89 lines
590 KiB
JavaScript
89 lines
590 KiB
JavaScript
define((function(){"use strict";var t={},e=6371008.8,n={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*e,kilometers:6371.0088,kilometres:6371.0088,meters:e,metres:e,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:e/1852,radians:1,yards:6967335.223679999},r={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e,yards:1.0936133},i={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function o(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function s(t,e,n){switch(t){case"Point":return a(e).geometry;case"LineString":return h(e).geometry;case"Polygon":return l(e).geometry;case"MultiPoint":return d(e).geometry;case"MultiLineString":return g(e).geometry;case"MultiPolygon":return y(e).geometry;default:throw new Error(t+" is invalid")}}function a(t,e,n){if(void 0===n&&(n={}),!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(!C(t[0])||!C(t[1]))throw new Error("coordinates must contain numbers");return o({type:"Point",coordinates:t},e,n)}function u(t,e,n){return void 0===n&&(n={}),f(t.map((function(t){return a(t,e)})),n)}function l(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var s=i[r];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:t},e,n)}function c(t,e,n){return void 0===n&&(n={}),f(t.map((function(t){return l(t,e)})),n)}function h(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:t},e,n)}function p(t,e,n){return void 0===n&&(n={}),f(t.map((function(t){return h(t,e)})),n)}function f(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function g(t,e,n){return void 0===n&&(n={}),o({type:"MultiLineString",coordinates:t},e,n)}function d(t,e,n){return void 0===n&&(n={}),o({type:"MultiPoint",coordinates:t},e,n)}function y(t,e,n){return void 0===n&&(n={}),o({type:"MultiPolygon",coordinates:t},e,n)}function v(t,e,n){return void 0===n&&(n={}),o({type:"GeometryCollection",geometries:t},e,n)}function _(t,e){if(void 0===e&&(e=0),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 m(t,e){void 0===e&&(e="kilometers");var r=n[e];if(!r)throw new Error(e+" units is invalid");return t*r}function x(t,e){void 0===e&&(e="kilometers");var r=n[e];if(!r)throw new Error(e+" units is invalid");return t/r}function E(t,e){return w(x(t,e))}function b(t){var e=t%360;return e<0&&(e+=360),e}function w(t){return t%(2*Math.PI)*180/Math.PI}function I(t){return t%360*Math.PI/180}function N(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return m(x(t,e),n)}function S(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=i[e];if(!r)throw new Error("invalid original units");var o=i[n];if(!o)throw new Error("invalid final units");return t/r*o}function C(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function P(t){return!!t&&t.constructor===Object}function M(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(!C(t))throw new Error("bbox must only contain numbers")}))}function L(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")}var O=Object.freeze({__proto__:null,earthRadius:e,factors:n,unitsFactors:r,areaFactors:i,feature:o,geometry:s,point:a,points:u,polygon:l,polygons:c,lineString:h,lineStrings:p,featureCollection:f,multiLineString:g,multiPoint:d,multiPolygon:y,geometryCollection:v,round:_,radiansToLength:m,lengthToRadians:x,lengthToDegrees:E,bearingToAzimuth:b,radiansToDegrees:w,degreesToRadians:I,convertLength:N,convertArea:S,isNumber:C,isObject:P,validateBBox:M,validateId:L});function R(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,c,h=0,p=0,f=t.type,g="FeatureCollection"===f,d="Feature"===f,y=g?t.features.length:1,v=0;v<y;v++){a=(c=!!(l=g?t.features[v].geometry:d?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var _=0;_<a;_++){var m=0,x=0;if(null!==(s=c?l.geometries[_]:l)){u=s.coordinates;var E=s.type;switch(h=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===e(u,p,v,m,x))return!1;p++,m++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(!1===e(u[r],p,v,m,x))return!1;p++,"MultiPoint"===E&&m++}"LineString"===E&&m++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-h;i++){if(!1===e(u[r][i],p,v,m,x))return!1;p++}"MultiLineString"===E&&m++,"Polygon"===E&&x++}"Polygon"===E&&m++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(x=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-h;o++){if(!1===e(u[r][i][o],p,v,m,x))return!1;p++}x++}m++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===R(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function T(t,e,n,r){var i=n;return R(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i}function A(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function D(t,e,n){var r=n;return A(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function F(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function k(t,e,n){var r=n;return F(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function G(t){var e=[];return R(t,(function(t){e.push(t)})),e}function q(t,e){var n,r,i,o,s,a,u,l,c,h,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,l=f?t.features[n].properties:g?t.properties:{},c=f?t.features[n].bbox:g?t.bbox:void 0,h=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":if(!1===e(o,p,l,c,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],p,l,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,p,l,c,h))return!1;p++}}function B(t,e,n){var r=n;return q(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r}function z(t,e){q(t,(function(t,n,r,i,s){var a,u=null===t?null:t.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return!1!==e(o(t,r,{bbox:i,id:s}),n,0)&&void 0}switch(u){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var l=0;l<t.coordinates.length;l++){var c=t.coordinates[l];if(!1===e(o({type:a,coordinates:c},r),n,l))return!1}}))}function j(t,e,n){var r=n;return z(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function U(t,e){z(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==R(t,(function(o,c,p,f,g){if(void 0===s||n>a||f>u||g>l)return s=o,a=n,u=f,l=g,void(i=0);var d=h([s,o],t.properties);if(!1===e(d,n,r,g,i))return!1;i++,s=o}))&&void 0}}}))}function V(t,e,n){var r=n,i=!1;return U(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 X(t,e){if(!t)throw new Error("geojson is required");z(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(h(o[s],t.properties),n,r,s))return!1}}}))}function Y(t,e,n){var r=n;return X(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r}function H(t,e){if(!P(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),h([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),h([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),h([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),h([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function W(t,e){if(!P(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,u=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),u=u||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":u=u||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var l=n.coordinates;switch(n.type){case"Point":return a(l,u,e);case"MultiPoint":return i<0&&(i=l.length+i),a(l[i],u,e);case"LineString":return s<0&&(s=l.length+s),a(l[s],u,e);case"Polygon":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s),a(l[o][s],u,e);case"MultiLineString":return i<0&&(i=l.length+i),s<0&&(s=l[i].length+s),a(l[i][s],u,e);case"MultiPolygon":return i<0&&(i=l.length+i),o<0&&(o=l[i].length+o),s<0&&(s=l[i][o].length-s),a(l[i][o][s],u,e)}throw new Error("geojson is invalid")}var J=Object.freeze({__proto__:null,coordAll:G,coordEach:R,coordReduce:T,featureEach:F,featureReduce:k,findPoint:W,findSegment:H,flattenEach:z,flattenReduce:j,geomEach:q,geomReduce:B,lineEach:X,lineReduce:Y,propEach:A,propReduce:D,segmentEach:U,segmentReduce:V});function Z(t){var e=[1/0,1/0,-1/0,-1/0];return R(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 K(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Q(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function $(t){if(t.length>1&&C(t[0])&&C(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return $(t[0]);throw new Error("coordinates must only contain numbers")}function tt(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 et(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 nt(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,i=t.features;r<i.length;r++){var o=i[r];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}function rt(t){return"Feature"===t.type?t.geometry:t}function it(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}Z.default=Z;var ot=Object.freeze({__proto__:null,getCoord:K,getCoords:Q,containsNumber:$,geojsonType:tt,featureOf:et,collectionOf:nt,getGeom:rt,getType:it}),st=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;
|
|
/*
|
|
object-assign
|
|
(c) Sindre Sorhus
|
|
@license MIT
|
|
*/function lt(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var ct=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,r,i=lt(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))at.call(n,s)&&(i[s]=n[s]);if(st){r=st(n);for(var a=0;a<r.length;a++)ut.call(n,r[a])&&(i[r[a]]=n[r[a]])}}return i},ht={successCallback:null,verbose:!1},pt={};
|
|
/**
|
|
* @license GNU Affero General Public License.
|
|
* Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
|
|
* v. 1.2.0
|
|
* https://github.com/RaumZeit/MarchingSquares.js
|
|
*
|
|
* MarchingSquaresJS is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* MarchingSquaresJS is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* As additional permission under GNU Affero General Public License version 3
|
|
* section 7, third-party projects (personal or commercial) may distribute,
|
|
* include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
|
|
* requirement that said third-party project for that reason alone becomes
|
|
* subject to any requirement of the GNU Affero General Public License version 3.
|
|
* Any modifications to MarchingSquaresJS, however, must be shared with the public
|
|
* and made available.
|
|
*
|
|
* In summary this:
|
|
* - allows you to use MarchingSquaresJS at no cost
|
|
* - allows you to use MarchingSquaresJS for both personal and commercial purposes
|
|
* - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
|
|
* license as long as this license notice is included
|
|
* - enables you to keep the source code of your program that uses MarchingSquaresJS
|
|
* undisclosed
|
|
* - forces you to share any modifications you have made to MarchingSquaresJS,
|
|
* e.g. bug-fixes
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
*/function ft(t,e,n){n=n||{};for(var r=Object.keys(ht),i=0;i<r.length;i++){var o=r[i],s=n[o];s=null!=s?s:ht[o],pt[o]=s}pt.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e);var a=function(t){var e=[],n=0;return t.cells.forEach((function(r,i){r.forEach((function(r,o){if(void 0!==r&&5!==(p=r).cval&&10!==p.cval&&!dt(r)){var s=function(t,e,n){var r,i,o=t.length,s=[],a=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],u=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],l=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],c=t[e][n],h=c.cval,p=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"][h],f=vt(c,p);s.push([n+f[0],e+f[1]]),f=vt(c,p=l[h]),s.push([n+f[0],e+f[1]]),yt(c);for(var g=n+a[h],d=e+u[h],y=h;g>=0&&d>=0&&d<o&&(g!=n||d!=e)&&void 0!==(c=t[d][g]);){if(0===(h=c.cval)||15===h)return{path:s,info:"mergeable"};p=l[h],r=a[h],i=u[h],5!==h&&10!==h||(5===h?c.flipped?-1===u[y]?(p="left",r=-1,i=0):(p="right",r=1,i=0):-1===a[y]&&(p="bottom",r=0,i=-1):10===h&&(c.flipped?-1===a[y]?(p="top",r=0,i=1):(p="bottom",r=0,i=-1):1===u[y]&&(p="left",r=-1,i=0))),f=vt(c,p),s.push([g+f[0],d+f[1]]),yt(c),g+=r,d+=i,y=h}return{path:s,info:"closed"}}(t.cells,i,o),a=!1;if("mergeable"===s.info)for(var u=s.path[s.path.length-1][0],l=s.path[s.path.length-1][1],c=n-1;c>=0;c--)if(Math.abs(e[c][0][0]-u)<=1e-7&&Math.abs(e[c][0][1]-l)<=1e-7){for(var h=s.path.length-2;h>=0;--h)e[c].unshift(s.path[h]);a=!0;break}a||(e[n++]=s.path)}var p}))})),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],l=t[o+1][s+1],c=t[o][s+1],h=t[o][s];if(!(isNaN(u)||isNaN(l)||isNaN(c)||isNaN(h))){a|=u>=e?8:0,a|=l>=e?4:0,a|=c>=e?2:0;var p,f,g,d,y=!1;if(5==(a|=h>=e?1:0)||10===a){var v=(u+l+c+h)/4;5===a&&v<e?(a=10,y=!0):10===a&&v<e&&(a=5,y=!0)}0!==a&&15!==a&&(p=f=g=d=.5,1===a?(g=1-gt(e,u,h),f=1-gt(e,c,h)):2===a?(f=gt(e,h,c),d=1-gt(e,l,c)):3===a?(g=1-gt(e,u,h),d=1-gt(e,l,c)):4===a?(p=gt(e,u,l),d=gt(e,c,l)):5===a?(p=gt(e,u,l),d=gt(e,c,l),f=1-gt(e,c,h),g=1-gt(e,u,h)):6===a?(f=gt(e,h,c),p=gt(e,u,l)):7===a?(g=1-gt(e,u,h),p=gt(e,u,l)):8===a?(g=gt(e,h,u),p=1-gt(e,l,u)):9===a?(f=1-gt(e,c,h),p=1-gt(e,l,u)):10===a?(p=1-gt(e,l,u),d=1-gt(e,l,c),f=gt(e,h,c),g=gt(e,h,u)):11===a?(p=1-gt(e,l,u),d=1-gt(e,l,c)):12===a?(g=gt(e,h,u),d=gt(e,c,l)):13===a?(f=1-gt(e,c,h),d=gt(e,c,l)):14===a?(g=gt(e,h,u),f=gt(e,h,c)):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 pt.successCallback&&pt.successCallback(a),a}function gt(t,e,n){return(t-e)/(n-e)}function dt(t){return 0===t.cval||15===t.cval}function yt(t){dt(t)||5===t.cval||10===t.cval||(t.cval=15)}function vt(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}var _t=xt,mt=xt;function xt(t,e,n,r,i){Et(t,e,n||0,r||t.length-1,i||wt)}function Et(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(o-u)/o)*(s-o/2<0?-1:1);Et(t,e,Math.max(n,Math.floor(e-s*u/o+l)),Math.min(r,Math.floor(e+(o-s)*u/o+l)),i)}var c=t[e],h=n,p=r;for(bt(t,n,e),i(t[r],c)>0&&bt(t,n,r);h<p;){for(bt(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[n],c)?bt(t,n,p):bt(t,++p,r),p<=e&&(n=p+1),e<=p&&(r=p-1)}}function bt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function wt(t,e){return t<e?-1:t>e?1:0}_t.default=mt;var It=St,Nt=St;function St(t,e){if(!(this instanceof St))return new St(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 Ct(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}function Pt(t,e){Mt(t,0,t.children.length,e,t)}function Mt(t,e,n,r,i){i||(i=kt(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],Lt(i,t.leaf?r(o):o);return i}function Lt(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 Ot(t,e){return t.minX-e.minX}function Rt(t,e){return t.minY-e.minY}function Tt(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function At(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Dt(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 kt(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Gt(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,_t(t,o,e,n,i),s.push(e,o,o,n))}function qt(t){var e={exports:{}};return t(e,e.exports),e.exports}St.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):Dt(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||Dt(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=kt([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],l=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=l.pop(),o=!0),s.leaf&&-1!==(i=Ct(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!Dt(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),l.push(n),n=0,r=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:Ot,compareMinY:Rt,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 Pt(i=kt(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=kt([])).leaf=!1,i.height=r;var a,u,l,c,h=Math.ceil(o/s),p=h*Math.ceil(Math.sqrt(s));for(Gt(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(Gt(t,a,l=Math.min(a+p-1,n),h,this.compareMinY),u=a;u<=l;u+=h)c=Math.min(u+h-1,l),i.children.push(this._build(t,u,c,r-1));return Pt(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,l,c,h,p,f;r.push(e),!e.leaf&&r.length-1!==n;){for(c=h=1/0,i=0,o=e.children.length;i<o;i++)u=Tt(s=e.children[i]),p=t,f=s,(l=(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-u)<h?(h=l,c=u<c?u:c,a=s):l===h&&u<c&&(c=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),Lt(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=kt(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,Pt(n,this.toBBox),Pt(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=kt([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Pt(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,l,c,h,p,f,g,d,y;for(u=l=1/0,r=e;r<=n-e;r++)h=i=Mt(t,0,r,this.toBBox),p=o=Mt(t,r,n,this.toBBox),void 0,void 0,void 0,void 0,f=Math.max(h.minX,p.minX),g=Math.max(h.minY,p.minY),d=Math.min(h.maxX,p.maxX),y=Math.min(h.maxY,p.maxY),s=Math.max(0,d-f)*Math.max(0,y-g),a=Tt(i)+Tt(o),s<u?(u=s,c=r,l=a<l?a:l):s===u&&a<l&&(l=a,c=r);return c},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:Ot,i=t.leaf?this.compareMinY:Rt;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=Mt(t,0,e,s),u=Mt(t,n-e,n,s),l=At(a)+At(u);for(i=e;i<n-e;i++)o=t.children[i],Lt(a,t.leaf?s(o):o),l+=At(a);for(i=n-e-1;i>=e;i--)o=t.children[i],Lt(u,t.leaf?s(o):o),l+=At(u);return l},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)Lt(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():Pt(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]+"};")}},It.default=Nt;var Bt=function(t,e,n){var r=t*e,i=zt*t,o=i-(i-t),s=t-o,a=zt*e,u=a-(a-e),l=e-u,c=s*l-(r-o*u-s*u-o*l);return n?(n[0]=c,n[1]=r,n):[c,r]},zt=+(Math.pow(2,27)+1),jt=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,l=0,c=Math.abs,h=t[u],p=c(h),f=e[l],g=c(f);p<g?(o=h,(u+=1)<n&&(p=c(h=t[u]))):(o=f,(l+=1)<r&&(g=c(f=e[l]))),u<n&&p<g||l>=r?(i=h,(u+=1)<n&&(p=c(h=t[u]))):(i=f,(l+=1)<r&&(g=c(f=e[l])));for(var d,y,v=i+o,_=v-i,m=o-_,x=m,E=v;u<n&&l<r;)p<g?(i=h,(u+=1)<n&&(p=c(h=t[u]))):(i=f,(l+=1)<r&&(g=c(f=e[l]))),(m=(o=x)-(_=(v=i+o)-i))&&(s[a++]=m),x=E-((d=E+v)-(y=d-E))+(v-y),E=d;for(;u<n;)(m=(o=x)-(_=(v=(i=h)+o)-i))&&(s[a++]=m),x=E-((d=E+v)-(y=d-E))+(v-y),E=d,(u+=1)<n&&(h=t[u]);for(;l<r;)(m=(o=x)-(_=(v=(i=f)+o)-i))&&(s[a++]=m),x=E-((d=E+v)-(y=d-E))+(v-y),E=d,(l+=1)<r&&(f=e[l]);return x&&(s[a++]=x),E&&(s[a++]=E),a||(s[a++]=0),s.length=a,s},Ut=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]},Vt=function(t,e){var n=t.length;if(1===n){var r=Bt(t[0],e);return r[0]?r:[r[1]]}var i=new Array(2*n),o=[.1,.1],s=[.1,.1],a=0;Bt(t[0],e,o),o[0]&&(i[a++]=o[0]);for(var u=1;u<n;++u){Bt(t[u],e,s);var l=o[1];Ut(l,s[0],o),o[0]&&(i[a++]=o[0]);var c=s[1],h=o[1],p=c+h,f=h-(p-c);o[1]=p,f&&(i[a++]=f)}return o[1]&&(i[a++]=o[1]),0===a&&(i[a++]=0),i.length=a,i},Xt=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,l=0,c=Math.abs,h=t[u],p=c(h),f=-e[l],g=c(f);p<g?(o=h,(u+=1)<n&&(p=c(h=t[u]))):(o=f,(l+=1)<r&&(g=c(f=-e[l]))),u<n&&p<g||l>=r?(i=h,(u+=1)<n&&(p=c(h=t[u]))):(i=f,(l+=1)<r&&(g=c(f=-e[l])));for(var d,y,v=i+o,_=v-i,m=o-_,x=m,E=v;u<n&&l<r;)p<g?(i=h,(u+=1)<n&&(p=c(h=t[u]))):(i=f,(l+=1)<r&&(g=c(f=-e[l]))),(m=(o=x)-(_=(v=i+o)-i))&&(s[a++]=m),x=E-((d=E+v)-(y=d-E))+(v-y),E=d;for(;u<n;)(m=(o=x)-(_=(v=(i=h)+o)-i))&&(s[a++]=m),x=E-((d=E+v)-(y=d-E))+(v-y),E=d,(u+=1)<n&&(h=t[u]);for(;l<r;)(m=(o=x)-(_=(v=(i=f)+o)-i))&&(s[a++]=m),x=E-((d=E+v)-(y=d-E))+(v-y),E=d,(l+=1)<r&&(f=-e[l]);return x&&(s[a++]=x),E&&(s[a++]=E),a||(s[a++]=0),s.length=a,s},Yt=qt((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){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(",n(t.slice(0,e)),",",n(t.slice(e)),")"].join("")}function r(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var i=[],o=0;o<t.length;++o)i.push(["scale(",n(r(e(t,o))),",",(s=o,1&s?"-":""),t[0][o],")"].join(""));return i;var s}function i(t){for(var i=[],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)?i.push.apply(i,r(e(s,u))):o.push.apply(o,r(e(s,u))),a.push("m"+u);var l=n(i),c=n(o),h="orientation"+t+"Exact",p=["function ",h,"(",a.join(),"){var p=",l,",n=",c,",d=sub(p,n);return d[d.length-1];};return ",h].join("");return new Function("sum","prod","scale","sub",p)(jt,Bt,Vt,Xt)}var o=i(3),s=i(4),a=[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]),s=(t[0]-n[0])*(e[1]-n[1]),a=i-s;if(i>0){if(s<=0)return a;r=i+s}else{if(!(i<0))return a;if(s>=0)return a;r=-(i+s)}var u=33306690738754716e-32*r;return a>=u||a<=-u?a:o(t,e,n)},function(t,e,n,r){var i=t[0]-r[0],o=e[0]-r[0],a=n[0]-r[0],u=t[1]-r[1],l=e[1]-r[1],c=n[1]-r[1],h=t[2]-r[2],p=e[2]-r[2],f=n[2]-r[2],g=o*c,d=a*l,y=a*u,v=i*c,_=i*l,m=o*u,x=h*(g-d)+p*(y-v)+f*(_-m),E=7771561172376103e-31*((Math.abs(g)+Math.abs(d))*Math.abs(h)+(Math.abs(y)+Math.abs(v))*Math.abs(p)+(Math.abs(_)+Math.abs(m))*Math.abs(f));return x>E||-x>E?x:s(t,e,n,r)}];function u(t){var e=a[t.length];return e||(e=a[t.length]=i(t.length)),e.apply(void 0,t)}!function(){for(;a.length<=5;)a.push(i(a.length));for(var e=[],n=["slow"],r=0;r<=5;++r)e.push("a"+r),n.push("o"+r);var o=["function getOrientation(",e.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(r=2;r<=5;++r)o.push("case ",r,":return o",r,"(",e.slice(0,r).join(),");");o.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(o.join(""));var s=Function.apply(void 0,n);for(t.exports=s.apply(void 0,[u].concat(a)),r=0;r<=5;++r)t.exports[r]=a[r]}()})),Ht=Yt[3],Wt=Zt,Jt=Zt;function Zt(t,e){if(!(this instanceof Zt))return new Zt(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||Kt,this.length>0)for(var n=(this.length>>1)-1;n>=0;n--)this._down(n)}function Kt(t,e){return t<e?-1:t>e?1:0}Zt.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}},Wt.default=Jt;var Qt=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],l=e[s][0],c=e[s][1];u>r!=c>r&&n<(l-a)*(r-u)/(c-u)+a&&(i=!i)}return i},$t=Yt[3],te=ne,ee=ne;function ne(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++)Qt(t[o],a)||u.push(t[o]);var l=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],l=o.length;l>1&&Ht(t[o[l-2]],t[o[l-1]],u)<=0;)l-=1,o.pop();for(o.push(a),l=s.length;l>1&&Ht(t[s[l-2]],t[s[l-1]],u)>=0;)l-=1,s.pop();s.push(a)}n=new Array(s.length+o.length-2);for(var c=0,h=(r=0,o.length);r<h;++r)n[c++]=o[r];for(var p=s.length-2;p>0;--p)n[c++]=s[p];return n}(u),c=[];for(o=0;o<l.length;o++)c.push(u[l[o]]);return c}(t),o=It(16,["[0]","[1]","[0]","[1]"]).load(t),s=[],a=0;a<i.length;a++){var u=i[a];o.remove(u),r=le(u,r),s.push(r)}var l=It(16);for(a=0;a<s.length;a++)l.insert(ue(s[a]));for(var c=e*e,h=n*n;s.length;){var p=s.shift(),f=p.p,g=p.next.p,d=ce(f,g);if(!(d<h)){var y=d/c;(u=re(o,p.prev.p,f,g,p.next.next.p,y,l))&&Math.min(ce(u,f),ce(u,g))<=y&&(s.push(p),s.push(le(u,p)),o.remove(u),l.remove(p),l.insert(ue(p)),l.insert(ue(p.next)))}}p=r;var v=[];do{v.push(p.p),p=p.next}while(p!==r);return v.push(p.p),v}function re(t,e,n,r,i,o,s){for(var a=new Wt(null,ie),u=t.data;u;){for(var l=0;l<u.children.length;l++){var c=u.children[l],h=u.leaf?he(c,n,r):oe(n,r,c);h>o||a.push({node:c,dist:h})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),f=p.node,g=he(f,e,n),d=he(f,r,i);if(p.dist<g&&p.dist<d&&ae(n,f,s)&&ae(r,f,s))return f}(u=a.pop())&&(u=u.node)}return null}function ie(t,e){return t.dist-e.dist}function oe(t,e,n){if(se(t,n)||se(e,n))return 0;var r=pe(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=pe(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=pe(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=pe(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)}function se(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function ae(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),h=n.search({minX:a,minY:u,maxX:l,maxY:c}),p=0;p<h.length;p++)if(r=h[p].p,i=h[p].next.p,o=t,r!==(s=e)&&i!==o&&$t(r,i,o)>0!=$t(r,i,s)>0&&$t(o,s,r)>0!=$t(o,s,i)>0)return!1;return!0}function ue(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 le(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 ce(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function he(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 pe(t,e,n,r,i,o,s,a){var u,l,c,h,p=n-t,f=r-e,g=s-i,d=a-o,y=t-i,v=e-o,_=p*p+f*f,m=p*g+f*d,x=g*g+d*d,E=p*y+f*v,b=g*y+d*v,w=_*x-m*m,I=w,N=w;0===w?(l=0,I=1,h=b,N=x):(h=_*b-m*E,(l=m*b-x*E)<0?(l=0,h=b,N=x):l>I&&(l=I,h=b+m,N=x)),h<0?(h=0,-E<0?l=0:-E>_?l=I:(l=-E,I=_)):h>N&&(h=N,-E+m<0?l=0:-E+m>_?l=I:(l=-E+m,I=_));var S=(1-(c=0===h?0:h/N))*i+c*s-((1-(u=0===l?0:l/I))*t+u*n),C=(1-c)*o+c*a-((1-u)*e+u*r);return S*S+C*C}function fe(t,e){void 0===e&&(e={}),e.concavity=e.concavity||1/0;var n=[];if(R(t,(function(t){n.push([t[0],t[1]])})),!n.length)return null;var r=te(n,e.concavity);return r.length>3?l([r]):null}function ge(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=K(t),i=rt(e),o=i.type,s=e.bbox,a=i.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(r,s))return!1;"Polygon"===o&&(a=[a]);for(var u=!1,l=0;l<a.length&&!u;l++)if(de(r,a[l][0],n.ignoreBoundary)){for(var c=!1,h=1;h<a[l].length&&!c;)de(r,a[l][h],!n.ignoreBoundary)&&(c=!0),h++;c||(u=!0)}return u}function de(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],l=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+l*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(l-t[1])<=0)return!n;a>t[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(r=!r)}return r}function ye(t,e){var n=[];return F(t,(function(t){var r=!1;if("Point"===t.geometry.type)q(e,(function(e){ge(t,e)&&(r=!0)})),r&&n.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];q(e,(function(e){R(t,(function(t){ge(t,e)&&(r=!0,i.push(t))}))})),r&&n.push(d(i))}})),f(n)}function ve(t,e,n){void 0===n&&(n={});var r=K(t),i=K(e),o=I(i[1]-r[1]),s=I(i[0]-r[0]),a=I(r[1]),u=I(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return m(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}function _e(t,e){var n=!1;return f(function(t){if(t.length<3)return[];t.sort(xe);for(var e,n,r,i,o,s,a=t.length-1,u=t[a].x,l=t[0].x,c=t[a].y,h=c;a--;)t[a].y<c&&(c=t[a].y),t[a].y>h&&(h=t[a].y);var p,f=l-u,g=h-c,d=f>g?f:g,y=.5*(l+u),v=.5*(h+c),_=[new me({__sentinel:!0,x:y-20*d,y:v-d},{__sentinel:!0,x:y,y:v+20*d},{__sentinel:!0,x:y+20*d,y:v-d})],m=[],x=[];for(a=t.length;a--;){for(x.length=0,p=_.length;p--;)(f=t[a].x-_[p].x)>0&&f*f>_[p].r?(m.push(_[p]),_.splice(p,1)):f*f+(g=t[a].y-_[p].y)*g>_[p].r||(x.push(_[p].a,_[p].b,_[p].b,_[p].c,_[p].c,_[p].a),_.splice(p,1));for(Ee(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&&_.push(new me(e,n,r))}for(Array.prototype.push.apply(m,_),a=m.length;a--;)(m[a].a.__sentinel||m[a].b.__sentinel||m[a].c.__sentinel)&&m.splice(a,1);return m}(t.features.map((function(t){var r={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?r.z=t.properties[e]:3===t.geometry.coordinates.length&&(n=!0,r.z=t.geometry.coordinates[2]),r}))).map((function(t){var e=[t.a.x,t.a.y],r=[t.b.x,t.b.y],i=[t.c.x,t.c.y],o={};return n?(e.push(t.a.z),r.push(t.b.z),i.push(t.c.z)):o={a:t.a.z,b:t.b.z,c:t.c.z},l([[e,r,i,e]],o)})))}te.default=ee;var me=function(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,l=o*(t.x+e.x)+s*(t.y+e.y),c=a*(t.x+n.x)+u*(t.y+n.y),h=2*(o*(n.y-e.y)-s*(n.x-e.x));this.x=(u*l-s*c)/h,this.y=(o*c-a*l)/h,r=this.x-t.x,i=this.y-t.y,this.r=r*r+i*i};function xe(t,e){return e.x-t.x}function Ee(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],e===(i=t[--r])&&n===o||e===o&&n===i){t.splice(s,2),t.splice(r,2),s-=2;continue t}}function be(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return we(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 we(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ne(t);default:throw new Error("unknown GeoJSON type")}}function we(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=Ie(t.properties),e.geometry=Ne(t.geometry),e}function Ie(t){var e={};return t?(Object.keys(t).forEach((function(n){var r=t[n];"object"==typeof r?null===r?e[n]=null:Array.isArray(r)?e[n]=r.map((function(t){return t})):e[n]=Ie(r):e[n]=r})),e):e}function Ne(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Ne(t)})),e):(e.coordinates=Se(t.coordinates),e)}function Se(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Se(t)}))}function Ce(t){return t[0].toString()+","+t[1].toString()}function Pe(t){return t}function Me(t,e){var n=function(t){if(null==t)return Pe;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,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*r+o,c[1]=(n+=t[1])*i+s;u<l;)c[u]=t[u],++u;return c}}(t.transform),r=t.arcs;function i(t,e){e.length&&e.pop();for(var i=r[t<0?~t:t],o=0,s=i.length;o<s;++o)e.push(n(i[o],o));t<0&&function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n}(e,s)}function o(t){return n(t)}function s(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function a(t){for(var e=s(t);e.length<4;)e.push(e[0]);return e}function u(t){return t.map(a)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=o(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(o);break;case"LineString":n=s(e.arcs);break;case"MultiLineString":n=e.arcs.map(s);break;case"Polygon":n=u(e.arcs);break;case"MultiPolygon":n=e.arcs.map(u);break;default:return null}return{type:r,coordinates:n}}(e)}function Le(t,e){var n={},r=[],i=[];function o(t){t.forEach((function(e){e.forEach((function(e){(n[e=e<0?~e:e]||(n[e]=[])).push(t)}))})),r.push(t)}function s(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)}(Me(t,{type:"Polygon",arcs:[e]}).coordinates[0])}return e.forEach((function t(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"Polygon":o(e.arcs);break;case"MultiPolygon":e.arcs.forEach(o)}})),r.forEach((function(t){if(!t._){var e=[],r=[t];for(t._=1,i.push(e);t=r.pop();)e.push(t),t.forEach((function(t){t.forEach((function(t){n[t<0?~t:t].forEach((function(t){t._||(t._=1,r.push(t))}))}))}))}})),r.forEach((function(t){delete t._})),{type:"MultiPolygon",arcs:i.map((function(e){var r,i=[];if(e.forEach((function(t){t.forEach((function(t){t.forEach((function(t){n[t<0?~t:t].length<2&&i.push(t)}))}))})),(r=(i=function(t,e){var n={},r={},i={},o=[],s=-1;function a(t,e){for(var r in t){var i=t[r];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){n[t<0?~t:t]=1})),o.push(i)}}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[++s],e[s]=n,e[r]=i)})),e.forEach((function(e){var n,o,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=i[a])if(delete i[n.end],n.push(e),n.end=u,o=r[u]){delete r[o.start];var l=o===n?n:n.concat(o);r[l.start=n.start]=i[l.end=o.end]=l}else r[n.start]=i[n.end]=n;else if(n=r[u])if(delete r[n.start],n.unshift(e),n.start=a,o=i[a]){delete i[o.end];var c=o===n?n:o.concat(n);r[c.start=o.start]=i[c.end=n.end]=c}else r[n.start]=i[n.end]=n;else r[(n=[e]).start=a]=i[n.end=u]=n})),a(i,r),a(r,i),e.forEach((function(t){n[t<0?~t:t]||o.push([t])})),o}(t,i)).length)>1)for(var o,a,u=1,l=s(i[0]);u<r;++u)(o=s(i[u]))>l&&(a=i[0],i[0]=i[u],i[u]=a,l=o);return i})).filter((function(t){return t.length>0}))}}var Oe=Object.prototype.hasOwnProperty;function Re(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,l=0;l<t;++l)s[l]=i;function c(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l]=o;if(++h>=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=r,a[l]=o,o}function h(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l];if(++h>=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=r,a[l]=o,o}function p(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l];if(++h>=t)break;c=s[l=l+1&u]}return o}function f(){for(var t=[],e=0,n=s.length;e<n;++e){var r=s[e];r!=i&&t.push(r)}return t}return{set:c,maybeSet:h,get:p,keys:f}}function Te(t,e){return t[0]===e[0]&&t[1]===e[1]}var Ae=new ArrayBuffer(16),De=new Float64Array(Ae),Fe=new Uint32Array(Ae);function ke(t){De[0]=t[0],De[1]=t[1];var e=Fe[0]^Fe[1];return 2147483647&(e<<5^e>>7^Fe[2]^Fe[3])}function Ge(t,e,n,r){qe(t,e,n),qe(t,e,e+r),qe(t,e+r,n)}function qe(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 Be(t){var e={type:"GeometryCollection",geometries:t.features.map(ze)};return null!=t.bbox&&(e.bbox=t.bbox),e}function ze(t){var e,n=je(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 je(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(je)}:"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 Ue(t,e){var n=function(t){var e=1/0,n=1/0,r=-1/0,i=-1/0;function o(t){null!=t&&Oe.call(s,t.type)&&s[t.type](t)}var s={GeometryCollection:function(t){t.geometries.forEach(o)},Point:function(t){a(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(a)},LineString:function(t){u(t.arcs)},MultiLineString:function(t){t.arcs.forEach(u)},Polygon:function(t){t.arcs.forEach(u)},MultiPolygon:function(t){t.arcs.forEach(l)}};function a(t){var o=t[0],s=t[1];o<e&&(e=o),o>r&&(r=o),s<n&&(n=s),s>i&&(i=s)}function u(t){t.forEach(a)}function l(t){t.forEach(u)}for(var c in t)o(t[c]);return r>=e&&i>=n?[e,n,r,i]:void 0}(t=function(t){var e,n,r={};for(e in t)r[e]=null==(n=t[e])?{type:null}:("FeatureCollection"===n.type?Be:"Feature"===n.type?ze:je)(n);return r}(t)),r=e>0&&n&&function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=o-r?(n-1)/(o-r):1,u=s-i?(n-1)/(s-i):1;function l(t){return[Math.round((t[0]-r)*a),Math.round((t[1]-i)*u)]}function c(t,e){for(var n,o,s,l,c,h=-1,p=0,f=t.length,g=new Array(f);++h<f;)n=t[h],l=Math.round((n[0]-r)*a),c=Math.round((n[1]-i)*u),l===o&&c===s||(g[p++]=[o=l,s=c]);for(g.length=p;p<e;)p=g.push([g[0][0],g[0][1]]);return g}function h(t){return c(t,2)}function p(t){return c(t,4)}function f(t){return t.map(p)}function g(t){null!=t&&Oe.call(d,t.type)&&d[t.type](t)}var d={GeometryCollection:function(t){t.geometries.forEach(g)},Point:function(t){t.coordinates=l(t.coordinates)},MultiPoint:function(t){t.coordinates=t.coordinates.map(l)},LineString:function(t){t.arcs=h(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(h)},Polygon:function(t){t.arcs=f(t.arcs)},MultiPolygon:function(t){t.arcs=t.arcs.map(f)}};for(var y in t)g(t[y]);return{scale:[1/a,1/u],translate:[r,i]}}(t,n,e),i=function(t){var e,n,r,i,o=t.coordinates,s=t.lines,a=t.rings,u=s.length+a.length;for(delete t.lines,delete t.rings,r=0,i=s.length;r<i;++r)for(e=s[r];e=e.next;)++u;for(r=0,i=a.length;r<i;++r)for(n=a[r];n=n.next;)++u;var l=Re(2*u*1.4,ke,Te),c=t.arcs=[];for(r=0,i=s.length;r<i;++r){e=s[r];do{h(e)}while(e=e.next)}for(r=0,i=a.length;r<i;++r)if((n=a[r]).next)do{h(n)}while(n=n.next);else p(n);function h(t){var e,n,r,i,s,a,u,h;if(r=l.get(e=o[t[0]]))for(u=0,h=r.length;u<h;++u)if(f(i=r[u],t))return t[0]=i[0],void(t[1]=i[1]);if(s=l.get(n=o[t[1]]))for(u=0,h=s.length;u<h;++u)if(g(a=s[u],t))return t[1]=a[0],void(t[0]=a[1]);r?r.push(t):l.set(e,[t]),s?s.push(t):l.set(n,[t]),c.push(t)}function p(t){var e,n,r,i,s;if(n=l.get(o[t[0]]))for(i=0,s=n.length;i<s;++i){if(d(r=n[i],t))return t[0]=r[0],void(t[1]=r[1]);if(y(r,t))return t[0]=r[1],void(t[1]=r[0])}if(n=l.get(e=o[t[0]+v(t)]))for(i=0,s=n.length;i<s;++i){if(d(r=n[i],t))return t[0]=r[0],void(t[1]=r[1]);if(y(r,t))return t[0]=r[1],void(t[1]=r[0])}n?n.push(t):l.set(e,[t]),c.push(t)}function f(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(!Te(o[n],o[r]))return!1;return!0}function g(t,e){var n=t[0],r=e[0],i=t[1],s=e[1];if(n-i!=r-s)return!1;for(;n<=i;++n,--s)if(!Te(o[n],o[s]))return!1;return!0}function d(t,e){var n=t[0],r=e[0],i=t[1]-n;if(i!==e[1]-r)return!1;for(var s=v(t),a=v(e),u=0;u<i;++u)if(!Te(o[n+(u+s)%i],o[r+(u+a)%i]))return!1;return!0}function y(t,e){var n=t[0],r=e[0],i=t[1],s=e[1],a=i-n;if(a!==s-r)return!1;for(var u=v(t),l=a-v(e),c=0;c<a;++c)if(!Te(o[n+(c+u)%a],o[s-(c+l)%a]))return!1;return!0}function v(t){for(var e=t[0],n=t[1],r=e,i=r,s=o[r];++r<n;){var a=o[r];(a[0]<s[0]||a[0]===s[0]&&a[1]<s[1])&&(i=r,s=a)}return i-e}return t}(function(t){var e,n,r,i=function(t){var e,n,r,i,o=t.coordinates,s=t.lines,a=t.rings,u=function(){for(var t=Re(1.4*o.length,E,b,Int32Array,-1,Int32Array),e=new Int32Array(o.length),n=0,r=o.length;n<r;++n)e[n]=t.maybeSet(n,n);return e}(),l=new Int32Array(o.length),c=new Int32Array(o.length),h=new Int32Array(o.length),p=new Int8Array(o.length),f=0;for(e=0,n=o.length;e<n;++e)l[e]=c[e]=h[e]=-1;for(e=0,n=s.length;e<n;++e){var g=s[e],d=g[0],y=g[1];for(r=u[d],i=u[++d],++f,p[r]=1;++d<=y;)x(e,r,r=i,i=u[d]);++f,p[i]=1}for(e=0,n=o.length;e<n;++e)l[e]=-1;for(e=0,n=a.length;e<n;++e){var v=a[e],_=v[0]+1,m=v[1];for(x(e,u[m-1],r=u[_-1],i=u[_]);++_<=m;)x(e,r,r=i,i=u[_])}function x(t,e,n,r){if(l[n]!==t){l[n]=t;var i=c[n];if(i>=0){var o=h[n];i===e&&o===r||i===r&&o===e||(++f,p[n]=1)}else c[n]=e,h[n]=r}}function E(t){return ke(o[t])}function b(t,e){return Te(o[t],o[e])}l=c=h=null;var w,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;function u(r){for(var a=e(r)&s,u=o[a],l=0;u!=i;){if(n(u,r))return!0;if(++l>=t)throw new Error("full hashset");u=o[a=a+1&s]}return o[a]=r,!0}function l(r){for(var a=e(r)&s,u=o[a],l=0;u!=i;){if(n(u,r))return!0;if(++l>=t)break;u=o[a=a+1&s]}return!1}function c(){for(var t=[],e=0,n=o.length;e<n;++e){var r=o[e];r!=i&&t.push(r)}return t}return{add:u,has:l,values:c}}(1.4*f,ke,Te);for(e=0,n=o.length;e<n;++e)p[w=u[e]]&&I.add(o[w]);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],l=u[0],c=u[1];++l<c;)i.has(o[l])&&(e={0:l,1:u[1]},u[1]=l,u=u.next=e);for(n=0,r=a.length;n<r;++n)for(var h=a[n],p=h[0],f=p,g=h[1],d=i.has(o[p]);++f<g;)i.has(o[f])&&(d?(e={0:f,1:h[1]},h[1]=f,h=h.next=e):(Ge(o,p,g,g-f),o[g]=o[p],d=!0,f=p));return t}(function(t){var e=-1,n=[],r=[],i=[];function o(t){t&&Oe.call(s,t.type)&&s[t.type](t)}var s={GeometryCollection:function(t){t.geometries.forEach(o)},LineString:function(t){t.arcs=a(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(a)},Polygon:function(t){t.arcs=t.arcs.map(u)},MultiPolygon:function(t){t.arcs=t.arcs.map(l)}};function a(t){for(var r=0,o=t.length;r<o;++r)i[++e]=t[r];var s={0:e-o+1,1:e};return n.push(s),s}function u(t){for(var n=0,o=t.length;n<o;++n)i[++e]=t[n];var s={0:e-o+1,1:e};return r.push(s),s}function l(t){return t.map(u)}for(var c in t)o(t[c]);return{type:"Topology",coordinates:i,lines:n,rings:r,objects:t}}(t))),o=i.coordinates,s=Re(1.4*i.arcs.length,Ve,Xe);function a(t){t&&Oe.call(u,t.type)&&u[t.type](t)}t=i.objects,i.bbox=n,i.arcs=i.arcs.map((function(t,e){return s.set(t,e),o.slice(t[0],t[1]+1)})),delete i.coordinates,o=null;var u={GeometryCollection:function(t){t.geometries.forEach(a)},LineString:function(t){t.arcs=l(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(l)},Polygon:function(t){t.arcs=t.arcs.map(l)},MultiPolygon:function(t){t.arcs=t.arcs.map(c)}};function l(t){var e=[];do{var n=s.get(t);e.push(t[0]<t[1]?n:~n)}while(t=t.next);return e}function c(t){return t.map(l)}for(var h in t)a(t[h]);return r&&(i.transform=r,i.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,l=o[0],c=l[0],h=l[1];++s<u;)r=(l=o[s])[0],i=l[1],r===c&&i===h||(o[a++]=[r-c,i-h],c=r,h=i);1===a&&(o[a++]=[0,0]),o.length=a}return t}(i.arcs)),i}function Ve(t){var e,n=t[0],r=t[1];return r<n&&(e=n,n=r,r=e),n+31*r}function Xe(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 Ye(t,e){if(void 0===e&&(e={}),!P(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==it(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=be(t));var r=function(t){var e={};z(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");var i=t;switch(r){case"LineString":return function(t,e){if(void 0===e&&(e={}),!P(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==it(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=be(t));var r=[],i=Y(t,(function(t,e){var n=function(t,e){var n,r=t.geometry.coordinates,i=e.geometry.coordinates,o=Ce(r[0]),s=Ce(r[r.length-1]),a=Ce(i[0]),u=Ce(i[i.length-1]);if(o===u)n=i.concat(r.slice(1));else if(a===s)n=r.concat(i.slice(1));else if(o===a)n=r.slice(1).reverse().concat(i);else{if(s!==u)return null;n=r.concat(i.reverse().slice(1))}return h(n)}(t,e);return n||(r.push(t),e)}));return i&&r.push(i),r.length?1===r.length?r[0]:g(r.map((function(t){return t.coordinates}))):null}(i,e);case"Polygon":return function(t,e){if(void 0===e&&(e={}),"FeatureCollection"!==it(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==e.mutate&&void 0!==e.mutate||(t=be(t));var n=[];z(t,(function(t){n.push(t.geometry)}));var r=Ue({geoms:v(n).geometry});return function(t){return Me(t,Le.apply(this,arguments))}(r,r.objects.geoms.geometries)}(i,e);default:throw new Error(r+" is not supported")}}function He(t,e){void 0===e&&(e={});var n="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var r=it(t),i=[];switch(r){case"LineString":i=We(t);break;case"MultiLineString":case"Polygon":Q(t).forEach((function(t){i.push(We(t))}));break;case"MultiPolygon":Q(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(We(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var s={};Q(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(s,e)||(i.push(t),s[e]=!0)}));break;default:throw new Error(r+" geometry not supported")}return t.coordinates?!0===n?(t.coordinates=i,t):{type:r,coordinates:i}:!0===n?(t.geometry.coordinates=i,t):o({type:r,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function We(t){var e=Q(t);if(2===e.length&&!Je(e[0],e[1]))return e;var n=[],r=e.length-1,i=n.length;n.push(e[0]);for(var o=1;o<r;o++){var s=n[n.length-1];e[o][0]===s[0]&&e[o][1]===s[1]||(n.push(e[o]),(i=n.length)>2&&Ze(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1))}if(n.push(e[e.length-1]),i=n.length,Je(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return Ze(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function Je(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ze(t,e,n){var r=n[0],i=n[1],o=t[0],s=t[1],a=e[0],u=e[1],l=a-o,c=u-s;return 0==(r-o)*c-(i-s)*l&&(Math.abs(l)>=Math.abs(c)?l>0?o<=r&&r<=a:a<=r&&r<=o:c>0?s<=i&&i<=u:u<=i&&i<=s)}function Ke(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 Qe(t,e,n,r,i){for(var o,s=r,a=e+1;a<n;a++){var u=Ke(t[a],t[e],t[n]);u>s&&(o=a,s=u)}s>r&&(o-e>1&&Qe(t,e,o,r,i),i.push(t[o]),n-o>1&&Qe(t,o,n,r,i))}function $e(t,e){var n=t.length-1,r=[t[0]];return Qe(t,0,n,e,r),r.push(t[n]),r}function tn(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return $e(t=n?t:function(t,e){for(var n,r,i,o,s,a=t[0],u=[a],l=1,c=t.length;l<c;l++)i=a,void 0,void 0,(o=(r=n=t[l]).x-i.x)*o+(s=r.y-i.y)*s>e&&(u.push(n),a=n);return a!==n&&u.push(n),u}(t,r),r)}function en(t,e,n){return tn(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 nn(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=tn(r,e,n).map((function(t){return[t.x,t.y]}));!rn(i);)i=tn(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 rn(t){return!(t.length<3||3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var on=function(){function t(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++){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}return t.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},t.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))}},t.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])},t}();function sn(t,e){void 0===e&&(e={});for(var n=e.resolution||1e4,r=e.sharpness||.85,i=[],o=rt(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new on({duration:n,points:o,sharpness:r}),a=function(t){var e=s.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},u=0;u<s.duration;u+=10)a(u);return a(s.duration),h(i,e.properties)}function an(t,e){void 0===e&&(e={});var n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r];return l([[s,[i,r],[i,o],[n,o],s]],e.properties,{bbox:t,id:e.id})}function un(t){return an(Z(t))}function ln(t){var e=t[0],n=t[1],r=t[2],i=t[3];if(ve(t.slice(0,2),[r,n])>=ve(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 cn(t,e,n,r){void 0===r&&(r={});var i=K(t),o=I(i[0]),s=I(i[1]),u=I(n),l=x(e,r.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(u));return a([w(o+Math.atan2(Math.sin(u)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c))),w(c)],r.properties)}function hn(t,e,n){void 0===n&&(n={});for(var r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],s=0;s<r;s++)o.push(cn(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),l([o],i)}function pn(t,e,n){if(void 0===n&&(n={}),!0===n.final)return function(t,e){var n=pn(e,t);return(n+180)%360}(t,e);var r=K(t),i=K(e),o=I(r[0]),s=I(i[0]),a=I(r[1]),u=I(i[1]),l=Math.sin(s-o)*Math.cos(u),c=Math.cos(a)*Math.sin(u)-Math.sin(a)*Math.cos(u)*Math.cos(s-o);return w(Math.atan2(l,c))}function fn(t,e){void 0===e&&(e={});var n=Z(t);return a([(n[0]+n[2])/2,(n[1]+n[3])/2],e.properties,e)}function gn(t,e){void 0===e&&(e={});var n=0,r=0,i=0;return R(t,(function(t){n+=t[0],r+=t[1],i++}),!0),a([n/i,r/i],e.properties)}function dn(t){var e=[];return"FeatureCollection"===t.type?F(t,(function(t){R(t,(function(n){e.push(a(n,t.properties))}))})):R(t,(function(n){e.push(a(n,t.properties))})),f(e)}var yn=_n,vn=_n;function _n(t,e,n){n=n||2;var r,i,o,s,a,u,l,c=e&&e.length,h=c?e[0]*n:t.length,p=mn(t,0,h,n,!0),f=[];if(!p)return f;if(c&&(p=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=mn(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(Mn(s));for(a.sort(Sn),i=0;i<a.length;i++)Cn(a[i],n),n=xn(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<h;g+=n)(a=t[g])<r&&(r=a),(u=t[g+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-r,s-i))?1/l:0}return En(p,f,n,r,i,l),f}function mn(t,e,n,r,i){var o,s;if(i===Bn(t,e,n,r)>0)for(o=e;o<n;o+=r)s=kn(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=kn(o,t[o],t[o+1],s);return s&&Tn(s,s.next)&&(Gn(s),s=s.next),s}function xn(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Tn(r,r.next)&&0!==Rn(r.prev,r,r.next))r=r.next;else{if(Gn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function En(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Pn(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,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(u=l;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,l*=2}while(s>1)}(i)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?wn(t,r,i,o):bn(t))e.push(a.i/n),e.push(t.i/n),e.push(u.i/n),Gn(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?En(t=In(t,e,n),e,n,r,i,o,2):2===s&&Nn(t,e,n,r,i,o):En(xn(t),e,n,r,i,o,1);break}}}function bn(t){var e=t.prev,n=t,r=t.next;if(Rn(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Ln(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Rn(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wn(t,e,n,r){var i=t.prev,o=t,s=t.next;if(Rn(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,l=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,h=Pn(a,u,e,n,r),p=Pn(l,c,e,n,r),f=t.prevZ,g=t.nextZ;f&&f.z>=h&&g&&g.z<=p;){if(f!==t.prev&&f!==t.next&&Ln(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Rn(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,g!==t.prev&&g!==t.next&&Ln(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&Rn(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&Ln(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Rn(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;g&&g.z<=p;){if(g!==t.prev&&g!==t.next&&Ln(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&Rn(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function In(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Tn(i,o)&&An(i,r,r.next,o)&&Dn(i,o)&&Dn(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Gn(r),Gn(r.next),r=t=o),r=r.next}while(r!==t);return r}function Nn(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&On(s,a)){var u=Fn(s,a);return s=xn(s,s.next),u=xn(u,u.next),En(s,e,n,r,i,o),void En(u,e,n,r,i,o)}a=a.next}s=s.next}while(s!==t)}function Sn(t,e){return t.x-e.x}function Cn(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,l=n,c=n.x,h=n.y,p=1/0;for(r=n.next;r!==l;)i>=r.x&&r.x>=c&&i!==r.x&&Ln(o<h?i:s,o,c,h,o<h?s:i,o,r.x,r.y)&&((u=Math.abs(o-r.y)/(i-r.x))<p||u===p&&r.x>n.x)&&Dn(r,t)&&(n=r,p=u),r=r.next;return n}(t,e)){var n=Fn(e,t);xn(n,n.next)}}function Pn(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 Mn(t){var e=t,n=t;do{e.x<n.x&&(n=e),e=e.next}while(e!==t);return n}function Ln(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 On(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&&An(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&Dn(t,e)&&Dn(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)}function Rn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Tn(t,e){return t.x===e.x&&t.y===e.y}function An(t,e,n,r){return!!(Tn(t,e)&&Tn(n,r)||Tn(t,r)&&Tn(n,e))||Rn(t,e,n)>0!=Rn(t,e,r)>0&&Rn(n,r,t)>0!=Rn(n,r,e)>0}function Dn(t,e){return Rn(t.prev,t,t.next)<0?Rn(t,e,t.next)>=0&&Rn(t,t.prev,e)>=0:Rn(t,e,t.prev)<0||Rn(t,t.next,e)<0}function Fn(t,e){var n=new qn(t.i,t.x,t.y),r=new qn(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 kn(t,e,n,r){var i=new qn(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 Gn(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 qn(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 Bn(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 zn(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=yn(e.vertices,e.holes,2),r=[],i=[];n.forEach((function(t,r){var o=n[r];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;o<i.length;o+=3){var s=i.slice(o,o+3);s.push(i[o]),r.push(l([s]))}return r}function jn(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n,r=1/0,i=0;return F(e,(function(e,n){var o=ve(t,e);o<r&&(i=n,r=o)})),(n=be(e.features[i])).properties.featureIndex=i,n.properties.distanceToPoint=r,n}function Un(t){if(!t)throw new Error("geojson is required");var e=[];return z(t,(function(t){!function(t,e){var n=[],r=t.geometry;if(null!==r){switch(r.type){case"Polygon":n=Q(r);break;case"LineString":n=[Q(r)]}n.forEach((function(n){(function(t,e){var n=[];return t.reduce((function(t,r){var i=h([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)})),f(e)}_n.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Bn(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,c=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Bn(t,l,c,n))}var h=0;for(a=0;a<r.length;a+=3){var p=r[a]*n,f=r[a+1]*n,g=r[a+2]*n;h+=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===h?0:Math.abs((h-s)/s)},_n.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},yn.default=vn;var Vn=qt((function(t,e){function n(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function r(t,e,r){if(void 0===r&&(r={}),!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(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return n({type:"Point",coordinates:t},e,r)}function i(t,e,r){void 0===r&&(r={});for(var i=0,o=t;i<o.length;i++){var s=o[i];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return n({type:"Polygon",coordinates:t},e,r)}function o(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return n({type:"LineString",coordinates:t},e,r)}function s(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function a(t,e,r){return void 0===r&&(r={}),n({type:"MultiLineString",coordinates:t},e,r)}function u(t,e,r){return void 0===r&&(r={}),n({type:"MultiPoint",coordinates:t},e,r)}function l(t,e,r){return void 0===r&&(r={}),n({type:"MultiPolygon",coordinates:t},e,r)}function c(t,n){void 0===n&&(n="kilometers");var r=e.factors[n];if(!r)throw new Error(n+" units is invalid");return t*r}function h(t,n){void 0===n&&(n="kilometers");var r=e.factors[n];if(!r)throw new Error(n+" units is invalid");return t/r}function p(t){return t%(2*Math.PI)*180/Math.PI}function f(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:1.0936*e.earthRadius},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=n,e.geometry=function(t,e,n){switch(t){case"Point":return r(e).geometry;case"LineString":return o(e).geometry;case"Polygon":return i(e).geometry;case"MultiPoint":return u(e).geometry;case"MultiLineString":return a(e).geometry;case"MultiPolygon":return l(e).geometry;default:throw new Error(t+" is invalid")}},e.point=r,e.points=function(t,e,n){return void 0===n&&(n={}),s(t.map((function(t){return r(t,e)})),n)},e.polygon=i,e.polygons=function(t,e,n){return void 0===n&&(n={}),s(t.map((function(t){return i(t,e)})),n)},e.lineString=o,e.lineStrings=function(t,e,n){return void 0===n&&(n={}),s(t.map((function(t){return o(t,e)})),n)},e.featureCollection=s,e.multiLineString=a,e.multiPoint=u,e.multiPolygon=l,e.geometryCollection=function(t,e,r){return void 0===r&&(r={}),n({type:"GeometryCollection",geometries:t},e,r)},e.round=function(t,e){if(void 0===e&&(e=0),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},e.radiansToLength=c,e.lengthToRadians=h,e.lengthToDegrees=function(t,e){return p(h(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=p,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return c(h(t,e),n)},e.convertArea=function(t,n,r){if(void 0===n&&(n="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[n];if(!i)throw new Error("invalid original units");var o=e.areaFactors[r];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=f,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(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(!f(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(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 Xn(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,c,h=0,p=0,f=t.type,g="FeatureCollection"===f,d="Feature"===f,y=g?t.features.length:1,v=0;v<y;v++){a=(c=!!(l=g?t.features[v].geometry:d?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var _=0;_<a;_++){var m=0,x=0;if(null!==(s=c?l.geometries[_]:l)){u=s.coordinates;var E=s.type;switch(h=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===e(u,p,v,m,x))return!1;p++,m++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(!1===e(u[r],p,v,m,x))return!1;p++,"MultiPoint"===E&&m++}"LineString"===E&&m++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-h;i++){if(!1===e(u[r][i],p,v,m,x))return!1;p++}"MultiLineString"===E&&m++,"Polygon"===E&&x++}"Polygon"===E&&m++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(x=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-h;o++){if(!1===e(u[r][i][o],p,v,m,x))return!1;p++}x++}m++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===Xn(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Yn(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function Hn(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function Wn(t,e){var n,r,i,o,s,a,u,l,c,h,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,l=f?t.features[n].properties:g?t.properties:{},c=f?t.features[n].bbox:g?t.bbox:void 0,h=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":if(!1===e(o,p,l,c,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],p,l,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,p,l,c,h))return!1;p++}}function Jn(t,e){Wn(t,(function(t,n,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(Vn.feature(t,r,{bbox:i,id:o}),n,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l={type:s,coordinates:t.coordinates[u]};if(!1===e(Vn.feature(l,r),n,u))return!1}}))}function Zn(t,e){Jn(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==Xn(t,(function(o,c,h,p,f){if(void 0===s||n>a||p>u||f>l)return s=o,a=n,u=p,l=f,void(i=0);var g=Vn.lineString([s,o],t.properties);if(!1===e(g,n,r,f,i))return!1;i++,s=o}))&&void 0}}}))}function Kn(t,e){if(!t)throw new Error("geojson is required");Jn(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(Vn.lineString(o[s],t.properties),n,r,s))return!1}}}))}var Qn=Xn,$n=Hn,tr=Jn,er=Wn,nr=Kn,rr=Yn,ir=Zn,or=Object.defineProperty({coordAll:function(t){var e=[];return Xn(t,(function(t){e.push(t)})),e},coordEach:Qn,coordReduce:function(t,e,n,r){var i=n;return Xn(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i},featureEach:$n,featureReduce:function(t,e,n){var r=n;return Hn(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},findPoint:function(t,e){if(e=e||{},!Vn.isObject(e))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return Vn.point(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Vn.point(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Vn.point(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Vn.point(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Vn.point(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),Vn.point(u[i][o][s],a,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(e=e||{},!Vn.isObject(e))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),Vn.lineString([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),Vn.lineString([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),Vn.lineString([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),Vn.lineString([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},flattenEach:tr,flattenReduce:function(t,e,n){var r=n;return Jn(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r},geomEach:er,geomReduce:function(t,e,n){var r=n;return Wn(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r},lineEach:nr,lineReduce:function(t,e,n){var r=n;return Kn(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r},propEach:rr,propReduce:function(t,e,n){var r=n;return Yn(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},segmentEach:ir,segmentReduce:function(t,e,n){var r=n,i=!1;return Zn(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}},"__esModule",{value:!0});function sr(t){var e=[1/0,1/0,-1/0,-1/0];return or.coordEach(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}sr.default=sr;var ar=sr,ur=Object.defineProperty({default:ar},"__esModule",{value:!0}).default,lr=or.featureEach,cr=(or.coordEach,Vn.polygon,Vn.featureCollection);function hr(t){var e=It(t);return e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:ur(t),It.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:ur(t),e.push(t)})):lr(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:ur(t),e.push(t)})),It.prototype.load.call(this,e)},e.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:ur(t),It.prototype.remove.call(this,t,e)},e.clear=function(){return It.prototype.clear.call(this)},e.search=function(t){var e=It.prototype.search.call(this,this.toBBox(t));return cr(e)},e.collides=function(t){return It.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=It.prototype.all.call(this);return cr(t)},e.toJSON=function(){return It.prototype.toJSON.call(this)},e.fromJSON=function(t){return It.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else if("Feature"===t.type)e=ur(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=ur(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}var pr=hr,fr=hr;function gr(t,e){var n={},r=[];if("LineString"===t.type&&(t=o(t)),"LineString"===e.type&&(e=o(e)),"Feature"===t.type&&"Feature"===e.type&&null!==t.geometry&&null!==e.geometry&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var i=dr(t,e);return i&&r.push(i),f(r)}var s=pr();return s.load(Un(e)),F(Un(t),(function(t){F(s.search(t),(function(e){var i=dr(t,e);if(i){var o=Q(i).join(",");n[o]||(n[o]=!0,r.push(i))}}))})),f(r)}function dr(t,e){var n=Q(t),r=Q(e);if(2!==n.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==r.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],u=n[1][1],l=r[0][0],c=r[0][1],h=r[1][0],p=r[1][1],f=(p-c)*(s-i)-(h-l)*(u-o);if(0===f)return null;var g=((h-l)*(o-c)-(p-c)*(i-l))/f,d=((s-i)*(o-c)-(u-o)*(i-l))/f;return g>=0&&g<=1&&d>=0&&d<=1?a([i+g*(s-i),o+g*(u-o)]):null}function yr(t,e,n){void 0===n&&(n={});var r=a([1/0,1/0],{dist:1/0}),i=0;return z(t,(function(t){for(var o=Q(t),s=0;s<o.length-1;s++){var u=a(o[s]);u.properties.dist=ve(e,u,n);var l=a(o[s+1]);l.properties.dist=ve(e,l,n);var c=ve(u,l,n),p=Math.max(u.properties.dist,l.properties.dist),f=pn(u,l),g=cn(e,p,f+90,n),d=cn(e,p,f-90,n),y=gr(h([g.geometry.coordinates,d.geometry.coordinates]),h([u.geometry.coordinates,l.geometry.coordinates])),v=null;y.features.length>0&&((v=y.features[0]).properties.dist=ve(e,v,n),v.properties.location=i+ve(u,v,n)),u.properties.dist<r.properties.dist&&((r=u).properties.index=s,r.properties.location=i),l.properties.dist<r.properties.dist&&((r=l).properties.index=s+1,r.properties.location=i+c),v&&v.properties.dist<r.properties.dist&&((r=v).properties.index=s),i+=c}})),r}function vr(t,n,r){void 0===r&&(r={});var i=K(t),o=K(n);return o[0]+=o[0]-i[0]>180?-360:i[0]-o[0]>180?360:0,N(function(t,n,r){var i=r=void 0===r?e:Number(r),o=t[1]*Math.PI/180,s=n[1]*Math.PI/180,a=s-o,u=Math.abs(n[0]-t[0])*Math.PI/180;u>Math.PI&&(u-=2*Math.PI);var l=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),c=Math.abs(l)>1e-11?a/l:Math.cos(o);return Math.sqrt(a*a+c*c*u*u)*i}(i,o),"meters",r.units)}function _r(t,e,n){if(void 0===n&&(n={}),n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=a(t):"Point"===t.type?t=o(t):et(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=h(e):"LineString"===e.type?e=o(e):et(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return U(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],s=function(t,e,n,r){var i=[n[0]-e[0],n[1]-e[1]],o=mr([t[0]-e[0],t[1]-e[1]],i);if(o<=0)return xr(t,e,{method:r.method,units:"degrees"});var s=mr(i,i);if(s<=o)return xr(t,n,{method:r.method,units:"degrees"});var a=o/s;return xr(t,[e[0]+a*i[0],e[1]+a*i[1]],{method:r.method,units:"degrees"})}(i,e,o,n);s<r&&(r=s)})),N(r,"degrees",n.units)}function mr(t,e){return t[0]*e[0]+t[1]*e[1]}function xr(t,e,n){return"planar"===n.method?vr(t,e,n):ve(t,e,n)}function Er(t,e,n,r,i,o,s,a){var u,l,c,h,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:(h=(n-t)*(l=e-o)-(r-e)*(c=t-i),l=((s-i)*l-(a-o)*c)/u,c=h/u,p.x=t+l*(n-t),p.y=e+l*(r-e),l>=0&&l<=1&&(p.onLine1=!0),c>=0&&c<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y])}function br(t){for(var e=function(t){return"FeatureCollection"!==t.type?"Feature"!==t.type?f([o(t)]):f([t]):t}(t),n=fn(e),r=!1,i=0;!r&&i<e.features.length;){var s,u=e.features[i].geometry,l=!1;if("Point"===u.type)n.geometry.coordinates[0]===u.coordinates[0]&&n.geometry.coordinates[1]===u.coordinates[1]&&(r=!0);else if("MultiPoint"===u.type){var c=!1;for(s=0;!c&&s<u.coordinates.length;)n.geometry.coordinates[0]===u.coordinates[s][0]&&n.geometry.coordinates[1]===u.coordinates[s][1]&&(r=!0,c=!0),s++}else if("LineString"===u.type)for(s=0;!l&&s<u.coordinates.length-1;)wr(n.geometry.coordinates[0],n.geometry.coordinates[1],u.coordinates[s][0],u.coordinates[s][1],u.coordinates[s+1][0],u.coordinates[s+1][1])&&(l=!0,r=!0),s++;else if("MultiLineString"===u.type)for(var h=0;h<u.coordinates.length;){l=!1,s=0;for(var p=u.coordinates[h];!l&&s<p.length-1;)wr(n.geometry.coordinates[0],n.geometry.coordinates[1],p[s][0],p[s][1],p[s+1][0],p[s+1][1])&&(l=!0,r=!0),s++;h++}else"Polygon"!==u.type&&"MultiPolygon"!==u.type||ge(n,u)&&(r=!0);i++}if(r)return n;var g=f([]);for(i=0;i<e.features.length;i++)g.features=g.features.concat(dn(e.features[i]).features);return a(jn(n,g).geometry.coordinates)}function wr(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))}pr.default=fr;var Ir=6378137;function Nr(t){return B(t,(function(t,e){return t+function(t){var e,n=0;switch(t.type){case"Polygon":return Sr(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)n+=Sr(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}function Sr(t){var e=0;if(t&&t.length>0){e+=Math.abs(Cr(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(Cr(t[n]))}return e}function Cr(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+=(Pr(t[o][0])-Pr(e[0]))*Math.sin(Pr(n[1]));a=a*Ir*Ir/2}return a}function Pr(t){return t*Math.PI/180}function Mr(t,e){return void 0===e&&(e={}),V(t,(function(t,n){var r=n.geometry.coordinates;return t+ve(r[0],r[1],e)}),0)}function Lr(t,e,n,r){if(!P(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,a,u,l=i.length,c=0,p=0;p<i.length&&!(e>=c&&p===i.length-1);p++){if(c>e&&0===o.length){if(!(s=e-c))return o.push(i[p]),h(o);a=pn(i[p],i[p-1])-180,u=cn(i[p],s,a,r),o.push(u.geometry.coordinates)}if(c>=n)return(s=n-c)?(a=pn(i[p],i[p-1])-180,u=cn(i[p],s,a,r),o.push(u.geometry.coordinates),h(o)):(o.push(i[p]),h(o));if(c>=e&&o.push(i[p]),p===i.length-1)return h(o);c+=ve(i[p],i[p+1],r)}if(c<e&&i.length===l)throw new Error("Start position is beyond line");var f=i[i.length-1];return h([f,f])}function Or(t,e,n){void 0===n&&(n={});for(var r=K(t),i=Q(e),o=0;o<i.length-1;o++){var s=!1;if(n.ignoreEndVertices&&(0===o&&(s="start"),o===i.length-2&&(s="end"),0===o&&o+1===i.length-1&&(s="both")),Rr(i[o],i[o+1],r,s,void 0===n.epsilon?null:n.epsilon))return!0}return!1}function Rr(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],u=t[1],l=e[0],c=e[1],h=l-a,p=c-u,f=(n[0]-a)*p-(n[1]-u)*h;if(null!==i){if(Math.abs(f)>i)return!1}else if(0!==f)return!1;return r?"start"===r?Math.abs(h)>=Math.abs(p)?h>0?a<o&&o<=l:l<=o&&o<a:p>0?u<s&&s<=c:c<=s&&s<u:"end"===r?Math.abs(h)>=Math.abs(p)?h>0?a<=o&&o<l:l<o&&o<=a:p>0?u<=s&&s<c:c<s&&s<=u:"both"===r&&(Math.abs(h)>=Math.abs(p)?h>0?a<o&&o<l:l<o&&o<a:p>0?u<s&&s<c:c<s&&s<u):Math.abs(h)>=Math.abs(p)?h>0?a<=o&&o<=l:l<=o&&o<=a:p>0?u<=s&&s<=c:c<=s&&s<=u}function Tr(t,e){var n=rt(t),r=rt(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var n,r=!1;for(n=0;n<e.coordinates.length;n++)if(Dr(e.coordinates[n],t.coordinates)){r=!0;break}return r}(n,r);case"LineString":return Or(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return ge(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){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++)Dr(t.coordinates[n],e.coordinates[i])&&(r=!0);if(!r)return!1}return!0}(n,r);case"LineString":return function(t,e){for(var n=!1,r=0;r<t.coordinates.length;r++){if(!Or(t.coordinates[r],e))return!1;n||(n=Or(t.coordinates[r],e,{ignoreEndVertices:!0}))}return n}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){for(var n=!0,r=!1,i=0;i<t.coordinates.length;i++){if(!(r=ge(t.coordinates[1],e))){n=!1;break}r=ge(t.coordinates[1],e,{ignoreBoundary:!0})}return n&&r}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(t,e){for(var n=0;n<t.coordinates.length;n++)if(!Or(t.coordinates[n],e))return!1;return!0}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){if(!Ar(Z(e),Z(t)))return!1;for(var n=!1,r=0;r<t.coordinates.length-1;r++){if(!ge(t.coordinates[r],e))return!1;n||(n=ge(t.coordinates[r],e,{ignoreBoundary:!0})),n||(n=ge(Fr(t.coordinates[r],t.coordinates[r+1]),e,{ignoreBoundary:!0}))}return n}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(t,e){var n=Z(t);if(!Ar(Z(e),n))return!1;for(var r=0;r<t.coordinates[0].length;r++)if(!ge(t.coordinates[0][r],e))return!1;return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function Ar(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Dr(t,e){return t[0]===e[0]&&t[1]===e[1]}function Fr(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function kr(t,e,n){void 0===n&&(n={}),n.mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],s=t[2],u=t[3],l=e/ve([i,o],[s,o],n)*(s-i),c=e/ve([i,o],[i,u],n)*(u-o),h=s-i,p=u-o,g=Math.floor(h/l),d=(p-Math.floor(p/c)*c)/2,y=i+(h-g*l)/2;y<=s;){for(var v=o+d;v<=u;){var _=a([y,v],n.properties);n.mask?Tr(_,n.mask)&&r.push(_):r.push(_),v+=c}y+=l}return f(r)}function Gr(t,e){void 0===e&&(e={});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 R(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 qr(t){if(!t)throw new Error("geojson is required");var e=[];return z(t,(function(t){e.push(t)})),f(e)}function Br(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(!Br(t[n],e[n]))return!1}else if(t[n]!==e[n])return!1;return!0}function zr(t){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 e=t.geometry.coordinates.length,n=[],r=0;r<e;r++){var i=t.geometry.coordinates[r];Yr(i[0],i[i.length-1])||i.push(i[0]),n.push.apply(n,i.slice(0,i.length-1))}if(!function(t){for(var e={},n=1,r=0,i=t.length;r<i;++r){if(Object.prototype.hasOwnProperty.call(e,t[r])){n=0;break}e[t[r]]=1}return n}(n))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var o=n.length,s=function(t,e,n){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===n&&(n=1);var r=t.geometry.coordinates,i=[],o={};if(n){for(var s=[],a=0;a<r.length;a++)for(var u=0;u<r[a].length-1;u++)s.push(d(a,u));var l=It();l.load(s)}for(var c=0;c<r.length;c++)for(var h=0;h<r[c].length-1;h++)if(n)l.search(d(c,h)).forEach((function(t){var e=t.ring,n=t.edge;g(c,h,e,n)}));else for(var p=0;p<r.length;p++)for(var f=0;f<r[p].length-1;f++)g(c,h,p,f);return e||(i={type:"Feature",geometry:{type:"MultiPoint",coordinates:i}}),i;function g(t,n,s,a){var u,l,c=r[t][n],h=r[t][n+1],p=r[s][a],f=r[s][a+1],g=function(t,e,n,r){if(Br(t,n)||Br(t,r)||Br(e,n)||Br(r,n))return null;var i=t[0],o=t[1],s=e[0],a=e[1],u=n[0],l=n[1],c=r[0],h=r[1],p=(i-s)*(l-h)-(o-a)*(u-c);return 0===p?null:[((i*a-o*s)*(u-c)-(i-s)*(u*h-l*c))/p,((i*a-o*s)*(l-h)-(o-a)*(u*h-l*c))/p]}(c,h,p,f);if(null!==g&&(u=h[0]!==c[0]?(g[0]-c[0])/(h[0]-c[0]):(g[1]-c[1])/(h[1]-c[1]),l=f[0]!==p[0]?(g[0]-p[0])/(f[0]-p[0]):(g[1]-p[1])/(f[1]-p[1]),!(u>=1||u<=0||l>=1||l<=0))){var d=g,y=!o[d];y&&(o[d]=!0),e?i.push(e(g,t,n,c,h,u,s,a,p,f,l,y)):i.push(g)}}function d(t,e){var n,i,o,s,a=r[t][e],u=r[t][e+1];return a[0]<u[0]?(n=a[0],i=u[0]):(n=u[0],i=a[0]),a[1]<u[1]?(o=a[1],s=u[1]):(o=u[1],s=a[1]),{minX:n,minY:o,maxX:i,maxY:s,ring:t,edge:e}}}(t,(function(t,e,n,r,i,o,s,a,u,l,c,h){return[t,e,n,r,i,o,s,a,u,l,c,h]})),a=s.length;if(0==a){var u=[];for(r=0;r<e;r++)u.push(l([t.geometry.coordinates[r]],{parent:-1,winding:Xr(t.geometry.coordinates[r])}));var c=f(u);return G(),q(),c}var h=[],p=[];for(r=0;r<e;r++){h.push([]);for(var g=0;g<t.geometry.coordinates[r].length-1;g++)h[r].push([new jr(t.geometry.coordinates[r][Hr(g+1,t.geometry.coordinates[r].length-1)],1,[r,g],[r,Hr(g+1,t.geometry.coordinates[r].length-1)],void 0)]),p.push(new Ur(t.geometry.coordinates[r][g],[r,Hr(g-1,t.geometry.coordinates[r].length-1)],[r,g],void 0,void 0,!1,!0))}for(r=0;r<a;r++)h[s[r][1]][s[r][2]].push(new jr(s[r][0],s[r][5],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0)),s[r][11]&&p.push(new Ur(s[r][0],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0,void 0,!0,!0));var d=p.length;for(r=0;r<h.length;r++)for(g=0;g<h[r].length;g++)h[r][g].sort((function(t,e){return t.param<e.param?-1:1}));var y=[];for(r=0;r<d;r++)y.push({minX:p[r].coord[0],minY:p[r].coord[1],maxX:p[r].coord[0],maxY:p[r].coord[1],index:r});var v=It();for(v.load(y),r=0;r<h.length;r++)for(g=0;g<h[r].length;g++)for(var _=0;_<h[r][g].length;_++){x=_==h[r][g].length-1?h[r][Hr(g+1,t.geometry.coordinates[r].length-1)][0].coord:h[r][g][_+1].coord;var m=v.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0];h[r][g][_].nxtIsectAlongEdgeIn=m.index}for(r=0;r<h.length;r++)for(g=0;g<h[r].length;g++)for(_=0;_<h[r][g].length;_++){var x=h[r][g][_].coord,E=(m=v.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0]).index;E<o?p[E].nxtIsectAlongRingAndEdge2=h[r][g][_].nxtIsectAlongEdgeIn:Yr(p[E].ringAndEdge1,h[r][g][_].ringAndEdgeIn)?p[E].nxtIsectAlongRingAndEdge1=h[r][g][_].nxtIsectAlongEdgeIn:p[E].nxtIsectAlongRingAndEdge2=h[r][g][_].nxtIsectAlongEdgeIn}var b=[];for(r=0,g=0;g<e;g++){var w=r;for(_=0;_<t.geometry.coordinates[g].length-1;_++)p[r].coord[0]<p[w].coord[0]&&(w=r),r++;var I=p[w].nxtIsectAlongRingAndEdge2;for(_=0;_<p.length;_++)if(p[_].nxtIsectAlongRingAndEdge1==w||p[_].nxtIsectAlongRingAndEdge2==w){var N=_;break}var S=Vr([p[N].coord,p[w].coord,p[I].coord],!0)?1:-1;b.push({isect:w,parent:-1,winding:S})}for(b.sort((function(t,e){return p[t.isect].coord>p[e.isect].coord?-1:1})),u=[];b.length>0;){var C=b.pop(),P=C.isect,M=C.parent,L=C.winding,O=u.length,R=[p[P].coord],T=P;if(p[P].ringAndEdge1Walkable)var A=p[P].ringAndEdge1,D=p[P].nxtIsectAlongRingAndEdge1;else A=p[P].ringAndEdge2,D=p[P].nxtIsectAlongRingAndEdge2;for(;!Yr(p[P].coord,p[D].coord);){R.push(p[D].coord);var F=void 0;for(r=0;r<b.length;r++)if(b[r].isect==D){F=r;break}if(null!=F&&b.splice(F,1),Yr(A,p[D].ringAndEdge1)){if(A=p[D].ringAndEdge2,p[D].ringAndEdge2Walkable=!1,p[D].ringAndEdge1Walkable){var k={isect:D};Vr([p[T].coord,p[D].coord,p[p[D].nxtIsectAlongRingAndEdge2].coord],1==L)?(k.parent=M,k.winding=-L):(k.parent=O,k.winding=L),b.push(k)}T=D,D=p[D].nxtIsectAlongRingAndEdge2}else A=p[D].ringAndEdge1,p[D].ringAndEdge1Walkable=!1,p[D].ringAndEdge2Walkable&&(k={isect:D},Vr([p[T].coord,p[D].coord,p[p[D].nxtIsectAlongRingAndEdge1].coord],1==L)?(k.parent=M,k.winding=-L):(k.parent=O,k.winding=L),b.push(k)),T=D,D=p[D].nxtIsectAlongRingAndEdge1}R.push(p[D].coord),u.push(l([R],{index:O,parent:M,winding:L,netWinding:void 0}))}function G(){for(var t=[],e=0;e<c.features.length;e++)-1==c.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<c.features.length;r++)t[e]!=r&&ge(c.features[t[e]].geometry.coordinates[0][0],c.features[r],{ignoreBoundary:!0})&&Nr(c.features[r])<1/0&&(n=r);c.features[t[e]].properties.parent=n}}function q(){for(var t=0;t<c.features.length;t++)if(-1==c.features[t].properties.parent){var e=c.features[t].properties.winding;c.features[t].properties.netWinding=e,B(t,e)}}function B(t,e){for(var n=0;n<c.features.length;n++)if(c.features[n].properties.parent==t){var r=e+c.features[n].properties.winding;c.features[n].properties.netWinding=r,B(n,r)}}return c=f(u),G(),q(),c}var jr=function(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i},Ur=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};function Vr(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 Xr(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);if(Vr([t[Hr(e-1,t.length-1)],t[e],t[Hr(e+1,t.length-1)]],!0))var r=1;else r=-1;return r}function Yr(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(!Yr(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0}function Hr(t,e){return(t%e+e)%e}var Wr=Math.PI/180,Jr=180/Math.PI,Zr=function(t,e){this.lon=t,this.lat=e,this.x=Wr*t,this.y=Wr*e};Zr.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},Zr.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new Zr(e,t)};var Kr=function(){this.coords=[],this.length=0};Kr.prototype.move_to=function(t){this.length++,this.coords.push(t)};var Qr=function(t){this.properties=t||{},this.geometries=[]};Qr.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}},Qr.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 $r=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 Zr(t.x,t.y),this.end=new Zr(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)};function ti(t,e){var n=[],r=pr();return z(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=ni(e,i);n=n.filter((function(t){return t.id!==o.id})),r.remove(o),F(ei(o,e),(function(t){n.push(t),r.insert(t)}))}}else(n=ei(t,e).features).forEach((function(t){t.bbox||(t.bbox=ln(Z(t)))})),r.load(f(n))})),f(n)}function ei(t,e){var n=[],r=Q(t)[0],i=Q(t)[t.geometry.coordinates.length-1];if(ri(r,K(e))||ri(i,K(e)))return f([t]);var o=pr(),s=Un(t);o.load(s);var a=o.search(e);if(!a.features.length)return f([t]);var u=ni(e,a),l=k(s,(function(t,r,i){var o=Q(r)[1],s=K(e);return i===u.id?(t.push(s),n.push(h(t)),ri(s,o)?[s]:[s,o]):(t.push(o),t)}),[r]);return l.length>1&&n.push(h(l)),f(n)}function ni(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 F(e,(function(e){var i=yr(e,t).properties.dist;i<r&&(n=e,r=i)})),n}function ri(t,e){return t[0]===e[0]&&t[1]===e[1]}function ii(t,e,n,r,i){void 0===i&&(i={});var o=i.steps||64,s=oi(n),a=oi(r),u=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(s===a)return h(hn(t,e,i).geometry.coordinates[0],u);for(var l=s,c=s<a?a:a+360,p=l,f=[],g=0;p<c;)f.push(cn(t,e,p,i).geometry.coordinates),p=l+360*++g/o;return p>c&&f.push(cn(t,e,c,i).geometry.coordinates),h(f,u)}function oi(t){var e=t%360;return e<0&&(e+=360),e}function si(t,e){void 0===e&&(e={});var n=rt(t);switch(e.properties||"Feature"!==t.type||(e.properties=t.properties),n.type){case"Polygon":return ai(n,e);case"MultiPolygon":return function(t,e){void 0===e&&(e={});var n=rt(t).coordinates,r=e.properties?e.properties:"Feature"===t.type?t.properties:{},i=[];return n.forEach((function(t){i.push(ui(t,r))})),f(i)}(n,e);default:throw new Error("invalid poly")}}function ai(t,e){return void 0===e&&(e={}),ui(rt(t).coordinates,e.properties?e.properties:"Feature"===t.type?t.properties:{})}function ui(t,e){return t.length>1?g(t,e):h(t[0],e)}function li(t,e){var n,r,i;void 0===e&&(e={});var o=e.properties,s=null===(n=e.autoComplete)||void 0===n||n,a=null===(r=e.orderCoords)||void 0===r||r;if("FeatureCollection"===(null!==(i=e.mutate)&&void 0!==i&&i||(t=be(t)),t.type)){var u=[];return t.features.forEach((function(t){u.push(Q(ci(t,{},s,a)))})),y(u,o)}return ci(t,o,s,a)}function ci(t,e,n,r){e=e||("Feature"===t.type?t.properties:{});var i=rt(t),o=i.coordinates,s=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return n&&(o=hi(o)),l([o],e);case"MultiLineString":var a=[],u=0;return o.forEach((function(t){if(n&&(t=hi(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)}(Z(h(t)));e>u?(a.unshift(t),u=e):a.push(t)}else a.push(t)})),l(a,e);default:throw new Error("geometry type "+s+" is not supported")}}function hi(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 pi(t,e){var n,r,i,o,s,a,u;for(r=1;r<=8;r*=2){for(n=[],o=!(gi(i=t[t.length-1],e)&r),s=0;s<t.length;s++)(u=!(gi(a=t[s],e)&r))!==o&&n.push(fi(i,a,r,e)),u&&n.push(a),i=a,o=u;if(!(t=n).length)break}return n}function fi(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 gi(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 di(t,e){for(var n=[],r=0,i=t;r<i.length;r++){var o=pi(i[r],e);o.length>0&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),o.length>=4&&n.push(o))}return n}$r.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=Jr*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[Jr*Math.atan2(i,r),s]},$r.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,l=e&&e.offset?e.offset:10,c=180-l,h=-180+l,p=360-l,f=1;f<n.length;++f){var g=n[f-1][0],d=n[f][0],y=Math.abs(d-g);y>p&&(d>c&&g<h||g>c&&d<h)?a=!0:y>u&&(u=y)}var v=[];if(a&&u<l){var _=[];v.push(_);for(var m=0;m<n.length;++m){var x=parseFloat(n[m][0]);if(m>0&&Math.abs(x-n[m-1][0])>p){var E=parseFloat(n[m-1][0]),b=parseFloat(n[m-1][1]),w=parseFloat(n[m][0]),I=parseFloat(n[m][1]);if(E>-180&&E<h&&180===w&&m+1<n.length&&n[m-1][0]>-180&&n[m-1][0]<h){_.push([-180,n[m][1]]),m++,_.push([n[m][0],n[m][1]]);continue}if(E>c&&E<180&&-180===w&&m+1<n.length&&n[m-1][0]>c&&n[m-1][0]<180){_.push([180,n[m][1]]),m++,_.push([n[m][0],n[m][1]]);continue}if(E<h&&w>c){var N=E;E=w,w=N;var S=b;b=I,I=S}if(E>c&&w<h&&(w+=360),E<=180&&w>=180&&E<w){var C=(180-E)/(w-E),P=C*I+(1-C)*b;_.push([n[m-1][0]>c?180:-180,P]),(_=[]).push([n[m-1][0]>c?-180:180,P]),v.push(_)}else _=[],v.push(_);_.push([x,n[m][1]])}else _.push([n[m][0],n[m][1]])}}else{var M=[];v.push(M);for(var L=0;L<n.length;++L)M.push([n[L][0],n[L][1]])}for(var O=new Qr(this.properties),R=0;R<v.length;++R){var T=new Kr;O.geometries.push(T);for(var A=v[R],D=0;D<A.length;++D)T.move_to(A[D])}return O};var yi=qt((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})),vi=qt((function(t,e){var n="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function i(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}(e=t.exports=n?r:i).supported=r,e.unsupported=i})),_i=qt((function(t){var e=Array.prototype.slice,n=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(r(t)||r(o))return!1;if(t.prototype!==o.prototype)return!1;if(vi(t))return!!vi(o)&&(t=e.call(t),o=e.call(o),n(t,o,s));if(i(t)){if(!i(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 l=yi(t),c=yi(o)}catch(t){return!1}if(l.length!=c.length)return!1;for(l.sort(),c.sort(),a=l.length-1;a>=0;a--)if(l[a]!=c[a])return!1;for(a=l.length-1;a>=0;a--)if(u=l[a],!n(t[u],o[u],s))return!1;return typeof t==typeof o}(t,o,s))};function r(t){return null==t}function i(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 mi(t,e,n){if(void 0===n&&(n={}),!P(n=n||{}))throw new Error("options is invalid");var r,i=n.tolerance||0,o=[],s=pr(),a=Un(t);return s.load(a),U(e,(function(t){var e=!1;t&&(F(s.search(t),(function(n){if(!1===e){var o=Q(t).sort(),s=Q(n).sort();_i(o,s)||(0===i?Or(o[0],n)&&Or(o[1],n):yr(n,o[0]).properties.dist<=i&&yr(n,o[1]).properties.dist<=i)?(e=!0,r=r?xi(r,t):t):(0===i?Or(s[0],t)&&Or(s[1],t):yr(t,s[0]).properties.dist<=i&&yr(t,s[1]).properties.dist<=i)&&(r=r?xi(r,n):n)}})),!1===e&&r&&(o.push(r),r=void 0))})),r&&o.push(r),f(o)}function xi(t,e){var n=Q(e),r=Q(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return _i(n[0],i)?s.unshift(n[1]):_i(n[0],o)?s.push(n[1]):_i(n[1],i)?s.unshift(n[0]):_i(n[1],o)&&s.push(n[0]),t}function Ei(t){var e=t%360;return e<0&&(e+=360),e}function bi(t,e,n){var r;return void 0===n&&(n={}),(r=n.final?wi(K(e),K(t)):wi(K(t),K(e)))>180?-(360-r):r}function wi(t,e){var n=I(t[1]),r=I(e[1]),i=I(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(w(Math.atan2(i,o))+360)%360}function Ii(t,n,r,i){void 0===i&&(i={});var o=n<0,s=N(Math.abs(n),i.units,"meters");o&&(s=-Math.abs(s));var u=K(t),l=function(t,n,r,i){var o=n/(i=void 0===i?e:Number(i)),s=t[0]*Math.PI/180,a=I(t[1]),u=I(r),l=o*Math.cos(u),c=a+l;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(a/2+Math.PI/4)),p=Math.abs(h)>1e-11?l/h:Math.cos(a);return[(180*(s+o*Math.sin(u)/p)/Math.PI+540)%360-180,180*c/Math.PI]}(u,s,r);return l[0]+=l[0]-u[0]>180?-360:u[0]-l[0]>180?360:0,a(l,i.properties)}function Ni(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=Ci(a,u,e),n<=0&&r>0?Ci(e,a,i)<0||(i=a):n>0&&r<=0&&(Si(e,a,o)||(o=a)),n=r}return[i,o]}function Si(t,e,n){return Ci(t,e,n)>0}function Ci(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function Pi(t){for(var e,n,r=Q(t),i=0,o=1;o<r.length;)e=n||r[0],i+=((n=r[o])[0]-e[0])*(n[1]+e[1]),o++;return i>0}function Mi(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return q(t,(function(t){Mi(t,e)})),t;case"LineString":return Li(Q(t),e),t;case"Polygon":return Oi(Q(t),e),t;case"MultiLineString":return Q(t).forEach((function(t){Li(t,e)})),t;case"MultiPolygon":return Q(t).forEach((function(t){Oi(t,e)})),t;case"Point":case"MultiPoint":return t}}function Li(t,e){Pi(t)===e&&t.reverse()}function Oi(t,e){Pi(t[0])!==e&&t[0].reverse();for(var n=1;n<t.length;n++)Pi(t[n])===e&&t[n].reverse()}var Ri={successCallback:null,verbose:!1,polygons:!1},Ti={};function Ai(t,e,n,r){r=r||{};for(var i=Object.keys(Ri),o=0;o<i.length;o++){var s=i[o],a=r[s];a=null!=a?a:Ri[s],Ti[s]=a}Ti.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+n)+"]");var u,l=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 l=0,c=t[a+1][u],h=t[a+1][u+1],p=t[a][u+1],f=t[a][u];if(!(isNaN(c)||isNaN(h)||isNaN(p)||isNaN(f))){l|=c<e?0:c>s?128:64,l|=h<e?0:h>s?32:16,l|=p<e?0:p>s?8:4;var g=+(l|=f<e?0:f>s?2:1),d=0;if(17===l||18===l||33===l||34===l||38===l||68===l||72===l||98===l||102===l||132===l||136===l||137===l||152===l||153===l){var y=(c+h+p+f)/4;d=y>s?2:y<e?0:1,34===l?1===d?l=35:0===d&&(l=136):136===l?1===d?(l=35,d=4):0===d&&(l=34):17===l?1===d?(l=155,d=4):0===d&&(l=153):68===l?1===d?(l=103,d=4):0===d&&(l=102):153===l?1===d&&(l=155):102===l?1===d&&(l=103):152===l?d<2&&(l=156,d=1):137===l?d<2&&(l=139,d=1):98===l?d<2&&(l=99,d=1):38===l?d<2&&(l=39,d=1):18===l?d>0?(l=156,d=4):l=152:33===l?d>0?(l=139,d=4):l=137:72===l?d>0?(l=99,d=4):l=98:132===l&&(d>0?(l=39,d=4):l=38)}if(0!=l&&170!=l){var v,_,m,x,E,b,w,I;v=_=m=x=E=b=w=I=.5;var N=[];1===l?(m=1-No(e,p,f),I=1-No(e,c,f),N.push(mo[l])):169===l?(m=No(s,f,p),I=No(s,f,c),N.push(mo[l])):4===l?(b=1-No(e,h,p),x=No(e,f,p),N.push(vo[l])):166===l?(b=No(s,p,h),x=1-No(s,p,f),N.push(vo[l])):16===l?(E=No(e,p,h),_=No(e,c,h),N.push(yo[l])):154===l?(E=1-No(s,h,p),_=1-No(s,h,c),N.push(yo[l])):64===l?(w=No(e,f,c),v=1-No(e,h,c),N.push(Eo[l])):106===l?(w=1-No(s,c,f),v=No(s,c,h),N.push(Eo[l])):168===l?(x=No(s,f,p),m=No(e,f,p),I=No(e,f,c),w=No(s,f,c),N.push(_o[l]),N.push(mo[l])):2===l?(x=1-No(e,p,f),m=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),N.push(_o[l]),N.push(mo[l])):162===l?(E=No(s,p,h),b=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),N.push(_o[l]),N.push(mo[l])):8===l?(E=1-No(e,h,p),b=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),N.push(yo[l]),N.push(vo[l])):138===l?(E=1-No(e,h,p),b=1-No(s,h,p),v=1-No(s,h,c),_=1-No(e,h,c),N.push(yo[l]),N.push(vo[l])):32===l?(E=No(s,p,h),b=No(e,p,h),v=No(e,c,h),_=No(s,c,h),N.push(yo[l]),N.push(vo[l])):42===l?(I=1-No(s,c,f),w=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h),N.push(xo[l]),N.push(Eo[l])):128===l&&(I=No(e,f,c),w=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c),N.push(xo[l]),N.push(Eo[l])),5===l?(b=1-No(e,h,p),I=1-No(e,c,f),N.push(vo[l])):165===l?(b=No(s,p,h),I=No(s,f,c),N.push(vo[l])):20===l?(x=No(e,f,p),_=No(e,c,h),N.push(_o[l])):150===l?(x=1-No(s,p,f),_=1-No(s,h,c),N.push(_o[l])):80===l?(E=No(e,p,h),w=No(e,f,c),N.push(yo[l])):90===l?(E=1-No(s,h,p),w=1-No(s,c,f),N.push(yo[l])):65===l?(m=1-No(e,p,f),v=1-No(e,h,c),N.push(mo[l])):105===l?(m=No(s,f,p),v=No(s,c,h),N.push(mo[l])):160===l?(E=No(s,p,h),b=No(e,p,h),I=No(e,f,c),w=No(s,f,c),N.push(yo[l]),N.push(vo[l])):10===l?(E=1-No(e,h,p),b=1-No(s,h,p),I=1-No(s,c,f),w=1-No(e,c,f),N.push(yo[l]),N.push(vo[l])):130===l?(x=1-No(e,p,f),m=1-No(s,p,f),v=1-No(s,h,c),_=1-No(e,h,c),N.push(_o[l]),N.push(mo[l])):40===l?(x=No(s,f,p),m=No(e,f,p),v=No(e,c,h),_=No(s,c,h),N.push(_o[l]),N.push(mo[l])):101===l?(b=No(s,p,h),v=No(s,c,h),N.push(vo[l])):69===l?(b=1-No(e,h,p),v=1-No(e,h,c),N.push(vo[l])):149===l?(I=No(s,f,c),_=1-No(s,h,c),N.push(xo[l])):21===l?(I=1-No(e,c,f),_=No(e,c,h),N.push(xo[l])):86===l?(x=1-No(s,p,f),w=1-No(s,c,f),N.push(_o[l])):84===l?(x=No(e,f,p),w=No(e,f,c),N.push(_o[l])):89===l?(E=1-No(s,h,p),m=No(s,f,p),N.push(mo[l])):81===l?(E=No(e,p,h),m=1-No(e,p,f),N.push(mo[l])):96===l?(E=No(s,p,h),b=No(e,p,h),w=No(e,f,c),v=No(s,c,h),N.push(yo[l]),N.push(vo[l])):74===l?(E=1-No(e,h,p),b=1-No(s,h,p),w=1-No(s,c,f),v=1-No(e,h,c),N.push(yo[l]),N.push(vo[l])):24===l?(E=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),_=No(e,c,h),N.push(yo[l]),N.push(mo[l])):146===l?(E=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),_=1-No(s,h,c),N.push(yo[l]),N.push(mo[l])):6===l?(b=1-No(e,h,p),x=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),N.push(vo[l]),N.push(_o[l])):164===l?(b=No(s,p,h),x=No(e,f,p),I=No(e,f,c),w=No(s,f,c),N.push(vo[l]),N.push(_o[l])):129===l?(m=1-No(e,p,f),I=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c),N.push(mo[l]),N.push(xo[l])):41===l?(m=No(s,f,p),I=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h),N.push(mo[l]),N.push(xo[l])):66===l?(x=1-No(e,p,f),m=1-No(s,p,f),w=1-No(s,c,f),v=1-No(e,h,c),N.push(_o[l]),N.push(mo[l])):104===l?(x=No(s,f,p),m=No(e,f,p),w=No(e,f,c),v=No(s,c,h),N.push(mo[l]),N.push(bo[l])):144===l?(E=No(e,p,h),I=No(e,f,c),w=No(s,f,c),_=1-No(s,h,c),N.push(yo[l]),N.push(Eo[l])):26===l?(E=1-No(s,h,p),I=1-No(s,c,f),w=1-No(e,c,f),_=No(e,c,h),N.push(yo[l]),N.push(Eo[l])):36===l?(b=No(s,p,h),x=No(e,f,p),v=No(e,c,h),_=No(s,c,h),N.push(vo[l]),N.push(_o[l])):134===l?(b=1-No(e,h,p),x=1-No(s,p,f),v=1-No(s,h,c),_=1-No(e,h,c),N.push(vo[l]),N.push(_o[l])):9===l?(E=1-No(e,h,p),b=1-No(s,h,p),m=No(s,f,p),I=1-No(e,c,f),N.push(yo[l]),N.push(vo[l])):161===l?(E=No(s,p,h),b=No(e,p,h),m=1-No(e,p,f),I=No(s,f,c),N.push(yo[l]),N.push(vo[l])):37===l?(b=No(s,p,h),I=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h),N.push(vo[l]),N.push(xo[l])):133===l?(b=1-No(e,h,p),I=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c),N.push(vo[l]),N.push(xo[l])):148===l?(x=No(e,f,p),I=No(e,f,c),w=No(s,f,c),_=1-No(s,h,c),N.push(_o[l]),N.push(Eo[l])):22===l?(x=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),_=No(e,c,h),N.push(_o[l]),N.push(Eo[l])):82===l?(E=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),w=1-No(s,c,f),N.push(yo[l]),N.push(mo[l])):88===l?(E=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),w=No(e,f,c),N.push(yo[l]),N.push(mo[l])):73===l?(E=1-No(e,h,p),b=1-No(s,h,p),m=No(s,f,p),v=1-No(e,h,c),N.push(yo[l]),N.push(vo[l])):97===l?(E=No(s,p,h),b=No(e,p,h),m=1-No(e,p,f),v=No(s,c,h),N.push(yo[l]),N.push(vo[l])):145===l?(E=No(e,p,h),m=1-No(e,p,f),I=No(s,f,c),_=1-No(s,h,c),N.push(yo[l]),N.push(xo[l])):25===l?(E=1-No(s,h,p),m=No(s,f,p),I=1-No(e,c,f),_=No(e,c,h),N.push(yo[l]),N.push(xo[l])):70===l?(b=1-No(e,h,p),x=1-No(s,p,f),w=1-No(s,c,f),v=1-No(e,h,c),N.push(vo[l]),N.push(_o[l])):100===l?(b=No(s,p,h),x=No(e,f,p),w=No(e,f,c),v=No(s,c,h),N.push(vo[l]),N.push(_o[l])):34===l?(0===d?(E=1-No(e,h,p),b=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),I=No(e,f,c),w=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c)):(E=No(s,p,h),b=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h)),N.push(yo[l]),N.push(vo[l]),N.push(xo[l]),N.push(Eo[l])):35===l?(4===d?(E=1-No(e,h,p),b=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),I=No(e,f,c),w=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c)):(E=No(s,p,h),b=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h)),N.push(yo[l]),N.push(vo[l]),N.push(mo[l]),N.push(Eo[l])):136===l?(0===d?(E=No(s,p,h),b=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h)):(E=1-No(e,h,p),b=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),I=No(e,f,c),w=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c)),N.push(yo[l]),N.push(vo[l]),N.push(xo[l]),N.push(Eo[l])):153===l?(0===d?(E=No(e,p,h),m=1-No(e,p,f),I=1-No(e,c,f),_=No(e,c,h)):(E=1-No(s,h,p),m=No(s,f,p),I=No(s,f,c),_=1-No(s,h,c)),N.push(yo[l]),N.push(mo[l])):102===l?(0===d?(b=1-No(e,h,p),x=No(e,f,p),w=No(e,f,c),v=1-No(e,h,c)):(b=No(s,p,h),x=1-No(s,p,f),w=1-No(s,c,f),v=No(s,c,h)),N.push(vo[l]),N.push(Eo[l])):155===l?(4===d?(E=No(e,p,h),m=1-No(e,p,f),I=1-No(e,c,f),_=No(e,c,h)):(E=1-No(s,h,p),m=No(s,f,p),I=No(s,f,c),_=1-No(s,h,c)),N.push(yo[l]),N.push(xo[l])):103===l?(4===d?(b=1-No(e,h,p),x=No(e,f,p),w=No(e,f,c),v=1-No(e,h,c)):(b=No(s,p,h),x=1-No(s,p,f),w=1-No(s,c,f),v=No(s,c,h)),N.push(vo[l]),N.push(_o[l])):152===l?(0===d?(E=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),_=No(e,c,h)):(E=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),I=No(e,f,c),w=No(s,f,c),_=1-No(s,h,c)),N.push(yo[l]),N.push(_o[l]),N.push(mo[l])):156===l?(4===d?(E=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),_=No(e,c,h)):(E=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),I=No(e,f,c),w=No(s,f,c),_=1-No(s,h,c)),N.push(yo[l]),N.push(mo[l]),N.push(Eo[l])):137===l?(0===d?(E=No(s,p,h),b=No(e,p,h),m=1-No(e,p,f),I=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h)):(E=1-No(e,h,p),b=1-No(s,h,p),m=No(s,f,p),I=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c)),N.push(yo[l]),N.push(vo[l]),N.push(mo[l])):139===l?(4===d?(E=No(s,p,h),b=No(e,p,h),m=1-No(e,p,f),I=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h)):(E=1-No(e,h,p),b=1-No(s,h,p),m=No(s,f,p),I=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c)),N.push(yo[l]),N.push(vo[l]),N.push(xo[l])):98===l?(0===d?(E=1-No(e,h,p),b=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),w=No(e,f,c),v=1-No(e,h,c)):(E=No(s,p,h),b=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),w=1-No(s,c,f),v=No(s,c,h)),N.push(yo[l]),N.push(vo[l]),N.push(Eo[l])):99===l?(4===d?(E=1-No(e,h,p),b=1-No(s,h,p),x=No(s,f,p),m=No(e,f,p),w=No(e,f,c),v=1-No(e,h,c)):(E=No(s,p,h),b=No(e,p,h),x=1-No(e,p,f),m=1-No(s,p,f),w=1-No(s,c,f),v=No(s,c,h)),N.push(yo[l]),N.push(vo[l]),N.push(mo[l])):38===l?(0===d?(b=1-No(e,h,p),x=No(e,f,p),I=No(e,f,c),w=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c)):(b=No(s,p,h),x=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h)),N.push(vo[l]),N.push(xo[l]),N.push(Eo[l])):39===l?(4===d?(b=1-No(e,h,p),x=No(e,f,p),I=No(e,f,c),w=No(s,f,c),v=1-No(s,h,c),_=1-No(e,h,c)):(b=No(s,p,h),x=1-No(s,p,f),I=1-No(s,c,f),w=1-No(e,c,f),v=No(e,c,h),_=No(s,c,h)),N.push(vo[l]),N.push(_o[l]),N.push(Eo[l])):85===l&&(E=1,b=0,x=1,m=0,I=0,w=1,v=0,_=1),(v<0||v>1||_<0||_>1||E<0||E>1||x<0||x>1||I<0||I>1||w<0||w>1)&&console.log("MarchingSquaresJS-isoBands: "+l+" "+g+" "+c+","+h+","+p+","+f+" "+d+" "+v+" "+_+" "+E+" "+b+" "+x+" "+m+" "+I+" "+w),o.cells[a][u]={cval:l,cval_real:g,flipped:d,topleft:v,topright:_,righttop:E,rightbottom:b,bottomright:x,bottomleft:m,leftbottom:I,lefttop:w,edges:N}}}}}return o}(t,e,n);return Ti.polygons?(Ti.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=Io[t.cval](t);"object"==typeof o&&So(o)?"object"==typeof o[0]&&So(o[0])?"object"==typeof o[0][0]&&So(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}(l)):(Ti.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=Po(t.cells[o][s]),u=null,l=s,c=o;null!==a&&i.push([a.p[0]+l,a.p[1]+c]);do{if(null===(u=Mo(t.cells[c][l],a.x,a.y,a.o)))break;if(i.push([u.p[0]+l,u.p[1]+c]),l+=u.x,a=u,(c+=u.y)<0||c>=n||l<0||l>=r||void 0===t.cells[c][l]){var h=Co(t,l-=u.x,c-=u.y,u.x,u.y,u.o);if(null===h)break;h.path.forEach((function(t){i.push(t)})),l=h.i,c=h.j,a=h}}while(void 0!==t.cells[c][l]&&t.cells[c][l].edges.length>0);e.push(i),i=[],t.cells[o][s].edges.length>0&&s--}return e}(l)),"function"==typeof Ti.successCallback&&Ti.successCallback(u),u}var Di=64,Fi=16,ki=[],Gi=[],qi=[],Bi=[],zi=[],ji=[],Ui=[],Vi=[],Xi=[],Yi=[],Hi=[],Wi=[],Ji=[],Zi=[],Ki=[],Qi=[],$i=[],to=[],eo=[],no=[],ro=[],io=[],oo=[],so=[];Ui[85]=Yi[85]=-1,Vi[85]=Hi[85]=0,Xi[85]=Wi[85]=1,eo[85]=io[85]=1,no[85]=oo[85]=0,ro[85]=so[85]=1,ki[85]=Bi[85]=0,Gi[85]=zi[85]=-1,qi[85]=Ki[85]=0,Qi[85]=Ji[85]=0,$i[85]=Zi[85]=1,ji[85]=to[85]=1,io[1]=io[169]=0,oo[1]=oo[169]=-1,so[1]=so[169]=0,Ji[1]=Ji[169]=-1,Zi[1]=Zi[169]=0,Ki[1]=Ki[169]=0,Yi[4]=Yi[166]=0,Hi[4]=Hi[166]=-1,Wi[4]=Wi[166]=1,Qi[4]=Qi[166]=1,$i[4]=$i[166]=0,to[4]=to[166]=0,Ui[16]=Ui[154]=0,Vi[16]=Vi[154]=1,Xi[16]=Xi[154]=1,Bi[16]=Bi[154]=1,zi[16]=zi[154]=0,ji[16]=ji[154]=1,eo[64]=eo[106]=0,no[64]=no[106]=1,ro[64]=ro[106]=0,ki[64]=ki[106]=-1,Gi[64]=Gi[106]=0,qi[64]=qi[106]=1,eo[2]=eo[168]=0,no[2]=no[168]=-1,ro[2]=ro[168]=1,io[2]=io[168]=0,oo[2]=oo[168]=-1,so[2]=so[168]=0,Ji[2]=Ji[168]=-1,Zi[2]=Zi[168]=0,Ki[2]=Ki[168]=0,Qi[2]=Qi[168]=-1,$i[2]=$i[168]=0,to[2]=to[168]=1,Ui[8]=Ui[162]=0,Vi[8]=Vi[162]=-1,Xi[8]=Xi[162]=0,Yi[8]=Yi[162]=0,Hi[8]=Hi[162]=-1,Wi[8]=Wi[162]=1,Ji[8]=Ji[162]=1,Zi[8]=Zi[162]=0,Ki[8]=Ki[162]=1,Qi[8]=Qi[162]=1,$i[8]=$i[162]=0,to[8]=to[162]=0,Ui[32]=Ui[138]=0,Vi[32]=Vi[138]=1,Xi[32]=Xi[138]=1,Yi[32]=Yi[138]=0,Hi[32]=Hi[138]=1,Wi[32]=Wi[138]=0,ki[32]=ki[138]=1,Gi[32]=Gi[138]=0,qi[32]=qi[138]=0,Bi[32]=Bi[138]=1,zi[32]=zi[138]=0,ji[32]=ji[138]=1,io[128]=io[42]=0,oo[128]=oo[42]=1,so[128]=so[42]=1,eo[128]=eo[42]=0,no[128]=no[42]=1,ro[128]=ro[42]=0,ki[128]=ki[42]=-1,Gi[128]=Gi[42]=0,qi[128]=qi[42]=1,Bi[128]=Bi[42]=-1,zi[128]=zi[42]=0,ji[128]=ji[42]=0,Yi[5]=Yi[165]=-1,Hi[5]=Hi[165]=0,Wi[5]=Wi[165]=0,io[5]=io[165]=1,oo[5]=oo[165]=0,so[5]=so[165]=0,Qi[20]=Qi[150]=0,$i[20]=$i[150]=1,to[20]=to[150]=1,Bi[20]=Bi[150]=0,zi[20]=zi[150]=-1,ji[20]=ji[150]=1,Ui[80]=Ui[90]=-1,Vi[80]=Vi[90]=0,Xi[80]=Xi[90]=1,eo[80]=eo[90]=1,no[80]=no[90]=0,ro[80]=ro[90]=1,Ji[65]=Ji[105]=0,Zi[65]=Zi[105]=1,Ki[65]=Ki[105]=0,ki[65]=ki[105]=0,Gi[65]=Gi[105]=-1,qi[65]=qi[105]=0,Ui[160]=Ui[10]=-1,Vi[160]=Vi[10]=0,Xi[160]=Xi[10]=1,Yi[160]=Yi[10]=-1,Hi[160]=Hi[10]=0,Wi[160]=Wi[10]=0,io[160]=io[10]=1,oo[160]=oo[10]=0,so[160]=so[10]=0,eo[160]=eo[10]=1,no[160]=no[10]=0,ro[160]=ro[10]=1,Qi[130]=Qi[40]=0,$i[130]=$i[40]=1,to[130]=to[40]=1,Ji[130]=Ji[40]=0,Zi[130]=Zi[40]=1,Ki[130]=Ki[40]=0,ki[130]=ki[40]=0,Gi[130]=Gi[40]=-1,qi[130]=qi[40]=0,Bi[130]=Bi[40]=0,zi[130]=zi[40]=-1,ji[130]=ji[40]=1,Yi[37]=Yi[133]=0,Hi[37]=Hi[133]=1,Wi[37]=Wi[133]=1,io[37]=io[133]=0,oo[37]=oo[133]=1,so[37]=so[133]=0,ki[37]=ki[133]=-1,Gi[37]=Gi[133]=0,qi[37]=qi[133]=0,Bi[37]=Bi[133]=1,zi[37]=zi[133]=0,ji[37]=ji[133]=0,Qi[148]=Qi[22]=-1,$i[148]=$i[22]=0,to[148]=to[22]=0,io[148]=io[22]=0,oo[148]=oo[22]=-1,so[148]=so[22]=1,eo[148]=eo[22]=0,no[148]=no[22]=1,ro[148]=ro[22]=1,Bi[148]=Bi[22]=-1,zi[148]=zi[22]=0,ji[148]=ji[22]=1,Ui[82]=Ui[88]=0,Vi[82]=Vi[88]=-1,Xi[82]=Xi[88]=1,Qi[82]=Qi[88]=1,$i[82]=$i[88]=0,to[82]=to[88]=1,Ji[82]=Ji[88]=-1,Zi[82]=Zi[88]=0,Ki[82]=Ki[88]=1,eo[82]=eo[88]=0,no[82]=no[88]=-1,ro[82]=ro[88]=0,Ui[73]=Ui[97]=0,Vi[73]=Vi[97]=1,Xi[73]=Xi[97]=0,Yi[73]=Yi[97]=0,Hi[73]=Hi[97]=-1,Wi[73]=Wi[97]=0,Ji[73]=Ji[97]=1,Zi[73]=Zi[97]=0,Ki[73]=Ki[97]=0,ki[73]=ki[97]=1,Gi[73]=Gi[97]=0,qi[73]=qi[97]=1,Ui[145]=Ui[25]=0,Vi[145]=Vi[25]=-1,Xi[145]=Xi[25]=0,Ji[145]=Ji[25]=1,Zi[145]=Zi[25]=0,Ki[145]=Ki[25]=1,io[145]=io[25]=0,oo[145]=oo[25]=1,so[145]=so[25]=1,Bi[145]=Bi[25]=-1,zi[145]=zi[25]=0,ji[145]=ji[25]=0,Yi[70]=Yi[100]=0,Hi[70]=Hi[100]=1,Wi[70]=Wi[100]=0,Qi[70]=Qi[100]=-1,$i[70]=$i[100]=0,to[70]=to[100]=1,eo[70]=eo[100]=0,no[70]=no[100]=-1,ro[70]=ro[100]=1,ki[70]=ki[100]=1,Gi[70]=Gi[100]=0,qi[70]=qi[100]=0,Yi[101]=Yi[69]=0,Hi[101]=Hi[69]=1,Wi[101]=Wi[69]=0,ki[101]=ki[69]=1,Gi[101]=Gi[69]=0,qi[101]=qi[69]=0,io[149]=io[21]=0,oo[149]=oo[21]=1,so[149]=so[21]=1,Bi[149]=Bi[21]=-1,zi[149]=zi[21]=0,ji[149]=ji[21]=0,Qi[86]=Qi[84]=-1,$i[86]=$i[84]=0,to[86]=to[84]=1,eo[86]=eo[84]=0,no[86]=no[84]=-1,ro[86]=ro[84]=1,Ui[89]=Ui[81]=0,Vi[89]=Vi[81]=-1,Xi[89]=Xi[81]=0,Ji[89]=Ji[81]=1,Zi[89]=Zi[81]=0,Ki[89]=Ki[81]=1,Ui[96]=Ui[74]=0,Vi[96]=Vi[74]=1,Xi[96]=Xi[74]=0,Yi[96]=Yi[74]=-1,Hi[96]=Hi[74]=0,Wi[96]=Wi[74]=1,eo[96]=eo[74]=1,no[96]=no[74]=0,ro[96]=ro[74]=0,ki[96]=ki[74]=1,Gi[96]=Gi[74]=0,qi[96]=qi[74]=1,Ui[24]=Ui[146]=0,Vi[24]=Vi[146]=-1,Xi[24]=Xi[146]=1,Qi[24]=Qi[146]=1,$i[24]=$i[146]=0,to[24]=to[146]=1,Ji[24]=Ji[146]=0,Zi[24]=Zi[146]=1,Ki[24]=Ki[146]=1,Bi[24]=Bi[146]=0,zi[24]=zi[146]=-1,ji[24]=ji[146]=0,Yi[6]=Yi[164]=-1,Hi[6]=Hi[164]=0,Wi[6]=Wi[164]=1,Qi[6]=Qi[164]=-1,$i[6]=$i[164]=0,to[6]=to[164]=0,io[6]=io[164]=0,oo[6]=oo[164]=-1,so[6]=so[164]=1,eo[6]=eo[164]=1,no[6]=no[164]=0,ro[6]=ro[164]=0,Ji[129]=Ji[41]=0,Zi[129]=Zi[41]=1,Ki[129]=Ki[41]=1,io[129]=io[41]=0,oo[129]=oo[41]=1,so[129]=so[41]=0,ki[129]=ki[41]=-1,Gi[129]=Gi[41]=0,qi[129]=qi[41]=0,Bi[129]=Bi[41]=0,zi[129]=zi[41]=-1,ji[129]=ji[41]=0,Qi[66]=Qi[104]=0,$i[66]=$i[104]=1,to[66]=to[104]=0,Ji[66]=Ji[104]=-1,Zi[66]=Zi[104]=0,Ki[66]=Ki[104]=1,eo[66]=eo[104]=0,no[66]=no[104]=-1,ro[66]=ro[104]=0,ki[66]=ki[104]=0,Gi[66]=Gi[104]=-1,qi[66]=qi[104]=1,Ui[144]=Ui[26]=-1,Vi[144]=Vi[26]=0,Xi[144]=Xi[26]=0,io[144]=io[26]=1,oo[144]=oo[26]=0,so[144]=so[26]=1,eo[144]=eo[26]=0,no[144]=no[26]=1,ro[144]=ro[26]=1,Bi[144]=Bi[26]=-1,zi[144]=zi[26]=0,ji[144]=ji[26]=1,Yi[36]=Yi[134]=0,Hi[36]=Hi[134]=1,Wi[36]=Wi[134]=1,Qi[36]=Qi[134]=0,$i[36]=$i[134]=1,to[36]=to[134]=0,ki[36]=ki[134]=0,Gi[36]=Gi[134]=-1,qi[36]=qi[134]=1,Bi[36]=Bi[134]=1,zi[36]=zi[134]=0,ji[36]=ji[134]=0,Ui[9]=Ui[161]=-1,Vi[9]=Vi[161]=0,Xi[9]=Xi[161]=0,Yi[9]=Yi[161]=0,Hi[9]=Hi[161]=-1,Wi[9]=Wi[161]=0,Ji[9]=Ji[161]=1,Zi[9]=Zi[161]=0,Ki[9]=Ki[161]=0,io[9]=io[161]=1,oo[9]=oo[161]=0,so[9]=so[161]=1,Ui[136]=0,Vi[136]=1,Xi[136]=1,Yi[136]=0,Hi[136]=1,Wi[136]=0,Qi[136]=-1,$i[136]=0,to[136]=1,Ji[136]=-1,Zi[136]=0,Ki[136]=0,io[136]=0,oo[136]=-1,so[136]=0,eo[136]=0,no[136]=-1,ro[136]=1,ki[136]=1,Gi[136]=0,qi[136]=0,Bi[136]=1,zi[136]=0,ji[136]=1,Ui[34]=0,Vi[34]=-1,Xi[34]=0,Yi[34]=0,Hi[34]=-1,Wi[34]=1,Qi[34]=1,$i[34]=0,to[34]=0,Ji[34]=1,Zi[34]=0,Ki[34]=1,io[34]=0,oo[34]=1,so[34]=1,eo[34]=0,no[34]=1,ro[34]=0,ki[34]=-1,Gi[34]=0,qi[34]=1,Bi[34]=-1,zi[34]=0,ji[34]=0,Ui[35]=0,Vi[35]=1,Xi[35]=1,Yi[35]=0,Hi[35]=-1,Wi[35]=1,Qi[35]=1,$i[35]=0,to[35]=0,Ji[35]=-1,Zi[35]=0,Ki[35]=0,io[35]=0,oo[35]=-1,so[35]=0,eo[35]=0,no[35]=1,ro[35]=0,ki[35]=-1,Gi[35]=0,qi[35]=1,Bi[35]=1,zi[35]=0,ji[35]=1,Ui[153]=0,Vi[153]=1,Xi[153]=1,Ji[153]=-1,Zi[153]=0,Ki[153]=0,io[153]=0,oo[153]=-1,so[153]=0,Bi[153]=1,zi[153]=0,ji[153]=1,Yi[102]=0,Hi[102]=-1,Wi[102]=1,Qi[102]=1,$i[102]=0,to[102]=0,eo[102]=0,no[102]=1,ro[102]=0,ki[102]=-1,Gi[102]=0,qi[102]=1,Ui[155]=0,Vi[155]=-1,Xi[155]=0,Ji[155]=1,Zi[155]=0,Ki[155]=1,io[155]=0,oo[155]=1,so[155]=1,Bi[155]=-1,zi[155]=0,ji[155]=0,Yi[103]=0,Hi[103]=1,Wi[103]=0,Qi[103]=-1,$i[103]=0,to[103]=1,eo[103]=0,no[103]=-1,ro[103]=1,ki[103]=1,Gi[103]=0,qi[103]=0,Ui[152]=0,Vi[152]=1,Xi[152]=1,Qi[152]=-1,$i[152]=0,to[152]=1,Ji[152]=-1,Zi[152]=0,Ki[152]=0,io[152]=0,oo[152]=-1,so[152]=0,eo[152]=0,no[152]=-1,ro[152]=1,Bi[152]=1,zi[152]=0,ji[152]=1,Ui[156]=0,Vi[156]=-1,Xi[156]=1,Qi[156]=1,$i[156]=0,to[156]=1,Ji[156]=-1,Zi[156]=0,Ki[156]=0,io[156]=0,oo[156]=-1,so[156]=0,eo[156]=0,no[156]=1,ro[156]=1,Bi[156]=-1,zi[156]=0,ji[156]=1,Ui[137]=0,Vi[137]=1,Xi[137]=1,Yi[137]=0,Hi[137]=1,Wi[137]=0,Ji[137]=-1,Zi[137]=0,Ki[137]=0,io[137]=0,oo[137]=-1,so[137]=0,ki[137]=1,Gi[137]=0,qi[137]=0,Bi[137]=1,zi[137]=0,ji[137]=1,Ui[139]=0,Vi[139]=1,Xi[139]=1,Yi[139]=0,Hi[139]=-1,Wi[139]=0,Ji[139]=1,Zi[139]=0,Ki[139]=0,io[139]=0,oo[139]=1,so[139]=0,ki[139]=-1,Gi[139]=0,qi[139]=0,Bi[139]=1,zi[139]=0,ji[139]=1,Ui[98]=0,Vi[98]=-1,Xi[98]=0,Yi[98]=0,Hi[98]=-1,Wi[98]=1,Qi[98]=1,$i[98]=0,to[98]=0,Ji[98]=1,Zi[98]=0,Ki[98]=1,eo[98]=0,no[98]=1,ro[98]=0,ki[98]=-1,Gi[98]=0,qi[98]=1,Ui[99]=0,Vi[99]=1,Xi[99]=0,Yi[99]=0,Hi[99]=-1,Wi[99]=1,Qi[99]=1,$i[99]=0,to[99]=0,Ji[99]=-1,Zi[99]=0,Ki[99]=1,eo[99]=0,no[99]=-1,ro[99]=0,ki[99]=1,Gi[99]=0,qi[99]=1,Yi[38]=0,Hi[38]=-1,Wi[38]=1,Qi[38]=1,$i[38]=0,to[38]=0,io[38]=0,oo[38]=1,so[38]=1,eo[38]=0,no[38]=1,ro[38]=0,ki[38]=-1,Gi[38]=0,qi[38]=1,Bi[38]=-1,zi[38]=0,ji[38]=0,Yi[39]=0,Hi[39]=1,Wi[39]=1,Qi[39]=-1,$i[39]=0,to[39]=0,io[39]=0,oo[39]=-1,so[39]=1,eo[39]=0,no[39]=1,ro[39]=0,ki[39]=-1,Gi[39]=0,qi[39]=1,Bi[39]=1,zi[39]=0,ji[39]=0;var ao=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},uo=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},lo=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},co=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},ho=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},po=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},fo=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},go=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},yo=[],vo=[],_o=[],mo=[],xo=[],Eo=[],bo=[],wo=[];mo[1]=xo[1]=18,mo[169]=xo[169]=18,_o[4]=vo[4]=12,_o[166]=vo[166]=12,yo[16]=wo[16]=4,yo[154]=wo[154]=4,Eo[64]=bo[64]=22,Eo[106]=bo[106]=22,_o[2]=Eo[2]=17,mo[2]=xo[2]=18,_o[168]=Eo[168]=17,mo[168]=xo[168]=18,yo[8]=mo[8]=9,vo[8]=_o[8]=12,yo[162]=mo[162]=9,vo[162]=_o[162]=12,yo[32]=wo[32]=4,vo[32]=bo[32]=1,yo[138]=wo[138]=4,vo[138]=bo[138]=1,xo[128]=wo[128]=21,Eo[128]=bo[128]=22,xo[42]=wo[42]=21,Eo[42]=bo[42]=22,vo[5]=xo[5]=14,vo[165]=xo[165]=14,_o[20]=wo[20]=6,_o[150]=wo[150]=6,yo[80]=Eo[80]=11,yo[90]=Eo[90]=11,mo[65]=bo[65]=3,mo[105]=bo[105]=3,yo[160]=Eo[160]=11,vo[160]=xo[160]=14,yo[10]=Eo[10]=11,vo[10]=xo[10]=14,_o[130]=wo[130]=6,mo[130]=bo[130]=3,_o[40]=wo[40]=6,mo[40]=bo[40]=3,vo[101]=bo[101]=1,vo[69]=bo[69]=1,xo[149]=wo[149]=21,xo[21]=wo[21]=21,_o[86]=Eo[86]=17,_o[84]=Eo[84]=17,yo[89]=mo[89]=9,yo[81]=mo[81]=9,yo[96]=bo[96]=0,vo[96]=Eo[96]=15,yo[74]=bo[74]=0,vo[74]=Eo[74]=15,yo[24]=_o[24]=8,mo[24]=wo[24]=7,yo[146]=_o[146]=8,mo[146]=wo[146]=7,vo[6]=Eo[6]=15,_o[6]=xo[6]=16,vo[164]=Eo[164]=15,_o[164]=xo[164]=16,mo[129]=wo[129]=7,xo[129]=bo[129]=20,mo[41]=wo[41]=7,xo[41]=bo[41]=20,_o[66]=bo[66]=2,mo[66]=Eo[66]=19,_o[104]=bo[104]=2,mo[104]=Eo[104]=19,yo[144]=xo[144]=10,Eo[144]=wo[144]=23,yo[26]=xo[26]=10,Eo[26]=wo[26]=23,vo[36]=wo[36]=5,_o[36]=bo[36]=2,vo[134]=wo[134]=5,_o[134]=bo[134]=2,yo[9]=xo[9]=10,vo[9]=mo[9]=13,yo[161]=xo[161]=10,vo[161]=mo[161]=13,vo[37]=wo[37]=5,xo[37]=bo[37]=20,vo[133]=wo[133]=5,xo[133]=bo[133]=20,_o[148]=xo[148]=16,Eo[148]=wo[148]=23,_o[22]=xo[22]=16,Eo[22]=wo[22]=23,yo[82]=_o[82]=8,mo[82]=Eo[82]=19,yo[88]=_o[88]=8,mo[88]=Eo[88]=19,yo[73]=bo[73]=0,vo[73]=mo[73]=13,yo[97]=bo[97]=0,vo[97]=mo[97]=13,yo[145]=mo[145]=9,xo[145]=wo[145]=21,yo[25]=mo[25]=9,xo[25]=wo[25]=21,vo[70]=bo[70]=1,_o[70]=Eo[70]=17,vo[100]=bo[100]=1,_o[100]=Eo[100]=17,yo[34]=mo[34]=9,vo[34]=_o[34]=12,xo[34]=wo[34]=21,Eo[34]=bo[34]=22,yo[136]=wo[136]=4,vo[136]=bo[136]=1,_o[136]=Eo[136]=17,mo[136]=xo[136]=18,yo[35]=wo[35]=4,vo[35]=_o[35]=12,mo[35]=xo[35]=18,Eo[35]=bo[35]=22,yo[153]=wo[153]=4,mo[153]=xo[153]=18,vo[102]=_o[102]=12,Eo[102]=bo[102]=22,yo[155]=mo[155]=9,xo[155]=wo[155]=23,vo[103]=bo[103]=1,_o[103]=Eo[103]=17,yo[152]=wo[152]=4,_o[152]=Eo[152]=17,mo[152]=xo[152]=18,yo[156]=_o[156]=8,mo[156]=xo[156]=18,Eo[156]=wo[156]=23,yo[137]=wo[137]=4,vo[137]=bo[137]=1,mo[137]=xo[137]=18,yo[139]=wo[139]=4,vo[139]=mo[139]=13,xo[139]=bo[139]=20,yo[98]=mo[98]=9,vo[98]=_o[98]=12,Eo[98]=bo[98]=22,yo[99]=bo[99]=0,vo[99]=_o[99]=12,mo[99]=Eo[99]=19,vo[38]=_o[38]=12,xo[38]=wo[38]=21,Eo[38]=bo[38]=22,vo[39]=wo[39]=5,_o[39]=xo[39]=16,Eo[39]=bo[39]=22;var Io=[];function No(t,e,n){return(t-e)/(n-e)}function So(t){return t.constructor.toString().indexOf("Array")>-1}function Co(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,l=n+i,c=[],h=!1;!h;){if(void 0===t.cells[l]||void 0===t.cells[l][u])if(l-=i,u-=r,a=(s=t.cells[l][u]).cval_real,-1===i)if(0===o)if(1&a)c.push([u,l]),r=-1,i=0,o=0;else{if(!(4&a)){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u+1,l]),r=1,i=0,o=0}else{if(!(1&a)){if(4&a){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u+s.bottomleft,l]),r=0,i=1,o=0,h=!0;break}c.push([u,l]),r=-1,i=0,o=0}else if(1===i)if(0===o){if(!(a&Fi)){if(a&Di){c.push([u+s.topleft,l+1]),r=0,i=-1,o=0,h=!0;break}c.push([u+s.topright,l+1]),r=0,i=-1,o=1,h=!0;break}c.push([u+1,l+1]),r=1,i=0,o=1}else c.push([u+1,l+1]),r=1,i=0,o=1;else if(-1===r)if(0===o){if(!(a&Di)){if(1&a){c.push([u,l+s.leftbottom]),r=1,i=0,o=0,h=!0;break}c.push([u,l+s.lefttop]),r=1,i=0,o=1,h=!0;break}c.push([u,l+1]),r=0,i=1,o=0}else{if(!(a&Di)){console.log("MarchingSquaresJS-isoBands: wtf");break}c.push([u,l+1]),r=0,i=1,o=0}else{if(1!==r){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(4&a)){c.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),r=0,i=-1,o=1}else{if(!(4&a)){if(a&Fi){c.push([u+1,l+s.righttop]),r=-1,i=0,o=1;break}c.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),r=0,i=-1,o=1}}else if(a=(s=t.cells[l][u]).cval_real,-1===r)if(0===o)if(void 0!==t.cells[l-1]&&void 0!==t.cells[l-1][u])r=0,i=-1,o=1;else{if(!(1&a)){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u,l])}else{if(!(a&Di)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);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[l+1]&&void 0!==t.cells[l+1][u])r=0,i=1,o=0;else{if(!(a&Fi)){c.push([u+s.topleft,l+1]),r=0,i=-1,o=0,h=!0;break}c.push([u+1,l+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[l][u+1])r=1,i=0,o=1;else{if(!(4&a)){c.push([u+1,l+s.righttop]),r=-1,i=0,o=1,h=!0;break}c.push([u+1,l]),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[l][u-1])r=-1,i=0,o=0;else{if(!(a&Di)){c.push([u,l+s.leftbottom]),r=1,i=0,o=0,h=!0;break}c.push([u,l+1]),r=0,i=1,o=0}}if(l+=i,(u+=r)===e&&l===n)break}return{path:c,i:u,j:l,x:r,y:i,o:o}}function Po(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Fi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return 4&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return 1&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Fi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return 4&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return 1&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return 1&n?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&Di?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return 1&n?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&Di?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&Di?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&Di?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&Di?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Fi?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&Di?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Fi?{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}function Mo(t,e,n,r){var i,o,s,a,u,l=t.cval;switch(e){case-1:if(0===r)i=vo[l],s=Yi[l],a=Hi[l],u=Wi[l];else i=yo[l],s=Ui[l],a=Vi[l],u=Xi[l];break;case 1:if(0===r)i=xo[l],s=io[l],a=oo[l],u=so[l];else i=Eo[l],s=eo[l],a=no[l],u=ro[l];break;default:switch(n){case-1:if(0===r)i=bo[l],s=ki[l],a=Gi[l],u=qi[l];else i=wo[l],s=Bi[l],a=zi[l],u=ji[l];break;case 1:if(0===r)i=mo[l],s=Ji[l],a=Zi[l],u=Ki[l];else i=_o[l],s=Qi[l],a=$i[l],u=to[l]}}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),l=t.cval_real,i){case 0:l&Fi?(e=t.topleft,n=1):(e=1,n=t.righttop);break;case 1:4&l?(e=1,n=t.rightbottom):(e=t.topleft,n=1);break;case 2:4&l?(e=t.topleft,n=1):(e=t.bottomright,n=0);break;case 3:1&l?(e=t.bottomleft,n=0):(e=t.topleft,n=1);break;case 4:l&Fi?(e=t.topright,n=1):(e=1,n=t.righttop);break;case 5:4&l?(e=1,n=t.rightbottom):(e=t.topright,n=1);break;case 6:4&l?(e=t.topright,n=1):(e=t.bottomright,n=0);break;case 7:1&l?(e=t.bottomleft,n=0):(e=t.topright,n=1);break;case 8:4&l?(e=1,n=t.righttop):(e=t.bottomright,n=0);break;case 9:1&l?(e=t.bottomleft,n=0):(e=1,n=t.righttop);break;case 10:1&l?(e=1,n=t.righttop):(e=0,n=t.leftbottom);break;case 11:l&Di?(e=0,n=t.lefttop):(e=1,n=t.righttop);break;case 12:4&l?(e=1,n=t.rightbottom):(e=t.bottomright,n=0);break;case 13:1&l?(e=t.bottomleft,n=0):(e=1,n=t.rightbottom);break;case 14:1&l?(e=1,n=t.rightbottom):(e=0,n=t.leftbottom);break;case 15:l&Di?(e=0,n=t.lefttop):(e=1,n=t.rightbottom);break;case 16:4&l?(e=0,n=t.leftbottom):(e=t.bottomright,n=0);break;case 17:l&Di?(e=0,n=t.lefttop):(e=t.bottomright,n=0);break;case 18:1&l?(e=t.bottomleft,n=0):(e=0,n=t.leftbottom);break;case 19:l&Di?(e=0,n=t.lefttop):(e=t.bottomleft,n=0);break;case 20:l&Di?(e=0,n=t.leftbottom):(e=t.topleft,n=1);break;case 21:l&Fi?(e=t.topright,n=1):(e=0,n=t.leftbottom);break;case 22:l&Di?(e=0,n=t.lefttop):(e=t.topleft,n=1);break;case 23:l&Fi?(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}}function Lo(t){var e=[],n=[];t.forEach((function(t){var r=Nr(l([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}function Oo(t){for(var e=t.map((function(t){return{lrCoordinates:t,grouped:!1}})),n=[];!To(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 o=l([e[r].lrCoordinates]),s=r+1;s<e.length;s++)e[s].grouped||Ro(l([e[s].lrCoordinates]),o)&&(i.push(e[s].lrCoordinates),e[s].grouped=!0);n.push(i)}return n}function Ro(t,e){for(var n=dn(t),r=0;r<n.features.length;r++)if(!ge(n.features[r],e))return!1;return!0}function To(t){for(var e=0;e<t.length;e++)if(!1===t[e].grouped)return!1;return!0}function Ao(t,e,n){if(!P(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=gn(t)),!1!==i&&void 0!==i||(t=be(t)),R(t,(function(t){var n=bi(r,t)+e,i=vr(r,t),o=Q(Ii(r,i,n));t[0]=o[0],t[1]=o[1]}))),t}function Do(t,e,n){if(!P(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=be(t)),"FeatureCollection"!==t.type||o?Fo(t,e,r):(F(t,(function(n,i){t.features[i]=Fo(n,e,r)})),t)}function Fo(t,e,n){var r="Point"===it(t);return n=function(t,e){if(null==e&&(e="centroid"),Array.isArray(e)||"object"==typeof e)return K(e);var n=t.bbox?t.bbox:Z(t),r=n[0],i=n[1],o=n[2],s=n[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return a([r,i]);case"se":case"southeast":case"eastsouth":case"bottomright":return a([o,i]);case"nw":case"northwest":case"westnorth":case"topleft":return a([r,s]);case"ne":case"northeast":case"eastnorth":case"topright":return a([o,s]);case"center":return fn(t);case void 0:case null:case"centroid":return gn(t);default:throw new Error("invalid origin")}}(t,n),1===e||r||R(t,(function(t){var r=vr(n,t),i=bi(n,t),o=Q(Ii(n,r*e,i));t[0]=o[0],t[1]=o[1],3===t.length&&(t[2]*=e)})),t}function ko(t){var e=t[0],n=t[1];return[n[0]-e[0],n[1]-e[1]]}function Go(t,e){return t[0]*e[1]-e[0]*t[1]}function qo(t,e,n){var r=[],i=E(e,n),o=Q(t),s=[];return o.forEach((function(t,e){if(e!==o.length-1){var n=(l=t,c=o[e+1],h=i,p=Math.sqrt((l[0]-c[0])*(l[0]-c[0])+(l[1]-c[1])*(l[1]-c[1])),f=l[0]+h*(c[1]-l[1])/p,g=c[0]+h*(c[1]-l[1])/p,[[f,l[1]+h*(l[0]-c[0])/p],[g,c[1]+h*(l[0]-c[0])/p]]);if(r.push(n),e>0){var a=r[e-1],u=function(t,e){return!function(t,e){return 0===Go(ko(t),ko(e))}(t,e)&&function(t,e){var n,r,i=t[0],o=ko(t),s=e[0],a=ko(e),u=Go(o,a);return function(t,e){return[t[0]+e[0],t[1]+e[1]]}(i,function(t,e){return[t*e[0],t*e[1]]}(Go((r=i,[(n=s)[0]-r[0],n[1]-r[1]]),a)/u,o))}(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]))}var l,c,h,p,f,g})),h(s,t.properties)}function Bo(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0];return function(t){return(t>0)-(t<0)||+t}(r*(n[1]-e[1])-o*i)}function zo(t,e){return e.geometry.coordinates[0].every((function(e){return ge(a(e),t)}))}Io[1]=Io[169]=ao,Io[4]=Io[166]=uo,Io[16]=Io[154]=lo,Io[64]=Io[106]=co,Io[168]=Io[2]=ho,Io[162]=Io[8]=po,Io[138]=Io[32]=fo,Io[42]=Io[128]=go,Io[5]=Io[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},Io[20]=Io[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},Io[80]=Io[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},Io[65]=Io[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Io[160]=Io[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},Io[130]=Io[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},Io[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},Io[101]=Io[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},Io[149]=Io[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},Io[86]=Io[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},Io[89]=Io[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},Io[96]=Io[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[24]=Io[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},Io[6]=Io[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},Io[129]=Io[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},Io[66]=Io[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[144]=Io[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[36]=Io[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},Io[9]=Io[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Io[37]=Io[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Io[148]=Io[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[82]=Io[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},Io[73]=Io[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Io[145]=Io[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Io[70]=Io[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[34]=function(t){return[go(t),po(t)]},Io[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]]},Io[136]=function(t){return[fo(t),ho(t)]},Io[153]=function(t){return[lo(t),ao(t)]},Io[102]=function(t){return[uo(t),co(t)]},Io[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Io[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[152]=function(t){return[lo(t),ho(t)]},Io[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[137]=function(t){return[fo(t),ao(t)]},Io[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Io[98]=function(t){return[po(t),co(t)]},Io[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[38]=function(t){return[uo(t),go(t)]},Io[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 jo=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(t){return t.join(",")},t.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))},t.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))},t.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},t.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=Bo(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)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},t.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},t}(),Uo=function(){function t(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)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return h([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(t){return Bo(t.from.coordinates,t.to.coordinates,this.to.coordinates)},t}(),Vo=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},t.prototype.get=function(t){return this.edges[t]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.edges.forEach(t)},t.prototype.map=function(t){return this.edges.map(t)},t.prototype.some=function(t){return this.edges.some(t)},t.prototype.isValid=function(){return!0},t.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=Bo(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},t.prototype.toMultiPoint=function(){return d(this.edges.map((function(t){return t.from.coordinates})))},t.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=l([t])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=un(this.toPolygon())},t.findEdgeRingContaining=function(t,e){var n,r,i=t.getEnvelope();return e.forEach((function(e){var o,s,u,l,c,h,p=e.getEnvelope();if(r&&(n=r.getEnvelope()),s=i,u=(o=p).geometry.coordinates[0].map((function(t){return t[0]})),l=o.geometry.coordinates[0].map((function(t){return t[1]})),c=s.geometry.coordinates[0].map((function(t){return t[0]})),h=s.geometry.coordinates[0].map((function(t){return t[1]})),(Math.max.apply(null,u)!==Math.max.apply(null,c)||Math.max.apply(null,l)!==Math.max.apply(null,h)||Math.min.apply(null,u)!==Math.min.apply(null,c)||Math.min.apply(null,l)!==Math.min.apply(null,h))&&zo(p,i)){for(var f=t.map((function(t){return t.from.coordinates})),g=void 0,d=function(t){e.some((function(e){return n=t,r=e.from.coordinates,n[0]===r[0]&&n[1]===r[1];var n,r}))||(g=t)},y=0,v=f;y<v.length;y++)d(v[y]);g&&e.inside(a(g))&&(r&&!zo(n,p)||(r=e))}})),r},t.prototype.inside=function(t){return ge(t,this.toPolygon())},t}(),Xo=function(){function t(){this.edges=[],this.nodes={}}return t.fromGeoJson=function(e){!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")}(e);var n=new t;return z(e,(function(t){et(t,"LineString","Graph::fromGeoJson"),T(t,(function(t,e){if(t){var r=n.getNode(t),i=n.getNode(e);n.addEdge(r,i)}return e}))})),n},t.prototype.getNode=function(t){var e=jo.buildId(t),n=this.nodes[e];return n||(n=this.nodes[e]=new jo(t)),n},t.prototype.addEdge=function(t,e){var n=new Uo(t,e),r=n.getSymetric();this.edges.push(n),this.edges.push(r)},t.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map((function(e){return t.nodes[e]})).forEach((function(e){return t._removeIfDangle(e)}))},t.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)}))}},t.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))}))},t.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}))},t.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,l=void 0;s.label===e&&(u=s),a.label===e&&(l=a),u&&l&&(l&&(r=l),u&&(r&&(r.next=u,r=void 0),n||(n=u)))}r&&(r.next=n)},t.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},t.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},t.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},t.prototype._findEdgeRing=function(t){var e=t,n=new Vo;do{n.push(e),e.ring=n,e=e.next}while(!t.isEqual(e));return n},t.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]},t.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()},t}();function Yo(t,e){var n=!0;return z(t,(function(t){z(e,(function(e){if(!1===n)return!1;n=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return n=t.coordinates,r=e.coordinates,!(n[0]===r[0]&&n[1]===r[1]);case"LineString":return!Ho(e,t);case"Polygon":return!ge(t,e)}break;case"LineString":switch(e.type){case"Point":return!Ho(t,e);case"LineString":return!function(t,e){return gr(t,e).features.length>0}(t,e);case"Polygon":return!Wo(e,t)}break;case"Polygon":switch(e.type){case"Point":return!ge(e,t);case"LineString":return!Wo(t,e);case"Polygon":return!function(t,e){for(var n=0,r=t.coordinates[0];n<r.length;n++)if(ge(r[n],e))return!0;for(var i=0,o=e.coordinates[0];i<o.length;i++)if(ge(o[i],t))return!0;return gr(si(t),si(e)).features.length>0}(e,t)}}var n,r;return!1}(t.geometry,e.geometry)}))})),n}function Ho(t,e){for(var n=0;n<t.coordinates.length-1;n++)if(Jo(t.coordinates[n],t.coordinates[n+1],e.coordinates))return!0;return!1}function Wo(t,e){for(var n=0,r=e.coordinates;n<r.length;n++)if(ge(r[n],t))return!0;return gr(e,si(t)).features.length>0}function Jo(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 0==r*s-i*o&&(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])}function Zo(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Ko(t,e){return t[0]===e[0]&&t[1]===e[1]}function Qo(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function $o(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),ns(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?n=!0:r=!0}o++}return n&&r}function ts(t,e){return gr(t,ai(e)).features.length>0}function es(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&(!n||!r);o++)ge(a(t.coordinates[o]),e)?n=!0:r=!0;return r&&n}function ns(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])}var rs=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:ss};function is(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function os(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function ss(t,e){return _i(t,e,{strict:!0})}rs.prototype.compare=function(t,e){if(t.type!==e.type||!os(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=is(t),i=is(e);return r.every((function(t){return this.some((function(e){return n.compare(t,e)}))}),i)}}return!1},rs.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},rs.prototype.compareLine=function(t,e,n,r){if(!os(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)}},rs.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},rs.prototype.comparePath=function(t,e){var n=this;return t.every((function(t,e){return n.compareCoord(t,this[e])}),e)},rs.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},rs.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)},rs.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},rs.prototype.removePseudo=function(t){return t};var as=rs;function us(t,e){var n=!1;return z(t,(function(t){z(e,(function(e){if(!0===n)return!0;n=!Yo(t.geometry,e.geometry)}))})),n}var ls=qt((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)})),cs=qt((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(c),a=0,u=0;u<c;u++)s[u]=0;for(var l=0;l<n;l++){var c=this.dataset[l].length;if(o===this.assignments[l]){for(u=0;u<c;u++)s[u]+=this.dataset[l][u];a++}}if(a>0){for(u=0;u<c;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)})),hs=qt((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)})),ps=qt((function(t){if(t.exports)var e=hs;function n(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)}n.prototype.run=function(t,n,r,i){this._init(t,n,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 e(null,null,"asc"),l=this._regionQuery(o);void 0!==this._distanceToCore(o)&&(this._updateQueue(o,l,u),this._expandCluster(a,u))}return this.clusters},n.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},n.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)},n.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))}}))},n.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))}}},n.prototype._distanceToCore=function(t){for(var e=this.epsilon,n=0;n<e;n++)if(this._regionQuery(t,n).length>=this.minPts)return n},n.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},n.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=n)})),fs=qt((function(t){t.exports&&(t.exports={DBSCAN:ls,KMEANS:cs,OPTICS:ps,PriorityQueue:hs})})),gs=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},ds=gs,ys=function(t,e,n){var r=Math.abs(t-e);return n?r:r*r},vs=gs;function _s(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}var ms=function(t,e,n,r){var i=[],o=[],s=[],a=[],u=!1,l=r||1e4,c=t.length,h=t[0].length,p=h>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?ds:ys,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,l=0,c=[],h=0;h<i;h++){for(var p=1/0,f=0;f<u;f++){var g=n(t[h],r[f]);g<=p&&(p=g)}a[h]=p}for(var d=0;d<i;d++)l+=a[d];for(var y=0;y<i;y++)c[y]={i:y,v:t[y],pr:a[y]/l,cs:0};c.sort((function(t,e){return t.pr-e.pr})),c[0].cs=c[0].pr;for(var v=1;v<i;v++)c[v].cs=c[v-1].cs+c[v].pr;for(var _=Math.random(),m=0;m<i-1&&c[m++].cs<_;);r.push(c[m-1].v)}return r}(t,e):n;else for(var g={};i.length<e;){var d=Math.floor(Math.random()*c);g[d]||(g[d]=!0,i.push(t[d]))}do{_s(e,0,f);for(var y=0;y<c;y++){for(var v=1/0,_=0,m=0;m<e;m++)(a=p?vs(t[y],i[m]):Math.abs(t[y]-i[m]))<=v&&(v=a,_=m);s[y]=_,f[_]++}for(var x=[],E=(o=[],0);E<e;E++)x[E]=p?_s(h,0,x[E]):0,o[E]=i[E];if(p){for(var b=0;b<e;b++)i[b]=[];for(var w=0;w<c;w++)for(var I=x[s[w]],N=t[w],S=0;S<h;S++)I[S]+=N[S];u=!0;for(var C=0;C<e;C++){for(var P=i[C],M=x[C],L=o[C],O=f[C],R=0;R<h;R++)P[R]=M[R]/O||0;if(u)for(var T=0;T<h;T++)if(L[T]!=P[T]){u=!1;break}}}else{for(var A=0;A<c;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||--l<=0}while(!u);return{it:1e4-l,k:e,idxs:s,centroids:i}};function xs(t,e){return b(bi(t[0],t[1]))===b(bi(e[0],e[1]))}function Es(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 bs(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}var ws={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||ws.heuristics.manhattan,o=r.closest||!1,s=new Ss((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 bs(u);u.closed=!0;for(var l=t.neighbors(u),c=0,h=l.length;c<h;++c){var p=l[c];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?bs(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}};function Is(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 Ns(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function Ns(t,e,n){this.x=t,this.y=e,this.weight=n}function Ss(t){this.content=[],this.scoreFunction=t}function Cs(t,e){for(var n=0;n<e.features.length;n++)if(ge(t,e.features[n]))return!0;return!1}function Ps(t){return function(){return t}}function Ms(t){return t[0]}function Ls(t){return t[1]}function Os(){this._=null}function Rs(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Ts(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 As(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 Ds(t){for(;t.L;)t=t.L;return t}function Fs(t,e,n,r){var i=[null,null],o=sa.push(i)-1;return i.left=t,i.right=e,n&&Gs(i,t,e,n),r&&Gs(i,e,t,r),ia[t.index].halfedges.push(o),ia[e.index].halfedges.push(o),i}function ks(t,e,n){var r=[e,n];return r.left=t,r}function Gs(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 qs(t,e,n,r,i){var o,s=t[0],a=t[1],u=s[0],l=s[1],c=0,h=1,p=a[0]-u,f=a[1]-l;if(o=e-u,p||!(o>0)){if(o/=p,p<0){if(o<c)return;o<h&&(h=o)}else if(p>0){if(o>h)return;o>c&&(c=o)}if(o=r-u,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o<c)return;o<h&&(h=o)}if(o=n-l,f||!(o>0)){if(o/=f,f<0){if(o<c)return;o<h&&(h=o)}else if(f>0){if(o>h)return;o>c&&(c=o)}if(o=i-l,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o<c)return;o<h&&(h=o)}return!(c>0||h<1)||(c>0&&(t[0]=[u+c*p,l+c*f]),h<1&&(t[1]=[u+h*p,l+h*f]),!0)}}}}}function Bs(t,e,n,r,i){var o=t[1];if(o)return!0;var s,a,u=t[0],l=t.left,c=t.right,h=l[0],p=l[1],f=c[0],g=c[1],d=(h+f)/2,y=(p+g)/2;if(g===p){if(d<e||d>=r)return;if(h>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=(h-f)/(g-p))*d,s<-1||s>1)if(h>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 zs(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 js(t,e){return e[+(e.left!==t.site)]}function Us(t,e){return e[+(e.left===t.site)]}Is.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)ws.cleanNode(this.nodes[t])},Is.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)ws.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Is.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Is.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},Is.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")},Ns.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Ns.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},Ns.prototype.isWall=function(){return 0===this.weight},Ss.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 l=this.content[o];this.scoreFunction(l)<(null===a?r:i)&&(a=o)}if(null===a)break;this.content[t]=this.content[a],this.content[a]=n,t=a}}},Os.prototype={constructor:Os,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=Ds(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&&(Ts(this,n),n=(t=n).U),n.C=!1,r.C=!0,As(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(As(this,n),n=(t=n).U),n.C=!1,r.C=!0,Ts(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?Ds(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,Ts(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,As(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Ts(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,As(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,Ts(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,As(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var Vs,Xs=[];function Ys(){Rs(this),this.x=this.y=this.arc=this.site=this.cy=null}function Hs(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,l=r[1]-a,c=o[0]-s,h=o[1]-a,p=2*(u*h-l*c);if(!(p>=-ua)){var f=u*u+l*l,g=c*c+h*h,d=(h*f-l*g)/p,y=(u*g-c*f)/p,v=Xs.pop()||new Ys;v.arc=t,v.site=i,v.x=d+s,v.y=(v.cy=y+a)+Math.sqrt(d*d+y*y),t.circle=v;for(var _=null,m=oa._;m;)if(v.y<m.y||v.y===m.y&&v.x<=m.x){if(!m.L){_=m.P;break}m=m.L}else{if(!m.R){_=m;break}m=m.R}oa.insert(_,v),_||(Vs=v)}}}}function Ws(t){var e=t.circle;e&&(e.P||(Vs=e.N),oa.remove(e),Xs.push(e),Rs(e),t.circle=null)}var Js=[];function Zs(){Rs(this),this.edge=this.site=this.circle=null}function Ks(t){var e=Js.pop()||new Zs;return e.site=t,e}function Qs(t){Ws(t),ra.remove(t),Js.push(t),Rs(t)}function $s(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,s=t.N,a=[t];Qs(t);for(var u=o;u.circle&&Math.abs(n-u.circle.x)<aa&&Math.abs(r-u.circle.cy)<aa;)o=u.P,a.unshift(u),Qs(u),u=o;a.unshift(u),Ws(u);for(var l=s;l.circle&&Math.abs(n-l.circle.x)<aa&&Math.abs(r-l.circle.cy)<aa;)s=l.N,a.push(l),Qs(l),l=s;a.push(l),Ws(l);var c,h=a.length;for(c=1;c<h;++c)l=a[c],u=a[c-1],Gs(l.edge,u.site,l.site,i);u=a[0],(l=a[h-1]).edge=Fs(u.site,l.site,null,i),Hs(u),Hs(l)}function ta(t){for(var e,n,r,i,o=t[0],s=t[1],a=ra._;a;)if((r=ea(a,s)-o)>aa)a=a.L;else{if(!((i=o-na(a,s))>aa)){r>-aa?(e=a.P,n=a):i>-aa?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){ia[t.index]={site:t,halfedges:[]}}(t);var u=Ks(t);if(ra.insert(e,u),e||n){if(e===n)return Ws(e),n=Ks(e.site),ra.insert(u,n),u.edge=n.edge=Fs(e.site,u.site),Hs(e),void Hs(n);if(n){Ws(e),Ws(n);var l=e.site,c=l[0],h=l[1],p=t[0]-c,f=t[1]-h,g=n.site,d=g[0]-c,y=g[1]-h,v=2*(p*y-f*d),_=p*p+f*f,m=d*d+y*y,x=[(y*_-f*m)/v+c,(p*m-d*_)/v+h];Gs(n.edge,l,g,x),u.edge=Fs(l,t,null,x),n.edge=Fs(t,g,null,x),Hs(e),Hs(n)}else u.edge=Fs(e.site,u.site)}}function ea(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],l=u-e;if(!l)return a;var c=a-r,h=1/o-1/l,p=c/l;return h?(-p+Math.sqrt(p*p-2*h*(c*c/(-2*l)-u+l/2+i-o/2)))/h+r:(r+a)/2}function na(t,e){var n=t.N;if(n)return ea(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var ra,ia,oa,sa,aa=1e-6,ua=1e-12;function la(t,e){return e[1]-t[1]||e[0]-t[0]}function ca(t,e){var n,r,i,o=t.sort(la).pop();for(sa=[],ia=new Array(t.length),ra=new Os,oa=new Os;;)if(i=Vs,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===n&&o[1]===r||(ta(o),n=o[0],r=o[1]),o=t.pop();else{if(!i)break;$s(i.arc)}if(function(){for(var t,e,n,r,i=0,o=ia.length;i<o;++i)if((t=ia[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]=zs(t,sa[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],l=+e[1][1];!function(t,e,n,r){for(var i,o=sa.length;o--;)Bs(i=sa[o],t,e,n,r)&&qs(i,t,e,n,r)&&(Math.abs(i[0][0]-i[1][0])>aa||Math.abs(i[0][1]-i[1][1])>aa)||delete sa[o]}(s,a,u,l),function(t,e,n,r){var i,o,s,a,u,l,c,h,p,f,g,d,y=ia.length,v=!0;for(i=0;i<y;++i)if(o=ia[i]){for(s=o.site,a=(u=o.halfedges).length;a--;)sa[u[a]]||u.splice(a,1);for(a=0,l=u.length;a<l;)g=(f=Us(o,sa[u[a]]))[0],d=f[1],h=(c=js(o,sa[u[++a%l]]))[0],p=c[1],(Math.abs(g-h)>aa||Math.abs(d-p)>aa)&&(u.splice(a,0,sa.push(ks(s,f,Math.abs(g-t)<aa&&r-d>aa?[t,Math.abs(h-t)<aa?p:r]:Math.abs(d-r)<aa&&n-g>aa?[Math.abs(p-r)<aa?h:n,r]:Math.abs(g-n)<aa&&d-e>aa?[n,Math.abs(h-n)<aa?p:e]:Math.abs(d-e)<aa&&g-t>aa?[Math.abs(p-e)<aa?h:t,e]:null))-1),++l);l&&(v=!1)}if(v){var _,m,x,E=1/0;for(i=0,v=null;i<y;++i)(o=ia[i])&&(x=(_=(s=o.site)[0]-t)*_+(m=s[1]-e)*m)<E&&(E=x,v=o);if(v){var b=[t,e],w=[t,r],I=[n,r],N=[n,e];v.halfedges.push(sa.push(ks(s=v.site,b,w))-1,sa.push(ks(s,w,I))-1,sa.push(ks(s,I,N))-1,sa.push(ks(s,N,b))-1)}}for(i=0;i<y;++i)(o=ia[i])&&(o.halfedges.length||delete ia[i])}(s,a,u,l)}this.edges=sa,this.cells=ia,ra=oa=sa=ia=null}function ha(t){return(t=t.slice()).push(t[0]),l([t])}function pa(t,e,n,r){var i=(r=r||{}).steps||64,o=r.units||"kilometers",s=r.angle||0,a=r.pivot||t,u=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(!P(r))throw new Error("options must be an object");if(!C(i))throw new Error("steps must be a number");if(!C(s))throw new Error("angle must be a number");var c=K(t);if("degrees"===o)var h=I(s);else e=Ii(t,e,90,{units:o}),n=Ii(t,n,0,{units:o}),e=K(e)[0]-c[0],n=K(n)[1]-c[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(fa(g),2)),y=e*n/Math.sqrt(Math.pow(e,2)+Math.pow(n,2)/Math.pow(fa(g),2));if(g<-90&&g>=-270&&(d=-d),g<-180&&g>=-360&&(y=-y),"degrees"===o){var v=d*Math.cos(h)+y*Math.sin(h),_=y*Math.cos(h)-d*Math.sin(h);d=v,y=_}p.push([d+c[0],y+c[1]])}return p.push(p[0]),"degrees"===o?l([p],u):Ao(l([p],u),s,{pivot:a})}function fa(t){var e=t*Math.PI/180;return Math.tan(e)}function ga(t,e){void 0===e&&(e={});var n=0,r=0,i=0;return q(t,(function(t,o,s){var a=e.weight?null==s?void 0:s[e.weight]:void 0;if(!C(a=null==a?1:a))throw new Error("weight value must be a number for feature index "+o);(a=Number(a))>0&&R(t,(function(t){n+=t[0]*a,r+=t[1]*a,i+=a}))})),a([n/i,r/i],e.properties,e)}function da(t,e,n,r,i){var o=r.tolerance||.001,s=0,u=0,l=0,c=0;if(F(n,(function(e){var n,r=null===(n=e.properties)||void 0===n?void 0:n.weight,i=null==r?1:r;if(!C(i=Number(i)))throw new Error("weight value must be a number");if(i>0){c+=1;var o=i*ve(e,t);0===o&&(o=1);var a=i/o;s+=e.geometry.coordinates[0]*a,u+=e.geometry.coordinates[1]*a,l+=a}})),c<1)throw new Error("no features to measure");var h=s/l,p=u/l;return 1===c||0===i||Math.abs(h-e[0])<o&&Math.abs(p-e[1])<o?a([h,p],{medianCandidates:r.medianCandidates}):(r.medianCandidates.push([h,p]),da([h,p],t,n,r,i-1))}function ya(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function va(t,e){var n=0,r=0;R(t,(function(i,o,s,a,u){u>n&&(n=u,r=o,e.push([]));var l=o-r,c=t.coordinates[u][l+1],h=i[0],p=i[1],f=c[0],g=c[1];e[u].push([.75*h+.25*f,.75*p+.25*g]),e[u].push([.25*h+.75*f,.25*p+.75*g])}),!0),e.forEach((function(t){t.push(t[0])}))}function _a(t,e){var n=0,r=0,i=0;R(t,(function(o,s,a,u,l){u>i&&(i=u,r=s,e.push([[]])),l>n&&(n=l,r=s,e[u].push([]));var c=s-r,h=t.coordinates[u][l][c+1],p=o[0],f=o[1],g=h[0],d=h[1];e[u][l].push([.75*p+.25*g,.75*f+.25*d]),e[u][l].push([.25*p+.75*g,.25*f+.75*d])}),!0),e.forEach((function(t){t.forEach((function(t){t.push(t[0])}))}))}function ma(t,e,n){void 0===n&&(n=2);var r=K(t),i=K(e),o=r[0]-i[0],s=r[1]-i[1];return 1===n?Math.abs(o)+Math.abs(s):Math.pow(Math.pow(o,n)+Math.pow(s,n),1/n)}function xa(t,e){var n=(e=e||{}).threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,s=e.standardization||!1,a=[];F(t,(function(t){a.push(gn(t))}));for(var u=[],l=0;l<a.length;l++)u[l]=[];for(l=0;l<a.length;l++)for(var c=l;c<a.length;c++){l===c&&(u[l][c]=0);var h=ma(a[l],a[c],r);u[l][c]=h,u[c][l]=h}for(l=0;l<a.length;l++)for(c=0;c<a.length;c++)0!==(h=u[l][c])&&(u[l][c]=i?h<=n?1:0:h<=n?Math.pow(h,o):0);if(s)for(l=0;l<a.length;l++){var p=u[l].reduce((function(t,e){return t+e}),0);for(c=0;c<a.length;c++)u[l][c]=u[l][c]/p}return u}function Ea(t){for(var e=0,n=0,r=t;n<r.length;n++)e+=r[n];return e/t.length}function ba(t,e){return void 0===e&&(e={}),Ia(t,"mercator",e)}function wa(t,e){return void 0===e&&(e={}),Ia(t,"wgs84",e)}function Ia(t,e,n){void 0===n&&(n={});var r=(n=n||{}).mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&C(t[0])?t="mercator"===e?Na(t):Sa(t):(!0!==r&&(t=be(t)),R(t,(function(t){var n="mercator"===e?Na(t):Sa(t);t[0]=n[0],t[1]=n[1]}))),t}function Na(t){var e=Math.PI/180,n=6378137,r=20037508.342789244,i=[n*(Math.abs(t[0])<=180?t[0]:t[0]-360*function(t){return t<0?-1:t>0?1:0}(t[0]))*e,n*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function Sa(t){var e=180/Math.PI,n=6378137;return[t[0]*e/n,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/n)))*e]}ca.prototype={constructor:ca,polygons:function(){var t=this.edges;return this.cells.map((function(e){var n=e.halfedges.map((function(n){return js(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,u,l,c=n.site,h=-1,p=e[i[o-1]],f=p.left===c?p.right:p.left;++h<o;)s=f,f=(p=e[i[h]]).left===c?p.right:p.left,s&&f&&r<s.index&&r<f.index&&(u=s,l=f,((a=c)[0]-l[0])*(u[1]-a[1])-(a[0]-u[0])*(l[1]-a[1])<0)&&t.push([c.data,s.data,f.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],l=e-i.site[1],c=u*u+l*l;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],l=e-a[1],h=u*u+l*l;h<c&&(c=h,s=a.index)}}))}while(null!==s);return o._found=r,null==n||c<=n*n?i.site:null}};var Ca=Object.freeze({__proto__:null,toMercator:ba,toWgs84:wa});function Pa(t){return Array.isArray(t)?Ta(t):t&&t.bbox?Ta(t.bbox):[360*Ra(),180*Ra()]}function Ma(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var n=[],r=0;r<t;r++)n.push(a(Pa(e.bbox)));return f(n)}function La(t,e){void 0===e&&(e={}),null==t&&(t=1),C(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),C(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var n=[],r=function(t){var r,i=[],o=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,n){n[e]=e>0?t+n[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var n=Math.random();i.push([n*(e.max_radial_length||10)*Math.sin(t),n*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((r=Pa(e.bbox),function(t){return[t[0]+r[0],t[1]+r[1]]})),n.push(l([i]))},i=0;i<t;i++)r();return f(n)}function Oa(t,e){if(void 0===e&&(e={}),!P(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),(!C(r)||void 0===r||r<2)&&(r=10),C(i)&&void 0!==i||(i=1e-4),C(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var u=[Pa(n)],l=0;l<r-1;l++){var c=(0===l?2*Math.random()*Math.PI:Math.tan((u[l][1]-u[l-1][1])/(u[l][0]-u[l-1][0])))+(Math.random()-.5)*o*2,p=Math.random()*i;u.push([u[l][0]+p*Math.cos(c),u[l][1]+p*Math.sin(c)])}s.push(h(u))}return f(s)}function Ra(){return Math.random()-.5}function Ta(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}var Aa=Object.freeze({__proto__:null,randomPosition:Pa,randomPoint:Ma,randomPolygon:La,randomLineString:Oa});function Da(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 F(t,(function(t){qa(t.properties,e)&&n.push(t)})),f(n)}function Fa(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=Ga(t,e),i=Object.keys(r),o=0;o<i.length;o++){for(var s=i[o],a=r[s],u=[],l=0;l<a.length;l++)u.push(t.features[a[l]]);n(f(u),s,o)}}function ka(t,e,n,r){var i=r;return Fa(t,e,(function(t,e,o){i=0===o&&void 0===r?t:n(i,t,e,o)})),i}function Ga(t,e){var n={};return F(t,(function(t,r){var i=t.properties||{};if(Object.prototype.hasOwnProperty.call(i,String(e))){var o=i[e];Object.prototype.hasOwnProperty.call(n,o)?n[o].push(r):n[o]=[r]}})),n}function qa(t,e){if(void 0===t)return!1;var n=typeof e;if("number"===n||"string"===n)return Object.prototype.hasOwnProperty.call(t,e);if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(!qa(t,e[r]))return!1;return!0}return Ba(t,e)}function Ba(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 za(t,e){if(!e)return{};if(!e.length)return{};for(var n={},r=0;r<e.length;r++){var i=e[r];Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n}var ja=Object.freeze({__proto__:null,getCluster:Da,clusterEach:Fa,clusterReduce:ka,createBins:Ga,applyFilter:qa,propertiesContainsFilter:Ba,filterProperties:za}),Ua=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};
|
|
/**
|
|
* splaytree v3.1.0
|
|
* Fast Splay tree for Node and browser
|
|
*
|
|
* @author Alexander Milevski <info@w8r.name>
|
|
* @license MIT
|
|
* @preserve
|
|
*/function Va(t,e){return t>e?1:t<e?-1:0}function Xa(t,e,n){for(var r=new Ua(null,null),i=r,o=r;;){var s=n(t,e.key);if(s<0){if(null===e.left)break;if(n(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(n(t,e.right.key)>0&&(a=e.right,e.right=a.left,a.left=e,null===(e=a).right))break;i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function Ya(t,e,n,r){var i=new Ua(t,e);if(null===n)return i.left=i.right=null,i;var o=r(t,(n=Xa(t,n,r)).key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function Ha(t,e,n){var r=null,i=null;if(e){var o=n((e=Xa(t,e,n)).key,t);0===o?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function Wa(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&Wa(t.left,o,!1,r,i),t.right&&Wa(t.right,o,!0,r,i)}}var Ja=function(){function t(t){void 0===t&&(t=Va),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=Ya(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var n=new Ua(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,i=Xa(t,this._root,r),o=r(t,i.key);return 0===o?this._root=i:(o<0?(n.left=i.left,n.right=i,i.left=null):o>0&&(n.right=i.right,n.left=i,i.right=null),this._size++,this._root=n),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=Xa(t,e,n)).key)?(null===e.left?r=e.right:(r=Xa(t,e.left,n)).right=e.right,this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Xa(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=Xa(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},t.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},t.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},t.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,n=[],r=!1,i=new Ua(null,null),o=i;!r;)e?(n.push(e),e=e.left):n.length>0?e=(e=o=o.next=n.pop()).right:r=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&Qa(t,e,0,r-1,i),null===this._root)this._root=Za(t,e,0,r),this._size=r;else{var o=function(t,e,n){for(var r=new Ua(null,null),i=r,o=t,s=e;null!==o&&null!==s;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return null!==o?i.next=o:null!==s&&(i.next=s),r.next}(this.toList(),function(t,e){for(var n=new Ua(null,null),r=n,i=0;i<t.length;i++)r=r.next=new Ua(t[i],e[i]);return r.next=null,n.next}(t,e),i);r=this._size+r,this._root=Ka({head:o},0,r)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return Wa(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,n){var r=this._comparator,i=Ha(t,this._root,r),o=i.left,s=i.right;r(t,e)<0?s=Ya(e,n,s,r):o=Ya(e,n,o,r),this._root=function(t,e,n){return null===e?t:(null===t||((e=Xa(t.key,e,n)).left=t),e)}(o,s,r)},t.prototype.split=function(t){return Ha(t,this._root,this._comparator)},t}();function Za(t,e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t[o],a=e[o],u=new Ua(s,a);return u.left=Za(t,e,n,o),u.right=Za(t,e,o+1,r),u}return null}function Ka(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=Ka(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=Ka(t,i+1,n),s}return null}function Qa(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}Qa(t,e,n,a,i),Qa(t,e,a+1,r,i)}}function $a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function eu(t,e,n){return e&&tu(t.prototype,e),n&&tu(t,n),t}var nu=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},ru=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},iu=Number.EPSILON;void 0===iu&&(iu=Math.pow(2,-52));var ou=iu*iu,su=function(t,e){if(-iu<t&&t<iu&&-iu<e&&e<iu)return 0;var n=t-e;return n*n<ou*t*e?0:t<e?-1:1},au=function(){function t(){$a(this,t),this.reset()}return eu(t,[{key:"reset",value:function(){this.xRounder=new uu,this.yRounder=new uu}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),uu=function(){function t(){$a(this,t),this.tree=new Ja,this.round(0)}return eu(t,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===su(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===su(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),t}(),lu=new au,cu=function(t,e){return t.x*e.y-t.y*e.x},hu=function(t,e){return t.x*e.x+t.y*e.y},pu=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=cu(r,i);return su(o,0)},fu=function(t){return Math.sqrt(hu(t,t))},gu=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return hu(i,r)/fu(i)/fu(r)},du=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},yu=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},vu=function(){function t(e,n){$a(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return eu(t,null,[{key:"compare",value:function(e,n){var r=t.comparePoints(e.point,n.point);return 0!==r?r:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:mu.compare(e.segment,n.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),eu(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i,o,s,a,u,l=r.otherSE;n.set(r,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},cu(u,a)/fu(u)/fu(a)),cosine:gu(e.point,t.point,l.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,a=n.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),_u=0,mu=function(){function t(e,n,r,i){$a(this,t),this.id=++_u,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return eu(t,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(n<r){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(n>r){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var d=t.comparePoint(e.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(i!==o){var y=u-s,v=i-n,_=l-a,m=o-r;if(y>v&&_<m)return 1;if(y<v&&_>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),eu(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=ru(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=nu(e,s)&&0===this.comparePoint(s),l=nu(n,i)&&0===t.comparePoint(i),c=nu(e,a)&&0===this.comparePoint(a),h=nu(n,o)&&0===t.comparePoint(o);if(l&&u)return h&&!c?o:!h&&c?a:null;if(l)return c&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&c)return null;if(h)return o;if(c)return a;var p=function(t,e,n,r){if(0===e.x)return yu(n,r,t.x);if(0===r.x)return yu(t,e,n.x);if(0===e.y)return du(n,r,t.y);if(0===r.y)return du(t,e,n.y);var i=cu(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=cu(o,e)/i,a=cu(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}}(i,this.vector(),s,t.vector());return null===p?null:nu(r,p)?lu.round(p.x,p.y):null}},{key:"split",value:function(e){var n=[],r=void 0!==e.events,i=new vu(e,!0),o=new vu(e,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return vu.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),vu.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var n=this,r=e;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=t.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a<u;a++){var l=r.rings[a],c=r.windings[a],h=n.rings.indexOf(l);-1===h?(n.rings.push(l),n.windings.push(c)):n.windings[h]+=c}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),n.push(a)):n[u]+=a}for(var l=[],c=[],h=0,p=e.length;h<p;h++)if(0!==n[h]){var f=e[h],g=f.poly;if(-1===c.indexOf(g))if(f.isExterior)l.push(g);else{-1===c.indexOf(g)&&c.push(g);var d=l.indexOf(f.poly);-1!==d&&l.splice(d,1)}}for(var y=0,v=l.length;y<v;y++){var _=l[y].multiPoly;-1===r.indexOf(_)&&r.push(_)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Mu.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===Mu.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(Mu.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,n,r){var i,o,s,a=vu.comparePoints(e,n);if(a<0)i=e,o=n,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=n,o=e,s=-1}return new t(new vu(i,!0),new vu(o,!1),[r],[s])}}]),t}(),xu=function(){function t(e,n,r){if($a(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=lu.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=lu.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(mu.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(mu.fromRing(o,i,this))}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),t}(),Eu=function(){function t(e,n){if($a(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new xu(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var r=1,i=e.length;r<i;r++){var o=new xu(e[r],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),bu=function(){function t(e,n){if($a(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var r=0,i=e.length;r<i;r++){var o=new Eu(e[r],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),wu=function(){function t(e){$a(this,t),this.events=e;for(var n=0,r=e.length;n<r;n++)e[n].segment.ringOut=this;this.poly=null}return eu(t,null,[{key:"factory",value:function(e){for(var n=[],r=0,i=e.length;r<i;r++){var o=e[r];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],c=a.point,h=[];s=a,a=u,l.push(a),a.point!==c;)for(;;){var p=a.getAvailableLinkedEvents();if(0===p.length){var f=l[0].point,g=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===p.length){u=p[0].otherSE;break}for(var d=null,y=0,v=h.length;y<v;y++)if(h[y].point===a.point){d=y;break}if(null===d){h.push({index:l.length,point:a.point});var _=a.getLeftmostComparator(s);u=p.sort(_)[0].otherSE;break}var m=h.splice(d)[0],x=l.splice(m.index);x.unshift(x[0].otherSE),n.push(new t(x.reverse()))}n.push(new t(l))}}return n}}]),eu(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==pu(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===pu(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,c=this.isExteriorRing()?e.length:-1,h=[],p=l;p!=c;p+=u)h.push([e[p].x,e[p].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];vu.compare(t,r)>0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Iu=function(){function t(e){$a(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return eu(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),t}(),Nu=function(){function t(e){$a(this,t),this.rings=e,this.polys=this._composePolys(e)}return eu(t,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new Iu(i));else{var o=i.enclosingRing();o.poly||e.push(new Iu(o)),o.poly.addInterior(i)}}return e}}]),t}(),Su=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mu.compare;$a(this,t),this.queue=e,this.tree=new Ja(n),this.segments=[]}return eu(t,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var c=this._splitSafely(s,l),h=0,p=c.length;h<p;h++)n.push(c[h])}var f=null;if(a){var g=a.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(f=g),!a.isAnEndpoint(g)))for(var d=this._splitSafely(a,g),y=0,v=d.length;y<v;y++)n.push(d[y])}if(null!==u||null!==f){var _=null;_=null===u?f:null===f||vu.comparePoints(u,f)<=0?u:f,this.queue.remove(e.rightSE),n.push(e.rightSE);for(var m=e.split(_),x=0,E=m.length;x<E;x++)n.push(m[x])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var b=s.getIntersection(a);if(null!==b){if(!s.isAnEndpoint(b))for(var w=this._splitSafely(s,b),I=0,N=w.length;I<N;I++)n.push(w[I]);if(!a.isAnEndpoint(b))for(var S=this._splitSafely(a,b),C=0,P=S.length;C<P;C++)n.push(S[C])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),t}(),Cu="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Pu="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Mu=new(function(){function t(){$a(this,t)}return eu(t,[{key:"run",value:function(t,e,n){Mu.type=t,lu.reset();for(var r=[new bu(e,!0)],i=0,o=n.length;i<o;i++)r.push(new bu(n[i],!1));if(Mu.numMultiPolys=r.length,"difference"===Mu.type)for(var s=r[0],a=1;a<r.length;)null!==ru(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===Mu.type)for(var u=0,l=r.length;u<l;u++)for(var c=r[u],h=u+1,p=r.length;h<p;h++)if(null===ru(c.bbox,r[h].bbox))return[];for(var f=new Ja(vu.compare),g=0,d=r.length;g<d;g++)for(var y=r[g].getSweepEvents(),v=0,_=y.length;v<_;v++)if(f.insert(y[v]),f.size>Cu)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new Su(f),x=f.size,E=f.pop();E;){var b=E.key;if(f.size===x){var w=b.segment;throw new Error("Unable to pop() ".concat(b.isLeft?"left":"right"," SweepEvent ")+"[".concat(b.point.x,", ").concat(b.point.y,"] from segment #").concat(w.id," ")+"[".concat(w.leftSE.point.x,", ").concat(w.leftSE.point.y,"] -> ")+"[".concat(w.rightSE.point.x,", ").concat(w.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>Cu)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>Pu)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=m.process(b),N=0,S=I.length;N<S;N++){var C=I[N];void 0===C.consumedBy&&f.insert(C)}x=f.size,E=f.pop()}lu.reset();var P=wu.factory(m.segments);return new Nu(P).getGeom()}}]),t}()),Lu={union:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Mu.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Mu.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Mu.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Mu.run("difference",t,n)}};"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 Ou=function(){};Ou.prototype.interfaces_=function(){return[]},Ou.prototype.getClass=function(){return Ou},Ou.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var Ru=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",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),Tu=function(){},Au={MAX_VALUE:{configurable:!0}};Tu.isNaN=function(t){return Number.isNaN(t)},Tu.doubleToLongBits=function(t){return t},Tu.longBitsToDouble=function(t){return t},Tu.isInfinite=function(t){return!Number.isFinite(t)},Au.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Tu,Au);var Du=function(){},Fu=function(){},ku=function(){};function Gu(){}var qu=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])},Bu={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};qu.prototype.setOrdinate=function(t,e){switch(t){case qu.X:this.x=e;break;case qu.Y:this.y=e;break;case qu.Z:this.z=e;break;default:throw new Ru("Invalid ordinate index: "+t)}},qu.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!!Ou.equalsWithTolerance(this.x,e.x,n)&&!!Ou.equalsWithTolerance(this.y,e.y,n)}},qu.prototype.getOrdinate=function(t){switch(t){case qu.X:return this.x;case qu.Y:return this.y;case qu.Z:return this.z}throw new Ru("Invalid ordinate index: "+t)},qu.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Tu.isNaN(this.z))&&Tu.isNaN(t.z)},qu.prototype.equals=function(t){return t instanceof qu&&this.equals2D(t)},qu.prototype.equalInZ=function(t,e){return Ou.equalsWithTolerance(this.z,t.z,e)},qu.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},qu.prototype.clone=function(){},qu.prototype.copy=function(){return new qu(this)},qu.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},qu.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)},qu.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},qu.prototype.hashCode=function(){var t=17;return 37*(t=37*t+qu.hashCode(this.x))+qu.hashCode(this.y)},qu.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},qu.prototype.interfaces_=function(){return[Du,Fu,Gu]},qu.prototype.getClass=function(){return qu},qu.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=Tu.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},Bu.DimensionalComparator.get=function(){return zu},Bu.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},Bu.NULL_ORDINATE.get=function(){return Tu.NaN},Bu.X.get=function(){return 0},Bu.Y.get=function(){return 1},Bu.Z.get=function(){return 2},Object.defineProperties(qu,Bu);var zu=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 Ru("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};zu.prototype.compare=function(t,e){var n=t,r=e,i=zu.compare(n.x,r.x);if(0!==i)return i;var o=zu.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:zu.compare(n.z,r.z)},zu.prototype.interfaces_=function(){return[ku]},zu.prototype.getClass=function(){return zu},zu.compare=function(t,e){return t<e?-1:t>e?1:Tu.isNaN(t)?Tu.isNaN(e)?0:-1:Tu.isNaN(e)?1:0};var ju=function(){};ju.prototype.create=function(){},ju.prototype.interfaces_=function(){return[]},ju.prototype.getClass=function(){return ju};var Uu=function(){},Vu={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Uu.prototype.interfaces_=function(){return[]},Uu.prototype.getClass=function(){return Uu},Uu.toLocationSymbol=function(t){switch(t){case Uu.EXTERIOR:return"e";case Uu.BOUNDARY:return"b";case Uu.INTERIOR:return"i";case Uu.NONE:return"-"}throw new Ru("Unknown location value: "+t)},Vu.INTERIOR.get=function(){return 0},Vu.BOUNDARY.get=function(){return 1},Vu.EXTERIOR.get=function(){return 2},Vu.NONE.get=function(){return-1},Object.defineProperties(Uu,Vu);var Xu=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Yu=function(){},Hu={LOG_10:{configurable:!0}};Yu.prototype.interfaces_=function(){return[]},Yu.prototype.getClass=function(){return Yu},Yu.log10=function(t){var e=Math.log(t);return Tu.isInfinite(e)||Tu.isNaN(e)?e:e/Yu.LOG_10},Yu.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},Yu.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}},Yu.wrap=function(t,e){return t<0?e- -t%e:t%e},Yu.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}},Yu.average=function(t,e){return(t+e)/2},Hu.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Yu,Hu);var Wu=function(t){this.str=t};Wu.prototype.append=function(t){this.str+=t},Wu.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},Wu.prototype.toString=function(t){return this.str};var Ju=function(t){this.value=t};Ju.prototype.intValue=function(){return this.value},Ju.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},Ju.isNaN=function(t){return Number.isNaN(t)};var Zu=function(){};Zu.isWhitespace=function(t){return t<=32&&t>=0||127===t},Zu.toUpperCase=function(t){return t.toUpperCase()};var Ku=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)}},Qu={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}};Ku.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},Ku.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=Ku.magnitude(n._hi),i=Ku.TEN.pow(r);(n=n.divide(i)).gt(Ku.TEN)?(n=n.divide(Ku.TEN),r+=1):n.lt(Ku.ONE)&&(n=n.multiply(Ku.TEN),r-=1);for(var o=r+1,s=new Wu,a=Ku.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(n._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,s.append(h),n=n.subtract(Ku.valueOf(l)).multiply(Ku.TEN),c&&n.selfAdd(Ku.TEN);var p=!0,f=Ku.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(p=!1),!p)break}return e[0]=r,s.toString()},Ku.prototype.sqr=function(){return this.multiply(this)},Ku.prototype.doubleValue=function(){return this._hi+this._lo},Ku.prototype.subtract=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},Ku.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},Ku.prototype.isZero=function(){return 0===this._hi&&0===this._lo},Ku.prototype.selfSubtract=function(){if(arguments[0]instanceof Ku){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)}},Ku.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Ku.prototype.min=function(t){return this.le(t)?this:t},Ku.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){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,l=null,c=null,h=null;return u=this._hi/n,h=(i=(l=Ku.SPLIT*u)-(i=l-u))*(s=(h=Ku.SPLIT*n)-(s=h-n))-(c=u*n)+i*(a=n-s)+(o=u-i)*s+o*a,h=u+(l=(this._hi-c-h+this._lo-u*r)/n),this._hi=h,this._lo=u-h+l,this}},Ku.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Ku.prototype.divide=function(){if(arguments[0]instanceof Ku){var t=arguments[0],e=null,n=null,r=null,i=null,o=null,s=null,a=null,u=null;n=(o=this._hi/t._hi)-(e=(s=Ku.SPLIT*o)-(e=s-o)),u=e*(r=(u=Ku.SPLIT*t._hi)-(r=u-t._hi))-(a=o*t._hi)+e*(i=t._hi-r)+n*r+n*i;var l=u=o+(s=(this._hi-a-u+this._lo-o*t._lo)/t._hi),c=o-u+s;return new Ku(l,c)}if("number"==typeof arguments[0]){var h=arguments[0];return Tu.isNaN(h)?Ku.createNaN():Ku.copy(this).selfDivide(h,0)}},Ku.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},Ku.prototype.pow=function(t){if(0===t)return Ku.valueOf(1);var e=new Ku(this),n=Ku.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},Ku.prototype.ceil=function(){if(this.isNaN())return Ku.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Ku(t,e)},Ku.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},Ku.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Ku.prototype.setValue=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},Ku.prototype.max=function(t){return this.ge(t)?this:t},Ku.prototype.sqrt=function(){if(this.isZero())return Ku.valueOf(0);if(this.isNegative())return Ku.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=Ku.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},Ku.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){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],l=arguments[1],c=null,h=null,p=null,f=null,g=null,d=null,y=null;f=this._hi+u,h=this._lo+l,g=f-(d=f-this._hi),p=h-(y=h-this._lo);var v=(c=f+(d=(g=u-d+(this._hi-g))+h))+(d=(p=l-y+(this._lo-p))+(d+(f-c))),_=d+(c-v);return this._hi=v,this._lo=_,this}},Ku.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){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,l=null;i=(u=Ku.SPLIT*this._hi)-this._hi,l=Ku.SPLIT*n,i=u-i,o=this._hi-i,s=l-n;var c=(u=this._hi*n)+(l=i*(s=l-s)-u+i*(a=n-s)+o*s+o*a+(this._hi*r+this._lo*n)),h=l+(i=u-c);return this._hi=c,this._lo=h,this}},Ku.prototype.selfSqr=function(){return this.selfMultiply(this)},Ku.prototype.floor=function(){if(this.isNaN())return Ku.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Ku(t,e)},Ku.prototype.negate=function(){return this.isNaN()?this:new Ku(-this._hi,-this._lo)},Ku.prototype.clone=function(){},Ku.prototype.multiply=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return t.isNaN()?Ku.createNaN():Ku.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Tu.isNaN(e)?Ku.createNaN():Ku.copy(this).selfMultiply(e,0)}},Ku.prototype.isNaN=function(){return Tu.isNaN(this._hi)},Ku.prototype.intValue=function(){return Math.trunc(this._hi)},Ku.prototype.toString=function(){var t=Ku.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},Ku.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."+Ku.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+Ku.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},Ku.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=Ku.SPLIT*n)-(i=s-n)),o=(a=Ku.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 Ku(u,n-u+s)},Ku.prototype.toSciNotation=function(){if(this.isZero())return Ku.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=Ku.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},Ku.prototype.abs=function(){return this.isNaN()?Ku.NaN:this.isNegative()?this.negate():new Ku(this)},Ku.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},Ku.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},Ku.prototype.add=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return Ku.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Ku.copy(this).selfAdd(e)}},Ku.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 Ku){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}},Ku.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},Ku.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},Ku.prototype.trunc=function(){return this.isNaN()?Ku.NaN:this.isPositive()?this.floor():this.ceil()},Ku.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Ku.prototype.interfaces_=function(){return[Gu,Du,Fu]},Ku.prototype.getClass=function(){return Ku},Ku.sqr=function(t){return Ku.valueOf(t).selfMultiply(t)},Ku.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return Ku.parse(t)}if("number"==typeof arguments[0]){var e=arguments[0];return new Ku(e)}},Ku.sqrt=function(t){return Ku.valueOf(t).sqrt()},Ku.parse=function(t){for(var e=0,n=t.length;Zu.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 Ku,s=0,a=0,u=0;!(e>=n);){var l=t.charAt(e);if(e++,Zu.isDigit(l)){var c=l-"0";o.selfMultiply(Ku.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=Ju.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' 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=Ku.TEN.pow(f);p=o.divide(g)}else if(f<0){var d=Ku.TEN.pow(-f);p=o.multiply(d)}return r?p.negate():p},Ku.createNaN=function(){return new Ku(Tu.NaN,Tu.NaN)},Ku.copy=function(t){return new Ku(t)},Ku.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},Ku.stringOfChar=function(t,e){for(var n=new Wu,r=0;r<e;r++)n.append(t);return n.toString()},Qu.PI.get=function(){return new Ku(3.141592653589793,12246467991473532e-32)},Qu.TWO_PI.get=function(){return new Ku(6.283185307179586,24492935982947064e-32)},Qu.PI_2.get=function(){return new Ku(1.5707963267948966,6123233995736766e-32)},Qu.E.get=function(){return new Ku(2.718281828459045,14456468917292502e-32)},Qu.NaN.get=function(){return new Ku(Tu.NaN,Tu.NaN)},Qu.EPS.get=function(){return 123259516440783e-46},Qu.SPLIT.get=function(){return 134217729},Qu.MAX_PRINT_DIGITS.get=function(){return 32},Qu.TEN.get=function(){return Ku.valueOf(10)},Qu.ONE.get=function(){return Ku.valueOf(1)},Qu.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Qu.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Ku,Qu);var $u=function(){},tl={DP_SAFE_EPSILON:{configurable:!0}};$u.prototype.interfaces_=function(){return[]},$u.prototype.getClass=function(){return $u},$u.orientationIndex=function(t,e,n){var r=$u.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=Ku.valueOf(e.x).selfAdd(-t.x),o=Ku.valueOf(e.y).selfAdd(-t.y),s=Ku.valueOf(n.x).selfAdd(-e.x),a=Ku.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},$u.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},$u.intersection=function(t,e,n,r){var i=Ku.valueOf(r.y).selfSubtract(n.y).selfMultiply(Ku.valueOf(e.x).selfSubtract(t.x)),o=Ku.valueOf(r.x).selfSubtract(n.x).selfMultiply(Ku.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=Ku.valueOf(r.x).selfSubtract(n.x).selfMultiply(Ku.valueOf(t.y).selfSubtract(n.y)),u=Ku.valueOf(r.y).selfSubtract(n.y).selfMultiply(Ku.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(s).doubleValue(),c=Ku.valueOf(t.x).selfAdd(Ku.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=Ku.valueOf(e.x).selfSubtract(t.x).selfMultiply(Ku.valueOf(t.y).selfSubtract(n.y)),p=Ku.valueOf(e.y).selfSubtract(t.y).selfMultiply(Ku.valueOf(t.x).selfSubtract(n.x)),f=h.subtract(p).selfDivide(s).doubleValue(),g=Ku.valueOf(n.y).selfAdd(Ku.valueOf(r.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();return new qu(c,g)},$u.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 $u.signum(s);r=i+o}else{if(!(i<0))return $u.signum(s);if(o>=0)return $u.signum(s);r=-i-o}var a=$u.DP_SAFE_EPSILON*r;return s>=a||-s>=a?$u.signum(s):2},$u.signum=function(t){return t>0?1:t<0?-1:0},tl.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties($u,tl);var el=function(){},nl={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};nl.X.get=function(){return 0},nl.Y.get=function(){return 1},nl.Z.get=function(){return 2},nl.M.get=function(){return 3},el.prototype.setOrdinate=function(t,e,n){},el.prototype.size=function(){},el.prototype.getOrdinate=function(t,e){},el.prototype.getCoordinate=function(){},el.prototype.getCoordinateCopy=function(t){},el.prototype.getDimension=function(){},el.prototype.getX=function(t){},el.prototype.clone=function(){},el.prototype.expandEnvelope=function(t){},el.prototype.copy=function(){},el.prototype.getY=function(t){},el.prototype.toCoordinateArray=function(){},el.prototype.interfaces_=function(){return[Fu]},el.prototype.getClass=function(){return el},Object.defineProperties(el,nl);var rl=function(){},il=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}(rl),ol=function(){};ol.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},ol.getProperty=function(t){return{"line.separator":"\n"}[t]};var sl=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 qu&&arguments[1]instanceof qu){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],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],p=arguments[1],f=arguments[2],g=arguments[3],d=h.y-p.y,y=p.x-h.x,v=h.x*p.y-p.x*h.y,_=f.y-g.y,m=g.x-f.x,x=f.x*g.y-g.x*f.y;this.x=y*x-m*v,this.y=_*v-d*x,this.w=d*m-_*y}};sl.prototype.getY=function(){var t=this.y/this.w;if(Tu.isNaN(t)||Tu.isInfinite(t))throw new il;return t},sl.prototype.getX=function(){var t=this.x/this.w;if(Tu.isNaN(t)||Tu.isInfinite(t))throw new il;return t},sl.prototype.getCoordinate=function(){var t=new qu;return t.x=this.getX(),t.y=this.getY(),t},sl.prototype.interfaces_=function(){return[]},sl.prototype.getClass=function(){return sl},sl.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,l=n.x*r.y-r.x*n.y,c=i*u-a*o,h=(o*l-u*s)/c,p=(a*s-i*l)/c;if(Tu.isNaN(h)||Tu.isInfinite(h)||Tu.isNaN(p)||Tu.isInfinite(p))throw new il;return new qu(h,p)};var al=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 qu){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)}},ul={serialVersionUID:{configurable:!0}};al.prototype.getArea=function(){return this.getWidth()*this.getHeight()},al.prototype.equals=function(t){if(!(t instanceof al))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()},al.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new al;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 al(e,r,n,i)},al.prototype.isNull=function(){return this._maxx<this._minx},al.prototype.getMaxX=function(){return this._maxx},al.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof qu){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof al){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}},al.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof al){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 qu){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)}},al.prototype.getMinY=function(){return this._miny},al.prototype.getMinX=function(){return this._minx},al.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof qu){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof al){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))}},al.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},al.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},al.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},al.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},al.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},al.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},al.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},al.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},al.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()}},al.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof al){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof qu){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)}},al.prototype.centre=function(){return this.isNull()?null:new qu((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},al.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof qu){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof al){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)}},al.prototype.getMaxY=function(){return this._maxy},al.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)},al.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+qu.hashCode(this._minx))+qu.hashCode(this._maxx))+qu.hashCode(this._miny))+qu.hashCode(this._maxy)},al.prototype.interfaces_=function(){return[Du,Gu]},al.prototype.getClass=function(){return al},al.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),l=Math.min(r.x,i.x),c=Math.max(r.x,i.x);return!(l>u||c<a||(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(r.y,i.y),c=Math.max(r.y,i.y),l>u||c<a))}},ul.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(al,ul);var ll={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*$/},cl=function(t){this.geometryFactory=t||new Jc};cl.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=ll.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=ll.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],pl[n]&&(e=pl[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},cl.prototype.write=function(t){return this.extractGeometry(t)},cl.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!hl[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+hl[e].apply(this,[t])+")"};var hl={coordinate:function(t){return t.x+" "+t.y},point:function(t){return hl.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+hl.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(hl.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(hl.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("("+hl.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+hl.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+hl.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("("+hl.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(",")}},pl={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(ll.spaces);return this.geometryFactory.createPoint(new qu(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(ll.trimParens,"$1"),r.push(pl.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(ll.spaces),r.push(new qu(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(ll.spaces),r.push(new qu(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var n=t.trim().split(ll.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(ll.trimParens,"$1"),r.push(pl.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e,n,r;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(ll.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(ll.trimParens,"$1"),n=pl.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){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var n=t.trim().split(ll.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(ll.trimParens,"$1"),r.push(pl.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)}},fl=function(t){this.parser=new cl(t)};fl.prototype.write=function(t){return this.parser.write(t)},fl.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var gl=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),dl=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}(gl),yl=function(){};yl.prototype.interfaces_=function(){return[]},yl.prototype.getClass=function(){return yl},yl.shouldNeverReachHere=function(){if(0===arguments.length)yl.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new dl("Should never reach here"+(null!==t?": "+t:""))}},yl.isTrue=function(){var t;if(1===arguments.length)yl.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new dl:new dl(t)},yl.equals=function(){var t,e,n;if(2===arguments.length)yl.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],n=arguments[2],!(e=arguments[1]).equals(t)))throw new dl("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var vl=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 qu,this._intPt[1]=new qu,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},_l={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};vl.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},vl.prototype.getTopologySummary=function(){var t=new Wu;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},vl.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)},vl.prototype.getIntersectionNum=function(){return this._result},vl.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],e=this.getEdgeDistance(t,0),n=this.getEdgeDistance(t,1);e>n?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},vl.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},vl.prototype.setPrecisionModel=function(t){this._precisionModel=t},vl.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],n=0;n<this._result;n++)if(!t._intPt[n].equals2D(t._inputLines[e][0])&&!t._intPt[n].equals2D(t._inputLines[e][1]))return!0;return!1}},vl.prototype.getIntersection=function(t){return this._intPt[t]},vl.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},vl.prototype.hasIntersection=function(){return this._result!==vl.NO_INTERSECTION},vl.prototype.getEdgeDistance=function(t,e){return vl.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},vl.prototype.isCollinear=function(){return this._result===vl.COLLINEAR_INTERSECTION},vl.prototype.toString=function(){return fl.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+fl.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},vl.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},vl.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},vl.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},vl.prototype.interfaces_=function(){return[]},vl.prototype.getClass=function(){return vl},vl.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 yl.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},vl.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return yl.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},_l.DONT_INTERSECT.get=function(){return 0},_l.DO_INTERSECT.get=function(){return 1},_l.COLLINEAR.get=function(){return 2},_l.NO_INTERSECTION.get=function(){return 0},_l.POINT_INTERSECTION.get=function(){return 1},_l.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(vl,_l);var ml=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 al(this._inputLines[0][0],this._inputLines[0][1]),n=new al(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,al.intersects(n,r,e)&&0===bl.orientationIndex(n,r,e)&&0===bl.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=sl.intersection(t,n,r,i)}catch(s){if(!(s instanceof il))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 qu(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=$u.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);ol.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&ol.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new qu(t),o=new qu(e),s=new qu(n),a=new qu(r),u=new qu;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,n,r,i){var o=al.intersects(e,n,r),s=al.intersects(e,n,i),a=al.intersects(r,i,e),u=al.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,l=n.x<r.x?n.x:r.x,c=n.y<r.y?n.y:r.y,h=n.x>r.x?n.x:r.x,p=n.y>r.y?n.y:r.y,f=((o>l?o:l)+(a<h?a:h))/2,g=((s>c?s:c)+(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,!al.intersects(e,n,r,i))return t.NO_INTERSECTION;var o=bl.orientationIndex(e,n,r),s=bl.orientationIndex(e,n,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=bl.orientationIndex(r,i,e),u=bl.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 qu(r):0===s?this._intPt[0]=new qu(i):0===a?this._intPt[0]=new qu(e):0===u&&(this._intPt[0]=new qu(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=bl.distancePointLine(t,n,r),s=bl.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=bl.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=bl.distancePointLine(r,t,e))<o&&(o=s,i=r),i},e}(vl),xl=function(){};xl.prototype.interfaces_=function(){return[]},xl.prototype.getClass=function(){return xl},xl.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 xl.signOfDet2x2(r,i,o,s)},xl.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 El=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};El.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=xl.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},El.prototype.isPointInPolygon=function(){return this.getLocation()!==Uu.EXTERIOR},El.prototype.getLocation=function(){return this._isPointOnSegment?Uu.BOUNDARY:this._crossingCount%2==1?Uu.INTERIOR:Uu.EXTERIOR},El.prototype.isOnSegment=function(){return this._isPointOnSegment},El.prototype.interfaces_=function(){return[]},El.prototype.getClass=function(){return El},El.locatePointInRing=function(){if(arguments[0]instanceof qu&&Xu(arguments[1],el)){for(var t=arguments[0],e=arguments[1],n=new El(t),r=new qu,i=new qu,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 qu&&arguments[1]instanceof Array){for(var s=arguments[0],a=arguments[1],u=new El(s),l=1;l<a.length;l++){var c=a[l],h=a[l-1];if(u.countSegment(c,h),u.isOnSegment())return u.getLocation()}return u.getLocation()}};var bl=function(){},wl={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};bl.prototype.interfaces_=function(){return[]},bl.prototype.getClass=function(){return bl},bl.orientationIndex=function(t,e,n){return $u.orientationIndex(t,e,n)},bl.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,s=t[r-1].y;e+=i*(s-o)}return e/2}if(Xu(arguments[0],el)){var a=arguments[0],u=a.size();if(u<3)return 0;var l=new qu,c=new qu,h=new qu;a.getCoordinate(0,c),a.getCoordinate(1,h);var p=c.x;h.x-=p;for(var f=0,g=1;g<u-1;g++)l.y=c.y,c.x=h.x,c.y=h.y,a.getCoordinate(g+1,h),h.x-=p,f+=c.x*(l.y-h.y);return f/2}},bl.distanceLineLine=function(t,e,n,r){if(t.equals(e))return bl.distancePointLine(t,n,r);if(n.equals(r))return bl.distancePointLine(r,t,e);var i=!1;if(al.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?Yu.min(bl.distancePointLine(t,n,r),bl.distancePointLine(e,n,r),bl.distancePointLine(n,t,e),bl.distancePointLine(r,t,e)):0},bl.isPointInRing=function(t,e){return bl.locatePointInRing(t,e)!==Uu.EXTERIOR},bl.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new qu;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,l=a-i,c=u-o;n+=Math.sqrt(l*l+c*c),i=a,o=u}return n},bl.isCCW=function(t){var e=t.length-1;if(e<3)throw new Ru("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],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var c=bl.computeOrientation(u,n,l);return 0===c?u.x>l.x:c>0},bl.locatePointInRing=function(t,e){return El.locatePointInRing(t,e)},bl.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)},bl.computeOrientation=function(t,e,n){return bl.orientationIndex(t,e,n)},bl.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new Ru("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=bl.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),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},bl.isOnLine=function(t,e){for(var n=new ml,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},wl.CLOCKWISE.get=function(){return-1},wl.RIGHT.get=function(){return bl.CLOCKWISE},wl.COUNTERCLOCKWISE.get=function(){return 1},wl.LEFT.get=function(){return bl.COUNTERCLOCKWISE},wl.COLLINEAR.get=function(){return 0},wl.STRAIGHT.get=function(){return bl.COLLINEAR},Object.defineProperties(bl,wl);var Il=function(){};Il.prototype.filter=function(t){},Il.prototype.interfaces_=function(){return[]},Il.prototype.getClass=function(){return Il};var Nl=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Sl={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}};Nl.prototype.isGeometryCollection=function(){return this.getSortIndex()===Nl.SORTINDEX_GEOMETRYCOLLECTION},Nl.prototype.getFactory=function(){return this._factory},Nl.prototype.getGeometryN=function(t){return this},Nl.prototype.getArea=function(){return 0},Nl.prototype.isRectangle=function(){return!1},Nl.prototype.equals=function(){if(arguments[0]instanceof Nl){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof Nl))return!1;var n=e;return this.equalsExact(n)}},Nl.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},Nl.prototype.geometryChanged=function(){this.apply(Nl.geometryChangedFilter)},Nl.prototype.geometryChangedAction=function(){this._envelope=null},Nl.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},Nl.prototype.getLength=function(){return 0},Nl.prototype.getNumGeometries=function(){return 1},Nl.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)}},Nl.prototype.getUserData=function(){return this._userData},Nl.prototype.getSRID=function(){return this._SRID},Nl.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Nl.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===Nl.SORTINDEX_GEOMETRYCOLLECTION)throw new Ru("This method does not support GeometryCollection arguments")},Nl.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},Nl.prototype.norm=function(){var t=this.copy();return t.normalize(),t},Nl.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Nl.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new al(this._envelope)},Nl.prototype.setSRID=function(t){this._SRID=t},Nl.prototype.setUserData=function(t){this._userData=t},Nl.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},Nl.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Nl.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Nl.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Nl.SORTINDEX_MULTIPOINT||this.getSortIndex()===Nl.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Nl.SORTINDEX_MULTIPOLYGON},Nl.prototype.interfaces_=function(){return[Fu,Du,Gu]},Nl.prototype.getClass=function(){return Nl},Nl.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},Nl.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},Sl.serialVersionUID.get=function(){return 0x799ea46522854c00},Sl.SORTINDEX_POINT.get=function(){return 0},Sl.SORTINDEX_MULTIPOINT.get=function(){return 1},Sl.SORTINDEX_LINESTRING.get=function(){return 2},Sl.SORTINDEX_LINEARRING.get=function(){return 3},Sl.SORTINDEX_MULTILINESTRING.get=function(){return 4},Sl.SORTINDEX_POLYGON.get=function(){return 5},Sl.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Sl.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Sl.geometryChangedFilter.get=function(){return Cl},Object.defineProperties(Nl,Sl);var Cl=function(){};Cl.interfaces_=function(){return[Il]},Cl.filter=function(t){t.geometryChangedAction()};var Pl=function(){};Pl.prototype.filter=function(t){},Pl.prototype.interfaces_=function(){return[]},Pl.prototype.getClass=function(){return Pl};var Ml=function(){},Ll={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}};Ml.prototype.isInBoundary=function(t){},Ml.prototype.interfaces_=function(){return[]},Ml.prototype.getClass=function(){return Ml},Ll.Mod2BoundaryNodeRule.get=function(){return Ol},Ll.EndPointBoundaryNodeRule.get=function(){return Rl},Ll.MultiValentEndPointBoundaryNodeRule.get=function(){return Tl},Ll.MonoValentEndPointBoundaryNodeRule.get=function(){return Al},Ll.MOD2_BOUNDARY_RULE.get=function(){return new Ol},Ll.ENDPOINT_BOUNDARY_RULE.get=function(){return new Rl},Ll.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Tl},Ll.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Al},Ll.OGC_SFS_BOUNDARY_RULE.get=function(){return Ml.MOD2_BOUNDARY_RULE},Object.defineProperties(Ml,Ll);var Ol=function(){};Ol.prototype.isInBoundary=function(t){return t%2==1},Ol.prototype.interfaces_=function(){return[Ml]},Ol.prototype.getClass=function(){return Ol};var Rl=function(){};Rl.prototype.isInBoundary=function(t){return t>0},Rl.prototype.interfaces_=function(){return[Ml]},Rl.prototype.getClass=function(){return Rl};var Tl=function(){};Tl.prototype.isInBoundary=function(t){return t>1},Tl.prototype.interfaces_=function(){return[Ml]},Tl.prototype.getClass=function(){return Tl};var Al=function(){};Al.prototype.isInBoundary=function(t){return 1===t},Al.prototype.interfaces_=function(){return[Ml]},Al.prototype.getClass=function(){return Al};var Dl=function(){};function Fl(t){this.message=t||""}Dl.prototype.add=function(){},Dl.prototype.addAll=function(){},Dl.prototype.isEmpty=function(){},Dl.prototype.iterator=function(){},Dl.prototype.size=function(){},Dl.prototype.toArray=function(){},Dl.prototype.remove=function(){},Fl.prototype=new Error,Fl.prototype.name="IndexOutOfBoundsException";var kl=function(){};kl.prototype.hasNext=function(){},kl.prototype.next=function(){},kl.prototype.remove=function(){};var Gl=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}(Dl);function ql(t){this.message=t||""}ql.prototype=new Error,ql.prototype.name="NoSuchElementException";var Bl=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Dl&&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,Dl]},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 zl(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new Fl;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}(Gl),zl=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 ql;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}(kl),jl=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),e.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(){var e=this;if(2===arguments.length){for(var n=arguments[0],r=arguments[1],i=!1,o=n.iterator();o.hasNext();)e.add(o.next(),r),i=!0;return i}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(){var e=this;if(1===arguments.length){var n=arguments[0];t.prototype.add.call(this,n)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1];return this.add(r,i,!0),!0}if(arguments[0]instanceof qu&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1];if(!s&&this.size()>=1){var a=this.get(this.size()-1);if(a.equals2D(o))return null}t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];return this.add(u,l),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var c=arguments[0],h=arguments[1],p=arguments[2];if(p)for(var f=0;f<c.length;f++)e.add(c[f],h);else for(var g=c.length-1;g>=0;g--)e.add(c[g],h);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof qu){var d=arguments[0],y=arguments[1],v=arguments[2];if(!v){var _=this.size();if(_>0){if(d>0){var m=this.get(d-1);if(m.equals2D(y))return null}if(d<_){var x=this.get(d);if(x.equals2D(y))return null}}}t.prototype.add.call(this,d,y)}}else if(4===arguments.length){var E=arguments[0],b=arguments[1],w=arguments[2],I=arguments[3],N=1;w>I&&(N=-1);for(var S=w;S!==I;S+=N)e.add(E[S],b);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new qu(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(Bl),Ul=function(){},Vl={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Vl.ForwardComparator.get=function(){return Xl},Vl.BidirectionalComparator.get=function(){return Yl},Vl.coordArrayType.get=function(){return new Array(0).fill(null)},Ul.prototype.interfaces_=function(){return[]},Ul.prototype.getClass=function(){return Ul},Ul.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},Ul.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(Ul.indexOf(r,e)<0)return r}return null},Ul.scroll=function(t,e){var n=Ul.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);ol.arraycopy(t,n,r,0,t.length-n),ol.arraycopy(t,0,r,t.length-n,n),ol.arraycopy(r,0,t,0,t.length)},Ul.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}},Ul.intersection=function(t,e){for(var n=new jl,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},Ul.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},Ul.removeRepeatedPoints=function(t){return Ul.hasRepeatedPoints(t)?new jl(t,!1).toCoordinateArray():t},Ul.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}},Ul.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},Ul.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 qu(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 qu(r[i+u])},Ul.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},Ul.envelope=function(t){for(var e=new al,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},Ul.toCoordinateArray=function(t){return t.toArray(Ul.coordArrayType)},Ul.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},Ul.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},Ul.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},Ul.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},Ul.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},Ul.extract=function(t,e,n){e=Yu.clamp(e,0,t.length);var r=(n=Yu.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(Ul,Vl);var Xl=function(){};Xl.prototype.compare=function(t,e){return Ul.compare(t,e)},Xl.prototype.interfaces_=function(){return[ku]},Xl.prototype.getClass=function(){return Xl};var Yl=function(){};Yl.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=Ul.compare(n,r);return Ul.isEqualReversed(n,r)?0:i},Yl.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=Ul.increasingDirection(n),o=Ul.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u<n.length;u++){var l=n[s].compareTo(r[a]);if(0!==l)return l;s+=i,a+=o}return 0},Yl.prototype.interfaces_=function(){return[ku]},Yl.prototype.getClass=function(){return Yl};var Hl=function(){};Hl.prototype.get=function(){},Hl.prototype.put=function(){},Hl.prototype.size=function(){},Hl.prototype.values=function(){},Hl.prototype.entrySet=function(){};var Wl=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}(Hl);function Jl(t){this.message=t||""}function Zl(){}Jl.prototype=new Error,Jl.prototype.name="OperationNotSupported",Zl.prototype=new Dl,Zl.prototype.contains=function(){};var Kl=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Dl&&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 Ql(this)},e}(Zl),Ql=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 ql;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new Jl},e}(kl);function $l(t){return null===t?0:t.color}function tc(t){return null===t?null:t.parent}function ec(t,e){null!==t&&(t.color=e)}function nc(t){return null===t?null:t.left}function rc(t){return null===t?null:t.right}function ic(){this.root_=null,this.size_=0}ic.prototype=new Wl,ic.prototype.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},ic.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},ic.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(tc(t)===nc(tc(tc(t)))){var n=rc(tc(tc(t)));1===$l(n)?(ec(tc(t),0),ec(n,0),ec(tc(tc(t)),1),t=tc(tc(t))):(t===rc(tc(t))&&(t=tc(t),e.rotateLeft(t)),ec(tc(t),0),ec(tc(tc(t)),1),e.rotateRight(tc(tc(t))))}else{var r=nc(tc(tc(t)));1===$l(r)?(ec(tc(t),0),ec(r,0),ec(tc(tc(t)),1),t=tc(tc(t))):(t===nc(tc(t))&&(t=tc(t),e.rotateRight(t)),ec(tc(t),0),ec(tc(tc(t)),1),e.rotateLeft(tc(tc(t))))}this.root_.color=0},ic.prototype.values=function(){var t=new Bl,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=ic.successor(e));)t.add(e.value);return t},ic.prototype.entrySet=function(){var t=new Kl,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=ic.successor(e));)t.add(e);return t},ic.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}},ic.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}},ic.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},ic.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},ic.prototype.size=function(){return this.size_};var oc=function(){};function sc(){}function ac(){this.array_=[],arguments[0]instanceof Dl&&this.addAll(arguments[0])}oc.prototype.interfaces_=function(){return[]},oc.prototype.getClass=function(){return oc},sc.prototype=new Zl,ac.prototype=new sc,ac.prototype.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},ac.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},ac.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},ac.prototype.remove=function(t){throw new Jl},ac.prototype.size=function(){return this.array_.length},ac.prototype.isEmpty=function(){return 0===this.array_.length},ac.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},ac.prototype.iterator=function(){return new uc(this)};var uc=function(t){this.treeSet_=t,this.position_=0};uc.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new ql;return this.treeSet_.array_[this.position_++]},uc.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},uc.prototype.remove=function(){throw new Jl};var lc=function(){};lc.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])},lc.asList=function(t){for(var e=new Bl,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var cc=function(){},hc={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}};hc.P.get=function(){return 0},hc.L.get=function(){return 1},hc.A.get=function(){return 2},hc.FALSE.get=function(){return-1},hc.TRUE.get=function(){return-2},hc.DONTCARE.get=function(){return-3},hc.SYM_FALSE.get=function(){return"F"},hc.SYM_TRUE.get=function(){return"T"},hc.SYM_DONTCARE.get=function(){return"*"},hc.SYM_P.get=function(){return"0"},hc.SYM_L.get=function(){return"1"},hc.SYM_A.get=function(){return"2"},cc.prototype.interfaces_=function(){return[]},cc.prototype.getClass=function(){return cc},cc.toDimensionSymbol=function(t){switch(t){case cc.FALSE:return cc.SYM_FALSE;case cc.TRUE:return cc.SYM_TRUE;case cc.DONTCARE:return cc.SYM_DONTCARE;case cc.P:return cc.SYM_P;case cc.L:return cc.SYM_L;case cc.A:return cc.SYM_A}throw new Ru("Unknown dimension value: "+t)},cc.toDimensionValue=function(t){switch(Zu.toUpperCase(t)){case cc.SYM_FALSE:return cc.FALSE;case cc.SYM_TRUE:return cc.TRUE;case cc.SYM_DONTCARE:return cc.DONTCARE;case cc.SYM_P:return cc.P;case cc.SYM_L:return cc.L;case cc.SYM_A:return cc.A}throw new Ru("Unknown dimension symbol: "+t)},Object.defineProperties(cc,hc);var pc=function(){};pc.prototype.filter=function(t){},pc.prototype.interfaces_=function(){return[]},pc.prototype.getClass=function(){return pc};var fc=function(){};fc.prototype.filter=function(t,e){},fc.prototype.isDone=function(){},fc.prototype.isGeometryChanged=function(){},fc.prototype.interfaces_=function(){return[]},fc.prototype.getClass=function(){return fc};var gc=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new Ru("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new al,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(){var e=this;if(2===arguments.length){var n=arguments[0],r=arguments[1];if(!this.isEquivalentClass(n))return!1;var i=n;if(this._geometries.length!==i._geometries.length)return!1;for(var o=0;o<this._geometries.length;o++)if(!e._geometries[o].equalsExact(i._geometries[o],r))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();lc.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=cc.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=cc.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(){var t=this;if(1===arguments.length){var e=arguments[0],n=new ac(lc.asList(this._geometries)),r=new ac(lc.asList(e._geometries));return this.compare(n,r)}if(2===arguments.length){for(var i=arguments[0],o=arguments[1],s=i,a=this.getNumGeometries(),u=s.getNumGeometries(),l=0;l<a&&l<u;){var c=t.getGeometryN(l),h=s.getGeometryN(l),p=c.compareToSameClass(h,o);if(0!==p)return p;l++}return l<a?1:l<u?-1:0}},e.prototype.apply=function(){var t=this;if(Xu(arguments[0],Pl))for(var e=arguments[0],n=0;n<this._geometries.length;n++)t._geometries[n].apply(e);else if(Xu(arguments[0],fc)){var r=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(r),!r.isDone());i++);r.isGeometryChanged()&&this.geometryChanged()}else if(Xu(arguments[0],pc)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(Xu(arguments[0],Il)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),yl.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}(Nl),dc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Nl.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()?cc.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 yc(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[oc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(gc),yc=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=Ml.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}};yc.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)},yc.prototype.getBoundary=function(){return this._geom instanceof Cc?this.boundaryLineString(this._geom):this._geom instanceof dc?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},yc.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()])},yc.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},yc.prototype.computeBoundaryCoordinates=function(t){var e=this,n=new Bl;this._endpointMap=new ic;for(var r=0;r<t.getNumGeometries();r++){var i=t.getGeometryN(r);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&n.add(s.getKey())}return Ul.toCoordinateArray(n)},yc.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new vc,this._endpointMap.put(t,e)),e.count++},yc.prototype.interfaces_=function(){return[]},yc.prototype.getClass=function(){return yc},yc.getBoundary=function(){if(1===arguments.length){var t=arguments[0],e=new yc(t);return e.getBoundary()}if(2===arguments.length){var n=arguments[0],r=arguments[1],i=new yc(n,r);return i.getBoundary()}};var vc=function(){this.count=null};function _c(){}function mc(){}vc.prototype.interfaces_=function(){return[]},vc.prototype.getClass=function(){return vc};var xc=function(){};function Ec(){}function bc(){}function wc(){}var Ic=function(){},Nc={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Ic.prototype.interfaces_=function(){return[]},Ic.prototype.getClass=function(){return Ic},Ic.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Ic.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new Ec,n=new _c(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var r=arguments[0],i=arguments[1],o="",s=new mc(Ic.getStackTrace(r)),a=new wc(s),u=0;u<i;u++)try{o+=a.readLine()+Ic.NEWLINE}catch(t){if(!(t instanceof bc))throw t;yl.shouldNeverReachHere()}return o}},Ic.split=function(t,e){for(var n=e.length,r=new Bl,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},Ic.toString=function(){if(1===arguments.length){var t=arguments[0];return Ic.SIMPLE_ORDINATE_FORMAT.format(t)}},Ic.spaces=function(t){return Ic.chars(" ",t)},Nc.NEWLINE.get=function(){return ol.getProperty("line.separator")},Nc.SIMPLE_ORDINATE_FORMAT.get=function(){return new xc("0.#")},Object.defineProperties(Ic,Nc);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,el.X)===t.getOrdinate(e-1,el.X)&&t.getOrdinate(0,el.Y)===t.getOrdinate(e-1,el.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)||Tu.isNaN(s)&&Tu.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 Wu;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(Ic.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,el.X)===e.getOrdinate(n-1,el.X)&&e.getOrdinate(0,el.Y)===e.getOrdinate(n-1,el.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 Cc=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),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new al:this._points.expandEnvelope(new al)},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(){var e=this;if(2===arguments.length){var n=arguments[0],r=arguments[1];if(!this.isEquivalentClass(n))return!1;var i=n;if(this._points.size()!==i._points.size())return!1;for(var o=0;o<this._points.size();o++)if(!e.equal(e._points.getCoordinate(o),i._points.getCoordinate(o),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var n=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(n)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(n))>0&&Sc.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?cc.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 bl.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(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=e,r=0,i=0;r<this._points.size()&&i<n._points.size();){var o=t._points.getCoordinate(r).compareTo(n._points.getCoordinate(i));if(0!==o)return o;r++,i++}return r<this._points.size()?1:i<n._points.size()?-1:0}if(2===arguments.length){var s=arguments[0],a=arguments[1],u=s;return a.compare(this._points,u._points)}},e.prototype.apply=function(){var t=this;if(Xu(arguments[0],Pl))for(var e=arguments[0],n=0;n<this._points.size();n++)e.filter(t._points.getCoordinate(n));else if(Xu(arguments[0],fc)){var r=arguments[0];if(0===this._points.size())return null;for(var i=0;i<this._points.size()&&(r.filter(t._points,i),!r.isDone());i++);r.isGeometryChanged()&&this.geometryChanged()}else if(Xu(arguments[0],pc)){var o=arguments[0];o.filter(this)}else if(Xu(arguments[0],Il)){var s=arguments[0];s.filter(this)}},e.prototype.getBoundary=function(){return new yc(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 Ru("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[oc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(Nl),Pc=function(){};Pc.prototype.interfaces_=function(){return[]},Pc.prototype.getClass=function(){return Pc};var Mc=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),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new al;var t=new al;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 cc.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],e=t;return this.getCoordinate().compareTo(e.getCoordinate())}if(2===arguments.length){var n=arguments[0],r=arguments[1],i=n;return r.compare(this._coordinates,i._coordinates)}},e.prototype.apply=function(){if(Xu(arguments[0],Pl)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(Xu(arguments[0],fc)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(Xu(arguments[0],pc)){var n=arguments[0];n.filter(this)}else if(Xu(arguments[0],Il)){var r=arguments[0];r.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([])),yl.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[Pc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(Nl),Lc=function(){};Lc.prototype.interfaces_=function(){return[]},Lc.prototype.getClass=function(){return Lc};var Oc=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 Ru("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new Ru("shell is empty but holes are not");this._shell=e,this._holes=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.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(bl.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(bl.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),l=t.getY(a);if(u!==o==(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){var e=this;if(2===arguments.length){var n=arguments[0],r=arguments[1];if(!this.isEquivalentClass(n))return!1;var i=n,o=this._shell,s=i._shell;if(!o.equalsExact(s,r))return!1;if(this._holes.length!==i._holes.length)return!1;for(var a=0;a<this._holes.length;a++)if(!e._holes[a].equalsExact(i._holes[a],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){var t=this;if(0===arguments.length){this.normalize(this._shell,!0);for(var e=0;e<this._holes.length;e++)t.normalize(t._holes[e],!1);lc.sort(this._holes)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];if(n.isEmpty())return null;var i=new Array(n.getCoordinates().length-1).fill(null);ol.arraycopy(n.getCoordinates(),0,i,0,i.length);var o=Ul.minCoordinate(n.getCoordinates());Ul.scroll(i,o),ol.arraycopy(i,0,n.getCoordinates(),0,i.length),n.getCoordinates()[i.length]=i[0],bl.isCCW(n.getCoordinates())===r&&Ul.reverse(n.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(){var t=this;if(1===arguments.length){var e=arguments[0],n=this._shell,r=e._shell;return n.compareToSameClass(r)}if(2===arguments.length){var i=arguments[0],o=arguments[1],s=i,a=this._shell,u=s._shell,l=a.compareToSameClass(u,o);if(0!==l)return l;for(var c=this.getNumInteriorRing(),h=s.getNumInteriorRing(),p=0;p<c&&p<h;){var f=t.getInteriorRingN(p),g=s.getInteriorRingN(p),d=f.compareToSameClass(g,o);if(0!==d)return d;p++}return p<c?1:p<h?-1:0}},e.prototype.apply=function(t){var e=this;if(Xu(t,Pl)){this._shell.apply(t);for(var n=0;n<this._holes.length;n++)e._holes[n].apply(t)}else if(Xu(t,fc)){if(this._shell.apply(t),!t.isDone())for(var r=0;r<this._holes.length&&(e._holes[r].apply(t),!t.isDone());r++);t.isGeometryChanged()&&this.geometryChanged()}else if(Xu(t,pc))t.filter(this);else if(Xu(t,Il)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].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[Lc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(Nl),Rc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Nl.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 cc.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[Pc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(gc),Tc=function(t){function e(e,n){e instanceof qu&&n instanceof Jc&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Nl.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return cc.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 Ru("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new Ru("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}(Cc),Ac=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Nl.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 Bl,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[Lc]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(gc),Dc=function(t){this._factory=t||null,this._isUserDataCopied=!1},Fc={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Dc.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Dc.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Dc.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof gc?this.editGeometryCollection(t,e):t instanceof Oc?this.editPolygon(t,e):t instanceof Mc||t instanceof Cc?e.edit(t,this._factory):(yl.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Dc.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new Bl,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===Rc?this._factory.createMultiPoint(r.toArray([])):n.getClass()===dc?this._factory.createMultiLineString(r.toArray([])):n.getClass()===Ac?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},Dc.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 Bl,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([]))},Dc.prototype.interfaces_=function(){return[]},Dc.prototype.getClass=function(){return Dc},Dc.GeometryEditorOperation=function(){},Fc.NoOpGeometryOperation.get=function(){return kc},Fc.CoordinateOperation.get=function(){return Gc},Fc.CoordinateSequenceOperation.get=function(){return qc},Object.defineProperties(Dc,Fc);var kc=function(){};kc.prototype.edit=function(t,e){return t},kc.prototype.interfaces_=function(){return[Dc.GeometryEditorOperation]},kc.prototype.getClass=function(){return kc};var Gc=function(){};Gc.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof Tc?e.createLinearRing(n):t instanceof Cc?e.createLineString(n):t instanceof Mc?n.length>0?e.createPoint(n[0]):e.createPoint():t},Gc.prototype.interfaces_=function(){return[Dc.GeometryEditorOperation]},Gc.prototype.getClass=function(){return Gc};var qc=function(){};qc.prototype.edit=function(t,e){return t instanceof Tc?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Cc?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Mc?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},qc.prototype.interfaces_=function(){return[Dc.GeometryEditorOperation]},qc.prototype.getClass=function(){return qc};var Bc=function(){var t=this;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 e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)t._coordinates[n]=new qu}else if(Xu(arguments[0],el)){var r=arguments[0];if(null===r)return this._coordinates=new Array(0).fill(null),null;this._dimension=r.getDimension(),this._coordinates=new Array(r.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=r.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new qu}},zc={serialVersionUID:{configurable:!0}};Bc.prototype.setOrdinate=function(t,e,n){switch(e){case el.X:this._coordinates[t].x=n;break;case el.Y:this._coordinates[t].y=n;break;case el.Z:this._coordinates[t].z=n;break;default:throw new Ru("invalid ordinateIndex")}},Bc.prototype.size=function(){return this._coordinates.length},Bc.prototype.getOrdinate=function(t,e){switch(e){case el.X:return this._coordinates[t].x;case el.Y:return this._coordinates[t].y;case el.Z:return this._coordinates[t].z}return Tu.NaN},Bc.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}},Bc.prototype.getCoordinateCopy=function(t){return new qu(this._coordinates[t])},Bc.prototype.getDimension=function(){return this._dimension},Bc.prototype.getX=function(t){return this._coordinates[t].x},Bc.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 Bc(t,this._dimension)},Bc.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},Bc.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 Bc(t,this._dimension)},Bc.prototype.toString=function(){if(this._coordinates.length>0){var t=new Wu(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"()"},Bc.prototype.getY=function(t){return this._coordinates[t].y},Bc.prototype.toCoordinateArray=function(){return this._coordinates},Bc.prototype.interfaces_=function(){return[el,Gu]},Bc.prototype.getClass=function(){return Bc},zc.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Bc,zc);var jc=function(){},Uc={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};jc.prototype.readResolve=function(){return jc.instance()},jc.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new Bc(t)}if(Xu(arguments[0],el)){var e=arguments[0];return new Bc(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return r>3&&(r=3),r<2?new Bc(n):new Bc(n,r)}},jc.prototype.interfaces_=function(){return[ju,Gu]},jc.prototype.getClass=function(){return jc},jc.instance=function(){return jc.instanceObject},Uc.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Uc.instanceObject.get=function(){return new jc},Object.defineProperties(jc,Uc);var Vc=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 Bl,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 Kl;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(Hl),Xc=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 Hc){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}},Yc={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Xc.prototype.equals=function(t){if(!(t instanceof Xc))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Xc.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new Ju(n).compareTo(new Ju(r))},Xc.prototype.getScale=function(){return this._scale},Xc.prototype.isFloating=function(){return this._modelType===Xc.FLOATING||this._modelType===Xc.FLOATING_SINGLE},Xc.prototype.getType=function(){return this._modelType},Xc.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Xc.FLOATING?t="Floating":this._modelType===Xc.FLOATING_SINGLE?t="Floating-Single":this._modelType===Xc.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},Xc.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Tu.isNaN(t)||this._modelType===Xc.FLOATING_SINGLE?t:this._modelType===Xc.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof qu){var e=arguments[0];if(this._modelType===Xc.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},Xc.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Xc.FLOATING?t=16:this._modelType===Xc.FLOATING_SINGLE?t=6:this._modelType===Xc.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Xc.prototype.setScale=function(t){this._scale=Math.abs(t)},Xc.prototype.interfaces_=function(){return[Gu,Du]},Xc.prototype.getClass=function(){return Xc},Xc.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Yc.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Yc.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Xc,Yc);var Hc=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Wc={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Hc.prototype.readResolve=function(){return Hc.nameToTypeMap.get(this._name)},Hc.prototype.toString=function(){return this._name},Hc.prototype.interfaces_=function(){return[Gu]},Hc.prototype.getClass=function(){return Hc},Wc.serialVersionUID.get=function(){return-552860263173159e4},Wc.nameToTypeMap.get=function(){return new Vc},Object.defineProperties(Hc,Wc),Xc.Type=Hc,Xc.FIXED=new Hc("FIXED"),Xc.FLOATING=new Hc("FLOATING"),Xc.FLOATING_SINGLE=new Hc("FLOATING SINGLE");var Jc=function t(){this._precisionModel=new Xc,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?Xu(arguments[0],ju)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Xc&&(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]))},Zc={serialVersionUID:{configurable:!0}};Jc.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new qu(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new qu(t.getMinX(),t.getMinY()),new qu(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new qu(t.getMinX(),t.getMinY()),new qu(t.getMinX(),t.getMaxY()),new qu(t.getMaxX(),t.getMaxY()),new qu(t.getMaxX(),t.getMinY()),new qu(t.getMinX(),t.getMinY())]),null)},Jc.prototype.createLineString=function(t){return t?t instanceof Array?new Cc(this.getCoordinateSequenceFactory().create(t),this):Xu(t,el)?new Cc(t,this):void 0:new Cc(this.getCoordinateSequenceFactory().create([]),this)},Jc.prototype.createMultiLineString=function(){if(0===arguments.length)return new dc(null,this);if(1===arguments.length){var t=arguments[0];return new dc(t,this)}},Jc.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(Jc.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Oc)return this.createMultiPolygon(Jc.toPolygonArray(t));if(a instanceof Cc)return this.createMultiLineString(Jc.toLineStringArray(t));if(a instanceof Mc)return this.createMultiPoint(Jc.toPointArray(t));yl.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},Jc.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},Jc.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof qu){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(Xu(arguments[0],el)){var e=arguments[0];return new Mc(e,this)}}},Jc.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Jc.prototype.createPolygon=function(){if(0===arguments.length)return new Oc(null,null,this);if(1===arguments.length){if(Xu(arguments[0],el)){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 Tc){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];return new Oc(r,i,this)}},Jc.prototype.getSRID=function(){return this._SRID},Jc.prototype.createGeometryCollection=function(){if(0===arguments.length)return new gc(null,this);if(1===arguments.length){var t=arguments[0];return new gc(t,this)}},Jc.prototype.createGeometry=function(t){return new Dc(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},Jc.prototype.getPrecisionModel=function(){return this._precisionModel},Jc.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(Xu(arguments[0],el)){var e=arguments[0];return new Tc(e,this)}}},Jc.prototype.createMultiPolygon=function(){if(0===arguments.length)return new Ac(null,this);if(1===arguments.length){var t=arguments[0];return new Ac(t,this)}},Jc.prototype.createMultiPoint=function(){var t=this;if(0===arguments.length)return new Rc(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];return new Rc(e,this)}if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(null!==n?this.getCoordinateSequenceFactory().create(n):null)}if(Xu(arguments[0],el)){var r=arguments[0];if(null===r)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),o=0;o<r.size();o++){var s=t.getCoordinateSequenceFactory().create(1,r.getDimension());Sc.copy(r,o,s,0,1),i[o]=t.createPoint(s)}return this.createMultiPoint(i)}}},Jc.prototype.interfaces_=function(){return[Gu]},Jc.prototype.getClass=function(){return Jc},Jc.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.getDefaultCoordinateSequenceFactory=function(){return jc.instance()},Jc.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Jc.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},Zc.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(Jc,Zc);var Kc=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Qc=function(t){this.geometryFactory=t||new Jc};Qc.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!$c[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Kc.indexOf(n)?$c[n].apply(this,[e.coordinates]):"GeometryCollection"===n?$c[n].apply(this,[e.geometries]):$c[n].apply(this,[e])},Qc.prototype.write=function(t){var e=t.getGeometryType();if(!th[e])throw new Error("Geometry is not supported");return th[e].apply(this,[t])};var $c={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!$c[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=$c.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 qu(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new qu(t[0],t[1]),new qu(t[2],t[1]),new qu(t[2],t[3]),new qu(t[0],t[3]),new qu(t[0],t[1])])},Point:function(t){var e=new qu(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push($c.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=$c.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push($c.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=$c.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=$c.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($c.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)}},th={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:th.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=th.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(th.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=th.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=th.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=th.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=th.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(th[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},eh=function(t){this.geometryFactory=t||new Jc,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Qc(this.geometryFactory)};eh.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Xc.FIXED&&this.reducePrecision(e),e},eh.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 nh=function(){this.parser=new Qc(this.geometryFactory)};nh.prototype.write=function(t){return this.parser.write(t)};var rh=function(){},ih={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function oh(t){this.message=t||""}function sh(){this.array_=[]}rh.prototype.interfaces_=function(){return[]},rh.prototype.getClass=function(){return rh},rh.opposite=function(t){return t===rh.LEFT?rh.RIGHT:t===rh.RIGHT?rh.LEFT:t},ih.ON.get=function(){return 0},ih.LEFT.get=function(){return 1},ih.RIGHT.get=function(){return 2},Object.defineProperties(rh,ih),oh.prototype=new Error,oh.prototype.name="EmptyStackException",sh.prototype=new Gl,sh.prototype.add=function(t){return this.array_.push(t),!0},sh.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},sh.prototype.push=function(t){return this.array_.push(t),t},sh.prototype.pop=function(t){if(0===this.array_.length)throw new oh;return this.array_.pop()},sh.prototype.peek=function(){if(0===this.array_.length)throw new oh;return this.array_[this.array_.length-1]},sh.prototype.empty=function(){return 0===this.array_.length},sh.prototype.isEmpty=function(){return this.empty()},sh.prototype.search=function(t){return this.array_.indexOf(t)},sh.prototype.size=function(){return this.array_.length},sh.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var ah=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};ah.prototype.getCoordinate=function(){return this._minCoord},ah.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},ah.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();yl.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=bl.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===bl.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===bl.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},ah.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=rh.LEFT;return n[e].y<n[e+1].y&&(r=rh.RIGHT),r},ah.prototype.getEdge=function(){return this._orientedDe},ah.prototype.checkForRightmostCoordinate=function(t){for(var e=this,n=t.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(null===e._minCoord||n[r].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])},ah.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)},ah.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}yl.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)===rh.LEFT&&(this._orientedDe=this._minDe.getSym())},ah.prototype.interfaces_=function(){return[]},ah.prototype.getClass=function(){return ah};var uh=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new qu(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}(gl),lh=function(){this.array_=[]};lh.prototype.addLast=function(t){this.array_.push(t)},lh.prototype.removeFirst=function(){return this.array_.shift()},lh.prototype.isEmpty=function(){return 0===this.array_.length};var ch=function(){this._finder=null,this._dirEdgeList=new Bl,this._nodes=new Bl,this._rightMostCoord=null,this._env=null,this._finder=new ah};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 uh("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(rh.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(rh.RIGHT)>=1&&e.getDepth(rh.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},ch.prototype.computeDepths=function(t){var e=new Kl,n=new lh,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 al,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 sh;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(rh.LEFT,t.getDepth(rh.RIGHT)),e.setDepth(rh.RIGHT,t.getDepth(rh.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[Du]},ch.prototype.getClass=function(){return ch};var hh=function t(){var e=this;if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[rh.ON]=r}else if(arguments[0]instanceof t){var i=arguments[0];if(this.init(i.location.length),null!==i)for(var o=0;o<this.location.length;o++)e.location[o]=i.location[o]}}else if(3===arguments.length){var s=arguments[0],a=arguments[1],u=arguments[2];this.init(3),this.location[rh.ON]=s,this.location[rh.LEFT]=a,this.location[rh.RIGHT]=u}};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]!==Uu.NONE)return!1;return!0},hh.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===Uu.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[rh.ON]=this.location[rh.ON],e[rh.LEFT]=Uu.NONE,e[rh.RIGHT]=Uu.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===Uu.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[rh.LEFT];this.location[rh.LEFT]=this.location[rh.RIGHT],this.location[rh.RIGHT]=t},hh.prototype.toString=function(){var t=new Wu;return this.location.length>1&&t.append(Uu.toLocationSymbol(this.location[rh.LEFT])),t.append(Uu.toLocationSymbol(this.location[rh.ON])),this.location.length>1&&t.append(Uu.toLocationSymbol(this.location[rh.RIGHT])),t.toString()},hh.prototype.setLocations=function(t,e,n){this.location[rh.ON]=t,this.location[rh.LEFT]=e,this.location[rh.RIGHT]=n},hh.prototype.get=function(t){return t<this.location.length?this.location[t]:Uu.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]===Uu.NONE)return!0;return!1},hh.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(rh.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(Uu.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 ph=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(Uu.NONE),this.elt[1]=new hh(Uu.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],l=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new hh(Uu.NONE,Uu.NONE,Uu.NONE),this.elt[1]=new hh(Uu.NONE,Uu.NONE,Uu.NONE),this.elt[u].setLocations(l,c,h)}};ph.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},ph.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},ph.prototype.isNull=function(t){return this.elt[t].isNull()},ph.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)}},ph.prototype.isLine=function(t){return this.elt[t].isLine()},ph.prototype.merge=function(t){for(var e=this,n=0;n<2;n++)null===e.elt[n]&&null!==t.elt[n]?e.elt[n]=new hh(t.elt[n]):e.elt[n].merge(t.elt[n])},ph.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},ph.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(rh.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},ph.prototype.toString=function(){var t=new Wu;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()},ph.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()}},ph.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},ph.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(rh.ON,e)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},ph.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},ph.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},ph.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new hh(this.elt[t].location[0]))},ph.prototype.interfaces_=function(){return[]},ph.prototype.getClass=function(){return ph},ph.toLineLabel=function(t){for(var e=new ph(Uu.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var fh=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Bl,this._pts=new Bl,this._label=new ph(Uu.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Bl,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};fh.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=bl.isCCW(this._ring.getCoordinates())},fh.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},fh.prototype.computePoints=function(t){var e=this;this._startDe=t;var n=t,r=!0;do{if(null===n)throw new uh("Found null DirectedEdge");if(n.getEdgeRing()===e)throw new uh("Directed Edge visited twice during ring-building at "+n.getCoordinate());e._edges.add(n);var i=n.getLabel();yl.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(n.getEdge(),n.isForward(),r),r=!1,e.setEdgeRing(n,e),n=e.getNext(n)}while(n!==this._startDe)},fh.prototype.getLinearRing=function(){return this._ring},fh.prototype.getCoordinate=function(t){return this._pts.get(t)},fh.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var n=e.getNode().getEdges().getOutgoingDegree(t);n>t._maxNodeDegree&&(t._maxNodeDegree=n),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},fh.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])}},fh.prototype.isHole=function(){return this._isHole},fh.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},fh.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!bl.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},fh.prototype.addHole=function(t){this._holes.add(t)},fh.prototype.isShell=function(){return null===this._shell},fh.prototype.getLabel=function(){return this._label},fh.prototype.getEdges=function(){return this._edges},fh.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},fh.prototype.getShell=function(){return this._shell},fh.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,rh.RIGHT);if(r===Uu.NONE)return null;if(this._label.getLocation(n)===Uu.NONE)return this._label.setLocation(n,r),null}},fh.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},fh.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)},fh.prototype.interfaces_=function(){return[]},fh.prototype.getClass=function(){return fh};var 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.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}(fh),dh=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 Bl,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new gh(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}(fh),yh=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}};yh.prototype.setVisited=function(t){this._isVisited=t},yh.prototype.setInResult=function(t){this._isInResult=t},yh.prototype.isCovered=function(){return this._isCovered},yh.prototype.isCoveredSet=function(){return this._isCoveredSet},yh.prototype.setLabel=function(t){this._label=t},yh.prototype.getLabel=function(){return this._label},yh.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},yh.prototype.updateIM=function(t){yl.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},yh.prototype.isInResult=function(){return this._isInResult},yh.prototype.isVisited=function(){return this._isVisited},yh.prototype.interfaces_=function(){return[]},yh.prototype.getClass=function(){return yh};var vh=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 ph(0,Uu.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=Uu.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==Uu.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 ph(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof ph)for(var r=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(r,i),s=t._label.getLocation(i);s===Uu.NONE&&t._label.setLocation(i,o)}},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=Uu.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;if(e===Uu.BOUNDARY)n=Uu.INTERIOR;else n=Uu.BOUNDARY;this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yh),_h=function(){this.nodeMap=new ic,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 qu){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 vh){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 Bl,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===Uu.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(){},xh={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 Ru("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 qu&&arguments[1]instanceof qu){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new Ru("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}},xh.NE.get=function(){return 0},xh.NW.get=function(){return 1},xh.SW.get=function(){return 2},xh.SE.get=function(){return 3},Object.defineProperties(mh,xh);var Eh=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],i=null;this._edge=e,this.init(n,r),this._label=i}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this._edge=o,this.init(s,a),this._label=u}};Eh.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:bl.computeOrientation(t._p0,t._p1,this._p1)},Eh.prototype.getDy=function(){return this._dy},Eh.prototype.getCoordinate=function(){return this._p0},Eh.prototype.setNode=function(t){this._node=t},Eh.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)},Eh.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},Eh.prototype.getDirectedCoordinate=function(){return this._p1},Eh.prototype.getDx=function(){return this._dx},Eh.prototype.getLabel=function(){return this._label},Eh.prototype.getEdge=function(){return this._edge},Eh.prototype.getQuadrant=function(){return this._quadrant},Eh.prototype.getNode=function(){return this._node},Eh.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},Eh.prototype.computeLabel=function(t){},Eh.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),yl.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},Eh.prototype.interfaces_=function(){return[Du]},Eh.prototype.getClass=function(){return Eh};var bh=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 ph(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 uh("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,n=0;n<2;n++)t._label.isArea(n)&&t._label.getLocation(n,rh.LEFT)===Uu.INTERIOR&&t._label.getLocation(n,rh.RIGHT)===Uu.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[rh.LEFT]+"/"+this._depth[rh.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,Uu.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,Uu.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===rh.LEFT&&(r=-1);var i=rh.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===Uu.EXTERIOR&&e===Uu.INTERIOR?1:t===Uu.INTERIOR&&e===Uu.EXTERIOR?-1:0},e}(Eh),wh=function(){};wh.prototype.createNode=function(t){return new vh(t,null)},wh.prototype.interfaces_=function(){return[]},wh.prototype.getClass=function(){return wh};var Ih=function(){if(this._edges=new Bl,this._nodes=null,this._edgeEndList=new Bl,0===arguments.length)this._nodes=new _h(new wh);else if(1===arguments.length){var t=arguments[0];this._nodes=new _h(t)}};Ih.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)}},Ih.prototype.find=function(t){return this._nodes.find(t)},Ih.prototype.addNode=function(){if(arguments[0]instanceof vh){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof qu){var e=arguments[0];return this._nodes.addNode(e)}},Ih.prototype.getNodeIterator=function(){return this._nodes.iterator()},Ih.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},Ih.prototype.debugPrintln=function(t){ol.out.println(t)},Ih.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)===Uu.BOUNDARY},Ih.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},Ih.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&bl.computeOrientation(t,e,r)===bl.COLLINEAR&&mh.quadrant(t,e)===mh.quadrant(n,r)},Ih.prototype.getEdgeEnds=function(){return this._edgeEndList},Ih.prototype.debugPrint=function(t){ol.out.print(t)},Ih.prototype.getEdgeIterator=function(){return this._edges.iterator()},Ih.prototype.findEdgeInSameDirection=function(t,e){for(var n=this,r=0;r<this._edges.size();r++){var i=n._edges.get(r),o=i.getCoordinates();if(n.matchInSameDirection(t,e,o[0],o[1]))return i;if(n.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},Ih.prototype.insertEdge=function(t){this._edges.add(t)},Ih.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},Ih.prototype.addEdges=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();e._edges.add(r);var i=new bh(r,!0),o=new bh(r,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},Ih.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},Ih.prototype.getNodes=function(){return this._nodes.values()},Ih.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},Ih.prototype.interfaces_=function(){return[]},Ih.prototype.getClass=function(){return Ih},Ih.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var Nh=function(){this._geometryFactory=null,this._shellList=new Bl;var t=arguments[0];this._geometryFactory=t};Nh.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)}},Nh.prototype.computePolygons=function(t){for(var e=new Bl,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},Nh.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 uh("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},Nh.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new Bl,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},Nh.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},Nh.prototype.buildMaximalEdgeRings=function(t){for(var e=new Bl,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new dh(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},Nh.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},Nh.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Nh.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(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(r)&&bl.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},Nh.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 yl.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},Nh.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];Ih.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new Bl,o=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},Nh.prototype.interfaces_=function(){return[]},Nh.prototype.getClass=function(){return Nh};var Sh=function(){};Sh.prototype.getBounds=function(){},Sh.prototype.interfaces_=function(){return[]},Sh.prototype.getClass=function(){return Sh};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[Sh,Gu]},Ch.prototype.getClass=function(){return Ch};var Ph=function(){this._size=null,this._items=null,this._size=0,this._items=new Bl,this._items.add(null)};Ph.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},Ph.prototype.size=function(){return this._size},Ph.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);2*t<=this._size&&((n=2*t)!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)},Ph.prototype.clear=function(){this._size=0,this._items.clear()},Ph.prototype.isEmpty=function(){return 0===this._size},Ph.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)},Ph.prototype.interfaces_=function(){return[]},Ph.prototype.getClass=function(){return Ph};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 Oh=function(){if(this._childBoundables=new Bl,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Rh={serialVersionUID:{configurable:!0}};Oh.prototype.getLevel=function(){return this._level},Oh.prototype.size=function(){return this._childBoundables.size()},Oh.prototype.getChildBoundables=function(){return this._childBoundables},Oh.prototype.addChildBoundable=function(t){yl.isTrue(null===this._bounds),this._childBoundables.add(t)},Oh.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Oh.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Oh.prototype.interfaces_=function(){return[Sh,Gu]},Oh.prototype.getClass=function(){return Oh},Rh.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Oh,Rh);var Th=function(){};Th.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Th.min=function(t){return Th.sort(t),t.get(0)},Th.sort=function(t,e){var n=t.toArray();e?lc.sort(n,e):lc.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},Th.singletonList=function(t){var e=new Bl;return e.add(t),e};var Ah=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()};Ah.prototype.expandToQueue=function(t,e){var n=Ah.isComposite(this._boundable1),r=Ah.isComposite(this._boundable2);if(n&&r)return Ah.area(this._boundable1)>Ah.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 Ru("neither boundable is composite")},Ah.prototype.isLeaves=function(){return!(Ah.isComposite(this._boundable1)||Ah.isComposite(this._boundable2))},Ah.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Ah.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new Ah(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},Ah.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},Ah.prototype.getDistance=function(){return this._distance},Ah.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Ah.prototype.interfaces_=function(){return[Du]},Ah.prototype.getClass=function(){return Ah},Ah.area=function(t){return t.getBounds().getArea()},Ah.isComposite=function(t){return t instanceof Oh};var Dh=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new Bl,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments[0];yl.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Fh={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Dh.prototype.getNodeCapacity=function(){return this._nodeCapacity},Dh.prototype.lastNode=function(t){return t.get(t.size()-1)},Dh.prototype.size=function(){var t=this;if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Oh?n+=t.size(i):i instanceof Ch&&(n+=1)}return n}},Dh.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)},Dh.prototype.itemsTree=function(){var t=this;if(0===arguments.length){this.build();var e=this.itemsTree(this._root);return null===e?new Bl:e}if(1===arguments.length){for(var n=arguments[0],r=new Bl,i=n.getChildBoundables().iterator();i.hasNext();){var o=i.next();if(o instanceof Oh){var s=t.itemsTree(o);null!==s&&r.add(s)}else o instanceof Ch?r.add(o.getItem()):yl.shouldNeverReachHere()}return r.size()<=0?null:r}},Dh.prototype.insert=function(t,e){yl.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ch(t,e))},Dh.prototype.boundablesAtLevel=function(){var t=this;if(1===arguments.length){var e=arguments[0],n=new Bl;return this.boundablesAtLevel(e,this._root,n),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(yl.isTrue(r>-2),i.getLevel()===r)return o.add(i),null;for(var s=i.getChildBoundables().iterator();s.hasNext();){var a=s.next();a instanceof Oh?t.boundablesAtLevel(r,a,o):(yl.isTrue(a instanceof Ch),-1===r&&o.add(a))}return null}},Dh.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var n=new Bl;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}if(2===arguments.length){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(3===arguments.length)if(Xu(arguments[2],Mh)&&arguments[0]instanceof Object&&arguments[1]instanceof Oh)for(var o=arguments[0],s=arguments[1],a=arguments[2],u=s.getChildBoundables(),l=0;l<u.size();l++){var c=u.get(l);t.getIntersectsOp().intersects(c.getBounds(),o)&&(c instanceof Oh?t.query(o,c,a):c instanceof Ch?a.visitItem(c.getItem()):yl.shouldNeverReachHere())}else if(Xu(arguments[2],Gl)&&arguments[0]instanceof Object&&arguments[1]instanceof Oh)for(var h=arguments[0],p=arguments[1],f=arguments[2],g=p.getChildBoundables(),d=0;d<g.size();d++){var y=g.get(d);t.getIntersectsOp().intersects(y.getBounds(),h)&&(y instanceof Oh?t.query(h,y,f):y instanceof Ch?f.add(y.getItem()):yl.shouldNeverReachHere())}},Dh.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},Dh.prototype.getRoot=function(){return this.build(),this._root},Dh.prototype.remove=function(){var t=this;if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.remove(e,this._root,n)}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=this.removeItem(i,o);if(s)return!0;for(var a=null,u=i.getChildBoundables().iterator();u.hasNext();){var l=u.next();if(t.getIntersectsOp().intersects(l.getBounds(),r)&&l instanceof Oh&&(s=t.remove(r,l,o))){a=l;break}}return null!==a&&a.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(a),s}},Dh.prototype.createHigherLevels=function(t,e){yl.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},Dh.prototype.depth=function(){var t=this;if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof Oh){var o=t.depth(i);o>n&&(n=o)}}return n+1}},Dh.prototype.createParentBoundables=function(t,e){var n=this;yl.isTrue(!t.isEmpty());var r=new Bl;r.add(this.createNode(e));var i=new Bl(t);Th.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(s)}return r},Dh.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Dh.prototype.interfaces_=function(){return[Gu]},Dh.prototype.getClass=function(){return Dh},Dh.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Fh.IntersectsOp.get=function(){return kh},Fh.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},Fh.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Dh,Fh);var kh=function(){},Gh=function(){};Gh.prototype.distance=function(t,e){},Gh.prototype.interfaces_=function(){return[]},Gh.prototype.getClass=function(){return Gh};var qh=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),e.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){yl.isTrue(t.length>0);for(var n=new Bl,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 Bl;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(Xu(arguments[2],Mh)&&arguments[0]instanceof Object&&arguments[1]instanceof Oh){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(Xu(arguments[2],Gl)&&arguments[0]instanceof Object&&arguments[1]instanceof Oh){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},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){yl.isTrue(!t.isEmpty());var r=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new Bl(t);Th.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(Xu(arguments[0],Gh)){var t=arguments[0],n=new Ah(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(n)}if(arguments[0]instanceof Ah){var r=arguments[0];return this.nearestNeighbour(r,Tu.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&Xu(arguments[1],Gh)){var i=arguments[0],o=arguments[1],s=new Ah(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof Ah&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=u,c=null,h=new Ph;for(h.add(a);!h.isEmpty()&&l>0;){var p=h.poll(),f=p.getDistance();if(f>=l)break;p.isLeaves()?(l=f,c=p):p.expandToQueue(h,l)}return[c.getBoundable(0).getItem(),c.getBoundable(1).getItem()]}}else if(3===arguments.length){var g=arguments[0],d=arguments[1],y=arguments[2],v=new Ch(g,d),_=new Ah(this.getRoot(),v,y);return this.nearestNeighbour(_)[0]}},e.prototype.interfaces_=function(){return[Lh,Gu]},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[ku]},compare:function(n,r){return t.compareDoubles(e.centreX(n.getBounds()),e.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[ku]},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}(Dh),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 al(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Oh),zh=function(){};zh.prototype.interfaces_=function(){return[]},zh.prototype.getClass=function(){return zh},zh.relativeSign=function(t,e){return t<e?-1:t>e?1:0},zh.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=zh.relativeSign(e.x,n.x),i=zh.relativeSign(e.y,n.y);switch(t){case 0:return zh.compareValue(r,i);case 1:return zh.compareValue(i,r);case 2:return zh.compareValue(i,-r);case 3:return zh.compareValue(-r,i);case 4:return zh.compareValue(-r,-i);case 5:return zh.compareValue(-i,-r);case 6:return zh.compareValue(-i,r);case 7:return zh.compareValue(r,-i)}return yl.shouldNeverReachHere("invalid octant value"),0},zh.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var jh=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 qu(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};jh.prototype.getCoordinate=function(){return this.coord},jh.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},jh.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:zh.compare(this._segmentOctant,this.coord,e.coord)},jh.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},jh.prototype.isInterior=function(){return this._isInterior},jh.prototype.interfaces_=function(){return[Du]},jh.prototype.getClass=function(){return jh};var Uh=function(){this._nodeMap=new ic,this._edge=null;var t=arguments[0];this._edge=t};Uh.prototype.getSplitCoordinates=function(){var t=new jl;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()},Uh.prototype.addCollapsedNodes=function(){var t=new Bl;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)}},Uh.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Uh.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 Ju(e+1))}},Uh.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new qu(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new qu(e.coord))},Uh.prototype.iterator=function(){return this._nodeMap.values().iterator()},Uh.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}},Uh.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)},Uh.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 Ju(e[0])),r=i}},Uh.prototype.getEdge=function(){return this._edge},Uh.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Uh.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 qu(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new qu(e.coord)),new Hh(o,this._edge.getData())},Uh.prototype.add=function(t,e){var n=new jh(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(yl.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},Uh.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new gl("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 gl("bad split edge end point at "+i)},Uh.prototype.interfaces_=function(){return[]},Uh.prototype.getClass=function(){return Uh};var Vh=function(){};Vh.prototype.interfaces_=function(){return[]},Vh.prototype.getClass=function(){return Vh},Vh.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 Ru("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 qu&&arguments[1]instanceof qu){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new Ru("Cannot compute the octant for two identical points "+i);return Vh.octant(s,a)}};var Xh=function(){};Xh.prototype.getCoordinates=function(){},Xh.prototype.size=function(){},Xh.prototype.getCoordinate=function(t){},Xh.prototype.isClosed=function(){},Xh.prototype.setData=function(t){},Xh.prototype.getData=function(){},Xh.prototype.interfaces_=function(){return[]},Xh.prototype.getClass=function(){return Xh};var Yh=function(){};Yh.prototype.addIntersection=function(t,e){},Yh.prototype.interfaces_=function(){return[Xh]},Yh.prototype.getClass=function(){return Yh};var Hh=function(){this._nodeList=new Uh(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Hh.prototype.getCoordinates=function(){return this._pts},Hh.prototype.size=function(){return this._pts.length},Hh.prototype.getCoordinate=function(t){return this._pts[t]},Hh.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Hh.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Hh.prototype.setData=function(t){this._data=t},Hh.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Vh.octant(t,e)},Hh.prototype.getData=function(){return this._data},Hh.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 qu(n.getIntersection(i));this.addIntersection(o,r)}},Hh.prototype.toString=function(){return fl.toLineString(new Bc(this._pts))},Hh.prototype.getNodeList=function(){return this._nodeList},Hh.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)},Hh.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},Hh.prototype.interfaces_=function(){return[Yh]},Hh.prototype.getClass=function(){return Hh},Hh.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new Bl;return Hh.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[0],r=arguments[1],i=n.iterator();i.hasNext();){var o=i.next();o.getNodeList().addSplitEdges(r)}};var Wh=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new qu,this.p1=new qu;else if(1===arguments.length){var t=arguments[0];this.p0=new qu(t.p0),this.p1=new qu(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 qu(e,n),this.p1=new qu(r,i)}},Jh={serialVersionUID:{configurable:!0}};Wh.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Wh.prototype.orientationIndex=function(){if(arguments[0]instanceof Wh){var t=arguments[0],e=bl.orientationIndex(this.p0,this.p1,t.p0),n=bl.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 qu){var r=arguments[0];return bl.orientationIndex(this.p0,this.p1,r)}},Wh.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Wh.prototype.isVertical=function(){return this.p0.x===this.p1.x},Wh.prototype.equals=function(t){if(!(t instanceof Wh))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Wh.prototype.intersection=function(t){var e=new ml;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Wh.prototype.project=function(){if(arguments[0]instanceof qu){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new qu(t);var e=this.projectionFactor(t),n=new qu;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 Wh){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 Wh(s,a)}},Wh.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Wh.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Wh.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Wh.prototype.distancePerpendicular=function(t){return bl.distancePointLinePerpendicular(t,this.p0,this.p1)},Wh.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Wh.prototype.midPoint=function(){return Wh.midPoint(this.p0,this.p1)},Wh.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?Tu.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},Wh.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=Tu.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},Wh.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},Wh.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Wh.prototype.getLength=function(){return this.p0.distance(this.p1)},Wh.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},Wh.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Wh.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)},Wh.prototype.lineIntersection=function(t){try{return sl.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof il))throw t}return null},Wh.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Wh.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 qu(n-u,r+a)},Wh.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}},Wh.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Tu.isNaN(e))&&(e=1),e},Wh.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Wh.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Wh.prototype.distance=function(){if(arguments[0]instanceof Wh){var t=arguments[0];return bl.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof qu){var e=arguments[0];return bl.distancePointLine(e,this.p0,this.p1)}},Wh.prototype.pointAlong=function(t){var e=new qu;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},Wh.prototype.hashCode=function(){var t=Tu.doubleToLongBits(this.p0.x);t^=31*Tu.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=Tu.doubleToLongBits(this.p1.x);return n^=31*Tu.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},Wh.prototype.interfaces_=function(){return[Du,Gu]},Wh.prototype.getClass=function(){return Wh},Wh.midPoint=function(t,e){return new qu((t.x+e.x)/2,(t.y+e.y)/2)},Jh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Wh,Jh);var Zh=function(){this.tempEnv1=new al,this.tempEnv2=new al,this._overlapSeg1=new Wh,this._overlapSeg2=new Wh};Zh.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)}},Zh.prototype.interfaces_=function(){return[]},Zh.prototype.getClass=function(){return Zh};var Kh=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};Kh.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Kh.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)},Kh.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},Kh.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Kh.prototype.setId=function(t){this._id=t},Kh.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Kh.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new al(t,e)}return this._env},Kh.prototype.getEndIndex=function(){return this._end},Kh.prototype.getStartIndex=function(){return this._start},Kh.prototype.getContext=function(){return this._context},Kh.prototype.getId=function(){return this._id},Kh.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],l=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,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((r+i)/2);t<c&&(r<h&&this.computeOverlapsInternal(t,c,n,r,h,o),h<i&&this.computeOverlapsInternal(t,c,n,h,i,o)),c<e&&(r<h&&this.computeOverlapsInternal(c,e,n,r,h,o),h<i&&this.computeOverlapsInternal(c,e,n,h,i,o))},Kh.prototype.interfaces_=function(){return[]},Kh.prototype.getClass=function(){return Kh};var Qh=function(){};Qh.prototype.interfaces_=function(){return[]},Qh.prototype.getClass=function(){return Qh},Qh.getChainStartIndices=function(t){var e=0,n=new Bl;n.add(new Ju(e));do{var r=Qh.findChainEnd(t,e);n.add(new Ju(r)),e=r}while(e<t.length-1);return Qh.toIntArray(n)},Qh.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},Qh.getChains=function(){if(1===arguments.length){var t=arguments[0];return Qh.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],r=new Bl,i=Qh.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new Kh(e,i[o],i[o+1],n);r.add(s)}return r}},Qh.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 $h=function(){};$h.prototype.computeNodes=function(t){},$h.prototype.getNodedSubstrings=function(){},$h.prototype.interfaces_=function(){return[]},$h.prototype.getClass=function(){return $h};var tp=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};tp.prototype.setSegmentIntersector=function(t){this._segInt=t},tp.prototype.interfaces_=function(){return[$h]},tp.prototype.getClass=function(){return tp};var ep=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new Bl,this._index=new qh,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return Hh.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,n=Qh.getChains(t.getCoordinates(),t).iterator();n.hasNext();){var r=n.next();r.setId(e._idCounter++),e._index.insert(r.getEnvelope(),r),e._monoChains.add(r)}},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=this,e=new np(this._segInt),n=this._monoChains.iterator();n.hasNext();)for(var r=n.next(),i=t._index.query(r.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>r.getId()&&(r.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return np},Object.defineProperties(e,n),e}(tp),np=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}(Zh),rp=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)}},ip={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}};rp.prototype.getEndCapStyle=function(){return this._endCapStyle},rp.prototype.isSingleSided=function(){return this._isSingleSided},rp.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=rp.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=rp.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==rp.JOIN_ROUND&&(this._quadrantSegments=rp.DEFAULT_QUADRANT_SEGMENTS)},rp.prototype.getJoinStyle=function(){return this._joinStyle},rp.prototype.setJoinStyle=function(t){this._joinStyle=t},rp.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},rp.prototype.getSimplifyFactor=function(){return this._simplifyFactor},rp.prototype.getQuadrantSegments=function(){return this._quadrantSegments},rp.prototype.setEndCapStyle=function(t){this._endCapStyle=t},rp.prototype.getMitreLimit=function(){return this._mitreLimit},rp.prototype.setMitreLimit=function(t){this._mitreLimit=t},rp.prototype.setSingleSided=function(t){this._isSingleSided=t},rp.prototype.interfaces_=function(){return[]},rp.prototype.getClass=function(){return rp},rp.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},ip.CAP_ROUND.get=function(){return 1},ip.CAP_FLAT.get=function(){return 2},ip.CAP_SQUARE.get=function(){return 3},ip.JOIN_ROUND.get=function(){return 1},ip.JOIN_MITRE.get=function(){return 2},ip.JOIN_BEVEL.get=function(){return 3},ip.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},ip.DEFAULT_MITRE_LIMIT.get=function(){return 5},ip.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(rp,ip);var op=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=bl.COUNTERCLOCKWISE,this._inputLine=t||null},sp={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};op.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)},op.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r<this._inputLine.length;){var o=!1;t.isDeletable(e,n,r,t._distanceTol)&&(t._isDeleted[n]=op.DELETE,o=!0,i=!0),e=o?r:n,n=t.findNextNonDeletedIndex(e),r=t.findNextNonDeletedIndex(n)}return i},op.prototype.isShallowConcavity=function(t,e,n,r){return bl.computeOrientation(t,e,n)===this._angleOrientation&&bl.distancePointLine(e,t,n)<r},op.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/op.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},op.prototype.isConcave=function(t,e,n){return bl.computeOrientation(t,e,n)===this._angleOrientation},op.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=bl.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},op.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===op.DELETE;)e++;return e},op.prototype.isShallow=function(t,e,n,r){return bl.distancePointLine(e,t,n)<r},op.prototype.collapseLine=function(){for(var t=new jl,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==op.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},op.prototype.interfaces_=function(){return[]},op.prototype.getClass=function(){return op},op.simplify=function(t,e){return new op(t).simplify(e)},sp.INIT.get=function(){return 0},sp.DELETE.get=function(){return 1},sp.KEEP.get=function(){return 1},sp.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(op,sp);var ap=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Bl},up={COORDINATE_ARRAY_TYPE:{configurable:!0}};ap.prototype.getCoordinates=function(){return this._ptList.toArray(ap.COORDINATE_ARRAY_TYPE)},ap.prototype.setPrecisionModel=function(t){this._precisionModel=t},ap.prototype.addPt=function(t){var e=new qu(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},ap.prototype.revere=function(){},ap.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])},ap.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},ap.prototype.toString=function(){return(new Jc).createLineString(this.getCoordinates()).toString()},ap.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new qu(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},ap.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},ap.prototype.interfaces_=function(){return[]},ap.prototype.getClass=function(){return ap},up.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(ap,up);var lp=function(){},cp={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};lp.prototype.interfaces_=function(){return[]},lp.prototype.getClass=function(){return lp},lp.toDegrees=function(t){return 180*t/Math.PI},lp.normalize=function(t){for(;t>Math.PI;)t-=lp.PI_TIMES_2;for(;t<=-Math.PI;)t+=lp.PI_TIMES_2;return t},lp.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)}},lp.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},lp.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},lp.interiorAngle=function(t,e,n){var r=lp.angle(e,t),i=lp.angle(e,n);return Math.abs(i-r)},lp.normalizePositive=function(t){if(t<0){for(;t<0;)t+=lp.PI_TIMES_2;t>=lp.PI_TIMES_2&&(t=0)}else{for(;t>=lp.PI_TIMES_2;)t-=lp.PI_TIMES_2;t<0&&(t=0)}return t},lp.angleBetween=function(t,e,n){var r=lp.angle(e,t),i=lp.angle(e,n);return lp.diff(r,i)},lp.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},lp.toRadians=function(t){return t*Math.PI/180},lp.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?lp.COUNTERCLOCKWISE:n<0?lp.CLOCKWISE:lp.NONE},lp.angleBetweenOriented=function(t,e,n){var r=lp.angle(e,t),i=lp.angle(e,n)-r;return i<=-Math.PI?i+lp.PI_TIMES_2:i>Math.PI?i-lp.PI_TIMES_2:i},cp.PI_TIMES_2.get=function(){return 2*Math.PI},cp.PI_OVER_2.get=function(){return Math.PI/2},cp.PI_OVER_4.get=function(){return Math.PI/4},cp.COUNTERCLOCKWISE.get=function(){return bl.COUNTERCLOCKWISE},cp.CLOCKWISE.get=function(){return bl.CLOCKWISE},cp.NONE.get=function(){return bl.COLLINEAR},Object.defineProperties(lp,cp);var hp=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 Wh,this._seg1=new Wh,this._offset0=new Wh,this._offset1=new Wh,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 ml,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===rp.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},pp={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}};hp.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=bl.computeOrientation(this._s0,this._s1,this._s2),r=n===bl.CLOCKWISE&&this._side===rh.LEFT||n===bl.COUNTERCLOCKWISE&&this._side===rh.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},hp.prototype.addLineEndCap=function(t,e){var n=new Wh(t,e),r=new Wh;this.computeOffsetSegment(n,rh.LEFT,this._distance,r);var i=new Wh;this.computeOffsetSegment(n,rh.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 rp.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,bl.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case rp.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case rp.CAP_SQUARE:var u=new qu;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new qu(r.p1.x+u.x,r.p1.y+u.y),c=new qu(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},hp.prototype.getCoordinates=function(){return this._segList.getCoordinates()},hp.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=sl.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 il))throw t;o=new qu(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},hp.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,l=n.y-t.y,c=Math.atan2(l,u);r===bl.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,r,i),this._segList.addPt(n)},hp.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*hp.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===rp.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===rp.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))},hp.prototype.createSquare=function(t){this._segList.addPt(new qu(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new qu(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new qu(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new qu(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},hp.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},hp.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},hp.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},hp.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)},hp.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=lp.angle(i,this._seg0.p0),s=lp.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=lp.normalize(o+s),u=lp.normalize(a+Math.PI),l=r*n,c=n-l*Math.abs(Math.sin(s)),h=i.x+l*Math.cos(u),p=i.y+l*Math.sin(u),f=new qu(h,p),g=new Wh(i,f),d=g.pointAlongOffset(1,c),y=g.pointAlongOffset(1,-c);this._side===rh.LEFT?(this._segList.addPt(d),this._segList.addPt(y)):(this._segList.addPt(y),this._segList.addPt(d))},hp.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===rh.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,l=i*n*s/a;r.p0.x=t.p0.x-l,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-l,r.p1.y=t.p1.y+u},hp.prototype.addFilletArc=function(t,e,n,r,i){var o=r===bl.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,l=0,c=new qu;l<s;){var h=e+o*l;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),l+=u}},hp.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*hp.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 qu((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 qu((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)}},hp.prototype.createCircle=function(t){var e=new qu(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},hp.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},hp.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ap,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*hp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},hp.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===rp.JOIN_BEVEL||this._bufParams.getJoinStyle()===rp.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,bl.CLOCKWISE,this._distance))},hp.prototype.closeRing=function(){this._segList.closeRing()},hp.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},hp.prototype.interfaces_=function(){return[]},hp.prototype.getClass=function(){return hp},pp.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},pp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},pp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},pp.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(hp,pp);var fp=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};fp.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&&Ul.reverse(o),o},fp.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=op.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],rh.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=op.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],rh.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},fp.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===rh.RIGHT&&(r=-r);var i=op.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()},fp.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=op.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],rh.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=op.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],rh.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},fp.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case rp.CAP_ROUND:e.createCircle(t);break;case rp.CAP_SQUARE:e.createSquare(t)}},fp.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()},fp.prototype.getBufferParameters=function(){return this._bufParams},fp.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},fp.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return fp.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},fp.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=op.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],rh.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=op.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],rh.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},fp.prototype.getSegGen=function(t){return new hp(this._precisionModel,this._bufParams,t)},fp.prototype.interfaces_=function(){return[]},fp.prototype.getClass=function(){return fp},fp.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new qu(t[n]);return e};var gp=function(){this._subgraphs=null,this._seg=new Wh,this._cga=new bl;var t=arguments[0];this._subgraphs=t},dp={DepthSegment:{configurable:!0}};gp.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=new Bl,r=this._subgraphs.iterator();r.hasNext();){var i=r.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}if(3===arguments.length)if(Xu(arguments[2],Gl)&&arguments[0]instanceof qu&&arguments[1]instanceof bh)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),c=0;c<l.length-1;c++){t._seg.p0=l[c],t._seg.p1=l[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse();var h=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(h<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||bl.computeOrientation(t._seg.p0,t._seg.p1,s)===bl.RIGHT)){var p=a.getDepth(rh.LEFT);t._seg.p0.equals(l[c])||(p=a.getDepth(rh.RIGHT));var f=new yp(t._seg,p);u.add(f)}}else if(Xu(arguments[2],Gl)&&arguments[0]instanceof qu&&Xu(arguments[1],Gl))for(var g=arguments[0],d=arguments[1],y=arguments[2],v=d.iterator();v.hasNext();){var _=v.next();_.isForward()&&t.findStabbedSegments(g,_,y)}},gp.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Th.min(e)._leftDepth},gp.prototype.interfaces_=function(){return[]},gp.prototype.getClass=function(){return gp},dp.DepthSegment.get=function(){return yp},Object.defineProperties(gp,dp);var yp=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Wh(t),this._leftDepth=e};yp.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)},yp.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},yp.prototype.toString=function(){return this._upwardSeg.toString()},yp.prototype.interfaces_=function(){return[Du]},yp.prototype.getClass=function(){return yp};var vp=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};vp.prototype.area=function(){return vp.area(this.p0,this.p1,this.p2)},vp.prototype.signedArea=function(){return vp.signedArea(this.p0,this.p1,this.p2)},vp.prototype.interpolateZ=function(t){if(null===t)throw new Ru("Supplied point is null.");return vp.interpolateZ(t,this.p0,this.p1,this.p2)},vp.prototype.longestSideLength=function(){return vp.longestSideLength(this.p0,this.p1,this.p2)},vp.prototype.isAcute=function(){return vp.isAcute(this.p0,this.p1,this.p2)},vp.prototype.circumcentre=function(){return vp.circumcentre(this.p0,this.p1,this.p2)},vp.prototype.area3D=function(){return vp.area3D(this.p0,this.p1,this.p2)},vp.prototype.centroid=function(){return vp.centroid(this.p0,this.p1,this.p2)},vp.prototype.inCentre=function(){return vp.inCentre(this.p0,this.p1,this.p2)},vp.prototype.interfaces_=function(){return[]},vp.prototype.getClass=function(){return vp},vp.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)},vp.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},vp.det=function(t,e,n,r){return t*r-e*n},vp.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,l=r.y-o,c=s*l-a*u,h=t.x-i,p=t.y-o,f=(l*h-a*p)/c,g=(-u*h+s*p)/c;return e.z+f*(n.z-e.z)+g*(r.z-e.z)},vp.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},vp.isAcute=function(t,e,n){return!!lp.isAcute(t,e,n)&&!!lp.isAcute(e,n,t)&&!!lp.isAcute(n,t,e)},vp.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,l=2*vp.det(o,s,a,u),c=vp.det(s,o*o+s*s,u,a*a+u*u),h=vp.det(o,o*o+s*s,a,a*a+u*u);return new qu(r-c/l,i+h/l)},vp.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new sl(t.x+n/2,t.y+r/2,1),o=new sl(t.x-r+n/2,t.y+n+r/2,1);return new sl(i,o)},vp.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 qu(t.x+i*o,t.y+i*s)},vp.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,l=i*u-o*a,c=o*s-r*u,h=r*a-i*s,p=l*l+c*c+h*h;return Math.sqrt(p)/2},vp.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new qu(r,i)},vp.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 qu(a,u)};var _p=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Bl;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};_p.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Uu.EXTERIOR,Uu.INTERIOR)},_p.prototype.addPolygon=function(t){var e=this,n=this._distance,r=rh.LEFT;this._distance<0&&(n=-this._distance,r=rh.RIGHT);var i=t.getExteriorRing(),o=Ul.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,n,r,Uu.EXTERIOR,Uu.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=Ul.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,n,rh.opposite(r),Uu.INTERIOR,Uu.EXTERIOR)}},_p.prototype.isTriangleErodedCompletely=function(t,e){var n=new vp(t[0],t[1],t[2]),r=n.inCentre();return bl.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},_p.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=Ul.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Uu.EXTERIOR,Uu.INTERIOR)},_p.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new Hh(t,new ph(0,Uu.BOUNDARY,e,n));this._curveList.add(r)},_p.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},_p.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<Tc.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=Tc.MINIMUM_VALID_SIZE&&bl.isCCW(t)&&(o=i,s=r,n=rh.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},_p.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Oc?this.addPolygon(t):t instanceof Cc?this.addLineString(t):t instanceof Mc?this.addPoint(t):(t instanceof Rc||t instanceof dc||t instanceof Ac||t instanceof gc)&&this.addCollection(t)},_p.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},_p.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},_p.prototype.interfaces_=function(){return[]},_p.prototype.getClass=function(){return _p};var mp=function(){};mp.prototype.locate=function(t){},mp.prototype.interfaces_=function(){return[]},mp.prototype.getClass=function(){return mp};var xp=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()};xp.prototype.next=function(){if(this._atStart)return this._atStart=!1,xp.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 ql;var t=this._parent.getGeometryN(this._index++);return t instanceof gc?(this._subcollectionIterator=new xp(t),this._subcollectionIterator.next()):t},xp.prototype.remove=function(){throw new Error(this.getClass().getName())},xp.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)},xp.prototype.interfaces_=function(){return[kl]},xp.prototype.getClass=function(){return xp},xp.isAtomic=function(t){return!(t instanceof gc)};var Ep=function(){this._geom=null;var t=arguments[0];this._geom=t};Ep.prototype.locate=function(t){return Ep.locate(t,this._geom)},Ep.prototype.interfaces_=function(){return[mp]},Ep.prototype.getClass=function(){return Ep},Ep.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&bl.isPointInRing(t,e.getCoordinates())},Ep.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Ep.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(Ep.isPointInRing(t,i))return!1}return!0},Ep.containsPoint=function(t,e){if(e instanceof Oc)return Ep.containsPointInPolygon(t,e);if(e instanceof gc)for(var n=new xp(e);n.hasNext();){var r=n.next();if(r!==e&&Ep.containsPoint(t,r))return!0}return!1},Ep.locate=function(t,e){return e.isEmpty()?Uu.EXTERIOR:Ep.containsPoint(t,e)?Uu.INTERIOR:Uu.EXTERIOR};var bp=function(){this._edgeMap=new ic,this._edgeList=null,this._ptInAreaLocation=[Uu.NONE,Uu.NONE]};bp.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)},bp.prototype.propagateSideLabels=function(t){for(var e=Uu.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,rh.LEFT)!==Uu.NONE&&(e=r.getLocation(t,rh.LEFT))}if(e===Uu.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,rh.ON)===Uu.NONE&&a.setLocation(t,rh.ON,i),a.isArea(t)){var u=a.getLocation(t,rh.LEFT),l=a.getLocation(t,rh.RIGHT);if(l!==Uu.NONE){if(l!==i)throw new uh("side location conflict",s.getCoordinate());u===Uu.NONE&&yl.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else yl.isTrue(a.getLocation(t,rh.LEFT)===Uu.NONE,"found single null side"),a.setLocation(t,rh.RIGHT,i),a.setLocation(t,rh.LEFT,i)}}},bp.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},bp.prototype.print=function(t){ol.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},bp.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},bp.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,rh.LEFT);yl.isTrue(r!==Uu.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();yl.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,rh.LEFT),u=s.getLocation(t,rh.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},bp.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},bp.prototype.iterator=function(){return this.getEdges().iterator()},bp.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new Bl(this._edgeMap.values())),this._edgeList},bp.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===Uu.NONE&&(this._ptInAreaLocation[t]=Ep.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},bp.prototype.toString=function(){var t=new Wu;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()},bp.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},bp.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)===Uu.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 l=Uu.NONE;if(e[u])l=Uu.EXTERIOR;else{var c=s.getCoordinate();l=this.getLocation(u,c,t)}a.setAllLocationsIfNull(u,l)}},bp.prototype.getDegree=function(){return this._edgeMap.size()},bp.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},bp.prototype.interfaces_=function(){return[]},bp.prototype.getClass=function(){return bp};var wp=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(){var t=this;this.getResultAreaEdges();for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),r){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;n=s,r=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;n.setNext(o),r=t._SCANNING_FOR_INCOMING}}if(r===this._LINKING_TO_OUTGOING){if(null===e)throw new uh("no outgoing dirEdge found",this.getCoordinate());yl.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),n.setNext(e)}},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:(yl.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},e.prototype.print=function(t){ol.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 Bl;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(){var t=this;if(1===arguments.length){var e=arguments[0],n=this.findIndex(e),r=e.getDepth(rh.LEFT),i=e.getDepth(rh.RIGHT),o=this.computeDepths(n+1,this._edgeList.size(),r),s=this.computeDepths(0,n,o);if(s!==i)throw new uh("depth mismatch at "+e.getCoordinate())}else if(3===arguments.length){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=l,h=a;h<u;h++){var p=t._edgeList.get(h);p.setEdgeDepths(rh.RIGHT,c),c=p.getDepth(rh.LEFT)}return c}},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=this,n=null,r=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===n&&s.getEdgeRing()===t&&(n=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;r=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;r.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(yl.isTrue(null!==n,"found null for first outgoing dirEdge"),yl.isTrue(n.getEdgeRing()===t,"unable to link last incoming dirEdge"),r.setNextMin(n))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){var n=e.next();n.isInResult()&&t++}return t}if(1===arguments.length){for(var r=arguments[0],i=0,o=this.iterator();o.hasNext();){var s=o.next();s.getEdgeRing()===r&&i++}return i}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=Uu.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=Uu.INTERIOR;break}if(r.isInResult()){t=Uu.EXTERIOR;break}}}if(t===Uu.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===Uu.INTERIOR):(s.isInResult()&&(i=Uu.EXTERIOR),a.isInResult()&&(i=Uu.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new ph(Uu.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!==Uu.INTERIOR&&o!==Uu.BOUNDARY||this._label.setLocation(i,Uu.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(bp),Ip=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 vh(t,new wp)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wh),Np=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Np.prototype.compareTo=function(t){var e=t;return Np.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Np.prototype.interfaces_=function(){return[Du]},Np.prototype.getClass=function(){return Np},Np.orientation=function(t){return 1===Ul.increasingDirection(t)},Np.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,l=r?0:n.length-1;;){var c=t[u].compareTo(n[l]);if(0!==c)return c;var h=(u+=i)===s,p=(l+=o)===a;if(h&&!p)return-1;if(!h&&p)return 1;if(h&&p)return 0}};var Sp=function(){this._edges=new Bl,this._ocaMap=new ic};Sp.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(") ")},Sp.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Sp.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Sp.prototype.iterator=function(){return this._edges.iterator()},Sp.prototype.getEdges=function(){return this._edges},Sp.prototype.get=function(t){return this._edges.get(t)},Sp.prototype.findEqualEdge=function(t){var e=new Np(t.getCoordinates());return this._ocaMap.get(e)},Sp.prototype.add=function(t){this._edges.add(t);var e=new Np(t.getCoordinates());this._ocaMap.put(e,t)},Sp.prototype.interfaces_=function(){return[]},Sp.prototype.getClass=function(){return Sp};var Cp=function(){};Cp.prototype.processIntersections=function(t,e,n,r){},Cp.prototype.isDone=function(){},Cp.prototype.interfaces_=function(){return[]},Cp.prototype.getClass=function(){return Cp};var Pp=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};Pp.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Pp.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},Pp.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Pp.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Pp.prototype.getLineIntersector=function(){return this._li},Pp.prototype.hasProperIntersection=function(){return this._hasProper},Pp.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)))},Pp.prototype.hasIntersection=function(){return this._hasIntersection},Pp.prototype.isDone=function(){return!1},Pp.prototype.hasInteriorIntersection=function(){return this._hasInterior},Pp.prototype.interfaces_=function(){return[Cp]},Pp.prototype.getClass=function(){return Pp},Pp.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Mp=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new qu(t),this.segmentIndex=e,this.dist=n};Mp.prototype.getSegmentIndex=function(){return this.segmentIndex},Mp.prototype.getCoordinate=function(){return this.coord},Mp.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Mp.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Mp.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Mp.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Mp.prototype.getDistance=function(){return this.dist},Mp.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Mp.prototype.interfaces_=function(){return[Du]},Mp.prototype.getClass=function(){return Mp};var Lp=function(){this._nodeMap=new ic,this.edge=null;var t=arguments[0];this.edge=t};Lp.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Lp.prototype.iterator=function(){return this._nodeMap.values().iterator()},Lp.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}},Lp.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)},Lp.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 qu(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 Dp(o,new ph(this.edge._label))},Lp.prototype.add=function(t,e,n){var r=new Mp(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},Lp.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Lp.prototype.interfaces_=function(){return[]},Lp.prototype.getClass=function(){return Lp};var Op=function(){};Op.prototype.getChainStartIndices=function(t){var e=0,n=new Bl;n.add(new Ju(e));do{var r=this.findChainEnd(t,e);n.add(new Ju(r)),e=r}while(e<t.length-1);return Op.toIntArray(n)},Op.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},Op.prototype.interfaces_=function(){return[]},Op.prototype.getClass=function(){return Op},Op.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 Rp=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new al,this.env2=new al;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Op;this.startIndex=e.getChainStartIndices(this.pts)};Rp.prototype.getCoordinates=function(){return this.pts},Rp.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},Rp.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},Rp.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],l=arguments[5],c=this.pts[i],h=this.pts[o],p=s.pts[a],f=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,h),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,l),d<u&&this.computeIntersectsForChain(i,g,s,d,u,l)),g<o&&(a<d&&this.computeIntersectsForChain(g,o,s,a,d,l),d<u&&this.computeIntersectsForChain(g,o,s,d,u,l))}},Rp.prototype.getStartIndexes=function(){return this.startIndex},Rp.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)},Rp.prototype.interfaces_=function(){return[]},Rp.prototype.getClass=function(){return Rp};var Tp=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},Ap={NULL_VALUE:{configurable:!0}};Tp.prototype.getDepth=function(t,e){return this._depth[t][e]},Tp.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},Tp.prototype.isNull=function(){var t=this;if(0===arguments.length){for(var e=0;e<2;e++)for(var n=0;n<3;n++)if(t._depth[e][n]!==Tp.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===Tp.NULL_VALUE}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._depth[i][o]===Tp.NULL_VALUE}},Tp.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var r=1;r<3;r++){var i=0;t._depth[e][r]>n&&(i=1),t._depth[e][r]=i}}},Tp.prototype.getDelta=function(t){return this._depth[t][rh.RIGHT]-this._depth[t][rh.LEFT]},Tp.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Uu.EXTERIOR:Uu.INTERIOR},Tp.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Tp.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);i!==Uu.EXTERIOR&&i!==Uu.INTERIOR||(t.isNull(n,r)?t._depth[n][r]=Tp.depthAtLocation(i):t._depth[n][r]+=Tp.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];a===Uu.INTERIOR&&this._depth[o][s]++}},Tp.prototype.interfaces_=function(){return[]},Tp.prototype.getClass=function(){return Tp},Tp.depthAtLocation=function(t){return t===Uu.EXTERIOR?0:t===Uu.INTERIOR?1:Tp.NULL_VALUE},Ap.NULL_VALUE.get=function(){return-1},Object.defineProperties(Tp,Ap);var Dp=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Lp(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Tp,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,ph.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 Rp(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new al;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 qu(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 Wu;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,rh.ON),e.getLocation(1,rh.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,rh.LEFT),e.getLocation(1,rh.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,rh.RIGHT),e.getLocation(1,rh.RIGHT),2))},e}(yh),Fp=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Sp,this._bufParams=t||null};Fp.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Fp.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 ph(t.getLabel())).flip(),n.merge(r);var i=Fp.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Fp.depthDelta(t.getLabel()))},Fp.prototype.buildSubgraphs=function(t,e){for(var n=new Bl,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new gp(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Fp.prototype.createSubgraphs=function(t){for(var e=new Bl,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new ch;i.create(r),e.add(i)}}return Th.sort(e,Th.reverseOrder()),e},Fp.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Fp.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new ep,n=new ml;return n.setPrecisionModel(t),e.setSegmentIntersector(new Pp(n)),e},Fp.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new fp(n,this._bufParams),i=new _p(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new Ih(new Ip),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new Nh(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Fp.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 Dp(i.getCoordinates(),new ph(s));this.insertUniqueEdge(a)}}},Fp.prototype.setNoder=function(t){this._workingNoder=t},Fp.prototype.interfaces_=function(){return[]},Fp.prototype.getClass=function(){return Fp},Fp.depthDelta=function(t){var e=t.getLocation(0,rh.LEFT),n=t.getLocation(0,rh.RIGHT);return e===Uu.INTERIOR&&n===Uu.EXTERIOR?1:e===Uu.EXTERIOR&&n===Uu.INTERIOR?-1:0},Fp.convertSegStrings=function(t){for(var e=new Jc,n=new Bl;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var kp=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()}};kp.prototype.rescale=function(){var t=this;if(Xu(arguments[0],Dl))for(var e=arguments[0],n=e.iterator();n.hasNext();){var r=n.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],o=0;o<i.length;o++)i[o].x=i[o].x/t._scaleFactor+t._offsetX,i[o].y=i[o].y/t._scaleFactor+t._offsetY;2===i.length&&i[0].equals2D(i[1])&&ol.out.println(i)}},kp.prototype.scale=function(){var t=this;if(Xu(arguments[0],Dl)){for(var e=arguments[0],n=new Bl,r=e.iterator();r.hasNext();){var i=r.next();n.add(new Hh(t.scale(i.getCoordinates()),i.getData()))}return n}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new qu(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);var u=Ul.removeRepeatedPoints(s);return u}},kp.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},kp.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},kp.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},kp.prototype.interfaces_=function(){return[$h]},kp.prototype.getClass=function(){return kp};var Gp=function(){this._li=new ml,this._segStrings=null;var t=arguments[0];this._segStrings=t},qp={fact:{configurable:!0}};Gp.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next(),r=n.getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=o.iterator();s.hasNext();)for(var a=s.next(),u=a.getCoordinates(),l=1;l<u.length-1;l++)if(u[l].equals(i))throw new gl("found endpt/interior pt intersection at index "+l+" :pt "+i)},Gp.prototype.checkInteriorIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();)for(var n=e.next(),r=this._segStrings.iterator();r.hasNext();){var i=r.next();t.checkInteriorIntersections(n,i)}else if(2===arguments.length)for(var o=arguments[0],s=arguments[1],a=o.getCoordinates(),u=s.getCoordinates(),l=0;l<a.length-1;l++)for(var c=0;c<u.length-1;c++)t.checkInteriorIntersections(o,l,s,c);else if(4===arguments.length){var h=arguments[0],p=arguments[1],f=arguments[2],g=arguments[3];if(h===f&&p===g)return null;var d=h.getCoordinates()[p],y=h.getCoordinates()[p+1],v=f.getCoordinates()[g],_=f.getCoordinates()[g+1];if(this._li.computeIntersection(d,y,v,_),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,d,y)||this.hasInteriorIntersection(this._li,v,_)))throw new gl("found non-noded intersection at "+d+"-"+y+" and "+v+"-"+_)}},Gp.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Gp.prototype.checkCollapses=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next();t.checkCollapses(n)}else if(1===arguments.length)for(var r=arguments[0],i=r.getCoordinates(),o=0;o<i.length-2;o++)t.checkCollapse(i[o],i[o+1],i[o+2])},Gp.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},Gp.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new gl("found non-noded collapse at "+Gp.fact.createLineString([t,e,n]))},Gp.prototype.interfaces_=function(){return[]},Gp.prototype.getClass=function(){return Gp},qp.fact.get=function(){return new Jc},Object.defineProperties(Gp,qp);var Bp=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 Ru("Scale factor must be non-zero");1!==e&&(this._pt=new qu(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new qu,this._p1Scaled=new qu),this.initCorners(this._pt)},zp={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Bp.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 yl.isTrue(!(s&&a),"Found bad envelope test"),a},Bp.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new qu(this._maxx,this._maxy),this._corner[1]=new qu(this._minx,this._maxy),this._corner[2]=new qu(this._minx,this._miny),this._corner[3]=new qu(this._maxx,this._miny)},Bp.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))},Bp.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Bp.prototype.getCoordinate=function(){return this._originalPt},Bp.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Bp.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Bp.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new al(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Bp.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()))))},Bp.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)))))},Bp.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)},Bp.prototype.interfaces_=function(){return[]},Bp.prototype.getClass=function(){return Bp},zp.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Bp,zp);var jp=function(){this.tempEnv1=new al,this.selectedSegment=new Wh};jp.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)}},jp.prototype.interfaces_=function(){return[]},jp.prototype.getClass=function(){return jp};var Up=function(){this._index=null;var t=arguments[0];this._index=t},Vp={HotPixelSnapAction:{configurable:!0}};Up.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 Xp(e,n,r);return this._index.query(i,{interfaces_:function(){return[Mh]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},Up.prototype.interfaces_=function(){return[]},Up.prototype.getClass=function(){return Up},Vp.HotPixelSnapAction.get=function(){return Xp},Object.defineProperties(Up,Vp);var Xp=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}(jp),Yp=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new Bl};Yp.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)}},Yp.prototype.isDone=function(){return!1},Yp.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Yp.prototype.interfaces_=function(){return[Cp]},Yp.prototype.getClass=function(){return Yp};var Hp=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 ml,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};Hp.prototype.checkCorrectness=function(t){var e=Hh.getNodedSubstrings(t),n=new Gp(e);try{n.checkValid()}catch(t){if(!(t instanceof rl))throw t;t.printStackTrace()}},Hp.prototype.getNodedSubstrings=function(){return Hh.getNodedSubstrings(this._nodedSegStrings)},Hp.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},Hp.prototype.findInteriorIntersections=function(t,e){var n=new Yp(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},Hp.prototype.computeVertexSnaps=function(){var t=this;if(Xu(arguments[0],Dl))for(var e=arguments[0],n=e.iterator();n.hasNext();){var r=n.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof Hh)for(var i=arguments[0],o=i.getCoordinates(),s=0;s<o.length;s++){var a=new Bp(o[s],t._scaleFactor,t._li),u=t._pointSnapper.snap(a,i,s);u&&i.addIntersection(o[s],s)}},Hp.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new ep,this._pointSnapper=new Up(this._noder.getIndex()),this.snapRound(t,this._li)},Hp.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next(),i=new Bp(r,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},Hp.prototype.interfaces_=function(){return[$h]},Hp.prototype.getClass=function(){return Hp};var Wp=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new rp,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}},Jp={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Wp.prototype.bufferFixedPrecision=function(t){var e=new kp(new Hp(new Xc(1)),t.getScale()),n=new Fp(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},Wp.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=Wp.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof uh))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=Wp.precisionScaleFactor(this._argGeom,this._distance,n),i=new Xc(r);this.bufferFixedPrecision(i)}},Wp.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Xc.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},Wp.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},Wp.prototype.bufferOriginalPrecision=function(){try{var t=new Fp(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof gl))throw t;this._saveException=t}},Wp.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},Wp.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},Wp.prototype.interfaces_=function(){return[]},Wp.prototype.getClass=function(){return Wp},Wp.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Wp(t),r=n.getResultGeometry(e);return r}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Nl&&"number"==typeof arguments[1]){var i=arguments[0],o=arguments[1],s=arguments[2],a=new Wp(i);a.setQuadrantSegments(s);var u=a.getResultGeometry(o);return u}if(arguments[2]instanceof rp&&arguments[0]instanceof Nl&&"number"==typeof arguments[1]){var l=arguments[0],c=arguments[1],h=arguments[2],p=new Wp(l,h),f=p.getResultGeometry(c);return f}}else if(4===arguments.length){var g=arguments[0],d=arguments[1],y=arguments[2],v=arguments[3],_=new Wp(g);_.setQuadrantSegments(y),_.setEndCapStyle(v);var m=_.getResultGeometry(d);return m}},Wp.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Yu.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)},Jp.CAP_ROUND.get=function(){return rp.CAP_ROUND},Jp.CAP_BUTT.get=function(){return rp.CAP_FLAT},Jp.CAP_FLAT.get=function(){return rp.CAP_FLAT},Jp.CAP_SQUARE.get=function(){return rp.CAP_SQUARE},Jp.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Wp,Jp);var Zp=function(){this._pt=[new qu,new qu],this._distance=Tu.NaN,this._isNull=!0};Zp.prototype.getCoordinates=function(){return this._pt},Zp.prototype.getCoordinate=function(t){return this._pt[t]},Zp.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)}},Zp.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}},Zp.prototype.getDistance=function(){return this._distance},Zp.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)}},Zp.prototype.interfaces_=function(){return[]},Zp.prototype.getClass=function(){return Zp};var Kp=function(){};Kp.prototype.interfaces_=function(){return[]},Kp.prototype.getClass=function(){return Kp},Kp.computeDistance=function(){if(arguments[2]instanceof Zp&&arguments[0]instanceof Cc&&arguments[1]instanceof qu)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Wh,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 Zp&&arguments[0]instanceof Oc&&arguments[1]instanceof qu){var a=arguments[0],u=arguments[1],l=arguments[2];Kp.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)Kp.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof Zp&&arguments[0]instanceof Nl&&arguments[1]instanceof qu){var h=arguments[0],p=arguments[1],f=arguments[2];if(h instanceof Cc)Kp.computeDistance(h,p,f);else if(h instanceof Oc)Kp.computeDistance(h,p,f);else if(h instanceof gc)for(var g=h,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);Kp.computeDistance(y,p,f)}else f.setMinimum(h.getCoordinate(),p)}else if(arguments[2]instanceof Zp&&arguments[0]instanceof Wh&&arguments[1]instanceof qu){var v=arguments[0],_=arguments[1],m=arguments[2],x=v.closestPoint(_);m.setMinimum(x,_)}};var Qp=function(t){this._maxPtDist=new Zp,this._inputGeom=t||null},$p={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Qp.prototype.computeMaxMidpointDistance=function(t){var e=new ef(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Qp.prototype.computeMaxVertexDistance=function(t){var e=new tf(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Qp.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Qp.prototype.getDistancePoints=function(){return this._maxPtDist},Qp.prototype.interfaces_=function(){return[]},Qp.prototype.getClass=function(){return Qp},$p.MaxPointDistanceFilter.get=function(){return tf},$p.MaxMidpointDistanceFilter.get=function(){return ef},Object.defineProperties(Qp,$p);var tf=function(t){this._maxPtDist=new Zp,this._minPtDist=new Zp,this._geom=t||null};tf.prototype.filter=function(t){this._minPtDist.initialize(),Kp.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},tf.prototype.getMaxPointDistance=function(){return this._maxPtDist},tf.prototype.interfaces_=function(){return[Pl]},tf.prototype.getClass=function(){return tf};var ef=function(t){this._maxPtDist=new Zp,this._minPtDist=new Zp,this._geom=t||null};ef.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new qu((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),Kp.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ef.prototype.isDone=function(){return!1},ef.prototype.isGeometryChanged=function(){return!1},ef.prototype.getMaxPointDistance=function(){return this._maxPtDist},ef.prototype.interfaces_=function(){return[fc]},ef.prototype.getClass=function(){return ef};var nf=function(t){this._comps=t||null};nf.prototype.filter=function(t){t instanceof Oc&&this._comps.add(t)},nf.prototype.interfaces_=function(){return[pc]},nf.prototype.getClass=function(){return nf},nf.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return nf.getPolygons(t,new Bl)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Oc?n.add(e):e instanceof gc&&e.apply(new nf(n)),n}};var rf=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}};rf.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Tc){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Cc&&this._lines.add(t)},rf.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},rf.prototype.interfaces_=function(){return[Il]},rf.prototype.getClass=function(){return rf},rf.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(rf.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(rf.getLines(e,n))}},rf.getLines=function(){if(1===arguments.length){var t=arguments[0];return rf.getLines(t,!1)}if(2===arguments.length){if(Xu(arguments[0],Dl)&&Xu(arguments[1],Dl)){for(var e=arguments[0],n=arguments[1],r=e.iterator();r.hasNext();){var i=r.next();rf.getLines(i,n)}return n}if(arguments[0]instanceof Nl&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1],a=new Bl;return o.apply(new rf(a,s)),a}if(arguments[0]instanceof Nl&&Xu(arguments[1],Dl)){var u=arguments[0],l=arguments[1];return u instanceof Cc?l.add(u):u.apply(new rf(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&Xu(arguments[0],Dl)&&Xu(arguments[1],Dl)){for(var c=arguments[0],h=arguments[1],p=arguments[2],f=c.iterator();f.hasNext();){var g=f.next();rf.getLines(g,h,p)}return h}if("boolean"==typeof arguments[2]&&arguments[0]instanceof Nl&&Xu(arguments[1],Dl)){var d=arguments[0],y=arguments[1],v=arguments[2];return d.apply(new rf(y,v)),y}}};var of=function(){if(this._boundaryRule=Ml.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 Ru("Rule must be non-null");this._boundaryRule=t}};of.prototype.locateInternal=function(){var t=this;if(arguments[0]instanceof qu&&arguments[1]instanceof Oc){var e=arguments[0],n=arguments[1];if(n.isEmpty())return Uu.EXTERIOR;var r=n.getExteriorRing(),i=this.locateInPolygonRing(e,r);if(i===Uu.EXTERIOR)return Uu.EXTERIOR;if(i===Uu.BOUNDARY)return Uu.BOUNDARY;for(var o=0;o<n.getNumInteriorRing();o++){var s=n.getInteriorRingN(o),a=t.locateInPolygonRing(e,s);if(a===Uu.INTERIOR)return Uu.EXTERIOR;if(a===Uu.BOUNDARY)return Uu.BOUNDARY}return Uu.INTERIOR}if(arguments[0]instanceof qu&&arguments[1]instanceof Cc){var u=arguments[0],l=arguments[1];if(!l.getEnvelopeInternal().intersects(u))return Uu.EXTERIOR;var c=l.getCoordinates();return l.isClosed()||!u.equals(c[0])&&!u.equals(c[c.length-1])?bl.isOnLine(u,c)?Uu.INTERIOR:Uu.EXTERIOR:Uu.BOUNDARY}if(arguments[0]instanceof qu&&arguments[1]instanceof Mc){var h=arguments[0],p=arguments[1],f=p.getCoordinate();return f.equals2D(h)?Uu.INTERIOR:Uu.EXTERIOR}},of.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?bl.locatePointInRing(t,e.getCoordinates()):Uu.EXTERIOR},of.prototype.intersects=function(t,e){return this.locate(t,e)!==Uu.EXTERIOR},of.prototype.updateLocationInfo=function(t){t===Uu.INTERIOR&&(this._isIn=!0),t===Uu.BOUNDARY&&this._numBoundaries++},of.prototype.computeLocation=function(t,e){var n=this;if(e instanceof Mc&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Cc)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Oc)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof dc)for(var r=e,i=0;i<r.getNumGeometries();i++){var o=r.getGeometryN(i);n.updateLocationInfo(n.locateInternal(t,o))}else if(e instanceof Ac)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);n.updateLocationInfo(n.locateInternal(t,u))}else if(e instanceof gc)for(var l=new xp(e);l.hasNext();){var c=l.next();c!==e&&n.computeLocation(t,c)}},of.prototype.locate=function(t,e){return e.isEmpty()?Uu.EXTERIOR:e instanceof Cc||e instanceof Oc?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?Uu.BOUNDARY:this._numBoundaries>0||this._isIn?Uu.INTERIOR:Uu.EXTERIOR)},of.prototype.interfaces_=function(){return[]},of.prototype.getClass=function(){return of};var sf=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}},af={INSIDE_AREA:{configurable:!0}};sf.prototype.isInsideArea=function(){return this._segIndex===sf.INSIDE_AREA},sf.prototype.getCoordinate=function(){return this._pt},sf.prototype.getGeometryComponent=function(){return this._component},sf.prototype.getSegmentIndex=function(){return this._segIndex},sf.prototype.interfaces_=function(){return[]},sf.prototype.getClass=function(){return sf},af.INSIDE_AREA.get=function(){return-1},Object.defineProperties(sf,af);var uf=function(t){this._pts=t||null};uf.prototype.filter=function(t){t instanceof Mc&&this._pts.add(t)},uf.prototype.interfaces_=function(){return[pc]},uf.prototype.getClass=function(){return uf},uf.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Mc?Th.singletonList(t):uf.getPoints(t,new Bl)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Mc?n.add(e):e instanceof gc&&e.apply(new uf(n)),n}};var lf=function(){this._locations=null;var t=arguments[0];this._locations=t};lf.prototype.filter=function(t){(t instanceof Mc||t instanceof Cc||t instanceof Oc)&&this._locations.add(new sf(t,0,t.getCoordinate()))},lf.prototype.interfaces_=function(){return[pc]},lf.prototype.getClass=function(){return lf},lf.getLocations=function(t){var e=new Bl;return t.apply(new lf(e)),e};var cf=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new of,this._minDistanceLocation=null,this._minDistance=Tu.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}};cf.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=1-n,o=nf.getPolygons(this._geom[n]);if(o.size()>0){var s=lf.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&Xu(arguments[0],Gl)&&Xu(arguments[1],Gl)){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=0;c<a.size();c++)for(var h=a.get(c),p=0;p<u.size();p++)if(t.computeContainmentDistance(h,u.get(p),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof sf&&arguments[1]instanceof Oc){var f=arguments[0],g=arguments[1],d=arguments[2],y=f.getCoordinate();if(Uu.EXTERIOR!==this._ptLocator.locate(y,g))return this._minDistance=0,d[0]=f,d[1]=new sf(g,y),null}},cf.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},cf.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=rf.getLines(this._geom[0]),n=rf.getLines(this._geom[1]),r=uf.getPoints(this._geom[0]),i=uf.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))))},cf.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},cf.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])},cf.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},cf.prototype.computeMinDistance=function(){var t=this;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 Cc&&arguments[1]instanceof Mc){var e=arguments[0],n=arguments[1],r=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=n.getCoordinate(),s=0;s<i.length-1;s++){var a=bl.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new Wh(i[s],i[s+1]),l=u.closestPoint(o);r[0]=new sf(e,s,l),r[1]=new sf(n,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Cc&&arguments[1]instanceof Cc){var c=arguments[0],h=arguments[1],p=arguments[2];if(c.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var f=c.getCoordinates(),g=h.getCoordinates(),d=0;d<f.length-1;d++)for(var y=0;y<g.length-1;y++){var v=bl.distanceLineLine(f[d],f[d+1],g[y],g[y+1]);if(v<t._minDistance){t._minDistance=v;var _=new Wh(f[d],f[d+1]),m=new Wh(g[y],g[y+1]),x=_.closestPoints(m);p[0]=new sf(c,d,x[0]),p[1]=new sf(h,y,x[1])}if(t._minDistance<=t._terminateDistance)return null}}},cf.prototype.computeMinDistancePoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<r._minDistance&&(r._minDistance=u,n[0]=new sf(o,0,o.getCoordinate()),n[1]=new sf(a,0,a.getCoordinate())),r._minDistance<=r._terminateDistance)return null}},cf.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new Ru("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},cf.prototype.computeMinDistanceLines=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},cf.prototype.interfaces_=function(){return[]},cf.prototype.getClass=function(){return cf},cf.distance=function(t,e){return new cf(t,e).distance()},cf.isWithinDistance=function(t,e,n){return new cf(t,e,n).distance()<=n},cf.nearestPoints=function(t,e){return new cf(t,e).nearestPoints()};var hf=function(){this._pt=[new qu,new qu],this._distance=Tu.NaN,this._isNull=!0};hf.prototype.getCoordinates=function(){return this._pt},hf.prototype.getCoordinate=function(t){return this._pt[t]},hf.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)}},hf.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}},hf.prototype.toString=function(){return fl.toLineString(this._pt[0],this._pt[1])},hf.prototype.getDistance=function(){return this._distance},hf.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)}},hf.prototype.interfaces_=function(){return[]},hf.prototype.getClass=function(){return hf};var pf=function(){};pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf},pf.computeDistance=function(){if(arguments[2]instanceof hf&&arguments[0]instanceof Cc&&arguments[1]instanceof qu)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Wh,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 hf&&arguments[0]instanceof Oc&&arguments[1]instanceof qu){var a=arguments[0],u=arguments[1],l=arguments[2];pf.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)pf.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof hf&&arguments[0]instanceof Nl&&arguments[1]instanceof qu){var h=arguments[0],p=arguments[1],f=arguments[2];if(h instanceof Cc)pf.computeDistance(h,p,f);else if(h instanceof Oc)pf.computeDistance(h,p,f);else if(h instanceof gc)for(var g=h,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);pf.computeDistance(y,p,f)}else f.setMinimum(h.getCoordinate(),p)}else if(arguments[2]instanceof hf&&arguments[0]instanceof Wh&&arguments[1]instanceof qu){var v=arguments[0],_=arguments[1],m=arguments[2],x=v.closestPoint(_);m.setMinimum(x,_)}};var ff=function(){this._g0=null,this._g1=null,this._ptDist=new hf,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},gf={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};ff.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},ff.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Ru("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},ff.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},ff.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ff.prototype.computeOrientedDistance=function(t,e,n){var r=new df(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new yf(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},ff.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ff.prototype.interfaces_=function(){return[]},ff.prototype.getClass=function(){return ff},ff.distance=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new ff(t,e);return n.distance()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new ff(r,i);return s.setDensifyFraction(o),s.distance()}},gf.MaxPointDistanceFilter.get=function(){return df},gf.MaxDensifiedByFractionDistanceFilter.get=function(){return yf},Object.defineProperties(ff,gf);var df=function(){this._maxPtDist=new hf,this._minPtDist=new hf,this._euclideanDist=new pf,this._geom=null;var t=arguments[0];this._geom=t};df.prototype.filter=function(t){this._minPtDist.initialize(),pf.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},df.prototype.getMaxPointDistance=function(){return this._maxPtDist},df.prototype.interfaces_=function(){return[Pl]},df.prototype.getClass=function(){return df};var yf=function(){this._maxPtDist=new hf,this._minPtDist=new hf,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};yf.prototype.filter=function(t,e){var n=this;if(0===e)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-r.x)/this._numSubSegs,s=(i.y-r.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=r.x+a*o,l=r.y+a*s,c=new qu(u,l);n._minPtDist.initialize(),pf.computeDistance(n._geom,c,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},yf.prototype.isDone=function(){return!1},yf.prototype.isGeometryChanged=function(){return!1},yf.prototype.getMaxPointDistance=function(){return this._maxPtDist},yf.prototype.interfaces_=function(){return[fc]},yf.prototype.getClass=function(){return yf};var vf=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},_f={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};vf.prototype.checkMaximumDistance=function(t,e,n){var r=new ff(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 "+fl.toLineString(i[0],i[1])+")"}},vf.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=vf.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(),vf.VERBOSE&&ol.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},vf.prototype.checkNegativeValid=function(){if(!(this._input instanceof Oc||this._input instanceof Ac||this._input instanceof gc))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)},vf.prototype.getErrorIndicator=function(){return this._errorIndicator},vf.prototype.checkMinimumDistance=function(t,e,n){var r=new cf(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 "+fl.toLineString(i[0],i[1])+" )"}},vf.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)},vf.prototype.getErrorLocation=function(){return this._errorLocation},vf.prototype.getPolygonLines=function(t){for(var e=new Bl,n=new rf(e),r=nf.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},vf.prototype.getErrorMessage=function(){return this._errMsg},vf.prototype.interfaces_=function(){return[]},vf.prototype.getClass=function(){return vf},_f.VERBOSE.get=function(){return!1},_f.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(vf,_f);var mf=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},xf={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};mf.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},mf.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*mf.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new al(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new al(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")},mf.prototype.checkDistance=function(){var t=new vf(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")},mf.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")},mf.prototype.checkPolygonal=function(){this._result instanceof Oc||this._result instanceof Ac||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},mf.prototype.getErrorIndicator=function(){return this._errorIndicator},mf.prototype.getErrorLocation=function(){return this._errorLocation},mf.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"))},mf.prototype.report=function(t){if(!mf.VERBOSE)return null;ol.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},mf.prototype.getErrorMessage=function(){return this._errorMsg},mf.prototype.interfaces_=function(){return[]},mf.prototype.getClass=function(){return mf},mf.isValidMsg=function(t,e,n){var r=new mf(t,e,n);return r.isValid()?null:r.getErrorMessage()},mf.isValid=function(t,e,n){return!!new mf(t,e,n).isValid()},xf.VERBOSE.get=function(){return!1},xf.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(mf,xf);var Ef=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ef.prototype.getCoordinates=function(){return this._pts},Ef.prototype.size=function(){return this._pts.length},Ef.prototype.getCoordinate=function(t){return this._pts[t]},Ef.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ef.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Vh.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Ef.prototype.setData=function(t){this._data=t},Ef.prototype.getData=function(){return this._data},Ef.prototype.toString=function(){return fl.toLineString(new Bc(this._pts))},Ef.prototype.interfaces_=function(){return[Xh]},Ef.prototype.getClass=function(){return Ef};var bf=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Bl,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};bf.prototype.getInteriorIntersection=function(){return this._interiorIntersection},bf.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},bf.prototype.getIntersectionSegments=function(){return this._intSegments},bf.prototype.count=function(){return this._intersectionCount},bf.prototype.getIntersections=function(){return this._intersections},bf.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},bf.prototype.setKeepIntersections=function(t){this._keepIntersections=t},bf.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++)},bf.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},bf.prototype.hasIntersection=function(){return null!==this._interiorIntersection},bf.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},bf.prototype.interfaces_=function(){return[Cp]},bf.prototype.getClass=function(){return bf},bf.createAllIntersectionsFinder=function(t){var e=new bf(t);return e.setFindAllIntersections(!0),e},bf.createAnyIntersectionFinder=function(t){return new bf(t)},bf.createIntersectionCounter=function(t){var e=new bf(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var wf=function(){this._li=new ml,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};wf.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},wf.prototype.getIntersections=function(){return this._segInt.getIntersections()},wf.prototype.isValid=function(){return this.execute(),this._isValid},wf.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},wf.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new bf(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ep;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},wf.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new uh(this.getErrorMessage(),this._segInt.getInteriorIntersection())},wf.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fl.toLineString(t[0],t[1])+" and "+fl.toLineString(t[2],t[3])},wf.prototype.interfaces_=function(){return[]},wf.prototype.getClass=function(){return wf},wf.computeIntersections=function(t){var e=new wf(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var If=function t(){this._nv=null;var e=arguments[0];this._nv=new wf(t.toSegmentStrings(e))};If.prototype.checkValid=function(){this._nv.checkValid()},If.prototype.interfaces_=function(){return[]},If.prototype.getClass=function(){return If},If.toSegmentStrings=function(t){for(var e=new Bl,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Ef(r.getCoordinates(),r))}return e},If.checkValid=function(t){new If(t).checkValid()};var Nf=function(t){this._mapOp=t};Nf.prototype.map=function(t){for(var e=new Bl,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(Jc.toGeometryArray(e))},Nf.prototype.interfaces_=function(){return[]},Nf.prototype.getClass=function(){return Nf},Nf.map=function(t,e){return new Nf(e).map(t)};var Sf=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new Bl,this._resultLineList=new Bl;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Sf.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var r=n.next();e.collectLineEdge(r,t,e._lineEdgesList),e.collectBoundaryTouchEdge(r,t,e._lineEdgesList)}},Sf.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Sf.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Sf.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!sg.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},Sf.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)}}},Sf.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))}},Sf.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)}},Sf.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(yl.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(sg.isResultOfOp(r,e)&&e===sg.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Sf.prototype.interfaces_=function(){return[]},Sf.prototype.getClass=function(){return Sf};var Cf=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new Bl;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Cf.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Cf.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!==sg.INTERSECTION)){var r=n.getLabel();sg.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},Cf.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Cf.prototype.interfaces_=function(){return[]},Cf.prototype.getClass=function(){return Cf};var Pf=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Pf.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Pf.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof Tc&&!r.isEmpty()||(n=!1);for(var i=new Bl,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof Tc||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new Bl;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},Pf.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Pf.prototype.getInputGeometry=function(){return this._inputGeom},Pf.prototype.transformMultiLineString=function(t,e){for(var n=new Bl,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)},Pf.prototype.transformCoordinates=function(t,e){return this.copy(t)},Pf.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Pf.prototype.transformMultiPoint=function(t,e){for(var n=new Bl,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)},Pf.prototype.transformMultiPolygon=function(t,e){for(var n=new Bl,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)},Pf.prototype.copy=function(t){return t.copy()},Pf.prototype.transformGeometryCollection=function(t,e){for(var n=new Bl,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(Jc.toGeometryArray(n)):this._factory.buildGeometry(n)},Pf.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Mc)return this.transformPoint(t,null);if(t instanceof Rc)return this.transformMultiPoint(t,null);if(t instanceof Tc)return this.transformLinearRing(t,null);if(t instanceof Cc)return this.transformLineString(t,null);if(t instanceof dc)return this.transformMultiLineString(t,null);if(t instanceof Oc)return this.transformPolygon(t,null);if(t instanceof Ac)return this.transformMultiPolygon(t,null);if(t instanceof gc)return this.transformGeometryCollection(t,null);throw new Ru("Unknown Geometry subtype: "+t.getClass().getName())},Pf.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)},Pf.prototype.interfaces_=function(){return[]},Pf.prototype.getClass=function(){return Pf};var Mf=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Wh,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Cc&&"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}};Mf.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 qu(o)),0===r&&this._isClosed&&t.set(t.size()-1,new qu(o)))}},Mf.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},Mf.prototype.snapTo=function(t){var e=new jl(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Mf.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 qu(i),!1)}},Mf.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=Tu.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(n._seg.p0=e.get(o),n._seg.p1=e.get(o+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var s=n._seg.distance(t);s<n._snapTolerance&&s<r&&(r=s,i=o)}return i},Mf.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Mf.prototype.interfaces_=function(){return[]},Mf.prototype.getClass=function(){return Mf},Mf.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Lf=function(t){this._srcGeom=t||null},Of={SNAP_PRECISION_FACTOR:{configurable:!0}};Lf.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Rf(e,n).transform(this._srcGeom)},Lf.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Rf(t,n,!0).transform(this._srcGeom),i=r;return e&&Xu(i,Lc)&&(i=r.buffer(0)),i},Lf.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Lf.prototype.extractTargetCoordinates=function(t){for(var e=new ac,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},Lf.prototype.computeMinimumSegmentLength=function(t){for(var e=Tu.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},Lf.prototype.interfaces_=function(){return[]},Lf.prototype.getClass=function(){return Lf},Lf.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Lf(t);r[0]=i.snapTo(e,n);var o=new Lf(e);return r[1]=o.snapTo(r[0],n),r},Lf.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Lf.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===Xc.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(Lf.computeOverlaySnapTolerance(i),Lf.computeOverlaySnapTolerance(o))}},Lf.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Lf.SNAP_PRECISION_FACTOR},Lf.snapToSelf=function(t,e,n){return new Lf(t).snapToSelf(e,n)},Of.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Lf,Of);var Rf=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 Mf(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}(Pf),Tf=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Tf.prototype.getCommon=function(){return Tu.longBitsToDouble(this._commonBits)},Tf.prototype.add=function(t){var e=Tu.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Tf.signExpBits(this._commonBits),this._isFirst=!1,null):Tf.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Tf.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Tf.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Tf.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Tu.longBitsToDouble(t),n=Tu.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),o=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return o}},Tf.prototype.interfaces_=function(){return[]},Tf.prototype.getClass=function(){return Tf},Tf.getBit=function(t,e){return 0!=(t&1<<e)?1:0},Tf.signExpBits=function(t){return t>>52},Tf.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},Tf.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r--){if(Tf.getBit(t,r)!==Tf.getBit(e,r))return n;n++}return 52};var Af=function(){this._commonCoord=null,this._ccFilter=new Ff},Df={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Af.prototype.addCommonBits=function(t){var e=new kf(this._commonCoord);t.apply(e),t.geometryChanged()},Af.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new qu(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new kf(e);return t.apply(n),t.geometryChanged(),t},Af.prototype.getCommonCoordinate=function(){return this._commonCoord},Af.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Af.prototype.interfaces_=function(){return[]},Af.prototype.getClass=function(){return Af},Df.CommonCoordinateFilter.get=function(){return Ff},Df.Translater.get=function(){return kf},Object.defineProperties(Af,Df);var Ff=function(){this._commonBitsX=new Tf,this._commonBitsY=new Tf};Ff.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Ff.prototype.getCommonCoordinate=function(){return new qu(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ff.prototype.interfaces_=function(){return[Pl]},Ff.prototype.getClass=function(){return Ff};var kf=function(){this.trans=null;var t=arguments[0];this.trans=t};kf.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)},kf.prototype.isDone=function(){return!1},kf.prototype.isGeometryChanged=function(){return!0},kf.prototype.interfaces_=function(){return[fc]},kf.prototype.getClass=function(){return kf};var Gf=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()};Gf.prototype.selfSnap=function(t){return new Lf(t).snapTo(t,this._snapTolerance)},Gf.prototype.removeCommonBits=function(t){this._cbr=new Af,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},Gf.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Gf.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=sg.overlayOp(e[0],e[1],t);return this.prepareResult(n)},Gf.prototype.checkValid=function(t){t.isValid()||ol.out.println("Snapped geometry is invalid")},Gf.prototype.computeSnapTolerance=function(){this._snapTolerance=Lf.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Gf.prototype.snap=function(t){var e=this.removeCommonBits(t);return Lf.snap(e[0],e[1],this._snapTolerance)},Gf.prototype.interfaces_=function(){return[]},Gf.prototype.getClass=function(){return Gf},Gf.overlayOp=function(t,e,n){return new Gf(t,e).getResultGeometry(n)},Gf.union=function(t,e){return Gf.overlayOp(t,e,sg.UNION)},Gf.intersection=function(t,e){return Gf.overlayOp(t,e,sg.INTERSECTION)},Gf.symDifference=function(t,e){return Gf.overlayOp(t,e,sg.SYMDIFFERENCE)},Gf.difference=function(t,e){return Gf.overlayOp(t,e,sg.DIFFERENCE)};var qf=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};qf.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=sg.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(t){if(!(t instanceof gl))throw t;r=t}if(!n)try{e=Gf.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof gl?r:t}return e},qf.prototype.interfaces_=function(){return[]},qf.prototype.getClass=function(){return qf},qf.overlayOp=function(t,e,n){return new qf(t,e).getResultGeometry(n)},qf.union=function(t,e){return qf.overlayOp(t,e,sg.UNION)},qf.intersection=function(t,e){return qf.overlayOp(t,e,sg.INTERSECTION)},qf.symDifference=function(t,e){return qf.overlayOp(t,e,sg.SYMDIFFERENCE)},qf.difference=function(t,e){return qf.overlayOp(t,e,sg.DIFFERENCE)};var Bf=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Bf.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Bf.prototype.interfaces_=function(){return[]},Bf.prototype.getClass=function(){return Bf};var zf=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}},jf={INSERT:{configurable:!0},DELETE:{configurable:!0}};zf.prototype.isDelete=function(){return this._eventType===zf.DELETE},zf.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},zf.prototype.getObject=function(){return this._obj},zf.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},zf.prototype.getInsertEvent=function(){return this._insertEvent},zf.prototype.isInsert=function(){return this._eventType===zf.INSERT},zf.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},zf.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},zf.prototype.interfaces_=function(){return[Du]},zf.prototype.getClass=function(){return zf},jf.INSERT.get=function(){return 1},jf.DELETE.get=function(){return 2},Object.defineProperties(zf,jf);var Uf=function(){};Uf.prototype.interfaces_=function(){return[]},Uf.prototype.getClass=function(){return Uf};var Vf=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};Vf.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Vf.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},Vf.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Vf.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Vf.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Vf.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},Vf.prototype.hasProperIntersection=function(){return this._hasProper},Vf.prototype.hasIntersection=function(){return this._hasIntersection},Vf.prototype.isDone=function(){return this._isDone},Vf.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},Vf.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},Vf.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))))},Vf.prototype.interfaces_=function(){return[]},Vf.prototype.getClass=function(){return Vf},Vf.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Xf=function(t){function e(){t.call(this),this.events=new Bl,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Th.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(){var t=this;if(1===arguments.length){var e=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var n=0;n<this.events.size();n++){var r=t.events.get(n);if(r.isInsert()&&t.processOverlaps(n,r.getDeleteEventIndex(),r,e),e.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof Vf&&Xu(arguments[0],Gl)&&Xu(arguments[1],Gl)){var i=arguments[0],o=arguments[1],s=arguments[2];this.addEdges(i,i),this.addEdges(o,o),this.computeIntersections(s)}else if("boolean"==typeof arguments[2]&&Xu(arguments[0],Gl)&&arguments[1]instanceof Vf){var a=arguments[0],u=arguments[1],l=arguments[2];l?this.addEdges(a,null):this.addEdges(a),this.computeIntersections(u)}},e.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new Bf(n,i),s=new zf(e,n.getMinX(i),o);this.events.add(s),this.events.add(new zf(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(){var t=this;if(1===arguments.length)for(var e=arguments[0],n=e.iterator();n.hasNext();){var r=n.next();t.addEdge(r,r)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.iterator();s.hasNext();){var a=s.next();t.addEdge(a,o)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Uf),Yf=function(){this._min=Tu.POSITIVE_INFINITY,this._max=Tu.NEGATIVE_INFINITY},Hf={NodeComparator:{configurable:!0}};Yf.prototype.getMin=function(){return this._min},Yf.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},Yf.prototype.getMax=function(){return this._max},Yf.prototype.toString=function(){return fl.toLineString(new qu(this._min,0),new qu(this._max,0))},Yf.prototype.interfaces_=function(){return[]},Yf.prototype.getClass=function(){return Yf},Hf.NodeComparator.get=function(){return Wf},Object.defineProperties(Yf,Hf);var Wf=function(){};Wf.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},Wf.prototype.interfaces_=function(){return[ku]},Wf.prototype.getClass=function(){return Wf};var Jf=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}(Yf),Zf=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}(Yf),Kf=function(){this._leaves=new Bl,this._root=null,this._level=0};Kf.prototype.buildTree=function(){Th.sort(this._leaves,new Yf.NodeComparator);for(var t=this._leaves,e=null,n=new Bl;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},Kf.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 Jf(t,e,n))},Kf.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Kf.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},Kf.prototype.printNode=function(t){ol.out.println(fl.toLineString(new qu(t._min,this._level),new qu(t._max,this._level)))},Kf.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},Kf.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 Zf(t.get(n),t.get(n+1));e.add(i)}}},Kf.prototype.interfaces_=function(){return[]},Kf.prototype.getClass=function(){return Kf};var Qf=function(){this._items=new Bl};Qf.prototype.visitItem=function(t){this._items.add(t)},Qf.prototype.getItems=function(){return this._items},Qf.prototype.interfaces_=function(){return[Mh]},Qf.prototype.getClass=function(){return Qf};var $f=function(){this._index=null;var t=arguments[0];if(!Xu(t,Lc))throw new Ru("Argument must be Polygonal");this._index=new ng(t)},tg={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};$f.prototype.locate=function(t){var e=new El(t),n=new eg(e);return this._index.query(t.y,t.y,n),e.getLocation()},$f.prototype.interfaces_=function(){return[mp]},$f.prototype.getClass=function(){return $f},tg.SegmentVisitor.get=function(){return eg},tg.IntervalIndexedGeometry.get=function(){return ng},Object.defineProperties($f,tg);var eg=function(){this._counter=null;var t=arguments[0];this._counter=t};eg.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},eg.prototype.interfaces_=function(){return[Mh]},eg.prototype.getClass=function(){return eg};var ng=function(){this._index=new Kf;var t=arguments[0];this.init(t)};ng.prototype.init=function(t){for(var e=rf.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},ng.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new Wh(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)}},ng.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Qf;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)}},ng.prototype.interfaces_=function(){return[]},ng.prototype.getClass=function(){return ng};var rg=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new Vc,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new of,2===arguments.length){var e=arguments[0],n=arguments[1],r=Ml.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,rh.ON)===Uu.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 Vf(n,!0,!1);o.setIsDoneIfProperInt(i);var s=this.createEdgeSetIntersector(),a=this._parentGeom instanceof Tc||this._parentGeom instanceof Oc||this._parentGeom instanceof Ac,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 Vf(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 Mc){var t=arguments[0],e=t.getCoordinate();this.insertPoint(this._argIndex,e,Uu.INTERIOR)}else if(arguments[0]instanceof qu){var n=arguments[0];this.insertPoint(this._argIndex,n,Uu.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),Uu.EXTERIOR,Uu.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,Uu.INTERIOR,Uu.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],Uu.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],Uu.BOUNDARY)},e.prototype.addLineString=function(t){var e=Ul.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new Dp(e,new ph(this._argIndex,Uu.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),yl.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===Uu.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=Ul.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;bl.isCCW(r)&&(i=n,o=e);var s=new Dp(r,new ph(this._argIndex,Uu.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],Uu.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new ph(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new Xf},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 Ac&&(this._useBoundaryDeterminationRule=!1),e instanceof Oc)this.addPolygon(e);else if(e instanceof Cc)this.addLineString(e);else if(e instanceof Mc)this.addPoint(e);else if(e instanceof Rc)this.addCollection(e);else if(e instanceof dc)this.addCollection(e);else if(e instanceof Ac)this.addCollection(e);else{if(!(e instanceof gc))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 Xu(this._parentGeom,Lc)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new $f(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)?Uu.BOUNDARY:Uu.INTERIOR},e}(Ih),ig=function(){if(this._li=new ml,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 rg(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=Ml.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 rg(0,e,r),this._arg[1]=new rg(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 rg(0,i,s),this._arg[1]=new rg(1,o,s)}};ig.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},ig.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},ig.prototype.interfaces_=function(){return[]},ig.prototype.getClass=function(){return ig};var og=function(){};og.prototype.interfaces_=function(){return[]},og.prototype.getClass=function(){return og},og.map=function(){if(arguments[0]instanceof Nl&&Xu(arguments[1],og.MapOp)){for(var t=arguments[0],e=arguments[1],n=new Bl,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(Xu(arguments[0],Dl)&&Xu(arguments[1],og.MapOp)){for(var o=arguments[0],s=arguments[1],a=new Bl,u=o.iterator();u.hasNext();){var l=u.next(),c=s.map(l);null!==c&&a.add(c)}return a}},og.MapOp=function(){};var sg=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n),this._ptLocator=new of,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Sp,this._resultPolyList=new Bl,this._resultLineList=new Bl,this._resultPointList=new Bl,this._graph=new Ih(new Ip),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 ph(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 Bl;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)!==Uu.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new Bl,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 Bl;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),If.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new Nh(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new Sf(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new Cf(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,rh.RIGHT),i.getLocation(1,rh.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):(yl.isTrue(!r.isNull(i,rh.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,rh.LEFT,r.getLocation(i,rh.LEFT)),yl.isTrue(!r.isNull(i,rh.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,rh.RIGHT,r.getLocation(i,rh.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}(ig);sg.overlayOp=function(t,e,n){return new sg(t,e).getResultGeometry(n)},sg.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return sg.createEmptyResult(sg.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return Nf.map(t,{interfaces_:function(){return[og.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qf.overlayOp(t,e,sg.INTERSECTION)},sg.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return sg.createEmptyResult(sg.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qf.overlayOp(t,e,sg.SYMDIFFERENCE)},sg.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case sg.INTERSECTION:o=Math.min(r,i);break;case sg.UNION:o=Math.max(r,i);break;case sg.DIFFERENCE:o=r;break;case sg.SYMDIFFERENCE:o=Math.max(r,i)}return o},sg.createEmptyResult=function(t,e,n,r){var i=null;switch(sg.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},sg.difference=function(t,e){return t.isEmpty()?sg.createEmptyResult(sg.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qf.overlayOp(t,e,sg.DIFFERENCE))},sg.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return sg.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===Uu.BOUNDARY&&(i=Uu.INTERIOR),o===Uu.BOUNDARY&&(o=Uu.INTERIOR),s){case sg.INTERSECTION:return i===Uu.INTERIOR&&o===Uu.INTERIOR;case sg.UNION:return i===Uu.INTERIOR||o===Uu.INTERIOR;case sg.DIFFERENCE:return i===Uu.INTERIOR&&o!==Uu.INTERIOR;case sg.SYMDIFFERENCE:return i===Uu.INTERIOR&&o!==Uu.INTERIOR||i!==Uu.INTERIOR&&o===Uu.INTERIOR}return!1}},sg.INTERSECTION=1,sg.UNION=2,sg.DIFFERENCE=3,sg.SYMDIFFERENCE=4;var ag=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new of,this._seg=new Wh;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};ag.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var r=e._linework.getGeometryN(n).getCoordinateSequence(),i=0;i<r.size()-1;i++)if(r.getCoordinate(i,e._seg.p0),r.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0;return!1},ag.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?Uu.BOUNDARY:this._ptLocator.locate(t,this._g)},ag.prototype.extractLinework=function(t){var e=new ug;t.apply(e);var n=e.getLinework(),r=Jc.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},ag.prototype.interfaces_=function(){return[]},ag.prototype.getClass=function(){return ag};var ug=function(){this._linework=null,this._linework=new Bl};ug.prototype.getLinework=function(){return this._linework},ug.prototype.filter=function(t){if(t instanceof Oc){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},ug.prototype.interfaces_=function(){return[pc]},ug.prototype.getClass=function(){return ug};var lg=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};lg.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)},lg.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},lg.prototype.getPoints=function(t){for(var e=new Bl,n=rf.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},lg.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,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new qu(l-u,c+a);r.add(h)}if(this._doRight){var p=new qu(l+u,c-a);r.add(p)}},lg.prototype.interfaces_=function(){return[]},lg.prototype.getClass=function(){return lg};var cg=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 Bl;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new ag(this._geom[0],this._boundaryDistanceTolerance),new ag(this._geom[1],this._boundaryDistanceTolerance),new ag(this._geom[2],this._boundaryDistanceTolerance)]},hg={TOLERANCE:{configurable:!0}};cg.prototype.reportResult=function(t,e,n){ol.out.println("Overlay result invalid - A:"+Uu.toLocationSymbol(e[0])+" B:"+Uu.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+Uu.toLocationSymbol(e[2]))},cg.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},cg.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var r=t._testCoords.get(n);if(!t.checkValid(e,r))return t._invalidLocation=r,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!cg.hasLocation(this._location,Uu.BOUNDARY)||this.isValidResult(i,this._location)}},cg.prototype.addTestPts=function(t){var e=new lg(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},cg.prototype.isValidResult=function(t,e){var n=sg.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===Uu.INTERIOR);return r||this.reportResult(t,e,n),r},cg.prototype.getInvalidLocation=function(){return this._invalidLocation},cg.prototype.interfaces_=function(){return[]},cg.prototype.getClass=function(){return cg},cg.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},cg.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Lf.computeSizeBasedSnapTolerance(t),Lf.computeSizeBasedSnapTolerance(e))},cg.isValid=function(t,e,n,r){return new cg(t,e,r).isValid(n)},hg.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(cg,hg);var pg=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};pg.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)}},pg.prototype.combine=function(){for(var t=new Bl,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)},pg.prototype.interfaces_=function(){return[]},pg.prototype.getClass=function(){return pg},pg.combine=function(){if(1===arguments.length){var t=arguments[0],e=new pg(t);return e.combine()}if(2===arguments.length){var n=arguments[0],r=arguments[1],i=new pg(pg.createList(n,r));return i.combine()}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=new pg(pg.createList(o,s,a));return u.combine()}},pg.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},pg.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Bl;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new Bl;return s.add(r),s.add(i),s.add(o),s}};var fg=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new Bl)},gg={STRTREE_NODE_CAPACITY:{configurable:!0}};fg.prototype.reduceToGeometries=function(t){for(var e=new Bl,n=t.iterator();n.hasNext();){var r=n.next(),i=null;Xu(r,Gl)?i=this.unionTree(r):r instanceof Nl&&(i=r),e.add(i)}return e},fg.prototype.extractByEnvelope=function(t,e,n){for(var r=new Bl,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)},fg.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return pg.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)},fg.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 qh(fg.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)},fg.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=fg.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(fg.getGeometry(e,n),fg.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)}},fg.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},fg.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},fg.prototype.unionActual=function(t,e){return fg.restrictToPolygons(t.union(e))},fg.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},fg.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new Bl,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),pg.combine(r)},fg.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0],e=t.get(0).getFactory(),n=e.buildGeometry(t),r=n.buffer(0);return r}if(2===arguments.length){var i=arguments[0],o=arguments[1],s=i.getFactory(),a=s.createGeometryCollection([i,o]),u=a.buffer(0);return u}},fg.prototype.interfaces_=function(){return[]},fg.prototype.getClass=function(){return fg},fg.restrictToPolygons=function(t){if(Xu(t,Lc))return t;var e=nf.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(Jc.toPolygonArray(e))},fg.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},fg.union=function(t){return new fg(t).union()},gg.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(fg,gg);var dg=function(){};function yg(){return new vg}function vg(){this.reset()}dg.prototype.interfaces_=function(){return[]},dg.prototype.getClass=function(){return dg},dg.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return sg.createEmptyResult(sg.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),qf.overlayOp(t,e,sg.UNION)},vg.prototype={constructor:vg,reset:function(){this.s=this.t=0},add:function(t){mg(_g,t,this.t),mg(this,_g.s,this.s),this.s?this.t+=_g.t:this.s=_g.t},valueOf:function(){return this.s}};var _g=new vg;function mg(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var xg=1e-6,Eg=Math.PI,bg=Eg/2,wg=Eg/4,Ig=2*Eg,Ng=180/Eg,Sg=Eg/180,Cg=Math.abs,Pg=Math.atan,Mg=Math.atan2,Lg=Math.cos,Og=Math.sin,Rg=Math.sqrt;function Tg(t){return t>1?0:t<-1?Eg:Math.acos(t)}function Ag(t){return t>1?bg:t<-1?-bg:Math.asin(t)}function Dg(){}function Fg(t,e){t&&Gg.hasOwnProperty(t.type)&&Gg[t.type](t,e)}var kg={Feature:function(t,e){Fg(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Fg(n[r].geometry,e)}},Gg={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){qg(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)qg(n[r],e,0)},Polygon:function(t,e){Bg(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Bg(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Fg(n[r],e)}};function qg(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 Bg(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)qg(t[n],e,1);e.polygonEnd()}function zg(t){return[Mg(t[1],t[0]),Ag(t[2])]}function jg(t){var e=t[0],n=t[1],r=Lg(n);return[r*Lg(e),r*Og(e),Og(n)]}function Ug(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Vg(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 Xg(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Yg(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Hg(t){var e=Rg(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Wg(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}function Jg(t,e){return[t>Eg?t-Ig:t<-Eg?t+Ig:t,e]}function Zg(t){return function(e,n){return[(e+=t)>Eg?e-Ig:e<-Eg?e+Ig:e,n]}}function Kg(t){var e=Zg(t);return e.invert=Zg(-t),e}function Qg(t,e){var n=Lg(t),r=Og(t),i=Lg(e),o=Og(e);function s(t,e){var s=Lg(e),a=Lg(t)*s,u=Og(t)*s,l=Og(e),c=l*n+a*r;return[Mg(u*i-c*o,a*n-l*r),Ag(c*i+u*o)]}return s.invert=function(t,e){var s=Lg(e),a=Lg(t)*s,u=Og(t)*s,l=Og(e),c=l*i-u*o;return[Mg(u*i+l*o,a*n+c*r),Ag(c*n-a*r)]},s}function $g(t,e){(e=jg(e))[0]-=t,Hg(e);var n=Tg(-e[1]);return((-e[2]<0?-n:n)+Ig-xg)%Ig}function td(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:Dg,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function ed(t,e){return Cg(t[0]-e[0])<xg&&Cg(t[1]-e[1])<xg}function nd(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 rd(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(ed(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 nd(r,t,null,!0)),u.push(n.o=new nd(r,null,n,!1)),a.push(n=new nd(s,t,null,!1)),u.push(n.o=new nd(s,null,n,!0))}})),a.length){for(u.sort(e),id(a),id(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;for(var l,c,h=a[0];;){for(var p=h,f=!0;p.v;)if((p=p.n)===h)return;l=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(o=0,s=l.length;o<s;++o)i.point((c=l[o])[0],c[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(f)for(l=p.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else r(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,f=!f}while(!p.v);i.lineEnd()}}}function id(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 od(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}yg(),yg(),yg(),Jg.invert=Jg;var sd=1e9,ad=-sd;function ud(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,l){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||u(i,o)<0^a>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(r,i){return Cg(r[0]-t)<xg?i>0?0:3:Cg(r[0]-n)<xg?i>0?2:1:Cg(r[1]-e)<xg?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){var u,l,c,h,p,f,g,d,y,v,_,m=s,x=td(),E={point:b,lineStart:function(){E.point=w,l&&l.push(c=[]),v=!0,y=!1,g=d=NaN},lineEnd:function(){u&&(w(h,p),f&&y&&x.rejoin(),u.push(x.result())),E.point=b,y&&m.lineEnd()},polygonStart:function(){m=x,u=[],l=[],_=!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=_&&e,i=(u=od(u)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&rd(u,a,e,o,s),s.polygonEnd()),m=s,u=l=c=null}};function b(t,e){i(t,e)&&m.point(t,e)}function w(o,s){var a=i(o,s);if(l&&c.push([o,s]),v)h=o,p=s,f=a,v=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&y)m.point(o,s);else{var u=[g=Math.max(ad,Math.min(sd,g)),d=Math.max(ad,Math.min(sd,d))],x=[o=Math.max(ad,Math.min(sd,o)),s=Math.max(ad,Math.min(sd,s))];!function(t,e,n,r,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,p=e[1]-u;if(s=n-a,h||!(s>0)){if(s/=h,h<0){if(s<l)return;s<c&&(c=s)}else if(h>0){if(s>c)return;s>l&&(l=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>l&&(l=s)}else if(h>0){if(s<l)return;s<c&&(c=s)}if(s=r-u,p||!(s>0)){if(s/=p,p<0){if(s<l)return;s<c&&(c=s)}else if(p>0){if(s>c)return;s>l&&(l=s)}if(s=o-u,p||!(s<0)){if(s/=p,p<0){if(s>c)return;s>l&&(l=s)}else if(p>0){if(s<l)return;s<c&&(c=s)}return l>0&&(t[0]=a+l*h,t[1]=u+l*p),c<1&&(e[0]=a+c*h,e[1]=u+c*p),!0}}}}}(u,x,t,e,n,r)?a&&(m.lineStart(),m.point(o,s),_=!1):(y||(m.lineStart(),m.point(u[0],u[1])),m.point(x[0],x[1]),a||m.lineEnd(),_=!1)}g=o,d=s,y=a}return E}}var ld=yg();function cd(t){return t}yg(),yg(),yg();var hd=1/0,pd=hd,fd=-hd,gd=fd,dd={point:function(t,e){t<hd&&(hd=t),t>fd&&(fd=t),e<pd&&(pd=e),e>gd&&(gd=e)},lineStart:Dg,lineEnd:Dg,polygonStart:Dg,polygonEnd:Dg,result:function(){var t=[[hd,pd],[fd,gd]];return fd=gd=-(pd=hd=1/0),t}};function yd(t,e,n,r){return function(i,o){var s,a,u,l=e(o),c=i.invert(r[0],r[1]),h=td(),p=e(h),f=!1,g={point:d,lineStart:v,lineEnd:_,polygonStart:function(){g.point=m,g.lineStart=x,g.lineEnd=E,a=[],s=[]},polygonEnd:function(){g.point=d,g.lineStart=v,g.lineEnd=_,a=od(a);var t=function(t,e){var n=e[0],r=e[1],i=[Og(n),-Lg(n),0],o=0,s=0;ld.reset();for(var a=0,u=t.length;a<u;++a)if(c=(l=t[a]).length)for(var l,c,h=l[c-1],p=h[0],f=h[1]/2+wg,g=Og(f),d=Lg(f),y=0;y<c;++y,p=_,g=x,d=E,h=v){var v=l[y],_=v[0],m=v[1]/2+wg,x=Og(m),E=Lg(m),b=_-p,w=b>=0?1:-1,I=w*b,N=I>Eg,S=g*x;if(ld.add(Mg(S*w*Og(I),d*E+S*Lg(I))),o+=N?b+w*Ig:b,N^p>=n^_>=n){var C=Vg(jg(h),jg(v));Hg(C);var P=Vg(i,C);Hg(P);var M=(N^b>=0?-1:1)*Ag(P[2]);(r>M||r===M&&(C[0]||C[1]))&&(s+=N^b>=0?1:-1)}}return(o<-1e-6||o<xg&&ld<-1e-6)^1&s}(s,c);a.length?(f||(o.polygonStart(),f=!0),rd(a,_d,t,n,o)):t&&(f||(o.polygonStart(),f=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function y(t,e){var n=i(t,e);l.point(n[0],n[1])}function v(){g.point=y,l.lineStart()}function _(){g.point=d,l.lineEnd()}function m(t,e){u.push([t,e]);var n=i(t,e);p.point(n[0],n[1])}function x(){p.lineStart(),u=[]}function E(){m(u[0][0],u[0][1]),p.lineEnd();var t,e,n,r,i=p.clean(),l=h.result(),c=l.length;if(u.pop(),s.push(u),u=null,c)if(1&i){if((e=(n=l[0]).length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t<e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(vd))}return g}}function vd(t){return t.length>1}function _d(t,e){return((t=t.x)[0]<0?t[1]-bg-xg:bg-t[1])-((e=e.x)[0]<0?e[1]-bg-xg:bg-e[1])}yg();var md=yd((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?Eg:-Eg,u=Cg(o-n);Cg(u-Eg)<xg?(t.point(n,r=(r+s)/2>0?bg:-bg),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=Eg&&(Cg(n-i)<xg&&(n-=i*xg),Cg(o-a)<xg&&(o-=a*xg),r=function(t,e,n,r){var i,o,s=Og(t-n);return Cg(s)>xg?Pg((Og(e)*(o=Lg(r))*Og(n)-Og(r)*(i=Lg(e))*Og(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*bg,r.point(-Eg,i),r.point(0,i),r.point(Eg,i),r.point(Eg,0),r.point(Eg,-i),r.point(0,-i),r.point(-Eg,-i),r.point(-Eg,0),r.point(-Eg,i);else if(Cg(t[0]-e[0])>xg){var o=t[0]<e[0]?Eg:-Eg;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-Eg,-bg]);function xd(t,e){var n=Lg(t),r=n>0,i=Cg(n)>xg;function o(t,e){return Lg(t)*Lg(e)>n}function s(t,e,r){var i=[1,0,0],o=Vg(jg(t),jg(e)),s=Ug(o,o),a=o[0],u=s-a*a;if(!u)return!r&&t;var l=n*s/u,c=-n*a/u,h=Vg(i,o),p=Yg(i,l);Xg(p,Yg(o,c));var f=h,g=Ug(p,f),d=Ug(f,f),y=g*g-d*(Ug(p,p)-1);if(!(y<0)){var v=Rg(y),_=Yg(f,(-g-v)/d);if(Xg(_,p),_=zg(_),!r)return _;var m,x=t[0],E=e[0],b=t[1],w=e[1];E<x&&(m=x,x=E,E=m);var I=E-x,N=Cg(I-Eg)<xg;if(!N&&w<b&&(m=b,b=w,w=m),N||I<xg?N?b+w>0^_[1]<(Cg(_[0]-x)<xg?b:w):b<=_[1]&&_[1]<=w:I>Eg^(x<=_[0]&&_[0]<=E)){var S=Yg(f,(-g+v)/d);return Xg(S,p),[_,zg(S)]}}}function a(e,n){var i=r?t:Eg-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return yd(o,(function(t){var e,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,p){var f,g=[h,p],d=o(h,p),y=r?d?0:a(h,p):d?a(h+(h<0?Eg:-Eg),p):0;if(!e&&(l=u=d)&&t.lineStart(),d!==u&&(!(f=s(e,g))||ed(e,f)||ed(g,f))&&(g[0]+=xg,g[1]+=xg,d=o(g[0],g[1])),d!==u)c=0,d?(t.lineStart(),f=s(g,e),t.point(f[0],f[1])):(f=s(e,g),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&r^d){var v;y&n||!(v=s(g,e,!0))||(c=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!d||e&&ed(e,g)||t.point(g[0],g[1]),e=g,u=d,n=y},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=Lg(e),a=Og(e),u=r*n;null==i?(i=e+r*Ig,o=e-u/2):(i=$g(s,i),o=$g(s,o),(r>0?i<o:i>o)&&(i+=r*Ig));for(var l,c=i;r>0?c>o:c<o;c-=u)l=zg([s,-a*Lg(c),-a*Og(c)]),t.point(l[0],l[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-Eg,t-Eg])}function Ed(t){return function(e){var n=new bd;for(var r in t)n[r]=t[r];return n.stream=e,n}}function bd(){}function wd(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),function(t,e){t&&kg.hasOwnProperty(t.type)?kg[t.type](t,e):Fg(t,e)}(n,t.stream(dd));var s=dd.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,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}bd.prototype={constructor:bd,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 Id=Lg(30*Sg);function Nd(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,l,c,h,p,f,g,d,y){var v=l-r,_=c-i,m=v*v+_*_;if(m>4*e&&d--){var x=s+p,E=a+f,b=u+g,w=Rg(x*x+E*E+b*b),I=Ag(b/=w),N=Cg(Cg(b)-1)<xg||Cg(o-h)<xg?(o+h)/2:Mg(E,x),S=t(N,I),C=S[0],P=S[1],M=C-r,L=P-i,O=_*M-v*L;(O*O/m>e||Cg((v*M+_*L)/m-.5)>.3||s*p+a*f+u*g<Id)&&(n(r,i,o,s,a,u,C,P,N,x/=w,E/=w,b,d,y),y.point(C,P),n(C,P,N,x,E,b,l,c,h,p,f,g,d,y))}}return function(e){var r,i,o,s,a,u,l,c,h,p,f,g,d={point:y,lineStart:v,lineEnd:m,polygonStart:function(){e.polygonStart(),d.lineStart=x},polygonEnd:function(){e.polygonEnd(),d.lineStart=v}};function y(n,r){n=t(n,r),e.point(n[0],n[1])}function v(){c=NaN,d.point=_,e.lineStart()}function _(r,i){var o=jg([r,i]),s=t(r,i);n(c,h,l,p,f,g,c=s[0],h=s[1],l=r,p=o[0],f=o[1],g=o[2],16,e),e.point(c,h)}function m(){d.point=y,e.lineEnd()}function x(){v(),d.point=E,d.lineEnd=b}function E(t,e){_(r=t,e),i=c,o=h,s=p,a=f,u=g,d.point=_}function b(){n(c,h,l,p,f,g,i,o,r,s,a,u,16,e),d.lineEnd=m,m()}return d}}(t,e):function(t){return Ed({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Sd=Ed({point:function(t,e){this.stream.point(t*Sg,e*Sg)}});var Cd=function(t,e){var n=Lg(t),r=Lg(e),i=function(t){return(t=Tg(t))&&t/Og(t)}(n*r);return[i*r*Og(t),i*Og(e)]};function Pd(){return function(t){return function(t){var e,n,r,i,o,s,a,u,l,c,h=150,p=480,f=250,g=0,d=0,y=0,v=0,_=0,m=null,x=md,E=null,b=cd,w=.5,I=Nd(C,w);function N(t){return[(t=o(t[0]*Sg,t[1]*Sg))[0]*h+n,r-t[1]*h]}function S(t){return(t=o.invert((t[0]-n)/h,(r-t[1])/h))&&[t[0]*Ng,t[1]*Ng]}function C(t,i){return[(t=e(t,i))[0]*h+n,r-t[1]*h]}function P(){o=Wg(i=function(t,e,n){return(t%=Ig)?e||n?Wg(Kg(t),Qg(e,n)):Kg(t):e||n?Qg(e,n):Jg}(y,v,_),e);var t=e(g,d);return n=p-t[0]*h,r=f+t[1]*h,M()}function M(){return l=c=null,N}return N.stream=function(t){return l&&c===t?l:l=Sd(x(i,I(b(c=t))))},N.clipAngle=function(t){return arguments.length?(x=+t?xd(m=t*Sg,6*Sg):(m=null,md),M()):m*Ng},N.clipExtent=function(t){return arguments.length?(b=null==t?(E=s=a=u=null,cd):ud(E=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==E?null:[[E,s],[a,u]]},N.scale=function(t){return arguments.length?(h=+t,P()):h},N.translate=function(t){return arguments.length?(p=+t[0],f=+t[1],P()):[p,f]},N.center=function(t){return arguments.length?(g=t[0]%360*Sg,d=t[1]%360*Sg,P()):[g*Ng,d*Ng]},N.rotate=function(t){return arguments.length?(y=t[0]%360*Sg,v=t[1]%360*Sg,_=t.length>2?t[2]%360*Sg:0,P()):[y*Ng,v*Ng,_*Ng]},N.precision=function(t){return arguments.length?(I=Nd(C,w=t*t),M()):Rg(w)},N.fitExtent=function(t,e){return wd(N,t,e)},N.fitSize=function(t,e){return function(t,e,n){return wd(t,[[0,0],e],n)}(N,t,e)},function(){return e=t.apply(this,arguments),N.invert=e.invert&&S,P()}}((function(){return t}))()}(Cd).scale(79.4188).clipAngle(179.999)}function Md(t,n,r,i){var s=t.properties||{},a="Feature"===t.type?t.geometry:t;if("GeometryCollection"===a.type){var u=[];return q(t,(function(t){var e=Md(t,n,r,i);e&&u.push(e)})),f(u)}var l=function(t){var n=fn(t).geometry.coordinates,r=[-n[0],-n[1]];return Pd().rotate(r).scale(e)}(a),c={type:a.type,coordinates:Od(a.coordinates,l)},h=(new eh).read(c),p=m(x(n,r),"meters"),g=Wp.bufferOp(h,p,i);if(!Ld((g=(new nh).write(g)).coordinates))return o({type:g.type,coordinates:Rd(g.coordinates,l)},s)}function Ld(t){return Array.isArray(t[0])?Ld(t[0]):isNaN(t[0])}function Od(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return Od(t,e)}))}function Rd(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return Rd(t,e)}))}function Td(t,e,n){void 0===n&&(n={});var r=rt(t),i=rt(e),o=Lu.intersection(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?l(o[0],n.properties):y(o,n.properties)}function Ad(t,e,n){void 0===n&&(n={});var r=JSON.stringify(n.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/ve([i,u],[s,u],n)*(s-i),h=2*e/ve([l,o],[l,a],n)*(a-o),p=c/2,g=2*p,d=Math.sqrt(3)/2*h,y=s-i,v=a-o,_=3/4*g,m=d,x=(y-g)/(g-p/2),E=Math.floor(x),b=(E*_-p/2-y)/2-p/2+_/2,w=Math.floor((v-d)/d),I=(v-w*d)/2,N=w*d-v>d/2;N&&(I-=d/4);for(var S=[],C=[],P=0;P<6;P++){var M=2*Math.PI/6*P;S.push(Math.cos(M)),C.push(Math.sin(M))}for(var L=[],O=0;O<=E;O++)for(var R=0;R<=w;R++){var T=O%2==1;if(!(0===R&&T||0===R&&N)){var A=O*_+i-b,D=R*m+o+I;if(T&&(D-=d/2),!0===n.triangles)Fd([A,D],c/2,h/2,JSON.parse(r),S,C).forEach((function(t){n.mask?Td(n.mask,t)&&L.push(t):L.push(t)}));else{var F=Dd([A,D],c/2,h/2,JSON.parse(r),S,C);n.mask?Td(n.mask,F)&&L.push(F):L.push(F)}}}return f(L)}function Dd(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],c=t[1]+n*o[a];s.push([u,c])}return s.push(s[0].slice()),l([s],r)}function Fd(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(l([u],r))}return s}function kd(t){return y(t)}function Gd(t,e,n){return void 0===n&&(n={}),function(t,e,n,r){void 0===r&&(r={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],c=e/ve([o,s],[a,s],r)*(a-o),h=n/ve([o,s],[o,u],r)*(u-s),p=a-o,g=u-s,d=Math.floor(p/c),y=Math.floor(g/h),v=(g-y*h)/2,_=o+(p-d*c)/2,m=0;m<d;m++){for(var x=s+v,E=0;E<y;E++){var b=l([[[_,x],[_,x+h],[_+c,x+h],[_+c,x],[_,x]]],r.properties);r.mask?us(r.mask,b)&&i.push(b):i.push(b),x+=h}_+=c}return f(i)}(t,e,e,n)}function qd(t,e,n){void 0===n&&(n={});for(var r=[],i=e/ve([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),o=e/ve([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,c=t[1];c<=t[3];){var h=null,p=null;s%2==0&&u%2==0?(h=l([[[a,c],[a,c+o],[a+i,c],[a,c]]],n.properties),p=l([[[a,c+o],[a+i,c+o],[a+i,c],[a,c+o]]],n.properties)):s%2==0&&u%2==1?(h=l([[[a,c],[a+i,c+o],[a+i,c],[a,c]]],n.properties),p=l([[[a,c],[a,c+o],[a+i,c+o],[a,c]]],n.properties)):u%2==0&&s%2==1?(h=l([[[a,c],[a,c+o],[a+i,c+o],[a,c]]],n.properties),p=l([[[a,c],[a+i,c+o],[a+i,c],[a,c]]],n.properties)):u%2==1&&s%2==1&&(h=l([[[a,c],[a,c+o],[a+i,c],[a,c]]],n.properties),p=l([[[a,c+o],[a+i,c+o],[a+i,c],[a,c+o]]],n.properties)),n.mask?(Td(n.mask,h)&&r.push(h),Td(n.mask,p)&&r.push(p)):(r.push(h),r.push(p)),c+=o,u++}s++,a+=i}return f(r)}return Cd.invert=function(t,e){var n=Rg(t*t+e*e),r=n,i=Og(r),o=Lg(r);return[Mg(t*i,n*o),Ag(n&&e*i/n)]},t.along=function(t,e,n){void 0===n&&(n={});for(var r=rt(t).coordinates,i=0,o=0;o<r.length&&!(e>=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var u=pn(r[o],r[o-1])-180;return cn(r[o],s,u,n)}return a(r[o])}i+=ve(r[o],r[o+1],n)}return a(r[r.length-1])},t.angle=function(t,e,n,r){if(void 0===r&&(r={}),!P(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!n)throw new Error("endPoint is required");var i=t,o=e,s=n,a=b(!0!==r.mercator?pn(i,o):bi(i,o)),u=b(!0!==r.mercator?pn(s,o):bi(s,o)),l=Math.abs(a-u);return!0===r.explementary?360-l:l},t.applyFilter=qa,t.area=Nr,t.areaFactors=i,t.bbox=Z,t.bboxClip=function(t,e){var n=rt(t),r=n.type,i="Feature"===t.type?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":var s=[];return"LineString"===r&&(o=[o]),o.forEach((function(t){!function(t,e,n){var r,i,o,s,a,u=t.length,l=gi(t[0],e),c=[];for(n||(n=[]),r=1;r<u;r++){for(s=t[r-1],i=o=gi(a=t[r],e);;){if(!(l|i)){c.push(s),i!==o?(c.push(a),r<u-1&&(n.push(c),c=[])):r===u-1&&c.push(a);break}if(l&i)break;l?l=gi(s=fi(s,a,l,e),e):i=gi(a=fi(s,a,i,e),e)}l=o}c.length&&n.push(c)}(t,e,s)})),1===s.length?h(s[0],i):g(s,i);case"Polygon":return l(di(o,e),i);case"MultiPolygon":return y(o.map((function(t){return di(t,e)})),i);default:throw new Error("geometry "+r+" not supported")}},t.bboxPolygon=an,t.bearing=pn,t.bearingToAngle=b,t.bearingToAzimuth=b,t.bezier=sn,t.bezierSpline=sn,t.booleanClockwise=Pi,t.booleanContains=function(t,e){var n=rt(t),r=rt(e),i=n.type,o=r.type,s=n.coordinates,a=r.coordinates;switch(i){case"Point":if("Point"===o)return Ko(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var n,r=!1;for(n=0;n<t.coordinates.length;n++)if(Ko(t.coordinates[n],e.coordinates)){r=!0;break}return r}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){for(var i=r[n],o=!1,s=0,a=t.coordinates;s<a.length;s++)if(Ko(i,a[s])){o=!0;break}if(!o)return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Or(r,n,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(Or({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(n=!0),!Or({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return n}(n,r);case"MultiPoint":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(Or(o,t,{ignoreEndVertices:!0})&&(n=!0),!Or(o,t))return!1}return!!n}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return ge(r,n,{ignoreBoundary:!0});case"LineString":return function(t,e){var n=!1,r=0;if(!Zo(Z(t),Z(e)))return!1;for(;r<e.coordinates.length-1;r++)if(ge({type:"Point",coordinates:Qo(e.coordinates[r],e.coordinates[r+1])},t,{ignoreBoundary:!0})){n=!0;break}return n}(n,r);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;if(!Zo(Z(t),Z(e)))return!1;for(var n=0,r=rt(e).coordinates;n<r.length;n++)for(var i=0,o=r[n];i<o.length;i++)if(!ge(o[i],t))return!1;return!0}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++)if(!ge(r[n],t,{ignoreBoundary:!0}))return!1;return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},t.booleanCrosses=function(t,e){var n=rt(t),r=rt(e),i=n.type,o=r.type;switch(i){case"MultiPoint":switch(o){case"LineString":return $o(n,r);case"Polygon":return es(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return $o(r,n);case"LineString":return function(t,e){if(gr(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),ns(t.coordinates[n],t.coordinates[n+1],e.coordinates[r],i))return!0}return!1}(n,r);case"Polygon":return ts(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return es(r,n);case"LineString":return ts(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},t.booleanDisjoint=Yo,t.booleanEqual=function(t,e){return rt(t).type===rt(e).type&&new as({precision:6}).compare(He(t),He(e))},t.booleanIntersects=us,t.booleanOverlap=function(t,e){var n=rt(t),r=rt(e),i=n.type,o=r.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new as({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<n.coordinates.length;a++)for(var u=0;u<r.coordinates.length;u++){var l=n.coordinates[a],c=r.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":U(t,(function(t){U(e,(function(e){mi(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":U(t,(function(t){U(e,(function(e){gr(t,e).features.length&&s++}))}))}return s>0},t.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Es(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Es(e,"line2"))throw new Error("line2 must be a LineString");for(var n=Un(He(t)).features,r=Un(He(e)).features,i=0;i<n.length;i++){var o=n[i].geometry.coordinates;if(!r[i])break;if(!xs(o,r[i].geometry.coordinates))return!1}return!0},t.booleanPointInPolygon=ge,t.booleanPointOnLine=Or,t.booleanWithin=Tr,t.buffer=function(t,e,n){var r=(n=n||{}).units||"kilometers",i=n.steps||8;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");var o=[];switch(t.type){case"GeometryCollection":return q(t,(function(t){var n=Md(t,e,r,i);n&&o.push(n)})),f(o);case"FeatureCollection":return F(t,(function(t){var n=Md(t,e,r,i);n&&F(n,(function(t){t&&o.push(t)}))})),f(o)}return Md(t,e,r,i)},t.center=fn,t.centerMean=ga,t.centerMedian=function(t,e){if(void 0===e&&(e={}),!P(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!C(n))throw new Error("counter must be a number");var r=e.weight,i=ga(t,{weight:e.weight}),o=f([]);F(t,(function(t){var e;o.features.push(gn(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[r]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return da(i.geometry.coordinates,[0,0],o,s,n)},t.centerOfMass=function t(e,n){switch(void 0===n&&(n={}),it(e)){case"Point":return a(K(e),n.properties);case"Polygon":var r=[];R(e,(function(t){r.push(t)}));var i,o,s,u,l,c,h,p,f=gn(e,{properties:n.properties}),g=f.geometry.coordinates,d=0,y=0,v=0,_=r.map((function(t){return[t[0]-g[0],t[1]-g[1]]}));for(i=0;i<r.length-1;i++)u=(o=_[i])[0],c=o[1],l=(s=_[i+1])[0],v+=p=u*(h=s[1])-l*c,d+=(u+l)*p,y+=(c+h)*p;if(0===v)return f;var m=1/(.5*v*6);return a([g[0]+m*d,g[1]+m*y],n.properties);default:var x=fe(e);return x?t(x,{properties:n.properties}):gn(e,{properties:n.properties})}},t.centroid=gn,t.circle=hn,t.cleanCoords=He,t.clone=be,t.clusterEach=Fa,t.clusterReduce=ka,t.clusters=ja,t.clustersDbscan=function(t,e,n){void 0===n&&(n={}),!0!==n.mutate&&(t=be(t)),n.minPoints=n.minPoints||3;var r=new fs.DBSCAN,i=r.run(G(t),N(e,n.units),n.minPoints,ve),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster=o,n.properties.dbscan="core"}))})),r.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){void 0===e&&(e={});var n=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(n/2)),e.numberOfClusters>n&&(e.numberOfClusters=n),!0!==e.mutate&&(t=be(t));var r=G(t),i=r.slice(0,e.numberOfClusters),o=ms(r,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),F(t,(function(t,e){var n=o.idxs[e];t.properties.cluster=n,t.properties.centroid=s[n]})),t},t.collect=function(t,e,n,r){var i=It(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[n]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=Z(t),n=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];n.forEach((function(e){ge([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[r]=o})),t},t.collectionOf=nt,t.combine=function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return F(t,(function(t){var n,r,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(n=e.MultiPoint.coordinates).push.apply(n,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(r=e.MultiLineString.coordinates).push.apply(r,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),f(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return o({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},t.concave=function(t,e){void 0===e&&(e={});var n=e.maxEdge||1/0,r=_e(function(t){var e=[],n={};return F(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(n,r)||(e.push(t),n[r]=!0)}})),f(e)}(t));if(r.features=r.features.filter((function(t){var r=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=ve(r,i,e),a=ve(i,o,e),u=ve(r,o,e);return s<=n&&a<=n&&u<=n})),r.features.length<1)return null;var i=Ye(r);return 1===i.coordinates.length&&(i.coordinates=i.coordinates[0],i.type="Polygon"),o(i)},t.containsNumber=$,t.convertArea=S,t.convertDistance=N,t.convertLength=N,t.convex=fe,t.coordAll=G,t.coordEach=R,t.coordReduce=T,t.createBins=Ga,t.degrees2radians=I,t.degreesToRadians=I,t.destination=cn,t.difference=function(t,e){var n=rt(t),r=rt(e),i=t.properties||{},o=Lu.difference(n.coordinates,r.coordinates);return 0===o.length?null:1===o.length?l(o[0],i):y(o,i)},t.dissolve=function(t,e){if(!P(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;nt(t,"Polygon","dissolve");var r=[];if(!e.propertyName)return qr(y(Lu.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};F(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[n])||(i[t.properties[n]]=[]),i[t.properties[n]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=y(Lu.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[n]=o[s],r.push(a)}return qr(f(r))},t.distance=ve,t.distanceToDegrees=E,t.distanceToRadians=x,t.distanceWeight=xa,t.earthRadius=e,t.ellipse=pa,t.envelope=un,t.explode=dn,t.factors=n,t.feature=o,t.featureCollection=f,t.featureEach=F,t.featureOf=et,t.featureReduce=k,t.filterProperties=za,t.findPoint=W,t.findSegment=H,t.flatten=qr,t.flattenEach=z,t.flattenReduce=j,t.flip=function(t,e){if(!P(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=be(t)),R(t,(function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e})),t},t.geojsonType=tt,t.geomEach=q,t.geomReduce=B,t.geometry=s,t.geometryCollection=v,t.getCluster=Da,t.getCoord=K,t.getCoords=Q,t.getGeom=rt,t.getType=it,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=K(t),e=K(e),r=r||{},i=i||100,o=o||10,new $r({x:t[0],y:t[1]},{x:e[0],y:e[1]},r).Arc(i,{offset:o}).json()},t.helpers=O,t.hexGrid=Ad,t.inside=ge,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(nt(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=Z(t);switch(r){case"point":case"points":s=kr(a,e,n);break;case"square":case"squares":s=Gd(a,e,n);break;case"hex":case"hexes":s=Ad(a,e,n);break;case"triangle":case"triangles":s=qd(a,e,n);break;default:throw new Error("invalid gridType")}var u=[];return F(s,(function(e){var s=0,a=0;F(t,(function(t){var u,l=ve("point"===r?e:gn(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===l&&(s=u);var c=1/Math.pow(l,o);a+=c,s+=c*u}));var l=be(e);l.properties[i]=s/a,u.push(l)})),f(u)},t.intersect=Td,t.invariant=ot,t.isNumber=C,t.isObject=P,t.isobands=function(t,e,n){if(!P(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(nt(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(!P(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=function(t,e){if(!P(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;nt(t,"Point","input must contain Points");for(var o=function(t,e){var n={};return F(t,(function(t){var e=Q(t)[1];n[e]||(n[e]=[]),n[e].push(t)})),Object.keys(n).map((function(t){return n[t].sort((function(t,e){return Q(t)[0]-Q(e)[0]}))})).sort((function(t,n){return e?Q(t[0])[1]-Q(n[0])[1]:Q(n[0])[1]-Q(t[0])[1]}))}
|
|
/*!
|
|
* @license GNU Affero General Public License.
|
|
* Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
|
|
* v. 1.2.0
|
|
* https://github.com/RaumZeit/MarchingSquares.js
|
|
*
|
|
* MarchingSquaresJS is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* MarchingSquaresJS is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* As additional permission under GNU Affero General Public License version 3
|
|
* section 7, third-party projects (personal or commercial) may distribute,
|
|
* include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
|
|
* requirement that said third-party project for that reason alone becomes
|
|
* subject to any requirement of the GNU Affero General Public License version 3.
|
|
* Any modifications to MarchingSquaresJS, however, must be shared with the public
|
|
* and made available.
|
|
*
|
|
* In summary this:
|
|
* - allows you to use MarchingSquaresJS at no cost
|
|
* - allows you to use MarchingSquaresJS for both personal and commercial purposes
|
|
* - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
|
|
* license as long as this license notice is included
|
|
* - enables you to keep the source code of your program that uses MarchingSquaresJS
|
|
* undisclosed
|
|
* - forces you to share any modifications you have made to MarchingSquaresJS,
|
|
* e.g. bug-fixes
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
*/(t,r),s=[],a=0;a<o.length;a++){for(var u=o[a],l=[],c=0;c<u.length;c++){var h=u[c];h.properties[n]?l.push(h.properties[n]):l.push(0),!0===i&&(h.properties.matrixPosition=[a,c])}s.push(l)}return s}(t,{zProperty:r,flip:!0}),a=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=Oo(Lo(Ai(t,o,s-o))),u={};u.groupedRings=a,u[n]=o+"-"+s,r.push(u)}return r}(s,e,r);return f((a=function(t,e,n){var r=Z(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,p=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(p)}))}))})),t}(a,s,t)).map((function(t,e){if(o[e]&&!P(o[e]))throw new Error("Each mappedProperty is required to be an Object");var n=ct({},i,o[e]);return n[r]=t[r],y(t.groupedRings,n)})))},t.isolines=function(t,e,n){if(!P(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(nt(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(!P(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(!P(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;nt(t,"Point","input must contain Points");for(var o=function(t,e){var n={};return F(t,(function(t){var e=Q(t)[1];n[e]||(n[e]=[]),n[e].push(t)})),Object.keys(n).map((function(t){return n[t].sort((function(t,e){return Q(t)[0]-Q(e)[0]}))})).sort((function(t,n){return e?Q(t[0])[1]-Q(n[0])[1]:Q(n[0])[1]-Q(t[0])[1]}))}(t,r),s=[],a=0;a<o.length;a++){for(var u=o[a],l=[],c=0;c<u.length;c++){var h=u[c];h.properties[n]?l.push(h.properties[n]):l.push(0),!0===i&&(h.properties.matrixPosition=[a,c])}s.push(l)}return s}(t,{zProperty:r,flip:!0});return f(function(t,e,n){var r=Z(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,p=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){R(t,p)})),t}(function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=ct({},r,i[s]);u[n]=a;var l=g(ft(t,a),u);o.push(l)}return o}(s,e,r,i,o),s,t))},t.kinks=function(t){var e,n,r={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 i=n;i<e.length-1;i++){if(t===e){if(1===Math.abs(n-i))continue;if(0===n&&i===t.length-2&&t[n][0]===t[t.length-1][0]&&t[n][1]===t[t.length-1][1])continue}var o=Er(t[n][0],t[n][1],t[n+1][0],t[n+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&r.features.push(a([o[0],o[1]]))}}))})),r},t.length=Mr,t.lengthToDegrees=E,t.lengthToRadians=x,t.lineArc=ii,t.lineChunk=function(t,e,n){if(!P(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 z(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,n,r){var i=Mr(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(Lr(t,e*s,e*(s+1),{units:n}))}(t,e,r,(function(t){o.push(t)}))})),f(o)},t.lineDistance=Mr,t.lineEach=X,t.lineIntersect=gr,t.lineOffset=function(t,e,n){if(!P(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=it(t),o=t.properties;switch(i){case"LineString":return qo(t,e,r);case"MultiLineString":var s=[];return z(t,(function(t){s.push(qo(t,e,r).geometry.coordinates)})),g(s,o);default:throw new Error("geometry "+i+" is not supported")}},t.lineOverlap=mi,t.lineReduce=Y,t.lineSegment=Un,t.lineSlice=function(t,e,n){var r=Q(n);if("LineString"!==it(n))throw new Error("line must be a LineString");for(var i,o=yr(n,t),s=yr(n,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(r[u]);return a.push(i[1].geometry.coordinates),h(a,n.properties)},t.lineSliceAlong=Lr,t.lineSplit=function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=it(t),r=it(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=Gr(e,{precision:7});switch(r){case"Point":return ei(t,i);case"MultiPoint":return ti(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return ti(t,gr(t,i))}},t.lineString=h,t.lineStringToPolygon=li,t.lineStrings=p,t.lineToPolygon=li,t.mask=function(t,e){var n,r=function(t){return l(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}(e);return("FeatureCollection"===t.type?kd(2===(n=t).features.length?Lu.union(n.features[0].geometry.coordinates,n.features[1].geometry.coordinates):Lu.union.apply(Lu,n.features.map((function(t){return t.geometry.coordinates})))):kd(Lu.union(t.geometry.coordinates))).geometry.coordinates.forEach((function(t){r.geometry.coordinates.push(t[0])})),r},t.meta=J,t.midpoint=function(t,e){return cn(t,ve(t,e)/2,pn(t,e))},t.moranIndex=function(t,e){var n=e.inputField,r=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=xa(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:r}),a=[];F(t,(function(t){var e=t.properties||{};a.push(e[n])}));for(var u=Ea(a),l=function(t){for(var e=Ea(t),n=0,r=0,i=t;r<i.length;r++){var o=i[r];n+=Math.pow(o-e,2)}return n/t.length}(a),c=0,h=0,p=0,f=0,g=s.length,d=0;d<g;d++){for(var y=0,v=0;v<g;v++)c+=s[d][v]*(a[d]-u)*(a[v]-u),h+=s[d][v],p+=Math.pow(s[d][v]+s[v][d],2),y+=s[d][v]+s[v][d];f+=Math.pow(y,2)}var _=c/h/l,m=-1/(g-1),x=(g*g*(p*=.5)-g*f+h*h*3)/((g-1)*(g+1)*(h*h))-m*m,E=Math.sqrt(x);return{expectedMoranIndex:m,moranIndex:_,stdNorm:E,zNorm:(_-m)/E}},t.multiLineString=g,t.multiPoint=d,t.multiPolygon=y,t.nearest=jn,t.nearestPoint=jn,t.nearestPointOnLine=yr,t.nearestPointToLine=function(t,e,n){void 0===n&&(n={});var r=n.units,i=n.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return q(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);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==it(e))throw new Error("line must be a LineString");var s=1/0,a=null;return F(o,(function(t){var n=_r(t,e,{units:r});n<s&&(s=n,a=t)})),a&&(a.properties=ct({dist:s},a.properties,i)),a},t.planepoint=function(t,e){var n=K(t),r=rt(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],l=n[1],c=r[0][0],h=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],v=r[2][1],_=void 0!==a?a:r[2][2];return(_*(u-c)*(l-g)+p*(u-f)*(l-v)+d*(u-y)*(l-h)-d*(u-c)*(l-v)-_*(u-f)*(l-h)-p*(u-y)*(l-g))/((u-c)*(l-g)+(u-f)*(l-v)+(u-y)*(l-h)-(u-c)*(l-v)-(u-f)*(l-h)-(u-y)*(l-g))},t.point=a,t.pointGrid=kr,t.pointOnFeature=br,t.pointOnLine=yr,t.pointOnSurface=br,t.pointToLineDistance=_r,t.points=u,t.pointsWithinPolygon=ye,t.polygon=l,t.polygonSmooth=function(t,e){var n=[],r=e.iterations||1;if(!t)throw new Error("inputPolys is required");return q(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<r;u++)a=[[]],s=t,u>0&&(s=l(o).geometry),va(s,a),o=a.slice(0);n.push(l(o,i));break;case"MultiPolygon":o=[[[]]];for(var c=0;c<r;c++)a=[[[]]],s=t,c>0&&(s=y(o).geometry),_a(s,a),o=a.slice(0);n.push(y(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),f(n)},t.polygonTangents=function(t,e){var n,r,i,o,s=Q(t),u=Q(e),l=Z(e),c=0,h=null;switch(s[0]>l[0]&&s[0]<l[2]&&s[1]>l[1]&&s[1]<l[3]&&(c=(h=jn(t,dn(e))).properties.featureIndex),it(e)){case"Polygon":n=u[0][c],r=u[0][0],null!==h&&h.geometry.coordinates[1]<s[1]&&(r=u[0][c]),o=Ci(u[0][0],u[0][u[0].length-1],s);var p=Ni(u[0],s,o,i,n,r);n=p[0],r=p[1];break;case"MultiPolygon":for(var g=0,d=0,y=0,v=0;v<u[0].length;v++){g=v;for(var _=!1,m=0;m<u[0][v].length;m++){if(d=m,y===c){_=!0;break}y++}if(_)break}n=u[0][g][d],r=u[0][g][d],o=Ci(u[0][0][0],u[0][0][u[0][0].length-1],s),u.forEach((function(t){var e=Ni(t[0],s,o,i,n,r);n=e[0],r=e[1]}))}return f([a(n),a(r)])},t.polygonToLine=si,t.polygonToLineString=si,t.polygonize=function(t){var e=Xo.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){Vo.findEdgeRingContaining(t,r)&&r.push(t)})),f(r.map((function(t){return t.toPolygon()})))},t.polygons=c,t.projection=Ca,t.propEach=A,t.propReduce=D,t.propertiesContainsFilter=Ba,t.radians2degrees=w,t.radiansToDegrees=w,t.radiansToDistance=m,t.radiansToLength=m,t.random=Aa,t.randomLineString=Oa,t.randomPoint=Ma,t.randomPolygon=La,t.randomPosition=Pa,t.rewind=function(t,e){if(!P(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=be(t));var i=[];switch(t.type){case"GeometryCollection":return q(t,(function(t){Mi(t,n)})),t;case"FeatureCollection":return F(t,(function(t){F(Mi(t,n),(function(t){i.push(t)}))})),f(i)}return Mi(t,n)},t.rhumbBearing=bi,t.rhumbDestination=Ii,t.rhumbDistance=vr,t.round=_,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 f(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.sector=function(t,e,n,r,i){if(!P(i=i||{}))throw new Error("options is invalid");var o=i.properties;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(Ei(n)===Ei(r))return hn(t,e,i);var s=Q(t),a=ii(t,e,n,r,i),u=[[s]];return R(a,(function(t){u[0].push(t)})),u[0].push(s),l(u,o)},t.segmentEach=U,t.segmentReduce=V,t.shortestPath=function(t,e,n){if(!P(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,s=n.obstacles||f([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!C(r)||r<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var u=K(t),l=K(e);switch(t=a(u),e=a(l),it(s)){case"FeatureCollection":if(0===s.features.length)return h([u,l]);break;case"Polygon":s=f([o(rt(s))]);break;default:throw new Error("invalid obstacles")}var c=s;c.features.push(t),c.features.push(e);var p=Z(Do(an(Z(c)),1.15));r||(r=ve([p[0],p[1]],[p[2],p[1]],n)/100),c.features.pop(),c.features.pop();for(var g=p[0],d=p[1],y=p[2],v=p[3],_=r/ve([g,d],[y,d],n)*(y-g),m=r/ve([g,d],[g,v],n)*(v-d),x=y-g,E=v-d,b=Math.floor(x/_),w=Math.floor(E/m),I=(x-b*_)/2,N=[],S=[],M=[],L=[],O=1/0,R=1/0,T=v-(E-w*m)/2,A=0;T>=d;){for(var D=[],F=[],k=g+I,G=0;k<=y;){var q=a([k,T]),B=Cs(q,s);D.push(B?0:1),F.push(k+"|"+T);var z=ve(q,t);!B&&z<O&&(O=z,M={x:G,y:A});var j=ve(q,e);!B&&j<R&&(R=j,L={x:G,y:A}),k+=_,G++}S.push(D),N.push(F),T-=m,A++}var U=new Is(S,{diagonal:!0}),V=U.grid[M.y][M.x],X=U.grid[L.y][L.x],Y=ws.search(U,V,X),H=[u];return Y.forEach((function(t){var e=N[t.x][t.y].split("|");H.push([+e[0],+e[1]])})),H.push(l),He(h(H))},t.simplify=function(t,e){if(!P(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=be(t)),q(t,(function(t){!function(t,e,n){var r=t.type;if("Point"===r||"MultiPoint"===r)return t;He(t,!0);var i=t.coordinates;switch(r){case"LineString":t.coordinates=en(i,e,n);break;case"MultiLineString":t.coordinates=i.map((function(t){return en(t,e,n)}));break;case"Polygon":t.coordinates=nn(i,e,n);break;case"MultiPolygon":t.coordinates=i.map((function(t){return nn(t,e,n)}))}}(t,n,r)})),t},t.square=ln,t.squareGrid=Gd,t.standardDeviationalEllipse=function(t,e){if(!P(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!C(n))throw new Error("steps must be a number");if(!P(i))throw new Error("properties must be a number");var o=G(t).length,s=ga(t,{weight:r}),a=0,u=0,l=0;F(t,(function(t){var e=t.properties[r]||1,n=ya(Q(t),Q(s));a+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,l+=n.x*n.y*e}));var c=a-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),p=2*l,g=Math.atan((c+h)/p),d=180*g/Math.PI,y=0,v=0,_=0;F(t,(function(t){var e=t.properties[r]||1,n=ya(Q(t),Q(s));y+=Math.pow(n.x*Math.cos(g)-n.y*Math.sin(g),2)*e,v+=Math.pow(n.x*Math.sin(g)+n.y*Math.cos(g),2)*e,_+=e}));var m=Math.sqrt(2*y/_),x=Math.sqrt(2*v/_),E=pa(s,m,x,{units:"degrees",angle:d,steps:n,properties:i}),b=ye(t,f([E])),w={meanCenterCoordinates:Q(s),semiMajorAxis:m,semiMinorAxis:x,numberOfFeatures:o,angle:d,percentageWithinEllipse:100*G(b).length/o};return E.properties.standardDeviationalEllipse=w,E},t.tag=function(t,e,n,r){return t=be(t),e=be(e),F(t,(function(t){t.properties||(t.properties={}),F(e,(function(e){void 0===t.properties[r]&&ge(t,e)&&(t.properties[r]=e.properties[n])}))})),t},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=zn(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(zn(t))})),e},t.tin=_e,t.toMercator=ba,t.toWgs84=wa,t.transformRotate=Ao,t.transformScale=Do,t.transformTranslate=function(t,e,n,r){if(!P(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+=180),!1!==s&&void 0!==s||(t=be(t)),R(t,(function(t){var r=Q(Ii(t,e,n,{units:i}));t[0]=r[0],t[1]=r[1],o&&3===t.length&&(t[2]+=o)})),t},t.triangleGrid=qd,t.truncate=Gr,t.union=function(t,e,n){void 0===n&&(n={});var r=rt(t),i=rt(e),o=Lu.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?l(o[0],n.properties):y(o,n.properties)},t.unitsFactors=r,t.unkinkPolygon=function(t){var e=[];return z(t,(function(t){"Polygon"===t.geometry.type&&F(zr(t),(function(n){e.push(l(n.geometry.coordinates,t.properties))}))})),f(e)},t.validateBBox=M,t.validateId=L,t.voronoi=function(t,e){if(!P(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 nt(t,"Point","points"),f(function(){var t=Ms,e=Ls,n=null;function r(r){return new ca(r.map((function(n,i){var o=[Math.round(t(n,i,r)/aa)*aa,Math.round(e(n,i,r)/aa)*aa];return o.index=i,o.data=n,o})),n)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(e){return arguments.length?(t="function"==typeof e?e:Ps(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:Ps(+t),r):e},r.extent=function(t){return arguments.length?(n=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):n&&[[n[0][0],n[0][1]],[n[1][0],n[1][1]]]},r.size=function(t){return arguments.length?(n=null==t?null:[[0,0],[+t[0],+t[1]]],r):n&&[n[1][0]-n[0][0],n[1][1]-n[0][1]]},r}().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(ha))},t.within=ye,Object.defineProperty(t,"__esModule",{value:!0}),t}));
|