L.MarkerClusterGroup.include({leafextZoomToShowLayer:function(layer,callback){var map=this._map;if(typeof callback!=="function"){callback=function(){}}var showMarker=function(){if((map.hasLayer(layer)||map.hasLayer(layer.__parent))&&!this._inZoomAnimation){this._map.off("moveend",showMarker,this);this.off("animationend",showMarker,this);if(map.hasLayer(layer)){callback()}else if(layer.__parent._icon){this.once("spiderfied",callback,this);layer.__parent.spiderfy()}}};if(layer._icon&&this._map.getBounds().contains(layer.getLatLng())){callback()}else if(layer.__parent._zoom<Math.round(this._map._zoom)){this._map.on("moveend",showMarker,this);this._map.panTo(layer.getLatLng())}else{if(typeof layer.__parent._childClusters!=="undefined"){console.log("extra definition in markercluster orig (bug or Sonderfall?)");this._map.on("moveend",showMarker,this);this.on("animationend",showMarker,this);if(layer.__parent._childClusters.length>0){map.setView(layer.__parent.getLatLng(),layer.__parent._zoom)}else{map.setView(layer.getLatLng(),layer.__parent._zoom)}}}}});function leafext_fitbounds_on(map){map.once("moveend",function(e){if(thismapbounds["fitBounds"]){map.fitBounds=thismapbounds["fitBounds"];map._shouldFitBounds=thismapbounds["shouldFitBounds"]}})}function leafext_fitbounds_off(map){if(map.fitBounds){thismapbounds["fitBounds"]=map.fitBounds;map.fitBounds=false;if(map._shouldFitBounds){thismapbounds["shouldFitBounds"]=map._shouldFitBounds;delete map._shouldFitBounds}}}function leafext_zoomto_marker(closestMarker,target,zoom,map,debug){if(zoom===false){zoom=map.getZoom()}leafext_fitbounds_off(map);if(!closestMarker.getPopup()){if(closestMarker.options.title){closestMarker.bindPopup(closestMarker.options.title)}else{closestMarker.bindPopup(target)}closestMarker.once("popupopen",function(){closestMarker.unbindPopup()})}closestMarker.once("popupopen",function(){map.panTo(this.getLatLng());leafext_fitbounds_on(map)});map.setView(closestMarker.getLatLng(),zoom);closestMarker.openPopup()}function leafext_zoomto_clmarker(closestMarker,target,markerClusterGroup,map,debug){console.log("leafext_zoomto_clmarker");closestMarker.once("popupopen",function(){leafext_fitbounds_off(map);map.panTo(this.getLatLng());leafext_fitbounds_on(map)});markerClusterGroup.leafextZoomToShowLayer(closestMarker,function(){if(closestMarker.getPopup()){closestMarker.openPopup()}else{closestMarker.bindPopup(target).openPopup()}})}function leafext_zoom_to_closest(type,closest,closestMarker,target,zoom,map,debug){if(closest<Number.MAX_VALUE){if(closestMarker.__parent){if(debug){console.log("closest "+type+" marker in cluster")}markerClusterGroup=closestMarker.__parent._group;leafext_zoomto_clmarker(closestMarker,target,markerClusterGroup,map,debug)}else{if(debug){console.log("closest "+type+" marker not in cluster")}leafext_zoomto_marker(closestMarker,target,zoom,map,debug)}}else{if(debug){console.log(type+" marker not found")}}}function leafext_jump_to_map(mapid){if(typeof mapid!=="undefined"){let allmaps=document.getElementsByClassName("leaflet-map");Object.entries(allmaps).forEach(([key,map])=>{if(mapid==map._leaflet_id-1){map.scrollIntoView({block:"center"})}})}}function leafext_get_map(mapid){let targetmap;if(mapid!=""){window.WPLeafletMapPlugin.maps.forEach(map=>{if(typeof targetmap==="undefined"){map.eachLayer(function(layer){if(layer instanceof L.TileLayer){if(layer.options.id&&layer.options.id==mapid){targetmap=map}}})}})}if(typeof targetmap==="undefined"){targetmap=window.WPLeafletMapPlugin.getCurrentMap()}return targetmap};