You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

588 lines
45 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. !function (e, t) {
  2. "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t(((e = e || self).Leaflet = e.Leaflet || {}, e.Leaflet.markercluster = {}))
  3. }(this, function (e) {
  4. "use strict";
  5. var t = L.MarkerClusterGroup = L.FeatureGroup.extend({
  6. options: {
  7. maxClusterRadius: 80,
  8. iconCreateFunction: null,
  9. clusterPane: L.Marker.prototype.options.pane,
  10. spiderfyOnEveryZoom: !1,
  11. spiderfyOnMaxZoom: !0,
  12. showCoverageOnHover: !0,
  13. zoomToBoundsOnClick: !0,
  14. singleMarkerMode: !1,
  15. disableClusteringAtZoom: null,
  16. removeOutsideVisibleBounds: !0,
  17. animate: !0,
  18. animateAddingMarkers: !1,
  19. spiderfyShapePositions: null,
  20. spiderfyDistanceMultiplier: 1,
  21. spiderLegPolylineOptions: {weight: 1.5, color: "#222", opacity: .5},
  22. chunkedLoading: !1,
  23. chunkInterval: 200,
  24. chunkDelay: 50,
  25. chunkProgress: null,
  26. polygonOptions: {}
  27. }, initialize: function (e) {
  28. L.Util.setOptions(this, e), this.options.iconCreateFunction || (this.options.iconCreateFunction = this._defaultIconCreateFunction), this._featureGroup = L.featureGroup(), this._featureGroup.addEventParent(this), this._nonPointGroup = L.featureGroup(), this._nonPointGroup.addEventParent(this), this._inZoomAnimation = 0, this._needsClustering = [], this._needsRemoving = [], this._currentShownBounds = null, this._queue = [], this._childMarkerEventHandlers = {
  29. dragstart: this._childMarkerDragStart,
  30. move: this._childMarkerMoved,
  31. dragend: this._childMarkerDragEnd
  32. };
  33. var t = L.DomUtil.TRANSITION && this.options.animate;
  34. L.extend(this, t ? this._withAnimation : this._noAnimation), this._markerCluster = t ? L.MarkerCluster : L.MarkerClusterNonAnimated
  35. }, addLayer: function (e) {
  36. if (e instanceof L.LayerGroup) return this.addLayers([e]);
  37. if (!e.getLatLng) return this._nonPointGroup.addLayer(e), this.fire("layeradd", {layer: e}), this;
  38. if (!this._map) return this._needsClustering.push(e), this.fire("layeradd", {layer: e}), this;
  39. if (this.hasLayer(e)) return this;
  40. this._unspiderfy && this._unspiderfy(), this._addLayer(e, this._maxZoom), this.fire("layeradd", {layer: e}), this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons();
  41. var t = e, i = this._zoom;
  42. if (e.__parent) for (; t.__parent._zoom >= i;) t = t.__parent;
  43. return this._currentShownBounds.contains(t.getLatLng()) && (this.options.animateAddingMarkers ? this._animationAddLayer(e, t) : this._animationAddLayerNonAnimated(e, t)), this
  44. }, removeLayer: function (e) {
  45. return e instanceof L.LayerGroup ? this.removeLayers([e]) : (e.getLatLng ? this._map ? e.__parent && (this._unspiderfy && (this._unspiderfy(), this._unspiderfyLayer(e)), this._removeLayer(e, !0), this.fire("layerremove", {layer: e}), this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons(), e.off(this._childMarkerEventHandlers, this), this._featureGroup.hasLayer(e) && (this._featureGroup.removeLayer(e), e.clusterShow && e.clusterShow())) : (!this._arraySplice(this._needsClustering, e) && this.hasLayer(e) && this._needsRemoving.push({
  46. layer: e,
  47. latlng: e._latlng
  48. }), this.fire("layerremove", {layer: e})) : (this._nonPointGroup.removeLayer(e), this.fire("layerremove", {layer: e})), this)
  49. }, addLayers: function (n, s) {
  50. if (!L.Util.isArray(n)) return this.addLayer(n);
  51. var o, a = this._featureGroup, h = this._nonPointGroup, l = this.options.chunkedLoading,
  52. u = this.options.chunkInterval, _ = this.options.chunkProgress, d = n.length, p = 0, c = !0;
  53. if (this._map) {
  54. var f = (new Date).getTime(), m = L.bind(function () {
  55. var e = (new Date).getTime();
  56. for (this._map && this._unspiderfy && this._unspiderfy(); p < d; p++) {
  57. if (l && p % 200 == 0) {
  58. var t = (new Date).getTime() - e;
  59. if (u < t) break
  60. }
  61. if ((o = n[p]) instanceof L.LayerGroup) c && (n = n.slice(), c = !1), this._extractNonGroupLayers(o, n), d = n.length; else if (o.getLatLng) {
  62. if (!this.hasLayer(o) && (this._addLayer(o, this._maxZoom), s || this.fire("layeradd", {layer: o}), o.__parent && 2 === o.__parent.getChildCount())) {
  63. var i = o.__parent.getAllChildMarkers(), r = i[0] === o ? i[1] : i[0];
  64. a.removeLayer(r)
  65. }
  66. } else h.addLayer(o), s || this.fire("layeradd", {layer: o})
  67. }
  68. _ && _(p, d, (new Date).getTime() - f), p === d ? (this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons(), this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds)) : setTimeout(m, this.options.chunkDelay)
  69. }, this);
  70. m()
  71. } else for (var e = this._needsClustering; p < d; p++) (o = n[p]) instanceof L.LayerGroup ? (c && (n = n.slice(), c = !1), this._extractNonGroupLayers(o, n), d = n.length) : o.getLatLng ? this.hasLayer(o) || e.push(o) : h.addLayer(o);
  72. return this
  73. }, removeLayers: function (e) {
  74. var t, i, r = e.length, n = this._featureGroup, s = this._nonPointGroup, o = !0;
  75. if (!this._map) {
  76. for (t = 0; t < r; t++) (i = e[t]) instanceof L.LayerGroup ? (o && (e = e.slice(), o = !1), this._extractNonGroupLayers(i, e), r = e.length) : (this._arraySplice(this._needsClustering, i), s.removeLayer(i), this.hasLayer(i) && this._needsRemoving.push({
  77. layer: i,
  78. latlng: i._latlng
  79. }), this.fire("layerremove", {layer: i}));
  80. return this
  81. }
  82. if (this._unspiderfy) {
  83. this._unspiderfy();
  84. var a = e.slice(), h = r;
  85. for (t = 0; t < h; t++) (i = a[t]) instanceof L.LayerGroup ? (this._extractNonGroupLayers(i, a), h = a.length) : this._unspiderfyLayer(i)
  86. }
  87. for (t = 0; t < r; t++) (i = e[t]) instanceof L.LayerGroup ? (o && (e = e.slice(), o = !1), this._extractNonGroupLayers(i, e), r = e.length) : i.__parent ? (this._removeLayer(i, !0, !0), this.fire("layerremove", {layer: i}), n.hasLayer(i) && (n.removeLayer(i), i.clusterShow && i.clusterShow())) : (s.removeLayer(i), this.fire("layerremove", {layer: i}));
  88. return this._topClusterLevel._recalculateBounds(), this._refreshClustersIcons(), this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds), this
  89. }, clearLayers: function () {
  90. return this._map || (this._needsClustering = [], this._needsRemoving = [], delete this._gridClusters, delete this._gridUnclustered), this._noanimationUnspiderfy && this._noanimationUnspiderfy(), this._featureGroup.clearLayers(), this._nonPointGroup.clearLayers(), this.eachLayer(function (e) {
  91. e.off(this._childMarkerEventHandlers, this), delete e.__parent
  92. }, this), this._map && this._generateInitialClusters(), this
  93. }, getBounds: function () {
  94. var e = new L.LatLngBounds;
  95. this._topClusterLevel && e.extend(this._topClusterLevel._bounds);
  96. for (var t = this._needsClustering.length - 1; 0 <= t; t--) e.extend(this._needsClustering[t].getLatLng());
  97. return e.extend(this._nonPointGroup.getBounds()), e
  98. }, eachLayer: function (e, t) {
  99. var i, r, n, s = this._needsClustering.slice(), o = this._needsRemoving;
  100. for (this._topClusterLevel && this._topClusterLevel.getAllChildMarkers(s), r = s.length - 1; 0 <= r; r--) {
  101. for (i = !0, n = o.length - 1; 0 <= n; n--) if (o[n].layer === s[r]) {
  102. i = !1;
  103. break
  104. }
  105. i && e.call(t, s[r])
  106. }
  107. this._nonPointGroup.eachLayer(e, t)
  108. }, getLayers: function () {
  109. var t = [];
  110. return this.eachLayer(function (e) {
  111. t.push(e)
  112. }), t
  113. }, getLayer: function (t) {
  114. var i = null;
  115. return t = parseInt(t, 10), this.eachLayer(function (e) {
  116. L.stamp(e) === t && (i = e)
  117. }), i
  118. }, hasLayer: function (e) {
  119. if (!e) return !1;
  120. var t, i = this._needsClustering;
  121. for (t = i.length - 1; 0 <= t; t--) if (i[t] === e) return !0;
  122. for (t = (i = this._needsRemoving).length - 1; 0 <= t; t--) if (i[t].layer === e) return !1;
  123. return !(!e.__parent || e.__parent._group !== this) || this._nonPointGroup.hasLayer(e)
  124. }, zoomToShowLayer: function (e, t) {
  125. var i = this._map;
  126. "function" != typeof t && (t = function () {
  127. });
  128. var r = function () {
  129. !i.hasLayer(e) && !i.hasLayer(e.__parent) || this._inZoomAnimation || (this._map.off("moveend", r, this), this.off("animationend", r, this), i.hasLayer(e) ? t() : e.__parent._icon && (this.once("spiderfied", t, this), e.__parent.spiderfy()))
  130. };
  131. e._icon && this._map.getBounds().contains(e.getLatLng()) ? t() : e.__parent._zoom < Math.round(this._map._zoom) ? (this._map.on("moveend", r, this), this._map.panTo(e.getLatLng())) : (this._map.on("moveend", r, this), this.on("animationend", r, this), e.__parent.zoomToBounds())
  132. }, onAdd: function (e) {
  133. var t, i, r;
  134. if (this._map = e, !isFinite(this._map.getMaxZoom())) throw "Map has no maxZoom specified";
  135. for (this._featureGroup.addTo(e), this._nonPointGroup.addTo(e), this._gridClusters || this._generateInitialClusters(), this._maxLat = e.options.crs.projection.MAX_LATITUDE, t = 0, i = this._needsRemoving.length; t < i; t++) (r = this._needsRemoving[t]).newlatlng = r.layer._latlng, r.layer._latlng = r.latlng;
  136. for (t = 0, i = this._needsRemoving.length; t < i; t++) r = this._needsRemoving[t], this._removeLayer(r.layer, !0), r.layer._latlng = r.newlatlng;
  137. this._needsRemoving = [], this._zoom = Math.round(this._map._zoom), this._currentShownBounds = this._getExpandedVisibleBounds(), this._map.on("zoomend", this._zoomEnd, this), this._map.on("moveend", this._moveEnd, this), this._spiderfierOnAdd && this._spiderfierOnAdd(), this._bindEvents(), i = this._needsClustering, this._needsClustering = [], this.addLayers(i, !0)
  138. }, onRemove: function (e) {
  139. e.off("zoomend", this._zoomEnd, this), e.off("moveend", this._moveEnd, this), this._unbindEvents(), this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", ""), this._spiderfierOnRemove && this._spiderfierOnRemove(), delete this._maxLat, this._hideCoverage(), this._featureGroup.remove(), this._nonPointGroup.remove(), this._featureGroup.clearLayers(), this._map = null
  140. }, getVisibleParent: function (e) {
  141. for (var t = e; t && !t._icon;) t = t.__parent;
  142. return t || null
  143. }, _arraySplice: function (e, t) {
  144. for (var i = e.length - 1; 0 <= i; i--) if (e[i] === t) return e.splice(i, 1), !0
  145. }, _removeFromGridUnclustered: function (e, t) {
  146. for (var i = this._map, r = this._gridUnclustered, n = Math.floor(this._map.getMinZoom()); n <= t && r[t].removeObject(e, i.project(e.getLatLng(), t)); t--) ;
  147. }, _childMarkerDragStart: function (e) {
  148. e.target.__dragStart = e.target._latlng
  149. }, _childMarkerMoved: function (e) {
  150. if (!this._ignoreMove && !e.target.__dragStart) {
  151. var t = e.target._popup && e.target._popup.isOpen();
  152. this._moveChild(e.target, e.oldLatLng, e.latlng), t && e.target.openPopup()
  153. }
  154. }, _moveChild: function (e, t, i) {
  155. e._latlng = t, this.removeLayer(e), e._latlng = i, this.addLayer(e)
  156. }, _childMarkerDragEnd: function (e) {
  157. var t = e.target.__dragStart;
  158. delete e.target.__dragStart, t && this._moveChild(e.target, t, e.target._latlng)
  159. }, _removeLayer: function (e, t, i) {
  160. var r = this._gridClusters, n = this._gridUnclustered, s = this._featureGroup, o = this._map,
  161. a = Math.floor(this._map.getMinZoom());
  162. t && this._removeFromGridUnclustered(e, this._maxZoom);
  163. var h, l = e.__parent, u = l._markers;
  164. for (this._arraySplice(u, e); l && (l._childCount--, l._boundsNeedUpdate = !0, !(l._zoom < a));) t && l._childCount <= 1 ? (h = l._markers[0] === e ? l._markers[1] : l._markers[0], r[l._zoom].removeObject(l, o.project(l._cLatLng, l._zoom)), n[l._zoom].addObject(h, o.project(h.getLatLng(), l._zoom)), this._arraySplice(l.__parent._childClusters, l), l.__parent._markers.push(h), h.__parent = l.__parent, l._icon && (s.removeLayer(l), i || s.addLayer(h))) : l._iconNeedsUpdate = !0, l = l.__parent;
  165. delete e.__parent
  166. }, _isOrIsParent: function (e, t) {
  167. for (; t;) {
  168. if (e === t) return !0;
  169. t = t.parentNode
  170. }
  171. return !1
  172. }, fire: function (e, t, i) {
  173. if (t && t.layer instanceof L.MarkerCluster) {
  174. if (t.originalEvent && this._isOrIsParent(t.layer._icon, t.originalEvent.relatedTarget)) return;
  175. e = "cluster" + e
  176. }
  177. L.FeatureGroup.prototype.fire.call(this, e, t, i)
  178. }, listens: function (e, t) {
  179. return L.FeatureGroup.prototype.listens.call(this, e, t) || L.FeatureGroup.prototype.listens.call(this, "cluster" + e, t)
  180. }, _defaultIconCreateFunction: function (e) {
  181. var t = e.getChildCount(), i = " marker-cluster-";
  182. return i += t < 10 ? "small" : t < 100 ? "medium" : "large", new L.DivIcon({
  183. html: "<div><span>" + t + "</span></div>",
  184. className: "marker-cluster" + i,
  185. iconSize: new L.Point(40, 40)
  186. })
  187. }, _bindEvents: function () {
  188. var e = this._map, t = this.options.spiderfyOnMaxZoom, i = this.options.showCoverageOnHover,
  189. r = this.options.zoomToBoundsOnClick, n = this.options.spiderfyOnEveryZoom;
  190. (t || r || n) && this.on("clusterclick clusterkeypress", this._zoomOrSpiderfy, this), i && (this.on("clustermouseover", this._showCoverage, this), this.on("clustermouseout", this._hideCoverage, this), e.on("zoomend", this._hideCoverage, this))
  191. }, _zoomOrSpiderfy: function (e) {
  192. var t = e.layer, i = t;
  193. if ("clusterkeypress" !== e.type || !e.originalEvent || 13 === e.originalEvent.keyCode) {
  194. for (; 1 === i._childClusters.length;) i = i._childClusters[0];
  195. i._zoom === this._maxZoom && i._childCount === t._childCount && this.options.spiderfyOnMaxZoom ? t.spiderfy() : this.options.zoomToBoundsOnClick && t.zoomToBounds(), this.options.spiderfyOnEveryZoom && t.spiderfy(), e.originalEvent && 13 === e.originalEvent.keyCode && this._map._container.focus()
  196. }
  197. }, _showCoverage: function (e) {
  198. var t = this._map;
  199. this._inZoomAnimation || (this._shownPolygon && t.removeLayer(this._shownPolygon), 2 < e.layer.getChildCount() && e.layer !== this._spiderfied && (this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions), t.addLayer(this._shownPolygon)))
  200. }, _hideCoverage: function () {
  201. this._shownPolygon && (this._map.removeLayer(this._shownPolygon), this._shownPolygon = null)
  202. }, _unbindEvents: function () {
  203. var e = this.options.spiderfyOnMaxZoom, t = this.options.showCoverageOnHover,
  204. i = this.options.zoomToBoundsOnClick, r = this.options.spiderfyOnEveryZoom, n = this._map;
  205. (e || i || r) && this.off("clusterclick clusterkeypress", this._zoomOrSpiderfy, this), t && (this.off("clustermouseover", this._showCoverage, this), this.off("clustermouseout", this._hideCoverage, this), n.off("zoomend", this._hideCoverage, this))
  206. }, _zoomEnd: function () {
  207. this._map && (this._mergeSplitClusters(), this._zoom = Math.round(this._map._zoom), this._currentShownBounds = this._getExpandedVisibleBounds())
  208. }, _moveEnd: function () {
  209. if (!this._inZoomAnimation) {
  210. var e = this._getExpandedVisibleBounds();
  211. this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, e), this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), e), this._currentShownBounds = e
  212. }
  213. }, _generateInitialClusters: function () {
  214. var e = Math.ceil(this._map.getMaxZoom()), t = Math.floor(this._map.getMinZoom()),
  215. i = this.options.maxClusterRadius, r = i;
  216. "function" != typeof i && (r = function () {
  217. return i
  218. }), null !== this.options.disableClusteringAtZoom && (e = this.options.disableClusteringAtZoom - 1), this._maxZoom = e, this._gridClusters = {}, this._gridUnclustered = {};
  219. for (var n = e; t <= n; n--) this._gridClusters[n] = new L.DistanceGrid(r(n)), this._gridUnclustered[n] = new L.DistanceGrid(r(n));
  220. this._topClusterLevel = new this._markerCluster(this, t - 1)
  221. }, _addLayer: function (e, t) {
  222. var i, r, n = this._gridClusters, s = this._gridUnclustered, o = Math.floor(this._map.getMinZoom());
  223. for (this.options.singleMarkerMode && this._overrideMarkerIcon(e), e.on(this._childMarkerEventHandlers, this); o <= t; t--) {
  224. i = this._map.project(e.getLatLng(), t);
  225. var a = n[t].getNearObject(i);
  226. if (a) return a._addChild(e), void (e.__parent = a);
  227. if (a = s[t].getNearObject(i)) {
  228. var h = a.__parent;
  229. h && this._removeLayer(a, !1);
  230. var l = new this._markerCluster(this, t, a, e);
  231. n[t].addObject(l, this._map.project(l._cLatLng, t)), a.__parent = l;
  232. var u = e.__parent = l;
  233. for (r = t - 1; r > h._zoom; r--) u = new this._markerCluster(this, r, u), n[r].addObject(u, this._map.project(a.getLatLng(), r));
  234. return h._addChild(u), void this._removeFromGridUnclustered(a, t)
  235. }
  236. s[t].addObject(e, i)
  237. }
  238. this._topClusterLevel._addChild(e), e.__parent = this._topClusterLevel
  239. }, _refreshClustersIcons: function () {
  240. this._featureGroup.eachLayer(function (e) {
  241. e instanceof L.MarkerCluster && e._iconNeedsUpdate && e._updateIcon()
  242. })
  243. }, _enqueue: function (e) {
  244. this._queue.push(e), this._queueTimeout || (this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300))
  245. }, _processQueue: function () {
  246. for (var e = 0; e < this._queue.length; e++) this._queue[e].call(this);
  247. this._queue.length = 0, clearTimeout(this._queueTimeout), this._queueTimeout = null
  248. }, _mergeSplitClusters: function () {
  249. var e = Math.round(this._map._zoom);
  250. this._processQueue(), this._zoom < e && this._currentShownBounds.intersects(this._getExpandedVisibleBounds()) ? (this._animationStart(), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds()), this._animationZoomIn(this._zoom, e)) : this._zoom > e ? (this._animationStart(), this._animationZoomOut(this._zoom, e)) : this._moveEnd()
  251. }, _getExpandedVisibleBounds: function () {
  252. return this.options.removeOutsideVisibleBounds ? L.Browser.mobile ? this._checkBoundsMaxLat(this._map.getBounds()) : this._checkBoundsMaxLat(this._map.getBounds().pad(1)) : this._mapBoundsInfinite
  253. }, _checkBoundsMaxLat: function (e) {
  254. var t = this._maxLat;
  255. return void 0 !== t && (e.getNorth() >= t && (e._northEast.lat = 1 / 0), e.getSouth() <= -t && (e._southWest.lat = -1 / 0)), e
  256. }, _animationAddLayerNonAnimated: function (e, t) {
  257. if (t === e) this._featureGroup.addLayer(e); else if (2 === t._childCount) {
  258. t._addToMap();
  259. var i = t.getAllChildMarkers();
  260. this._featureGroup.removeLayer(i[0]), this._featureGroup.removeLayer(i[1])
  261. } else t._updateIcon()
  262. }, _extractNonGroupLayers: function (e, t) {
  263. var i, r = e.getLayers(), n = 0;
  264. for (t = t || []; n < r.length; n++) (i = r[n]) instanceof L.LayerGroup ? this._extractNonGroupLayers(i, t) : t.push(i);
  265. return t
  266. }, _overrideMarkerIcon: function (e) {
  267. return e.options.icon = this.options.iconCreateFunction({
  268. getChildCount: function () {
  269. return 1
  270. }, getAllChildMarkers: function () {
  271. return [e]
  272. }
  273. })
  274. }
  275. });
  276. L.MarkerClusterGroup.include({_mapBoundsInfinite: new L.LatLngBounds(new L.LatLng(-1 / 0, -1 / 0), new L.LatLng(1 / 0, 1 / 0))}), L.MarkerClusterGroup.include({
  277. _noAnimation: {
  278. _animationStart: function () {
  279. }, _animationZoomIn: function (e, t) {
  280. this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), e), this._topClusterLevel._recursivelyAddChildrenToMap(null, t, this._getExpandedVisibleBounds()), this.fire("animationend")
  281. }, _animationZoomOut: function (e, t) {
  282. this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), e), this._topClusterLevel._recursivelyAddChildrenToMap(null, t, this._getExpandedVisibleBounds()), this.fire("animationend")
  283. }, _animationAddLayer: function (e, t) {
  284. this._animationAddLayerNonAnimated(e, t)
  285. }
  286. }, _withAnimation: {
  287. _animationStart: function () {
  288. this._map._mapPane.className += " leaflet-cluster-anim", this._inZoomAnimation++
  289. }, _animationZoomIn: function (n, s) {
  290. var o, a = this._getExpandedVisibleBounds(), h = this._featureGroup,
  291. e = Math.floor(this._map.getMinZoom());
  292. this._ignoreMove = !0, this._topClusterLevel._recursively(a, n, e, function (e) {
  293. var t, i = e._latlng, r = e._markers;
  294. for (a.contains(i) || (i = null), e._isSingleParent() && n + 1 === s ? (h.removeLayer(e), e._recursivelyAddChildrenToMap(null, s, a)) : (e.clusterHide(), e._recursivelyAddChildrenToMap(i, s, a)), o = r.length - 1; 0 <= o; o--) t = r[o], a.contains(t._latlng) || h.removeLayer(t)
  295. }), this._forceLayout(), this._topClusterLevel._recursivelyBecomeVisible(a, s), h.eachLayer(function (e) {
  296. e instanceof L.MarkerCluster || !e._icon || e.clusterShow()
  297. }), this._topClusterLevel._recursively(a, n, s, function (e) {
  298. e._recursivelyRestoreChildPositions(s)
  299. }), this._ignoreMove = !1, this._enqueue(function () {
  300. this._topClusterLevel._recursively(a, n, e, function (e) {
  301. h.removeLayer(e), e.clusterShow()
  302. }), this._animationEnd()
  303. })
  304. }, _animationZoomOut: function (e, t) {
  305. this._animationZoomOutSingle(this._topClusterLevel, e - 1, t), this._topClusterLevel._recursivelyAddChildrenToMap(null, t, this._getExpandedVisibleBounds()), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), e, this._getExpandedVisibleBounds())
  306. }, _animationAddLayer: function (e, t) {
  307. var i = this, r = this._featureGroup;
  308. r.addLayer(e), t !== e && (2 < t._childCount ? (t._updateIcon(), this._forceLayout(), this._animationStart(), e._setPos(this._map.latLngToLayerPoint(t.getLatLng())), e.clusterHide(), this._enqueue(function () {
  309. r.removeLayer(e), e.clusterShow(), i._animationEnd()
  310. })) : (this._forceLayout(), i._animationStart(), i._animationZoomOutSingle(t, this._map.getMaxZoom(), this._zoom)))
  311. }
  312. }, _animationZoomOutSingle: function (t, i, r) {
  313. var n = this._getExpandedVisibleBounds(), s = Math.floor(this._map.getMinZoom());
  314. t._recursivelyAnimateChildrenInAndAddSelfToMap(n, s, i + 1, r);
  315. var o = this;
  316. this._forceLayout(), t._recursivelyBecomeVisible(n, r), this._enqueue(function () {
  317. if (1 === t._childCount) {
  318. var e = t._markers[0];
  319. this._ignoreMove = !0, e.setLatLng(e.getLatLng()), this._ignoreMove = !1, e.clusterShow && e.clusterShow()
  320. } else t._recursively(n, r, s, function (e) {
  321. e._recursivelyRemoveChildrenFromMap(n, s, i + 1)
  322. });
  323. o._animationEnd()
  324. })
  325. }, _animationEnd: function () {
  326. this._map && (this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", "")), this._inZoomAnimation--, this.fire("animationend")
  327. }, _forceLayout: function () {
  328. L.Util.falseFn(document.body.offsetWidth)
  329. }
  330. }), L.markerClusterGroup = function (e) {
  331. return new L.MarkerClusterGroup(e)
  332. };
  333. var i = L.MarkerCluster = L.Marker.extend({
  334. options: L.Icon.prototype.options, initialize: function (e, t, i, r) {
  335. L.Marker.prototype.initialize.call(this, i ? i._cLatLng || i.getLatLng() : new L.LatLng(0, 0), {
  336. icon: this,
  337. pane: e.options.clusterPane
  338. }), this._group = e, this._zoom = t, this._markers = [], this._childClusters = [], this._childCount = 0, this._iconNeedsUpdate = !0, this._boundsNeedUpdate = !0, this._bounds = new L.LatLngBounds, i && this._addChild(i), r && this._addChild(r)
  339. }, getAllChildMarkers: function (e, t) {
  340. e = e || [];
  341. for (var i = this._childClusters.length - 1; 0 <= i; i--) this._childClusters[i].getAllChildMarkers(e, t);
  342. for (var r = this._markers.length - 1; 0 <= r; r--) t && this._markers[r].__dragStart || e.push(this._markers[r]);
  343. return e
  344. }, getChildCount: function () {
  345. return this._childCount
  346. }, zoomToBounds: function (e) {
  347. for (var t, i = this._childClusters.slice(), r = this._group._map, n = r.getBoundsZoom(this._bounds), s = this._zoom + 1, o = r.getZoom(); 0 < i.length && s < n;) {
  348. s++;
  349. var a = [];
  350. for (t = 0; t < i.length; t++) a = a.concat(i[t]._childClusters);
  351. i = a
  352. }
  353. s < n ? this._group._map.setView(this._latlng, s) : n <= o ? this._group._map.setView(this._latlng, o + 1) : this._group._map.fitBounds(this._bounds, e)
  354. }, getBounds: function () {
  355. var e = new L.LatLngBounds;
  356. return e.extend(this._bounds), e
  357. }, _updateIcon: function () {
  358. this._iconNeedsUpdate = !0, this._icon && this.setIcon(this)
  359. }, createIcon: function () {
  360. return this._iconNeedsUpdate && (this._iconObj = this._group.options.iconCreateFunction(this), this._iconNeedsUpdate = !1), this._iconObj.createIcon()
  361. }, createShadow: function () {
  362. return this._iconObj.createShadow()
  363. }, _addChild: function (e, t) {
  364. this._iconNeedsUpdate = !0, this._boundsNeedUpdate = !0, this._setClusterCenter(e), e instanceof L.MarkerCluster ? (t || (this._childClusters.push(e), e.__parent = this), this._childCount += e._childCount) : (t || this._markers.push(e), this._childCount++), this.__parent && this.__parent._addChild(e, !0)
  365. }, _setClusterCenter: function (e) {
  366. this._cLatLng || (this._cLatLng = e._cLatLng || e._latlng)
  367. }, _resetBounds: function () {
  368. var e = this._bounds;
  369. e._southWest && (e._southWest.lat = 1 / 0, e._southWest.lng = 1 / 0), e._northEast && (e._northEast.lat = -1 / 0, e._northEast.lng = -1 / 0)
  370. }, _recalculateBounds: function () {
  371. var e, t, i, r, n = this._markers, s = this._childClusters, o = 0, a = 0, h = this._childCount;
  372. if (0 !== h) {
  373. for (this._resetBounds(), e = 0; e < n.length; e++) i = n[e]._latlng, this._bounds.extend(i), o += i.lat, a += i.lng;
  374. for (e = 0; e < s.length; e++) (t = s[e])._boundsNeedUpdate && t._recalculateBounds(), this._bounds.extend(t._bounds), i = t._wLatLng, r = t._childCount, o += i.lat * r, a += i.lng * r;
  375. this._latlng = this._wLatLng = new L.LatLng(o / h, a / h), this._boundsNeedUpdate = !1
  376. }
  377. }, _addToMap: function (e) {
  378. e && (this._backupLatlng = this._latlng, this.setLatLng(e)), this._group._featureGroup.addLayer(this)
  379. }, _recursivelyAnimateChildrenIn: function (e, n, t) {
  380. this._recursively(e, this._group._map.getMinZoom(), t - 1, function (e) {
  381. var t, i, r = e._markers;
  382. for (t = r.length - 1; 0 <= t; t--) (i = r[t])._icon && (i._setPos(n), i.clusterHide())
  383. }, function (e) {
  384. var t, i, r = e._childClusters;
  385. for (t = r.length - 1; 0 <= t; t--) (i = r[t])._icon && (i._setPos(n), i.clusterHide())
  386. })
  387. }, _recursivelyAnimateChildrenInAndAddSelfToMap: function (t, i, r, n) {
  388. this._recursively(t, n, i, function (e) {
  389. e._recursivelyAnimateChildrenIn(t, e._group._map.latLngToLayerPoint(e.getLatLng()).round(), r), e._isSingleParent() && r - 1 === n ? (e.clusterShow(), e._recursivelyRemoveChildrenFromMap(t, i, r)) : e.clusterHide(), e._addToMap()
  390. })
  391. }, _recursivelyBecomeVisible: function (e, t) {
  392. this._recursively(e, this._group._map.getMinZoom(), t, null, function (e) {
  393. e.clusterShow()
  394. })
  395. }, _recursivelyAddChildrenToMap: function (r, n, s) {
  396. this._recursively(s, this._group._map.getMinZoom() - 1, n, function (e) {
  397. if (n !== e._zoom) for (var t = e._markers.length - 1; 0 <= t; t--) {
  398. var i = e._markers[t];
  399. s.contains(i._latlng) && (r && (i._backupLatlng = i.getLatLng(), i.setLatLng(r), i.clusterHide && i.clusterHide()), e._group._featureGroup.addLayer(i))
  400. }
  401. }, function (e) {
  402. e._addToMap(r)
  403. })
  404. }, _recursivelyRestoreChildPositions: function (e) {
  405. for (var t = this._markers.length - 1; 0 <= t; t--) {
  406. var i = this._markers[t];
  407. i._backupLatlng && (i.setLatLng(i._backupLatlng), delete i._backupLatlng)
  408. }
  409. if (e - 1 === this._zoom) for (var r = this._childClusters.length - 1; 0 <= r; r--) this._childClusters[r]._restorePosition(); else for (var n = this._childClusters.length - 1; 0 <= n; n--) this._childClusters[n]._recursivelyRestoreChildPositions(e)
  410. }, _restorePosition: function () {
  411. this._backupLatlng && (this.setLatLng(this._backupLatlng), delete this._backupLatlng)
  412. }, _recursivelyRemoveChildrenFromMap: function (e, t, i, r) {
  413. var n, s;
  414. this._recursively(e, t - 1, i - 1, function (e) {
  415. for (s = e._markers.length - 1; 0 <= s; s--) n = e._markers[s], r && r.contains(n._latlng) || (e._group._featureGroup.removeLayer(n), n.clusterShow && n.clusterShow())
  416. }, function (e) {
  417. for (s = e._childClusters.length - 1; 0 <= s; s--) n = e._childClusters[s], r && r.contains(n._latlng) || (e._group._featureGroup.removeLayer(n), n.clusterShow && n.clusterShow())
  418. })
  419. }, _recursively: function (e, t, i, r, n) {
  420. var s, o, a = this._childClusters, h = this._zoom;
  421. if (t <= h && (r && r(this), n && h === i && n(this)), h < t || h < i) for (s = a.length - 1; 0 <= s; s--) (o = a[s])._boundsNeedUpdate && o._recalculateBounds(), e.intersects(o._bounds) && o._recursively(e, t, i, r, n)
  422. }, _isSingleParent: function () {
  423. return 0 < this._childClusters.length && this._childClusters[0]._childCount === this._childCount
  424. }
  425. });
  426. L.Marker.include({
  427. clusterHide: function () {
  428. var e = this.options.opacity;
  429. return this.setOpacity(0), this.options.opacity = e, this
  430. }, clusterShow: function () {
  431. return this.setOpacity(this.options.opacity)
  432. }
  433. }), L.DistanceGrid = function (e) {
  434. this._cellSize = e, this._sqCellSize = e * e, this._grid = {}, this._objectPoint = {}
  435. }, L.DistanceGrid.prototype = {
  436. addObject: function (e, t) {
  437. var i = this._getCoord(t.x), r = this._getCoord(t.y), n = this._grid, s = n[r] = n[r] || {},
  438. o = s[i] = s[i] || [], a = L.Util.stamp(e);
  439. this._objectPoint[a] = t, o.push(e)
  440. }, updateObject: function (e, t) {
  441. this.removeObject(e), this.addObject(e, t)
  442. }, removeObject: function (e, t) {
  443. var i, r, n = this._getCoord(t.x), s = this._getCoord(t.y), o = this._grid, a = o[s] = o[s] || {},
  444. h = a[n] = a[n] || [];
  445. for (delete this._objectPoint[L.Util.stamp(e)], i = 0, r = h.length; i < r; i++) if (h[i] === e) return h.splice(i, 1), 1 === r && delete a[n], !0
  446. }, eachObject: function (e, t) {
  447. var i, r, n, s, o, a, h = this._grid;
  448. for (i in h) for (r in o = h[i]) for (n = 0, s = (a = o[r]).length; n < s; n++) e.call(t, a[n]) && (n--, s--)
  449. }, getNearObject: function (e) {
  450. var t, i, r, n, s, o, a, h, l = this._getCoord(e.x), u = this._getCoord(e.y), _ = this._objectPoint,
  451. d = this._sqCellSize, p = null;
  452. for (t = u - 1; t <= u + 1; t++) if (n = this._grid[t]) for (i = l - 1; i <= l + 1; i++) if (s = n[i]) for (r = 0, o = s.length; r < o; r++) a = s[r], ((h = this._sqDist(_[L.Util.stamp(a)], e)) < d || h <= d && null === p) && (d = h, p = a);
  453. return p
  454. }, _getCoord: function (e) {
  455. var t = Math.floor(e / this._cellSize);
  456. return isFinite(t) ? t : e
  457. }, _sqDist: function (e, t) {
  458. var i = t.x - e.x, r = t.y - e.y;
  459. return i * i + r * r
  460. }
  461. }, L.QuickHull = {
  462. getDistant: function (e, t) {
  463. var i = t[1].lat - t[0].lat;
  464. return (t[0].lng - t[1].lng) * (e.lat - t[0].lat) + i * (e.lng - t[0].lng)
  465. }, findMostDistantPointFromBaseLine: function (e, t) {
  466. var i, r, n, s = 0, o = null, a = [];
  467. for (i = t.length - 1; 0 <= i; i--) r = t[i], 0 < (n = this.getDistant(r, e)) && (a.push(r), s < n && (s = n, o = r));
  468. return {maxPoint: o, newPoints: a}
  469. }, buildConvexHull: function (e, t) {
  470. var i = [], r = this.findMostDistantPointFromBaseLine(e, t);
  471. return r.maxPoint ? i = (i = i.concat(this.buildConvexHull([e[0], r.maxPoint], r.newPoints))).concat(this.buildConvexHull([r.maxPoint, e[1]], r.newPoints)) : [e[0]]
  472. }, getConvexHull: function (e) {
  473. var t, i = !1, r = !1, n = !1, s = !1, o = null, a = null, h = null, l = null, u = null, _ = null;
  474. for (t = e.length - 1; 0 <= t; t--) {
  475. var d = e[t];
  476. (!1 === i || d.lat > i) && (i = (o = d).lat), (!1 === r || d.lat < r) && (r = (a = d).lat), (!1 === n || d.lng > n) && (n = (h = d).lng), (!1 === s || d.lng < s) && (s = (l = d).lng)
  477. }
  478. return u = r !== i ? (_ = a, o) : (_ = l, h), [].concat(this.buildConvexHull([_, u], e), this.buildConvexHull([u, _], e))
  479. }
  480. }, L.MarkerCluster.include({
  481. getConvexHull: function () {
  482. var e, t, i = this.getAllChildMarkers(), r = [];
  483. for (t = i.length - 1; 0 <= t; t--) e = i[t].getLatLng(), r.push(e);
  484. return L.QuickHull.getConvexHull(r)
  485. }
  486. }), L.MarkerCluster.include({
  487. _2PI: 2 * Math.PI,
  488. _circleFootSeparation: 25,
  489. _circleStartAngle: 0,
  490. _spiralFootSeparation: 28,
  491. _spiralLengthStart: 11,
  492. _spiralLengthFactor: 5,
  493. _circleSpiralSwitchover: 9,
  494. spiderfy: function () {
  495. if (this._group._spiderfied !== this && !this._group._inZoomAnimation) {
  496. var e, t = this.getAllChildMarkers(null, !0), i = this._group._map.latLngToLayerPoint(this._latlng);
  497. this._group._unspiderfy(), e = (this._group._spiderfied = this)._group.options.spiderfyShapePositions ? this._group.options.spiderfyShapePositions(t.length, i) : t.length >= this._circleSpiralSwitchover ? this._generatePointsSpiral(t.length, i) : (i.y += 10, this._generatePointsCircle(t.length, i)), this._animationSpiderfy(t, e)
  498. }
  499. },
  500. unspiderfy: function (e) {
  501. this._group._inZoomAnimation || (this._animationUnspiderfy(e), this._group._spiderfied = null)
  502. },
  503. _generatePointsCircle: function (e, t) {
  504. var i, r,
  505. n = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + e) / this._2PI,
  506. s = this._2PI / e, o = [];
  507. for (n = Math.max(n, 35), o.length = e, i = 0; i < e; i++) r = this._circleStartAngle + i * s, o[i] = new L.Point(t.x + n * Math.cos(r), t.y + n * Math.sin(r))._round();
  508. return o
  509. },
  510. _generatePointsSpiral: function (e, t) {
  511. var i, r = this._group.options.spiderfyDistanceMultiplier, n = r * this._spiralLengthStart,
  512. s = r * this._spiralFootSeparation, o = r * this._spiralLengthFactor * this._2PI, a = 0, h = [];
  513. for (i = h.length = e; 0 <= i; i--) i < e && (h[i] = new L.Point(t.x + n * Math.cos(a), t.y + n * Math.sin(a))._round()), n += o / (a += s / n + 5e-4 * i);
  514. return h
  515. },
  516. _noanimationUnspiderfy: function () {
  517. var e, t, i = this._group, r = i._map, n = i._featureGroup, s = this.getAllChildMarkers(null, !0);
  518. for (i._ignoreMove = !0, this.setOpacity(1), t = s.length - 1; 0 <= t; t--) e = s[t], n.removeLayer(e), e._preSpiderfyLatlng && (e.setLatLng(e._preSpiderfyLatlng), delete e._preSpiderfyLatlng), e.setZIndexOffset && e.setZIndexOffset(0), e._spiderLeg && (r.removeLayer(e._spiderLeg), delete e._spiderLeg);
  519. i.fire("unspiderfied", {cluster: this, markers: s}), i._ignoreMove = !1, i._spiderfied = null
  520. }
  521. }), L.MarkerClusterNonAnimated = L.MarkerCluster.extend({
  522. _animationSpiderfy: function (e, t) {
  523. var i, r, n, s, o = this._group, a = o._map, h = o._featureGroup,
  524. l = this._group.options.spiderLegPolylineOptions;
  525. for (o._ignoreMove = !0, i = 0; i < e.length; i++) s = a.layerPointToLatLng(t[i]), r = e[i], n = new L.Polyline([this._latlng, s], l), a.addLayer(n), r._spiderLeg = n, r._preSpiderfyLatlng = r._latlng, r.setLatLng(s), r.setZIndexOffset && r.setZIndexOffset(1e6), h.addLayer(r);
  526. this.setOpacity(.3), o._ignoreMove = !1, o.fire("spiderfied", {cluster: this, markers: e})
  527. }, _animationUnspiderfy: function () {
  528. this._noanimationUnspiderfy()
  529. }
  530. }), L.MarkerCluster.include({
  531. _animationSpiderfy: function (e, t) {
  532. var i, r, n, s, o, a, h = this, l = this._group, u = l._map, _ = l._featureGroup, d = this._latlng,
  533. p = u.latLngToLayerPoint(d), c = L.Path.SVG,
  534. f = L.extend({}, this._group.options.spiderLegPolylineOptions), m = f.opacity;
  535. for (void 0 === m && (m = L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity), c ? (f.opacity = 0, f.className = (f.className || "") + " leaflet-cluster-spider-leg") : f.opacity = m, l._ignoreMove = !0, i = 0; i < e.length; i++) r = e[i], a = u.layerPointToLatLng(t[i]), n = new L.Polyline([d, a], f), u.addLayer(n), r._spiderLeg = n, c && (o = (s = n._path).getTotalLength() + .1, s.style.strokeDasharray = o, s.style.strokeDashoffset = o), r.setZIndexOffset && r.setZIndexOffset(1e6), r.clusterHide && r.clusterHide(), _.addLayer(r), r._setPos && r._setPos(p);
  536. for (l._forceLayout(), l._animationStart(), i = e.length - 1; 0 <= i; i--) a = u.layerPointToLatLng(t[i]), (r = e[i])._preSpiderfyLatlng = r._latlng, r.setLatLng(a), r.clusterShow && r.clusterShow(), c && ((s = (n = r._spiderLeg)._path).style.strokeDashoffset = 0, n.setStyle({opacity: m}));
  537. this.setOpacity(.3), l._ignoreMove = !1, setTimeout(function () {
  538. l._animationEnd(), l.fire("spiderfied", {cluster: h, markers: e})
  539. }, 200)
  540. }, _animationUnspiderfy: function (e) {
  541. var t, i, r, n, s, o, a = this, h = this._group, l = h._map, u = h._featureGroup,
  542. _ = e ? l._latLngToNewLayerPoint(this._latlng, e.zoom, e.center) : l.latLngToLayerPoint(this._latlng),
  543. d = this.getAllChildMarkers(null, !0), p = L.Path.SVG;
  544. for (h._ignoreMove = !0, h._animationStart(), this.setOpacity(1), i = d.length - 1; 0 <= i; i--) (t = d[i])._preSpiderfyLatlng && (t.closePopup(), t.setLatLng(t._preSpiderfyLatlng), delete t._preSpiderfyLatlng, o = !0, t._setPos && (t._setPos(_), o = !1), t.clusterHide && (t.clusterHide(), o = !1), o && u.removeLayer(t), p && (s = (n = (r = t._spiderLeg)._path).getTotalLength() + .1, n.style.strokeDashoffset = s, r.setStyle({opacity: 0})));
  545. h._ignoreMove = !1, setTimeout(function () {
  546. var e = 0;
  547. for (i = d.length - 1; 0 <= i; i--) (t = d[i])._spiderLeg && e++;
  548. for (i = d.length - 1; 0 <= i; i--) (t = d[i])._spiderLeg && (t.clusterShow && t.clusterShow(), t.setZIndexOffset && t.setZIndexOffset(0), 1 < e && u.removeLayer(t), l.removeLayer(t._spiderLeg), delete t._spiderLeg);
  549. h._animationEnd(), h.fire("unspiderfied", {cluster: a, markers: d})
  550. }, 200)
  551. }
  552. }), L.MarkerClusterGroup.include({
  553. _spiderfied: null, unspiderfy: function () {
  554. this._unspiderfy.apply(this, arguments)
  555. }, _spiderfierOnAdd: function () {
  556. this._map.on("click", this._unspiderfyWrapper, this), this._map.options.zoomAnimation && this._map.on("zoomstart", this._unspiderfyZoomStart, this), this._map.on("zoomend", this._noanimationUnspiderfy, this), L.Browser.touch || this._map.getRenderer(this)
  557. }, _spiderfierOnRemove: function () {
  558. this._map.off("click", this._unspiderfyWrapper, this), this._map.off("zoomstart", this._unspiderfyZoomStart, this), this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._map.off("zoomend", this._noanimationUnspiderfy, this), this._noanimationUnspiderfy()
  559. }, _unspiderfyZoomStart: function () {
  560. this._map && this._map.on("zoomanim", this._unspiderfyZoomAnim, this)
  561. }, _unspiderfyZoomAnim: function (e) {
  562. L.DomUtil.hasClass(this._map._mapPane, "leaflet-touching") || (this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._unspiderfy(e))
  563. }, _unspiderfyWrapper: function () {
  564. this._unspiderfy()
  565. }, _unspiderfy: function (e) {
  566. this._spiderfied && this._spiderfied.unspiderfy(e)
  567. }, _noanimationUnspiderfy: function () {
  568. this._spiderfied && this._spiderfied._noanimationUnspiderfy()
  569. }, _unspiderfyLayer: function (e) {
  570. e._spiderLeg && (this._featureGroup.removeLayer(e), e.clusterShow && e.clusterShow(), e.setZIndexOffset && e.setZIndexOffset(0), this._map.removeLayer(e._spiderLeg), delete e._spiderLeg)
  571. }
  572. }), L.MarkerClusterGroup.include({
  573. refreshClusters: function (e) {
  574. return e ? e instanceof L.MarkerClusterGroup ? e = e._topClusterLevel.getAllChildMarkers() : e instanceof L.LayerGroup ? e = e._layers : e instanceof L.MarkerCluster ? e = e.getAllChildMarkers() : e instanceof L.Marker && (e = [e]) : e = this._topClusterLevel.getAllChildMarkers(), this._flagParentsIconsNeedUpdate(e), this._refreshClustersIcons(), this.options.singleMarkerMode && this._refreshSingleMarkerModeMarkers(e), this
  575. }, _flagParentsIconsNeedUpdate: function (e) {
  576. var t, i;
  577. for (t in e) for (i = e[t].__parent; i;) i._iconNeedsUpdate = !0, i = i.__parent
  578. }, _refreshSingleMarkerModeMarkers: function (e) {
  579. var t, i;
  580. for (t in e) i = e[t], this.hasLayer(i) && i.setIcon(this._overrideMarkerIcon(i))
  581. }
  582. }), L.Marker.include({
  583. refreshIconOptions: function (e, t) {
  584. var i = this.options.icon;
  585. return L.setOptions(i, e), this.setIcon(i), t && this.__parent && this.__parent._group.refreshClusters(this), this
  586. }
  587. }), e.MarkerClusterGroup = t, e.MarkerCluster = i, Object.defineProperty(e, "__esModule", {value: !0})
  588. });
  589. //# sourceMappingURL=leaflet.markercluster.js.map