var t,e;var i="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:global;!function(a,n,s){function o(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}L.drawVersion="1.0.4",L.Draw={},L.drawLocal={draw:{toolbar:{actions:{title:"Cancel drawing",text:"Cancel"},finish:{title:"Finish drawing",text:"Finish"},undo:{title:"Delete last point drawn",text:"Delete last point"},buttons:{polyline:"Draw a polyline",polygon:"Draw a polygon",rectangle:"Draw a rectangle",circle:"Draw a circle",marker:"Draw a marker",circlemarker:"Draw a circlemarker"}},handlers:{circle:{tooltip:{start:"Click and drag to draw circle."},radius:"Radius"},circlemarker:{tooltip:{start:"Click map to place circle marker."}},marker:{tooltip:{start:"Click map to place marker."}},polygon:{tooltip:{start:"Click to start drawing shape.",cont:"Click to continue drawing shape.",end:"Click first point to close this shape."}},polyline:{error:"Error: shape edges cannot cross!",tooltip:{start:"Click to start drawing line.",cont:"Click to continue drawing line.",end:"Click last point to finish line."}},rectangle:{tooltip:{start:"Click and drag to draw rectangle."}},simpleshape:{tooltip:{end:"Release mouse to finish drawing."}}}},edit:{toolbar:{actions:{save:{title:"Save changes",text:"Save"},cancel:{title:"Cancel editing, discards all changes",text:"Cancel"},clearAll:{title:"Clear all layers",text:"Clear All"}},buttons:{edit:"Edit layers",editDisabled:"No layers to edit",remove:"Delete layers",removeDisabled:"No layers to delete"}},handlers:{edit:{tooltip:{text:"Drag handles or markers to edit features.",subtext:"Click cancel to undo changes."}},remove:{tooltip:{text:"Click on a feature to remove."}}}}},L.Draw.Event={},L.Draw.Event.CREATED="draw:created",L.Draw.Event.EDITED="draw:edited",L.Draw.Event.DELETED="draw:deleted",L.Draw.Event.DRAWSTART="draw:drawstart",L.Draw.Event.DRAWSTOP="draw:drawstop",L.Draw.Event.DRAWVERTEX="draw:drawvertex",L.Draw.Event.EDITSTART="draw:editstart",L.Draw.Event.EDITMOVE="draw:editmove",L.Draw.Event.EDITRESIZE="draw:editresize",L.Draw.Event.EDITVERTEX="draw:editvertex",L.Draw.Event.EDITSTOP="draw:editstop",L.Draw.Event.DELETESTART="draw:deletestart",L.Draw.Event.DELETESTOP="draw:deletestop",L.Draw.Event.TOOLBAROPENED="draw:toolbaropened",L.Draw.Event.TOOLBARCLOSED="draw:toolbarclosed",L.Draw.Event.MARKERCONTEXT="draw:markercontext",L.Draw=L.Draw||{},L.Draw.Feature=L.Handler.extend({initialize:function(t,e){(this||i)._map=t,(this||i)._container=t._container,(this||i)._overlayPane=t._panes.overlayPane,(this||i)._popupPane=t._panes.popupPane,e&&e.shapeOptions&&(e.shapeOptions=L.Util.extend({},(this||i).options.shapeOptions,e.shapeOptions)),L.setOptions(this||i,e);var a=L.version.split(".");1===parseInt(a[0],10)&&parseInt(a[1],10)>=2?L.Draw.Feature.include(L.Evented.prototype):L.Draw.Feature.include(L.Mixin.Events)},enable:function(){(this||i)._enabled||(L.Handler.prototype.enable.call(this||i),this.fire("enabled",{handler:(this||i).type}),(this||i)._map.fire(L.Draw.Event.DRAWSTART,{layerType:(this||i).type}))},disable:function(){(this||i)._enabled&&(L.Handler.prototype.disable.call(this||i),(this||i)._map.fire(L.Draw.Event.DRAWSTOP,{layerType:(this||i).type}),this.fire("disabled",{handler:(this||i).type}))},addHooks:function(){var t=(this||i)._map;t&&(L.DomUtil.disableTextSelection(),t.getContainer().focus(),(this||i)._tooltip=new L.Draw.Tooltip((this||i)._map),L.DomEvent.on((this||i)._container,"keyup",(this||i)._cancelDrawing,this||i))},removeHooks:function(){(this||i)._map&&(L.DomUtil.enableTextSelection(),(this||i)._tooltip.dispose(),(this||i)._tooltip=null,L.DomEvent.off((this||i)._container,"keyup",(this||i)._cancelDrawing,this||i))},setOptions:function(t){L.setOptions(this||i,t)},_fireCreatedEvent:function(t){(this||i)._map.fire(L.Draw.Event.CREATED,{layer:t,layerType:(this||i).type})},_cancelDrawing:function(t){27===t.keyCode&&((this||i)._map.fire("draw:canceled",{layerType:(this||i).type}),this.disable())}}),L.Draw.Polyline=L.Draw.Feature.extend({statics:{TYPE:"polyline"},Poly:L.Polyline,options:{allowIntersection:!0,repeatMode:!1,drawError:{color:"#b00b00",timeout:2500},icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),touchIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-touch-icon"}),guidelineDistance:20,maxGuideLineLength:4e3,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!1,clickable:!0},metric:!0,feet:!0,nautic:!1,showLength:!0,zIndexOffset:2e3,factor:1,maxPoints:0},initialize:function(t,e){L.Browser.touch&&((this||i).options.icon=(this||i).options.touchIcon),(this||i).options.drawError.message=L.drawLocal.draw.handlers.polyline.error,e&&e.drawError&&(e.drawError=L.Util.extend({},(this||i).options.drawError,e.drawError)),(this||i).type=L.Draw.Polyline.TYPE,L.Draw.Feature.prototype.initialize.call(this||i,t,e)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this||i),(this||i)._map&&((this||i)._markers=[],(this||i)._markerGroup=new L.LayerGroup,(this||i)._map.addLayer((this||i)._markerGroup),(this||i)._poly=new L.Polyline([],(this||i).options.shapeOptions),(this||i)._tooltip.updateContent(this._getTooltipText()),(this||i)._mouseMarker||((this||i)._mouseMarker=L.marker((this||i)._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:(this||i).options.zIndexOffset})),(this||i)._mouseMarker.on("mouseout",(this||i)._onMouseOut,this||i).on("mousemove",(this||i)._onMouseMove,this||i).on("mousedown",(this||i)._onMouseDown,this||i).on("mouseup",(this||i)._onMouseUp,this||i).addTo((this||i)._map),(this||i)._map.on("mouseup",(this||i)._onMouseUp,this||i).on("mousemove",(this||i)._onMouseMove,this||i).on("zoomlevelschange",(this||i)._onZoomEnd,this||i).on("touchstart",(this||i)._onTouch,this||i).on("zoomend",(this||i)._onZoomEnd,this||i))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this||i),this._clearHideErrorTimeout(),this._cleanUpShape(),(this||i)._map.removeLayer((this||i)._markerGroup),delete(this||i)._markerGroup,delete(this||i)._markers,(this||i)._map.removeLayer((this||i)._poly),delete(this||i)._poly,(this||i)._mouseMarker.off("mousedown",(this||i)._onMouseDown,this||i).off("mouseout",(this||i)._onMouseOut,this||i).off("mouseup",(this||i)._onMouseUp,this||i).off("mousemove",(this||i)._onMouseMove,this||i),(this||i)._map.removeLayer((this||i)._mouseMarker),delete(this||i)._mouseMarker,this._clearGuides(),(this||i)._map.off("mouseup",(this||i)._onMouseUp,this||i).off("mousemove",(this||i)._onMouseMove,this||i).off("zoomlevelschange",(this||i)._onZoomEnd,this||i).off("zoomend",(this||i)._onZoomEnd,this||i).off("touchstart",(this||i)._onTouch,this||i).off("click",(this||i)._onTouch,this||i)},deleteLastVertex:function(){if(!((this||i)._markers.length<=1)){var t=(this||i)._markers.pop(),e=(this||i)._poly,a=e.getLatLngs(),n=a.splice(-1,1)[0];(this||i)._poly.setLatLngs(a),(this||i)._markerGroup.removeLayer(t),e.getLatLngs().length<2&&(this||i)._map.removeLayer(e),this._vertexChanged(n,!1)}},addVertex:function(t){(this||i)._markers.length>=2&&!(this||i).options.allowIntersection&&(this||i)._poly.newLatLngIntersects(t)?this._showErrorTooltip():((this||i)._errorShown&&this._hideErrorTooltip(),(this||i)._markers.push(this._createMarker(t)),(this||i)._poly.addLatLng(t),2===(this||i)._poly.getLatLngs().length&&(this||i)._map.addLayer((this||i)._poly),this._vertexChanged(t,!0))},completeShape:function(){(this||i)._markers.length<=1||!this._shapeIsValid()||(this._fireCreatedEvent(),this.disable(),(this||i).options.repeatMode&&this.enable())},_finishShape:function(){var t=(this||i)._poly._defaultShape?(this||i)._poly._defaultShape():(this||i)._poly.getLatLngs(),e=(this||i)._poly.newLatLngIntersects(t[t.length-1]);!(this||i).options.allowIntersection&&e||!this._shapeIsValid()?this._showErrorTooltip():(this._fireCreatedEvent(),this.disable(),(this||i).options.repeatMode&&this.enable())},_shapeIsValid:function(){return!0},_onZoomEnd:function(){null!==(this||i)._markers&&this._updateGuide()},_onMouseMove:function(t){var e=(this||i)._map.mouseEventToLayerPoint(t.originalEvent),a=(this||i)._map.layerPointToLatLng(e);(this||i)._currentLatLng=a,this._updateTooltip(a),this._updateGuide(e),(this||i)._mouseMarker.setLatLng(a),L.DomEvent.preventDefault(t.originalEvent)},_vertexChanged:function(t,e){(this||i)._map.fire(L.Draw.Event.DRAWVERTEX,{layers:(this||i)._markerGroup}),this._updateFinishHandler(),this._updateRunningMeasure(t,e),this._clearGuides(),this._updateTooltip()},_onMouseDown:function(t){if(!(this||i)._clickHandled&&!(this||i)._touchHandled&&!(this||i)._disableMarkers){this._onMouseMove(t),(this||i)._clickHandled=!0,this._disableNewMarkers();var e=t.originalEvent,a=e.clientX,n=e.clientY;(this||i)._startPoint.call(this||i,a,n)}},_startPoint:function(t,e){(this||i)._mouseDownOrigin=L.point(t,e)},_onMouseUp:function(t){var e=t.originalEvent,a=e.clientX,n=e.clientY;(this||i)._endPoint.call(this||i,a,n,t),(this||i)._clickHandled=null},_endPoint:function(t,e,n){if((this||i)._mouseDownOrigin){var s=L.point(t,e).distanceTo((this||i)._mouseDownOrigin),r=this._calculateFinishDistance(n.latlng);(this||i).options.maxPoints>1&&(this||i).options.maxPoints==(this||i)._markers.length+1?(this.addVertex(n.latlng),this._finishShape()):r<10&&L.Browser.touch?this._finishShape():Math.abs(s)<9*(a.devicePixelRatio||1)&&this.addVertex(n.latlng),this._enableNewMarkers()}(this||i)._mouseDownOrigin=null},_onTouch:function(t){var e,a,n=t.originalEvent;!n.touches||!n.touches[0]||(this||i)._clickHandled||(this||i)._touchHandled||(this||i)._disableMarkers||(e=n.touches[0].clientX,a=n.touches[0].clientY,this._disableNewMarkers(),(this||i)._touchHandled=!0,(this||i)._startPoint.call(this||i,e,a),(this||i)._endPoint.call(this||i,e,a,t),(this||i)._touchHandled=null),(this||i)._clickHandled=null},_onMouseOut:function(){(this||i)._tooltip&&(this||i)._tooltip._onMouseOut.call((this||i)._tooltip)},_calculateFinishDistance:function(t){var e;if((this||i)._markers.length>0){var a;if((this||i).type===L.Draw.Polyline.TYPE)a=(this||i)._markers[(this||i)._markers.length-1];else{if((this||i).type!==L.Draw.Polygon.TYPE)return 1/0;a=(this||i)._markers[0]}var n=(this||i)._map.latLngToContainerPoint(a.getLatLng()),s=new L.Marker(t,{icon:(this||i).options.icon,zIndexOffset:2*(this||i).options.zIndexOffset}),r=(this||i)._map.latLngToContainerPoint(s.getLatLng());e=n.distanceTo(r)}else e=1/0;return e},_updateFinishHandler:function(){var t=(this||i)._markers.length;t>1&&(this||i)._markers[t-1].on("click",(this||i)._finishShape,this||i),t>2&&(this||i)._markers[t-2].off("click",(this||i)._finishShape,this||i)},_createMarker:function(t){var e=new L.Marker(t,{icon:(this||i).options.icon,zIndexOffset:2*(this||i).options.zIndexOffset});return(this||i)._markerGroup.addLayer(e),e},_updateGuide:function(t){var e=(this||i)._markers?(this||i)._markers.length:0;e>0&&(t=t||(this||i)._map.latLngToLayerPoint((this||i)._currentLatLng),this._clearGuides(),this._drawGuide((this||i)._map.latLngToLayerPoint((this||i)._markers[e-1].getLatLng()),t))},_updateTooltip:function(t){var e=this._getTooltipText();t&&(this||i)._tooltip.updatePosition(t),(this||i)._errorShown||(this||i)._tooltip.updateContent(e)},_drawGuide:function(t,e){var a,n,s,r=Math.floor(Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))),l=(this||i).options.guidelineDistance,h=(this||i).options.maxGuideLineLength,d=r>h?r-h:l;for((this||i)._guidesContainer||((this||i)._guidesContainer=L.DomUtil.create("div","leaflet-draw-guides",(this||i)._overlayPane));d1&&(this||i)._markers[(this||i)._markers.length-1].off("click",(this||i)._finishShape,this||i)},_fireCreatedEvent:function(){var t=new(this||i).Poly((this||i)._poly.getLatLngs(),(this||i).options.shapeOptions);L.Draw.Feature.prototype._fireCreatedEvent.call(this||i,t)}}),L.Draw.Polygon=L.Draw.Polyline.extend({statics:{TYPE:"polygon"},Poly:L.Polygon,options:{showArea:!1,showLength:!1,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},metric:!0,feet:!0,nautic:!1,precision:{}},initialize:function(t,e){L.Draw.Polyline.prototype.initialize.call(this||i,t,e),(this||i).type=L.Draw.Polygon.TYPE},_updateFinishHandler:function(){var t=(this||i)._markers.length;1===t&&(this||i)._markers[0].on("click",(this||i)._finishShape,this||i),t>2&&((this||i)._markers[t-1].on("dblclick",(this||i)._finishShape,this||i),t>3&&(this||i)._markers[t-2].off("dblclick",(this||i)._finishShape,this||i))},_getTooltipText:function(){var t,e;return 0===(this||i)._markers.length?t=L.drawLocal.draw.handlers.polygon.tooltip.start:(this||i)._markers.length<3?(t=L.drawLocal.draw.handlers.polygon.tooltip.cont,e=this._getMeasurementString()):(t=L.drawLocal.draw.handlers.polygon.tooltip.end,e=this._getMeasurementString()),{text:t,subtext:e}},_getMeasurementString:function(){var t=(this||i)._area,e="";return t||(this||i).options.showLength?((this||i).options.showLength&&(e=L.Draw.Polyline.prototype._getMeasurementString.call(this||i)),t&&(e+="
"+L.GeometryUtil.readableArea(t,(this||i).options.metric,(this||i).options.precision)),e):null},_shapeIsValid:function(){return(this||i)._markers.length>=3},_vertexChanged:function(t,e){var a;!(this||i).options.allowIntersection&&(this||i).options.showArea&&(a=(this||i)._poly.getLatLngs(),(this||i)._area=L.GeometryUtil.geodesicArea(a)),L.Draw.Polyline.prototype._vertexChanged.call(this||i,t,e)},_cleanUpShape:function(){var t=(this||i)._markers.length;t>0&&((this||i)._markers[0].off("click",(this||i)._finishShape,this||i),t>2&&(this||i)._markers[t-1].off("dblclick",(this||i)._finishShape,this||i))}}),L.SimpleShape={},L.Draw.SimpleShape=L.Draw.Feature.extend({options:{repeatMode:!1},initialize:function(t,e){(this||i)._endLabelText=L.drawLocal.draw.handlers.simpleshape.tooltip.end,L.Draw.Feature.prototype.initialize.call(this||i,t,e)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this||i),(this||i)._map&&((this||i)._mapDraggable=(this||i)._map.dragging.enabled(),(this||i)._mapDraggable&&(this||i)._map.dragging.disable(),(this||i)._container.style.cursor="crosshair",(this||i)._tooltip.updateContent({text:(this||i)._initialLabelText}),(this||i)._map.on("mousedown",(this||i)._onMouseDown,this||i).on("mousemove",(this||i)._onMouseMove,this||i).on("touchstart",(this||i)._onMouseDown,this||i).on("touchmove",(this||i)._onMouseMove,this||i),n.addEventListener("touchstart",L.DomEvent.preventDefault,{passive:!1}))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this||i),(this||i)._map&&((this||i)._mapDraggable&&(this||i)._map.dragging.enable(),(this||i)._container.style.cursor="",(this||i)._map.off("mousedown",(this||i)._onMouseDown,this||i).off("mousemove",(this||i)._onMouseMove,this||i).off("touchstart",(this||i)._onMouseDown,this||i).off("touchmove",(this||i)._onMouseMove,this||i),L.DomEvent.off(n,"mouseup",(this||i)._onMouseUp,this||i),L.DomEvent.off(n,"touchend",(this||i)._onMouseUp,this||i),n.removeEventListener("touchstart",L.DomEvent.preventDefault),(this||i)._shape&&((this||i)._map.removeLayer((this||i)._shape),delete(this||i)._shape)),(this||i)._isDrawing=!1},_getTooltipText:function(){return{text:(this||i)._endLabelText}},_onMouseDown:function(t){(this||i)._isDrawing=!0,(this||i)._startLatLng=t.latlng,L.DomEvent.on(n,"mouseup",(this||i)._onMouseUp,this||i).on(n,"touchend",(this||i)._onMouseUp,this||i).preventDefault(t.originalEvent)},_onMouseMove:function(t){var e=t.latlng;(this||i)._tooltip.updatePosition(e),(this||i)._isDrawing&&((this||i)._tooltip.updateContent(this._getTooltipText()),this._drawShape(e))},_onMouseUp:function(){(this||i)._shape&&this._fireCreatedEvent(),this.disable(),(this||i).options.repeatMode&&this.enable()}}),L.Draw.Rectangle=L.Draw.SimpleShape.extend({statics:{TYPE:"rectangle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},showArea:!0,metric:!0},initialize:function(t,e){(this||i).type=L.Draw.Rectangle.TYPE,(this||i)._initialLabelText=L.drawLocal.draw.handlers.rectangle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this||i,t,e)},disable:function(){(this||i)._enabled&&((this||i)._isCurrentlyTwoClickDrawing=!1,L.Draw.SimpleShape.prototype.disable.call(this||i))},_onMouseUp:function(t){(this||i)._shape||(this||i)._isCurrentlyTwoClickDrawing?(this||i)._isCurrentlyTwoClickDrawing&&!o(t.target,"leaflet-pane")||L.Draw.SimpleShape.prototype._onMouseUp.call(this||i):(this||i)._isCurrentlyTwoClickDrawing=!0},_drawShape:function(t){(this||i)._shape?(this||i)._shape.setBounds(new L.LatLngBounds((this||i)._startLatLng,t)):((this||i)._shape=new L.Rectangle(new L.LatLngBounds((this||i)._startLatLng,t),(this||i).options.shapeOptions),(this||i)._map.addLayer((this||i)._shape))},_fireCreatedEvent:function(){var t=new L.Rectangle((this||i)._shape.getBounds(),(this||i).options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this||i,t)},_getTooltipText:function(){var t,e,a,n=L.Draw.SimpleShape.prototype._getTooltipText.call(this||i),s=(this||i)._shape,r=(this||i).options.showArea;return s&&(t=(this||i)._shape._defaultShape?(this||i)._shape._defaultShape():(this||i)._shape.getLatLngs(),e=L.GeometryUtil.geodesicArea(t),a=r?L.GeometryUtil.readableArea(e,(this||i).options.metric):""),{text:n.text,subtext:a}}}),L.Draw.Marker=L.Draw.Feature.extend({statics:{TYPE:"marker"},options:{icon:new L.Icon.Default,repeatMode:!1,zIndexOffset:2e3},initialize:function(t,e){(this||i).type=L.Draw.Marker.TYPE,(this||i)._initialLabelText=L.drawLocal.draw.handlers.marker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this||i,t,e)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this||i),(this||i)._map&&((this||i)._tooltip.updateContent({text:(this||i)._initialLabelText}),(this||i)._mouseMarker||((this||i)._mouseMarker=L.marker((this||i)._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:(this||i).options.zIndexOffset})),(this||i)._mouseMarker.on("click",(this||i)._onClick,this||i).addTo((this||i)._map),(this||i)._map.on("mousemove",(this||i)._onMouseMove,this||i),(this||i)._map.on("click",(this||i)._onTouch,this||i))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this||i),(this||i)._map&&((this||i)._map.off("click",(this||i)._onClick,this||i).off("click",(this||i)._onTouch,this||i),(this||i)._marker&&((this||i)._marker.off("click",(this||i)._onClick,this||i),(this||i)._map.removeLayer((this||i)._marker),delete(this||i)._marker),(this||i)._mouseMarker.off("click",(this||i)._onClick,this||i),(this||i)._map.removeLayer((this||i)._mouseMarker),delete(this||i)._mouseMarker,(this||i)._map.off("mousemove",(this||i)._onMouseMove,this||i))},_onMouseMove:function(t){var e=t.latlng;(this||i)._tooltip.updatePosition(e),(this||i)._mouseMarker.setLatLng(e),(this||i)._marker?(e=(this||i)._mouseMarker.getLatLng(),(this||i)._marker.setLatLng(e)):((this||i)._marker=this._createMarker(e),(this||i)._marker.on("click",(this||i)._onClick,this||i),(this||i)._map.on("click",(this||i)._onClick,this||i).addLayer((this||i)._marker))},_createMarker:function(t){return new L.Marker(t,{icon:(this||i).options.icon,zIndexOffset:(this||i).options.zIndexOffset})},_onClick:function(){this._fireCreatedEvent(),this.disable(),(this||i).options.repeatMode&&this.enable()},_onTouch:function(t){this._onMouseMove(t),this._onClick()},_fireCreatedEvent:function(){var t=new L.Marker.Touch((this||i)._marker.getLatLng(),{icon:(this||i).options.icon});L.Draw.Feature.prototype._fireCreatedEvent.call(this||i,t)}}),L.Draw.CircleMarker=L.Draw.Marker.extend({statics:{TYPE:"circlemarker"},options:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0,zIndexOffset:2e3},initialize:function(t,e){(this||i).type=L.Draw.CircleMarker.TYPE,(this||i)._initialLabelText=L.drawLocal.draw.handlers.circlemarker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this||i,t,e)},_fireCreatedEvent:function(){var t=new L.CircleMarker((this||i)._marker.getLatLng(),(this||i).options);L.Draw.Feature.prototype._fireCreatedEvent.call(this||i,t)},_createMarker:function(t){return new L.CircleMarker(t,(this||i).options)}}),L.Draw.Circle=L.Draw.SimpleShape.extend({statics:{TYPE:"circle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},showRadius:!0,metric:!0,feet:!0,nautic:!1},initialize:function(t,e){(this||i).type=L.Draw.Circle.TYPE,(this||i)._initialLabelText=L.drawLocal.draw.handlers.circle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this||i,t,e)},_drawShape:function(t){if(L.GeometryUtil.isVersion07x())var e=(this||i)._startLatLng.distanceTo(t);else var e=(this||i)._map.distance((this||i)._startLatLng,t);(this||i)._shape?(this||i)._shape.setRadius(e):((this||i)._shape=new L.Circle((this||i)._startLatLng,e,(this||i).options.shapeOptions),(this||i)._map.addLayer((this||i)._shape))},_fireCreatedEvent:function(){var t=new L.Circle((this||i)._startLatLng,(this||i)._shape.getRadius(),(this||i).options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this||i,t)},_onMouseMove:function(t){var e,a=t.latlng,n=(this||i).options.showRadius,s=(this||i).options.metric;if((this||i)._tooltip.updatePosition(a),(this||i)._isDrawing){this._drawShape(a),e=(this||i)._shape.getRadius().toFixed(1);var r="";n&&(r=L.drawLocal.draw.handlers.circle.radius+": "+L.GeometryUtil.readableDistance(e,s,(this||i).options.feet,(this||i).options.nautic)),(this||i)._tooltip.updateContent({text:(this||i)._endLabelText,subtext:r})}}}),L.Edit=L.Edit||{},L.Edit.Marker=L.Handler.extend({initialize:function(t,e){(this||i)._marker=t,L.setOptions(this||i,e)},addHooks:function(){var t=(this||i)._marker;t.dragging.enable(),t.on("dragend",(this||i)._onDragEnd,t),this._toggleMarkerHighlight()},removeHooks:function(){var t=(this||i)._marker;t.dragging.disable(),t.off("dragend",(this||i)._onDragEnd,t),this._toggleMarkerHighlight()},_onDragEnd:function(t){var e=t.target;e.edited=!0,(this||i)._map.fire(L.Draw.Event.EDITMOVE,{layer:e})},_toggleMarkerHighlight:function(){var t=(this||i)._marker._icon;t&&(t.style.display="none",L.DomUtil.hasClass(t,"leaflet-edit-marker-selected")?(L.DomUtil.removeClass(t,"leaflet-edit-marker-selected"),this._offsetMarker(t,-4)):(L.DomUtil.addClass(t,"leaflet-edit-marker-selected"),this._offsetMarker(t,4)),t.style.display="")},_offsetMarker:function(t,e){var i=parseInt(t.style.marginTop,10)-e,a=parseInt(t.style.marginLeft,10)-e;t.style.marginTop=i+"px",t.style.marginLeft=a+"px"}}),L.Marker.addInitHook((function(){L.Edit.Marker&&((this||i).editing=new L.Edit.Marker(this||i),(this||i).options.editable&&(this||i).editing.enable())})),L.Edit=L.Edit||{},L.Edit.Poly=L.Handler.extend({initialize:function(t){(this||i).latlngs=[t._latlngs],t._holes&&((this||i).latlngs=(this||i).latlngs.concat(t._holes)),(this||i)._poly=t,(this||i)._poly.on("revert-edited",(this||i)._updateLatLngs,this||i)},_defaultShape:function(){return L.Polyline._flat?L.Polyline._flat((this||i)._poly._latlngs)?(this||i)._poly._latlngs:(this||i)._poly._latlngs[0]:(this||i)._poly._latlngs},_eachVertexHandler:function(t){for(var e=0;e<(this||i)._verticesHandlers.length;e++)t((this||i)._verticesHandlers[e])},addHooks:function(){this._initHandlers(),this._eachVertexHandler((function(t){t.addHooks()}))},removeHooks:function(){this._eachVertexHandler((function(t){t.removeHooks()}))},updateMarkers:function(){this._eachVertexHandler((function(t){t.updateMarkers()}))},_initHandlers:function(){(this||i)._verticesHandlers=[];for(var t=0;t<(this||i).latlngs.length;t++)(this||i)._verticesHandlers.push(new L.Edit.PolyVerticesEdit((this||i)._poly,(this||i).latlngs[t],(this||i)._poly.options.poly))},_updateLatLngs:function(t){(this||i).latlngs=[t.layer._latlngs],t.layer._holes&&((this||i).latlngs=(this||i).latlngs.concat(t.layer._holes))}}),L.Edit.PolyVerticesEdit=L.Handler.extend({options:{icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),touchIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-touch-icon"}),drawError:{color:"#b00b00",timeout:1e3}},initialize:function(t,e,a){L.Browser.touch&&((this||i).options.icon=(this||i).options.touchIcon),(this||i)._poly=t,a&&a.drawError&&(a.drawError=L.Util.extend({},(this||i).options.drawError,a.drawError)),(this||i)._latlngs=e,L.setOptions(this||i,a)},_defaultShape:function(){return L.Polyline._flat?L.Polyline._flat((this||i)._latlngs)?(this||i)._latlngs:(this||i)._latlngs[0]:(this||i)._latlngs},addHooks:function(){var t=(this||i)._poly,e=t._path;t instanceof L.Polygon||(t.options.fill=!1,t.options.editing&&(t.options.editing.fill=!1)),e&&t.options.editing&&t.options.editing.className&&(t.options.original.className&&t.options.original.className.split(" ").forEach((function(t){L.DomUtil.removeClass(e,t)})),t.options.editing.className.split(" ").forEach((function(t){L.DomUtil.addClass(e,t)}))),t.setStyle(t.options.editing),(this||i)._poly._map&&((this||i)._map=(this||i)._poly._map,(this||i)._markerGroup||this._initMarkers(),(this||i)._poly._map.addLayer((this||i)._markerGroup))},removeHooks:function(){var t=(this||i)._poly,e=t._path;e&&t.options.editing&&t.options.editing.className&&(t.options.editing.className.split(" ").forEach((function(t){L.DomUtil.removeClass(e,t)})),t.options.original.className&&t.options.original.className.split(" ").forEach((function(t){L.DomUtil.addClass(e,t)}))),t.setStyle(t.options.original),t._map&&(t._map.removeLayer((this||i)._markerGroup),delete(this||i)._markerGroup,delete(this||i)._markers)},updateMarkers:function(){(this||i)._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){(this||i)._markerGroup||((this||i)._markerGroup=new L.LayerGroup),(this||i)._markers=[];var t,e,a,n,s=this._defaultShape();for(t=0,a=s.length;tt&&(i._index+=e)}))},_createMiddleMarker:function(t,e){var a,n,s,r=this._getMiddleLatLng(t,e),l=this._createMarker(r);l.setOpacity(.6),t._middleRight=e._middleLeft=l,n=function(){l.off("touchmove",n,this||i);var s=e._index;l._index=s,l.off("click",a,this||i).on("click",(this||i)._onMarkerClick,this||i),r.lat=l.getLatLng().lat,r.lng=l.getLatLng().lng,this._spliceLatLngs(s,0,r),(this||i)._markers.splice(s,0,l),l.setOpacity(1),this._updateIndexes(s,1),e._index++,this._updatePrevNext(t,l),this._updatePrevNext(l,e),(this||i)._poly.fire("editstart")},s=function(){l.off("dragstart",n,this||i),l.off("dragend",s,this||i),l.off("touchmove",n,this||i),this._createMiddleMarker(t,l),this._createMiddleMarker(l,e)},a=function(){n.call(this||i),s.call(this||i),this._fireEdit()},l.on("click",a,this||i).on("dragstart",n,this||i).on("dragend",s,this||i).on("touchmove",n,this||i),(this||i)._markerGroup.addLayer(l)},_updatePrevNext:function(t,e){t&&(t._next=e),e&&(e._prev=t)},_getMiddleLatLng:function(t,e){var a=(this||i)._poly._map,n=a.project(t.getLatLng()),s=a.project(e.getLatLng());return a.unproject(n._add(s)._divideBy(2))}}),L.Polyline.addInitHook((function(){(this||i).editing||(L.Edit.Poly&&((this||i).editing=new L.Edit.Poly(this||i),(this||i).options.editable&&(this||i).editing.enable()),this.on("add",(function(){(this||i).editing&&(this||i).editing.enabled()&&(this||i).editing.addHooks()})),this.on("remove",(function(){(this||i).editing&&(this||i).editing.enabled()&&(this||i).editing.removeHooks()})))})),L.Edit=L.Edit||{},L.Edit.SimpleShape=L.Handler.extend({options:{moveIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-move"}),resizeIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-resize"}),touchMoveIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-move leaflet-touch-icon"}),touchResizeIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-resize leaflet-touch-icon"})},initialize:function(t,e){L.Browser.touch&&((this||i).options.moveIcon=(this||i).options.touchMoveIcon,(this||i).options.resizeIcon=(this||i).options.touchResizeIcon),(this||i)._shape=t,L.Util.setOptions(this||i,e)},addHooks:function(){var t=(this||i)._shape;(this||i)._shape._map&&((this||i)._map=(this||i)._shape._map,t.setStyle(t.options.editing),t._map&&((this||i)._map=t._map,(this||i)._markerGroup||this._initMarkers(),(this||i)._map.addLayer((this||i)._markerGroup)))},removeHooks:function(){var t=(this||i)._shape;if(t.setStyle(t.options.original),t._map){this._unbindMarker((this||i)._moveMarker);for(var e=0,a=(this||i)._resizeMarkers.length;e"+L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.draw.handlers.circle.radius+": "+L.GeometryUtil.readableDistance(t,!0,(this||i).options.feet,(this||i).options.nautic)}),(this||i)._shape.setRadius(t),(this||i)._map.fire(L.Draw.Event.EDITRESIZE,{layer:(this||i)._shape})}}),L.Circle.addInitHook((function(){L.Edit.Circle&&((this||i).editing=new L.Edit.Circle(this||i),(this||i).options.editable&&(this||i).editing.enable())})),L.Map.mergeOptions({touchExtend:!0}),L.Map.TouchExtend=L.Handler.extend({initialize:function(t){(this||i)._map=t,(this||i)._container=t._container,(this||i)._pane=t._panes.overlayPane},addHooks:function(){L.DomEvent.on((this||i)._container,"touchstart",(this||i)._onTouchStart,this||i),L.DomEvent.on((this||i)._container,"touchend",(this||i)._onTouchEnd,this||i),L.DomEvent.on((this||i)._container,"touchmove",(this||i)._onTouchMove,this||i),this._detectIE()?(L.DomEvent.on((this||i)._container,"MSPointerDown",(this||i)._onTouchStart,this||i),L.DomEvent.on((this||i)._container,"MSPointerUp",(this||i)._onTouchEnd,this||i),L.DomEvent.on((this||i)._container,"MSPointerMove",(this||i)._onTouchMove,this||i),L.DomEvent.on((this||i)._container,"MSPointerCancel",(this||i)._onTouchCancel,this||i)):(L.DomEvent.on((this||i)._container,"touchcancel",(this||i)._onTouchCancel,this||i),L.DomEvent.on((this||i)._container,"touchleave",(this||i)._onTouchLeave,this||i))},removeHooks:function(){L.DomEvent.off((this||i)._container,"touchstart",(this||i)._onTouchStart,this||i),L.DomEvent.off((this||i)._container,"touchend",(this||i)._onTouchEnd,this||i),L.DomEvent.off((this||i)._container,"touchmove",(this||i)._onTouchMove,this||i),this._detectIE()?(L.DomEvent.off((this||i)._container,"MSPointerDown",(this||i)._onTouchStart,this||i),L.DomEvent.off((this||i)._container,"MSPointerUp",(this||i)._onTouchEnd,this||i),L.DomEvent.off((this||i)._container,"MSPointerMove",(this||i)._onTouchMove,this||i),L.DomEvent.off((this||i)._container,"MSPointerCancel",(this||i)._onTouchCancel,this||i)):(L.DomEvent.off((this||i)._container,"touchcancel",(this||i)._onTouchCancel,this||i),L.DomEvent.off((this||i)._container,"touchleave",(this||i)._onTouchLeave,this||i))},_touchEvent:function(t,e){var a={};if(void 0!==t.touches){if(!t.touches.length)return;a=t.touches[0]}else{if("touch"!==t.pointerType)return;if(a=t,!this._filterClick(t))return}var n=(this||i)._map.mouseEventToContainerPoint(a),s=(this||i)._map.mouseEventToLayerPoint(a),r=(this||i)._map.layerPointToLatLng(s);(this||i)._map.fire(e,{latlng:r,layerPoint:s,containerPoint:n,pageX:a.pageX,pageY:a.pageY,originalEvent:t})},_filterClick:function(t){var e=t.timeStamp||t.originalEvent.timeStamp,i=L.DomEvent._lastClick&&e-L.DomEvent._lastClick;return i&&i>100&&i<500||t.target._simulatedClick&&!t._simulated?(L.DomEvent.stop(t),!1):(L.DomEvent._lastClick=e,!0)},_onTouchStart:function(t){(this||i)._map._loaded&&this._touchEvent(t,"touchstart")},_onTouchEnd:function(t){(this||i)._map._loaded&&this._touchEvent(t,"touchend")},_onTouchCancel:function(t){if((this||i)._map._loaded){var e="touchcancel";this._detectIE()&&(e="pointercancel"),this._touchEvent(t,e)}},_onTouchLeave:function(t){(this||i)._map._loaded&&this._touchEvent(t,"touchleave")},_onTouchMove:function(t){(this||i)._map._loaded&&this._touchEvent(t,"touchmove")},_detectIE:function(){var t=a.navigator.userAgent,e=t.indexOf("MSIE ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("Trident/")>0){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}var n=t.indexOf("Edge/");return n>0&&parseInt(t.substring(n+5,t.indexOf(".",n)),10)}}),L.Map.addInitHook("addHandler","touchExtend",L.Map.TouchExtend),L.Marker.Touch=L.Marker.extend({_initInteraction:function(){return(this||i).addInteractiveTarget?L.Marker.prototype._initInteraction.apply(this||i):this._initInteractionLegacy()},_initInteractionLegacy:function(){if((this||i).options.clickable){var t=(this||i)._icon,e=["dblclick","mousedown","mouseover","mouseout","contextmenu","touchstart","touchend","touchmove"];(this||i)._detectIE?e.concat(["MSPointerDown","MSPointerUp","MSPointerMove","MSPointerCancel"]):e.concat(["touchcancel"]),L.DomUtil.addClass(t,"leaflet-clickable"),L.DomEvent.on(t,"click",(this||i)._onMouseClick,this||i),L.DomEvent.on(t,"keypress",(this||i)._onKeyPress,this||i);for(var a=0;a0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("Trident/")>0){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}var n=t.indexOf("Edge/");return n>0&&parseInt(t.substring(n+5,t.indexOf(".",n)),10)}}),L.LatLngUtil={cloneLatLngs:function(t){for(var e=[],i=0,a=t.length;i2){for(var r=0;r1&&(i=i+r+l[1])}return i},readableArea:function(a,n,s){var r,l,s=L.Util.extend({},t,s);return n?(l=["ha","m"],i.type=e=typeof n,"string"===e?l=[n]:"boolean"!==e&&(l=n),r=a>=1e6&&-1!==l.indexOf("km")?L.GeometryUtil.formattedNumber(1e-6*a,s.km)+" km²":a>=1e4&&-1!==l.indexOf("ha")?L.GeometryUtil.formattedNumber(1e-4*a,s.ha)+" ha":L.GeometryUtil.formattedNumber(a,s.m)+" m²"):(a/=.836127,r=a>=3097600?L.GeometryUtil.formattedNumber(a/3097600,s.mi)+" mi²":a>=4840?L.GeometryUtil.formattedNumber(a/4840,s.ac)+" acres":L.GeometryUtil.formattedNumber(a,s.yd)+" yd²"),r},readableDistance:function(e,i,a,n,s){var r,s=L.Util.extend({},t,s);switch(i?"string"==typeof i?i:"metric":a?"feet":n?"nauticalMile":"yards"){case"metric":r=e>1e3?L.GeometryUtil.formattedNumber(e/1e3,s.km)+" km":L.GeometryUtil.formattedNumber(e,s.m)+" m";break;case"feet":e*=3.28083,r=L.GeometryUtil.formattedNumber(e,s.ft)+" ft";break;case"nauticalMile":e*=.53996,r=L.GeometryUtil.formattedNumber(e/1e3,s.nm)+" nm";break;case"yards":default:e*=1.09361,r=e>1760?L.GeometryUtil.formattedNumber(e/1760,s.mi)+" miles":L.GeometryUtil.formattedNumber(e,s.yd)+" yd"}return r},isVersion07x:function(){var t=L.version.split(".");return 0===parseInt(t[0],10)&&7===parseInt(t[1],10)}})}(),L.Util.extend(L.LineUtil,{segmentsIntersect:function(t,e,i,a){return this._checkCounterclockwise(t,i,a)!==this._checkCounterclockwise(e,i,a)&&this._checkCounterclockwise(t,e,i)!==this._checkCounterclockwise(t,e,a)},_checkCounterclockwise:function(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}}),L.Polyline.include({intersects:function(){var t,e,i,a=this._getProjectedPoints(),n=a?a.length:0;if(this._tooFewPointsForIntersection())return!1;for(t=n-1;t>=3;t--)if(e=a[t-1],i=a[t],this._lineSegmentsIntersectsRange(e,i,t-2))return!0;return!1},newLatLngIntersects:function(t,e){return!!(this||i)._map&&this.newPointIntersects((this||i)._map.latLngToLayerPoint(t),e)},newPointIntersects:function(t,e){var i=this._getProjectedPoints(),a=i?i.length:0,n=i?i[a-1]:null,s=a-2;return!this._tooFewPointsForIntersection(1)&&this._lineSegmentsIntersectsRange(n,t,s,e?1:0)},_tooFewPointsForIntersection:function(t){var e=this._getProjectedPoints(),i=e?e.length:0;return i+=t||0,!e||i<=3},_lineSegmentsIntersectsRange:function(t,e,i,a){var n,s,r=this._getProjectedPoints();a=a||0;for(var l=i;l>a;l--)if(n=r[l-1],s=r[l],L.LineUtil.segmentsIntersect(t,e,n,s))return!0;return!1},_getProjectedPoints:function(){if(!(this||i)._defaultShape)return(this||i)._originalPoints;for(var t=[],e=this._defaultShape(),a=0;a=2?L.Toolbar.include(L.Evented.prototype):L.Toolbar.include(L.Mixin.Events)},enabled:function(){return null!==(this||i)._activeMode},disable:function(){this.enabled()&&(this||i)._activeMode.handler.disable()},addToolbar:function(t){var e,a=L.DomUtil.create("div","leaflet-draw-section"),n=0,s=(this||i)._toolbarClass||"",r=this.getModeHandlers(t);for((this||i)._toolbarContainer=L.DomUtil.create("div","leaflet-draw-toolbar leaflet-bar"),(this||i)._map=t,e=0;e0&&(this||i)._singleLineLabel&&(L.DomUtil.removeClass((this||i)._container,"leaflet-draw-tooltip-single"),(this||i)._singleLineLabel=!1):(L.DomUtil.addClass((this||i)._container,"leaflet-draw-tooltip-single"),(this||i)._singleLineLabel=!0),(this||i)._container.innerHTML=(t.subtext.length>0?''+t.subtext+"
":"")+""+t.text+"",t.text||t.subtext?((this||i)._visible=!0,(this||i)._container.style.visibility="inherit"):((this||i)._visible=!1,(this||i)._container.style.visibility="hidden"),this||i):this||i},updatePosition:function(t){var e=(this||i)._map.latLngToLayerPoint(t),a=(this||i)._container;return(this||i)._container&&((this||i)._visible&&(a.style.visibility="inherit"),L.DomUtil.setPosition(a,e)),this||i},showAsError:function(){return(this||i)._container&&L.DomUtil.addClass((this||i)._container,"leaflet-error-draw-tooltip"),this||i},removeError:function(){return(this||i)._container&&L.DomUtil.removeClass((this||i)._container,"leaflet-error-draw-tooltip"),this||i},_onMouseOut:function(){(this||i)._container&&((this||i)._container.style.visibility="hidden")}}),L.DrawToolbar=L.Toolbar.extend({statics:{TYPE:"draw"},options:{polyline:{},polygon:{},rectangle:{},circle:{},marker:{},circlemarker:{}},initialize:function(t){for(var e in(this||i).options)(this||i).options.hasOwnProperty(e)&&t[e]&&(t[e]=L.extend({},(this||i).options[e],t[e]));(this||i)._toolbarClass="leaflet-draw-draw",L.Toolbar.prototype.initialize.call(this||i,t)},getModeHandlers:function(t){return[{enabled:(this||i).options.polyline,handler:new L.Draw.Polyline(t,(this||i).options.polyline),title:L.drawLocal.draw.toolbar.buttons.polyline},{enabled:(this||i).options.polygon,handler:new L.Draw.Polygon(t,(this||i).options.polygon),title:L.drawLocal.draw.toolbar.buttons.polygon},{enabled:(this||i).options.rectangle,handler:new L.Draw.Rectangle(t,(this||i).options.rectangle),title:L.drawLocal.draw.toolbar.buttons.rectangle},{enabled:(this||i).options.circle,handler:new L.Draw.Circle(t,(this||i).options.circle),title:L.drawLocal.draw.toolbar.buttons.circle},{enabled:(this||i).options.marker,handler:new L.Draw.Marker(t,(this||i).options.marker),title:L.drawLocal.draw.toolbar.buttons.marker},{enabled:(this||i).options.circlemarker,handler:new L.Draw.CircleMarker(t,(this||i).options.circlemarker),title:L.drawLocal.draw.toolbar.buttons.circlemarker}]},getActions:function(t){return[{enabled:t.completeShape,title:L.drawLocal.draw.toolbar.finish.title,text:L.drawLocal.draw.toolbar.finish.text,callback:t.completeShape,context:t},{enabled:t.deleteLastVertex,title:L.drawLocal.draw.toolbar.undo.title,text:L.drawLocal.draw.toolbar.undo.text,callback:t.deleteLastVertex,context:t},{title:L.drawLocal.draw.toolbar.actions.title,text:L.drawLocal.draw.toolbar.actions.text,callback:(this||i).disable,context:this||i}]},setOptions:function(t){L.setOptions(this||i,t);for(var e in(this||i)._modes)(this||i)._modes.hasOwnProperty(e)&&t.hasOwnProperty(e)&&(this||i)._modes[e].handler.setOptions(t[e])}}),L.EditToolbar=L.Toolbar.extend({statics:{TYPE:"edit"},options:{edit:{selectedPathOptions:{dashArray:"10, 10",fill:!0,fillColor:"#fe57a1",fillOpacity:.1,maintainColor:!1}},remove:{},poly:null,featureGroup:null},initialize:function(t){t.edit&&(void 0===t.edit.selectedPathOptions&&(t.edit.selectedPathOptions=(this||i).options.edit.selectedPathOptions),t.edit.selectedPathOptions=L.extend({},(this||i).options.edit.selectedPathOptions,t.edit.selectedPathOptions)),t.remove&&(t.remove=L.extend({},(this||i).options.remove,t.remove)),t.poly&&(t.poly=L.extend({},(this||i).options.poly,t.poly)),(this||i)._toolbarClass="leaflet-draw-edit",L.Toolbar.prototype.initialize.call(this||i,t),(this||i)._selectedFeatureCount=0},getModeHandlers:function(t){var e=(this||i).options.featureGroup;return[{enabled:(this||i).options.edit,handler:new L.EditToolbar.Edit(t,{featureGroup:e,selectedPathOptions:(this||i).options.edit.selectedPathOptions,poly:(this||i).options.poly}),title:L.drawLocal.edit.toolbar.buttons.edit},{enabled:(this||i).options.remove,handler:new L.EditToolbar.Delete(t,{featureGroup:e}),title:L.drawLocal.edit.toolbar.buttons.remove}]},getActions:function(t){var e=[{title:L.drawLocal.edit.toolbar.actions.save.title,text:L.drawLocal.edit.toolbar.actions.save.text,callback:(this||i)._save,context:this||i},{title:L.drawLocal.edit.toolbar.actions.cancel.title,text:L.drawLocal.edit.toolbar.actions.cancel.text,callback:(this||i).disable,context:this||i}];return t.removeAllLayers&&e.push({title:L.drawLocal.edit.toolbar.actions.clearAll.title,text:L.drawLocal.edit.toolbar.actions.clearAll.text,callback:(this||i)._clearAllLayers,context:this||i}),e},addToolbar:function(t){var e=L.Toolbar.prototype.addToolbar.call(this||i,t);return this._checkDisabled(),(this||i).options.featureGroup.on("layeradd layerremove",(this||i)._checkDisabled,this||i),e},removeToolbar:function(){(this||i).options.featureGroup.off("layeradd layerremove",(this||i)._checkDisabled,this||i),L.Toolbar.prototype.removeToolbar.call(this||i)},disable:function(){this.enabled()&&((this||i)._activeMode.handler.revertLayers(),L.Toolbar.prototype.disable.call(this||i))},_save:function(){(this||i)._activeMode.handler.save(),(this||i)._activeMode&&(this||i)._activeMode.handler.disable()},_clearAllLayers:function(){(this||i)._activeMode.handler.removeAllLayers(),(this||i)._activeMode&&(this||i)._activeMode.handler.disable()},_checkDisabled:function(){var t,e=(this||i).options.featureGroup,a=0!==e.getLayers().length;(this||i).options.edit&&(t=(this||i)._modes[L.EditToolbar.Edit.TYPE].button,a?L.DomUtil.removeClass(t,"leaflet-disabled"):L.DomUtil.addClass(t,"leaflet-disabled"),t.setAttribute("title",a?L.drawLocal.edit.toolbar.buttons.edit:L.drawLocal.edit.toolbar.buttons.editDisabled)),(this||i).options.remove&&(t=(this||i)._modes[L.EditToolbar.Delete.TYPE].button,a?L.DomUtil.removeClass(t,"leaflet-disabled"):L.DomUtil.addClass(t,"leaflet-disabled"),t.setAttribute("title",a?L.drawLocal.edit.toolbar.buttons.remove:L.drawLocal.edit.toolbar.buttons.removeDisabled))}}),L.EditToolbar.Edit=L.Handler.extend({statics:{TYPE:"edit"},initialize:function(t,e){if(L.Handler.prototype.initialize.call(this||i,t),L.setOptions(this||i,e),(this||i)._featureGroup=e.featureGroup,!((this||i)._featureGroup instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");(this||i)._uneditedLayerProps={},(this||i).type=L.EditToolbar.Edit.TYPE;var a=L.version.split(".");1===parseInt(a[0],10)&&parseInt(a[1],10)>=2?L.EditToolbar.Edit.include(L.Evented.prototype):L.EditToolbar.Edit.include(L.Mixin.Events)},enable:function(){!(this||i)._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:(this||i).type}),(this||i)._map.fire(L.Draw.Event.EDITSTART,{handler:(this||i).type}),L.Handler.prototype.enable.call(this||i),(this||i)._featureGroup.on("layeradd",(this||i)._enableLayerEdit,this||i).on("layerremove",(this||i)._disableLayerEdit,this||i))},disable:function(){(this||i)._enabled&&((this||i)._featureGroup.off("layeradd",(this||i)._enableLayerEdit,this||i).off("layerremove",(this||i)._disableLayerEdit,this||i),L.Handler.prototype.disable.call(this||i),(this||i)._map.fire(L.Draw.Event.EDITSTOP,{handler:(this||i).type}),this.fire("disabled",{handler:(this||i).type}))},addHooks:function(){var t=(this||i)._map;t&&(t.getContainer().focus(),(this||i)._featureGroup.eachLayer((this||i)._enableLayerEdit,this||i),(this||i)._tooltip=new L.Draw.Tooltip((this||i)._map),(this||i)._tooltip.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}),t._editTooltip=(this||i)._tooltip,this._updateTooltip(),(this||i)._map.on("mousemove",(this||i)._onMouseMove,this||i).on("touchmove",(this||i)._onMouseMove,this||i).on("MSPointerMove",(this||i)._onMouseMove,this||i).on(L.Draw.Event.EDITVERTEX,(this||i)._updateTooltip,this||i))},removeHooks:function(){(this||i)._map&&((this||i)._featureGroup.eachLayer((this||i)._disableLayerEdit,this||i),(this||i)._uneditedLayerProps={},(this||i)._tooltip.dispose(),(this||i)._tooltip=null,(this||i)._map.off("mousemove",(this||i)._onMouseMove,this||i).off("touchmove",(this||i)._onMouseMove,this||i).off("MSPointerMove",(this||i)._onMouseMove,this||i).off(L.Draw.Event.EDITVERTEX,(this||i)._updateTooltip,this||i))},revertLayers:function(){(this||i)._featureGroup.eachLayer((function(t){this._revertLayer(t)}),this||i)},save:function(){var t=new L.LayerGroup;(this||i)._featureGroup.eachLayer((function(e){e.edited&&(t.addLayer(e),e.edited=!1)})),(this||i)._map.fire(L.Draw.Event.EDITED,{layers:t})},_backupLayer:function(t){var e=L.Util.stamp(t);(this||i)._uneditedLayerProps[e]||(t instanceof L.Polyline||t instanceof L.Polygon||t instanceof L.Rectangle?(this||i)._uneditedLayerProps[e]={latlngs:L.LatLngUtil.cloneLatLngs(t.getLatLngs())}:t instanceof L.Circle?(this||i)._uneditedLayerProps[e]={latlng:L.LatLngUtil.cloneLatLng(t.getLatLng()),radius:t.getRadius()}:(t instanceof L.Marker||t instanceof L.CircleMarker)&&((this||i)._uneditedLayerProps[e]={latlng:L.LatLngUtil.cloneLatLng(t.getLatLng())}))},_getTooltipText:function(){return{text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}},_updateTooltip:function(){(this||i)._tooltip.updateContent(this._getTooltipText())},_revertLayer:function(t){var e=L.Util.stamp(t);t.edited=!1,(this||i)._uneditedLayerProps.hasOwnProperty(e)&&(t instanceof L.Polyline||t instanceof L.Polygon||t instanceof L.Rectangle?t.setLatLngs((this||i)._uneditedLayerProps[e].latlngs):t instanceof L.Circle?(t.setLatLng((this||i)._uneditedLayerProps[e].latlng),t.setRadius((this||i)._uneditedLayerProps[e].radius)):(t instanceof L.Marker||t instanceof L.CircleMarker)&&t.setLatLng((this||i)._uneditedLayerProps[e].latlng),t.fire("revert-edited",{layer:t}))},_enableLayerEdit:function(t){var e,a,n=t.layer||t.target||t;this._backupLayer(n),(this||i).options.poly&&(a=L.Util.extend({},(this||i).options.poly),n.options.poly=a),(this||i).options.selectedPathOptions&&(e=L.Util.extend({},(this||i).options.selectedPathOptions),e.maintainColor&&(e.color=n.options.color,e.fillColor=n.options.fillColor),n.options.original=L.extend({},n.options),n.options.editing=e),n instanceof L.Marker?(n.editing&&n.editing.enable(),n.dragging.enable(),n.on("dragend",(this||i)._onMarkerDragEnd).on("touchmove",(this||i)._onTouchMove,this||i).on("MSPointerMove",(this||i)._onTouchMove,this||i).on("touchend",(this||i)._onMarkerDragEnd,this||i).on("MSPointerUp",(this||i)._onMarkerDragEnd,this||i)):n.editing.enable()},_disableLayerEdit:function(t){var e=t.layer||t.target||t;e.edited=!1,e.editing&&e.editing.disable(),delete e.options.editing,delete e.options.original,(this||i)._selectedPathOptions&&(e instanceof L.Marker?this._toggleMarkerHighlight(e):(e.setStyle(e.options.previousOptions),delete e.options.previousOptions)),e instanceof L.Marker?(e.dragging.disable(),e.off("dragend",(this||i)._onMarkerDragEnd,this||i).off("touchmove",(this||i)._onTouchMove,this||i).off("MSPointerMove",(this||i)._onTouchMove,this||i).off("touchend",(this||i)._onMarkerDragEnd,this||i).off("MSPointerUp",(this||i)._onMarkerDragEnd,this||i)):e.editing.disable()},_onMouseMove:function(t){(this||i)._tooltip.updatePosition(t.latlng)},_onMarkerDragEnd:function(t){var e=t.target;e.edited=!0,(this||i)._map.fire(L.Draw.Event.EDITMOVE,{layer:e})},_onTouchMove:function(t){var e=t.originalEvent.changedTouches[0],a=(this||i)._map.mouseEventToLayerPoint(e),n=(this||i)._map.layerPointToLatLng(a);t.target.setLatLng(n)},_hasAvailableLayers:function(){return 0!==(this||i)._featureGroup.getLayers().length}}),L.EditToolbar.Delete=L.Handler.extend({statics:{TYPE:"remove"},initialize:function(t,e){if(L.Handler.prototype.initialize.call(this||i,t),L.Util.setOptions(this||i,e),(this||i)._deletableLayers=(this||i).options.featureGroup,!((this||i)._deletableLayers instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");(this||i).type=L.EditToolbar.Delete.TYPE;var a=L.version.split(".");1===parseInt(a[0],10)&&parseInt(a[1],10)>=2?L.EditToolbar.Delete.include(L.Evented.prototype):L.EditToolbar.Delete.include(L.Mixin.Events)},enable:function(){!(this||i)._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:(this||i).type}),(this||i)._map.fire(L.Draw.Event.DELETESTART,{handler:(this||i).type}),L.Handler.prototype.enable.call(this||i),(this||i)._deletableLayers.on("layeradd",(this||i)._enableLayerDelete,this||i).on("layerremove",(this||i)._disableLayerDelete,this||i))},disable:function(){(this||i)._enabled&&((this||i)._deletableLayers.off("layeradd",(this||i)._enableLayerDelete,this||i).off("layerremove",(this||i)._disableLayerDelete,this||i),L.Handler.prototype.disable.call(this||i),(this||i)._map.fire(L.Draw.Event.DELETESTOP,{handler:(this||i).type}),this.fire("disabled",{handler:(this||i).type}))},addHooks:function(){var t=(this||i)._map;t&&(t.getContainer().focus(),(this||i)._deletableLayers.eachLayer((this||i)._enableLayerDelete,this||i),(this||i)._deletedLayers=new L.LayerGroup,(this||i)._tooltip=new L.Draw.Tooltip((this||i)._map),(this||i)._tooltip.updateContent({text:L.drawLocal.edit.handlers.remove.tooltip.text}),(this||i)._map.on("mousemove",(this||i)._onMouseMove,this||i))},removeHooks:function(){(this||i)._map&&((this||i)._deletableLayers.eachLayer((this||i)._disableLayerDelete,this||i),(this||i)._deletedLayers=null,(this||i)._tooltip.dispose(),(this||i)._tooltip=null,(this||i)._map.off("mousemove",(this||i)._onMouseMove,this||i))},revertLayers:function(){(this||i)._deletedLayers.eachLayer((function(t){(this||i)._deletableLayers.addLayer(t),t.fire("revert-deleted",{layer:t})}),this||i)},save:function(){(this||i)._map.fire(L.Draw.Event.DELETED,{layers:(this||i)._deletedLayers})},removeAllLayers:function(){(this||i)._deletableLayers.eachLayer((function(t){this._removeLayer({layer:t})}),this||i),this.save()},_enableLayerDelete:function(t){(t.layer||t.target||t).on("click",(this||i)._removeLayer,this||i)},_disableLayerDelete:function(t){var e=t.layer||t.target||t;e.off("click",(this||i)._removeLayer,this||i),(this||i)._deletedLayers.removeLayer(e)},_removeLayer:function(t){var e=t.layer||t.target||t;(this||i)._deletableLayers.removeLayer(e),(this||i)._deletedLayers.addLayer(e),e.fire("deleted")},_onMouseMove:function(t){(this||i)._tooltip.updatePosition(t.latlng)},_hasAvailableLayers:function(){return 0!==(this||i)._deletableLayers.getLayers().length}})}(window,document);var a={};export default a;