Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-lasso

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-lasso - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

2

dist/leaflet-lasso.umd.min.js

@@ -16,3 +16,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e((t=t||self).LeafletLasso={},t.L)}(this,(function(t,e){"use strict";e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;

***************************************************************************** */
var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)};function n(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r=function(){return(r=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function i(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;var n=Array(t),r=0;for(e=0;e<o;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,r++)n[r]=i[s];return n}var s=function(t){function o(o,n){var i=t.call(this)||this;return i.polyline=e.polyline(o,n),i.polygon=e.polygon(o,r(r({},n),{weight:0})),i}return n(o,t),o.prototype.onAdd=function(t){return this.polyline.addTo(t),this.polygon.addTo(t),this},o.prototype.onRemove=function(){return this.polyline.remove(),this.polygon.remove(),this},o.prototype.addLatLng=function(t){return this.polyline.addLatLng(t),this.polygon.addLatLng(t),this},o.prototype.getLatLngs=function(){return this.polygon.getLatLngs()[0]},o.prototype.toGeoJSON=function(){return this.polygon.toGeoJSON()},o}(e.Layer),a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var l=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){var o,n;o=a,n=function(){var t={},e={type:"link",properties:{href:"http://spatialreference.org/ref/sr-org/6928/ogcwkt/",type:"ogcwkt"}};function o(t){return"[object Array]"===Object.prototype.toString.call(t)}function n(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t}function r(t){if(t.type)switch(t.type){case"Point":return[t.coordinates[0],t.coordinates[1],t.coordinates[0],t.coordinates[1]];case"MultiPoint":case"LineString":return s(t.coordinates);case"MultiLineString":case"Polygon":return i(t.coordinates);case"MultiPolygon":return function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++)for(var l=s[a],u=0;u<l.length;u++){var c=l[u],h=c[0],p=c[1];(null===e||h<e)&&(e=h),(null===o||h>o)&&(o=h),(null===n||p<n)&&(n=p),(null===r||p>r)&&(r=p)}return[e,n,o,r]}(t.coordinates);case"Feature":return t.geometry?r(t.geometry):null;case"FeatureCollection":return function(t){for(var e,o=[],n=t.features.length-1;n>=0;n--)e=r(t.features[n].geometry),o.push([e[0],e[1]]),o.push([e[2],e[3]]);return s(o)}(t);case"GeometryCollection":return function(t){for(var e,o=[],n=t.geometries.length-1;n>=0;n--)e=r(t.geometries[n]),o.push([e[0],e[1]]),o.push([e[2],e[3]]);return s(o)}(t);default:throw new Error("Unknown type: "+t.type)}return null}function i(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++){var l=s[a],u=l[0],c=l[1];(null===e||u<e)&&(e=u),(null===o||u>o)&&(o=u),(null===n||c<n)&&(n=c),(null===r||c>r)&&(r=c)}return[e,n,o,r]}function s(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++){var s=t[i],a=s[0],l=s[1];(null===e||a<e)&&(e=a),(null===o||a>o)&&(o=a),(null===n||l<n)&&(n=l),(null===r||l>r)&&(r=l)}return[e,n,o,r]}function a(t){var e=r(t);return{x:e[0],y:e[1],w:Math.abs(e[0]-e[2]),h:Math.abs(e[1]-e[3])}}function l(t){return 57.29577951308232*t}function u(t){return.017453292519943*t}function c(t){var e=t[0],o=t[1];return[l(e/6378137)-360*Math.floor((l(e/6378137)+180)/360),l(Math.PI/2-2*Math.atan(Math.exp(-1*o/6378137)))]}function h(t){var e=t[0],o=Math.max(Math.min(t[1],89.99999),-89.99999);return[6378137*u(e),3189068.5*Math.log((1+Math.sin(u(o)))/(1-Math.sin(u(o))))]}function p(t,o,n){if("Point"===t.type)t.coordinates=o(t.coordinates);else if("Feature"===t.type)t.geometry=p(t.geometry,o,!0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)t.features[r]=p(t.features[r],o,!0);else if("GeometryCollection"===t.type)for(var i=0;i<t.geometries.length;i++)t.geometries[i]=p(t.geometries[i],o,!0);else t.coordinates=function t(e,o){for(var n=0;n<e.length;n++)"number"==typeof e[n][0]&&(e[n]=o(e[n])),"object"==typeof e[n]&&(e[n]=t(e[n],o));return e}(t.coordinates,o);return n||o===h&&(t.crs=e),o===c&&delete t.crs,t}function f(t){return p(t,h)}function y(t){return p(t,c)}function d(t,e){return t[0]>e[0]?-1:t[0]<e[0]?1:t[1]>e[1]?-1:t[1]<e[1]?1:0}function g(t,e,o){return(n=(e[0]-t[0])*(o[1]-t[1])-(o[0]-t[0])*(e[1]-t[1]))<(r=0)?-1:n>r?1:0;var n,r}function m(t,e){var o=e[0]-t[0],n=e[1]-t[1];return o*o+n*n}function v(t,e){var o=e;for(var n in t){var r=g(e,o,t[n]);(-1===r||0===r&&m(e,t[n])>m(e,o))&&(o=t[n])}return o}function w(t){if(0===t.length)return[];if(1===t.length)return t;for(var e=[t.sort(d)[0]],o=0;o<e.length;o++){var n=v(t,e[o]);n!==e[0]&&e.push(n)}return e}function M(t,e){for(var o=!1,n=-1,r=t.length,i=r-1;++n<r;i=n)(t[n][1]<=e[1]&&e[1]<t[i][1]||t[i][1]<=e[1]&&e[1]<t[n][1])&&e[0]<(t[i][0]-t[n][0])*(e[1]-t[n][1])/(t[i][1]-t[n][1])+t[n][0]&&(o=!o);return o}function b(t,e){if(t&&t.length){if(1===t.length)return M(t[0],e);if(M(t[0],e)){for(var o=1;o<t.length;o++)if(M(t[o],e))return!1;return!0}return!1}return!1}function P(t,e,o,n){var r=(n[0]-o[0])*(t[1]-o[1])-(n[1]-o[1])*(t[0]-o[0]),i=(e[0]-t[0])*(t[1]-o[1])-(e[1]-t[1])*(t[0]-o[0]),s=(n[1]-o[1])*(e[0]-t[0])-(n[0]-o[0])*(e[1]-t[1]);if(0!==s){var a=r/s,l=i/s;if(0<=a&&a<=1&&0<=l&&l<=1)return!0}return!1}function L(t){return!isNaN(parseFloat(t))&&isFinite(t)}function A(t,e){if(L(t[0][0])){if(L(e[0][0])){for(var o=0;o<t.length-1;o++)for(var n=0;n<e.length-1;n++)if(P(t[o],t[o+1],e[n],e[n+1]))return!0}else for(var r=0;r<e.length;r++)if(A(t,e[r]))return!0}else for(var i=0;i<t.length;i++)if(A(t[i],e))return!0;return!1}function E(t){for(var e=[],o=0;o<t.length;o++){var n=t[o].slice();!1===S(n[0],n[n.length-1])&&n.push(n[0]),e.push(n)}return e}function S(t,e){for(var o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}function T(t,e){if(t.length!==e.length)return!1;for(var o=t.slice().sort(d),n=e.slice().sort(d),r=0;r<o.length;r++){if(o[r].length!==n[r].length)return!1;for(var i=0;i<o.length;i++)if(o[r][i]!==n[r][i])return!1}return!0}var C=["length"];function R(t){if(t)switch(t.type){case"Point":return new O(t);case"MultiPoint":return new D(t);case"LineString":return new F(t);case"MultiLineString":return new I(t);case"Polygon":return new x(t);case"MultiPolygon":return new G(t);case"Feature":return new k(t);case"FeatureCollection":return new N(t);case"GeometryCollection":return new U(t);default:throw new Error("Unknown type: "+t.type)}}function O(t){var e=Array.prototype.slice.call(arguments);if(t&&"Point"===t.type&&t.coordinates)n(this,t);else if(t&&o(t))this.coordinates=t;else{if(!(e.length>=2))throw"Terraformer: invalid input for Terraformer.Point";this.coordinates=e}this.type="Point"}function D(t){if(t&&"MultiPoint"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.MultiPoint";this.coordinates=t}this.type="MultiPoint"}function F(t){if(t&&"LineString"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.LineString";this.coordinates=t}this.type="LineString"}function I(t){if(t&&"MultiLineString"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.MultiLineString";this.coordinates=t}this.type="MultiLineString"}function x(t){if(t&&"Polygon"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.Polygon";this.coordinates=t}this.type="Polygon"}function G(t){if(t&&"MultiPolygon"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.MultiPolygon";this.coordinates=t}this.type="MultiPolygon"}function k(t){if(t&&"Feature"===t.type)n(this,t);else{if(!(t&&t.type&&t.coordinates))throw"Terraformer: invalid input for Terraformer.Feature";this.geometry=t}this.type="Feature"}function N(t){if(t&&"FeatureCollection"===t.type&&t.features)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.FeatureCollection";this.features=t}this.type="FeatureCollection"}function U(t){if(t&&"GeometryCollection"===t.type&&t.geometries)n(this,t);else if(o(t))this.geometries=t;else{if(!t.coordinates||!t.type)throw"Terraformer: invalid input for Terraformer.GeometryCollection";this.type="GeometryCollection",this.geometries=[t]}this.type="GeometryCollection"}function B(t,e,o){for(var n=h(t),r=o||64,i={type:"Polygon",coordinates:[[]]},s=1;s<=r;s++){var a=s*(360/r)*Math.PI/180;i.coordinates[0].push([n[0]+e*Math.cos(a),n[1]+e*Math.sin(a)])}return i.coordinates=E(i.coordinates),y(i)}function H(t,e,o){var r=o||64,i=e||250;if(!t||t.length<2||!i||!r)throw new Error("Terraformer: missing parameter for Terraformer.Circle");n(this,new k({type:"Feature",geometry:B(t,i,r),properties:{radius:i,center:t,steps:r}}))}return R.prototype.toMercator=function(){return f(this)},R.prototype.toGeographic=function(){return y(this)},R.prototype.envelope=function(){return a(this)},R.prototype.bbox=function(){return r(this)},R.prototype.convexHull=function(){var t,e,o=[];if("Point"===this.type)return null;if("LineString"===this.type||"MultiPoint"===this.type){if(!(this.coordinates&&this.coordinates.length>=3))return null;o=this.coordinates}else if("Polygon"===this.type||"MultiLineString"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return null;for(t=0;t<this.coordinates.length;t++)o=o.concat(this.coordinates[t]);if(o.length<3)return null}else if("MultiPolygon"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return null;for(t=0;t<this.coordinates.length;t++)for(e=0;e<this.coordinates[t].length;e++)o=o.concat(this.coordinates[t][e]);if(o.length<3)return null}else if("Feature"===this.type)return new R(this.geometry).convexHull();return new x({type:"Polygon",coordinates:E([w(o)])})},R.prototype.toJSON=function(){var t={};for(var e in this)this.hasOwnProperty(e)&&-1===C.indexOf(e)&&(t[e]=this[e]);return t.bbox=r(this),t},R.prototype.contains=function(t){return new R(t).within(this)},R.prototype.within=function(t){var e,o;if("Feature"===t.type&&(t=t.geometry),"Point"===t.type&&"Point"===this.type)return S(this.coordinates,t.coordinates);if("MultiLineString"===t.type&&"Point"===this.type)for(e=0;e<t.coordinates.length;e++){var n={type:"LineString",coordinates:t.coordinates[e]};if(this.within(n))return!0}if(("LineString"===t.type||"MultiPoint"===t.type)&&"Point"===this.type)for(e=0;e<t.coordinates.length;e++){if(this.coordinates.length!==t.coordinates[e].length)return!1;if(S(this.coordinates,t.coordinates[e]))return!0}if("Polygon"===t.type){if("Polygon"===this.type){if(t.coordinates.length===this.coordinates.length)for(e=0;e<this.coordinates.length;e++)if(T(this.coordinates[e],t.coordinates[e]))return!0;return!(!this.coordinates.length||!b(t.coordinates,this.coordinates[0][0])||A(E(this.coordinates),E(t.coordinates)))}if("Point"===this.type)return b(t.coordinates,this.coordinates);if("LineString"===this.type||"MultiPoint"===this.type){if(!this.coordinates||0===this.coordinates.length)return!1;for(e=0;e<this.coordinates.length;e++)if(!1===b(t.coordinates,this.coordinates[e]))return!1;return!0}if("MultiLineString"===this.type){for(e=0;e<this.coordinates.length;e++)if(!1===new F(this.coordinates[e]).within(t))return o++,!1;return!0}if("MultiPolygon"===this.type){for(e=0;e<this.coordinates.length;e++)if(!1===new R({type:"Polygon",coordinates:this.coordinates[e]}).within(t))return!1;return!0}}if("MultiPolygon"===t.type){if("Point"===this.type){if(t.coordinates.length)for(e=0;e<t.coordinates.length;e++)if(b(t.coordinates[e],this.coordinates)&&!1===A([this.coordinates],t.coordinates))return!0;return!1}if("Polygon"===this.type){for(e=0;e<this.coordinates.length;e++)if(t.coordinates[e].length===this.coordinates.length)for(j=0;j<this.coordinates.length;j++)if(T(this.coordinates[j],t.coordinates[e][j]))return!0;if(!1===A(this.coordinates,t.coordinates)&&t.coordinates.length){for(e=0;e<t.coordinates.length;e++)o=!1!==b(t.coordinates[e],this.coordinates[0][0]);return o}}else if("LineString"===this.type||"MultiPoint"===this.type)for(e=0;e<t.coordinates.length;e++){var r={type:"Polygon",coordinates:t.coordinates[e]};return!!this.within(r)}else{if("MultiLineString"===this.type){for(e=0;e<this.coordinates.length;e++)if(!1===new F(this.coordinates[e]).within(t))return!1;return!0}if("MultiPolygon"===this.type){for(e=0;e<t.coordinates.length;e++){var i={type:"Polygon",coordinates:t.coordinates[e]};if(!1===this.within(i))return!1}return!0}}}return!1},R.prototype.intersects=function(t){"Feature"===t.type&&(t=t.geometry);var e=new R(t);return!(!this.within(t)&&!e.within(this))||("Point"!==this.type&&"MultiPoint"!==this.type&&"Point"!==t.type&&"MultiPoint"!==t.type?A(this.coordinates,t.coordinates):"Feature"===this.type?new R(this.geometry).intersects(t):(function(){var t=Array.prototype.slice.apply(arguments);void 0!==typeof console&&console.warn&&console.warn.apply(console,t)}("Type "+this.type+" to "+t.type+" intersection is not supported by intersects"),!1))},O.prototype=new R,O.prototype.constructor=O,D.prototype=new R,D.prototype.constructor=D,D.prototype.forEach=function(t){for(var e=0;e<this.coordinates.length;e++)t.apply(this,[this.coordinates[e],e,this.coordinates]);return this},D.prototype.addPoint=function(t){return this.coordinates.push(t),this},D.prototype.insertPoint=function(t,e){return this.coordinates.splice(e,0,t),this},D.prototype.removePoint=function(t){return"number"==typeof t?this.coordinates.splice(t,1):this.coordinates.splice(this.coordinates.indexOf(t),1),this},D.prototype.get=function(t){return new O(this.coordinates[t])},F.prototype=new R,F.prototype.constructor=F,F.prototype.addVertex=function(t){return this.coordinates.push(t),this},F.prototype.insertVertex=function(t,e){return this.coordinates.splice(e,0,t),this},F.prototype.removeVertex=function(t){return this.coordinates.splice(t,1),this},I.prototype=new R,I.prototype.constructor=I,I.prototype.forEach=function(t){for(var e=0;e<this.coordinates.length;e++)t.apply(this,[this.coordinates[e],e,this.coordinates])},I.prototype.get=function(t){return new F(this.coordinates[t])},x.prototype=new R,x.prototype.constructor=x,x.prototype.addVertex=function(t){return this.insertVertex(t,this.coordinates[0].length-1),this},x.prototype.insertVertex=function(t,e){return this.coordinates[0].splice(e,0,t),this},x.prototype.removeVertex=function(t){return this.coordinates[0].splice(t,1),this},x.prototype.close=function(){this.coordinates=E(this.coordinates)},x.prototype.hasHoles=function(){return this.coordinates.length>1},x.prototype.holes=function(){if(holes=[],this.hasHoles())for(var t=1;t<this.coordinates.length;t++)holes.push(new x([this.coordinates[t]]));return holes},G.prototype=new R,G.prototype.constructor=G,G.prototype.forEach=function(t){for(var e=0;e<this.coordinates.length;e++)t.apply(this,[this.coordinates[e],e,this.coordinates])},G.prototype.get=function(t){return new x(this.coordinates[t])},G.prototype.close=function(){var t=[];return this.forEach((function(e){t.push(E(e))})),this.coordinates=t,this},k.prototype=new R,k.prototype.constructor=k,N.prototype=new R,N.prototype.constructor=N,N.prototype.forEach=function(t){for(var e=0;e<this.features.length;e++)t.apply(this,[this.features[e],e,this.features])},N.prototype.get=function(t){var e;return this.forEach((function(o){o.id===t&&(e=o)})),new k(e)},U.prototype=new R,U.prototype.constructor=U,U.prototype.forEach=function(t){for(var e=0;e<this.geometries.length;e++)t.apply(this,[this.geometries[e],e,this.geometries])},U.prototype.get=function(t){return new R(this.geometries[t])},H.prototype=new R,H.prototype.constructor=H,H.prototype.recalculate=function(){return this.geometry=B(this.properties.center,this.properties.radius,this.properties.steps),this},H.prototype.center=function(t){return t&&(this.properties.center=t,this.recalculate()),this.properties.center},H.prototype.radius=function(t){return t&&(this.properties.radius=t,this.recalculate()),this.properties.radius},H.prototype.steps=function(t){return t&&(this.properties.steps=t,this.recalculate()),this.properties.steps},H.prototype.toJSON=function(){return R.prototype.toJSON.call(this)},t.Primitive=R,t.Point=O,t.MultiPoint=D,t.LineString=F,t.MultiLineString=I,t.Polygon=x,t.MultiPolygon=G,t.Feature=k,t.FeatureCollection=N,t.GeometryCollection=U,t.Circle=H,t.toMercator=f,t.toGeographic=y,t.Tools={},t.Tools.positionToMercator=h,t.Tools.positionToGeographic=c,t.Tools.applyConverter=p,t.Tools.toMercator=f,t.Tools.toGeographic=y,t.Tools.createCircle=B,t.Tools.calculateBounds=r,t.Tools.calculateEnvelope=a,t.Tools.coordinatesContainPoint=M,t.Tools.polygonContainsPoint=b,t.Tools.arraysIntersectArrays=A,t.Tools.coordinatesContainPoint=M,t.Tools.coordinatesEqual=T,t.Tools.convexHull=w,t.Tools.isConvex=function(t){for(var e,o=0;o<t.length-3;o++){var n=t[o],r=t[o+1],i=t[o+2],s=[r[0]-n[0],r[1]-n[1]],a=i[0]*s[1]-i[1]*s[0]+s[0]*n[1]-s[1]*n[0];if(0===o)e=a<0;else if(e&&a>0||!e&&a<0)return!1}return!0},t.MercatorCRS=e,t.GeographicCRS={type:"link",properties:{href:"http://spatialreference.org/ref/epsg/4326/ogcwkt/",type:"ogcwkt"}},t},t.exports=n(),"object"==typeof window&&(o.Terraformer=n())}));function u(t){return t*Math.PI/180}function c(t){return 180*t/Math.PI}function h({center:t,radius:e,numberOfSegments:o}){!function(t){if(!Array.isArray(t)||![2,3].includes(t.length))throw new Error("ERROR! Center has to be an array of length two or three");const[e,o]=t;if("number"!=typeof e||"number"!=typeof o)throw new Error(`ERROR! Longitude and Latitude has to be numbers but where ${typeof e} and ${typeof o}`);if(e>180||e<-180)throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${e}`);if(o>90||o<-90)throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${o}`)}(t),function(t){if("number"!=typeof t)throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof t}`);if(t<=0)throw new Error(`ERROR! Radius has to be a positive number but was: ${t}`)}(e),function(t){if("number"!=typeof t&&void 0!==t)throw new Error(`ERROR! Number of segments has to be a number but was: ${typeof t}`);if(t<3)throw new Error(`ERROR! Number of segments has to be at least 3 but was: ${t}`)}(o)}function p(t,o){return function(t,e,o){var n=o||32;h({center:t,radius:e,numberOfSegments:o});for(var r,i,s,a,l,p,f,y=[],d=0;d<n;++d)y.push((r=t,i=e,s=2*Math.PI*-d/n,a=void 0,l=void 0,p=void 0,f=void 0,a=u(r[1]),l=u(r[0]),p=i/6378137,f=Math.asin(Math.sin(a)*Math.cos(p)+Math.cos(a)*Math.sin(p)*Math.cos(s)),[c(l+Math.atan2(Math.sin(s)*Math.sin(p)*Math.cos(a),Math.cos(p)-Math.sin(a)*Math.sin(f))),c(f)]));return y.push(y[0]),{type:"Polygon",coordinates:[y]}}(e.GeoJSON.latLngToCoords(t),o)}function f(t,o){return void 0===o&&(o={}),t instanceof e.Circle?p(t.getLatLng(),t.getRadius()):t instanceof e.CircleMarker?null!=o.zoom&&null!=o.crs?p(t.getLatLng(),function(t,o,n){var r=t.getLatLng(),i=o.latLngToPoint(r,n),s=t.getRadius()/Math.SQRT2,a=e.point([i.x-s,i.y-s]),l=o.pointToLatLng(a,n);return o.distance(r,l)}(t,o.crs,o.zoom)):(console.warn("Zoom and CRS is required for calculating CircleMarker polygon, falling back to center point only"),t.toGeoJSON().geometry):t instanceof e.Marker||t instanceof e.Polyline?t.toGeoJSON().geometry:void 0}function y(t,e,o){return void 0===o&&(o={}),e.filter((function(e){var n=f(e,o);return!!n&&(o.intersect?function(t,e){var o=new l.Primitive(t);return"Point"===e.type?o.contains(e):o.intersects(e)}(t,n):function(t,e){return new l.Primitive(t).contains(e)}(t,n))}))}function d(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}d(".leaflet-lasso-active {\n cursor: crosshair;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.leaflet-lasso-active .leaflet-interactive {\n cursor: crosshair;\n pointer-events: none;\n}");var g="leaflet-lasso-active",m=function(t){function o(o,n){void 0===n&&(n={});var r=t.call(this,o)||this;return r.options={polygon:{color:"#00C3FF",weight:2},intersect:!1},r.onDocumentMouseMoveBound=r.onDocumentMouseMove.bind(r),r.onDocumentMouseUpBound=r.onDocumentMouseUp.bind(r),r.map=o,e.Util.setOptions(r,n),r}return n(o,t),o.prototype.setOptions=function(t){this.options=r(r({},this.options),t)},o.prototype.toggle=function(){this.enabled()?this.disable():this.enable()},o.prototype.addHooks=function(){this.map.getPane("mapPane"),this.map.on("mousedown",this.onMapMouseDown,this),this.map.getContainer().classList.add(g),this.map.dragging.disable(),this.map.fire("lasso.enabled")},o.prototype.removeHooks=function(){this.polygon&&(this.map.removeLayer(this.polygon),this.polygon=void 0),this.map.off("mousedown",this.onMapMouseDown,this),document.removeEventListener("mousemove",this.onDocumentMouseMoveBound),document.removeEventListener("mouseup",this.onDocumentMouseUpBound),this.map.getContainer().classList.remove(g),document.body.classList.remove(g),this.map.dragging.enable(),this.map.fire("lasso.disabled")},o.prototype.getPolygon=function(){return this.polygon},o.prototype.onMapMouseDown=function(t){var e=t;1===e.originalEvent.buttons?e.originalEvent.target.closest(".leaflet-control-container")||(this.polygon=new s([e.latlng],this.options.polygon).addTo(this.map),document.body.classList.add(g),document.addEventListener("mousemove",this.onDocumentMouseMoveBound),document.addEventListener("mouseup",this.onDocumentMouseUpBound)):this.disable()},o.prototype.onDocumentMouseMove=function(t){if(this.polygon){var e=t;if(1!==e.buttons)return console.warn("mouseup event was missed"),void this.finish();this.polygon.addLatLng(this.map.mouseEventToLatLng(e))}},o.prototype.onDocumentMouseUp=function(){this.finish()},o.prototype.finish=function(){var t=this;if(this.polygon){var o=this.polygon.toGeoJSON().geometry,n=[];this.map.eachLayer((function(o){o!==t.polygon&&o!==t.polygon.polyline&&o!==t.polygon.polygon&&(o instanceof e.Marker||o instanceof e.Path?n.push(o):e.MarkerCluster&&o instanceof e.MarkerCluster&&n.push.apply(n,o.getAllChildMarkers()))}));var r=y(o,n,{zoom:this.map.getZoom(),crs:this.map.options.crs,intersect:this.options.intersect});this.map.fire("lasso.finished",{latLngs:this.polygon.getLatLngs(),layers:r}),this.disable()}},o}(e.Handler);d(".leaflet-control-lasso {\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsSAAALEgHS3X78AAAD6UlEQVR4nO1b7XHbMAwFfP0fdYKqE8QbRJ0gGUEjaAR3A4/gbuBOUHWCKhs4E1SegD06jzmYpWhJpiRKNu58Tix+AA8gCQIQK6Xolml109LfAbgDcAfg5gH4NPQEzJwSkf4kRLR2NKmJqNLfSqlqaH7+4y/0McjML0SUQdinHkO8ApCSiPZKqToogxYFAQBC50T03NDkN74raFzSGtahreSLo+9PALG7mlEXaQD6fMD0BgIp8TkQ0ZaINChpl7ExZoZxK2vcGr8nfXl2ztm5g1twI/Q6KHPvVlFg/DMgJgEAWpWCay3lIYX2zJ1bQFQhAO+i9b2l8VEEd/BSWEooBgUAm5REPvg67AGCrZDdIABgQ6qF1oOu8QBAbK4FwTd4bq23SbXeks/OIPg0f7V5TQRCpz3BNdhamH30wgu+CwFC66VqD5IIByRas/eAYDbGqi8AW+FszEp4ocC6y1KQneW6z+YmvJDDLIVDVwBKdNzPVXghi/FbLjprp4AIM2fi6loMcusal8zN8eXirOp885jNrn/BAlKxnL17GWPj+As8viqlDguwAG3V+hR7JKJvSqmyqd1KmMnrUoQHGaEzX6OVaLAfg6sRyUSeUt+UKxGobDSTmZKR5yIAj/h79IhsDPSRFxg6+ho9AAukpI1IgydGxiY4dSRON+/SXgwAyE1sHbkF79JmeEuaPs91H4DWf+Ffk1nSgDwQ0RH5iUbZqgXcAI0MG/FbKn7f+i5DZo14PabISR/lb0qpjWETXq252LmSsidaCYfh8s0pbnKZuFHuEzNvmNl5MiR9YmmRLYHaxb8VJ3SG+UzD3ZyvwyI/UEPozMoZFE2xTjOADId1yuhGBMLO0raSUSE74HsGgDoPiZULsIISPkFqtUlEuOx0YsiHadeIakTC57bGPW0zAVRiP+yVXJhY+M6JHLFcCtfDvUAoahCseoXW0Wz0Oy1310O5WUQLgmX2ZddEzkffhoc2CJMUQ3h4kzt+v7S4ke/CRKWYaBtBYURmF2tcMda7bC0absWEk5TG4ISyS3Suury1BqAB+XIMIDCv7eAEsUTvHtDQoak8bhPSexSlcXadYBlqHu8p0BMIZRVIti9QeD/Hc/S1hVawgKDuufQDriqVZeYcAjeVyL4BGBc1lcaSKY8dolaYmTXgf0ykKFStcCIKpM33Q8vuR1EcXeEuMkhoDnyWCKB81wGUQV+aEhFaJ/mSlgPwYvyHZ8QN9SlS38RbY3hnYQ/NHyH8KVq0+DdGdCgMS+sRe1ImX8xYvAUw8wGb7Q9c88/2l1sAIEPBlPM0ur85GgEPk9IdgAh4mJTuAETAw3RERP8Ab2Uzgrad13wAAAAASUVORK5CYII=');\n background-size: 22px;\n}");var v=function(t){function o(o){void 0===o&&(o={});var n=t.call(this)||this;return n.options={position:"topright"},e.Util.setOptions(n,o),n}return n(o,t),o.prototype.setOptions=function(t){this.options=r(r({},this.options),t),this.lasso&&this.lasso.setOptions(this.options)},o.prototype.onAdd=function(t){this.lasso=new m(t,this.options);var o=e.DomUtil.create("div","leaflet-bar leaflet-control"),n=e.DomUtil.create("a","leaflet-control-lasso",o);return n.href="#",n.title="Toggle Lasso",n.setAttribute("role","button"),n.setAttribute("aria-label",n.title),e.DomEvent.addListener(n,"click",this.toggle,this),o},o.prototype.enabled=function(){return!!this.lasso&&this.lasso.enabled()},o.prototype.enable=function(){this.lasso&&this.lasso.enable()},o.prototype.disable=function(){this.lasso&&this.lasso.disable()},o.prototype.toggle=function(){this.lasso&&this.lasso.toggle()},o}(e.Control);e.Lasso=m,e.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(m.bind.apply(m,i([void 0],t)))},e.Control.Lasso=v,e.control.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(v.bind.apply(v,i([void 0],t)))},t.ACTIVE_CLASS=g,t.DISABLED_EVENT="lasso.disabled",t.ENABLED_EVENT="lasso.enabled",t.FINISHED_EVENT="lasso.finished",t.LassoControl=v,t.LassoHandler=m,Object.defineProperty(t,"__esModule",{value:!0})}));
var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)};function n(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r=function(){return(r=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function i(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;var n=Array(t),r=0;for(e=0;e<o;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,r++)n[r]=i[s];return n}var s=function(t){function o(o,n){var i=t.call(this)||this;return i.polyline=e.polyline(o,n),i.polygon=e.polygon(o,r(r({},n),{weight:0})),i}return n(o,t),o.prototype.onAdd=function(t){return this.polyline.addTo(t),this.polygon.addTo(t),this},o.prototype.onRemove=function(){return this.polyline.remove(),this.polygon.remove(),this},o.prototype.addLatLng=function(t){return this.polyline.addLatLng(t),this.polygon.addLatLng(t),this},o.prototype.getLatLngs=function(){return this.polygon.getLatLngs()[0]},o.prototype.toGeoJSON=function(){return this.polygon.toGeoJSON()},o}(e.Layer),a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var l=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){var o,n;o=a,n=function(){var t={},e={type:"link",properties:{href:"http://spatialreference.org/ref/sr-org/6928/ogcwkt/",type:"ogcwkt"}};function o(t){return"[object Array]"===Object.prototype.toString.call(t)}function n(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t}function r(t){if(t.type)switch(t.type){case"Point":return[t.coordinates[0],t.coordinates[1],t.coordinates[0],t.coordinates[1]];case"MultiPoint":case"LineString":return s(t.coordinates);case"MultiLineString":case"Polygon":return i(t.coordinates);case"MultiPolygon":return function(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++)for(var l=s[a],u=0;u<l.length;u++){var c=l[u],h=c[0],p=c[1];(null===e||h<e)&&(e=h),(null===o||h>o)&&(o=h),(null===n||p<n)&&(n=p),(null===r||p>r)&&(r=p)}return[e,n,o,r]}(t.coordinates);case"Feature":return t.geometry?r(t.geometry):null;case"FeatureCollection":return function(t){for(var e,o=[],n=t.features.length-1;n>=0;n--)e=r(t.features[n].geometry),o.push([e[0],e[1]]),o.push([e[2],e[3]]);return s(o)}(t);case"GeometryCollection":return function(t){for(var e,o=[],n=t.geometries.length-1;n>=0;n--)e=r(t.geometries[n]),o.push([e[0],e[1]]),o.push([e[2],e[3]]);return s(o)}(t);default:throw new Error("Unknown type: "+t.type)}return null}function i(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++)for(var s=t[i],a=0;a<s.length;a++){var l=s[a],u=l[0],c=l[1];(null===e||u<e)&&(e=u),(null===o||u>o)&&(o=u),(null===n||c<n)&&(n=c),(null===r||c>r)&&(r=c)}return[e,n,o,r]}function s(t){for(var e=null,o=null,n=null,r=null,i=0;i<t.length;i++){var s=t[i],a=s[0],l=s[1];(null===e||a<e)&&(e=a),(null===o||a>o)&&(o=a),(null===n||l<n)&&(n=l),(null===r||l>r)&&(r=l)}return[e,n,o,r]}function a(t){var e=r(t);return{x:e[0],y:e[1],w:Math.abs(e[0]-e[2]),h:Math.abs(e[1]-e[3])}}function l(t){return 57.29577951308232*t}function u(t){return.017453292519943*t}function c(t){var e=t[0],o=t[1];return[l(e/6378137)-360*Math.floor((l(e/6378137)+180)/360),l(Math.PI/2-2*Math.atan(Math.exp(-1*o/6378137)))]}function h(t){var e=t[0],o=Math.max(Math.min(t[1],89.99999),-89.99999);return[6378137*u(e),3189068.5*Math.log((1+Math.sin(u(o)))/(1-Math.sin(u(o))))]}function p(t,o,n){if("Point"===t.type)t.coordinates=o(t.coordinates);else if("Feature"===t.type)t.geometry=p(t.geometry,o,!0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)t.features[r]=p(t.features[r],o,!0);else if("GeometryCollection"===t.type)for(var i=0;i<t.geometries.length;i++)t.geometries[i]=p(t.geometries[i],o,!0);else t.coordinates=function t(e,o){for(var n=0;n<e.length;n++)"number"==typeof e[n][0]&&(e[n]=o(e[n])),"object"==typeof e[n]&&(e[n]=t(e[n],o));return e}(t.coordinates,o);return n||o===h&&(t.crs=e),o===c&&delete t.crs,t}function f(t){return p(t,h)}function y(t){return p(t,c)}function d(t,e){return t[0]>e[0]?-1:t[0]<e[0]?1:t[1]>e[1]?-1:t[1]<e[1]?1:0}function g(t,e,o){return(n=(e[0]-t[0])*(o[1]-t[1])-(o[0]-t[0])*(e[1]-t[1]))<(r=0)?-1:n>r?1:0;var n,r}function v(t,e){var o=e[0]-t[0],n=e[1]-t[1];return o*o+n*n}function m(t,e){var o=e;for(var n in t){var r=g(e,o,t[n]);(-1===r||0===r&&v(e,t[n])>v(e,o))&&(o=t[n])}return o}function w(t){if(0===t.length)return[];if(1===t.length)return t;for(var e=[t.sort(d)[0]],o=0;o<e.length;o++){var n=m(t,e[o]);n!==e[0]&&e.push(n)}return e}function M(t,e){for(var o=!1,n=-1,r=t.length,i=r-1;++n<r;i=n)(t[n][1]<=e[1]&&e[1]<t[i][1]||t[i][1]<=e[1]&&e[1]<t[n][1])&&e[0]<(t[i][0]-t[n][0])*(e[1]-t[n][1])/(t[i][1]-t[n][1])+t[n][0]&&(o=!o);return o}function b(t,e){if(t&&t.length){if(1===t.length)return M(t[0],e);if(M(t[0],e)){for(var o=1;o<t.length;o++)if(M(t[o],e))return!1;return!0}return!1}return!1}function P(t,e,o,n){var r=(n[0]-o[0])*(t[1]-o[1])-(n[1]-o[1])*(t[0]-o[0]),i=(e[0]-t[0])*(t[1]-o[1])-(e[1]-t[1])*(t[0]-o[0]),s=(n[1]-o[1])*(e[0]-t[0])-(n[0]-o[0])*(e[1]-t[1]);if(0!==s){var a=r/s,l=i/s;if(0<=a&&a<=1&&0<=l&&l<=1)return!0}return!1}function L(t){return!isNaN(parseFloat(t))&&isFinite(t)}function A(t,e){if(L(t[0][0])){if(L(e[0][0])){for(var o=0;o<t.length-1;o++)for(var n=0;n<e.length-1;n++)if(P(t[o],t[o+1],e[n],e[n+1]))return!0}else for(var r=0;r<e.length;r++)if(A(t,e[r]))return!0}else for(var i=0;i<t.length;i++)if(A(t[i],e))return!0;return!1}function E(t){for(var e=[],o=0;o<t.length;o++){var n=t[o].slice();!1===S(n[0],n[n.length-1])&&n.push(n[0]),e.push(n)}return e}function S(t,e){for(var o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}function T(t,e){if(t.length!==e.length)return!1;for(var o=t.slice().sort(d),n=e.slice().sort(d),r=0;r<o.length;r++){if(o[r].length!==n[r].length)return!1;for(var i=0;i<o.length;i++)if(o[r][i]!==n[r][i])return!1}return!0}var C=["length"];function R(t){if(t)switch(t.type){case"Point":return new O(t);case"MultiPoint":return new D(t);case"LineString":return new F(t);case"MultiLineString":return new I(t);case"Polygon":return new x(t);case"MultiPolygon":return new G(t);case"Feature":return new k(t);case"FeatureCollection":return new N(t);case"GeometryCollection":return new U(t);default:throw new Error("Unknown type: "+t.type)}}function O(t){var e=Array.prototype.slice.call(arguments);if(t&&"Point"===t.type&&t.coordinates)n(this,t);else if(t&&o(t))this.coordinates=t;else{if(!(e.length>=2))throw"Terraformer: invalid input for Terraformer.Point";this.coordinates=e}this.type="Point"}function D(t){if(t&&"MultiPoint"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.MultiPoint";this.coordinates=t}this.type="MultiPoint"}function F(t){if(t&&"LineString"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.LineString";this.coordinates=t}this.type="LineString"}function I(t){if(t&&"MultiLineString"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.MultiLineString";this.coordinates=t}this.type="MultiLineString"}function x(t){if(t&&"Polygon"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.Polygon";this.coordinates=t}this.type="Polygon"}function G(t){if(t&&"MultiPolygon"===t.type&&t.coordinates)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.MultiPolygon";this.coordinates=t}this.type="MultiPolygon"}function k(t){if(t&&"Feature"===t.type)n(this,t);else{if(!(t&&t.type&&t.coordinates))throw"Terraformer: invalid input for Terraformer.Feature";this.geometry=t}this.type="Feature"}function N(t){if(t&&"FeatureCollection"===t.type&&t.features)n(this,t);else{if(!o(t))throw"Terraformer: invalid input for Terraformer.FeatureCollection";this.features=t}this.type="FeatureCollection"}function U(t){if(t&&"GeometryCollection"===t.type&&t.geometries)n(this,t);else if(o(t))this.geometries=t;else{if(!t.coordinates||!t.type)throw"Terraformer: invalid input for Terraformer.GeometryCollection";this.type="GeometryCollection",this.geometries=[t]}this.type="GeometryCollection"}function B(t,e,o){for(var n=h(t),r=o||64,i={type:"Polygon",coordinates:[[]]},s=1;s<=r;s++){var a=s*(360/r)*Math.PI/180;i.coordinates[0].push([n[0]+e*Math.cos(a),n[1]+e*Math.sin(a)])}return i.coordinates=E(i.coordinates),y(i)}function H(t,e,o){var r=o||64,i=e||250;if(!t||t.length<2||!i||!r)throw new Error("Terraformer: missing parameter for Terraformer.Circle");n(this,new k({type:"Feature",geometry:B(t,i,r),properties:{radius:i,center:t,steps:r}}))}return R.prototype.toMercator=function(){return f(this)},R.prototype.toGeographic=function(){return y(this)},R.prototype.envelope=function(){return a(this)},R.prototype.bbox=function(){return r(this)},R.prototype.convexHull=function(){var t,e,o=[];if("Point"===this.type)return null;if("LineString"===this.type||"MultiPoint"===this.type){if(!(this.coordinates&&this.coordinates.length>=3))return null;o=this.coordinates}else if("Polygon"===this.type||"MultiLineString"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return null;for(t=0;t<this.coordinates.length;t++)o=o.concat(this.coordinates[t]);if(o.length<3)return null}else if("MultiPolygon"===this.type){if(!(this.coordinates&&this.coordinates.length>0))return null;for(t=0;t<this.coordinates.length;t++)for(e=0;e<this.coordinates[t].length;e++)o=o.concat(this.coordinates[t][e]);if(o.length<3)return null}else if("Feature"===this.type)return new R(this.geometry).convexHull();return new x({type:"Polygon",coordinates:E([w(o)])})},R.prototype.toJSON=function(){var t={};for(var e in this)this.hasOwnProperty(e)&&-1===C.indexOf(e)&&(t[e]=this[e]);return t.bbox=r(this),t},R.prototype.contains=function(t){return new R(t).within(this)},R.prototype.within=function(t){var e,o,n;if("Feature"===t.type&&(t=t.geometry),"Point"===t.type&&"Point"===this.type)return S(this.coordinates,t.coordinates);if("MultiLineString"===t.type&&"Point"===this.type)for(e=0;e<t.coordinates.length;e++){var r={type:"LineString",coordinates:t.coordinates[e]};if(this.within(r))return!0}if(("LineString"===t.type||"MultiPoint"===t.type)&&"Point"===this.type)for(e=0;e<t.coordinates.length;e++){if(this.coordinates.length!==t.coordinates[e].length)return!1;if(S(this.coordinates,t.coordinates[e]))return!0}if("Polygon"===t.type){if("Polygon"===this.type){if(t.coordinates.length===this.coordinates.length)for(e=0;e<this.coordinates.length;e++)if(T(this.coordinates[e],t.coordinates[e]))return!0;return!(!this.coordinates.length||!b(t.coordinates,this.coordinates[0][0])||A(E(this.coordinates),E(t.coordinates)))}if("Point"===this.type)return b(t.coordinates,this.coordinates);if("LineString"===this.type||"MultiPoint"===this.type){if(!this.coordinates||0===this.coordinates.length)return!1;for(e=0;e<this.coordinates.length;e++)if(!1===b(t.coordinates,this.coordinates[e]))return!1;return!0}if("MultiLineString"===this.type){for(e=0;e<this.coordinates.length;e++)if(!1===new F(this.coordinates[e]).within(t))return n++,!1;return!0}if("MultiPolygon"===this.type){for(e=0;e<this.coordinates.length;e++)if(!1===new R({type:"Polygon",coordinates:this.coordinates[e]}).within(t))return!1;return!0}}if("MultiPolygon"===t.type){if("Point"===this.type){if(t.coordinates.length)for(e=0;e<t.coordinates.length;e++)if(b(t.coordinates[e],this.coordinates)&&!1===A([this.coordinates],t.coordinates))return!0;return!1}if("Polygon"===this.type){for(e=0;e<this.coordinates.length;e++)if(t.coordinates[e].length===this.coordinates.length)for(o=0;o<this.coordinates.length;o++)if(T(this.coordinates[o],t.coordinates[e][o]))return!0;if(!1===A(this.coordinates,t.coordinates)&&t.coordinates.length){for(e=0;e<t.coordinates.length;e++)n=!1!==b(t.coordinates[e],this.coordinates[0][0]);return n}}else if("LineString"===this.type||"MultiPoint"===this.type)for(e=0;e<t.coordinates.length;e++){var i={type:"Polygon",coordinates:t.coordinates[e]};return!!this.within(i)}else{if("MultiLineString"===this.type){for(e=0;e<this.coordinates.length;e++)if(!1===new F(this.coordinates[e]).within(t))return!1;return!0}if("MultiPolygon"===this.type){for(e=0;e<t.coordinates.length;e++){var s={type:"Polygon",coordinates:t.coordinates[e]};if(!1===this.within(s))return!1}return!0}}}return!1},R.prototype.intersects=function(t){"Feature"===t.type&&(t=t.geometry);var e=new R(t);return!(!this.within(t)&&!e.within(this))||("Point"!==this.type&&"MultiPoint"!==this.type&&"Point"!==t.type&&"MultiPoint"!==t.type?A(this.coordinates,t.coordinates):"Feature"===this.type?new R(this.geometry).intersects(t):(function(){var t=Array.prototype.slice.apply(arguments);void 0!==typeof console&&console.warn&&console.warn.apply(console,t)}("Type "+this.type+" to "+t.type+" intersection is not supported by intersects"),!1))},O.prototype=new R,O.prototype.constructor=O,D.prototype=new R,D.prototype.constructor=D,D.prototype.forEach=function(t){for(var e=0;e<this.coordinates.length;e++)t.apply(this,[this.coordinates[e],e,this.coordinates]);return this},D.prototype.addPoint=function(t){return this.coordinates.push(t),this},D.prototype.insertPoint=function(t,e){return this.coordinates.splice(e,0,t),this},D.prototype.removePoint=function(t){return"number"==typeof t?this.coordinates.splice(t,1):this.coordinates.splice(this.coordinates.indexOf(t),1),this},D.prototype.get=function(t){return new O(this.coordinates[t])},F.prototype=new R,F.prototype.constructor=F,F.prototype.addVertex=function(t){return this.coordinates.push(t),this},F.prototype.insertVertex=function(t,e){return this.coordinates.splice(e,0,t),this},F.prototype.removeVertex=function(t){return this.coordinates.splice(t,1),this},I.prototype=new R,I.prototype.constructor=I,I.prototype.forEach=function(t){for(var e=0;e<this.coordinates.length;e++)t.apply(this,[this.coordinates[e],e,this.coordinates])},I.prototype.get=function(t){return new F(this.coordinates[t])},x.prototype=new R,x.prototype.constructor=x,x.prototype.addVertex=function(t){return this.insertVertex(t,this.coordinates[0].length-1),this},x.prototype.insertVertex=function(t,e){return this.coordinates[0].splice(e,0,t),this},x.prototype.removeVertex=function(t){return this.coordinates[0].splice(t,1),this},x.prototype.close=function(){this.coordinates=E(this.coordinates)},x.prototype.hasHoles=function(){return this.coordinates.length>1},x.prototype.holes=function(){var t=[];if(this.hasHoles())for(var e=1;e<this.coordinates.length;e++)t.push(new x([this.coordinates[e]]));return t},G.prototype=new R,G.prototype.constructor=G,G.prototype.forEach=function(t){for(var e=0;e<this.coordinates.length;e++)t.apply(this,[this.coordinates[e],e,this.coordinates])},G.prototype.get=function(t){return new x(this.coordinates[t])},G.prototype.close=function(){var t=[];return this.forEach((function(e){t.push(E(e))})),this.coordinates=t,this},k.prototype=new R,k.prototype.constructor=k,N.prototype=new R,N.prototype.constructor=N,N.prototype.forEach=function(t){for(var e=0;e<this.features.length;e++)t.apply(this,[this.features[e],e,this.features])},N.prototype.get=function(t){var e;return this.forEach((function(o){o.id===t&&(e=o)})),new k(e)},U.prototype=new R,U.prototype.constructor=U,U.prototype.forEach=function(t){for(var e=0;e<this.geometries.length;e++)t.apply(this,[this.geometries[e],e,this.geometries])},U.prototype.get=function(t){return new R(this.geometries[t])},H.prototype=new R,H.prototype.constructor=H,H.prototype.recalculate=function(){return this.geometry=B(this.properties.center,this.properties.radius,this.properties.steps),this},H.prototype.center=function(t){return t&&(this.properties.center=t,this.recalculate()),this.properties.center},H.prototype.radius=function(t){return t&&(this.properties.radius=t,this.recalculate()),this.properties.radius},H.prototype.steps=function(t){return t&&(this.properties.steps=t,this.recalculate()),this.properties.steps},H.prototype.toJSON=function(){return R.prototype.toJSON.call(this)},t.Primitive=R,t.Point=O,t.MultiPoint=D,t.LineString=F,t.MultiLineString=I,t.Polygon=x,t.MultiPolygon=G,t.Feature=k,t.FeatureCollection=N,t.GeometryCollection=U,t.Circle=H,t.toMercator=f,t.toGeographic=y,t.Tools={},t.Tools.positionToMercator=h,t.Tools.positionToGeographic=c,t.Tools.applyConverter=p,t.Tools.toMercator=f,t.Tools.toGeographic=y,t.Tools.createCircle=B,t.Tools.calculateBounds=r,t.Tools.calculateEnvelope=a,t.Tools.coordinatesContainPoint=M,t.Tools.polygonContainsPoint=b,t.Tools.arraysIntersectArrays=A,t.Tools.coordinatesContainPoint=M,t.Tools.coordinatesEqual=T,t.Tools.convexHull=w,t.Tools.isConvex=function(t){for(var e,o=0;o<t.length-3;o++){var n=t[o],r=t[o+1],i=t[o+2],s=[r[0]-n[0],r[1]-n[1]],a=i[0]*s[1]-i[1]*s[0]+s[0]*n[1]-s[1]*n[0];if(0===o)e=a<0;else if(e&&a>0||!e&&a<0)return!1}return!0},t.MercatorCRS=e,t.GeographicCRS={type:"link",properties:{href:"http://spatialreference.org/ref/epsg/4326/ogcwkt/",type:"ogcwkt"}},t},t.exports=n(),"object"==typeof window&&(o.Terraformer=n())}));function u(t){return t*Math.PI/180}function c(t){return 180*t/Math.PI}function h({center:t,radius:e,numberOfSegments:o}){!function(t){if(!Array.isArray(t)||![2,3].includes(t.length))throw new Error("ERROR! Center has to be an array of length two or three");const[e,o]=t;if("number"!=typeof e||"number"!=typeof o)throw new Error(`ERROR! Longitude and Latitude has to be numbers but where ${typeof e} and ${typeof o}`);if(e>180||e<-180)throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${e}`);if(o>90||o<-90)throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${o}`)}(t),function(t){if("number"!=typeof t)throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof t}`);if(t<=0)throw new Error(`ERROR! Radius has to be a positive number but was: ${t}`)}(e),function(t){if("number"!=typeof t&&void 0!==t)throw new Error(`ERROR! Number of segments has to be a number but was: ${typeof t}`);if(t<3)throw new Error(`ERROR! Number of segments has to be at least 3 but was: ${t}`)}(o)}function p(t,o){return function(t,e,o){var n=o||32;h({center:t,radius:e,numberOfSegments:o});for(var r,i,s,a,l,p,f,y=[],d=0;d<n;++d)y.push((r=t,i=e,s=2*Math.PI*-d/n,a=void 0,l=void 0,p=void 0,f=void 0,a=u(r[1]),l=u(r[0]),p=i/6378137,f=Math.asin(Math.sin(a)*Math.cos(p)+Math.cos(a)*Math.sin(p)*Math.cos(s)),[c(l+Math.atan2(Math.sin(s)*Math.sin(p)*Math.cos(a),Math.cos(p)-Math.sin(a)*Math.sin(f))),c(f)]));return y.push(y[0]),{type:"Polygon",coordinates:[y]}}(e.GeoJSON.latLngToCoords(t),o)}function f(t,o){return void 0===o&&(o={}),t instanceof e.Circle?p(t.getLatLng(),t.getRadius()):t instanceof e.CircleMarker?null!=o.zoom&&null!=o.crs?p(t.getLatLng(),function(t,o,n){var r=t.getLatLng(),i=o.latLngToPoint(r,n),s=t.getRadius()/Math.SQRT2,a=e.point([i.x-s,i.y-s]),l=o.pointToLatLng(a,n);return o.distance(r,l)}(t,o.crs,o.zoom)):(console.warn("Zoom and CRS is required for calculating CircleMarker polygon, falling back to center point only"),t.toGeoJSON().geometry):t instanceof e.Marker||t instanceof e.Polyline?t.toGeoJSON().geometry:void 0}function y(t,e,o){return void 0===o&&(o={}),e.filter((function(e){var n=f(e,o);return!!n&&(o.intersect?function(t,e){var o=new l.Primitive(t);return"Point"===e.type?o.contains(e):o.intersects(e)}(t,n):function(t,e){return new l.Primitive(t).contains(e)}(t,n))}))}function d(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}d(".leaflet-lasso-active {\n cursor: crosshair;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.leaflet-lasso-active .leaflet-interactive {\n cursor: crosshair;\n pointer-events: none;\n}");var g="leaflet-lasso-active",v=function(t){function o(o,n){void 0===n&&(n={});var r=t.call(this,o)||this;return r.options={polygon:{color:"#00C3FF",weight:2},intersect:!1},r.onDocumentMouseMoveBound=r.onDocumentMouseMove.bind(r),r.onDocumentMouseUpBound=r.onDocumentMouseUp.bind(r),r.map=o,e.Util.setOptions(r,n),r}return n(o,t),o.prototype.setOptions=function(t){this.options=r(r({},this.options),t)},o.prototype.toggle=function(){this.enabled()?this.disable():this.enable()},o.prototype.addHooks=function(){this.map.getPane("mapPane"),this.map.on("mousedown",this.onMapMouseDown,this),this.map.getContainer().classList.add(g),this.map.dragging.disable(),this.map.fire("lasso.enabled")},o.prototype.removeHooks=function(){this.polygon&&(this.map.removeLayer(this.polygon),this.polygon=void 0),this.map.off("mousedown",this.onMapMouseDown,this),document.removeEventListener("mousemove",this.onDocumentMouseMoveBound),document.removeEventListener("mouseup",this.onDocumentMouseUpBound),this.map.getContainer().classList.remove(g),document.body.classList.remove(g),this.map.dragging.enable(),this.map.fire("lasso.disabled")},o.prototype.getPolygon=function(){return this.polygon},o.prototype.onMapMouseDown=function(t){var e=t;1===e.originalEvent.buttons?e.originalEvent.target.closest(".leaflet-control-container")||(this.polygon=new s([e.latlng],this.options.polygon).addTo(this.map),document.body.classList.add(g),document.addEventListener("mousemove",this.onDocumentMouseMoveBound),document.addEventListener("mouseup",this.onDocumentMouseUpBound)):this.disable()},o.prototype.onDocumentMouseMove=function(t){if(this.polygon){var e=t;if(1!==e.buttons)return console.warn("mouseup event was missed"),void this.finish();this.polygon.addLatLng(this.map.mouseEventToLatLng(e))}},o.prototype.onDocumentMouseUp=function(){this.finish()},o.prototype.finish=function(){var t=this;if(this.polygon){var o=this.polygon.toGeoJSON().geometry,n=[];this.map.eachLayer((function(o){o!==t.polygon&&o!==t.polygon.polyline&&o!==t.polygon.polygon&&(o instanceof e.Marker||o instanceof e.Path?n.push(o):e.MarkerCluster&&o instanceof e.MarkerCluster&&n.push.apply(n,o.getAllChildMarkers()))}));var r=y(o,n,{zoom:this.map.getZoom(),crs:this.map.options.crs,intersect:this.options.intersect});this.map.fire("lasso.finished",{latLngs:this.polygon.getLatLngs(),layers:r}),this.disable()}},o}(e.Handler);d(".leaflet-control-lasso {\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsSAAALEgHS3X78AAAD6UlEQVR4nO1b7XHbMAwFfP0fdYKqE8QbRJ0gGUEjaAR3A4/gbuBOUHWCKhs4E1SegD06jzmYpWhJpiRKNu58Tix+AA8gCQIQK6Xolml109LfAbgDcAfg5gH4NPQEzJwSkf4kRLR2NKmJqNLfSqlqaH7+4y/0McjML0SUQdinHkO8ApCSiPZKqToogxYFAQBC50T03NDkN74raFzSGtahreSLo+9PALG7mlEXaQD6fMD0BgIp8TkQ0ZaINChpl7ExZoZxK2vcGr8nfXl2ztm5g1twI/Q6KHPvVlFg/DMgJgEAWpWCay3lIYX2zJ1bQFQhAO+i9b2l8VEEd/BSWEooBgUAm5REPvg67AGCrZDdIABgQ6qF1oOu8QBAbK4FwTd4bq23SbXeks/OIPg0f7V5TQRCpz3BNdhamH30wgu+CwFC66VqD5IIByRas/eAYDbGqi8AW+FszEp4ocC6y1KQneW6z+YmvJDDLIVDVwBKdNzPVXghi/FbLjprp4AIM2fi6loMcusal8zN8eXirOp885jNrn/BAlKxnL17GWPj+As8viqlDguwAG3V+hR7JKJvSqmyqd1KmMnrUoQHGaEzX6OVaLAfg6sRyUSeUt+UKxGobDSTmZKR5yIAj/h79IhsDPSRFxg6+ho9AAukpI1IgydGxiY4dSRON+/SXgwAyE1sHbkF79JmeEuaPs91H4DWf+Ffk1nSgDwQ0RH5iUbZqgXcAI0MG/FbKn7f+i5DZo14PabISR/lb0qpjWETXq252LmSsidaCYfh8s0pbnKZuFHuEzNvmNl5MiR9YmmRLYHaxb8VJ3SG+UzD3ZyvwyI/UEPozMoZFE2xTjOADId1yuhGBMLO0raSUSE74HsGgDoPiZULsIISPkFqtUlEuOx0YsiHadeIakTC57bGPW0zAVRiP+yVXJhY+M6JHLFcCtfDvUAoahCseoXW0Wz0Oy1310O5WUQLgmX2ZddEzkffhoc2CJMUQ3h4kzt+v7S4ke/CRKWYaBtBYURmF2tcMda7bC0absWEk5TG4ISyS3Suury1BqAB+XIMIDCv7eAEsUTvHtDQoak8bhPSexSlcXadYBlqHu8p0BMIZRVIti9QeD/Hc/S1hVawgKDuufQDriqVZeYcAjeVyL4BGBc1lcaSKY8dolaYmTXgf0ykKFStcCIKpM33Q8vuR1EcXeEuMkhoDnyWCKB81wGUQV+aEhFaJ/mSlgPwYvyHZ8QN9SlS38RbY3hnYQ/NHyH8KVq0+DdGdCgMS+sRe1ImX8xYvAUw8wGb7Q9c88/2l1sAIEPBlPM0ur85GgEPk9IdgAh4mJTuAETAw3RERP8Ab2Uzgrad13wAAAAASUVORK5CYII=');\n background-size: 22px;\n}");var m=function(t){function o(o){void 0===o&&(o={});var n=t.call(this)||this;return n.options={position:"topright"},e.Util.setOptions(n,o),n}return n(o,t),o.prototype.setOptions=function(t){this.options=r(r({},this.options),t),this.lasso&&this.lasso.setOptions(this.options)},o.prototype.onAdd=function(t){this.lasso=new v(t,this.options);var o=e.DomUtil.create("div","leaflet-bar leaflet-control"),n=e.DomUtil.create("a","leaflet-control-lasso",o);return n.href="#",n.title="Toggle Lasso",n.setAttribute("role","button"),n.setAttribute("aria-label",n.title),e.DomEvent.addListener(n,"click",this.toggle,this),o},o.prototype.enabled=function(){return!!this.lasso&&this.lasso.enabled()},o.prototype.enable=function(){this.lasso&&this.lasso.enable()},o.prototype.disable=function(){this.lasso&&this.lasso.disable()},o.prototype.toggle=function(){this.lasso&&this.lasso.toggle()},o}(e.Control);e.Lasso=v,e.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(v.bind.apply(v,i([void 0],t)))},e.Control.Lasso=m,e.control.lasso=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(m.bind.apply(m,i([void 0],t)))},t.ACTIVE_CLASS=g,t.DISABLED_EVENT="lasso.disabled",t.ENABLED_EVENT="lasso.enabled",t.FINISHED_EVENT="lasso.finished",t.LassoControl=m,t.LassoHandler=v,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=leaflet-lasso.umd.min.js.map
{
"name": "leaflet-lasso",
"version": "2.0.7",
"version": "2.0.8",
"description": "Leaflet plugin for lasso selection",

@@ -23,6 +23,6 @@ "keywords": [

"@rollup/plugin-node-resolve": "^7.1.1",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/leaflet": "^1.5.12",
"@types/leaflet.markercluster": "^1.4.2",
"autoprefixer": "^9.7.5",
"autoprefixer": "^9.7.6",
"identity-obj-proxy": "^3.0.0",

@@ -34,8 +34,8 @@ "jest": "^25.2.7",

"postcss-assets": "^5.0.0",
"rollup": "^2.3.2",
"rollup": "^2.3.3",
"rollup-plugin-postcss": "^2.5.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript2": "^0.27.0",
"rollup-plugin-visualizer": "^4.0.2",
"ts-jest": "^25.3.0",
"rollup-plugin-visualizer": "^4.0.3",
"ts-jest": "^25.3.1",
"typescript": "^3.8.3"

@@ -48,4 +48,4 @@ },

"circle-to-polygon": "^2.0.1",
"terraformer": "^1.0.10"
"terraformer": "^1.0.12"
}
}

