Socket
Socket
Sign inDemoInstall

@react-google-maps/marker-clusterer

Package Overview
Dependencies
0
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.10.0 to 2.10.1

166

dist/cjs.js

@@ -29,9 +29,79 @@ 'use strict';

this.backgroundPosition = '0 0';
this.cMouseDownInCluster = null;
this.cDraggingMapByCluster = null;
this.timeOut = null;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.setMap(cluster.getMap()); // Note: this causes onAdd to be called
}
ClusterIcon.prototype.onBoundsChanged = function () {
this.cDraggingMapByCluster = this.cMouseDownInCluster;
};
ClusterIcon.prototype.onMouseDown = function () {
this.cMouseDownInCluster = true;
this.cDraggingMapByCluster = false;
};
ClusterIcon.prototype.onClick = function (event) {
this.cMouseDownInCluster = false;
if (!this.cDraggingMapByCluster) {
var markerClusterer_1 = this.cluster.getClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(markerClusterer_1, 'click', this.cluster);
google.maps.event.trigger(markerClusterer_1, 'clusterclick', this.cluster); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (markerClusterer_1.getZoomOnClick()) {
// Zoom into the cluster.
var maxZoom_1 = markerClusterer_1.getMaxZoom();
var bounds_1 = this.cluster.getBounds();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// There is a fix for Issue 170 here:
this.timeOut = window.setTimeout(function () {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// Don't zoom beyond the max zoom level
if (maxZoom_1 !== null &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().getZoom() > maxZoom_1) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().setZoom(maxZoom_1 + 1);
}
}, 100);
}
// Prevent event propagation to the map:
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
}
}
};
ClusterIcon.prototype.onMouseOver = function () {
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(this.cluster.getClusterer(), 'mouseover', this.cluster);
};
ClusterIcon.prototype.onMouseOut = function () {
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(this.cluster.getClusterer(), 'mouseout', this.cluster);
};
ClusterIcon.prototype.onAdd = function () {
var _this = this;
var cMouseDownInCluster;
var cDraggingMapByCluster;
this.div = document.createElement('div');

@@ -42,2 +112,3 @@ this.div.className = this.className;

}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

@@ -47,67 +118,9 @@ this.getPanes().overlayMouseTarget.appendChild(this.div);

this.boundsChangedListener = google.maps.event.addListener(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.getMap(), 'boundschanged', function boundsChanged() {
cDraggingMapByCluster = cMouseDownInCluster;
});
google.maps.event.addListener(this.div, 'mousedown', function onMouseDown() {
cMouseDownInCluster = true;
cDraggingMapByCluster = false;
});
google.maps.event.addListener(this.div, 'click', function (event) {
cMouseDownInCluster = false;
if (!cDraggingMapByCluster) {
var markerClusterer_1 = _this.cluster.getClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(markerClusterer_1, 'click', _this.cluster);
google.maps.event.trigger(markerClusterer_1, 'clusterclick', _this.cluster); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (markerClusterer_1.getZoomOnClick()) {
// Zoom into the cluster.
var maxZoom_1 = markerClusterer_1.getMaxZoom();
var bounds_1 = _this.cluster.getBounds();
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// There is a fix for Issue 170 here:
setTimeout(function timeout() {
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// Don't zoom beyond the max zoom level
// @ts-ignore
if (maxZoom_1 !== null && markerClusterer_1.getMap().getZoom() > maxZoom_1) {
// @ts-ignore
markerClusterer_1.getMap().setZoom(maxZoom_1 + 1);
}
}, 100);
}
// Prevent event propagation to the map:
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
}
}
});
google.maps.event.addListener(this.div, 'mouseover', function () {
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(_this.cluster.getClusterer(), 'mouseover', _this.cluster);
});
google.maps.event.addListener(this.div, 'mouseout', function () {
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(_this.cluster.getClusterer(), 'mouseout', _this.cluster);
});
this.getMap(), 'bounds_changed', this.onBoundsChanged);
this.div.addEventListener('mousedown', this.onMouseDown);
this.div.addEventListener('click', this.onClick);
this.div.addEventListener('mouseover', this.onMouseOver);
this.div.addEventListener('mouseout', this.onMouseOut);
};

@@ -120,4 +133,11 @@ ClusterIcon.prototype.onRemove = function () {

}
google.maps.event.clearInstanceListeners(this.div);
this.div.removeEventListener('mousedown', this.onMouseDown);
this.div.removeEventListener('click', this.onClick);
this.div.removeEventListener('mouseover', this.onMouseOver);
this.div.removeEventListener('mouseout', this.onMouseOut);
this.div.parentNode.removeChild(this.div);
if (this.timeOut !== null) {
window.clearTimeout(this.timeOut);
this.timeOut = null;
}
this.div = null;

@@ -129,4 +149,4 @@ }

var _a = this.getPosFromLatLng(this.center), x = _a.x, y = _a.y;
this.div.style.top = y + 'px';
this.div.style.left = x + 'px';
this.div.style.top = "".concat(y, "px");
this.div.style.left = "".concat(x, "px");
}

@@ -149,3 +169,5 @@ };

