@mapgis/mapbox-gl-draw 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mapbox-gl-draw.css +88 -0
- package/dist/mapbox-gl-draw.js +2 -0
- package/package.json +8 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
/* Override default control style */
|
|
3
|
+
.mapbox-gl-draw_ctrl-bottom-left,
|
|
4
|
+
.mapbox-gl-draw_ctrl-top-left {
|
|
5
|
+
margin-left:0;
|
|
6
|
+
border-radius:0 4px 4px 0;
|
|
7
|
+
}
|
|
8
|
+
.mapbox-gl-draw_ctrl-top-right,
|
|
9
|
+
.mapbox-gl-draw_ctrl-bottom-right {
|
|
10
|
+
margin-right:0;
|
|
11
|
+
border-radius:4px 0 0 4px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.mapbox-gl-draw_ctrl-draw-btn {
|
|
15
|
+
border-color:rgba(0,0,0,0.9);
|
|
16
|
+
color:rgba(255,255,255,0.5);
|
|
17
|
+
width:30px;
|
|
18
|
+
height:30px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.mapbox-gl-draw_ctrl-draw-btn.active,
|
|
22
|
+
.mapbox-gl-draw_ctrl-draw-btn.active:hover {
|
|
23
|
+
background-color:rgb(0 0 0/5%);
|
|
24
|
+
}
|
|
25
|
+
.mapbox-gl-draw_ctrl-draw-btn {
|
|
26
|
+
background-repeat: no-repeat;
|
|
27
|
+
background-position: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.mapbox-gl-draw_point {
|
|
31
|
+
background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m10 2c-3.3 0-6 2.7-6 6s6 9 6 9 6-5.7 6-9-2.7-6-6-6zm0 2c2.1 0 3.8 1.7 3.8 3.8 0 1.5-1.8 3.9-2.9 5.2h-1.7c-1.1-1.4-2.9-3.8-2.9-5.2-.1-2.1 1.6-3.8 3.7-3.8z"/>%3C/svg>');
|
|
32
|
+
}
|
|
33
|
+
.mapbox-gl-draw_polygon {
|
|
34
|
+
background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m15 12.3v-4.6c.6-.3 1-1 1-1.7 0-1.1-.9-2-2-2-.7 0-1.4.4-1.7 1h-4.6c-.3-.6-1-1-1.7-1-1.1 0-2 .9-2 2 0 .7.4 1.4 1 1.7v4.6c-.6.3-1 1-1 1.7 0 1.1.9 2 2 2 .7 0 1.4-.4 1.7-1h4.6c.3.6 1 1 1.7 1 1.1 0 2-.9 2-2 0-.7-.4-1.4-1-1.7zm-8-.3v-4l1-1h4l1 1v4l-1 1h-4z"/>%3C/svg>');
|
|
35
|
+
}
|
|
36
|
+
.mapbox-gl-draw_line {
|
|
37
|
+
background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m13.5 3.5c-1.4 0-2.5 1.1-2.5 2.5 0 .3 0 .6.2.9l-3.8 3.8c-.3-.1-.6-.2-.9-.2-1.4 0-2.5 1.1-2.5 2.5s1.1 2.5 2.5 2.5 2.5-1.1 2.5-2.5c0-.3 0-.6-.2-.9l3.8-3.8c.3.1.6.2.9.2 1.4 0 2.5-1.1 2.5-2.5s-1.1-2.5-2.5-2.5z"/>%3C/svg>');
|
|
38
|
+
}
|
|
39
|
+
.mapbox-gl-draw_trash {
|
|
40
|
+
background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M10,3.4 c-0.8,0-1.5,0.5-1.8,1.2H5l-1,1v1h12v-1l-1-1h-3.2C11.5,3.9,10.8,3.4,10,3.4z M5,8v7c0,1,1,2,2,2h6c1,0,2-1,2-2V8h-2v5.5h-1.5V8h-3 v5.5H7V8H5z"/>%3C/svg>');
|
|
41
|
+
}
|
|
42
|
+
.mapbox-gl-draw_uncombine {
|
|
43
|
+
background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m12 2c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm4 4c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm-7 1c-1 0-1 1-.5 1.5.3.3 1 1 1 1l-1 1s-.5.5 0 1 1 0 1 0l1-1 1 1c.5.5 1.5.5 1.5-.5v-4zm-5 3c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l4.9 4.9c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-4.9-4.9c-.1-.2-.4-.3-.7-.3z"/>%3C/svg>');
|
|
44
|
+
}
|
|
45
|
+
.mapbox-gl-draw_combine {
|
|
46
|
+
background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M12.1,2c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l4.9,4.9c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-4.9-4.9C12.6,2.1,12.3,2,12.1,2z M8,8C7,8,7,9,7.5,9.5c0.3,0.3,1,1,1,1l-1,1c0,0-0.5,0.5,0,1s1,0,1,0l1-1l1,1 C11,13,12,13,12,12V8H8z M4,10c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1c0.4-0.4,0.4-1,0-1.4 l-1-1C4.5,10.1,4.3,10,4,10z M8,14c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-1-1C8.5,14.1,8.3,14,8,14z"/>%3C/svg>');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.mapboxgl-map.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
.mapboxgl-map.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
53
|
+
cursor: move;
|
|
54
|
+
}
|
|
55
|
+
.mapboxgl-map.mouse-add .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
56
|
+
cursor: crosshair;
|
|
57
|
+
}
|
|
58
|
+
.mapboxgl-map.mouse-move.mode-direct_select .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
59
|
+
cursor: grab;
|
|
60
|
+
cursor: -moz-grab;
|
|
61
|
+
cursor: -webkit-grab;
|
|
62
|
+
}
|
|
63
|
+
.mapboxgl-map.mode-direct_select.feature-vertex.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
64
|
+
cursor: move;
|
|
65
|
+
}
|
|
66
|
+
.mapboxgl-map.mode-direct_select.feature-midpoint.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
67
|
+
cursor: cell;
|
|
68
|
+
}
|
|
69
|
+
.mapboxgl-map.mode-direct_select.feature-feature.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
70
|
+
cursor: move;
|
|
71
|
+
}
|
|
72
|
+
.mapboxgl-map.mode-static.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive {
|
|
73
|
+
cursor: grab;
|
|
74
|
+
cursor: -moz-grab;
|
|
75
|
+
cursor: -webkit-grab;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.mapbox-gl-draw_boxselect {
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
width: 0;
|
|
84
|
+
height: 0;
|
|
85
|
+
background: rgba(0,0,0,.1);
|
|
86
|
+
border: 2px dotted #fff;
|
|
87
|
+
opacity: 0.5;
|
|
88
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).MapboxDraw=e()}(this,(function(){"use strict";var t=function(t,e){var n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[],deleteLastCoordinates:[]},o={on:function(t,e,o){if(void 0===n[t])throw new Error("Invalid event type: "+t);n[t].push({selector:e,fn:o})},render:function(t){e.store.featureChanged(t)}},r=function(t,r){for(var i=n[t],a=i.length;a--;){var s=i[a];if(s.selector(r)){s.fn.call(o,r)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(o),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){r("drag",t)},click:function(t){r("click",t)},mousemove:function(t){r("mousemove",t)},mousedown:function(t){r("mousedown",t)},mouseup:function(t){r("mouseup",t)},mouseout:function(t){r("mouseout",t)},keydown:function(t){r("keydown",t)},keyup:function(t){r("keyup",t)},touchstart:function(t){r("touchstart",t)},touchmove:function(t){r("touchmove",t)},touchend:function(t){r("touchend",t)},tap:function(t){r("tap",t)},deleteLastCoordinates:function(t){r("deleteLastCoordinates",t)}}};function e(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,o.get?o:{enumerable:!0,get:function(){return t[e]}})})),n}var n={},o={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142},r=o;function i(t){var e=0;if(t&&t.length>0){e+=Math.abs(a(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(a(t[n]))}return e}function a(t){var e,n,o,i,a,u,c=0,l=t.length;if(l>2){for(u=0;u<l;u++)u===l-2?(o=l-2,i=l-1,a=0):u===l-1?(o=l-1,i=0,a=1):(o=u,i=u+1,a=u+2),e=t[o],n=t[i],c+=(s(t[a][0])-s(e[0]))*Math.sin(s(n[1]));c=c*r.RADIUS*r.RADIUS/2}return c}function s(t){return t*Math.PI/180}n.geometry=function t(e){var n,o=0;switch(e.type){case"Polygon":return i(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)o+=i(e.coordinates[n]);return o;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<e.geometries.length;n++)o+=t(e.geometries[n]);return o}},n.ring=a;var u="mapboxgl-ctrl",c="mapbox-gl-draw_ctrl-draw-btn",l="mapbox-gl-draw_line",d="mapbox-gl-draw_polygon",p="mapbox-gl-draw_point",f="mapbox-gl-draw_trash",h="mapbox-gl-draw_combine",g="mapbox-gl-draw_uncombine",y="mapboxgl-ctrl-group",v="active",m="mapbox-gl-draw_boxselect",b="mapbox-gl-draw-hot",_="mapbox-gl-draw-cold",x="add",S="move",C="drag",E="pointer",M="none",w={POLYGON:"polygon",LINE:"line_string",POINT:"point"},I="Feature",L="Polygon",P="LineString",F="Point",O="FeatureCollection",T="Multi",k="MultiPoint",A="MultiLineString",j="MultiPolygon",D={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},N="draw.create",U="draw.delete",R="draw.update",V="draw.selectionchange",B="draw.modechange",J="draw.actionable",G="draw.render",z="draw.combine",$="draw.uncombine",q="move",W="change_coordinates",Y="feature",Z="midpoint",K="vertex",X="true",H="false",Q=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],tt={Point:0,LineString:1,Polygon:2};function et(t,e){var n=tt[t.geometry.type]-tt[e.geometry.type];return 0===n&&t.geometry.type===L?t.area-e.area:n}function nt(t){if(this._items={},this._nums={},this._length=t?t.length:0,t)for(var e=0,n=t.length;e<n;e++)this.add(t[e]),void 0!==t[e]&&("string"==typeof t[e]?this._items[t[e]]=e:this._nums[t[e]]=e)}nt.prototype.add=function(t){return this.has(t)||(this._length++,"string"==typeof t?this._items[t]=this._length:this._nums[t]=this._length),this},nt.prototype.delete=function(t){return!1===this.has(t)||(this._length--,delete this._items[t],delete this._nums[t]),this},nt.prototype.has=function(t){return("string"==typeof t||"number"==typeof t)&&(void 0!==this._items[t]||void 0!==this._nums[t])},nt.prototype.values=function(){var t=this,e=[];return Object.keys(this._items).forEach((function(n){e.push({k:n,v:t._items[n]})})),Object.keys(this._nums).forEach((function(n){e.push({k:JSON.parse(n),v:t._nums[n]})})),e.sort((function(t,e){return t.v-e.v})).map((function(t){return t.k}))},nt.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};var ot=[Y,Z,K],rt={click:function(t,e,n){return it(t,e,n,n.options.clickBuffer)},touch:function(t,e,n){return it(t,e,n,n.options.touchBuffer)}};function it(t,e,o,r){if(null===o.map)return[];var i=t?function(t,e){return void 0===e&&(e=0),[[t.point.x-e,t.point.y-e],[t.point.x+e,t.point.y+e]]}(t,r):e,a={};o.options.styles&&(a.layers=o.options.styles.map((function(t){return t.id})));var s=o.map.queryRenderedFeatures(i,a).filter((function(t){return-1!==ot.indexOf(t.properties.meta)})),u=new nt,c=[];return s.forEach((function(t){var e=t.properties.id;u.has(e)||(u.add(e),c.push(t))})),function(t){return t.map((function(t){return t.geometry.type===L&&(t.area=n.geometry({type:I,property:{},geometry:t.geometry})),t})).sort(et).map((function(t){return delete t.area,t}))}(c)}function at(t,e){var n=rt.click(t,null,e),o={mouse:M};return n[0]&&(o.mouse=n[0].properties.active===X?S:E,o.feature=n[0].properties.meta),-1!==e.events.currentModeName().indexOf("draw")&&(o.mouse=x),e.ui.queueMapClasses(o),e.ui.updateMapClasses(),n[0]}function st(t,e){var n=t.x-e.x,o=t.y-e.y;return Math.sqrt(n*n+o*o)}function ut(t,e,n){void 0===n&&(n={});var o=null!=n.fineTolerance?n.fineTolerance:4,r=null!=n.grossTolerance?n.grossTolerance:12,i=null!=n.interval?n.interval:500;t.point=t.point||e.point,t.time=t.time||e.time;var a=st(t.point,e.point);return a<o||a<r&&e.time-t.time<i}function ct(t,e,n){void 0===n&&(n={});var o=null!=n.tolerance?n.tolerance:25,r=null!=n.interval?n.interval:250;return t.point=t.point||e.point,t.time=t.time||e.time,st(t.point,e.point)<o&&e.time-t.time<r}var lt={exports:{}},dt=lt.exports=function(t,e){if(e||(e=16),void 0===t&&(t=128),t<=0)return"0";for(var n=Math.log(Math.pow(2,t))/Math.log(e),o=2;n===1/0;o*=2)n=Math.log(Math.pow(2,t/o))/Math.log(e)*o;var r=n-Math.floor(n),i="";for(o=0;o<Math.floor(n);o++){i=Math.floor(Math.random()*e).toString(e)+i}if(r){var a=Math.pow(e,r);i=Math.floor(Math.random()*a).toString(e)+i}var s=parseInt(i,e);return s!==1/0&&s>=Math.pow(2,t)?dt(t,e):i};dt.rack=function(t,e,n){var o=function(o){var i=0;do{if(i++>10){if(!n)throw new Error("too many ID collisions, use more bits");t+=n}var a=dt(t,e)}while(Object.hasOwnProperty.call(r,a));return r[a]=o,a},r=o.hats={};return o.get=function(t){return o.hats[t]},o.set=function(t,e){return o.hats[t]=e,o},o.bits=t||128,o.base=e||16,o};var pt=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||lt.exports(),this.type=e.geometry.type};pt.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},pt.prototype.incomingCoords=function(t){this.setCoordinates(t)},pt.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},pt.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},pt.prototype.setProperty=function(t,e){this.properties[t]=e},pt.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:I,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},pt.prototype.internal=function(t){var e={id:this.id,meta:Y,"meta:type":this.type,active:H,mode:t};if(this.ctx.options.userProperties)for(var n in this.properties)e["user_"+n]=this.properties[n];return{type:I,properties:e,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var ft=function(t,e){pt.call(this,t,e)};(ft.prototype=Object.create(pt.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},ft.prototype.updateCoordinate=function(t,e,n){this.coordinates=3===arguments.length?[e,n]:[t,e],this.changed()},ft.prototype.getCoordinate=function(){return this.getCoordinates()};var ht=function(t,e){pt.call(this,t,e)};(ht.prototype=Object.create(pt.prototype)).isValid=function(){return this.coordinates.length>1},ht.prototype.addCoordinate=function(t,e,n){this.changed();var o=parseInt(t,10);this.coordinates.splice(o,0,[e,n])},ht.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},ht.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},ht.prototype.updateCoordinate=function(t,e,n){var o=parseInt(t,10);this.coordinates[o]=[e,n],this.changed()};var gt=function(t,e){pt.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(gt.prototype=Object.create(pt.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},gt.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},gt.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},gt.prototype.addCoordinate=function(t,e,n){this.changed();var o=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[o[0]].splice(o[1],0,[e,n])},gt.prototype.removeCoordinate=function(t){this.changed();var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];n&&(n.splice(e[1],1),n.length<3&&this.coordinates.splice(e[0],1))},gt.prototype.getCoordinate=function(t){var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];return JSON.parse(JSON.stringify(n[e[1]]))},gt.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},gt.prototype.updateCoordinate=function(t,e,n){this.changed();var o=t.split("."),r=parseInt(o[0],10),i=parseInt(o[1],10);void 0===this.coordinates[r]&&(this.coordinates[r]=[]),this.coordinates[r][i]=[e,n]};var yt={MultiPoint:ft,MultiLineString:ht,MultiPolygon:gt},vt=function(t,e,n,o,r){var i=n.split("."),a=parseInt(i[0],10),s=i[1]?i.slice(1).join("."):null;return t[a][e](s,o,r)},mt=function(t,e){if(pt.call(this,t,e),delete this.coordinates,this.model=yt[e.geometry.type],void 0===this.model)throw new TypeError(e.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(e.geometry.coordinates)};function bt(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(mt.prototype=Object.create(pt.prototype))._coordinatesToFeatures=function(t){var e=this,n=this.model.bind(this);return t.map((function(t){return new n(e.ctx,{id:lt.exports(),type:I,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},mt.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},mt.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},mt.prototype.getCoordinate=function(t){return vt(this.features,"getCoordinate",t)},mt.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===L?t.getCoordinates():t.coordinates}))))},mt.prototype.updateCoordinate=function(t,e,n){vt(this.features,"updateCoordinate",t,e,n),this.changed()},mt.prototype.addCoordinate=function(t,e,n){vt(this.features,"addCoordinate",t,e,n),this.changed()},mt.prototype.removeCoordinate=function(t){vt(this.features,"removeCoordinate",t),this.changed()},mt.prototype.getFeatures=function(){return this.features},bt.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},bt.prototype.setSelectedCoordinates=function(t){var e=this;this._ctx.store.setSelectedCoordinates(t),t.reduce((function(t,n){return void 0===t[n.feature_id]&&(t[n.feature_id]=!0,e._ctx.store.get(n.feature_id).changed()),t}),{})},bt.prototype.getSelected=function(){return this._ctx.store.getSelected()},bt.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},bt.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},bt.prototype.getFeature=function(t){return this._ctx.store.get(t)},bt.prototype.select=function(t){return this._ctx.store.select(t)},bt.prototype.deselect=function(t){return this._ctx.store.deselect(t)},bt.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},bt.prototype.addFeature=function(t){return this._ctx.store.add(t)},bt.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},bt.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},bt.prototype.setActionableState=function(t){void 0===t&&(t={});var e={trash:t.trash||!1,combineFeatures:t.combineFeatures||!1,uncombineFeatures:t.uncombineFeatures||!1};return this._ctx.events.actionable(e)},bt.prototype.changeMode=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._ctx.events.changeMode(t,e,n)},bt.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},bt.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},bt.prototype.featuresAt=function(t,e,n){if(void 0===n&&(n="click"),"click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return rt[n](t,e,this._ctx)},bt.prototype.newFeature=function(t){var e=t.geometry.type;return e===F?new ft(this._ctx,t):e===P?new ht(this._ctx,t):e===L?new gt(this._ctx,t):new mt(this._ctx,t)},bt.prototype.isInstanceOf=function(t,e){if(t===F)return e instanceof ft;if(t===P)return e instanceof ht;if(t===L)return e instanceof gt;if("MultiFeature"===t)return e instanceof mt;throw new Error("Unknown feature class: "+t)},bt.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},bt.prototype.onSetup=function(){},bt.prototype.onDrag=function(){},bt.prototype.onClick=function(){},bt.prototype.onMouseMove=function(){},bt.prototype.onMouseDown=function(){},bt.prototype.onMouseUp=function(){},bt.prototype.onMouseOut=function(){},bt.prototype.onKeyUp=function(){},bt.prototype.onKeyDown=function(){},bt.prototype.onTouchStart=function(){},bt.prototype.onTouchMove=function(){},bt.prototype.onTouchEnd=function(){},bt.prototype.onTap=function(){},bt.prototype.onStop=function(){},bt.prototype.onTrash=function(){},bt.prototype.onCombineFeature=function(){},bt.prototype.onUncombineFeature=function(){},bt.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var _t={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap",deleteLastCoordinates:"onDeleteLastCoordinates"},xt=Object.keys(_t);function St(t){var e=Object.keys(t);return function(n,o){void 0===o&&(o={});var r={},i=e.reduce((function(e,n){return e[n]=t[n],e}),new bt(n));return{start:function(){var e=this;r=i.onSetup(o),xt.forEach((function(n){var o,a=_t[n],s=function(){return!1};t[a]&&(s=function(){return!0}),e.on(n,s,(o=a,function(t){return i[o](r,t)}))}))},stop:function(){i.onStop(r)},trash:function(){i.onTrash(r)},combineFeatures:function(){i.onCombineFeatures(r)},uncombineFeatures:function(){i.onUncombineFeatures(r)},render:function(t,e){i.toDisplayFeatures(r,t,e)}}}}function Ct(t){return[].concat(t).filter((function(t){return void 0!==t}))}function Et(){var t=this;if(!(t.ctx.map&&void 0!==t.ctx.map.getSource(b)))return u();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var n=[],o=[];t.isDirty?o=t.getAllIds():(n=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),o=t.sources.hot.filter((function(e){return e.properties.id&&-1===n.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var r=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===n.indexOf(e)}));var i=r!==t.sources.cold.length||o.length>0;function a(n,o){var r=t.get(n).internal(e);t.ctx.events.currentModeRender(r,(function(e){t.sources[o].push(e)}))}if(n.forEach((function(t){return a(t,"hot")})),o.forEach((function(t){return a(t,"cold")})),i&&t.ctx.map.getSource(_).setData({type:O,features:t.sources.cold}),t.ctx.map.getSource(b).setData({type:O,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(V,{features:t.getSelected().map((function(t){return t.toGeoJSON()})),points:t.getSelectedCoordinates().map((function(t){return{type:I,properties:{},geometry:{type:F,coordinates:t.coordinates}}}))}),t._emitSelectionChange=!1),t._deletedFeaturesToEmit.length){var s=t._deletedFeaturesToEmit.map((function(t){return t.toGeoJSON()}));t._deletedFeaturesToEmit=[],t.ctx.map.fire(U,{features:s})}function u(){t.isDirty=!1,t.clearChangedIds()}u(),t.ctx.map.fire(G,{})}function Mt(t){var e,n=this;this._features={},this._featureIds=new nt,this._selectedFeatureIds=new nt,this._selectedCoordinates=[],this._changedFeatureIds=new nt,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,Et.call(n)})))},this.isDirty=!1}function wt(t,e){var n=t._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));t._selectedCoordinates.length===n.length||e.silent||(t._emitSelectionChange=!0),t._selectedCoordinates=n}Mt.prototype.createRenderBatch=function(){var t=this,e=this.render,n=0;return this.render=function(){n++},function(){t.render=e,n>0&&t.render()}},Mt.prototype.setDirty=function(){return this.isDirty=!0,this},Mt.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},Mt.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},Mt.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},Mt.prototype.getAllIds=function(){return this._featureIds.values()},Mt.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},Mt.prototype.delete=function(t,e){var n=this;return void 0===e&&(e={}),Ct(t).forEach((function(t){n._featureIds.has(t)&&(n._featureIds.delete(t),n._selectedFeatureIds.delete(t),e.silent||-1===n._deletedFeaturesToEmit.indexOf(n._features[t])&&n._deletedFeaturesToEmit.push(n._features[t]),delete n._features[t],n.isDirty=!0)})),wt(this,e),this},Mt.prototype.get=function(t){return this._features[t]},Mt.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},Mt.prototype.select=function(t,e){var n=this;return void 0===e&&(e={}),Ct(t).forEach((function(t){n._selectedFeatureIds.has(t)||(n._selectedFeatureIds.add(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),this},Mt.prototype.deselect=function(t,e){var n=this;return void 0===e&&(e={}),Ct(t).forEach((function(t){n._selectedFeatureIds.has(t)&&(n._selectedFeatureIds.delete(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),wt(this,e),this},Mt.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},Mt.prototype.setSelected=function(t,e){var n=this;return void 0===e&&(e={}),t=Ct(t),this.deselect(this._selectedFeatureIds.values().filter((function(e){return-1===t.indexOf(e)})),{silent:e.silent}),this.select(t.filter((function(t){return!n._selectedFeatureIds.has(t)})),{silent:e.silent}),this},Mt.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},Mt.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},Mt.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},Mt.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},Mt.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},Mt.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},Mt.prototype.setFeatureProperty=function(t,e,n){this.get(t).setProperty(e,n),this.featureChanged(t)},Mt.prototype.storeMapConfig=function(){var t=this;Q.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},Mt.prototype.restoreMapConfig=function(){var t=this;Object.keys(this._mapInitialConfig).forEach((function(e){t._mapInitialConfig[e]?t.ctx.map[e].enable():t.ctx.map[e].disable()}))},Mt.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var It=function(){for(var t=arguments,e={},n=0;n<arguments.length;n++){var o=t[n];for(var r in o)Lt.call(o,r)&&(e[r]=o[r])}return e},Lt=Object.prototype.hasOwnProperty;var Pt=["mode","feature","mouse"];function Ft(e){var n=null,o=null,r={onRemove:function(){return e.map.off("load",r.connect),clearInterval(o),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.map=null,e.container=null,e.store=null,n&&n.parentNode&&n.parentNode.removeChild(n),n=null,this},connect:function(){e.map.off("load",r.connect),clearInterval(o),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd:function(i){var a=i.fire;return i.fire=function(t,e){var n=arguments;return 1===a.length&&1!==arguments.length&&(n=[It({},{type:t},e)]),a.apply(i,n)},e.map=i,e.events=function(e){var n=Object.keys(e.options.modes).reduce((function(t,n){return t[n]=St(e.options.modes[n]),t}),{}),o={},r={},i={},a=null,s=null;i.drag=function(t,n){n({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:C}),s.drag(t)):t.originalEvent.stopPropagation()},i.mousedrag=function(t){i.drag(t,(function(t){return!ut(o,t)}))},i.touchdrag=function(t){i.drag(t,(function(t){return!ct(r,t)}))},i.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return i.mousedrag(t);var n=at(t,e);t.featureTarget=n,s.mousemove(t)},i.mousedown=function(t){o={time:(new Date).getTime(),point:t.point};var n=at(t,e);t.featureTarget=n,s.mousedown(t)},i.mouseup=function(t){var n=at(t,e);if(t.featureTarget=n,ut(o,{point:t.point,time:(new Date).getTime()})){var r=t.originalEvent;r&&(2===r.button?s.deleteLastCoordinates(t):s.click(t))}else s.mouseup(t)},i.mouseout=function(t){s.mouseout(t)},i.touchstart=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){r={time:(new Date).getTime(),point:t.point};var n=rt.touch(t,null,e)[0];t.featureTarget=n,s.touchstart(t)}},i.touchmove=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled)return s.touchmove(t),i.touchdrag(t)},i.touchend=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){var n=rt.touch(t,null,e)[0];t.featureTarget=n,ct(r,{time:(new Date).getTime(),point:t.point})?s.tap(t):s.touchend(t)}};var u=function(t){return!(8===t||46===t||t>=48&&t<=57)};function c(o,r,i){void 0===i&&(i={}),s.stop();var u=n[o];if(void 0===u)throw new Error(o+" is not valid");a=o;var c=u(e,r);s=t(c,e),i.silent||e.map.fire(B,{mode:o}),e.store.setDirty(),e.store.render()}i.keydown=function(t){"mapboxgl-canvas"===(t.srcElement||t.target).classList[0]&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?u(t.keyCode)?s.keydown(t):49===t.keyCode&&e.options.controls.point?c(D.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?c(D.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&c(D.DRAW_POLYGON):(t.preventDefault(),s.trash()))},i.keyup=function(t){u(t.keyCode)&&s.keyup(t)},i.zoomend=function(){e.store.changeZoom()},i.data=function(t){if("style"===t.dataType){var n=e.setup,o=e.map,r=e.options,i=e.store;r.styles.some((function(t){return o.getLayer(t.id)}))||(n.addLayers(),i.setDirty(),i.render())}};var l={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){a=e.options.defaultMode,s=t(n[a](e),e)},changeMode:c,actionable:function(t){var n=!1;Object.keys(t).forEach((function(e){if(void 0===l[e])throw new Error("Invalid action type");l[e]!==t[e]&&(n=!0),l[e]=t[e]})),n&&e.map.fire(J,{actions:l})},currentModeName:function(){return a},currentModeRender:function(t,e){return s.render(t,e)},fire:function(t,e){i[t]&&i[t](e)},addEventListeners:function(){e.map.on("mousemove",i.mousemove),e.map.on("mousedown",i.mousedown),e.map.on("mouseup",i.mouseup),e.map.on("data",i.data),e.map.on("touchmove",i.touchmove),e.map.on("touchstart",i.touchstart),e.map.on("touchend",i.touchend),e.container.addEventListener("mouseout",i.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",i.keydown),e.container.addEventListener("keyup",i.keyup))},removeEventListeners:function(){e.map.off("mousemove",i.mousemove),e.map.off("mousedown",i.mousedown),e.map.off("mouseup",i.mouseup),e.map.off("data",i.data),e.map.off("touchmove",i.touchmove),e.map.off("touchstart",i.touchstart),e.map.off("touchend",i.touchend),e.container.removeEventListener("mouseout",i.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",i.keydown),e.container.removeEventListener("keyup",i.keyup))},trash:function(t){s.trash(t)},combineFeatures:function(){s.combineFeatures()},uncombineFeatures:function(){s.uncombineFeatures()},getMode:function(){return a}}}(e),e.ui=function(t){var e={},n=null,o={mode:null,feature:null,mouse:null},r={mode:null,feature:null,mouse:null};function i(t){r=It(r,t)}function a(){var e,n;if(t.container){var i=[],a=[];Pt.forEach((function(t){r[t]!==o[t]&&(i.push(t+"-"+o[t]),null!==r[t]&&a.push(t+"-"+r[t]))})),i.length>0&&(e=t.container.classList).remove.apply(e,i),a.length>0&&(n=t.container.classList).add.apply(n,a),o=It(o,r)}}function s(t,e){void 0===e&&(e={});var o=document.createElement("button");return o.className=c+" "+e.className,o.setAttribute("title",e.title),e.container.appendChild(o),o.addEventListener("click",(function(o){if(o.preventDefault(),o.stopPropagation(),o.target===n)return m(),void e.onDeactivate();b(t),e.onActivate()}),!0),o}function m(){n&&(n.classList.remove(v),n=null)}function b(t){m();var o=e[t];o&&o&&"trash"!==t&&(o.classList.add(v),n=o)}return{setActiveButton:b,queueMapClasses:i,updateMapClasses:a,clearMapClasses:function(){i({mode:null,feature:null,mouse:null}),a()},addButtons:function(){var n=t.options.controls,o=document.createElement("div");return o.className=y+" "+u,n?(n[w.LINE]&&(e[w.LINE]=s(w.LINE,{container:o,className:l,title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(D.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),n[w.POLYGON]&&(e[w.POLYGON]=s(w.POLYGON,{container:o,className:d,title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(D.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),n[w.POINT]&&(e[w.POINT]=s(w.POINT,{container:o,className:p,title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(D.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),n.trash&&(e.trash=s("trash",{container:o,className:f,title:"Delete",onActivate:function(){t.events.trash()}})),n.combine_features&&(e.combine_features=s("combineFeatures",{container:o,className:h,title:"Combine",onActivate:function(){t.events.combineFeatures()}})),n.uncombine_features&&(e.uncombine_features=s("uncombineFeatures",{container:o,className:g,title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),o):o},removeButtons:function(){Object.keys(e).forEach((function(t){var n=e[t];n.parentNode&&n.parentNode.removeChild(n),delete e[t]}))}}}(e),e.container=i.getContainer(),e.store=new Mt(e),n=e.ui.addButtons(),e.options.boxSelect&&(i.boxZoom.disable(),i.dragPan.disable(),i.dragPan.enable()),i.loaded()?r.connect():(i.on("load",r.connect),o=setInterval((function(){i.loaded()&&r.connect()}),16)),e.events.start(),n},addLayers:function(){e.map.addSource(_,{data:{type:O,features:[]},type:"geojson"}),e.map.addSource(b,{data:{type:O,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(_)&&e.map.removeSource(_),e.map.getSource(b)&&e.map.removeSource(b)}};return e.setup=r,r}function Ot(t){return function(e){var n=e.featureTarget;return!!n&&(!!n.properties&&n.properties.meta===t)}}function Tt(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&(t.featureTarget.properties.active===X&&t.featureTarget.properties.meta===Y))}function kt(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&(t.featureTarget.properties.active===H&&t.featureTarget.properties.meta===Y))}function At(t){return void 0===t.featureTarget}function jt(t){var e=t.featureTarget;return!!e&&(!!e.properties&&e.properties.meta===K)}function Dt(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function Nt(t){return 27===t.keyCode}function Ut(t){return 13===t.keyCode}var Rt=Vt;function Vt(t,e){this.x=t,this.y=e}function Bt(t,e){var n=e.getBoundingClientRect();return new Rt(t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0))}function Jt(t,e,n,o){return{type:I,properties:{meta:K,parent:t,coord_path:n,active:o?X:H},geometry:{type:F,coordinates:e}}}function Gt(t,e,n){void 0===e&&(e={}),void 0===n&&(n=null);var o,r=t.geometry,i=r.type,a=r.coordinates,s=t.properties&&t.properties.id,u=[];function c(t,n){var o="",r=null;t.forEach((function(t,i){var a=null!=n?n+"."+i:String(i),c=Jt(s,t,a,l(a));if(e.midpoints&&r){var d=function(t,e,n){var o=e.geometry.coordinates,r=n.geometry.coordinates;if(o[1]>85||o[1]<-85||r[1]>85||r[1]<-85)return null;var i={lng:(o[0]+r[0])/2,lat:(o[1]+r[1])/2};return{type:I,properties:{meta:Z,parent:t,lng:i.lng,lat:i.lat,coord_path:n.properties.coord_path},geometry:{type:F,coordinates:[i.lng,i.lat]}}}(s,r,c);d&&u.push(d)}r=c;var p=JSON.stringify(t);o!==p&&u.push(c),0===i&&(o=p)}))}function l(t){return!!e.selectedPaths&&-1!==e.selectedPaths.indexOf(t)}return i===F?u.push(Jt(s,a,n,l(n))):i===L?a.forEach((function(t,e){c(t,null!==n?n+"."+e:String(e))})):i===P?c(a,n):0===i.indexOf(T)&&(o=i.replace(T,""),a.forEach((function(n,r){var i={type:I,properties:t.properties,geometry:{type:o,coordinates:n}};u=u.concat(Gt(i,e,r))}))),u}Vt.prototype={clone:function(){return new Vt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),o=e*this.x-n*this.y,r=n*this.x+e*this.y;return this.x=o,this.y=r,this},_rotateAround:function(t,e){var n=Math.cos(t),o=Math.sin(t),r=e.x+n*(this.x-e.x)-o*(this.y-e.y),i=e.y+o*(this.x-e.x)+n*(this.y-e.y);return this.x=r,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Vt.convert=function(t){return t instanceof Vt?t:Array.isArray(t)?new Vt(t[0],t[1]):t};var zt=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t._ctx&&t._ctx.store&&t._ctx.store.getInitialConfigValue&&t._ctx.store.getInitialConfigValue("doubleClickZoom")&&t.map.doubleClickZoom.enable()}),0)},$t=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t.map.doubleClickZoom.disable()}),0)},qt={exports:{}},Wt=function(t){if(!t||!t.type)return null;var e=Yt[t.type];if(!e)return null;if("geometry"===e)return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]};if("feature"===e)return{type:"FeatureCollection",features:[t]};if("featurecollection"===e)return t},Yt={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};var Zt=Object.freeze({__proto__:null,default:function t(e){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.reduce((function(e,n){return e.concat(t(n))}),[]),e;case"Feature":return e.geometry?t(e.geometry).map((function(t){var n={type:"Feature",properties:JSON.parse(JSON.stringify(e.properties)),geometry:t};return void 0!==e.id&&(n.id=e.id),n})):[e];case"MultiPoint":return e.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return e.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return e.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return e.geometries.map(t).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[e]}}}),Kt=Wt,Xt=e(Zt),Ht=function(t){return function t(e){if(Array.isArray(e)&&e.length&&"number"==typeof e[0])return[e];return e.reduce((function(e,n){return Array.isArray(n)&&Array.isArray(n[0])?e.concat(t(n)):(e.push(n),e)}),[])}(t)};Xt instanceof Function||(Xt=Xt.default);var Qt={exports:{}},te=Qt.exports=function(t){return new ee(t)};function ee(t){this.value=t}function ne(t,e,n){var o=[],r=[],i=!0;return function t(a){var s=n?oe(a):a,u={},c=!0,l={node:s,node_:a,path:[].concat(o),parent:r[r.length-1],parents:r,key:o.slice(-1)[0],isRoot:0===o.length,level:o.length,circular:null,update:function(t,e){l.isRoot||(l.parent.node[l.key]=t),l.node=t,e&&(c=!1)},delete:function(t){delete l.parent.node[l.key],t&&(c=!1)},remove:function(t){ae(l.parent.node)?l.parent.node.splice(l.key,1):delete l.parent.node[l.key],t&&(c=!1)},keys:null,before:function(t){u.before=t},after:function(t){u.after=t},pre:function(t){u.pre=t},post:function(t){u.post=t},stop:function(){i=!1},block:function(){c=!1}};if(!i)return l;function d(){if("object"==typeof l.node&&null!==l.node){l.keys&&l.node_===l.node||(l.keys=re(l.node)),l.isLeaf=0==l.keys.length;for(var t=0;t<r.length;t++)if(r[t].node_===a){l.circular=r[t];break}}else l.isLeaf=!0,l.keys=null;l.notLeaf=!l.isLeaf,l.notRoot=!l.isRoot}d();var p=e.call(l,l.node);return void 0!==p&&l.update&&l.update(p),u.before&&u.before.call(l,l.node),c?("object"!=typeof l.node||null===l.node||l.circular||(r.push(l),d(),se(l.keys,(function(e,r){o.push(e),u.pre&&u.pre.call(l,l.node[e],e);var i=t(l.node[e]);n&&ue.call(l.node,e)&&(l.node[e]=i.node),i.isLast=r==l.keys.length-1,i.isFirst=0==r,u.post&&u.post.call(l,i),o.pop()})),r.pop()),u.after&&u.after.call(l,l.node),l):l}(t).node}function oe(t){if("object"==typeof t&&null!==t){var e;if(ae(t))e=[];else if("[object Date]"===ie(t))e=new Date(t.getTime?t.getTime():t);else if(function(t){return"[object RegExp]"===ie(t)}(t))e=new RegExp(t);else if(function(t){return"[object Error]"===ie(t)}(t))e={message:t.message};else if(function(t){return"[object Boolean]"===ie(t)}(t))e=new Boolean(t);else if(function(t){return"[object Number]"===ie(t)}(t))e=new Number(t);else if(function(t){return"[object String]"===ie(t)}(t))e=new String(t);else if(Object.create&&Object.getPrototypeOf)e=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)e={};else{var n=t.constructor&&t.constructor.prototype||t.__proto__||{},o=function(){};o.prototype=n,e=new o}return se(re(t),(function(n){e[n]=t[n]})),e}return t}ee.prototype.get=function(t){for(var e=this.value,n=0;n<t.length;n++){var o=t[n];if(!e||!ue.call(e,o)){e=void 0;break}e=e[o]}return e},ee.prototype.has=function(t){for(var e=this.value,n=0;n<t.length;n++){var o=t[n];if(!e||!ue.call(e,o))return!1;e=e[o]}return!0},ee.prototype.set=function(t,e){for(var n=this.value,o=0;o<t.length-1;o++){var r=t[o];ue.call(n,r)||(n[r]={}),n=n[r]}return n[t[o]]=e,e},ee.prototype.map=function(t){return ne(this.value,t,!0)},ee.prototype.forEach=function(t){return this.value=ne(this.value,t,!1),this.value},ee.prototype.reduce=function(t,e){var n=1===arguments.length,o=n?this.value:e;return this.forEach((function(e){this.isRoot&&n||(o=t.call(this,o,e))})),o},ee.prototype.paths=function(){var t=[];return this.forEach((function(e){t.push(this.path)})),t},ee.prototype.nodes=function(){var t=[];return this.forEach((function(e){t.push(this.node)})),t},ee.prototype.clone=function(){var t=[],e=[];return function n(o){for(var r=0;r<t.length;r++)if(t[r]===o)return e[r];if("object"==typeof o&&null!==o){var i=oe(o);return t.push(o),e.push(i),se(re(o),(function(t){i[t]=n(o[t])})),t.pop(),e.pop(),i}return o}(this.value)};var re=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function ie(t){return Object.prototype.toString.call(t)}var ae=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},se=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e(t[n],n,t)};se(re(ee.prototype),(function(t){te[t]=function(e){var n=[].slice.call(arguments,1),o=new ee(e);return o[t].apply(o,n)}}));var ue=Object.hasOwnProperty||function(t,e){return e in t},ce=le;function le(t){if(!(this instanceof le))return new le(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}le.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},le.prototype.equals=function(t){var e;return e=t instanceof le?t.bbox():t,this._bbox[0]==e[0]&&this._bbox[1]==e[1]&&this._bbox[2]==e[2]&&this._bbox[3]==e[3]},le.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},le.prototype.union=function(t){var e;return this._valid=!0,e=t instanceof le?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[2]),this._bbox[3]=Math.max(this._bbox[3],e[3]),this},le.prototype.bbox=function(){return this._valid?this._bbox:null},le.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],n=t[1];return this._bbox[0]<=e&&this._bbox[1]<=n&&this._bbox[2]>=e&&this._bbox[3]>=n},le.prototype.intersect=function(t){return this._valid?(e=t instanceof le?t.bbox():t,!(this._bbox[0]>e[2]||this._bbox[2]<e[0]||this._bbox[3]<e[1]||this._bbox[1]>e[3])):null;var e},le.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},le.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var de=function(t){if(!t)return[];var e=Xt(Kt(t)),n=[];return e.features.forEach((function(t){t.geometry&&(n=n.concat(Ht(t.geometry.coordinates)))})),n},pe=Qt.exports,fe=ce,he={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},ge=Object.keys(he);function ye(t){for(var e=fe(),n=de(t),o=0;o<n.length;o++)e.include(n[o]);return e}qt.exports=function(t){return ye(t).bbox()},qt.exports.polygon=function(t){return ye(t).polygon()},qt.exports.bboxify=function(t){return pe(t).map((function(t){t&&(ge.some((function(e){return!!t[e]&&-1!==he[e].indexOf(t.type)}))&&(t.bbox=ye(t).bbox(),this.update(t)))}))};var ve=-90;function me(t,e){var n=ve,o=90,r=ve,i=90,a=270,s=-270;t.forEach((function(t){var e=qt.exports(t),u=e[1],c=e[3],l=e[0],d=e[2];u>n&&(n=u),c<o&&(o=c),c>r&&(r=c),u<i&&(i=u),l<a&&(a=l),d>s&&(s=d)}));var u=e;return n+u.lat>85&&(u.lat=85-n),r+u.lat>90&&(u.lat=90-r),o+u.lat<-85&&(u.lat=-85-o),i+u.lat<ve&&(u.lat=ve-i),a+u.lng<=-270&&(u.lng+=360*Math.ceil(Math.abs(u.lng)/360)),s+u.lng>=270&&(u.lng-=360*Math.ceil(Math.abs(u.lng)/360)),u}function be(t,e){var n=me(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,o=t.getCoordinates(),r=function(t){var e={lng:t[0]+n.lng,lat:t[1]+n.lat};return[e.lng,e.lat]},i=function(t){return t.map((function(t){return r(t)}))};t.type===F?e=r(o):t.type===P||t.type===k?e=o.map(r):t.type===L||t.type===A?e=o.map(i):t.type===j&&(e=o.map((function(t){return t.map((function(t){return i(t)}))}))),t.incomingCoords(e)}))}var _e={onSetup:function(t){var e=this,n={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:t.featureIds||[]};return this.setSelected(n.initiallySelectedFeatureIds.filter((function(t){return void 0!==e.getFeature(t)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),n},fireUpdate:function(){this.map.fire(R,{action:q,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(){var t=this,e=this.getSelected(),n=e.filter((function(e){return t.isInstanceOf("MultiFeature",e)})),o=!1;if(e.length>1){o=!0;var r=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==r&&(o=!1)}))}var i=n.length>0,a=e.length>0;this.setActionableState({combineFeatures:o,uncombineFeatures:i,trash:a})},getUniqueIds:function(t){return t.length?t.map((function(t){return t.properties.id})).filter((function(t){return void 0!==t})).reduce((function(t,e){return t.add(e),t}),new nt).values():[]},stopExtendedInteractions:function(t){t.boxSelectElement&&(t.boxSelectElement.parentNode&&t.boxSelectElement.parentNode.removeChild(t.boxSelectElement),t.boxSelectElement=null),this.map.dragPan.enable(),t.boxSelecting=!1,t.canBoxSelect=!1,t.dragMoving=!1,t.canDragMove=!1},onStop:function(){zt(this)},onMouseMove:function(t){return this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};_e.onTap=_e.onClick=function(t,e){return At(e)?this.clickAnywhere(t,e):Ot(K)(e)?this.clickOnVertex(t,e):function(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.meta===Y}(e)?this.clickOnFeature(t,e):void 0},_e.clickAnywhere=function(t){var e=this,n=this.getSelectedIds();n.length&&(this.clearSelectedFeatures(),n.forEach((function(t){return e.doRender(t)}))),zt(this),this.stopExtendedInteractions(t)},_e.clickOnVertex=function(t,e){this.changeMode(D.DIRECT_SELECT,{featureId:e.featureTarget.properties.parent,coordPath:e.featureTarget.properties.coord_path,startPos:e.lngLat}),this.updateUIClasses({mouse:S})},_e.startOnActiveFeature=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),this.doRender(e.featureTarget.properties.id),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},_e.clickOnFeature=function(t,e){var n=this;$t(this),this.stopExtendedInteractions(t);var o=Dt(e),r=this.getSelectedIds(),i=e.featureTarget.properties.id,a=this.isSelected(i);if(!o&&a&&this.getFeature(i).type!==F)return this.changeMode(D.DIRECT_SELECT,{featureId:i});a&&o?(this.deselect(i),this.updateUIClasses({mouse:E}),1===r.length&&zt(this)):!a&&o?(this.select(i),this.updateUIClasses({mouse:S})):a||o||(r.forEach((function(t){return n.doRender(t)})),this.setSelected(i),this.updateUIClasses({mouse:S})),this.doRender(i)},_e.onMouseDown=function(t,e){return Tt(e)?this.startOnActiveFeature(t,e):this.drawConfig.boxSelect&&function(t){return!!t.originalEvent&&!!t.originalEvent.shiftKey&&0===t.originalEvent.button}(e)?this.startBoxSelect(t,e):void 0},_e.startBoxSelect=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),t.boxSelectStartLocation=Bt(e.originalEvent,this.map.getContainer()),t.canBoxSelect=!0},_e.onTouchStart=function(t,e){if(Tt(e))return this.startOnActiveFeature(t,e)},_e.onDrag=function(t,e){return t.canDragMove?this.dragMove(t,e):this.drawConfig.boxSelect&&t.canBoxSelect?this.whileBoxSelect(t,e):void 0},_e.whileBoxSelect=function(t,e){t.boxSelecting=!0,this.updateUIClasses({mouse:x}),t.boxSelectElement||(t.boxSelectElement=document.createElement("div"),t.boxSelectElement.classList.add(m),this.map.getContainer().appendChild(t.boxSelectElement));var n=Bt(e.originalEvent,this.map.getContainer()),o=Math.min(t.boxSelectStartLocation.x,n.x),r=Math.max(t.boxSelectStartLocation.x,n.x),i=Math.min(t.boxSelectStartLocation.y,n.y),a=Math.max(t.boxSelectStartLocation.y,n.y),s="translate("+o+"px, "+i+"px)";t.boxSelectElement.style.transform=s,t.boxSelectElement.style.WebkitTransform=s,t.boxSelectElement.style.width=r-o+"px",t.boxSelectElement.style.height=a-i+"px"},_e.dragMove=function(t,e){t.dragMoving=!0,e.originalEvent.stopPropagation();var n={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};be(this.getSelected(),n),t.dragMoveLocation=e.lngLat},_e.onTouchEnd=_e.onMouseUp=function(t,e){var n=this;if(t.dragMoving)this.fireUpdate();else if(t.boxSelecting){var o=[t.boxSelectStartLocation,Bt(e.originalEvent,this.map.getContainer())],r=this.featuresAt(null,o,"click"),i=this.getUniqueIds(r).filter((function(t){return!n.isSelected(t)}));i.length&&(this.select(i),i.forEach((function(t){return n.doRender(t)})),this.updateUIClasses({mouse:S}))}this.stopExtendedInteractions(t)},_e.toDisplayFeatures=function(t,e,n){e.properties.active=this.isSelected(e.properties.id)?X:H,n(e),this.fireActionable(),e.properties.active===X&&e.geometry.type!==F&&Gt(e).forEach(n)},_e.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},_e.onCombineFeatures=function(){var t=this.getSelected();if(!(0===t.length||t.length<2)){for(var e=[],n=[],o=t[0].type.replace("Multi",""),r=0;r<t.length;r++){var i=t[r];if(i.type.replace("Multi","")!==o)return;i.type.includes("Multi")?i.getCoordinates().forEach((function(t){e.push(t)})):e.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){var a=this.newFeature({type:I,properties:n[0].properties,geometry:{type:"Multi"+o,coordinates:e}});this.addFeature(a),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([a.id]),this.map.fire(z,{createdFeatures:[a.toGeoJSON()],deletedFeatures:n})}this.fireActionable()}},_e.onUncombineFeatures=function(){var t=this,e=this.getSelected();if(0!==e.length){for(var n=[],o=[],r=function(r){var i=e[r];t.isInstanceOf("MultiFeature",i)&&(i.getFeatures().forEach((function(e){t.addFeature(e),e.properties=i.properties,n.push(e.toGeoJSON()),t.select([e.id])})),t.deleteFeature(i.id,{silent:!0}),o.push(i.toGeoJSON()))},i=0;i<e.length;i++)r(i);n.length>1&&this.map.fire($,{createdFeatures:n,deletedFeatures:o}),this.fireActionable()}};var xe=Ot(K),Se=Ot(Z),Ce={fireUpdate:function(){this.map.fire(R,{action:W,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(t){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:t.selectedCoordPaths.length>0})},startDragging:function(t,e){this.map.dragPan.disable(),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},stopDragging:function(t){this.map.dragPan.enable(),t.dragMoving=!1,t.canDragMove=!1,t.dragMoveLocation=null},onVertex:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties,o=t.selectedCoordPaths.indexOf(n.coord_path);Dt(e)||-1!==o?Dt(e)&&-1===o&&t.selectedCoordPaths.push(n.coord_path):t.selectedCoordPaths=[n.coord_path];var r=this.pathsToCoordinates(t.featureId,t.selectedCoordPaths);this.setSelectedCoordinates(r)},onMidpoint:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties;t.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),t.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(t,e){return e.map((function(e){return{feature_id:t,coord_path:e}}))},onFeature:function(t,e){0===t.selectedCoordPaths.length?this.startDragging(t,e):this.stopDragging(t)},dragFeature:function(t,e,n){be(this.getSelected(),n),t.dragMoveLocation=e.lngLat},dragVertex:function(t,e,n){for(var o=t.selectedCoordPaths.map((function(e){return t.feature.getCoordinate(e)})),r=me(o.map((function(t){return{type:I,properties:{},geometry:{type:F,coordinates:t}}})),n),i=0;i<o.length;i++){var a=o[i];t.feature.updateCoordinate(t.selectedCoordPaths[i],a[0]+r.lng,a[1]+r.lat)}},clickNoTarget:function(){this.changeMode(D.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(D.SIMPLE_SELECT)},clickActiveFeature:function(t){t.selectedCoordPaths=[],this.clearSelectedCoordinates(),t.feature.changed()},onSetup:function(t){var e=t.featureId,n=this.getFeature(e);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===F)throw new TypeError("direct_select mode doesn't handle point features");var o={featureId:e,feature:n,dragMoveLocation:t.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:t.coordPath?[t.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(e,o.selectedCoordPaths)),this.setSelected(e),$t(this),this.setActionableState({trash:!0}),o},onStop:function(){zt(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(t,e,n){t.featureId===e.properties.id?(e.properties.active=X,n(e),Gt(e,{map:this.map,midpoints:!0,selectedPaths:t.selectedCoordPaths}).forEach(n)):(e.properties.active=H,n(e)),this.fireActionable(t)},onTrash:function(t){t.selectedCoordPaths.sort((function(t,e){return e.localeCompare(t,"en",{numeric:!0})})).forEach((function(e){return t.feature.removeCoordinate(e)})),this.fireUpdate(),t.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(t),!1===t.feature.isValid()&&(this.deleteFeature([t.featureId]),this.changeMode(D.SIMPLE_SELECT,{}))},onMouseMove:function(t,e){var n=Tt(e),o=xe(e),r=0===t.selectedCoordPaths.length;return n&&r||o&&!r?this.updateUIClasses({mouse:S}):this.updateUIClasses({mouse:M}),this.stopDragging(t),!0},onMouseOut:function(t){return t.dragMoving&&this.fireUpdate(),!0}};Ce.onTouchStart=Ce.onMouseDown=function(t,e){return xe(e)?this.onVertex(t,e):Tt(e)?this.onFeature(t,e):Se(e)?this.onMidpoint(t,e):void 0},Ce.onDrag=function(t,e){if(!0===t.canDragMove){t.dragMoving=!0,e.originalEvent.stopPropagation();var n={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};t.selectedCoordPaths.length>0?this.dragVertex(t,e,n):this.dragFeature(t,e,n),t.dragMoveLocation=e.lngLat}},Ce.onClick=function(t,e){return At(e)?this.clickNoTarget(t,e):Tt(e)?this.clickActiveFeature(t,e):kt(e)?this.clickInactive(t,e):void this.stopDragging(t)},Ce.onTap=function(t,e){return At(e)?this.clickNoTarget(t,e):Tt(e)?this.clickActiveFeature(t,e):kt(e)?this.clickInactive(t,e):void 0},Ce.onTouchEnd=Ce.onMouseUp=function(t){t.dragMoving&&this.fireUpdate(),this.stopDragging(t)};var Ee={};function Me(t,e){return!!t.lngLat&&(t.lngLat.lng===e[0]&&t.lngLat.lat===e[1])}Ee.onSetup=function(){var t=this.newFeature({type:I,properties:{},geometry:{type:F,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:x}),this.activateUIButton(w.POINT),this.setActionableState({trash:!0}),{point:t}},Ee.stopDrawingAndRemove=function(t){this.deleteFeature([t.point.id],{silent:!0}),this.changeMode(D.SIMPLE_SELECT)},Ee.onTap=Ee.onClick=function(t,e){this.updateUIClasses({mouse:S}),t.point.updateCoordinate("",e.lngLat.lng,e.lngLat.lat),this.map.fire(N,{features:[t.point.toGeoJSON()]}),this.changeMode(D.SIMPLE_SELECT,{featureIds:[t.point.id]})},Ee.onStop=function(t){this.activateUIButton(),t.point.getCoordinate().length||this.deleteFeature([t.point.id],{silent:!0})},Ee.toDisplayFeatures=function(t,e,n){var o=e.properties.id===t.point.id;if(e.properties.active=o?X:H,!o)return n(e)},Ee.onTrash=Ee.stopDrawingAndRemove,Ee.onKeyUp=function(t,e){if(Nt(e)||Ut(e))return this.stopDrawingAndRemove(t,e)};var we={onSetup:function(){var t=this.newFeature({type:I,properties:{},geometry:{type:L,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),$t(this),this.updateUIClasses({mouse:x}),this.activateUIButton(w.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&Me(e,t.polygon.coordinates[0][t.currentVertexPosition-1]))return this.changeMode(D.SIMPLE_SELECT,{featureIds:[t.polygon.id]});this.updateUIClasses({mouse:x}),t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),t.currentVertexPosition++,t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(D.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},onMouseMove:function(t,e){t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),jt(e)&&this.updateUIClasses({mouse:E})}};we.onTap=we.onClick=function(t,e){return jt(e)?this.clickOnVertex(t,e):this.clickAnywhere(t,e)},we.onKeyUp=function(t,e){Nt(e)?(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(D.SIMPLE_SELECT)):Ut(e)&&this.changeMode(D.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},we.onStop=function(t){this.updateUIClasses({mouse:M}),zt(this),this.activateUIButton(),void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+t.currentVertexPosition),t.polygon.isValid()?this.map.fire(N,{features:[t.polygon.toGeoJSON()]}):(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(D.SIMPLE_SELECT,{},{silent:!0})))},we.toDisplayFeatures=function(t,e,n){var o=e.properties.id===t.polygon.id;if(e.properties.active=o?X:H,!o)return n(e);if(0!==e.geometry.coordinates.length){var r=e.geometry.coordinates[0].length;if(!(r<3)){if(e.properties.meta=Y,n(Jt(t.polygon.id,e.geometry.coordinates[0][0],"0.0",!1)),r>3){var i=e.geometry.coordinates[0].length-3;n(Jt(t.polygon.id,e.geometry.coordinates[0][i],"0."+i,!1))}if(r<=4){var a=[[e.geometry.coordinates[0][0][0],e.geometry.coordinates[0][0][1]],[e.geometry.coordinates[0][1][0],e.geometry.coordinates[0][1][1]]];if(n({type:I,properties:e.properties,geometry:{coordinates:a,type:P}}),3===r)return}return n(e)}}},we.onTrash=function(t){this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(D.SIMPLE_SELECT)},we.onDeleteLastCoordinates=function(t){void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+(t.currentVertexPosition-1)),t.currentVertexPosition<=2?t.currentVertexPosition=0:t.currentVertexPosition-=1)};var Ie={onSetup:function(t){var e,n,o=(t=t||{}).featureId,r="forward";if(o){if(!(e=this.getFeature(o)))throw new Error("Could not find a feature with the provided featureId");var i=t.from;if(i&&"Feature"===i.type&&i.geometry&&"Point"===i.geometry.type&&(i=i.geometry),i&&"Point"===i.type&&i.coordinates&&2===i.coordinates.length&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");var a=e.coordinates.length-1;if(e.coordinates[a][0]===i[0]&&e.coordinates[a][1]===i[1])n=a+1,e.addCoordinate.apply(e,[n].concat(e.coordinates[a]));else{if(e.coordinates[0][0]!==i[0]||e.coordinates[0][1]!==i[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");r="backwards",n=0,e.addCoordinate.apply(e,[n].concat(e.coordinates[0]))}}else e=this.newFeature({type:I,properties:{},geometry:{type:P,coordinates:[]}}),n=0,this.addFeature(e);return this.clearSelectedFeatures(),$t(this),this.updateUIClasses({mouse:x}),this.activateUIButton(w.LINE),this.setActionableState({trash:!0}),{line:e,currentVertexPosition:n,direction:r}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&Me(e,t.line.coordinates[t.currentVertexPosition-1])||"backwards"===t.direction&&Me(e,t.line.coordinates[t.currentVertexPosition+1]))return this.changeMode(D.SIMPLE_SELECT,{featureIds:[t.line.id]});this.updateUIClasses({mouse:x}),t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),"forward"===t.direction?(t.currentVertexPosition++,t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)):t.line.addCoordinate(0,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(D.SIMPLE_SELECT,{featureIds:[t.line.id]})},onMouseMove:function(t,e){t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),jt(e)&&this.updateUIClasses({mouse:E})}};Ie.onTap=Ie.onClick=function(t,e){if(jt(e))return this.clickOnVertex(t,e);this.clickAnywhere(t,e)},Ie.onKeyUp=function(t,e){Ut(e)?this.changeMode(D.SIMPLE_SELECT,{featureIds:[t.line.id]}):Nt(e)&&(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(D.SIMPLE_SELECT))},Ie.onStop=function(t){zt(this),this.activateUIButton(),void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(""+t.currentVertexPosition),t.line.isValid()?this.map.fire(N,{features:[t.line.toGeoJSON()]}):(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(D.SIMPLE_SELECT,{},{silent:!0})))},Ie.onTrash=function(t){this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(D.SIMPLE_SELECT)},Ie.toDisplayFeatures=function(t,e,n){var o=e.properties.id===t.line.id;if(e.properties.active=o?X:H,!o)return n(e);e.geometry.coordinates.length<2||(e.properties.meta=Y,n(Jt(t.line.id,e.geometry.coordinates["forward"===t.direction?e.geometry.coordinates.length-2:1],""+("forward"===t.direction?e.geometry.coordinates.length-2:1),!1)),n(e))},Ie.onDeleteLastCoordinates=function(t){void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(t.currentVertexPosition-1),t.currentVertexPosition>=1&&(t.currentVertexPosition-=1))};var Le={simple_select:_e,direct_select:Ce,draw_point:Ee,draw_polygon:we,draw_line_string:Ie},Pe={defaultMode:D.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}],modes:Le,controls:{},userProperties:!1},Fe={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Oe={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function Te(t,e){return t.map((function(t){return t.source?t:It(t,{id:t.id+"."+e,source:"hot"===e?b:_})}))}var ke={exports:{}};!function(t,e){var n="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",u="[object Error]",c="[object Function]",l="[object Map]",d="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",g="[object Set]",y="[object String]",v="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",_="[object DataView]",x=/^\[object .+?Constructor\]$/,S=/^(?:0|[1-9]\d*)$/,C={};C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C[r]=C[i]=C[b]=C[a]=C[_]=C[s]=C[u]=C[c]=C[l]=C[d]=C[p]=C[h]=C[g]=C[y]=C[m]=!1;var E="object"==typeof global&&global&&global.Object===Object&&global,M="object"==typeof self&&self&&self.Object===Object&&self,w=E||M||Function("return this")(),I=e&&!e.nodeType&&e,L=I&&t&&!t.nodeType&&t,P=L&&L.exports===I,F=P&&E.process,O=function(){try{return F&&F.binding&&F.binding("util")}catch(t){}}(),T=O&&O.isTypedArray;function k(t,e){for(var n=-1,o=null==t?0:t.length;++n<o;)if(e(t[n],n,t))return!0;return!1}function A(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n}function j(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var D,N,U,R=Array.prototype,V=Function.prototype,B=Object.prototype,J=w["__core-js_shared__"],G=V.toString,z=B.hasOwnProperty,$=(D=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",q=B.toString,W=RegExp("^"+G.call(z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Y=P?w.Buffer:void 0,Z=w.Symbol,K=w.Uint8Array,X=B.propertyIsEnumerable,H=R.splice,Q=Z?Z.toStringTag:void 0,tt=Object.getOwnPropertySymbols,et=Y?Y.isBuffer:void 0,nt=(N=Object.keys,U=Object,function(t){return N(U(t))}),ot=Ot(w,"DataView"),rt=Ot(w,"Map"),it=Ot(w,"Promise"),at=Ot(w,"Set"),st=Ot(w,"WeakMap"),ut=Ot(Object,"create"),ct=jt(ot),lt=jt(rt),dt=jt(it),pt=jt(at),ft=jt(st),ht=Z?Z.prototype:void 0,gt=ht?ht.valueOf:void 0;function yt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function mt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function bt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new mt;++e<n;)this.add(t[e])}function _t(t){var e=this.__data__=new vt(t);this.size=e.size}function xt(t,e){var n=Ut(t),o=!n&&Nt(t),r=!n&&!o&&Rt(t),i=!n&&!o&&!r&&zt(t),a=n||o||r||i,s=a?function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o}(t.length,String):[],u=s.length;for(var c in t)!e&&!z.call(t,c)||a&&("length"==c||r&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||At(c,u))||s.push(c);return s}function St(t,e){for(var n=t.length;n--;)if(Dt(t[n][0],e))return n;return-1}function Ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Q&&Q in Object(t)?function(t){var e=z.call(t,Q),n=t[Q];try{t[Q]=void 0;var o=!0}catch(t){}var r=q.call(t);o&&(e?t[Q]=n:delete t[Q]);return r}(t):function(t){return q.call(t)}(t)}function Et(t){return Gt(t)&&Ct(t)==r}function Mt(t,e,n,o,c){return t===e||(null==t||null==e||!Gt(t)&&!Gt(e)?t!=t&&e!=e:function(t,e,n,o,c,f){var m=Ut(t),x=Ut(e),S=m?i:kt(t),C=x?i:kt(e),E=(S=S==r?p:S)==p,M=(C=C==r?p:C)==p,w=S==C;if(w&&Rt(t)){if(!Rt(e))return!1;m=!0,E=!1}if(w&&!E)return f||(f=new _t),m||zt(t)?Lt(t,e,n,o,c,f):function(t,e,n,o,r,i,c){switch(n){case _:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case b:return!(t.byteLength!=e.byteLength||!i(new K(t),new K(e)));case a:case s:case d:return Dt(+t,+e);case u:return t.name==e.name&&t.message==e.message;case h:case y:return t==e+"";case l:var p=A;case g:var f=1&o;if(p||(p=j),t.size!=e.size&&!f)return!1;var m=c.get(t);if(m)return m==e;o|=2,c.set(t,e);var x=Lt(p(t),p(e),o,r,i,c);return c.delete(t),x;case v:if(gt)return gt.call(t)==gt.call(e)}return!1}(t,e,S,n,o,c,f);if(!(1&n)){var I=E&&z.call(t,"__wrapped__"),L=M&&z.call(e,"__wrapped__");if(I||L){var P=I?t.value():t,F=L?e.value():e;return f||(f=new _t),c(P,F,n,o,f)}}if(!w)return!1;return f||(f=new _t),function(t,e,n,o,r,i){var a=1&n,s=Pt(t),u=s.length,c=Pt(e).length;if(u!=c&&!a)return!1;var l=u;for(;l--;){var d=s[l];if(!(a?d in e:z.call(e,d)))return!1}var p=i.get(t);if(p&&i.get(e))return p==e;var f=!0;i.set(t,e),i.set(e,t);var h=a;for(;++l<u;){var g=t[d=s[l]],y=e[d];if(o)var v=a?o(y,g,d,e,t,i):o(g,y,d,t,e,i);if(!(void 0===v?g===y||r(g,y,n,o,i):v)){f=!1;break}h||(h="constructor"==d)}if(f&&!h){var m=t.constructor,b=e.constructor;m==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof b&&b instanceof b||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,n,o,c,f)}(t,e,n,o,Mt,c))}function wt(t){return!(!Jt(t)||function(t){return!!$&&$ in t}(t))&&(Vt(t)?W:x).test(jt(t))}function It(t){if(n=(e=t)&&e.constructor,o="function"==typeof n&&n.prototype||B,e!==o)return nt(t);var e,n,o,r=[];for(var i in Object(t))z.call(t,i)&&"constructor"!=i&&r.push(i);return r}function Lt(t,e,n,o,r,i){var a=1&n,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var l=-1,d=!0,p=2&n?new bt:void 0;for(i.set(t,e),i.set(e,t);++l<s;){var f=t[l],h=e[l];if(o)var g=a?o(h,f,l,e,t,i):o(f,h,l,t,e,i);if(void 0!==g){if(g)continue;d=!1;break}if(p){if(!k(e,(function(t,e){if(a=e,!p.has(a)&&(f===t||r(f,t,n,o,i)))return p.push(e);var a}))){d=!1;break}}else if(f!==h&&!r(f,h,n,o,i)){d=!1;break}}return i.delete(t),i.delete(e),d}function Pt(t){return function(t,e,n){var o=e(t);return Ut(t)?o:function(t,e){for(var n=-1,o=e.length,r=t.length;++n<o;)t[r+n]=e[n];return t}(o,n(t))}(t,$t,Tt)}function Ft(t,e){var n,o,r=t.__data__;return("string"==(o=typeof(n=e))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function Ot(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return wt(n)?n:void 0}yt.prototype.clear=function(){this.__data__=ut?ut(null):{},this.size=0},yt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},yt.prototype.get=function(t){var e=this.__data__;if(ut){var o=e[t];return o===n?void 0:o}return z.call(e,t)?e[t]:void 0},yt.prototype.has=function(t){var e=this.__data__;return ut?void 0!==e[t]:z.call(e,t)},yt.prototype.set=function(t,e){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=ut&&void 0===e?n:e,this},vt.prototype.clear=function(){this.__data__=[],this.size=0},vt.prototype.delete=function(t){var e=this.__data__,n=St(e,t);return!(n<0)&&(n==e.length-1?e.pop():H.call(e,n,1),--this.size,!0)},vt.prototype.get=function(t){var e=this.__data__,n=St(e,t);return n<0?void 0:e[n][1]},vt.prototype.has=function(t){return St(this.__data__,t)>-1},vt.prototype.set=function(t,e){var n=this.__data__,o=St(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this},mt.prototype.clear=function(){this.size=0,this.__data__={hash:new yt,map:new(rt||vt),string:new yt}},mt.prototype.delete=function(t){var e=Ft(this,t).delete(t);return this.size-=e?1:0,e},mt.prototype.get=function(t){return Ft(this,t).get(t)},mt.prototype.has=function(t){return Ft(this,t).has(t)},mt.prototype.set=function(t,e){var n=Ft(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this},bt.prototype.add=bt.prototype.push=function(t){return this.__data__.set(t,n),this},bt.prototype.has=function(t){return this.__data__.has(t)},_t.prototype.clear=function(){this.__data__=new vt,this.size=0},_t.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},_t.prototype.get=function(t){return this.__data__.get(t)},_t.prototype.has=function(t){return this.__data__.has(t)},_t.prototype.set=function(t,e){var n=this.__data__;if(n instanceof vt){var o=n.__data__;if(!rt||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new mt(o)}return n.set(t,e),this.size=n.size,this};var Tt=tt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,o=null==t?0:t.length,r=0,i=[];++n<o;){var a=t[n];e(a,n,t)&&(i[r++]=a)}return i}(tt(t),(function(e){return X.call(t,e)})))}:function(){return[]},kt=Ct;function At(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||S.test(t))&&t>-1&&t%1==0&&t<e}function jt(t){if(null!=t){try{return G.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Dt(t,e){return t===e||t!=t&&e!=e}(ot&&kt(new ot(new ArrayBuffer(1)))!=_||rt&&kt(new rt)!=l||it&&kt(it.resolve())!=f||at&&kt(new at)!=g||st&&kt(new st)!=m)&&(kt=function(t){var e=Ct(t),n=e==p?t.constructor:void 0,o=n?jt(n):"";if(o)switch(o){case ct:return _;case lt:return l;case dt:return f;case pt:return g;case ft:return m}return e});var Nt=Et(function(){return arguments}())?Et:function(t){return Gt(t)&&z.call(t,"callee")&&!X.call(t,"callee")},Ut=Array.isArray;var Rt=et||function(){return!1};function Vt(t){if(!Jt(t))return!1;var e=Ct(t);return e==c||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Bt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}function Jt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Gt(t){return null!=t&&"object"==typeof t}var zt=T?function(t){return function(e){return t(e)}}(T):function(t){return Gt(t)&&Bt(t.length)&&!!C[Ct(t)]};function $t(t){return null!=(e=t)&&Bt(e.length)&&!Vt(e)?xt(t):It(t);var e}t.exports=function(t,e){return Mt(t,e)}}(ke,ke.exports);var Ae=ke.exports;var je={Polygon:gt,LineString:ht,Point:ft,MultiPolygon:mt,MultiLineString:mt,MultiPoint:mt};function De(t,e){return e.modes=D,e.getFeatureIdsAt=function(e){return rt.click({point:e},null,t).map((function(t){return t.properties.id}))},e.getSelectedIds=function(){return t.store.getSelectedIds()},e.getSelected=function(){return{type:O,features:t.store.getSelectedIds().map((function(e){return t.store.get(e)})).map((function(t){return t.toGeoJSON()}))}},e.getSelectedPoints=function(){return{type:O,features:t.store.getSelectedCoordinates().map((function(t){return{type:I,properties:{},geometry:{type:F,coordinates:t.coordinates}}}))}},e.set=function(n){if(void 0===n.type||n.type!==O||!Array.isArray(n.features))throw new Error("Invalid FeatureCollection");var o=t.store.createRenderBatch(),r=t.store.getAllIds().slice(),i=e.add(n),a=new nt(i);return(r=r.filter((function(t){return!a.has(t)}))).length&&e.delete(r),o(),i},e.add=function(e){var n=JSON.parse(JSON.stringify(Wt(e))).features.map((function(e){if(e.id=e.id||lt.exports(),null===e.geometry)throw new Error("Invalid geometry: null");if(void 0===t.store.get(e.id)||t.store.get(e.id).type!==e.geometry.type){var n=je[e.geometry.type];if(void 0===n)throw new Error("Invalid geometry type: "+e.geometry.type+".");var o=new n(t,e);t.store.add(o)}else{var r=t.store.get(e.id);r.properties=e.properties,Ae(r.getCoordinates(),e.geometry.coordinates)||r.incomingCoords(e.geometry.coordinates)}return e.id}));return t.store.render(),n},e.get=function(e){var n=t.store.get(e);if(n)return n.toGeoJSON()},e.getAll=function(){return{type:O,features:t.store.getAll().map((function(t){return t.toGeoJSON()}))}},e.delete=function(n){return t.store.delete(n,{silent:!0}),e.getMode()!==D.DIRECT_SELECT||t.store.getSelectedIds().length?t.store.render():t.events.changeMode(D.SIMPLE_SELECT,void 0,{silent:!0}),e},e.deleteAll=function(){return t.store.delete(t.store.getAllIds(),{silent:!0}),e.getMode()===D.DIRECT_SELECT?t.events.changeMode(D.SIMPLE_SELECT,void 0,{silent:!0}):t.store.render(),e},e.changeMode=function(n,o){return void 0===o&&(o={}),n===D.SIMPLE_SELECT&&e.getMode()===D.SIMPLE_SELECT?(r=o.featureIds||[],i=t.store.getSelectedIds(),r.length===i.length&&JSON.stringify(r.map((function(t){return t})).sort())===JSON.stringify(i.map((function(t){return t})).sort())||(t.store.setSelected(o.featureIds,{silent:!0}),t.store.render()),e):(n===D.DIRECT_SELECT&&e.getMode()===D.DIRECT_SELECT&&o.featureId===t.store.getSelectedIds()[0]||t.events.changeMode(n,o,{silent:!0}),e);var r,i},e.getMode=function(){return t.events.getMode()},e.trash=function(){return t.events.trash({silent:!0}),e},e.combineFeatures=function(){return t.events.combineFeatures({silent:!0}),e},e.uncombineFeatures=function(){return t.events.uncombineFeatures({silent:!0}),e},e.setFeatureProperty=function(n,o,r){return t.store.setFeatureProperty(n,o,r),e},e}var Ne=function(t,e){var n={options:t=function(t){void 0===t&&(t={});var e=It(t);return t.controls||(e.controls={}),!1===t.displayControlsDefault?e.controls=It(Oe,t.controls):e.controls=It(Fe,t.controls),(e=It(Pe,e)).styles=Te(e.styles,"cold").concat(Te(e.styles,"hot")),e}(t)};e=De(n,e),n.api=e;var o=Ft(n);return e.onAdd=o.onAdd,e.onRemove=o.onRemove,e.types=w,e.options=t,e};function Ue(t){Ne(t,this)}return Ue.modes=Le,Ue}));
|
|
2
|
+
//# sourceMappingURL=mapbox-gl-draw.js.map
|