turfjs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/turfjs-build.js +1 -0
  3. data/lib/turfjs.rb +37 -0
  4. metadata +78 -0
@@ -0,0 +1 @@
1
+ !function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){(function(t){const e=n(2);t.turf=e,t.turfAPIs=()=>Object.keys(e).filter(t=>e[t].constructor===Function)}).call(this,n(1))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){!function(t){"use strict";function e(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.bbox,i=n.id;if(void 0===t)throw new Error("geometry is required");if(e&&e.constructor!==Object)throw new Error("properties must be an Object");r&&N(r),i&&C(i);var o={type:"Feature"};return i&&(o.id=i),r&&(o.bbox=r),o.properties=e||{},o.geometry=t,o}function n(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var i,s=n.bbox;if(!t)throw new Error("type is required");if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");switch(s&&N(s),t){case"Point":i=r(e).geometry;break;case"LineString":i=a(e).geometry;break;case"Polygon":i=o(e).geometry;break;case"MultiPoint":i=l(e).geometry;break;case"MultiLineString":i=h(e).geometry;break;case"MultiPolygon":i=p(e).geometry;break;default:throw new Error(t+" is invalid")}return s&&(i.bbox=s),i}function r(t,n,r){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(!b(t[0])||!b(t[1]))throw new Error("coordinates must contain numbers");return e({type:"Point",coordinates:t},n,r)}function i(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");return c(t.map((function(t){return r(t,e)})),n)}function o(t,n,r){if(!t)throw new Error("coordinates is required");for(var i=0;i<t.length;i++){var o=t[i];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++){if(0===i&&0===s&&!b(o[0][0])||!b(o[0][1]))throw new Error("coordinates must contain numbers");if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}}return e({type:"Polygon",coordinates:t},n,r)}function s(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");return c(t.map((function(t){return o(t,e)})),n)}function a(t,n,r){if(!t)throw new Error("coordinates is required");if(t.length<2)throw new Error("coordinates must be an array of two or more positions");if(!b(t[0][1])||!b(t[0][1]))throw new Error("coordinates must contain numbers");return e({type:"LineString",coordinates:t},n,r)}function u(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");return c(t.map((function(t){return a(t,e)})),n)}function c(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.id;if(!t)throw new Error("No features passed");if(!Array.isArray(t))throw new Error("features must be an Array");n&&N(n),r&&C(r);var i={type:"FeatureCollection"};return r&&(i.id=r),n&&(i.bbox=n),i.features=t,i}function h(t,n,r){if(!t)throw new Error("coordinates is required");return e({type:"MultiLineString",coordinates:t},n,r)}function l(t,n,r){if(!t)throw new Error("coordinates is required");return e({type:"MultiPoint",coordinates:t},n,r)}function p(t,n,r){if(!t)throw new Error("coordinates is required");return e({type:"MultiPolygon",coordinates:t},n,r)}function f(t,n,r){if(!t)throw new Error("geometries is required");if(!Array.isArray(t))throw new Error("geometries must be an Array");return e({type:"GeometryCollection",geometries:t},n,r)}function g(t,e){if(null==t||isNaN(t))throw new Error("num is required");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 d(t,e){if(null==t)throw new Error("radians is required");if(e&&"string"!=typeof e)throw new Error("units must be a string");var n=bo[e||"kilometers"];if(!n)throw new Error(e+" units is invalid");return t*n}function y(t,e){if(null==t)throw new Error("distance is required");if(e&&"string"!=typeof e)throw new Error("units must be a string");var n=bo[e||"kilometers"];if(!n)throw new Error(e+" units is invalid");return t/n}function _(t,e){return v(y(t,e))}function m(t){if(null==t)throw new Error("bearing is required");var e=t%360;return e<0&&(e+=360),e}function v(t){if(null==t)throw new Error("radians is required");return t%(2*Math.PI)*180/Math.PI}function x(t){if(null==t)throw new Error("degrees is required");return t%360*Math.PI/180}function E(t,e,n){if(null==t)throw new Error("length is required");if(!(t>=0))throw new Error("length must be a positive number");return d(y(t,e),n||"kilometers")}function w(t,e,n){if(null==t)throw new Error("area is required");if(!(t>=0))throw new Error("area must be a positive number");var r=No[e||"meters"];if(!r)throw new Error("invalid original units");var i=No[n||"kilometers"];if(!i)throw new Error("invalid final units");return t/r*i}function b(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function I(t){return!!t&&t.constructor===Object}function N(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(!b(t))throw new Error("bbox must only contain numbers")}))}function C(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}function S(t,e,n){if(null!==t)for(var r,i,o,s,a,u,c,h,l=0,p=0,f=t.type,g="FeatureCollection"===f,d="Feature"===f,y=g?t.features.length:1,_=0;_<y;_++){a=(h=!!(c=g?t.features[_].geometry:d?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var m=0;m<a;m++){var v=0,x=0;if(null!==(s=h?c.geometries[m]:c)){u=s.coordinates;var E=s.type;switch(l=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":e(u,p,_,v,x),p++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++)e(u[r],p,_,v,x),p++,"MultiPoint"===E&&v++;"LineString"===E&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-l;i++)e(u[r][i],p,_,v,x),p++;"MultiLineString"===E&&v++,"Polygon"===E&&x++}"Polygon"===E&&v++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for("MultiPolygon"===E&&(x=0),i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-l;o++)e(u[r][i][o],p,_,v,x),p++;x++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)S(s.geometries[r],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function M(t,e,n,r){var i=n;return S(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i}function L(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function P(t,e,n){var r=n;return L(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function O(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function R(t,e,n){var r=n;return O(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function T(t){var e=[];return S(t,(function(t){e.push(t)})),e}function A(t,e){var n,r,i,o,s,a,u,c,h,l,p=0,f="FeatureCollection"===t.type,g="Feature"===t.type,d=f?t.features.length:1;for(n=0;n<d;n++){for(a=f?t.features[n].geometry:g?t.geometry:t,c=f?t.features[n].properties:g?t.properties:{},h=f?t.features[n].bbox:g?t.bbox:void 0,l=f?t.features[n].id:g?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,p,c,h,l);break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)e(o.geometries[r],p,c,h,l);break;default:throw new Error("Unknown Geometry Type")}else e(null,p,c,h,l);p++}}function D(t,e,n){var r=n;return A(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r}function F(t,n){A(t,(function(t,r,i,o,s){var a,u=null===t?null:t.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return void n(e(t,i,{bbox:o,id:s}),r,0)}switch(u){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}t.coordinates.forEach((function(t,o){n(e({type:a,coordinates:t},i),r,o)}))}))}function q(t,e,n){var r=n;return F(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function G(t,e){F(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;"Point"!==o&&"MultiPoint"!==o&&M(t,(function(o,s,u,c,h,l){var p=a([o,s],t.properties);return e(p,n,r,l,i),i++,s}))}}))}function B(t,e,n){var r=n,i=!1;return G(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}function k(t,e){if(!t)throw new Error("geojson is required");F(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":e(t,n,r,0,0);break;case"Polygon":for(var s=0;s<o.length;s++)e(a(o[s],t.properties),n,r,s)}}}))}function z(t,e,n){var r=n;return k(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r}function j(t){var e=[1/0,1/0,-1/0,-1/0];return S(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function X(t){if(!t)throw new Error("obj is required");var e=U(t);if(e.length>1&&b(e[0])&&b(e[1]))return e;throw new Error("Coordinate is not a valid Point")}function U(t){if(!t)throw new Error("obj is required");var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return Y(e),e;throw new Error("No valid coordinates")}function Y(t){if(t.length>1&&b(t[0])&&b(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Y(t[0]);throw new Error("coordinates must only contain numbers")}function V(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 H(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 W(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");for(var r=0;r<t.features.length;r++){var i=t.features[r];if(!i||"Feature"!==i.type||!i.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!i.geometry||i.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+i.geometry.type)}}function J(t){if(!t)throw new Error("geojson is required");if(void 0!==t.geometry)return t.geometry;if(t.coordinates||t.geometries)return t;throw new Error("geojson must be a valid Feature or Geometry Object")}function Z(){throw new Error("invariant.getGeomType has been deprecated in v5.0 in favor of invariant.getType")}function K(t,e){if(!t)throw new Error((e||"geojson")+" is required");if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error((e||"geojson")+" is invalid")}function Q(t,e,n){n=n||{};for(var r=Object.keys(Lo),i=0;i<r.length;i++){var o=r[i],s=n[o];s=null!=s?s:Lo[o],Po[o]=s}Po.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e);var a=function(t){var e=[],n=0;return t.rows,t.cols,t.cells.forEach((function(r,i){r.forEach((function(r,o){if(void 0!==r&&!function(t){return 5===t.cval||10===t.cval}(r)&&!tt(r)){var s=function(t,e,n){var r,i,o,s=t.length,a=[],u=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],c=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],h=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],l=(t[e][n],t[e][n]),p=l.cval,f=nt(l,o=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"][p]);a.push([n+f[0],e+f[1]]),f=nt(l,o=h[p]),a.push([n+f[0],e+f[1]]),et(l);for(var g=n+u[p],d=e+c[p],y=p;g>=0&&d>=0&&d<s&&(g!=n||d!=e)&&void 0!==(l=t[d][g]);){if(0===(p=l.cval)||15===p)return{path:a,info:"mergeable"};o=h[p],r=u[p],i=c[p],5!==p&&10!==p||(5===p?l.flipped?-1===c[y]?(o="left",r=-1,i=0):(o="right",r=1,i=0):-1===u[y]&&(o="bottom",r=0,i=-1):10===p&&(l.flipped?-1===u[y]?(o="top",r=0,i=1):(o="bottom",r=0,i=-1):1===c[y]&&(o="left",r=-1,i=0))),f=nt(l,o),a.push([g+f[0],d+f[1]]),et(l),g+=r,d+=i,y=p}return{path:a,info:"closed"}}(t.cells,i,o),a=!1;if("mergeable"===s.info)for(var u=s.path[s.path.length-1][0],c=s.path[s.path.length-1][1],h=n-1;h>=0;h--)if(Math.abs(e[h][0][0]-u)<=1e-7&&Math.abs(e[h][0][1]-c)<=1e-7){for(var l=s.path.length-2;l>=0;--l)e[h].unshift(s.path[l]);a=!0;break}a||(e[n++]=s.path)}}))})),e}(function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=0;o<n;++o){i.cells[o]=[];for(var s=0;s<r;++s){var a=0,u=t[o+1][s],c=t[o+1][s+1],h=t[o][s+1],l=t[o][s];if(!(isNaN(u)||isNaN(c)||isNaN(h)||isNaN(l))){a|=u>=e?8:0,a|=c>=e?4:0,a|=h>=e?2:0;var p,f,g,d,y=!1;if(5==(a|=l>=e?1:0)||10===a){var _=(u+c+h+l)/4;5===a&&_<e?(a=10,y=!0):10===a&&_<e&&(a=5,y=!0)}0!==a&&15!==a&&(p=f=g=d=.5,1===a?(g=1-$(e,u,l),f=1-$(e,h,l)):2===a?(f=$(e,l,h),d=1-$(e,c,h)):3===a?(g=1-$(e,u,l),d=1-$(e,c,h)):4===a?(p=$(e,u,c),d=$(e,h,c)):5===a?(p=$(e,u,c),d=$(e,h,c),f=1-$(e,h,l),g=1-$(e,u,l)):6===a?(f=$(e,l,h),p=$(e,u,c)):7===a?(g=1-$(e,u,l),p=$(e,u,c)):8===a?(g=$(e,l,u),p=1-$(e,c,u)):9===a?(f=1-$(e,h,l),p=1-$(e,c,u)):10===a?(p=1-$(e,c,u),d=1-$(e,c,h),f=$(e,l,h),g=$(e,l,u)):11===a?(p=1-$(e,c,u),d=1-$(e,c,h)):12===a?(g=$(e,l,u),d=$(e,h,c)):13===a?(f=1-$(e,h,l),d=$(e,h,c)):14===a?(g=$(e,l,u),f=$(e,l,h)):console.log("MarchingSquaresJS-isoContours: Illegal cval detected: "+a),i.cells[o][s]={cval:a,flipped:y,top:p,right:d,bottom:f,left:g})}}}return i}(t,e));return"function"==typeof Po.successCallback&&Po.successCallback(a),a}function $(t,e,n){return(t-e)/(n-e)}function tt(t){return 0===t.cval||15===t.cval}function et(t){tt(t)||5===t.cval||10===t.cval||(t.cval=15)}function nt(t,e){return"top"===e?[t.top,1]:"bottom"===e?[t.bottom,0]:"right"===e?[1,t.right]:"left"===e?[0,t.left]:void 0}function rt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function it(t,e){if(!(this instanceof it))return new it(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function ot(t,e){st(t,0,t.children.length,e,t)}function st(t,e,n,r,i){i||(i=gt(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<n;s++)o=t.children[s],at(i,t.leaf?r(o):o);return i}function at(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function ut(t,e){return t.minX-e.minX}function ct(t,e){return t.minY-e.minY}function ht(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function lt(t){return t.maxX-t.minX+(t.maxY-t.minY)}function pt(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function ft(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function gt(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dt(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(o=e+Math.ceil((n-e)/r/2)*r,Oo(t,o,e,n,i),s.push(e,o,o,n))}function yt(t,e){return t(e={exports:{}},e.exports),e.exports}function _t(t,e){if(!(this instanceof _t))return new _t(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||function(t,e){return t<e?-1:t>e?1:0},this.length>0)for(var n=(this.length>>1)-1;n>=0;n--)this._down(n)}function mt(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;for(var r,i=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>r[0]&&(r=s),s[1]<n[1]&&(n=s),s[1]>i[1]&&(i=s)}var a=[e,n,r,i],u=a.slice();for(o=0;o<t.length;o++)Uo(t[o],a)||u.push(t[o]);var c=ko(u),h=[];for(o=0;o<c.length;o++)h.push(u[c[o]]);return h}(t),o=Ro(16,["[0]","[1]","[0]","[1]"]).load(t),s=[],a=0;a<i.length;a++){var u=i[a];o.remove(u),r=bt(u,r),s.push(r)}var c=Ro(16);for(a=0;a<s.length;a++)c.insert(wt(s[a]));for(var h=e*e,l=n*n;s.length;){var p=s.shift(),f=p.p,g=p.next.p,d=It(f,g);if(!(d<l)){var y=d/h;(u=function(t,e,n,r,i,o,s){for(var a=new jo(null,vt),u=t.data;u;){for(var c=0;c<u.children.length;c++){var h=u.children[c],l=u.leaf?Nt(h,n,r):function(t,e,n){if(xt(t,n)||xt(e,n))return 0;var r=Ct(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Ct(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Ct(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Ct(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}(n,r,h);l>o||a.push({node:h,dist:l})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),f=p.node,g=Nt(f,e,n),d=Nt(f,r,i);if(p.dist<g&&p.dist<d&&Et(n,f,s)&&Et(r,f,s))return f}(u=a.pop())&&(u=u.node)}return null}(o,p.prev.p,f,g,p.next.next.p,y,c))&&Math.min(It(u,f),It(u,g))<=y&&(s.push(p),s.push(bt(u,p)),o.remove(u),c.remove(p),c.insert(wt(p)),c.insert(wt(p.next)))}}p=r;var _=[];do{_.push(p.p),p=p.next}while(p!==r);return _.push(p.p),_}function vt(t,e){return t.dist-e.dist}function xt(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Et(t,e,n){for(var r=Math.min(t[0],e[0]),i=Math.min(t[1],e[1]),o=Math.max(t[0],e[0]),s=Math.max(t[1],e[1]),a=n.search({minX:r,minY:i,maxX:o,maxY:s}),u=0;u<a.length;u++)if(function(t,e,n,r){return t!==r&&e!==n&&Yo(t,e,n)>0!=Yo(t,e,r)>0&&Yo(n,r,t)>0!=Yo(n,r,e)>0}(a[u].p,a[u].next.p,t,e))return!1;return!0}function wt(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 bt(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 It(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Nt(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Ct(t,e,n,r,i,o,s,a){var u,c,h,l,p=n-t,f=r-e,g=s-i,d=a-o,y=t-i,_=e-o,m=p*p+f*f,v=p*g+f*d,x=g*g+d*d,E=p*y+f*_,w=g*y+d*_,b=m*x-v*v,I=b,N=b;0===b?(c=0,I=1,l=w,N=x):(l=m*w-v*E,(c=v*w-x*E)<0?(c=0,l=w,N=x):c>I&&(c=I,l=w+v,N=x)),l<0?(l=0,-E<0?c=0:-E>m?c=I:(c=-E,I=m)):l>N&&(l=N,-E+v<0?c=0:-E+v>m?c=I:(c=-E+v,I=m));var C=(1-(h=0===l?0:l/N))*i+h*s-((1-(u=0===c?0:c/I))*t+u*n),S=(1-h)*o+h*a-((1-u)*e+u*r);return C*C+S*S}function St(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.concavity||1/0,r=[];if(S(t,(function(t){r.push([t[0],t[1]])})),!r.length)return null;var i=Vo(r,n);return i.length>3?o([i]):null}function Mt(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.ignoreBoundary;if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var i=X(t),o=U(e),s=e.geometry?e.geometry.type:e.type,a=e.bbox;if(a&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(i,a))return!1;"Polygon"===s&&(o=[o]);for(var u=0,c=!1;u<o.length&&!c;u++)if(Lt(i,o[u][0],r)){for(var h=!1,l=1;l<o[u].length&&!h;)Lt(i,o[u][l],!r)&&(h=!0),l++;h||(c=!0)}return c}function Lt(t,e,n){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],u=e[o][0],c=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+c*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(c-t[1])<=0)return!n;a>t[1]!=c>t[1]&&t[0]<(u-s)*(t[1]-a)/(c-a)+s&&(r=!r)}return r}function Pt(t,e){var n=[];return A(e,(function(e){O(t,(function(t){Mt(t,e)&&n.push(t)}))})),c(n)}function Ot(t,e){if("FeatureCollection"!==t.type)throw new Error("points must be a FeatureCollection");var n=!1;return c(function(t){if(t.length<3)return[];t.sort(Tt);for(var e,n,r,i,o,s,a=t.length-1,u=t[a].x,c=t[0].x,h=t[a].y,l=h;a--;)t[a].y<h&&(h=t[a].y),t[a].y>l&&(l=t[a].y);var p,f=c-u,g=l-h,d=f>g?f:g,y=.5*(c+u),_=.5*(l+h),m=[new Rt({x:y-20*d,y:_-d,__sentinel:!0},{x:y,y:_+20*d,__sentinel:!0},{x:y+20*d,y:_-d,__sentinel:!0})],v=[],x=[];for(a=t.length;a--;){for(x.length=0,p=m.length;p--;)(f=t[a].x-m[p].x)>0&&f*f>m[p].r?(v.push(m[p]),m.splice(p,1)):f*f+(g=t[a].y-m[p].y)*g>m[p].r||(x.push(m[p].a,m[p].b,m[p].b,m[p].c,m[p].c,m[p].a),m.splice(p,1));for(At(x),p=x.length;p;)n=x[--p],e=x[--p],r=t[a],i=n.x-e.x,o=n.y-e.y,s=2*(i*(r.y-n.y)-o*(r.x-n.x)),Math.abs(s)>1e-12&&m.push(new Rt(e,n,r))}for(Array.prototype.push.apply(v,m),a=v.length;a--;)(v[a].a.__sentinel||v[a].b.__sentinel||v[a].c.__sentinel)&&v.splice(a,1);return v}(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],s={};return n?(e.push(t.a.z),r.push(t.b.z),i.push(t.c.z)):s={a:t.a.z,b:t.b.z,c:t.c.z},o([[e,r,i,e]],s)})))}function Rt(t,e,n){this.a=t,this.b=e,this.c=n;var r,i,o=e.x-t.x,s=e.y-t.y,a=n.x-t.x,u=n.y-t.y,c=o*(t.x+e.x)+s*(t.y+e.y),h=a*(t.x+n.x)+u*(t.y+n.y),l=2*(o*(n.y-e.y)-s*(n.x-e.x));this.x=(u*c-s*h)/l,this.y=(o*h-a*c)/l,r=this.x-t.x,i=this.y-t.y,this.r=r*r+i*i}function Tt(t,e){return e.x-t.x}function At(t){var e,n,r,i,o,s=t.length;t:for(;s;)for(n=t[--s],e=t[--s],r=s;r;)if(o=t[--r],i=t[--r],e===i&&n===o||e===o&&n===i){t.splice(s,2),t.splice(r,2),s-=2;continue t}}function Dt(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.units,i=X(t),o=X(e),s=x(o[1]-i[1]),a=x(o[0]-i[0]),u=x(i[1]),c=x(o[1]),h=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(u)*Math.cos(c);return d(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),r)}function Ft(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return qt(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(n){switch(n){case"type":case"features":return;default:e[n]=t[n]}})),e.features=t.features.map((function(t){return qt(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Gt(t);default:throw new Error("unknown GeoJSON type")}}function qt(t){var e={type:"Feature"};return Object.keys(t).forEach((function(n){switch(n){case"type":case"properties":case"geometry":return;default:e[n]=t[n]}})),e.properties=function t(e){var n={};return e?(Object.keys(e).forEach((function(r){var i=e[r];"object"==typeof i?null===i?n[r]=null:i.length?n[r]=i.map((function(t){return t})):n[r]=t(i):n[r]=i})),n):n}(t.properties),e.geometry=Gt(t.geometry),e}function Gt(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Gt(t)})),e):(e.coordinates=function t(e){return"object"!=typeof e[0]?e.slice():e.map((function(e){return t(e)}))}(t.coordinates),e)}function Bt(t,e){function n(t,e){e.length&&e.pop();for(var n=u[t<0?~t:t],r=0,i=n.length;r<i;++r)e.push(a(n[r],r));t<0&&Zo(e,i)}function r(t){return a(t)}function i(t){for(var e=[],r=0,i=t.length;r<i;++r)n(t[r],e);return e.length<2&&e.push(e[0]),e}function o(t){for(var e=i(t);e.length<4;)e.push(e[0]);return e}function s(t){return t.map(o)}var a=Jo(t.transform),u=t.arcs;return function t(e){var n,o=e.type;switch(o){case"GeometryCollection":return{type:o,geometries:e.geometries.map(t)};case"Point":n=r(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(r);break;case"LineString":n=i(e.arcs);break;case"MultiLineString":n=e.arcs.map(i);break;case"Polygon":n=s(e.arcs);break;case"MultiPolygon":n=e.arcs.map(s);break;default:return null}return{type:o,coordinates:n}}(e)}function kt(t,e){function n(t){t.forEach((function(e){e.forEach((function(e){(i[e=e<0?~e:e]||(i[e]=[])).push(t)}))})),o.push(t)}function r(e){return function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++n<r;)e=i,i=t[n],o+=e[0]*i[1]-e[1]*i[0];return Math.abs(o)}(Bt(t,{type:"Polygon",arcs:[e]}).coordinates[0])}var i={},o=[],s=[];return e.forEach((function t(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"Polygon":n(e.arcs);break;case"MultiPolygon":e.arcs.forEach(n)}})),o.forEach((function(t){if(!t._){var e=[],n=[t];for(t._=1,s.push(e);t=n.pop();)e.push(t),t.forEach((function(t){t.forEach((function(t){i[t<0?~t:t].forEach((function(t){t._||(t._=1,n.push(t))}))}))}))}})),o.forEach((function(t){delete t._})),{type:"MultiPolygon",arcs:s.map((function(e){var n,o=[];if(e.forEach((function(t){t.forEach((function(t){t.forEach((function(t){i[t<0?~t:t].length<2&&o.push(t)}))}))})),(n=(o=Ko(t,o)).length)>1)for(var s,a,u=1,c=r(o[0]);u<n;++u)(s=r(o[u]))>c&&(a=o[0],o[0]=o[u],o[u]=a,c=s);return o}))}}function zt(t,e,n){for(var r,i=e+(n---e>>1);e<i;++e,--n)r=t[e],t[e]=t[n],t[n]=r}function jt(t){return null==t?{type:null}:("FeatureCollection"===t.type?function(t){var e={type:"GeometryCollection",geometries:t.features.map(Xt)};return null!=t.bbox&&(e.bbox=t.bbox),e}:"Feature"===t.type?Xt:Ut)(t)}function Xt(t){var e,n=Ut(t.geometry);for(e in null!=t.id&&(n.id=t.id),null!=t.bbox&&(n.bbox=t.bbox),t.properties){n.properties=t.properties;break}return n}function Ut(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(Ut)}:"Point"===t.type||"MultiPoint"===t.type?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return null!=t.bbox&&(e.bbox=t.bbox),e}function Yt(t){var e,n=t[0],r=t[1];return r<n&&(e=n,n=r,r=e),n+31*r}function Vt(t,e){var n,r=t[0],i=t[1],o=e[0],s=e[1];return i<r&&(n=r,r=i,i=n),s<o&&(n=o,o=s,s=n),r===o&&i===s}function Ht(t){return t[0].toString()+","+t[1].toString()}function Wt(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==K(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=Ft(t));var r=function(t){var e={};F(t,(function(t){e[t.geometry.type]=!0}));var n=Object.keys(e);return 1===n.length?n[0]:null}(t);if(!r)throw new Error("geojson must be homogenous");switch(r){case"LineString":return function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==K(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=Ft(t));var r=[],i=z(t,(function(t,e){return function(t,e){var n,r=t.geometry.coordinates,i=e.geometry.coordinates,o=Ht(r[0]),s=Ht(r[r.length-1]),u=Ht(i[0]),c=Ht(i[i.length-1]);if(o===c)n=i.concat(r.slice(1));else if(u===s)n=r.concat(i.slice(1));else if(o===u)n=r.slice(1).reverse().concat(i);else{if(s!==c)return null;n=r.concat(i.reverse().slice(1))}return a(n)}(t,e)||(r.push(t),e)}));return i&&r.push(i),r.length?1===r.length?r[0]:h(r.map((function(t){return t.coordinates}))):null}(t,e);case"Polygon":return function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==K(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=Ft(t));var r=[];F(t,(function(t){r.push(t.geometry)}));var i=ss({geoms:f(r).geometry});return Qo(i,i.objects.geoms.geometries)}(t,e);default:throw new Error(r+" is not supported")}}function Jt(t,n){var r="object"==typeof n?n.mutate:n;if(!t)throw new Error("geojson is required");var i=K(t),o=[];switch(i){case"LineString":o=Zt(t);break;case"MultiLineString":case"Polygon":U(t).forEach((function(t){o.push(Zt(t))}));break;case"MultiPolygon":U(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(Zt(t))})),o.push(e)}));break;case"Point":return t;case"MultiPoint":var s={};U(t).forEach((function(t){var e=t.join("-");s.hasOwnProperty(e)||(o.push(t),s[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):e({type:i,coordinates:o},t.properties,t.bbox,t.id)}function Zt(t){var e=U(t);if(2===e.length&&!function(t,e){return t[0]===e[0]&&t[1]===e[1]}(e[0],e[1]))return e;var n,r,i,o=[],s=e.length-1;o.push(e[0]);for(var a=1;a<s;a++)n=e[a-1],r=e[a],function(t,e,n){var r=n[0],i=n[1],o=t[0],s=t[1],a=e[0],u=e[1],c=a-o,h=u-s;return(r-o)*h-(i-s)*c==0&&(Math.abs(c)>=Math.abs(h)?c>0?o<=r&&r<=a:a<=r&&r<=o:h>0?s<=i&&i<=u:u<=i&&i<=s)}(n,i=e[a+1],r)||o.push(r);return o.push(i),o}function Kt(t,e){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function Qt(t,e,n){var r=e.x,i=e.y,o=n.x-r,s=n.y-i;if(0!==o||0!==s){var a=((t.x-r)*o+(t.y-i)*s)/(o*o+s*s);a>1?(r=n.x,i=n.y):a>0&&(r+=o*a,i+=s*a)}return(o=t.x-r)*o+(s=t.y-i)*s}function $t(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return function(t,e){var n=t.length-1,r=[t[0]];return function t(e,n,r,i,o){for(var s,a=i,u=n+1;u<r;u++){var c=Qt(e[u],e[n],e[r]);c>a&&(s=u,a=c)}a>i&&(s-n>1&&t(e,n,s,i,o),o.push(e[s]),r-s>1&&t(e,s,r,i,o))}(t,0,n,e,r),r.push(t[n]),r}(t=n?t:function(t,e){for(var n,r=t[0],i=[r],o=1,s=t.length;o<s;o++)Kt(n=t[o],r)>e&&(i.push(n),r=n);return r!==n&&i.push(n),i}(t,r),r)}function te(t,e,n){return $t(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,n).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function ee(t,e,n){return t.map((function(t){var r=t.map((function(t){return{x:t[0],y:t[1]}}));if(r.length<4)throw new Error("invalid polygon");for(var i=$t(r,e,n).map((function(t){return[t.x,t.y]}));!function(t){return!(t.length<3||3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}(i);)i=$t(r,e-=.01*e,n).map((function(t){return[t.x,t.y]}));return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function ne(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.resolution||1e4,r=e.sharpness||.85;if(!t)throw new Error("line is required");if(!b(n))throw new Error("resolution must be an number");if(!b(r))throw new Error("sharpness must be an number");for(var i=[],o=new as({points:J(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),duration:n,sharpness:r}),s=0;s<o.duration;s+=10){var u=o.pos(s);Math.floor(s/100)%2==0&&i.push([u.x,u.y])}return a(i,t.properties)}function re(t){N(t);var e=Number(t[0]),n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[e,n];return o([[s,[r,n],[r,i],[e,i],s]])}function ie(t){return re(j(t))}function oe(t){var e=t[0],n=t[1],r=t[2],i=t[3];if(Dt(t.slice(0,2),[r,n])>=Dt(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var s=(e+r)/2;return[s-(i-n)/2,n,s+(i-n)/2,i]}function se(t,e,n,i){if(!I(i=i||{}))throw new Error("options is invalid");var o=i.units,s=i.properties,a=X(t),u=x(a[0]),c=x(a[1]),h=x(n),l=y(e,o),p=Math.asin(Math.sin(c)*Math.cos(l)+Math.cos(c)*Math.sin(l)*Math.cos(h));return r([v(u+Math.atan2(Math.sin(h)*Math.sin(l)*Math.cos(c),Math.cos(l)-Math.sin(c)*Math.sin(p))),v(p)],s)}function ae(t,e,n){var r=(n=n||{}).steps||64,i=n.properties;if(!t)throw new Error("center is required");if(!e)throw new Error("radius is required");if("object"!=typeof n)throw new Error("options must be an object");if("number"!=typeof r)throw new Error("steps must be a number");r=r||64,i=i||t.properties||{};for(var s=[],a=0;a<r;a++)s.push(se(t,e,-360*a/r,n).geometry.coordinates);return s.push(s[0]),o([s],i)}function ue(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");if(!0===n.final)return function(t,e){var n=ue(e,t);return(n+180)%360}(t,e);var r=X(t),i=X(e),o=x(r[0]),s=x(i[0]),a=x(r[1]),u=x(i[1]),c=Math.sin(s-o)*Math.cos(u),h=Math.cos(a)*Math.sin(u)-Math.sin(a)*Math.cos(u)*Math.cos(s-o);return v(Math.atan2(c,h))}function ce(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.properties;if(!t)throw new Error("geojson is required");var i=j(t);return r([(i[0]+i[2])/2,(i[1]+i[3])/2],n)}function he(t,e){var n=0,i=0,o=0;return S(t,(function(t){n+=t[0],i+=t[1],o++}),!0),r([n/o,i/o],e)}function le(t){var e=[];return"FeatureCollection"===t.type?O(t,(function(t){S(t,(function(n){e.push(r(n,t.properties))}))})):S(t,(function(n){e.push(r(n,t.properties))})),c(e)}function pe(t,e,n){n=n||2;var r,i,o,s,a,u,c,h=e&&e.length,l=h?e[0]*n:t.length,p=fe(t,0,l,n,!0),f=[];if(!p)return f;if(h&&(p=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=fe(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(function(t){var e=t,n=t;do{e.x<n.x&&(n=e),e=e.next}while(e!==t);return n}(s));for(a.sort(de),i=0;i<a.length;i++)!function(t,e){if(e=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s){if(s=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===s)return n.prev;var u,c=n,h=n.x,l=n.y,p=1/0;for(r=n.next;r!==c;)i>=r.x&&r.x>=h&&i!==r.x&&_e(o<l?i:s,o,h,l,o<l?s:i,o,r.x,r.y)&&((u=Math.abs(o-r.y)/(i-r.x))<p||u===p&&r.x>n.x)&&Ee(r,t)&&(n=r,p=u),r=r.next;return n}(t,e)){var n=we(e,t);ge(n,n.next)}}(a[i],n),n=ge(n,n.next);return n}(t,e,p,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var g=n;g<l;g+=n)(a=t[g])<r&&(r=a),(u=t[g+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);c=0!==(c=Math.max(o-r,s-i))?1/c:0}return function t(e,n,r,i,o,s,a){if(e){!a&&s&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=ye(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,s,a,u,c=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<c&&(a++,r=r.nextZ);e++);for(u=c;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(s>1)}(i)}(e,i,o,s);for(var u,c,h=e;e.prev!==e.next;)if(u=e.prev,c=e.next,s?function(t,e,n,r){var i=t.prev,o=t,s=t.next;if(me(i,o,s)>=0)return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,u=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,c=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,l=ye(a,u,e,n,r),p=ye(c,h,e,n,r),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&_e(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&me(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&_e(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&me(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}(e,i,o,s):function(t){var e=t.prev,n=t,r=t.next;if(me(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(_e(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&me(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(e))n.push(u.i/r),n.push(e.i/r),n.push(c.i/r),Ie(e),e=c.next,h=c.next;else if((e=c)===h){a?1===a?t(e=function(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!ve(i,o)&&xe(i,r,r.next,o)&&Ee(i,o)&&Ee(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Ie(r),Ie(r.next),r=t=o),r=r.next}while(r!==t);return r}(e,n,r),n,r,i,o,s,2):2===a&&function(e,n,r,i,o,s){var a=e;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&function(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&&xe(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&Ee(t,e)&&Ee(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)}(a,u)){var c=we(a,u);return a=ge(a,a.next),c=ge(c,c.next),t(a,n,r,i,o,s),void t(c,n,r,i,o,s)}u=u.next}a=a.next}while(a!==e)}(e,n,r,i,o,s):t(ge(e),n,r,i,o,s,1);break}}}(p,f,n,r,i,c),f}function fe(t,e,n,r,i){var o,s;if(i===Ce(t,e,n,r)>0)for(o=e;o<n;o+=r)s=be(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=be(o,t[o],t[o+1],s);return s&&ve(s,s.next)&&(Ie(s),s=s.next),s}function ge(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!ve(r,r.next)&&0!==me(r.prev,r,r.next))r=r.next;else{if(Ie(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function de(t,e){return t.x-e.x}function ye(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function _e(t,e,n,r,i,o,s,a){return(i-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function me(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ve(t,e){return t.x===e.x&&t.y===e.y}function xe(t,e,n,r){return!!(ve(t,e)&&ve(n,r)||ve(t,r)&&ve(n,e))||me(t,e,n)>0!=me(t,e,r)>0&&me(n,r,t)>0!=me(n,r,e)>0}function Ee(t,e){return me(t.prev,t,t.next)<0?me(t,e,t.next)>=0&&me(t,t.prev,e)>=0:me(t,e,t.prev)<0||me(t,t.next,e)<0}function we(t,e){var n=new Ne(t.i,t.x,t.y),r=new Ne(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 be(t,e,n,r){var i=new Ne(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 Ie(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 Ne(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ce(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}function Se(t){var e=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n}(t),n=us(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 s=0;s<i.length;s+=3){var a=i.slice(s,s+3);a.push(i[s]),r.push(o([a]))}return r}function Me(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n,r=1/0;return O(e,(function(e,i){var o=Dt(t,e);o<r&&((n=Ft(e)).properties.featureIndex=i,n.properties.distanceToPoint=o,r=o)})),n}function Le(t,e,n,r,i){!function t(e,n,r,i,o){for(;i>r;){if(i-r>600){var s=i-r+1,a=n-r+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(a-s/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-a*c/s+h)),Math.min(i,Math.floor(n+(s-a)*c/s+h)),o)}var l=e[n],p=r,f=i;for(Pe(e,r,n),o(e[i],l)>0&&Pe(e,r,i);p<f;){for(Pe(e,p,f),p++,f--;o(e[p],l)<0;)p++;for(;o(e[f],l)>0;)f--}0===o(e[r],l)?Pe(e,r,f):Pe(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}}(t,e,n||0,r||t.length-1,i||function(t,e){return t<e?-1:t>e?1:0})}function Pe(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Oe(t,e){if(!(this instanceof Oe))return new Oe(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function Re(t,e){Te(t,0,t.children.length,e,t)}function Te(t,e,n,r,i){i||(i=ze(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<n;s++)o=t.children[s],Ae(i,t.leaf?r(o):o);return i}function Ae(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function De(t,e){return t.minX-e.minX}function Fe(t,e){return t.minY-e.minY}function qe(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ge(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Be(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function ke(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function ze(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function je(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(Le(t,o=e+Math.ceil((n-e)/r/2)*r,e,n,i),s.push(e,o,o,n))}function Xe(t){var e=Oe(t);return e.insert=function(t){if(Array.isArray(t)){var e=t;(t=Ue(e)).bbox=e}else t.bbox=t.bbox?t.bbox:Ye(t);return Oe.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){var n=Ue(t);n.bbox=t,e.push(n)})):O(t,(function(t){t.bbox=t.bbox?t.bbox:Ye(t),e.push(t)})),Oe.prototype.load.call(this,e)},e.remove=function(t){if(Array.isArray(t)){var e=t;(t=Ue(e)).bbox=e}return Oe.prototype.remove.call(this,t)},e.clear=function(){return Oe.prototype.clear.call(this)},e.search=function(t){return{type:"FeatureCollection",features:Oe.prototype.search.call(this,this.toBBox(t))}},e.collides=function(t){return Oe.prototype.collides.call(this,this.toBBox(t))},e.all=function(){return{type:"FeatureCollection",features:Oe.prototype.all.call(this)}},e.toJSON=function(){return Oe.prototype.toJSON.call(this)},e.fromJSON=function(t){return Oe.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;return{minX:(e=t.bbox?t.bbox:Array.isArray(t)&&4===t.length?t:Ye(t))[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}function Ue(t){var e=[t[0],t[1]],n=[t[0],t[3]],r=[t[2],t[3]];return{type:"Feature",bbox:t,properties:{},geometry:{type:"Polygon",coordinates:[[e,[t[2],t[1]],r,n,e]]}}}function Ye(t){var e=[1/0,1/0,-1/0,-1/0];return S(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function Ve(t){if(!t)throw new Error("geojson is required");var e=[];return F(t,(function(t){!function(t,e){var n=[],r=t.geometry;switch(r.type){case"Polygon":n=U(r);break;case"LineString":n=[U(r)]}n.forEach((function(n){(function(t,e){var n=[];return t.reduce((function(t,r){var i=a([t,r],e);return i.bbox=function(t,e){var n=t[0],r=t[1],i=e[0],o=e[1];return[n<i?n:i,r<o?r:o,n>i?n:i,r>o?r:o]}(t,r),n.push(i),r})),n})(n,t.properties).forEach((function(t){t.id=e.length,e.push(t)}))}))}(t,e)})),c(e)}function He(t,n){var r={},i=[];if("LineString"===t.type&&(t=e(t)),"LineString"===n.type&&(n=e(n)),"Feature"===t.type&&"Feature"===n.type&&"LineString"===t.geometry.type&&"LineString"===n.geometry.type&&2===t.geometry.coordinates.length&&2===n.geometry.coordinates.length){var o=We(t,n);return o&&i.push(o),c(i)}var s=Xe();return s.load(Ve(n)),O(Ve(t),(function(t){O(s.search(t),(function(e){var n=We(t,e);if(n){var o=U(n).join(",");r[o]||(r[o]=!0,i.push(n))}}))})),c(i)}function We(t,e){var n=U(t),i=U(e);if(2!==n.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==i.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var o=n[0][0],s=n[0][1],a=n[1][0],u=n[1][1],c=i[0][0],h=i[0][1],l=i[1][0],p=i[1][1],f=(p-h)*(a-o)-(l-c)*(u-s);if(0===f)return null;var g=((l-c)*(s-h)-(p-h)*(o-c))/f,d=((a-o)*(s-h)-(u-s)*(o-c))/f;return g>=0&&g<=1&&d>=0&&d<=1?r([o+g*(a-o),s+g*(u-s)]):null}function Je(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var i=t.geometry?t.geometry.type:t.type;if("LineString"!==i&&"MultiLineString"!==i)throw new Error("lines must be LineString or MultiLineString");var o=r([1/0,1/0],{dist:1/0}),s=0;return F(t,(function(t){for(var i=U(t),u=0;u<i.length-1;u++){var c=r(i[u]);c.properties.dist=Dt(e,c,n);var h=r(i[u+1]);h.properties.dist=Dt(e,h,n);var l=Dt(c,h,n),p=Math.max(c.properties.dist,h.properties.dist),f=ue(c,h),g=se(e,p,f+90,n),d=se(e,p,f-90,n),y=He(a([g.geometry.coordinates,d.geometry.coordinates]),a([c.geometry.coordinates,h.geometry.coordinates])),_=null;y.features.length>0&&((_=y.features[0]).properties.dist=Dt(e,_,n),_.properties.location=s+Dt(c,_,n)),c.properties.dist<o.properties.dist&&((o=c).properties.index=u,o.properties.location=s),h.properties.dist<o.properties.dist&&((o=h).properties.index=u+1,o.properties.location=s+l),_&&_.properties.dist<o.properties.dist&&((o=_).properties.index=u),s+=l}})),o}function Ze(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r,i=n.final;if(!t)throw new Error("start point is required");if(!e)throw new Error("end point is required");return(r=i?Ke(X(e),X(t)):Ke(X(t),X(e)))>180?-(360-r):r}function Ke(t,e){var n=x(t[1]),r=x(e[1]),i=x(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(v(Math.atan2(i,o))+360)%360}function Qe(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("from point is required");if(!e)throw new Error("to point is required");var i=X(t),o=X(e);return o[0]+=o[0]-i[0]>180?-360:i[0]-o[0]>180?360:0,E(function(t,e,n){var r=n=void 0===n?wo:Number(n),i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),c=Math.abs(u)>1e-11?s/u:Math.cos(i);return Math.sqrt(s*s+c*c*a*a)*r}(i,o),"meters",r)}function $e(t,e){return en(t,"mercator",e)}function tn(t,e){return en(t,"wgs84",e)}function en(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&b(t[0])?t="mercator"===e?nn(t):rn(t):(!0!==r&&(t=Ft(t)),S(t,(function(t){var n="mercator"===e?nn(t):rn(t);t[0]=n[0],t[1]=n[1]}))),t}function nn(t){var e=Math.PI/180,n=20037508.342789244,r=[6378137*(Math.abs(t[0])<=180?t[0]:t[0]-360*function(t){return t<0?-1:t>0?1:0}(t[0]))*e,6378137*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return r[0]>n&&(r[0]=n),r[0]<-n&&(r[0]=-n),r[1]>n&&(r[1]=n),r[1]<-n&&(r[1]=-n),r}function rn(t){var e=180/Math.PI;return[t[0]*e/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/6378137)))*e]}function on(t,n,i){if(!I(i=i||{}))throw new Error("options is invalid");if(!t)throw new Error("pt is required");if(Array.isArray(t)?t=r(t):"Point"===t.type?t=e(t):H(t,"Point","point"),!n)throw new Error("line is required");Array.isArray(n)?n=a(n):"LineString"===n.type?n=e(n):H(n,"LineString","line");var o=1/0,s=t.geometry.coordinates;return G(n,(function(t){var e=t.geometry.coordinates[0],n=t.geometry.coordinates[1],a=function(t,e,n,i){var o=i.mercator,s=!0!==o?Dt(e,t,i):sn(e,t,i),a=m(!0!==o?ue(e,t):Ze(e,t)),u=m(!0!==o?ue(e,n):Ze(e,n)),c=Math.abs(a-u);if(c>90)return s;var h=(u+180)%360,l=m(!0!==o?ue(n,t):Ze(n,t)),p=Math.abs(l-h);return p>180&&(p=Math.abs(p-360)),p>90?!0!==o?Dt(t,n,i):sn(t,n,i):!0!==o?s*Math.sin(x(c)):function(t,e,n,i){var o=0;(Math.abs(t[0])>=180||Math.abs(e[0])>=180||Math.abs(n[0])>=180)&&(o=t[0]>0||e[0]>0||n[0]>0?-180:180);var s=r(n),a=tn(function(t,e,n){var r=t[0],i=t[1],o=e[0]-r,s=e[1]-i,a=((n[0]-r)*o+(n[1]-i)*s)/(o*o+s*s);return[r+a*o,i+a*s]}($e([t[0]+o,t[1]]),$e([e[0]+o,e[1]]),$e([n[0]+o,n[1]])));return 0!==o&&(a[0]-=o),Qe(s,a,i)}(e,n,t,i)}(s,e,n,i);o>a&&(o=a)})),o}function sn(t,e,n){var r=n.units,i=0;Math.abs(t[0])>=180&&(i=t[0]>0?-180:180),Math.abs(e[0])>=180&&(i=e[0]>0?-180:180);var o=$e([t[0]+i,t[1]]),s=$e([e[0]+i,e[1]]),a=function(t){return t*t},u=a(o[0]-s[0])+a(o[1]-s[1]);return E(Math.sqrt(u),"meters",r)}function an(t){for(var n=function(t){return"FeatureCollection"!==t.type?"Feature"!==t.type?c([e(t)]):c([t]):t}(t),i=ce(n),o=!1,s=0;!o&&s<n.features.length;){var a,u=n.features[s].geometry,h=!1;if("Point"===u.type)i.geometry.coordinates[0]===u.coordinates[0]&&i.geometry.coordinates[1]===u.coordinates[1]&&(o=!0);else if("MultiPoint"===u.type){var l=!1;for(a=0;!l&&a<u.coordinates.length;)i.geometry.coordinates[0]===u.coordinates[a][0]&&i.geometry.coordinates[1]===u.coordinates[a][1]&&(o=!0,l=!0),a++}else if("LineString"===u.type)for(a=0;!h&&a<u.coordinates.length-1;)un(i.geometry.coordinates[0],i.geometry.coordinates[1],u.coordinates[a][0],u.coordinates[a][1],u.coordinates[a+1][0],u.coordinates[a+1][1])&&(h=!0,o=!0),a++;else if("MultiLineString"===u.type)for(var p=0;p<u.coordinates.length;){h=!1,a=0;for(var f=u.coordinates[p];!h&&a<f.length-1;)un(i.geometry.coordinates[0],i.geometry.coordinates[1],f[a][0],f[a][1],f[a+1][0],f[a+1][1])&&(h=!0,o=!0),a++;p++}else"Polygon"!==u.type&&"MultiPolygon"!==u.type||Mt(i,u)&&(o=!0);s++}if(o)return i;var g=c([]);for(s=0;s<n.features.length;s++)g.features=g.features.concat(le(n.features[s]).features);return r(Me(i,g).geometry.coordinates)}function un(t,e,n,r,i,o){return Math.sqrt((i-n)*(i-n)+(o-r)*(o-r))===Math.sqrt((t-n)*(t-n)+(e-r)*(e-r))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}function cn(t){return D(t,(function(t,e){return t+function t(e){var n,r=0;switch(e.type){case"Polygon":return hn(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)r+=hn(e.coordinates[n]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<e.geometries.length;n++)r+=t(e.geometries[n]);return r}}(e)}),0)}function hn(t){var e=0;if(t&&t.length>0){e+=Math.abs(ln(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(ln(t[n]))}return e}function ln(t){var e,n,r,i,o,s,a=0,u=t.length;if(u>2){for(s=0;s<u;s++)s===u-2?(r=u-2,i=u-1,o=0):s===u-1?(r=u-1,i=0,o=1):(r=s,i=s+1,o=s+2),e=t[r],n=t[i],a+=(pn(t[o][0])-pn(e[0]))*Math.sin(pn(n[1]));a=a*ls*ls/2}return a}function pn(t){return t*Math.PI/180}function fn(t,e){if(!I(e=e||{}))throw new Error("options is invalid");if(!t)throw new Error("geojson is required");return B(t,(function(t,n){var r=n.geometry.coordinates;return t+Dt(r[0],r[1],e)}),0)}function gn(t,e,n,r){if(!I(r=r||{}))throw new Error("options is invalid");var i,o=[];if("Feature"===t.type)i=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}for(var s,u,c,h=0,l=0;l<i.length&&!(e>=h&&l===i.length-1);l++){if(h>e&&0===o.length){if(!(s=e-h))return o.push(i[l]),a(o);u=ue(i[l],i[l-1])-180,c=se(i[l],s,u,r),o.push(c.geometry.coordinates)}if(h>=n)return(s=n-h)?(u=ue(i[l],i[l-1])-180,c=se(i[l],s,u,r),o.push(c.geometry.coordinates),a(o)):(o.push(i[l]),a(o));if(h>=e&&o.push(i[l]),l===i.length-1)return a(o);h+=Dt(i[l],i[l+1],r)}return a(i[i.length-1])}function dn(t,e,n){var r=(n=n||{}).ignoreEndVertices;if(!I(n))throw new Error("invalid options");if(!t)throw new Error("pt is required");if(!e)throw new Error("line is required");for(var i=X(t),o=U(e),s=0;s<o.length-1;s++){var a=!1;if(r&&(0===s&&(a="start"),s===o.length-2&&(a="end"),0===s&&s+1===o.length-1&&(a="both")),function(t,e,n,r){var i=n[0],o=n[1],s=t[0],a=t[1],u=e[0],c=e[1],h=u-s,l=c-a;return(n[0]-s)*l-(n[1]-a)*h==0&&(r?"start"===r?Math.abs(h)>=Math.abs(l)?h>0?s<i&&i<=u:u<=i&&i<s:l>0?a<o&&o<=c:c<=o&&o<a:"end"===r?Math.abs(h)>=Math.abs(l)?h>0?s<=i&&i<u:u<i&&i<=s:l>0?a<=o&&o<c:c<o&&o<=a:"both"===r?Math.abs(h)>=Math.abs(l)?h>0?s<i&&i<u:u<i&&i<s:l>0?a<o&&o<c:c<o&&o<a:void 0:Math.abs(h)>=Math.abs(l)?h>0?s<=i&&i<=u:u<=i&&i<=s:l>0?a<=o&&o<=c:c<=o&&o<=a)}(o[s],o[s+1],i,a))return!0}return!1}function yn(t,e){var n=K(t),r=K(e),i=J(t),o=J(e);switch(n){case"Point":switch(r){case"MultiPoint":return function(t,e){var n,r=!1;for(n=0;n<e.coordinates.length;n++)if(mn(e.coordinates[n],t.coordinates)){r=!0;break}return r}(i,o);case"LineString":return dn(i,o,{ignoreEndVertices:!0});case"Polygon":return Mt(i,o,{ignoreBoundary:!0});default:throw new Error("feature2 "+r+" geometry not supported")}case"MultiPoint":switch(r){case"MultiPoint":return function(t,e){for(var n=0;n<t.coordinates.length;n++){for(var r=!1,i=0;i<e.coordinates.length;i++)mn(t.coordinates[n],e.coordinates[i])&&(r=!0);if(!r)return!1}return!0}(i,o);case"LineString":return function(t,e){for(var n=!1,r=0;r<t.coordinates.length;r++){if(!dn(t.coordinates[r],e))return!1;n||(n=dn(t.coordinates[r],e,{ignoreEndVertices:!0}))}return n}(i,o);case"Polygon":return function(t,e){for(var n=!0,r=0;r<t.coordinates.length;r++){var i=Mt(t.coordinates[1],e);if(!i){n=!1;break}i=Mt(t.coordinates[1],e,{ignoreBoundary:!0})}return n&&i}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"LineString":return function(t,e){for(var n=0;n<t.coordinates.length;n++)if(!dn(t.coordinates[n],e))return!1;return!0}(i,o);case"Polygon":return function(t,e){if(!_n(j(e),j(t)))return!1;for(var n=!1,r=0;r<t.coordinates.length-1;r++){if(!Mt(t.coordinates[r],e))return!1;n||(n=Mt(t.coordinates[r],e,{ignoreBoundary:!0})),n||(n=Mt(function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}(t.coordinates[r],t.coordinates[r+1]),e,{ignoreBoundary:!0}))}return n}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"Polygon":return function(t,e){var n=j(t);if(!_n(j(e),n))return!1;for(var r=0;r<t.coordinates[0].length;r++)if(!Mt(t.coordinates[0][r],e))return!1;return!0}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+n+" geometry not supported")}}function _n(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function mn(t,e){return t[0]===e[0]&&t[1]===e[1]}function vn(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var i=n.mask,o=n.properties,s=[];if(null==e)throw new Error("cellSide is required");if(!b(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(i&&-1===["Polygon","MultiPolygon"].indexOf(K(i)))throw new Error("options.mask must be a (Multi)Polygon");for(var a=t[0],u=t[1],h=t[2],l=t[3],p=e/Dt([a,u],[h,u],n)*(h-a),f=e/Dt([a,u],[a,l],n)*(l-u),g=h-a,d=l-u,y=Math.floor(g/p),_=(d-Math.floor(d/f)*f)/2,m=a+(g-y*p)/2;m<=h;){for(var v=u+_;v<=l;){var x=r([m,v],o);i?yn(x,i)&&s.push(x):s.push(x),v+=f}m+=p}return c(s)}function xn(t,e){if(!I(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("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof r)throw new Error("<coordinates> must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return S(t,(function(t){!function(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r<t.length;r++)t[r]=Math.round(t[r]*e)/e}(t,o,r)})),t}function En(t,e){if(!t||!e)return!1;if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!En(t[n],e[n]))return!1}else if(t[n]!==e[n])return!1;return!0}function wn(t,e){if(void 0===e&&(e=!0),3!=t.length)throw new Error("This function requires an array of three points [x,y]");return(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])>=0==e}function bn(t,e){if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!bn(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0}function In(t,e){var n=[],r=Xe();return F(e,(function(e){if(n.forEach((function(t,e){t.id=e})),n.length){var i=r.search(e);if(i.features.length){var o=Cn(e,i);n=n.filter((function(t){return t.id!==o.id})),r.remove(o),O(Nn(o,e),(function(t){n.push(t),r.insert(t)}))}}else(n=Nn(t,e).features).forEach((function(t){t.bbox||(t.bbox=oe(j(t)))})),r.load(c(n))})),c(n)}function Nn(t,e){var n=[],r=U(t)[0],i=U(t)[t.geometry.coordinates.length-1];if(Sn(r,X(e))||Sn(i,X(e)))return c([t]);var o=Xe(),s=Ve(t);o.load(s);var u=o.search(e);if(!u.features.length)return c([t]);var h=Cn(e,u),l=R(s,(function(t,r,i){var o=U(r)[1],s=X(e);return i===h.id?(t.push(s),n.push(a(t)),Sn(s,o)?[s]:[s,o]):(t.push(o),t)}),[r]);return l.length>1&&n.push(a(l)),c(n)}function Cn(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 O(e,(function(e){var i=Je(e,t).properties.dist;i<r&&(n=e,r=i)})),n}function Sn(t,e){return t[0]===e[0]&&t[1]===e[1]}function Mn(t,e,n,r,i){if(!I(i=i||{}))throw new Error("options is invalid");var o=i.steps,s=i.units;if(!t)throw new Error("center is required");if(!e)throw new Error("radius is required");if(null==n)throw new Error("bearing1 is required");if(null==r)throw new Error("bearing2 is required");if("object"!=typeof i)throw new Error("options must be an object");o=o||64;var u=Ln(n),c=Ln(r),h=t.properties;if(u===c)return a(ae(t,e,i).geometry.coordinates[0],h);for(var l=u,p=u<c?c:c+360,f=l,g=[],d=0;f<p;)g.push(se(t,e,f,s).geometry.coordinates),f=l+360*++d/o;return f>p&&g.push(se(t,e,p,s).geometry.coordinates),a(g,h)}function Ln(t){var e=t%360;return e<0&&(e+=360),e}function Pn(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.properties,r=K(t),i=U(t);if(n=n||t.properties||{},!i.length)throw new Error("polygon must contain coordinates");switch(r){case"Polygon":return On(i,n);case"MultiPolygon":var o=[];return i.forEach((function(t){o.push(On(t,n))})),c(o);default:throw new Error("geom "+r+" not supported")}}function On(t,e){return t.length>1?h(t,e):a(t[0],e)}function Rn(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.properties,r=e.autoComplete,i=e.orderCoords;if(!t)throw new Error("lines is required");switch(r=void 0===r||r,i=void 0===i||i,K(t)){case"FeatureCollection":case"GeometryCollection":var o=[];return(t.features?t.features:t.geometries).forEach((function(t){o.push(U(Tn(t,{},r,i)))})),p(o,n)}return Tn(t,n,r,i)}function Tn(t,e,n,r){e=e||t.properties||{};var i=U(t),s=K(t);if(!i.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return n&&(i=An(i)),o([i],e);case"MultiLineString":var u=[],c=0;return i.forEach((function(t){if(n&&(t=An(t)),r){var e=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.abs(e-r)*Math.abs(n-i)}(j(a(t)));e>c?(u.unshift(t),c=e):u.push(t)}else u.push(t)})),o(u,e);default:throw new Error("geometry type "+s+" is not supported")}}function An(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return n===o&&r===s||t.push(e),t}function Dn(t,e,n){var r,i,o,s,a,u=t.length,c=qn(t[0],e),h=[];for(n||(n=[]),r=1;r<u;r++){for(i=t[r-1],s=a=qn(o=t[r],e);;){if(!(c|s)){h.push(i),s!==a?(h.push(o),r<u-1&&(n.push(h),h=[])):r===u-1&&h.push(o);break}if(c&s)break;c?c=qn(i=Fn(i,o,c,e),e):s=qn(o=Fn(i,o,s,e),e)}c=a}return h.length&&n.push(h),n}function Fn(t,e,n,r){return 8&n?[t[0]+(e[0]-t[0])*(r[3]-t[1])/(e[1]-t[1]),r[3]]:4&n?[t[0]+(e[0]-t[0])*(r[1]-t[1])/(e[1]-t[1]),r[1]]:2&n?[r[2],t[1]+(e[1]-t[1])*(r[2]-t[0])/(e[0]-t[0])]:1&n?[r[0],t[1]+(e[1]-t[1])*(r[0]-t[0])/(e[0]-t[0])]:null}function qn(t,e){var n=0;return t[0]<e[0]?n|=1:t[0]>e[2]&&(n|=2),t[1]<e[1]?n|=4:t[1]>e[3]&&(n|=8),n}function Gn(t,e){for(var n=[],r=0;r<t.length;r++){var i=Es.polygon(t[r],e);i.length>0&&(i[0][0]===i[i.length-1][0]&&i[0][1]===i[i.length-1][1]||i.push(i[0]),i.length>=4&&n.push(i))}return n}function Bn(t){return"[object Arguments]"===Object.prototype.toString.call(t)}function kn(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?(n.strict,t===e):function(t,e,n){var r,i;if(zn(t)||zn(e))return!1;if(t.prototype!==e.prototype)return!1;if(Bn(t))return!!Bn(e)&&kn(t=ws.call(t),e=ws.call(e),n);if(jn(t)){if(!jn(e))return!1;if(t.length!==e.length)return!1;for(r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}try{var o=Object.keys(t),s=Object.keys(e)}catch(t){return!1}if(o.length!==s.length)return!1;for(o.sort(),s.sort(),r=o.length-1;r>=0;r--)if(o[r]!==s[r])return!1;for(r=o.length-1;r>=0;r--)if(!kn(t[i=o[r]],e[i],n))return!1;return typeof t==typeof e}(t,e,n))}function zn(t){return null==t}function jn(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}function Xn(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r,i=n.tolerance||0,o=[],s=Xe();return s.load(Ve(t)),G(e,(function(t){var e=!1;O(s.search(t),(function(n){if(!1===e){var o=U(t).sort(),s=U(n).sort();kn(o,s)||(0===i?dn(o[0],n)&&dn(o[1],n):Je(n,o[0]).properties.dist<=i&&Je(n,o[1]).properties.dist<=i)?(e=!0,r=r?Un(r,t):t):(0===i?dn(s[0],t)&&dn(s[1],t):Je(t,s[0]).properties.dist<=i&&Je(t,s[1]).properties.dist<=i)&&(r=r?Un(r,n):n)}})),!1===e&&r&&(o.push(r),r=void 0)})),r&&o.push(r),c(o)}function Un(t,e){var n=U(e),r=U(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return kn(n[0],i)?s.unshift(n[1]):kn(n[0],o)?s.push(n[1]):kn(n[1],i)?s.unshift(n[0]):kn(n[1],o)&&s.push(n[0]),t}function Yn(t){var e=t%360;return e<0&&(e+=360),e}function Vn(t,e,n,i){if(!I(i=i||{}))throw new Error("options is invalid");var o=i.units,s=i.properties;if(!t)throw new Error("origin is required");if(null==e)throw new Error("distance is required");if(null==n)throw new Error("bearing is required");if(!(e>=0))throw new Error("distance must be greater than 0");var a=E(e,o,"meters"),u=X(t),c=function(t,e,n,r){var i=e/(r=void 0===r?wo:Number(r)),o=t[0]*Math.PI/180,s=x(t[1]),a=x(n),u=i*Math.cos(a),c=s+u;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var h=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),l=Math.abs(h)>1e-11?u/h:Math.cos(s);return[(180*(o+i*Math.sin(a)/l)/Math.PI+540)%360-180,180*c/Math.PI]}(u,a,n);return c[0]+=c[0]-u[0]>180?-360:u[0]-c[0]>180?360:0,r(c,s)}function Hn(t,e,n,r,i,o){for(var s=0;s<t.length;s++){var a=t[s],u=t[s+1];s===t.length-1&&(u=t[0]),r=Wn(a,u,e),n<=0&&r>0?function(t,e,n){return Wn(t,e,n)<0}(e,a,i)||(i=a):n>0&&r<=0&&(function(t,e,n){return Wn(t,e,n)>0}(e,a,o)||(o=a)),n=r}return[i,o]}function Wn(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function Jn(t){if(!t)throw new Error("line is required");var e=t.geometry?t.geometry.type:t.type;if(!Array.isArray(t)&&"LineString"!==e)throw new Error("geometry must be a LineString");for(var n,r,i=U(t),o=0,s=1;s<i.length;)n=r||i[0],o+=((r=i[s])[0]-n[0])*(r[1]+n[1]),s++;return o>0}function Zn(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return A(t,(function(t){Zn(t,e)})),t;case"LineString":return Kn(U(t),e),t;case"Polygon":return Qn(U(t),e),t;case"MultiLineString":return U(t).forEach((function(t){Kn(t,e)})),t;case"MultiPolygon":return U(t).forEach((function(t){Qn(t,e)})),t;case"Point":case"MultiPoint":return t}}function Kn(t,e){Jn(t)===e&&t.reverse()}function Qn(t,e){Jn(t[0])!==e&&t[0].reverse();for(var n=1;n<t.length;n++)Jn(t[n])===e&&t[n].reverse()}function $n(t,e,n,r){r=r||{};for(var i=Object.keys(bs),o=0;o<i.length;o++){var s=i[o],a=r[s];a=null!=a?a:bs[s],Is[s]=a}Is.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+n)+"]");var u,c=function(t,e,n){for(var r=t.length-1,i=t[0].length-1,o={rows:r,cols:i,cells:[]},s=e+Math.abs(n),a=0;a<r;++a){o.cells[a]=[];for(var u=0;u<i;++u){var c=0,h=t[a+1][u],l=t[a+1][u+1],p=t[a][u+1],f=t[a][u];if(!(isNaN(h)||isNaN(l)||isNaN(p)||isNaN(f))){c|=h<e?0:h>s?128:64,c|=l<e?0:l>s?32:16,c|=p<e?0:p>s?8:4;var g=+(c|=f<e?0:f>s?2:1),d=0;if(17===c||18===c||33===c||34===c||38===c||68===c||72===c||98===c||102===c||132===c||136===c||137===c||152===c||153===c){var y=(h+l+p+f)/4;d=y>s?2:y<e?0:1,34===c?1===d?c=35:0===d&&(c=136):136===c?1===d?(c=35,d=4):0===d&&(c=34):17===c?1===d?(c=155,d=4):0===d&&(c=153):68===c?1===d?(c=103,d=4):0===d&&(c=102):153===c?1===d&&(c=155):102===c?1===d&&(c=103):152===c?d<2&&(c=156,d=1):137===c?d<2&&(c=139,d=1):98===c?d<2&&(c=99,d=1):38===c?d<2&&(c=39,d=1):18===c?d>0?(c=156,d=4):c=152:33===c?d>0?(c=139,d=4):c=137:72===c?d>0?(c=99,d=4):c=98:132===c&&(d>0?(c=39,d=4):c=38)}if(0!=c&&170!=c){var _,m,v,x,E,w,b,I;_=m=v=x=E=w=b=I=.5;var N=[];1===c?(v=1-tr(e,p,f),I=1-tr(e,h,f),N.push(ha[c])):169===c?(v=tr(s,f,p),I=tr(s,f,h),N.push(ha[c])):4===c?(w=1-tr(e,l,p),x=tr(e,f,p),N.push(ua[c])):166===c?(w=tr(s,p,l),x=1-tr(s,p,f),N.push(ua[c])):16===c?(E=tr(e,p,l),m=tr(e,h,l),N.push(aa[c])):154===c?(E=1-tr(s,l,p),m=1-tr(s,l,h),N.push(aa[c])):64===c?(b=tr(e,f,h),_=1-tr(e,l,h),N.push(pa[c])):106===c?(b=1-tr(s,h,f),_=tr(s,h,l),N.push(pa[c])):168===c?(x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),N.push(ca[c]),N.push(ha[c])):2===c?(x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),N.push(ca[c]),N.push(ha[c])):162===c?(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),N.push(ca[c]),N.push(ha[c])):8===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),N.push(aa[c]),N.push(ua[c])):138===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(aa[c]),N.push(ua[c])):32===c?(E=tr(s,p,l),w=tr(e,p,l),_=tr(e,h,l),m=tr(s,h,l),N.push(aa[c]),N.push(ua[c])):42===c?(I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l),N.push(la[c]),N.push(pa[c])):128===c&&(I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(la[c]),N.push(pa[c])),5===c?(w=1-tr(e,l,p),I=1-tr(e,h,f),N.push(ua[c])):165===c?(w=tr(s,p,l),I=tr(s,f,h),N.push(ua[c])):20===c?(x=tr(e,f,p),m=tr(e,h,l),N.push(ca[c])):150===c?(x=1-tr(s,p,f),m=1-tr(s,l,h),N.push(ca[c])):80===c?(E=tr(e,p,l),b=tr(e,f,h),N.push(aa[c])):90===c?(E=1-tr(s,l,p),b=1-tr(s,h,f),N.push(aa[c])):65===c?(v=1-tr(e,p,f),_=1-tr(e,l,h),N.push(ha[c])):105===c?(v=tr(s,f,p),_=tr(s,h,l),N.push(ha[c])):160===c?(E=tr(s,p,l),w=tr(e,p,l),I=tr(e,f,h),b=tr(s,f,h),N.push(aa[c]),N.push(ua[c])):10===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),I=1-tr(s,h,f),b=1-tr(e,h,f),N.push(aa[c]),N.push(ua[c])):130===c?(x=1-tr(e,p,f),v=1-tr(s,p,f),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ca[c]),N.push(ha[c])):40===c?(x=tr(s,f,p),v=tr(e,f,p),_=tr(e,h,l),m=tr(s,h,l),N.push(ca[c]),N.push(ha[c])):101===c?(w=tr(s,p,l),_=tr(s,h,l),N.push(ua[c])):69===c?(w=1-tr(e,l,p),_=1-tr(e,l,h),N.push(ua[c])):149===c?(I=tr(s,f,h),m=1-tr(s,l,h),N.push(la[c])):21===c?(I=1-tr(e,h,f),m=tr(e,h,l),N.push(la[c])):86===c?(x=1-tr(s,p,f),b=1-tr(s,h,f),N.push(ca[c])):84===c?(x=tr(e,f,p),b=tr(e,f,h),N.push(ca[c])):89===c?(E=1-tr(s,l,p),v=tr(s,f,p),N.push(ha[c])):81===c?(E=tr(e,p,l),v=1-tr(e,p,f),N.push(ha[c])):96===c?(E=tr(s,p,l),w=tr(e,p,l),b=tr(e,f,h),_=tr(s,h,l),N.push(aa[c]),N.push(ua[c])):74===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),b=1-tr(s,h,f),_=1-tr(e,l,h),N.push(aa[c]),N.push(ua[c])):24===c?(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),m=tr(e,h,l),N.push(aa[c]),N.push(ha[c])):146===c?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),m=1-tr(s,l,h),N.push(aa[c]),N.push(ha[c])):6===c?(w=1-tr(e,l,p),x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),N.push(ua[c]),N.push(ca[c])):164===c?(w=tr(s,p,l),x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),N.push(ua[c]),N.push(ca[c])):129===c?(v=1-tr(e,p,f),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ha[c]),N.push(la[c])):41===c?(v=tr(s,f,p),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l),N.push(ha[c]),N.push(la[c])):66===c?(x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),_=1-tr(e,l,h),N.push(ca[c]),N.push(ha[c])):104===c?(x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),_=tr(s,h,l),N.push(ha[c]),N.push(fa[c])):144===c?(E=tr(e,p,l),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h),N.push(aa[c]),N.push(pa[c])):26===c?(E=1-tr(s,l,p),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l),N.push(aa[c]),N.push(pa[c])):36===c?(w=tr(s,p,l),x=tr(e,f,p),_=tr(e,h,l),m=tr(s,h,l),N.push(ua[c]),N.push(ca[c])):134===c?(w=1-tr(e,l,p),x=1-tr(s,p,f),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ua[c]),N.push(ca[c])):9===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),I=1-tr(e,h,f),N.push(aa[c]),N.push(ua[c])):161===c?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),I=tr(s,f,h),N.push(aa[c]),N.push(ua[c])):37===c?(w=tr(s,p,l),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l),N.push(ua[c]),N.push(la[c])):133===c?(w=1-tr(e,l,p),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h),N.push(ua[c]),N.push(la[c])):148===c?(x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h),N.push(ca[c]),N.push(pa[c])):22===c?(x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l),N.push(ca[c]),N.push(pa[c])):82===c?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),N.push(aa[c]),N.push(ha[c])):88===c?(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),N.push(aa[c]),N.push(ha[c])):73===c?(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),_=1-tr(e,l,h),N.push(aa[c]),N.push(ua[c])):97===c?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),_=tr(s,h,l),N.push(aa[c]),N.push(ua[c])):145===c?(E=tr(e,p,l),v=1-tr(e,p,f),I=tr(s,f,h),m=1-tr(s,l,h),N.push(aa[c]),N.push(la[c])):25===c?(E=1-tr(s,l,p),v=tr(s,f,p),I=1-tr(e,h,f),m=tr(e,h,l),N.push(aa[c]),N.push(la[c])):70===c?(w=1-tr(e,l,p),x=1-tr(s,p,f),b=1-tr(s,h,f),_=1-tr(e,l,h),N.push(ua[c]),N.push(ca[c])):100===c?(w=tr(s,p,l),x=tr(e,f,p),b=tr(e,f,h),_=tr(s,h,l),N.push(ua[c]),N.push(ca[c])):34===c?(0===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(la[c]),N.push(pa[c])):35===c?(4===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(ha[c]),N.push(pa[c])):136===c?(0===d?(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)):(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)),N.push(aa[c]),N.push(ua[c]),N.push(la[c]),N.push(pa[c])):153===c?(0===d?(E=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(ha[c])):102===c?(0===d?(w=1-tr(e,l,p),x=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(ua[c]),N.push(pa[c])):155===c?(4===d?(E=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(la[c])):103===c?(4===d?(w=1-tr(e,l,p),x=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(ua[c]),N.push(ca[c])):152===c?(0===d?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(ca[c]),N.push(ha[c])):156===c?(4===d?(E=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),m=tr(e,h,l)):(E=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),m=1-tr(s,l,h)),N.push(aa[c]),N.push(ha[c]),N.push(pa[c])):137===c?(0===d?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)):(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)),N.push(aa[c]),N.push(ua[c]),N.push(ha[c])):139===c?(4===d?(E=tr(s,p,l),w=tr(e,p,l),v=1-tr(e,p,f),I=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)):(E=1-tr(e,l,p),w=1-tr(s,l,p),v=tr(s,f,p),I=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)),N.push(aa[c]),N.push(ua[c]),N.push(la[c])):98===c?(0===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(pa[c])):99===c?(4===d?(E=1-tr(e,l,p),w=1-tr(s,l,p),x=tr(s,f,p),v=tr(e,f,p),b=tr(e,f,h),_=1-tr(e,l,h)):(E=tr(s,p,l),w=tr(e,p,l),x=1-tr(e,p,f),v=1-tr(s,p,f),b=1-tr(s,h,f),_=tr(s,h,l)),N.push(aa[c]),N.push(ua[c]),N.push(ha[c])):38===c?(0===d?(w=1-tr(e,l,p),x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(ua[c]),N.push(la[c]),N.push(pa[c])):39===c?(4===d?(w=1-tr(e,l,p),x=tr(e,f,p),I=tr(e,f,h),b=tr(s,f,h),_=1-tr(s,l,h),m=1-tr(e,l,h)):(w=tr(s,p,l),x=1-tr(s,p,f),I=1-tr(s,h,f),b=1-tr(e,h,f),_=tr(e,h,l),m=tr(s,h,l)),N.push(ua[c]),N.push(ca[c]),N.push(pa[c])):85===c&&(E=1,w=0,x=1,v=0,I=0,b=1,_=0,m=1),(_<0||_>1||m<0||m>1||E<0||E>1||x<0||x>1||I<0||I>1||b<0||b>1)&&console.log("MarchingSquaresJS-isoBands: "+c+" "+g+" "+h+","+l+","+p+","+f+" "+d+" "+_+" "+m+" "+E+" "+w+" "+x+" "+v+" "+I+" "+b),o.cells[a][u]={cval:c,cval_real:g,flipped:d,topleft:_,topright:m,righttop:E,rightbottom:w,bottomright:x,bottomleft:v,leftbottom:I,lefttop:b,edges:N}}}}}return o}(t,e,n);return Is.polygons?(Is.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),u=function(t){var e=[],n=0;return t.cells.forEach((function(t,r){t.forEach((function(t,i){if(void 0!==t){var o=da[t.cval](t);"object"==typeof o&&er(o)?"object"==typeof o[0]&&er(o[0])?"object"==typeof o[0][0]&&er(o[0][0])?o.forEach((function(t){t.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=t})):(o.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=o):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}}))})),e}(c)):(Is.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),u=function(t){for(var e=[],n=t.rows,r=t.cols,i=[],o=0;o<n;o++)for(var s=0;s<r;s++)if(void 0!==t.cells[o][s]&&t.cells[o][s].edges.length>0){var a=function(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Cs?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return n&Ss?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return n&Ms?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Cs?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return n&Ss?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return n&Ms?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return n&Ms?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return n&Ms?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&Ns?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return n&Ms?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return n&Ms?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&Ns?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return n&Ss?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&Ns?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return n&Ms?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&Ns?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&Ns?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Cs?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&Ns?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Cs?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}(t.cells[o][s]),u=null,c=s,h=o;null!==a&&i.push([a.p[0]+c,a.p[1]+h]);do{if(null===(u=function(t,e,n,r){var i,o,s,a,u,c=t.cval;switch(e){case-1:switch(r){case 0:i=ua[c],s=Gs[c],a=Bs[c],u=ks[c];break;default:i=aa[c],s=Ds[c],a=Fs[c],u=qs[c]}break;case 1:switch(r){case 0:i=la[c],s=Zs[c],a=Ks[c],u=Qs[c];break;default:i=pa[c],s=Hs[c],a=Ws[c],u=Js[c]}break;default:switch(n){case-1:switch(r){case 0:i=fa[c],s=Ls[c],a=Ps[c],u=Os[c];break;default:i=ga[c],s=Rs[c],a=Ts[c],u=As[c]}break;case 1:switch(r){case 0:i=ha[c],s=zs[c],a=js[c],u=Xs[c];break;default:i=ca[c],s=Us[c],a=Ys[c],u=Vs[c]}}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var n=e+1;n<t.edges.length;n++)t.edges[n-1]=t.edges[n];t.edges.pop()}(t,o),c=t.cval_real,i){case 0:c&Cs?(e=t.topleft,n=1):(e=1,n=t.righttop);break;case 1:c&Ss?(e=1,n=t.rightbottom):(e=t.topleft,n=1);break;case 2:c&Ss?(e=t.topleft,n=1):(e=t.bottomright,n=0);break;case 3:c&Ms?(e=t.bottomleft,n=0):(e=t.topleft,n=1);break;case 4:c&Cs?(e=t.topright,n=1):(e=1,n=t.righttop);break;case 5:c&Ss?(e=1,n=t.rightbottom):(e=t.topright,n=1);break;case 6:c&Ss?(e=t.topright,n=1):(e=t.bottomright,n=0);break;case 7:c&Ms?(e=t.bottomleft,n=0):(e=t.topright,n=1);break;case 8:c&Ss?(e=1,n=t.righttop):(e=t.bottomright,n=0);break;case 9:c&Ms?(e=t.bottomleft,n=0):(e=1,n=t.righttop);break;case 10:c&Ms?(e=1,n=t.righttop):(e=0,n=t.leftbottom);break;case 11:c&Ns?(e=0,n=t.lefttop):(e=1,n=t.righttop);break;case 12:c&Ss?(e=1,n=t.rightbottom):(e=t.bottomright,n=0);break;case 13:c&Ms?(e=t.bottomleft,n=0):(e=1,n=t.rightbottom);break;case 14:c&Ms?(e=1,n=t.rightbottom):(e=0,n=t.leftbottom);break;case 15:c&Ns?(e=0,n=t.lefttop):(e=1,n=t.rightbottom);break;case 16:c&Ss?(e=0,n=t.leftbottom):(e=t.bottomright,n=0);break;case 17:c&Ns?(e=0,n=t.lefttop):(e=t.bottomright,n=0);break;case 18:c&Ms?(e=t.bottomleft,n=0):(e=0,n=t.leftbottom);break;case 19:c&Ns?(e=0,n=t.lefttop):(e=t.bottomleft,n=0);break;case 20:c&Ns?(e=0,n=t.leftbottom):(e=t.topleft,n=1);break;case 21:c&Cs?(e=t.topright,n=1):(e=0,n=t.leftbottom);break;case 22:c&Ns?(e=0,n=t.lefttop):(e=t.topleft,n=1);break;case 23:c&Cs?(e=t.topright,n=1):(e=0,n=t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return void 0!==e&&void 0!==n&&void 0!==s&&void 0!==a&&void 0!==u||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+n+" "+s+" "+a+" "+u)),{p:[e,n],x:s,y:a,o:u}}(t.cells[h][c],a.x,a.y,a.o)))break;if(i.push([u.p[0]+c,u.p[1]+h]),c+=u.x,a=u,(h+=u.y)<0||h>=n||c<0||c>=r||void 0===t.cells[h][c]){var l=function(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,c=n+i,h=[],l=!1;!l;){if(void 0===t.cells[c]||void 0===t.cells[c][u])if(c-=i,u-=r,a=(s=t.cells[c][u]).cval_real,-1===i)if(0===o)if(a&Ms)h.push([u,c]),r=-1,i=0,o=0;else{if(!(a&Ss)){h.push([u+s.bottomright,c]),r=0,i=1,o=1,l=!0;break}h.push([u+1,c]),r=1,i=0,o=0}else{if(!(a&Ms)){if(a&Ss){h.push([u+s.bottomright,c]),r=0,i=1,o=1,l=!0;break}h.push([u+s.bottomleft,c]),r=0,i=1,o=0,l=!0;break}h.push([u,c]),r=-1,i=0,o=0}else if(1===i)if(0===o){if(!(a&Cs)){if(a&Ns){h.push([u+s.topleft,c+1]),r=0,i=-1,o=0,l=!0;break}h.push([u+s.topright,c+1]),r=0,i=-1,o=1,l=!0;break}h.push([u+1,c+1]),r=1,i=0,o=1}else h.push([u+1,c+1]),r=1,i=0,o=1;else if(-1===r)if(0===o){if(!(a&Ns)){if(a&Ms){h.push([u,c+s.leftbottom]),r=1,i=0,o=0,l=!0;break}h.push([u,c+s.lefttop]),r=1,i=0,o=1,l=!0;break}h.push([u,c+1]),r=0,i=1,o=0}else{if(!(a&Ns)){console.log("MarchingSquaresJS-isoBands: wtf");break}h.push([u,c+1]),r=0,i=1,o=0}else{if(1!==r){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(a&Ss)){h.push([u+1,c+s.rightbottom]),r=-1,i=0,o=0,l=!0;break}h.push([u+1,c]),r=0,i=-1,o=1}else{if(!(a&Ss)){if(a&Cs){h.push([u+1,c+s.righttop]),r=-1,i=0,o=1;break}h.push([u+1,c+s.rightbottom]),r=-1,i=0,o=0,l=!0;break}h.push([u+1,c]),r=0,i=-1,o=1}}else if(a=(s=t.cells[c][u]).cval_real,-1===r)if(0===o)if(void 0!==t.cells[c-1]&&void 0!==t.cells[c-1][u])r=0,i=-1,o=1;else{if(!(a&Ms)){h.push([u+s.bottomright,c]),r=0,i=1,o=1,l=!0;break}h.push([u,c])}else{if(!(a&Ns)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+c);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===r){if(0===o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[c+1]&&void 0!==t.cells[c+1][u])r=0,i=1,o=0;else{if(!(a&Cs)){h.push([u+s.topleft,c+1]),r=0,i=-1,o=0,l=!0;break}h.push([u+1,c+1]),r=1,i=0,o=1}}else if(-1===i){if(1!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[c][u+1])r=1,i=0,o=1;else{if(!(a&Ss)){h.push([u+1,c+s.righttop]),r=-1,i=0,o=1,l=!0;break}h.push([u+1,c]),r=0,i=-1,o=1}}else{if(1!==i){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(0!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[c][u-1])r=-1,i=0,o=0;else{if(!(a&Ns)){h.push([u,c+s.leftbottom]),r=1,i=0,o=0,l=!0;break}h.push([u,c+1]),r=0,i=1,o=0}}if(c+=i,(u+=r)===e&&c===n)break}return{path:h,i:u,j:c,x:r,y:i,o:o}}(t,c-=u.x,h-=u.y,u.x,u.y,u.o);if(null===l)break;l.path.forEach((function(t){i.push(t)})),c=l.i,h=l.j,a=l}}while(void 0!==t.cells[h][c]&&t.cells[h][c].edges.length>0);e.push(i),i=[],t.cells[o][s].edges.length>0&&s--}return e}(c)),"function"==typeof Is.successCallback&&Is.successCallback(u),u}function tr(t,e,n){return(t-e)/(n-e)}function er(t){return t.constructor.toString().indexOf("Array")>-1}function nr(t,e,n){if(!I(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=he(t)),!1!==i&&void 0!==i||(t=Ft(t)),S(t,(function(t){var n=Ze(r,t)+e,i=Qe(r,t),o=U(Vn(r,i,n));t[0]=o[0],t[1]=o[1]}))),t}function rr(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.origin,i=n.mutate;if(!t)throw new Error("geojson required");if("number"!=typeof e||0===e)throw new Error("invalid factor");var o=Array.isArray(r)||"object"==typeof r;return!0!==i&&(t=Ft(t)),"FeatureCollection"!==t.type||o?ir(t,e,r):(O(t,(function(n,i){t.features[i]=ir(n,e,r)})),t)}function ir(t,e,n){var i="Point"===K(t);return n=function(t,e){if(null!=e||(e="centroid"),Array.isArray(e)||"object"==typeof e)return X(e);var n=t.bbox?t.bbox:j(t),i=n[0],o=n[1],s=n[2],a=n[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return r([i,o]);case"se":case"southeast":case"eastsouth":case"bottomright":return r([s,o]);case"nw":case"northwest":case"westnorth":case"topleft":return r([i,a]);case"ne":case"northeast":case"eastnorth":case"topright":return r([s,a]);case"center":return ce(t);case void 0:case null:case"centroid":return he(t);default:throw new Error("invalid origin")}}(t,n),1===e||i||S(t,(function(t){var r=Qe(n,t),i=Ze(n,t),o=U(Vn(n,r*e,i));t[0]=o[0],t[1]=o[1],3===t.length&&(t[2]*=e)})),t}function or(t){var e=t[0],n=t[1];return[n[0]-e[0],n[1]-e[1]]}function sr(t,e){return t[0]*e[1]-e[0]*t[1]}function ar(t,e,n){var r=[],i=_(e,n),o=U(t),s=[];return o.forEach((function(t,e){if(e!==o.length-1){var n=function(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]]}(t,o[e+1],i);if(r.push(n),e>0){var a=r[e-1],u=function(t,e){return!function(t,e){return 0===sr(or(t),or(e))}(t,e)&&function(t,e){var n=t[0],r=or(t),i=e[0],o=or(e),s=sr(r,o);return function(t,e){return[t[0]+e[0],t[1]+e[1]]}(n,function(t,e){return[t*e[0],t*e[1]]}(sr(function(t,e){return[t[0]-e[0],t[1]-e[1]]}(i,n),o)/s,r))}(t,e)}(n,a);!1!==u&&(a[1]=u,n[0]=u),s.push(a[0]),e===o.length-2&&(s.push(n[0]),s.push(n[1]))}2===o.length&&(s.push(n[0]),s.push(n[1]))}})),a(s,t.properties)}function ur(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0],s=n[1]-e[1];return Math.sign(r*s-o*i)}function cr(t,e){return e.geometry.coordinates[0].every((function(e){return Mt(r(e),t)}))}function hr(t,e){for(var n=0;n<t.coordinates.length-1;n++)if(function(t,e,n){var r=n[0]-t[0],i=n[1]-t[1],o=e[0]-t[0],s=e[1]-t[1];return r*s-i*o==0&&(Math.abs(o)>=Math.abs(s)?o>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])}(t.coordinates[n],t.coordinates[n+1],e.coordinates))return!0;return!1}function lr(t,e){return He(e,Pn(t)).features.length>0}function pr(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function fr(t,e){return t[0]===e[0]&&t[1]===e[1]}function gr(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&!n&&!r;){for(var s=0;s<e.coordinates.length-1;s++){var a=!0;0!==s&&s!==e.coordinates.length-2||(a=!1),_r(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?n=!0:r=!0}o++}return n&&r}function dr(t,e){return He(t,Pn(e)).features.length>0}function yr(t,e){for(var n=!1,i=!1,o=t.coordinates[0].length,s=0;s<o&&n&&i;)Mt(r(t.coordinates[0][s]),e)?n=!0:i=!0,s++;return i&&i}function _r(t,e,n,r){var i=n[0]-t[0],o=n[1]-t[1],s=e[0]-t[0],a=e[1]-t[1];return 0==i*a-o*s&&(r?Math.abs(s)>=Math.abs(a)?s>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]:Math.abs(s)>=Math.abs(a)?s>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 mr(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function vr(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function xr(t,e){return ba(t,e,{strict:!0})}function Er(t,e){if(!t)throw new Error("feature1 is required");if(!e)throw new Error("feature2 is required");var n=K(t);if(n!==K(e))throw new Error("features must be of the same type");if("Point"===n)throw new Error("Point geometry not supported");if(new Na({precision:6}).compare(t,e))return!1;var r=0;switch(n){case"MultiPoint":var i=T(t),o=T(e);i.forEach((function(t){o.forEach((function(e){t[0]===e[0]&&t[1]===e[1]&&r++}))}));break;case"LineString":case"MultiLineString":G(t,(function(t){G(e,(function(e){Xn(t,e).features.length&&r++}))}));break;case"Polygon":case"MultiPolygon":G(t,(function(t){G(e,(function(e){He(t,e).features.length&&r++}))}))}return r>0}function wr(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}function br(t,e){if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("Invalid GeoJSON object for "+e)}function Ir(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}function Nr(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var n=0;n<t.length;n++){this.grid[n]=[];for(var r=0,i=t[n];r<i.length;r++){var o=new Cr(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function Cr(t,e,n){this.x=t,this.y=e,this.weight=n}function Sr(t){this.content=[],this.scoreFunction=t}function Mr(t){return t[0]}function Lr(t){return t[1]}function Pr(){this._=null}function Or(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Rr(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function Tr(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function Ar(t){for(;t.L;)t=t.L;return t}function Dr(t,e,n,r){var i=[null,null],o=ja.push(i)-1;return i.left=t,i.right=e,n&&qr(i,t,e,n),r&&qr(i,e,t,r),ka[t.index].halfedges.push(o),ka[e.index].halfedges.push(o),i}function Fr(t,e,n){var r=[e,n];return r.left=t,r}function qr(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function Gr(t,e,n,r,i){var o,s=t[0],a=t[1],u=s[0],c=s[1],h=0,l=1,p=a[0]-u,f=a[1]-c;if(o=e-u,p||!(o>0)){if(o/=p,p<0){if(o<h)return;o<l&&(l=o)}else if(p>0){if(o>l)return;o>h&&(h=o)}if(o=r-u,p||!(o<0)){if(o/=p,p<0){if(o>l)return;o>h&&(h=o)}else if(p>0){if(o<h)return;o<l&&(l=o)}if(o=n-c,f||!(o>0)){if(o/=f,f<0){if(o<h)return;o<l&&(l=o)}else if(f>0){if(o>l)return;o>h&&(h=o)}if(o=i-c,f||!(o<0)){if(o/=f,f<0){if(o>l)return;o>h&&(h=o)}else if(f>0){if(o<h)return;o<l&&(l=o)}return!(h>0||l<1)||(h>0&&(t[0]=[u+h*p,c+h*f]),l<1&&(t[1]=[u+l*p,c+l*f]),!0)}}}}}function Br(t,e,n,r,i){var o=t[1];if(o)return!0;var s,a,u=t[0],c=t.left,h=t.right,l=c[0],p=c[1],f=h[0],g=h[1],d=(l+f)/2,y=(p+g)/2;if(g===p){if(d<e||d>=r)return;if(l>f){if(u){if(u[1]>=i)return}else u=[d,n];o=[d,i]}else{if(u){if(u[1]<n)return}else u=[d,i];o=[d,n]}}else if(a=y-(s=(l-f)/(g-p))*d,s<-1||s>1)if(l>f){if(u){if(u[1]>=i)return}else u=[(n-a)/s,n];o=[(i-a)/s,i]}else{if(u){if(u[1]<n)return}else u=[(i-a)/s,i];o=[(n-a)/s,n]}else if(p<g){if(u){if(u[0]>=r)return}else u=[e,s*e+a];o=[r,s*r+a]}else{if(u){if(u[0]<e)return}else u=[r,s*r+a];o=[e,s*e+a]}return t[0]=u,t[1]=o,!0}function kr(t,e){var n=t.site,r=e.left,i=e.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function zr(t,e){return e[+(e.left!==t.site)]}function jr(t,e){return e[+(e.left===t.site)]}function Xr(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var s=i[0],a=i[1],u=r[0]-s,c=r[1]-a,h=o[0]-s,l=o[1]-a,p=2*(u*l-c*h);if(!(p>=-Va)){var f=u*u+c*c,g=h*h+l*l,d=(l*f-c*g)/p,y=(u*g-h*f)/p,_=Xa.pop()||new function(){Or(this),this.x=this.y=this.arc=this.site=this.cy=null};_.arc=t,_.site=i,_.x=d+s,_.y=(_.cy=y+a)+Math.sqrt(d*d+y*y),t.circle=_;for(var m=null,v=za._;v;)if(_.y<v.y||_.y===v.y&&_.x<=v.x){if(!v.L){m=v.P;break}v=v.L}else{if(!v.R){m=v;break}v=v.R}za.insert(m,_),m||(Ga=_)}}}}function Ur(t){var e=t.circle;e&&(e.P||(Ga=e.N),za.remove(e),Xa.push(e),Or(e),t.circle=null)}function Yr(t){var e=Ua.pop()||new function(){Or(this),this.edge=this.site=this.circle=null};return e.site=t,e}function Vr(t){Ur(t),Ba.remove(t),Ua.push(t),Or(t)}function Hr(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,s=t.N,a=[t];Vr(t);for(var u=o;u.circle&&Math.abs(n-u.circle.x)<Ya&&Math.abs(r-u.circle.cy)<Ya;)o=u.P,a.unshift(u),Vr(u),u=o;a.unshift(u),Ur(u);for(var c=s;c.circle&&Math.abs(n-c.circle.x)<Ya&&Math.abs(r-c.circle.cy)<Ya;)s=c.N,a.push(c),Vr(c),c=s;a.push(c),Ur(c);var h,l=a.length;for(h=1;h<l;++h)c=a[h],u=a[h-1],qr(c.edge,u.site,c.site,i);u=a[0],(c=a[l-1]).edge=Dr(u.site,c.site,null,i),Xr(u),Xr(c)}function Wr(t){for(var e,n,r,i,o=t[0],s=t[1],a=Ba._;a;)if((r=Jr(a,s)-o)>Ya)a=a.L;else{if(!((i=o-function(t,e){var n=t.N;if(n)return Jr(n,e);var r=t.site;return r[1]===e?r[0]:1/0}(a,s))>Ya)){r>-Ya?(e=a.P,n=a):i>-Ya?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){ka[t.index]={site:t,halfedges:[]}}(t);var u=Yr(t);if(Ba.insert(e,u),e||n){if(e===n)return Ur(e),n=Yr(e.site),Ba.insert(u,n),u.edge=n.edge=Dr(e.site,u.site),Xr(e),void Xr(n);if(n){Ur(e),Ur(n);var c=e.site,h=c[0],l=c[1],p=t[0]-h,f=t[1]-l,g=n.site,d=g[0]-h,y=g[1]-l,_=2*(p*y-f*d),m=p*p+f*f,v=d*d+y*y,x=[(y*m-f*v)/_+h,(p*v-d*m)/_+l];qr(n.edge,c,g,x),u.edge=Dr(c,t,null,x),n.edge=Dr(t,g,null,x),Xr(e),Xr(n)}else u.edge=Dr(e.site,u.site)}}function Jr(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;var a=(n=s.site)[0],u=n[1],c=u-e;if(!c)return a;var h=a-r,l=1/o-1/c,p=h/c;return l?(-p+Math.sqrt(p*p-2*l*(h*h/(-2*c)-u+c/2+i-o/2)))/l+r:(r+a)/2}function Zr(t,e,n){return(t[0]-n[0])*(e[1]-t[1])-(t[0]-e[0])*(n[1]-t[1])}function Kr(t,e){return e[1]-t[1]||e[0]-t[0]}function Qr(t,e){var n,r,i,o=t.sort(Kr).pop();for(ja=[],ka=new Array(t.length),Ba=new Pr,za=new Pr;;)if(i=Ga,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===n&&o[1]===r||(Wr(o),n=o[0],r=o[1]),o=t.pop();else{if(!i)break;Hr(i.arc)}if(function(){for(var t,e,n,r,i=0,o=ka.length;i<o;++i)if((t=ka[i])&&(r=(e=t.halfedges).length)){var s=new Array(r),a=new Array(r);for(n=0;n<r;++n)s[n]=n,a[n]=kr(t,ja[e[n]]);for(s.sort((function(t,e){return a[e]-a[t]})),n=0;n<r;++n)a[n]=e[s[n]];for(n=0;n<r;++n)e[n]=a[n]}}(),e){var s=+e[0][0],a=+e[0][1],u=+e[1][0],c=+e[1][1];!function(t,e,n,r){for(var i,o=ja.length;o--;)Br(i=ja[o],t,e,n,r)&&Gr(i,t,e,n,r)&&(Math.abs(i[0][0]-i[1][0])>Ya||Math.abs(i[0][1]-i[1][1])>Ya)||delete ja[o]}(s,a,u,c),function(t,e,n,r){var i,o,s,a,u,c,h,l,p,f,g,d,y=ka.length,_=!0;for(i=0;i<y;++i)if(o=ka[i]){for(s=o.site,a=(u=o.halfedges).length;a--;)ja[u[a]]||u.splice(a,1);for(a=0,c=u.length;a<c;)g=(f=jr(o,ja[u[a]]))[0],d=f[1],l=(h=zr(o,ja[u[++a%c]]))[0],p=h[1],(Math.abs(g-l)>Ya||Math.abs(d-p)>Ya)&&(u.splice(a,0,ja.push(Fr(s,f,Math.abs(g-t)<Ya&&r-d>Ya?[t,Math.abs(l-t)<Ya?p:r]:Math.abs(d-r)<Ya&&n-g>Ya?[Math.abs(p-r)<Ya?l:n,r]:Math.abs(g-n)<Ya&&d-e>Ya?[n,Math.abs(l-n)<Ya?p:e]:Math.abs(d-e)<Ya&&g-t>Ya?[Math.abs(p-e)<Ya?l:t,e]:null))-1),++c);c&&(_=!1)}if(_){var m,v,x,E=1/0;for(i=0,_=null;i<y;++i)(o=ka[i])&&(x=(m=(s=o.site)[0]-t)*m+(v=s[1]-e)*v)<E&&(E=x,_=o);if(_){var w=[t,e],b=[t,r],I=[n,r],N=[n,e];_.halfedges.push(ja.push(Fr(s=_.site,w,b))-1,ja.push(Fr(s,b,I))-1,ja.push(Fr(s,I,N))-1,ja.push(Fr(s,N,w))-1)}}for(i=0;i<y;++i)(o=ka[i])&&(o.halfedges.length||delete ka[i])}(s,a,u,c)}this.edges=ja,this.cells=ka,Ba=za=ja=ka=null}function $r(t){return(t=t.slice()).push(t[0]),o([t])}function ti(t,e,n,r){var i=(r=r||{}).steps||64,s=r.units||"kilometers",a=r.angle||0,u=r.pivot||t,c=r.properties||t.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(!I(r))throw new Error("options must be an object");if(!b(i))throw new Error("steps must be a number");if(!b(a))throw new Error("angle must be a number");var h=X(t);if("degrees"===s)var l=x(a);else e=Vn(t,e,90,{units:s}),n=Vn(t,n,0,{units:s}),e=X(e)[0]-h[0],n=X(n)[1]-h[1];for(var p=[],f=0;f<i;f+=1){var g=-360*f/i,d=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e,2)*Math.pow(ei(g),2)),y=e*n/Math.sqrt(Math.pow(e,2)+Math.pow(n,2)/Math.pow(ei(g),2));if(g<-90&&g>=-270&&(d=-d),g<-180&&g>=-360&&(y=-y),"degrees"===s){var _=d*Math.cos(l)+y*Math.sin(l),m=y*Math.cos(l)-d*Math.sin(l);d=_,y=m}p.push([d+h[0],y+h[1]])}return p.push(p[0]),"degrees"===s?o([p],c):nr(o([p],c),a,{pivot:u})}function ei(t){var e=t*Math.PI/180;return Math.tan(e)}function ni(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.properties,i=e.weight;if(!t)throw new Error("geojson is required");var o=0,s=0,a=0;return A(t,(function(t,e,n){var r=n[i];if(!b(r=null==r?1:r))throw new Error("weight value must be a number for feature index "+e);(r=Number(r))>0&&S(t,(function(t){o+=t[0]*r,s+=t[1]*r,a+=r}))})),r([o/a,s/a],n)}function ri(t,e,n,i){var o=n.properties.tolerance||.001,s=0,a=0,u=0,c=0;if(O(n,(function(e){var n=e.properties.weight,r=null==n?1:n;if(!b(r=Number(r)))throw new Error("weight value must be a number");if(r>0){c+=1;var i=r*Dt(e,t);0===i&&(i=1);var o=r/i;s+=e.geometry.coordinates[0]*o,a+=e.geometry.coordinates[1]*o,u+=o}})),c<1)throw new Error("no features to measure");var h=s/u,l=a/u;return 1===c||0===i||Math.abs(h-e[0])<o&&Math.abs(l-e[1])<o?r([h,l],{medianCandidates:n.properties.medianCandidates}):(n.properties.medianCandidates.push([h,l]),ri([h,l],t,n,i-1))}function ii(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function oi(t){if(I(t)&&(t=t.bbox),t&&!Array.isArray(t))throw new Error("bbox is invalid");return t?function(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}(t):[360*ci(),180*ci()]}function si(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.bbox;null!=t||(t=1);for(var i=[],o=0;o<t;o++)i.push(r(oi(n)));return c(i)}function ai(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.num_vertices,i=e.max_radial_length;null!=t||(t=1),b(r)||(r=10),b(i)||(i=10);for(var s=[],a=0;a<t;a++){var u=[],h=Array.apply(null,new Array(r+1)).map(Math.random);h.forEach((function(t,e,n){n[e]=e>0?t+n[e-1]:t})),h.forEach((function(t){t=2*t*Math.PI/h[h.length-1];var e=Math.random();u.push([e*i*Math.sin(t),e*i*Math.cos(t)])})),u[u.length-1]=u[0],u=u.map(function(t){return function(e){return[e[0]+t[0],e[1]+t[1]]}}(oi(n))),s.push(o([u]))}return c(s)}function ui(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.num_vertices,i=e.max_length,o=e.max_rotation;null!=t||(t=1),(!b(r)||r<2)&&(r=10),b(i)||(i=1e-4),b(o)||(o=Math.PI/8);for(var s=[],u=0;u<t;u++){for(var h=[oi(n)],l=0;l<r-1;l++){var p=(0===l?2*Math.random()*Math.PI:Math.tan((h[l][1]-h[l-1][1])/(h[l][0]-h[l-1][0])))+(Math.random()-.5)*o*2,f=Math.random()*i;h.push([h[l][0]+f*Math.cos(p),h[l][1]+f*Math.sin(p)])}s.push(a(h))}return c(s)}function ci(){return Math.random()-.5}function hi(t,e){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("filter is required");var n=[];return O(t,(function(t){gi(t.properties,e)&&n.push(t)})),c(n)}function li(t,e,n){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("property is required");for(var r=fi(t,e),i=Object.keys(r),o=0;o<i.length;o++){for(var s=i[o],a=r[s],u=[],h=0;h<a.length;h++)u.push(t.features[a[h]]);n(c(u),s,o)}}function pi(t,e,n,r){var i=r;return li(t,e,(function(t,e,o){i=0===o&&void 0===r?t:n(i,t,e,o)})),i}function fi(t,e){var n={};return O(t,(function(t,r){var i=t.properties||{};if(i.hasOwnProperty(e)){var o=i[e];n.hasOwnProperty(o)?n[o].push(r):n[o]=[r]}})),n}function gi(t,e){if(void 0===t)return!1;var n=typeof e;if("number"===n||"string"===n)return t.hasOwnProperty(e);if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(!gi(t,e[r]))return!1;return!0}return di(t,e)}function di(t,e){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r];if(t[i]!==e[i])return!1}return!0}function yi(t,e){if(!e)return{};if(!e.length)return{};for(var n={},r=0;r<e.length;r++){var i=e[r];t.hasOwnProperty(i)&&(n[i]=t[i])}return n}function _i(){}function mi(t){this.message=t||""}function vi(t){this.message=t||""}function xi(){}function Ei(t){return null===t?fc:t.color}function wi(t){return null===t?null:t.parent}function bi(t,e){null!==t&&(t.color=e)}function Ii(t){return null===t?null:t.left}function Ni(t){return null===t?null:t.right}function Ci(){this.root_=null,this.size_=0}function Si(){}function Mi(){this.array_=[],arguments[0]instanceof Qu&&this.addAll(arguments[0])}function Li(){}function Pi(t){this.message=t||""}function Oi(){this.array_=[]}function Ri(t){switch(t.type){case"Polygon":return cn(t)>1?t:null;case"MultiPolygon":var e=[];if(F(t,(function(t){cn(t)>1&&e.push(t.geometry.coordinates)})),e.length)return{type:"MultiPolygon",coordinates:e}}}function Ti(){this.reset()}function Ai(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}function Di(t){return t>1?vf:t<-1?-vf:Math.asin(t)}function Fi(){}function qi(t,e){t&&Af.hasOwnProperty(t.type)&&Af[t.type](t,e)}function Gi(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Bi(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Gi(t[n],e,1);e.polygonEnd()}function ki(t){return[Cf(t[1],t[0]),Di(t[2])]}function zi(t){var e=t[0],n=t[1],r=Sf(n);return[r*Sf(e),r*Pf(e),Pf(n)]}function ji(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Xi(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Ui(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Yi(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Vi(t){var e=Of(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Hi(t,e){return[t>mf?t-Ef:t<-mf?t+Ef:t,e]}function Wi(t,e,n){return(t%=Ef)?e||n?Ff(Zi(t),Ki(e,n)):Zi(t):e||n?Ki(e,n):Hi}function Ji(t){return function(e,n){return[(e+=t)>mf?e-Ef:e<-mf?e+Ef:e,n]}}function Zi(t){var e=Ji(t);return e.invert=Ji(-t),e}function Ki(t,e){function n(t,e){var n=Sf(e),a=Sf(t)*n,u=Pf(t)*n,c=Pf(e),h=c*r+a*i;return[Cf(u*o-h*s,a*r-c*i),Di(h*o+u*s)]}var r=Sf(t),i=Pf(t),o=Sf(e),s=Pf(e);return n.invert=function(t,e){var n=Sf(e),a=Sf(t)*n,u=Pf(t)*n,c=Pf(e),h=c*o-u*s;return[Cf(u*o+c*s,a*r+h*i),Di(h*r-a*i)]},n}function Qi(t,e){(e=zi(e))[0]-=t,Vi(e);var n=function(t){return t>1?0:t<-1?mf:Math.acos(t)}(-e[1]);return((-e[2]<0?-n:n)+Ef-_f)%Ef}function $i(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function to(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function eo(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,c){var h=0,l=0;if(null==i||(h=s(i,a))!==(l=s(o,a))||u(i,o)<0^a>0)do{c.point(0===h||3===h?t:n,h>1?r:e)}while((h=(h+a+4)%4)!==l);else c.point(o[0],o[1])}function s(r,i){return If(r[0]-t)<_f?i>0?0:3:If(r[0]-n)<_f?i>0?2:1:If(r[1]-e)<_f?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(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(s){function u(t,e){i(t,e)&&E.point(t,e)}function c(o,s){var a=i(o,s);if(l&&p.push([o,s]),v)f=o,g=s,d=a,v=!1,a&&(E.lineStart(),E.point(o,s));else if(a&&m)E.point(o,s);else{var u=[y=Math.max(Uf,Math.min(Xf,y)),_=Math.max(Uf,Math.min(Xf,_))],c=[o=Math.max(Uf,Math.min(Xf,o)),s=Math.max(Uf,Math.min(Xf,s))];Gf(u,c,t,e,n,r)?(m||(E.lineStart(),E.point(u[0],u[1])),E.point(c[0],c[1]),a||E.lineEnd(),x=!1):a&&(E.lineStart(),E.point(o,s),x=!1)}y=o,_=s,m=a}var h,l,p,f,g,d,y,_,m,v,x,E=s,w=qf(),b={point:u,lineStart:function(){b.point=c,l&&l.push(p=[]),v=!0,m=!1,y=_=NaN},lineEnd:function(){h&&(c(f,g),d&&m&&w.rejoin(),h.push(w.result())),b.point=u,m&&E.lineEnd()},polygonStart:function(){E=w,h=[],l=[],x=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var o,s,a=l[n],u=1,c=a.length,h=a[0],p=h[0],f=h[1];u<c;++u)o=p,s=f,p=(h=a[u])[0],f=h[1],s<=r?f>r&&(p-o)*(r-s)>(f-s)*(t-o)&&++e:f<=r&&(p-o)*(r-s)<(f-s)*(t-o)&&--e;return e}(),n=x&&e,i=(h=jf(h)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&kf(h,a,e,o,s),s.polygonEnd()),E=s,h=l=p=null}};return b}}function no(t){return t.length>1}function ro(t,e){return((t=t.x)[0]<0?t[1]-vf-_f:vf-t[1])-((e=e.x)[0]<0?e[1]-vf-_f:vf-e[1])}function io(t){return function(e){var n=new oo;for(var r in t)n[r]=t[r];return n.stream=e,n}}function oo(){}function so(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),Df(n,t.stream(Kf));var s=Kf.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,c=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,c])}function ao(t,e){return[t,Lf(Rf((vf+e)/2))]}function uo(t,e){return[Lf(Rf((vf+e)/2)),-t]}function co(t,n,r,i){var o=t.properties||{},s="Feature"===t.type?t.geometry:t;if("GeometryCollection"===s.type){var a=[];return A(t,(function(t){var e=co(t,n,r,i);e&&a.push(e)})),c(a)}var u,h=j(t),l=h[1]>50&&h[3]>50;u=l?{type:s.type,coordinates:ho(s.coordinates,po(s))}:$e(s);var p,f=(new nh).read(u),g=d(y(n,r),"meters"),_=Hl.bufferOp(f,g);if(!function t(e){return Array.isArray(e[0])?t(e[0]):isNaN(e[0])}((_=(new rh).write(_)).coordinates))return(p=l?{type:_.type,coordinates:lo(_.coordinates,po(s))}:tn(_)).geometry?p:e(p,o)}function ho(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return ho(t,e)}))}function lo(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return lo(t,e)}))}function po(t){var e=ce(t).geometry.coordinates.reverse(),n=e.map((function(t){return-t}));return ig().center(e).rotate(n).scale(wo)}function fo(){for(var t=new nh,e=t.read(JSON.stringify(arguments[0].geometry)),n=1;n<arguments.length;n++)e=gf.union(e,t.read(JSON.stringify(arguments[n].geometry)));return{type:"Feature",geometry:e=(new rh).write(e),properties:arguments[0].properties}}function go(t,n){var r=J(t),i=J(n);if(Jt(xn(i,{precision:4})).coordinates[0].length<4)return null;if(Jt(xn(r,{precision:4})).coordinates[0].length<4)return null;var o=new nh,s=o.read(xn(r)),a=o.read(xn(i)),u=of.intersection(s,a);return u.isEmpty()?null:e((new rh).write(u))}function yo(t,e){return function(t,e,n){var r,i;if(!Array.isArray(e))throw new Error("Get closest expects an array as second argument");return e.forEach((function(e,n){var o=function(t,e){return t-e}(e,t);o>=0&&(void 0===i||o<i)&&(i=o,r=n)})),r}(t,e)}function _o(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.properties||{},i=n.triangles,s=n.mask;if(null==e)throw new Error("cellSide is required");if(!b(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(s&&-1===["Polygon","MultiPolygon"].indexOf(K(s)))throw new Error("options.mask must be a (Multi)Polygon");var a=t[0],u=t[1],h=t[2],l=t[3],p=(u+l)/2,f=(a+h)/2,g=2*e/Dt([a,p],[h,p],n)*(h-a),d=2*e/Dt([f,u],[f,l],n)*(l-u),y=g/2,_=2*y,m=Math.sqrt(3)/2*d,v=h-a,x=l-u,E=.75*_,w=m,N=(v-_)/(_-y/2),C=Math.floor(N),S=(C*E-y/2-v)/2-y/2+E/2,M=Math.floor((x-m)/m),L=(x-M*m)/2,P=M*m-x>m/2;P&&(L-=m/4);for(var O=[],R=[],T=0;T<6;T++){var A=2*Math.PI/6*T;O.push(Math.cos(A)),R.push(Math.sin(A))}for(var D=[],F=0;F<=C;F++)for(var q=0;q<=M;q++){var G=F%2==1;if(!(0===q&&G||0===q&&P)){var B=F*E+a-S,k=q*w+u+L;if(G&&(k-=m/2),!0===i)(function(t,e,n,r,i,s){for(var a=[],u=0;u<6;u++){var c=[];c.push(t),c.push([t[0]+e*i[u],t[1]+n*s[u]]),c.push([t[0]+e*i[(u+1)%6],t[1]+n*s[(u+1)%6]]),c.push(t),a.push(o([c],r))}return a})([B,k],g/2,d/2,r,O,R).forEach((function(t){s?go(s,t)&&D.push(t):D.push(t)}));else{var z=function(t,e,n,r,i,s){for(var a=[],u=0;u<6;u++){var c=t[0]+e*i[u],h=t[1]+n*s[u];a.push([c,h])}return a.push(a[0].slice()),o([a],r)}([B,k],g/2,d/2,r,O,R);s?go(s,z)&&D.push(z):D.push(z)}}}return c(D)}function mo(t){if(t.features.length<=1)return t;var e=function(t){var e=Ro(),n=[];return F(t,(function(t,e){var r=j(t);n.push({minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],geojson:t,index:e})})),e.load(n),e}(t),n=[],r={};return F(t,(function(t,i){if(r[i])return!0;for(e.remove({index:i},vo),r[i]=!0;;){var o=j(t),s=e.search({minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]});if(s.length>0){var a=s.map((function(t){return r[t.index]=!0,e.remove({index:t.index},vo),t.geojson}));a.push(t),t=fo.apply(this,a)}if(0===s.length)break}n.push(t)})),c(n)}function vo(t,e){return t.index===e.index}function xo(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.mask,s=[];if(null==e)throw new Error("cellSide is required");if(!b(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(i&&-1===["Polygon","MultiPolygon"].indexOf(K(i)))throw new Error("options.mask must be a (Multi)Polygon");for(var a=t[0],u=t[1],h=t[2],l=t[3],p=e/Dt([a,u],[h,u],n)*(h-a),f=e/Dt([a,u],[a,l],n)*(l-u),g=h-a,d=l-u,y=Math.floor(g/p),_=Math.floor(d/f),m=(d-_*f)/2,v=a+(g-y*p)/2,x=0;x<y;x++){for(var E=u+m,w=0;w<_;w++){var N=o([[[v,E],[v,E+f],[v+p,E+f],[v+p,E],[v,E]]],r);i?go(i,N)&&s.push(N):s.push(N),E+=f}v+=p}return c(s)}function Eo(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.mask,s=[];if(null==e)throw new Error("cellSide is required");if(!b(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(i&&-1===["Polygon","MultiPolygon"].indexOf(K(i)))throw new Error("options.mask must be a (Multi)Polygon");for(var a=e/Dt([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),u=e/Dt([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),h=0,l=t[0];l<=t[2];){for(var p=0,f=t[1];f<=t[3];){var g=null,d=null;h%2==0&&p%2==0?(g=o([[[l,f],[l,f+u],[l+a,f],[l,f]]],r),d=o([[[l,f+u],[l+a,f+u],[l+a,f],[l,f+u]]],r)):h%2==0&&p%2==1?(g=o([[[l,f],[l+a,f+u],[l+a,f],[l,f]]],r),d=o([[[l,f],[l,f+u],[l+a,f+u],[l,f]]],r)):p%2==0&&h%2==1?(g=o([[[l,f],[l,f+u],[l+a,f+u],[l,f]]],r),d=o([[[l,f],[l+a,f+u],[l+a,f],[l,f]]],r)):p%2==1&&h%2==1&&(g=o([[[l,f],[l,f+u],[l+a,f],[l,f]]],r),d=o([[[l,f+u],[l+a,f+u],[l+a,f],[l,f+u]]],r)),i?(go(i,g)&&s.push(g),go(i,d)&&s.push(d)):(s.push(g),s.push(d)),f+=u,p++}h++,l+=a}return c(s)}var wo=6371008.8,bo={meters:wo,metres:wo,millimeters:1e3*wo,millimetres:1e3*wo,centimeters:100*wo,centimetres:100*wo,kilometers:wo/1e3,kilometres:wo/1e3,miles:wo/1609.344,nauticalmiles:wo/1852,inches:39.37*wo,yards:wo/1.0936,feet:3.28084*wo,radians:1,degrees:wo/111325},Io={meters:1,metres:1,millimeters:1e3,millimetres:1e3,centimeters:100,centimetres:100,kilometers:.001,kilometres:.001,miles:1/1609.344,nauticalmiles:1/1852,inches:39.37,yards:1/1.0936,feet:3.28084,radians:1/wo,degrees:1/111325},No={meters:1,metres:1,millimeters:1e6,millimetres:1e6,centimeters:1e4,centimetres:1e4,kilometers:1e-6,kilometres:1e-6,acres:247105e-9,miles:386e-9,yards:1.195990046,feet:10.763910417,inches:1550.003100006},Co=Object.freeze({earthRadius:wo,factors:bo,unitsFactors:Io,areaFactors:No,feature:e,geometry:n,point:r,points:i,polygon:o,polygons:s,lineString:a,lineStrings:u,featureCollection:c,multiLineString:h,multiPoint:l,multiPolygon:p,geometryCollection:f,round:g,radiansToLength:d,lengthToRadians:y,lengthToDegrees:_,bearingToAzimuth:m,radiansToDegrees:v,degreesToRadians:x,convertLength:E,convertArea:w,isNumber:b,isObject:I,validateBBox:N,validateId:C,radians2degrees:function(){throw new Error("method has been renamed to `radiansToDegrees`")},degrees2radians:function(){throw new Error("method has been renamed to `degreesToRadians`")},distanceToDegrees:function(){throw new Error("method has been renamed to `lengthToDegrees`")},distanceToRadians:function(){throw new Error("method has been renamed to `lengthToRadians`")},radiansToDistance:function(){throw new Error("method has been renamed to `radiansToLength`")},bearingToAngle:function(){throw new Error("method has been renamed to `bearingToAzimuth`")},convertDistance:function(){throw new Error("method has been renamed to `convertLength`")}}),So=Object.freeze({coordEach:S,coordReduce:M,propEach:L,propReduce:P,featureEach:O,featureReduce:R,coordAll:T,geomEach:A,geomReduce:D,flattenEach:F,flattenReduce:q,segmentEach:G,segmentReduce:B,lineEach:k,lineReduce:z}),Mo=Object.freeze({getCoord:X,getCoords:U,containsNumber:Y,geojsonType:V,featureOf:H,collectionOf:W,getGeom:J,getGeomType:Z,getType:K}),Lo={successCallback:null,verbose:!1},Po={},Oo=function t(e,n,r,i,o){for(r=r||0,i=i||e.length-1,o=o||function(t,e){return t<e?-1:t>e?1:0};i>r;){if(i-r>600){var s=i-r+1,a=n-r+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(a-s/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-a*c/s+h)),Math.min(i,Math.floor(n+(s-a)*c/s+h)),o)}var l=e[n],p=r,f=i;for(rt(e,r,n),o(e[i],l)>0&&rt(e,r,i);p<f;){for(rt(e,p,f),p++,f--;o(e[p],l)<0;)p++;for(;o(e[f],l)>0;)f--}0===o(e[r],l)?rt(e,r,f):rt(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}},Ro=it;it.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!ft(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],ft(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):pt(t,a)?this._all(s,n):u.push(s));e=u.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!ft(t,e))return!1;for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],ft(t,s=e.leaf?n(o):o)){if(e.leaf||pt(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var i=this.data;this.data=r,r=i}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=gt([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],c=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=c.pop(),o=!0),s.leaf&&-1!==(i=function(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!pt(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),c.push(n),n=0,r=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:ut,compareMinY:ct,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return ot(i=gt(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=gt([])).leaf=!1,i.height=r;var a,u,c,h,l=Math.ceil(o/s),p=l*Math.ceil(Math.sqrt(s));for(dt(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(dt(t,a,c=Math.min(a+p-1,n),l,this.compareMinY),u=a;u<=c;u+=l)h=Math.min(u+l-1,c),i.children.push(this._build(t,u,h,r-1));return ot(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,c,h,l;r.push(e),!e.leaf&&r.length-1!==n;){for(h=l=1/0,i=0,o=e.children.length;i<o;i++)u=ht(s=e.children[i]),(c=function(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}(t,s)-u)<l?(l=c,h=u<h?u:h,a=s):c===l&&u<h&&(h=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,i=n?t:r(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),at(s,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split: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),s=gt(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,ot(n,this.toBBox),ot(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=gt([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ot(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,c,h;for(u=c=1/0,r=e;r<=n-e;r++)s=function(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}(i=st(t,0,r,this.toBBox),o=st(t,r,n,this.toBBox)),a=ht(i)+ht(o),s<u?(u=s,h=r,c=a<c?a:c):s===u&&a<c&&(c=a,h=r);return h},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:ut,i=t.leaf?this.compareMinY:ct;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);var i,o,s=this.toBBox,a=st(t,0,e,s),u=st(t,n-e,n,s),c=lt(a)+lt(u);for(i=e;i<n-e;i++)o=t.children[i],at(a,t.leaf?s(o):o),c+=lt(a);for(i=n-e-1;i>=e;i--)o=t.children[i],at(u,t.leaf?s(o):o),c+=lt(u);return c},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)at(e[r],t)},_condense: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():ot(t[n],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};var To=function(t,e,n){var r=t*e,i=Ao*t,o=i-(i-t),s=t-o,a=Ao*e,u=a-(a-e),c=e-u,h=s*c-(r-o*u-s*u-o*c);return n?(n[0]=h,n[1]=r,n):[h,r]},Ao=+(Math.pow(2,27)+1),Do=function(t,e){var n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){var n=t+e,r=n-t,i=t-(n-r)+(e-r);return i?[i,n]:[n]}(t[0],e[0]);var i,o,s=new Array(n+r),a=0,u=0,c=0,h=Math.abs,l=t[u],p=h(l),f=e[c],g=h(f);p<g?(o=l,(u+=1)<n&&(p=h(l=t[u]))):(o=f,(c+=1)<r&&(g=h(f=e[c]))),u<n&&p<g||c>=r?(i=l,(u+=1)<n&&(p=h(l=t[u]))):(i=f,(c+=1)<r&&(g=h(f=e[c])));for(var d,y,_=i+o,m=_-i,v=o-m,x=v,E=_;u<n&&c<r;)p<g?(i=l,(u+=1)<n&&(p=h(l=t[u]))):(i=f,(c+=1)<r&&(g=h(f=e[c]))),(v=(o=x)-(m=(_=i+o)-i))&&(s[a++]=v),x=E-((d=E+_)-(y=d-E))+(_-y),E=d;for(;u<n;)(v=(o=x)-(m=(_=(i=l)+o)-i))&&(s[a++]=v),x=E-((d=E+_)-(y=d-E))+(_-y),E=d,(u+=1)<n&&(l=t[u]);for(;c<r;)(v=(o=x)-(m=(_=(i=f)+o)-i))&&(s[a++]=v),x=E-((d=E+_)-(y=d-E))+(_-y),E=d,(c+=1)<r&&(f=e[c]);return x&&(s[a++]=x),E&&(s[a++]=E),a||(s[a++]=0),s.length=a,s},Fo=function(t,e,n){var r=t+e,i=r-t,o=e-i,s=t-(r-i);return n?(n[0]=s+o,n[1]=r,n):[s+o,r]},qo=function(t,e){var n=t.length;if(1===n){var r=To(t[0],e);return r[0]?r:[r[1]]}var i=new Array(2*n),o=[.1,.1],s=[.1,.1],a=0;To(t[0],e,o),o[0]&&(i[a++]=o[0]);for(var u=1;u<n;++u){To(t[u],e,s);var c=o[1];Fo(c,s[0],o),o[0]&&(i[a++]=o[0]);var h=s[1],l=o[1],p=h+l,f=l-(p-h);o[1]=p,f&&(i[a++]=f)}return o[1]&&(i[a++]=o[1]),0===a&&(i[a++]=0),i.length=a,i},Go=function(t,e){var n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){var n=t+e,r=n-t,i=t-(n-r)+(e-r);return i?[i,n]:[n]}(t[0],-e[0]);var i,o,s=new Array(n+r),a=0,u=0,c=0,h=Math.abs,l=t[u],p=h(l),f=-e[c],g=h(f);p<g?(o=l,(u+=1)<n&&(p=h(l=t[u]))):(o=f,(c+=1)<r&&(g=h(f=-e[c]))),u<n&&p<g||c>=r?(i=l,(u+=1)<n&&(p=h(l=t[u]))):(i=f,(c+=1)<r&&(g=h(f=-e[c])));for(var d,y,_=i+o,m=_-i,v=o-m,x=v,E=_;u<n&&c<r;)p<g?(i=l,(u+=1)<n&&(p=h(l=t[u]))):(i=f,(c+=1)<r&&(g=h(f=-e[c]))),(v=(o=x)-(m=(_=i+o)-i))&&(s[a++]=v),x=E-((d=E+_)-(y=d-E))+(_-y),E=d;for(;u<n;)(v=(o=x)-(m=(_=(i=l)+o)-i))&&(s[a++]=v),x=E-((d=E+_)-(y=d-E))+(_-y),E=d,(u+=1)<n&&(l=t[u]);for(;c<r;)(v=(o=x)-(m=(_=(i=f)+o)-i))&&(s[a++]=v),x=E-((d=E+_)-(y=d-E))+(_-y),E=d,(c+=1)<r&&(f=-e[c]);return x&&(s[a++]=x),E&&(s[a++]=E),a||(s[a++]=0),s.length=a,s},Bo=yt((function(t){function e(t,e){for(var n=new Array(t.length-1),r=1;r<t.length;++r)for(var i=n[r-1]=new Array(t.length-1),o=0,s=0;o<t.length;++o)o!==e&&(i[s++]=t[r][o]);return n}function n(t){return 1&t?"-":""}function r(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",r(t.slice(0,e)),",",r(t.slice(e)),")"].join("")}function i(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var o=[],s=0;s<t.length;++s)o.push(["scale(",r(i(e(t,s))),",",n(s),t[0][s],")"].join(""));return o}function o(t){for(var n=[],o=[],s=function(t){for(var e=new Array(t),n=0;n<t;++n){e[n]=new Array(t);for(var r=0;r<t;++r)e[n][r]=["m",r,"[",t-n-1,"]"].join("")}return e}(t),a=[],u=0;u<t;++u)0==(1&u)?n.push.apply(n,i(e(s,u))):o.push.apply(o,i(e(s,u))),a.push("m"+u);var c=r(n),h=r(o),l="orientation"+t+"Exact",p=["function ",l,"(",a.join(),"){var p=",c,",n=",h,",d=sub(p,n);return d[d.length-1];};return ",l].join("");return new Function("sum","prod","scale","sub",p)(Do,To,qo,Go)}var s=o(3),a=o(4),u=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,n){var r,i=(t[1]-n[1])*(e[0]-n[0]),o=(t[0]-n[0])*(e[1]-n[1]),a=i-o;if(i>0){if(o<=0)return a;r=i+o}else{if(!(i<0))return a;if(o>=0)return a;r=-(i+o)}var u=33306690738754716e-32*r;return a>=u||a<=-u?a:s(t,e,n)},function(t,e,n,r){var i=t[0]-r[0],o=e[0]-r[0],s=n[0]-r[0],u=t[1]-r[1],c=e[1]-r[1],h=n[1]-r[1],l=t[2]-r[2],p=e[2]-r[2],f=n[2]-r[2],g=o*h,d=s*c,y=s*u,_=i*h,m=i*c,v=o*u,x=l*(g-d)+p*(y-_)+f*(m-v),E=7771561172376103e-31*((Math.abs(g)+Math.abs(d))*Math.abs(l)+(Math.abs(y)+Math.abs(_))*Math.abs(p)+(Math.abs(m)+Math.abs(v))*Math.abs(f));return x>E||-x>E?x:a(t,e,n,r)}];!function(){for(;u.length<=5;)u.push(o(u.length));for(var e=[],n=["slow"],r=0;r<=5;++r)e.push("a"+r),n.push("o"+r);var i=["function getOrientation(",e.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(r=2;r<=5;++r)i.push("case ",r,":return o",r,"(",e.slice(0,r).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),n.push(i.join(""));var s=Function.apply(void 0,n);for(t.exports=s.apply(void 0,[function(t){var e=u[t.length];return e||(e=u[t.length]=o(t.length)),e.apply(void 0,t)}].concat(u)),r=0;r<=5;++r)t.exports[r]=u[r]}()})),ko=function(t){var e=t.length;if(e<3){for(var n=new Array(e),r=0;r<e;++r)n[r]=r;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:n}var i=new Array(e);for(r=0;r<e;++r)i[r]=r;i.sort((function(e,n){return t[e][0]-t[n][0]||t[e][1]-t[n][1]}));var o=[i[0],i[1]],s=[i[0],i[1]];for(r=2;r<e;++r){for(var a=i[r],u=t[a],c=o.length;c>1&&zo(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(a),c=s.length;c>1&&zo(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(a)}n=new Array(s.length+o.length-2);for(var h=0,l=(r=0,o.length);r<l;++r)n[h++]=o[r];for(var p=s.length-2;p>0;--p)n[h++]=s[p];return n},zo=Bo[3],jo=_t,Xo=_t;_t.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up: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},_down:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=o+1,a=e[o];if(s<this.length&&n(e[s],a)<0&&(o=s,a=e[s]),n(a,i)>=0)break;e[t]=a,t=o}e[t]=i}},jo.default=Xo;var Uo=function(t,e){for(var n=t[0],r=t[1],i=!1,o=0,s=e.length-1;o<e.length;s=o++){var a=e[o][0],u=e[o][1],c=e[s][0],h=e[s][1];u>r!=h>r&&n<(c-a)*(r-u)/(h-u)+a&&(i=!i)}return i},Yo=Bo[3],Vo=mt,Ho=mt;Vo.default=Ho;var Wo=function(t){return t},Jo=function(t){if(null==t)return Wo;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,a){a||(e=n=0);var u=2,c=t.length,h=new Array(c);for(h[0]=(e+=t[0])*r+o,h[1]=(n+=t[1])*i+s;u<c;)h[u]=t[u],++u;return h}},Zo=function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n},Ko=function(t,e){function n(t,e){for(var n in t){var i=t[n];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){r[t<0?~t:t]=1})),s.push(i)}}var r={},i={},o={},s=[],a=-1;return e.forEach((function(n,r){var i,o=t.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++a],e[a]=n,e[r]=i)})),e.forEach((function(e){var n,r,s=function(e){var n,r=t.arcs[e<0?~e:e],i=r[0];return t.transform?(n=[0,0],r.forEach((function(t){n[0]+=t[0],n[1]+=t[1]}))):n=r[r.length-1],e<0?[n,i]:[i,n]}(e),a=s[0],u=s[1];if(n=o[a])if(delete o[n.end],n.push(e),n.end=u,r=i[u]){delete i[r.start];var c=r===n?n:n.concat(r);i[c.start=n.start]=o[c.end=r.end]=c}else i[n.start]=o[n.end]=n;else if(n=i[u])if(delete i[n.start],n.unshift(e),n.start=a,r=o[a]){delete o[r.end];var h=r===n?n:r.concat(n);i[h.start=r.start]=o[h.end=n.end]=h}else i[n.start]=o[n.end]=n;else i[(n=[e]).start=a]=o[n.end=u]=n})),n(o,i),n(i,o),e.forEach((function(t){r[t<0?~t:t]||s.push([t])})),s},Qo=function(t){return Bt(t,kt.apply(this,arguments))},$o=function(t,e,n,r,i,o){3===arguments.length&&(r=o=Array,i=null);for(var s=new r(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),a=new o(t),u=t-1,c=0;c<t;++c)s[c]=i;return{set:function(r,o){for(var c=e(r)&u,h=s[c],l=0;h!=i;){if(n(h,r))return a[c]=o;if(++l>=t)throw new Error("full hashmap");h=s[c=c+1&u]}return s[c]=r,a[c]=o,o},maybeSet:function(r,o){for(var c=e(r)&u,h=s[c],l=0;h!=i;){if(n(h,r))return a[c];if(++l>=t)throw new Error("full hashmap");h=s[c=c+1&u]}return s[c]=r,a[c]=o,o},get:function(r,o){for(var c=e(r)&u,h=s[c],l=0;h!=i;){if(n(h,r))return a[c];if(++l>=t)break;h=s[c=c+1&u]}return o},keys:function(){for(var t=[],e=0,n=s.length;e<n;++e){var r=s[e];r!=i&&t.push(r)}return t}}},ts=function(t,e){return t[0]===e[0]&&t[1]===e[1]},es=new ArrayBuffer(16),ns=new Float64Array(es),rs=new Uint32Array(es),is=function(t){ns[0]=t[0],ns[1]=t[1];var e=rs[0]^rs[1];return 2147483647&(e<<5^e>>7^rs[2]^rs[3])},os=function(t){var e,n,r,i=function(t){function e(t,e,n,r){if(p[n]!==t){p[n]=t;var i=f[n];if(i>=0){var o=g[n];i===e&&o===r||i===r&&o===e||(++y,d[n]=1)}else f[n]=e,g[n]=r}}function n(t){return is(u[t])}function r(t,e){return ts(u[t],u[e])}var i,o,s,a,u=t.coordinates,c=t.lines,h=t.rings,l=function(){for(var t=$o(1.4*u.length,n,r,Int32Array,-1,Int32Array),e=new Int32Array(u.length),i=0,o=u.length;i<o;++i)e[i]=t.maybeSet(i,i);return e}(),p=new Int32Array(u.length),f=new Int32Array(u.length),g=new Int32Array(u.length),d=new Int8Array(u.length),y=0;for(i=0,o=u.length;i<o;++i)p[i]=f[i]=g[i]=-1;for(i=0,o=c.length;i<o;++i){var _=c[i],m=_[0],v=_[1];for(s=l[m],a=l[++m],++y,d[s]=1;++m<=v;)e(i,s,s=a,a=l[m]);++y,d[a]=1}for(i=0,o=u.length;i<o;++i)p[i]=-1;for(i=0,o=h.length;i<o;++i){var x=h[i],E=x[0]+1,w=x[1];for(e(i,l[w-1],s=l[E-1],a=l[E]);++E<=w;)e(i,s,s=a,a=l[E])}p=f=g=null;var b,I=function(t,e,n,r,i){3===arguments.length&&(r=Array,i=null);for(var o=new r(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),s=t-1,a=0;a<t;++a)o[a]=i;return{add:function(r){for(var a=e(r)&s,u=o[a],c=0;u!=i;){if(n(u,r))return!0;if(++c>=t)throw new Error("full hashset");u=o[a=a+1&s]}return o[a]=r,!0},has:function(r){for(var a=e(r)&s,u=o[a],c=0;u!=i;){if(n(u,r))return!0;if(++c>=t)break;u=o[a=a+1&s]}return!1},values:function(){for(var t=[],e=0,n=o.length;e<n;++e){var r=o[e];r!=i&&t.push(r)}return t}}}(1.4*y,is,ts);for(i=0,o=u.length;i<o;++i)d[b=l[i]]&&I.add(u[b]);return I}(t),o=t.coordinates,s=t.lines,a=t.rings;for(n=0,r=s.length;n<r;++n)for(var u=s[n],c=u[0],h=u[1];++c<h;)i.has(o[c])&&(e={0:c,1:u[1]},u[1]=c,u=u.next=e);for(n=0,r=a.length;n<r;++n)for(var l=a[n],p=l[0],f=p,g=l[1],d=i.has(o[p]);++f<g;)i.has(o[f])&&(d?(e={0:f,1:l[1]},l[1]=f,l=l.next=e):(function(t,e,n,r){zt(t,e,n),zt(t,e,e+r),zt(t,e+r,n)}(o,p,g,g-f),o[g]=o[p],d=!0,f=p));return t},ss=function(t,e){function n(t){t&&h.hasOwnProperty(t.type)&&h[t.type](t)}function r(t){var e=[];do{var n=c.get(t);e.push(t[0]<t[1]?n:~n)}while(t=t.next);return e}function i(t){return t.map(r)}var o=function(t){function e(t){null!=t&&c.hasOwnProperty(t.type)&&c[t.type](t)}function n(t){var e=t[0],n=t[1];e<o&&(o=e),e>a&&(a=e),n<s&&(s=n),n>u&&(u=n)}function r(t){t.forEach(n)}function i(t){t.forEach(r)}var o=1/0,s=1/0,a=-1/0,u=-1/0,c={GeometryCollection:function(t){t.geometries.forEach(e)},Point:function(t){n(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(n)},LineString:function(t){r(t.arcs)},MultiLineString:function(t){t.arcs.forEach(r)},Polygon:function(t){t.arcs.forEach(r)},MultiPolygon:function(t){t.arcs.forEach(i)}};for(var h in t)e(t[h]);return a>=o&&u>=s?[o,s,a,u]:void 0}(t=function(t){var e,n={};for(e in t)n[e]=jt(t[e]);return n}(t)),s=e>0&&o&&function(t,e,n){function r(t){return[Math.round((t[0]-c)*f),Math.round((t[1]-h)*g)]}function i(t,e){for(var n,r,i,o,s,a=-1,u=0,l=t.length,p=new Array(l);++a<l;)n=t[a],o=Math.round((n[0]-c)*f),s=Math.round((n[1]-h)*g),o===r&&s===i||(p[u++]=[r=o,i=s]);for(p.length=u;u<e;)u=p.push([p[0][0],p[0][1]]);return p}function o(t){return i(t,2)}function s(t){return i(t,4)}function a(t){return t.map(s)}function u(t){null!=t&&d.hasOwnProperty(t.type)&&d[t.type](t)}var c=e[0],h=e[1],l=e[2],p=e[3],f=l-c?(n-1)/(l-c):1,g=p-h?(n-1)/(p-h):1,d={GeometryCollection:function(t){t.geometries.forEach(u)},Point:function(t){t.coordinates=r(t.coordinates)},MultiPoint:function(t){t.coordinates=t.coordinates.map(r)},LineString:function(t){t.arcs=o(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(o)},Polygon:function(t){t.arcs=a(t.arcs)},MultiPolygon:function(t){t.arcs=t.arcs.map(a)}};for(var y in t)u(t[y]);return{scale:[1/f,1/g],translate:[c,h]}}(t,o,e),a=function(t){function e(t){var e,n,r,i,o,s,a,u;if(r=f.get(e=c[t[0]]))for(a=0,u=r.length;a<u;++a)if(function(t,e){var n=t[0],r=e[0],i=t[1];if(n-i!=r-e[1])return!1;for(;n<=i;++n,++r)if(!ts(c[n],c[r]))return!1;return!0}(i=r[a],t))return t[0]=i[0],void(t[1]=i[1]);if(o=f.get(n=c[t[1]]))for(a=0,u=o.length;a<u;++a)if(function(t,e){var n=t[0],r=e[0],i=t[1],o=e[1];if(n-i!=r-o)return!1;for(;n<=i;++n,--o)if(!ts(c[n],c[o]))return!1;return!0}(s=o[a],t))return t[1]=s[0],void(t[0]=s[1]);r?r.push(t):f.set(e,[t]),o?o.push(t):f.set(n,[t]),g.push(t)}function n(t,e){var n=t[0],r=e[0],o=t[1]-n;if(o!==e[1]-r)return!1;for(var s=i(t),a=i(e),u=0;u<o;++u)if(!ts(c[n+(u+s)%o],c[r+(u+a)%o]))return!1;return!0}function r(t,e){var n=t[0],r=e[0],o=t[1],s=e[1],a=o-n;if(a!==s-r)return!1;for(var u=i(t),h=a-i(e),l=0;l<a;++l)if(!ts(c[n+(l+u)%a],c[s-(l+h)%a]))return!1;return!0}function i(t){for(var e=t[0],n=t[1],r=e,i=r,o=c[r];++r<n;){var s=c[r];(s[0]<o[0]||s[0]===o[0]&&s[1]<o[1])&&(i=r,o=s)}return i-e}var o,s,a,u,c=t.coordinates,h=t.lines,l=t.rings,p=h.length+l.length;for(delete t.lines,delete t.rings,a=0,u=h.length;a<u;++a)for(o=h[a];o=o.next;)++p;for(a=0,u=l.length;a<u;++a)for(s=l[a];s=s.next;)++p;var f=$o(2*p*1.4,is,ts),g=t.arcs=[];for(a=0,u=h.length;a<u;++a){o=h[a];do{e(o)}while(o=o.next)}for(a=0,u=l.length;a<u;++a)if((s=l[a]).next)do{e(s)}while(s=s.next);else!function(t){var e,o,s,a,u;if(o=f.get(c[t[0]]))for(a=0,u=o.length;a<u;++a){if(n(s=o[a],t))return t[0]=s[0],void(t[1]=s[1]);if(r(s,t))return t[0]=s[1],void(t[1]=s[0])}if(o=f.get(e=c[t[0]+i(t)]))for(a=0,u=o.length;a<u;++a){if(n(s=o[a],t))return t[0]=s[0],void(t[1]=s[1]);if(r(s,t))return t[0]=s[1],void(t[1]=s[0])}o?o.push(t):f.set(e,[t]),g.push(t)}(s);return t}(os(function(t){function e(t){t&&c.hasOwnProperty(t.type)&&c[t.type](t)}function n(t){for(var e=0,n=t.length;e<n;++e)u[++o]=t[e];var r={0:o-n+1,1:o};return s.push(r),r}function r(t){for(var e=0,n=t.length;e<n;++e)u[++o]=t[e];var r={0:o-n+1,1:o};return a.push(r),r}function i(t){return t.map(r)}var o=-1,s=[],a=[],u=[],c={GeometryCollection:function(t){t.geometries.forEach(e)},LineString:function(t){t.arcs=n(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(n)},Polygon:function(t){t.arcs=t.arcs.map(r)},MultiPolygon:function(t){t.arcs=t.arcs.map(i)}};for(var h in t)e(t[h]);return{type:"Topology",coordinates:u,lines:s,rings:a,objects:t}}(t))),u=a.coordinates,c=$o(1.4*a.arcs.length,Yt,Vt);t=a.objects,a.bbox=o,a.arcs=a.arcs.map((function(t,e){return c.set(t,e),u.slice(t[0],t[1]+1)})),delete a.coordinates,u=null;var h={GeometryCollection:function(t){t.geometries.forEach(n)},LineString:function(t){t.arcs=r(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(r)},Polygon:function(t){t.arcs=t.arcs.map(r)},MultiPolygon:function(t){t.arcs=t.arcs.map(i)}};for(var l in t)n(t[l]);return s&&(a.transform=s,a.arcs=function(t){for(var e=-1,n=t.length;++e<n;){for(var r,i,o=t[e],s=0,a=1,u=o.length,c=o[0],h=c[0],l=c[1];++s<u;)r=(c=o[s])[0],i=c[1],r===h&&i===l||(o[a++]=[r-h,i-l],h=r,l=i);1===a&&(o[a++]=[0,0]),o.length=a}return t}(a.arcs)),a},as=function(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(e=0;e<this.length-1;e++){var n=this.points[e],r=this.points[e+1];this.centers.push({x:(n.x+r.x)/2,y:(n.y+r.y)/2,z:(n.z+r.z)/2})}for(this.controls.push([this.points[0],this.points[0]]),e=0;e<this.centers.length-1;e++){n=this.centers[e],r=this.centers[e+1];var i=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,o=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,s=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+s)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+s)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this};as.prototype.cacheSteps=function(t){var e=[],n=this.pos(0);e.push(0);for(var r=0;r<this.duration;r+=10){var i=this.pos(r);Math.sqrt((i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y)+(i.z-n.z)*(i.z-n.z))>t&&(e.push(r),n=i)}return e},as.prototype.vector=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))}},as.prototype.pos=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 function(t,e,n,r,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(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]}}((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])};var us=pe,cs=pe;pe.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Ce(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var c=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Ce(t,c,h,n))}var l=0;for(a=0;a<r.length;a+=3){var p=r[a]*n,f=r[a+1]*n,g=r[a+2]*n;l+=Math.abs((t[p]-t[g])*(t[f+1]-t[p+1])-(t[p]-t[f])*(t[g+1]-t[p+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},pe.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n},us.default=cs,Oe.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!ke(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],ke(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):Be(t,a)?this._all(s,n):u.push(s));e=u.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!ke(t,e))return!1;for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],ke(t,s=e.leaf?n(o):o)){if(e.leaf||Be(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var i=this.data;this.data=r,r=i}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=ze([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],c=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=c.pop(),o=!0),s.leaf&&-1!==(i=function(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!Be(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),c.push(n),n=0,r=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:De,compareMinY:Fe,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return Re(i=ze(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=ze([])).leaf=!1,i.height=r;var a,u,c,h,l=Math.ceil(o/s),p=l*Math.ceil(Math.sqrt(s));for(je(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(je(t,a,c=Math.min(a+p-1,n),l,this.compareMinY),u=a;u<=c;u+=l)h=Math.min(u+l-1,c),i.children.push(this._build(t,u,h,r-1));return Re(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,c,h,l;r.push(e),!e.leaf&&r.length-1!==n;){for(h=l=1/0,i=0,o=e.children.length;i<o;i++)u=qe(s=e.children[i]),(c=function(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}(t,s)-u)<l?(l=c,h=u<h?u:h,a=s):c===l&&u<h&&(h=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,i=n?t:r(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),Ae(s,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split: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),s=ze(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,Re(n,this.toBBox),Re(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=ze([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Re(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,c,h;for(u=c=1/0,r=e;r<=n-e;r++)s=function(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}(i=Te(t,0,r,this.toBBox),o=Te(t,r,n,this.toBBox)),a=qe(i)+qe(o),s<u?(u=s,h=r,c=a<c?a:c):s===u&&a<c&&(c=a,h=r);return h},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:De,i=t.leaf?this.compareMinY:Fe;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);var i,o,s=this.toBBox,a=Te(t,0,e,s),u=Te(t,n-e,n,s),c=Ge(a)+Ge(u);for(i=e;i<n-e;i++)o=t.children[i],Ae(a,t.leaf?s(o):o),c+=Ge(a);for(i=n-e-1;i>=e;i--)o=t.children[i],Ae(u,t.leaf?s(o):o),c+=Ge(u);return c},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)Ae(e[r],t)},_condense: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():Re(t[n],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};var hs=Object.freeze({toMercator:$e,toWgs84:tn}),ls=6378137,ps=function(t){function e(){for(var t=[],e=0;e<g.features.length;e++)-1==g.features[e].properties.parent&&t.push(e);if(t.length>1)for(e=0;e<t.length;e++){for(var n=-1,r=0;r<g.features.length;r++)t[e]!=r&&Mt(g.features[t[e]].geometry.coordinates[0][0],g.features[r],{ignoreBoundary:!0})&&cn(g.features[r])<1/0&&(n=r);g.features[t[e]].properties.parent=n}}function n(){for(var t=0;t<g.features.length;t++)if(-1==g.features[t].properties.parent){var e=g.features[t].properties.winding;g.features[t].properties.netWinding=e,r(t,e)}}function r(t,e){for(var n=0;n<g.features.length;n++)if(g.features[n].properties.parent==t){var i=e+g.features[n].properties.winding;g.features[n].properties.netWinding=i,r(n,i)}}if("Feature"!=t.type)throw new Error("The input must a geojson object of type Feature");if(void 0===t.geometry||null==t.geometry)throw new Error("The input must a geojson object with a non-empty geometry");if("Polygon"!=t.geometry.type)throw new Error("The input must be a geojson Polygon");for(var i=t.geometry.coordinates.length,s=[],a=0;a<i;a++){var u=t.geometry.coordinates[a];bn(u[0],u[u.length-1])||u.push(u[0]),s.push.apply(s,u.slice(0,u.length-1))}if(!function(t){for(var e={},n=1,r=0,i=t.length;r<i;++r){if(e.hasOwnProperty(t[r])){n=0;break}e[t[r]]=1}return n}(s))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var h=s.length,l=function(t,e,n){function r(t,n,r,i){var u,c,h=o[t][n],l=o[t][n+1],p=o[r][i],f=o[r][i+1],g=function(t,e,n,r){if(En(t,n)||En(t,r)||En(e,n)||En(r,n))return null;var i=t[0],o=t[1],s=e[0],a=e[1],u=n[0],c=n[1],h=r[0],l=r[1],p=(i-s)*(c-l)-(o-a)*(u-h);return 0===p?null:[((i*a-o*s)*(u-h)-(i-s)*(u*l-c*h))/p,((i*a-o*s)*(c-l)-(o-a)*(u*l-c*h))/p]}(h,l,p,f);if(null!==g&&(u=l[0]!==h[0]?(g[0]-h[0])/(l[0]-h[0]):(g[1]-h[1])/(l[1]-h[1]),c=f[0]!==p[0]?(g[0]-p[0])/(f[0]-p[0]):(g[1]-p[1])/(f[1]-p[1]),!(u>=1||u<=0||c>=1||c<=0))){var d=g,y=!a[d];y&&(a[d]=!0),e?s.push(e(g,t,n,h,l,u,r,i,p,f,c,y)):s.push(g)}}function i(t,e){var n,r,i,s,a=o[t][e],u=o[t][e+1];return a[0]<u[0]?(n=a[0],r=u[0]):(n=u[0],r=a[0]),a[1]<u[1]?(i=a[1],s=u[1]):(i=u[1],s=a[1]),{minX:n,minY:i,maxX:r,maxY:s,ring:t,edge:e}}if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===n&&(n=1);var o=t.geometry.coordinates,s=[],a={};if(n){for(var u=[],c=0;c<o.length;c++)for(var h=0;h<o[c].length-1;h++)u.push(i(c,h));var l=Ro();l.load(u)}for(var p=0;p<o.length;p++)for(var f=0;f<o[p].length-1;f++)if(n)l.search(i(p,f)).forEach((function(t){var e=t.ring,n=t.edge;r(p,f,e,n)}));else for(var g=0;g<o.length;g++)for(var d=0;d<o[g].length-1;d++)r(p,f,g,d);return e||(s={type:"Feature",geometry:{type:"MultiPoint",coordinates:s}}),s}(t,(function(t,e,n,r,i,o,s,a,u,c,h,l){return[t,e,n,r,i,o,s,a,u,c,h,l]})),p=l.length;if(0==p){var f=[];for(a=0;a<i;a++)f.push(o([t.geometry.coordinates[a]],{parent:-1,winding:function(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);if(wn([t[(e-1).modulo(t.length-1)],t[e],t[(e+1).modulo(t.length-1)]],!0))var r=1;else r=-1;return r}(t.geometry.coordinates[a])}));var g=c(f);return e(),n(),g}var d=[],y=[];for(a=0;a<i;a++){d.push([]);for(var _=0;_<t.geometry.coordinates[a].length-1;_++)d[a].push([new fs(t.geometry.coordinates[a][(_+1).modulo(t.geometry.coordinates[a].length-1)],1,[a,_],[a,(_+1).modulo(t.geometry.coordinates[a].length-1)],void 0)]),y.push(new gs(t.geometry.coordinates[a][_],[a,(_-1).modulo(t.geometry.coordinates[a].length-1)],[a,_],void 0,void 0,!1,!0))}for(a=0;a<p;a++)d[l[a][1]][l[a][2]].push(new fs(l[a][0],l[a][5],[l[a][1],l[a][2]],[l[a][6],l[a][7]],void 0)),l[a][11]&&y.push(new gs(l[a][0],[l[a][1],l[a][2]],[l[a][6],l[a][7]],void 0,void 0,!0,!0));var m=y.length;for(a=0;a<d.length;a++)for(_=0;_<d[a].length;_++)d[a][_].sort((function(t,e){return t.param<e.param?-1:1}));var v=[];for(a=0;a<m;a++)v.push({minX:y[a].coord[0],minY:y[a].coord[1],maxX:y[a].coord[0],maxY:y[a].coord[1],index:a});var x=Ro();for(x.load(v),a=0;a<d.length;a++)for(_=0;_<d[a].length;_++)for(var E=0;E<d[a][_].length;E++){b=E==d[a][_].length-1?d[a][(_+1).modulo(t.geometry.coordinates[a].length-1)][0].coord:d[a][_][E+1].coord;var w=x.search({minX:b[0],minY:b[1],maxX:b[0],maxY:b[1]})[0];d[a][_][E].nxtIsectAlongEdgeIn=w.index}for(a=0;a<d.length;a++)for(_=0;_<d[a].length;_++)for(E=0;E<d[a][_].length;E++){var b=d[a][_][E].coord,I=(w=x.search({minX:b[0],minY:b[1],maxX:b[0],maxY:b[1]})[0]).index;I<h?y[I].nxtIsectAlongRingAndEdge2=d[a][_][E].nxtIsectAlongEdgeIn:bn(y[I].ringAndEdge1,d[a][_][E].ringAndEdgeIn)?y[I].nxtIsectAlongRingAndEdge1=d[a][_][E].nxtIsectAlongEdgeIn:y[I].nxtIsectAlongRingAndEdge2=d[a][_][E].nxtIsectAlongEdgeIn}var N=[];for(a=0,_=0;_<i;_++){var C=a;for(E=0;E<t.geometry.coordinates[_].length-1;E++)y[a].coord[0]<y[C].coord[0]&&(C=a),a++;var S=y[C].nxtIsectAlongRingAndEdge2;for(E=0;E<y.length;E++)if(y[E].nxtIsectAlongRingAndEdge1==C||y[E].nxtIsectAlongRingAndEdge2==C){var M=E;break}var L=wn([y[M].coord,y[C].coord,y[S].coord],!0)?1:-1;N.push({isect:C,parent:-1,winding:L})}for(N.sort((function(t,e){return y[t.isect].coord>y[e.isect].coord?-1:1})),f=[];N.length>0;){var P=N.pop(),O=P.isect,R=P.parent,T=P.winding,A=f.length,D=[y[O].coord],F=O;if(y[O].ringAndEdge1Walkable)var q=y[O].ringAndEdge1,G=y[O].nxtIsectAlongRingAndEdge1;else q=y[O].ringAndEdge2,G=y[O].nxtIsectAlongRingAndEdge2;for(;!bn(y[O].coord,y[G].coord);){D.push(y[G].coord);var B=void 0;for(a=0;a<N.length;a++)if(N[a].isect==G){B=a;break}if(null!=B&&N.splice(B,1),bn(q,y[G].ringAndEdge1)){if(q=y[G].ringAndEdge2,y[G].ringAndEdge2Walkable=!1,y[G].ringAndEdge1Walkable){var k={isect:G};wn([y[F].coord,y[G].coord,y[y[G].nxtIsectAlongRingAndEdge2].coord],1==T)?(k.parent=R,k.winding=-T):(k.parent=A,k.winding=T),N.push(k)}F=G,G=y[G].nxtIsectAlongRingAndEdge2}else q=y[G].ringAndEdge1,y[G].ringAndEdge1Walkable=!1,y[G].ringAndEdge2Walkable&&(k={isect:G},wn([y[F].coord,y[G].coord,y[y[G].nxtIsectAlongRingAndEdge1].coord],1==T)?(k.parent=R,k.winding=-T):(k.parent=A,k.winding=T),N.push(k)),F=G,G=y[G].nxtIsectAlongRingAndEdge1}D.push(y[G].coord),f.push(o([D],{index:A,parent:R,winding:T,netWinding:void 0}))}return g=c(f),e(),n(),g},fs=function(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i},gs=function(t,e,n,r,i,o,s){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=n,this.nxtIsectAlongRingAndEdge1=r,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=s};Number.prototype.modulo=function(t){return(this%t+t)%t};var ds=Math.PI/180,ys=180/Math.PI,_s=function(t,e){this.lon=t,this.lat=e,this.x=ds*t,this.y=ds*e};_s.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},_s.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new _s(e,t)};var ms=function(){this.coords=[],this.length=0};ms.prototype.move_to=function(t){this.length++,this.coords.push(t)};var vs=function(t){this.properties=t||{},this.geometries=[]};vs.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;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},vs.prototype.wkt=function(){for(var t="",e="LINESTRING(",n=function(t){e+=t[0]+" "+t[1]+","},r=0;r<this.geometries.length;r++){if(0===this.geometries[r].coords.length)return"LINESTRING(empty)";this.geometries[r].coords.forEach(n),t+=e.substring(0,e.length-1)+")"}return t};var xs=function(t,e,n){if(!t||void 0===t.x||void 0===t.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||void 0===e.x||void 0===e.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new _s(t.x,t.y),this.end=new _s(e.x,e.y),this.properties=n||{};var r=this.start.x-this.end.x,i=this.start.y-this.end.y,o=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(r/2),2);if(this.g=2*Math.asin(Math.sqrt(o)),this.g===Math.PI)throw new Error("it appears "+t.view()+" and "+e.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};xs.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),n=Math.sin(t*this.g)/Math.sin(this.g),r=e*Math.cos(this.start.y)*Math.cos(this.start.x)+n*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+n*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+n*Math.sin(this.end.y),s=ys*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[ys*Math.atan2(i,r),s]},xs.prototype.Arc=function(t,e){var n=[];if(!t||t<=2)n.push([this.start.lon,this.start.lat]),n.push([this.end.lon,this.end.lat]);else for(var r=1/(t-1),i=0;i<t;++i){var o=r*i,s=this.interpolate(o);n.push(s)}for(var a=!1,u=0,c=e&&e.offset?e.offset:10,h=180-c,l=-180+c,p=360-c,f=1;f<n.length;++f){var g=n[f-1][0],d=n[f][0],y=Math.abs(d-g);y>p&&(d>h&&g<l||g>h&&d<l)?a=!0:y>u&&(u=y)}var _=[];if(a&&u<c){var m=[];_.push(m);for(var v=0;v<n.length;++v){var x=parseFloat(n[v][0]);if(v>0&&Math.abs(x-n[v-1][0])>p){var E=parseFloat(n[v-1][0]),w=parseFloat(n[v-1][1]),b=parseFloat(n[v][0]),I=parseFloat(n[v][1]);if(E>-180&&E<l&&180===b&&v+1<n.length&&n[v-1][0]>-180&&n[v-1][0]<l){m.push([-180,n[v][1]]),v++,m.push([n[v][0],n[v][1]]);continue}if(E>h&&E<180&&-180===b&&v+1<n.length&&n[v-1][0]>h&&n[v-1][0]<180){m.push([180,n[v][1]]),v++,m.push([n[v][0],n[v][1]]);continue}if(E<l&&b>h){var N=E;E=b,b=N;var C=w;w=I,I=C}if(E>h&&b<l&&(b+=360),E<=180&&b>=180&&E<b){var S=(180-E)/(b-E),M=S*I+(1-S)*w;m.push([n[v-1][0]>h?180:-180,M]),(m=[]).push([n[v-1][0]>h?-180:180,M]),_.push(m)}else m=[],_.push(m);m.push([x,n[v][1]])}else m.push([n[v][0],n[v][1]])}}else{var L=[];_.push(L);for(var P=0;P<n.length;++P)L.push([n[P][0],n[P][1]])}for(var O=new vs(this.properties),R=0;R<_.length;++R){var T=new ms;O.geometries.push(T);for(var A=_[R],D=0;D<A.length;++D)T.move_to(A[D])}return O};var Es=Dn;Dn.polyline=Dn,Dn.polygon=function(t,e){var n,r,i,o,s,a,u;for(r=1;r<=8;r*=2){for(n=[],o=!(qn(i=t[t.length-1],e)&r),s=0;s<t.length;s++)(u=!(qn(a=t[s],e)&r))!==o&&n.push(Fn(i,a,r,e)),u&&n.push(a),i=a,o=u;if(!(t=n).length)break}return n};var ws=Array.prototype.slice,bs={successCallback:null,verbose:!1,polygons:!1},Is={},Ns=64,Cs=16,Ss=4,Ms=1,Ls=[],Ps=[],Os=[],Rs=[],Ts=[],As=[],Ds=[],Fs=[],qs=[],Gs=[],Bs=[],ks=[],zs=[],js=[],Xs=[],Us=[],Ys=[],Vs=[],Hs=[],Ws=[],Js=[],Zs=[],Ks=[],Qs=[];Ds[85]=Gs[85]=-1,Fs[85]=Bs[85]=0,qs[85]=ks[85]=1,Hs[85]=Zs[85]=1,Ws[85]=Ks[85]=0,Js[85]=Qs[85]=1,Ls[85]=Rs[85]=0,Ps[85]=Ts[85]=-1,Os[85]=Xs[85]=0,Us[85]=zs[85]=0,Ys[85]=js[85]=1,As[85]=Vs[85]=1,Zs[1]=Zs[169]=0,Ks[1]=Ks[169]=-1,Qs[1]=Qs[169]=0,zs[1]=zs[169]=-1,js[1]=js[169]=0,Xs[1]=Xs[169]=0,Gs[4]=Gs[166]=0,Bs[4]=Bs[166]=-1,ks[4]=ks[166]=1,Us[4]=Us[166]=1,Ys[4]=Ys[166]=0,Vs[4]=Vs[166]=0,Ds[16]=Ds[154]=0,Fs[16]=Fs[154]=1,qs[16]=qs[154]=1,Rs[16]=Rs[154]=1,Ts[16]=Ts[154]=0,As[16]=As[154]=1,Hs[64]=Hs[106]=0,Ws[64]=Ws[106]=1,Js[64]=Js[106]=0,Ls[64]=Ls[106]=-1,Ps[64]=Ps[106]=0,Os[64]=Os[106]=1,Hs[2]=Hs[168]=0,Ws[2]=Ws[168]=-1,Js[2]=Js[168]=1,Zs[2]=Zs[168]=0,Ks[2]=Ks[168]=-1,Qs[2]=Qs[168]=0,zs[2]=zs[168]=-1,js[2]=js[168]=0,Xs[2]=Xs[168]=0,Us[2]=Us[168]=-1,Ys[2]=Ys[168]=0,Vs[2]=Vs[168]=1,Ds[8]=Ds[162]=0,Fs[8]=Fs[162]=-1,qs[8]=qs[162]=0,Gs[8]=Gs[162]=0,Bs[8]=Bs[162]=-1,ks[8]=ks[162]=1,zs[8]=zs[162]=1,js[8]=js[162]=0,Xs[8]=Xs[162]=1,Us[8]=Us[162]=1,Ys[8]=Ys[162]=0,Vs[8]=Vs[162]=0,Ds[32]=Ds[138]=0,Fs[32]=Fs[138]=1,qs[32]=qs[138]=1,Gs[32]=Gs[138]=0,Bs[32]=Bs[138]=1,ks[32]=ks[138]=0,Ls[32]=Ls[138]=1,Ps[32]=Ps[138]=0,Os[32]=Os[138]=0,Rs[32]=Rs[138]=1,Ts[32]=Ts[138]=0,As[32]=As[138]=1,Zs[128]=Zs[42]=0,Ks[128]=Ks[42]=1,Qs[128]=Qs[42]=1,Hs[128]=Hs[42]=0,Ws[128]=Ws[42]=1,Js[128]=Js[42]=0,Ls[128]=Ls[42]=-1,Ps[128]=Ps[42]=0,Os[128]=Os[42]=1,Rs[128]=Rs[42]=-1,Ts[128]=Ts[42]=0,As[128]=As[42]=0,Gs[5]=Gs[165]=-1,Bs[5]=Bs[165]=0,ks[5]=ks[165]=0,Zs[5]=Zs[165]=1,Ks[5]=Ks[165]=0,Qs[5]=Qs[165]=0,Us[20]=Us[150]=0,Ys[20]=Ys[150]=1,Vs[20]=Vs[150]=1,Rs[20]=Rs[150]=0,Ts[20]=Ts[150]=-1,As[20]=As[150]=1,Ds[80]=Ds[90]=-1,Fs[80]=Fs[90]=0,qs[80]=qs[90]=1,Hs[80]=Hs[90]=1,Ws[80]=Ws[90]=0,Js[80]=Js[90]=1,zs[65]=zs[105]=0,js[65]=js[105]=1,Xs[65]=Xs[105]=0,Ls[65]=Ls[105]=0,Ps[65]=Ps[105]=-1,Os[65]=Os[105]=0,Ds[160]=Ds[10]=-1,Fs[160]=Fs[10]=0,qs[160]=qs[10]=1,Gs[160]=Gs[10]=-1,Bs[160]=Bs[10]=0,ks[160]=ks[10]=0,Zs[160]=Zs[10]=1,Ks[160]=Ks[10]=0,Qs[160]=Qs[10]=0,Hs[160]=Hs[10]=1,Ws[160]=Ws[10]=0,Js[160]=Js[10]=1,Us[130]=Us[40]=0,Ys[130]=Ys[40]=1,Vs[130]=Vs[40]=1,zs[130]=zs[40]=0,js[130]=js[40]=1,Xs[130]=Xs[40]=0,Ls[130]=Ls[40]=0,Ps[130]=Ps[40]=-1,Os[130]=Os[40]=0,Rs[130]=Rs[40]=0,Ts[130]=Ts[40]=-1,As[130]=As[40]=1,Gs[37]=Gs[133]=0,Bs[37]=Bs[133]=1,ks[37]=ks[133]=1,Zs[37]=Zs[133]=0,Ks[37]=Ks[133]=1,Qs[37]=Qs[133]=0,Ls[37]=Ls[133]=-1,Ps[37]=Ps[133]=0,Os[37]=Os[133]=0,Rs[37]=Rs[133]=1,Ts[37]=Ts[133]=0,As[37]=As[133]=0,Us[148]=Us[22]=-1,Ys[148]=Ys[22]=0,Vs[148]=Vs[22]=0,Zs[148]=Zs[22]=0,Ks[148]=Ks[22]=-1,Qs[148]=Qs[22]=1,Hs[148]=Hs[22]=0,Ws[148]=Ws[22]=1,Js[148]=Js[22]=1,Rs[148]=Rs[22]=-1,Ts[148]=Ts[22]=0,As[148]=As[22]=1,Ds[82]=Ds[88]=0,Fs[82]=Fs[88]=-1,qs[82]=qs[88]=1,Us[82]=Us[88]=1,Ys[82]=Ys[88]=0,Vs[82]=Vs[88]=1,zs[82]=zs[88]=-1,js[82]=js[88]=0,Xs[82]=Xs[88]=1,Hs[82]=Hs[88]=0,Ws[82]=Ws[88]=-1,Js[82]=Js[88]=0,Ds[73]=Ds[97]=0,Fs[73]=Fs[97]=1,qs[73]=qs[97]=0,Gs[73]=Gs[97]=0,Bs[73]=Bs[97]=-1,ks[73]=ks[97]=0,zs[73]=zs[97]=1,js[73]=js[97]=0,Xs[73]=Xs[97]=0,Ls[73]=Ls[97]=1,Ps[73]=Ps[97]=0,Os[73]=Os[97]=1,Ds[145]=Ds[25]=0,Fs[145]=Fs[25]=-1,qs[145]=qs[25]=0,zs[145]=zs[25]=1,js[145]=js[25]=0,Xs[145]=Xs[25]=1,Zs[145]=Zs[25]=0,Ks[145]=Ks[25]=1,Qs[145]=Qs[25]=1,Rs[145]=Rs[25]=-1,Ts[145]=Ts[25]=0,As[145]=As[25]=0,Gs[70]=Gs[100]=0,Bs[70]=Bs[100]=1,ks[70]=ks[100]=0,Us[70]=Us[100]=-1,Ys[70]=Ys[100]=0,Vs[70]=Vs[100]=1,Hs[70]=Hs[100]=0,Ws[70]=Ws[100]=-1,Js[70]=Js[100]=1,Ls[70]=Ls[100]=1,Ps[70]=Ps[100]=0,Os[70]=Os[100]=0,Gs[101]=Gs[69]=0,Bs[101]=Bs[69]=1,ks[101]=ks[69]=0,Ls[101]=Ls[69]=1,Ps[101]=Ps[69]=0,Os[101]=Os[69]=0,Zs[149]=Zs[21]=0,Ks[149]=Ks[21]=1,Qs[149]=Qs[21]=1,Rs[149]=Rs[21]=-1,Ts[149]=Ts[21]=0,As[149]=As[21]=0,Us[86]=Us[84]=-1,Ys[86]=Ys[84]=0,Vs[86]=Vs[84]=1,Hs[86]=Hs[84]=0,Ws[86]=Ws[84]=-1,Js[86]=Js[84]=1,Ds[89]=Ds[81]=0,Fs[89]=Fs[81]=-1,qs[89]=qs[81]=0,zs[89]=zs[81]=1,js[89]=js[81]=0,Xs[89]=Xs[81]=1,Ds[96]=Ds[74]=0,Fs[96]=Fs[74]=1,qs[96]=qs[74]=0,Gs[96]=Gs[74]=-1,Bs[96]=Bs[74]=0,ks[96]=ks[74]=1,Hs[96]=Hs[74]=1,Ws[96]=Ws[74]=0,Js[96]=Js[74]=0,Ls[96]=Ls[74]=1,Ps[96]=Ps[74]=0,Os[96]=Os[74]=1,Ds[24]=Ds[146]=0,Fs[24]=Fs[146]=-1,qs[24]=qs[146]=1,Us[24]=Us[146]=1,Ys[24]=Ys[146]=0,Vs[24]=Vs[146]=1,zs[24]=zs[146]=0,js[24]=js[146]=1,Xs[24]=Xs[146]=1,Rs[24]=Rs[146]=0,Ts[24]=Ts[146]=-1,As[24]=As[146]=0,Gs[6]=Gs[164]=-1,Bs[6]=Bs[164]=0,ks[6]=ks[164]=1,Us[6]=Us[164]=-1,Ys[6]=Ys[164]=0,Vs[6]=Vs[164]=0,Zs[6]=Zs[164]=0,Ks[6]=Ks[164]=-1,Qs[6]=Qs[164]=1,Hs[6]=Hs[164]=1,Ws[6]=Ws[164]=0,Js[6]=Js[164]=0,zs[129]=zs[41]=0,js[129]=js[41]=1,Xs[129]=Xs[41]=1,Zs[129]=Zs[41]=0,Ks[129]=Ks[41]=1,Qs[129]=Qs[41]=0,Ls[129]=Ls[41]=-1,Ps[129]=Ps[41]=0,Os[129]=Os[41]=0,Rs[129]=Rs[41]=0,Ts[129]=Ts[41]=-1,As[129]=As[41]=0,Us[66]=Us[104]=0,Ys[66]=Ys[104]=1,Vs[66]=Vs[104]=0,zs[66]=zs[104]=-1,js[66]=js[104]=0,Xs[66]=Xs[104]=1,Hs[66]=Hs[104]=0,Ws[66]=Ws[104]=-1,Js[66]=Js[104]=0,Ls[66]=Ls[104]=0,Ps[66]=Ps[104]=-1,Os[66]=Os[104]=1,Ds[144]=Ds[26]=-1,Fs[144]=Fs[26]=0,qs[144]=qs[26]=0,Zs[144]=Zs[26]=1,Ks[144]=Ks[26]=0,Qs[144]=Qs[26]=1,Hs[144]=Hs[26]=0,Ws[144]=Ws[26]=1,Js[144]=Js[26]=1,Rs[144]=Rs[26]=-1,Ts[144]=Ts[26]=0,As[144]=As[26]=1,Gs[36]=Gs[134]=0,Bs[36]=Bs[134]=1,ks[36]=ks[134]=1,Us[36]=Us[134]=0,Ys[36]=Ys[134]=1,Vs[36]=Vs[134]=0,Ls[36]=Ls[134]=0,Ps[36]=Ps[134]=-1,Os[36]=Os[134]=1,Rs[36]=Rs[134]=1,Ts[36]=Ts[134]=0,As[36]=As[134]=0,Ds[9]=Ds[161]=-1,Fs[9]=Fs[161]=0,qs[9]=qs[161]=0,Gs[9]=Gs[161]=0,Bs[9]=Bs[161]=-1,ks[9]=ks[161]=0,zs[9]=zs[161]=1,js[9]=js[161]=0,Xs[9]=Xs[161]=0,Zs[9]=Zs[161]=1,Ks[9]=Ks[161]=0,Qs[9]=Qs[161]=1,Ds[136]=0,Fs[136]=1,qs[136]=1,Gs[136]=0,Bs[136]=1,ks[136]=0,Us[136]=-1,Ys[136]=0,Vs[136]=1,zs[136]=-1,js[136]=0,Xs[136]=0,Zs[136]=0,Ks[136]=-1,Qs[136]=0,Hs[136]=0,Ws[136]=-1,Js[136]=1,Ls[136]=1,Ps[136]=0,Os[136]=0,Rs[136]=1,Ts[136]=0,As[136]=1,Ds[34]=0,Fs[34]=-1,qs[34]=0,Gs[34]=0,Bs[34]=-1,ks[34]=1,Us[34]=1,Ys[34]=0,Vs[34]=0,zs[34]=1,js[34]=0,Xs[34]=1,Zs[34]=0,Ks[34]=1,Qs[34]=1,Hs[34]=0,Ws[34]=1,Js[34]=0,Ls[34]=-1,Ps[34]=0,Os[34]=1,Rs[34]=-1,Ts[34]=0,As[34]=0,Ds[35]=0,Fs[35]=1,qs[35]=1,Gs[35]=0,Bs[35]=-1,ks[35]=1,Us[35]=1,Ys[35]=0,Vs[35]=0,zs[35]=-1,js[35]=0,Xs[35]=0,Zs[35]=0,Ks[35]=-1,Qs[35]=0,Hs[35]=0,Ws[35]=1,Js[35]=0,Ls[35]=-1,Ps[35]=0,Os[35]=1,Rs[35]=1,Ts[35]=0,As[35]=1,Ds[153]=0,Fs[153]=1,qs[153]=1,zs[153]=-1,js[153]=0,Xs[153]=0,Zs[153]=0,Ks[153]=-1,Qs[153]=0,Rs[153]=1,Ts[153]=0,As[153]=1,Gs[102]=0,Bs[102]=-1,ks[102]=1,Us[102]=1,Ys[102]=0,Vs[102]=0,Hs[102]=0,Ws[102]=1,Js[102]=0,Ls[102]=-1,Ps[102]=0,Os[102]=1,Ds[155]=0,Fs[155]=-1,qs[155]=0,zs[155]=1,js[155]=0,Xs[155]=1,Zs[155]=0,Ks[155]=1,Qs[155]=1,Rs[155]=-1,Ts[155]=0,As[155]=0,Gs[103]=0,Bs[103]=1,ks[103]=0,Us[103]=-1,Ys[103]=0,Vs[103]=1,Hs[103]=0,Ws[103]=-1,Js[103]=1,Ls[103]=1,Ps[103]=0,Os[103]=0,Ds[152]=0,Fs[152]=1,qs[152]=1,Us[152]=-1,Ys[152]=0,Vs[152]=1,zs[152]=-1,js[152]=0,Xs[152]=0,Zs[152]=0,Ks[152]=-1,Qs[152]=0,Hs[152]=0,Ws[152]=-1,Js[152]=1,Rs[152]=1,Ts[152]=0,As[152]=1,Ds[156]=0,Fs[156]=-1,qs[156]=1,Us[156]=1,Ys[156]=0,Vs[156]=1,zs[156]=-1,js[156]=0,Xs[156]=0,Zs[156]=0,Ks[156]=-1,Qs[156]=0,Hs[156]=0,Ws[156]=1,Js[156]=1,Rs[156]=-1,Ts[156]=0,As[156]=1,Ds[137]=0,Fs[137]=1,qs[137]=1,Gs[137]=0,Bs[137]=1,ks[137]=0,zs[137]=-1,js[137]=0,Xs[137]=0,Zs[137]=0,Ks[137]=-1,Qs[137]=0,Ls[137]=1,Ps[137]=0,Os[137]=0,Rs[137]=1,Ts[137]=0,As[137]=1,Ds[139]=0,Fs[139]=1,qs[139]=1,Gs[139]=0,Bs[139]=-1,ks[139]=0,zs[139]=1,js[139]=0,Xs[139]=0,Zs[139]=0,Ks[139]=1,Qs[139]=0,Ls[139]=-1,Ps[139]=0,Os[139]=0,Rs[139]=1,Ts[139]=0,As[139]=1,Ds[98]=0,Fs[98]=-1,qs[98]=0,Gs[98]=0,Bs[98]=-1,ks[98]=1,Us[98]=1,Ys[98]=0,Vs[98]=0,zs[98]=1,js[98]=0,Xs[98]=1,Hs[98]=0,Ws[98]=1,Js[98]=0,Ls[98]=-1,Ps[98]=0,Os[98]=1,Ds[99]=0,Fs[99]=1,qs[99]=0,Gs[99]=0,Bs[99]=-1,ks[99]=1,Us[99]=1,Ys[99]=0,Vs[99]=0,zs[99]=-1,js[99]=0,Xs[99]=1,Hs[99]=0,Ws[99]=-1,Js[99]=0,Ls[99]=1,Ps[99]=0,Os[99]=1,Gs[38]=0,Bs[38]=-1,ks[38]=1,Us[38]=1,Ys[38]=0,Vs[38]=0,Zs[38]=0,Ks[38]=1,Qs[38]=1,Hs[38]=0,Ws[38]=1,Js[38]=0,Ls[38]=-1,Ps[38]=0,Os[38]=1,Rs[38]=-1,Ts[38]=0,As[38]=0,Gs[39]=0,Bs[39]=1,ks[39]=1,Us[39]=-1,Ys[39]=0,Vs[39]=0,Zs[39]=0,Ks[39]=-1,Qs[39]=1,Hs[39]=0,Ws[39]=1,Js[39]=0,Ls[39]=-1,Ps[39]=0,Os[39]=1,Rs[39]=1,Ts[39]=0,As[39]=0;var $s=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},ta=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},ea=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},na=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},ra=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},ia=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},oa=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},sa=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},aa=[],ua=[],ca=[],ha=[],la=[],pa=[],fa=[],ga=[];ha[1]=la[1]=18,ha[169]=la[169]=18,ca[4]=ua[4]=12,ca[166]=ua[166]=12,aa[16]=ga[16]=4,aa[154]=ga[154]=4,pa[64]=fa[64]=22,pa[106]=fa[106]=22,ca[2]=pa[2]=17,ha[2]=la[2]=18,ca[168]=pa[168]=17,ha[168]=la[168]=18,aa[8]=ha[8]=9,ua[8]=ca[8]=12,aa[162]=ha[162]=9,ua[162]=ca[162]=12,aa[32]=ga[32]=4,ua[32]=fa[32]=1,aa[138]=ga[138]=4,ua[138]=fa[138]=1,la[128]=ga[128]=21,pa[128]=fa[128]=22,la[42]=ga[42]=21,pa[42]=fa[42]=22,ua[5]=la[5]=14,ua[165]=la[165]=14,ca[20]=ga[20]=6,ca[150]=ga[150]=6,aa[80]=pa[80]=11,aa[90]=pa[90]=11,ha[65]=fa[65]=3,ha[105]=fa[105]=3,aa[160]=pa[160]=11,ua[160]=la[160]=14,aa[10]=pa[10]=11,ua[10]=la[10]=14,ca[130]=ga[130]=6,ha[130]=fa[130]=3,ca[40]=ga[40]=6,ha[40]=fa[40]=3,ua[101]=fa[101]=1,ua[69]=fa[69]=1,la[149]=ga[149]=21,la[21]=ga[21]=21,ca[86]=pa[86]=17,ca[84]=pa[84]=17,aa[89]=ha[89]=9,aa[81]=ha[81]=9,aa[96]=fa[96]=0,ua[96]=pa[96]=15,aa[74]=fa[74]=0,ua[74]=pa[74]=15,aa[24]=ca[24]=8,ha[24]=ga[24]=7,aa[146]=ca[146]=8,ha[146]=ga[146]=7,ua[6]=pa[6]=15,ca[6]=la[6]=16,ua[164]=pa[164]=15,ca[164]=la[164]=16,ha[129]=ga[129]=7,la[129]=fa[129]=20,ha[41]=ga[41]=7,la[41]=fa[41]=20,ca[66]=fa[66]=2,ha[66]=pa[66]=19,ca[104]=fa[104]=2,ha[104]=pa[104]=19,aa[144]=la[144]=10,pa[144]=ga[144]=23,aa[26]=la[26]=10,pa[26]=ga[26]=23,ua[36]=ga[36]=5,ca[36]=fa[36]=2,ua[134]=ga[134]=5,ca[134]=fa[134]=2,aa[9]=la[9]=10,ua[9]=ha[9]=13,aa[161]=la[161]=10,ua[161]=ha[161]=13,ua[37]=ga[37]=5,la[37]=fa[37]=20,ua[133]=ga[133]=5,la[133]=fa[133]=20,ca[148]=la[148]=16,pa[148]=ga[148]=23,ca[22]=la[22]=16,pa[22]=ga[22]=23,aa[82]=ca[82]=8,ha[82]=pa[82]=19,aa[88]=ca[88]=8,ha[88]=pa[88]=19,aa[73]=fa[73]=0,ua[73]=ha[73]=13,aa[97]=fa[97]=0,ua[97]=ha[97]=13,aa[145]=ha[145]=9,la[145]=ga[145]=21,aa[25]=ha[25]=9,la[25]=ga[25]=21,ua[70]=fa[70]=1,ca[70]=pa[70]=17,ua[100]=fa[100]=1,ca[100]=pa[100]=17,aa[34]=ha[34]=9,ua[34]=ca[34]=12,la[34]=ga[34]=21,pa[34]=fa[34]=22,aa[136]=ga[136]=4,ua[136]=fa[136]=1,ca[136]=pa[136]=17,ha[136]=la[136]=18,aa[35]=ga[35]=4,ua[35]=ca[35]=12,ha[35]=la[35]=18,pa[35]=fa[35]=22,aa[153]=ga[153]=4,ha[153]=la[153]=18,ua[102]=ca[102]=12,pa[102]=fa[102]=22,aa[155]=ha[155]=9,la[155]=ga[155]=23,ua[103]=fa[103]=1,ca[103]=pa[103]=17,aa[152]=ga[152]=4,ca[152]=pa[152]=17,ha[152]=la[152]=18,aa[156]=ca[156]=8,ha[156]=la[156]=18,pa[156]=ga[156]=23,aa[137]=ga[137]=4,ua[137]=fa[137]=1,ha[137]=la[137]=18,aa[139]=ga[139]=4,ua[139]=ha[139]=13,la[139]=fa[139]=20,aa[98]=ha[98]=9,ua[98]=ca[98]=12,pa[98]=fa[98]=22,aa[99]=fa[99]=0,ua[99]=ca[99]=12,ha[99]=pa[99]=19,ua[38]=ca[38]=12,la[38]=ga[38]=21,pa[38]=fa[38]=22,ua[39]=ga[39]=5,ca[39]=la[39]=16,pa[39]=fa[39]=22;var da=[];da[1]=da[169]=$s,da[4]=da[166]=ta,da[16]=da[154]=ea,da[64]=da[106]=na,da[168]=da[2]=ra,da[162]=da[8]=ia,da[138]=da[32]=oa,da[42]=da[128]=sa,da[5]=da[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},da[20]=da[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},da[80]=da[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},da[65]=da[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},da[160]=da[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},da[130]=da[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},da[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},da[101]=da[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},da[149]=da[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},da[86]=da[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},da[89]=da[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},da[96]=da[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},da[24]=da[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},da[6]=da[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},da[129]=da[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},da[66]=da[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},da[144]=da[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},da[36]=da[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},da[9]=da[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},da[37]=da[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},da[148]=da[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},da[82]=da[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},da[73]=da[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},da[145]=da[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},da[70]=da[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},da[34]=function(t){return[sa(t),ia(t)]},da[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},da[136]=function(t){return[oa(t),ra(t)]},da[153]=function(t){return[ea(t),$s(t)]},da[102]=function(t){return[ta(t),na(t)]},da[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},da[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},da[152]=function(t){return[ea(t),ra(t)]},da[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},da[137]=function(t){return[oa(t),$s(t)]},da[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},da[98]=function(t){return[ia(t),na(t)]},da[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},da[38]=function(t){return[ta(t),sa(t)]},da[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};var ya=function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1};ya.buildId=function(t){return t.join(",")},ya.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))},ya.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))},ya.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},ya.prototype.sortOuterEdges=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=ur(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)},ya.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},ya.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},ya.prototype.addInnerEdge=function(t){this.innerEdges.push(t)};var _a=function(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)};_a.prototype.getSymetric=function(){return this.symetric||(this.symetric=new _a(this.to,this.from),this.symetric.symetric=this),this.symetric},_a.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},_a.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},_a.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},_a.prototype.toLineString=function(){return a([this.from.coordinates,this.to.coordinates])},_a.prototype.compareTo=function(t){return ur(t.from.coordinates,t.to.coordinates,this.to.coordinates)};var ma=function(){this.edges=[],this.polygon=void 0,this.envelope=void 0},va={length:{configurable:!0}};ma.prototype.push=function(t){this[this.edges.length]=t,this.edges.push(t),this.polygon=this.envelope=void 0},ma.prototype.get=function(t){return this.edges[t]},va.length.get=function(){return this.edges.length},ma.prototype.forEach=function(t){this.edges.forEach(t)},ma.prototype.map=function(t){return this.edges.map(t)},ma.prototype.some=function(t){return this.edges.some(t)},ma.prototype.isValid=function(){return!0},ma.prototype.isHole=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=ur(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},ma.prototype.toMultiPoint=function(){return l(this.edges.map((function(t){return t.from.coordinates})))},ma.prototype.toPolygon=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=o([t])},ma.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=ie(this.toPolygon())},ma.findEdgeRingContaining=function(t,e){var n,i,o=t.getEnvelope();return e.forEach((function(e){var s=e.getEnvelope();if(i&&(n=i.getEnvelope()),!function(t,e){var n=t.geometry.coordinates.map((function(t){return t[0]})),r=t.geometry.coordinates.map((function(t){return t[1]})),i=e.geometry.coordinates.map((function(t){return t[0]})),o=e.geometry.coordinates.map((function(t){return t[1]}));return Math.max(null,n)===Math.max(null,i)&&Math.max(null,r)===Math.max(null,o)&&Math.min(null,n)===Math.min(null,i)&&Math.min(null,r)===Math.min(null,o)}(s,o)&&cr(s,o)){var a=t.map((function(t){return t.from.coordinates})).find((function(t){return!e.some((function(e){return function(t,e){return t[0]===e[0]&&t[1]===e[1]}(t,e.from.coordinates)}))}));a&&e.inside(r(a))&&(i&&!cr(n,s)||(i=e))}})),i},ma.prototype.inside=function(t){return Mt(t,this.toPolygon())},Object.defineProperties(ma.prototype,va);var xa=function(){this.edges=[],this.nodes={}};xa.fromGeoJson=function(t){!function(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 '"+t.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}(t);var e=new xa;return F(t,(function(t){H(t,"LineString","Graph::fromGeoJson"),M(t,(function(t,n){if(t){var r=e.getNode(t),i=e.getNode(n);e.addEdge(r,i)}return n}))})),e},xa.prototype.getNode=function(t){var e=ya.buildId(t),n=this.nodes[e];return n||(n=this.nodes[e]=new ya(t)),n},xa.prototype.addEdge=function(t,e){var n=new _a(t,e),r=n.getSymetric();this.edges.push(n),this.edges.push(r)},xa.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map((function(e){return t.nodes[e]})).forEach((function(e){return t._removeIfDangle(e)}))},xa.prototype._removeIfDangle=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)}))}},xa.prototype.deleteCutEdges=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))}))},xa.prototype._computeNextCWEdges=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}))},xa.prototype._computeNextCCWEdges=function(t,e){for(var n,r,i=t.getOuterEdges(),o=i.length-1;o>=0;--o){var s=i[o],a=s.symetric,u=void 0,c=void 0;s.label===e&&(u=s),a.label===e&&(c=a),u&&c&&(c&&(r=c),u&&(r&&(r.next=u,r=void 0),n||(n=u)))}r&&(r.next=n)},xa.prototype._findLabeledEdgeRings=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},xa.prototype.getEdgeRings=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},xa.prototype._findIntersectionNodes=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},xa.prototype._findEdgeRing=function(t){var e=t,n=new ma;do{n.push(e),e.ring=n,e=e.next}while(!t.isEqual(e));return n},xa.prototype.removeNode=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]},xa.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()};var Ea=yt((function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}(t.exports="function"==typeof Object.keys?Object.keys:n).shim=n})),wa=(Ea.shim,yt((function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function r(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var i="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();(e=t.exports=i?n:r).supported=n,e.unsupported=r}))),ba=(wa.supported,wa.unsupported,yt((function(t){function e(t){return null==t}function n(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}var r=Array.prototype.slice,i=t.exports=function(t,o,s){return s||(s={}),t===o||(t instanceof Date&&o instanceof Date?t.getTime()===o.getTime():!t||!o||"object"!=typeof t&&"object"!=typeof o?s.strict?t===o:t==o:function(t,o,s){var a,u;if(e(t)||e(o))return!1;if(t.prototype!==o.prototype)return!1;if(wa(t))return!!wa(o)&&(t=r.call(t),o=r.call(o),i(t,o,s));if(n(t)){if(!n(o))return!1;if(t.length!==o.length)return!1;for(a=0;a<t.length;a++)if(t[a]!==o[a])return!1;return!0}try{var c=Ea(t),h=Ea(o)}catch(t){return!1}if(c.length!=h.length)return!1;for(c.sort(),h.sort(),a=c.length-1;a>=0;a--)if(c[a]!=h[a])return!1;for(a=c.length-1;a>=0;a--)if(u=c[a],!i(t[u],o[u],s))return!1;return typeof t==typeof o}(t,o,s))}}))),Ia=function(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:xr};Ia.prototype.compare=function(t,e){if(t.type!==e.type||!vr(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,0,!1);case"Polygon":return this.comparePolygon(t,e);case"Feature":return this.compareFeature(t,e);default:if(0===t.type.indexOf("Multi")){var n=this,r=mr(t),i=mr(e);return r.every((function(t){return this.some((function(e){return n.compare(t,e)}))}),i)}}return!1},Ia.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].toFixed(this.precision)!==e[n].toFixed(this.precision))return!1;return!0},Ia.prototype.compareLine=function(t,e,n,r){if(!vr(t,e))return!1;var i=this.pseudoNode?t:this.removePseudo(t),o=this.pseudoNode?e:this.removePseudo(e);if(!r||this.compareCoord(i[0],o[0])||(o=this.fixStartIndex(o,i))){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)}},Ia.prototype.fixStartIndex=function(t,e){for(var n,r=-1,i=0;i<t.length;i++)if(this.compareCoord(t[i],e[0])){r=i;break}return r>=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},Ia.prototype.comparePath=function(t,e){var n=this;return t.every((function(t,e){return n.compareCoord(t,this[e])}),e)},Ia.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),r)}return!1},Ia.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},Ia.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},Ia.prototype.removePseudo=function(t){return t};var Na=Ia,Ca=yt((function(t){function e(t,e,n,r){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,n,r)}e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);for(var i=0;i<this._datasetLength;i++)if(1!==this._visited[i]){this._visited[i]=1;var o=this._regionQuery(i);if(o.length<this.minPts)this.noise.push(i);else{var s=this.clusters.length;this.clusters.push([]),this._addToCluster(i,s),this._expandCluster(s,o)}}return this.clusters},e.prototype._init=function(t,e,n,r){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this.noise=[],this._datasetLength=t.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}e&&(this.epsilon=e),n&&(this.minPts=n),r&&(this.distance=r)},e.prototype._expandCluster=function(t,e){for(var n=0;n<e.length;n++){var r=e[n];if(1!==this._visited[r]){this._visited[r]=1;var i=this._regionQuery(r);i.length>=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[r]&&this._addToCluster(r,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],n=0;n<this._datasetLength;n++)this.distance(this.dataset[t],this.dataset[n])<this.epsilon&&e.push(n);return e},e.prototype._mergeArrays=function(t,e){for(var n=e.length,r=0;r<n;r++){var i=e[r];t.indexOf(i)<0&&t.push(i)}return t},e.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=e)})),Sa=yt((function(t){function e(t,e,n){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(t,e,n)}e.prototype.init=function(t,e,n){this.assignments=[],this.centroids=[],void 0!==t&&(this.dataset=t),void 0!==e&&(this.k=e),void 0!==n&&(this.distance=n)},e.prototype.run=function(t,e){this.init(t,e);for(var n=this.dataset.length,r=0;r<this.k;r++)this.centroids[r]=this.randomCentroid();for(var i=!0;i;){i=this.assign();for(var o=0;o<this.k;o++){for(var s=new Array(h),a=0,u=0;u<h;u++)s[u]=0;for(var c=0;c<n;c++){var h=this.dataset[c].length;if(o===this.assignments[c]){for(u=0;u<h;u++)s[u]+=this.dataset[c][u];a++}}if(a>0){for(u=0;u<h;u++)s[u]/=a;this.centroids[o]=s}else this.centroids[o]=this.randomCentroid(),i=!0}}return this.getClusters()},e.prototype.randomCentroid=function(){var t,e,n=this.dataset.length-1;do{e=Math.round(Math.random()*n),t=this.dataset[e]}while(this.centroids.indexOf(t)>=0);return t},e.prototype.assign=function(){for(var t,e=!1,n=this.dataset.length,r=0;r<n;r++)(t=this.argmin(this.dataset[r],this.centroids,this.distance))!=this.assignments[r]&&(this.assignments[r]=t,e=!0);return e},e.prototype.getClusters=function(){for(var t,e=new Array(this.k),n=0;n<this.assignments.length;n++)void 0===e[t=this.assignments[n]]&&(e[t]=[]),e[t].push(n);return e},e.prototype.argmin=function(t,e,n){for(var r,i=Number.MAX_VALUE,o=0,s=e.length,a=0;a<s;a++)(r=n(t,e[a]))<i&&(i=r,o=a);return o},e.prototype.distance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;){var i=t[r]-e[r];n+=i*i}return Math.sqrt(n)},t.exports&&(t.exports=e)})),Ma=yt((function(t){function e(t,e,n){this._queue=[],this._priorities=[],this._sorting="desc",this._init(t,e,n)}e.prototype.insert=function(t,e){for(var n=this._queue.length,r=n;r--;){var i=this._priorities[r];"desc"===this._sorting?e>i&&(n=r):e<i&&(n=r)}this._insertAt(t,e,n)},e.prototype.remove=function(t){for(var e=this._queue.length;e--;)if(t===this._queue[e]){this._queue.splice(e,1),this._priorities.splice(e,1);break}},e.prototype.forEach=function(t){this._queue.forEach(t)},e.prototype.getElements=function(){return this._queue},e.prototype.getElementPriority=function(t){return this._priorities[t]},e.prototype.getPriorities=function(){return this._priorities},e.prototype.getElementsWithPriorities=function(){for(var t=[],e=0,n=this._queue.length;e<n;e++)t.push([this._queue[e],this._priorities[e]]);return t},e.prototype._init=function(t,e,n){if(t&&e){if(this._queue=[],this._priorities=[],t.length!==e.length)throw new Error("Arrays must have the same length");for(var r=0;r<t.length;r++)this.insert(t[r],e[r])}n&&(this._sorting=n)},e.prototype._insertAt=function(t,e,n){this._queue.length===n?(this._queue.push(t),this._priorities.push(e)):(this._queue.splice(n,0,t),this._priorities.splice(n,0,e))},t.exports&&(t.exports=e)})),La=yt((function(t){function e(t,e,n,r){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(t,e,n,r)}if(t.exports)var n=Ma;e.prototype.run=function(t,e,r,i){this._init(t,e,r,i);for(var o=0,s=this.dataset.length;o<s;o++)if(1!==this._processed[o]){this._processed[o]=1,this.clusters.push([o]);var a=this.clusters.length-1;this._orderedList.push(o);var u=new n(null,null,"asc"),c=this._regionQuery(o);void 0!==this._distanceToCore(o)&&(this._updateQueue(o,c,u),this._expandCluster(a,u))}return this.clusters},e.prototype.getReachabilityPlot=function(){for(var t=[],e=0,n=this._orderedList.length;e<n;e++){var r=this._orderedList[e],i=this._reachability[r];t.push([r,i])}return t},e.prototype._init=function(t,e,n,r){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),n&&(this.minPts=n),r&&(this.distance=r)},e.prototype._updateQueue=function(t,e,n){var r=this;this._coreDistance=this._distanceToCore(t),e.forEach((function(e){if(void 0===r._processed[e]){var i=r.distance(r.dataset[t],r.dataset[e]),o=Math.max(r._coreDistance,i);void 0===r._reachability[e]?(r._reachability[e]=o,n.insert(e,o)):o<r._reachability[e]&&(r._reachability[e]=o,n.remove(e),n.insert(e,o))}}))},e.prototype._expandCluster=function(t,e){for(var n=e.getElements(),r=0,i=n.length;r<i;r++){var o=n[r];if(void 0===this._processed[o]){var s=this._regionQuery(o);this._processed[o]=1,this.clusters[t].push(o),this._orderedList.push(o),void 0!==this._distanceToCore(o)&&(this._updateQueue(o,s,e),this._expandCluster(t,e))}}},e.prototype._distanceToCore=function(t){for(var e=this.epsilon,n=0;n<e;n++)if(this._regionQuery(t,n).length>=this.minPts)return n},e.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var n=[],r=0,i=this.dataset.length;r<i;r++)this.distance(this.dataset[t],this.dataset[r])<e&&n.push(r);return n},e.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=e)})),Pa=yt((function(t){t.exports&&(t.exports={DBSCAN:Ca,KMEANS:Sa,OPTICS:La,PriorityQueue:Ma})})),Oa=(Pa.DBSCAN,Pa.KMEANS,Pa.OPTICS,Pa.PriorityQueue,function(t,e,n){for(var r=t.length,i=0,o=0;o<r;o++){var s=(t[o]||0)-(e[o]||0);i+=s*s}return n?Math.sqrt(i):i}),Ra=Oa,Ta=function(t,e,n){var r=Math.abs(t-e);return n?r:r*r},Aa=Oa,Da=function(t,e,n,r){var i=[],o=[],s=[],a=[],u=!1,c=r||1e4,h=t.length,l=t[0].length,p=l>0,f=[];if(n)i="kmrand"==n?function(t,e){for(var n={},r=[],i=e<<2,o=t.length,s=t[0].length>0;r.length<e&&i-- >0;){var a=t[Math.floor(Math.random()*o)],u=s?a.join("_"):""+a;n[u]||(n[u]=!0,r.push(a))}if(r.length<e)throw new Error("Error initializating clusters");return r}(t,e):"kmpp"==n?function(t,e){var n=t[0].length?Ra:Ta,r=[],i=t.length,o=t[0].length>0,s=t[Math.floor(Math.random()*i)];for(o&&s.join("_"),r.push(s);r.length<e;){for(var a=[],u=r.length,c=0,h=[],l=0;l<i;l++){for(var p=1/0,f=0;f<u;f++){var g=n(t[l],r[f]);g<=p&&(p=g)}a[l]=p}for(var d=0;d<i;d++)c+=a[d];for(var y=0;y<i;y++)h[y]={i:y,v:t[y],pr:a[y]/c,cs:0};h.sort((function(t,e){return t.pr-e.pr})),h[0].cs=h[0].pr;for(var _=1;_<i;_++)h[_].cs=h[_-1].cs+h[_].pr;for(var m=Math.random(),v=0;v<i-1&&h[v++].cs<m;);r.push(h[v-1].v)}return r}(t,e):n;else for(var g={};i.length<e;){var d=Math.floor(Math.random()*h);g[d]||(g[d]=!0,i.push(t[d]))}do{wr(e,0,f);for(var y=0;y<h;y++){for(var _=1/0,m=0,v=0;v<e;v++)(a=p?Aa(t[y],i[v]):Math.abs(t[y]-i[v]))<=_&&(_=a,m=v);s[y]=m,f[m]++}for(var x=[],E=(o=[],0);E<e;E++)x[E]=p?wr(l,0,x[E]):0,o[E]=i[E];if(p){for(var w=0;w<e;w++)i[w]=[];for(var b=0;b<h;b++)for(var I=x[s[b]],N=t[b],C=0;C<l;C++)I[C]+=N[C];u=!0;for(var S=0;S<e;S++){for(var M=i[S],L=x[S],P=o[S],O=f[S],R=0;R<l;R++)M[R]=L[R]/O||0;if(u)for(var T=0;T<l;T++)if(P[T]!=M[T]){u=!1;break}}}else{for(var A=0;A<h;A++)x[s[A]]+=t[A];for(var D=0;D<e;D++)i[D]=x[D]/f[D]||0;u=!0;for(var F=0;F<e;F++)if(o[F]!=i[F]){u=!1;break}}u=u||--c<=0}while(!u);return{it:1e4-c,k:e,idxs:s,centroids:i}},Fa={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||Fa.heuristics.manhattan,o=r.closest||!1,s=new Sr((function(t){return t.f})),a=e;for(e.h=i(e,n),s.push(e);s.size()>0;){var u=s.pop();if(u===n)return Ir(u);u.closed=!0;for(var c=t.neighbors(u),h=0,l=c.length;h<l;++h){var p=c[h];if(!p.closed&&!p.isWall()){var f=u.g+p.getCost(u),g=p.visited;(!g||f<p.g)&&(p.visited=!0,p.parent=u,p.h=p.h||i(p,n),p.g=f,p.f=p.g+p.h,t.markDirty(p),o&&(p.h<a.h||p.h===a.h&&p.g<a.g)&&(a=p),g?s.rescoreElement(p):s.push(p))}}}return o?Ir(a):[]},heuristics:{manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var n=Math.sqrt(2),r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return 1*(r+i)+(n-2)*Math.min(r,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};Nr.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)Fa.cleanNode(this.nodes[t])},Nr.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)Fa.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Nr.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Nr.prototype.neighbors=function(t){var e=[],n=t.x,r=t.y,i=this.grid;return i[n-1]&&i[n-1][r]&&e.push(i[n-1][r]),i[n+1]&&i[n+1][r]&&e.push(i[n+1][r]),i[n]&&i[n][r-1]&&e.push(i[n][r-1]),i[n]&&i[n][r+1]&&e.push(i[n][r+1]),this.diagonal&&(i[n-1]&&i[n-1][r-1]&&e.push(i[n-1][r-1]),i[n+1]&&i[n+1][r-1]&&e.push(i[n+1][r-1]),i[n-1]&&i[n-1][r+1]&&e.push(i[n-1][r+1]),i[n+1]&&i[n+1][r+1]&&e.push(i[n+1][r+1])),e},Nr.prototype.toString=function(){for(var t,e,n,r,i=[],o=this.grid,s=0,a=o.length;s<a;s++){for(t=[],n=0,r=(e=o[s]).length;n<r;n++)t.push(e[n].weight);i.push(t.join(" "))}return i.join("\n")},Cr.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Cr.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},Cr.prototype.isWall=function(){return 0===this.weight},Sr.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(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)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];t>0;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[n]=e,this.content[t]=r,t=n}},bubbleUp:function(t){for(var e=this.content.length,n=this.content[t],r=this.scoreFunction(n);;){var i,o=t+1<<1,s=o-1,a=null;if(s<e){var u=this.content[s];(i=this.scoreFunction(u))<r&&(a=s)}if(o<e){var c=this.content[o];this.scoreFunction(c)<(null===a?r:i)&&(a=o)}if(null===a)break;this.content[t]=this.content[a],this.content[a]=n,t=a}}};var qa=function(t){return function(){return t}};Pr.prototype={constructor:Pr,insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=Ar(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(Rr(this,n),n=(t=n).U),n.C=!1,r.C=!0,Tr(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(Tr(this,n),n=(t=n).U),n.C=!1,r.C=!0,Rr(this,r)),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,r,i=t.U,o=t.L,s=t.R;if(n=o?s?Ar(s):o:s,i?i.L===t?i.L=n:i.R=n:this._=n,o&&s?(r=n.C,n.C=t.C,n.L=o,o.U=n,n!==s?(i=n.U,n.U=t.U,t=n.R,i.L=t,n.R=s,s.U=n):(n.U=i,i=n,t=n.R)):(r=t.C,t=n),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,Rr(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,Tr(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Rr(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,Tr(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,Rr(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,Tr(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var Ga,Ba,ka,za,ja,Xa=[],Ua=[],Ya=1e-6,Va=1e-12;Qr.prototype={constructor:Qr,polygons:function(){var t=this.edges;return this.cells.map((function(e){var n=e.halfedges.map((function(n){return zr(e,t[n])}));return n.data=e.site.data,n}))},triangles:function(){var t=[],e=this.edges;return this.cells.forEach((function(n,r){if(o=(i=n.halfedges).length)for(var i,o,s,a=n.site,u=-1,c=e[i[o-1]],h=c.left===a?c.right:c.left;++u<o;)s=h,h=(c=e[i[u]]).left===a?c.right:c.left,s&&h&&r<s.index&&r<h.index&&Zr(a,s,h)<0&&t.push([a.data,s.data,h.data])})),t},links:function(){return this.edges.filter((function(t){return t.right})).map((function(t){return{source:t.left.data,target:t.right.data}}))},find:function(t,e,n){for(var r,i,o=this,s=o._found||0,a=o.cells.length;!(i=o.cells[s]);)if(++s>=a)return null;var u=t-i.site[0],c=e-i.site[1],h=u*u+c*c;do{i=o.cells[r=s],s=null,i.halfedges.forEach((function(n){var r=o.edges[n],a=r.left;if(a!==i.site&&a||(a=r.right)){var u=t-a[0],c=e-a[1],l=u*u+c*c;l<h&&(h=l,s=a.index)}}))}while(null!==s);return o._found=r,null==n||h<=n*n?i.site:null}};var Ha=Object.freeze({randomPosition:oi,randomPoint:si,randomPolygon:ai,randomLineString:ui}),Wa=Object.freeze({getCluster:hi,clusterEach:li,clusterReduce:pi,createBins:fi,applyFilter:gi,propertiesContainsFilter:di,filterProperties:yi});"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=1 in arguments&&parseInt(Number(arguments[1]),10)||0;r=r<0?Math.max(n+r,0):Math.min(r,n);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(i=i<0?Math.max(n+arguments[2],0):Math.min(i,n);r<i;)e[r]=t,++r;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Ja=function(){};Ja.prototype.interfaces_=function(){return[]},Ja.prototype.getClass=function(){return Ja},Ja.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var Za=function(){},Ka=function(){},Qa={MAX_VALUE:{configurable:!0}};Ka.isNaN=function(t){return Number.isNaN(t)},Ka.doubleToLongBits=function(t){return t},Ka.longBitsToDouble=function(t){return t},Ka.isInfinite=function(t){return!Number.isFinite(t)},Qa.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Ka,Qa);var $a=function(){},tu=function(){},eu=function(){},nu=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},ru={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};nu.prototype.setOrdinate=function(t,e){switch(t){case nu.X:this.x=e;break;case nu.Y:this.y=e;break;case nu.Z:this.z=e;break;default:throw new Za("Invalid ordinate index: "+t)}},nu.prototype.equals2D=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!!Ja.equalsWithTolerance(this.x,e.x,n)&&!!Ja.equalsWithTolerance(this.y,e.y,n)}},nu.prototype.getOrdinate=function(t){switch(t){case nu.X:return this.x;case nu.Y:return this.y;case nu.Z:return this.z}throw new Za("Invalid ordinate index: "+t)},nu.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Ka.isNaN(this.z))&&Ka.isNaN(t.z)},nu.prototype.equals=function(t){return t instanceof nu&&this.equals2D(t)},nu.prototype.equalInZ=function(t,e){return Ja.equalsWithTolerance(this.z,t.z,e)},nu.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},nu.prototype.clone=function(){},nu.prototype.copy=function(){return new nu(this)},nu.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},nu.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},nu.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},nu.prototype.hashCode=function(){var t=17;return 37*(t=37*t+nu.hashCode(this.x))+nu.hashCode(this.y)},nu.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},nu.prototype.interfaces_=function(){return[$a,tu,_i]},nu.prototype.getClass=function(){return nu},nu.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=Ka.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},ru.DimensionalComparator.get=function(){return iu},ru.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},ru.NULL_ORDINATE.get=function(){return Ka.NaN},ru.X.get=function(){return 0},ru.Y.get=function(){return 1},ru.Z.get=function(){return 2},Object.defineProperties(nu,ru);var iu=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new Za("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};iu.prototype.compare=function(t,e){var n=t,r=e,i=iu.compare(n.x,r.x);if(0!==i)return i;var o=iu.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:iu.compare(n.z,r.z)},iu.prototype.interfaces_=function(){return[eu]},iu.prototype.getClass=function(){return iu},iu.compare=function(t,e){return t<e?-1:t>e?1:Ka.isNaN(t)?Ka.isNaN(e)?0:-1:Ka.isNaN(e)?1:0};var ou=function(){};ou.prototype.create=function(){},ou.prototype.interfaces_=function(){return[]},ou.prototype.getClass=function(){return ou};var su=function(){},au={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};su.prototype.interfaces_=function(){return[]},su.prototype.getClass=function(){return su},su.toLocationSymbol=function(t){switch(t){case su.EXTERIOR:return"e";case su.BOUNDARY:return"b";case su.INTERIOR:return"i";case su.NONE:return"-"}throw new Za("Unknown location value: "+t)},au.INTERIOR.get=function(){return 0},au.BOUNDARY.get=function(){return 1},au.EXTERIOR.get=function(){return 2},au.NONE.get=function(){return-1},Object.defineProperties(su,au);var uu=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},cu=function(){},hu={LOG_10:{configurable:!0}};cu.prototype.interfaces_=function(){return[]},cu.prototype.getClass=function(){return cu},cu.log10=function(t){var e=Math.log(t);return Ka.isInfinite(e)||Ka.isNaN(e)?e:e/cu.LOG_10},cu.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},cu.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:r>o?o:r}},cu.wrap=function(t,e){return t<0?e- -t%e:t%e},cu.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=i;return o>u&&(u=o),s>u&&(u=s),a>u&&(u=a),u}},cu.average=function(t,e){return(t+e)/2},hu.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(cu,hu);var lu=function(t){this.str=t};lu.prototype.append=function(t){this.str+=t},lu.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},lu.prototype.toString=function(t){return this.str};var pu=function(t){this.value=t};pu.prototype.intValue=function(){return this.value},pu.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},pu.isNaN=function(t){return Number.isNaN(t)};var fu=function(){};fu.isWhitespace=function(t){return t<=32&&t>=0||127===t},fu.toUpperCase=function(t){return t.toUpperCase()};var gu=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){var r=arguments[0];t.call(this,t.parse(r))}}else if(2===arguments.length){var i=arguments[0],o=arguments[1];this.init(i,o)}},du={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};gu.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},gu.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=gu.magnitude(n._hi),i=gu.TEN.pow(r);(n=n.divide(i)).gt(gu.TEN)?(n=n.divide(gu.TEN),r+=1):n.lt(gu.ONE)&&(n=n.multiply(gu.TEN),r-=1);for(var o=r+1,s=new lu,a=gu.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var c=Math.trunc(n._hi);if(c<0)break;var h=!1,l=0;c>9?(h=!0,l="9"):l="0"+c,s.append(l),n=n.subtract(gu.valueOf(c)).multiply(gu.TEN),h&&n.selfAdd(gu.TEN);var p=!0,f=gu.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(p=!1),!p)break}return e[0]=r,s.toString()},gu.prototype.sqr=function(){return this.multiply(this)},gu.prototype.doubleValue=function(){return this._hi+this._lo},gu.prototype.subtract=function(){if(arguments[0]instanceof gu){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},gu.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},gu.prototype.isZero=function(){return 0===this._hi&&0===this._lo},gu.prototype.selfSubtract=function(){if(arguments[0]instanceof gu){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},gu.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},gu.prototype.min=function(t){return this.le(t)?this:t},gu.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof gu){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,c=null,h=null,l=null;return u=this._hi/n,l=(i=(c=gu.SPLIT*u)-(i=c-u))*(s=(l=gu.SPLIT*n)-(s=l-n))-(h=u*n)+i*(a=n-s)+(o=u-i)*s+o*a,l=u+(c=(this._hi-h-l+this._lo-u*r)/n),this._hi=l,this._lo=u-l+c,this}},gu.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},gu.prototype.divide=function(){if(arguments[0]instanceof gu){var t=arguments[0],e=null,n=null,r=null,i=null,o=null,s=null,a=null,u=null;return n=(o=this._hi/t._hi)-(e=(s=gu.SPLIT*o)-(e=s-o)),u=e*(r=(u=gu.SPLIT*t._hi)-(r=u-t._hi))-(a=o*t._hi)+e*(i=t._hi-r)+n*r+n*i,s=(this._hi-a-u+this._lo-o*t._lo)/t._hi,new gu(u=o+s,o-u+s)}if("number"==typeof arguments[0]){var c=arguments[0];return Ka.isNaN(c)?gu.createNaN():gu.copy(this).selfDivide(c,0)}},gu.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},gu.prototype.pow=function(t){if(0===t)return gu.valueOf(1);var e=new gu(this),n=gu.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},gu.prototype.ceil=function(){if(this.isNaN())return gu.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new gu(t,e)},gu.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},gu.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},gu.prototype.setValue=function(){if(arguments[0]instanceof gu){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},gu.prototype.max=function(t){return this.ge(t)?this:t},gu.prototype.sqrt=function(){if(this.isZero())return gu.valueOf(0);if(this.isNegative())return gu.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=gu.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},gu.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof gu){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0],n=null,r=null,i=null,o=null,s=null,a=null;return o=(i=this._hi+e)-(s=i-this._hi),r=(a=(o=e-s+(this._hi-o))+this._lo)+(i-(n=i+a)),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(2===arguments.length){var u=arguments[0],c=arguments[1],h=null,l=null,p=null,f=null,g=null,d=null,y=null;f=this._hi+u,l=this._lo+c,g=f-(d=f-this._hi),p=l-(y=l-this._lo);var _=(h=f+(d=(g=u-d+(this._hi-g))+l))+(d=(p=c-y+(this._lo-p))+(d+(f-h))),m=d+(h-_);return this._hi=_,this._lo=m,this}},gu.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof gu){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,c=null;i=(u=gu.SPLIT*this._hi)-this._hi,c=gu.SPLIT*n,i=u-i,o=this._hi-i,s=c-n;var h=(u=this._hi*n)+(c=i*(s=c-s)-u+i*(a=n-s)+o*s+o*a+(this._hi*r+this._lo*n)),l=c+(i=u-h);return this._hi=h,this._lo=l,this}},gu.prototype.selfSqr=function(){return this.selfMultiply(this)},gu.prototype.floor=function(){if(this.isNaN())return gu.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new gu(t,e)},gu.prototype.negate=function(){return this.isNaN()?this:new gu(-this._hi,-this._lo)},gu.prototype.clone=function(){},gu.prototype.multiply=function(){if(arguments[0]instanceof gu){var t=arguments[0];return t.isNaN()?gu.createNaN():gu.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Ka.isNaN(e)?gu.createNaN():gu.copy(this).selfMultiply(e,0)}},gu.prototype.isNaN=function(){return Ka.isNaN(this._hi)},gu.prototype.intValue=function(){return Math.trunc(this._hi)},gu.prototype.toString=function(){var t=gu.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},gu.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if("."===n.charAt(0))i="0"+n;else if(r<0)i="0."+gu.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+gu.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},gu.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=gu.SPLIT*n)-(i=s-n)),o=(a=gu.SPLIT*this._hi)-this._hi;var u=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new gu(u,n-u+s)},gu.prototype.toSciNotation=function(){if(this.isZero())return gu.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=gu.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},gu.prototype.abs=function(){return this.isNaN()?gu.NaN:this.isNegative()?this.negate():new gu(this)},gu.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},gu.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},gu.prototype.add=function(){if(arguments[0]instanceof gu){var t=arguments[0];return gu.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return gu.copy(this).selfAdd(e)}},gu.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof gu){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}},gu.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},gu.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},gu.prototype.trunc=function(){return this.isNaN()?gu.NaN:this.isPositive()?this.floor():this.ceil()},gu.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},gu.prototype.interfaces_=function(){return[_i,$a,tu]},gu.prototype.getClass=function(){return gu},gu.sqr=function(t){return gu.valueOf(t).selfMultiply(t)},gu.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return gu.parse(t)}if("number"==typeof arguments[0]){var e=arguments[0];return new gu(e)}},gu.sqrt=function(t){return gu.valueOf(t).sqrt()},gu.parse=function(t){for(var e=0,n=t.length;fu.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(r=!0))}for(var o=new gu,s=0,a=0,u=0;!(e>=n);){var c=t.charAt(e);if(e++,fu.isDigit(c)){var h=c-"0";o.selfMultiply(gu.TEN),o.selfAdd(h),s++}else{if("."!==c){if("e"===c||"E"===c){var l=t.substring(e);try{u=pu.parseInt(l)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+l+" in string "+t):e}break}throw new Error("Unexpected character '"+c+"' at position "+e+" in string "+t)}a=s}}var p=o,f=s-a-u;if(0===f)p=o;else if(f>0){var g=gu.TEN.pow(f);p=o.divide(g)}else if(f<0){var d=gu.TEN.pow(-f);p=o.multiply(d)}return r?p.negate():p},gu.createNaN=function(){return new gu(Ka.NaN,Ka.NaN)},gu.copy=function(t){return new gu(t)},gu.magnitude=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},gu.stringOfChar=function(t,e){for(var n=new lu,r=0;r<e;r++)n.append(t);return n.toString()},du.PI.get=function(){return new gu(3.141592653589793,12246467991473532e-32)},du.TWO_PI.get=function(){return new gu(6.283185307179586,24492935982947064e-32)},du.PI_2.get=function(){return new gu(1.5707963267948966,6123233995736766e-32)},du.E.get=function(){return new gu(2.718281828459045,14456468917292502e-32)},du.NaN.get=function(){return new gu(Ka.NaN,Ka.NaN)},du.EPS.get=function(){return 123259516440783e-46},du.SPLIT.get=function(){return 134217729},du.MAX_PRINT_DIGITS.get=function(){return 32},du.TEN.get=function(){return gu.valueOf(10)},du.ONE.get=function(){return gu.valueOf(1)},du.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},du.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(gu,du);var yu=function(){},_u={DP_SAFE_EPSILON:{configurable:!0}};yu.prototype.interfaces_=function(){return[]},yu.prototype.getClass=function(){return yu},yu.orientationIndex=function(t,e,n){var r=yu.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=gu.valueOf(e.x).selfAdd(-t.x),o=gu.valueOf(e.y).selfAdd(-t.y),s=gu.valueOf(n.x).selfAdd(-e.x),a=gu.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},yu.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},yu.intersection=function(t,e,n,r){var i=gu.valueOf(r.y).selfSubtract(n.y).selfMultiply(gu.valueOf(e.x).selfSubtract(t.x)),o=gu.valueOf(r.x).selfSubtract(n.x).selfMultiply(gu.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=gu.valueOf(r.x).selfSubtract(n.x).selfMultiply(gu.valueOf(t.y).selfSubtract(n.y)),u=gu.valueOf(r.y).selfSubtract(n.y).selfMultiply(gu.valueOf(t.x).selfSubtract(n.x)),c=a.subtract(u).selfDivide(s).doubleValue(),h=gu.valueOf(t.x).selfAdd(gu.valueOf(e.x).selfSubtract(t.x).selfMultiply(c)).doubleValue(),l=gu.valueOf(e.x).selfSubtract(t.x).selfMultiply(gu.valueOf(t.y).selfSubtract(n.y)),p=gu.valueOf(e.y).selfSubtract(t.y).selfMultiply(gu.valueOf(t.x).selfSubtract(n.x)),f=l.subtract(p).selfDivide(s).doubleValue(),g=gu.valueOf(n.y).selfAdd(gu.valueOf(r.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();return new nu(h,g)},yu.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(i>0){if(o<=0)return yu.signum(s);r=i+o}else{if(!(i<0))return yu.signum(s);if(o>=0)return yu.signum(s);r=-i-o}var a=yu.DP_SAFE_EPSILON*r;return s>=a||-s>=a?yu.signum(s):2},yu.signum=function(t){return t>0?1:t<0?-1:0},_u.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(yu,_u);var mu=function(){},vu={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};vu.X.get=function(){return 0},vu.Y.get=function(){return 1},vu.Z.get=function(){return 2},vu.M.get=function(){return 3},mu.prototype.setOrdinate=function(t,e,n){},mu.prototype.size=function(){},mu.prototype.getOrdinate=function(t,e){},mu.prototype.getCoordinate=function(){},mu.prototype.getCoordinateCopy=function(t){},mu.prototype.getDimension=function(){},mu.prototype.getX=function(t){},mu.prototype.clone=function(){},mu.prototype.expandEnvelope=function(t){},mu.prototype.copy=function(){},mu.prototype.getY=function(t){},mu.prototype.toCoordinateArray=function(){},mu.prototype.interfaces_=function(){return[tu]},mu.prototype.getClass=function(){return mu},Object.defineProperties(mu,vu);var xu=function(){},Eu=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xu),wu=function(){};wu.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},wu.getProperty=function(t){return{"line.separator":"\n"}[t]};var bu=function t(){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 e=arguments[0];this.x=e.x,this.y=e.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 t&&arguments[1]instanceof t){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 nu&&arguments[1]instanceof nu){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],c=arguments[1],h=arguments[2];this.x=u,this.y=c,this.w=h}else if(4===arguments.length){var l=arguments[0],p=arguments[1],f=arguments[2],g=arguments[3],d=l.y-p.y,y=p.x-l.x,_=l.x*p.y-p.x*l.y,m=f.y-g.y,v=g.x-f.x,x=f.x*g.y-g.x*f.y;this.x=y*x-v*_,this.y=m*_-d*x,this.w=d*v-m*y}};bu.prototype.getY=function(){var t=this.y/this.w;if(Ka.isNaN(t)||Ka.isInfinite(t))throw new Eu;return t},bu.prototype.getX=function(){var t=this.x/this.w;if(Ka.isNaN(t)||Ka.isInfinite(t))throw new Eu;return t},bu.prototype.getCoordinate=function(){var t=new nu;return t.x=this.getX(),t.y=this.getY(),t},bu.prototype.interfaces_=function(){return[]},bu.prototype.getClass=function(){return bu},bu.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,u=r.x-n.x,c=n.x*r.y-r.x*n.y,h=i*u-a*o,l=(o*c-u*s)/h,p=(a*s-i*c)/h;if(Ka.isNaN(l)||Ka.isInfinite(l)||Ka.isNaN(p)||Ka.isInfinite(p))throw new Eu;return new nu(l,p)};var Iu=function t(){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 nu){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){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],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},Nu={serialVersionUID:{configurable:!0}};Iu.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Iu.prototype.equals=function(t){if(!(t instanceof Iu))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},Iu.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new Iu;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new Iu(e,r,n,i)},Iu.prototype.isNull=function(){return this._maxx<this._minx},Iu.prototype.getMaxX=function(){return this._maxx},Iu.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof nu){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof Iu){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}},Iu.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof Iu){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof nu){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},Iu.prototype.getMinY=function(){return this._miny},Iu.prototype.getMinX=function(){return this._minx},Iu.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof nu){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof Iu){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}},Iu.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},Iu.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Iu.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},Iu.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},Iu.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Iu.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Iu.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Iu.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},Iu.prototype.expandBy=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()}},Iu.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof Iu){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof nu){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},Iu.prototype.centre=function(){return this.isNull()?null:new nu((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Iu.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof nu){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Iu){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},Iu.prototype.getMaxY=function(){return this._maxy},Iu.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},Iu.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+nu.hashCode(this._minx))+nu.hashCode(this._maxx))+nu.hashCode(this._miny))+nu.hashCode(this._maxy)},Iu.prototype.interfaces_=function(){return[$a,_i]},Iu.prototype.getClass=function(){return Iu},Iu.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),c=Math.min(r.x,i.x),h=Math.max(r.x,i.x);return!(c>u||h<a||(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),c=Math.min(r.y,i.y),h=Math.max(r.y,i.y),c>u||h<a))}},Nu.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(Iu,Nu);var Cu={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},Su=function(t){this.geometryFactory=t||new Zc};Su.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=Cu.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=Cu.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],Lu[n]&&(e=Lu[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},Su.prototype.write=function(t){return this.extractGeometry(t)},Su.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!Mu[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+Mu[e].apply(this,[t])+")"};var Mu={coordinate:function(t){return t.x+" "+t.y},point:function(t){return Mu.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+Mu.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(Mu.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(Mu.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+Mu.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+Mu.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+Mu.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+Mu.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},Lu={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(Cu.spaces);return this.geometryFactory.createPoint(new nu(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){if(void 0===t)return this.geometryFactory.createMultiPoint();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Cu.trimParens,"$1"),r.push(Lu.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(Cu.spaces),r.push(new nu(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(r)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(Cu.spaces),r.push(new nu(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString();for(var e,n=t.trim().split(Cu.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Cu.trimParens,"$1"),r.push(Lu.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon();for(var e,n,r,i,o=t.trim().split(Cu.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(Cu.trimParens,"$1"),n=Lu.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var e,n=t.trim().split(Cu.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Cu.trimParens,"$1"),r.push(Lu.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(r)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),n=[],r=0,i=e.length;r<i;++r)n.push(this.read(e[r]));return this.geometryFactory.createGeometryCollection(n)}},Pu=function(t){this.parser=new Su(t)};Pu.prototype.write=function(t){return this.parser.write(t)},Pu.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var Ou=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Ru=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ou),Tu=function(){};Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu},Tu.shouldNeverReachHere=function(){if(0===arguments.length)Tu.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new Ru("Should never reach here"+(null!==t?": "+t:""))}},Tu.isTrue=function(){var t,e;if(1===arguments.length)t=arguments[0],Tu.isTrue(t,null);else if(2===arguments.length&&(t=arguments[0],e=arguments[1],!t))throw null===e?new Ru:new Ru(e)},Tu.equals=function(){var t,e,n;if(2===arguments.length)t=arguments[0],e=arguments[1],Tu.equals(t,e,null);else if(3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],!e.equals(t)))throw new Ru("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var Au=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new nu,this._intPt[1]=new nu,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Du={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Au.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},Au.prototype.getTopologySummary=function(){var t=new lu;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},Au.prototype.computeIntersection=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)},Au.prototype.getIntersectionNum=function(){return this._result},Au.prototype.computeIntLineIndex=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)}},Au.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Au.prototype.setPrecisionModel=function(t){this._precisionModel=t},Au.prototype.isInteriorIntersection=function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments[0],e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}},Au.prototype.getIntersection=function(t){return this._intPt[t]},Au.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Au.prototype.hasIntersection=function(){return this._result!==Au.NO_INTERSECTION},Au.prototype.getEdgeDistance=function(t,e){return Au.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},Au.prototype.isCollinear=function(){return this._result===Au.COLLINEAR_INTERSECTION},Au.prototype.toString=function(){return Pu.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Pu.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Au.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},Au.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},Au.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},Au.prototype.interfaces_=function(){return[]},Au.prototype.getClass=function(){return Au},Au.computeEdgeDistance=function(t,e,n){var r=Math.abs(n.x-e.x),i=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=r>i?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=r>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return Tu.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},Au.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return Tu.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},Du.DONT_INTERSECT.get=function(){return 0},Du.DO_INTERSECT.get=function(){return 1},Du.COLLINEAR.get=function(){return 2},Du.NO_INTERSECTION.get=function(){return 0},Du.POINT_INTERSECTION.get=function(){return 1},Du.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Au,Du);var Fu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new Iu(this._inputLines[0][0],this._inputLines[0][1]),n=new Iu(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,Iu.intersects(n,r,e)&&0===Bu.orientationIndex(n,r,e)&&0===Bu.orientationIndex(r,n,e))return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,n,r,i){i.x=this.smallestInAbsValue(t.x,e.x,n.x,r.x),i.y=this.smallestInAbsValue(t.y,e.y,n.y,r.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,n,r,i){var o=null;try{o=bu.intersection(t,n,r,i)}catch(s){if(!(s instanceof Eu))throw s;o=e.nearestEndpoint(t,n,r,i)}return o},e.prototype.intersection=function(t,n,r,i){var o=this.intersectionWithNormalization(t,n,r,i);return this.isInSegmentEnvelopes(o)||(o=new nu(e.nearestEndpoint(t,n,r,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(n)<o&&(i=n,o=Math.abs(n)),Math.abs(r)<o&&(i=r),i},e.prototype.checkDD=function(t,e,n,r,i){var o=yu.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);wu.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&wu.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new nu(t),o=new nu(e),s=new nu(n),a=new nu(r),u=new nu;this.normalizeToEnvCentre(i,o,s,a,u);var c=this.safeHCoordinateIntersection(i,o,s,a);return c.x+=u.x,c.y+=u.y,c},e.prototype.computeCollinearIntersection=function(e,n,r,i){var o=Iu.intersects(e,n,r),s=Iu.intersects(e,n,i),a=Iu.intersects(r,i,e),u=Iu.intersects(r,i,n);return o&&s?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,r,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,c=n.x<r.x?n.x:r.x,h=n.y<r.y?n.y:r.y,l=n.x>r.x?n.x:r.x,p=n.y>r.y?n.y:r.y,f=((o>c?o:c)+(a<l?a:l))/2,g=((s>h?s:h)+(u<p?u:p))/2;i.x=f,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.computeIntersect=function(e,n,r,i){if(this._isProper=!1,!Iu.intersects(e,n,r,i))return t.NO_INTERSECTION;var o=Bu.orientationIndex(e,n,r),s=Bu.orientationIndex(e,n,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=Bu.orientationIndex(r,i,e),u=Bu.orientationIndex(r,i,n);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,r,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(r)||e.equals2D(i)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(i)?this._intPt[0]=n:0===o?this._intPt[0]=new nu(r):0===s?this._intPt[0]=new nu(i):0===a?this._intPt[0]=new nu(e):0===u&&(this._intPt[0]=new nu(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,r){var i=t,o=Bu.distancePointLine(t,n,r),s=Bu.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=Bu.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=Bu.distancePointLine(r,t,e))<o&&(o=s,i=r),i},e}(Au),qu=function(){};qu.prototype.interfaces_=function(){return[]},qu.prototype.getClass=function(){return qu},qu.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return qu.signOfDet2x2(r,i,o,s)},qu.signOfDet2x2=function(t,e,n,r){var i=null,o=null,s=null;if(i=1,0===t||0===r)return 0===e||0===n?0:e>0?n>0?-i:i:n>0?i:-i;if(0===e||0===n)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0))return i;if(!(t<=n))return i}else{if(n>0)return-i;if(!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(e<r+r)return i}else{if(e>r+r)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if((e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(r<e+e)return-i}else{if(r>e+e)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var Gu=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Gu.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=qu.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},Gu.prototype.isPointInPolygon=function(){return this.getLocation()!==su.EXTERIOR},Gu.prototype.getLocation=function(){return this._isPointOnSegment?su.BOUNDARY:this._crossingCount%2==1?su.INTERIOR:su.EXTERIOR},Gu.prototype.isOnSegment=function(){return this._isPointOnSegment},Gu.prototype.interfaces_=function(){return[]},Gu.prototype.getClass=function(){return Gu},Gu.locatePointInRing=function(){if(arguments[0]instanceof nu&&uu(arguments[1],mu)){for(var t=arguments[0],e=arguments[1],n=new Gu(t),r=new nu,i=new nu,o=1;o<e.size();o++)if(e.getCoordinate(o,r),e.getCoordinate(o-1,i),n.countSegment(r,i),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof nu&&arguments[1]instanceof Array){for(var s=arguments[0],a=arguments[1],u=new Gu(s),c=1;c<a.length;c++){var h=a[c],l=a[c-1];if(u.countSegment(h,l),u.isOnSegment())return u.getLocation()}return u.getLocation()}};var Bu=function(){},ku={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};Bu.prototype.interfaces_=function(){return[]},Bu.prototype.getClass=function(){return Bu},Bu.orientationIndex=function(t,e,n){return yu.orientationIndex(t,e,n)},Bu.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,r=1;r<t.length-1;r++){var i=t[r].x-n,o=t[r+1].y;e+=i*(t[r-1].y-o)}return e/2}if(uu(arguments[0],mu)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new nu,c=new nu,h=new nu;s.getCoordinate(0,c),s.getCoordinate(1,h);var l=c.x;h.x-=l;for(var p=0,f=1;f<a-1;f++)u.y=c.y,c.x=h.x,c.y=h.y,s.getCoordinate(f+1,h),h.x-=l,p+=c.x*(u.y-h.y);return p/2}},Bu.distanceLineLine=function(t,e,n,r){if(t.equals(e))return Bu.distancePointLine(t,n,r);if(n.equals(r))return Bu.distancePointLine(r,t,e);var i=!1;if(Iu.intersects(t,e,n,r)){var o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(0===o)i=!0;else{var s=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?cu.min(Bu.distancePointLine(t,n,r),Bu.distancePointLine(e,n,r),Bu.distancePointLine(n,t,e),Bu.distancePointLine(r,t,e)):0},Bu.isPointInRing=function(t,e){return Bu.locatePointInRing(t,e)!==su.EXTERIOR},Bu.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new nu;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;s<e;s++){t.getCoordinate(s,r);var a=r.x,u=r.y,c=a-i,h=u-o;n+=Math.sqrt(c*c+h*h),i=a,o=u}return n},Bu.isCCW=function(t){var e=t.length-1;if(e<3)throw new Za("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,i=1;i<=e;i++){var o=t[i];o.y>n.y&&(n=o,r=i)}var s=r;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==r);var a=r;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==r);var u=t[s],c=t[a];if(u.equals2D(n)||c.equals2D(n)||u.equals2D(c))return!1;var h=Bu.computeOrientation(u,n,c);return 0===h?u.x>c.x:h>0},Bu.locatePointInRing=function(t,e){return Gu.locatePointInRing(t,e)},Bu.distancePointLinePerpendicular=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)},Bu.computeOrientation=function(t,e,n){return Bu.orientationIndex(t,e,n)},Bu.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new Za("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=Bu.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),c=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(c<=0)return o.distance(s);if(c>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(h)*Math.sqrt(u)}},Bu.isOnLine=function(t,e){for(var n=new Fu,r=1;r<e.length;r++){var i=e[r-1],o=e[r];if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},ku.CLOCKWISE.get=function(){return-1},ku.RIGHT.get=function(){return Bu.CLOCKWISE},ku.COUNTERCLOCKWISE.get=function(){return 1},ku.LEFT.get=function(){return Bu.COUNTERCLOCKWISE},ku.COLLINEAR.get=function(){return 0},ku.STRAIGHT.get=function(){return Bu.COLLINEAR},Object.defineProperties(Bu,ku);var zu=function(){};zu.prototype.filter=function(t){},zu.prototype.interfaces_=function(){return[]},zu.prototype.getClass=function(){return zu};var ju=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Xu={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};ju.prototype.isGeometryCollection=function(){return this.getSortIndex()===ju.SORTINDEX_GEOMETRYCOLLECTION},ju.prototype.getFactory=function(){return this._factory},ju.prototype.getGeometryN=function(t){return this},ju.prototype.getArea=function(){return 0},ju.prototype.isRectangle=function(){return!1},ju.prototype.equals=function(){if(arguments[0]instanceof ju){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof ju))return!1;var n=e;return this.equalsExact(n)}},ju.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},ju.prototype.geometryChanged=function(){this.apply(ju.geometryChangedFilter)},ju.prototype.geometryChangedAction=function(){this._envelope=null},ju.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},ju.prototype.getLength=function(){return 0},ju.prototype.getNumGeometries=function(){return 1},ju.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},ju.prototype.getUserData=function(){return this._userData},ju.prototype.getSRID=function(){return this._SRID},ju.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},ju.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===ju.SORTINDEX_GEOMETRYCOLLECTION)throw new Za("This method does not support GeometryCollection arguments")},ju.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},ju.prototype.norm=function(){var t=this.copy();return t.normalize(),t},ju.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},ju.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new Iu(this._envelope)},ju.prototype.setSRID=function(t){this._SRID=t},ju.prototype.setUserData=function(t){this._userData=t},ju.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(0!==s)return s}return n.hasNext()?1:r.hasNext()?-1:0},ju.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},ju.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===ju.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===ju.SORTINDEX_MULTIPOINT||this.getSortIndex()===ju.SORTINDEX_MULTILINESTRING||this.getSortIndex()===ju.SORTINDEX_MULTIPOLYGON},ju.prototype.interfaces_=function(){return[tu,$a,_i]},ju.prototype.getClass=function(){return ju},ju.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},ju.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},Xu.serialVersionUID.get=function(){return 0x799ea46522854c00},Xu.SORTINDEX_POINT.get=function(){return 0},Xu.SORTINDEX_MULTIPOINT.get=function(){return 1},Xu.SORTINDEX_LINESTRING.get=function(){return 2},Xu.SORTINDEX_LINEARRING.get=function(){return 3},Xu.SORTINDEX_MULTILINESTRING.get=function(){return 4},Xu.SORTINDEX_POLYGON.get=function(){return 5},Xu.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Xu.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Xu.geometryChangedFilter.get=function(){return Uu},Object.defineProperties(ju,Xu);var Uu=function(){};Uu.interfaces_=function(){return[zu]},Uu.filter=function(t){t.geometryChangedAction()};var Yu=function(){};Yu.prototype.filter=function(t){},Yu.prototype.interfaces_=function(){return[]},Yu.prototype.getClass=function(){return Yu};var Vu=function(){},Hu={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Vu.prototype.isInBoundary=function(t){},Vu.prototype.interfaces_=function(){return[]},Vu.prototype.getClass=function(){return Vu},Hu.Mod2BoundaryNodeRule.get=function(){return Wu},Hu.EndPointBoundaryNodeRule.get=function(){return Ju},Hu.MultiValentEndPointBoundaryNodeRule.get=function(){return Zu},Hu.MonoValentEndPointBoundaryNodeRule.get=function(){return Ku},Hu.MOD2_BOUNDARY_RULE.get=function(){return new Wu},Hu.ENDPOINT_BOUNDARY_RULE.get=function(){return new Ju},Hu.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Zu},Hu.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ku},Hu.OGC_SFS_BOUNDARY_RULE.get=function(){return Vu.MOD2_BOUNDARY_RULE},Object.defineProperties(Vu,Hu);var Wu=function(){};Wu.prototype.isInBoundary=function(t){return t%2==1},Wu.prototype.interfaces_=function(){return[Vu]},Wu.prototype.getClass=function(){return Wu};var Ju=function(){};Ju.prototype.isInBoundary=function(t){return t>0},Ju.prototype.interfaces_=function(){return[Vu]},Ju.prototype.getClass=function(){return Ju};var Zu=function(){};Zu.prototype.isInBoundary=function(t){return t>1},Zu.prototype.interfaces_=function(){return[Vu]},Zu.prototype.getClass=function(){return Zu};var Ku=function(){};Ku.prototype.isInBoundary=function(t){return 1===t},Ku.prototype.interfaces_=function(){return[Vu]},Ku.prototype.getClass=function(){return Ku};var Qu=function(){};Qu.prototype.add=function(){},Qu.prototype.addAll=function(){},Qu.prototype.isEmpty=function(){},Qu.prototype.iterator=function(){},Qu.prototype.size=function(){},Qu.prototype.toArray=function(){},Qu.prototype.remove=function(){};var $u=function(t){function e(e){t.call(this),this.message=e||""}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={name:{configurable:!0}};return n.name.get=function(){return"IndexOutOfBoundsException"},Object.defineProperties(e,n),e}(Error),tc=function(){};tc.prototype.hasNext=function(){},tc.prototype.next=function(){},tc.prototype.remove=function(){};var ec=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Qu);(mi.prototype=new Error).name="NoSuchElementException";var nc=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Qu&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Qu]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new rc(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new $u;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n<r;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},e}(ec),rc=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new mi;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(tc),ic=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.ensureCapacity(n.length),this.add(n,r)}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={coordArrayType:{configurable:!0}};return n.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[0],n=arguments[1],r=!1,i=e.iterator();i.hasNext();)this.add(i.next(),n),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=0;n<this.size();n++)e.add(n,this.get(n).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){if(1===arguments.length){var e=arguments[0];t.prototype.add.call(this,e)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],r=arguments[1];return this.add(n,r,!0),!0}if(arguments[0]instanceof nu&&"boolean"==typeof arguments[1]){var i=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(i))return null;t.prototype.add.call(this,i)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1];return this.add(o,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var a=arguments[0],u=arguments[1];if(arguments[2])for(var c=0;c<a.length;c++)this.add(a[c],u);else for(var h=a.length-1;h>=0;h--)this.add(a[h],u);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof nu){var l=arguments[0],p=arguments[1];if(!arguments[2]){var f=this.size();if(f>0){if(l>0&&this.get(l-1).equals2D(p))return null;if(l<f&&this.get(l).equals2D(p))return null}}t.prototype.add.call(this,l,p)}}else if(4===arguments.length){var g=arguments[0],d=arguments[1],y=arguments[2],_=arguments[3],m=1;y>_&&(m=-1);for(var v=y;v!==_;v+=m)this.add(g[v],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new nu(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(nc),oc=function(){},sc={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};sc.ForwardComparator.get=function(){return ac},sc.BidirectionalComparator.get=function(){return uc},sc.coordArrayType.get=function(){return new Array(0).fill(null)},oc.prototype.interfaces_=function(){return[]},oc.prototype.getClass=function(){return oc},oc.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},oc.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(oc.indexOf(r,e)<0)return r}return null},oc.scroll=function(t,e){var n=oc.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);wu.arraycopy(t,n,r,0,t.length-n),wu.arraycopy(t,0,r,t.length-n,n),wu.arraycopy(r,0,t,0,t.length)},oc.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(0!==o.compare(r[s],i[s]))return!1;return!0}},oc.intersection=function(t,e){for(var n=new ic,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},oc.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},oc.removeRepeatedPoints=function(t){return oc.hasRepeatedPoints(t)?new ic(t,!1).toCoordinateArray():t},oc.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t[r];t[r]=t[e-r],t[e-r]=i}},oc.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},oc.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new nu(t[n]);return e}if(5===arguments.length)for(var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new nu(r[i+u])},oc.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=e[t.length-n-1];if(0!==r.compareTo(i))return!1}return!0},oc.envelope=function(t){for(var e=new Iu,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},oc.toCoordinateArray=function(t){return t.toArray(oc.coordArrayType)},oc.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},oc.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},oc.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(0!==r)return r}return 1},oc.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(0!==r)return r;n++}return n<e.length?-1:n<t.length?1:0},oc.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},oc.extract=function(t,e,n){e=cu.clamp(e,0,t.length);var r=(n=cu.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(oc,sc);var ac=function(){};ac.prototype.compare=function(t,e){return oc.compare(t,e)},ac.prototype.interfaces_=function(){return[eu]},ac.prototype.getClass=function(){return ac};var uc=function(){};uc.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;var i=oc.compare(n,r);return oc.isEqualReversed(n,r)?0:i},uc.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;for(var i=oc.increasingDirection(n),o=oc.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u<n.length;u++){var c=n[s].compareTo(r[a]);if(0!==c)return c;s+=i,a+=o}return 0},uc.prototype.interfaces_=function(){return[eu]},uc.prototype.getClass=function(){return uc};var cc=function(){};cc.prototype.get=function(){},cc.prototype.put=function(){},cc.prototype.size=function(){},cc.prototype.values=function(){},cc.prototype.entrySet=function(){};var hc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(cc);(vi.prototype=new Error).name="OperationNotSupported",(xi.prototype=new Qu).contains=function(){};var lc=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Qu&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new pc(this)},e}(xi),pc=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new mi;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new vi},e}(tc),fc=0;(Ci.prototype=new hc).get=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},Ci.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:fc,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 s={key:t,left:null,right:null,value:e,parent:n,color:fc,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},Ci.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(wi(t)===Ii(wi(wi(t)))){var e=Ni(wi(wi(t)));1===Ei(e)?(bi(wi(t),fc),bi(e,fc),bi(wi(wi(t)),1),t=wi(wi(t))):(t===Ni(wi(t))&&(t=wi(t),this.rotateLeft(t)),bi(wi(t),fc),bi(wi(wi(t)),1),this.rotateRight(wi(wi(t))))}else{var n=Ii(wi(wi(t)));1===Ei(n)?(bi(wi(t),fc),bi(n,fc),bi(wi(wi(t)),1),t=wi(wi(t))):(t===Ii(wi(t))&&(t=wi(t),this.rotateRight(t)),bi(wi(t),fc),bi(wi(wi(t)),1),this.rotateLeft(wi(wi(t))))}this.root_.color=fc},Ci.prototype.values=function(){var t=new nc,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=Ci.successor(e));)t.add(e.value);return t},Ci.prototype.entrySet=function(){var t=new lc,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=Ci.successor(e));)t.add(e);return t},Ci.prototype.rotateLeft=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}},Ci.prototype.rotateRight=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}},Ci.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},Ci.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var n=t.parent,r=t;null!==n&&r===n.right;)r=n,n=n.parent;return n},Ci.prototype.size=function(){return this.size_};var gc=function(){};gc.prototype.interfaces_=function(){return[]},gc.prototype.getClass=function(){return gc},Si.prototype=new xi,(Mi.prototype=new Si).contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},Mi.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},Mi.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},Mi.prototype.remove=function(t){throw new vi},Mi.prototype.size=function(){return this.array_.length},Mi.prototype.isEmpty=function(){return 0===this.array_.length},Mi.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},Mi.prototype.iterator=function(){return new dc(this)};var dc=function(t){this.treeSet_=t,this.position_=0};dc.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new mi;return this.treeSet_.array_[this.position_++]},dc.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},dc.prototype.remove=function(){throw new vi};var yc=function(){};yc.sort=function(){var t,e,n,r,i=arguments[0];if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort(r);else if(2===arguments.length)n=arguments[1],r=function(t,e){return n.compare(t,e)},i.sort(r);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),n=arguments[3],r=function(t,e){return n.compare(t,e)},e.sort(r),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},yc.asList=function(t){for(var e=new nc,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var _c=function(){},mc={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};mc.P.get=function(){return 0},mc.L.get=function(){return 1},mc.A.get=function(){return 2},mc.FALSE.get=function(){return-1},mc.TRUE.get=function(){return-2},mc.DONTCARE.get=function(){return-3},mc.SYM_FALSE.get=function(){return"F"},mc.SYM_TRUE.get=function(){return"T"},mc.SYM_DONTCARE.get=function(){return"*"},mc.SYM_P.get=function(){return"0"},mc.SYM_L.get=function(){return"1"},mc.SYM_A.get=function(){return"2"},_c.prototype.interfaces_=function(){return[]},_c.prototype.getClass=function(){return _c},_c.toDimensionSymbol=function(t){switch(t){case _c.FALSE:return _c.SYM_FALSE;case _c.TRUE:return _c.SYM_TRUE;case _c.DONTCARE:return _c.SYM_DONTCARE;case _c.P:return _c.SYM_P;case _c.L:return _c.SYM_L;case _c.A:return _c.SYM_A}throw new Za("Unknown dimension value: "+t)},_c.toDimensionValue=function(t){switch(fu.toUpperCase(t)){case _c.SYM_FALSE:return _c.FALSE;case _c.SYM_TRUE:return _c.TRUE;case _c.SYM_DONTCARE:return _c.DONTCARE;case _c.SYM_P:return _c.P;case _c.SYM_L:return _c.L;case _c.SYM_A:return _c.A}throw new Za("Unknown dimension symbol: "+t)},Object.defineProperties(_c,mc);var vc=function(){};vc.prototype.filter=function(t){},vc.prototype.interfaces_=function(){return[]},vc.prototype.getClass=function(){return vc};var xc=function(){};xc.prototype.filter=function(t,e){},xc.prototype.isDone=function(){},xc.prototype.isGeometryChanged=function(){},xc.prototype.interfaces_=function(){return[]},xc.prototype.getClass=function(){return xc};var Ec=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new Za("geometries must not contain null elements")}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new Iu,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getCoordinates(),i=0;i<r.length;i++)t[++e]=r[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(r._geometries[i],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();yc.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=_c.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=_c.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new Mi(yc.asList(this._geometries)),n=new Mi(yc.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=arguments[0],i=arguments[1],o=r,s=this.getNumGeometries(),a=o.getNumGeometries(),u=0;u<s&&u<a;){var c=this.getGeometryN(u),h=o.getGeometryN(u),l=c.compareToSameClass(h,i);if(0!==l)return l;u++}return u<s?1:u<a?-1:0}},e.prototype.apply=function(){if(uu(arguments[0],Yu))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(uu(arguments[0],xc)){var n=arguments[0];if(0===this._geometries.length)return null;for(var r=0;r<this._geometries.length&&(this._geometries[r].apply(n),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else if(uu(arguments[0],vc)){var i=arguments[0];i.filter(this);for(var o=0;o<this._geometries.length;o++)this._geometries[o].apply(i)}else if(uu(arguments[0],zu)){var s=arguments[0];s.filter(this);for(var a=0;a<this._geometries.length;a++)this._geometries[a].apply(s)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Tu.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var n=0;n<this._geometries.length;n++)e._geometries[n]=this._geometries[n].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,n),e}(ju),wc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?_c.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new bc(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[gc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(Ec),bc=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=Vu.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};bc.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},bc.prototype.getBoundary=function(){return this._geom instanceof Mc?this.boundaryLineString(this._geom):this._geom instanceof wc?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},bc.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},bc.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},bc.prototype.computeBoundaryCoordinates=function(t){var e=new nc;this._endpointMap=new Ci;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);0!==r.getNumPoints()&&(this.addEndpoint(r.getCoordinateN(0)),this.addEndpoint(r.getCoordinateN(r.getNumPoints()-1)))}for(var i=this._endpointMap.entrySet().iterator();i.hasNext();){var o=i.next(),s=o.getValue().count;this._bnRule.isInBoundary(s)&&e.add(o.getKey())}return oc.toCoordinateArray(e)},bc.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Ic,this._endpointMap.put(t,e)),e.count++},bc.prototype.interfaces_=function(){return[]},bc.prototype.getClass=function(){return bc},bc.getBoundary=function(){if(1===arguments.length){var t=arguments[0];return new bc(t).getBoundary()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return new bc(e,n).getBoundary()}};var Ic=function(){this.count=null};Ic.prototype.interfaces_=function(){return[]},Ic.prototype.getClass=function(){return Ic};var Nc=function(){},Cc={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Nc.prototype.interfaces_=function(){return[]},Nc.prototype.getClass=function(){return Nc},Nc.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Nc.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new function(){},n=new function(){}(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var r=arguments[0],i=arguments[1],o="",s=new function(){}(new function(){}(Nc.getStackTrace(r))),a=0;a<i;a++)try{o+=s.readLine()+Nc.NEWLINE}catch(t){if(!(t instanceof Li))throw t;Tu.shouldNeverReachHere()}return o}},Nc.split=function(t,e){for(var n=e.length,r=new nc,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u<a.length;u++)a[u]=r.get(u);return a},Nc.toString=function(){if(1===arguments.length){var t=arguments[0];return Nc.SIMPLE_ORDINATE_FORMAT.format(t)}},Nc.spaces=function(t){return Nc.chars(" ",t)},Cc.NEWLINE.get=function(){return wu.getProperty("line.separator")},Cc.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(Nc,Cc);var Sc=function(){};Sc.prototype.interfaces_=function(){return[]},Sc.prototype.getClass=function(){return Sc},Sc.copyCoord=function(t,e,n,r){for(var i=Math.min(t.getDimension(),n.getDimension()),o=0;o<i;o++)n.setOrdinate(r,o,t.getOrdinate(e,o))},Sc.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,mu.X)===t.getOrdinate(e-1,mu.X)&&t.getOrdinate(0,mu.Y)===t.getOrdinate(e-1,mu.Y)},Sc.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),i=0;i<n;i++)for(var o=0;o<r;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||Ka.isNaN(s)&&Ka.isNaN(a)))return!1}return!0},Sc.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(Sc.copy(e,0,r,0,i),i>0)for(var o=i;o<n;o++)Sc.copy(e,i-1,r,o,1);return r},Sc.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)Sc.swap(t,r,e-r)},Sc.swap=function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var i=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,i)}},Sc.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)Sc.copyCoord(t,e+o,n,r+o)},Sc.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new lu;r.append("(");for(var i=0;i<e;i++){i>0&&r.append(" ");for(var o=0;o<n;o++)o>0&&r.append(","),r.append(Nc.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},Sc.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Sc.createClosedRing(t,e,4):e.getOrdinate(0,mu.X)===e.getOrdinate(n-1,mu.X)&&e.getOrdinate(0,mu.Y)===e.getOrdinate(n-1,mu.Y)?e:Sc.createClosedRing(t,e,n+1)},Sc.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Sc.copy(e,0,r,0,i);for(var o=i;o<n;o++)Sc.copy(e,0,r,o,1);return r};var Mc=function(t){function e(e,n){t.call(this,n),this._points=null,this.init(e)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Iu:this._points.expandEnvelope(new Iu)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),r._points.getCoordinate(i),n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<Math.trunc(this._points.size()/2);t++){var e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e)))return this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))>0&&Sc.reverse(this._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?_c.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Bu.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Sc.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var r=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==r)return r;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(uu(arguments[0],Yu))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(uu(arguments[0],xc)){var n=arguments[0];if(0===this._points.size())return null;for(var r=0;r<this._points.size()&&(n.filter(this._points,r),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else(uu(arguments[0],vc)||uu(arguments[0],zu))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new bc(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new Za("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[gc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(ju),Lc=function(){};Lc.prototype.interfaces_=function(){return[]},Lc.prototype.getClass=function(){return Lc};var Pc=function(t){function e(e,n){t.call(this,n),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Iu;var t=new Iu;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return _c.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(uu(arguments[0],Yu)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(uu(arguments[0],xc)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(uu(arguments[0],vc)||uu(arguments[0],zu))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),Tu.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[Lc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(ju),Oc=function(){};Oc.prototype.interfaces_=function(){return[]},Oc.prototype.getClass=function(){return Oc};var Rc=function(t){function e(e,n,r){if(t.call(this,r),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===n&&(n=[]),t.hasNullElements(n))throw new Za("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new Za("shell is empty but holes are not");this._shell=e,this._holes=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),r=0;r<n.length;r++)t[++e]=n[r];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(Bu.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(Bu.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var r=t.getX(n);if(r!==e.getMinX()&&r!==e.getMaxX())return!1;var i=t.getY(n);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),c=t.getY(a);if(u!==o==(c!==s))return!1;o=u,s=c}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e,i=this._shell,o=r._shell;if(!i.equalsExact(o,n))return!1;if(this._holes.length!==r._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(r._holes[s],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);yc.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var r=new Array(e.getCoordinates().length-1).fill(null);wu.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=oc.minCoordinate(e.getCoordinates());oc.scroll(r,i),wu.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],Bu.isCCW(e.getCoordinates())===n&&oc.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var r=arguments[0],i=arguments[1],o=r,s=this._shell,a=o._shell,u=s.compareToSameClass(a,i);if(0!==u)return u;for(var c=this.getNumInteriorRing(),h=o.getNumInteriorRing(),l=0;l<c&&l<h;){var p=this.getInteriorRingN(l),f=o.getInteriorRingN(l),g=p.compareToSameClass(f,i);if(0!==g)return g;l++}return l<c?1:l<h?-1:0}},e.prototype.apply=function(t){if(uu(t,Yu)){this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(uu(t,xc)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(this._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(uu(t,vc))t.filter(this);else if(uu(t,zu)){t.filter(this),this._shell.apply(t);for(var r=0;r<this._holes.length;r++)this._holes[r].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var n=0;n<this._holes.length;n++)e._holes[n]=this._holes[n].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r<n.length;r++)n[r]=this._holes[r].copy();return new e(t,n,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[Oc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(ju),Tc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return _c.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Lc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(Ec),Ac=function(t){function e(e,n){e instanceof nu&&n instanceof Zc&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return _c.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return Sc.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new Za("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new Za("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Mc),Dc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ju.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new nc,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN(r));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Oc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(Ec),Fc=function(t){this._factory=t||null,this._isUserDataCopied=!1},qc={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Fc.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Fc.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Fc.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Ec?this.editGeometryCollection(t,e):t instanceof Rc?this.editPolygon(t,e):t instanceof Pc||t instanceof Mc?e.edit(t,this._factory):(Tu.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Fc.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new nc,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===Tc?this._factory.createMultiPoint(r.toArray([])):n.getClass()===wc?this._factory.createMultiLineString(r.toArray([])):n.getClass()===Dc?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},Fc.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var r=this.edit(n.getExteriorRing(),e);if(null===r||r.isEmpty())return this._factory.createPolygon();for(var i=new nc,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},Fc.prototype.interfaces_=function(){return[]},Fc.prototype.getClass=function(){return Fc},Fc.GeometryEditorOperation=function(){},qc.NoOpGeometryOperation.get=function(){return Gc},qc.CoordinateOperation.get=function(){return Bc},qc.CoordinateSequenceOperation.get=function(){return kc},Object.defineProperties(Fc,qc);var Gc=function(){};Gc.prototype.edit=function(t,e){return t},Gc.prototype.interfaces_=function(){return[Fc.GeometryEditorOperation]},Gc.prototype.getClass=function(){return Gc};var Bc=function(){};Bc.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof Ac?e.createLinearRing(n):t instanceof Mc?e.createLineString(n):t instanceof Pc?n.length>0?e.createPoint(n[0]):e.createPoint():t},Bc.prototype.interfaces_=function(){return[Fc.GeometryEditorOperation]},Bc.prototype.getClass=function(){return Bc};var kc=function(){};kc.prototype.edit=function(t,e){return t instanceof Ac?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Mc?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Pc?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},kc.prototype.interfaces_=function(){return[Fc.GeometryEditorOperation]},kc.prototype.getClass=function(){return kc};var zc=function(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var e=0;e<t;e++)this._coordinates[e]=new nu}else if(uu(arguments[0],mu)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var r=0;r<this._coordinates.length;r++)this._coordinates[r]=n.getCoordinateCopy(r)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var i=arguments[0],o=arguments[1];this._coordinates=i,this._dimension=o,null===i&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],a=arguments[1];this._coordinates=new Array(s).fill(null),this._dimension=a;for(var u=0;u<s;u++)this._coordinates[u]=new nu}},jc={serialVersionUID:{configurable:!0}};zc.prototype.setOrdinate=function(t,e,n){switch(e){case mu.X:this._coordinates[t].x=n;break;case mu.Y:this._coordinates[t].y=n;break;case mu.Z:this._coordinates[t].z=n;break;default:throw new Za("invalid ordinateIndex")}},zc.prototype.size=function(){return this._coordinates.length},zc.prototype.getOrdinate=function(t,e){switch(e){case mu.X:return this._coordinates[t].x;case mu.Y:return this._coordinates[t].y;case mu.Z:return this._coordinates[t].z}return Ka.NaN},zc.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},zc.prototype.getCoordinateCopy=function(t){return new nu(this._coordinates[t])},zc.prototype.getDimension=function(){return this._dimension},zc.prototype.getX=function(t){return this._coordinates[t].x},zc.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new zc(t,this._dimension)},zc.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},zc.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new zc(t,this._dimension)},zc.prototype.toString=function(){if(this._coordinates.length>0){var t=new lu(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},zc.prototype.getY=function(t){return this._coordinates[t].y},zc.prototype.toCoordinateArray=function(){return this._coordinates},zc.prototype.interfaces_=function(){return[mu,_i]},zc.prototype.getClass=function(){return zc},jc.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(zc,jc);var Xc=function(){},Uc={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Xc.prototype.readResolve=function(){return Xc.instance()},Xc.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new zc(t)}if(uu(arguments[0],mu)){var e=arguments[0];return new zc(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return r>3&&(r=3),r<2?new zc(n):new zc(n,r)}},Xc.prototype.interfaces_=function(){return[ou,_i]},Xc.prototype.getClass=function(){return Xc},Xc.instance=function(){return Xc.instanceObject},Uc.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Uc.instanceObject.get=function(){return new Xc},Object.defineProperties(Xc,Uc);var Yc=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new nc,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new lc;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(cc),Vc=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof Wc){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}},Hc={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Vc.prototype.equals=function(t){if(!(t instanceof Vc))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Vc.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new pu(n).compareTo(new pu(r))},Vc.prototype.getScale=function(){return this._scale},Vc.prototype.isFloating=function(){return this._modelType===Vc.FLOATING||this._modelType===Vc.FLOATING_SINGLE},Vc.prototype.getType=function(){return this._modelType},Vc.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Vc.FLOATING?t="Floating":this._modelType===Vc.FLOATING_SINGLE?t="Floating-Single":this._modelType===Vc.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},Vc.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Ka.isNaN(t)||this._modelType===Vc.FLOATING_SINGLE?t:this._modelType===Vc.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof nu){var e=arguments[0];if(this._modelType===Vc.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},Vc.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Vc.FLOATING?t=16:this._modelType===Vc.FLOATING_SINGLE?t=6:this._modelType===Vc.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Vc.prototype.setScale=function(t){this._scale=Math.abs(t)},Vc.prototype.interfaces_=function(){return[_i,$a]},Vc.prototype.getClass=function(){return Vc},Vc.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Hc.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Hc.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Vc,Hc);var Wc=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Jc={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Wc.prototype.readResolve=function(){return Wc.nameToTypeMap.get(this._name)},Wc.prototype.toString=function(){return this._name},Wc.prototype.interfaces_=function(){return[_i]},Wc.prototype.getClass=function(){return Wc},Jc.serialVersionUID.get=function(){return-552860263173159e4},Jc.nameToTypeMap.get=function(){return new Yc},Object.defineProperties(Wc,Jc),Vc.Type=Wc,Vc.FIXED=new Wc("FIXED"),Vc.FLOATING=new Wc("FLOATING"),Vc.FLOATING_SINGLE=new Wc("FLOATING SINGLE");var Zc=function t(){this._precisionModel=new Vc,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?uu(arguments[0],ou)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Vc&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Kc={serialVersionUID:{configurable:!0}};Zc.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new nu(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new nu(t.getMinX(),t.getMinY()),new nu(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new nu(t.getMinX(),t.getMinY()),new nu(t.getMinX(),t.getMaxY()),new nu(t.getMaxX(),t.getMaxY()),new nu(t.getMaxX(),t.getMinY()),new nu(t.getMinX(),t.getMinY())]),null)},Zc.prototype.createLineString=function(t){return t?t instanceof Array?new Mc(this.getCoordinateSequenceFactory().create(t),this):uu(t,mu)?new Mc(t,this):void 0:new Mc(this.getCoordinateSequenceFactory().create([]),this)},Zc.prototype.createMultiLineString=function(){if(0===arguments.length)return new wc(null,this);if(1===arguments.length){var t=arguments[0];return new wc(t,this)}},Zc.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(Zc.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Rc)return this.createMultiPolygon(Zc.toPolygonArray(t));if(a instanceof Mc)return this.createMultiLineString(Zc.toLineStringArray(t));if(a instanceof Pc)return this.createMultiPoint(Zc.toPointArray(t));Tu.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},Zc.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},Zc.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof nu){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(uu(arguments[0],mu)){var e=arguments[0];return new Pc(e,this)}}},Zc.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Zc.prototype.createPolygon=function(){if(0===arguments.length)return new Rc(null,null,this);if(1===arguments.length){if(uu(arguments[0],mu)){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 Ac){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];return new Rc(r,i,this)}},Zc.prototype.getSRID=function(){return this._SRID},Zc.prototype.createGeometryCollection=function(){if(0===arguments.length)return new Ec(null,this);if(1===arguments.length){var t=arguments[0];return new Ec(t,this)}},Zc.prototype.createGeometry=function(t){return new Fc(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},Zc.prototype.getPrecisionModel=function(){return this._precisionModel},Zc.prototype.createLinearRing=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(uu(arguments[0],mu)){var e=arguments[0];return new Ac(e,this)}}},Zc.prototype.createMultiPolygon=function(){if(0===arguments.length)return new Dc(null,this);if(1===arguments.length){var t=arguments[0];return new Dc(t,this)}},Zc.prototype.createMultiPoint=function(){if(0===arguments.length)return new Tc(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new Tc(t,this)}if(arguments[0]instanceof Array){var e=arguments[0];return this.createMultiPoint(null!==e?this.getCoordinateSequenceFactory().create(e):null)}if(uu(arguments[0],mu)){var n=arguments[0];if(null===n)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(n.size()).fill(null),i=0;i<n.size();i++){var o=this.getCoordinateSequenceFactory().create(1,n.getDimension());Sc.copy(n,i,o,0,1),r[i]=this.createPoint(o)}return this.createMultiPoint(r)}}},Zc.prototype.interfaces_=function(){return[_i]},Zc.prototype.getClass=function(){return Zc},Zc.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.getDefaultCoordinateSequenceFactory=function(){return Xc.instance()},Zc.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Zc.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},Kc.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(Zc,Kc);var Qc=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],$c=function(t){this.geometryFactory=t||new Zc};$c.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!th[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Qc.indexOf(n)?th[n].apply(this,[e.coordinates]):"GeometryCollection"===n?th[n].apply(this,[e.geometries]):th[n].apply(this,[e])},$c.prototype.write=function(t){var e=t.getGeometryType();if(!eh[e])throw new Error("Geometry is not supported");return eh[e].apply(this,[t])};var th={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!th[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=th.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(new nu(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new nu(t[0],t[1]),new nu(t[2],t[1]),new nu(t[2],t[3]),new nu(t[0],t[3]),new nu(t[0],t[1])])},Point:function(t){var e=new nu(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(th.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=th.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(th.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=th.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=th.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(th.Polygon.apply(this,[r]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(this.read(r))}return this.geometryFactory.createGeometryCollection(e)}},eh={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:eh.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=eh.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(eh.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=eh.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=eh.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=eh.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=eh.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(eh[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},nh=function(t){this.geometryFactory=t||new Zc,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new $c(this.geometryFactory)};nh.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Vc.FIXED&&this.reducePrecision(e),e},nh.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var rh=function(){this.parser=new $c(this.geometryFactory)};rh.prototype.write=function(t){return this.parser.write(t)};var ih=function(){},oh={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};ih.prototype.interfaces_=function(){return[]},ih.prototype.getClass=function(){return ih},ih.opposite=function(t){return t===ih.LEFT?ih.RIGHT:t===ih.RIGHT?ih.LEFT:t},oh.ON.get=function(){return 0},oh.LEFT.get=function(){return 1},oh.RIGHT.get=function(){return 2},Object.defineProperties(ih,oh),(Pi.prototype=new Error).name="EmptyStackException",(Oi.prototype=new ec).add=function(t){return this.array_.push(t),!0},Oi.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},Oi.prototype.push=function(t){return this.array_.push(t),t},Oi.prototype.pop=function(t){if(0===this.array_.length)throw new Pi;return this.array_.pop()},Oi.prototype.peek=function(){if(0===this.array_.length)throw new Pi;return this.array_[this.array_.length-1]},Oi.prototype.empty=function(){return 0===this.array_.length},Oi.prototype.isEmpty=function(){return this.empty()},Oi.prototype.search=function(t){return this.array_.indexOf(t)},Oi.prototype.size=function(){return this.array_.length},Oi.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var sh=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};sh.prototype.getCoordinate=function(){return this._minCoord},sh.prototype.getRightmostSide=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},sh.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();Tu.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=Bu.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===Bu.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===Bu.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},sh.prototype.getRightmostSideOfSegment=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=ih.LEFT;return n[e].y<n[e+1].y&&(r=ih.RIGHT),r},sh.prototype.getEdge=function(){return this._orientedDe},sh.prototype.checkForRightmostCoordinate=function(t){for(var e=t.getEdge().getCoordinates(),n=0;n<e.length-1;n++)(null===this._minCoord||e[n].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},sh.prototype.findRightmostEdgeAtNode=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)},sh.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}Tu.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)===ih.LEFT&&(this._orientedDe=this._minDe.getSym())},sh.prototype.interfaces_=function(){return[]},sh.prototype.getClass=function(){return sh};var ah=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new nu(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(Ou),uh=function(){this.array_=[]};uh.prototype.addLast=function(t){this.array_.push(t)},uh.prototype.removeFirst=function(){return this.array_.shift()},uh.prototype.isEmpty=function(){return 0===this.array_.length};var ch=function(){this._finder=null,this._dirEdgeList=new nc,this._nodes=new nc,this._rightMostCoord=null,this._env=null,this._finder=new sh};ch.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},ch.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ch.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(null===e)throw new ah("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},ch.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ih.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},ch.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ch.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ih.RIGHT)>=1&&e.getDepth(ih.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},ch.prototype.computeDepths=function(t){var e=new lc,n=new uh,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 s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},ch.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},ch.prototype.getEnvelope=function(){if(null===this._env){for(var t=new Iu,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},ch.prototype.addReachable=function(t){var e=new Oi;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},ch.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(ih.LEFT,t.getDepth(ih.RIGHT)),e.setDepth(ih.RIGHT,t.getDepth(ih.LEFT))},ch.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},ch.prototype.getNodes=function(){return this._nodes},ch.prototype.getDirectedEdges=function(){return this._dirEdgeList},ch.prototype.interfaces_=function(){return[$a]},ch.prototype.getClass=function(){return ch};var hh=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[ih.ON]=n}else if(arguments[0]instanceof t){var r=arguments[0];if(this.init(r.location.length),null!==r)for(var i=0;i<this.location.length;i++)this.location[i]=r.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[ih.ON]=o,this.location[ih.LEFT]=s,this.location[ih.RIGHT]=a}};hh.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},hh.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==su.NONE)return!1;return!0},hh.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===su.NONE&&(this.location[e]=t)},hh.prototype.isLine=function(){return 1===this.location.length},hh.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[ih.ON]=this.location[ih.ON],e[ih.LEFT]=su.NONE,e[ih.RIGHT]=su.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===su.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},hh.prototype.getLocations=function(){return this.location},hh.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[ih.LEFT];this.location[ih.LEFT]=this.location[ih.RIGHT],this.location[ih.RIGHT]=t},hh.prototype.toString=function(){var t=new lu;return this.location.length>1&&t.append(su.toLocationSymbol(this.location[ih.LEFT])),t.append(su.toLocationSymbol(this.location[ih.ON])),this.location.length>1&&t.append(su.toLocationSymbol(this.location[ih.RIGHT])),t.toString()},hh.prototype.setLocations=function(t,e,n){this.location[ih.ON]=t,this.location[ih.LEFT]=e,this.location[ih.RIGHT]=n},hh.prototype.get=function(t){return t<this.location.length?this.location[t]:su.NONE},hh.prototype.isArea=function(){return this.location.length>1},hh.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===su.NONE)return!0;return!1},hh.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(ih.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},hh.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(su.NONE)},hh.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},hh.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},hh.prototype.interfaces_=function(){return[]},hh.prototype.getClass=function(){return hh};var lh=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new hh(e),this.elt[1]=new hh(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.elt[0]=new hh(n.elt[0]),this.elt[1]=new hh(n.elt[1])}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.elt[0]=new hh(su.NONE),this.elt[1]=new hh(su.NONE),this.elt[r].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new hh(o,s,a),this.elt[1]=new hh(o,s,a)}else if(4===arguments.length){var u=arguments[0],c=arguments[1],h=arguments[2],l=arguments[3];this.elt[0]=new hh(su.NONE,su.NONE,su.NONE),this.elt[1]=new hh(su.NONE,su.NONE,su.NONE),this.elt[u].setLocations(c,h,l)}};lh.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},lh.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},lh.prototype.isNull=function(t){return this.elt[t].isNull()},lh.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},lh.prototype.isLine=function(t){return this.elt[t].isLine()},lh.prototype.merge=function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new hh(t.elt[e]):this.elt[e].merge(t.elt[e])},lh.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},lh.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(ih.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},lh.prototype.toString=function(){var t=new lu;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},lh.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},lh.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},lh.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(ih.ON,e)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},lh.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},lh.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},lh.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new hh(this.elt[t].location[0]))},lh.prototype.interfaces_=function(){return[]},lh.prototype.getClass=function(){return lh},lh.toLineLabel=function(t){for(var e=new lh(su.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var ph=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new nc,this._pts=new nc,this._label=new lh(su.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new nc,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};ph.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=Bu.isCCW(this._ring.getCoordinates())},ph.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},ph.prototype.computePoints=function(t){this._startDe=t;var e=t,n=!0;do{if(null===e)throw new ah("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new ah("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var r=e.getLabel();Tu.isTrue(r.isArea()),this.mergeLabel(r),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)},ph.prototype.getLinearRing=function(){return this._ring},ph.prototype.getCoordinate=function(t){return this._pts.get(t)},ph.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},ph.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;a>=0;a--)this._pts.add(r[a])}},ph.prototype.isHole=function(){return this._isHole},ph.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},ph.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Bu.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},ph.prototype.addHole=function(t){this._holes.add(t)},ph.prototype.isShell=function(){return null===this._shell},ph.prototype.getLabel=function(){return this._label},ph.prototype.getEdges=function(){return this._edges},ph.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},ph.prototype.getShell=function(){return this._shell},ph.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=e.getLocation(n,ih.RIGHT);if(r===su.NONE)return null;if(this._label.getLocation(n)===su.NONE)return this._label.setLocation(n,r),null}},ph.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},ph.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},ph.prototype.interfaces_=function(){return[]},ph.prototype.getClass=function(){return ph};var fh=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ph),gh=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new nc,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new fh(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ph),dh=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}};dh.prototype.setVisited=function(t){this._isVisited=t},dh.prototype.setInResult=function(t){this._isInResult=t},dh.prototype.isCovered=function(){return this._isCovered},dh.prototype.isCoveredSet=function(){return this._isCoveredSet},dh.prototype.setLabel=function(t){this._label=t},dh.prototype.getLabel=function(){return this._label},dh.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},dh.prototype.updateIM=function(t){Tu.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},dh.prototype.isInResult=function(){return this._isInResult},dh.prototype.isVisited=function(){return this._isVisited},dh.prototype.interfaces_=function(){return[]},dh.prototype.getClass=function(){return dh};var yh=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new lh(0,su.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=su.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==su.BOUNDARY&&(n=r)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new lh(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){if(arguments[0]instanceof e){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof lh)for(var n=arguments[0],r=0;r<2;r++){var i=this.computeMergedLocation(n,r);this._label.getLocation(r)===su.NONE&&this._label.setLocation(r,i)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=su.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case su.BOUNDARY:n=su.INTERIOR;break;case su.INTERIOR:default:n=su.BOUNDARY}this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dh),_h=function(){this.nodeMap=new Ci,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};_h.prototype.find=function(t){return this.nodeMap.get(t)},_h.prototype.addNode=function(){if(arguments[0]instanceof nu){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 yh){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},_h.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},_h.prototype.iterator=function(){return this.nodeMap.values().iterator()},_h.prototype.values=function(){return this.nodeMap.values()},_h.prototype.getBoundaryNodes=function(t){for(var e=new nc,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===su.BOUNDARY&&e.add(r)}return e},_h.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},_h.prototype.interfaces_=function(){return[]},_h.prototype.getClass=function(){return _h};var mh=function(){},vh={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};mh.prototype.interfaces_=function(){return[]},mh.prototype.getClass=function(){return mh},mh.isNorthern=function(t){return t===mh.NE||t===mh.NW},mh.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},mh.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n},mh.isInHalfPlane=function(t,e){return e===mh.SE?t===mh.SE||t===mh.SW:t===e||t===e+1},mh.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new Za("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?mh.NE:mh.SE:e>=0?mh.NW:mh.SW}if(arguments[0]instanceof nu&&arguments[1]instanceof nu){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new Za("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?mh.NE:mh.SE:r.y>=n.y?mh.NW:mh.SW}},vh.NE.get=function(){return 0},vh.NW.get=function(){return 1},vh.SW.get=function(){return 2},vh.SE.get=function(){return 3},Object.defineProperties(mh,vh);var xh=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._edge=e,this.init(n,r),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};xh.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:Bu.computeOrientation(t._p0,t._p1,this._p1)},xh.prototype.getDy=function(){return this._dy},xh.prototype.getCoordinate=function(){return this._p0},xh.prototype.setNode=function(t){this._node=t},xh.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},xh.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},xh.prototype.getDirectedCoordinate=function(){return this._p1},xh.prototype.getDx=function(){return this._dx},xh.prototype.getLabel=function(){return this._label},xh.prototype.getEdge=function(){return this._edge},xh.prototype.getQuadrant=function(){return this._quadrant},xh.prototype.getNode=function(){return this._node},xh.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},xh.prototype.computeLabel=function(t){},xh.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=mh.quadrant(this._dx,this._dy),Tu.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},xh.prototype.interfaces_=function(){return[$a]},xh.prototype.getClass=function(){return xh};var Eh=function(t){function e(){var e=arguments[0],n=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate(r),e.getCoordinate(r-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new lh(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new ah("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,ih.LEFT)===su.INTERIOR&&this._label.getLocation(e,ih.RIGHT)===su.INTERIOR||(t=!1);return t},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[ih.LEFT]+"/"+this._depth[ih.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,su.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,su.EXTERIOR);return t&&e&&n},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===ih.LEFT&&(r=-1);var i=ih.opposite(t),o=e+n*r;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===su.EXTERIOR&&e===su.INTERIOR?1:t===su.INTERIOR&&e===su.EXTERIOR?-1:0},e}(xh),wh=function(){};wh.prototype.createNode=function(t){return new yh(t,null)},wh.prototype.interfaces_=function(){return[]},wh.prototype.getClass=function(){return wh};var bh=function(){if(this._edges=new nc,this._nodes=null,this._edgeEndList=new nc,0===arguments.length)this._nodes=new _h(new wh);else if(1===arguments.length){var t=arguments[0];this._nodes=new _h(t)}};bh.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},bh.prototype.find=function(t){return this._nodes.find(t)},bh.prototype.addNode=function(){if(arguments[0]instanceof yh){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof nu){var e=arguments[0];return this._nodes.addNode(e)}},bh.prototype.getNodeIterator=function(){return this._nodes.iterator()},bh.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},bh.prototype.debugPrintln=function(t){wu.out.println(t)},bh.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var r=n.getLabel();return null!==r&&r.getLocation(t)===su.BOUNDARY},bh.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},bh.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&Bu.computeOrientation(t,e,r)===Bu.COLLINEAR&&mh.quadrant(t,e)===mh.quadrant(n,r)},bh.prototype.getEdgeEnds=function(){return this._edgeEndList},bh.prototype.debugPrint=function(t){wu.out.print(t)},bh.prototype.getEdgeIterator=function(){return this._edges.iterator()},bh.prototype.findEdgeInSameDirection=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(this.matchInSameDirection(t,e,i[0],i[1]))return r;if(this.matchInSameDirection(t,e,i[i.length-1],i[i.length-2]))return r}return null},bh.prototype.insertEdge=function(t){this._edges.add(t)},bh.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},bh.prototype.addEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var r=new Eh(n,!0),i=new Eh(n,!1);r.setSym(i),i.setSym(r),this.add(r),this.add(i)}},bh.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},bh.prototype.getNodes=function(){return this._nodes.values()},bh.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return r}return null},bh.prototype.interfaces_=function(){return[]},bh.prototype.getClass=function(){return bh},bh.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var Ih=function(){this._geometryFactory=null,this._shellList=new nc;var t=arguments[0];this._geometryFactory=t};Ih.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},Ih.prototype.computePolygons=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},Ih.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(null===r.getShell()){var i=this.findEdgeRingContaining(r,t);if(null===i)throw new ah("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},Ih.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new nc,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},Ih.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},Ih.prototype.buildMaximalEdgeRings=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new gh(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},Ih.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},Ih.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ih.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),c=u.getLinearRing(),h=c.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var l=!1;h.contains(r)&&Bu.isPointInRing(i,c.getCoordinates())&&(l=!0),l&&(null===o||s.contains(h))&&(o=u)}return o},Ih.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return Tu.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},Ih.prototype.add=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];bh.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new nc,o=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},Ih.prototype.interfaces_=function(){return[]},Ih.prototype.getClass=function(){return Ih};var Nh=function(){};Nh.prototype.getBounds=function(){},Nh.prototype.interfaces_=function(){return[]},Nh.prototype.getClass=function(){return Nh};var Ch=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ch.prototype.getItem=function(){return this._item},Ch.prototype.getBounds=function(){return this._bounds},Ch.prototype.interfaces_=function(){return[Nh,_i]},Ch.prototype.getClass=function(){return Ch};var Sh=function(){this._size=null,this._items=null,this._size=0,this._items=new nc,this._items.add(null)};Sh.prototype.poll=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},Sh.prototype.size=function(){return this._size},Sh.prototype.reorder=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)},Sh.prototype.clear=function(){this._size=0,this._items.clear()},Sh.prototype.isEmpty=function(){return 0===this._size},Sh.prototype.add=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)},Sh.prototype.interfaces_=function(){return[]},Sh.prototype.getClass=function(){return Sh};var Mh=function(){};Mh.prototype.visitItem=function(t){},Mh.prototype.interfaces_=function(){return[]},Mh.prototype.getClass=function(){return Mh};var Lh=function(){};Lh.prototype.insert=function(t,e){},Lh.prototype.remove=function(t,e){},Lh.prototype.query=function(){},Lh.prototype.interfaces_=function(){return[]},Lh.prototype.getClass=function(){return Lh};var Ph=function(){if(this._childBoundables=new nc,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Oh={serialVersionUID:{configurable:!0}};Ph.prototype.getLevel=function(){return this._level},Ph.prototype.size=function(){return this._childBoundables.size()},Ph.prototype.getChildBoundables=function(){return this._childBoundables},Ph.prototype.addChildBoundable=function(t){Tu.isTrue(null===this._bounds),this._childBoundables.add(t)},Ph.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ph.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Ph.prototype.interfaces_=function(){return[Nh,_i]},Ph.prototype.getClass=function(){return Ph},Oh.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Ph,Oh);var Rh=function(){};Rh.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Rh.min=function(t){return Rh.sort(t),t.get(0)},Rh.sort=function(t,e){var n=t.toArray();e?yc.sort(n,e):yc.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},Rh.singletonList=function(t){var e=new nc;return e.add(t),e};var Th=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};Th.prototype.expandToQueue=function(t,e){var n=Th.isComposite(this._boundable1),r=Th.isComposite(this._boundable2);if(n&&r)return Th.area(this._boundable1)>Th.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Za("neither boundable is composite")},Th.prototype.isLeaves=function(){return!(Th.isComposite(this._boundable1)||Th.isComposite(this._boundable2))},Th.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Th.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new Th(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},Th.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},Th.prototype.getDistance=function(){return this._distance},Th.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Th.prototype.interfaces_=function(){return[$a]},Th.prototype.getClass=function(){return Th},Th.area=function(t){return t.getBounds().getArea()},Th.isComposite=function(t){return t instanceof Ph};var Ah=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new nc,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments[0];Tu.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Dh={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ah.prototype.getNodeCapacity=function(){return this._nodeCapacity},Ah.prototype.lastNode=function(t){return t.get(t.size()-1)},Ah.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof Ph?t+=this.size(n):n instanceof Ch&&(t+=1)}return t}},Ah.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ch&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},Ah.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new nc:t}if(1===arguments.length){for(var e=arguments[0],n=new nc,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof Ph){var o=this.itemsTree(i);null!==o&&n.add(o)}else i instanceof Ch?n.add(i.getItem()):Tu.shouldNeverReachHere()}return n.size()<=0?null:n}},Ah.prototype.insert=function(t,e){Tu.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ch(t,e))},Ah.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new nc;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];if(Tu.isTrue(n>-2),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Ph?this.boundablesAtLevel(n,s,i):(Tu.isTrue(s instanceof Ch),-1===n&&i.add(s))}return null}},Ah.prototype.query=function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new nc;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(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.query(n,this._root,r)}else if(3===arguments.length)if(uu(arguments[2],Mh)&&arguments[0]instanceof Object&&arguments[1]instanceof Ph)for(var i=arguments[0],o=arguments[1],s=arguments[2],a=o.getChildBoundables(),u=0;u<a.size();u++){var c=a.get(u);this.getIntersectsOp().intersects(c.getBounds(),i)&&(c instanceof Ph?this.query(i,c,s):c instanceof Ch?s.visitItem(c.getItem()):Tu.shouldNeverReachHere())}else if(uu(arguments[2],ec)&&arguments[0]instanceof Object&&arguments[1]instanceof Ph)for(var h=arguments[0],l=arguments[1],p=arguments[2],f=l.getChildBoundables(),g=0;g<f.size();g++){var d=f.get(g);this.getIntersectsOp().intersects(d.getBounds(),h)&&(d instanceof Ph?this.query(h,d,p):d instanceof Ch?p.add(d.getItem()):Tu.shouldNeverReachHere())}},Ah.prototype.build=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},Ah.prototype.getRoot=function(){return this.build(),this._root},Ah.prototype.remove=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 s=null,a=r.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&u instanceof Ph&&(o=this.remove(n,u,i))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},Ah.prototype.createHigherLevels=function(t,e){Tu.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},Ah.prototype.depth=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 Ph){var r=this.depth(n);r>t&&(t=r)}}return t+1}},Ah.prototype.createParentBoundables=function(t,e){Tu.isTrue(!t.isEmpty());var n=new nc;n.add(this.createNode(e));var r=new nc(t);Rh.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},Ah.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Ah.prototype.interfaces_=function(){return[_i]},Ah.prototype.getClass=function(){return Ah},Ah.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Dh.IntersectsOp.get=function(){return Fh},Dh.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},Dh.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Ah,Dh);var Fh=function(){},qh=function(){};qh.prototype.distance=function(t,e){},qh.prototype.interfaces_=function(){return[]},qh.prototype.getClass=function(){return qh};var Gh=function(t){function e(n){n=n||e.DEFAULT_NODE_CAPACITY,t.call(this,n)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){Tu.isTrue(t.length>0);for(var n=new nc,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},e.prototype.createNode=function(t){return new Bh(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],n=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,n)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),r=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){r[o]=new nc;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var n=arguments[0],r=arguments[1];t.prototype.query.call(this,n,r)}else if(3===arguments.length)if(uu(arguments[2],Mh)&&arguments[0]instanceof Object&&arguments[1]instanceof Ph){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(uu(arguments[2],ec)&&arguments[0]instanceof Object&&arguments[1]instanceof Ph){var a=arguments[0],u=arguments[1],c=arguments[2];t.prototype.query.call(this,a,u,c)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,n){return t.prototype.createParentBoundables.call(this,e,n)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return t.prototype.remove.call(this,e,n)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,n){Tu.isTrue(!t.isEmpty());var r=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new nc(t);Rh.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(r))));return this.createParentBoundablesFromVerticalSlices(o,n)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(uu(arguments[0],qh)){var t=arguments[0],n=new Th(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(n)}if(arguments[0]instanceof Th){var r=arguments[0];return this.nearestNeighbour(r,Ka.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&uu(arguments[1],qh)){var i=arguments[0],o=arguments[1],s=new Th(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof Th&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],c=null,h=new Sh;for(h.add(a);!h.isEmpty()&&u>0;){var l=h.poll(),p=l.getDistance();if(p>=u)break;l.isLeaves()?(u=p,c=l):l.expandToQueue(h,u)}return[c.getBoundable(0).getItem(),c.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[0],g=arguments[1],d=arguments[2],y=new Ch(f,g),_=new Th(this.getRoot(),y,d);return this.nearestNeighbour(_)[0]}},e.prototype.interfaces_=function(){return[Lh,_i]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},n.STRtreeNode.get=function(){return Bh},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[eu]},compare:function(n,r){return t.compareDoubles(e.centreX(n.getBounds()),e.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[eu]},compare:function(n,r){return t.compareDoubles(e.centreY(n.getBounds()),e.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Ah),Bh=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new Iu(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ph),kh=function(){};kh.prototype.interfaces_=function(){return[]},kh.prototype.getClass=function(){return kh},kh.relativeSign=function(t,e){return t<e?-1:t>e?1:0},kh.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=kh.relativeSign(e.x,n.x),i=kh.relativeSign(e.y,n.y);switch(t){case 0:return kh.compareValue(r,i);case 1:return kh.compareValue(i,r);case 2:return kh.compareValue(i,-r);case 3:return kh.compareValue(-r,i);case 4:return kh.compareValue(-r,-i);case 5:return kh.compareValue(-i,-r);case 6:return kh.compareValue(-i,r);case 7:return kh.compareValue(r,-i)}return Tu.shouldNeverReachHere("invalid octant value"),0},kh.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var zh=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 nu(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};zh.prototype.getCoordinate=function(){return this.coord},zh.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},zh.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:kh.compare(this._segmentOctant,this.coord,e.coord)},zh.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},zh.prototype.isInterior=function(){return this._isInterior},zh.prototype.interfaces_=function(){return[$a]},zh.prototype.getClass=function(){return zh};var jh=function(){this._nodeMap=new Ci,this._edge=null;var t=arguments[0];this._edge=t};jh.prototype.getSplitCoordinates=function(){var t=new ic;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()},jh.prototype.addCollapsedNodes=function(){var t=new nc;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)}},jh.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},jh.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new pu(e+1))}},jh.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new nu(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new nu(e.coord))},jh.prototype.iterator=function(){return this._nodeMap.values().iterator()},jh.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},jh.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,1===r&&(n[0]=t.segmentIndex+1,!0)},jh.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();this.findCollapseIndex(r,i,e)&&t.add(new pu(e[0])),r=i}},jh.prototype.getEdge=function(){return this._edge},jh.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},jh.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new nu(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new nu(e.coord)),new Vh(o,this._edge.getData())},jh.prototype.add=function(t,e){var n=new zh(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(Tu.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},jh.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new Ou("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new Ou("bad split edge end point at "+i)},jh.prototype.interfaces_=function(){return[]},jh.prototype.getClass=function(){return jh};var Xh=function(){};Xh.prototype.interfaces_=function(){return[]},Xh.prototype.getClass=function(){return Xh},Xh.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new Za("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof nu&&arguments[1]instanceof nu){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new Za("Cannot compute the octant for two identical points "+i);return Xh.octant(s,a)}};var Uh=function(){};Uh.prototype.getCoordinates=function(){},Uh.prototype.size=function(){},Uh.prototype.getCoordinate=function(t){},Uh.prototype.isClosed=function(){},Uh.prototype.setData=function(t){},Uh.prototype.getData=function(){},Uh.prototype.interfaces_=function(){return[]},Uh.prototype.getClass=function(){return Uh};var Yh=function(){};Yh.prototype.addIntersection=function(t,e){},Yh.prototype.interfaces_=function(){return[Uh]},Yh.prototype.getClass=function(){return Yh};var Vh=function(){this._nodeList=new jh(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Vh.prototype.getCoordinates=function(){return this._pts},Vh.prototype.size=function(){return this._pts.length},Vh.prototype.getCoordinate=function(t){return this._pts[t]},Vh.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Vh.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Vh.prototype.setData=function(t){this._data=t},Vh.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Xh.octant(t,e)},Vh.prototype.getData=function(){return this._data},Vh.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[3],o=new nu(n.getIntersection(i));this.addIntersection(o,r)}},Vh.prototype.toString=function(){return Pu.toLineString(new zc(this._pts))},Vh.prototype.getNodeList=function(){return this._nodeList},Vh.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts[r];t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},Vh.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},Vh.prototype.interfaces_=function(){return[Yh]},Vh.prototype.getClass=function(){return Vh},Vh.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new nc;return Vh.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[0],r=arguments[1],i=n.iterator();i.hasNext();)i.next().getNodeList().addSplitEdges(r)};var Hh=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new nu,this.p1=new nu;else if(1===arguments.length){var t=arguments[0];this.p0=new nu(t.p0),this.p1=new nu(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this.p0=new nu(e,n),this.p1=new nu(r,i)}},Wh={serialVersionUID:{configurable:!0}};Hh.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Hh.prototype.orientationIndex=function(){if(arguments[0]instanceof Hh){var t=arguments[0],e=Bu.orientationIndex(this.p0,this.p1,t.p0),n=Bu.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof nu){var r=arguments[0];return Bu.orientationIndex(this.p0,this.p1,r)}},Hh.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Hh.prototype.isVertical=function(){return this.p0.x===this.p1.x},Hh.prototype.equals=function(t){if(!(t instanceof Hh))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Hh.prototype.intersection=function(t){var e=new Fu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Hh.prototype.project=function(){if(arguments[0]instanceof nu){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new nu(t);var e=this.projectionFactor(t),n=new nu;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof Hh){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new Hh(s,a)}},Hh.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Hh.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Hh.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Hh.prototype.distancePerpendicular=function(t){return Bu.distancePointLinePerpendicular(t,this.p0,this.p1)},Hh.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Hh.prototype.midPoint=function(){return Hh.midPoint(this.p0,this.p1)},Hh.prototype.projectionFactor=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?Ka.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},Hh.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=Ka.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=u),n},Hh.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},Hh.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Hh.prototype.getLength=function(){return this.p0.distance(this.p1)},Hh.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},Hh.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Hh.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},Hh.prototype.lineIntersection=function(t){try{return bu.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof Eu))throw t}return null},Hh.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Hh.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new nu(n-u,r+a)},Hh.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},Hh.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Ka.isNaN(e))&&(e=1),e},Hh.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Hh.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Hh.prototype.distance=function(){if(arguments[0]instanceof Hh){var t=arguments[0];return Bu.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof nu){var e=arguments[0];return Bu.distancePointLine(e,this.p0,this.p1)}},Hh.prototype.pointAlong=function(t){var e=new nu;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},Hh.prototype.hashCode=function(){var t=Ka.doubleToLongBits(this.p0.x);t^=31*Ka.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=Ka.doubleToLongBits(this.p1.x);return n^=31*Ka.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},Hh.prototype.interfaces_=function(){return[$a,_i]},Hh.prototype.getClass=function(){return Hh},Hh.midPoint=function(t,e){return new nu((t.x+e.x)/2,(t.y+e.y)/2)},Wh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Hh,Wh);var Jh=function(){this.tempEnv1=new Iu,this.tempEnv2=new Iu,this._overlapSeg1=new Hh,this._overlapSeg2=new Hh};Jh.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},Jh.prototype.interfaces_=function(){return[]},Jh.prototype.getClass=function(){return Jh};var Zh=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};Zh.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Zh.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},Zh.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},Zh.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Zh.prototype.setId=function(t){this._id=t},Zh.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Zh.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new Iu(t,e)}return this._env},Zh.prototype.getEndIndex=function(){return this._end},Zh.prototype.getStartIndex=function(){return this._start},Zh.prototype.getContext=function(){return this._context},Zh.prototype.getId=function(){return this._id},Zh.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],c=n._pts[i];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,c),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),l=Math.trunc((r+i)/2);t<h&&(r<l&&this.computeOverlapsInternal(t,h,n,r,l,o),l<i&&this.computeOverlapsInternal(t,h,n,l,i,o)),h<e&&(r<l&&this.computeOverlapsInternal(h,e,n,r,l,o),l<i&&this.computeOverlapsInternal(h,e,n,l,i,o))},Zh.prototype.interfaces_=function(){return[]},Zh.prototype.getClass=function(){return Zh};var Kh=function(){};Kh.prototype.interfaces_=function(){return[]},Kh.prototype.getClass=function(){return Kh},Kh.getChainStartIndices=function(t){var e=0,n=new nc;n.add(new pu(e));do{var r=Kh.findChainEnd(t,e);n.add(new pu(r)),e=r}while(e<t.length-1);return Kh.toIntArray(n)},Kh.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var r=mh.quadrant(t[n],t[n+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||mh.quadrant(t[i-1],t[i])===r);)i++;return i-1},Kh.getChains=function(){if(1===arguments.length){var t=arguments[0];return Kh.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],r=new nc,i=Kh.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new Zh(e,i[o],i[o+1],n);r.add(s)}return r}},Kh.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Qh=function(){};Qh.prototype.computeNodes=function(t){},Qh.prototype.getNodedSubstrings=function(){},Qh.prototype.interfaces_=function(){return[]},Qh.prototype.getClass=function(){return Qh};var $h=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};$h.prototype.setSegmentIntersector=function(t){this._segInt=t},$h.prototype.interfaces_=function(){return[Qh]},$h.prototype.getClass=function(){return $h};var tl=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new nc,this._index=new Gh,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return Vh.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=Kh.getChains(t.getCoordinates(),t).iterator();e.hasNext();){var n=e.next();n.setId(this._idCounter++),this._index.insert(n.getEnvelope(),n),this._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=new el(this._segInt),e=this._monoChains.iterator();e.hasNext();)for(var n=e.next(),r=this._index.query(n.getEnvelope()).iterator();r.hasNext();){var i=r.next();if(i.getId()>n.getId()&&(n.computeOverlaps(i,t),this._nOverlaps++),this._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return el},Object.defineProperties(e,n),e}($h),el=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3],o=e.getContext(),s=r.getContext();this._si.processIntersections(o,n,s,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Jh),nl=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}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],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},rl={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};nl.prototype.getEndCapStyle=function(){return this._endCapStyle},nl.prototype.isSingleSided=function(){return this._isSingleSided},nl.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=nl.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=nl.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==nl.JOIN_ROUND&&(this._quadrantSegments=nl.DEFAULT_QUADRANT_SEGMENTS)},nl.prototype.getJoinStyle=function(){return this._joinStyle},nl.prototype.setJoinStyle=function(t){this._joinStyle=t},nl.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},nl.prototype.getSimplifyFactor=function(){return this._simplifyFactor},nl.prototype.getQuadrantSegments=function(){return this._quadrantSegments},nl.prototype.setEndCapStyle=function(t){this._endCapStyle=t},nl.prototype.getMitreLimit=function(){return this._mitreLimit},nl.prototype.setMitreLimit=function(t){this._mitreLimit=t},nl.prototype.setSingleSided=function(t){this._isSingleSided=t},nl.prototype.interfaces_=function(){return[]},nl.prototype.getClass=function(){return nl},nl.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},rl.CAP_ROUND.get=function(){return 1},rl.CAP_FLAT.get=function(){return 2},rl.CAP_SQUARE.get=function(){return 3},rl.JOIN_ROUND.get=function(){return 1},rl.JOIN_MITRE.get=function(){return 2},rl.JOIN_BEVEL.get=function(){return 3},rl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},rl.DEFAULT_MITRE_LIMIT.get=function(){return 5},rl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(nl,rl);var il=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Bu.COUNTERCLOCKWISE,this._inputLine=t||null},ol={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};il.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r)},il.prototype.deleteShallowConcavities=function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),r=!1;n<this._inputLine.length;){var i=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=il.DELETE,i=!0,r=!0),t=i?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return r},il.prototype.isShallowConcavity=function(t,e,n,r){return Bu.computeOrientation(t,e,n)===this._angleOrientation&&Bu.distancePointLine(e,t,n)<r},il.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/il.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<r;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},il.prototype.isConcave=function(t,e,n){return Bu.computeOrientation(t,e,n)===this._angleOrientation},il.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=Bu.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},il.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===il.DELETE;)e++;return e},il.prototype.isShallow=function(t,e,n,r){return Bu.distancePointLine(e,t,n)<r},il.prototype.collapseLine=function(){for(var t=new ic,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==il.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},il.prototype.interfaces_=function(){return[]},il.prototype.getClass=function(){return il},il.simplify=function(t,e){return new il(t).simplify(e)},ol.INIT.get=function(){return 0},ol.DELETE.get=function(){return 1},ol.KEEP.get=function(){return 1},ol.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(il,ol);var sl=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new nc},al={COORDINATE_ARRAY_TYPE:{configurable:!0}};sl.prototype.getCoordinates=function(){return this._ptList.toArray(sl.COORDINATE_ARRAY_TYPE)},sl.prototype.setPrecisionModel=function(t){this._precisionModel=t},sl.prototype.addPt=function(t){var e=new nu(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},sl.prototype.revere=function(){},sl.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;r>=0;r--)this.addPt(t[r])},sl.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},sl.prototype.toString=function(){return(new Zc).createLineString(this.getCoordinates()).toString()},sl.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new nu(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},sl.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},sl.prototype.interfaces_=function(){return[]},sl.prototype.getClass=function(){return sl},al.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(sl,al);var ul=function(){},cl={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ul.prototype.interfaces_=function(){return[]},ul.prototype.getClass=function(){return ul},ul.toDegrees=function(t){return 180*t/Math.PI},ul.normalize=function(t){for(;t>Math.PI;)t-=ul.PI_TIMES_2;for(;t<=-Math.PI;)t+=ul.PI_TIMES_2;return t},ul.angle=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)}},ul.isAcute=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},ul.isObtuse=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},ul.interiorAngle=function(t,e,n){var r=ul.angle(e,t),i=ul.angle(e,n);return Math.abs(i-r)},ul.normalizePositive=function(t){if(t<0){for(;t<0;)t+=ul.PI_TIMES_2;t>=ul.PI_TIMES_2&&(t=0)}else{for(;t>=ul.PI_TIMES_2;)t-=ul.PI_TIMES_2;t<0&&(t=0)}return t},ul.angleBetween=function(t,e,n){var r=ul.angle(e,t),i=ul.angle(e,n);return ul.diff(r,i)},ul.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},ul.toRadians=function(t){return t*Math.PI/180},ul.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?ul.COUNTERCLOCKWISE:n<0?ul.CLOCKWISE:ul.NONE},ul.angleBetweenOriented=function(t,e,n){var r=ul.angle(e,t),i=ul.angle(e,n)-r;return i<=-Math.PI?i+ul.PI_TIMES_2:i>Math.PI?i-ul.PI_TIMES_2:i},cl.PI_TIMES_2.get=function(){return 2*Math.PI},cl.PI_OVER_2.get=function(){return Math.PI/2},cl.PI_OVER_4.get=function(){return Math.PI/4},cl.COUNTERCLOCKWISE.get=function(){return Bu.COUNTERCLOCKWISE},cl.CLOCKWISE.get=function(){return Bu.CLOCKWISE},cl.NONE.get=function(){return Bu.COLLINEAR},Object.defineProperties(ul,cl);var hl=function t(){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 Hh,this._seg1=new Hh,this._offset0=new Hh,this._offset1=new Hh,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new Fu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===nl.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},ll={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};hl.prototype.addNextSegment=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=Bu.computeOrientation(this._s0,this._s1,this._s2),r=n===Bu.CLOCKWISE&&this._side===ih.LEFT||n===Bu.COUNTERCLOCKWISE&&this._side===ih.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},hl.prototype.addLineEndCap=function(t,e){var n=new Hh(t,e),r=new Hh;this.computeOffsetSegment(n,ih.LEFT,this._distance,r);var i=new Hh;this.computeOffsetSegment(n,ih.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case nl.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,Bu.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case nl.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case nl.CAP_SQUARE:var u=new nu;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var c=new nu(r.p1.x+u.x,r.p1.y+u.y),h=new nu(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(c),this._segList.addPt(h)}},hl.prototype.getCoordinates=function(){return this._segList.getCoordinates()},hl.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=bu.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof Eu))throw t;o=new nu(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},hl.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,c=n.y-t.y,h=Math.atan2(c,u);r===Bu.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,r,i),this._segList.addPt(n)},hl.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*hl.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===nl.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===nl.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},hl.prototype.createSquare=function(t){this._segList.addPt(new nu(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new nu(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new nu(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new nu(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},hl.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},hl.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},hl.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},hl.prototype.initSideSegments=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)},hl.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=ul.angle(i,this._seg0.p0),s=ul.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=ul.normalize(o+s),u=ul.normalize(a+Math.PI),c=r*n,h=n-c*Math.abs(Math.sin(s)),l=i.x+c*Math.cos(u),p=i.y+c*Math.sin(u),f=new nu(l,p),g=new Hh(i,f),d=g.pointAlongOffset(1,h),y=g.pointAlongOffset(1,-h);this._side===ih.LEFT?(this._segList.addPt(d),this._segList.addPt(y)):(this._segList.addPt(y),this._segList.addPt(d))},hl.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===ih.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*n*o/a,c=i*n*s/a;r.p0.x=t.p0.x-c,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-c,r.p1.y=t.p1.y+u},hl.prototype.addFilletArc=function(t,e,n,r,i){var o=r===Bu.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,c=0,h=new nu;c<s;){var l=e+o*c;h.x=t.x+i*Math.cos(l),h.y=t.y+i*Math.sin(l),this._segList.addPt(h),c+=u}},hl.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*hl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new nu((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new nu((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},hl.prototype.createCircle=function(t){var e=new nu(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},hl.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},hl.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new sl,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*hl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},hl.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===nl.JOIN_BEVEL||this._bufParams.getJoinStyle()===nl.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Bu.CLOCKWISE,this._distance))},hl.prototype.closeRing=function(){this._segList.closeRing()},hl.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},hl.prototype.interfaces_=function(){return[]},hl.prototype.getClass=function(){return hl},ll.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},ll.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},ll.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},ll.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(hl,ll);var pl=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};pl.prototype.getOffsetCurve=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&&oc.reverse(o),o},pl.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=il.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],ih.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=il.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],ih.LEFT),n.addFirstSegment();for(var c=2;c<=u;c++)n.addNextSegment(a[c],!0)}n.addLastSegment(),n.closeRing()},pl.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===ih.RIGHT&&(r=-r);var i=il.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},pl.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=il.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],ih.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=il.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],ih.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},pl.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case nl.CAP_ROUND:e.createCircle(t);break;case nl.CAP_SQUARE:e.createSquare(t)}},pl.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===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()},pl.prototype.getBufferParameters=function(){return this._bufParams},pl.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},pl.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return pl.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},pl.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=il.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],ih.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=il.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],ih.LEFT),n.addFirstSegment();for(var c=2;c<=u;c++)n.addNextSegment(a[c],!0)}n.addLastSegment()},pl.prototype.getSegGen=function(t){return new hl(this._precisionModel,this._bufParams,t)},pl.prototype.interfaces_=function(){return[]},pl.prototype.getClass=function(){return pl},pl.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new nu(t[n]);return e};var fl=function(){this._subgraphs=null,this._seg=new Hh,this._cga=new Bu;var t=arguments[0];this._subgraphs=t},gl={DepthSegment:{configurable:!0}};fl.prototype.findStabbedSegments=function(){if(1===arguments.length){for(var t=arguments[0],e=new nc,n=this._subgraphs.iterator();n.hasNext();){var r=n.next(),i=r.getEnvelope();t.y<i.getMinY()||t.y>i.getMaxY()||this.findStabbedSegments(t,r.getDirectedEdges(),e)}return e}if(3===arguments.length)if(uu(arguments[2],ec)&&arguments[0]instanceof nu&&arguments[1]instanceof Eh){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=s.getEdge().getCoordinates(),c=0;c<u.length-1;c++)if(this._seg.p0=u[c],this._seg.p1=u[c+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<o.x||this._seg.isHorizontal()||o.y<this._seg.p0.y||o.y>this._seg.p1.y||Bu.computeOrientation(this._seg.p0,this._seg.p1,o)===Bu.RIGHT)){var h=s.getDepth(ih.LEFT);this._seg.p0.equals(u[c])||(h=s.getDepth(ih.RIGHT));var l=new dl(this._seg,h);a.add(l)}}else if(uu(arguments[2],ec)&&arguments[0]instanceof nu&&uu(arguments[1],ec))for(var p=arguments[0],f=arguments[1],g=arguments[2],d=f.iterator();d.hasNext();){var y=d.next();y.isForward()&&this.findStabbedSegments(p,y,g)}},fl.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Rh.min(e)._leftDepth},fl.prototype.interfaces_=function(){return[]},fl.prototype.getClass=function(){return fl},gl.DepthSegment.get=function(){return dl},Object.defineProperties(fl,gl);var dl=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Hh(t),this._leftDepth=e};dl.prototype.compareTo=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)},dl.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},dl.prototype.toString=function(){return this._upwardSeg.toString()},dl.prototype.interfaces_=function(){return[$a]},dl.prototype.getClass=function(){return dl};var yl=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};yl.prototype.area=function(){return yl.area(this.p0,this.p1,this.p2)},yl.prototype.signedArea=function(){return yl.signedArea(this.p0,this.p1,this.p2)},yl.prototype.interpolateZ=function(t){if(null===t)throw new Za("Supplied point is null.");return yl.interpolateZ(t,this.p0,this.p1,this.p2)},yl.prototype.longestSideLength=function(){return yl.longestSideLength(this.p0,this.p1,this.p2)},yl.prototype.isAcute=function(){return yl.isAcute(this.p0,this.p1,this.p2)},yl.prototype.circumcentre=function(){return yl.circumcentre(this.p0,this.p1,this.p2)},yl.prototype.area3D=function(){return yl.area3D(this.p0,this.p1,this.p2)},yl.prototype.centroid=function(){return yl.centroid(this.p0,this.p1,this.p2)},yl.prototype.inCentre=function(){return yl.inCentre(this.p0,this.p1,this.p2)},yl.prototype.interfaces_=function(){return[]},yl.prototype.getClass=function(){return yl},yl.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},yl.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},yl.det=function(t,e,n,r){return t*r-e*n},yl.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,u=n.y-o,c=r.y-o,h=s*c-a*u,l=t.x-i,p=t.y-o,f=(c*l-a*p)/h,g=(-u*l+s*p)/h;return e.z+f*(n.z-e.z)+g*(r.z-e.z)},yl.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},yl.isAcute=function(t,e,n){return!!ul.isAcute(t,e,n)&&!!ul.isAcute(e,n,t)&&!!ul.isAcute(n,t,e)},yl.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,c=2*yl.det(o,s,a,u),h=yl.det(s,o*o+s*s,u,a*a+u*u),l=yl.det(o,o*o+s*s,a,a*a+u*u);return new nu(r-h/c,i+l/c)},yl.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new bu(t.x+n/2,t.y+r/2,1),o=new bu(t.x-r+n/2,t.y+n+r/2,1);return new bu(i,o)},yl.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new nu(t.x+i*o,t.y+i*s)},yl.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,c=i*u-o*a,h=o*s-r*u,l=r*a-i*s,p=c*c+h*h+l*l;return Math.sqrt(p)/2},yl.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new nu(r,i)},yl.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new nu(a,u)};var _l=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new nc;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};_l.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,su.EXTERIOR,su.INTERIOR)},_l.prototype.addPolygon=function(t){var e=this._distance,n=ih.LEFT;this._distance<0&&(e=-this._distance,n=ih.RIGHT);var r=t.getExteriorRing(),i=oc.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance))return null;if(this._distance<=0&&i.length<3)return null;this.addPolygonRing(i,e,n,su.EXTERIOR,su.INTERIOR);for(var o=0;o<t.getNumInteriorRing();o++){var s=t.getInteriorRingN(o),a=oc.removeRepeatedPoints(s.getCoordinates());this._distance>0&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,ih.opposite(n),su.INTERIOR,su.EXTERIOR)}},_l.prototype.isTriangleErodedCompletely=function(t,e){var n=new yl(t[0],t[1],t[2]),r=n.inCentre();return Bu.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},_l.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=oc.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,su.EXTERIOR,su.INTERIOR)},_l.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new Vh(t,new lh(0,su.BOUNDARY,e,n));this._curveList.add(r)},_l.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},_l.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<Ac.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=Ac.MINIMUM_VALID_SIZE&&Bu.isCCW(t)&&(o=i,s=r,n=ih.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},_l.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Rc?this.addPolygon(t):t instanceof Mc?this.addLineString(t):t instanceof Pc?this.addPoint(t):(t instanceof Tc||t instanceof wc||t instanceof Dc||t instanceof Ec)&&this.addCollection(t)},_l.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},_l.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},_l.prototype.interfaces_=function(){return[]},_l.prototype.getClass=function(){return _l};var ml=function(){};ml.prototype.locate=function(t){},ml.prototype.interfaces_=function(){return[]},ml.prototype.getClass=function(){return ml};var vl=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()};vl.prototype.next=function(){if(this._atStart)return this._atStart=!1,vl.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new mi;var t=this._parent.getGeometryN(this._index++);return t instanceof Ec?(this._subcollectionIterator=new vl(t),this._subcollectionIterator.next()):t},vl.prototype.remove=function(){throw new Error(this.getClass().getName())},vl.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},vl.prototype.interfaces_=function(){return[tc]},vl.prototype.getClass=function(){return vl},vl.isAtomic=function(t){return!(t instanceof Ec)};var xl=function(){this._geom=null;var t=arguments[0];this._geom=t};xl.prototype.locate=function(t){return xl.locate(t,this._geom)},xl.prototype.interfaces_=function(){return[ml]},xl.prototype.getClass=function(){return xl},xl.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&Bu.isPointInRing(t,e.getCoordinates())},xl.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!xl.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(xl.isPointInRing(t,i))return!1}return!0},xl.containsPoint=function(t,e){if(e instanceof Rc)return xl.containsPointInPolygon(t,e);if(e instanceof Ec)for(var n=new vl(e);n.hasNext();){var r=n.next();if(r!==e&&xl.containsPoint(t,r))return!0}return!1},xl.locate=function(t,e){return e.isEmpty()?su.EXTERIOR:xl.containsPoint(t,e)?su.INTERIOR:su.EXTERIOR};var El=function(){this._edgeMap=new Ci,this._edgeList=null,this._ptInAreaLocation=[su.NONE,su.NONE]};El.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},El.prototype.propagateSideLabels=function(t){for(var e=su.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,ih.LEFT)!==su.NONE&&(e=r.getLocation(t,ih.LEFT))}if(e===su.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,ih.ON)===su.NONE&&a.setLocation(t,ih.ON,i),a.isArea(t)){var u=a.getLocation(t,ih.LEFT),c=a.getLocation(t,ih.RIGHT);if(c!==su.NONE){if(c!==i)throw new ah("side location conflict",s.getCoordinate());u===su.NONE&&Tu.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else Tu.isTrue(a.getLocation(t,ih.LEFT)===su.NONE,"found single null side"),a.setLocation(t,ih.RIGHT,i),a.setLocation(t,ih.LEFT,i)}}},El.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},El.prototype.print=function(t){wu.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},El.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},El.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,ih.LEFT);Tu.isTrue(r!==su.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();Tu.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,ih.LEFT),u=s.getLocation(t,ih.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},El.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1},El.prototype.iterator=function(){return this.getEdges().iterator()},El.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new nc(this._edgeMap.values())),this._edgeList},El.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===su.NONE&&(this._ptInAreaLocation[t]=xl.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},El.prototype.toString=function(){var t=new lu;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},El.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},El.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===su.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var c=su.NONE;if(e[u])c=su.EXTERIOR;else{var h=s.getCoordinate();c=this.getLocation(u,h,t)}a.setAllLocationsIfNull(u,c)}},El.prototype.getDegree=function(){return this._edgeMap.size()},El.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},El.prototype.interfaces_=function(){return[]},El.prototype.getClass=function(){return El};var wl=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,r=0;r<this._resultAreaEdgeList.size();r++){var i=this._resultAreaEdgeList.get(r),o=i.getSym();if(i.getLabel().isArea())switch(null===t&&i.isInResult()&&(t=i),n){case this._SCANNING_FOR_INCOMING:if(!o.isInResult())continue;e=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!i.isInResult())continue;e.setNext(i),n=this._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new ah("no outgoing dirEdge found",this.getCoordinate());Tu.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return mh.isNorthern(i)&&mh.isNorthern(o)?n:mh.isNorthern(i)||mh.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(Tu.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},e.prototype.print=function(t){wu.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new nc;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=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)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(ih.LEFT),r=t.getDepth(ih.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new ah("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=o;u<s;u++){var c=this._edgeList.get(u);c.setEdgeDepths(ih.RIGHT,a),a=c.getDepth(ih.LEFT)}return a}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=this._resultAreaEdgeList.size()-1;i>=0;i--){var o=this._resultAreaEdgeList.get(i),s=o.getSym();switch(null===e&&o.getEdgeRing()===t&&(e=o),r){case this._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,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&&(Tu.isTrue(null!==e,"found null for first outgoing dirEdge"),Tu.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},e.prototype.getOutgoingDegree=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}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=su.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=su.INTERIOR;break}if(r.isInResult()){t=su.EXTERIOR;break}}}if(t===su.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===su.INTERIOR):(s.isInResult()&&(i=su.EXTERIOR),a.isInResult()&&(i=su.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new lh(su.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),i=0;i<2;i++){var o=r.getLocation(i);o!==su.INTERIOR&&o!==su.BOUNDARY||this._label.setLocation(i,su.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(El),bl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new yh(t,new wl)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wh),Il=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Il.prototype.compareTo=function(t){var e=t;return Il.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Il.prototype.interfaces_=function(){return[$a]},Il.prototype.getClass=function(){return Il},Il.orientation=function(t){return 1===oc.increasingDirection(t)},Il.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,u=e?0:t.length-1,c=r?0:n.length-1;;){var h=t[u].compareTo(n[c]);if(0!==h)return h;var l=(u+=i)===s,p=(c+=o)===a;if(l&&!p)return-1;if(!l&&p)return 1;if(l&&p)return 0}};var Nl=function(){this._edges=new nc,this._ocaMap=new Ci};Nl.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i<r.length;i++)i>0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},Nl.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Nl.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Nl.prototype.iterator=function(){return this._edges.iterator()},Nl.prototype.getEdges=function(){return this._edges},Nl.prototype.get=function(t){return this._edges.get(t)},Nl.prototype.findEqualEdge=function(t){var e=new Il(t.getCoordinates());return this._ocaMap.get(e)},Nl.prototype.add=function(t){this._edges.add(t);var e=new Il(t.getCoordinates());this._ocaMap.put(e,t)},Nl.prototype.interfaces_=function(){return[]},Nl.prototype.getClass=function(){return Nl};var Cl=function(){};Cl.prototype.processIntersections=function(t,e,n,r){},Cl.prototype.isDone=function(){},Cl.prototype.interfaces_=function(){return[]},Cl.prototype.getClass=function(){return Cl};var Sl=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Sl.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Sl.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},Sl.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Sl.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Sl.prototype.getLineIntersector=function(){return this._li},Sl.prototype.hasProperIntersection=function(){return this._hasProper},Sl.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Sl.prototype.hasIntersection=function(){return this._hasIntersection},Sl.prototype.isDone=function(){return!1},Sl.prototype.hasInteriorIntersection=function(){return this._hasInterior},Sl.prototype.interfaces_=function(){return[Cl]},Sl.prototype.getClass=function(){return Sl},Sl.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Ml=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new nu(t),this.segmentIndex=e,this.dist=n};Ml.prototype.getSegmentIndex=function(){return this.segmentIndex},Ml.prototype.getCoordinate=function(){return this.coord},Ml.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Ml.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Ml.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Ml.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Ml.prototype.getDistance=function(){return this.dist},Ml.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Ml.prototype.interfaces_=function(){return[$a]},Ml.prototype.getClass=function(){return Ml};var Ll=function(){this._nodeMap=new Ci,this.edge=null;var t=arguments[0];this.edge=t};Ll.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Ll.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ll.prototype.addSplitEdges=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}},Ll.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Ll.prototype.createSplitEdge=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),s=0;o[s++]=new nu(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new Al(o,new lh(this.edge._label))},Ll.prototype.add=function(t,e,n){var r=new Ml(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},Ll.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Ll.prototype.interfaces_=function(){return[]},Ll.prototype.getClass=function(){return Ll};var Pl=function(){};Pl.prototype.getChainStartIndices=function(t){var e=0,n=new nc;n.add(new pu(e));do{var r=this.findChainEnd(t,e);n.add(new pu(r)),e=r}while(e<t.length-1);return Pl.toIntArray(n)},Pl.prototype.findChainEnd=function(t,e){for(var n=mh.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&mh.quadrant(t[r-1],t[r])===n;)r++;return r-1},Pl.prototype.interfaces_=function(){return[]},Pl.prototype.getClass=function(){return Pl},Pl.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Ol=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Iu,this.env2=new Iu;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Pl;this.startIndex=e.getChainStartIndices(this.pts)};Ol.prototype.getCoordinates=function(){return this.pts},Ol.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Ol.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Ol.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],c=arguments[5],h=this.pts[i],l=this.pts[o],p=s.pts[a],f=s.pts[u];if(o-i==1&&u-a==1)return c.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,l),this.env2.init(p,f),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),d=Math.trunc((a+u)/2);i<g&&(a<d&&this.computeIntersectsForChain(i,g,s,a,d,c),d<u&&this.computeIntersectsForChain(i,g,s,d,u,c)),g<o&&(a<d&&this.computeIntersectsForChain(g,o,s,a,d,c),d<u&&this.computeIntersectsForChain(g,o,s,d,u,c))}},Ol.prototype.getStartIndexes=function(){return this.startIndex},Ol.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},Ol.prototype.interfaces_=function(){return[]},Ol.prototype.getClass=function(){return Ol};var Rl=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},Tl={NULL_VALUE:{configurable:!0}};Rl.prototype.getDepth=function(t,e){return this._depth[t][e]},Rl.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},Rl.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Rl.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===Rl.NULL_VALUE}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._depth[r][i]===Rl.NULL_VALUE}},Rl.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var r=0;this._depth[t][n]>e&&(r=1),this._depth[t][n]=r}}},Rl.prototype.getDelta=function(t){return this._depth[t][ih.RIGHT]-this._depth[t][ih.LEFT]},Rl.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?su.EXTERIOR:su.INTERIOR},Rl.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Rl.prototype.add=function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var r=t.getLocation(e,n);r!==su.EXTERIOR&&r!==su.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=Rl.depthAtLocation(r):this._depth[e][n]+=Rl.depthAtLocation(r))}else if(3===arguments.length){var i=arguments[0],o=arguments[1];arguments[2]===su.INTERIOR&&this._depth[i][o]++}},Rl.prototype.interfaces_=function(){return[]},Rl.prototype.getClass=function(){return Rl},Rl.depthAtLocation=function(t){return t===su.EXTERIOR?0:t===su.INTERIOR?1:Rl.NULL_VALUE},Tl.NULL_VALUE.get=function(){return-1},Object.defineProperties(Rl,Tl);var Al=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Ll(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Rl,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,lh.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(n.pts[s])||(r=!1),this.pts[s].equals2D(n.pts[--o])||(i=!1),!r&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new Ol(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new Iu;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,n,r){var i=new nu(t.getIntersection(r)),o=e,s=t.getEdgeDistance(n,r),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new lu;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,ih.ON),e.getLocation(1,ih.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,ih.LEFT),e.getLocation(1,ih.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,ih.RIGHT),e.getLocation(1,ih.RIGHT),2))},e}(dh),Dl=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Nl,this._bufParams=t||null};Dl.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Dl.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new lh(t.getLabel())).flip(),n.merge(r);var i=Dl.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Dl.depthDelta(t.getLabel()))},Dl.prototype.buildSubgraphs=function(t,e){for(var n=new nc,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new fl(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Dl.prototype.createSubgraphs=function(t){for(var e=new nc,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new ch;i.create(r),e.add(i)}}return Rh.sort(e,Rh.reverseOrder()),e},Dl.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Dl.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new tl,n=new Fu;return n.setPrecisionModel(t),e.setSegmentIntersector(new Sl(n)),e},Dl.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new pl(n,this._bufParams),i=new _l(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new bh(new bl),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new Ih(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Dl.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i=r.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new Al(i.getCoordinates(),new lh(s));this.insertUniqueEdge(a)}}},Dl.prototype.setNoder=function(t){this._workingNoder=t},Dl.prototype.interfaces_=function(){return[]},Dl.prototype.getClass=function(){return Dl},Dl.depthDelta=function(t){var e=t.getLocation(0,ih.LEFT),n=t.getLocation(0,ih.RIGHT);return e===su.INTERIOR&&n===su.EXTERIOR?1:e===su.EXTERIOR&&n===su.INTERIOR?-1:0},Dl.convertSegStrings=function(t){for(var e=new Zc,n=new nc;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var Fl=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};Fl.prototype.rescale=function(){if(uu(arguments[0],Qu))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],r=0;r<n.length;r++)n[r].x=n[r].x/this._scaleFactor+this._offsetX,n[r].y=n[r].y/this._scaleFactor+this._offsetY;2===n.length&&n[0].equals2D(n[1])&&wu.out.println(n)}},Fl.prototype.scale=function(){if(uu(arguments[0],Qu)){for(var t=arguments[0],e=new nc,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Vh(this.scale(r.getCoordinates()),r.getData()))}return e}if(arguments[0]instanceof Array){for(var i=arguments[0],o=new Array(i.length).fill(null),s=0;s<i.length;s++)o[s]=new nu(Math.round((i[s].x-this._offsetX)*this._scaleFactor),Math.round((i[s].y-this._offsetY)*this._scaleFactor),i[s].z);return oc.removeRepeatedPoints(o)}},Fl.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},Fl.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Fl.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},Fl.prototype.interfaces_=function(){return[Qh]},Fl.prototype.getClass=function(){return Fl};var ql=function(){this._li=new Fu,this._segStrings=null;var t=arguments[0];this._segStrings=t},Gl={fact:{configurable:!0}};ql.prototype.checkEndPtVertexIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(2===arguments.length)for(var n=arguments[0],r=arguments[1].iterator();r.hasNext();)for(var i=r.next().getCoordinates(),o=1;o<i.length-1;o++)if(i[o].equals(n))throw new Ou("found endpt/interior pt intersection at index "+o+" :pt "+n)},ql.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkInteriorIntersections(e,r)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var c=0;c<a.length-1;c++)this.checkInteriorIntersections(i,u,o,c);else if(4===arguments.length){var h=arguments[0],l=arguments[1],p=arguments[2],f=arguments[3];if(h===p&&l===f)return null;var g=h.getCoordinates()[l],d=h.getCoordinates()[l+1],y=p.getCoordinates()[f],_=p.getCoordinates()[f+1];if(this._li.computeIntersection(g,d,y,_),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,d)||this.hasInteriorIntersection(this._li,y,_)))throw new Ou("found non-noded intersection at "+g+"-"+d+" and "+y+"-"+_)}},ql.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},ql.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var n=arguments[0].getCoordinates(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])},ql.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection(r);if(!i.equals(e)&&!i.equals(n))return!0}return!1},ql.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new Ou("found non-noded collapse at "+ql.fact.createLineString([t,e,n]))},ql.prototype.interfaces_=function(){return[]},ql.prototype.getClass=function(){return ql},Gl.fact.get=function(){return new Zc},Object.defineProperties(ql,Gl);var Bl=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 Za("Scale factor must be non-zero");1!==e&&(this._pt=new nu(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new nu,this._p1Scaled=new nu),this.initCorners(this._pt)},kl={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Bl.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return Tu.isTrue(!(s&&a),"Found bad envelope test"),a},Bl.prototype.initCorners=function(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new nu(this._maxx,this._maxy),this._corner[1]=new nu(this._minx,this._maxy),this._corner[2]=new nu(this._minx,this._miny),this._corner[3]=new nu(this._maxx,this._miny)},Bl.prototype.intersects=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))},Bl.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Bl.prototype.getCoordinate=function(){return this._originalPt},Bl.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Bl.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Bl.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Iu(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Bl.prototype.intersectsPixelClosure=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()))))},Bl.prototype.intersectsToleranceSquare=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)))))},Bl.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},Bl.prototype.interfaces_=function(){return[]},Bl.prototype.getClass=function(){return Bl},kl.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Bl,kl);var zl=function(){this.tempEnv1=new Iu,this.selectedSegment=new Hh};zl.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}},zl.prototype.interfaces_=function(){return[]},zl.prototype.getClass=function(){return zl};var jl=function(){this._index=null;var t=arguments[0];this._index=t},Xl={HotPixelSnapAction:{configurable:!0}};jl.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new Ul(e,n,r);return this._index.query(i,{interfaces_:function(){return[Mh]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},jl.prototype.interfaces_=function(){return[]},jl.prototype.getClass=function(){return jl},Xl.HotPixelSnapAction.get=function(){return Ul},Object.defineProperties(jl,Xl);var Ul=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[0],n=arguments[1],r=e.getContext();if(null!==this._parentEdge&&r===this._parentEdge&&n===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(zl),Yl=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new nc};Yl.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)}},Yl.prototype.isDone=function(){return!1},Yl.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Yl.prototype.interfaces_=function(){return[Cl]},Yl.prototype.getClass=function(){return Yl};var Vl=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new Fu,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};Vl.prototype.checkCorrectness=function(t){var e=Vh.getNodedSubstrings(t),n=new ql(e);try{n.checkValid()}catch(t){if(!(t instanceof xu))throw t;t.printStackTrace()}},Vl.prototype.getNodedSubstrings=function(){return Vh.getNodedSubstrings(this._nodedSegStrings)},Vl.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},Vl.prototype.findInteriorIntersections=function(t,e){var n=new Yl(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},Vl.prototype.computeVertexSnaps=function(){if(uu(arguments[0],Qu))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(arguments[0]instanceof Vh)for(var n=arguments[0],r=n.getCoordinates(),i=0;i<r.length;i++){var o=new Bl(r[i],this._scaleFactor,this._li);this._pointSnapper.snap(o,n,i)&&n.addIntersection(r[i],i)}},Vl.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new tl,this._pointSnapper=new jl(this._noder.getIndex()),this.snapRound(t,this._li)},Vl.prototype.computeIntersectionSnaps=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=new Bl(n,this._scaleFactor,this._li);this._pointSnapper.snap(r)}},Vl.prototype.interfaces_=function(){return[Qh]},Vl.prototype.getClass=function(){return Vl};var Hl=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new nl,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}},Wl={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Hl.prototype.bufferFixedPrecision=function(t){var e=new Fl(new Vl(new Vc(1)),t.getScale()),n=new Dl(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},Hl.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=Hl.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof ah))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=Hl.precisionScaleFactor(this._argGeom,this._distance,n),i=new Vc(r);this.bufferFixedPrecision(i)}},Hl.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Vc.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},Hl.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},Hl.prototype.bufferOriginalPrecision=function(){try{var t=new Dl(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof Ou))throw t;this._saveException=t}},Hl.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},Hl.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},Hl.prototype.interfaces_=function(){return[]},Hl.prototype.getClass=function(){return Hl},Hl.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new Hl(t).getResultGeometry(e)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof ju&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1],i=arguments[2],o=new Hl(n);return o.setQuadrantSegments(i),o.getResultGeometry(r)}if(arguments[2]instanceof nl&&arguments[0]instanceof ju&&"number"==typeof arguments[1]){var s=arguments[0],a=arguments[1],u=arguments[2];return new Hl(s,u).getResultGeometry(a)}}else if(4===arguments.length){var c=arguments[0],h=arguments[1],l=arguments[2],p=arguments[3],f=new Hl(c);return f.setQuadrantSegments(l),f.setEndCapStyle(p),f.getResultGeometry(h)}},Hl.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=cu.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)},Wl.CAP_ROUND.get=function(){return nl.CAP_ROUND},Wl.CAP_BUTT.get=function(){return nl.CAP_FLAT},Wl.CAP_FLAT.get=function(){return nl.CAP_FLAT},Wl.CAP_SQUARE.get=function(){return nl.CAP_SQUARE},Wl.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Hl,Wl);var Jl=function(){this._pt=[new nu,new nu],this._distance=Ka.NaN,this._isNull=!0};Jl.prototype.getCoordinates=function(){return this._pt},Jl.prototype.getCoordinate=function(t){return this._pt[t]},Jl.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},Jl.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},Jl.prototype.getDistance=function(){return this._distance},Jl.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},Jl.prototype.interfaces_=function(){return[]},Jl.prototype.getClass=function(){return Jl};var Zl=function(){};Zl.prototype.interfaces_=function(){return[]},Zl.prototype.getClass=function(){return Zl},Zl.computeDistance=function(){if(arguments[2]instanceof Jl&&arguments[0]instanceof Mc&&arguments[1]instanceof nu)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Hh,o=0;o<r.length-1;o++){i.setCoordinates(r[o],r[o+1]);var s=i.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof Jl&&arguments[0]instanceof Rc&&arguments[1]instanceof nu){var a=arguments[0],u=arguments[1],c=arguments[2];Zl.computeDistance(a.getExteriorRing(),u,c);for(var h=0;h<a.getNumInteriorRing();h++)Zl.computeDistance(a.getInteriorRingN(h),u,c)}else if(arguments[2]instanceof Jl&&arguments[0]instanceof ju&&arguments[1]instanceof nu){var l=arguments[0],p=arguments[1],f=arguments[2];if(l instanceof Mc)Zl.computeDistance(l,p,f);else if(l instanceof Rc)Zl.computeDistance(l,p,f);else if(l instanceof Ec)for(var g=l,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);Zl.computeDistance(y,p,f)}else f.setMinimum(l.getCoordinate(),p)}else if(arguments[2]instanceof Jl&&arguments[0]instanceof Hh&&arguments[1]instanceof nu){var _=arguments[0],m=arguments[1],v=arguments[2],x=_.closestPoint(m);v.setMinimum(x,m)}};var Kl=function(t){this._maxPtDist=new Jl,this._inputGeom=t||null},Ql={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Kl.prototype.computeMaxMidpointDistance=function(t){var e=new tp(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Kl.prototype.computeMaxVertexDistance=function(t){var e=new $l(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Kl.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Kl.prototype.getDistancePoints=function(){return this._maxPtDist},Kl.prototype.interfaces_=function(){return[]},Kl.prototype.getClass=function(){return Kl},Ql.MaxPointDistanceFilter.get=function(){return $l},Ql.MaxMidpointDistanceFilter.get=function(){return tp},Object.defineProperties(Kl,Ql);var $l=function(t){this._maxPtDist=new Jl,this._minPtDist=new Jl,this._geom=t||null};$l.prototype.filter=function(t){this._minPtDist.initialize(),Zl.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},$l.prototype.getMaxPointDistance=function(){return this._maxPtDist},$l.prototype.interfaces_=function(){return[Yu]},$l.prototype.getClass=function(){return $l};var tp=function(t){this._maxPtDist=new Jl,this._minPtDist=new Jl,this._geom=t||null};tp.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new nu((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),Zl.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},tp.prototype.isDone=function(){return!1},tp.prototype.isGeometryChanged=function(){return!1},tp.prototype.getMaxPointDistance=function(){return this._maxPtDist},tp.prototype.interfaces_=function(){return[xc]},tp.prototype.getClass=function(){return tp};var ep=function(t){this._comps=t||null};ep.prototype.filter=function(t){t instanceof Rc&&this._comps.add(t)},ep.prototype.interfaces_=function(){return[vc]},ep.prototype.getClass=function(){return ep},ep.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return ep.getPolygons(t,new nc)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Rc?n.add(e):e instanceof Ec&&e.apply(new ep(n)),n}};var np=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};np.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Ac){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Mc&&this._lines.add(t)},np.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},np.prototype.interfaces_=function(){return[zu]},np.prototype.getClass=function(){return np},np.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(np.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(np.getLines(e,n))}},np.getLines=function(){if(1===arguments.length){var t=arguments[0];return np.getLines(t,!1)}if(2===arguments.length){if(uu(arguments[0],Qu)&&uu(arguments[1],Qu)){for(var e=arguments[0],n=arguments[1],r=e.iterator();r.hasNext();){var i=r.next();np.getLines(i,n)}return n}if(arguments[0]instanceof ju&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1],a=new nc;return o.apply(new np(a,s)),a}if(arguments[0]instanceof ju&&uu(arguments[1],Qu)){var u=arguments[0],c=arguments[1];return u instanceof Mc?c.add(u):u.apply(new np(c)),c}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&uu(arguments[0],Qu)&&uu(arguments[1],Qu)){for(var h=arguments[0],l=arguments[1],p=arguments[2],f=h.iterator();f.hasNext();){var g=f.next();np.getLines(g,l,p)}return l}if("boolean"==typeof arguments[2]&&arguments[0]instanceof ju&&uu(arguments[1],Qu)){var d=arguments[0],y=arguments[1],_=arguments[2];return d.apply(new np(y,_)),y}}};var rp=function(){if(this._boundaryRule=Vu.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new Za("Rule must be non-null");this._boundaryRule=t}};rp.prototype.locateInternal=function(){if(arguments[0]instanceof nu&&arguments[1]instanceof Rc){var t=arguments[0],e=arguments[1];if(e.isEmpty())return su.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===su.EXTERIOR)return su.EXTERIOR;if(r===su.BOUNDARY)return su.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===su.INTERIOR)return su.EXTERIOR;if(s===su.BOUNDARY)return su.BOUNDARY}return su.INTERIOR}if(arguments[0]instanceof nu&&arguments[1]instanceof Mc){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return su.EXTERIOR;var c=u.getCoordinates();return u.isClosed()||!a.equals(c[0])&&!a.equals(c[c.length-1])?Bu.isOnLine(a,c)?su.INTERIOR:su.EXTERIOR:su.BOUNDARY}if(arguments[0]instanceof nu&&arguments[1]instanceof Pc){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?su.INTERIOR:su.EXTERIOR}},rp.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Bu.locatePointInRing(t,e.getCoordinates()):su.EXTERIOR},rp.prototype.intersects=function(t,e){return this.locate(t,e)!==su.EXTERIOR},rp.prototype.updateLocationInfo=function(t){t===su.INTERIOR&&(this._isIn=!0),t===su.BOUNDARY&&this._numBoundaries++},rp.prototype.computeLocation=function(t,e){if(e instanceof Pc&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Mc)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Rc)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof wc)for(var n=e,r=0;r<n.getNumGeometries();r++){var i=n.getGeometryN(r);this.updateLocationInfo(this.locateInternal(t,i))}else if(e instanceof Dc)for(var o=e,s=0;s<o.getNumGeometries();s++){var a=o.getGeometryN(s);this.updateLocationInfo(this.locateInternal(t,a))}else if(e instanceof Ec)for(var u=new vl(e);u.hasNext();){var c=u.next();c!==e&&this.computeLocation(t,c)}},rp.prototype.locate=function(t,e){return e.isEmpty()?su.EXTERIOR:e instanceof Mc||e instanceof Rc?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?su.BOUNDARY:this._numBoundaries>0||this._isIn?su.INTERIOR:su.EXTERIOR)},rp.prototype.interfaces_=function(){return[]},rp.prototype.getClass=function(){return rp};var ip=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._component=r,this._segIndex=i,this._pt=o}},op={INSIDE_AREA:{configurable:!0}};ip.prototype.isInsideArea=function(){return this._segIndex===ip.INSIDE_AREA},ip.prototype.getCoordinate=function(){return this._pt},ip.prototype.getGeometryComponent=function(){return this._component},ip.prototype.getSegmentIndex=function(){return this._segIndex},ip.prototype.interfaces_=function(){return[]},ip.prototype.getClass=function(){return ip},op.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ip,op);var sp=function(t){this._pts=t||null};sp.prototype.filter=function(t){t instanceof Pc&&this._pts.add(t)},sp.prototype.interfaces_=function(){return[vc]},sp.prototype.getClass=function(){return sp},sp.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Pc?Rh.singletonList(t):sp.getPoints(t,new nc)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Pc?n.add(e):e instanceof Ec&&e.apply(new sp(n)),n}};var ap=function(){this._locations=null;var t=arguments[0];this._locations=t};ap.prototype.filter=function(t){(t instanceof Pc||t instanceof Mc||t instanceof Rc)&&this._locations.add(new ip(t,0,t.getCoordinate()))},ap.prototype.interfaces_=function(){return[vc]},ap.prototype.getClass=function(){return ap},ap.getLocations=function(t){var e=new nc;return t.apply(new ap(e)),e};var up=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new rp,this._minDistanceLocation=null,this._minDistance=Ka.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};up.prototype.computeContainmentDistance=function(){if(0===arguments.length){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=1-e,i=ep.getPolygons(this._geom[e]);if(i.size()>0){var o=ap.getLocations(this._geom[r]);if(this.computeContainmentDistance(o,i,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&uu(arguments[0],ec)&&uu(arguments[1],ec)){for(var s=arguments[0],a=arguments[1],u=arguments[2],c=0;c<s.size();c++)for(var h=s.get(c),l=0;l<a.size();l++)if(this.computeContainmentDistance(h,a.get(l),u),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ip&&arguments[1]instanceof Rc){var p=arguments[0],f=arguments[1],g=arguments[2],d=p.getCoordinate();if(su.EXTERIOR!==this._ptLocator.locate(d,f))return this._minDistance=0,g[0]=p,g[1]=new ip(f,d),null}},up.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},up.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=np.getLines(this._geom[0]),n=np.getLines(this._geom[1]),r=sp.getPoints(this._geom[0]),i=sp.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},up.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},up.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},up.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},up.prototype.computeMinDistance=function(){if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof Mc&&arguments[1]instanceof Pc){var t=arguments[0],e=arguments[1],n=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;for(var r=t.getCoordinates(),i=e.getCoordinate(),o=0;o<r.length-1;o++){var s=Bu.distancePointLine(i,r[o],r[o+1]);if(s<this._minDistance){this._minDistance=s;var a=new Hh(r[o],r[o+1]).closestPoint(i);n[0]=new ip(t,o,a),n[1]=new ip(e,0,i)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Mc&&arguments[1]instanceof Mc){var u=arguments[0],c=arguments[1],h=arguments[2];if(u.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var l=u.getCoordinates(),p=c.getCoordinates(),f=0;f<l.length-1;f++)for(var g=0;g<p.length-1;g++){var d=Bu.distanceLineLine(l[f],l[f+1],p[g],p[g+1]);if(d<this._minDistance){this._minDistance=d;var y=new Hh(l[f],l[f+1]),_=new Hh(p[g],p[g+1]),m=y.closestPoints(_);h[0]=new ip(u,f,m[0]),h[1]=new ip(c,g,m[1])}if(this._minDistance<=this._terminateDistance)return null}}},up.prototype.computeMinDistancePoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o),a=i.getCoordinate().distance(s.getCoordinate());if(a<this._minDistance&&(this._minDistance=a,n[0]=new ip(i,0,i.getCoordinate()),n[1]=new ip(s,0,s.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},up.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new Za("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},up.prototype.computeMinDistanceLines=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},up.prototype.interfaces_=function(){return[]},up.prototype.getClass=function(){return up},up.distance=function(t,e){return new up(t,e).distance()},up.isWithinDistance=function(t,e,n){return new up(t,e,n).distance()<=n},up.nearestPoints=function(t,e){return new up(t,e).nearestPoints()};var cp=function(){this._pt=[new nu,new nu],this._distance=Ka.NaN,this._isNull=!0};cp.prototype.getCoordinates=function(){return this._pt},cp.prototype.getCoordinate=function(t){return this._pt[t]},cp.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},cp.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},cp.prototype.toString=function(){return Pu.toLineString(this._pt[0],this._pt[1])},cp.prototype.getDistance=function(){return this._distance},cp.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},cp.prototype.interfaces_=function(){return[]},cp.prototype.getClass=function(){return cp};var hp=function(){};hp.prototype.interfaces_=function(){return[]},hp.prototype.getClass=function(){return hp},hp.computeDistance=function(){if(arguments[2]instanceof cp&&arguments[0]instanceof Mc&&arguments[1]instanceof nu)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Hh,i=t.getCoordinates(),o=0;o<i.length-1;o++){r.setCoordinates(i[o],i[o+1]);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof cp&&arguments[0]instanceof Rc&&arguments[1]instanceof nu){var a=arguments[0],u=arguments[1],c=arguments[2];hp.computeDistance(a.getExteriorRing(),u,c);for(var h=0;h<a.getNumInteriorRing();h++)hp.computeDistance(a.getInteriorRingN(h),u,c)}else if(arguments[2]instanceof cp&&arguments[0]instanceof ju&&arguments[1]instanceof nu){var l=arguments[0],p=arguments[1],f=arguments[2];if(l instanceof Mc)hp.computeDistance(l,p,f);else if(l instanceof Rc)hp.computeDistance(l,p,f);else if(l instanceof Ec)for(var g=l,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);hp.computeDistance(y,p,f)}else f.setMinimum(l.getCoordinate(),p)}else if(arguments[2]instanceof cp&&arguments[0]instanceof Hh&&arguments[1]instanceof nu){var _=arguments[0],m=arguments[1],v=arguments[2],x=_.closestPoint(m);v.setMinimum(x,m)}};var lp=function(){this._g0=null,this._g1=null,this._ptDist=new cp,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},pp={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};lp.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},lp.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Za("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},lp.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},lp.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},lp.prototype.computeOrientedDistance=function(t,e,n){var r=new fp(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new gp(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},lp.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},lp.prototype.interfaces_=function(){return[]},lp.prototype.getClass=function(){return lp},lp.distance=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new lp(t,e).distance()}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=new lp(n,r);return o.setDensifyFraction(i),o.distance()}},pp.MaxPointDistanceFilter.get=function(){return fp},pp.MaxDensifiedByFractionDistanceFilter.get=function(){return gp},Object.defineProperties(lp,pp);var fp=function(){this._maxPtDist=new cp,this._minPtDist=new cp,this._euclideanDist=new hp,this._geom=null;var t=arguments[0];this._geom=t};fp.prototype.filter=function(t){this._minPtDist.initialize(),hp.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},fp.prototype.getMaxPointDistance=function(){return this._maxPtDist},fp.prototype.interfaces_=function(){return[Yu]},fp.prototype.getClass=function(){return fp};var gp=function(){this._maxPtDist=new cp,this._minPtDist=new cp,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};gp.prototype.filter=function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=(r.x-n.x)/this._numSubSegs,o=(r.y-n.y)/this._numSubSegs,s=0;s<this._numSubSegs;s++){var a=n.x+s*i,u=n.y+s*o,c=new nu(a,u);this._minPtDist.initialize(),hp.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},gp.prototype.isDone=function(){return!1},gp.prototype.isGeometryChanged=function(){return!1},gp.prototype.getMaxPointDistance=function(){return this._maxPtDist},gp.prototype.interfaces_=function(){return[xc]},gp.prototype.getClass=function(){return gp};var dp=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},yp={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};dp.prototype.checkMaximumDistance=function(t,e,n){var r=new lp(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Pu.toLineString(i[0],i[1])+")"}},dp.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=dp.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),dp.VERBOSE&&wu.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},dp.prototype.checkNegativeValid=function(){if(!(this._input instanceof Rc||this._input instanceof Dc||this._input instanceof Ec))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},dp.prototype.getErrorIndicator=function(){return this._errorIndicator},dp.prototype.checkMinimumDistance=function(t,e,n){var r=new up(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Pu.toLineString(i[0],i[1])+" )"}},dp.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},dp.prototype.getErrorLocation=function(){return this._errorLocation},dp.prototype.getPolygonLines=function(t){for(var e=new nc,n=new np(e),r=ep.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},dp.prototype.getErrorMessage=function(){return this._errMsg},dp.prototype.interfaces_=function(){return[]},dp.prototype.getClass=function(){return dp},yp.VERBOSE.get=function(){return!1},yp.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(dp,yp);var _p=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},mp={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};_p.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},_p.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*_p.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new Iu(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new Iu(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},_p.prototype.checkDistance=function(){var t=new dp(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},_p.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},_p.prototype.checkPolygonal=function(){this._result instanceof Rc||this._result instanceof Dc||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},_p.prototype.getErrorIndicator=function(){return this._errorIndicator},_p.prototype.getErrorLocation=function(){return this._errorLocation},_p.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},_p.prototype.report=function(t){if(!_p.VERBOSE)return null;wu.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},_p.prototype.getErrorMessage=function(){return this._errorMsg},_p.prototype.interfaces_=function(){return[]},_p.prototype.getClass=function(){return _p},_p.isValidMsg=function(t,e,n){var r=new _p(t,e,n);return r.isValid()?null:r.getErrorMessage()},_p.isValid=function(t,e,n){return!!new _p(t,e,n).isValid()},mp.VERBOSE.get=function(){return!1},mp.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(_p,mp);var vp=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};vp.prototype.getCoordinates=function(){return this._pts},vp.prototype.size=function(){return this._pts.length},vp.prototype.getCoordinate=function(t){return this._pts[t]},vp.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},vp.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Xh.octant(this.getCoordinate(t),this.getCoordinate(t+1))},vp.prototype.setData=function(t){this._data=t},vp.prototype.getData=function(){return this._data},vp.prototype.toString=function(){return Pu.toLineString(new zc(this._pts))},vp.prototype.interfaces_=function(){return[Uh]},vp.prototype.getClass=function(){return vp};var xp=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new nc,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};xp.prototype.getInteriorIntersection=function(){return this._interiorIntersection},xp.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},xp.prototype.getIntersectionSegments=function(){return this._intSegments},xp.prototype.count=function(){return this._intersectionCount},xp.prototype.getIntersections=function(){return this._intersections},xp.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},xp.prototype.setKeepIntersections=function(t){this._keepIntersections=t},xp.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(n,r))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},xp.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},xp.prototype.hasIntersection=function(){return null!==this._interiorIntersection},xp.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},xp.prototype.interfaces_=function(){return[Cl]},xp.prototype.getClass=function(){return xp},xp.createAllIntersectionsFinder=function(t){var e=new xp(t);return e.setFindAllIntersections(!0),e},xp.createAnyIntersectionFinder=function(t){return new xp(t)},xp.createIntersectionCounter=function(t){var e=new xp(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ep=function(){this._li=new Fu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ep.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Ep.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ep.prototype.isValid=function(){return this.execute(),this._isValid},Ep.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Ep.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new xp(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new tl;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ep.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ah(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ep.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Pu.toLineString(t[0],t[1])+" and "+Pu.toLineString(t[2],t[3])},Ep.prototype.interfaces_=function(){return[]},Ep.prototype.getClass=function(){return Ep},Ep.computeIntersections=function(t){var e=new Ep(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var wp=function t(){this._nv=null;var e=arguments[0];this._nv=new Ep(t.toSegmentStrings(e))};wp.prototype.checkValid=function(){this._nv.checkValid()},wp.prototype.interfaces_=function(){return[]},wp.prototype.getClass=function(){return wp},wp.toSegmentStrings=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next();e.add(new vp(r.getCoordinates(),r))}return e},wp.checkValid=function(t){new wp(t).checkValid()};var bp=function(t){this._mapOp=t};bp.prototype.map=function(t){for(var e=new nc,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(Zc.toGeometryArray(e))},bp.prototype.interfaces_=function(){return[]},bp.prototype.getClass=function(){return bp},bp.map=function(t,e){return new bp(e).map(t)};var Ip=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new nc,this._resultLineList=new nc;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Ip.prototype.collectLines=function(t){for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next();this.collectLineEdge(n,t,this._lineEdgesList),this.collectBoundaryTouchEdge(n,t,this._lineEdgesList)}},Ip.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Ip.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Ip.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!of.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},Ip.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getEdge();if(n.isLineEdge()&&!r.isCoveredSet()){var i=this._op.isCoveredByA(n.getCoordinate());r.setCovered(i)}}},Ip.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=n.getLabel();n.isIsolated()&&(r.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},Ip.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),r=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(r),n.setInResult(!0)}},Ip.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(Tu.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(of.isResultOfOp(r,e)&&e===of.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Ip.prototype.interfaces_=function(){return[]},Ip.prototype.getClass=function(){return Ip};var Np=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new nc;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Np.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Np.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!(n.isInResult()||n.isIncidentEdgeInResult()||0!==n.getEdges().getDegree()&&t!==of.INTERSECTION)){var r=n.getLabel();of.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},Np.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Np.prototype.interfaces_=function(){return[]},Np.prototype.getClass=function(){return Np};var Cp=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Cp.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Cp.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof Ac&&!r.isEmpty()||(n=!1);for(var i=new nc,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof Ac||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new nc;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},Cp.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Cp.prototype.getInputGeometry=function(){return this._inputGeom},Cp.prototype.transformMultiLineString=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Cp.prototype.transformCoordinates=function(t,e){return this.copy(t)},Cp.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Cp.prototype.transformMultiPoint=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Cp.prototype.transformMultiPolygon=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Cp.prototype.copy=function(t){return t.copy()},Cp.prototype.transformGeometryCollection=function(t,e){for(var n=new nc,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN(r));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Zc.toGeometryArray(n)):this._factory.buildGeometry(n)},Cp.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Pc)return this.transformPoint(t,null);if(t instanceof Tc)return this.transformMultiPoint(t,null);if(t instanceof Ac)return this.transformLinearRing(t,null);if(t instanceof Mc)return this.transformLineString(t,null);if(t instanceof wc)return this.transformMultiLineString(t,null);if(t instanceof Rc)return this.transformPolygon(t,null);if(t instanceof Dc)return this.transformMultiPolygon(t,null);if(t instanceof Ec)return this.transformGeometryCollection(t,null);throw new Za("Unknown Geometry subtype: "+t.getClass().getName())},Cp.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var r=n.size();return r>0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Cp.prototype.interfaces_=function(){return[]},Cp.prototype.getClass=function(){return Cp};var Sp=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Hh,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Mc&&"number"==typeof arguments[1]){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Sp.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new nu(o)),0===r&&this._isClosed&&t.set(t.size()-1,new nu(o)))}},Sp.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},Sp.prototype.snapTo=function(t){var e=new ic(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Sp.prototype.snapSegments=function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var r=0;r<n;r++){var i=e[r],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new nu(i),!1)}},Sp.prototype.findSegmentIndexToSnap=function(t,e){for(var n=Ka.MAX_VALUE,r=-1,i=0;i<e.size()-1;i++){if(this._seg.p0=e.get(i),this._seg.p1=e.get(i+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var o=this._seg.distance(t);o<this._snapTolerance&&o<n&&(n=o,r=i)}return r},Sp.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Sp.prototype.interfaces_=function(){return[]},Sp.prototype.getClass=function(){return Sp},Sp.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Mp=function(t){this._srcGeom=t||null},Lp={SNAP_PRECISION_FACTOR:{configurable:!0}};Mp.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Pp(e,n).transform(this._srcGeom)},Mp.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Pp(t,n,!0).transform(this._srcGeom),i=r;return e&&uu(i,Oc)&&(i=r.buffer(0)),i},Mp.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Mp.prototype.extractTargetCoordinates=function(t){for(var e=new Mi,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},Mp.prototype.computeMinimumSegmentLength=function(t){for(var e=Ka.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},Mp.prototype.interfaces_=function(){return[]},Mp.prototype.getClass=function(){return Mp},Mp.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Mp(t);r[0]=i.snapTo(e,n);var o=new Mp(e);return r[1]=o.snapTo(r[0],n),r},Mp.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Mp.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===Vc.FIXED){var r=1/n.getScale()*2/1.415;r>e&&(e=r)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Mp.computeOverlaySnapTolerance(i),Mp.computeOverlaySnapTolerance(o))}},Mp.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Mp.SNAP_PRECISION_FACTOR},Mp.snapToSelf=function(t,e,n){return new Mp(t).snapToSelf(e,n)},Lp.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Mp,Lp);var Pp=function(t){function e(e,n,r){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==r&&r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new Sp(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Cp),Op=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Op.prototype.getCommon=function(){return Ka.longBitsToDouble(this._commonBits)},Op.prototype.add=function(t){var e=Ka.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Op.signExpBits(this._commonBits),this._isFirst=!1,null):Op.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Op.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Op.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Op.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Ka.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+Ka.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+e+" ]"}},Op.prototype.interfaces_=function(){return[]},Op.prototype.getClass=function(){return Op},Op.getBit=function(t,e){return 0!=(t&1<<e)?1:0},Op.signExpBits=function(t){return t>>52},Op.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},Op.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r--){if(Op.getBit(t,r)!==Op.getBit(e,r))return n;n++}return 52};var Rp=function(){this._commonCoord=null,this._ccFilter=new Ap},Tp={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Rp.prototype.addCommonBits=function(t){var e=new Dp(this._commonCoord);t.apply(e),t.geometryChanged()},Rp.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new nu(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new Dp(e);return t.apply(n),t.geometryChanged(),t},Rp.prototype.getCommonCoordinate=function(){return this._commonCoord},Rp.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Rp.prototype.interfaces_=function(){return[]},Rp.prototype.getClass=function(){return Rp},Tp.CommonCoordinateFilter.get=function(){return Ap},Tp.Translater.get=function(){return Dp},Object.defineProperties(Rp,Tp);var Ap=function(){this._commonBitsX=new Op,this._commonBitsY=new Op};Ap.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Ap.prototype.getCommonCoordinate=function(){return new nu(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ap.prototype.interfaces_=function(){return[Yu]},Ap.prototype.getClass=function(){return Ap};var Dp=function(){this.trans=null;var t=arguments[0];this.trans=t};Dp.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},Dp.prototype.isDone=function(){return!1},Dp.prototype.isGeometryChanged=function(){return!0},Dp.prototype.interfaces_=function(){return[xc]},Dp.prototype.getClass=function(){return Dp};var Fp=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};Fp.prototype.selfSnap=function(t){return new Mp(t).snapTo(t,this._snapTolerance)},Fp.prototype.removeCommonBits=function(t){this._cbr=new Rp,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},Fp.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Fp.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=of.overlayOp(e[0],e[1],t);return this.prepareResult(n)},Fp.prototype.checkValid=function(t){t.isValid()||wu.out.println("Snapped geometry is invalid")},Fp.prototype.computeSnapTolerance=function(){this._snapTolerance=Mp.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Fp.prototype.snap=function(t){var e=this.removeCommonBits(t);return Mp.snap(e[0],e[1],this._snapTolerance)},Fp.prototype.interfaces_=function(){return[]},Fp.prototype.getClass=function(){return Fp},Fp.overlayOp=function(t,e,n){return new Fp(t,e).getResultGeometry(n)},Fp.union=function(t,e){return Fp.overlayOp(t,e,of.UNION)},Fp.intersection=function(t,e){return Fp.overlayOp(t,e,of.INTERSECTION)},Fp.symDifference=function(t,e){return Fp.overlayOp(t,e,of.SYMDIFFERENCE)},Fp.difference=function(t,e){return Fp.overlayOp(t,e,of.DIFFERENCE)};var qp=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};qp.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=of.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(t){if(!(t instanceof Ou))throw t;r=t}if(!n)try{e=Fp.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof Ou?r:t}return e},qp.prototype.interfaces_=function(){return[]},qp.prototype.getClass=function(){return qp},qp.overlayOp=function(t,e,n){return new qp(t,e).getResultGeometry(n)},qp.union=function(t,e){return qp.overlayOp(t,e,of.UNION)},qp.intersection=function(t,e){return qp.overlayOp(t,e,of.INTERSECTION)},qp.symDifference=function(t,e){return qp.overlayOp(t,e,of.SYMDIFFERENCE)},qp.difference=function(t,e){return qp.overlayOp(t,e,of.DIFFERENCE)};var Gp=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Gp.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Gp.prototype.interfaces_=function(){return[]},Gp.prototype.getClass=function(){return Gp};var Bp=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},kp={INSERT:{configurable:!0},DELETE:{configurable:!0}};Bp.prototype.isDelete=function(){return this._eventType===Bp.DELETE},Bp.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Bp.prototype.getObject=function(){return this._obj},Bp.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},Bp.prototype.getInsertEvent=function(){return this._insertEvent},Bp.prototype.isInsert=function(){return this._eventType===Bp.INSERT},Bp.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},Bp.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Bp.prototype.interfaces_=function(){return[$a]},Bp.prototype.getClass=function(){return Bp},kp.INSERT.get=function(){return 1},kp.DELETE.get=function(){return 2},Object.defineProperties(Bp,kp);var zp=function(){};zp.prototype.interfaces_=function(){return[]},zp.prototype.getClass=function(){return zp};var jp=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};jp.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(jp.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},jp.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},jp.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},jp.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},jp.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},jp.prototype.hasProperIntersection=function(){return this._hasProper},jp.prototype.hasIntersection=function(){return this._hasIntersection},jp.prototype.isDone=function(){return this._isDone},jp.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},jp.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},jp.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},jp.prototype.interfaces_=function(){return[]},jp.prototype.getClass=function(){return jp},jp.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Xp=function(t){function e(){t.call(this),this.events=new nc,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Rh.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof jp&&uu(arguments[0],ec)&&uu(arguments[1],ec)){var r=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&uu(arguments[0],ec)&&arguments[1]instanceof jp){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new Gp(n,i),s=new Bp(e,n.getMinX(i),o);this.events.add(s),this.events.add(new Bp(n.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,n,r){for(var i=n.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(i.computeIntersections(a,r),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments[0],r=arguments[1],i=n.iterator();i.hasNext();){var o=i.next();this.addEdge(o,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(zp),Up=function(){this._min=Ka.POSITIVE_INFINITY,this._max=Ka.NEGATIVE_INFINITY},Yp={NodeComparator:{configurable:!0}};Up.prototype.getMin=function(){return this._min},Up.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},Up.prototype.getMax=function(){return this._max},Up.prototype.toString=function(){return Pu.toLineString(new nu(this._min,0),new nu(this._max,0))},Up.prototype.interfaces_=function(){return[]},Up.prototype.getClass=function(){return Up},Yp.NodeComparator.get=function(){return Vp},Object.defineProperties(Up,Yp);var Vp=function(){};Vp.prototype.compare=function(t,e){var n=t,r=e,i=(n._min+n._max)/2,o=(r._min+r._max)/2;return i<o?-1:i>o?1:0},Vp.prototype.interfaces_=function(){return[eu]},Vp.prototype.getClass=function(){return Vp};var Hp=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],r=arguments[2];this._min=e,this._max=n,this._item=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Up),Wp=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Up),Jp=function(){this._leaves=new nc,this._root=null,this._level=0};Jp.prototype.buildTree=function(){Rh.sort(this._leaves,new Up.NodeComparator);for(var t=this._leaves,e=null,n=new nc;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},Jp.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Hp(t,e,n))},Jp.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Jp.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},Jp.prototype.printNode=function(t){wu.out.println(Pu.toLineString(new nu(t._min,this._level),new nu(t._max,this._level)))},Jp.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},Jp.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(r);else{var i=new Wp(t.get(n),t.get(n+1));e.add(i)}}},Jp.prototype.interfaces_=function(){return[]},Jp.prototype.getClass=function(){return Jp};var Zp=function(){this._items=new nc};Zp.prototype.visitItem=function(t){this._items.add(t)},Zp.prototype.getItems=function(){return this._items},Zp.prototype.interfaces_=function(){return[Mh]},Zp.prototype.getClass=function(){return Zp};var Kp=function(){this._index=null;var t=arguments[0];if(!uu(t,Oc))throw new Za("Argument must be Polygonal");this._index=new tf(t)},Qp={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};Kp.prototype.locate=function(t){var e=new Gu(t),n=new $p(e);return this._index.query(t.y,t.y,n),e.getLocation()},Kp.prototype.interfaces_=function(){return[ml]},Kp.prototype.getClass=function(){return Kp},Qp.SegmentVisitor.get=function(){return $p},Qp.IntervalIndexedGeometry.get=function(){return tf},Object.defineProperties(Kp,Qp);var $p=function(){this._counter=null;var t=arguments[0];this._counter=t};$p.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},$p.prototype.interfaces_=function(){return[Mh]},$p.prototype.getClass=function(){return $p};var tf=function(){this._index=new Jp;var t=arguments[0];this.init(t)};tf.prototype.init=function(t){for(var e=np.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},tf.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new Hh(t[e-1],t[e]),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},tf.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Zp;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._index.query(r,i,o)}},tf.prototype.interfaces_=function(){return[]},tf.prototype.getClass=function(){return tf};var ef=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new Yc,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new rp,2===arguments.length){var e=arguments[0],n=arguments[1],r=Vu.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=r,null!==n&&this.add(n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,n){var r=this._nodes.addNode(n).getLabel(),i=1;r.getLocation(t,ih.ON)===su.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);r.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=new jp(n,!0,!1);o.setIsDoneIfProperInt(i);var s=this.createEdgeSetIntersector(),a=this._parentGeom instanceof Ac||this._parentGeom instanceof Rc||this._parentGeom instanceof Dc,u=r||!a;return s.computeIntersections(this._edges,o,u),this.addSelfIntersectionNodes(this._argIndex),o}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,n){var r=new jp(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Pc){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,su.INTERIOR)}else if(arguments[0]instanceof nu){var e=arguments[0];this.insertPoint(this._argIndex,e,su.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),su.EXTERIOR,su.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,su.INTERIOR,su.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],su.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],su.BOUNDARY)},e.prototype.addLineString=function(t){var e=oc.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new Al(e,new lh(this._argIndex,su.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),Tu.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,r=t.iterator();r.hasNext();){var i=r.next();e[n++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===su.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=oc.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;Bu.isCCW(r)&&(i=n,o=e);var s=new Al(r,new lh(this._argIndex,su.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],su.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new lh(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new Xp},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),r=n.getLabel().getLocation(t),i=n.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,r)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof Dc&&(this._useBoundaryDeterminationRule=!1),e instanceof Rc)this.addPolygon(e);else if(e instanceof Mc)this.addLineString(e);else if(e instanceof Pc)this.addPoint(e);else if(e instanceof Tc)this.addCollection(e);else if(e instanceof wc)this.addCollection(e);else if(e instanceof Dc)this.addCollection(e);else{if(!(e instanceof Ec))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},e.prototype.locate=function(t){return uu(this._parentGeom,Oc)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new Kp(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?su.BOUNDARY:su.INTERIOR},e}(bh),nf=function(){if(this._li=new Fu,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ef(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=Vu.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ef(0,e,r),this._arg[1]=new ef(1,n,r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ef(0,i,s),this._arg[1]=new ef(1,o,s)}};nf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},nf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},nf.prototype.interfaces_=function(){return[]},nf.prototype.getClass=function(){return nf};var rf=function(){};rf.prototype.interfaces_=function(){return[]},rf.prototype.getClass=function(){return rf},rf.map=function(){if(arguments[0]instanceof ju&&uu(arguments[1],rf.MapOp)){for(var t=arguments[0],e=arguments[1],n=new nc,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(uu(arguments[0],Qu)&&uu(arguments[1],rf.MapOp)){for(var o=arguments[0],s=arguments[1],a=new nc,u=o.iterator();u.hasNext();){var c=u.next(),h=s.map(c);null!==h&&a.add(h)}return a}},rf.MapOp=function(){};var of=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n),this._ptLocator=new rp,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Nl,this._resultPolyList=new nc,this._resultLineList=new nc,this._resultPointList=new nc,this._graph=new bh(new bl),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new lh(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(n),i.add(r),n.merge(r)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,n,r,i){var o=new nc;return o.addAll(t),o.addAll(n),o.addAll(r),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==su.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new nc,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new nc;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),wp.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new Ih(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new Ip(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new Np(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var r=n.next(),i=r.getLabel();i.isArea()&&!r.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,ih.RIGHT),i.getLocation(1,ih.RIGHT),t)&&r.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),r=e.getDepth();if(!r.isNull()){r.normalize();for(var i=0;i<2;i++)n.isNull(i)||!n.isArea()||r.isNull(i)||(0===r.getDelta(i)?n.toLine(i):(Tu.isTrue(!r.isNull(i,ih.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,ih.LEFT,r.getLocation(i,ih.LEFT)),Tu.isTrue(!r.isNull(i,ih.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,ih.RIGHT,r.getLocation(i,ih.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(nf);of.overlayOp=function(t,e,n){return new of(t,e).getResultGeometry(n)},of.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return of.createEmptyResult(of.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return bp.map(t,{interfaces_:function(){return[rf.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.INTERSECTION)},of.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return of.createEmptyResult(of.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.SYMDIFFERENCE)},of.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case of.INTERSECTION:o=Math.min(r,i);break;case of.UNION:o=Math.max(r,i);break;case of.DIFFERENCE:o=r;break;case of.SYMDIFFERENCE:o=Math.max(r,i)}return o},of.createEmptyResult=function(t,e,n,r){var i=null;switch(of.resultDimension(t,e,n)){case-1:i=r.createGeometryCollection(new Array(0).fill(null));break;case 0:i=r.createPoint();break;case 1:i=r.createLineString();break;case 2:i=r.createPolygon()}return i},of.difference=function(t,e){return t.isEmpty()?of.createEmptyResult(of.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.DIFFERENCE))},of.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return of.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===su.BOUNDARY&&(i=su.INTERIOR),o===su.BOUNDARY&&(o=su.INTERIOR),s){case of.INTERSECTION:return i===su.INTERIOR&&o===su.INTERIOR;case of.UNION:return i===su.INTERIOR||o===su.INTERIOR;case of.DIFFERENCE:return i===su.INTERIOR&&o!==su.INTERIOR;case of.SYMDIFFERENCE:return i===su.INTERIOR&&o!==su.INTERIOR||i!==su.INTERIOR&&o===su.INTERIOR}return!1}},of.INTERSECTION=1,of.UNION=2,of.DIFFERENCE=3,of.SYMDIFFERENCE=4;var sf=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new rp,this._seg=new Hh;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};sf.prototype.isWithinToleranceOfBoundary=function(t){for(var e=0;e<this._linework.getNumGeometries();e++)for(var n=this._linework.getGeometryN(e).getCoordinateSequence(),r=0;r<n.size()-1;r++)if(n.getCoordinate(r,this._seg.p0),n.getCoordinate(r+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},sf.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?su.BOUNDARY:this._ptLocator.locate(t,this._g)},sf.prototype.extractLinework=function(t){var e=new af;t.apply(e);var n=e.getLinework(),r=Zc.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},sf.prototype.interfaces_=function(){return[]},sf.prototype.getClass=function(){return sf};var af=function(){this._linework=null,this._linework=new nc};af.prototype.getLinework=function(){return this._linework},af.prototype.filter=function(t){if(t instanceof Rc){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},af.prototype.interfaces_=function(){return[vc]},af.prototype.getClass=function(){return af};var uf=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};uf.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i<r.length-1;i++)this.computeOffsetPoints(r[i],r[i+1],e,n)},uf.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},uf.prototype.getPoints=function(t){for(var e=new nc,n=np.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},uf.prototype.computeOffsetPoints=function(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=n*i/s,u=n*o/s,c=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var l=new nu(c-u,h+a);r.add(l)}if(this._doRight){var p=new nu(c+u,h-a);r.add(p)}},uf.prototype.interfaces_=function(){return[]},uf.prototype.getClass=function(){return uf};var cf=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new nc;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new sf(this._geom[0],this._boundaryDistanceTolerance),new sf(this._geom[1],this._boundaryDistanceTolerance),new sf(this._geom[2],this._boundaryDistanceTolerance)]},hf={TOLERANCE:{configurable:!0}};cf.prototype.reportResult=function(t,e,n){wu.out.println("Overlay result invalid - A:"+su.toLocationSymbol(e[0])+" B:"+su.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+su.toLocationSymbol(e[2]))},cf.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},cf.prototype.checkValid=function(){if(1===arguments.length){for(var t=arguments[0],e=0;e<this._testCoords.size();e++){var n=this._testCoords.get(e);if(!this.checkValid(t,n))return this._invalidLocation=n,!1}return!0}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._location[0]=this._locFinder[0].getLocation(i),this._location[1]=this._locFinder[1].getLocation(i),this._location[2]=this._locFinder[2].getLocation(i),!!cf.hasLocation(this._location,su.BOUNDARY)||this.isValidResult(r,this._location)}},cf.prototype.addTestPts=function(t){var e=new uf(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},cf.prototype.isValidResult=function(t,e){var n=of.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===su.INTERIOR);return r||this.reportResult(t,e,n),r},cf.prototype.getInvalidLocation=function(){return this._invalidLocation},cf.prototype.interfaces_=function(){return[]},cf.prototype.getClass=function(){return cf},cf.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},cf.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Mp.computeSizeBasedSnapTolerance(t),Mp.computeSizeBasedSnapTolerance(e))},cf.isValid=function(t,e,n,r){return new cf(t,e,r).isValid(n)},hf.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(cf,hf);var lf=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};lf.prototype.extractElements=function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);this._skipEmpty&&r.isEmpty()||e.add(r)}},lf.prototype.combine=function(){for(var t=new nc,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},lf.prototype.interfaces_=function(){return[]},lf.prototype.getClass=function(){return lf},lf.combine=function(){if(1===arguments.length){var t=arguments[0];return new lf(t).combine()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return new lf(lf.createList(e,n)).combine()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];return new lf(lf.createList(r,i,o)).combine()}},lf.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},lf.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new nc;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new nc;return s.add(r),s.add(i),s.add(o),s}};var pf=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new nc)},ff={STRTREE_NODE_CAPACITY:{configurable:!0}};pf.prototype.reduceToGeometries=function(t){for(var e=new nc,n=t.iterator();n.hasNext();){var r=n.next(),i=null;uu(r,ec)?i=this.unionTree(r):r instanceof ju&&(i=r),e.add(i)}return e},pf.prototype.extractByEnvelope=function(t,e,n){for(var r=new nc,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},pf.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return lf.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},pf.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new Gh(pf.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var r=t.itemsTree();return this.unionTree(r)},pf.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];if(r-n<=1){var i=pf.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(pf.getGeometry(e,n),pf.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},pf.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var r=n.next();e=null===e?r.copy():e.union(r)}return e},pf.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},pf.prototype.unionActual=function(t,e){return pf.restrictToPolygons(t.union(e))},pf.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},pf.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new nc,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),lf.combine(r)},pf.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf},pf.restrictToPolygons=function(t){if(uu(t,Oc))return t;var e=ep.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(Zc.toPolygonArray(e))},pf.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},pf.union=function(t){return new pf(t).union()},ff.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(pf,ff);var gf=function(){};gf.prototype.interfaces_=function(){return[]},gf.prototype.getClass=function(){return gf},gf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return of.createEmptyResult(of.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qp.overlayOp(t,e,of.UNION)};var df=function(){return new Ti};Ti.prototype={constructor:Ti,reset:function(){this.s=this.t=0},add:function(t){Ai(yf,t,this.t),Ai(this,yf.s,this.s),this.s?this.t+=yf.t:this.s=yf.t},valueOf:function(){return this.s}};var yf=new Ti,_f=1e-6,mf=Math.PI,vf=mf/2,xf=mf/4,Ef=2*mf,wf=180/mf,bf=mf/180,If=Math.abs,Nf=Math.atan,Cf=Math.atan2,Sf=Math.cos,Mf=Math.exp,Lf=Math.log,Pf=Math.sin,Of=Math.sqrt,Rf=Math.tan,Tf={Feature:function(t,e){qi(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)qi(n[r].geometry,e)}},Af={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Gi(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Gi(n[r],e,0)},Polygon:function(t,e){Bi(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Bi(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)qi(n[r],e)}},Df=function(t,e){t&&Tf.hasOwnProperty(t.type)?Tf[t.type](t,e):qi(t,e)},Ff=(df(),df(),df(),function(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n});Hi.invert=Hi;var qf=function(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:Fi,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}},Gf=function(t,e,n,r,i,o){var s,a=t[0],u=t[1],c=0,h=1,l=e[0]-a,p=e[1]-u;if(s=n-a,l||!(s>0)){if(s/=l,l<0){if(s<c)return;s<h&&(h=s)}else if(l>0){if(s>h)return;s>c&&(c=s)}if(s=i-a,l||!(s<0)){if(s/=l,l<0){if(s>h)return;s>c&&(c=s)}else if(l>0){if(s<c)return;s<h&&(h=s)}if(s=r-u,p||!(s>0)){if(s/=p,p<0){if(s<c)return;s<h&&(h=s)}else if(p>0){if(s>h)return;s>c&&(c=s)}if(s=o-u,p||!(s<0)){if(s/=p,p<0){if(s>h)return;s>c&&(c=s)}else if(p>0){if(s<c)return;s<h&&(h=s)}return c>0&&(t[0]=a+c*l,t[1]=u+c*p),h<1&&(e[0]=a+h*l,e[1]=u+h*p),!0}}}}},Bf=function(t,e){return If(t[0]-e[0])<_f&&If(t[1]-e[1])<_f},kf=function(t,e,n,r,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],s=t[e];if(Bf(r,s)){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else a.push(n=new $i(r,t,null,!0)),u.push(n.o=new $i(r,null,n,!1)),a.push(n=new $i(s,t,null,!1)),u.push(n.o=new $i(s,null,n,!0))}})),a.length){for(u.sort(e),to(a),to(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;for(var c,h,l=a[0];;){for(var p=l,f=!0;p.v;)if((p=p.n)===l)return;c=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(o=0,s=c.length;o<s;++o)i.point((h=c[o])[0],h[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(f)for(c=p.p.z,o=c.length-1;o>=0;--o)i.point((h=c[o])[0],h[1]);else r(p.x,p.p.x,-1,i);p=p.p}c=(p=p.o).z,f=!f}while(!p.v);i.lineEnd()}}},zf=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},jf=(function(t){1===t.length&&(t=function(t){return function(e,n){return zf(t(e),n)}}(t))}(zf),function(t){for(var e,n,r,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(n=new Array(s);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--s]=r[e];return n}),Xf=1e9,Uf=-Xf,Yf=df(),Vf=(df(),function(t){return t}),Hf=(df(),df(),1/0),Wf=Hf,Jf=-Hf,Zf=Jf,Kf={point:function(t,e){t<Hf&&(Hf=t),t>Jf&&(Jf=t),e<Wf&&(Wf=e),e>Zf&&(Zf=e)},lineStart:Fi,lineEnd:Fi,polygonStart:Fi,polygonEnd:Fi,result:function(){var t=[[Hf,Wf],[Jf,Zf]];return Jf=Zf=-(Wf=Hf=1/0),t}},Qf=(df(),function(t,e,n,r){return function(i,o){function s(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function a(t,e){var n=i(t,e);y.point(n[0],n[1])}function u(){E.point=a,y.lineStart()}function c(){E.point=s,y.lineEnd()}function h(t,e){d.push([t,e]);var n=i(t,e);v.point(n[0],n[1])}function l(){v.lineStart(),d=[]}function p(){h(d[0][0],d[0][1]),v.lineEnd();var t,e,n,r,i=v.clean(),s=m.result(),a=s.length;if(d.pop(),f.push(d),d=null,a)if(1&i){if((e=(n=s[0]).length-1)>0){for(x||(o.polygonStart(),x=!0),o.lineStart(),t=0;t<e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else a>1&&2&i&&s.push(s.pop().concat(s.shift())),g.push(s.filter(no))}var f,g,d,y=e(o),_=i.invert(r[0],r[1]),m=qf(),v=e(m),x=!1,E={point:s,lineStart:u,lineEnd:c,polygonStart:function(){E.point=h,E.lineStart=l,E.lineEnd=p,g=[],f=[]},polygonEnd:function(){E.point=s,E.lineStart=u,E.lineEnd=c,g=jf(g);var t=function(t,e){var n=e[0],r=e[1],i=[Pf(n),-Sf(n),0],o=0,s=0;Yf.reset();for(var a=0,u=t.length;a<u;++a)if(h=(c=t[a]).length)for(var c,h,l=c[h-1],p=l[0],f=l[1]/2+xf,g=Pf(f),d=Sf(f),y=0;y<h;++y,p=m,g=x,d=E,l=_){var _=c[y],m=_[0],v=_[1]/2+xf,x=Pf(v),E=Sf(v),w=m-p,b=w>=0?1:-1,I=b*w,N=I>mf,C=g*x;if(Yf.add(Cf(C*b*Pf(I),d*E+C*Sf(I))),o+=N?w+b*Ef:w,N^p>=n^m>=n){var S=Xi(zi(l),zi(_));Vi(S);var M=Xi(i,S);Vi(M);var L=(N^w>=0?-1:1)*Di(M[2]);(r>L||r===L&&(S[0]||S[1]))&&(s+=N^w>=0?1:-1)}}return(o<-_f||o<_f&&Yf<-_f)^1&s}(f,_);g.length?(x||(o.polygonStart(),x=!0),kf(g,ro,t,n,o)):t&&(x||(o.polygonStart(),x=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),x&&(o.polygonEnd(),x=!1),g=f=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};return E}}),$f=Qf((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?mf:-mf,u=If(o-n);If(u-mf)<_f?(t.point(n,r=(r+s)/2>0?vf:-vf),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=mf&&(If(n-i)<_f&&(n-=i*_f),If(o-a)<_f&&(o-=a*_f),r=function(t,e,n,r){var i,o,s=Pf(t-n);return If(s)>_f?Nf((Pf(e)*(o=Sf(r))*Pf(n)-Pf(r)*(i=Sf(e))*Pf(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*vf,r.point(-mf,i),r.point(0,i),r.point(mf,i),r.point(mf,0),r.point(mf,-i),r.point(0,-i),r.point(-mf,-i),r.point(-mf,0),r.point(-mf,i);else if(If(t[0]-e[0])>_f){var o=t[0]<e[0]?mf:-mf;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-mf,-vf]),tg=function(t,e){function n(t,e){return Sf(t)*Sf(e)>o}function r(t,e,n){var r=[1,0,0],i=Xi(zi(t),zi(e)),s=ji(i,i),a=i[0],u=s-a*a;if(!u)return!n&&t;var c=o*s/u,h=-o*a/u,l=Xi(r,i),p=Yi(r,c);Ui(p,Yi(i,h));var f=l,g=ji(p,f),d=ji(f,f),y=g*g-d*(ji(p,p)-1);if(!(y<0)){var _=Of(y),m=Yi(f,(-g-_)/d);if(Ui(m,p),m=ki(m),!n)return m;var v,x=t[0],E=e[0],w=t[1],b=e[1];E<x&&(v=x,x=E,E=v);var I=E-x,N=If(I-mf)<_f;if(!N&&b<w&&(v=w,w=b,b=v),N||I<_f?N?w+b>0^m[1]<(If(m[0]-x)<_f?w:b):w<=m[1]&&m[1]<=b:I>mf^(x<=m[0]&&m[0]<=E)){var C=Yi(f,(-g+_)/d);return Ui(C,p),[m,ki(C)]}}}function i(e,n){var r=s?t:mf-t,i=0;return e<-r?i|=1:e>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var o=Sf(t),s=o>0,a=If(o)>_f;return Qf(n,(function(t){var e,o,u,c,h;return{lineStart:function(){c=u=!1,h=1},point:function(l,p){var f,g=[l,p],d=n(l,p),y=s?d?0:i(l,p):d?i(l+(l<0?mf:-mf),p):0;if(!e&&(c=u=d)&&t.lineStart(),d!==u&&(!(f=r(e,g))||Bf(e,f)||Bf(g,f))&&(g[0]+=_f,g[1]+=_f,d=n(g[0],g[1])),d!==u)h=0,d?(t.lineStart(),f=r(g,e),t.point(f[0],f[1])):(f=r(e,g),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(a&&e&&s^d){var _;y&o||!(_=r(g,e,!0))||(h=0,s?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1])))}!d||e&&Bf(e,g)||t.point(g[0],g[1]),e=g,u=d,o=y},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return h|(c&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=Sf(e),a=Pf(e),u=r*n;null==i?(i=e+r*Ef,o=e-u/2):(i=Qi(s,i),o=Qi(s,o),(r>0?i<o:i>o)&&(i+=r*Ef));for(var c,h=i;r>0?h>o:h<o;h-=u)c=ki([s,-a*Sf(h),-a*Pf(h)]),t.point(c[0],c[1])}}(o,t,e,i,n,r)}),s?[0,-t]:[-mf,t-mf])};oo.prototype={constructor:oo,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var eg=Sf(30*bf),ng=function(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,c,h,l,p,f,g,d,y){var _=c-r,m=h-i,v=_*_+m*m;if(v>4*e&&d--){var x=s+p,E=a+f,w=u+g,b=Of(x*x+E*E+w*w),I=Di(w/=b),N=If(If(w)-1)<_f||If(o-l)<_f?(o+l)/2:Cf(E,x),C=t(N,I),S=C[0],M=C[1],L=S-r,P=M-i,O=m*L-_*P;(O*O/v>e||If((_*L+m*P)/v-.5)>.3||s*p+a*f+u*g<eg)&&(n(r,i,o,s,a,u,S,M,N,x/=b,E/=b,w,d,y),y.point(S,M),n(S,M,N,x,E,w,c,h,l,p,f,g,d,y))}}return function(e){function r(n,r){n=t(n,r),e.point(n[0],n[1])}function i(){_=NaN,w.point=o,e.lineStart()}function o(r,i){var o=zi([r,i]),s=t(r,i);n(_,m,y,v,x,E,_=s[0],m=s[1],y=r,v=o[0],x=o[1],E=o[2],16,e),e.point(_,m)}function s(){w.point=r,e.lineEnd()}function a(){i(),w.point=u,w.lineEnd=c}function u(t,e){o(h=t,e),l=_,p=m,f=v,g=x,d=E,w.point=o}function c(){n(_,m,y,v,x,E,l,p,h,f,g,d,16,e),w.lineEnd=s,s()}var h,l,p,f,g,d,y,_,m,v,x,E,w={point:r,lineStart:i,lineEnd:s,polygonStart:function(){e.polygonStart(),w.lineStart=a},polygonEnd:function(){e.polygonEnd(),w.lineStart=i}};return w}}(t,e):function(t){return io({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)},rg=io({point:function(t,e){this.stream.point(t*bf,e*bf)}});ao.invert=function(t,e){return[t,2*Nf(Mf(e))-vf]},uo.invert=function(t,e){return[-e,2*Nf(Mf(t))-vf]};var ig=function(){var t=function(t){function e(){var e=mf*a(),s=o(function(t){function e(e){return(e=t(e[0]*bf,e[1]*bf))[0]*=wf,e[1]*=wf,e}return t=Wi(t[0]*bf,t[1]*bf,t.length>2?t[2]*bf:0),e.invert=function(e){return(e=t.invert(e[0]*bf,e[1]*bf))[0]*=wf,e[1]*=wf,e},e}(o.rotate()).invert([0,0]));return c(null==h?[[s[0]-e,s[1]-e],[s[0]+e,s[1]+e]]:t===ao?[[Math.max(s[0]-e,h),n],[Math.min(s[0]+e,r),i]]:[[h,Math.max(s[1]-e,n)],[r,Math.min(s[1]+e,i)]])}var n,r,i,o=function(t){return function(t){function e(t){return[(t=c(t[0]*bf,t[1]*bf))[0]*d+s,a-t[1]*d]}function n(t,e){return[(t=o(t,e))[0]*d+s,a-t[1]*d]}function r(){c=Ff(u=Wi(x,E,w),o);var t=o(m,v);return s=y-t[0]*d,a=_+t[1]*d,i()}function i(){return f=g=null,e}var o,s,a,u,c,h,l,p,f,g,d=150,y=480,_=250,m=0,v=0,x=0,E=0,w=0,b=null,I=$f,N=null,C=Vf,S=.5,M=ng(n,S);return e.stream=function(t){return f&&g===t?f:f=rg(I(u,M(C(g=t))))},e.clipAngle=function(t){return arguments.length?(I=+t?tg(b=t*bf,6*bf):(b=null,$f),i()):b*wf},e.clipExtent=function(t){return arguments.length?(C=null==t?(N=h=l=p=null,Vf):eo(N=+t[0][0],h=+t[0][1],l=+t[1][0],p=+t[1][1]),i()):null==N?null:[[N,h],[l,p]]},e.scale=function(t){return arguments.length?(d=+t,r()):d},e.translate=function(t){return arguments.length?(y=+t[0],_=+t[1],r()):[y,_]},e.center=function(t){return arguments.length?(m=t[0]%360*bf,v=t[1]%360*bf,r()):[m*wf,v*wf]},e.rotate=function(t){return arguments.length?(x=t[0]%360*bf,E=t[1]%360*bf,w=t.length>2?t[2]%360*bf:0,r()):[x*wf,E*wf,w*wf]},e.precision=function(t){return arguments.length?(M=ng(n,S=t*t),i()):Of(S)},e.fitExtent=function(t,n){return so(e,t,n)},e.fitSize=function(t,n){return function(t,e,n){return so(t,[[0,0],e],n)}(e,t,n)},function(){return o=t.apply(this,arguments),e.invert=o.invert&&function(t){return(t=c.invert((t[0]-s)/d,(a-t[1])/d))&&[t[0]*wf,t[1]*wf]},r()}}((function(){return t}))()}(t),s=o.center,a=o.scale,u=o.translate,c=o.clipExtent,h=null;return o.scale=function(t){return arguments.length?(a(t),e()):a()},o.translate=function(t){return arguments.length?(u(t),e()):u()},o.center=function(t){return arguments.length?(s(t),e()):s()},o.clipExtent=function(t){return arguments.length?(null==t?h=n=r=i=null:(h=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),e()):null==h?null:[[h,n],[r,i]]},e()}(uo),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)};t.projection=hs,t.random=Ha,t.clusters=Wa,t.helpers=Co,t.invariant=Mo,t.meta=So,t.isolines=function(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(W(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!I(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;W(t,"Point","input must contain Points");for(var o=function(t,e){var n={};return O(t,(function(t){var e=U(t)[1];n[e]||(n[e]=[]),n[e].push(t)})),Object.keys(n).map((function(t){return n[t].sort((function(t,e){return U(t)[0]-U(e)[0]}))})).sort((function(t,n){return e?U(t[0])[1]-U(n[0])[1]:U(n[0])[1]-U(t[0])[1]}))}(t,r),s=[],a=0;a<o.length;a++){for(var u=o[a],c=[],h=0;h<u.length;h++){var l=u[h];l.properties[n]?c.push(l.properties[n]):c.push(0),!0===i&&(l.properties.matrixPosition=[a,h])}s.push(c)}return s}(t,{zProperty:r,flip:!0});return c(function(t,e,n){var r=j(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,c=e.length-1,h=i/u,l=o/c,p=function(t){t[0]=t[0]*h+s,t[1]=t[1]*l+a};return t.forEach((function(t){S(t,p)})),t}(function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Object.assign({},r,i[s]);u[n]=a;var c=h(Q(t,a),u);o.push(c)}return o}(s,e,r,i,o),s,t))},t.convex=St,t.pointsWithinPolygon=Pt,t.concave=function(t,n){if(!I(n=n||{}))throw new Error("options is invalid");if(!t)throw new Error("points is required");var r=n.maxEdge||1/0;if(!b(r))throw new Error("maxEdge is invalid");var i=Ot(function(t){var e=[],n={};return O(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join("-");n.hasOwnProperty(r)||(e.push(t),n[r]=!0)}})),c(e)}(t));if(i.features=i.features.filter((function(t){var e=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Dt(e,i,n),a=Dt(i,o,n),u=Dt(e,o,n);return s<=r&&a<=r&&u<=r})),i.features.length<1)return null;var o=Wt(i,n);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),e(o)},t.collect=function(t,e,n,r){var i=Ro(6),o=e.features.map((function(t){return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:t.properties[n]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=j(t),n=[];i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}).forEach((function(e){Mt([e.minX,e.minY],t)&&n.push(e.property)})),t.properties[r]=n})),t},t.flip=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return!1!==n&&void 0!==n||(t=Ft(t)),S(t,(function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e})),t},t.simplify=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=void 0!==e.tolerance?e.tolerance:1,r=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(n&&n<0)throw new Error("invalid tolerance");return!0!==i&&(t=Ft(t)),A(t,(function(t){!function(t,e,n){var r=t.type;if("Point"===r||"MultiPoint"===r)return t;Jt(t,!0);var i=t.coordinates;switch(r){case"LineString":t.coordinates=te(i,e,n);break;case"MultiLineString":t.coordinates=i.map((function(t){return te(t,e,n)}));break;case"Polygon":t.coordinates=ee(i,e,n);break;case"MultiPolygon":t.coordinates=i.map((function(t){return ee(t,e,n)}))}}(t,n,r)})),t},t.bezierSpline=ne,t.tag=function(t,e,n,r){return t=Ft(t),e=Ft(e),O(t,(function(t){t.properties||(t.properties={}),O(e,(function(e){void 0===t.properties[r]&&Mt(t,e)&&(t.properties[r]=e.properties[n])}))})),t},t.sample=function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");return c(function(t,e){for(var n,r,i=t.slice(0),o=t.length,s=o-e;o-- >s;)n=i[r=Math.floor((o+1)*Math.random())],i[r]=i[o],i[o]=n;return i.slice(s)}(t.features,e))},t.envelope=ie,t.square=oe,t.circle=ae,t.midpoint=function(t,e){return se(t,Dt(t,e)/2,ue(t,e))},t.center=ce,t.centerOfMass=function t(e,n){switch(K(e)){case"Point":return e;case"Polygon":var i=[];S(e,(function(t){i.push(t)}));var o,s,a,u,c,h,l,p,f=he(e,n),g=f.geometry.coordinates,d=0,y=0,_=0,m=i.map((function(t){return[t[0]-g[0],t[1]-g[1]]}));for(o=0;o<i.length-1;o++)u=(s=m[o])[0],h=s[1],c=(a=m[o+1])[0],_+=p=u*(l=a[1])-c*h,d+=(u+c)*p,y+=(h+l)*p;if(0===_)return f;var v=1/(.5*_*6);return r([g[0]+v*d,g[1]+v*y],n);default:var x=St(e);return x?t(x,n):he(e,n)}},t.centroid=he,t.combine=function(t){function n(t,e,n){n?r[e].coordinates=r[e].coordinates.concat(t.geometry.coordinates):r[e].coordinates.push(t.geometry.coordinates),r[e].properties.push(t.properties)}var r={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}},i=Object.keys(r).reduce((function(t,e){return t[e.replace("Multi","")]=e,t}),{});return O(t,(function(t){t.geometry&&(r[t.geometry.type]?n(t,t.geometry.type,!0):i[t.geometry.type]&&n(t,i[t.geometry.type],!1))})),c(Object.keys(r).filter((function(t){return r[t].coordinates.length})).sort().map((function(t){return e({type:t,coordinates:r[t].coordinates},{collectedProperties:r[t].properties})})))},t.distance=Dt,t.explode=le,t.bbox=j,t.tesselate=function(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=Se(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Se(t))})),e},t.bboxPolygon=re,t.booleanPointInPolygon=Mt,t.nearestPoint=Me,t.nearestPointOnLine=Je,t.nearestPointToLine=function(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.units,i=n.properties||{};if(!t)throw new Error("points is required");if(!(t=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return A(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t)).features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==K(e))throw new Error("line must be a LineString");var o=1/0,s=null;return O(t,(function(t){var n=on(t,e,{units:r});n<o&&(o=n,s=t)})),s&&(s.properties=Object.assign({dist:o},s.properties,i)),s},t.planepoint=function(t,e){var n=X(t),r=J(e).coordinates[0];if(r.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=n[0],c=n[1],h=r[0][0],l=r[0][1],p=void 0!==o?o:r[0][2],f=r[1][0],g=r[1][1],d=void 0!==s?s:r[1][2],y=r[2][0],_=r[2][1],m=void 0!==a?a:r[2][2];return(m*(u-h)*(c-g)+p*(u-f)*(c-_)+d*(u-y)*(c-l)-d*(u-h)*(c-_)-m*(u-f)*(c-l)-p*(u-y)*(c-g))/((u-h)*(c-g)+(u-f)*(c-_)+(u-y)*(c-l)-(u-h)*(c-_)-(u-f)*(c-l)-(u-y)*(c-g))},t.tin=Ot,t.bearing=ue,t.destination=se,t.kinks=function(t){var e,n,i={type:"FeatureCollection",features:[]};if("LineString"===(n="Feature"===t.type?t.geometry:t).type)e=[n.coordinates];else if("MultiLineString"===n.type)e=n.coordinates;else if("MultiPolygon"===n.type)e=[].concat.apply([],n.coordinates);else{if("Polygon"!==n.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=n.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var n=0;n<t.length-1;n++)for(var o=n;o<e.length-1;o++){if(t===e){if(1===Math.abs(n-o))continue;if(0===n&&o===t.length-2&&t[n][0]===t[t.length-1][0]&&t[n][1]===t[t.length-1][1])continue}var s=function(t,e,n,r,i,o,s,a){var u,c,h,l,p={x:null,y:null,onLine1:!1,onLine2:!1};return 0==(u=(a-o)*(n-t)-(s-i)*(r-e))?null!==p.x&&null!==p.y&&p:(l=(n-t)*(c=e-o)-(r-e)*(h=t-i),c=((s-i)*c-(a-o)*h)/u,h=l/u,p.x=t+c*(n-t),p.y=e+c*(r-e),c>=0&&c<=1&&(p.onLine1=!0),h>=0&&h<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y])}(t[n][0],t[n][1],t[n+1][0],t[n+1][1],e[o][0],e[o][1],e[o+1][0],e[o+1][1]);s&&i.features.push(r([s[0],s[1]]))}}))})),i},t.pointOnFeature=an,t.area=cn,t.along=function(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var i;if("Feature"===t.type)i=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}if(!b(e))throw new Error("distance must be a number");for(var o=0,s=0;s<i.length&&!(e>=o&&s===i.length-1);s++){if(o>=e){var a=e-o;if(a){var u=ue(i[s],i[s-1])-180;return se(i[s],a,u,n)}return r(i[s])}o+=Dt(i[s],i[s+1],n)}return r(i[i.length-1])},t.length=fn,t.lineSlice=function(t,e,n){var r=U(n);if("LineString"!==K(n))throw new Error("line must be a LineString");for(var i,o=Je(n,t),s=Je(n,e),u=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],c=i[0].properties.index+1;c<i[1].properties.index+1;c++)u.push(r[c]);return u.push(i[1].geometry.coordinates),a(u,n.properties)},t.lineSliceAlong=gn,t.pointGrid=vn,t.truncate=xn,t.flatten=function(t){if(!t)throw new Error("geojson is required");var e=[];return F(t,(function(t){e.push(t)})),c(e)},t.lineIntersect=He,t.lineChunk=function(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.units,i=n.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return F(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,n,r){var i=fn(t,{units:n});if(i<=e)return r(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++)r(gn(t,e*s,e*(s+1),{units:n}))}(t,e,r,(function(t){o.push(t)}))})),c(o)},t.unkinkPolygon=function(t){var e=[];return F(t,(function(t){"Polygon"===t.geometry.type&&O(ps(t),(function(n){e.push(o(n.geometry.coordinates,t.properties))}))})),c(e)},t.greatCircle=function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.npoints,o=n.offset;return t=X(t),e=X(e),r=r||{},i=i||100,o=o||10,new xs({x:t[0],y:t[1]},{x:e[0],y:e[1]},r).Arc(i,{offset:o}).json()},t.lineSegment=Ve,t.lineSplit=function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=K(t),r=K(e);if("LineString"!==n)throw new Error("line must be LineString");if("FeatureCollection"===r)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===r)throw new Error("splitter cannot be a GeometryCollection");var i=xn(e,{precision:7});switch(r){case"Point":return Nn(t,i);case"MultiPoint":return In(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return In(t,He(t,i))}},t.lineArc=Mn,t.polygonToLine=Pn,t.lineToPolygon=Rn,t.bboxClip=function(t,e){var n=function(t){return t.geometry?t.geometry.type:t.type}(t),r=U(t),i=t.properties;switch(n){case"LineString":case"MultiLineString":var s=[];return"LineString"===n&&(r=[r]),r.forEach((function(t){Es(t,e,s)})),1===s.length?a(s[0],i):h(s,i);case"Polygon":return o(Gn(r,e),i);case"MultiPolygon":return p(r.map((function(t){return Gn(t,e)})),i);default:throw new Error("geometry "+n+" not supported")}},t.lineOverlap=Xn,t.sector=function(t,e,n,r,i){if(!I(i=i||{}))throw new Error("options is invalid");if(!t)throw new Error("center is required");if(null==n)throw new Error("bearing1 is required");if(null==r)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(Yn(n)===Yn(r))return ae(t,e,i);var s=U(t),a=[[s]];return S(Mn(t,e,n,r,i),(function(t){a[0].push(t)})),a[0].push(s),o(a)},t.rhumbBearing=Ze,t.rhumbDistance=Qe,t.rhumbDestination=Vn,t.polygonTangents=function(t,e){var n,i,o,s=U(t),a=U(e);switch(K(e)){case"Polygon":n=a[0][0],i=a[0][0],o=Wn(a[0][0],a[0][a[0].length-1],s);var u=Hn(a[0],s,o,void 0,n,i);n=u[0],i=u[1];break;case"MultiPolygon":n=a[0][0][0],i=a[0][0][0],o=Wn(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=Hn(t[0],s,o,void 0,n,i);n=e[0],i=e[1]}))}return c([r(n),r(i)])},t.rewind=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof n)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof r)throw new Error("<mutate> must be a boolean");!1===r&&(t=Ft(t));var i=[];switch(t.type){case"GeometryCollection":return A(t,(function(t){Zn(t,n)})),t;case"FeatureCollection":return O(t,(function(t){O(Zn(t,n),(function(t){i.push(t)}))})),c(i)}return Zn(t,n)},t.isobands=function(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},s=n.breaksProperties||[];if(W(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!I(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(s))throw new Error("breaksProperties is not an Array");var a=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;W(t,"Point","input must contain Points");for(var o=function(t,e){var n={};return O(t,(function(t){var e=U(t)[1];n[e]||(n[e]=[]),n[e].push(t)})),Object.keys(n).map((function(t){return n[t].sort((function(t,e){return U(t)[0]-U(e)[0]}))})).sort((function(t,n){return e?U(t[0])[1]-U(n[0])[1]:U(n[0])[1]-U(t[0])[1]}))}(t,r),s=[],a=0;a<o.length;a++){for(var u=o[a],c=[],h=0;h<u.length;h++){var l=u[h];l.properties[n]?c.push(l.properties[n]):c.push(0),!0===i&&(l.properties.matrixPosition=[a,h])}s.push(c)}return s}(t,{zProperty:r,flip:!0}),u=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var s=+e[i-1],a=+e[i],u=function(t){for(var e=t.map((function(t){return{lrCoordinates:t,grouped:!1}})),n=[];!function(t){for(var e=0;e<t.length;e++)if(!1===t[e].grouped)return!1;return!0}(e);)for(var r=0;r<e.length;r++)if(!e[r].grouped){var i=[];i.push(e[r].lrCoordinates),e[r].grouped=!0;for(var s=o([e[r].lrCoordinates]),a=r+1;a<e.length;a++)e[a].grouped||function(t,e){for(var n=le(t),r=0;r<n.features.length;r++)if(!Mt(n.features[r],e))return!1;return!0}(o([e[a].lrCoordinates]),s)&&(i.push(e[a].lrCoordinates),e[a].grouped=!0);n.push(i)}return n}(function(t){var e=[],n=[];t.forEach((function(t){var r=cn(o([t]));n.push(r),e.push({ring:t,area:r})})),n.sort((function(t,e){return e-t}));var r=[];return n.forEach((function(t){for(var n=0;n<e.length;n++)if(e[n].area===t){r.push(e[n].ring),e.splice(n,1);break}})),r}($n(t,s,a-s))),c={};c.groupedRings=u,c[n]=s+"-"+a,r.push(c)}return r}(a,e,r);return c((u=function(t,e,n){var r=j(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,c=e.length-1,h=i/u,l=o/c,p=function(t){t[0]=t[0]*h+s,t[1]=t[1]*l+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(p)}))}))})),t}(u,a,t)).map((function(t,e){if(s[e]&&!I(s[e]))throw new Error("Each mappedProperty is required to be an Object");var n=Object.assign({},i,s[e]);return n[r]=t[r],p(t.groupedRings,n)})))},t.transformRotate=nr,t.transformScale=rr,t.transformTranslate=function(t,e,n,r){if(!I(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.zTranslation,s=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=-n),!1!==s&&void 0!==s||(t=Ft(t)),S(t,(function(t){var r=U(Vn(t,e,n,{units:i}));t[0]=r[0],t[1]=r[1],o&&3===t.length&&(t[2]+=o)})),t},t.lineOffset=function(t,e,n){if(!I(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=K(t),o=t.properties;switch(i){case"LineString":return ar(t,e,r);case"MultiLineString":var s=[];return F(t,(function(t){s.push(ar(t,e,r).geometry.coordinates)})),h(s,o);default:throw new Error("geometry "+i+" is not supported")}},t.polygonize=function(t){var e=xa.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){ma.findEdgeRingContaining(t,r)&&r.push(t)})),c(r.map((function(t){return t.toPolygon()})))},t.booleanDisjoint=function(t,e){var n;return F(t,(function(t){F(e,(function(e){if(!1===n)return!1;n=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return!function(t,e){return t[0]===e[0]&&t[1]===e[1]}(t.coordinates,e.coordinates);case"LineString":return!hr(e,t);case"Polygon":return!Mt(t,e)}break;case"LineString":switch(e.type){case"Point":return!hr(t,e);case"LineString":return!function(t,e){return He(t,e).features.length>0}(t,e);case"Polygon":return!lr(e,t)}break;case"Polygon":switch(e.type){case"Point":return!Mt(e,t);case"LineString":return!lr(t,e);case"Polygon":return!function(t,e){for(var n=0;n<t.coordinates[0].length;n++)if(Mt(t.coordinates[0][n],e))return!0;for(var r=0;r<e.coordinates[0].length;r++)if(Mt(e.coordinates[0][r],t))return!0;return!1}(e,t)}}}(t.geometry,e.geometry)}))})),n},t.booleanContains=function(t,e){var n=K(t),r=K(e),i=J(t),o=J(e),s=U(t),a=U(e);switch(n){case"Point":switch(r){case"Point":return fr(s,a);default:throw new Error("feature2 "+r+" geometry not supported")}case"MultiPoint":switch(r){case"Point":return function(t,e){var n,r=!1;for(n=0;n<t.coordinates.length;n++)if(fr(t.coordinates[n],e.coordinates)){r=!0;break}return r}(i,o);case"MultiPoint":return function(t,e){for(var n=0;n<e.coordinates.length;n++){for(var r=!1,i=0;i<t.coordinates.length;i++)if(fr(e.coordinates[n],t.coordinates[i])){r=!0;break}if(!r)return!1}return!0}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"Point":return dn(o,i,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var n=!1,r=0;r<e.coordinates.length;r++)if(dn({type:"Point",coordinates:e.coordinates[r]},t,{ignoreEndVertices:!0})&&(n=!0),!dn({type:"Point",coordinates:e.coordinates[r]},t,{ignoreEndVertices:!1}))return!1;return n}(i,o);case"MultiPoint":return function(t,e){for(var n=!1,r=0;r<e.coordinates.length;r++)if(dn(e.coordinates[r],t,{ignoreEndVertices:!0})&&(n=!0),!dn(e.coordinates[r],t))return!1;return!!n}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"Point":return Mt(o,i,{ignoreBoundary:!0});case"LineString":return function(t,e){var n=!1,r=0;if(!pr(j(t),j(e)))return!1;for(;r<e.coordinates.length-1;r++)if(Mt({type:"Point",coordinates:function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}(e.coordinates[r],e.coordinates[r+1])},t,{ignoreBoundary:!0})){n=!0;break}return n}(i,o);case"Polygon":return function(t,e){if(!pr(j(t),j(e)))return!1;for(var n=0;n<e.coordinates[0].length;n++)if(!Mt(e.coordinates[0][n],t))return!1;return!0}(i,o);case"MultiPoint":return function(t,e){for(var n=0;n<e.coordinates.length;n++)if(!Mt(e.coordinates[n],t,{ignoreBoundary:!0}))return!1;return!0}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+n+" geometry not supported")}},t.booleanCrosses=function(t,e){var n=K(t),r=K(e),i=J(t),o=J(e);switch(n){case"MultiPoint":switch(r){case"LineString":return gr(i,o);case"Polygon":return yr(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"MultiPoint":return gr(o,i);case"LineString":return function(t,e){if(He(t,e).features.length>0)for(var n=0;n<t.coordinates.length-1;n++)for(var r=0;r<e.coordinates.length-1;r++){var i=!0;if(0!==r&&r!==e.coordinates.length-2||(i=!1),_r(t.coordinates[n],t.coordinates[n+1],e.coordinates[r],i))return!0}return!1}(i,o);case"Polygon":return dr(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"MultiPoint":return yr(o,i);case"LineString":return dr(o,i);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+n+" geometry not supported")}},t.booleanClockwise=Jn,t.booleanOverlap=Er,t.booleanPointOnLine=dn,t.booleanEqual=function(t,e){if(!t)throw new Error("feature1 is required");if(!e)throw new Error("feature2 is required");return K(t)===K(e)&&new Na({precision:6}).compare(Jt(t),Jt(e))},t.booleanWithin=yn,t.clone=Ft,t.cleanCoords=Jt,t.clustersDbscan=function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.minPoints,i=n.units;if(W(t,"Point","Input must contain Points"),null==e)throw new Error("maxDistance is required");if(!(Math.sign(e)>0))throw new Error("Invalid maxDistance");if(!(null==r||Math.sign(r)>0))throw new Error("Invalid minPoints");t=Ft(t),r=r||3;var o=new Pa.DBSCAN,s=-1;return o.run(T(t),E(e,i),r,Dt).forEach((function(e){s++,e.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster=s,n.properties.dbscan="core"}))})),o.noise.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster?n.properties.dbscan="edge":n.properties.dbscan="noise"})),t},t.clustersKmeans=function(t,e){if("object"!=typeof(e=e||{}))throw new Error("options is invalid");var n=e.numberOfClusters,r=e.mutate;W(t,"Point","Input must contain Points");var i=t.features.length;(n=n||Math.round(Math.sqrt(i/2)))>i&&(n=i),!1!==r&&void 0!==r||(t=Ft(t));var o=T(t),s=o.slice(0,n),a=Da(o,n,s),u={};return a.centroids.forEach((function(t,e){u[e]=t})),O(t,(function(t,e){var n=a.idxs[e];t.properties.cluster=n,t.properties.centroid=u[n]})),t},t.pointToLineDistance=on,t.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==br(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==br(e,"line2"))throw new Error("line2 must be a LineString");for(var n=Ve(Jt(t)).features,r=Ve(Jt(e)).features,i=0;i<n.length;i++){var o=n[i].geometry.coordinates;if(!r[i])break;if(!function(t,e){return m(Ze(t[0],t[1]))===m(Ze(e[0],e[1]))}(o,r[i].geometry.coordinates))return!1}return!0},t.shortestPath=function(t,n,i){if(!I(i=i||{}))throw new Error("options is invalid");var o=i.resolution,s=i.minDistance,u=i.obstacles||c([]);if(!t)throw new Error("start is required");if(!n)throw new Error("end is required");if(o&&!b(o)||o<=0)throw new Error("options.resolution must be a number, greater than 0");if(s)throw new Error("options.minDistance is not yet implemented");var h=X(t),l=X(n);switch(t=r(h),n=r(l),K(u)){case"FeatureCollection":if(0===u.features.length)return a([h,l]);break;case"Polygon":u=c([e(J(u))]);break;default:throw new Error("invalid obstacles")}var p=u;p.features.push(t),p.features.push(n);var f=j(rr(re(j(p)),1.15));o||(o=Dt([f[0],f[1]],[f[2],f[1]],i)/100),p.features.pop(),p.features.pop();for(var g=f[0],d=f[1],y=f[2],_=f[3],m=o/Dt([g,d],[y,d],i)*(y-g),v=o/Dt([g,d],[g,_],i)*(_-d),x=y-g,E=_-d,w=(x-Math.floor(x/m)*m)/2,N=[],C=[],S=[],M=[],L=1/0,P=1/0,O=_-(E-Math.floor(E/v)*v)/2,R=0;O>=d;){for(var T=[],A=[],D=g+w,F=0;D<=y;){var q=r([D,O]),G=function(t,e){for(var n=0;n<e.features.length;n++)if(Mt(t,e.features[n]))return!0;return!1}(q,u);T.push(G?0:1),A.push(D+"|"+O);var B=Dt(q,t);!G&&B<L&&(L=B,S={x:F,y:R});var k=Dt(q,n);!G&&k<P&&(P=k,M={x:F,y:R}),D+=m,F++}C.push(T),N.push(A),O-=v,R++}var z=new Nr(C,{diagonal:!0}),U=z.grid[S.y][S.x],Y=z.grid[M.y][M.x],V=[h];return Fa.search(z,U,Y).forEach((function(t){var e=N[t.x][t.y].split("|");V.push([+e[0],+e[1]])})),V.push(l),Jt(a(V))},t.voronoi=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(n))throw new Error("bbox is invalid");return W(t,"Point","points"),c(function(){function t(t){return new Qr(t.map((function(r,i){var o=[Math.round(e(r,i,t)/Ya)*Ya,Math.round(n(r,i,t)/Ya)*Ya];return o.index=i,o.data=r,o})),r)}var e=Mr,n=Lr,r=null;return t.polygons=function(e){return t(e).polygons()},t.links=function(e){return t(e).links()},t.triangles=function(e){return t(e).triangles()},t.x=function(n){return arguments.length?(e="function"==typeof n?n:qa(+n),t):e},t.y=function(e){return arguments.length?(n="function"==typeof e?e:qa(+e),t):n},t.extent=function(e){return arguments.length?(r=null==e?null:[[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]],t):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},t.size=function(e){return arguments.length?(r=null==e?null:[[0,0],[+e[0],+e[1]]],t):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},t}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[n[0],n[1]],[n[2],n[3]]]).polygons(t.features).map($r))},t.ellipse=ti,t.centerMean=ni,t.centerMedian=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!b(n))throw new Error("counter must be a number");var r=e.weight,i=ni(t,{weight:e.weight}),o=c([]);return O(t,(function(t){o.features.push(he(t,{weight:t.properties[r]}))})),o.properties={tolerance:e.tolerance,medianCandidates:[]},ri(i.geometry.coordinates,[0,0],o,n)},t.standardDeviationalEllipse=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!b(n))throw new Error("steps must be a number");if(!I(i))throw new Error("properties must be a number");var o=T(t).length,s=ni(t,{weight:r}),a=0,u=0,h=0;O(t,(function(t){var e=t.properties[r]||1,n=ii(U(t),U(s));a+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,h+=n.x*n.y*e}));var l=a-u,p=Math.sqrt(Math.pow(l,2)+4*Math.pow(h,2)),f=2*h,g=Math.atan((l+p)/f),d=180*g/Math.PI,y=0,_=0,m=0;O(t,(function(t){var e=t.properties[r]||1,n=ii(U(t),U(s));y+=Math.pow(n.x*Math.cos(g)-n.y*Math.sin(g),2)*e,_+=Math.pow(n.x*Math.sin(g)+n.y*Math.cos(g),2)*e,m+=e}));var v=Math.sqrt(2*y/m),x=Math.sqrt(2*_/m),E=ti(s,v,x,{units:"degrees",angle:d,steps:n,properties:i}),w=Pt(t,c([E])),N={meanCenterCoordinates:U(s),semiMajorAxis:v,semiMinorAxis:x,numberOfFeatures:o,angle:d,percentageWithinEllipse:100*T(w).length/o};return E.properties.standardDeviationalEllipse=N,E},t.difference=function(t,n){var r=J(t),i=J(n),o=t.properties||{};if(r=Ri(r),i=Ri(i),!r)return null;if(!i)return e(r,o);var s=new nh,a=s.read(r),u=s.read(i),c=of.difference(a,u);return c.isEmpty()?null:e((new rh).write(c),o)},t.buffer=function(t,e,n){var r=(n=n||{}).units,i=n.steps||64;if(!t)throw new Error("geojson is required");if("object"!=typeof n)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");i=i||64,r=r||"kilometers";var o=[];switch(t.type){case"GeometryCollection":return A(t,(function(t){var n=co(t,e,r,i);n&&o.push(n)})),c(o);case"FeatureCollection":return O(t,(function(t){var n=co(t,e,r,i);n&&O(n,(function(t){t&&o.push(t)}))})),c(o)}return co(t,e,r,i)},t.union=fo,t.intersect=go,t.dissolve=function(t,e){if(!I(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;W(t,"Polygon","dissolve");var r=Ft(t),i=r.features,o=[];i.forEach((function(t,e){t.properties.origIndexPosition=e}));var s=Xe();for(var u in s.load(r),i){var c=i[u],h=!1;if(s.search(c).features.forEach((function(t){c=i[u];var e=t.properties.origIndexPosition;if(o.length>0&&0!==e)if(e>o[o.length-1])e-=o.length;else{var r=yo(e,o);0!==r&&(e-=r)}if(e!==+u){var l=i[e];l&&c&&(void 0!==n&&l.properties[n]!==c.properties[n]||Er(c,l)&&function(t,e){return He(a(T(t)),a(T(e))).features.length>0}(c,l)&&(i[u]=fo(c,l),o.push(t.properties.origIndexPosition),o.sort((function(t,e){return t-e})),s.remove(t),i.splice(e,1),c.properties.origIndexPosition=u,s.remove(c,(function(t,e){return t.properties.origIndexPosition===e.properties.origIndexPosition})),h=!0))}})),h){if(!c)continue;c.properties.origIndexPosition=u,s.insert(c),u--}}return i.forEach((function(t){delete t.properties.origIndexPosition,delete t.bbox})),r},t.hexGrid=_o,t.mask=function(t,e){var n=function(t){return o(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}(e),r=function(t){var e=[],n=[];return F(t,(function(t){var r=t.geometry.coordinates,i=r[0],s=r.slice(1);e.push(o([i])),s.forEach((function(t){n.push(o([t]))}))})),[c(e),c(n)]}(t),i=r[0],s=r[1];return function(t,e,n){var r=[];return r.push(t.geometry.coordinates[0]),F(e,(function(t){r.push(t.geometry.coordinates[0])})),F(n,(function(t){r.push(t.geometry.coordinates[0])})),o(r)}(n,i=mo(i),s=mo(s))},t.squareGrid=xo,t.triangleGrid=Eo,t.interpolate=function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.gridType,i=n.property,o=n.weight;if(!t)throw new Error("points is required");if(W(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(void 0!==o&&"number"!=typeof o)throw new Error("weight must be a number");i=i||"elevation",r=r||"square",o=o||1;var s,a=j(t);switch(r){case"point":case"points":s=vn(a,e,n);break;case"square":case"squares":s=xo(a,e,n);break;case"hex":case"hexes":s=_o(a,e,n);break;case"triangle":case"triangles":s=Eo(a,e,n);break;default:throw new Error("invalid gridType")}var u=[];return O(s,(function(e){var s=0,a=0;O(t,(function(t){var u,c=Dt("point"===r?e:he(e),t,n);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===c&&(s=u);var h=1/Math.pow(c,o);a+=h,s+=h*u}));var c=Ft(e);c.properties[i]=s/a,u.push(c)})),c(u)},t.pointOnSurface=an,t.polygonToLineString=Pn,t.lineStringToPolygon=Rn,t.inside=Mt,t.within=Pt,t.bezier=ne,t.nearest=Me,t.pointOnLine=Je,t.lineDistance=fn,t.radians2degrees=v,t.degrees2radians=x,t.distanceToDegrees=_,t.distanceToRadians=y,t.radiansToDistance=d,t.bearingToAngle=m,t.convertDistance=E,t.toMercator=$e,t.toWgs84=tn,t.randomPosition=oi,t.randomPoint=si,t.randomPolygon=ai,t.randomLineString=ui,t.getCluster=hi,t.clusterEach=li,t.clusterReduce=pi,t.createBins=fi,t.applyFilter=gi,t.propertiesContainsFilter=di,t.filterProperties=yi,t.earthRadius=wo,t.factors=bo,t.unitsFactors=Io,t.areaFactors=No,t.feature=e,t.geometry=n,t.point=r,t.points=i,t.polygon=o,t.polygons=s,t.lineString=a,t.lineStrings=u,t.featureCollection=c,t.multiLineString=h,t.multiPoint=l,t.multiPolygon=p,t.geometryCollection=f,t.round=g,t.radiansToLength=d,t.lengthToRadians=y,t.lengthToDegrees=_,t.bearingToAzimuth=m,t.radiansToDegrees=v,t.degreesToRadians=x,t.convertLength=E,t.convertArea=w,t.isNumber=b,t.isObject=I,t.validateBBox=N,t.validateId=C,t.getCoord=X,t.getCoords=U,t.containsNumber=Y,t.geojsonType=V,t.featureOf=H,t.collectionOf=W,t.getGeom=J,t.getGeomType=Z,t.getType=K,t.coordEach=S,t.coordReduce=M,t.propEach=L,t.propReduce=P,t.featureEach=O,t.featureReduce=R,t.coordAll=T,t.geomEach=A,t.geomReduce=D,t.flattenEach=F,t.flattenReduce=q,t.segmentEach=G,t.segmentReduce=B,t.lineEach=k,t.lineReduce=z,Object.defineProperty(t,"__esModule",{value:!0})}(e)}]);