var pos = this.getPosFromLatLng(this.center);
if (this.sums === null || typeof this.sums.title === 'undefined' || this.sums.title === '') {
if (this.sums === null ||
typeof this.sums.title === 'undefined' ||
this.sums.title === '') {
divTitle = this.cluster.getClusterer().getTitle();

@@ -220,4 +242,2 @@ }

pos.y -= this.anchorIcon[0];
// pos.x = pos.x
// pos.y = pos.y
return pos;

@@ -224,0 +244,0 @@ };

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function t(e,i){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=i,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.setMap(e.getMap())}return t.prototype.onAdd=function(){var t,e,i=this;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div),this.boundsChangedListener=google.maps.event.addListener(this.getMap(),"boundschanged",(function(){e=t})),google.maps.event.addListener(this.div,"mousedown",(function(){t=!0,e=!1})),google.maps.event.addListener(this.div,"click",(function(s){if(t=!1,!e){var r=i.cluster.getClusterer();if(google.maps.event.trigger(r,"click",i.cluster),google.maps.event.trigger(r,"clusterclick",i.cluster),r.getZoomOnClick()){var o=r.getMaxZoom(),n=i.cluster.getBounds();r.getMap().fitBounds(n),setTimeout((function(){r.getMap().fitBounds(n),null!==o&&r.getMap().getZoom()>o&&r.getMap().setZoom(o+1)}),100)}s.cancelBubble=!0,s.stopPropagation&&s.stopPropagation()}})),google.maps.event.addListener(this.div,"mouseover",(function(){google.maps.event.trigger(i.cluster.getClusterer(),"mouseover",i.cluster)})),google.maps.event.addListener(this.div,"mouseout",(function(){google.maps.event.trigger(i.cluster.getClusterer(),"mouseout",i.cluster)}))},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),google.maps.event.clearInstanceListeners(this.div),this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var t=this.getPosFromLatLng(this.center),e=t.x,i=t.y;this.div.style.top=i+"px",this.div.style.left=e+"px"}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var t;if(this.div&&this.center){var e="",i=this.backgroundPosition.split(" "),s=parseInt(i[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(i[1].replace(/^\s+|\s+$/g,""),10),o=this.getPosFromLatLng(this.center);e=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,this.div.style.cursor="pointer",this.div.style.position="absolute",this.div.style.top="".concat(o.y,"px"),this.div.style.left="".concat(o.x,"px"),this.div.style.width="".concat(this.width,"px"),this.div.style.height="".concat(this.height,"px");var n=document.createElement("img");n.alt=e,n.src=this.url,n.style.position="absolute",n.style.top="".concat(r,"px"),n.style.left="".concat(s,"px"),this.cluster.getClusterer().enableRetinaIcons||(n.style.clip="rect(-".concat(r,"px, -").concat(s+this.width,"px, -").concat(r+this.height,", -").concat(s,")"));var a=document.createElement("div");a.style.position="absolute",a.style.top="".concat(this.anchorText[0],"px"),a.style.left="".concat(this.anchorText[1],"px"),a.style.color=this.textColor,a.style.fontSize="".concat(this.textSize,"px"),a.style.fontFamily=this.fontFamily,a.style.fontWeight=this.fontWeight,a.style.fontStyle=this.fontStyle,a.style.textDecoration=this.textDecoration,a.style.textAlign="center",a.style.width="".concat(this.width,"px"),a.style.lineHeight="".concat(this.height,"px"),a.innerText="".concat(null===(t=this.sums)||void 0===t?void 0:t.text),this.div.innerHTML="",this.div.appendChild(n),this.div.appendChild(a),this.div.title=e,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(t){this.sums=t;var e=this.cluster.getClusterer().getStyles(),i=e[Math.min(e.length-1,Math.max(0,t.index-1))];this.url=i.url,this.height=i.height,this.width=i.width,i.className&&(this.className="".concat(this.clusterClassName," ").concat(i.className)),this.anchorText=i.anchorText||[0,0],this.anchorIcon=i.anchorIcon||[this.height/2,this.width/2],this.textColor=i.textColor||"black",this.textSize=i.textSize||11,this.textDecoration=i.textDecoration||"none",this.fontWeight=i.fontWeight||"bold",this.fontStyle=i.fontStyle||"normal",this.fontFamily=i.fontFamily||"Arial,sans-serif",this.backgroundPosition=i.backgroundPosition||"0 0"},t.prototype.setCenter=function(t){this.center=t},t.prototype.getPosFromLatLng=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=this.anchorIcon[1],e.y-=this.anchorIcon[0],e},t}(),e=function(){function e(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new t(this,this.markerClusterer.getStyles())}return e.prototype.getSize=function(){return this.markers.length},e.prototype.getMarkers=function(){return this.markers},e.prototype.getCenter=function(){return this.center},e.prototype.getMap=function(){return this.map},e.prototype.getClusterer=function(){return this.markerClusterer},e.prototype.getBounds=function(){for(var t=new google.maps.LatLngBounds(this.center,this.center),e=this.getMarkers(),i=0;i<e.length;i++){var s=e[i].getPosition();s&&t.extend(s)}return t},e.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},e.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;var e;if(this.center){if(this.averageCenter&&(e=t.getPosition())){var i=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(i-1)+e.lat())/i,(this.center.lng()*(i-1)+e.lng())/i),this.calculateBounds()}}else(e=t.getPosition())&&(this.center=e,this.calculateBounds());t.isAdded=!0,this.markers.push(t);var s=this.markers.length,r=this.markerClusterer.getMaxZoom(),o=this.map.getZoom();if(null!==r&&void 0!==o&&o>r)t.getMap()!==this.map&&t.setMap(this.map);else if(s<this.minClusterSize)t.getMap()!==this.map&&t.setMap(this.map);else if(s===this.minClusterSize)for(var n=0;n<s;n++)this.markers[n].setMap(null);else t.setMap(null);return!0},e.prototype.isMarkerInClusterBounds=function(t){if(null!==this.bounds){var e=t.getPosition();if(e)return this.bounds.contains(e)}return!1},e.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},e.prototype.updateIcon=function(){var t=this.markers.length,e=this.markerClusterer.getMaxZoom(),i=this.map.getZoom();null!==e&&void 0!==i&&i>e||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},e.prototype.isMarkerAlreadyAdded=function(t){if(this.markers.includes)return this.markers.includes(t);for(var e=0;e<this.markers.length;e++)if(t===this.markers[e])return!0;return!1},e}(),i=function(t,e){var i=t.length,s=i.toString().length,r=Math.min(s,e);return{text:i.toString(),index:r,title:""}},s=[53,56,66,78,90],r=function(){function t(e,r,o){void 0===r&&(r=[]),void 0===o&&(o={}),this.extend(t,google.maps.OverlayView),this.markers=[],this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=o.gridSize||60,this.minClusterSize=o.minimumClusterSize||2,this.maxZoom=o.maxZoom||null,this.styles=o.styles||[],this.title=o.title||"",this.zoomOnClick=!0,void 0!==o.zoomOnClick&&(this.zoomOnClick=o.zoomOnClick),this.averageCenter=!1,void 0!==o.averageCenter&&(this.averageCenter=o.averageCenter),this.ignoreHidden=!1,void 0!==o.ignoreHidden&&(this.ignoreHidden=o.ignoreHidden),this.enableRetinaIcons=!1,void 0!==o.enableRetinaIcons&&(this.enableRetinaIcons=o.enableRetinaIcons),this.imagePath=o.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=o.imageExtension||"png",this.imageSizes=o.imageSizes||s,this.calculator=o.calculator||i,this.batchSize=o.batchSize||2e3,this.batchSizeIE=o.batchSizeIE||500,this.clusterClass=o.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(r,!0),this.setMap(e)}return t.prototype.onAdd=function(){var t=this;this.activeMap=this.getMap(),this.ready=!0,this.repaint(),this.listeners=[google.maps.event.addListener(this.getMap(),"zoom_changed",(function(){t.resetViewport(!1),t.getMap().getZoom()!==(t.get("minZoom")||0)&&t.getMap().getZoom()!==t.get("maxZoom")||google.maps.event.trigger(t,"idle")})),google.maps.event.addListener(this.getMap(),"idle",(function(){t.redraw()}))]},t.prototype.onRemove=function(){for(var t=0;t<this.markers.length;t++)this.markers[t].getMap()!==this.activeMap&&this.markers[t].setMap(this.activeMap);for(t=0;t<this.clusters.length;t++)this.clusters[t].remove();this.clusters=[];for(t=0;t<this.listeners.length;t++)google.maps.event.removeListener(this.listeners[t]);this.listeners=[],this.activeMap=null,this.ready=!1},t.prototype.draw=function(){},t.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var t=0;t<this.imageSizes.length;t++)this.styles.push({url:this.imagePath+(t+1)+"."+this.imageExtension,height:this.imageSizes[t],width:this.imageSizes[t]})},t.prototype.fitMapToMarkers=function(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,i=0;i<t.length;i++){var s=t[i].getPosition();s&&e.extend(s)}this.getMap().fitBounds(e)},t.prototype.getGridSize=function(){return this.gridSize},t.prototype.setGridSize=function(t){this.gridSize=t},t.prototype.getMinimumClusterSize=function(){return this.minClusterSize},t.prototype.setMinimumClusterSize=function(t){this.minClusterSize=t},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.setMaxZoom=function(t){this.maxZoom=t},t.prototype.getStyles=function(){return this.styles},t.prototype.setStyles=function(t){this.styles=t},t.prototype.getTitle=function(){return this.title},t.prototype.setTitle=function(t){this.title=t},t.prototype.getZoomOnClick=function(){return this.zoomOnClick},t.prototype.setZoomOnClick=function(t){this.zoomOnClick=t},t.prototype.getAverageCenter=function(){return this.averageCenter},t.prototype.setAverageCenter=function(t){this.averageCenter=t},t.prototype.getIgnoreHidden=function(){return this.ignoreHidden},t.prototype.setIgnoreHidden=function(t){this.ignoreHidden=t},t.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons},t.prototype.setEnableRetinaIcons=function(t){this.enableRetinaIcons=t},t.prototype.getImageExtension=function(){return this.imageExtension},t.prototype.setImageExtension=function(t){this.imageExtension=t},t.prototype.getImagePath=function(){return this.imagePath},t.prototype.setImagePath=function(t){this.imagePath=t},t.prototype.getImageSizes=function(){return this.imageSizes},t.prototype.setImageSizes=function(t){this.imageSizes=t},t.prototype.getCalculator=function(){return this.calculator},t.prototype.setCalculator=function(t){this.calculator=t},t.prototype.getBatchSizeIE=function(){return this.batchSizeIE},t.prototype.setBatchSizeIE=function(t){this.batchSizeIE=t},t.prototype.getClusterClass=function(){return this.clusterClass},t.prototype.setClusterClass=function(t){this.clusterClass=t},t.prototype.getMarkers=function(){return this.markers},t.prototype.getTotalMarkers=function(){return this.markers.length},t.prototype.getClusters=function(){return this.clusters},t.prototype.getTotalClusters=function(){return this.clusters.length},t.prototype.addMarker=function(t,e){this.pushMarkerTo(t),e||this.redraw()},t.prototype.addMarkers=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&this.pushMarkerTo(t[i]);e||this.redraw()},t.prototype.pushMarkerTo=function(t){var e=this;t.getDraggable()&&google.maps.event.addListener(t,"dragend",(function(){e.ready&&(t.isAdded=!1,e.repaint())})),t.isAdded=!1,this.markers.push(t)},t.prototype.removeMarker_=function(t){var e=-1;if(this.markers.indexOf)e=this.markers.indexOf(t);else for(var i=0;i<this.markers.length;i++)if(t===this.markers[i]){e=i;break}return-1!==e&&(t.setMap(null),this.markers.splice(e,1),!0)},t.prototype.removeMarker=function(t,e){var i=this.removeMarker_(t);return!e&&i&&this.repaint(),i},t.prototype.removeMarkers=function(t,e){for(var i=!1,s=0;s<t.length;s++)i=i||this.removeMarker_(t[s]);return!e&&i&&this.repaint(),i},t.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers=[]},t.prototype.repaint=function(){var t=this.clusters.slice();this.clusters=[],this.resetViewport(!1),this.redraw(),setTimeout((function(){for(var e=0;e<t.length;e++)t[e].remove()}),0)},t.prototype.getExtendedBounds=function(t){var e=this.getProjection(),i=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()));i.x+=this.gridSize,i.y-=this.gridSize;var s=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()));return s.x-=this.gridSize,s.y+=this.gridSize,t.extend(e.fromDivPixelToLatLng(i)),t.extend(e.fromDivPixelToLatLng(s)),t},t.prototype.redraw=function(){this.createClusters(0)},t.prototype.resetViewport=function(t){for(var e=0;e<this.clusters.length;e++)this.clusters[e].remove();this.clusters=[];for(e=0;e<this.markers.length;e++){var i=this.markers[e];i.isAdded=!1,t&&i.setMap(null)}},t.prototype.distanceBetweenPoints=function(t,e){var i=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,r=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371},t.prototype.isMarkerInBounds=function(t,e){var i=t.getPosition();return!!i&&e.contains(i)},t.prototype.addToClosestCluster=function(t){for(var i,s=4e4,r=null,o=0;o<this.clusters.length;o++){var n=(i=this.clusters[o]).getCenter(),a=t.getPosition();if(n&&a){var h=this.distanceBetweenPoints(n,a);h<s&&(s=h,r=i)}}r&&r.isMarkerInClusterBounds(t)?r.addMarker(t):((i=new e(this)).addMarker(t),this.clusters.push(i))},t.prototype.createClusters=function(t){var e=this;if(this.ready){0===t&&(google.maps.event.trigger(this,"clusteringbegin",this),null!==this.timerRefStatic&&(window.clearTimeout(this.timerRefStatic),delete this.timerRefStatic));for(var i=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),s=this.getExtendedBounds(i),r=Math.min(t+this.batchSize,this.markers.length),o=t;o<r;o++){var n=this.markers[o];!n.isAdded&&this.isMarkerInBounds(n,s)&&(!this.ignoreHidden||this.ignoreHidden&&n.getVisible())&&this.addToClosestCluster(n)}if(r<this.markers.length)this.timerRefStatic=window.setTimeout((function(){e.createClusters(r)}),0);else{this.timerRefStatic=null,google.maps.event.trigger(this,"clusteringend",this);for(o=0;o<this.clusters.length;o++)this.clusters[o].updateIcon()}}},t.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},t}();exports.Cluster=e,exports.ClusterIcon=t,exports.Clusterer=r;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function t(e,i){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=i,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(e.getMap())}return t.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},t.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},t.prototype.onClick=function(t){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var e=this.cluster.getClusterer();if(google.maps.event.trigger(e,"click",this.cluster),google.maps.event.trigger(e,"clusterclick",this.cluster),e.getZoomOnClick()){var i=e.getMaxZoom(),s=this.cluster.getBounds();e.getMap().fitBounds(s),this.timeOut=window.setTimeout((function(){e.getMap().fitBounds(s),null!==i&&e.getMap().getZoom()>i&&e.getMap().setZoom(i+1)}),100)}t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}},t.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},t.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},t.prototype.onAdd=function(){this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div),this.boundsChangedListener=google.maps.event.addListener(this.getMap(),"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut)},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),null!==this.timeOut&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},t.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var t=this.getPosFromLatLng(this.center),e=t.x,i=t.y;this.div.style.top="".concat(i,"px"),this.div.style.left="".concat(e,"px")}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var t;if(this.div&&this.center){var e="",i=this.backgroundPosition.split(" "),s=parseInt(i[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(i[1].replace(/^\s+|\s+$/g,""),10),o=this.getPosFromLatLng(this.center);e=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,this.div.style.cursor="pointer",this.div.style.position="absolute",this.div.style.top="".concat(o.y,"px"),this.div.style.left="".concat(o.x,"px"),this.div.style.width="".concat(this.width,"px"),this.div.style.height="".concat(this.height,"px");var n=document.createElement("img");n.alt=e,n.src=this.url,n.style.position="absolute",n.style.top="".concat(r,"px"),n.style.left="".concat(s,"px"),this.cluster.getClusterer().enableRetinaIcons||(n.style.clip="rect(-".concat(r,"px, -").concat(s+this.width,"px, -").concat(r+this.height,", -").concat(s,")"));var a=document.createElement("div");a.style.position="absolute",a.style.top="".concat(this.anchorText[0],"px"),a.style.left="".concat(this.anchorText[1],"px"),a.style.color=this.textColor,a.style.fontSize="".concat(this.textSize,"px"),a.style.fontFamily=this.fontFamily,a.style.fontWeight=this.fontWeight,a.style.fontStyle=this.fontStyle,a.style.textDecoration=this.textDecoration,a.style.textAlign="center",a.style.width="".concat(this.width,"px"),a.style.lineHeight="".concat(this.height,"px"),a.innerText="".concat(null===(t=this.sums)||void 0===t?void 0:t.text),this.div.innerHTML="",this.div.appendChild(n),this.div.appendChild(a),this.div.title=e,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(t){this.sums=t;var e=this.cluster.getClusterer().getStyles(),i=e[Math.min(e.length-1,Math.max(0,t.index-1))];this.url=i.url,this.height=i.height,this.width=i.width,i.className&&(this.className="".concat(this.clusterClassName," ").concat(i.className)),this.anchorText=i.anchorText||[0,0],this.anchorIcon=i.anchorIcon||[this.height/2,this.width/2],this.textColor=i.textColor||"black",this.textSize=i.textSize||11,this.textDecoration=i.textDecoration||"none",this.fontWeight=i.fontWeight||"bold",this.fontStyle=i.fontStyle||"normal",this.fontFamily=i.fontFamily||"Arial,sans-serif",this.backgroundPosition=i.backgroundPosition||"0 0"},t.prototype.setCenter=function(t){this.center=t},t.prototype.getPosFromLatLng=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=this.anchorIcon[1],e.y-=this.anchorIcon[0],e},t}(),e=function(){function e(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new t(this,this.markerClusterer.getStyles())}return e.prototype.getSize=function(){return this.markers.length},e.prototype.getMarkers=function(){return this.markers},e.prototype.getCenter=function(){return this.center},e.prototype.getMap=function(){return this.map},e.prototype.getClusterer=function(){return this.markerClusterer},e.prototype.getBounds=function(){for(var t=new google.maps.LatLngBounds(this.center,this.center),e=this.getMarkers(),i=0;i<e.length;i++){var s=e[i].getPosition();s&&t.extend(s)}return t},e.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},e.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;var e;if(this.center){if(this.averageCenter&&(e=t.getPosition())){var i=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(i-1)+e.lat())/i,(this.center.lng()*(i-1)+e.lng())/i),this.calculateBounds()}}else(e=t.getPosition())&&(this.center=e,this.calculateBounds());t.isAdded=!0,this.markers.push(t);var s=this.markers.length,r=this.markerClusterer.getMaxZoom(),o=this.map.getZoom();if(null!==r&&void 0!==o&&o>r)t.getMap()!==this.map&&t.setMap(this.map);else if(s<this.minClusterSize)t.getMap()!==this.map&&t.setMap(this.map);else if(s===this.minClusterSize)for(var n=0;n<s;n++)this.markers[n].setMap(null);else t.setMap(null);return!0},e.prototype.isMarkerInClusterBounds=function(t){if(null!==this.bounds){var e=t.getPosition();if(e)return this.bounds.contains(e)}return!1},e.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},e.prototype.updateIcon=function(){var t=this.markers.length,e=this.markerClusterer.getMaxZoom(),i=this.map.getZoom();null!==e&&void 0!==i&&i>e||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},e.prototype.isMarkerAlreadyAdded=function(t){if(this.markers.includes)return this.markers.includes(t);for(var e=0;e<this.markers.length;e++)if(t===this.markers[e])return!0;return!1},e}(),i=function(t,e){var i=t.length,s=i.toString().length,r=Math.min(s,e);return{text:i.toString(),index:r,title:""}},s=[53,56,66,78,90],r=function(){function t(e,r,o){void 0===r&&(r=[]),void 0===o&&(o={}),this.extend(t,google.maps.OverlayView),this.markers=[],this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=o.gridSize||60,this.minClusterSize=o.minimumClusterSize||2,this.maxZoom=o.maxZoom||null,this.styles=o.styles||[],this.title=o.title||"",this.zoomOnClick=!0,void 0!==o.zoomOnClick&&(this.zoomOnClick=o.zoomOnClick),this.averageCenter=!1,void 0!==o.averageCenter&&(this.averageCenter=o.averageCenter),this.ignoreHidden=!1,void 0!==o.ignoreHidden&&(this.ignoreHidden=o.ignoreHidden),this.enableRetinaIcons=!1,void 0!==o.enableRetinaIcons&&(this.enableRetinaIcons=o.enableRetinaIcons),this.imagePath=o.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=o.imageExtension||"png",this.imageSizes=o.imageSizes||s,this.calculator=o.calculator||i,this.batchSize=o.batchSize||2e3,this.batchSizeIE=o.batchSizeIE||500,this.clusterClass=o.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(r,!0),this.setMap(e)}return t.prototype.onAdd=function(){var t=this;this.activeMap=this.getMap(),this.ready=!0,this.repaint(),this.listeners=[google.maps.event.addListener(this.getMap(),"zoom_changed",(function(){t.resetViewport(!1),t.getMap().getZoom()!==(t.get("minZoom")||0)&&t.getMap().getZoom()!==t.get("maxZoom")||google.maps.event.trigger(t,"idle")})),google.maps.event.addListener(this.getMap(),"idle",(function(){t.redraw()}))]},t.prototype.onRemove=function(){for(var t=0;t<this.markers.length;t++)this.markers[t].getMap()!==this.activeMap&&this.markers[t].setMap(this.activeMap);for(t=0;t<this.clusters.length;t++)this.clusters[t].remove();this.clusters=[];for(t=0;t<this.listeners.length;t++)google.maps.event.removeListener(this.listeners[t]);this.listeners=[],this.activeMap=null,this.ready=!1},t.prototype.draw=function(){},t.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var t=0;t<this.imageSizes.length;t++)this.styles.push({url:this.imagePath+(t+1)+"."+this.imageExtension,height:this.imageSizes[t],width:this.imageSizes[t]})},t.prototype.fitMapToMarkers=function(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,i=0;i<t.length;i++){var s=t[i].getPosition();s&&e.extend(s)}this.getMap().fitBounds(e)},t.prototype.getGridSize=function(){return this.gridSize},t.prototype.setGridSize=function(t){this.gridSize=t},t.prototype.getMinimumClusterSize=function(){return this.minClusterSize},t.prototype.setMinimumClusterSize=function(t){this.minClusterSize=t},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.setMaxZoom=function(t){this.maxZoom=t},t.prototype.getStyles=function(){return this.styles},t.prototype.setStyles=function(t){this.styles=t},t.prototype.getTitle=function(){return this.title},t.prototype.setTitle=function(t){this.title=t},t.prototype.getZoomOnClick=function(){return this.zoomOnClick},t.prototype.setZoomOnClick=function(t){this.zoomOnClick=t},t.prototype.getAverageCenter=function(){return this.averageCenter},t.prototype.setAverageCenter=function(t){this.averageCenter=t},t.prototype.getIgnoreHidden=function(){return this.ignoreHidden},t.prototype.setIgnoreHidden=function(t){this.ignoreHidden=t},t.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons},t.prototype.setEnableRetinaIcons=function(t){this.enableRetinaIcons=t},t.prototype.getImageExtension=function(){return this.imageExtension},t.prototype.setImageExtension=function(t){this.imageExtension=t},t.prototype.getImagePath=function(){return this.imagePath},t.prototype.setImagePath=function(t){this.imagePath=t},t.prototype.getImageSizes=function(){return this.imageSizes},t.prototype.setImageSizes=function(t){this.imageSizes=t},t.prototype.getCalculator=function(){return this.calculator},t.prototype.setCalculator=function(t){this.calculator=t},t.prototype.getBatchSizeIE=function(){return this.batchSizeIE},t.prototype.setBatchSizeIE=function(t){this.batchSizeIE=t},t.prototype.getClusterClass=function(){return this.clusterClass},t.prototype.setClusterClass=function(t){this.clusterClass=t},t.prototype.getMarkers=function(){return this.markers},t.prototype.getTotalMarkers=function(){return this.markers.length},t.prototype.getClusters=function(){return this.clusters},t.prototype.getTotalClusters=function(){return this.clusters.length},t.prototype.addMarker=function(t,e){this.pushMarkerTo(t),e||this.redraw()},t.prototype.addMarkers=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&this.pushMarkerTo(t[i]);e||this.redraw()},t.prototype.pushMarkerTo=function(t){var e=this;t.getDraggable()&&google.maps.event.addListener(t,"dragend",(function(){e.ready&&(t.isAdded=!1,e.repaint())})),t.isAdded=!1,this.markers.push(t)},t.prototype.removeMarker_=function(t){var e=-1;if(this.markers.indexOf)e=this.markers.indexOf(t);else for(var i=0;i<this.markers.length;i++)if(t===this.markers[i]){e=i;break}return-1!==e&&(t.setMap(null),this.markers.splice(e,1),!0)},t.prototype.removeMarker=function(t,e){var i=this.removeMarker_(t);return!e&&i&&this.repaint(),i},t.prototype.removeMarkers=function(t,e){for(var i=!1,s=0;s<t.length;s++)i=i||this.removeMarker_(t[s]);return!e&&i&&this.repaint(),i},t.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers=[]},t.prototype.repaint=function(){var t=this.clusters.slice();this.clusters=[],this.resetViewport(!1),this.redraw(),setTimeout((function(){for(var e=0;e<t.length;e++)t[e].remove()}),0)},t.prototype.getExtendedBounds=function(t){var e=this.getProjection(),i=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()));i.x+=this.gridSize,i.y-=this.gridSize;var s=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()));return s.x-=this.gridSize,s.y+=this.gridSize,t.extend(e.fromDivPixelToLatLng(i)),t.extend(e.fromDivPixelToLatLng(s)),t},t.prototype.redraw=function(){this.createClusters(0)},t.prototype.resetViewport=function(t){for(var e=0;e<this.clusters.length;e++)this.clusters[e].remove();this.clusters=[];for(e=0;e<this.markers.length;e++){var i=this.markers[e];i.isAdded=!1,t&&i.setMap(null)}},t.prototype.distanceBetweenPoints=function(t,e){var i=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,r=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371},t.prototype.isMarkerInBounds=function(t,e){var i=t.getPosition();return!!i&&e.contains(i)},t.prototype.addToClosestCluster=function(t){for(var i,s=4e4,r=null,o=0;o<this.clusters.length;o++){var n=(i=this.clusters[o]).getCenter(),a=t.getPosition();if(n&&a){var h=this.distanceBetweenPoints(n,a);h<s&&(s=h,r=i)}}r&&r.isMarkerInClusterBounds(t)?r.addMarker(t):((i=new e(this)).addMarker(t),this.clusters.push(i))},t.prototype.createClusters=function(t){var e=this;if(this.ready){0===t&&(google.maps.event.trigger(this,"clusteringbegin",this),null!==this.timerRefStatic&&(window.clearTimeout(this.timerRefStatic),delete this.timerRefStatic));for(var i=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),s=this.getExtendedBounds(i),r=Math.min(t+this.batchSize,this.markers.length),o=t;o<r;o++){var n=this.markers[o];!n.isAdded&&this.isMarkerInBounds(n,s)&&(!this.ignoreHidden||this.ignoreHidden&&n.getVisible())&&this.addToClosestCluster(n)}if(r<this.markers.length)this.timerRefStatic=window.setTimeout((function(){e.createClusters(r)}),0);else{this.timerRefStatic=null,google.maps.event.trigger(this,"clusteringend",this);for(o=0;o<this.clusters.length;o++)this.clusters[o].updateIcon()}}},t.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},t}();exports.Cluster=e,exports.ClusterIcon=t,exports.Clusterer=r;
//# sourceMappingURL=cjs.min.js.map

@@ -25,9 +25,79 @@ var ClusterIcon = /** @class */ (function () {

this.backgroundPosition = '0 0';
this.cMouseDownInCluster = null;
this.cDraggingMapByCluster = null;
this.timeOut = null;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.setMap(cluster.getMap()); // Note: this causes onAdd to be called
}
ClusterIcon.prototype.onBoundsChanged = function () {
this.cDraggingMapByCluster = this.cMouseDownInCluster;
};
ClusterIcon.prototype.onMouseDown = function () {
this.cMouseDownInCluster = true;
this.cDraggingMapByCluster = false;
};
ClusterIcon.prototype.onClick = function (event) {
this.cMouseDownInCluster = false;
if (!this.cDraggingMapByCluster) {
var markerClusterer_1 = this.cluster.getClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(markerClusterer_1, 'click', this.cluster);
google.maps.event.trigger(markerClusterer_1, 'clusterclick', this.cluster); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (markerClusterer_1.getZoomOnClick()) {
// Zoom into the cluster.
var maxZoom_1 = markerClusterer_1.getMaxZoom();
var bounds_1 = this.cluster.getBounds();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// There is a fix for Issue 170 here:
this.timeOut = window.setTimeout(function () {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// Don't zoom beyond the max zoom level
if (maxZoom_1 !== null &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().getZoom() > maxZoom_1) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().setZoom(maxZoom_1 + 1);
}
}, 100);
}
// Prevent event propagation to the map:
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
}
}
};
ClusterIcon.prototype.onMouseOver = function () {
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(this.cluster.getClusterer(), 'mouseover', this.cluster);
};
ClusterIcon.prototype.onMouseOut = function () {
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(this.cluster.getClusterer(), 'mouseout', this.cluster);
};
ClusterIcon.prototype.onAdd = function () {
var _this = this;
var cMouseDownInCluster;
var cDraggingMapByCluster;
this.div = document.createElement('div');

@@ -38,2 +108,3 @@ this.div.className = this.className;

}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

@@ -43,67 +114,9 @@ this.getPanes().overlayMouseTarget.appendChild(this.div);

this.boundsChangedListener = google.maps.event.addListener(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.getMap(), 'boundschanged', function boundsChanged() {
cDraggingMapByCluster = cMouseDownInCluster;
});
google.maps.event.addListener(this.div, 'mousedown', function onMouseDown() {
cMouseDownInCluster = true;
cDraggingMapByCluster = false;
});
google.maps.event.addListener(this.div, 'click', function (event) {
cMouseDownInCluster = false;
if (!cDraggingMapByCluster) {
var markerClusterer_1 = _this.cluster.getClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(markerClusterer_1, 'click', _this.cluster);
google.maps.event.trigger(markerClusterer_1, 'clusterclick', _this.cluster); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (markerClusterer_1.getZoomOnClick()) {
// Zoom into the cluster.
var maxZoom_1 = markerClusterer_1.getMaxZoom();
var bounds_1 = _this.cluster.getBounds();
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// There is a fix for Issue 170 here:
setTimeout(function timeout() {
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// Don't zoom beyond the max zoom level
// @ts-ignore
if (maxZoom_1 !== null && markerClusterer_1.getMap().getZoom() > maxZoom_1) {
// @ts-ignore
markerClusterer_1.getMap().setZoom(maxZoom_1 + 1);
}
}, 100);
}
// Prevent event propagation to the map:
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
}
}
});
google.maps.event.addListener(this.div, 'mouseover', function () {
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(_this.cluster.getClusterer(), 'mouseover', _this.cluster);
});
google.maps.event.addListener(this.div, 'mouseout', function () {
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(_this.cluster.getClusterer(), 'mouseout', _this.cluster);
});
this.getMap(), 'bounds_changed', this.onBoundsChanged);
this.div.addEventListener('mousedown', this.onMouseDown);
this.div.addEventListener('click', this.onClick);
this.div.addEventListener('mouseover', this.onMouseOver);
this.div.addEventListener('mouseout', this.onMouseOut);
};

@@ -116,4 +129,11 @@ ClusterIcon.prototype.onRemove = function () {

}
google.maps.event.clearInstanceListeners(this.div);
this.div.removeEventListener('mousedown', this.onMouseDown);
this.div.removeEventListener('click', this.onClick);
this.div.removeEventListener('mouseover', this.onMouseOver);
this.div.removeEventListener('mouseout', this.onMouseOut);
this.div.parentNode.removeChild(this.div);
if (this.timeOut !== null) {
window.clearTimeout(this.timeOut);
this.timeOut = null;
}
this.div = null;

@@ -125,4 +145,4 @@ }

var _a = this.getPosFromLatLng(this.center), x = _a.x, y = _a.y;
this.div.style.top = y + 'px';
this.div.style.left = x + 'px';
this.div.style.top = "".concat(y, "px");
this.div.style.left = "".concat(x, "px");
}