@@ -35,3 +35,3 @@ # leaflet-lasso

```
<script src="https://unpkg.com/leaflet-lasso@2.0.7/dist/leaflet-lasso.umd.min.js"></script>
<script src="https://unpkg.com/leaflet-lasso@2.0.8/dist/leaflet-lasso.umd.min.js"></script>
```

@@ -38,0 +38,0 @@

@@ -43,6 +43,8 @@ import L from 'leaflet';

const polygon = (latLng => L.polygon([
[latLng[0] - latSmallDelta, latLng[1] - lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1] - lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1] + lngSmallDelta],
[latLng[0] - latSmallDelta, latLng[1] + lngSmallDelta],
[
[latLng[0] - latSmallDelta, latLng[1] - lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1] - lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1] + lngSmallDelta],
[latLng[0] - latSmallDelta, latLng[1] + lngSmallDelta],
],
]))([startLatLng[0], startLatLng[1] + lngDelta * 4]);

@@ -65,12 +67,16 @@ const holedPolygon = (latLng => L.polygon([

[
[latLng[0] - latSmallDelta, latLng[1] - lngSmallDelta],
[latLng[0] - latSmallDelta, latLng[1]],
[latLng[0], latLng[1]],
[latLng[0], latLng[1] - lngSmallDelta],
[
[latLng[0] - latSmallDelta, latLng[1] - lngSmallDelta],
[latLng[0] - latSmallDelta, latLng[1]],
[latLng[0], latLng[1]],
[latLng[0], latLng[1] - lngSmallDelta],
],
],
[
[latLng[0], latLng[1]],
[latLng[0], latLng[1] + lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1] + lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1]],
[
[latLng[0], latLng[1]],
[latLng[0], latLng[1] + lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1] + lngSmallDelta],
[latLng[0] + latSmallDelta, latLng[1]],
],
],

@@ -77,0 +83,0 @@ ]))([startLatLng[0], startLatLng[1] + lngDelta * 6]);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc