/* esri-leaflet-cluster - v3.0.1 - Thu Feb 23 2023 13:13:10 GMT-0600 (Central Standard Time)
 * Copyright (c) 2023 Environmental Systems Research Institute, Inc.
 * Apache-2.0 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("leaflet"),require("esri-leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet","esri-leaflet"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).L=e.L||{},e.L.esri=e.L.esri||{},e.L.esri.Cluster={}),e.L,e.L.esri)}(this,(function(e,t,r){"use strict";var i="3.0.1",s=r.FeatureManager.extend({statics:{EVENTS:"click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose",CLUSTEREVENTS:"clusterclick clusterdblclick clustermouseover clustermouseout clustermousemove clustercontextmenu"},initialize:function(e){r.FeatureManager.prototype.initialize.call(this,e),e=t.setOptions(this,e),this._layers={},this._leafletIds={},this.cluster=t.markerClusterGroup(e),this._key="c"+(1e9*Math.random()).toString(36).replace(".","_"),this.cluster.addEventParent(this)},onAdd:function(e){r.FeatureManager.prototype.onAdd.call(this,e),this._map.addLayer(this.cluster)},onRemove:function(e){r.FeatureManager.prototype.onRemove.call(this,e),this._map.removeLayer(this.cluster)},createNewLayer:function(e){var r=t.GeoJSON.geometryToLayer(e,this.options);return r&&(r.defaultOptions=r.options),r},createLayers:function(e){for(var r=[],i=e.length-1;i>=0;i--){var s=e[i],a=this._layers[s.id];a||((a=this.createNewLayer(s)).feature=t.GeoJSON.asFeature(s),a.defaultOptions=a.options,a._leaflet_id=this._key+"_"+s.id,this.resetStyle(a.feature.id),this._layers[a.feature.id]=a,this._leafletIds[a._leaflet_id]=s.id,this.options.onEachFeature&&this.options.onEachFeature(a.feature,a),this.fire("createfeature",{feature:a.feature})),(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(s))&&r.push(a)}r.length&&this.cluster.addLayers(r)},addLayers:function(e){for(var t=[],r=e.length-1;r>=0;r--){var i=this._layers[e[r]];this.fire("addfeature",{feature:i.feature}),t.push(i)}this.cluster.addLayers(t)},removeLayers:function(e,t){for(var r=[],i=e.length-1;i>=0;i--){var s=e[i],a=this._layers[s];this.fire("removefeature",{feature:a.feature,permanent:t}),r.push(a),this._layers[s]&&t&&delete this._layers[s]}this.cluster.removeLayers(r)},resetStyle:function(e){var t=this._layers[e];return t&&(t.options=t.defaultOptions,this.setFeatureStyle(t.feature.id,this.options.style)),this},setStyle:function(e){return this.eachFeature((function(t){this.setFeatureStyle(t.feature.id,e)}),this),this},setFeatureStyle:function(e,t){var r=this._layers[e];"function"==typeof t&&(t=t(r.feature)),r.setStyle&&r.setStyle(t)},eachFeature:function(e,t){for(var r in this._layers)e.call(t,this._layers[r]);return this},getFeature:function(e){return this._layers[e]},openPopup(e){return this._popup&&this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map),this},openTooltip(e){return this._tooltip&&this._tooltip._prepareOpen(e)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this)),this}});function a(e){return new s(e)}e.FeatureLayer=s,e.VERSION=i,e.default=a,e.featureLayer=a,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=esri-leaflet-cluster.js.map