@@ -145,3 +165,5 @@ };

var pos = this.getPosFromLatLng(this.center);
if (this.sums === null || typeof this.sums.title === 'undefined' || this.sums.title === '') {
if (this.sums === null ||
typeof this.sums.title === 'undefined' ||
this.sums.title === '') {
divTitle = this.cluster.getClusterer().getTitle();

@@ -216,4 +238,2 @@ }

pos.y -= this.anchorIcon[0];
// pos.x = pos.x
// pos.y = pos.y
return pos;

@@ -220,0 +240,0 @@ };

@@ -1,2 +0,2 @@

var t=function(){function t(e,i){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=i,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.setMap(e.getMap())}return t.prototype.onAdd=function(){var t,e,i=this;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div),this.boundsChangedListener=google.maps.event.addListener(this.getMap(),"boundschanged",(function(){e=t})),google.maps.event.addListener(this.div,"mousedown",(function(){t=!0,e=!1})),google.maps.event.addListener(this.div,"click",(function(s){if(t=!1,!e){var r=i.cluster.getClusterer();if(google.maps.event.trigger(r,"click",i.cluster),google.maps.event.trigger(r,"clusterclick",i.cluster),r.getZoomOnClick()){var n=r.getMaxZoom(),o=i.cluster.getBounds();r.getMap().fitBounds(o),setTimeout((function(){r.getMap().fitBounds(o),null!==n&&r.getMap().getZoom()>n&&r.getMap().setZoom(n+1)}),100)}s.cancelBubble=!0,s.stopPropagation&&s.stopPropagation()}})),google.maps.event.addListener(this.div,"mouseover",(function(){google.maps.event.trigger(i.cluster.getClusterer(),"mouseover",i.cluster)})),google.maps.event.addListener(this.div,"mouseout",(function(){google.maps.event.trigger(i.cluster.getClusterer(),"mouseout",i.cluster)}))},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),google.maps.event.clearInstanceListeners(this.div),this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var t=this.getPosFromLatLng(this.center),e=t.x,i=t.y;this.div.style.top=i+"px",this.div.style.left=e+"px"}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var t;if(this.div&&this.center){var e="",i=this.backgroundPosition.split(" "),s=parseInt(i[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(i[1].replace(/^\s+|\s+$/g,""),10),n=this.getPosFromLatLng(this.center);e=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,this.div.style.cursor="pointer",this.div.style.position="absolute",this.div.style.top="".concat(n.y,"px"),this.div.style.left="".concat(n.x,"px"),this.div.style.width="".concat(this.width,"px"),this.div.style.height="".concat(this.height,"px");var o=document.createElement("img");o.alt=e,o.src=this.url,o.style.position="absolute",o.style.top="".concat(r,"px"),o.style.left="".concat(s,"px"),this.cluster.getClusterer().enableRetinaIcons||(o.style.clip="rect(-".concat(r,"px, -").concat(s+this.width,"px, -").concat(r+this.height,", -").concat(s,")"));var a=document.createElement("div");a.style.position="absolute",a.style.top="".concat(this.anchorText[0],"px"),a.style.left="".concat(this.anchorText[1],"px"),a.style.color=this.textColor,a.style.fontSize="".concat(this.textSize,"px"),a.style.fontFamily=this.fontFamily,a.style.fontWeight=this.fontWeight,a.style.fontStyle=this.fontStyle,a.style.textDecoration=this.textDecoration,a.style.textAlign="center",a.style.width="".concat(this.width,"px"),a.style.lineHeight="".concat(this.height,"px"),a.innerText="".concat(null===(t=this.sums)||void 0===t?void 0:t.text),this.div.innerHTML="",this.div.appendChild(o),this.div.appendChild(a),this.div.title=e,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(t){this.sums=t;var e=this.cluster.getClusterer().getStyles(),i=e[Math.min(e.length-1,Math.max(0,t.index-1))];this.url=i.url,this.height=i.height,this.width=i.width,i.className&&(this.className="".concat(this.clusterClassName," ").concat(i.className)),this.anchorText=i.anchorText||[0,0],this.anchorIcon=i.anchorIcon||[this.height/2,this.width/2],this.textColor=i.textColor||"black",this.textSize=i.textSize||11,this.textDecoration=i.textDecoration||"none",this.fontWeight=i.fontWeight||"bold",this.fontStyle=i.fontStyle||"normal",this.fontFamily=i.fontFamily||"Arial,sans-serif",this.backgroundPosition=i.backgroundPosition||"0 0"},t.prototype.setCenter=function(t){this.center=t},t.prototype.getPosFromLatLng=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=this.anchorIcon[1],e.y-=this.anchorIcon[0],e},t}(),e=function(){function e(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new t(this,this.markerClusterer.getStyles())}return e.prototype.getSize=function(){return this.markers.length},e.prototype.getMarkers=function(){return this.markers},e.prototype.getCenter=function(){return this.center},e.prototype.getMap=function(){return this.map},e.prototype.getClusterer=function(){return this.markerClusterer},e.prototype.getBounds=function(){for(var t=new google.maps.LatLngBounds(this.center,this.center),e=this.getMarkers(),i=0;i<e.length;i++){var s=e[i].getPosition();s&&t.extend(s)}return t},e.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},e.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;var e;if(this.center){if(this.averageCenter&&(e=t.getPosition())){var i=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(i-1)+e.lat())/i,(this.center.lng()*(i-1)+e.lng())/i),this.calculateBounds()}}else(e=t.getPosition())&&(this.center=e,this.calculateBounds());t.isAdded=!0,this.markers.push(t);var s=this.markers.length,r=this.markerClusterer.getMaxZoom(),n=this.map.getZoom();if(null!==r&&void 0!==n&&n>r)t.getMap()!==this.map&&t.setMap(this.map);else if(s<this.minClusterSize)t.getMap()!==this.map&&t.setMap(this.map);else if(s===this.minClusterSize)for(var o=0;o<s;o++)this.markers[o].setMap(null);else t.setMap(null);return!0},e.prototype.isMarkerInClusterBounds=function(t){if(null!==this.bounds){var e=t.getPosition();if(e)return this.bounds.contains(e)}return!1},e.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},e.prototype.updateIcon=function(){var t=this.markers.length,e=this.markerClusterer.getMaxZoom(),i=this.map.getZoom();null!==e&&void 0!==i&&i>e||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},e.prototype.isMarkerAlreadyAdded=function(t){if(this.markers.includes)return this.markers.includes(t);for(var e=0;e<this.markers.length;e++)if(t===this.markers[e])return!0;return!1},e}(),i=function(t,e){var i=t.length,s=i.toString().length,r=Math.min(s,e);return{text:i.toString(),index:r,title:""}},s=[53,56,66,78,90],r=function(){function t(e,r,n){void 0===r&&(r=[]),void 0===n&&(n={}),this.extend(t,google.maps.OverlayView),this.markers=[],this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=n.gridSize||60,this.minClusterSize=n.minimumClusterSize||2,this.maxZoom=n.maxZoom||null,this.styles=n.styles||[],this.title=n.title||"",this.zoomOnClick=!0,void 0!==n.zoomOnClick&&(this.zoomOnClick=n.zoomOnClick),this.averageCenter=!1,void 0!==n.averageCenter&&(this.averageCenter=n.averageCenter),this.ignoreHidden=!1,void 0!==n.ignoreHidden&&(this.ignoreHidden=n.ignoreHidden),this.enableRetinaIcons=!1,void 0!==n.enableRetinaIcons&&(this.enableRetinaIcons=n.enableRetinaIcons),this.imagePath=n.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=n.imageExtension||"png",this.imageSizes=n.imageSizes||s,this.calculator=n.calculator||i,this.batchSize=n.batchSize||2e3,this.batchSizeIE=n.batchSizeIE||500,this.clusterClass=n.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(r,!0),this.setMap(e)}return t.prototype.onAdd=function(){var t=this;this.activeMap=this.getMap(),this.ready=!0,this.repaint(),this.listeners=[google.maps.event.addListener(this.getMap(),"zoom_changed",(function(){t.resetViewport(!1),t.getMap().getZoom()!==(t.get("minZoom")||0)&&t.getMap().getZoom()!==t.get("maxZoom")||google.maps.event.trigger(t,"idle")})),google.maps.event.addListener(this.getMap(),"idle",(function(){t.redraw()}))]},t.prototype.onRemove=function(){for(var t=0;t<this.markers.length;t++)this.markers[t].getMap()!==this.activeMap&&this.markers[t].setMap(this.activeMap);for(t=0;t<this.clusters.length;t++)this.clusters[t].remove();this.clusters=[];for(t=0;t<this.listeners.length;t++)google.maps.event.removeListener(this.listeners[t]);this.listeners=[],this.activeMap=null,this.ready=!1},t.prototype.draw=function(){},t.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var t=0;t<this.imageSizes.length;t++)this.styles.push({url:this.imagePath+(t+1)+"."+this.imageExtension,height:this.imageSizes[t],width:this.imageSizes[t]})},t.prototype.fitMapToMarkers=function(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,i=0;i<t.length;i++){var s=t[i].getPosition();s&&e.extend(s)}this.getMap().fitBounds(e)},t.prototype.getGridSize=function(){return this.gridSize},t.prototype.setGridSize=function(t){this.gridSize=t},t.prototype.getMinimumClusterSize=function(){return this.minClusterSize},t.prototype.setMinimumClusterSize=function(t){this.minClusterSize=t},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.setMaxZoom=function(t){this.maxZoom=t},t.prototype.getStyles=function(){return this.styles},t.prototype.setStyles=function(t){this.styles=t},t.prototype.getTitle=function(){return this.title},t.prototype.setTitle=function(t){this.title=t},t.prototype.getZoomOnClick=function(){return this.zoomOnClick},t.prototype.setZoomOnClick=function(t){this.zoomOnClick=t},t.prototype.getAverageCenter=function(){return this.averageCenter},t.prototype.setAverageCenter=function(t){this.averageCenter=t},t.prototype.getIgnoreHidden=function(){return this.ignoreHidden},t.prototype.setIgnoreHidden=function(t){this.ignoreHidden=t},t.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons},t.prototype.setEnableRetinaIcons=function(t){this.enableRetinaIcons=t},t.prototype.getImageExtension=function(){return this.imageExtension},t.prototype.setImageExtension=function(t){this.imageExtension=t},t.prototype.getImagePath=function(){return this.imagePath},t.prototype.setImagePath=function(t){this.imagePath=t},t.prototype.getImageSizes=function(){return this.imageSizes},t.prototype.setImageSizes=function(t){this.imageSizes=t},t.prototype.getCalculator=function(){return this.calculator},t.prototype.setCalculator=function(t){this.calculator=t},t.prototype.getBatchSizeIE=function(){return this.batchSizeIE},t.prototype.setBatchSizeIE=function(t){this.batchSizeIE=t},t.prototype.getClusterClass=function(){return this.clusterClass},t.prototype.setClusterClass=function(t){this.clusterClass=t},t.prototype.getMarkers=function(){return this.markers},t.prototype.getTotalMarkers=function(){return this.markers.length},t.prototype.getClusters=function(){return this.clusters},t.prototype.getTotalClusters=function(){return this.clusters.length},t.prototype.addMarker=function(t,e){this.pushMarkerTo(t),e||this.redraw()},t.prototype.addMarkers=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&this.pushMarkerTo(t[i]);e||this.redraw()},t.prototype.pushMarkerTo=function(t){var e=this;t.getDraggable()&&google.maps.event.addListener(t,"dragend",(function(){e.ready&&(t.isAdded=!1,e.repaint())})),t.isAdded=!1,this.markers.push(t)},t.prototype.removeMarker_=function(t){var e=-1;if(this.markers.indexOf)e=this.markers.indexOf(t);else for(var i=0;i<this.markers.length;i++)if(t===this.markers[i]){e=i;break}return-1!==e&&(t.setMap(null),this.markers.splice(e,1),!0)},t.prototype.removeMarker=function(t,e){var i=this.removeMarker_(t);return!e&&i&&this.repaint(),i},t.prototype.removeMarkers=function(t,e){for(var i=!1,s=0;s<t.length;s++)i=i||this.removeMarker_(t[s]);return!e&&i&&this.repaint(),i},t.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers=[]},t.prototype.repaint=function(){var t=this.clusters.slice();this.clusters=[],this.resetViewport(!1),this.redraw(),setTimeout((function(){for(var e=0;e<t.length;e++)t[e].remove()}),0)},t.prototype.getExtendedBounds=function(t){var e=this.getProjection(),i=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()));i.x+=this.gridSize,i.y-=this.gridSize;var s=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()));return s.x-=this.gridSize,s.y+=this.gridSize,t.extend(e.fromDivPixelToLatLng(i)),t.extend(e.fromDivPixelToLatLng(s)),t},t.prototype.redraw=function(){this.createClusters(0)},t.prototype.resetViewport=function(t){for(var e=0;e<this.clusters.length;e++)this.clusters[e].remove();this.clusters=[];for(e=0;e<this.markers.length;e++){var i=this.markers[e];i.isAdded=!1,t&&i.setMap(null)}},t.prototype.distanceBetweenPoints=function(t,e){var i=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,r=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371},t.prototype.isMarkerInBounds=function(t,e){var i=t.getPosition();return!!i&&e.contains(i)},t.prototype.addToClosestCluster=function(t){for(var i,s=4e4,r=null,n=0;n<this.clusters.length;n++){var o=(i=this.clusters[n]).getCenter(),a=t.getPosition();if(o&&a){var h=this.distanceBetweenPoints(o,a);h<s&&(s=h,r=i)}}r&&r.isMarkerInClusterBounds(t)?r.addMarker(t):((i=new e(this)).addMarker(t),this.clusters.push(i))},t.prototype.createClusters=function(t){var e=this;if(this.ready){0===t&&(google.maps.event.trigger(this,"clusteringbegin",this),null!==this.timerRefStatic&&(window.clearTimeout(this.timerRefStatic),delete this.timerRefStatic));for(var i=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),s=this.getExtendedBounds(i),r=Math.min(t+this.batchSize,this.markers.length),n=t;n<r;n++){var o=this.markers[n];!o.isAdded&&this.isMarkerInBounds(o,s)&&(!this.ignoreHidden||this.ignoreHidden&&o.getVisible())&&this.addToClosestCluster(o)}if(r<this.markers.length)this.timerRefStatic=window.setTimeout((function(){e.createClusters(r)}),0);else{this.timerRefStatic=null,google.maps.event.trigger(this,"clusteringend",this);for(n=0;n<this.clusters.length;n++)this.clusters[n].updateIcon()}}},t.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},t}();export{e as Cluster,t as ClusterIcon,r as Clusterer};
var t=function(){function t(e,i){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=i,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(e.getMap())}return t.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},t.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},t.prototype.onClick=function(t){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var e=this.cluster.getClusterer();if(google.maps.event.trigger(e,"click",this.cluster),google.maps.event.trigger(e,"clusterclick",this.cluster),e.getZoomOnClick()){var i=e.getMaxZoom(),s=this.cluster.getBounds();e.getMap().fitBounds(s),this.timeOut=window.setTimeout((function(){e.getMap().fitBounds(s),null!==i&&e.getMap().getZoom()>i&&e.getMap().setZoom(i+1)}),100)}t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}},t.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},t.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},t.prototype.onAdd=function(){this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div),this.boundsChangedListener=google.maps.event.addListener(this.getMap(),"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut)},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),null!==this.timeOut&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},t.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var t=this.getPosFromLatLng(this.center),e=t.x,i=t.y;this.div.style.top="".concat(i,"px"),this.div.style.left="".concat(e,"px")}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var t;if(this.div&&this.center){var e="",i=this.backgroundPosition.split(" "),s=parseInt(i[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(i[1].replace(/^\s+|\s+$/g,""),10),o=this.getPosFromLatLng(this.center);e=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,this.div.style.cursor="pointer",this.div.style.position="absolute",this.div.style.top="".concat(o.y,"px"),this.div.style.left="".concat(o.x,"px"),this.div.style.width="".concat(this.width,"px"),this.div.style.height="".concat(this.height,"px");var n=document.createElement("img");n.alt=e,n.src=this.url,n.style.position="absolute",n.style.top="".concat(r,"px"),n.style.left="".concat(s,"px"),this.cluster.getClusterer().enableRetinaIcons||(n.style.clip="rect(-".concat(r,"px, -").concat(s+this.width,"px, -").concat(r+this.height,", -").concat(s,")"));var a=document.createElement("div");a.style.position="absolute",a.style.top="".concat(this.anchorText[0],"px"),a.style.left="".concat(this.anchorText[1],"px"),a.style.color=this.textColor,a.style.fontSize="".concat(this.textSize,"px"),a.style.fontFamily=this.fontFamily,a.style.fontWeight=this.fontWeight,a.style.fontStyle=this.fontStyle,a.style.textDecoration=this.textDecoration,a.style.textAlign="center",a.style.width="".concat(this.width,"px"),a.style.lineHeight="".concat(this.height,"px"),a.innerText="".concat(null===(t=this.sums)||void 0===t?void 0:t.text),this.div.innerHTML="",this.div.appendChild(n),this.div.appendChild(a),this.div.title=e,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(t){this.sums=t;var e=this.cluster.getClusterer().getStyles(),i=e[Math.min(e.length-1,Math.max(0,t.index-1))];this.url=i.url,this.height=i.height,this.width=i.width,i.className&&(this.className="".concat(this.clusterClassName," ").concat(i.className)),this.anchorText=i.anchorText||[0,0],this.anchorIcon=i.anchorIcon||[this.height/2,this.width/2],this.textColor=i.textColor||"black",this.textSize=i.textSize||11,this.textDecoration=i.textDecoration||"none",this.fontWeight=i.fontWeight||"bold",this.fontStyle=i.fontStyle||"normal",this.fontFamily=i.fontFamily||"Arial,sans-serif",this.backgroundPosition=i.backgroundPosition||"0 0"},t.prototype.setCenter=function(t){this.center=t},t.prototype.getPosFromLatLng=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=this.anchorIcon[1],e.y-=this.anchorIcon[0],e},t}(),e=function(){function e(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new t(this,this.markerClusterer.getStyles())}return e.prototype.getSize=function(){return this.markers.length},e.prototype.getMarkers=function(){return this.markers},e.prototype.getCenter=function(){return this.center},e.prototype.getMap=function(){return this.map},e.prototype.getClusterer=function(){return this.markerClusterer},e.prototype.getBounds=function(){for(var t=new google.maps.LatLngBounds(this.center,this.center),e=this.getMarkers(),i=0;i<e.length;i++){var s=e[i].getPosition();s&&t.extend(s)}return t},e.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},e.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;var e;if(this.center){if(this.averageCenter&&(e=t.getPosition())){var i=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(i-1)+e.lat())/i,(this.center.lng()*(i-1)+e.lng())/i),this.calculateBounds()}}else(e=t.getPosition())&&(this.center=e,this.calculateBounds());t.isAdded=!0,this.markers.push(t);var s=this.markers.length,r=this.markerClusterer.getMaxZoom(),o=this.map.getZoom();if(null!==r&&void 0!==o&&o>r)t.getMap()!==this.map&&t.setMap(this.map);else if(s<this.minClusterSize)t.getMap()!==this.map&&t.setMap(this.map);else if(s===this.minClusterSize)for(var n=0;n<s;n++)this.markers[n].setMap(null);else t.setMap(null);return!0},e.prototype.isMarkerInClusterBounds=function(t){if(null!==this.bounds){var e=t.getPosition();if(e)return this.bounds.contains(e)}return!1},e.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},e.prototype.updateIcon=function(){var t=this.markers.length,e=this.markerClusterer.getMaxZoom(),i=this.map.getZoom();null!==e&&void 0!==i&&i>e||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},e.prototype.isMarkerAlreadyAdded=function(t){if(this.markers.includes)return this.markers.includes(t);for(var e=0;e<this.markers.length;e++)if(t===this.markers[e])return!0;return!1},e}(),i=function(t,e){var i=t.length,s=i.toString().length,r=Math.min(s,e);return{text:i.toString(),index:r,title:""}},s=[53,56,66,78,90],r=function(){function t(e,r,o){void 0===r&&(r=[]),void 0===o&&(o={}),this.extend(t,google.maps.OverlayView),this.markers=[],this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=o.gridSize||60,this.minClusterSize=o.minimumClusterSize||2,this.maxZoom=o.maxZoom||null,this.styles=o.styles||[],this.title=o.title||"",this.zoomOnClick=!0,void 0!==o.zoomOnClick&&(this.zoomOnClick=o.zoomOnClick),this.averageCenter=!1,void 0!==o.averageCenter&&(this.averageCenter=o.averageCenter),this.ignoreHidden=!1,void 0!==o.ignoreHidden&&(this.ignoreHidden=o.ignoreHidden),this.enableRetinaIcons=!1,void 0!==o.enableRetinaIcons&&(this.enableRetinaIcons=o.enableRetinaIcons),this.imagePath=o.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=o.imageExtension||"png",this.imageSizes=o.imageSizes||s,this.calculator=o.calculator||i,this.batchSize=o.batchSize||2e3,this.batchSizeIE=o.batchSizeIE||500,this.clusterClass=o.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(r,!0),this.setMap(e)}return t.prototype.onAdd=function(){var t=this;this.activeMap=this.getMap(),this.ready=!0,this.repaint(),this.listeners=[google.maps.event.addListener(this.getMap(),"zoom_changed",(function(){t.resetViewport(!1),t.getMap().getZoom()!==(t.get("minZoom")||0)&&t.getMap().getZoom()!==t.get("maxZoom")||google.maps.event.trigger(t,"idle")})),google.maps.event.addListener(this.getMap(),"idle",(function(){t.redraw()}))]},t.prototype.onRemove=function(){for(var t=0;t<this.markers.length;t++)this.markers[t].getMap()!==this.activeMap&&this.markers[t].setMap(this.activeMap);for(t=0;t<this.clusters.length;t++)this.clusters[t].remove();this.clusters=[];for(t=0;t<this.listeners.length;t++)google.maps.event.removeListener(this.listeners[t]);this.listeners=[],this.activeMap=null,this.ready=!1},t.prototype.draw=function(){},t.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var t=0;t<this.imageSizes.length;t++)this.styles.push({url:this.imagePath+(t+1)+"."+this.imageExtension,height:this.imageSizes[t],width:this.imageSizes[t]})},t.prototype.fitMapToMarkers=function(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,i=0;i<t.length;i++){var s=t[i].getPosition();s&&e.extend(s)}this.getMap().fitBounds(e)},t.prototype.getGridSize=function(){return this.gridSize},t.prototype.setGridSize=function(t){this.gridSize=t},t.prototype.getMinimumClusterSize=function(){return this.minClusterSize},t.prototype.setMinimumClusterSize=function(t){this.minClusterSize=t},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.setMaxZoom=function(t){this.maxZoom=t},t.prototype.getStyles=function(){return this.styles},t.prototype.setStyles=function(t){this.styles=t},t.prototype.getTitle=function(){return this.title},t.prototype.setTitle=function(t){this.title=t},t.prototype.getZoomOnClick=function(){return this.zoomOnClick},t.prototype.setZoomOnClick=function(t){this.zoomOnClick=t},t.prototype.getAverageCenter=function(){return this.averageCenter},t.prototype.setAverageCenter=function(t){this.averageCenter=t},t.prototype.getIgnoreHidden=function(){return this.ignoreHidden},t.prototype.setIgnoreHidden=function(t){this.ignoreHidden=t},t.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons},t.prototype.setEnableRetinaIcons=function(t){this.enableRetinaIcons=t},t.prototype.getImageExtension=function(){return this.imageExtension},t.prototype.setImageExtension=function(t){this.imageExtension=t},t.prototype.getImagePath=function(){return this.imagePath},t.prototype.setImagePath=function(t){this.imagePath=t},t.prototype.getImageSizes=function(){return this.imageSizes},t.prototype.setImageSizes=function(t){this.imageSizes=t},t.prototype.getCalculator=function(){return this.calculator},t.prototype.setCalculator=function(t){this.calculator=t},t.prototype.getBatchSizeIE=function(){return this.batchSizeIE},t.prototype.setBatchSizeIE=function(t){this.batchSizeIE=t},t.prototype.getClusterClass=function(){return this.clusterClass},t.prototype.setClusterClass=function(t){this.clusterClass=t},t.prototype.getMarkers=function(){return this.markers},t.prototype.getTotalMarkers=function(){return this.markers.length},t.prototype.getClusters=function(){return this.clusters},t.prototype.getTotalClusters=function(){return this.clusters.length},t.prototype.addMarker=function(t,e){this.pushMarkerTo(t),e||this.redraw()},t.prototype.addMarkers=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&this.pushMarkerTo(t[i]);e||this.redraw()},t.prototype.pushMarkerTo=function(t){var e=this;t.getDraggable()&&google.maps.event.addListener(t,"dragend",(function(){e.ready&&(t.isAdded=!1,e.repaint())})),t.isAdded=!1,this.markers.push(t)},t.prototype.removeMarker_=function(t){var e=-1;if(this.markers.indexOf)e=this.markers.indexOf(t);else for(var i=0;i<this.markers.length;i++)if(t===this.markers[i]){e=i;break}return-1!==e&&(t.setMap(null),this.markers.splice(e,1),!0)},t.prototype.removeMarker=function(t,e){var i=this.removeMarker_(t);return!e&&i&&this.repaint(),i},t.prototype.removeMarkers=function(t,e){for(var i=!1,s=0;s<t.length;s++)i=i||this.removeMarker_(t[s]);return!e&&i&&this.repaint(),i},t.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers=[]},t.prototype.repaint=function(){var t=this.clusters.slice();this.clusters=[],this.resetViewport(!1),this.redraw(),setTimeout((function(){for(var e=0;e<t.length;e++)t[e].remove()}),0)},t.prototype.getExtendedBounds=function(t){var e=this.getProjection(),i=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()));i.x+=this.gridSize,i.y-=this.gridSize;var s=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()));return s.x-=this.gridSize,s.y+=this.gridSize,t.extend(e.fromDivPixelToLatLng(i)),t.extend(e.fromDivPixelToLatLng(s)),t},t.prototype.redraw=function(){this.createClusters(0)},t.prototype.resetViewport=function(t){for(var e=0;e<this.clusters.length;e++)this.clusters[e].remove();this.clusters=[];for(e=0;e<this.markers.length;e++){var i=this.markers[e];i.isAdded=!1,t&&i.setMap(null)}},t.prototype.distanceBetweenPoints=function(t,e){var i=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,r=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371},t.prototype.isMarkerInBounds=function(t,e){var i=t.getPosition();return!!i&&e.contains(i)},t.prototype.addToClosestCluster=function(t){for(var i,s=4e4,r=null,o=0;o<this.clusters.length;o++){var n=(i=this.clusters[o]).getCenter(),a=t.getPosition();if(n&&a){var h=this.distanceBetweenPoints(n,a);h<s&&(s=h,r=i)}}r&&r.isMarkerInClusterBounds(t)?r.addMarker(t):((i=new e(this)).addMarker(t),this.clusters.push(i))},t.prototype.createClusters=function(t){var e=this;if(this.ready){0===t&&(google.maps.event.trigger(this,"clusteringbegin",this),null!==this.timerRefStatic&&(window.clearTimeout(this.timerRefStatic),delete this.timerRefStatic));for(var i=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),s=this.getExtendedBounds(i),r=Math.min(t+this.batchSize,this.markers.length),o=t;o<r;o++){var n=this.markers[o];!n.isAdded&&this.isMarkerInBounds(n,s)&&(!this.ignoreHidden||this.ignoreHidden&&n.getVisible())&&this.addToClosestCluster(n)}if(r<this.markers.length)this.timerRefStatic=window.setTimeout((function(){e.createClusters(r)}),0);else{this.timerRefStatic=null,google.maps.event.trigger(this,"clusteringend",this);for(o=0;o<this.clusters.length;o++)this.clusters[o].updateIcon()}}},t.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},t}();export{e as Cluster,t as ClusterIcon,r as Clusterer};
//# sourceMappingURL=esm.min.js.map

@@ -65,4 +65,12 @@ interface ClusterIconInfo {

backgroundPosition: string;
cMouseDownInCluster: boolean | null;
cDraggingMapByCluster: boolean | null;
timeOut: number | null;
boundsChangedListener: google.maps.MapsEventListener | null;
constructor(cluster: Cluster, styles: ClusterIconStyle[]);
onBoundsChanged(): void;
onMouseDown(): void;
onClick(event: Event): void;
onMouseOver(): void;
onMouseOut(): void;
onAdd(): void;

@@ -69,0 +77,0 @@ onRemove(): void;

@@ -31,9 +31,79 @@ (function (global, factory) {

this.backgroundPosition = '0 0';
this.cMouseDownInCluster = null;
this.cDraggingMapByCluster = null;
this.timeOut = null;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.setMap(cluster.getMap()); // Note: this causes onAdd to be called
}
ClusterIcon.prototype.onBoundsChanged = function () {
this.cDraggingMapByCluster = this.cMouseDownInCluster;
};
ClusterIcon.prototype.onMouseDown = function () {
this.cMouseDownInCluster = true;
this.cDraggingMapByCluster = false;
};
ClusterIcon.prototype.onClick = function (event) {
this.cMouseDownInCluster = false;
if (!this.cDraggingMapByCluster) {
var markerClusterer_1 = this.cluster.getClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(markerClusterer_1, 'click', this.cluster);
google.maps.event.trigger(markerClusterer_1, 'clusterclick', this.cluster); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (markerClusterer_1.getZoomOnClick()) {
// Zoom into the cluster.
var maxZoom_1 = markerClusterer_1.getMaxZoom();
var bounds_1 = this.cluster.getBounds();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// There is a fix for Issue 170 here:
this.timeOut = window.setTimeout(function () {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// Don't zoom beyond the max zoom level
if (maxZoom_1 !== null &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().getZoom() > maxZoom_1) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
markerClusterer_1.getMap().setZoom(maxZoom_1 + 1);
}
}, 100);
}
// Prevent event propagation to the map:
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
}
}
};
ClusterIcon.prototype.onMouseOver = function () {
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(this.cluster.getClusterer(), 'mouseover', this.cluster);
};
ClusterIcon.prototype.onMouseOut = function () {
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(this.cluster.getClusterer(), 'mouseout', this.cluster);
};
ClusterIcon.prototype.onAdd = function () {
var _this = this;
var cMouseDownInCluster;
var cDraggingMapByCluster;
this.div = document.createElement('div');

@@ -44,2 +114,3 @@ this.div.className = this.className;

}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

@@ -49,67 +120,9 @@ this.getPanes().overlayMouseTarget.appendChild(this.div);

this.boundsChangedListener = google.maps.event.addListener(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.getMap(), 'boundschanged', function boundsChanged() {
cDraggingMapByCluster = cMouseDownInCluster;
});
google.maps.event.addListener(this.div, 'mousedown', function onMouseDown() {
cMouseDownInCluster = true;
cDraggingMapByCluster = false;
});
google.maps.event.addListener(this.div, 'click', function (event) {
cMouseDownInCluster = false;
if (!cDraggingMapByCluster) {
var markerClusterer_1 = _this.cluster.getClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(markerClusterer_1, 'click', _this.cluster);
google.maps.event.trigger(markerClusterer_1, 'clusterclick', _this.cluster); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (markerClusterer_1.getZoomOnClick()) {
// Zoom into the cluster.
var maxZoom_1 = markerClusterer_1.getMaxZoom();
var bounds_1 = _this.cluster.getBounds();
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// There is a fix for Issue 170 here:
setTimeout(function timeout() {
// @ts-ignore
markerClusterer_1.getMap().fitBounds(bounds_1);
// Don't zoom beyond the max zoom level
// @ts-ignore
if (maxZoom_1 !== null && markerClusterer_1.getMap().getZoom() > maxZoom_1) {
// @ts-ignore
markerClusterer_1.getMap().setZoom(maxZoom_1 + 1);
}
}, 100);
}
// Prevent event propagation to the map:
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
}
}
});
google.maps.event.addListener(this.div, 'mouseover', function () {
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(_this.cluster.getClusterer(), 'mouseover', _this.cluster);
});
google.maps.event.addListener(this.div, 'mouseout', function () {
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(_this.cluster.getClusterer(), 'mouseout', _this.cluster);
});
this.getMap(), 'bounds_changed', this.onBoundsChanged);
this.div.addEventListener('mousedown', this.onMouseDown);
this.div.addEventListener('click', this.onClick);
this.div.addEventListener('mouseover', this.onMouseOver);
this.div.addEventListener('mouseout', this.onMouseOut);
};

