Measure Area and Length of Polygon

DISCLAIMER: This example was created before additional GEOMETRY-related functions were added. Please consider using those instead of the turf.js library.

The example below uses the turf.js library to calculate the area and length of a polygon collected in Fulcrum. NOTE: You will need to enable Lines and Polygons for an app in order for this data event to work.

!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).turf=t()}(function(){return function r(i,o,s){function a(e,t){if(!o[e]){if(!i[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(u)return u(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=o[e]={exports:{}},i[e][0].call(n.exports,function(t){return a(i[e][1][t]||t)},n,n.exports,r,i,o,s)}return o[e].exports}for(var u="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,n){var r,i,e=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return(r=setTimeout)(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}var u,l=[],h=!1,c=-1;function p(){h&&u&&(h=!1,u.length?l=u.concat(l):c=-1,l.length)&&f()}function f(){if(!h){for(var t=a(p),e=(h=!0,l.length);e;){for(u=l,l=[];++c<e;)u&&u[c].run();c=-1,e=l.length}u=null,h=!1,!function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return(i=clearTimeout)(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function d(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new g(t,e)),1!==l.length||h||a(f)},g.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=d,e.addListener=d,e.once=d,e.off=d,e.removeListener=d,e.removeAllListeners=d,e.emit=d,e.prependListener=d,e.prependOnceListener=d,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}],"@turf/turf":[function(t,e,n){!function(fd){!function(){var t;t=this,function(t){"use strict";var q=6371008.8,i={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*q,kilometers:6371.0088,kilometres:6371.0088,meters:q,metres:q,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:q/1852,radians:1,yards:6967335.223679999},n={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/q,yards:1.0936133},o={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 B(t,e,n){var r={type:"Feature"};return 0!==(n=void 0===n?{}:n).id&&!n.id||(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function z(t,e,n){switch(t){case"Point":return R(e).geometry;case"LineString":return V(e).geometry;case"Polygon":return k(e).geometry;case"MultiPoint":return H(e).geometry;case"MultiLineString":return Y(e).geometry;case"MultiPolygon":return W(e).geometry;default:throw new Error(t+" is invalid")}}function R(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(ot(t[0])&&ot(t[1]))return B({type:"Point",coordinates:t},e,n);throw new Error("coordinates must contain numbers")}function j(t,e,n){return void 0===n&&(n={}),G(t.map(function(t){return R(t,e)}),n)}function k(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return B({type:"Polygon",coordinates:t},e,n)}function U(t,e,n){return void 0===n&&(n={}),G(t.map(function(t){return k(t,e)}),n)}function V(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 B({type:"LineString",coordinates:t},e,n)}function X(t,e,n){return void 0===n&&(n={}),G(t.map(function(t){return V(t,e)}),n)}function G(t,e){var n={type:"FeatureCollection"};return(e=void 0===e?{}:e).id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function Y(t,e,n){return B({type:"MultiLineString",coordinates:t},e,n=void 0===n?{}:n)}function H(t,e,n){return B({type:"MultiPoint",coordinates:t},e,n=void 0===n?{}:n)}function W(t,e,n){return B({type:"MultiPolygon",coordinates:t},e,n=void 0===n?{}:n)}function J(t,e,n){return B({type:"GeometryCollection",geometries:t},e,n=void 0===n?{}:n)}function Z(t,e){if(!(e=void 0===e?0:e)||0<=e)return e=Math.pow(10,e||0),Math.round(t*e)/e;throw new Error("precision must be a positive number")}function K(t,e){var n=i[e=void 0===e?"kilometers":e];if(n)return t*n;throw new Error(e+" units is invalid")}function Q(t,e){var n=i[e=void 0===e?"kilometers":e];if(n)return t/n;throw new Error(e+" units is invalid")}function $(t,e){return et(Q(t,e))}function tt(t){t%=360;return t<0&&(t+=360),t}function et(t){return t%(2*Math.PI)*180/Math.PI}function nt(t){return t%360*Math.PI/180}function rt(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),0<=t)return K(Q(t,e),n);throw new Error("length must be a positive number")}function it(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(0<=t))throw new Error("area must be a positive number");e=o[e];if(!e)throw new Error("invalid original units");n=o[n];if(n)return t/e*n;throw new Error("invalid final units")}function ot(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function st(t){return!!t&&t.constructor===Object}function at(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(!ot(t))throw new Error("bbox must only contain numbers")})}function ut(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 lt=Object.freeze({__proto__:null,earthRadius:q,factors:i,unitsFactors:n,areaFactors:o,feature:B,geometry:z,point:R,points:j,polygon:k,polygons:U,lineString:V,lineStrings:X,featureCollection:G,multiLineString:Y,multiPoint:H,multiPolygon:W,geometryCollection:J,round:Z,radiansToLength:K,lengthToRadians:Q,lengthToDegrees:$,bearingToAzimuth:tt,radiansToDegrees:et,degreesToRadians:nt,convertLength:rt,convertArea:it,isNumber:ot,isObject:st,validateBBox:at,validateId:ut});function ht(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l=0,h=t.type,c="FeatureCollection"===h,p="Feature"===h,f=c?t.features.length:1,g=0;g<f;g++)for(var d=(u=!!(a=c?t.features[g].geometry:p?t.geometry:t)&&"GeometryCollection"===a.type)?a.geometries.length:1,y=0;y<d;y++){var _=0,m=0;if(null!==(s=u?a.geometries[y]:a)){var v=s.coordinates,x=s.type,E=!n||"Polygon"!==x&&"MultiPolygon"!==x?0:1;switch(x){case null:break;case"Point":if(!1===e(v,l,g,_,m))return!1;l++,_++;break;case"LineString":case"MultiPoint":for(r=0;r<v.length;r++){if(!1===e(v[r],l,g,_,m))return!1;l++,"MultiPoint"===x&&_++}"LineString"===x&&_++;break;case"Polygon":case"MultiLineString":for(r=0;r<v.length;r++){for(i=0;i<v[r].length-E;i++){if(!1===e(v[r][i],l,g,_,m))return!1;l++}"MultiLineString"===x&&_++,"Polygon"===x&&m++}"Polygon"===x&&_++;break;case"MultiPolygon":for(r=0;r<v.length;r++){for(i=m=0;i<v[r].length;i++){for(o=0;o<v[r][i].length-E;o++){if(!1===e(v[r][i][o],l,g,_,m))return!1;l++}m++}_++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===ht(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function ct(t,o,s,e){var a=s;return ht(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)},e),a}function pt(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 ft(t,n,r){var i=r;return pt(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function gt(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 dt(t,n,r){var i=r;return gt(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function yt(t){var e=[];return ht(t,function(t){e.push(t)}),e}function _t(t,e){for(var n,r,i,o,s,a,u,l,h,c=0,p="FeatureCollection"===t.type,f="Feature"===t.type,g=p?t.features.length:1,d=0;d<g;d++){for(s=p?t.features[d].geometry:f?t.geometry:t,u=p?t.features[d].properties:f?t.properties:{},l=p?t.features[d].bbox:f?t.bbox:void 0,h=p?t.features[d].id:f?t.id:void 0,o=(a=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,r=0;r<o;r++)if(null!==(i=a?s.geometries[r]:s))switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(i,c,u,l,h))return!1;break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===e(i.geometries[n],c,u,l,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,c,u,l,h))return!1;c++}}function mt(t,o,s){var a=s;return _t(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)}),a}function vt(t,l){_t(t,function(t,e,n,r,i){var o,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==l(B(t,n,{bbox:r,id:i}),e,0)&&void 0}switch(s){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}for(var a=0;a<t.coordinates.length;a++){var u=t.coordinates[a];if(!1===l(B({type:o,coordinates:u},n),e,a))return!1}})}function xt(t,r,i){var o=i;return vt(t,function(t,e,n){o=0===e&&0===n&&void 0===i?t:r(o,t,e,n)}),o}function Et(t,g){vt(t,function(s,a,u){var l=0;if(s.geometry){var h,c,p,f,t=s.geometry.type;if("Point"!==t&&"MultiPoint"!==t)return f=p=c=0,!1!==ht(s,function(t,e,n,r,i){var o;if(!(void 0===h||c<a||p<r||f<i))return o=V([h,t],s.properties),!1!==g(o,a,u,i,l)&&(l++,void(h=t));h=t,c=a,p=r,f=i,l=0})&&void 0}})}function bt(t,o,s){var a=s,u=!1;return Et(t,function(t,e,n,r,i){a=!1===u&&void 0===s?t:o(a,t,e,n,r,i),u=!0}),a}function wt(t,s){if(!t)throw new Error("geojson is required");vt(t,function(t,e,n){if(null!==t.geometry){var r=t.geometry.type,i=t.geometry.coordinates;switch(r){case"LineString":if(!1===s(t,e,n,0,0))return!1;break;case"Polygon":for(var o=0;o<i.length;o++)if(!1===s(V(i[o],t.properties),e,n,o))return!1}}})}function It(t,i,o){var s=o;return wt(t,function(t,e,n,r){s=0===e&&void 0===o?t:i(s,t,e,n,r)}),s}function Nt(t,e){if(!st(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 V([u[s=s<0?u.length+s-1:s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),V([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),V([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),V([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function St(t,e){if(!st(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,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 R(u,a,e);case"MultiPoint":return R(u[i=i<0?u.length+i:i],a,e);case"LineString":return R(u[s=s<0?u.length+s:s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),R(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),R(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),R(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var Ct=Object.freeze({__proto__:null,coordAll:yt,coordEach:ht,coordReduce:ct,featureEach:gt,featureReduce:dt,findPoint:St,findSegment:Nt,flattenEach:vt,flattenReduce:xt,geomEach:_t,geomReduce:mt,lineEach:wt,lineReduce:It,propEach:pt,propReduce:ft,segmentEach:Et,segmentReduce:bt});function Pt(t){var e=[1/0,1/0,-1/0,-1/0];return ht(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 Mt(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)&&2<=t.length&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function _(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 Lt(t){if(1<t.length&&ot(t[0])&&ot(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Lt(t[0]);throw new Error("coordinates must only contain numbers")}function Ot(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 Rt(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 Tt(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 At(t){return"Feature"===t.type?t.geometry:t}function Dt(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":("Feature"===t.type&&null!==t.geometry?t.geometry:t).type}Pt.default=Pt;var Ft=Object.freeze({__proto__:null,getCoord:Mt,getCoords:_,containsNumber:Lt,geojsonType:Ot,featureOf:Rt,collectionOf:Tt,getGeom:At,getType:Dt}),kt=Object.getOwnPropertySymbols,Gt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var Bt=function(){try{if(Object.assign){var t=new String("abc");if(t[5]="de","5"!==Object.getOwnPropertyNames(t)[0]){for(var e,n={},r=0;r<10;r++)n["_"+String.fromCharCode(r)]=r;if("0123456789"===Object.getOwnPropertyNames(n).map(function(t){return n[t]}).join(""))return e={},"abcdefghijklmnopqrst".split("").forEach(function(t){e[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},e)).join("")}}}catch(t){}}()?Object.assign:function(t,e){for(var n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),i=1;i<arguments.length;i++){for(var o in n=Object(arguments[i]))Gt.call(n,o)&&(r[o]=n[o]);if(kt)for(var s=kt(n),a=0;a<s.length;a++)qt.call(n,s[a])&&(r[s[a]]=n[s[a]])}return r},zt={successCallback:null,verbose:!1},jt={};function Ut(t,e,n){return(t-e)/(n-e)}function Vt(t){return 0===t.cval||15===t.cval}function Xt(t){Vt(t)||5===t.cval||10===t.cval||(t.cval=15)}function Yt(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 Ht=Wt;function Wt(t,e,n,r,i){!function t(e,n,r,i,o){for(;r<i;){600<i-r&&(s=i-r+1,a=n-r+1,l=Math.log(s),u=.5*Math.exp(2*l/3),l=.5*Math.sqrt(l*u*(s-u)/s)*(a-s/2<0?-1:1),t(e,n,Math.max(r,Math.floor(n-a*u/s+l)),Math.min(i,Math.floor(n+(s-a)*u/s+l)),o));var s,a,u,l,h=e[n],c=r,p=i;for(Jt(e,r,n),0<o(e[i],h)&&Jt(e,r,i);c<p;){for(Jt(e,c,p),c++,p--;o(e[c],h)<0;)c++;for(;0<o(e[p],h);)p--}0===o(e[r],h)?Jt(e,r,p):Jt(e,++p,i),p<=n&&(r=p+1),n<=p&&(i=p-1)}}(t,e,n||0,r||t.length-1,i||Zt)}function Jt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Zt(t,e){return t<e?-1:e<t?1:0}Ht.default=Wt;var Kt=$t,Qt=$t;function $t(t,e){if(!(this instanceof $t))return new $t(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 te(t,e){ee(t,0,t.children.length,e,t)}function ee(t,e,n,r,i){(i=i||le(null)).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],ne(i,t.leaf?r(o):o);return i}function ne(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 re(t,e){return t.minX-e.minX}function ie(t,e){return t.minY-e.minY}function oe(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function se(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ae(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function ue(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function le(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function he(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,Ht(t,o,e,n,i),s.push(e,o,o,n))}function ce(t){var e={exports:{}};return t(e,e.exports),e.exports}$t.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(ue(t,e))for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],ue(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):ae(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(ue(t,e))for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],ue(t,s=e.leaf?n(o):o)){if(e.leaf||ae(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(t&&t.length)if(t.length<this._minEntries)for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);else{var r,i=this._build(t.slice(),0,t.length-1,0);this.data.children.length?this.data.height===i.height?this._splitRoot(this.data,i):(this.data.height<i.height&&(r=this.data,this.data=i,i=r),this._insert(i,this.data.height-i.height-1,!0)):this.data=i}return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=le([]),this},remove:function(t,e){if(t)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=function(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!ae(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),l.push(n),s=(r=s).children[n=0])}return this},toBBox:function(t){return t},compareMinX:re,compareMinY:ie,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)te(i=le(t.slice(e,n+1)),this.toBBox);else{r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=le([])).leaf=!1,i.height=r;var a,u,l,h,c=Math.ceil(o/s),p=c*Math.ceil(Math.sqrt(s));for(he(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(he(t,a,l=Math.min(a+p-1,n),c,this.compareMinY),u=a;u<=l;u+=c)h=Math.min(u+c-1,l),i.children.push(this._build(t,u,h,r-1));te(i,this.toBBox)}return i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,l,h,c,p;r.push(e),!e.leaf&&r.length-1!==n;){for(l=h=1/0,i=0,o=e.children.length;i<o;i++)u=oe(s=e.children[i]),c=t,p=s,(p=(Math.max(p.maxX,c.maxX)-Math.min(p.minX,c.minX))*(Math.max(p.maxY,c.maxY)-Math.min(p.minY,c.minY))-u)<h?(h=p,l=u<l?u:l,a=s):p===h&&u<l&&(l=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,n=n?t:r(t),i=[],r=this._chooseSubtree(n,this.data,e,i);for(r.children.push(t),ne(r,n);0<=e&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries,i=(this._chooseSplitAxis(n,i,r),this._chooseSplitIndex(n,i,r)),r=le(n.children.splice(i,n.children.length-i));r.height=n.height,r.leaf=n.leaf,te(n,this.toBBox),te(r,this.toBBox),e?t[e-1].children.push(r):this._splitRoot(n,r)},_splitRoot:function(t,e){this.data=le([t,e]),this.data.height=t.height+1,this.data.leaf=!1,te(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){for(var r,i,o,s,a,u,l,h,c,p=o=1/0,f=e;f<=n-e;f++)c=r=ee(t,0,f,this.toBBox),a=i=ee(t,f,n,this.toBBox),0,u=Math.max(c.minX,a.minX),l=Math.max(c.minY,a.minY),h=Math.min(c.maxX,a.maxX),c=Math.min(c.maxY,a.maxY),a=Math.max(0,h-u)*Math.max(0,c-l),h=oe(r)+oe(i),a<p?(p=a,s=f,o=h<o?h:o):a===p&&h<o&&(o=h,s=f);return s},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:re,i=t.leaf?this.compareMinY:ie;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);for(var i,o=this.toBBox,s=ee(t,0,e,o),a=ee(t,n-e,n,o),u=se(s)+se(a),l=e;l<n-e;l++)i=t.children[l],ne(s,t.leaf?o(i):i),u+=se(s);for(l=n-e-1;e<=l;l--)i=t.children[l],ne(a,t.leaf?o(i):i),u+=se(a);return u},_adjustParentBBoxes:function(t,e,n){for(var r=n;0<=r;r--)ne(e[r],t)},_condense:function(t){for(var e,n=t.length-1;0<=n;n--)0===t[n].children.length?0<n?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():te(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]+"};")}},Kt.default=Qt;function pe(t,e){var n,r,i,o,s=0|t.length,a=0|e.length;if(1==s&&1==a)return n=t[0],r=e[0],(n=n-((i=n+r)-(o=i-n))+(r-o))?[n,i]:[i];var u,l,h=new Array(s+a),c=0,p=0,f=0,g=Math.abs,d=t[p],y=g(d),_=e[f],m=g(_);y<m?(l=d,(p+=1)<s&&(y=g(d=t[p]))):(l=_,(f+=1)<a&&(m=g(_=e[f]))),p<s&&y<m||a<=f?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=e[f])));for(var v,x,E=u+l,b=l-(E-u),w=b,I=E;p<s&&f<a;)y<m?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=e[f]))),(b=(l=w)-((E=u+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v;for(;p<s;)(b=(l=w)-((E=(u=d)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(p+=1)<s&&(d=t[p]);for(;f<a;)(b=(l=w)-((E=(u=_)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(f+=1)<a&&(_=e[f]);return w&&(h[c++]=w),I&&(h[c++]=I),c||(h[c++]=0),h.length=c,h}function fe(t,e){var n,r=t.length;if(1===r)return(n=de(t[0],e))[0]?n:[n[1]];var i=new Array(2*r),o=[.1,.1],s=[.1,.1],a=0;de(t[0],e,o),o[0]&&(i[a++]=o[0]);for(var u=1;u<r;++u){de(t[u],e,s);var l=o[1],l=(_e(l,s[0],o),o[0]&&(i[a++]=o[0]),s[1]),h=o[1],c=l+h,h=h-(c-l);o[1]=c,h&&(i[a++]=h)}return o[1]&&(i[a++]=o[1]),0===a&&(i[a++]=0),i.length=a,i}function ge(t,e){var n,r,i,o,s=0|t.length,a=0|e.length;if(1==s&&1==a)return n=t[0],r=-e[0],(n=n-((i=n+r)-(o=i-n))+(r-o))?[n,i]:[i];var u,l,h=new Array(s+a),c=0,p=0,f=0,g=Math.abs,d=t[p],y=g(d),_=-e[f],m=g(_);y<m?(l=d,(p+=1)<s&&(y=g(d=t[p]))):(l=_,(f+=1)<a&&(m=g(_=-e[f]))),p<s&&y<m||a<=f?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=-e[f])));for(var v,x,E=u+l,b=l-(E-u),w=b,I=E;p<s&&f<a;)y<m?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=-e[f]))),(b=(l=w)-((E=u+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v;for(;p<s;)(b=(l=w)-((E=(u=d)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(p+=1)<s&&(d=t[p]);for(;f<a;)(b=(l=w)-((E=(u=_)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(f+=1)<a&&(_=-e[f]);return w&&(h[c++]=w),I&&(h[c++]=I),c||(h[c++]=0),h.length=c,h}var de=function(t,e,n){var r=t*e,i=ye*t,i=i-(i-t),t=t-i,o=ye*e,o=o-(o-e),e=e-o,t=t*e-(r-i*o-t*o-i*e);return n?(n[0]=t,n[1]=r,n):[t,r]},ye=+(Math.pow(2,27)+1),_e=function(t,e,n){var r=t+e,i=r-t,e=e-i,t=t-(r-i);return n?(n[0]=t+e,n[1]=r,n):[t+e,r]},Qt=ce(function(t){function l(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 h(t){var e;return 1===t.length?t[0]:(2===t.length?["sum(",t[0],",",t[1],")"]:(e=t.length>>1,["sum(",h(t.slice(0,e)),",",h(t.slice(e)),")"])).join("")}function c(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],n=0;n<t.length;++n)e.push(["scale(",h(c(l(t,n))),",",1&n?"-":"",t[0][n],")"].join(""));return e}function e(t){for(var e=[],n=[],r=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),i=[],o=0;o<t;++o)0==(1&o)?e.push.apply(e,c(l(r,o))):n.push.apply(n,c(l(r,o))),i.push("m"+o);var s=h(e),a=h(n),u="orientation"+t+"Exact",s=["function ",u,"(",i.join(),"){var p=",s,",n=",a,",d=sub(p,n);return d[d.length-1];};return ",u].join("");return new Function("sum","prod","scale","sub",s)(pe,de,fe,ge)}var a=e(3),d=e(4),n=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,n){var r,i=(t[1]-n[1])*(e[0]-n[0]),o=(t[0]-n[0])*(e[1]-n[1]),s=i-o;if(0<i){if(o<=0)return s;r=i+o}else{if(!(i<0))return s;if(0<=o)return s;r=-(i+o)}i=33306690738754716e-32*r;return i<=s||s<=-i?s:a(t,e,n)},function(t,e,n,r){var i=t[0]-r[0],o=e[0]-r[0],s=n[0]-r[0],a=t[1]-r[1],u=e[1]-r[1],l=n[1]-r[1],h=t[2]-r[2],c=e[2]-r[2],p=n[2]-r[2],f=o*l,g=s*u,s=s*a,l=i*l,i=i*u,u=o*a,o=h*(f-g)+c*(s-l)+p*(i-u),a=7771561172376103e-31*((Math.abs(f)+Math.abs(g))*Math.abs(h)+(Math.abs(s)+Math.abs(l))*Math.abs(c)+(Math.abs(i)+Math.abs(u))*Math.abs(p));return a<o||a<-o?o:d(t,e,n,r)}];for(;n.length<=5;)n.push(e(n.length));for(var r=[],i=["slow"],o=0;o<=5;++o)r.push("a"+o),i.push("o"+o);for(var s=["function getOrientation(",r.join(),"){switch(arguments.length){case 0:case 1:return 0;"],o=2;o<=5;++o)s.push("case ",o,":return o",o,"(",r.slice(0,o).join(),");");s.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),i.push(s.join(""));var u=Function.apply(void 0,i);for(t.exports=u.apply(void 0,[function(t){return(n[t.length]||(n[t.length]=e(t.length))).apply(void 0,t)}].concat(n)),o=0;o<=5;++o)t.exports[o]=n[o]}),me=Qt[3],ve=Ee,xe=Ee;function Ee(t,e){if(!(this instanceof Ee))return new Ee(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||be,0<this.length)for(var n=(this.length>>1)-1;0<=n;n--)this._down(n)}function be(t,e){return t<e?-1:e<t?1:0}Ee.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){var t;if(0!==this.length)return t=this.data[0],this.length--,0<this.length&&(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];0<t;){var i=t-1>>1,o=e[i];if(0<=n(r,o))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&&(a=e[o=s]),0<=n(a,i))break;e[t]=a,t=o}e[t]=i}},ve.default=xe;var we=Qt[3],Ie=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)}for(var a=[e,n,r,i],u=a.slice(),o=0;o<t.length;o++)!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],h=e[s][1];r<u!=r<h&&n<(l-a)*(r-u)/(h-u)+a&&(i=!i)}return i}(t[o],a)&&u.push(t[o]);var l=function(n){var t=n.length;if(t<3){for(var e=new Array(t),r=0;r<t;++r)e[r]=r;return 2===t&&n[0][0]===n[1][0]&&n[0][1]===n[1][1]?[0]:e}for(var i=new Array(t),r=0;r<t;++r)i[r]=r;i.sort(function(t,e){return n[t][0]-n[e][0]||n[t][1]-n[e][1]});var o=[i[0],i[1]],s=[i[0],i[1]];for(r=2;r<t;++r){for(var a=i[r],u=n[a],l=o.length;1<l&&me(n[o[l-2]],n[o[l-1]],u)<=0;)--l,o.pop();for(o.push(a),l=s.length;1<l&&0<=me(n[s[l-2]],n[s[l-1]],u);)--l,s.pop();s.push(a)}for(var e=new Array(s.length+o.length-2),h=0,c=(r=0,o.length);r<c;++r)e[h++]=o[r];for(var p=s.length-2;0<p;--p)e[h++]=s[p];return e}(u),h=[];for(o=0;o<l.length;o++)h.push(u[l[o]]);return h}(t),o=Kt(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)}for(var l=Kt(16),a=0;a<s.length;a++)l.insert(Me(s[a]));for(var h=e*e,c=n*n;s.length;){var p=s.shift(),f=p.p,g=p.next.p,d=Oe(f,g);d<c||(u=function(t,e,n,r,i,o,s){for(var a=new ve(null,Se),u=t.data;u;){for(var l=0;l<u.children.length;l++){var h=u.children[l],c=u.leaf?Re(h,n,r):function(t,e,n){var r,i,o;return Ce(t,n)||Ce(e,n)||0===(r=Te(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY))||0===(i=Te(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY))||0===(o=Te(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY))||0===(t=Te(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY))?0:Math.min(r,i,o,t)}(n,r,h);o<c||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),f=p.node,g=Re(f,e,n),d=Re(f,r,i);if(p.dist<g&&p.dist<d&&Pe(n,f,s)&&Pe(r,f,s))return f}u=(u=a.pop())&&u.node}return null}(o,p.prev.p,f,g,p.next.next.p,d=d/h,l))&&Math.min(Oe(u,f),Oe(u,g))<=d&&(s.push(p),s.push(Le(u,p)),o.remove(u),l.remove(p),l.insert(Me(p)),l.insert(Me(p.next)))}for(var p=r,y=[];y.push(p.p),(p=p.next)!==r;);return y.push(p.p),y}function Se(t,e){return t.dist-e.dist}function Ce(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Pe(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]),h=Math.max(t[1],e[1]),c=n.search({minX:a,minY:u,maxX:l,maxY:h}),p=0;p<c.length;p++)if(r=c[p].p,i=c[p].next.p,o=t,r!==(s=e)&&i!==o&&0<we(r,i,o)!=0<we(r,i,s)&&0<we(o,s,r)!=0<we(o,s,i))return;return 1}function Me(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){t={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(t.next=e.next,(t.prev=e).next.prev=t,e.next=t):(t.prev=t).next=t,t}function Oe(t,e){var n=t[0]-e[0],t=t[1]-e[1];return n*n+t*t}function Re(t,e,n){var r,i=e[0],e=e[1],o=n[0]-i,s=n[1]-e;return 0==o&&0==s||(1<(r=((t[0]-i)*o+(t[1]-e)*s)/(o*o+s*s))?(i=n[0],e=n[1]):0<r&&(i+=o*r,e+=s*r)),(o=t[0]-i)*o+(s=t[1]-e)*s}function Te(t,e,n,r,i,o,s,a){var u,l,h=n-t,c=r-e,p=s-i,f=a-o,g=t-i,d=e-o,y=h*h+c*c,_=h*p+c*f,m=p*p+f*f,h=h*g+c*d,c=p*g+f*d,p=y*m-_*_,g=p,f=p,c=(0==p?(u=0,g=1,l=c,f=m):(l=y*c-_*h,(u=_*c-m*h)<0?(u=0,l=c,f=m):g<u&&(u=g,l=c+_,f=m)),l<0?-h<(l=0)?u=0:y<-h?u=g:(u=-h,g=y):f<l&&(l=f,_-h<0?u=0:y<_-h?u=g:(u=_-h,g=y)),(1-(d=0===l?0:l/f))*i+d*s-((1-(p=0===u?0:u/g))*t+p*n)),m=(1-d)*o+d*a-((1-p)*e+p*r);return c*c+m*m}function Ae(t,e){(e=void 0===e?{}:e).concavity=e.concavity||1/0;var n=[];return ht(t,function(t){n.push([t[0],t[1]])}),n.length&&3<(t=Ie(n,e.concavity)).length?k([t]):null}function De(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=Mt(t),t=At(e),i=t.type,e=e.bbox,o=t.coordinates;if(e&&!1==(e[0]<=r[0]&&e[1]<=r[1]&&e[2]>=r[0]&&e[3]>=r[1]))return!1;"Polygon"===i&&(o=[o]);for(var s=!1,a=0;a<o.length&&!s;a++)if(Fe(r,o[a][0],n.ignoreBoundary)){for(var u=!1,l=1;l<o[a].length&&!u;)Fe(r,o[a][l],!n.ignoreBoundary)&&(u=!0),l++;u||(s=!0)}return s}function Fe(t,e,n){for(var r=!1,i=0,o=(e=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.slice(0,e.length-1):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 ke(t,e){var o=[];return gt(t,function(n){var r=!1;if("Point"===n.geometry.type)_t(e,function(t){De(n,t)&&(r=!0)}),r&&o.push(n);else{if("MultiPoint"!==n.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];_t(e,function(e){ht(n,function(t){De(t,e)&&(r=!0,i.push(t))})}),r&&o.push(H(i))}}),G(o)}function Ge(t,e,n){void 0===n&&(n={});var t=Mt(t),e=Mt(e),r=nt(e[1]-t[1]),i=nt(e[0]-t[0]),t=nt(t[1]),e=nt(e[1]),r=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(i/2),2)*Math.cos(t)*Math.cos(e);return K(2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r)),n.units)}function qe(t,n){var o=!1;return G(function(t){if(t.length<3)return[];t.sort(ze);for(var e,n,r,i,o,s=t[_=t.length-1].x,a=t[0].x,u=t[_].y,l=u;_--;)t[_].y<u&&(u=t[_].y),t[_].y>l&&(l=t[_].y);for(var h,c=a-s,p=l-u,f=p<c?c:p,a=.5*(a+s),s=.5*(l+u),g=[new Be({__sentinel:!0,x:a-20*f,y:s-f},{__sentinel:!0,x:a,y:s+20*f},{__sentinel:!0,x:a+20*f,y:s-f})],d=[],y=[],_=t.length;_--;){for(y.length=0,h=g.length;h--;)0<(c=t[_].x-g[h].x)&&c*c>g[h].r?(d.push(g[h]),g.splice(h,1)):c*c+(p=t[_].y-g[h].y)*p>g[h].r||(y.push(g[h].a,g[h].b,g[h].b,g[h].c,g[h].c,g[h].a),g.splice(h,1));I=b=E=x=v=m=w=void 0;var m,v,x,E,b,w=y,I=w.length;t:for(;I;)for(v=w[--I],m=w[--I],x=I;x;)if(b=w[--x],m===(E=w[--x])&&v===b||m===b&&v===E){w.splice(I,2),w.splice(x,2),I-=2;continue t}for(h=y.length;h;)n=y[--h],e=y[--h],r=t[_],o=n.x-e.x,i=n.y-e.y,o=2*(o*(r.y-n.y)-i*(r.x-n.x)),1e-12<Math.abs(o)&&g.push(new Be(e,n,r))}for(Array.prototype.push.apply(d,g),_=d.length;_--;)(d[_].a.__sentinel||d[_].b.__sentinel||d[_].c.__sentinel)&&d.splice(_,1);return d}(t.features.map(function(t){var e={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return n?e.z=t.properties[n]:3===t.geometry.coordinates.length&&(o=!0,e.z=t.geometry.coordinates[2]),e})).map(function(t){var e=[t.a.x,t.a.y],n=[t.b.x,t.b.y],r=[t.c.x,t.c.y],i={};return o?(e.push(t.a.z),n.push(t.b.z),r.push(t.c.z)):i={a:t.a.z,b:t.b.z,c:t.c.z},k([[e,n,r,e]],i)}))}Ie.default=Ne;function Be(t,e,n){this.a=t,this.b=e,this.c=n;var r=e.x-t.x,i=e.y-t.y,o=n.x-t.x,s=n.y-t.y,a=r*(t.x+e.x)+i*(t.y+e.y),u=o*(t.x+n.x)+s*(t.y+n.y),n=2*(r*(n.y-e.y)-i*(n.x-e.x));this.x=(s*a-i*u)/n,this.y=(r*u-o*a)/n,e=this.x-t.x,s=this.y-t.y,this.r=e*e+s*s}function ze(t,e){return e.x-t.x}function je(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ue(t);case"FeatureCollection":return e=t,n={type:"FeatureCollection"},Object.keys(e).forEach(function(t){switch(t){case"type":case"features":return;default:n[t]=e[t]}}),n.features=e.features.map(Ue),n;case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ve(t);default:throw new Error("unknown GeoJSON type")}var e,n}function Ue(e){var n={type:"Feature"};return Object.keys(e).forEach(function(t){switch(t){case"type":case"properties":case"geometry":return;default:n[t]=e[t]}}),n.properties=function n(r){var i={};return r&&Object.keys(r).forEach(function(t){var e=r[t];"object"==typeof e?null===e?i[t]=null:Array.isArray(e)?i[t]=e.map(function(t){return t}):i[t]=n(e):i[t]=e}),i}(e.properties),n.geometry=Ve(e.geometry),n}function Ve(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?e.geometries=t.geometries.map(Ve):e.coordinates=function e(t){return"object"!=typeof t[0]?t.slice():t.map(function(t){return e(t)})}(t.coordinates),e}function Xe(t){return t[0].toString()+","+t[1].toString()}function Ye(t){return t}function He(t,e){var n,o,s,a,u,l,h,f=null==(n=t.transform)?Ye:(a=n.scale[0],u=n.scale[1],l=n.translate[0],h=n.translate[1],function(t,e){e||(o=s=0);var n=2,r=t.length,i=new Array(r);for(i[0]=(o+=t[0])*a+l,i[1]=(s+=t[1])*u+h;n<r;)i[n]=t[n],++n;return i}),g=t.arcs;function i(t){return f(t)}function c(t){for(var e=[],n=0,r=t.length;n<r;++n){i=void 0;o=void 0;s=void 0;a=void 0;u=void 0;h=void 0;l=void 0;c=void 0;p=void 0;var i=t[n];var o=e;o.length&&o.pop();for(var s=g[i<0?~i:i],a=0,u=s.length;a<u;++a)o.push(f(s[a],a));if(i<0)for(var l,h=o,c=h.length,p=c-u;p<--c;)l=h[p],h[p++]=h[c],h[c]=l}return e.length<2&&e.push(e[0]),e}function r(t){for(var e=c(t);e.length<4;)e.push(e[0]);return e}function p(t){return t.map(r)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=i(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(i);break;case"LineString":n=c(e.arcs);break;case"MultiLineString":n=e.arcs.map(c);break;case"Polygon":n=p(e.arcs);break;case"MultiPolygon":n=e.arcs.map(p);break;default:return null}return{type:r,coordinates:n}}(e)}function We(a,r){var i={},u={},l={},o=[],s=-1;function t(t,e){for(var n in t){n=t[n];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[t<0?~t:t]=1}),o.push(n)}}return r.forEach(function(t,e){var n=a.arcs[t<0?~t:t];n.length<3&&!n[1][0]&&!n[1][1]&&(n=r[++s],r[s]=t,r[e]=n)}),r.forEach(function(t){o=t,i=a.arcs[o<0?~o:o],s=i[0],a.transform?(n=[0,0],i.forEach(function(t){n[0]+=t[0],n[1]+=t[1]})):n=i[i.length-1];var e,n,r,i=o<0?[n,s]:[s,n],o=i[0],s=i[1];(i=l[o])?(delete l[i.end],i.push(t),i.end=s,(e=u[s])?(delete u[e.start],r=e===i?i:i.concat(e),u[r.start=i.start]=l[r.end=e.end]=r):u[i.start]=l[i.end]=i):(i=u[s])?(delete u[i.start],i.unshift(t),i.start=o,(e=l[o])?(delete l[e.end],r=e===i?i:e.concat(i),u[r.start=e.start]=l[r.end=i.end]=r):u[i.start]=l[i.end]=i):u[(i=[t]).start=o]=l[i.end=s]=i}),t(l,u),t(u,l),r.forEach(function(t){i[t<0?~t:t]||o.push([t])}),o}function Je(a,t){var u={},n=[],r=[];function i(e){e.forEach(function(t){t.forEach(function(t){(u[t=t<0?~t:t]||(u[t]=[])).push(e)})}),n.push(e)}function l(t){for(var e,n=He(a,{type:"Polygon",arcs:[t]}).coordinates[0],r=-1,i=n.length,o=n[i-1],s=0;++r<i;)e=o,o=n[r],s+=e[0]*o[1]-e[1]*o[0];return Math.abs(s)}return t.forEach(function t(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"Polygon":i(e.arcs);break;case"MultiPolygon":e.arcs.forEach(i)}}),n.forEach(function(t){if(!t._){var e=[],n=[t];for(t._=1,r.push(e);t=n.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){u[t<0?~t:t].forEach(function(t){t._||(t._=1,n.push(t))})})})}}),n.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:r.map(function(t){var e,n=[];if(t.forEach(function(t){t.forEach(function(t){t.forEach(function(t){u[t<0?~t:t].length<2&&n.push(t)})})}),1<(e=(n=We(a,n)).length))for(var r,i,o=1,s=l(n[0]);o<e;++o)(r=l(n[o]))>s&&(i=n[0],n[0]=n[o],n[o]=i,s=r);return n}).filter(function(t){return 0<t.length})}}var Ze=Object.prototype.hasOwnProperty;function Ke(o,s,a,t,u,e){3===arguments.length&&(t=e=Array,u=null);for(var l=new t(o=1<<Math.max(4,Math.ceil(Math.log(o)/Math.LN2))),h=new e(o),c=o-1,n=0;n<o;++n)l[n]=u;return{set:function(t,e){for(var n=s(t)&c,r=l[n],i=0;r!=u;){if(a(r,t))return h[n]=e;if(++i>=o)throw new Error("full hashmap");r=l[n=n+1&c]}return l[n]=t,h[n]=e},maybeSet:function(t,e){for(var n=s(t)&c,r=l[n],i=0;r!=u;){if(a(r,t))return h[n];if(++i>=o)throw new Error("full hashmap");r=l[n=n+1&c]}return l[n]=t,h[n]=e},get:function(t,e){for(var n=s(t)&c,r=l[n],i=0;r!=u;){if(a(r,t))return h[n];if(++i>=o)break;r=l[n=n+1&c]}return e},keys:function(){for(var t=[],e=0,n=l.length;e<n;++e){var r=l[e];r!=u&&t.push(r)}return t}}}function Qe(t,e){return t[0]===e[0]&&t[1]===e[1]}var xe=new ArrayBuffer(16),$e=new Float64Array(xe),tn=new Uint32Array(xe);function en(t){$e[0]=t[0],$e[1]=t[1];t=tn[0]^tn[1];return 2147483647&(t<<5^t>>7^tn[2]^tn[3])}function nn(t){for(var i=t.coordinates,e=t.lines,n=t.rings,r=function(){for(var t=Ke(1.4*i.length,E,b,Int32Array,-1,Int32Array),e=new Int32Array(i.length),n=0,r=i.length;n<r;++n)e[n]=t.maybeSet(n,n);return e}(),o=new Int32Array(i.length),s=new Int32Array(i.length),a=new Int32Array(i.length),u=new Int8Array(i.length),l=0,h=0,c=i.length;h<c;++h)o[h]=s[h]=a[h]=-1;for(h=0,c=e.length;h<c;++h){var p=e[h],f=p[0],g=p[1],d=r[f],y=r[++f];for(++l,u[d]=1;++f<=g;)x(h,d,d=y,y=r[f]);++l,u[y]=1}for(h=0,c=i.length;h<c;++h)o[h]=-1;for(h=0,c=n.length;h<c;++h){var _=n[h],m=_[0]+1,v=_[1];for(x(h,r[v-1],d=r[m-1],y=r[m]);++m<=v;)x(h,d,d=y,y=r[m])}function x(t,e,n,r){var i;o[n]!==t&&(o[n]=t,0<=(t=s[n])?(i=a[n],t===e&&i===r||t===r&&i===e||(++l,u[n]=1)):(s[n]=e,a[n]=r))}function E(t){return en(i[t])}function b(t,e){return Qe(i[t],i[e])}var w,o=s=a=null,I=function(i,o,s,t,a){3===arguments.length&&(t=Array,a=null);for(var u=new t(i=1<<Math.max(4,Math.ceil(Math.log(i)/Math.LN2))),l=i-1,e=0;e<i;++e)u[e]=a;return{add:function(t){for(var e=o(t)&l,n=u[e],r=0;n!=a;){if(s(n,t))return!0;if(++r>=i)throw new Error("full hashset");n=u[e=e+1&l]}return u[e]=t,!0},has:function(t){for(var e=o(t)&l,n=u[e],r=0;n!=a;){if(s(n,t))return!0;if(++r>=i)break;n=u[e=e+1&l]}return!1},values:function(){for(var t=[],e=0,n=u.length;e<n;++e){var r=u[e];r!=a&&t.push(r)}return t}}}(1.4*l,en,Qe);for(h=0,c=i.length;h<c;++h)u[w=r[h]]&&I.add(i[w]);return I}function rn(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 on(t){var e={type:"GeometryCollection",geometries:t.features.map(sn)};return null!=t.bbox&&(e.bbox=t.bbox),e}function sn(t){var e,n=an(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 an(t){var e;return null==t?{type:null}:(e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(an)}:"Point"===t.type||"MultiPoint"===t.type?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates},null!=t.bbox&&(e.bbox=t.bbox),e)}function un(t,d){var y=function(t){var n=1/0,r=1/0,i=-1/0,o=-1/0;function e(t){null!=t&&Ze.call(a,t.type)&&a[t.type](t)}var s,a={GeometryCollection:function(t){t.geometries.forEach(e)},Point:function(t){u(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(u)},LineString:function(t){l(t.arcs)},MultiLineString:function(t){t.arcs.forEach(l)},Polygon:function(t){t.arcs.forEach(l)},MultiPolygon:function(t){t.arcs.forEach(h)}};function u(t){var e=t[0],t=t[1];e<n&&(n=e),i<e&&(i=e),t<r&&(r=t),o<t&&(o=t)}function l(t){t.forEach(u)}function h(t){t.forEach(l)}for(s in t)e(t[s]);return n<=i&&r<=o?[n,r,i,o]:void 0}(t=function(t){var e,n,r={};for(e in t)r[e]=null==(n=t[e])?{type:null}:("FeatureCollection"===n.type?on:"Feature"===n.type?sn:an)(n);return r}(t)),e=0<d&&y&&function(t){var h=y[0],c=y[1],e=y[2],n=y[3],p=e-h?(d-1)/(e-h):1,f=n-c?(d-1)/(n-c):1;function r(t){return[Math.round((t[0]-h)*p),Math.round((t[1]-c)*f)]}function i(t,e){for(var n,r,i,o,s=-1,a=0,u=t.length,l=new Array(u);++s<u;)o=t[s],i=Math.round((o[0]-h)*p),o=Math.round((o[1]-c)*f),i===n&&o===r||(l[a++]=[n=i,r=o]);for(l.length=a;a<e;)a=l.push([l[0][0],l[0][1]]);return l}function o(t){return i(t,2)}function s(t){return i(t,4)}function a(t){return t.map(s)}function u(t){null!=t&&Ze.call(g,t.type)&&g[t.type](t)}var l,g={GeometryCollection:function(t){t.geometries.forEach(u)},Point:function(t){t.coordinates=r(t.coordinates)},MultiPoint:function(t){t.coordinates=t.coordinates.map(r)},LineString:function(t){t.arcs=o(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(o)},Polygon:function(t){t.arcs=a(t.arcs)},MultiPolygon:function(t){t.arcs=t.arcs.map(a)}};for(l in t)u(t[l]);return{scale:[1/p,1/f],translate:[h,c]}}(t),n=function(t){var e,n,h=t.coordinates,r=t.lines,i=t.rings,o=r.length+i.length;for(delete t.lines,delete t.rings,s=0,a=r.length;s<a;++s)for(e=r[s];e=e.next;)++o;for(s=0,a=i.length;s<a;++s)for(n=i[s];n=n.next;)++o;for(var l=Ke(2*o*1.4,en,Qe),c=t.arcs=[],s=0,a=r.length;s<a;++s)for(e=r[s];u(e),e=e.next;);for(s=0,a=i.length;s<a;++s)if((n=i[s]).next)for(;u(n),n=n.next;);else!function(t){var e,n,r,i,o;if(n=l.get(h[t[0]]))for(i=0,o=n.length;i<o;++i){if(p(r=n[i],t))return t[0]=r[0],t[1]=r[1];if(f(r,t))return t[0]=r[1],t[1]=r[0]}if(n=l.get(e=h[t[0]+g(t)]))for(i=0,o=n.length;i<o;++i){if(p(r=n[i],t))return t[0]=r[0],t[1]=r[1];if(f(r,t))return t[0]=r[1],t[1]=r[0]}n?n.push(t):l.set(e,[t]),c.push(t)}(n);function u(t){var e,n,r,i,o,s,a,u;if(r=l.get(e=h[t[0]]))for(a=0,u=r.length;a<u;++a)if(function(t,e){var n=t[0],r=e[0],i=t[1];if(n-i!=r-e[1])return;for(;n<=i;++n,++r)if(!Qe(h[n],h[r]))return;return 1}(i=r[a],t))return t[0]=i[0],t[1]=i[1];if(o=l.get(n=h[t[1]]))for(a=0,u=o.length;a<u;++a)if(function(t,e){var n=t[0],r=e[0],i=t[1],o=e[1];if(n-i!=r-o)return;for(;n<=i;++n,--o)if(!Qe(h[n],h[o]))return;return 1}(s=o[a],t))return t[1]=s[0],t[0]=s[1];r?r.push(t):l.set(e,[t]),o?o.push(t):l.set(n,[t]),c.push(t)}function p(t,e){var n=t[0],r=e[0],i=t[1]-n;if(i==e[1]-r){for(var o=g(t),s=g(e),a=0;a<i;++a)if(!Qe(h[n+(a+o)%i],h[r+(a+s)%i]))return;return 1}}function f(t,e){var n=t[0],r=e[0],i=t[1],o=e[1],s=i-n;if(s==o-r){for(var a=g(t),u=s-g(e),l=0;l<s;++l)if(!Qe(h[n+(l+a)%s],h[o-(l+u)%s]))return;return 1}}function g(t){for(var e=t[0],n=t[1],r=e,i=r,o=h[r];++r<n;){var s=h[r];(s[0]<o[0]||s[0]===o[0]&&s[1]<o[1])&&(i=r,o=s)}return i-e}return t}(function(t){for(var e,n,r,i,o,s=nn(t),a=t.coordinates,u=t.lines,l=t.rings,h=0,c=u.length;h<c;++h)for(var p=u[h],f=p[0],g=p[1];++f<g;)s.has(a[f])&&(e={0:f,1:p[1]},p[1]=f,p=p.next=e);for(h=0,c=l.length;h<c;++h)for(var d=l[h],y=d[0],_=y,m=d[1],v=s.has(a[y]);++_<m;)s.has(a[_])&&(v?(e={0:_,1:d[1]},d[1]=_,d=d.next=e):(o=(i=m)-_,rn(n=a,r=y,i),rn(n,r,r+o),rn(n,r+o,i),a[m]=a[y],v=!0,_=y));return t}(function(t){var i=-1,o=[],s=[],a=[];function e(t){t&&Ze.call(r,t.type)&&r[t.type](t)}var n,r={GeometryCollection:function(t){t.geometries.forEach(e)},LineString:function(t){t.arcs=u(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(u)},Polygon:function(t){t.arcs=t.arcs.map(l)},MultiPolygon:function(t){t.arcs=t.arcs.map(h)}};function u(t){for(var e=0,n=t.length;e<n;++e)a[++i]=t[e];var r={0:i-n+1,1:i};return o.push(r),r}function l(t){for(var e=0,n=t.length;e<n;++e)a[++i]=t[e];var r={0:i-n+1,1:i};return s.push(r),r}function h(t){return t.map(l)}for(n in t)e(t[n]);return{type:"Topology",coordinates:a,lines:o,rings:s,objects:t}}(t))),r=n.coordinates,i=Ke(1.4*n.arcs.length,ln,hn);function o(t){t&&Ze.call(a,t.type)&&a[t.type](t)}t=n.objects,n.bbox=y,n.arcs=n.arcs.map(function(t,e){return i.set(t,e),r.slice(t[0],t[1]+1)}),delete n.coordinates;var s,r=null,a={GeometryCollection:function(t){t.geometries.forEach(o)},LineString:function(t){t.arcs=u(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(u)},Polygon:function(t){t.arcs=t.arcs.map(u)},MultiPolygon:function(t){t.arcs=t.arcs.map(l)}};function u(t){var e=[];do{var n=i.get(t)}while(e.push(t[0]<t[1]?n:~n),t=t.next);return e}function l(t){return t.map(u)}for(s in t)o(t[s]);return e&&(n.transform=e,n.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],h=l[0],c=l[1];++s<u;)r=(l=o[s])[0],i=l[1],r===h&&i===c||(o[a++]=[r-h,i-c],h=r,c=i);1===a&&(o[a++]=[0,0]),o.length=a}return t}(n.arcs)),n}function ln(t){var e,n=t[0],t=t[1];return t<n&&(e=n,n=t,t=e),n+31*t}function hn(t,e){var n,r=t[0],t=t[1],i=e[0],e=e[1];return t<r&&(n=r,r=t,t=n),e<i&&(n=i,i=e,e=n),r===i&&t===e}function cn(t,e){if(!st(e=(e=void 0===e?{}:e)||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==Dt(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=je(t));r={},vt(t,function(t){r[t.geometry.type]=!0});var r,i=1===(n=Object.keys(r)).length?n[0]:null;if(!i)throw new Error("geojson must be homogenous");var o=t;switch(i){case"LineString":var s=o,a=e;if(!st(a=(a=void 0===a?{}:a)||{}))throw new Error("options is invalid");if(a=a.mutate,"FeatureCollection"!==Dt(s))throw new Error("geojson must be a FeatureCollection");if(!s.features.length)throw new Error("geojson is empty");!1!==a&&void 0!==a||(s=je(s));var l=[];return(a=It(s,function(a,u){return function(){var t,e=a.geometry.coordinates,n=u.geometry.coordinates,r=Xe(e[0]),i=Xe(e[e.length-1]),o=Xe(n[0]),s=Xe(n[n.length-1]);if(r===s)t=n.concat(e.slice(1));else if(o===i)t=e.concat(n.slice(1));else if(r===o)t=e.slice(1).reverse().concat(n);else{if(i!==s)return null;t=e.concat(n.reverse().slice(1))}return V(t)}()||(l.push(a),u)}))&&l.push(a),l.length?1===l.length?l[0]:Y(l.map(function(t){return t.coordinates})):null;case"Polygon":s=o,a=e;if(void 0===a&&(a={}),"FeatureCollection"!==Dt(s))throw new Error("geojson must be a FeatureCollection");if(!s.features.length)throw new Error("geojson is empty");!1!==a.mutate&&void 0!==a.mutate||(s=je(s));var u=[];return vt(s,function(t){u.push(t.geometry)}),function(t){return He(t,Je.apply(this,arguments))}(a=un({geoms:J(u).geometry}),a.objects.geoms.geometries);default:throw new Error(i+" is not supported")}}function pn(t,e){e="object"==typeof(e=void 0===e?{}:e)?e.mutate:e;if(!t)throw new Error("geojson is required");var n=Dt(t),r=[];switch(n){case"LineString":r=fn(t);break;case"MultiLineString":case"Polygon":_(t).forEach(function(t){r.push(fn(t))});break;case"MultiPolygon":_(t).forEach(function(t){var e=[];t.forEach(function(t){e.push(fn(t))}),r.push(e)});break;case"Point":return t;case"MultiPoint":var i={};_(t).forEach(function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(i,e)||(r.push(t),i[e]=!0)});break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===e?(t.coordinates=r,t):{type:n,coordinates:r}:!0===e?(t.geometry.coordinates=r,t):B({type:n,coordinates:r},t.properties,{bbox:t.bbox,id:t.id})}function fn(t){var e=_(t);if(2===e.length&&!gn(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]),2<(i=n.length)&&dn(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,gn(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return dn(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function gn(t,e){return t[0]===e[0]&&t[1]===e[1]}function dn(t,e,n){var r=n[0],n=n[1],i=t[0],t=t[1],o=e[0],e=e[1],s=o-i,a=e-t;return 0==(r-i)*a-(n-t)*s&&(Math.abs(s)>=Math.abs(a)?0<s?i<=r&&r<=o:o<=r&&r<=i:0<a?t<=n&&n<=e:e<=n&&n<=t)}function yn(t,e){var n=t.length-1,r=[t[0]];return function t(e,n,r,i,o){for(var s,a,u,l,h,c,p,f=i,g=n+1;g<r;g++){a=e[g],u=e[n],d=e[r],p=c=h=l=void 0,h=u.x,u=u.y,c=d.x-h,p=d.y-u,0==c&&0==p||(1<(l=((a.x-h)*c+(a.y-u)*p)/(c*c+p*p))?(h=d.x,u=d.y):0<l&&(h+=c*l,u+=p*l));var d=(c=a.x-h)*c+(p=a.y-u)*p;f<d&&(s=g,f=d)}i<f&&(1<s-n&&t(e,n,s,i,o),o.push(e[s]),1<r-s)&&t(e,s,r,i,o)}(t,0,n,e,r),r.push(t[n]),r}function _n(t,e,n){return t.length<=2?t:(e=void 0!==e?e*e:1,yn(t=n?t:function(t,e){for(var n,r,i,o,s=t[0],a=[s],u=1,l=t.length;u<l;u++)i=s,0,e<(o=(r=n=t[u]).x-i.x)*o+(o=r.y-i.y)*o&&(a.push(n),s=n);return s!==n&&a.push(n),a}(t,e),e))}function mn(t,e,n){return _n(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 vn(t,i,o){return t.map(function(t){var e=t.map(function(t){return{x:t[0],y:t[1]}});if(e.length<4)throw new Error("invalid polygon");for(var n,r=_n(e,i,o).map(function(t){return[t.x,t.y]});(n=r).length<3||3===n.length&&n[2][0]===n[0][0]&&n[2][1]===n[0][1];)r=_n(e,i-=.01*i,o).map(function(t){return[t.x,t.y]});return r[r.length-1][0]===r[0][0]&&r[r.length-1][1]===r[0][1]||r.push(r[0]),r})}En.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},En.prototype.vector=function(t){var e=this.pos(t+10),t=this.pos(t-10);return{angle:180*Math.atan2(e.y-t.y,e.x-t.x)/3.14,speed:Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)+(t.z-e.z)*(t.z-e.z))}},En.prototype.pos=function(t){var e,n,r,i,o,t=t-this.delay,t=(t=(t=t<0?0:t)>this.duration?this.duration-1:t)/this.duration;return 1<=t?this.points[this.length-1]:(i=Math.floor((this.points.length-1)*t),t=(this.length-1)*t-i,e=this.points[i],n=this.controls[i][1],r=this.controls[i+1][0],i=this.points[i+1],o=[(o=t*t)*t,3*o*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)],{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]})};var xn=En;function En(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;for(var e=this.delay=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}function bn(t,e){for(var n=(e=void 0===e?{}:e).resolution||1e4,r=e.sharpness||.85,i=[],t=At(t).coordinates.map(function(t){return{x:t[0],y:t[1]}}),o=new xn({duration:n,points:t,sharpness:r}),s=function(t){var e=o.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},a=0;a<o.duration;a+=10)s(a);return s(o.duration),V(i,e.properties)}function wn(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 k([[s,[i,r],[i,o],[n,o],s]],e.properties,{bbox:t,id:e.id})}function In(t){return wn(Pt(t))}function Nn(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Ge(t.slice(0,2),[r,n])>=Ge(t.slice(0,2),[e,i])?[e,(t=(n+i)/2)-(r-e)/2,r,t+(r-e)/2]:[(t=(e+r)/2)-(i-n)/2,n,t+(i-n)/2,i]}function Sn(t,e,n,r){void 0===r&&(r={});var t=Mt(t),i=nt(t[0]),t=nt(t[1]),n=nt(n),e=Q(e,r.units),o=Math.asin(Math.sin(t)*Math.cos(e)+Math.cos(t)*Math.sin(e)*Math.cos(n));return R([et(i+Math.atan2(Math.sin(n)*Math.sin(e)*Math.cos(t),Math.cos(e)-Math.sin(t)*Math.sin(o))),et(o)],r.properties)}function Cn(t,e,n){for(var r=(n=void 0===n?{}:n).steps||64,i=n.properties||(!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{}),o=[],s=0;s<r;s++)o.push(Sn(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),k([o],i)}function Pn(t,e,n){var r,i;return!0===(n=void 0===n?{}:n).final?(Pn(e,t)+180)%360:(n=Mt(t),t=Mt(e),e=nt(n[0]),r=nt(t[0]),n=nt(n[1]),t=nt(t[1]),i=Math.sin(r-e)*Math.cos(t),n=Math.cos(n)*Math.sin(t)-Math.sin(n)*Math.cos(t)*Math.cos(r-e),et(Math.atan2(i,n)))}function Mn(t,e){void 0===e&&(e={});t=Pt(t);return R([(t[0]+t[2])/2,(t[1]+t[3])/2],e.properties,e)}function Ln(t,e){void 0===e&&(e={});var n=0,r=0,i=0;return ht(t,function(t){n+=t[0],r+=t[1],i++},!0),R([n/i,r/i],e.properties)}function On(e){var n=[];return"FeatureCollection"===e.type?gt(e,function(e){ht(e,function(t){n.push(R(t,e.properties))})}):ht(e,function(t){n.push(R(t,e.properties))}),G(n)}var Rn=Tn,Qt=Tn;function Tn(t,e,n){n=n||2;var r,i,o,s,a,u=e&&e.length,l=u?e[0]*n:t.length,h=An(t,0,l,n,!0),c=[];if(h){if(u&&(h=function(t,e,n,r){for(var i,o,s,a=[],u=0,l=e.length;u<l;u++)(i=An(t,e[u]*r,u<l-1?e[u+1]*r:t.length,r,!1))===i.next&&(i.steiner=!0),a.push(function(t){var e=t,n=t;for(;e.x<n.x&&(n=e),e=e.next,e!==t;);return n}(i));for(a.sort(kn),u=0;u<a.length;u++)(s=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&&s<a){if((s=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}}}while((r=r.next)!==e);if(!n)return null;if(i===s)return n.prev;for(var u,l=n,h=n.x,c=n.y,p=1/0,r=n.next;r!==l;)i>=r.x&&r.x>=h&&i!==r.x&&qn(o<c?i:s,o,h,c,o<c?s:i,o,r.x,r.y)&&((u=Math.abs(o-r.y)/(i-r.x))<p||u===p&&r.x>n.x)&&Un(r,t)&&(n=r,p=u),r=r.next;return n}(o=a[u],s=n))&&Dn(s=Vn(s,o),s.next),n=Dn(n,n.next);return n}(t,e,h,n)),t.length>80*n){for(var p=r=t[0],f=i=t[1],g=n;g<l;g+=n)(o=t[g])<p&&(p=o),(s=t[g+1])<f&&(f=s),r<o&&(r=o),i<s&&(i=s);a=0!==(a=Math.max(r-p,i-f))?1/a:0}Fn(h,c,n,p,f,a)}return c}function An(t,e,n,r,i){var o,s;if(i===0<Wn(t,e,n,r))for(o=e;o<n;o+=r)s=Xn(o,t[o],t[o+1],s);else for(o=n-r;e<=o;o-=r)s=Xn(o,t[o],t[o+1],s);return s&&zn(s,s.next)&&(Yn(s),s=s.next),s}function Dn(t,e){if(!t)return t;e=e||t;var n,r=t;do{if(n=!1,r.steiner||!zn(r,r.next)&&0!==Bn(r.prev,r,r.next))r=r.next;else{if(Yn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Fn(t,e,n,r,i,o,s){if(t){if(!s&&o){var a=t;var u=r;var l=i;var h=o;for(var c=a;null===c.z&&(c.z=Gn(c.x,c.y,u,l,h)),c.prevZ=c.prev,c.nextZ=c.next,(c=c.next)!==a;);c.prevZ.nextZ=null,c.prevZ=null;var p,f,g,d,y,_,m,v,x=c,E=1;do{for(f=x,y=x=null,_=0;f;){for(_++,g=f,p=m=0;p<E&&(m++,g=g.nextZ);p++);for(v=E;0<m||0<v&&g;)0!==m&&(0===v||!g||f.z<=g.z)?(f=(d=f).nextZ,m--):(g=(d=g).nextZ,v--),y?y.nextZ=d:x=d,d.prevZ=y,y=d;f=g}}while(y.nextZ=null,E*=2,1<_)}for(var b,w,I=t;t.prev!==t.next;)if(b=t.prev,w=t.next,o?function(t,e,n,r){var i=t.prev,o=t,s=t.next;if(0<=Bn(i,o,s))return;for(var a=(i.x<o.x?i.x<s.x?i:s:o.x<s.x?o:s).x,u=(i.y<o.y?i.y<s.y?i:s:o.y<s.y?o:s).y,l=(i.x>o.x?i.x>s.x?i:s:o.x>s.x?o:s).x,h=(i.y>o.y?i.y>s.y?i:s:o.y>s.y?o:s).y,c=Gn(a,u,e,n,r),p=Gn(l,h,e,n,r),f=t.prevZ,g=t.nextZ;f&&f.z>=c&&g&&g.z<=p;){if(f!==t.prev&&f!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=Bn(f.prev,f,f.next))return;if(f=f.prevZ,g!==t.prev&&g!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&0<=Bn(g.prev,g,g.next))return;g=g.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=Bn(f.prev,f,f.next))return;f=f.prevZ}for(;g&&g.z<=p;){if(g!==t.prev&&g!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&0<=Bn(g.prev,g,g.next))return;g=g.nextZ}return 1}(t,r,i,o):function(t){var e=t.prev,n=t,r=t.next;if(0<=Bn(e,n,r))return;for(var i=t.next.next;i!==t.prev;){if(qn(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=Bn(i.prev,i,i.next))return;i=i.next}return 1}(t))e.push(b.i/n),e.push(t.i/n),e.push(w.i/n),Yn(t),t=w.next,I=w.next;else if((t=w)===I){s?1===s?Fn(t=function(t,e,n){var r=t;do{var i=r.prev,o=r.next.next}while(!zn(i,o)&&jn(i,r,r.next,o)&&Un(i,o)&&Un(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Yn(r),Yn(r.next),r=t=o),r=r.next,r!==t);return r}(t,e,n),e,n,r,i,o,2):2===s&&function(t,e,n,r,i,o){var s=t;do{for(var a,u=s.next.next;u!==s.prev;){if(s.i!==u.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&jn(n,n.next,t,e))return 1}while((n=n.next)!==t)}(t,e)&&Un(t,e)&&Un(e,t)&&function(t,e){for(var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;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)!==t;);return r}(t,e)}(s,u))return a=Vn(s,u),s=Dn(s,s.next),a=Dn(a,a.next),Fn(s,e,n,r,i,o),Fn(a,e,n,r,i,o);u=u.next}}while(s=s.next,s!==t)}(t,e,n,r,i,o):Fn(Dn(t),e,n,r,i,o,1);break}}}function kn(t,e){return t.x-e.x}function Gn(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))|(1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qn(t,e,n,r,i,o,s,a){return 0<=(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)}function Bn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function zn(t,e){return t.x===e.x&&t.y===e.y}function jn(t,e,n,r){return zn(t,e)&&zn(n,r)||zn(t,r)&&zn(n,e)||0<Bn(t,e,n)!=0<Bn(t,e,r)&&0<Bn(n,r,t)!=0<Bn(n,r,e)}function Un(t,e){return Bn(t.prev,t,t.next)<0?0<=Bn(t,e,t.next)&&0<=Bn(t,t.prev,e):Bn(t,e,t.prev)<0||Bn(t,t.next,e)<0}function Vn(t,e){var n=new Hn(t.i,t.x,t.y),r=new Hn(e.i,e.x,e.y),i=t.next,o=e.prev;return(t.next=e).prev=t,(n.next=i).prev=n,(r.next=n).prev=r,(o.next=r).prev=o,r}function Xn(t,e,n,r){t=new Hn(t,e,n);return r?(t.next=r.next,(t.prev=r).next.prev=t,r.next=t):(t.prev=t).next=t,t}function Yn(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 Hn(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 Wn(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 Jn(t){var n=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]);0<i&&(r+=t[i-1].length,n.holes.push(r))}return n}(t),r=Rn(n.vertices,n.holes,2),e=[],i=[];r.forEach(function(t,e){e=r[e];i.push([n.vertices[2*e],n.vertices[2*e+1]])});for(var o=0;o<i.length;o+=3){var s=i.slice(o,o+3);s.push(i[o]),e.push(k([s]))}return e}function Zn(n,t){if(!n)throw new Error("targetPoint is required");var r,i;if(t)return r=1/0,i=0,gt(t,function(t,e){t=Ge(n,t);t<r&&(i=e,r=t)}),(t=je(t.features[i])).properties.featureIndex=i,t.properties.distanceToPoint=r,t;throw new Error("points is required")}function Kn(t){var o;if(t)return o=[],vt(t,function(t){var e=t,n=o,r=[],i=e.geometry;if(null!==i){switch(i.type){case"Polygon":r=_(i);break;case"LineString":r=[_(i)]}r.forEach(function(t){var s,a;s=e.properties,a=[],t.reduce(function(t,e){var n,r,i,o=V([t,e],s);return o.bbox=(n=t[0],t=t[1],r=e[0],i=e[1],[n<r?n:r,t<i?t:i,r<n?n:r,i<t?t:i]),a.push(o),e}),a.forEach(function(t){t.id=n.length,n.push(t)})})}}),G(o);throw new Error("geojson is required")}Tn.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Wn(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Wn(t,l,h,n))}for(var c=0,a=0;a<r.length;a+=3){var p=r[a]*n,f=r[a+1]*n,g=r[a+2]*n;c+=Math.abs((t[p]-t[g])*(t[1+f]-t[1+p])-(t[p]-t[f])*(t[1+g]-t[1+p]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},Tn.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]);0<i&&(r+=t[i-1].length,n.holes.push(r))}return n},Rn.default=Qt;var Qn=ce(function(t,r){function a(t,e,n){var r={type:"Feature"};return 0!==(n=void 0===n?{}:n).id&&!n.id||(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function i(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(g(t[0])&&g(t[1]))return a({type:"Point",coordinates:t},e,n);throw new Error("coordinates must contain numbers")}function o(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return a({type:"Polygon",coordinates:t},e,n)}function s(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 a({type:"LineString",coordinates:t},e,n)}function u(t,e){var n={type:"FeatureCollection"};return(e=void 0===e?{}:e).id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function l(t,e,n){return a({type:"MultiLineString",coordinates:t},e,n=void 0===n?{}:n)}function h(t,e,n){return a({type:"MultiPoint",coordinates:t},e,n=void 0===n?{}:n)}function c(t,e,n){return a({type:"MultiPolygon",coordinates:t},e,n=void 0===n?{}:n)}function p(t,e){var n=r.factors[e=void 0===e?"kilometers":e];if(n)return t*n;throw new Error(e+" units is invalid")}function f(t,e){var n=r.factors[e=void 0===e?"kilometers":e];if(n)return t/n;throw new Error(e+" units is invalid")}function n(t){return t%(2*Math.PI)*180/Math.PI}function g(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=6371008.8,r.factors={centimeters:100*r.earthRadius,centimetres:100*r.earthRadius,degrees:r.earthRadius/111325,feet:3.28084*r.earthRadius,inches:39.37*r.earthRadius,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:1e3*r.earthRadius,millimetres:1e3*r.earthRadius,nauticalmiles:r.earthRadius/1852,radians:1,yards:1.0936*r.earthRadius},r.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/r.earthRadius,yards:1.0936133},r.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},r.feature=a,r.geometry=function(t,e,n){switch(t){case"Point":return i(e).geometry;case"LineString":return s(e).geometry;case"Polygon":return o(e).geometry;case"MultiPoint":return h(e).geometry;case"MultiLineString":return l(e).geometry;case"MultiPolygon":return c(e).geometry;default:throw new Error(t+" is invalid")}},r.point=i,r.points=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return i(t,e)}),n)},r.polygon=o,r.polygons=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return o(t,e)}),n)},r.lineString=s,r.lineStrings=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return s(t,e)}),n)},r.featureCollection=u,r.multiLineString=l,r.multiPoint=h,r.multiPolygon=c,r.geometryCollection=function(t,e,n){return a({type:"GeometryCollection",geometries:t},e,n=void 0===n?{}:n)},r.round=function(t,e){if(!(e=void 0===e?0:e)||0<=e)return e=Math.pow(10,e||0),Math.round(t*e)/e;throw new Error("precision must be a positive number")},r.radiansToLength=p,r.lengthToRadians=f,r.lengthToDegrees=function(t,e){return n(f(t,e))},r.bearingToAzimuth=function(t){t%=360;return t<0&&(t+=360),t},r.radiansToDegrees=n,r.degreesToRadians=function(t){return t%360*Math.PI/180},r.convertLength=function(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),0<=t)return p(f(t,e),n);throw new Error("length must be a positive number")},r.convertArea=function(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(0<=t))throw new Error("area must be a positive number");e=r.areaFactors[e];if(!e)throw new Error("invalid original units");n=r.areaFactors[n];if(n)return t/e*n;throw new Error("invalid final units")},r.isNumber=g,r.isObject=function(t){return!!t&&t.constructor===Object},r.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(!g(t))throw new Error("bbox must only contain numbers")})},r.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 $n(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l=0,h=t.type,c="FeatureCollection"===h,p="Feature"===h,f=c?t.features.length:1,g=0;g<f;g++)for(var d=(u=!!(a=c?t.features[g].geometry:p?t.geometry:t)&&"GeometryCollection"===a.type)?a.geometries.length:1,y=0;y<d;y++){var _=0,m=0;if(null!==(s=u?a.geometries[y]:a)){var v=s.coordinates,x=s.type,E=!n||"Polygon"!==x&&"MultiPolygon"!==x?0:1;switch(x){case null:break;case"Point":if(!1===e(v,l,g,_,m))return!1;l++,_++;break;case"LineString":case"MultiPoint":for(r=0;r<v.length;r++){if(!1===e(v[r],l,g,_,m))return!1;l++,"MultiPoint"===x&&_++}"LineString"===x&&_++;break;case"Polygon":case"MultiLineString":for(r=0;r<v.length;r++){for(i=0;i<v[r].length-E;i++){if(!1===e(v[r][i],l,g,_,m))return!1;l++}"MultiLineString"===x&&_++,"Polygon"===x&&m++}"Polygon"===x&&_++;break;case"MultiPolygon":for(r=0;r<v.length;r++){for(i=m=0;i<v[r].length;i++){for(o=0;o<v[r][i].length-E;o++){if(!1===e(v[r][i][o],l,g,_,m))return!1;l++}m++}_++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===$n(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function tr(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 er(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 nr(t,e){for(var n,r,i,o,s,a,u,l,h,c=0,p="FeatureCollection"===t.type,f="Feature"===t.type,g=p?t.features.length:1,d=0;d<g;d++){for(s=p?t.features[d].geometry:f?t.geometry:t,u=p?t.features[d].properties:f?t.properties:{},l=p?t.features[d].bbox:f?t.bbox:void 0,h=p?t.features[d].id:f?t.id:void 0,o=(a=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,r=0;r<o;r++)if(null!==(i=a?s.geometries[r]:s))switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(i,c,u,l,h))return!1;break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===e(i.geometries[n],c,u,l,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,c,u,l,h))return!1;c++}}function rr(t,l){nr(t,function(t,e,n,r,i){var o,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==l(Qn.feature(t,n,{bbox:r,id:i}),e,0)&&void 0}switch(s){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}for(var a=0;a<t.coordinates.length;a++){var u={type:o,coordinates:t.coordinates[a]};if(!1===l(Qn.feature(u,n),e,a))return!1}})}function ir(t,g){rr(t,function(s,a,u){var l=0;if(s.geometry){var h,c,p,f,t=s.geometry.type;if("Point"!==t&&"MultiPoint"!==t)return f=p=c=0,!1!==$n(s,function(t,e,n,r,i){var o;if(!(void 0===h||c<a||p<r||f<i))return o=Qn.lineString([h,t],s.properties),!1!==g(o,a,u,i,l)&&(l++,void(h=t));h=t,c=a,p=r,f=i,l=0})&&void 0}})}function or(t,s){if(!t)throw new Error("geojson is required");rr(t,function(t,e,n){if(null!==t.geometry){var r=t.geometry.type,i=t.geometry.coordinates;switch(r){case"LineString":if(!1===s(t,e,n,0,0))return!1;break;case"Polygon":for(var o=0;o<i.length;o++)if(!1===s(Qn.lineString(i[o],t.properties),e,n,o))return!1}}})}var sr=Object.defineProperty({coordAll:function(t){var e=[];return $n(t,function(t){e.push(t)}),e},coordEach:$n,coordReduce:function(t,o,s,e){var a=s;return $n(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)},e),a},featureEach:er,featureReduce:function(t,n,r){var i=r;return er(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i},findPoint:function(t,e){if(!Qn.isObject(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,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 Qn.point(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Qn.point(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Qn.point(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Qn.point(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Qn.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),Qn.point(u[i][o][s],a,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(!Qn.isObject(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),Qn.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),Qn.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),Qn.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),Qn.lineString([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},flattenEach:rr,flattenReduce:function(t,r,i){var o=i;return rr(t,function(t,e,n){o=0===e&&0===n&&void 0===i?t:r(o,t,e,n)}),o},geomEach:nr,geomReduce:function(t,o,s){var a=s;return nr(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)}),a},lineEach:or,lineReduce:function(t,i,o){var s=o;return or(t,function(t,e,n,r){s=0===e&&void 0===o?t:i(s,t,e,n,r)}),s},propEach:tr,propReduce:function(t,n,r){var i=r;return tr(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i},segmentEach:ir,segmentReduce:function(t,o,s){var a=s,u=!1;return ir(t,function(t,e,n,r,i){a=!1===u&&void 0===s?t:o(a,t,e,n,r,i),u=!0}),a}},"__esModule",{value:!0});function ar(t){var e=[1/0,1/0,-1/0,-1/0];return sr.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}ar.default=ar;var ur=Object.defineProperty({default:ar},"__esModule",{value:!0}).default,lr=sr.featureEach,hr=(sr.coordEach,Qn.polygon,Qn.featureCollection);function cr(t){t=Kt(t);return t.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox||ur(t),Kt.prototype.insert.call(this,t)},t.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||ur(t),e.push(t)}):lr(t,function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox||ur(t),e.push(t)}),Kt.prototype.load.call(this,e)},t.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox||ur(t),Kt.prototype.remove.call(this,t,e)},t.clear=function(){return Kt.prototype.clear.call(this)},t.search=function(t){t=Kt.prototype.search.call(this,this.toBBox(t));return hr(t)},t.collides=function(t){return Kt.prototype.collides.call(this,this.toBBox(t))},t.all=function(){var t=Kt.prototype.all.call(this);return hr(t)},t.toJSON=function(){return Kt.prototype.toJSON.call(this)},t.fromJSON=function(t){return Kt.prototype.fromJSON.call(this,t)},t.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&&"FeatureCollection"!==t.type)throw new Error("invalid geojson");e=ur(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},t}var pr=cr;function fr(t,e){var n,r,i={},o=[];return("LineString"===t.type&&(t=B(t)),"LineString"===e.type&&(e=B(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)?(n=gr(t,e))&&o.push(n):((r=pr()).load(Kn(e)),gt(Kn(t),function(n){gt(r.search(n),function(t){var e,t=gr(n,t);t&&(e=_(t).join(","),i[e]||(i[e]=!0,o.push(t)))})})),G(o)}function gr(t,e){t=_(t),e=_(e);if(2!==t.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==e.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var n,r=t[0][0],i=t[0][1],o=t[1][0],t=t[1][1],s=e[0][0],a=e[0][1],u=e[1][0],e=e[1][1],l=(e-a)*(o-r)-(u-s)*(t-i);return 0!=l&&(n=((o-r)*(i-a)-(t-i)*(r-s))/l,0<=(u=((u-s)*(i-a)-(e-a)*(r-s))/l))&&u<=1&&0<=n&&n<=1?R([r+u*(o-r),i+u*(t-i)]):null}function dr(t,l,h){void 0===h&&(h={});var c=R([1/0,1/0],{dist:1/0}),p=0;return vt(t,function(t){for(var e=_(t),n=0;n<e.length-1;n++){var r=R(e[n]),i=(r.properties.dist=Ge(l,r,h),R(e[n+1])),o=(i.properties.dist=Ge(l,i,h),Ge(r,i,h)),s=Math.max(r.properties.dist,i.properties.dist),a=Pn(r,i),u=Sn(l,s,a+90,h),s=Sn(l,s,a-90,h),a=fr(V([u.geometry.coordinates,s.geometry.coordinates]),V([r.geometry.coordinates,i.geometry.coordinates])),u=null;0<a.features.length&&((u=a.features[0]).properties.dist=Ge(l,u,h),u.properties.location=p+Ge(r,u,h)),r.properties.dist<c.properties.dist&&((c=r).properties.index=n,c.properties.location=p),i.properties.dist<c.properties.dist&&((c=i).properties.index=n+1,c.properties.location=p+o),u&&u.properties.dist<c.properties.dist&&((c=u).properties.index=n),p+=o}}),c}function yr(t,e,n){void 0===n&&(n={});var r,i,o,s,t=Mt(t),e=Mt(e);return e[0]+=180<e[0]-t[0]?-360:180<t[0]-e[0]?360:0,rt((r=q,i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,(e=Math.abs(e[0]-t[0])*Math.PI/180)>Math.PI&&(e-=2*Math.PI),o=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),o=1e-11<Math.abs(o)?s/o:Math.cos(i),Math.sqrt(s*s+o*o*e*e)*r),"meters",n.units)}function _r(t,e,s){if((s=void 0===s?{}:s).method||(s.method="geodesic"),s.units||(s.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=R(t):"Point"===t.type?t=B(t):Rt(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=V(e):"LineString"===e.type?e=B(e):Rt(e,"LineString","line");var a=1/0,u=t.geometry.coordinates;return Et(e,function(t){var e,n,r,i=t.geometry.coordinates[0],t=t.geometry.coordinates[1],o=(e=u,i=i,n=s,r=[(t=t)[0]-i[0],t[1]-i[1]],o=mr([e[0]-i[0],e[1]-i[1]],r),vr(e,o<=0?i:(e=mr(r,r))<=o?t:[i[0]+(t=o/e)*r[0],i[1]+t*r[1]],{method:n.method,units:"degrees"}));o<a&&(a=o)}),rt(a,"degrees",s.units)}function mr(t,e){return t[0]*e[0]+t[1]*e[1]}function vr(t,e,n){return("planar"===n.method?yr:Ge)(t,e,n)}function xr(t){for(var e="FeatureCollection"!==(t=t).type?"Feature"!==t.type?G([B(t)]):G([t]):t,n=Mn(e),r=!1,i=0;!r&&i<e.features.length;){var o=e.features[i].geometry,s=!1;if("Point"===o.type)n.geometry.coordinates[0]===o.coordinates[0]&&n.geometry.coordinates[1]===o.coordinates[1]&&(r=!0);else if("MultiPoint"===o.type)for(var a=!1,u=0;!a&&u<o.coordinates.length;)n.geometry.coordinates[0]===o.coordinates[u][0]&&n.geometry.coordinates[1]===o.coordinates[u][1]&&(a=r=!0),u++;else if("LineString"===o.type)for(u=0;!s&&u<o.coordinates.length-1;)Er(n.geometry.coordinates[0],n.geometry.coordinates[1],o.coordinates[u][0],o.coordinates[u][1],o.coordinates[u+1][0],o.coordinates[u+1][1])&&(r=s=!0),u++;else if("MultiLineString"===o.type)for(var l=0;l<o.coordinates.length;){s=!1,u=0;for(var h=o.coordinates[l];!s&&u<h.length-1;)Er(n.geometry.coordinates[0],n.geometry.coordinates[1],h[u][0],h[u][1],h[u+1][0],h[u+1][1])&&(r=s=!0),u++;l++}else"Polygon"!==o.type&&"MultiPolygon"!==o.type||De(n,o)&&(r=!0);i++}if(r)return n;for(var c=G([]),i=0;i<e.features.length;i++)c.features=c.features.concat(On(e.features[i]).features);return R(Zn(n,c).geometry.coordinates)}function Er(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=cr;var br=6378137;function wr(t){return mt(t,function(t,e){return t+function(t){var e,n=0;switch(t.type){case"Polygon":return Ir(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)n+=Ir(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)},0)}function Ir(t){var e=0;if(t&&0<t.length){e+=Math.abs(Nr(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(Nr(t[n]))}return e}function Nr(t){var e,n,r,i,o,s,a=0,u=t.length;if(2<u){for(s=0;s<u;s++)o=s===u-2?(r=u-2,i=u-1,0):s===u-1?(r=u-1,i=0,1):(i=(r=s)+1,s+2),e=t[r],n=t[i],a+=(Sr(t[o][0])-Sr(e[0]))*Math.sin(Sr(n[1]));a=a*br*br/2}return a}function Sr(t){return t*Math.PI/180}function Cr(t,n){return void 0===n&&(n={}),bt(t,function(t,e){e=e.geometry.coordinates;return t+Ge(e[0],e[1],n)},0)}function Pr(t,e,n,r){if(!st(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,t=i.length,l=0,h=0;h<i.length&&!(l<=e&&h===i.length-1);h++){if(e<l&&0===o.length){if(!(s=e-l))return o.push(i[h]),V(o);a=Pn(i[h],i[h-1])-180,u=Sn(i[h],s,a,r),o.push(u.geometry.coordinates)}if(n<=l)return(s=n-l)?(a=Pn(i[h],i[h-1])-180,u=Sn(i[h],s,a,r),o.push(u.geometry.coordinates)):o.push(i[h]),V(o);if(e<=l&&o.push(i[h]),h===i.length-1)return V(o);l+=Ge(i[h],i[h+1],r)}if(l<e&&i.length===t)throw new Error("Start position is beyond line");t=i[i.length-1];return V([t,t])}function Mr(t,e,n){void 0===n&&(n={});for(var r=Mt(t),i=_(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"),function(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],t=t[1],u=e[0],e=e[1],l=u-a,h=e-t,n=(n[0]-a)*h-(n[1]-t)*l;if(null!==i){if(Math.abs(n)>i)return}else if(0!=n)return;return r?"start"===r?Math.abs(l)>=Math.abs(h)?0<l?a<o&&o<=u:u<=o&&o<a:0<h?t<s&&s<=e:e<=s&&s<t:"end"===r?Math.abs(l)>=Math.abs(h)?0<l?a<=o&&o<u:u<o&&o<=a:0<h?t<=s&&s<e:e<s&&s<=t:"both"===r&&(Math.abs(l)>=Math.abs(h)?0<l?a<o&&o<u:u<o&&o<a:0<h?t<s&&s<e:e<s&&s<t):Math.abs(l)>=Math.abs(h)?0<l?a<=o&&o<=u:u<=o&&o<=a:0<h?t<=s&&s<=e:e<=s&&s<=t}(i[o],i[o+1],r,s,void 0===n.epsilon?null:n.epsilon))return!0}return!1}function Lr(t,e){var n=At(t),r=At(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":for(var s=n,a=r,u=!1,l=0;l<a.coordinates.length;l++)if(Rr(a.coordinates[l],s.coordinates)){u=!0;break}return u;case"LineString":return Mr(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return De(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":for(var h=n,c=r,p=0;p<h.coordinates.length;p++){for(var f=!1,g=0;g<c.coordinates.length;g++)Rr(h.coordinates[p],c.coordinates[g])&&(f=!0);if(!f)return!1}return!0;case"LineString":for(var d=n,y=r,_=!1,m=0;m<d.coordinates.length;m++){if(!Mr(d.coordinates[m],y))return!1;_=_||Mr(d.coordinates[m],y,{ignoreEndVertices:!0})}return _;case"Polygon":case"MultiPolygon":for(var v=n,x=r,E=!0,b=!1,w=0;w<v.coordinates.length;w++){if(!(b=De(v.coordinates[1],x))){E=!1;break}b=De(v.coordinates[1],x,{ignoreBoundary:!0})}return E&&b;default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":for(var I=n,N=r,S=0;S<I.coordinates.length;S++)if(!Mr(I.coordinates[S],N))return!1;return!0;case"Polygon":case"MultiPolygon":var C=n,P=r;if(!Or(Pt(P),Pt(C)))return!1;for(var M,L,O=!1,R=0;R<C.coordinates.length-1;R++){if(!De(C.coordinates[R],P))return!1;O=(O=O||De(C.coordinates[R],P,{ignoreBoundary:!0}))||De((M=C.coordinates[R],L=C.coordinates[R+1],[(M[0]+L[0])/2,(M[1]+L[1])/2]),P,{ignoreBoundary:!0})}return O;default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":var T=n,A=r,F=Pt(T);if(!Or(Pt(A),F))return!1;for(var D=0;D<T.coordinates[0].length;D++)if(!De(T.coordinates[0][D],A))return!1;return!0;default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function Or(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Rr(t,e){return t[0]===e[0]&&t[1]===e[1]}function Tr(t,e,n){(n=void 0===n?{}:n).mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],s=t[2],a=t[3],u=e/Ge([i,o],[s,o],n)*(s-i),l=e/Ge([i,o],[i,a],n)*(a-o),t=s-i,e=a-o,h=Math.floor(t/u),c=(e-Math.floor(e/l)*l)/2,p=i+(t-h*u)/2;p<=s;){for(var f=o+c;f<=a;){var g=R([p,f],n.properties);n.mask&&!Lr(g,n.mask)||r.push(g),f+=l}p+=u}return G(r)}function Ar(t,e){var n=(e=void 0===e?{}:e).precision,i=e.coordinates,e=e.mutate,n=null==n||isNaN(n)?6:n,i=null==i||isNaN(i)?3:i;if(!t)throw new Error("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof i)throw new Error("<coordinates> must be a number");!1!==e&&void 0!==e||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return ht(t,function(t){var e=t,n=o;e.length>i&&e.splice(i,e.length);for(var r=0;r<e.length;r++)e[r]=Math.round(e[r]*n)/n}),t}function Dr(t){var e;if(t)return e=[],vt(t,function(t){e.push(t)}),G(e);throw new Error("geojson is required")}function Fr(t,_,e){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");var m=t.geometry.coordinates,v=[],x={};if(e=void 0===e?1:e){for(var n=[],r=0;r<m.length;r++)for(var i=0;i<m[r].length-1;i++)n.push(c(r,i));var o=Kt();o.load(n)}for(var s=0;s<m.length;s++)for(var a=0;a<m[s].length-1;a++)if(e)o.search(c(s,a)).forEach(function(t){var e=t.ring,t=t.edge;h(s,a,e,t)});else for(var u=0;u<m.length;u++)for(var l=0;l<m[u].length-1;l++)h(s,a,u,l);return v=_?v:{type:"Feature",geometry:{type:"MultiPoint",coordinates:v}};function h(t,e,n,r){var i,o,s,a,u,l,h,c,p=m[t][e],f=m[t][e+1],g=m[n][r],d=m[n][r+1],y=(c=f,s=d,kr(i=p,o=g)||kr(i,s)||kr(c,o)||kr(s,o)||(y=i[0],i=i[1],a=c[0],c=c[1],u=o[0],o=o[1],l=s[0],0==(h=(y-a)*(o-(s=s[1]))-(i-c)*(u-l)))?null:[((y*c-i*a)*(u-l)-(y-a)*(u*s-o*l))/h,((y*c-i*a)*(o-s)-(i-c)*(u*s-o*l))/h]);null===y||(a=f[0]!==p[0]?(y[0]-p[0])/(f[0]-p[0]):(y[1]-p[1])/(f[1]-p[1]),i=d[0]!==g[0]?(y[0]-g[0])/(d[0]-g[0]):(y[1]-g[1])/(d[1]-g[1]),1<=a)||a<=0||1<=i||i<=0||((c=!x[y])&&(x[y]=!0),_?v.push(_(y,t,e,p,f,a,n,r,g,d,i,c)):v.push(y))}function c(t,e){var n,r,i=m[t][e],o=m[t][e+1],s=(i[0]<o[0]?(n=i[0],o):(n=o[0],i))[0],o=(i[1]<o[1]?(r=i[1],o):(r=o[1],i))[1];return{minX:n,minY:r,maxX:s,maxY:o,ring:t,edge:e}}}function kr(t,e){if(t&&e&&t.length===e.length){for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!kr(t[n],e[n]))return}else if(t[n]!==e[n])return;return 1}}function Gr(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];jr(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=Fr(t,function(t,e,n,r,i,o,s,a,u,l,h,c){return[t,e,n,r,i,o,s,a,u,l,h,c]}),a=s.length;if(0==a){for(var u=[],r=0;r<e;r++)u.push(k([t.geometry.coordinates[r]],{parent:-1,winding:function(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);{var r;r=zr([t[Ur(e-1,t.length-1)],t[e],t[Ur(e+1,t.length-1)]],!0)?1:-1}return r}(t.geometry.coordinates[r])}));var l=G(u)}else{var h=[],c=[];for(r=0;r<e;r++){h.push([]);for(var p=0;p<t.geometry.coordinates[r].length-1;p++)h[r].push([new qr(t.geometry.coordinates[r][Ur(p+1,t.geometry.coordinates[r].length-1)],1,[r,p],[r,Ur(p+1,t.geometry.coordinates[r].length-1)],void 0)]),c.push(new Br(t.geometry.coordinates[r][p],[r,Ur(p-1,t.geometry.coordinates[r].length-1)],[r,p],void 0,void 0,!1,!0))}for(r=0;r<a;r++)h[s[r][1]][s[r][2]].push(new qr(s[r][0],s[r][5],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0)),s[r][11]&&c.push(new Br(s[r][0],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0,void 0,!0,!0));var f=c.length;for(r=0;r<h.length;r++)for(p=0;p<h[r].length;p++)h[r][p].sort(function(t,e){return t.param<e.param?-1:1});var g=[];for(r=0;r<f;r++)g.push({minX:c[r].coord[0],minY:c[r].coord[1],maxX:c[r].coord[0],maxY:c[r].coord[1],index:r});var d=Kt();for(d.load(g),r=0;r<h.length;r++)for(p=0;p<h[r].length;p++)for(var y=0;y<h[r][p].length;y++){var _=(y==h[r][p].length-1?h[r][Ur(p+1,t.geometry.coordinates[r].length-1)][0]:h[r][p][y+1]).coord,m=d.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0];h[r][p][y].nxtIsectAlongEdgeIn=m.index}for(r=0;r<h.length;r++)for(p=0;p<h[r].length;p++)for(y=0;y<h[r][p].length;y++){var _=h[r][p][y].coord,v=(m=d.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0]).index;!(v<o)&&jr(c[v].ringAndEdge1,h[r][p][y].ringAndEdgeIn)?c[v].nxtIsectAlongRingAndEdge1=h[r][p][y].nxtIsectAlongEdgeIn:c[v].nxtIsectAlongRingAndEdge2=h[r][p][y].nxtIsectAlongEdgeIn}for(var x=[],p=r=0;p<e;p++){for(var E=r,y=0;y<t.geometry.coordinates[p].length-1;y++)c[r].coord[0]<c[E].coord[0]&&(E=r),r++;var b=c[E].nxtIsectAlongRingAndEdge2;for(y=0;y<c.length;y++)if(c[y].nxtIsectAlongRingAndEdge1==E||c[y].nxtIsectAlongRingAndEdge2==E){var w=y;break}b=zr([c[w].coord,c[E].coord,c[b].coord],!0)?1:-1;x.push({isect:E,parent:-1,winding:b})}for(x.sort(function(t,e){return c[t.isect].coord>c[e.isect].coord?-1:1}),u=[];0<x.length;){for(var I=x.pop(),N=I.isect,S=I.parent,C=I.winding,P=u.length,M=[c[N].coord],L=N,O=c[N].ringAndEdge1Walkable?(T=c[N].ringAndEdge1,c[N].nxtIsectAlongRingAndEdge1):(T=c[N].ringAndEdge2,c[N].nxtIsectAlongRingAndEdge2);!jr(c[N].coord,c[O].coord);){M.push(c[O].coord);var R,T,A=void 0;for(r=0;r<x.length;r++)if(x[r].isect==O){A=r;break}null!=A&&x.splice(A,1),O=jr(T,c[O].ringAndEdge1)?(T=c[O].ringAndEdge2,c[O].ringAndEdge2Walkable=!1,c[O].ringAndEdge1Walkable&&(R={isect:O},zr([c[L].coord,c[O].coord,c[c[O].nxtIsectAlongRingAndEdge2].coord],1==C)?(R.parent=S,R.winding=-C):(R.parent=P,R.winding=C),x.push(R)),c[L=O].nxtIsectAlongRingAndEdge2):(T=c[O].ringAndEdge1,c[O].ringAndEdge1Walkable=!1,c[O].ringAndEdge2Walkable&&(R={isect:O},zr([c[L].coord,c[O].coord,c[c[O].nxtIsectAlongRingAndEdge1].coord],1==C)?(R.parent=S,R.winding=-C):(R.parent=P,R.winding=C),x.push(R)),c[L=O].nxtIsectAlongRingAndEdge1)}M.push(c[O].coord),u.push(k([M],{index:P,parent:S,winding:C,netWinding:void 0}))}l=G(u)}return D(),F(),l;function D(){for(var t=[],e=0;e<l.features.length;e++)-1==l.features[e].properties.parent&&t.push(e);if(1<t.length)for(e=0;e<t.length;e++){for(var n=-1,r=0;r<l.features.length;r++)t[e]!=r&&De(l.features[t[e]].geometry.coordinates[0][0],l.features[r],{ignoreBoundary:!0})&&wr(l.features[r])<1/0&&(n=r);l.features[t[e]].properties.parent=n}}function F(){for(var t,e=0;e<l.features.length;e++)-1==l.features[e].properties.parent&&(t=l.features[e].properties.winding,function t(e,n){for(var r=0;r<l.features.length;r++){var i;l.features[r].properties.parent==e&&(i=n+l.features[r].properties.winding,l.features[r].properties.netWinding=i,t(r,i))}}(e,l.features[e].properties.netWinding=t))}}function qr(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i}function Br(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 zr(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 0<=(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])==e}function jr(t,e){if(t&&e&&t.length==e.length){for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!jr(t[n],e[n]))return}else if(t[n]!=e[n])return;return 1}}function Ur(t,e){return(t%e+e)%e}function Vr(t,e){this.lon=t,this.lat=e,this.x=Wr*t,this.y=Wr*e}function Xr(){this.coords=[],this.length=0}function Yr(t){this.properties=t||{},this.geometries=[]}function Hr(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 Vr(t.x,t.y),this.end=new Vr(e.x,e.y),this.properties=n||{};var n=this.start.x-this.end.x,r=this.start.y-this.end.y,r=Math.pow(Math.sin(r/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(n/2),2);if(this.g=2*Math.asin(Math.sqrt(r)),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)}var Wr=Math.PI/180,Jr=180/Math.PI;Vr.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},Vr.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new Vr(e,t)},Xr.prototype.move_to=function(t){this.length++,this.coords.push(t)},Yr.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}},Yr.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};function Zr(r,t){var i=[],o=pr();return vt(t,function(t){var e,n;i.forEach(function(t,e){t.id=e}),i.length?(e=o.search(t)).features.length&&(n=Qr(t,e),i=i.filter(function(t){return t.id!==n.id}),o.remove(n),gt(Kr(n,t),function(t){i.push(t),o.insert(t)})):((i=Kr(r,t).features).forEach(function(t){t.bbox||(t.bbox=Nn(Pt(t)))}),o.load(G(i)))}),G(i)}function Kr(t,i){var e,o,s=[],n=_(t)[0],r=_(t)[t.geometry.coordinates.length-1];return!$r(n,Mt(i))&&!$r(r,Mt(i))&&(r=pr(),e=Kn(t),r.load(e),(r=r.search(i)).features.length)?(o=Qr(i,r),1<(r=dt(e,function(t,e,n){var e=_(e)[1],r=Mt(i);return n===o.id?(t.push(r),s.push(V(t)),$r(r,e)?[r]:[r,e]):(t.push(e),t)},[n])).length&&s.push(V(r)),G(s)):G([t])}function Qr(n,t){var r,i;if(t.features.length)return 1===t.features.length?t.features[0]:(i=1/0,gt(t,function(t){var e=dr(t,n).properties.dist;e<i&&(r=t,i=e)}),r);throw new Error("lines must contain features")}function $r(t,e){return t[0]===e[0]&&t[1]===e[1]}function ti(t,e,n,r,i){var o=(i=void 0===i?{}:i).steps||64,n=ei(n),r=ei(r),s=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(n===r)return V(Cn(t,e,i).geometry.coordinates[0],s);for(var a=n,u=n<r?r:r+360,l=a,h=[],c=0;l<u;)h.push(Sn(t,e,l,i).geometry.coordinates),l=a+360*++c/o;return u<l&&h.push(Sn(t,e,u,i).geometry.coordinates),V(h,s)}function ei(t){t%=360;return t<0&&(t+=360),t}function ni(t,e){var n,r,i,o,s=At(t);switch((e=void 0===e?{}:e).properties||"Feature"!==t.type||(e.properties=t.properties),s.type){case"Polygon":return ri(s,e);case"MultiPolygon":return n=e,r=At(s).coordinates,i=(n=void 0===n?{}:n).properties||("Feature"===s.type?s.properties:{}),o=[],r.forEach(function(t){o.push(ii(t,i))}),G(o);default:throw new Error("invalid poly")}}function ri(t,e){return ii(At(t).coordinates,(e=void 0===e?{}:e).properties||("Feature"===t.type?t.properties:{}))}function ii(t,e){return 1<t.length?Y(t,e):V(t[0],e)}function oi(t,e){var n,r,i=(e=void 0===e?{}:e).properties,o=null==(n=e.autoComplete)||n,s=null==(n=e.orderCoords)||n;return"FeatureCollection"!==(t=null!=(n=e.mutate)&&n?t:je(t)).type?si(t,i,o,s):(r=[],t.features.forEach(function(t){r.push(_(si(t,{},o,s)))}),W(r,i))}function si(t,e,o,s){e=e||("Feature"===t.type?t.properties:{});var t=At(t),n=t.coordinates,r=t.type;if(!n.length)throw new Error("line must contain coordinates");switch(r){case"LineString":return k([n=o?ai(n):n],e);case"MultiLineString":var a=[],u=0;return n.forEach(function(t){var e,n,r,i;o&&(t=ai(t)),s&&(e=Pt(V(t)),n=e[0],r=e[1],i=e[2],e=e[3],n=Math.abs(n-i)*Math.abs(r-e),u<n)?(a.unshift(t),u=n):a.push(t)}),k(a,e);default:throw new Error("geometry type "+r+" is not supported")}}function ai(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],i=i[1];return n===o&&r===i||t.push(e),t}function ui(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 li(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 hi(t,e){for(var n=[],r=0,i=t;r<i.length;r++){var o=function(t,e){for(var n,r,i,o,s,a,u=1;u<=8;u*=2){for(n=[],i=!(li(r=t[t.length-1],e)&u),o=0;o<t.length;o++)(a=!(li(s=t[o],e)&u))!==i&&n.push(ui(r,s,u,e)),a&&n.push(s),r=s,i=a;if(!(t=n).length)break}return n}(i[r],e);0<o.length&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),4<=o.length)&&n.push(o)}return n}Hr.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),t=Math.sin(t*this.g)/Math.sin(this.g),n=e*Math.cos(this.start.y)*Math.cos(this.start.x)+t*Math.cos(this.end.y)*Math.cos(this.end.x),r=e*Math.cos(this.start.y)*Math.sin(this.start.x)+t*Math.cos(this.end.y)*Math.sin(this.end.x),e=e*Math.sin(this.start.y)+t*Math.sin(this.end.y),t=Jr*Math.atan2(e,Math.sqrt(Math.pow(n,2)+Math.pow(r,2)));return[Jr*Math.atan2(r,n),t]},Hr.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=this.interpolate(r*i);n.push(o)}for(var s=!1,a=0,e=e&&e.offset?e.offset:10,u=180-e,l=-180+e,h=360-e,c=1;c<n.length;++c){var p=n[c-1][0],f=n[c][0],g=Math.abs(f-p);h<g&&(u<f&&p<l||u<p&&f<l)?s=!0:a<g&&(a=g)}var d=[];if(s&&a<e){var y=[];d.push(y);for(var _=0;_<n.length;++_){var m,v,x,E,b,w=parseFloat(n[_][0]);0<_&&Math.abs(w-n[_-1][0])>h?(m=parseFloat(n[_-1][0]),v=parseFloat(n[_-1][1]),b=parseFloat(n[_][0]),x=parseFloat(n[_][1]),-180<m&&m<l&&180===b&&_+1<n.length&&-180<n[_-1][0]&&n[_-1][0]<l?(y.push([-180,n[_][1]]),_++,y.push([n[_][0],n[_][1]])):u<m&&m<180&&-180===b&&_+1<n.length&&n[_-1][0]>u&&n[_-1][0]<180?(y.push([180,n[_][1]]),_++,y.push([n[_][0],n[_][1]])):(m<l&&u<b&&(E=m,m=b,b=E,E=v,v=x,x=E),u<m&&b<l&&(b+=360),m<=180&&180<=b&&m<b?(y.push([n[_-1][0]>u?180:-180,b=(E=(180-m)/(b-m))*x+(1-E)*v]),(y=[]).push([n[_-1][0]>u?-180:180,b]),d.push(y)):d.push(y=[]),y.push([w,n[_][1]]))):y.push([n[_][0],n[_][1]])}}else{var I=[];d.push(I);for(var N=0;N<n.length;++N)I.push([n[N][0],n[N][1]])}for(var S=new Yr(this.properties),C=0;C<d.length;++C){var P=new Xr;S.geometries.push(P);for(var M=d[C],L=0;L<M.length;++L)P.move_to(M[L])}return S};var ci=ce(function(t,e){function n(t){var e,n=[];for(e in t)n.push(e);return n}(t.exports="function"==typeof Object.keys?Object.keys:n).shim=n}),pi=ce(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}),fi=ce(function(t){var a=Array.prototype.slice,u=t.exports=function(t,e,n){return n=n||{},t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:function(t,e,n){var r,i;if(l(t)||l(e))return!1;if(t.prototype!==e.prototype)return!1;if(pi(t))return!!pi(e)&&(t=a.call(t),e=a.call(e),u(t,e,n));if(h(t)){if(!h(e))return!1;if(t.length!==e.length)return!1;for(r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}try{var o=ci(t),s=ci(e)}catch(t){return!1}if(o.length!=s.length)return!1;for(o.sort(),s.sort(),r=o.length-1;0<=r;r--)if(o[r]!=s[r])return!1;for(r=o.length-1;0<=r;r--)if(i=o[r],!u(t[i],e[i],n))return!1;return typeof t==typeof e}(t,e,n))};function l(t){return null==t}function h(t){return t&&"object"==typeof t&&"number"==typeof t.length&&"function"==typeof t.copy&&"function"==typeof t.slice&&!(0<t.length&&"number"!=typeof t[0])}});function gi(t,e,n){var o,s,a,u;if(st(n=(n=void 0===n?{}:n)||{}))return s=n.tolerance||0,a=[],u=pr(),n=Kn(t),u.load(n),Et(e,function(r){var i=!1;r&&(gt(u.search(r),function(t){var e,n;!1===i&&(e=_(r).sort(),n=_(t).sort(),fi(e,n)||(0===s?Mr(e[0],t)&&Mr(e[1],t):dr(t,e[0]).properties.dist<=s&&dr(t,e[1]).properties.dist<=s)?(i=!0,o=o?di(o,r):r):(0===s?Mr(n[0],r)&&Mr(n[1],r):dr(r,n[0]).properties.dist<=s&&dr(r,n[1]).properties.dist<=s)&&(o=o?di(o,t):t))}),!1===i)&&o&&(a.push(o),o=void 0)}),o&&a.push(o),G(a);throw new Error("options is invalid")}function di(t,e){var e=_(e),n=_(t),r=n[0],n=n[n.length-1],i=t.geometry.coordinates;return fi(e[0],r)?i.unshift(e[1]):fi(e[0],n)?i.push(e[1]):fi(e[1],r)?i.unshift(e[0]):fi(e[1],n)&&i.push(e[0]),t}function yi(t){t%=360;return t<0&&(t+=360),t}function _i(t,e,n){return 180<(n=(n=void 0===n?{}:n).final?mi(Mt(e),Mt(t)):mi(Mt(t),Mt(e)))?-(360-n):n}function mi(t,e){var n=nt(t[1]),r=nt(e[1]),e=nt(e[0]-t[0]),t=(e>Math.PI&&(e-=2*Math.PI),e<-Math.PI&&(e+=2*Math.PI),Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)));return(et(Math.atan2(e,t))+360)%360}function vi(t,e,n,r){void 0===r&&(r={});var i,o,s,a=e<0,e=rt(Math.abs(e),r.units,"meters"),a=(a&&(e=-Math.abs(e)),Mt(t)),u=(t=e/q,e=a[0]*Math.PI/180,i=nt(a[1]),n=nt(n),o=t*Math.cos(n),s=i+o,Math.abs(s)>Math.PI/2&&(s=0<s?Math.PI-s:-Math.PI-s),u=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),o=1e-11<Math.abs(u)?o/u:Math.cos(i),[(180*(e+t*Math.sin(n)/o)/Math.PI+540)%360-180,180*s/Math.PI]);return u[0]+=180<u[0]-a[0]?-360:180<a[0]-u[0]?360:0,R(u,r.properties)}function xi(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=Ei(a,u,e),n<=0&&0<r?Ei(e,a,i)<0||(i=a):0<n&&r<=0&&(0<Ei(e,a,o)||(o=a)),n=r}return[i,o]}function Ei(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function bi(t){for(var e,n,r=_(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 0<i}function wi(t,e){switch(("Feature"===t.type?t.geometry:t).type){case"GeometryCollection":return _t(t,function(t){wi(t,e)}),t;case"LineString":return Ii(_(t),e),t;case"Polygon":return Ni(_(t),e),t;case"MultiLineString":return _(t).forEach(function(t){Ii(t,e)}),t;case"MultiPolygon":return _(t).forEach(function(t){Ni(t,e)}),t;case"Point":case"MultiPoint":return t}}function Ii(t,e){bi(t)===e&&t.reverse()}function Ni(t,e){bi(t[0])!==e&&t[0].reverse();for(var n=1;n<t.length;n++)bi(t[n])===e&&t[n].reverse()}var Si={successCallback:null,verbose:!1,polygons:!1},Ci={};function Pi(t,e,I,n){n=n||{};for(var r=Object.keys(Si),i=0;i<r.length;i++){var o=r[i],s=n[o];Ci[o]=null!=s?s:Si[o]}Ci.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+I)+"]");var a,u,t=function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=e+Math.abs(I),s=0;s<n;++s){i.cells[s]=[];for(var a=0;a<r;++a){var u,l,h,c,p,f,g,d,y,_,m,v=0,x=t[s+1][a],E=t[s+1][a+1],b=t[s][a+1],w=t[s][a];isNaN(x)||isNaN(E)||isNaN(b)||isNaN(w)||(u=v=(v=v|(x<e?0:o<x?128:64)|(E<e?0:o<E?32:16))|(b<e?0:o<b?8:4)|(w<e?0:o<w?2:1),l=0,17!==v&&18!==v&&33!==v&&34!==v&&38!==v&&68!==v&&72!==v&&98!==v&&102!==v&&132!==v&&136!==v&&137!==v&&152!==v&&153!==v||(l=o<(y=(x+E+b+w)/4)?2:y<e?0:1,34===v?1===l?v=35:0===l&&(v=136):136===v?1===l?(v=35,l=4):0===l&&(v=34):17===v?1===l?(v=155,l=4):0===l&&(v=153):68===v?1===l?(v=103,l=4):0===l&&(v=102):153===v?1===l&&(v=155):102===v?1===l&&(v=103):152===v?l<2&&(v=156,l=1):137===v?l<2&&(v=139,l=1):98===v?l<2&&(v=99,l=1):38===v?l<2&&(v=39,l=1):18===v?0<l?(v=156,l=4):v=152:33===v?0<l?(v=139,l=4):v=137:72===v?0<l?(v=99,l=4):v=98:132===v&&(0<l?(v=39,l=4):v=38)),0!=v&&170!=v&&(_=h=c=p=f=g=d=y=.5,m=[],1===v?(c=1-O(e,b,w),y=1-O(e,x,w),m.push(P[v])):169===v?(c=O(o,w,b),y=O(o,w,x),m.push(P[v])):4===v?(g=1-O(e,E,b),p=O(e,w,b),m.push(S[v])):166===v?(g=O(o,b,E),p=1-O(o,b,w),m.push(S[v])):16===v?(f=O(e,b,E),h=O(e,x,E),m.push(N[v])):154===v?(f=1-O(o,E,b),h=1-O(o,E,x),m.push(N[v])):64===v?(d=O(e,w,x),_=1-O(e,E,x),m.push(L[v])):106===v?(d=1-O(o,x,w),_=O(o,x,E),m.push(L[v])):168===v?(p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),m.push(C[v]),m.push(P[v])):2===v?(p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),m.push(C[v]),m.push(P[v])):162===v?(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),m.push(C[v]),m.push(P[v])):8===v?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),m.push(N[v]),m.push(S[v])):138===v?(f=1-O(e,E,b),g=1-O(o,E,b),_=1-O(o,E,x),h=1-O(e,E,x),m.push(N[v]),m.push(S[v])):32===v?(f=O(o,b,E),g=O(e,b,E),_=O(e,x,E),h=O(o,x,E),m.push(N[v]),m.push(S[v])):42===v?(y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),h=O(o,x,E),m.push(M[v]),m.push(L[v])):128===v&&(y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),h=1-O(e,E,x),m.push(M[v]),m.push(L[v])),5===v?(g=1-O(e,E,b),y=1-O(e,x,w),m.push(S[v])):165===v?(g=O(o,b,E),y=O(o,w,x),m.push(S[v])):20===v?(p=O(e,w,b),h=O(e,x,E),m.push(C[v])):150===v?(p=1-O(o,b,w),h=1-O(o,E,x),m.push(C[v])):80===v?(f=O(e,b,E),d=O(e,w,x),m.push(N[v])):90===v?(f=1-O(o,E,b),d=1-O(o,x,w),m.push(N[v])):65===v?(c=1-O(e,b,w),_=1-O(e,E,x),m.push(P[v])):105===v?(c=O(o,w,b),_=O(o,x,E),m.push(P[v])):160===v?(f=O(o,b,E),g=O(e,b,E),y=O(e,w,x),d=O(o,w,x),m.push(N[v]),m.push(S[v])):10===v?(f=1-O(e,E,b),g=1-O(o,E,b),y=1-O(o,x,w),d=1-O(e,x,w),m.push(N[v]),m.push(S[v])):130===v?(p=1-O(e,b,w),c=1-O(o,b,w),_=1-O(o,E,x),h=1-O(e,E,x),m.push(C[v]),m.push(P[v])):40===v?(p=O(o,w,b),c=O(e,w,b),_=O(e,x,E),h=O(o,x,E),m.push(C[v]),m.push(P[v])):101===v?(g=O(o,b,E),_=O(o,x,E),m.push(S[v])):69===v?(g=1-O(e,E,b),_=1-O(e,E,x),m.push(S[v])):149===v?(y=O(o,w,x),h=1-O(o,E,x),m.push(M[v])):21===v?(y=1-O(e,x,w),h=O(e,x,E),m.push(M[v])):86===v?(p=1-O(o,b,w),d=1-O(o,x,w),m.push(C[v])):84===v?(p=O(e,w,b),d=O(e,w,x),m.push(C[v])):89===v?(f=1-O(o,E,b),c=O(o,w,b),m.push(P[v])):81===v?(f=O(e,b,E),c=1-O(e,b,w),m.push(P[v])):96===v?(f=O(o,b,E),g=O(e,b,E),d=O(e,w,x),_=O(o,x,E),m.push(N[v]),m.push(S[v])):74===v?(f=1-O(e,E,b),g=1-O(o,E,b),d=1-O(o,x,w),_=1-O(e,E,x),m.push(N[v]),m.push(S[v])):24===v?(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),h=O(e,x,E),m.push(N[v]),m.push(P[v])):146===v?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),h=1-O(o,E,x),m.push(N[v]),m.push(P[v])):6===v?(g=1-O(e,E,b),p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),m.push(S[v]),m.push(C[v])):164===v?(g=O(o,b,E),p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),m.push(S[v]),m.push(C[v])):129===v?(c=1-O(e,b,w),y=O(o,w,x),_=1-O(o,E,x),h=1-O(e,E,x),m.push(P[v]),m.push(M[v])):41===v?(c=O(o,w,b),y=1-O(e,x,w),_=O(e,x,E),h=O(o,x,E),m.push(P[v]),m.push(M[v])):66===v?(p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),_=1-O(e,E,x),m.push(C[v]),m.push(P[v])):104===v?(p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),_=O(o,x,E),m.push(P[v]),m.push(so[v])):144===v?(f=O(e,b,E),y=O(e,w,x),d=O(o,w,x),h=1-O(o,E,x),m.push(N[v]),m.push(L[v])):26===v?(f=1-O(o,E,b),y=1-O(o,x,w),d=1-O(e,x,w),h=O(e,x,E),m.push(N[v]),m.push(L[v])):36===v?(g=O(o,b,E),p=O(e,w,b),_=O(e,x,E),h=O(o,x,E),m.push(S[v]),m.push(C[v])):134===v?(g=1-O(e,E,b),p=1-O(o,b,w),_=1-O(o,E,x),h=1-O(e,E,x),m.push(S[v]),m.push(C[v])):9===v?(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),y=1-O(e,x,w),m.push(N[v]),m.push(S[v])):161===v?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),y=O(o,w,x),m.push(N[v]),m.push(S[v])):37===v?(g=O(o,b,E),y=1-O(e,x,w),_=O(e,x,E),h=O(o,x,E),m.push(S[v]),m.push(M[v])):133===v?(g=1-O(e,E,b),y=O(o,w,x),_=1-O(o,E,x),h=1-O(e,E,x),m.push(S[v]),m.push(M[v])):148===v?(p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),h=1-O(o,E,x),m.push(C[v]),m.push(L[v])):22===v?(p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),h=O(e,x,E),m.push(C[v]),m.push(L[v])):82===v?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),m.push(N[v]),m.push(P[v])):88===v?(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),m.push(N[v]),m.push(P[v])):73===v?(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),_=1-O(e,E,x),m.push(N[v]),m.push(S[v])):97===v?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),_=O(o,x,E),m.push(N[v]),m.push(S[v])):145===v?(f=O(e,b,E),c=1-O(e,b,w),y=O(o,w,x),h=1-O(o,E,x),m.push(N[v]),m.push(M[v])):25===v?(f=1-O(o,E,b),c=O(o,w,b),y=1-O(e,x,w),h=O(e,x,E),m.push(N[v]),m.push(M[v])):70===v?(g=1-O(e,E,b),p=1-O(o,b,w),d=1-O(o,x,w),_=1-O(e,E,x),m.push(S[v]),m.push(C[v])):100===v?(g=O(o,b,E),p=O(e,w,b),d=O(e,w,x),_=O(o,x,E),m.push(S[v]),m.push(C[v])):34===v?(h=0===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(M[v]),m.push(L[v])):35===v?(h=4===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(P[v]),m.push(L[v])):136===v?(h=0===l?(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)):(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)),m.push(N[v]),m.push(S[v]),m.push(M[v]),m.push(L[v])):153===v?(h=0===l?(f=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(P[v])):102===v?(_=0===l?(g=1-O(e,E,b),p=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(S[v]),m.push(L[v])):155===v?(h=4===l?(f=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(M[v])):103===v?(_=4===l?(g=1-O(e,E,b),p=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(S[v]),m.push(C[v])):152===v?(h=0===l?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(C[v]),m.push(P[v])):156===v?(h=4===l?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(P[v]),m.push(L[v])):137===v?(h=0===l?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),_=O(e,x,E),O(o,x,E)):(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)),m.push(N[v]),m.push(S[v]),m.push(P[v])):139===v?(h=4===l?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),_=O(e,x,E),O(o,x,E)):(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)),m.push(N[v]),m.push(S[v]),m.push(M[v])):98===v?(_=0===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(L[v])):99===v?(_=4===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(P[v])):38===v?(h=0===l?(g=1-O(e,E,b),p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(S[v]),m.push(M[v]),m.push(L[v])):39===v?(h=4===l?(g=1-O(e,E,b),p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(S[v]),m.push(C[v]),m.push(L[v])):85===v&&(_=y=c=g=0,h=d=p=f=1),(_<0||1<_||h<0||1<h||f<0||1<f||p<0||1<p||y<0||1<y||d<0||1<d)&&console.log("MarchingSquaresJS-isoBands: "+v+" "+u+" "+x+","+E+","+b+","+w+" "+l+" "+_+" "+h+" "+f+" "+g+" "+p+" "+c+" "+y+" "+d),i.cells[s][a]={cval:v,cval_real:u,flipped:l,topleft:_,topright:h,righttop:f,rightbottom:g,bottomright:p,bottomleft:c,leftbottom:y,lefttop:d,edges:m}))}}return i}(t,e),e=Ci.polygons?(Ci.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),a=[],u=0,t.cells.forEach(function(t,n){t.forEach(function(t,e){void 0!==t&&("object"==typeof(t=l[t.cval](t))&&uo(t)?"object"==typeof t[0]&&uo(t[0])?"object"==typeof t[0][0]&&uo(t[0][0])?t.forEach(function(t){t.forEach(function(t){t[0]+=e,t[1]+=n}),a[u++]=t}):(t.forEach(function(t){t[0]+=e,t[1]+=n}),a[u++]=t):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates"))})}),a):(Ci.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),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]&&0<t.cells[o][s].edges.length){var a=function(t){if(0<t.edges.length){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Gi?{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&Gi?{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&ki?{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&ki?{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&ki?{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&ki?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&ki?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Gi?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&ki?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Gi?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}(t.cells[o][s]),u=s,l=o;null!==a&&i.push([a.p[0]+u,a.p[1]+l]);do{if(null===(h=function(t,e,n,r){var i,o,s,a,u,l=t.cval;switch(e){case-1:u=(0===r?(i=S[l],s=Xi[l],a=Yi[l],Hi):(i=N[l],s=ji[l],a=Ui[l],Vi))[l];break;case 1:u=(0===r?(i=M[l],s=ro[l],a=io[l],oo):(i=L[l],s=to[l],a=eo[l],no))[l];break;default:switch(n){case-1:u=(0===r?(i=so[l],s=c[l],a=p[l],f):(i=ao[l],s=qi[l],a=Bi[l],zi))[l];break;case 1:u=(0===r?(i=P[l],s=Wi[l],a=Ji[l],Zi):(i=C[l],s=Ki[l],a=Qi[l],$i))[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:n=l&Gi?(e=t.topleft,1):(e=1,t.righttop);break;case 1:n=4&l?(e=1,t.rightbottom):(e=t.topleft,1);break;case 2:n=4&l?(e=t.topleft,1):(e=t.bottomright,0);break;case 3:n=1&l?(e=t.bottomleft,0):(e=t.topleft,1);break;case 4:n=l&Gi?(e=t.topright,1):(e=1,t.righttop);break;case 5:n=4&l?(e=1,t.rightbottom):(e=t.topright,1);break;case 6:n=4&l?(e=t.topright,1):(e=t.bottomright,0);break;case 7:n=1&l?(e=t.bottomleft,0):(e=t.topright,1);break;case 8:n=4&l?(e=1,t.righttop):(e=t.bottomright,0);break;case 9:n=1&l?(e=t.bottomleft,0):(e=1,t.righttop);break;case 10:n=1&l?(e=1,t.righttop):(e=0,t.leftbottom);break;case 11:n=l&ki?(e=0,t.lefttop):(e=1,t.righttop);break;case 12:n=4&l?(e=1,t.rightbottom):(e=t.bottomright,0);break;case 13:n=1&l?(e=t.bottomleft,0):(e=1,t.rightbottom);break;case 14:n=1&l?(e=1,t.rightbottom):(e=0,t.leftbottom);break;case 15:n=l&ki?(e=0,t.lefttop):(e=1,t.rightbottom);break;case 16:n=4&l?(e=0,t.leftbottom):(e=t.bottomright,0);break;case 17:n=l&ki?(e=0,t.lefttop):(e=t.bottomright,0);break;case 18:n=1&l?(e=t.bottomleft,0):(e=0,t.leftbottom);break;case 19:n=l&ki?(e=0,t.lefttop):(e=t.bottomleft,0);break;case 20:n=l&ki?(e=0,t.leftbottom):(e=t.topleft,1);break;case 21:n=l&Gi?(e=t.topright,1):(e=0,t.leftbottom);break;case 22:n=l&ki?(e=0,t.lefttop):(e=t.topleft,1);break;case 23:n=l&Gi?(e=t.topright,1):(e=0,t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return void 0!==e&&void 0!==n&&void 0!==s&&void 0!==a&&void 0!==u||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+n+" "+s+" "+a+" "+u)),{p:[e,n],x:s,y:a,o:u}}(t.cells[l][u],a.x,a.y,a.o)))break;if(i.push([h.p[0]+u,h.p[1]+l]),u+=h.x,(l+=(a=h).y)<0||n<=l||u<0||r<=u||void 0===t.cells[l][u]){var h=function(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,l=n+i,h=[],c=!1;!c;){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)h.push([u,l]),r=-1,o=i=0;else{if(!(4&a)){h.push([u+s.bottomright,l]),o=i=1,c=!(r=0);break}h.push([u+1,l]),r=1,o=i=0}else{if(!(1&a)){if(4&a){h.push([u+s.bottomright,l]),o=i=1,c=!(r=0);break}h.push([u+s.bottomleft,l]),i=1,c=!(o=r=0);break}h.push([u,l]),r=-1,o=i=0}else if(1===i)if(0===o){if(!(a&Gi)){if(a&ki){h.push([u+s.topleft,l+1]),i=-1,c=!(o=r=0);break}h.push([u+s.topright,l+1]),i=-1,o=1,c=!(r=0);break}h.push([u+1,l+1]),i=0,o=r=1}else h.push([u+1,l+1]),i=0,o=r=1;else if(-1===r){if(0===o){if(!(a&ki)){if(1&a){h.push([u,l+s.leftbottom]),r=1,c=!(o=i=0);break}h.push([u,l+s.lefttop]),o=r=1,c=!(i=0);break}}else if(!(a&ki)){console.log("MarchingSquaresJS-isoBands: wtf");break}h.push([u,l+1]),i=1,o=r=0}else{if(1!==r){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(4&a)){h.push([u+1,l+s.rightbottom]),r=-1,c=!(o=i=0);break}}else if(!(4&a)){if(a&Gi){h.push([u+1,l+s.righttop]),r=-1,i=0,o=1;break}h.push([u+1,l+s.rightbottom]),r=-1,c=!(o=i=0);break}h.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)){h.push([u+s.bottomright,l]),o=i=1,c=!(r=0);break}h.push([u,l])}else{if(!(a&ki)){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])i=1,o=r=0;else{if(!(a&Gi)){h.push([u+s.topleft,l+1]),i=-1,c=!(o=r=0);break}h.push([u+1,l+1]),i=0,o=r=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;else{if(!(4&a)){h.push([u+1,l+s.righttop]),r=-1,o=1,c=!(i=0);break}h.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,o=i=0;else{if(!(a&ki)){h.push([u,l+s.leftbottom]),r=1,c=!(o=i=0);break}h.push([u,l+1]),i=1,o=r=0}}if(l+=i,(u+=r)===e&&l===n)break}return{path:h,i:u,j:l,x:r,y:i,o:o}}(t,u-=h.x,l-=h.y,h.x,h.y,h.o);if(null===h)break;h.path.forEach(function(t){i.push(t)}),u=h.i,l=h.j,a=h}}while(void 0!==t.cells[l][u]&&0<t.cells[l][u].edges.length);e.push(i),i=[],0<t.cells[o][s].edges.length&&s--}return e}(t));return"function"==typeof Ci.successCallback&&Ci.successCallback(e),e}function Mi(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]}function Li(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]}function Oi(t){return[[t.topright,1],[1,1],[1,t.righttop]]}function Ri(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]}function Ti(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]}function Ai(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]}function Di(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]}function Fi(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]}var ki=64,Gi=16,c=[],p=[],f=[],qi=[],Bi=[],zi=[],ji=[],Ui=[],Vi=[],Xi=[],Yi=[],Hi=[],Wi=[],Ji=[],Zi=[],Ki=[],Qi=[],$i=[],to=[],eo=[],no=[],ro=[],io=[],oo=[],N=(ji[85]=Xi[85]=-1,Ui[85]=Yi[85]=0,Vi[85]=Hi[85]=1,to[85]=ro[85]=1,eo[85]=io[85]=0,no[85]=oo[85]=1,c[85]=qi[85]=0,p[85]=Bi[85]=-1,f[85]=Zi[85]=0,Ki[85]=Wi[85]=0,Qi[85]=Ji[85]=1,zi[85]=$i[85]=1,ro[1]=ro[169]=0,io[1]=io[169]=-1,oo[1]=oo[169]=0,Wi[1]=Wi[169]=-1,Ji[1]=Ji[169]=0,Zi[1]=Zi[169]=0,Xi[4]=Xi[166]=0,Yi[4]=Yi[166]=-1,Hi[4]=Hi[166]=1,Ki[4]=Ki[166]=1,Qi[4]=Qi[166]=0,$i[4]=$i[166]=0,ji[16]=ji[154]=0,Ui[16]=Ui[154]=1,Vi[16]=Vi[154]=1,qi[16]=qi[154]=1,Bi[16]=Bi[154]=0,zi[16]=zi[154]=1,to[64]=to[106]=0,eo[64]=eo[106]=1,no[64]=no[106]=0,c[64]=c[106]=-1,p[64]=p[106]=0,f[64]=f[106]=1,to[2]=to[168]=0,eo[2]=eo[168]=-1,no[2]=no[168]=1,ro[2]=ro[168]=0,io[2]=io[168]=-1,oo[2]=oo[168]=0,Wi[2]=Wi[168]=-1,Ji[2]=Ji[168]=0,Zi[2]=Zi[168]=0,Ki[2]=Ki[168]=-1,Qi[2]=Qi[168]=0,$i[2]=$i[168]=1,ji[8]=ji[162]=0,Ui[8]=Ui[162]=-1,Vi[8]=Vi[162]=0,Xi[8]=Xi[162]=0,Yi[8]=Yi[162]=-1,Hi[8]=Hi[162]=1,Wi[8]=Wi[162]=1,Ji[8]=Ji[162]=0,Zi[8]=Zi[162]=1,Ki[8]=Ki[162]=1,Qi[8]=Qi[162]=0,$i[8]=$i[162]=0,ji[32]=ji[138]=0,Ui[32]=Ui[138]=1,Vi[32]=Vi[138]=1,Xi[32]=Xi[138]=0,Yi[32]=Yi[138]=1,Hi[32]=Hi[138]=0,c[32]=c[138]=1,p[32]=p[138]=0,f[32]=f[138]=0,qi[32]=qi[138]=1,Bi[32]=Bi[138]=0,zi[32]=zi[138]=1,ro[128]=ro[42]=0,io[128]=io[42]=1,oo[128]=oo[42]=1,to[128]=to[42]=0,eo[128]=eo[42]=1,no[128]=no[42]=0,c[128]=c[42]=-1,p[128]=p[42]=0,f[128]=f[42]=1,qi[128]=qi[42]=-1,Bi[128]=Bi[42]=0,zi[128]=zi[42]=0,Xi[5]=Xi[165]=-1,Yi[5]=Yi[165]=0,Hi[5]=Hi[165]=0,ro[5]=ro[165]=1,io[5]=io[165]=0,oo[5]=oo[165]=0,Ki[20]=Ki[150]=0,Qi[20]=Qi[150]=1,$i[20]=$i[150]=1,qi[20]=qi[150]=0,Bi[20]=Bi[150]=-1,zi[20]=zi[150]=1,ji[80]=ji[90]=-1,Ui[80]=Ui[90]=0,Vi[80]=Vi[90]=1,to[80]=to[90]=1,eo[80]=eo[90]=0,no[80]=no[90]=1,Wi[65]=Wi[105]=0,Ji[65]=Ji[105]=1,Zi[65]=Zi[105]=0,c[65]=c[105]=0,p[65]=p[105]=-1,f[65]=f[105]=0,ji[160]=ji[10]=-1,Ui[160]=Ui[10]=0,Vi[160]=Vi[10]=1,Xi[160]=Xi[10]=-1,Yi[160]=Yi[10]=0,Hi[160]=Hi[10]=0,ro[160]=ro[10]=1,io[160]=io[10]=0,oo[160]=oo[10]=0,to[160]=to[10]=1,eo[160]=eo[10]=0,no[160]=no[10]=1,Ki[130]=Ki[40]=0,Qi[130]=Qi[40]=1,$i[130]=$i[40]=1,Wi[130]=Wi[40]=0,Ji[130]=Ji[40]=1,Zi[130]=Zi[40]=0,c[130]=c[40]=0,p[130]=p[40]=-1,f[130]=f[40]=0,qi[130]=qi[40]=0,Bi[130]=Bi[40]=-1,zi[130]=zi[40]=1,Xi[37]=Xi[133]=0,Yi[37]=Yi[133]=1,Hi[37]=Hi[133]=1,ro[37]=ro[133]=0,io[37]=io[133]=1,oo[37]=oo[133]=0,c[37]=c[133]=-1,p[37]=p[133]=0,f[37]=f[133]=0,qi[37]=qi[133]=1,Bi[37]=Bi[133]=0,zi[37]=zi[133]=0,Ki[148]=Ki[22]=-1,Qi[148]=Qi[22]=0,$i[148]=$i[22]=0,ro[148]=ro[22]=0,io[148]=io[22]=-1,oo[148]=oo[22]=1,to[148]=to[22]=0,eo[148]=eo[22]=1,no[148]=no[22]=1,qi[148]=qi[22]=-1,Bi[148]=Bi[22]=0,zi[148]=zi[22]=1,ji[82]=ji[88]=0,Ui[82]=Ui[88]=-1,Vi[82]=Vi[88]=1,Ki[82]=Ki[88]=1,Qi[82]=Qi[88]=0,$i[82]=$i[88]=1,Wi[82]=Wi[88]=-1,Ji[82]=Ji[88]=0,Zi[82]=Zi[88]=1,to[82]=to[88]=0,eo[82]=eo[88]=-1,no[82]=no[88]=0,ji[73]=ji[97]=0,Ui[73]=Ui[97]=1,Vi[73]=Vi[97]=0,Xi[73]=Xi[97]=0,Yi[73]=Yi[97]=-1,Hi[73]=Hi[97]=0,Wi[73]=Wi[97]=1,Ji[73]=Ji[97]=0,Zi[73]=Zi[97]=0,c[73]=c[97]=1,p[73]=p[97]=0,f[73]=f[97]=1,ji[145]=ji[25]=0,Ui[145]=Ui[25]=-1,Vi[145]=Vi[25]=0,Wi[145]=Wi[25]=1,Ji[145]=Ji[25]=0,Zi[145]=Zi[25]=1,ro[145]=ro[25]=0,io[145]=io[25]=1,oo[145]=oo[25]=1,qi[145]=qi[25]=-1,Bi[145]=Bi[25]=0,zi[145]=zi[25]=0,Xi[70]=Xi[100]=0,Yi[70]=Yi[100]=1,Hi[70]=Hi[100]=0,Ki[70]=Ki[100]=-1,Qi[70]=Qi[100]=0,$i[70]=$i[100]=1,to[70]=to[100]=0,eo[70]=eo[100]=-1,no[70]=no[100]=1,c[70]=c[100]=1,p[70]=p[100]=0,f[70]=f[100]=0,Xi[101]=Xi[69]=0,Yi[101]=Yi[69]=1,Hi[101]=Hi[69]=0,c[101]=c[69]=1,p[101]=p[69]=0,f[101]=f[69]=0,ro[149]=ro[21]=0,io[149]=io[21]=1,oo[149]=oo[21]=1,qi[149]=qi[21]=-1,Bi[149]=Bi[21]=0,zi[149]=zi[21]=0,Ki[86]=Ki[84]=-1,Qi[86]=Qi[84]=0,$i[86]=$i[84]=1,to[86]=to[84]=0,eo[86]=eo[84]=-1,no[86]=no[84]=1,ji[89]=ji[81]=0,Ui[89]=Ui[81]=-1,Vi[89]=Vi[81]=0,Wi[89]=Wi[81]=1,Ji[89]=Ji[81]=0,Zi[89]=Zi[81]=1,ji[96]=ji[74]=0,Ui[96]=Ui[74]=1,Vi[96]=Vi[74]=0,Xi[96]=Xi[74]=-1,Yi[96]=Yi[74]=0,Hi[96]=Hi[74]=1,to[96]=to[74]=1,eo[96]=eo[74]=0,no[96]=no[74]=0,c[96]=c[74]=1,p[96]=p[74]=0,f[96]=f[74]=1,ji[24]=ji[146]=0,Ui[24]=Ui[146]=-1,Vi[24]=Vi[146]=1,Ki[24]=Ki[146]=1,Qi[24]=Qi[146]=0,$i[24]=$i[146]=1,Wi[24]=Wi[146]=0,Ji[24]=Ji[146]=1,Zi[24]=Zi[146]=1,qi[24]=qi[146]=0,Bi[24]=Bi[146]=-1,zi[24]=zi[146]=0,Xi[6]=Xi[164]=-1,Yi[6]=Yi[164]=0,Hi[6]=Hi[164]=1,Ki[6]=Ki[164]=-1,Qi[6]=Qi[164]=0,$i[6]=$i[164]=0,ro[6]=ro[164]=0,io[6]=io[164]=-1,oo[6]=oo[164]=1,to[6]=to[164]=1,eo[6]=eo[164]=0,no[6]=no[164]=0,Wi[129]=Wi[41]=0,Ji[129]=Ji[41]=1,Zi[129]=Zi[41]=1,ro[129]=ro[41]=0,io[129]=io[41]=1,oo[129]=oo[41]=0,c[129]=c[41]=-1,p[129]=p[41]=0,f[129]=f[41]=0,qi[129]=qi[41]=0,Bi[129]=Bi[41]=-1,zi[129]=zi[41]=0,Ki[66]=Ki[104]=0,Qi[66]=Qi[104]=1,$i[66]=$i[104]=0,Wi[66]=Wi[104]=-1,Ji[66]=Ji[104]=0,Zi[66]=Zi[104]=1,to[66]=to[104]=0,eo[66]=eo[104]=-1,no[66]=no[104]=0,c[66]=c[104]=0,p[66]=p[104]=-1,f[66]=f[104]=1,ji[144]=ji[26]=-1,Ui[144]=Ui[26]=0,Vi[144]=Vi[26]=0,ro[144]=ro[26]=1,io[144]=io[26]=0,oo[144]=oo[26]=1,to[144]=to[26]=0,eo[144]=eo[26]=1,no[144]=no[26]=1,qi[144]=qi[26]=-1,Bi[144]=Bi[26]=0,zi[144]=zi[26]=1,Xi[36]=Xi[134]=0,Yi[36]=Yi[134]=1,Hi[36]=Hi[134]=1,Ki[36]=Ki[134]=0,Qi[36]=Qi[134]=1,$i[36]=$i[134]=0,c[36]=c[134]=0,p[36]=p[134]=-1,f[36]=f[134]=1,qi[36]=qi[134]=1,Bi[36]=Bi[134]=0,zi[36]=zi[134]=0,ji[9]=ji[161]=-1,Ui[9]=Ui[161]=0,Vi[9]=Vi[161]=0,Xi[9]=Xi[161]=0,Yi[9]=Yi[161]=-1,Hi[9]=Hi[161]=0,Wi[9]=Wi[161]=1,Ji[9]=Ji[161]=0,Zi[9]=Zi[161]=0,ro[9]=ro[161]=1,io[9]=io[161]=0,oo[9]=oo[161]=1,ji[136]=0,Ui[136]=1,Vi[136]=1,Xi[136]=0,Yi[136]=1,Hi[136]=0,Ki[136]=-1,Qi[136]=0,$i[136]=1,Wi[136]=-1,Ji[136]=0,Zi[136]=0,ro[136]=0,io[136]=-1,oo[136]=0,to[136]=0,eo[136]=-1,no[136]=1,c[136]=1,p[136]=0,f[136]=0,qi[136]=1,Bi[136]=0,zi[136]=1,ji[34]=0,Ui[34]=-1,Vi[34]=0,Xi[34]=0,Yi[34]=-1,Hi[34]=1,Ki[34]=1,Qi[34]=0,$i[34]=0,Wi[34]=1,Ji[34]=0,Zi[34]=1,ro[34]=0,io[34]=1,oo[34]=1,to[34]=0,eo[34]=1,no[34]=0,c[34]=-1,p[34]=0,f[34]=1,qi[34]=-1,Bi[34]=0,zi[34]=0,ji[35]=0,Ui[35]=1,Vi[35]=1,Xi[35]=0,Yi[35]=-1,Hi[35]=1,Ki[35]=1,Qi[35]=0,$i[35]=0,Wi[35]=-1,Ji[35]=0,Zi[35]=0,ro[35]=0,io[35]=-1,oo[35]=0,to[35]=0,eo[35]=1,no[35]=0,c[35]=-1,p[35]=0,f[35]=1,qi[35]=1,Bi[35]=0,zi[35]=1,ji[153]=0,Ui[153]=1,Vi[153]=1,Wi[153]=-1,Ji[153]=0,Zi[153]=0,ro[153]=0,io[153]=-1,oo[153]=0,qi[153]=1,Bi[153]=0,zi[153]=1,Xi[102]=0,Yi[102]=-1,Hi[102]=1,Ki[102]=1,Qi[102]=0,$i[102]=0,to[102]=0,eo[102]=1,no[102]=0,c[102]=-1,p[102]=0,f[102]=1,ji[155]=0,Ui[155]=-1,Vi[155]=0,Wi[155]=1,Ji[155]=0,Zi[155]=1,ro[155]=0,io[155]=1,oo[155]=1,qi[155]=-1,Bi[155]=0,zi[155]=0,Xi[103]=0,Yi[103]=1,Hi[103]=0,Ki[103]=-1,Qi[103]=0,$i[103]=1,to[103]=0,eo[103]=-1,no[103]=1,c[103]=1,p[103]=0,f[103]=0,ji[152]=0,Ui[152]=1,Vi[152]=1,Ki[152]=-1,Qi[152]=0,$i[152]=1,Wi[152]=-1,Ji[152]=0,Zi[152]=0,ro[152]=0,io[152]=-1,oo[152]=0,to[152]=0,eo[152]=-1,no[152]=1,qi[152]=1,Bi[152]=0,zi[152]=1,ji[156]=0,Ui[156]=-1,Vi[156]=1,Ki[156]=1,Qi[156]=0,$i[156]=1,Wi[156]=-1,Ji[156]=0,Zi[156]=0,ro[156]=0,io[156]=-1,oo[156]=0,to[156]=0,eo[156]=1,no[156]=1,qi[156]=-1,Bi[156]=0,zi[156]=1,ji[137]=0,Ui[137]=1,Vi[137]=1,Xi[137]=0,Yi[137]=1,Hi[137]=0,Wi[137]=-1,Ji[137]=0,Zi[137]=0,ro[137]=0,io[137]=-1,oo[137]=0,c[137]=1,p[137]=0,f[137]=0,qi[137]=1,Bi[137]=0,zi[137]=1,ji[139]=0,Ui[139]=1,Vi[139]=1,Xi[139]=0,Yi[139]=-1,Hi[139]=0,Wi[139]=1,Ji[139]=0,Zi[139]=0,ro[139]=0,io[139]=1,oo[139]=0,c[139]=-1,p[139]=0,f[139]=0,qi[139]=1,Bi[139]=0,zi[139]=1,ji[98]=0,Ui[98]=-1,Vi[98]=0,Xi[98]=0,Yi[98]=-1,Hi[98]=1,Ki[98]=1,Qi[98]=0,$i[98]=0,Wi[98]=1,Ji[98]=0,Zi[98]=1,to[98]=0,eo[98]=1,no[98]=0,c[98]=-1,p[98]=0,f[98]=1,ji[99]=0,Ui[99]=1,Vi[99]=0,Xi[99]=0,Yi[99]=-1,Hi[99]=1,Ki[99]=1,Qi[99]=0,$i[99]=0,Wi[99]=-1,Ji[99]=0,Zi[99]=1,to[99]=0,eo[99]=-1,no[99]=0,c[99]=1,p[99]=0,f[99]=1,Xi[38]=0,Yi[38]=-1,Hi[38]=1,Ki[38]=1,Qi[38]=0,$i[38]=0,ro[38]=0,io[38]=1,oo[38]=1,to[38]=0,eo[38]=1,no[38]=0,c[38]=-1,p[38]=0,f[38]=1,qi[38]=-1,Bi[38]=0,zi[38]=0,Xi[39]=0,Yi[39]=1,Hi[39]=1,Ki[39]=-1,Qi[39]=0,$i[39]=0,ro[39]=0,io[39]=-1,oo[39]=1,to[39]=0,eo[39]=1,no[39]=0,c[39]=-1,p[39]=0,f[39]=1,qi[39]=1,Bi[39]=0,zi[39]=0,[]),S=[],C=[],P=[],M=[],L=[],so=[],ao=[],l=(P[1]=M[1]=18,P[169]=M[169]=18,C[4]=S[4]=12,C[166]=S[166]=12,N[16]=ao[16]=4,N[154]=ao[154]=4,L[64]=so[64]=22,L[106]=so[106]=22,C[2]=L[2]=17,P[2]=M[2]=18,C[168]=L[168]=17,P[168]=M[168]=18,N[8]=P[8]=9,S[8]=C[8]=12,N[162]=P[162]=9,S[162]=C[162]=12,N[32]=ao[32]=4,S[32]=so[32]=1,N[138]=ao[138]=4,S[138]=so[138]=1,M[128]=ao[128]=21,L[128]=so[128]=22,M[42]=ao[42]=21,L[42]=so[42]=22,S[5]=M[5]=14,S[165]=M[165]=14,C[20]=ao[20]=6,C[150]=ao[150]=6,N[80]=L[80]=11,N[90]=L[90]=11,P[65]=so[65]=3,P[105]=so[105]=3,N[160]=L[160]=11,S[160]=M[160]=14,N[10]=L[10]=11,S[10]=M[10]=14,C[130]=ao[130]=6,P[130]=so[130]=3,C[40]=ao[40]=6,P[40]=so[40]=3,S[101]=so[101]=1,S[69]=so[69]=1,M[149]=ao[149]=21,M[21]=ao[21]=21,C[86]=L[86]=17,C[84]=L[84]=17,N[89]=P[89]=9,N[81]=P[81]=9,N[96]=so[96]=0,S[96]=L[96]=15,N[74]=so[74]=0,S[74]=L[74]=15,N[24]=C[24]=8,P[24]=ao[24]=7,N[146]=C[146]=8,P[146]=ao[146]=7,S[6]=L[6]=15,C[6]=M[6]=16,S[164]=L[164]=15,C[164]=M[164]=16,P[129]=ao[129]=7,M[129]=so[129]=20,P[41]=ao[41]=7,M[41]=so[41]=20,C[66]=so[66]=2,P[66]=L[66]=19,C[104]=so[104]=2,P[104]=L[104]=19,N[144]=M[144]=10,L[144]=ao[144]=23,N[26]=M[26]=10,L[26]=ao[26]=23,S[36]=ao[36]=5,C[36]=so[36]=2,S[134]=ao[134]=5,C[134]=so[134]=2,N[9]=M[9]=10,S[9]=P[9]=13,N[161]=M[161]=10,S[161]=P[161]=13,S[37]=ao[37]=5,M[37]=so[37]=20,S[133]=ao[133]=5,M[133]=so[133]=20,C[148]=M[148]=16,L[148]=ao[148]=23,C[22]=M[22]=16,L[22]=ao[22]=23,N[82]=C[82]=8,P[82]=L[82]=19,N[88]=C[88]=8,P[88]=L[88]=19,N[73]=so[73]=0,S[73]=P[73]=13,N[97]=so[97]=0,S[97]=P[97]=13,N[145]=P[145]=9,M[145]=ao[145]=21,N[25]=P[25]=9,M[25]=ao[25]=21,S[70]=so[70]=1,C[70]=L[70]=17,S[100]=so[100]=1,C[100]=L[100]=17,N[34]=P[34]=9,S[34]=C[34]=12,M[34]=ao[34]=21,L[34]=so[34]=22,N[136]=ao[136]=4,S[136]=so[136]=1,C[136]=L[136]=17,P[136]=M[136]=18,N[35]=ao[35]=4,S[35]=C[35]=12,P[35]=M[35]=18,L[35]=so[35]=22,N[153]=ao[153]=4,P[153]=M[153]=18,S[102]=C[102]=12,L[102]=so[102]=22,N[155]=P[155]=9,M[155]=ao[155]=23,S[103]=so[103]=1,C[103]=L[103]=17,N[152]=ao[152]=4,C[152]=L[152]=17,P[152]=M[152]=18,N[156]=C[156]=8,P[156]=M[156]=18,L[156]=ao[156]=23,N[137]=ao[137]=4,S[137]=so[137]=1,P[137]=M[137]=18,N[139]=ao[139]=4,S[139]=P[139]=13,M[139]=so[139]=20,N[98]=P[98]=9,S[98]=C[98]=12,L[98]=so[98]=22,N[99]=so[99]=0,S[99]=C[99]=12,P[99]=L[99]=19,S[38]=C[38]=12,M[38]=ao[38]=21,L[38]=so[38]=22,S[39]=ao[39]=5,C[39]=M[39]=16,L[39]=so[39]=22,[]);function O(t,e,n){return(t-e)/(n-e)}function uo(t){return-1<t.constructor.toString().indexOf("Array")}function lo(t){for(var e=t.map(function(t){return{lrCoordinates:t,grouped:!1}}),n=[];!function(t){for(var e=0;e<t.length;e++)if(!1===t[e].grouped)return;return 1}(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=k([e[r].lrCoordinates]),s=r+1;s<e.length;s++)!e[s].grouped&&function(t,e){for(var n=On(t),r=0;r<n.features.length;r++)if(!De(n.features[r],e))return;return 1}(k([e[s].lrCoordinates]),o)&&(i.push(e[s].lrCoordinates),e[s].grouped=!0);n.push(i)}return n}function ho(t,r,e){if(!st(e=e||{}))throw new Error("options is invalid");var i=e.pivot,e=e.mutate;if(!t)throw new Error("geojson is required");if(null==r||isNaN(r))throw new Error("angle is required");return 0!==r&&(i=i||Ln(t),ht(t=!1!==e&&void 0!==e?t:je(t),function(t){var e=_i(i,t)+r,n=yr(i,t),n=_(vi(i,n,e));t[0]=n[0],t[1]=n[1]})),t}function co(n,r,t){if(!st(t=t||{}))throw new Error("options is invalid");var i=t.origin,t=t.mutate;if(!n)throw new Error("geojson required");if("number"!=typeof r||0===r)throw new Error("invalid factor");var e=Array.isArray(i)||"object"==typeof i;return"FeatureCollection"!==(n=!0!==t?je(n):n).type||e?po(n,r,i):(gt(n,function(t,e){n.features[e]=po(t,r,i)}),n)}function po(t,r,i){var e="Point"===Dt(t);return i=function(t,e){if(null==e&&(e="centroid"),Array.isArray(e)||"object"==typeof e)return Mt(e);var n=t.bbox||Pt(t),r=n[0],i=n[1],o=n[2],s=n[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return R([r,i]);case"se":case"southeast":case"eastsouth":case"bottomright":return R([o,i]);case"nw":case"northwest":case"westnorth":case"topleft":return R([r,s]);case"ne":case"northeast":case"eastnorth":case"topright":return R([o,s]);case"center":return Mn(t);case void 0:case null:case"centroid":return Ln(t);default:throw new Error("invalid origin")}}(t,i),1===r||e||ht(t,function(t){var e=yr(i,t),n=_i(i,t),e=_(vi(i,e*r,n));t[0]=e[0],t[1]=e[1],3===t.length&&(t[2]*=r)}),t}function fo(t){var e=t[0],t=t[1];return[t[0]-e[0],t[1]-e[1]]}function go(t,e){return t[0]*e[1]-e[0]*t[1]}function yo(t,e,n){var u=[],l=$(e,n),h=_(t),c=[];return h.forEach(function(t,e){var n,r,i,o,s,a;e!==h.length-1&&(t=t,r=h[e+1],i=l,o=Math.sqrt((t[0]-r[0])*(t[0]-r[0])+(t[1]-r[1])*(t[1]-r[1])),s=t[0]+i*(r[1]-t[1])/o,a=r[0]+i*(r[1]-t[1])/o,s=[[s,t[1]+i*(t[0]-r[0])/o],[a,r[1]+i*(t[0]-r[0])/o]],u.push(s),0<e&&(i=a=u[e-1],!1!==(n=!(0===go(fo(t=s),fo(i)))&&(r=t[0],t=fo(t),o=i[0],i=fo(i),n=go(t,i),o=go([o[0]-r[0],o[1]-r[1]],i)/n,i=[o*t[0],o*t[1]],[r[0]+i[0],r[1]+i[1]]))&&(a[1]=n,s[0]=n),c.push(a[0]),e===h.length-2)&&(c.push(s[0]),c.push(s[1])),2===h.length)&&(c.push(s[0]),c.push(s[1]))}),V(c,t.properties)}function _o(t,e,n){var r=e[0]-t[0],t=e[1]-t[1],i=n[0]-e[0];return(0<(r=r*(n[1]-e[1])-i*t))-(r<0)||r}function mo(e,t){return t.geometry.coordinates[0].every(function(t){return De(R(t),e)})}l[1]=l[169]=Mi,l[4]=l[166]=Li,l[16]=l[154]=Oi,l[64]=l[106]=Ri,l[168]=l[2]=Ti,l[162]=l[8]=Ai,l[138]=l[32]=Di,l[42]=l[128]=Fi,l[5]=l[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},l[20]=l[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},l[80]=l[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},l[65]=l[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},l[160]=l[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},l[130]=l[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},l[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},l[101]=l[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},l[149]=l[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},l[86]=l[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},l[89]=l[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},l[96]=l[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},l[24]=l[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},l[6]=l[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},l[129]=l[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},l[66]=l[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[144]=l[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},l[36]=l[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},l[9]=l[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},l[37]=l[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},l[148]=l[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},l[82]=l[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},l[73]=l[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},l[145]=l[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},l[70]=l[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[34]=function(t){return[Fi(t),Ai(t)]},l[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]]},l[136]=function(t){return[Di(t),Ti(t)]},l[153]=function(t){return[Oi(t),Mi(t)]},l[102]=function(t){return[Li(t),Ri(t)]},l[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},l[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[152]=function(t){return[Oi(t),Ti(t)]},l[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},l[137]=function(t){return[Di(t),Mi(t)]},l[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},l[98]=function(t){return[Ai(t),Ri(t)]},l[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[38]=function(t){return[Li(t),Fi(t)]},l[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};Io.buildId=function(t){return t.join(",")},Io.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(t){return t.from.id!==e.from.id})},Io.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(t){return t.to.id!==e.to.id})},Io.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},Io.prototype.sortOuterEdges=function(){var r=this;this.outerEdgesSorted||(this.outerEdges.sort(function(t,e){var n,t=t.to,e=e.to;return 0<=t.coordinates[0]-r.coordinates[0]&&e.coordinates[0]-r.coordinates[0]<0?1:t.coordinates[0]-r.coordinates[0]<0&&0<=e.coordinates[0]-r.coordinates[0]?-1:t.coordinates[0]-r.coordinates[0]==0&&e.coordinates[0]-r.coordinates[0]==0?0<=t.coordinates[1]-r.coordinates[1]||0<=e.coordinates[1]-r.coordinates[1]?t.coordinates[1]-e.coordinates[1]:e.coordinates[1]-t.coordinates[1]:(n=_o(r.coordinates,t.coordinates,e.coordinates))<0?1:0<n?-1:Math.pow(t.coordinates[0]-r.coordinates[0],2)+Math.pow(t.coordinates[1]-r.coordinates[1],2)-(Math.pow(e.coordinates[0]-r.coordinates[0],2)+Math.pow(e.coordinates[1]-r.coordinates[1],2))}),this.outerEdgesSorted=!0)},Io.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},Io.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},Io.prototype.addInnerEdge=function(t){this.innerEdges.push(t)};var vo=Io,xo=(wo.prototype.getSymetric=function(){return this.symetric||(this.symetric=new wo(this.to,this.from),this.symetric.symetric=this),this.symetric},wo.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},wo.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},wo.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},wo.prototype.toLineString=function(){return V([this.from.coordinates,this.to.coordinates])},wo.prototype.compareTo=function(t){return _o(t.from.coordinates,t.to.coordinates,this.to.coordinates)},wo),Eo=(bo.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},bo.prototype.get=function(t){return this.edges[t]},Object.defineProperty(bo.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),bo.prototype.forEach=function(t){this.edges.forEach(t)},bo.prototype.map=function(t){return this.edges.map(t)},bo.prototype.some=function(t){return this.edges.some(t)},bo.prototype.isValid=function(){return!0},bo.prototype.isHole=function(){var r=this,t=this.edges.reduce(function(t,e,n){return t=e.from.coordinates[1]>r.edges[t].from.coordinates[1]?n:t},0),e=(0===t?this.length:t)-1,n=(t+1)%this.length,t=_o(this.edges[e].from.coordinates,this.edges[t].from.coordinates,this.edges[n].from.coordinates);return 0===t?this.edges[e].from.coordinates[0]>this.edges[n].from.coordinates[0]:0<t},bo.prototype.toMultiPoint=function(){return H(this.edges.map(function(t){return t.from.coordinates}))},bo.prototype.toPolygon=function(){var t;return this.polygon||((t=this.edges.map(function(t){return t.from.coordinates})).push(this.edges[0].from.coordinates),this.polygon=k([t]))},bo.prototype.getEnvelope=function(){return this.envelope||(this.envelope=In(this.toPolygon()))},bo.findEdgeRingContaining=function(l,t){var h,c,p=l.getEnvelope();return t.forEach(function(t){var e,n,r,i=t.getEnvelope();if(c&&(h=c.getEnvelope()),r=p,o=(e=i).geometry.coordinates[0].map(function(t){return t[0]}),e=e.geometry.coordinates[0].map(function(t){return t[1]}),n=r.geometry.coordinates[0].map(function(t){return t[0]}),r=r.geometry.coordinates[0].map(function(t){return t[1]}),(Math.max.apply(null,o)!==Math.max.apply(null,n)||Math.max.apply(null,e)!==Math.max.apply(null,r)||Math.min.apply(null,o)!==Math.min.apply(null,n)||Math.min.apply(null,e)!==Math.min.apply(null,r))&&mo(i,p)){for(var o=l.map(function(t){return t.from.coordinates}),s=void 0,a=0,u=o;a<u.length;a++)!function(e){t.some(function(t){return t=t.from.coordinates,e[0]===t[0]&&e[1]===t[1]})||(s=e)}(u[a]);s&&t.inside(R(s))&&(c&&!mo(h,i)||(c=t))}}),c},bo.prototype.inside=function(t){return De(t,this.toPolygon())},bo);function bo(){this.edges=[],this.polygon=void 0,this.envelope=void 0}function wo(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)}function Io(t){this.id=Io.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}So.fromGeoJson=function(t){var e=t;if(!e)throw new Error("No geojson passed");if("FeatureCollection"!==e.type&&"GeometryCollection"!==e.type&&"MultiLineString"!==e.type&&"LineString"!==e.type&&"Feature"!==e.type)throw new Error("Invalid input type '"+e.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature");var r=new So;return vt(t,function(t){Rt(t,"LineString","Graph::fromGeoJson"),ct(t,function(t,e){var n;return t&&(t=r.getNode(t),n=r.getNode(e),r.addEdge(t,n)),e})}),r},So.prototype.getNode=function(t){var e=vo.buildId(t);return this.nodes[e]||(this.nodes[e]=new vo(t))},So.prototype.addEdge=function(t,e){t=new xo(t,e),e=t.getSymetric();this.edges.push(t),this.edges.push(e)},So.prototype.deleteDangles=function(){var e=this;Object.keys(this.nodes).map(function(t){return e.nodes[t]}).forEach(function(t){return e._removeIfDangle(t)})},So.prototype._removeIfDangle=function(t){var e,n=this;t.innerEdges.length<=1&&(e=t.getOuterEdges().map(function(t){return t.to}),this.removeNode(t),e.forEach(function(t){return n._removeIfDangle(t)}))},So.prototype.deleteCutEdges=function(){var e=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(t){t.label===t.symetric.label&&(e.removeEdge(t.symetric),e.removeEdge(t))})},So.prototype._computeNextCWEdges=function(n){var e=this;void 0===n?Object.keys(this.nodes).forEach(function(t){return e._computeNextCWEdges(e.nodes[t])}):n.getOuterEdges().forEach(function(t,e){n.getOuterEdge((0===e?n.getOuterEdges().length:e)-1).symetric.next=t})},So.prototype._computeNextCCWEdges=function(t,e){for(var n,r,i=t.getOuterEdges(),o=i.length-1;0<=o;--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)},So.prototype._findLabeledEdgeRings=function(){var n=[],r=0;return this.edges.forEach(function(t){if(!(0<=t.label)){n.push(t);for(var e=t;e.label=r,e=e.next,!t.isEqual(e););r++}}),n},So.prototype.getEdgeRings=function(){var n=this,e=(this._computeNextCWEdges(),this.edges.forEach(function(t){t.label=void 0}),this._findLabeledEdgeRings().forEach(function(e){n._findIntersectionNodes(e).forEach(function(t){n._computeNextCCWEdges(t,e.label)})}),[]);return this.edges.forEach(function(t){t.ring||e.push(n._findEdgeRing(t))}),e},So.prototype._findIntersectionNodes=function(n){for(var t=[],r=n;function(){var e=0;r.from.getOuterEdges().forEach(function(t){t.label===n.label&&++e}),1<e&&t.push(r.from),r=r.next}(),!n.isEqual(r););return t},So.prototype._findEdgeRing=function(t){for(var e=t,n=new Eo;n.push(e),e.ring=n,e=e.next,!t.isEqual(e););return n},So.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]},So.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(t){return!t.isEqual(e)}),e.deleteEdge()};var No=So;function So(){this.edges=[],this.nodes={}}function Co(t,n){var r=!0;return vt(t,function(e){vt(n,function(t){if(!1===r)return!1;r=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return u=t.coordinates,l=e.coordinates,!(u[0]===l[0]&&u[1]===l[1]);case"LineString":return!Po(e,t);case"Polygon":return!De(t,e)}break;case"LineString":switch(e.type){case"Point":return!Po(t,e);case"LineString":return!(0<fr(t,e).features.length);case"Polygon":return!Mo(e,t)}break;case"Polygon":switch(e.type){case"Point":return!De(e,t);case"LineString":return!Mo(t,e);case"Polygon":for(var n=e,r=t,i=0,o=n.coordinates[0];i<o.length;i++)if(De(o[i],r))return!1;for(var s=0,a=r.coordinates[0];s<a.length;s++)if(De(a[s],n))return!1;return!(0<fr(ni(n),ni(r)).features.length)}}var u,l;return!1}(e.geometry,t.geometry)})}),r}function Po(t,e){for(var n,r,i,o,s,a,u,l=0;l<t.coordinates.length-1;l++)if(n=t.coordinates[l],r=t.coordinates[l+1],i=e.coordinates,u=a=s=o=void 0,o=i[0]-n[0],s=i[1]-n[1],a=r[0]-n[0],u=r[1]-n[1],0==o*u-s*a&&(Math.abs(a)>=Math.abs(u)?0<a?n[0]<=i[0]&&i[0]<=r[0]:r[0]<=i[0]&&i[0]<=n[0]:0<u?n[1]<=i[1]&&i[1]<=r[1]:r[1]<=i[1]&&i[1]<=n[1]))return 1}function Mo(t,e){for(var n=0,r=e.coordinates;n<r.length;n++)if(De(r[n],t))return 1;return 0<fr(e,ni(t)).features.length}function Lo(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Oo(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ro(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),Do(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?n=!0:r=!0}o++}return n&&r}function To(t,e){return 0<fr(t,ri(e)).features.length}function Ao(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&(!n||!r);o++)De(R(t.coordinates[o]),e)?n=!0:r=!0;return r&&n}function Do(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)?0<s?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:0<a?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?0<s?t[0]<n[0]&&n[0]<e[0]:e[0]<n[0]&&n[0]<t[0]:0<a?t[1]<n[1]&&n[1]<e[1]:e[1]<n[1]&&n[1]<t[1])}function Fo(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:qo}function ko(e){return e.coordinates.map(function(t){return{type:e.type.replace("Multi",""),coordinates:t}})}function Go(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function qo(t,e){return fi(t,e,{strict:!0})}Fo.prototype.compare=function(t,e){if(t.type===e.type&&Go(t,e))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:var n,r,i;if(0===t.type.indexOf("Multi"))return n=this,r=ko(t),i=ko(e),r.every(function(e){return this.some(function(t){return n.compare(e,t)})},i)}return!1},Fo.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},Fo.prototype.compareLine=function(t,e,n,r){return!!Go(t,e)&&(t=this.pseudoNode?t:this.removePseudo(t),e=this.pseudoNode?e:this.removePseudo(e),!r||this.compareCoord(t[0],e[0])||(e=this.fixStartIndex(e,t))?(r=this.compareCoord(t[n],e[n]),this.direction||r?this.comparePath(t,e):!!this.compareCoord(t[n],e[e.length-(1+n)])&&this.comparePath(t.slice().reverse(),e)):void 0)},Fo.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 n=0<=r?[].concat(t.slice(r,t.length),t.slice(1,r+1)):n},Fo.prototype.comparePath=function(t,e){var n=this;return t.every(function(t,e){return n.compareCoord(t,this[e])},e)},Fo.prototype.comparePolygon=function(t,e){var n;return!!this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)&&(t=t.coordinates.slice(1,t.coordinates.length),e=e.coordinates.slice(1,e.coordinates.length),n=this,t.every(function(e){return this.some(function(t){return n.compareLine(e,t,1,!0)})},e))},Fo.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)},Fo.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},Fo.prototype.removePseudo=function(t){return t};var Bo=Fo;function zo(t,n){var r=!1;return vt(t,function(e){vt(n,function(t){if(!0===r)return!0;r=!Co(e.geometry,t.geometry)})}),r}function jo(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}var Uo=ce(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,o,s=0;s<this._datasetLength;s++)1!==this._visited[s]&&(this._visited[s]=1,(i=this._regionQuery(s)).length<this.minPts?this.noise.push(s):(o=this.clusters.length,this.clusters.push([]),this._addToCluster(s,o),this._expandCluster(o,i)));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,i=e[n];1!==this._visited[i]&&(this._visited[i]=1,(r=this._regionQuery(i)).length>=this.minPts)&&(e=this._mergeArrays(e,r)),1!==this._assigned[i]&&this._addToCluster(i,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)}),Vo=ce(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;)for(var i=this.assign(),o=0;o<this.k;o++){for(var s=new Array(h),a=0,u=0;u<h;u++)s[u]=0;for(var l=0;l<n;l++){var h=this.dataset[l].length;if(o===this.assignments[l]){for(u=0;u<h;u++)s[u]+=this.dataset[l][u];a++}}if(0<a){for(u=0;u<h;u++)s[u]/=a;this.centroids[o]=s}else this.centroids[o]=this.randomCentroid(),i=!0}return this.getClusters()},e.prototype.randomCentroid=function(){for(var t,e,n=this.dataset.length-1;e=Math.round(Math.random()*n),t=this.dataset[e],0<=this.centroids.indexOf(t););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)}),Xo=ce(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?i<e&&(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)}),Yo=ce(function(t){var l;function e(t,e,n,r){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(t,e,n,r)}t.exports&&(l=Xo),e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);for(var i,o,s,a=0,u=this.dataset.length;a<u;a++)1!==this._processed[a]&&(this._processed[a]=1,this.clusters.push([a]),i=this.clusters.length-1,this._orderedList.push(a),o=new l(null,null,"asc"),s=this._regionQuery(a),void 0!==this._distanceToCore(a))&&(this._updateQueue(a,s,o),this._expandCluster(i,o));return this.clusters},e.prototype.getReachabilityPlot=function(){for(var t=[],e=0,n=this._orderedList.length;e<n;e++){var r=this._orderedList[e],i=this._reachability[r];t.push([r,i])}return t},e.prototype._init=function(t,e,n,r){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),n&&(this.minPts=n),r&&(this.distance=r)},e.prototype._updateQueue=function(n,t,r){var i=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(t){var e;void 0===i._processed[t]&&(e=i.distance(i.dataset[n],i.dataset[t]),e=Math.max(i._coreDistance,e),void 0===i._reachability[t]?(i._reachability[t]=e,r.insert(t,e)):e<i._reachability[t]&&(i._reachability[t]=e,r.remove(t),r.insert(t,e)))})},e.prototype._expandCluster=function(t,e){for(var n=e.getElements(),r=0,i=n.length;r<i;r++){var o,s=n[r];void 0===this._processed[s]&&(o=this._regionQuery(s),this._processed[s]=1,this.clusters[t].push(s),this._orderedList.push(s),void 0!==this._distanceToCore(s))&&(this._updateQueue(s,o,e),this._expandCluster(t,e))}},e.prototype._distanceToCore=function(t){for(var e=this.epsilon,n=0;n<e;n++)if(this._regionQuery(t,n).length>=this.minPts)return n},e.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var n=[],r=0,i=this.dataset.length;r<i;r++)this.distance(this.dataset[t],this.dataset[r])<e&&n.push(r);return n},e.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=e)}),Ho=ce(function(t){t.exports&&(t.exports={DBSCAN:Uo,KMEANS:Vo,OPTICS:Yo,PriorityQueue:Xo})}),Wo=jo,Jo=function(t,e,n){t=Math.abs(t-e);return n?t:t*t},Zo=jo;function Ko(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}function Qo(t,e,n,r){var i,o=[],s=[],a=[],u=!1,l=r||1e4,h=t.length,c=t[0].length,p=0<c,f=[];if(n)o="kmrand"==n?function(t,e){for(var n={},r=[],i=e<<2,o=t.length,s=0<t[0].length;r.length<e&&0<i--;){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?Wo:Jo,r=[],i=t.length,o=0<t[0].length,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,h=[],c=0;c<i;c++){for(var p=1/0,f=0;f<u;f++){var g=n(t[c],r[f]);g<=p&&(p=g)}a[c]=p}for(var d=0;d<i;d++)l+=a[d];for(var y=0;y<i;y++)h[y]={i:y,v:t[y],pr:a[y]/l,cs:0};h.sort(function(t,e){return t.pr-e.pr}),h[0].cs=h[0].pr;for(var _=1;_<i;_++)h[_].cs=h[_-1].cs+h[_].pr;for(var m=Math.random(),v=0;v<i-1&&h[v++].cs<m;);r.push(h[v-1].v)}return r}(t,e):n;else for(var g={};o.length<e;){var d=Math.floor(Math.random()*h);g[d]||(g[d]=!0,o.push(t[d]))}do{Ko(e,0,f);for(var y=0;y<h;y++){for(var _=1/0,m=0,v=0;v<e;v++)(i=p?Zo(t[y],o[v]):Math.abs(t[y]-o[v]))<=_&&(_=i,m=v);f[a[y]=m]++}for(var x=[],E=(s=[],0);E<e;E++)x[E]=p?Ko(c,0,x[E]):0,s[E]=o[E];if(p){for(var b=0;b<e;b++)o[b]=[];for(var w=0;w<h;w++)for(var I=x[a[w]],N=t[w],S=0;S<c;S++)I[S]+=N[S];for(var u=!0,C=0;C<e;C++){for(var P=o[C],M=x[C],L=s[C],F=f[C],O=0;O<c;O++)P[O]=M[O]/F||0;if(u)for(var R=0;R<c;R++)if(L[R]!=P[R]){u=!1;break}}}else{for(var T=0;T<h;T++)x[a[T]]+=t[T];for(var A=0;A<e;A++)o[A]=x[A]/f[A]||0;u=!0;for(var D=0;D<e;D++)if(s[D]!=o[D]){u=!1;break}}}while(!(u=u||--l<=0));return{it:1e4-l,k:e,idxs:a,centroids:o}}function $o(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 ts(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}var es={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||es.heuristics.manhattan,o=r.closest||!1,s=new is(function(t){return t.f}),a=e;for(e.h=i(e,n),s.push(e);0<s.size();){var u=s.pop();if(u===n)return ts(u);u.closed=!0;for(var l=t.neighbors(u),h=0,c=l.length;h<c;++h){var p,f,g=l[h];!g.closed&&!g.isWall()&&(p=u.g+g.getCost(u),!(f=g.visited)||p<g.g)&&(g.visited=!0,g.parent=u,g.h=g.h||i(g,n),g.g=p,g.f=g.g+g.h,t.markDirty(g),o&&(g.h<a.h||g.h===a.h&&g.g<a.g)&&(a=g),f?s.rescoreElement(g):s.push(g))}}return o?ts(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),e=Math.abs(e.y-t.y);return+(r+e)+(n-2)*Math.min(r,e)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function ns(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 rs(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function rs(t,e,n){this.x=t,this.y=e,this.weight=n}function is(t){this.content=[],this.scoreFunction=t}function os(t){return function(){return t}}function ss(t){return t[0]}function as(t){return t[1]}function us(){this._=null}function ls(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function hs(t,e){var n=e,e=e.R,r=n.U;r?r.L===n?r.L=e:r.R=e:t._=e,e.U=r,n.U=e,n.R=e.L,n.R&&(n.R.U=n),e.L=n}function cs(t,e){var n=e,e=e.L,r=n.U;r?r.L===n?r.L=e:r.R=e:t._=e,e.U=r,n.U=e,n.L=e.R,n.L&&(n.L.U=n),e.R=n}function ps(t){for(;t.L;)t=t.L;return t}function fs(t,e,n,r){var i=[null,null],o=Os.push(i)-1;return i.left=t,i.right=e,n&&ds(i,t,e,n),r&&ds(i,e,t,r),Ms[t.index].halfedges.push(o),Ms[e.index].halfedges.push(o),i}function gs(t,e,n){e=[e,n];return e.left=t,e}function ds(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 ys(t,e){return e[+(e.left!==t.site)]}ns.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)es.cleanNode(this.nodes[t])},ns.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)es.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},ns.prototype.markDirty=function(t){this.dirtyNodes.push(t)},ns.prototype.neighbors=function(t){var e=[],n=t.x,t=t.y,r=this.grid;return r[n-1]&&r[n-1][t]&&e.push(r[n-1][t]),r[n+1]&&r[n+1][t]&&e.push(r[n+1][t]),r[n]&&r[n][t-1]&&e.push(r[n][t-1]),r[n]&&r[n][t+1]&&e.push(r[n][t+1]),this.diagonal&&(r[n-1]&&r[n-1][t-1]&&e.push(r[n-1][t-1]),r[n+1]&&r[n+1][t-1]&&e.push(r[n+1][t-1]),r[n-1]&&r[n-1][t+1]&&e.push(r[n-1][t+1]),r[n+1])&&r[n+1][t+1]&&e.push(r[n+1][t+1]),e},ns.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")},rs.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},rs.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},rs.prototype.isWall=function(){return 0===this.weight},is.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 0<this.content.length&&(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];0<t;){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&&(i=this.content[s],(i=this.scoreFunction(i))<r)&&(a=s),null===(a=o<e&&(s=this.content[o],this.scoreFunction(s)<(null===a?r:i))?o:a))break;this.content[t]=this.content[a],this.content[a]=n,t=a}}},us.prototype={constructor:us,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 n=this._?(t=ps(this._),e.P=null,(e.N=t).P=t.L=e,t):(e.P=e.N=null,this._=e,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&&(hs(this,n),n=(t=n).U),n.C=!1,r.C=!0,cs(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(cs(this,n),n=(t=n).U),n.C=!1,r.C=!0,hs(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=t.U,i=t.L,o=t.R,s=i?o?ps(o):i:o;if(r?r.L===t?r.L=s:r.R=s:this._=s,i&&o?(n=s.C,s.C=t.C,((s.L=i).U=s)!==o?(r=s.U,s.U=t.U,t=s.R,r.L=t,(s.R=o).U=s):(s.U=r,t=(r=s).R)):(n=t.C,t=s),t&&(t.U=r),!n)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===r.L){if((e=r.R).C&&(e.C=!1,r.C=!0,hs(this,r),e=r.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,cs(this,e),e=r.R),e.C=r.C,r.C=e.R.C=!1,hs(this,r),t=this._;break}}else if((e=r.L).C&&(e.C=!1,r.C=!0,cs(this,r),e=r.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,hs(this,e),e=r.L),e.C=r.C,r.C=e.L.C=!1,cs(this,r),t=this._;break}}while(e.C=!0,r=(t=r).U,!t.C);t&&(t.C=!1)}}};var _s,ms=[];function vs(){ls(this),this.x=this.y=this.arc=this.site=this.cy=null}function xs(t){var e=t.P,n=t.N;if(e&&n){var e=e.site,r=t.site,n=n.site;if(e!==n){var i=r[0],o=r[1],s=e[0]-i,e=e[1]-o,a=n[0]-i,n=n[1]-o,u=2*(s*n-e*a);if(!(-Ts<=u)){var l=s*s+e*e,h=a*a+n*n,n=(n*l-e*h)/u,e=(s*h-a*l)/u,c=ms.pop()||new vs;c.arc=t,c.site=r,c.x=n+i,c.y=(c.cy=e+o)+Math.sqrt(n*n+e*e),t.circle=c;for(var p=null,f=Ls._;f;)if(c.y<f.y||c.y===f.y&&c.x<=f.x){if(!f.L){p=f.P;break}f=f.L}else{if(!f.R){p=f;break}f=f.R}Ls.insert(p,c),p||(_s=c)}}}}function Es(t){var e=t.circle;e&&(e.P||(_s=e.N),Ls.remove(e),ms.push(e),ls(e),t.circle=null)}var bs=[];function ws(){ls(this),this.edge=this.site=this.circle=null}function Is(t){var e=bs.pop()||new ws;return e.site=t,e}function Ns(t){Es(t),Ps.remove(t),bs.push(t),ls(t)}function Ss(t){for(var e,n,r,i,o,s,a=t[0],u=t[1],l=Ps._;l;)if((r=Cs(l,u)-a)>Rs)l=l.L;else{if(!((i=a-(o=u,s=void 0,(s=(i=l).N)?Cs(s,o):(s=i.site)[1]===o?s[0]:1/0))>Rs)){-Rs<r?(e=l.P,n=l):-Rs<i?n=(e=l).N:e=n=l;break}if(!l.R){e=l;break}l=l.R}Ms[t.index]={site:t,halfedges:[]};var h,c,p,f,g,d,y,_,m,v,x=Is(t);if(Ps.insert(e,x),e||n){if(e===n)return Es(e),n=Is(e.site),Ps.insert(x,n),x.edge=n.edge=fs(e.site,x.site),xs(e),xs(n);n?(Es(e),Es(n),c=(h=e.site)[0],p=h[1],f=t[0]-c,v=t[1]-p,d=(g=n.site)[0]-c,y=g[1]-p,ds(n.edge,h,g,v=[(y*(_=f*f+v*v)-v*(m=d*d+y*y))/(y=2*(f*y-v*d))+c,(f*m-d*_)/y+p]),x.edge=fs(h,t,null,v),n.edge=fs(t,g,null,v),xs(e),xs(n)):x.edge=fs(e.site,x.site)}}function Cs(t,e){var n,r,i,o=t.site,s=o[0],a=o[1],u=a-e;return u?(t=t.P)?(t=(o=t.site)[0],(e=(o=o[1])-e)?(i=(n=t-s)/e,(r=1/u-1/e)?(-i+Math.sqrt(i*i-2*r*(n*n/(-2*e)-o+e/2+a-u/2)))/r+s:(s+t)/2):t):-1/0:s}var Ps,Ms,Ls,Os,Rs=1e-6,Ts=1e-12;function As(t,e){return e[1]-t[1]||e[0]-t[0]}function Ds(F,t){var k,G,e,n=F.sort(As).pop();for(Os=[],Ms=new Array(F.length),Ps=new us,Ls=new us;;)if(e=_s,n&&(!e||n[1]<e.y||n[1]===e.y&&n[0]<e.x))n[0]===k&&n[1]===G||(Ss(n),k=n[0],G=n[1]),n=F.pop();else{if(!e)break;V=u=a=s=o=U=j=z=B=i=q=r=void 0;var r=e.arc,q=r.circle,i=q.x,B=q.cy,z=[i,B],j=r.P,U=r.N,o=[r];Ns(r);for(var s=j;s.circle&&Math.abs(i-s.circle.x)<Rs&&Math.abs(B-s.circle.cy)<Rs;)j=s.P,o.unshift(s),Ns(s),s=j;o.unshift(s),Es(s);for(var a=U;a.circle&&Math.abs(i-a.circle.x)<Rs&&Math.abs(B-a.circle.cy)<Rs;)U=a.N,o.push(a),Ns(a),a=U;o.push(a),Es(a);for(var V=o.length,u=1;u<V;++u)ds((a=o[u]).edge,(s=o[u-1]).site,a.site,z);(a=o[V-1]).edge=fs((s=o[0]).site,a.site,null,z),xs(s),xs(a)}for(var X,Y,l,h,c,p,f,H=0,W=Ms.length;H<W;++H)if((X=Ms[H])&&(l=(Y=X.halfedges).length)){for(var J=new Array(l),g=new Array(l),d=0;d<l;++d)J[d]=d,g[d]=(h=X,c=Os[Y[d]],f=p=void 0,h=h.site,p=c.left,f=c.right,h===f&&(f=p,p=h),f?Math.atan2(f[1]-p[1],f[0]-p[0]):(f=h===p?(p=c[1],c[0]):(p=c[0],c[1]),Math.atan2(p[0]-f[0],f[1]-p[1])));for(J.sort(function(t,e){return g[e]-g[t]}),d=0;d<l;++d)g[d]=Y[J[d]];for(d=0;d<l;++d)Y[d]=g[d]}if(t){for(var y,_=+t[0][0],m=+t[0][1],Z=+t[1][0],t=+t[1][1],K=_,Q=m,$=Z,tt=t,et=Os.length;et--;)(function(t,e,n,r,i){var o=t[1];if(!o){var s,a=t[0],u=t.left,l=t.right,h=u[0],u=u[1],c=l[0],l=l[1],p=(h+c)/2;if(l===u){if(p<e||r<=p)return;if(c<h){if(a){if(a[1]>=i)return}else a=[p,n];o=[p,i]}else{if(a){if(a[1]<n)return}else a=[p,i];o=[p,n]}}else if(p=(u+l)/2-(s=(h-c)/(l-u))*p,s<-1||1<s)if(c<h){if(a){if(a[1]>=i)return}else a=[(n-p)/s,n];o=[(i-p)/s,i]}else{if(a){if(a[1]<n)return}else a=[(i-p)/s,i];o=[(n-p)/s,n]}else if(u<l){if(a){if(a[0]>=r)return}else a=[e,s*e+p];o=[r,s*r+p]}else{if(a){if(a[0]<e)return}else a=[r,s*r+p];o=[e,s*e+p]}t[0]=a,t[1]=o}return 1})(y=Os[et],K,Q,$,tt)&&function(t,e,n,r,i){var o=t[0],s=t[1],a=o[0],o=o[1],u=0,l=1,h=s[0]-a,s=s[1]-o,e=e-a;if(h||!(0<e)){if(e/=h,h<0){if(e<u)return;e<l&&(l=e)}else if(0<h){if(l<e)return;u<e&&(u=e)}if(e=r-a,h||!(e<0)){if(e/=h,h<0){if(l<e)return;u<e&&(u=e)}else if(0<h){if(e<u)return;e<l&&(l=e)}if(e=n-o,s||!(0<e)){if(e/=s,s<0){if(e<u)return;e<l&&(l=e)}else if(0<s){if(l<e)return;u<e&&(u=e)}if(e=i-o,s||!(e<0)){if(e/=s,s<0){if(l<e)return;u<e&&(u=e)}else if(0<s){if(e<u)return;e<l&&(l=e)}return(0<u||l<1)&&(0<u&&(t[0]=[a+u*h,o+u*s]),l<1)&&(t[1]=[a+l*h,o+l*s]),1}}}}}(y,K,Q,$,tt)&&(Math.abs(y[0][0]-y[1][0])>Rs||Math.abs(y[0][1]-y[1][1])>Rs)||delete Os[et];var v,x,E,b,w,I,N,S,C,P,M=_,L=m,O=Z,R=t,nt=Ms.length,T=!0;for(D=0;D<nt;++D)if(v=Ms[D]){for(x=v.site,E=(b=v.halfedges).length;E--;)Os[b[E]]||b.splice(E,1);for(E=0,w=b.length;E<w;)C=v,C=(P=(P=Os[b[E]])[+(P.left===C.site)])[0],S=P[1],I=(N=ys(v,Os[b[++E%w]]))[0],N=N[1],(Math.abs(C-I)>Rs||Math.abs(S-N)>Rs)&&(b.splice(E,0,Os.push(gs(x,P,Math.abs(C-M)<Rs&&Rs<R-S?[M,Math.abs(I-M)<Rs?N:R]:Math.abs(S-R)<Rs&&Rs<O-C?[Math.abs(N-R)<Rs?I:O,R]:Math.abs(C-O)<Rs&&Rs<S-L?[O,Math.abs(I-O)<Rs?N:L]:Math.abs(S-L)<Rs&&Rs<C-M?[Math.abs(N-L)<Rs?I:M,L]:null))-1),++w);w&&(T=!1)}if(T){for(var A,rt=1/0,D=0,T=null;D<nt;++D)(v=Ms[D])&&(A=(A=(x=v.site)[0]-M)*A+(A=x[1]-L)*A)<rt&&(rt=A,T=v);T&&(_=[O,R],m=[O,L],T.halfedges.push(Os.push(gs(x=T.site,Z=[M,L],t=[M,R]))-1,Os.push(gs(x,t,_))-1,Os.push(gs(x,_,m))-1,Os.push(gs(x,m,Z))-1))}for(D=0;D<nt;++D)!(v=Ms[D])||v.halfedges.length||delete Ms[D]}this.edges=Os,this.cells=Ms,Ps=Ls=Os=Ms=null}function Fs(t){return(t=t.slice()).push(t[0]),k([t])}function ks(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(!st(r))throw new Error("options must be an object");if(!ot(i))throw new Error("steps must be a number");if(!ot(s))throw new Error("angle must be a number");var l,h=Mt(t);"degrees"===o?l=nt(s):(e=vi(t,e,90,{units:o}),n=vi(t,n,0,{units:o}),e=Mt(e)[0]-h[0],n=Mt(n)[1]-h[1]);for(var c=[],p=0;p<i;p+=1){var f,g=-360*p/i,d=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e,2)*Math.pow(Gs(g),2)),y=e*n/Math.sqrt(Math.pow(e,2)+Math.pow(n,2)/Math.pow(Gs(g),2));g<-90&&-270<=g&&(d=-d),g<-180&&-360<=g&&(y=-y),"degrees"===o&&(g=d*Math.cos(l)+y*Math.sin(l),f=y*Math.cos(l)-d*Math.sin(l),d=g,y=f),c.push([d+h[0],y+h[1]])}return c.push(c[0]),"degrees"===o?k([c],u):ho(k([c],u),s,{pivot:a})}function Gs(t){t=t*Math.PI/180;return Math.tan(t)}function qs(t,i){void 0===i&&(i={});var o=0,s=0,a=0;return _t(t,function(t,e,n){var r=!i.weight||null==n?void 0:n[i.weight];if(!ot(r=null==r?1:r))throw new Error("weight value must be a number for feature index "+e);0<(r=Number(r))&&ht(t,function(t){o+=t[0]*r,s+=t[1]*r,a+=r})}),R([o/a,s/a],i.properties,i)}function Bs(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function zs(t,e){var n=(e=e||{}).threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,e=e.standardization||!1,s=[];gt(t,function(t){s.push(Ln(t))});for(var a,u,l,h,c=[],p=0;p<s.length;p++)c[p]=[];for(p=0;p<s.length;p++)for(var f=p;f<s.length;f++){p===f&&(c[p][f]=0);u=s[f],(h=void 0)===(l=r)&&(l=2),a=Mt(a=s[p]),u=Mt(u),h=a[0]-u[0],a=a[1]-u[1];var g=1===l?Math.abs(h)+Math.abs(a):Math.pow(Math.pow(h,l)+Math.pow(a,l),1/l);c[p][f]=g,c[f][p]=g}for(p=0;p<s.length;p++)for(f=0;f<s.length;f++)0!==(g=c[p][f])&&(c[p][f]=i?g<=n?1:0:g<=n?Math.pow(g,o):0);if(e)for(p=0;p<s.length;p++)for(var d=c[p].reduce(function(t,e){return t+e},0),f=0;f<s.length;f++)c[p][f]=c[p][f]/d;return c}function js(t){for(var e=0,n=0,r=t;n<r.length;n++)e+=r[n];return e/t.length}function Us(t,e){return Xs(t,"mercator",e=void 0===e?{}:e)}function Vs(t,e){return Xs(t,"wgs84",e=void 0===e?{}:e)}function Xs(t,n,e){e=(e=(e=void 0===e?{}:e)||{}).mutate;if(t)return Array.isArray(t)&&ot(t[0])?t=("mercator"===n?Ys:Hs)(t):ht(t=!0!==e?je(t):t,function(t){var e=("mercator"===n?Ys:Hs)(t);t[0]=e[0],t[1]=e[1]}),t;throw new Error("geojson is required")}function Ys(t){var e=Math.PI/180,n=20037508.342789244,r=[6378137*(Math.abs(t[0])<=180?t[0]:t[0]-360*((r=t[0])<0?-1:0<r?1:0))*e,6378137*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return n<r[0]&&(r[0]=n),r[0]<-n&&(r[0]=-n),n<r[1]&&(r[1]=n),r[1]<-n&&(r[1]=-n),r}function Hs(t){var e=180/Math.PI;return[t[0]*e/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/6378137)))*e]}Ds.prototype={constructor:Ds,polygons:function(){var n=this.edges;return this.cells.map(function(e){var t=e.halfedges.map(function(t){return ys(e,n[t])});return t.data=e.site.data,t})},triangles:function(){var h=[],c=this.edges;return this.cells.forEach(function(t,e){if(r=(n=t.halfedges).length)for(var n,r,i,o,s=t.site,a=-1,u=c[n[r-1]],l=u.left===s?u.right:u.left;++a<r;)i=l,l=(u=c[n[a]]).left===s?u.right:u.left,i&&l&&e<i.index&&e<l.index&&(o=l,(s[0]-o[0])*(i[1]-s[1])-(s[0]-i[0])*(o[1]-s[1])<0)&&h.push([s.data,i.data,l.data])}),h},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(n,r,t){for(var e,i,o=this,s=o._found||0,a=o.cells.length;!(i=o.cells[s]);)if(++s>=a)return null;for(var u=n-i.site[0],l=r-i.site[1],h=u*u+l*l;i=o.cells[e=s],s=null,i.halfedges.forEach(function(t){var t=o.edges[t],e=t.left;(e!==i.site&&e||(e=t.right))&&(t=(t=n-e[0])*t+(t=r-e[1])*t)<h&&(h=t,s=e.index)}),null!==s;);return o._found=e,null==t||h<=t*t?i.site:null}};xe=Object.freeze({__proto__:null,toMercator:Us,toWgs84:Vs});function Ws(t){return Array.isArray(t)?$s(t):t&&t.bbox?$s(t.bbox):[360*Qs(),180*Qs()]}function Js(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var n=[],r=0;r<t;r++)n.push(R(Ws(e.bbox)));return G(n)}function Zs(t,i){null==t&&(t=1),ot((i=void 0===i?{}:i).num_vertices)&&void 0!==i.num_vertices||(i.num_vertices=10),ot(i.max_radial_length)&&void 0!==i.max_radial_length||(i.max_radial_length=10);for(var o=[],e=function(t){var e,n=[],r=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,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(i.num_vertices+1)).map(Math.random);r.forEach(function(t,e,n){n[e]=0<e?t+n[e-1]:t}),r.forEach(function(t){t=2*t*Math.PI/r[r.length-1];var e=Math.random();n.push([e*(i.max_radial_length||10)*Math.sin(t),e*(i.max_radial_length||10)*Math.cos(t)])}),n[n.length-1]=n[0],n=n.map((e=Ws(i.bbox),function(t){return[t[0]+e[0],t[1]+e[1]]})),o.push(k([n]))},n=0;n<t;n++)e();return G(o)}function Ks(t,e){if(!st(e=(e=void 0===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),(!ot(r)||void 0===r||r<2)&&(r=10),ot(i)&&void 0!==i||(i=1e-4),ot(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var u=[Ws(n)],l=0;l<r-1;l++){var h=(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,c=Math.random()*i;u.push([u[l][0]+c*Math.cos(h),u[l][1]+c*Math.sin(h)])}s.push(V(u))}return G(s)}function Qs(){return Math.random()-.5}function $s(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}Qt=Object.freeze({__proto__:null,randomPosition:Ws,randomPoint:Js,randomPolygon:Zs,randomLineString:Ks});function ta(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 gt(t,function(t){ia(t.properties,e)&&n.push(t)}),G(n)}function ea(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=ra(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(G(u),s,o)}}function na(t,e,r,i){var o=i;return ea(t,e,function(t,e,n){o=0===n&&void 0===i?t:r(o,t,e,n)}),o}function ra(t,n){var r={};return gt(t,function(t,e){var t=t.properties||{};Object.prototype.hasOwnProperty.call(t,String(n))&&(t=t[n],Object.prototype.hasOwnProperty.call(r,t)?r[t].push(e):r[t]=[e])}),r}function ia(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(!ia(t,e[r]))return!1;return!0}return oa(t,e)}function oa(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 sa(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 aa=Object.freeze({__proto__:null,getCluster:ta,clusterEach:ea,clusterReduce:na,createBins:ra,applyFilter:ia,propertiesContainsFilter:oa,filterProperties:sa}),ua=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function la(t,e){return e<t?1:t<e?-1:0}function ha(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,e=(o=e).left}else{if(!(0<s))break;if(null===e.right)break;if(0<n(t,e.right.key)&&(a=e.right,e.right=a.left,a.left=e,null===(e=a).right))break;i.right=e,e=(i=e).right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function ca(t,e,n,r){e=new ua(t,e);return null===n?e.left=e.right=null:(t=r(t,(n=ha(t,n,r)).key))<0?(e.left=n.left,(e.right=n).left=null):0<=t&&(e.right=n.right,(e.left=n).right=null),e}function pa(t,e,n){var r=null,i=null;return e&&(0===(n=n((e=ha(t,e,n)).key,t))?(r=e.left,i=e.right):n<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)),{left:r,right:i}}ga.prototype.insert=function(t,e){return this._size++,this._root=ca(t,e,this._root,this._comparator)},ga.prototype.add=function(t,e){var e=new ua(t,e),n=(null===this._root&&(e.left=e.right=null,this._size++,this._root=e),this._comparator),r=ha(t,this._root,n),n=n(t,r.key);return 0===n?this._root=r:(n<0?(e.left=r.left,(e.right=r).left=null):0<n&&(e.right=r.right,(e.left=r).right=null),this._size++,this._root=e),this._root},ga.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},ga.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=ha(t,e,n)).key)?(null===e.left?r=e.right:(r=ha(t,e.left,n)).right=e.right,this._size--,r):e},ga.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=ha(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},ga.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},ga.prototype.find=function(t){return this._root&&(this._root=ha(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},ga.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},ga.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},ga.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(0<o((s=i.pop()).key,e))break;if(0<=o(s.key,t)&&n.call(r,s))return this;s=s.right}return this},ga.prototype.keys=function(){var e=[];return this.forEach(function(t){t=t.key;return e.push(t)}),e},ga.prototype.values=function(){var e=[];return this.forEach(function(t){t=t.data;return e.push(t)}),e},ga.prototype.min=function(){return this._root?this.minNode(this._root).key:null},ga.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},ga.prototype.minNode=function(t){if(t=void 0===t?this._root:t)for(;t.left;)t=t.left;return t},ga.prototype.maxNode=function(t){if(t=void 0===t?this._root:t)for(;t.right;)t=t.right;return t},ga.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(0<i.length){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},ga.prototype.next=function(t){var e=this._root,n=null;if(t.right)for(n=t.right;n.left;)n=n.left;else for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;e=i<0?(n=e).left:e.right}return n},ga.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left)for(n=t.left;n.right;)n=n.right;else for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;e=i<0?e.left:(n=e).right}return n},ga.prototype.clear=function(){return this._root=null,this._size=0,this},ga.prototype.toList=function(){for(var t=this._root,e=t,n=[],r=!1,i=t=new ua(null,null);!r;)e?(n.push(e),e=e.left):0<n.length?e=(e=i=i.next=n.pop()).right:r=!0;return i.next=null,t.next},ga.prototype.load=function(t,e,n){void 0===e&&(e=[]);var r=t.length,i=this._comparator;return(n=void 0===n?!1:n)&&function t(e,n,r,i,o){if(!(i<=r)){for(var s=e[r+i>>1],a=r-1,u=i+1;;){for(;o(e[++a],s)<0;);for(;0<o(e[--u],s););if(u<=a)break;var l=e[a];e[a]=e[u],e[u]=l,l=n[a],n[a]=n[u],n[u]=l}t(e,n,r,u,o),t(e,n,u+1,i,o)}}(t,e,0,r-1,i),null===this._root?(this._root=function t(e,n,r,i){var o=i-r;{var s,a;if(0<o)return o=r+Math.floor(o/2),a=e[o],s=n[o],(a=new ua(a,s)).left=t(e,n,r,o),a.right=t(e,n,o+1,i),a}return null}(t,e,0,r),this._size=r):(n=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?o=(i.next=o).next:s=(i.next=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=function t(e,n,r){var i=r-n;{var o;if(0<i)return i=n+Math.floor(i/2),n=t(e,n,i),(o=e.head).left=n,e.head=e.head.next,o.right=t(e,i+1,r),o}return null}({head:n},0,r)),this},ga.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(ga.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(ga.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),ga.prototype.toString=function(t){var e=[];return function t(e,n,r,i,o){e&&(i(n+(r?"└── ":"├── ")+o(e)+"\n"),n+=r?"    ":"│   ",e.left&&t(e.left,n,!1,i,o),e.right)&&t(e.right,n,!0,i,o)}(this._root,"",!0,function(t){return e.push(t)},t=void 0===t?function(t){return String(t.key)}:t),e.join("")},ga.prototype.update=function(t,e,n){var r=this._comparator,i=pa(t,this._root,r),o=i.left,i=i.right;r(t,e)<0?i=ca(e,n,i,r):o=ca(e,n,o,r),this._root=(t=o,null===(e=i)?t:(null!==t&&((e=ha(t.key,e,r)).left=t),e))},ga.prototype.split=function(t){return pa(t,this._root,this._comparator)};var fa=ga;function ga(t){void 0===t&&(t=la),this._root=null,this._size=0,this._comparator=t}function da(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ya(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 _a(t,e,n){e&&ya(t.prototype,e),n&&ya(t,n)}function ma(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y}function va(t,e){var n,r;return e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y?null:(n=(t.ll.x<e.ll.x?e:t).ll.x,r=(t.ur.x<e.ur.x?t:e).ur.x,{ll:{x:n,y:(t.ll.y<e.ll.y?e:t).ll.y},ur:{x:r,y:(t.ur.y<e.ur.y?t:e).ur.y}})}function xa(t,e){var n;return-Na<t&&t<Na&&-Na<e&&e<Na||(n=t-e)*n<Sa*t*e?0:t<e?-1:1}function Ea(t,e){return t.x*e.y-t.y*e.x}function ba(t,e,n){return e={x:e.x-t.x,y:e.y-t.y},n={x:n.x-t.x,y:n.y-t.y},t=Ea(e,n),xa(t,0)}function wa(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}}function Ia(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}}var Na=Number.EPSILON,Sa=(Na=void 0===Na?Math.pow(2,-52):Na)*Na,e=(_a(nu,[{key:"reset",value:function(){this.xRounder=new Ca,this.yRounder=new Ca}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),nu),Ca=(_a(eu,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);return null!==n&&0===xa(e.key,n.key)||null!==(n=this.tree.next(e))&&0===xa(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),eu),Pa=new e,Ma=function(t,e){return t.x*e.x+t.y*e.y},La=function(t){return Math.sqrt(Ma(t,t))},Oa=(_a(tu,null,[{key:"compare",value:function(t,e){var n=tu.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:Ta.compare(t.segment,e.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}}]),_a(tu,[{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(i){function o(t){var e,n,r=t.otherSE;a.set(t,{sine:(t=s.point,e=i.point,n=r.point,e={x:e.x-t.x,y:e.y-t.y},n={x:n.x-t.x,y:n.y-t.y},Ea(n,e)/La(n)/La(e)),cosine:function(t,e,n){e={x:e.x-t.x,y:e.y-t.y},n={x:n.x-t.x,y:n.y-t.y};return Ma(n,e)/La(n)/La(e)}(s.point,i.point,r.point)})}var s=this,a=new Map;return function(t,e){a.has(t)||o(t),a.has(e)||o(e);var t=a.get(t),n=t.sine,t=t.cosine,e=a.get(e),r=e.sine,e=e.cosine;return 0<=n&&0<=r?t<e?1:e<t?-1:0:n<0&&r<0?t<e?-1:e<t?1:0:r<n?-1:n<r?1:0}}}]),tu),Ra=0,Ta=(_a($a,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)return a<s&&a<u?1:s<a&&u<a?-1:(h=t.comparePoint(e.leftSE.point))<0?1:!(0<h)&&0!==(h=e.comparePoint(t.rightSE.point))?h:-1;if(r<n)return s<a&&s<l?-1:a<s&&l<s?1:0!==(h=e.comparePoint(t.leftSE.point))?h:!((h=t.comparePoint(e.rightSE.point))<0)&&0<h?-1:1;if(s<a)return-1;if(a<s)return 1;if(i<o){var h=e.comparePoint(t.rightSE.point);if(0!==h)return h}if(o<i){h=t.comparePoint(e.rightSE.point);if(h<0)return 1;if(0<h)return-1}if(i!==o){h=u-s,s=i-n,n=l-a,a=o-r;if(s<h&&n<a)return 1;if(h<s&&a<n)return-1}return o<i?1:i<o||u<l?-1:l<u?1:t.id<e.id?-1:t.id>e.id?1:0}}]),_a($a,[{key:"replaceRightSE",value:function(t){this.rightSE=t,(this.rightSE.segment=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:e<t?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){var e,n,r;return this.isAnEndpoint(t)?0:(r=this.leftSE.point,n=this.rightSE.point,e=this.vector(),r.x===n.x?t.x===r.x?0:t.x<r.x?1:-1:(n=(t.y-r.y)/e.y,n=r.x+n*e.x,t.x===n||(n=(t.x-r.x)/e.x,r=r.y+n*e.y,t.y===r)?0:t.y<r?-1:1))}},{key:"getIntersection",value:function(t){var e,n,r,i,o,s,a=this.bbox(),u=t.bbox(),l=va(a,u);return null===l?null:(o=this.leftSE.point,i=this.rightSE.point,e=t.leftSE.point,s=t.rightSE.point,r=ma(a,e)&&0===this.comparePoint(e),n=ma(u,o)&&0===t.comparePoint(o),a=ma(a,s)&&0===this.comparePoint(s),u=ma(u,i)&&0===t.comparePoint(i),n&&r?u&&!a?i:!u&&a?s:null:n?a&&o.x===s.x&&o.y===s.y?null:o:r?u&&i.x===e.x&&i.y===e.y?null:e:u&&a?null:u?i:a?s:(n=o,r=this.vector(),u=e,i=t.vector(),null!==(e=0===r.x?Ia(u,i,n.x):0===i.x?Ia(n,r,u.x):0===r.y?wa(u,i,n.y):0===i.y?wa(n,r,u.y):0==(a=Ea(r,i))?null:(s={x:u.x-n.x,y:u.y-n.y},o=Ea(s,r)/a,s=Ea(s,i)/a,{x:(n.x+s*r.x+(u.x+o*i.x))/2,y:(n.y+s*r.y+(u.y+o*i.y))/2}))&&ma(l,e)?Pa.round(e.x,e.y):null))}},{key:"split",value:function(t){var e=[],n=void 0!==t.events,r=new Oa(t,!0),t=new Oa(t,!1),i=this.rightSE,i=(this.replaceRightSE(t),e.push(t),e.push(r),new $a(r,i,this.rings.slice(),this.windings.slice()));return 0<Oa.comparePoints(i.leftSE.point,i.rightSE.point)&&i.swapEvents(),0<Oa.comparePoints(this.leftSE.point,this.rightSE.point)&&this.swapEvents(),n&&(r.checkForConsuming(),t.checkForConsuming()),e}},{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(t){for(var e=this,n=t;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var t=$a.compare(e,n);if(0!==t){0<t&&(t=e,e=n,n=t),e.prev===n&&(t=e,e=n,n=t);for(var r=0,i=n.rings.length;r<i;r++){var o=n.rings[r],s=n.windings[r],a=e.rings.indexOf(o);-1===a?(e.rings.push(o),e.windings.push(s)):e.windings[a]+=s}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.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(){var t;return void 0===this._beforeState&&(this.prev?(t=this.prev.consumedBy||this.prev,this._beforeState=t.afterState()):this._beforeState={rings:[],windings:[],multiPolys:[]}),this._beforeState}},{key:"afterState",value:function(){if(void 0===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,h,c=[],p=[],f=0,g=e.length;f<g;f++)0!==n[f]&&(h=(l=e[f]).poly,-1===p.indexOf(h))&&(l.isExterior?c.push(h):(-1===p.indexOf(h)&&p.push(h),-1!==(h=c.indexOf(l.poly))&&c.splice(h,1)));for(var d=0,y=c.length;d<y;d++){var _=c[d].multiPoly;-1===r.indexOf(_)&&r.push(_)}}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0===this._isInResult){var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Ua.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!=r;break;case"intersection":n=(t.length<e.length?(i=t.length,e):(i=e.length,t)).length;this._isInResult=n===Ua.numMultiPolys&&i<n;break;case"xor":r=Math.abs(t.length-e.length);this._isInResult=r%2==1;break;case"difference":var i=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=i(t)!==i(e);break;default:throw new Error("Unrecognized operation type found ".concat(Ua.type))}}return this._isInResult}}],[{key:"fromRing",value:function(t,e,n){var r,i,o,s=Oa.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(0<s))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));r=e,i=t,o=-1}return new $a(new Oa(r,!0),new Oa(i,!1),[n],[o])}}]),$a),Aa=(_a(Qa,[{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}}]),Qa),Da=(_a(Ka,[{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}}]),Ka),Fa=(_a(Za,[{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}}]),Za),ka=(_a(Ja,null,[{key:"factory",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(i.isInResult()&&!i.ringOut){for(var o,s=i.leftSE,a=i.rightSE,u=[s],l=s.point,h=[];o=s,s=a,u.push(s),s.point!==l;)for(;;){var c=s.getAvailableLinkedEvents();if(0===c.length)throw d=u[0].point,y=u[u.length-1].point,new Error("Unable to complete output ring starting at [".concat(d.x,",")+" ".concat(d.y,"]. Last matching segment found ends at")+" [".concat(y.x,", ").concat(y.y,"]."));if(1===c.length){a=c[0].otherSE;break}for(var p=null,f=0,g=h.length;f<g;f++)if(h[f].point===s.point){p=f;break}if(null===p){h.push({index:u.length,point:s.point});var d=s.getLeftmostComparator(o),a=c.sort(d)[0].otherSE;break}var y=h.splice(p)[0],c=u.splice(y.index);c.unshift(c[0].otherSE),e.push(new Ja(c.reverse()))}e.push(new Ja(u))}}return e}}]),_a(Ja,[{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!==ba(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;0===ba(e[0],t,e[1])&&e.shift(),e.push(e[0]);for(var s=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:e.length-1,u=this.isExteriorRing()?e.length:-1,l=[],h=a;h!=u;h+=s)l.push([e[h].x,e[h].y]);return l}},{key:"isExteriorRing",value:function(){var t;return void 0===this._isExteriorRing&&(t=this.enclosingRing(),this._isExteriorRing=!t||!t.isExteriorRing()),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];0<Oa.compare(t,r)&&(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();o=(i=o.prevInResult())?i.prevInResult():null}}}]),Ja),Ga=(_a(Wa,[{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}}]),Wa),qa=(_a(Ha,[{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,o=t[n];o.poly||(o.isExteriorRing()?e.push(new Ga(o)):((i=o.enclosingRing()).poly||e.push(new Ga(i)),i.poly.addInterior(o)))}return e}}]),Ha),Ba=(_a(Ya,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e);else{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){r=null;if(s){var u=s.getIntersection(e);if(null!==u&&(e.isAnEndpoint(u)||(r=u),!s.isAnEndpoint(u)))for(var l=this._splitSafely(s,u),h=0,c=l.length;h<c;h++)n.push(l[h])}u=null;if(a){var p=a.getIntersection(e);if(null!==p&&(e.isAnEndpoint(p)||(u=p),!a.isAnEndpoint(p)))for(var f=this._splitSafely(a,p),g=0,d=f.length;g<d;g++)n.push(f[g])}if(null!==r||null!==u){p=null,p=null!==r&&(null===u||Oa.comparePoints(r,u)<=0)?r:u;this.queue.remove(e.rightSE),n.push(e.rightSE);for(var y=e.split(p),_=0,m=y.length;_<m;_++)n.push(y[_])}0<n.length?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){r=s.getIntersection(a);if(null!==r){if(!s.isAnEndpoint(r))for(var v=this._splitSafely(s,r),x=0,E=v.length;x<E;x++)n.push(v[x]);if(!a.isAnEndpoint(r))for(var b=this._splitSafely(a,r),w=0,I=b.length;w<I;w++)n.push(b[w])}}this.tree.remove(e)}}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE,e=(this.queue.remove(n),t.split(e));return e.push(n),void 0===t.consumedBy&&this.tree.insert(t),e}}]),Ya),za=void 0!==fd&&fd.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ja=void 0!==fd&&fd.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Ua=(_a(Xa,[{key:"run",value:function(t,e,n){Ua.type=t,Pa.reset();for(var r=[new Fa(e,!0)],i=0,o=n.length;i<o;i++)r.push(new Fa(n[i],!1));if(Ua.numMultiPolys=r.length,"difference"===Ua.type)for(var s=r[0],a=1;a<r.length;)null!==va(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===Ua.type)for(var u=0,l=r.length;u<l;u++)for(var h=r[u],c=u+1,p=r.length;c<p;c++)if(null===va(h.bbox,r[c].bbox))return[];for(var f=new fa(Oa.compare),g=0,d=r.length;g<d;g++)for(var y=r[g].getSweepEvents(),_=0,m=y.length;_<m;_++)if(f.insert(y[_]),f.size>za)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var v=new Ba(f),x=f.size,E=f.pop();E;){var b,w=E.key;if(f.size===x)throw b=w.segment,new Error("Unable to pop() ".concat(w.isLeft?"left":"right"," SweepEvent ")+"[".concat(w.point.x,", ").concat(w.point.y,"] from segment #").concat(b.id," ")+"[".concat(b.leftSE.point.x,", ").concat(b.leftSE.point.y,"] -> ")+"[".concat(b.rightSE.point.x,", ").concat(b.rightSE.point.y,"] from queue. ")+"Please file a bug report.");if(f.size>za)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(v.segments.length>ja)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=v.process(w),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()}Pa.reset();t=ka.factory(v.segments);return new qa(t).getGeom()}}]),new Xa),Va={union:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("difference",t,n)}};function Xa(){da(this,Xa)}function Ya(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Ta.compare;da(this,Ya),this.queue=t,this.tree=new fa(e),this.segments=[]}function Ha(t){da(this,Ha),this.rings=t,this.polys=this._composePolys(t)}function Wa(t){da(this,Wa),((this.exteriorRing=t).poly=this).interiorRings=[]}function Ja(t){da(this,Ja);for(var e=0,n=(this.events=t).length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}function Za(t,e){if(da(this,Za),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}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 n=0,r=t.length;n<r;n++){var i=new Da(t[n],this);i.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.polys.push(i)}this.isSubject=e}function Ka(t,e){if(da(this,Ka),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Aa(t[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 n=1,r=t.length;n<r;n++){var i=new Aa(t[n],this,!1);i.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.interiorRings.push(i)}this.multiPoly=e}function Qa(t,e,n){if(da(this,Qa),!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");e=Pa.round(t[0][0],t[0][1]);this.bbox={ll:{x:e.x,y:e.y},ur:{x:e.x,y:e.y}};for(var r=e,i=1,o=t.length;i<o;i++){if("number"!=typeof t[i][0]||"number"!=typeof t[i][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var s=Pa.round(t[i][0],t[i][1]);s.x===r.x&&s.y===r.y||(this.segments.push(Ta.fromRing(r,s,this)),s.x<this.bbox.ll.x&&(this.bbox.ll.x=s.x),s.y<this.bbox.ll.y&&(this.bbox.ll.y=s.y),s.x>this.bbox.ur.x&&(this.bbox.ur.x=s.x),s.y>this.bbox.ur.y&&(this.bbox.ur.y=s.y),r=s)}e.x===r.x&&e.y===r.y||this.segments.push(Ta.fromRing(r,e,this))}function $a(t,e,n,r){da(this,$a),this.id=++Ra,(this.leftSE=t).segment=this,t.otherSE=e,(this.rightSE=e).segment=this,e.otherSE=t,this.rings=n,this.windings=r}function tu(t,e){da(this,tu),void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}function eu(){da(this,eu),this.tree=new fa,this.round(0)}function nu(){da(this,nu),this.reset()}"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");for(var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=((r=1 in arguments&&parseInt(Number(arguments[1]),10)||0)<0?Math.max(n+r,0):Math.min(r,n)),i=((i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n)<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)};function ru(){}function h(){}ru.prototype.interfaces_=function(){return[]},ru.prototype.getClass=function(){return ru},ru.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n},(iu=Error)&&(su.__proto__=iu);var iu,ou=(su.prototype=Object.create(iu&&iu.prototype)).constructor=su,e={MAX_VALUE:{configurable:!0}};function su(t){iu.call(this,t),this.name="IllegalArgumentException",this.message=t,this.stack=(new iu).stack}h.isNaN=function(t){return Number.isNaN(t)},h.doubleToLongBits=function(t){return t},h.longBitsToDouble=function(t){return t},h.isInfinite=function(t){return!Number.isFinite(t)},e.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(h,e);function au(){}function uu(){}function lu(){}function hu(){}function m(){var t;this.x=null,this.y=null,this.z=null,0===arguments.length?(this.x=0,this.y=0,this.z=m.NULL_ORDINATE):1===arguments.length?(this.x=(t=arguments[0]).x,this.y=t.y,this.z=t.z):2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=m.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])}function cu(){}function g(){}function v(t,e){return t.interfaces_&&-1<t.interfaces_().indexOf(e)}function pu(){}function fu(t){this.str=t}function gu(t){this.value=t}function du(){}function d(){this._hi=0,(this._lo=0)===arguments.length?this.init(0):1===arguments.length?"number"==typeof arguments[0]||arguments[0]instanceof d?this.init(arguments[0]):"string"==typeof arguments[0]&&d.call(this,d.parse(arguments[0])):2===arguments.length&&this.init(arguments[0],arguments[1])}function yu(){}function y(){}function _u(){}function mu(){}var vu,e={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}},xu=(m.prototype.setOrdinate=function(t,e){switch(t){case m.X:this.x=e;break;case m.Y:this.y=e;break;case m.Z:this.z=e;break;default:throw new ou("Invalid ordinate index: "+t)}},m.prototype.equals2D=function(){var t,e;return 1===arguments.length?this.x===(t=arguments[0]).x&&this.y===t.y:2===arguments.length?!!ru.equalsWithTolerance(this.x,(t=arguments[0]).x,e=arguments[1])&&!!ru.equalsWithTolerance(this.y,t.y,e):void 0},m.prototype.getOrdinate=function(t){switch(t){case m.X:return this.x;case m.Y:return this.y;case m.Z:return this.z}throw new ou("Invalid ordinate index: "+t)},m.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||h.isNaN(this.z))&&h.isNaN(t.z)},m.prototype.equals=function(t){return t instanceof m&&this.equals2D(t)},m.prototype.equalInZ=function(t,e){return ru.equalsWithTolerance(this.z,t.z,e)},m.prototype.compareTo=function(t){return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0},m.prototype.clone=function(){},m.prototype.copy=function(){return new m(this)},m.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},m.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,t=this.z-t.z;return Math.sqrt(e*e+n*n+t*t)},m.prototype.distance=function(t){var e=this.x-t.x,t=this.y-t.y;return Math.sqrt(e*e+t*t)},m.prototype.hashCode=function(){return 37*(629+m.hashCode(this.x))+m.hashCode(this.y)},m.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},m.prototype.interfaces_=function(){return[au,uu,hu]},m.prototype.getClass=function(){return m},m.hashCode=function(){var t;if(1===arguments.length)return t=h.doubleToLongBits(arguments[0]),Math.trunc((t^t)>>>32)},e.DimensionalComparator.get=function(){return xu},e.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},e.NULL_ORDINATE.get=function(){return h.NaN},e.X.get=function(){return 0},e.Y.get=function(){return 1},e.Z.get=function(){return 2},Object.defineProperties(m,e),function(t){if(this._dimensionsToTest=2,0!==arguments.length&&1===arguments.length){if(2!==t&&3!==t)throw new ou("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}),e=(xu.prototype.compare=function(t,e){var n=xu.compare(t.x,e.x);return 0!==n||0!==(n=xu.compare(t.y,e.y))?n:this._dimensionsToTest<=2?0:xu.compare(t.z,e.z)},xu.prototype.interfaces_=function(){return[lu]},xu.prototype.getClass=function(){return xu},xu.compare=function(t,e){return t<e?-1:e<t?1:h.isNaN(t)?h.isNaN(e)?0:-1:h.isNaN(e)?1:0},cu.prototype.create=function(){},cu.prototype.interfaces_=function(){return[]},cu.prototype.getClass=function(){return cu},{INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}}),e=(g.prototype.interfaces_=function(){return[]},g.prototype.getClass=function(){return g},g.toLocationSymbol=function(t){switch(t){case g.EXTERIOR:return"e";case g.BOUNDARY:return"b";case g.INTERIOR:return"i";case g.NONE:return"-"}throw new ou("Unknown location value: "+t)},e.INTERIOR.get=function(){return 0},e.BOUNDARY.get=function(){return 1},e.EXTERIOR.get=function(){return 2},e.NONE.get=function(){return-1},Object.defineProperties(g,e),{LOG_10:{configurable:!0}}),e=(pu.prototype.interfaces_=function(){return[]},pu.prototype.getClass=function(){return pu},pu.log10=function(t){t=Math.log(t);return h.isInfinite(t)||h.isNaN(t)?t:t/pu.LOG_10},pu.min=function(t,e,n,r){return t=r<(t=n<(t=e<t?e:t)?n:t)?r:t},pu.clamp=function(){var t,e,n;return"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]?(n=arguments[0],t=arguments[1],e=arguments[2],n<t?t:e<n?e:n):Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])?(t=arguments[0],e=arguments[1],n=arguments[2],t<e?e:n<t?n:t):void 0},pu.wrap=function(t,e){return t<0?e- -t%e:t%e},pu.max=function(){var t,e,n;return 3===arguments.length?(t=(t=n=arguments[0])<(e=arguments[1])?e:n)<(e=arguments[2])?e:t:4===arguments.length?(n=(n=(n=arguments[0])<(e=arguments[1])?e:n)<(t=arguments[2])?t:n)<(e=arguments[3])?e:n:void 0},pu.average=function(t,e){return(t+e)/2},e.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(pu,e),fu.prototype.append=function(t){this.str+=t},fu.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},fu.prototype.toString=function(t){return this.str},gu.prototype.intValue=function(){return this.value},gu.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},gu.isNaN=function(t){return Number.isNaN(t)},du.isWhitespace=function(t){return t<=32&&0<=t||127===t},du.toUpperCase=function(t){return t.toUpperCase()},{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}}),e=(d.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},d.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=d.magnitude(n._hi),i=d.TEN.pow(r);(n=n.divide(i)).gt(d.TEN)?(n=n.divide(d.TEN),r+=1):n.lt(d.ONE)&&(n=n.multiply(d.TEN),--r);for(var o=r+1,s=new fu,a=d.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 h=!1,c=0,c=9<l?(h=!0,"9"):"0"+l,c=(s.append(c),n=n.subtract(d.valueOf(l)).multiply(d.TEN),h&&n.selfAdd(d.TEN),!0),l=d.magnitude(n._hi);if(!(c=l<0&&Math.abs(l)>=a-u?!1:c))break}return e[0]=r,s.toString()},d.prototype.sqr=function(){return this.multiply(this)},d.prototype.doubleValue=function(){return this._hi+this._lo},d.prototype.subtract=function(){return arguments[0]instanceof d?this.add(arguments[0].negate()):"number"==typeof arguments[0]?this.add(-arguments[0]):void 0},d.prototype.equals=function(){var t;if(1===arguments.length)return this._hi===(t=arguments[0])._hi&&this._lo===t._lo},d.prototype.isZero=function(){return 0===this._hi&&0===this._lo},d.prototype.selfSubtract=function(){var t;return arguments[0]instanceof d?(t=arguments[0],this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)):"number"==typeof arguments[0]?(t=arguments[0],this.isNaN()?this:this.selfAdd(-t,0)):void 0},d.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},d.prototype.min=function(t){return this.le(t)?this:t},d.prototype.selfDivide=function(){var t,e,n,r,i,o,s,a,u;return 1===arguments.length?arguments[0]instanceof d?this.selfDivide((e=arguments[0])._hi,e._lo):"number"==typeof arguments[0]?this.selfDivide(arguments[0],0):void 0:2===arguments.length?(u=s=o=a=i=r=n=e=null,a=this._hi/(t=arguments[0]),u=(e=(o=d.SPLIT*a)-(o-a))*(r=(u=d.SPLIT*t)-(u-t))-(s=a*t)+e*(i=t-r)+(n=a-e)*r+n*i,u=a+(o=(this._hi-s-u+this._lo-a*arguments[1])/t),this._hi=u,this._lo=a-u+o,this):void 0},d.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},d.prototype.divide=function(){var t,e,n,r,i,o,s,a,u;return arguments[0]instanceof d?(a=o=i=r=n=e=s=u=null,s=(r=this._hi/(t=arguments[0])._hi)-(u=(i=d.SPLIT*r)-(i-r)),a=u*(e=(a=d.SPLIT*t._hi)-(a-t._hi))-(o=r*t._hi)+u*(n=t._hi-e)+s*e+s*n,a=r+(i=(this._hi-o-a+this._lo-r*t._lo)/t._hi),new d(a,r-a+i)):"number"==typeof arguments[0]?h.isNaN(u=arguments[0])?d.createNaN():d.copy(this).selfDivide(u,0):void 0},d.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},d.prototype.pow=function(t){if(0===t)return d.valueOf(1);var e=new d(this),n=d.valueOf(1),r=Math.abs(t);if(1<r)for(;0<r;)r%2==1&&n.selfMultiply(e),0<(r/=2)&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},d.prototype.ceil=function(){var t,e;return this.isNaN()?d.NaN:(e=0,(t=Math.ceil(this._hi))===this._hi&&(e=Math.ceil(this._lo)),new d(t,e))},d.prototype.compareTo=function(t){return this._hi<t._hi?-1:this._hi>t._hi?1:this._lo<t._lo?-1:this._lo>t._lo?1:0},d.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},d.prototype.setValue=function(){return arguments[0]instanceof d||"number"==typeof arguments[0]?(this.init(arguments[0]),this):void 0},d.prototype.max=function(t){return this.ge(t)?this:t},d.prototype.sqrt=function(){var t,e;return this.isZero()?d.valueOf(0):this.isNegative()?d.NaN:(e=1/Math.sqrt(this._hi),t=this._hi*e,t=d.valueOf(t),e=this.subtract(t.sqr())._hi*(.5*e),t.add(e))},d.prototype.selfAdd=function(){var t,e,n,r,i,o,s,a,u;return 1===arguments.length?arguments[0]instanceof d?this.selfAdd((r=arguments[0])._hi,r._lo):"number"==typeof arguments[0]?(u=o=s=i=n=r=null,s=(i=this._hi+(e=arguments[0]))-(o=i-this._hi),n=(u=(s=e-o+(this._hi-s))+this._lo)+(i-(r=i+u)),this._hi=r+n,this._lo=n+(r-this._hi),this):void 0:2===arguments.length?(r=n=u=i=s=o=e=null,i=this._hi+(a=arguments[0]),o=this._lo+(t=arguments[1]),u=i-(n=i-this._hi),s=o-(r=o-this._lo),a=(e=i+(n=(u=a-n+(this._hi-u))+o))+(n=(s=t-r+(this._lo-s))+(n+(i-e))),u=n+(e-a),this._hi=a,this._lo=u,this):void 0},d.prototype.selfMultiply=function(){var t,e,n,r,i,o,s;return 1===arguments.length?arguments[0]instanceof d?this.selfMultiply((r=arguments[0])._hi,r._lo):"number"==typeof arguments[0]?this.selfMultiply(arguments[0],0):void 0:2===arguments.length?(i=n=e=o=s=r=null,r=(n=d.SPLIT*this._hi)-this._hi,s=this._hi-(r=n-r),o=(n=this._hi*(t=arguments[0]))+(i=r*(o=(i=d.SPLIT*t)-(o=i-t))-n+r*(e=t-o)+s*o+s*e+(this._hi*arguments[1]+this._lo*t)),s=i+(r=n-o),this._hi=o,this._lo=s,this):void 0},d.prototype.selfSqr=function(){return this.selfMultiply(this)},d.prototype.floor=function(){var t,e;return this.isNaN()?d.NaN:(e=0,(t=Math.floor(this._hi))===this._hi&&(e=Math.floor(this._lo)),new d(t,e))},d.prototype.negate=function(){return this.isNaN()?this:new d(-this._hi,-this._lo)},d.prototype.clone=function(){},d.prototype.multiply=function(){var t;return arguments[0]instanceof d?(t=arguments[0]).isNaN()?d.createNaN():d.copy(this).selfMultiply(t):"number"==typeof arguments[0]?h.isNaN(t=arguments[0])?d.createNaN():d.copy(this).selfMultiply(t,0):void 0},d.prototype.isNaN=function(){return h.isNaN(this._hi)},d.prototype.intValue=function(){return Math.trunc(this._hi)},d.prototype.toString=function(){var t=d.magnitude(this._hi);return-3<=t&&t<=20?this.toStandardNotation():this.toSciNotation()},d.prototype.toStandardNotation=function(){var t,e,n=this.getSpecialNumberString();return null!==n?n:(n=new Array(1).fill(null),t=this.extractSignificantDigits(!0,n),n=n[0]+1,"."===(e=t).charAt(0)?e="0"+t:n<0?e="0."+d.stringOfChar("0",-n)+t:-1===t.indexOf(".")&&(n=n-t.length,e=t+d.stringOfChar("0",n)+".0"),this.isNegative()?"-"+e:e)},d.prototype.reciprocal=function(){var t,e,n,r=null,i=(t=1/this._hi)-(r=(e=d.SPLIT*t)-(e-t)),o=(n=d.SPLIT*this._hi)-this._hi,s=t+(e=(1-(s=t*this._hi)-(r*(o=n-o)-s+r*(n=this._hi-o)+i*o+i*n)-t*this._lo)/this._hi);return new d(s,t-s+e)},d.prototype.toSciNotation=function(){if(this.isZero())return d.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var t=new Array(1).fill(null),e=this.extractSignificantDigits(!1,t),t=d.SCI_NOT_EXPONENT_CHAR+t[0];if("0"===e.charAt(0))throw new Error("Found leading zero: "+e);var n="",e=(1<e.length&&(n=e.substring(1)),e.charAt(0)+"."+n);return this.isNegative()?"-"+e+t:e+t},d.prototype.abs=function(){return this.isNaN()?d.NaN:this.isNegative()?this.negate():new d(this)},d.prototype.isPositive=function(){return(0<this._hi||0===this._hi)&&0<this._lo},d.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},d.prototype.add=function(){var t;return arguments[0]instanceof d||"number"==typeof arguments[0]?(t=arguments[0],d.copy(this).selfAdd(t)):void 0},d.prototype.init=function(){var t,e;1===arguments.length?"number"==typeof arguments[0]?(this._hi=arguments[0],this._lo=0):arguments[0]instanceof d&&(this._hi=(t=arguments[0])._hi,this._lo=t._lo):2===arguments.length&&(t=arguments[0],e=arguments[1],this._hi=t,this._lo=e)},d.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},d.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},d.prototype.trunc=function(){return this.isNaN()?d.NaN:this.isPositive()?this.floor():this.ceil()},d.prototype.signum=function(){return 0<this._hi?1:this._hi<0?-1:0<this._lo?1:this._lo<0?-1:0},d.prototype.interfaces_=function(){return[hu,au,uu]},d.prototype.getClass=function(){return d},d.sqr=function(t){return d.valueOf(t).selfMultiply(t)},d.valueOf=function(){return"string"==typeof arguments[0]?d.parse(arguments[0]):"number"==typeof arguments[0]?new d(arguments[0]):void 0},d.sqrt=function(t){return d.valueOf(t).sqrt()},d.parse=function(t){for(var e=0,n=t.length;du.isWhitespace(t.charAt(e));)e++;var r=!1;e<n&&("-"!==(c=t.charAt(e))&&"+"!==c||(e++,"-"===c&&(r=!0)));for(var i=new d,o=0,s=0,a=0;!(n<=e);){var u=t.charAt(e);if(e++,du.isDigit(u)){var l=u-"0";i.selfMultiply(d.TEN),i.selfAdd(l),o++}else{if("."!==u){if("e"!==u&&"E"!==u)throw new Error("Unexpected character '"+u+"' at position "+e+" in string "+t);l=t.substring(e);try{a=gu.parseInt(l)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+l+" in string "+t):e}break}s=o}}var h,c=i,p=o-s-a;return 0==p?c=i:0<p?(h=d.TEN.pow(p),c=i.divide(h)):p<0&&(h=d.TEN.pow(-p),c=i.multiply(h)),r?c.negate():c},d.createNaN=function(){return new d(h.NaN,h.NaN)},d.copy=function(t){return new d(t)},d.magnitude=function(t){var t=Math.abs(t),e=Math.log(t)/Math.log(10),e=Math.trunc(Math.floor(e));return 10*Math.pow(10,e)<=t&&(e+=1),e},d.stringOfChar=function(t,e){for(var n=new fu,r=0;r<e;r++)n.append(t);return n.toString()},e.PI.get=function(){return new d(3.141592653589793,12246467991473532e-32)},e.TWO_PI.get=function(){return new d(6.283185307179586,24492935982947064e-32)},e.PI_2.get=function(){return new d(1.5707963267948966,6123233995736766e-32)},e.E.get=function(){return new d(2.718281828459045,14456468917292502e-32)},e.NaN.get=function(){return new d(h.NaN,h.NaN)},e.EPS.get=function(){return 123259516440783e-46},e.SPLIT.get=function(){return 134217729},e.MAX_PRINT_DIGITS.get=function(){return 32},e.TEN.get=function(){return d.valueOf(10)},e.ONE.get=function(){return d.valueOf(1)},e.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},e.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(d,e),{DP_SAFE_EPSILON:{configurable:!0}}),e=(yu.prototype.interfaces_=function(){return[]},yu.prototype.getClass=function(){return yu},yu.orientationIndex=function(t,e,n){var r,i=yu.orientationIndexFilter(t,e,n);return i<=1?i:(i=d.valueOf(e.x).selfAdd(-t.x),t=d.valueOf(e.y).selfAdd(-t.y),r=d.valueOf(n.x).selfAdd(-e.x),n=d.valueOf(n.y).selfAdd(-e.y),i.selfMultiply(n).selfSubtract(t.selfMultiply(r)).signum())},yu.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},yu.intersection=function(t,e,n,r){var i=d.valueOf(r.y).selfSubtract(n.y).selfMultiply(d.valueOf(e.x).selfSubtract(t.x)),o=d.valueOf(r.x).selfSubtract(n.x).selfMultiply(d.valueOf(e.y).selfSubtract(t.y)),i=i.subtract(o),o=d.valueOf(r.x).selfSubtract(n.x).selfMultiply(d.valueOf(t.y).selfSubtract(n.y)),s=d.valueOf(r.y).selfSubtract(n.y).selfMultiply(d.valueOf(t.x).selfSubtract(n.x)),o=o.subtract(s).selfDivide(i).doubleValue(),s=d.valueOf(t.x).selfAdd(d.valueOf(e.x).selfSubtract(t.x).selfMultiply(o)).doubleValue(),o=d.valueOf(e.x).selfSubtract(t.x).selfMultiply(d.valueOf(t.y).selfSubtract(n.y)),e=d.valueOf(e.y).selfSubtract(t.y).selfMultiply(d.valueOf(t.x).selfSubtract(n.x)),t=o.subtract(e).selfDivide(i).doubleValue(),o=d.valueOf(n.y).selfAdd(d.valueOf(r.y).selfSubtract(n.y).selfMultiply(t)).doubleValue();return new m(s,o)},yu.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),t=(t.y-n.y)*(e.x-n.x),e=i-t;if(0<i){if(t<=0)return yu.signum(e);r=i+t}else{if(!(i<0))return yu.signum(e);if(0<=t)return yu.signum(e);r=-i-t}n=yu.DP_SAFE_EPSILON*r;return n<=e||n<=-e?yu.signum(e):2},yu.signum=function(t){return 0<t?1:t<0?-1:0},e.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(yu,e),{X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}}),Eu=(e.X.get=function(){return 0},e.Y.get=function(){return 1},e.Z.get=function(){return 2},e.M.get=function(){return 3},y.prototype.setOrdinate=function(t,e,n){},y.prototype.size=function(){},y.prototype.getOrdinate=function(t,e){},y.prototype.getCoordinate=function(){},y.prototype.getCoordinateCopy=function(t){},y.prototype.getDimension=function(){},y.prototype.getX=function(t){},y.prototype.clone=function(){},y.prototype.expandEnvelope=function(t){},y.prototype.copy=function(){},y.prototype.getY=function(t){},y.prototype.toCoordinateArray=function(){},y.prototype.interfaces_=function(){return[uu]},y.prototype.getClass=function(){return y},Object.defineProperties(y,e),(vu=_u)&&(bu.__proto__=vu),((bu.prototype=Object.create(vu&&vu.prototype)).constructor=bu).prototype.interfaces_=function(){return[]},bu.prototype.getClass=function(){return bu},bu);function bu(){vu.call(this,"Projective point not representable on the Cartesian plane.")}mu.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},mu.getProperty=function(t){return{"line.separator":"\n"}[t]};function wu(){var t,e,n,r,i,o,s;this.x=null,this.y=null,this.w=null,0===arguments.length?(this.x=0,this.y=0,this.w=1):1===arguments.length?(this.x=(t=arguments[0]).x,this.y=t.y,this.w=1):2===arguments.length?"number"==typeof arguments[0]&&"number"==typeof arguments[1]?(t=arguments[0],r=arguments[1],this.x=t,this.y=r,this.w=1):arguments[0]instanceof wu&&arguments[1]instanceof wu?(this.x=(t=arguments[0]).y*(r=arguments[1]).w-r.y*t.w,this.y=r.x*t.w-t.x*r.w,this.w=t.x*r.y-r.x*t.y):arguments[0]instanceof m&&arguments[1]instanceof m&&(this.x=(r=arguments[0]).y-(t=arguments[1]).y,this.y=t.x-r.x,this.w=r.x*t.y-t.x*r.y):3===arguments.length?(t=arguments[0],r=arguments[1],e=arguments[2],this.x=t,this.y=r,this.w=e):4===arguments.length&&(e=(t=arguments[0]).y-(r=arguments[1]).y,n=r.x-t.x,r=t.x*r.y-r.x*t.y,i=(t=arguments[2]).y-(s=arguments[3]).y,o=s.x-t.x,s=t.x*s.y-s.x*t.y,this.x=n*s-o*r,this.y=i*r-e*s,this.w=e*o-i*n)}function u(){var t,e;this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length?this.init():1===arguments.length?arguments[0]instanceof m?this.init((t=arguments[0]).x,t.x,t.y,t.y):arguments[0]instanceof u&&this.init(arguments[0]):2===arguments.length?this.init((t=arguments[0]).x,(e=arguments[1]).x,t.y,e.y):4===arguments.length&&this.init(arguments[0],arguments[1],arguments[2],arguments[3])}wu.prototype.getY=function(){var t=this.y/this.w;if(h.isNaN(t)||h.isInfinite(t))throw new Eu;return t},wu.prototype.getX=function(){var t=this.x/this.w;if(h.isNaN(t)||h.isInfinite(t))throw new Eu;return t},wu.prototype.getCoordinate=function(){var t=new m;return t.x=this.getX(),t.y=this.getY(),t},wu.prototype.interfaces_=function(){return[]},wu.prototype.getClass=function(){return wu},wu.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,e=t.x*e.y-e.x*t.y,t=n.y-r.y,s=r.x-n.x,r=n.x*r.y-r.x*n.y,n=i*s-t*o,o=(o*r-s*e)/n,s=(t*e-i*r)/n;if(h.isNaN(o)||h.isInfinite(o)||h.isNaN(s)||h.isInfinite(s))throw new Eu;return new m(o,s)};function Iu(t){this.geometryFactory=t||new A}function Nu(t){this.parser=new Iu(t)}function x(){}var Su,Cu,e={serialVersionUID:{configurable:!0}},Pu=(u.prototype.getArea=function(){return this.getWidth()*this.getHeight()},u.prototype.equals=function(t){return t instanceof u&&(t=t,this.isNull()?t.isNull():this._maxx===t.getMaxX()&&this._maxy===t.getMaxY()&&this._minx===t.getMinX()&&this._miny===t.getMinY())},u.prototype.intersection=function(t){var e,n,r;return this.isNull()||t.isNull()||!this.intersects(t)?new u:(e=(this._minx>t._minx?this:t)._minx,n=(this._miny>t._miny?this:t)._miny,r=(this._maxx<t._maxx?this:t)._maxx,t=(this._maxy<t._maxy?this:t)._maxy,new u(e,r,n,t))},u.prototype.isNull=function(){return this._maxx<this._minx},u.prototype.getMaxX=function(){return this._maxx},u.prototype.covers=function(){var t,e;return 1===arguments.length?arguments[0]instanceof m?this.covers((t=arguments[0]).x,t.y):arguments[0]instanceof u?(t=arguments[0],!this.isNull()&&!t.isNull()&&t.getMinX()>=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy):void 0:2===arguments.length?(t=arguments[0],e=arguments[1],!this.isNull()&&t>=this._minx&&t<=this._maxx&&e>=this._miny&&e<=this._maxy):void 0},u.prototype.intersects=function(){var t,e;return 1===arguments.length?arguments[0]instanceof u?(t=arguments[0],!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)):arguments[0]instanceof m?this.intersects((t=arguments[0]).x,t.y):void 0:2===arguments.length?(t=arguments[0],e=arguments[1],!this.isNull()&&!(t>this._maxx||t<this._minx||e>this._maxy||e<this._miny)):void 0},u.prototype.getMinY=function(){return this._miny},u.prototype.getMinX=function(){return this._minx},u.prototype.expandToInclude=function(){var t;if(1===arguments.length){if(arguments[0]instanceof m){var e=arguments[0];this.expandToInclude(e.x,e.y)}else if(arguments[0]instanceof u){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 2===arguments.length&&(e=arguments[0],t=arguments[1],this.isNull()?(this._minx=e,this._maxx=e,this._miny=t,this._maxy=t):(e<this._minx&&(this._minx=e),e>this._maxx&&(this._maxx=e),t<this._miny&&(this._miny=t),t>this._maxy&&(this._maxy=t)))},u.prototype.minExtent=function(){var t,e;return this.isNull()?0:(t=this.getWidth())<(e=this.getHeight())?t:e},u.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},u.prototype.compareTo=function(t){return this.isNull()?t.isNull()?0:-1:t.isNull()?1:this._minx<t._minx?-1:this._minx>t._minx?1:this._miny<t._miny?-1:this._miny>t._miny?1:this._maxx<t._maxx?-1:this._maxx>t._maxx?1:this._maxy<t._maxy?-1:this._maxy>t._maxy?1:0},u.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},u.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},u.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},u.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},u.prototype.maxExtent=function(){var t,e;return this.isNull()?0:(t=this.getWidth(),(e=this.getHeight())<t?t:e)},u.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var t=arguments[0],e=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=e,this._maxy+=e,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},u.prototype.contains=function(){return 1===arguments.length?arguments[0]instanceof u||arguments[0]instanceof m?this.covers(arguments[0]):void 0:2===arguments.length?this.covers(arguments[0],arguments[1]):void 0},u.prototype.centre=function(){return this.isNull()?null:new m((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},u.prototype.init=function(){var t,e,n,r;0===arguments.length?this.setToNull():1===arguments.length?arguments[0]instanceof m?this.init((t=arguments[0]).x,t.x,t.y,t.y):arguments[0]instanceof u&&(this._minx=(t=arguments[0])._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy):2===arguments.length?this.init((t=arguments[0]).x,(e=arguments[1]).x,t.y,e.y):4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],t<e?(this._minx=t,this._maxx=e):(this._minx=e,this._maxx=t),n<r?(this._miny=n,this._maxy=r):(this._miny=r,this._maxy=n))},u.prototype.getMaxY=function(){return this._maxy},u.prototype.distance=function(t){var e,n;return this.intersects(t)?0:(e=0,this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx),n=0,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))},u.prototype.hashCode=function(){return 37*(37*(37*(629+m.hashCode(this._minx))+m.hashCode(this._maxx))+m.hashCode(this._miny))+m.hashCode(this._maxy)},u.prototype.interfaces_=function(){return[au,hu]},u.prototype.getClass=function(){return u},u.intersects=function(){var t,e,n,r,i,o,s,a;return 3===arguments.length?(e=arguments[0],n=arguments[1],(t=arguments[2]).x>=(e.x<n.x?e:n).x&&t.x<=(e.x>n.x?e:n).x&&t.y>=(e.y<n.y?e:n).y&&t.y<=(e.y>n.y?e:n).y):4===arguments.length?(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],i=Math.min(n.x,r.x),o=Math.max(n.x,r.x),s=Math.min(t.x,e.x),a=Math.max(t.x,e.x),!(o<s||a<i||(i=Math.min(n.y,r.y),o=Math.max(n.y,r.y),s=Math.min(t.y,e.y),a=Math.max(t.y,e.y),o<s)||a<i)):void 0},e.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(u,e),{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*$/}),Mu=(Iu.prototype.read=function(t){t=t.replace(/[\n\r]/g," ");var e,n,r=Pu.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((r=Pu.emptyTypeStr.exec(t))[2]=void 0),void 0===(e=r&&(n=r[1].toLowerCase(),r=r[2],Lu[n])?Lu[n].apply(this,[r]):e))throw new Error("Could not parse WKT "+t);return e},Iu.prototype.write=function(t){return this.extractGeometry(t)},Iu.prototype.extractGeometry=function(t){var e,n=t.getGeometryType().toLowerCase();return Mu[n]?(e=n.toUpperCase(),t.isEmpty()?e+" EMPTY":e+"("+Mu[n].apply(this,[t])+")"):null},{coordinate:function(t){return t.x+" "+t.y},point:function(t){return Mu.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+Mu.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(Mu.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(Mu.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+Mu.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+Mu.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+Mu.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+Mu.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}}),Lu={point:function(t){return void 0===t?this.geometryFactory.createPoint():(t=t.trim().split(Pu.spaces),this.geometryFactory.createPoint(new m(Number.parseFloat(t[0]),Number.parseFloat(t[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(Pu.trimParens,"$1"),r.push(Lu.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(Pu.spaces),r.push(new m(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(Pu.spaces),r.push(new m(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(Pu.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Pu.trimParens,"$1"),r.push(Lu.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e;if(void 0===t)return this.geometryFactory.createPolygon();for(var n,r=t.trim().split(Pu.parenComma),i=[],o=0,s=r.length;o<s;++o)e=r[o].replace(Pu.trimParens,"$1"),e=Lu.linestring.apply(this,[e]),e=this.geometryFactory.createLinearRing(e._points),0===o?n=e:i.push(e);return this.geometryFactory.createPolygon(n,i)},multipolygon:function(