@@ -122,4 +135,11 @@ ClusterIcon.prototype.onRemove = function () {

}
google.maps.event.clearInstanceListeners(this.div);
this.div.removeEventListener('mousedown', this.onMouseDown);
this.div.removeEventListener('click', this.onClick);
this.div.removeEventListener('mouseover', this.onMouseOver);
this.div.removeEventListener('mouseout', this.onMouseOut);
this.div.parentNode.removeChild(this.div);
if (this.timeOut !== null) {
window.clearTimeout(this.timeOut);
this.timeOut = null;
}
this.div = null;

@@ -131,4 +151,4 @@ }

var _a = this.getPosFromLatLng(this.center), x = _a.x, y = _a.y;
this.div.style.top = y + 'px';
this.div.style.left = x + 'px';
this.div.style.top = "".concat(y, "px");
this.div.style.left = "".concat(x, "px");
}

@@ -151,3 +171,5 @@ };

var pos = this.getPosFromLatLng(this.center);
if (this.sums === null || typeof this.sums.title === 'undefined' || this.sums.title === '') {
if (this.sums === null ||
typeof this.sums.title === 'undefined' ||
this.sums.title === '') {
divTitle = this.cluster.getClusterer().getTitle();

@@ -222,4 +244,2 @@ }

pos.y -= this.anchorIcon[0];
// pos.x = pos.x
// pos.y = pos.y
return pos;

@@ -226,0 +246,0 @@ };

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).markerClusterer={})}(this,(function(t){"use strict";var e=function(){function t(e,i){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=i,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.setMap(e.getMap())}return t.prototype.onAdd=function(){var t,e,i=this;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div),this.boundsChangedListener=google.maps.event.addListener(this.getMap(),"boundschanged",(function(){e=t})),google.maps.event.addListener(this.div,"mousedown",(function(){t=!0,e=!1})),google.maps.event.addListener(this.div,"click",(function(s){if(t=!1,!e){var r=i.cluster.getClusterer();if(google.maps.event.trigger(r,"click",i.cluster),google.maps.event.trigger(r,"clusterclick",i.cluster),r.getZoomOnClick()){var o=r.getMaxZoom(),n=i.cluster.getBounds();r.getMap().fitBounds(n),setTimeout((function(){r.getMap().fitBounds(n),null!==o&&r.getMap().getZoom()>o&&r.getMap().setZoom(o+1)}),100)}s.cancelBubble=!0,s.stopPropagation&&s.stopPropagation()}})),google.maps.event.addListener(this.div,"mouseover",(function(){google.maps.event.trigger(i.cluster.getClusterer(),"mouseover",i.cluster)})),google.maps.event.addListener(this.div,"mouseout",(function(){google.maps.event.trigger(i.cluster.getClusterer(),"mouseout",i.cluster)}))},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),google.maps.event.clearInstanceListeners(this.div),this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var t=this.getPosFromLatLng(this.center),e=t.x,i=t.y;this.div.style.top=i+"px",this.div.style.left=e+"px"}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var t;if(this.div&&this.center){var e="",i=this.backgroundPosition.split(" "),s=parseInt(i[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(i[1].replace(/^\s+|\s+$/g,""),10),o=this.getPosFromLatLng(this.center);e=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,this.div.style.cursor="pointer",this.div.style.position="absolute",this.div.style.top="".concat(o.y,"px"),this.div.style.left="".concat(o.x,"px"),this.div.style.width="".concat(this.width,"px"),this.div.style.height="".concat(this.height,"px");var n=document.createElement("img");n.alt=e,n.src=this.url,n.style.position="absolute",n.style.top="".concat(r,"px"),n.style.left="".concat(s,"px"),this.cluster.getClusterer().enableRetinaIcons||(n.style.clip="rect(-".concat(r,"px, -").concat(s+this.width,"px, -").concat(r+this.height,", -").concat(s,")"));var a=document.createElement("div");a.style.position="absolute",a.style.top="".concat(this.anchorText[0],"px"),a.style.left="".concat(this.anchorText[1],"px"),a.style.color=this.textColor,a.style.fontSize="".concat(this.textSize,"px"),a.style.fontFamily=this.fontFamily,a.style.fontWeight=this.fontWeight,a.style.fontStyle=this.fontStyle,a.style.textDecoration=this.textDecoration,a.style.textAlign="center",a.style.width="".concat(this.width,"px"),a.style.lineHeight="".concat(this.height,"px"),a.innerText="".concat(null===(t=this.sums)||void 0===t?void 0:t.text),this.div.innerHTML="",this.div.appendChild(n),this.div.appendChild(a),this.div.title=e,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(t){this.sums=t;var e=this.cluster.getClusterer().getStyles(),i=e[Math.min(e.length-1,Math.max(0,t.index-1))];this.url=i.url,this.height=i.height,this.width=i.width,i.className&&(this.className="".concat(this.clusterClassName," ").concat(i.className)),this.anchorText=i.anchorText||[0,0],this.anchorIcon=i.anchorIcon||[this.height/2,this.width/2],this.textColor=i.textColor||"black",this.textSize=i.textSize||11,this.textDecoration=i.textDecoration||"none",this.fontWeight=i.fontWeight||"bold",this.fontStyle=i.fontStyle||"normal",this.fontFamily=i.fontFamily||"Arial,sans-serif",this.backgroundPosition=i.backgroundPosition||"0 0"},t.prototype.setCenter=function(t){this.center=t},t.prototype.getPosFromLatLng=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=this.anchorIcon[1],e.y-=this.anchorIcon[0],e},t}(),i=function(){function t(t){this.markerClusterer=t,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new e(this,this.markerClusterer.getStyles())}return t.prototype.getSize=function(){return this.markers.length},t.prototype.getMarkers=function(){return this.markers},t.prototype.getCenter=function(){return this.center},t.prototype.getMap=function(){return this.map},t.prototype.getClusterer=function(){return this.markerClusterer},t.prototype.getBounds=function(){for(var t=new google.maps.LatLngBounds(this.center,this.center),e=this.getMarkers(),i=0;i<e.length;i++){var s=e[i].getPosition();s&&t.extend(s)}return t},t.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},t.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;var e;if(this.center){if(this.averageCenter&&(e=t.getPosition())){var i=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(i-1)+e.lat())/i,(this.center.lng()*(i-1)+e.lng())/i),this.calculateBounds()}}else(e=t.getPosition())&&(this.center=e,this.calculateBounds());t.isAdded=!0,this.markers.push(t);var s=this.markers.length,r=this.markerClusterer.getMaxZoom(),o=this.map.getZoom();if(null!==r&&void 0!==o&&o>r)t.getMap()!==this.map&&t.setMap(this.map);else if(s<this.minClusterSize)t.getMap()!==this.map&&t.setMap(this.map);else if(s===this.minClusterSize)for(var n=0;n<s;n++)this.markers[n].setMap(null);else t.setMap(null);return!0},t.prototype.isMarkerInClusterBounds=function(t){if(null!==this.bounds){var e=t.getPosition();if(e)return this.bounds.contains(e)}return!1},t.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},t.prototype.updateIcon=function(){var t=this.markers.length,e=this.markerClusterer.getMaxZoom(),i=this.map.getZoom();null!==e&&void 0!==i&&i>e||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},t.prototype.isMarkerAlreadyAdded=function(t){if(this.markers.includes)return this.markers.includes(t);for(var e=0;e<this.markers.length;e++)if(t===this.markers[e])return!0;return!1},t}(),s=function(t,e){var i=t.length,s=i.toString().length,r=Math.min(s,e);return{text:i.toString(),index:r,title:""}},r=[53,56,66,78,90],o=function(){function t(e,i,o){void 0===i&&(i=[]),void 0===o&&(o={}),this.extend(t,google.maps.OverlayView),this.markers=[],this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=o.gridSize||60,this.minClusterSize=o.minimumClusterSize||2,this.maxZoom=o.maxZoom||null,this.styles=o.styles||[],this.title=o.title||"",this.zoomOnClick=!0,void 0!==o.zoomOnClick&&(this.zoomOnClick=o.zoomOnClick),this.averageCenter=!1,void 0!==o.averageCenter&&(this.averageCenter=o.averageCenter),this.ignoreHidden=!1,void 0!==o.ignoreHidden&&(this.ignoreHidden=o.ignoreHidden),this.enableRetinaIcons=!1,void 0!==o.enableRetinaIcons&&(this.enableRetinaIcons=o.enableRetinaIcons),this.imagePath=o.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=o.imageExtension||"png",this.imageSizes=o.imageSizes||r,this.calculator=o.calculator||s,this.batchSize=o.batchSize||2e3,this.batchSizeIE=o.batchSizeIE||500,this.clusterClass=o.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(i,!0),this.setMap(e)}return t.prototype.onAdd=function(){var t=this;this.activeMap=this.getMap(),this.ready=!0,this.repaint(),this.listeners=[google.maps.event.addListener(this.getMap(),"zoom_changed",(function(){t.resetViewport(!1),t.getMap().getZoom()!==(t.get("minZoom")||0)&&t.getMap().getZoom()!==t.get("maxZoom")||google.maps.event.trigger(t,"idle")})),google.maps.event.addListener(this.getMap(),"idle",(function(){t.redraw()}))]},t.prototype.onRemove=function(){for(var t=0;t<this.markers.length;t++)this.markers[t].getMap()!==this.activeMap&&this.markers[t].setMap(this.activeMap);for(t=0;t<this.clusters.length;t++)this.clusters[t].remove();this.clusters=[];for(t=0;t<this.listeners.length;t++)google.maps.event.removeListener(this.listeners[t]);this.listeners=[],this.activeMap=null,this.ready=!1},t.prototype.draw=function(){},t.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var t=0;t<this.imageSizes.length;t++)this.styles.push({url:this.imagePath+(t+1)+"."+this.imageExtension,height:this.imageSizes[t],width:this.imageSizes[t]})},t.prototype.fitMapToMarkers=function(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,i=0;i<t.length;i++){var s=t[i].getPosition();s&&e.extend(s)}this.getMap().fitBounds(e)},t.prototype.getGridSize=function(){return this.gridSize},t.prototype.setGridSize=function(t){this.gridSize=t},t.prototype.getMinimumClusterSize=function(){return this.minClusterSize},t.prototype.setMinimumClusterSize=function(t){this.minClusterSize=t},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.setMaxZoom=function(t){this.maxZoom=t},t.prototype.getStyles=function(){return this.styles},t.prototype.setStyles=function(t){this.styles=t},t.prototype.getTitle=function(){return this.title},t.prototype.setTitle=function(t){this.title=t},t.prototype.getZoomOnClick=function(){return this.zoomOnClick},t.prototype.setZoomOnClick=function(t){this.zoomOnClick=t},t.prototype.getAverageCenter=function(){return this.averageCenter},t.prototype.setAverageCenter=function(t){this.averageCenter=t},t.prototype.getIgnoreHidden=function(){return this.ignoreHidden},t.prototype.setIgnoreHidden=function(t){this.ignoreHidden=t},t.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons},t.prototype.setEnableRetinaIcons=function(t){this.enableRetinaIcons=t},t.prototype.getImageExtension=function(){return this.imageExtension},t.prototype.setImageExtension=function(t){this.imageExtension=t},t.prototype.getImagePath=function(){return this.imagePath},t.prototype.setImagePath=function(t){this.imagePath=t},t.prototype.getImageSizes=function(){return this.imageSizes},t.prototype.setImageSizes=function(t){this.imageSizes=t},t.prototype.getCalculator=function(){return this.calculator},t.prototype.setCalculator=function(t){this.calculator=t},t.prototype.getBatchSizeIE=function(){return this.batchSizeIE},t.prototype.setBatchSizeIE=function(t){this.batchSizeIE=t},t.prototype.getClusterClass=function(){return this.clusterClass},t.prototype.setClusterClass=function(t){this.clusterClass=t},t.prototype.getMarkers=function(){return this.markers},t.prototype.getTotalMarkers=function(){return this.markers.length},t.prototype.getClusters=function(){return this.clusters},t.prototype.getTotalClusters=function(){return this.clusters.length},t.prototype.addMarker=function(t,e){this.pushMarkerTo(t),e||this.redraw()},t.prototype.addMarkers=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&this.pushMarkerTo(t[i]);e||this.redraw()},t.prototype.pushMarkerTo=function(t){var e=this;t.getDraggable()&&google.maps.event.addListener(t,"dragend",(function(){e.ready&&(t.isAdded=!1,e.repaint())})),t.isAdded=!1,this.markers.push(t)},t.prototype.removeMarker_=function(t){var e=-1;if(this.markers.indexOf)e=this.markers.indexOf(t);else for(var i=0;i<this.markers.length;i++)if(t===this.markers[i]){e=i;break}return-1!==e&&(t.setMap(null),this.markers.splice(e,1),!0)},t.prototype.removeMarker=function(t,e){var i=this.removeMarker_(t);return!e&&i&&this.repaint(),i},t.prototype.removeMarkers=function(t,e){for(var i=!1,s=0;s<t.length;s++)i=i||this.removeMarker_(t[s]);return!e&&i&&this.repaint(),i},t.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers=[]},t.prototype.repaint=function(){var t=this.clusters.slice();this.clusters=[],this.resetViewport(!1),this.redraw(),setTimeout((function(){for(var e=0;e<t.length;e++)t[e].remove()}),0)},t.prototype.getExtendedBounds=function(t){var e=this.getProjection(),i=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()));i.x+=this.gridSize,i.y-=this.gridSize;var s=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()));return s.x-=this.gridSize,s.y+=this.gridSize,t.extend(e.fromDivPixelToLatLng(i)),t.extend(e.fromDivPixelToLatLng(s)),t},t.prototype.redraw=function(){this.createClusters(0)},t.prototype.resetViewport=function(t){for(var e=0;e<this.clusters.length;e++)this.clusters[e].remove();this.clusters=[];for(e=0;e<this.markers.length;e++){var i=this.markers[e];i.isAdded=!1,t&&i.setMap(null)}},t.prototype.distanceBetweenPoints=function(t,e){var i=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,r=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371},t.prototype.isMarkerInBounds=function(t,e){var i=t.getPosition();return!!i&&e.contains(i)},t.prototype.addToClosestCluster=function(t){for(var e,s=4e4,r=null,o=0;o<this.clusters.length;o++){var n=(e=this.clusters[o]).getCenter(),a=t.getPosition();if(n&&a){var h=this.distanceBetweenPoints(n,a);h<s&&(s=h,r=e)}}r&&r.isMarkerInClusterBounds(t)?r.addMarker(t):((e=new i(this)).addMarker(t),this.clusters.push(e))},t.prototype.createClusters=function(t){var e=this;if(this.ready){0===t&&(google.maps.event.trigger(this,"clusteringbegin",this),null!==this.timerRefStatic&&(window.clearTimeout(this.timerRefStatic),delete this.timerRefStatic));for(var i=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),s=this.getExtendedBounds(i),r=Math.min(t+this.batchSize,this.markers.length),o=t;o<r;o++){var n=this.markers[o];!n.isAdded&&this.isMarkerInBounds(n,s)&&(!this.ignoreHidden||this.ignoreHidden&&n.getVisible())&&this.addToClosestCluster(n)}if(r<this.markers.length)this.timerRefStatic=window.setTimeout((function(){e.createClusters(r)}),0);else{this.timerRefStatic=null,google.maps.event.trigger(this,"clusteringend",this);for(o=0;o<this.clusters.length;o++)this.clusters[o].updateIcon()}}},t.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},t}();t.Cluster=i,t.ClusterIcon=e,t.Clusterer=o,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).markerClusterer={})}(this,(function(t){"use strict";var e=function(){function t(e,i){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=i,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(e.getMap())}return t.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},t.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},t.prototype.onClick=function(t){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var e=this.cluster.getClusterer();if(google.maps.event.trigger(e,"click",this.cluster),google.maps.event.trigger(e,"clusterclick",this.cluster),e.getZoomOnClick()){var i=e.getMaxZoom(),s=this.cluster.getBounds();e.getMap().fitBounds(s),this.timeOut=window.setTimeout((function(){e.getMap().fitBounds(s),null!==i&&e.getMap().getZoom()>i&&e.getMap().setZoom(i+1)}),100)}t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}},t.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},t.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},t.prototype.onAdd=function(){this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div),this.boundsChangedListener=google.maps.event.addListener(this.getMap(),"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut)},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),null!==this.timeOut&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},t.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var t=this.getPosFromLatLng(this.center),e=t.x,i=t.y;this.div.style.top="".concat(i,"px"),this.div.style.left="".concat(e,"px")}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var t;if(this.div&&this.center){var e="",i=this.backgroundPosition.split(" "),s=parseInt(i[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(i[1].replace(/^\s+|\s+$/g,""),10),o=this.getPosFromLatLng(this.center);e=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,this.div.style.cursor="pointer",this.div.style.position="absolute",this.div.style.top="".concat(o.y,"px"),this.div.style.left="".concat(o.x,"px"),this.div.style.width="".concat(this.width,"px"),this.div.style.height="".concat(this.height,"px");var n=document.createElement("img");n.alt=e,n.src=this.url,n.style.position="absolute",n.style.top="".concat(r,"px"),n.style.left="".concat(s,"px"),this.cluster.getClusterer().enableRetinaIcons||(n.style.clip="rect(-".concat(r,"px, -").concat(s+this.width,"px, -").concat(r+this.height,", -").concat(s,")"));var a=document.createElement("div");a.style.position="absolute",a.style.top="".concat(this.anchorText[0],"px"),a.style.left="".concat(this.anchorText[1],"px"),a.style.color=this.textColor,a.style.fontSize="".concat(this.textSize,"px"),a.style.fontFamily=this.fontFamily,a.style.fontWeight=this.fontWeight,a.style.fontStyle=this.fontStyle,a.style.textDecoration=this.textDecoration,a.style.textAlign="center",a.style.width="".concat(this.width,"px"),a.style.lineHeight="".concat(this.height,"px"),a.innerText="".concat(null===(t=this.sums)||void 0===t?void 0:t.text),this.div.innerHTML="",this.div.appendChild(n),this.div.appendChild(a),this.div.title=e,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(t){this.sums=t;var e=this.cluster.getClusterer().getStyles(),i=e[Math.min(e.length-1,Math.max(0,t.index-1))];this.url=i.url,this.height=i.height,this.width=i.width,i.className&&(this.className="".concat(this.clusterClassName," ").concat(i.className)),this.anchorText=i.anchorText||[0,0],this.anchorIcon=i.anchorIcon||[this.height/2,this.width/2],this.textColor=i.textColor||"black",this.textSize=i.textSize||11,this.textDecoration=i.textDecoration||"none",this.fontWeight=i.fontWeight||"bold",this.fontStyle=i.fontStyle||"normal",this.fontFamily=i.fontFamily||"Arial,sans-serif",this.backgroundPosition=i.backgroundPosition||"0 0"},t.prototype.setCenter=function(t){this.center=t},t.prototype.getPosFromLatLng=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=this.anchorIcon[1],e.y-=this.anchorIcon[0],e},t}(),i=function(){function t(t){this.markerClusterer=t,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new e(this,this.markerClusterer.getStyles())}return t.prototype.getSize=function(){return this.markers.length},t.prototype.getMarkers=function(){return this.markers},t.prototype.getCenter=function(){return this.center},t.prototype.getMap=function(){return this.map},t.prototype.getClusterer=function(){return this.markerClusterer},t.prototype.getBounds=function(){for(var t=new google.maps.LatLngBounds(this.center,this.center),e=this.getMarkers(),i=0;i<e.length;i++){var s=e[i].getPosition();s&&t.extend(s)}return t},t.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},t.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;var e;if(this.center){if(this.averageCenter&&(e=t.getPosition())){var i=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(i-1)+e.lat())/i,(this.center.lng()*(i-1)+e.lng())/i),this.calculateBounds()}}else(e=t.getPosition())&&(this.center=e,this.calculateBounds());t.isAdded=!0,this.markers.push(t);var s=this.markers.length,r=this.markerClusterer.getMaxZoom(),o=this.map.getZoom();if(null!==r&&void 0!==o&&o>r)t.getMap()!==this.map&&t.setMap(this.map);else if(s<this.minClusterSize)t.getMap()!==this.map&&t.setMap(this.map);else if(s===this.minClusterSize)for(var n=0;n<s;n++)this.markers[n].setMap(null);else t.setMap(null);return!0},t.prototype.isMarkerInClusterBounds=function(t){if(null!==this.bounds){var e=t.getPosition();if(e)return this.bounds.contains(e)}return!1},t.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},t.prototype.updateIcon=function(){var t=this.markers.length,e=this.markerClusterer.getMaxZoom(),i=this.map.getZoom();null!==e&&void 0!==i&&i>e||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},t.prototype.isMarkerAlreadyAdded=function(t){if(this.markers.includes)return this.markers.includes(t);for(var e=0;e<this.markers.length;e++)if(t===this.markers[e])return!0;return!1},t}(),s=function(t,e){var i=t.length,s=i.toString().length,r=Math.min(s,e);return{text:i.toString(),index:r,title:""}},r=[53,56,66,78,90],o=function(){function t(e,i,o){void 0===i&&(i=[]),void 0===o&&(o={}),this.extend(t,google.maps.OverlayView),this.markers=[],this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=o.gridSize||60,this.minClusterSize=o.minimumClusterSize||2,this.maxZoom=o.maxZoom||null,this.styles=o.styles||[],this.title=o.title||"",this.zoomOnClick=!0,void 0!==o.zoomOnClick&&(this.zoomOnClick=o.zoomOnClick),this.averageCenter=!1,void 0!==o.averageCenter&&(this.averageCenter=o.averageCenter),this.ignoreHidden=!1,void 0!==o.ignoreHidden&&(this.ignoreHidden=o.ignoreHidden),this.enableRetinaIcons=!1,void 0!==o.enableRetinaIcons&&(this.enableRetinaIcons=o.enableRetinaIcons),this.imagePath=o.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=o.imageExtension||"png",this.imageSizes=o.imageSizes||r,this.calculator=o.calculator||s,this.batchSize=o.batchSize||2e3,this.batchSizeIE=o.batchSizeIE||500,this.clusterClass=o.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(i,!0),this.setMap(e)}return t.prototype.onAdd=function(){var t=this;this.activeMap=this.getMap(),this.ready=!0,this.repaint(),this.listeners=[google.maps.event.addListener(this.getMap(),"zoom_changed",(function(){t.resetViewport(!1),t.getMap().getZoom()!==(t.get("minZoom")||0)&&t.getMap().getZoom()!==t.get("maxZoom")||google.maps.event.trigger(t,"idle")})),google.maps.event.addListener(this.getMap(),"idle",(function(){t.redraw()}))]},t.prototype.onRemove=function(){for(var t=0;t<this.markers.length;t++)this.markers[t].getMap()!==this.activeMap&&this.markers[t].setMap(this.activeMap);for(t=0;t<this.clusters.length;t++)this.clusters[t].remove();this.clusters=[];for(t=0;t<this.listeners.length;t++)google.maps.event.removeListener(this.listeners[t]);this.listeners=[],this.activeMap=null,this.ready=!1},t.prototype.draw=function(){},t.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var t=0;t<this.imageSizes.length;t++)this.styles.push({url:this.imagePath+(t+1)+"."+this.imageExtension,height:this.imageSizes[t],width:this.imageSizes[t]})},t.prototype.fitMapToMarkers=function(){for(var t=this.getMarkers(),e=new google.maps.LatLngBounds,i=0;i<t.length;i++){var s=t[i].getPosition();s&&e.extend(s)}this.getMap().fitBounds(e)},t.prototype.getGridSize=function(){return this.gridSize},t.prototype.setGridSize=function(t){this.gridSize=t},t.prototype.getMinimumClusterSize=function(){return this.minClusterSize},t.prototype.setMinimumClusterSize=function(t){this.minClusterSize=t},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.setMaxZoom=function(t){this.maxZoom=t},t.prototype.getStyles=function(){return this.styles},t.prototype.setStyles=function(t){this.styles=t},t.prototype.getTitle=function(){return this.title},t.prototype.setTitle=function(t){this.title=t},t.prototype.getZoomOnClick=function(){return this.zoomOnClick},t.prototype.setZoomOnClick=function(t){this.zoomOnClick=t},t.prototype.getAverageCenter=function(){return this.averageCenter},t.prototype.setAverageCenter=function(t){this.averageCenter=t},t.prototype.getIgnoreHidden=function(){return this.ignoreHidden},t.prototype.setIgnoreHidden=function(t){this.ignoreHidden=t},t.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons},t.prototype.setEnableRetinaIcons=function(t){this.enableRetinaIcons=t},t.prototype.getImageExtension=function(){return this.imageExtension},t.prototype.setImageExtension=function(t){this.imageExtension=t},t.prototype.getImagePath=function(){return this.imagePath},t.prototype.setImagePath=function(t){this.imagePath=t},t.prototype.getImageSizes=function(){return this.imageSizes},t.prototype.setImageSizes=function(t){this.imageSizes=t},t.prototype.getCalculator=function(){return this.calculator},t.prototype.setCalculator=function(t){this.calculator=t},t.prototype.getBatchSizeIE=function(){return this.batchSizeIE},t.prototype.setBatchSizeIE=function(t){this.batchSizeIE=t},t.prototype.getClusterClass=function(){return this.clusterClass},t.prototype.setClusterClass=function(t){this.clusterClass=t},t.prototype.getMarkers=function(){return this.markers},t.prototype.getTotalMarkers=function(){return this.markers.length},t.prototype.getClusters=function(){return this.clusters},t.prototype.getTotalClusters=function(){return this.clusters.length},t.prototype.addMarker=function(t,e){this.pushMarkerTo(t),e||this.redraw()},t.prototype.addMarkers=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&this.pushMarkerTo(t[i]);e||this.redraw()},t.prototype.pushMarkerTo=function(t){var e=this;t.getDraggable()&&google.maps.event.addListener(t,"dragend",(function(){e.ready&&(t.isAdded=!1,e.repaint())})),t.isAdded=!1,this.markers.push(t)},t.prototype.removeMarker_=function(t){var e=-1;if(this.markers.indexOf)e=this.markers.indexOf(t);else for(var i=0;i<this.markers.length;i++)if(t===this.markers[i]){e=i;break}return-1!==e&&(t.setMap(null),this.markers.splice(e,1),!0)},t.prototype.removeMarker=function(t,e){var i=this.removeMarker_(t);return!e&&i&&this.repaint(),i},t.prototype.removeMarkers=function(t,e){for(var i=!1,s=0;s<t.length;s++)i=i||this.removeMarker_(t[s]);return!e&&i&&this.repaint(),i},t.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers=[]},t.prototype.repaint=function(){var t=this.clusters.slice();this.clusters=[],this.resetViewport(!1),this.redraw(),setTimeout((function(){for(var e=0;e<t.length;e++)t[e].remove()}),0)},t.prototype.getExtendedBounds=function(t){var e=this.getProjection(),i=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()));i.x+=this.gridSize,i.y-=this.gridSize;var s=e.fromLatLngToDivPixel(new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()));return s.x-=this.gridSize,s.y+=this.gridSize,t.extend(e.fromDivPixelToLatLng(i)),t.extend(e.fromDivPixelToLatLng(s)),t},t.prototype.redraw=function(){this.createClusters(0)},t.prototype.resetViewport=function(t){for(var e=0;e<this.clusters.length;e++)this.clusters[e].remove();this.clusters=[];for(e=0;e<this.markers.length;e++){var i=this.markers[e];i.isAdded=!1,t&&i.setMap(null)}},t.prototype.distanceBetweenPoints=function(t,e){var i=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,r=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371},t.prototype.isMarkerInBounds=function(t,e){var i=t.getPosition();return!!i&&e.contains(i)},t.prototype.addToClosestCluster=function(t){for(var e,s=4e4,r=null,o=0;o<this.clusters.length;o++){var n=(e=this.clusters[o]).getCenter(),a=t.getPosition();if(n&&a){var h=this.distanceBetweenPoints(n,a);h<s&&(s=h,r=e)}}r&&r.isMarkerInClusterBounds(t)?r.addMarker(t):((e=new i(this)).addMarker(t),this.clusters.push(e))},t.prototype.createClusters=function(t){var e=this;if(this.ready){0===t&&(google.maps.event.trigger(this,"clusteringbegin",this),null!==this.timerRefStatic&&(window.clearTimeout(this.timerRefStatic),delete this.timerRefStatic));for(var i=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),s=this.getExtendedBounds(i),r=Math.min(t+this.batchSize,this.markers.length),o=t;o<r;o++){var n=this.markers[o];!n.isAdded&&this.isMarkerInBounds(n,s)&&(!this.ignoreHidden||this.ignoreHidden&&n.getVisible())&&this.addToClosestCluster(n)}if(r<this.markers.length)this.timerRefStatic=window.setTimeout((function(){e.createClusters(r)}),0);else{this.timerRefStatic=null,google.maps.event.trigger(this,"clusteringend",this);for(o=0;o<this.clusters.length;o++)this.clusters[o].updateIcon()}}},t.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},t}();t.Cluster=i,t.ClusterIcon=e,t.Clusterer=o,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=umd.min.js.map
{
"name": "@react-google-maps/marker-clusterer",
"sideEffects": false,
"version": "2.10.0",
"version": "2.10.1",
"description": "Marker Clusterer for React.js Google Maps API",

@@ -56,11 +56,11 @@ "license": "MIT",

"@getify/eslint-plugin-proper-arrows": "11.0.3",
"@rollup/plugin-commonjs": "21.1.0",
"@rollup/plugin-node-resolve": "13.2.1",
"@rollup/plugin-commonjs": "22.0.0",
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-typescript": "8.3.2",
"@types/babel-types": "7.0.11",
"@types/google.maps": "3.48.5",
"jest": "27.5.1",
"jest-cli": "27.5.1",
"@types/google.maps": "3.48.8",
"jest": "28.1.0",
"jest-cli": "28.1.0",
"rimraf": "3.0.2",
"rollup": "2.70.2",
"rollup": "2.73.0",
"rollup-plugin-dts": "4.2.1",

@@ -67,0 +67,0 @@ "rollup-plugin-terser": "7.0.2"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc