Version Description
- 2021-02-01 =
- Fixed an issue where OpenLayers Tile Server Key field would not be visible without the Pro add-on
- Fixed an issue where OpenLayers would not allow click event bubbling for features
- Fixed an issue with marker storage logic that would prevent the Pro add-on from removing gallery images
- Fixed an issue where the store locator would scroll to the map element, even when modern locator style is active
- Fixed an issue with the onApproveMarker event trigger in the marker panel
- Added pep.js to the dependencies of the plugin to support pointer events on iOS 12 devices
Download this release
Release Info
Developer | WPGMaps |
Plugin | WP Google Maps |
Version | 8.1.8 |
Comparing to | |
See all releases |
Code changes from version 8.1.7 to 8.1.8
- html/map-edit-page/map-edit-page.html.php +15 -0
- html/settings-page.html.php +2 -2
- includes/class.rest-api.php +8 -6
- includes/class.script-loader.php +2 -1
- js/v8/map-edit-page/marker-panel.js +1 -1
- js/v8/open-layers/ol-map.js +32 -4
- js/v8/store-locator.js +4 -2
- js/v8/wp-google-maps.combined.js +37 -7
- js/v8/wp-google-maps.min.js +1 -1
- lib/pep.js +1473 -0
- readme.txt +9 -0
- wpGoogleMaps.php +9 -1
html/map-edit-page/map-edit-page.html.php
CHANGED
@@ -1287,6 +1287,21 @@
|
|
1287 |
<label for="polygon_labels"></label>
|
1288 |
</div>
|
1289 |
</fieldset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1290 |
|
1291 |
<fieldset class="wpgmza-pro-feature">
|
1292 |
<legend>
|
1287 |
<label for="polygon_labels"></label>
|
1288 |
</div>
|
1289 |
</fieldset>
|
1290 |
+
|
1291 |
+
<fieldset class="wpgmza-pro-feature">
|
1292 |
+
<legend>
|
1293 |
+
<?php
|
1294 |
+
_e("Disable Polygon InfoWindows", "wp-google-maps");
|
1295 |
+
?>
|
1296 |
+
</legend>
|
1297 |
+
<div class='switch'>
|
1298 |
+
<input type="checkbox"
|
1299 |
+
id="disable_polygon_info_windows"
|
1300 |
+
name="disable_polygon_info_windows"
|
1301 |
+
class="postform cmn-toggle cmn-toggle-round-flat wpgmza-pro-feature"/>
|
1302 |
+
<label for="disable_polygon_info_windows"></label>
|
1303 |
+
</div>
|
1304 |
+
</fieldset>
|
1305 |
|
1306 |
<fieldset class="wpgmza-pro-feature">
|
1307 |
<legend>
|
html/settings-page.html.php
CHANGED
@@ -1150,10 +1150,10 @@
|
|
1150 |
</fieldset>
|
1151 |
|
1152 |
<fieldset data-required-maps-engine="open-layers">
|
1153 |
-
<legend
|
1154 |
<?php echo __('OpenLayers Tileserver Key', 'wp-google-maps'); ?>
|
1155 |
</legend>
|
1156 |
-
<label
|
1157 |
<input name='open_layers_api_key'/>
|
1158 |
<p>
|
1159 |
<small>
|
1150 |
</fieldset>
|
1151 |
|
1152 |
<fieldset data-required-maps-engine="open-layers">
|
1153 |
+
<legend>
|
1154 |
<?php echo __('OpenLayers Tileserver Key', 'wp-google-maps'); ?>
|
1155 |
</legend>
|
1156 |
+
<label>
|
1157 |
<input name='open_layers_api_key'/>
|
1158 |
<p>
|
1159 |
<small>
|
includes/class.rest-api.php
CHANGED
@@ -818,18 +818,20 @@ class RestAPI extends Factory
|
|
818 |
|
819 |
$marker = Marker::createInstance($id);
|
820 |
|
821 |
-
foreach($_POST as $key => $value)
|
822 |
-
{
|
823 |
if($key == 'id')
|
824 |
continue;
|
825 |
|
826 |
-
if($key == 'gallery')
|
827 |
-
{
|
828 |
$gallery = new MarkerGallery($_POST[$key]);
|
829 |
$marker->gallery = $gallery;
|
830 |
-
}
|
831 |
-
else
|
832 |
$marker->{$key} = stripslashes($value);
|
|
|
|
|
|
|
|
|
|
|
833 |
}
|
834 |
|
835 |
$map = Map::createInstance($marker->map_id);
|
818 |
|
819 |
$marker = Marker::createInstance($id);
|
820 |
|
821 |
+
foreach($_POST as $key => $value){
|
|
|
822 |
if($key == 'id')
|
823 |
continue;
|
824 |
|
825 |
+
if($key == 'gallery'){
|
|
|
826 |
$gallery = new MarkerGallery($_POST[$key]);
|
827 |
$marker->gallery = $gallery;
|
828 |
+
} else {
|
|
|
829 |
$marker->{$key} = stripslashes($value);
|
830 |
+
}
|
831 |
+
}
|
832 |
+
|
833 |
+
if(empty($_POST['gallery']) && !empty($marker->gallery)){
|
834 |
+
$marker->gallery = false;
|
835 |
}
|
836 |
|
837 |
$map = Map::createInstance($marker->map_id);
|
includes/class.script-loader.php
CHANGED
@@ -123,7 +123,8 @@ class ScriptLoader
|
|
123 |
'javascript-cookie' => $plugin_dir_url . 'lib/jquery-cookie.js',
|
124 |
'remodal' => $plugin_dir_url . "lib/remodal{$minified}.js",
|
125 |
'spectrum' => $plugin_dir_url . 'lib/spectrum.js',
|
126 |
-
|
|
|
127 |
// TODO: These are only needed if the server supports inflate
|
128 |
'fast-text-encoding' => $plugin_dir_url . 'lib/text.js',
|
129 |
'pako' => $plugin_dir_url . 'lib/pako_deflate.min.js'
|
123 |
'javascript-cookie' => $plugin_dir_url . 'lib/jquery-cookie.js',
|
124 |
'remodal' => $plugin_dir_url . "lib/remodal{$minified}.js",
|
125 |
'spectrum' => $plugin_dir_url . 'lib/spectrum.js',
|
126 |
+
// PEP JS for iOS 12 pointer events
|
127 |
+
'pepjs' => $plugin_dir_url . 'lib/pep.js',
|
128 |
// TODO: These are only needed if the server supports inflate
|
129 |
'fast-text-encoding' => $plugin_dir_url . 'lib/text.js',
|
130 |
'pako' => $plugin_dir_url . 'lib/pako_deflate.min.js'
|
js/v8/map-edit-page/marker-panel.js
CHANGED
@@ -33,7 +33,7 @@ jQuery(function($) {
|
|
33 |
self.onAdjustFeature(event);
|
34 |
});
|
35 |
|
36 |
-
$(document.body).
|
37 |
self.onApproveMarker(event);
|
38 |
});
|
39 |
|
33 |
self.onAdjustFeature(event);
|
34 |
});
|
35 |
|
36 |
+
$(document.body).on("click", ".wpgmza_approve_btn", function(event) {
|
37 |
self.onApproveMarker(event);
|
38 |
});
|
39 |
|
js/v8/open-layers/ol-map.js
CHANGED
@@ -138,8 +138,9 @@ jQuery(function($) {
|
|
138 |
|
139 |
var marker = features[0].wpgmzaMarker;
|
140 |
|
141 |
-
if(!marker)
|
142 |
return;
|
|
|
143 |
|
144 |
marker.trigger("click");
|
145 |
marker.trigger("select");
|
@@ -241,14 +242,40 @@ jQuery(function($) {
|
|
241 |
else if("button" in event)
|
242 |
isRight = event.button == 2;
|
243 |
|
244 |
-
if(event.which == 1 || event.button == 1)
|
245 |
-
{
|
246 |
if(self.isBeingDragged)
|
247 |
return;
|
248 |
|
249 |
// Left click
|
250 |
if($(event.target).closest(".ol-marker").length)
|
251 |
return; // A marker was clicked, not the map. Do nothing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
self.trigger({
|
254 |
type: "click",
|
@@ -258,8 +285,9 @@ jQuery(function($) {
|
|
258 |
return;
|
259 |
}
|
260 |
|
261 |
-
if(!isRight)
|
262 |
return;
|
|
|
263 |
|
264 |
return self.onRightClick(event);
|
265 |
});
|
138 |
|
139 |
var marker = features[0].wpgmzaMarker;
|
140 |
|
141 |
+
if(!marker){
|
142 |
return;
|
143 |
+
}
|
144 |
|
145 |
marker.trigger("click");
|
146 |
marker.trigger("select");
|
242 |
else if("button" in event)
|
243 |
isRight = event.button == 2;
|
244 |
|
245 |
+
if(event.which == 1 || event.button == 1){
|
|
|
246 |
if(self.isBeingDragged)
|
247 |
return;
|
248 |
|
249 |
// Left click
|
250 |
if($(event.target).closest(".ol-marker").length)
|
251 |
return; // A marker was clicked, not the map. Do nothing
|
252 |
+
|
253 |
+
/*
|
254 |
+
* User is clicking on the map, but looks like it was not a marker...
|
255 |
+
*
|
256 |
+
* Finding a light at the end of the tunnel
|
257 |
+
*/
|
258 |
+
try{
|
259 |
+
var featuresUnderPixel = self.olMap.getFeaturesAtPixel([event.offsetX, event.offsetY]);
|
260 |
+
}catch(e) {
|
261 |
+
return;
|
262 |
+
}
|
263 |
+
|
264 |
+
if(!featuresUnderPixel)
|
265 |
+
featuresUnderPixel = [];
|
266 |
+
|
267 |
+
var nativeFeaturesUnderPixel = [], i, props;
|
268 |
+
for(i = 0; i < featuresUnderPixel.length; i++){
|
269 |
+
props = featuresUnderPixel[i].getProperties();
|
270 |
+
|
271 |
+
if(!props.wpgmzaFeature)
|
272 |
+
continue;
|
273 |
+
|
274 |
+
nativeFeature = props.wpgmzaFeature;
|
275 |
+
nativeFeaturesUnderPixel.push(nativeFeature);
|
276 |
+
|
277 |
+
nativeFeature.trigger("click");
|
278 |
+
}
|
279 |
|
280 |
self.trigger({
|
281 |
type: "click",
|
285 |
return;
|
286 |
}
|
287 |
|
288 |
+
if(!isRight){
|
289 |
return;
|
290 |
+
}
|
291 |
|
292 |
return self.onRightClick(event);
|
293 |
});
|
js/v8/store-locator.js
CHANGED
@@ -214,8 +214,10 @@ jQuery(function($) {
|
|
214 |
return false;
|
215 |
}
|
216 |
|
217 |
-
|
218 |
-
|
|
|
|
|
219 |
function callback(results, status)
|
220 |
{
|
221 |
self.map.trigger({
|
214 |
return false;
|
215 |
}
|
216 |
|
217 |
+
if((typeof this.map.settings.store_locator_style !== 'undefined' && this.map.settings.store_locator_style !== "modern") && WPGMZA.settings.user_interface_style !== 'modern' && WPGMZA.settings.user_interface_style === 'default'){
|
218 |
+
WPGMZA.animateScroll(this.map.element);
|
219 |
+
}
|
220 |
+
|
221 |
function callback(results, status)
|
222 |
{
|
223 |
self.map.trigger({
|
js/v8/wp-google-maps.combined.js
CHANGED
@@ -8330,8 +8330,10 @@ jQuery(function($) {
|
|
8330 |
return false;
|
8331 |
}
|
8332 |
|
8333 |
-
|
8334 |
-
|
|
|
|
|
8335 |
function callback(results, status)
|
8336 |
{
|
8337 |
self.map.trigger({
|
@@ -11360,8 +11362,9 @@ jQuery(function($) {
|
|
11360 |
|
11361 |
var marker = features[0].wpgmzaMarker;
|
11362 |
|
11363 |
-
if(!marker)
|
11364 |
return;
|
|
|
11365 |
|
11366 |
marker.trigger("click");
|
11367 |
marker.trigger("select");
|
@@ -11463,14 +11466,40 @@ jQuery(function($) {
|
|
11463 |
else if("button" in event)
|
11464 |
isRight = event.button == 2;
|
11465 |
|
11466 |
-
if(event.which == 1 || event.button == 1)
|
11467 |
-
{
|
11468 |
if(self.isBeingDragged)
|
11469 |
return;
|
11470 |
|
11471 |
// Left click
|
11472 |
if($(event.target).closest(".ol-marker").length)
|
11473 |
return; // A marker was clicked, not the map. Do nothing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11474 |
|
11475 |
self.trigger({
|
11476 |
type: "click",
|
@@ -11480,8 +11509,9 @@ jQuery(function($) {
|
|
11480 |
return;
|
11481 |
}
|
11482 |
|
11483 |
-
if(!isRight)
|
11484 |
return;
|
|
|
11485 |
|
11486 |
return self.onRightClick(event);
|
11487 |
});
|
@@ -15750,7 +15780,7 @@ jQuery(function($) {
|
|
15750 |
self.onAdjustFeature(event);
|
15751 |
});
|
15752 |
|
15753 |
-
$(document.body).
|
15754 |
self.onApproveMarker(event);
|
15755 |
});
|
15756 |
|
8330 |
return false;
|
8331 |
}
|
8332 |
|
8333 |
+
if((typeof this.map.settings.store_locator_style !== 'undefined' && this.map.settings.store_locator_style !== "modern") && WPGMZA.settings.user_interface_style !== 'modern' && WPGMZA.settings.user_interface_style === 'default'){
|
8334 |
+
WPGMZA.animateScroll(this.map.element);
|
8335 |
+
}
|
8336 |
+
|
8337 |
function callback(results, status)
|
8338 |
{
|
8339 |
self.map.trigger({
|
11362 |
|
11363 |
var marker = features[0].wpgmzaMarker;
|
11364 |
|
11365 |
+
if(!marker){
|
11366 |
return;
|
11367 |
+
}
|
11368 |
|
11369 |
marker.trigger("click");
|
11370 |
marker.trigger("select");
|
11466 |
else if("button" in event)
|
11467 |
isRight = event.button == 2;
|
11468 |
|
11469 |
+
if(event.which == 1 || event.button == 1){
|
|
|
11470 |
if(self.isBeingDragged)
|
11471 |
return;
|
11472 |
|
11473 |
// Left click
|
11474 |
if($(event.target).closest(".ol-marker").length)
|
11475 |
return; // A marker was clicked, not the map. Do nothing
|
11476 |
+
|
11477 |
+
/*
|
11478 |
+
* User is clicking on the map, but looks like it was not a marker...
|
11479 |
+
*
|
11480 |
+
* Finding a light at the end of the tunnel
|
11481 |
+
*/
|
11482 |
+
try{
|
11483 |
+
var featuresUnderPixel = self.olMap.getFeaturesAtPixel([event.offsetX, event.offsetY]);
|
11484 |
+
}catch(e) {
|
11485 |
+
return;
|
11486 |
+
}
|
11487 |
+
|
11488 |
+
if(!featuresUnderPixel)
|
11489 |
+
featuresUnderPixel = [];
|
11490 |
+
|
11491 |
+
var nativeFeaturesUnderPixel = [], i, props;
|
11492 |
+
for(i = 0; i < featuresUnderPixel.length; i++){
|
11493 |
+
props = featuresUnderPixel[i].getProperties();
|
11494 |
+
|
11495 |
+
if(!props.wpgmzaFeature)
|
11496 |
+
continue;
|
11497 |
+
|
11498 |
+
nativeFeature = props.wpgmzaFeature;
|
11499 |
+
nativeFeaturesUnderPixel.push(nativeFeature);
|
11500 |
+
|
11501 |
+
nativeFeature.trigger("click");
|
11502 |
+
}
|
11503 |
|
11504 |
self.trigger({
|
11505 |
type: "click",
|
11509 |
return;
|
11510 |
}
|
11511 |
|
11512 |
+
if(!isRight){
|
11513 |
return;
|
11514 |
+
}
|
11515 |
|
11516 |
return self.onRightClick(event);
|
11517 |
});
|
15780 |
self.onAdjustFeature(event);
|
15781 |
});
|
15782 |
|
15783 |
+
$(document.body).on("click", ".wpgmza_approve_btn", function(event) {
|
15784 |
self.onApproveMarker(event);
|
15785 |
});
|
15786 |
|
js/v8/wp-google-maps.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function($){var core={MARKER_PULL_DATABASE:"0",MARKER_PULL_XML:"1",PAGE_MAP_LIST:"map-list",PAGE_MAP_EDIT:"map-edit",PAGE_SETTINGS:"map-settings",PAGE_SUPPORT:"map-support",PAGE_CATEGORIES:"categories",PAGE_ADVANCED:"advanced",PAGE_CUSTOM_FIELDS:"custom-fields",maps:[],events:null,settings:null,restAPI:null,localized_strings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',preloaderHTML:"<div class='wpgmza-preloader'><div></div><div></div><div></div><div></div></div>",getCurrentPage:function(){switch(WPGMZA.getQueryParamValue("page")){case"wp-google-maps-menu":return window.location.href.match(/action=edit/)&&window.location.href.match(/map_id=\d+/)?WPGMZA.PAGE_MAP_EDIT:WPGMZA.PAGE_MAP_LIST;case"wp-google-maps-menu-settings":return WPGMZA.PAGE_SETTINGS;case"wp-google-maps-menu-support":return WPGMZA.PAGE_SUPPORT;case"wp-google-maps-menu-categories":return WPGMZA.PAGE_CATEGORIES;case"wp-google-maps-menu-advanced":return WPGMZA.PAGE_ADVANCED;case"wp-google-maps-menu-custom-fields":return WPGMZA.PAGE_CUSTOM_FIELDS;default:return null}},getScrollAnimationOffset:function(){return(WPGMZA.settings.scroll_animation_offset||0)+$("#wpadminbar").height()},getScrollAnimationDuration:function(){return WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},extend:function(child,parent){var constructor=child;child.prototype=Object.create(parent.prototype),child.prototype.constructor=constructor},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){var hex=parseInt(colour.replace(/^#/,""),16);return[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},hexOpacityToString:function(colour,opacity){var arr=WPGMZA.hexOpacityToRGBA(colour,opacity);return"rgba("+arr[0]+", "+arr[1]+", "+arr[2]+", "+arr[3]+")"},hexToRgba:function(hex){var c;return/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)?(3==(c=hex.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),{r:(c="0x"+c.join(""))>>16&255,g:c>>8&255,b:255&c,a:1}):0},rgbaToString:function(rgba){return"rgba("+rgba.r+", "+rgba.g+", "+rgba.b+", "+rgba.a+")"},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])}):null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:img.width,height:img.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},decodeEntities:function(input){return input.replace(/&(nbsp|amp|quot|lt|gt);/g,function(m,e){return m[e]}).replace(/&#(\d+);/gi,function(m,e){return String.fromCharCode(parseInt(e,10))})},isDeveloperMode:function(){return this.settings.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback,error,watch){var nativeFunction="getCurrentPosition";if(WPGMZA.userLocationDenied)error&&error({code:1,message:"Location unavailable"});else if(watch&&(nativeFunction="watchPosition"),navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation[nativeFunction]?navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){options.enableHighAccuracy=!1,navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){console.warn(err.code,err.message),1==err.code&&(WPGMZA.userLocationDenied=!0),error&&error(err)},options)},options):console.warn(nativeFunction+" is not available")}else console.warn("No geolocation available on this device")},watchPosition:function(callback,error){return WPGMZA.getCurrentPosition(callback,error,!0)},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},capitalizeWords:function(string){return(string+"").replace(/^(.)|\s+(.)/g,function(m){return m.toUpperCase()})},pluralize:function(string){return WPGMZA.singularize(string)+"s"},singularize:function(string){return string.replace(/s$/,"")},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if("OLFeature"!=(fullInstanceName=WPGMZA[engine+pro+instanceName]&&engine+instanceName!="OLFeature"?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]&&WPGMZA[engine+instanceName].prototype?engine+instanceName:instanceName)&&!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){for(var i=0;i<WPGMZA.maps.length;i++)if(WPGMZA.maps[i].id==id)return WPGMZA.maps[i];return null},isGoogleAutocompleteSupported:function(){return!!window.google&&(!!google.maps&&(!!google.maps.places&&(!!google.maps.places.Autocomplete&&(!WPGMZA.CloudAPI||!WPGMZA.CloudAPI.isBeingUsed))))},googleAPIStatus:window.wpgmza_google_api_status,isSafari:function(){var ua=navigator.userAgent.toLowerCase();return ua.match(/safari/i)&&!ua.match(/chrome/i)},isTouchDevice:function(){return"ontouchstart"in window},isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},isModernComponentStyleAllowed:function(){return!WPGMZA.settings.user_interface_style||"legacy"==WPGMZA.settings.user_interface_style||"modern"==WPGMZA.settings.user_interface_style},isElementInView:function(element){var pageTop=$(window).scrollTop(),pageBottom=pageTop+$(window).height(),elementTop=$(element).offset().top,elementBottom=elementTop+$(element).height();return elementTop<pageTop&&pageBottom<elementBottom||(pageTop<=elementTop&&elementTop<=pageBottom||pageTop<=elementBottom&&elementBottom<=pageBottom)},isFullScreen:function(){return wpgmzaisFullScreen},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&#]*)");return(m=window.location.href.match(regex))?decodeURIComponent(m[1]):null},notification:function(text,time){switch(arguments.length){case 0:text="",time=4e3;break;case 1:time=4e3}var html='<div class="wpgmza-popup-notification">'+text+"</div>";jQuery("body").append(html),setTimeout(function(){jQuery("body").find(".wpgmza-popup-notification").remove()},time)}},wpgmzaisFullScreen=!1;for(var key in[]){console.warn("It appears that the built in JavaScript Array has been extended, this can create issues with for ... in loops, which may cause failure.");break}for(var key in window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core,WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}function onScroll(event){$(".wpgmza_map").each(function(index,el){var isInView=WPGMZA.isElementInView(el);el.wpgmzaScrollIntoViewTriggerFlag?isInView||(el.wpgmzaScrollIntoViewTriggerFlag=!1):isInView&&($(el).trigger("mapscrolledintoview.wpgmza"),el.wpgmzaScrollIntoViewTriggerFlag=!0)})}WPGMZA.settings.useLegacyGlobals=!0,jQuery(function($){$(window).trigger("ready.wpgmza"),$("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length&&console.warn("Minified script is out of date, using combined script instead.");var elements=$("script").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});1<elements.length&&console.warn("Multiple jQuery versions detected: ",elements),WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),WPGMZA.CloudAPI&&(WPGMZA.cloudAPI=WPGMZA.CloudAPI.createInstance()),$(document).on("fullscreenchange",function(){wpgmzaisFullScreen=!!document.fullscreenElement}),$("body").on("click","#wpgmzaCloseChat",function(e){e.preventDefault(),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_hide_chat",nonce:WPGMZA_localized_data.ajaxnonce}}),$(".wpgmza-chat-help").remove()})}),$(document).ready(function(event){for(var key in[]){console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");break}if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").first().after($(warning))}}),$(window).on("scroll",onScroll),$(document).ready(onScroll),$(function(){WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code?jQuery(".wpgmza-gdpr-compliance").length<=0&&($("#wpgmza_map, .wpgmza_map").each(function(index,el){$(el).append($(WPGMZA.api_consent_html)),$(el).css({height:"auto"})}),$("button.wpgmza-api-consent").on("click",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()})):function initMaps(){$(document.body).find(".wpgmza_map:not(.wpgmza-initialized)").each(function(index,el){el.wpgmzaMap?console.warn("Element missing class wpgmza-initialized but does have wpgmzaMap property. No new instance will be created"):el.wpgmzaMap=WPGMZA.Map.createInstance(el)}),WPGMZA.Map.nextInitTimeoutID=setTimeout(initMaps,3e3)}()}),$(document.body).on("click","button.wpgmza-api-consent",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()}),$(document.body).on("keydown",function(event){event.altKey&&(WPGMZA.altKeyDown=!0)}),$(document.body).on("keyup",function(event){event.altKey||(WPGMZA.altKeyDown=!1)})}),jQuery(function($){WPGMZA.Compatibility=function(){this.preventDocumentWriteGoogleMapsAPI()},WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI=function(){var old=document.write;document.write=function(content){content.match&&content.match(/maps\.google/)||old.call(document,content)}},WPGMZA.compatiblityModule=new WPGMZA.Compatibility}),function(root,factory){"object"==typeof exports?module.exports=factory(root):"function"==typeof define&&define.amd?define([],factory.bind(root,root)):factory(root)}("undefined"!=typeof global?global:this,function(root){if(root.CSS&&root.CSS.escape)return root.CSS.escape;function cssEscape(value){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var codeUnit,string=String(value),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index<length;)0!=(codeUnit=string.charCodeAt(index))?result+=1<=codeUnit&&codeUnit<=31||127==codeUnit||0==index&&48<=codeUnit&&codeUnit<=57||1==index&&48<=codeUnit&&codeUnit<=57&&45==firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!=index||1!=length||45!=codeUnit)&&(128<=codeUnit||45==codeUnit||95==codeUnit||48<=codeUnit&&codeUnit<=57||65<=codeUnit&&codeUnit<=90||97<=codeUnit&&codeUnit<=122)?string.charAt(index):"\\"+string.charAt(index):result+="�";return result}return root.CSS||(root.CSS={}),root.CSS.escape=cssEscape}),jQuery(function($){Math.PI;function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Distance={MILES:!0,KILOMETERS:!1,MILES_PER_KILOMETER:.621371,KILOMETERS_PER_MILE:1.60934,uiToMeters:function(uiDistance){return parseFloat(uiDistance)/(WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?WPGMZA.Distance.MILES_PER_KILOMETER:1)*1e3},uiToKilometers:function(uiDistance){return.001*WPGMZA.Distance.uiToMeters(uiDistance)},uiToMiles:function(uiDistance){return WPGMZA.Distance.uiToKilometers(uiDistance)*WPGMZA.Distance.MILES_PER_KILOMETER},kilometersToUI:function(km){return WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?km*WPGMZA.Distance.MILES_PER_KILOMETER:km},between:function(a,b){if(!(a instanceof WPGMZA.LatLng||"lat"in a&&"lng"in a))throw new Error("First argument must be an instance of WPGMZA.LatLng or a literal");if(!(b instanceof WPGMZA.LatLng||"lat"in b&&"lng"in b))throw new Error("Second argument must be an instance of WPGMZA.LatLng or a literal");if(a===b)return 0;var lat1=a.lat,lon1=a.lng,lat2=b.lat,lon2=b.lng,dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1);a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}}),jQuery(function($){WPGMZA.EliasFano=function(){if(!WPGMZA.EliasFano.isSupported)throw new Error("Elias Fano encoding is not supported on browsers without Uint8Array");WPGMZA.EliasFano.decodingTablesInitialised||WPGMZA.EliasFano.createDecodingTable()},WPGMZA.EliasFano.isSupported="Uint8Array"in window,WPGMZA.EliasFano.decodingTableHighBits=[],WPGMZA.EliasFano.decodingTableDocIDNumber=null,WPGMZA.EliasFano.decodingTableHighBitsCarryover=null,WPGMZA.EliasFano.createDecodingTable=function(){WPGMZA.EliasFano.decodingTableDocIDNumber=new Uint8Array(256),WPGMZA.EliasFano.decodingTableHighBitsCarryover=new Uint8Array(256);for(var decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,i=0;i<256;i++){var zeroCount=0;decodingTableHighBits[i]=[];for(var j=7;0<=j;j--)zeroCount=0<(i&1<<j)?(decodingTableHighBits[i][decodingTableDocIDNumber[i]]=zeroCount,decodingTableDocIDNumber[i]++,0):(zeroCount+1)%255;decodingTableHighBitsCarryover[i]=zeroCount}WPGMZA.EliasFano.decodingTablesInitialised=!0},WPGMZA.EliasFano.prototype.encode=function(list){var lastDocID=0,buffer1=0,bufferLength1=0,buffer2=0,bufferLength2=0;if(0==list.length)return result;function toByte(n){return 255&n}var compressedBufferPointer1=0,compressedBufferPointer2=0,averageDelta=list[list.length-1]/list.length,averageDeltaLog=Math.log2(averageDelta),lowBitsLength=Math.floor(averageDeltaLog),lowBitsMask=(1<<lowBitsLength)-1,prev=null,maxCompressedSize=Math.floor((2+Math.ceil(Math.log2(averageDelta)))*list.length/8)+6,compressedBuffer=new Uint8Array(maxCompressedSize);lowBitsLength<0&&(lowBitsLength=0),compressedBufferPointer2=Math.floor(lowBitsLength*list.length/8+6),compressedBuffer[compressedBufferPointer1++]=toByte(list.length),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>8),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>16),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>24),compressedBuffer[compressedBufferPointer1++]=toByte(lowBitsLength),list.forEach(function(docID){var docIDDelta=docID-lastDocID-1;if(!$.isNumeric(docID))throw new Error("Value is not numeric");if(docID=parseInt(docID),null!==prev&&docID<=prev)throw new Error("Elias Fano encoding can only be used on a sorted, ascending list of unique integers.");for(prev=docID,buffer1<<=lowBitsLength,buffer1|=docIDDelta&lowBitsMask,bufferLength1+=lowBitsLength;7<bufferLength1;)bufferLength1-=8,compressedBuffer[compressedBufferPointer1++]=toByte(buffer1>>bufferLength1);var unaryCodeLength=1+(docIDDelta>>lowBitsLength);for(buffer2<<=unaryCodeLength,buffer2|=1,bufferLength2+=unaryCodeLength;7<bufferLength2;)bufferLength2-=8,compressedBuffer[compressedBufferPointer2++]=toByte(buffer2>>bufferLength2);lastDocID=docID}),0<bufferLength1&&(compressedBuffer[compressedBufferPointer1++]=toByte(buffer1<<8-bufferLength1)),0<bufferLength2&&(compressedBuffer[compressedBufferPointer2++]=toByte(buffer2<<8-bufferLength2));var result=new Uint8Array(compressedBuffer);return result.pointer=compressedBufferPointer2,result},WPGMZA.EliasFano.prototype.decode=function(compressedBuffer){var resultPointer=0,list=[],decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,lowBitsPointer=0,lastDocID=0,docID=0,docIDNumber=0,listCount=compressedBuffer[lowBitsPointer++];listCount|=compressedBuffer[lowBitsPointer++]<<8,listCount|=compressedBuffer[lowBitsPointer++]<<16,listCount|=compressedBuffer[lowBitsPointer++]<<24;var highBitsPointer,lowBitsLength=compressedBuffer[lowBitsPointer++],lowBitsCount=0,lowBits=0,cb=1;for(highBitsPointer=Math.floor(lowBitsLength*listCount/8+6);highBitsPointer<compressedBuffer.pointer;highBitsPointer++){docID+=decodingTableHighBitsCarryover[cb],docIDNumber=decodingTableDocIDNumber[cb=compressedBuffer[highBitsPointer]];for(var i=0;i<docIDNumber;i++){for(docID<<=lowBitsCount,docID|=lowBits&(1<<lowBitsCount)-1;lowBitsCount<lowBitsLength;)docID<<=8,docID|=lowBits=compressedBuffer[lowBitsPointer++],lowBitsCount+=8;docID>>=lowBitsCount-=lowBitsLength,docID+=(decodingTableHighBits[cb][i]<<lowBitsLength)+lastDocID+1,lastDocID=list[resultPointer++]=docID,docID=0}}return list}}),jQuery(function($){WPGMZA.EventDispatcher=function(){WPGMZA.assertInstanceOf(this,"EventDispatcher"),this._listenersByType={}},WPGMZA.EventDispatcher.prototype.addEventListener=function(type,listener,thisObject,useCapture){var types=type.split(/\s+/);if(1<types.length)for(var i=0;i<types.length;i++)this.addEventListener(types[i],listener,thisObject,useCapture);else{if(!(listener instanceof Function))throw new Error("Listener must be a function");var target;target=this._listenersByType.hasOwnProperty(type)?this._listenersByType[type]:this._listenersByType[type]=[];var obj={listener:listener,thisObject:thisObject||this,useCapture:!!useCapture};target.push(obj)}},WPGMZA.EventDispatcher.prototype.on=WPGMZA.EventDispatcher.prototype.addEventListener,WPGMZA.EventDispatcher.prototype.removeEventListener=function(type,listener,thisObject,useCapture){var arr,obj;if(arr=this._listenersByType[type]){thisObject=thisObject||this,useCapture=!!useCapture;for(var i=0;i<arr.length;i++)if(obj=arr[i],(1==arguments.length||obj.listener==listener)&&obj.thisObject==thisObject&&obj.useCapture==useCapture)return void arr.splice(i,1)}},WPGMZA.EventDispatcher.prototype.off=WPGMZA.EventDispatcher.prototype.removeEventListener,WPGMZA.EventDispatcher.prototype.hasEventListener=function(type){return!!_listenersByType[type]},WPGMZA.EventDispatcher.prototype.dispatchEvent=function(event){if(!(event instanceof WPGMZA.Event))if("string"==typeof event)event=new WPGMZA.Event(event);else{var src=event;for(var name in event=new WPGMZA.Event,src)event[name]=src[name]}for(var path=[],obj=(event.target=this).parent;null!=obj;obj=obj.parent)path.unshift(obj);event.phase=WPGMZA.Event.CAPTURING_PHASE;for(var i=0;i<path.length&&!event._cancelled;i++)path[i]._triggerListeners(event);if(!event._cancelled){for(event.phase=WPGMZA.Event.AT_TARGET,this._triggerListeners(event),event.phase=WPGMZA.Event.BUBBLING_PHASE,i=path.length-1;0<=i&&!event._cancelled;i--)path[i]._triggerListeners(event);var topMostElement=this.element;for(obj=this.parent;null!=obj;obj=obj.parent)obj.element&&(topMostElement=obj.element);if(topMostElement){var customEvent={};for(var key in event){var value=event[key];"type"==key&&(value+=".wpgmza"),customEvent[key]=value}$(topMostElement).trigger(customEvent)}}},WPGMZA.EventDispatcher.prototype.trigger=WPGMZA.EventDispatcher.prototype.dispatchEvent,WPGMZA.EventDispatcher.prototype._triggerListeners=function(event){var arr,obj;if(arr=this._listenersByType[event.type])for(var i=0;i<arr.length;i++)obj=arr[i],event.phase==WPGMZA.Event.CAPTURING_PHASE&&!obj.useCapture||obj.listener.call(arr[i].thisObject,event)},WPGMZA.events=new WPGMZA.EventDispatcher}),jQuery(function($){WPGMZA.AddressInput=function(element,map){if(!(element instanceof HTMLInputElement))throw new Error("Element is not an instance of HTMLInputElement");var json;this.element=element;var options={fields:["name","formatted_address"],types:["geocode"]};(json=$(element).attr("data-autocomplete-options"))&&(options=$.extend(options,JSON.parse(json))),map&&map.settings.wpgmza_store_locator_restrict&&(options.country=map.settings.wpgmza_store_locator_restrict),WPGMZA.isGoogleAutocompleteSupported()?"wpgmza_add_address_map_editor"!=this.id&&WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey&&(element.googleAutoComplete=new google.maps.places.Autocomplete(element,options),options.country&&element.googleAutoComplete.setComponentRestrictions({country:options.country})):WPGMZA.CloudAPI&&WPGMZA.CloudAPI.isBeingUsed&&(element.cloudAutoComplete=new WPGMZA.CloudAutocomplete(element,options))},WPGMZA.extend(WPGMZA.AddressInput,WPGMZA.EventDispatcher),WPGMZA.AddressInput.createInstance=function(element,map){return new WPGMZA.AddressInput(element,map)}}),jQuery(function($){WPGMZA.DrawingManager=function(map){WPGMZA.assertInstanceOf(this,"DrawingManager"),WPGMZA.EventDispatcher.call(this),this.map=map,this.mode=WPGMZA.DrawingManager.MODE_NONE},WPGMZA.DrawingManager.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.DrawingManager.prototype.constructor=WPGMZA.DrawingManager,WPGMZA.DrawingManager.MODE_NONE=null,WPGMZA.DrawingManager.MODE_MARKER="marker",WPGMZA.DrawingManager.MODE_POLYGON="polygon",WPGMZA.DrawingManager.MODE_POLYLINE="polyline",WPGMZA.DrawingManager.MODE_CIRCLE="circle",WPGMZA.DrawingManager.MODE_RECTANGLE="rectangle",WPGMZA.DrawingManager.MODE_HEATMAP="heatmap",WPGMZA.DrawingManager.getConstructor=function(){switch(WPGMZA.settings.engine){case"google-maps":return WPGMZA.GoogleDrawingManager;default:return WPGMZA.OLDrawingManager}},WPGMZA.DrawingManager.createInstance=function(map){return new(WPGMZA.DrawingManager.getConstructor())(map)},WPGMZA.DrawingManager.prototype.setDrawingMode=function(mode){this.mode=mode,this.trigger("drawingmodechanged")}}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){WPGMZA.FancyControls={formatToggleSwitch:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-round-flat"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)},formatToggleButton:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-yes-no"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(label).attr("data-on",WPGMZA.localized_strings.yes),$(label).attr("data-off",WPGMZA.localized_strings.no),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)}},$(".wpgmza-fancy-toggle-switch").each(function(index,el){WPGMZA.FancyControls.formatToggleSwitch(el)}),$(".wpgmza-fancy-toggle-button").each(function(index,el){WPGMZA.FancyControls.formatToggleButton(el)})}),jQuery(function($){WPGMZA.Feature=function(options){for(var key in WPGMZA.assertInstanceOf(this,"Feature"),WPGMZA.EventDispatcher.call(this),this.id=-1,options)this[key]=options[key]},WPGMZA.extend(WPGMZA.Feature,WPGMZA.EventDispatcher),WPGMZA.MapObject=WPGMZA.Feature,WPGMZA.Feature.prototype.parseGeometry=function(subject){if("string"==typeof subject&&subject.match(/^\[/))try{subject=JSON.parse(subject)}catch(e){}if("object"==typeof subject){for(var arr=subject,i=0;i<arr.length;i++)arr[i].lat=parseFloat(arr[i].lat),arr[i].lng=parseFloat(arr[i].lng);return arr}if("string"!=typeof subject)throw new Error("Invalid geometry");var pairs,coords,results=[];pairs=subject.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.Feature.prototype.setOptions=function(options){for(var key in options)this[key]=options[key];this.updateNativeFeature()},WPGMZA.Feature.prototype.setEditable=function(editable){this.setOptions({editable:editable})},WPGMZA.Feature.prototype.setDraggable=function(draggable){this.setOptions({draggable:draggable})},WPGMZA.Feature.prototype.getScalarProperties=function(){var options={};for(var key in this)switch(typeof this[key]){case"number":options[key]=parseFloat(this[key]);break;case"boolean":case"string":options[key]=this[key]}return options},WPGMZA.Feature.prototype.updateNativeFeature=function(){var props=this.getScalarProperties();switch(WPGMZA.settings.engine){case"open-layers":this.layer&&this.layer.setStyle(WPGMZA.OLFeature.getOLStyle(props));break;default:this.googleFeature.setOptions(props)}}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Circle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Circle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeColor",{enumerable:!0,get:function(){return this.lineColor?this.lineColor:"#000000"},set:function(a){this.lineColor=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineOpacity||0==this.lineOpacity?parseFloat(this.lineOpacity):0},set:function(a){this.lineOpacity=a}}),WPGMZA.Circle.createInstance=function(options,engineCircle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options,engineCircle)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.FriendlyError=function(){}}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/),latLng=new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])});callback([latLng.latLng=latLng],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)){this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find(".wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={};var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)},"google-maps"!=WPGMZA.settings.engine||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT||this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key,["https://www.wpgmaps.com/documentation/creating-a-google-maps-api-key/"])}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if(message)if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))||(m=message.match(/^Geocoding Service: .+/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){var self=this;if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){urls[i];var button=buttonTemplate.clone(),text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),$(button).find("i").addClass("fa-external-link"),$(button).append(text)}buttonContainer.append(button)}$(this.errorMessageList).append(li),$("#wpgmza_map, .wpgmza_map").each(function(index,el){var container=$(el).find(".wpgmza-google-maps-api-error-overlay");0==container.length&&(container=$("<div class='wpgmza-google-maps-api-error-overlay'></div>")).html(self.element.html()),setTimeout(function(){$(el).append(container)},1e3)}),$(".gm-err-container").parent().css({"z-index":1}),this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(feature){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),this.on("infowindowopen",function(event){self.onOpen(event)}),feature&&(this.feature=feature,this.state=WPGMZA.InfoWindow.STATE_CLOSED,feature.map?setTimeout(function(){self.onFeatureAdded(event)},100):feature.addEventListener("added",function(event){self.onFeatureAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.STATE_OPEN="open",WPGMZA.InfoWindow.STATE_CLOSED="closed",WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(feature){return new(this.getConstructor())(feature)},Object.defineProperty(WPGMZA.InfoWindow.prototype,"content",{get:function(){return this.getContent()},set:function(value){this.contentHtml=value}}),WPGMZA.InfoWindow.prototype.addEditButton=function(){return"map-edit"==WPGMZA.currentPage?' <a title="Edit this marker" style="width:15px;" class="wpgmza_edit_btn" data-edit-marker-id="'+this.feature.id+'"><i class="fa fa-edit"></i></a>':""},WPGMZA.InfoWindow.prototype.workOutDistanceBetweenTwoMarkers=function(location1,location2){if(location1&&location2){var distanceToDisplay=WPGMZA.Distance.between(location1,location2);return this.distanceUnits==WPGMZA.Distance.MILES&&(distanceToDisplay/=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(distanceToDisplay,2)}},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="",extra_html="";if(this.feature instanceof WPGMZA.Marker){if(this.feature.map.storeLocator&&this.feature.map.storeLocator.state==WPGMZA.StoreLocator.STATE_APPLIED){var currentLatLng=this.feature.getPosition(),distance=this.workOutDistanceBetweenTwoMarkers(this.feature.map.storeLocator.center,currentLatLng);extra_html+="<p>"+(this.feature.map.settings.store_locator_distance==WPGMZA.Distance.KILOMETERS?distance+WPGMZA.localized_strings.kilometers_away:distance+WPGMZA.localized_strings.miles_away)+"</p>"}html=this.feature.address+extra_html}return this.contentHtml&&(html=this.contentHtml),callback&&callback(html),html},WPGMZA.InfoWindow.prototype.open=function(map,feature){return this.feature=feature,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&(!this.feature.disableInfoWindow&&(this.state=WPGMZA.InfoWindow.STATE_OPEN,!0))},WPGMZA.InfoWindow.prototype.close=function(){this.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(this.state=WPGMZA.InfoWindow.STATE_CLOSED,this.trigger("infowindowclose"))},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onFeatureAdded=function(){1==this.feature.settings.infoopen&&this.open()},WPGMZA.InfoWindow.prototype.onOpen=function(){}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,(this._lng=0)!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},WPGMZA.LatLng.isLatLngString=function(str){return"string"==typeof str&&!!str.match(WPGMZA.LatLng.REGEXP)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.fromString=function(string){if(!WPGMZA.LatLng.isLatLngString(string))throw new Error("Not a valid latlng string");var m=string.match(WPGMZA.LatLng.REGEXP);return new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])})},WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromCurrentPosition=function(callback,options){options=options||{},callback&&WPGMZA.getCurrentPosition(function(position){var latLng=new WPGMZA.LatLng({lat:position.coords.latitude,lng:position.coords.longitude});options.geocodeAddress?WPGMZA.Geocoder.createInstance().getAddressFromLatLng({latLng:latLng},function(results){results.length&&(latLng.address=results[0]),callback(latLng)}):callback(latLng)})},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.toGoogleLatLngArray=function(arr){var result=[];return arr.forEach(function(nativeLatLng){if(!(nativeLatLng instanceof WPGMZA.LatLng||"lat"in nativeLatLng&&"lng"in nativeLatLng))throw new Error("Unexpected input");result.push(new google.maps.LatLng({lat:parseFloat(nativeLatLng.lat),lng:parseFloat(nativeLatLng.lng)}))}),result},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.toLatLngLiteral=function(){return{lat:this.lat,lng:this.lng}},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI},WPGMZA.LatLng.prototype.getGreatCircleDistance=function(arg1,arg2){var other,lat1=this.lat,lon1=this.lng;if(1==arguments.length)other=new WPGMZA.LatLng(arg1);else{if(2!=arguments.length)throw new Error("Invalid number of arguments");other=new WPGMZA.LatLng(arg1,arg2)}var lat2=other.lat,lon2=other.lng,phi1=lat1.toRadians(),phi2=lat2.toRadians(),deltaPhi=(lat2-lat1).toRadians(),deltaLambda=(lon2-lon1).toRadians(),a=Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaLambda/2)*Math.sin(deltaLambda/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLngBounds){var other=southWest;this.south=other.south,this.north=other.north,this.west=other.west,this.east=other.east}else southWest&&northEast&&(this.south=southWest.lat,this.north=northEast.lat,this.west=southWest.lng,this.east=northEast.lng)},WPGMZA.LatLngBounds.fromGoogleLatLngBounds=function(googleLatLngBounds){if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))throw new Error("Argument must be an instance of google.maps.LatLngBounds");var result=new WPGMZA.LatLngBounds,southWest=googleLatLngBounds.getSouthWest(),northEast=googleLatLngBounds.getNorthEast();return result.north=northEast.lat(),result.south=southWest.lat(),result.west=southWest.lng(),result.east=northEast.lng(),result},WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral=function(obj){var result=new WPGMZA.LatLngBounds,southWest=obj.southwest,northEast=obj.northeast;return result.north=northEast.lat,result.south=southWest.lat,result.west=southWest.lng,result.east=northEast.lng,result},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return null==this.north&&null==this.south&&null==this.west&&null==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){if(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),this.isInInitialState())return this.north=this.south=latLng.lat,void(this.west=this.east=latLng.lng);latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng)},WPGMZA.LatLngBounds.prototype.extendByPixelMargin=function(map,x,arg){var y=x;if(!(map instanceof WPGMZA.Map))throw new Error("First argument must be an instance of WPGMZA.Map");if(this.isInInitialState())throw new Error("Cannot extend by pixels in initial state");3<=arguments.length&&(y=arg);var southWest=new WPGMZA.LatLng(this.south,this.west),northEast=new WPGMZA.LatLng(this.north,this.east);southWest=map.latLngToPixels(southWest),northEast=map.latLngToPixels(northEast),southWest.x-=x,southWest.y+=y,northEast.x+=x,northEast.y-=y,southWest=map.pixelsToLatLng(southWest.x,southWest.y),northEast=map.pixelsToLatLng(northEast.x,northEast.y);this.toString();this.north=northEast.lat,this.south=southWest.lat,this.west=southWest.lng,this.east=northEast.lng},WPGMZA.LatLngBounds.prototype.contains=function(latLng){if(!(latLng instanceof WPGMZA.LatLng))throw new Error("Argument must be an instance of WPGMZA.LatLng");return!(latLng.lat<Math.min(this.north,this.south))&&(!(latLng.lat>Math.max(this.north,this.south))&&(this.west<this.east?latLng.lng>=this.west&&latLng.lng<=this.east:latLng.lng<=this.west||latLng.lng>=this.east))},WPGMZA.LatLngBounds.prototype.toString=function(){return this.north+"N "+this.south+"S "+this.west+"W "+this.east+"E"},WPGMZA.LatLngBounds.prototype.toLiteral=function(){return{north:this.north,south:this.south,west:this.west,east:this.east}}}),jQuery(function($){var legacyGlobals={marker_pull:"0",marker_array:[],MYMAP:[],infoWindow_poly:[],markerClusterer:[],heatmap:[],WPGM_Path:[],WPGM_Path_Polygon:[],WPGM_PathLine:[],WPGM_PathLineData:[],WPGM_PathData:[],original_iw:null,wpgmza_user_marker:null,wpgmaps_localize_marker_data:[],wpgmaps_localize_polygon_settings:[],wpgmaps_localize_heatmap_settings:[],wpgmaps_localize_polyline_settings:[],wpgmza_cirtcle_data_array:[],wpgmza_rectangle_data_array:[],wpgmzaForceLegacyMarkerClusterer:!1};function bindLegacyGlobalProperty(key){key in window?console.warn("Cannot redefine legacy global "+key):Object.defineProperty(window,key,{get:function(){return console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]},set:function(value){console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]=value}})}for(var key in legacyGlobals)bindLegacyGlobalProperty(key);WPGMZA.legacyGlobals=legacyGlobals,window.InitMap=window.resetLocations=window.searchLocations=window.fillInAddress=window.searchLocationsNear=function(){console.warn("This function is deprecated and should no longer be used")}}),jQuery(function($){WPGMZA.MapListPage=function(){$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")})},WPGMZA.MapListPage.createInstance=function(){return new WPGMZA.MapListPage},$(document).ready(function(event){WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_LIST&&(WPGMZA.mapListPage=WPGMZA.MapListPage.createInstance())})}),jQuery(function($){WPGMZA.MapSettings=function(element){var json,self=this,str=element.getAttribute("data-settings");try{json=JSON.parse(str)}catch(e){str=(str=str.replace(/\\%/g,"%")).replace(/\\\\"/g,'\\"');try{json=JSON.parse(str)}catch(e){json={},console.warn("Failed to parse map settings JSON")}}function addSettings(input){if(input)for(var key in input)if("other_settings"!=key){var value=input[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),self[key]=value}}WPGMZA.assertInstanceOf(this,"MapSettings"),addSettings(WPGMZA.settings),addSettings(json),json&&json.other_settings&&addSettings(json.other_settings)},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){var self=this,options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),empty("map_start_lat")||empty("map_start_lng")||(options.center=ol.proj.fromLonLat([parseFloat(this.map_start_lng),parseFloat(this.map_start_lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),this.map_start_zoom&&(options.zoom=parseInt(this.map_start_zoom)),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179];function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom)),this.map_start_zoom&&(zoom=parseInt(this.map_start_zoom));var options={zoom:zoom,center:latLng};function isSettingDisabled(value){return"yes"===value||!!value}switch(empty("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),empty("map_start_lat")||empty("map_start_lng")||(options.center=new google.maps.LatLng({lat:parseFloat(this.map_start_lat),lng:parseFloat(this.map_start_lng)})),this.wpgmza_min_zoom&&this.wpgmza_max_zoom&&(options.minZoom=Math.min(this.wpgmza_min_zoom,this.wpgmza_max_zoom),options.maxZoom=Math.max(this.wpgmza_min_zoom,this.wpgmza_max_zoom)),options.zoomControl=!isSettingDisabled(this.wpgmza_settings_map_zoom),options.panControl=!isSettingDisabled(this.wpgmza_settings_map_pan),options.mapTypeControl=!isSettingDisabled(this.wpgmza_settings_map_type),options.streetViewControl=!isSettingDisabled(this.wpgmza_settings_map_streetview),options.fullscreenControl=!isSettingDisabled(this.wpgmza_settings_map_full_screen_control),options.draggable=!isSettingDisabled(this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom=isSettingDisabled(this.wpgmza_settings_map_clickzoom),this.wpgmza_settings_map_scroll&&(options.scrollwheel=!1),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures||1==this.wpgmza_force_greedy_gestures?(options.gestureHandling="greedy",!this.wpgmza_settings_map_scroll&&"scrollwheel"in options&&delete options.scrollwheel):options.gestureHandling="cooperative",parseInt(this.type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}return this.wpgmza_theme_data&&this.wpgmza_theme_data.length&&(options.styles=WPGMZA.GoogleMap.parseThemeData(this.wpgmza_theme_data)),options}}),jQuery(function($){WPGMZA.Map=function(element,options){var self=this;if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(element.hasAttribute("data-map-id")?this.id=element.getAttribute("data-map-id"):this.id=1,!/\d+/.test(this.id))throw new Error("Map ID must be an integer");if(WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,$(this.element).addClass("wpgmza-initialized"),this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.rectangles=[],this.loadSettings(options),this.shortcodeAttributes={},$(this.element).attr("data-shortcode-attributes"))try{this.shortcodeAttributes=JSON.parse($(this.element).attr("data-shortcode-attributes")),this.shortcodeAttributes.zoom&&(this.settings.map_start_zoom=parseInt(this.shortcodeAttributes.zoom))}catch(e){console.warn("Error parsing shortcode attributes")}WPGMZA.getCurrentPage()!=WPGMZA.PAGE_MAP_EDIT&&this.initStoreLocator(),this.setDimensions(),this.setAlignment(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this),WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code&&($(element).append($(WPGMZA.api_consent_html)),$(element).css({height:"auto"})),this.on("init",function(event){self.onInit(event)}),this.on("click",function(event){self.onClick(event)}),WPGMZA.useLegacyGlobals&&(wpgmzaLegacyGlobals.MYMAP[this.id]={map:null,bounds:null,mc:null},wpgmzaLegacyGlobals.MYMAP.init=wpgmzaLegacyGlobals.MYMAP[this.id].init=wpgmzaLegacyGlobals.MYMAP.placeMarkers=wpgmzaLegacyGlobals.MYMAP[this.id].placeMarkers=function(){console.warn("This function is deprecated and should no longer be used")})},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.nightTimeThemeData=[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#575663"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#80823e"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#1b737a"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}],WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},Object.defineProperty(WPGMZA.Map.prototype,"markersPlaced",{get:function(){return this._markersPlaced},set:function(value){throw new Error("Value is read only")}}),Object.defineProperty(WPGMZA.Map.prototype,"lat",{get:function(){return this.getCenter().lat},set:function(value){var center=this.getCenter();center.lat=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"lng",{get:function(){return this.getCenter().lng},set:function(value){var center=this.getCenter();center.lng=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"zoom",{get:function(){return this.getZoom()},set:function(value){this.setZoom(value)}}),WPGMZA.Map.prototype.onInit=function(event){this.initPreloader(),"autoFetchFeatures"in this.settings&&!1===this.settings.autoFetchFeatures||this.fetchFeatures()},WPGMZA.Map.prototype.initPreloader=function(){this.preloader=$(WPGMZA.preloaderHTML),$(this.preloader).hide(),$(this.element).append(this.preloader)},WPGMZA.Map.prototype.showPreloader=function(show){show?$(this.preloader).show():$(this.preloader).hide()},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element);settings.other_settings;if(delete settings.other_settings,options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.initStoreLocator=function(){var storeLocatorElement=$(".wpgmza_sl_main_div");storeLocatorElement.length&&(this.storeLocator=WPGMZA.StoreLocator.createInstance(this,storeLocatorElement[0]))},WPGMZA.Map.prototype.getFeatureArrays=function(){var arrays=WPGMZA.Map.prototype.getFeatureArrays.call(this);return arrays.heatmaps=this.heatmaps,arrays},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]},WPGMZA.Map.prototype.getRESTParameters=function(options){var defaults={};return options&&options.filter||(defaults.filter=JSON.stringify(this.markerFilter.getFilteringParameters())),$.extend(!0,defaults,options)},WPGMZA.Map.prototype.fetchFeaturesViaREST=function(){var data,self=this,filter=this.markerFilter.getFilteringParameters();if("1"==WPGMZA.is_admin&&(filter.includeUnapproved=!0,filter.excludeIntegrated=!0),this.shortcodeAttributes.acf_post_id&&(filter.acfPostID=this.shortcodeAttributes.acf_post_id),this.showPreloader(!0),this.fetchFeaturesXhr&&this.fetchFeaturesXhr.abort(),WPGMZA.settings.fetchMarkersBatchSize){var offset=0,limit=WPGMZA.settings.fetchMarkersBatchSize;!function fetchNextBatch(){filter.offset=offset,filter.limit=limit,data=this.getRESTParameters({filter:JSON.stringify(filter)}),self.fetchFeaturesXhr=WPGMZA.restAPI.call("/markers/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){result.length?(self.onMarkersFetched(result,!0),offset+=limit,fetchNextBatch()):(self.onMarkersFetched(result),data.exclude="markers",WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}}))}})}()}else data=this.getRESTParameters({filter:JSON.stringify(filter)}),this.fetchFeaturesXhr=WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}};Math.PI;function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){0==arguments.length&&(width=this.settings.map_width?this.settings.map_width:"100",this.settings.map_width_type?width+=this.settings.map_width_type.replace("\\",""):width+="%",height=this.settings.map_height?this.settings.map_height:"400",this.settings.map_height_type?height+=this.settings.map_height_type.replace("\\",""):height+="px"),$(this.engineElement).css({width:width,height:height})},WPGMZA.Map.prototype.setAlignment=function(){switch(parseInt(this.settings.wpgmza_map_align)){case 1:$(this.element).css({float:"left"});break;case 2:$(this.element).css({"margin-left":"auto","margin-right":"auto"});break;case 3:$(this.element).css({float:"right"})}},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,(marker.parent=this).markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.infoWindow&&marker.infoWindow.close(),marker.map=null,marker.parent=null;var index=this.markers.indexOf(marker);if(-1==index)throw new Error("Marker not found in marker array");this.markers.splice(index,1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.removeAllMarkers=function(options){for(var i=this.markers.length-1;0<=i;i--)this.removeMarker(this.markers[i])},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.getMarkerByTitle=function(title){if("string"==typeof title){for(var i=0;i<this.markers.length;i++)if(this.markers[i].title==title)return this.markers[i]}else{if(!(title instanceof RegExp))throw new Error("Invalid argument");for(i=0;i<this.markers.length;i++)if(title.test(this.markers[i].title))return this.markers[i]}return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");(polygon.map=this).polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.removePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.removePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.removePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");(polyline.map=this).polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.removePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.removePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.removePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");(circle.map=this).circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.removeCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.removeCircle(circle)},WPGMZA.Map.prototype.addRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");(rectangle.map=this).rectangles.push(rectangle),this.dispatchEvent({type:"rectangleadded",rectangle:rectangle})},WPGMZA.Map.prototype.removeRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");if(rectangle.map!==this)throw new Error("Wrong map error");rectangle.map=null,this.rectangles.splice(this.rectangles.indexOf(rectangle),1),this.dispatchEvent({type:"rectangleremoved",rectangle:rectangle})},WPGMZA.Map.prototype.getRectangleByID=function(id){for(var i=0;i<this.rectangles.length;i++)if(this.rectangles[i].id==id)return this.rectangles[i];return null},WPGMZA.Map.prototype.removeRectangleByID=function(id){var rectangle=this.getRectangleByID(id);rectangle&&this.removeRectangle(rectangle)},WPGMZA.Map.prototype.resetBounds=function(){var latlng=new WPGMZA.LatLng(this.settings.map_start_lat,this.settings.map_start_lng);this.panTo(latlng),this.setZoom(this.settings.map_start_zoom)},WPGMZA.Map.prototype.nudge=function(x,y){var nudged=this.nudgeLatLng(this.getCenter(),x,y);this.setCenter(nudged)},WPGMZA.Map.prototype.nudgeLatLng=function(latLng,x,y){var pixels=this.latLngToPixels(latLng);if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");return this.pixelsToLatLng(pixels)},WPGMZA.Map.prototype.animateNudge=function(x,y,origin,milliseconds){var nudged;if(origin){if(!(origin instanceof WPGMZA.LatLng))throw new Error("Origin must be an instance of WPGMZA.LatLng")}else origin=this.getCenter();nudged=this.nudgeLatLng(origin,x,y),milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$(this).animate({lat:nudged.lat,lng:nudged.lng},milliseconds)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){this.trigger("idle")},WPGMZA.Map.prototype.onClick=function(event){},WPGMZA.Map.prototype.hasVisibleMarkers=function(){for(var marker,length=this.markers.length,i=0;i<length;i++)if((marker=this.markers[i]).isFilterable&&marker.getVisible())return!0;return!1},WPGMZA.Map.prototype.closeAllInfoWindows=function(){this.markers.forEach(function(marker){marker.infoWindow&&marker.infoWindow.close()})},$(document).ready(function(event){if(!WPGMZA.visibilityWorkaroundIntervalID){var invisibleMaps=jQuery(".wpgmza_map:hidden");WPGMZA.visibilityWorkaroundIntervalID=setInterval(function(){jQuery(invisibleMaps).each(function(index,el){if(jQuery(el).is(":visible")){var id=jQuery(el).attr("data-map-id");WPGMZA.getMapByID(id).onElementResized(),invisibleMaps.splice(invisibleMaps.toArray().indexOf(el),1)}})},1e3)}})}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1),$("#wpgmza-confirm-engine").click()}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val(),nonce:$("#wpgmza-maps-engine-dialog").attr("data-ajax-nonce")},success:function(response,status,xhr){window.location.reload()}})},$(document).ready(function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.MarkerFilter=function(map){WPGMZA.EventDispatcher.call(this),this.map=map},WPGMZA.MarkerFilter.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MarkerFilter.prototype.constructor=WPGMZA.MarkerFilter,WPGMZA.MarkerFilter.createInstance=function(map){return new WPGMZA.MarkerFilter(map)},WPGMZA.MarkerFilter.prototype.getFilteringParameters=function(){var params={map_id:this.map.id};return this.map.storeLocator&&(params=$.extend(params,this.map.storeLocator.getFilteringParameters())),params},WPGMZA.MarkerFilter.prototype.update=function(params,source){var self=this;function dispatchEvent(result){var event=new WPGMZA.Event("filteringcomplete");event.map=self.map,event.source=source,event.filteredMarkers=result,event.filteringParams=params,self.onFilteringComplete(event),self.trigger(event),self.map.trigger(event)}this.updateTimeoutID||(params=params||{},this.xhr&&(this.xhr.abort(),delete this.xhr),this.updateTimeoutID=setTimeout(function(){if((params=$.extend(self.getFilteringParameters(),params)).center instanceof WPGMZA.LatLng&&(params.center=params.center.toLatLngLiteral()),params.hideAll)return dispatchEvent([]),void delete self.updateTimeoutID;self.map.showPreloader(!0),self.xhr=WPGMZA.restAPI.call("/markers",{data:{fields:["id"],filter:JSON.stringify(params)},success:function(result,status,xhr){self.map.showPreloader(!1),dispatchEvent(result)},useCompressedPathVariable:!0}),delete self.updateTimeoutID},0))},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(event){var map=[];event.filteredMarkers.forEach(function(data){map[data.id]=!0}),this.map.markers.forEach(function(marker){if(marker.isFilterable){var allowByFilter=!!map[marker.id];marker.isFiltered=!allowByFilter,marker.setVisible(allowByFilter)}})}}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;this._offset={x:0,y:0},WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,this.isFilterable=!0,this.disableInfoWindow=!1,WPGMZA.Feature.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}),this.handleLegacyGlobals(row))},WPGMZA.Marker.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",Object.defineProperty(WPGMZA.Marker.prototype,"offsetX",{get:function(){return this._offset.x},set:function(value){this._offset.x=value,this.updateOffset()}}),Object.defineProperty(WPGMZA.Marker.prototype,"offsetY",{get:function(){return this._offset.y},set:function(value){this._offset.y=value,this.updateOffset()}}),WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select"),"1"==this.infoopen&&this.openInfoWindow(!0)},WPGMZA.Marker.prototype.handleLegacyGlobals=function(row){var m;if(WPGMZA.settings.useLegacyGlobals&&this.map_id&&this.id&&!(WPGMZA.pro_version&&(m=WPGMZA.pro_version.match(/\d+/))&&m[0]<=7)){WPGMZA.legacyGlobals.marker_array[this.map_id]||(WPGMZA.legacyGlobals.marker_array[this.map_id]=[]),WPGMZA.legacyGlobals.marker_array[this.map_id][this.id]=this,WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]||(WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]=[]);var cloned=$.extend({marker_id:this.id},row);WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id][this.id]=cloned}},WPGMZA.Marker.prototype.initInfoWindow=function(){this.infoWindow||(this.infoWindow=WPGMZA.InfoWindow.createInstance())},WPGMZA.Marker.prototype.openInfoWindow=function(autoOpen){this.map?(autoOpen||(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),this.map.lastInteractedMarker=this),this.initInfoWindow(),this.infoWindow.open(this.map,this)):console.warn("Cannot open infowindow for marker with no map")},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){WPGMZA.settings.wpgmza_settings_map_open_marker_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){function stripProtocol(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}return WPGMZA.defaultMarkerIcon?stripProtocol(WPGMZA.defaultMarkerIcon):stripProtocol(WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return new WPGMZA.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.setOffset=function(x,y){this._offset.x=x,this._offset.y=y,this.updateOffset()},WPGMZA.Marker.prototype.updateOffset=function(){},WPGMZA.Marker.prototype.getAnimation=function(){return this.anim},WPGMZA.Marker.prototype.setAnimation=function(animation){},WPGMZA.Marker.prototype.getVisible=function(){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.getMap=function(){return this.map},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this),this.map=map},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(options){},WPGMZA.Marker.prototype.setOpacity=function(opacity){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=WPGMZA.getMapByID(map_id):this.map=WPGMZA.maps[0],this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#ff0000",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#ff0000")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),start=(rgba=WPGMZA.hexToRgba(settings.color),WPGMZA.rgbaToString(rgba));rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(var i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(0<settings.numRadiusLabels){var m,x,y;radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1]),context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var spokeAngle,width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;0<Math.sin(spokeAngle)&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this,map=WPGMZA.getMapByID(map_id);if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"'], .wpgmza_sl_search_button_"+map_id).closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var addressInput,inner=$(this.element).find(".wpgmza-inner");addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),map.settings.store_locator_query_string&&map.settings.store_locator_query_string.length&&addressInput.attr("placeholder",map.settings.store_locator_query_string),inner.append(addressInput);var button,titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=map.settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}(button=$(original).find("button.wpgmza-use-my-location"))&&inner.append(button),$(addressInput).on("keydown keypress",function(event){13==event.keyCode&&self.searchButton.is(":visible")&&self.searchButton.trigger("click")}),$(addressInput).on("input",function(event){self.searchButton.show(),self.resetButton.hide()}),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button, .wpgmza_sl_search_button_div"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_APPLIED)}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_INITIAL})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),items=($(container).children("ul"),$(container).find("li")),numCategories=0,icons=[];items.each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fa fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")}),$(this.element).on("mouseover","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseOverCategory(event)}),$(this.element).on("mouseleave","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseLeaveCategory(event)}),$("body").on("click",".wpgmza_store_locator_options_button",function(event){setTimeout(function(){if($(".wpgmza_cat_checkbox_holder").hasClass("wpgmza-open")){var p_cat=$(".wpgmza_cat_checkbox_holder"),position_cat=p_cat.position().top+p_cat.outerHeight(!0)+$(".wpgmza-modern-store-locator").height(),$p_map=$(".wpgmza_map");$p_map.position().top+$p_map.outerHeight(!0)<=position_cat&&($(".wpgmza_cat_ul").css("overflow","scroll "),$(".wpgmza_cat_ul").css("height","100%"),$(".wpgmza-modern-store-locator").css("height","100%"),$(".wpgmza_cat_checkbox_holder.wpgmza-open").css({"padding-bottom":"50px",height:"100%"}))}},500)})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLModernStoreLocator(map_id);default:return new WPGMZA.GoogleModernStoreLocator(map_id)}},WPGMZA.ModernStoreLocator.prototype.onMouseOverCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeIn()},WPGMZA.ModernStoreLocator.prototype.onMouseLeaveCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeOut()}}),jQuery(function($){WPGMZA.NativeMapsAppIcon=function(){navigator.userAgent.match(/^Apple|iPhone|iPad|iPod/)?(this.type="apple",this.element=$('<span><i class="fab fa fa-apple" aria-hidden="true"></i></span>')):(this.type="google",this.element=$('<span><i class="fab fa fa-google" aria-hidden="true"></i></span>'))}}),jQuery(function($){Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(begin,end){return new Uint8Array(Array.prototype.slice.call(this,begin,end))}}),WPGMZA.isSafari()&&!window.external&&(window.external={})}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,Object.defineProperty(WPGMZA.Polygon.prototype,"fillColor",{enumerable:!0,get:function(){return this.fillcolor&&this.fillcolor.length?"#"+this.fillcolor.replace(/^#/,""):"#ff0000"},set:function(a){this.fillcolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineopacity&&this.lineopacity.length?this.lineopacity:.6},set:function(a){this.lineopacity=a}}),WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)}}),jQuery(function($){WPGMZA.Polyline=function(options,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,Object.defineProperty(WPGMZA.Polyline.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeWeight",{enumerable:!0,get:function(){return this.linethickness&&this.linethickness.length?parseInt(this.linethickness):1},set:function(a){this.linethickness=a}}),WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(options,engineObject){return new(WPGMZA.Polyline.getConstructor())(options,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.PopoutPanel=function(element){this.element=element},WPGMZA.PopoutPanel.prototype.open=function(){$(this.element).addClass("wpgmza-open")},WPGMZA.PopoutPanel.prototype.close=function(){$(this.element).removeClass("wpgmza-open")}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Rectangle=function(options,engineRectangle){WPGMZA.assertInstanceOf(this,"Rectangle"),this.name="",this.cornerA=new WPGMZA.LatLng,this.cornerB=new WPGMZA.LatLng,this.color="#ff0000",this.opacity=.5,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Rectangle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeColor",{enumerable:!0,get:function(){return"#000000"}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return 0}}),WPGMZA.Rectangle.createInstance=function(options,engineRectangle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLRectangle;break;default:constructor=WPGMZA.GoogleRectangle}return new constructor(options,engineRectangle)}}),jQuery(function($){function sendAJAXFallbackRequest(route,params){if((params=$.extend({},params)).data||(params.data={}),"route"in params.data)throw new Error("Cannot send route through this method");if("action"in params.data)throw new Error("Cannot send action through this method");return params.data.route=route,params.data.action="wpgmza_rest_api_request",WPGMZA.restAPI.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_AJAX),$.ajax(WPGMZA.ajaxurl,params)}WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl,this.useAJAXFallback=!1},WPGMZA.RestAPI.CONTEXT_REST="REST",WPGMZA.RestAPI.CONTEXT_AJAX="AJAX",WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableSupported",{get:function(){return WPGMZA.serverCanInflate&&"Uint8Array"in window&&"TextEncoder"in window}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableAllowed",{get:function(){return!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?!WPGMZA.settings.disable_compressed_path_variables:WPGMZA.settings.enable_compressed_path_variables}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"maxURLLength",{get:function(){return 2083}}),WPGMZA.RestAPI.prototype.compressParams=function(params){var suffix="";if(params.markerIDs){var markerIDs=params.markerIDs.split(",");if(1<markerIDs.length){var encoded=(new WPGMZA.EliasFano).encode(markerIDs),compressed=pako.deflate(encoded),string=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");suffix="/"+btoa(string).replace(/\//g,"-").replace(/=+$/,""),params.midcbp=encoded.pointer,delete params.markerIDs}}string=JSON.stringify(params);var input=(new TextEncoder).encode(string),raw=(compressed=pako.deflate(input),Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join(""));return btoa(raw).replace(/\//g,"-").replace(/=+$/,"")+suffix},WPGMZA.RestAPI.prototype.getNonce=function(route){var matches=[];for(var pattern in WPGMZA.restnoncetable){var regex=new RegExp(pattern);route.match(regex)&&matches.push({pattern:pattern,nonce:WPGMZA.restnoncetable[pattern],length:pattern.length})}if(!matches.length)throw new Error("No nonce found for route");return matches.sort(function(a,b){return b.length-a.length}),matches[0].nonce},WPGMZA.RestAPI.prototype.addNonce=function(route,params,context){function setRESTNonce(xhr){context==WPGMZA.RestAPI.CONTEXT_REST&&self.shouldAddNonce(route)&&xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&¶ms.method&&!params.method.match(/^GET$/i)&&xhr.setRequestHeader("X-WPGMZA-Action-Nonce",self.getNonce(route))}var self=this;if(params.beforeSend){var base=params.beforeSend;params.beforeSend=function(xhr){base(xhr),setRESTNonce(xhr)}}else params.beforeSend=setRESTNonce},WPGMZA.RestAPI.prototype.shouldAddNonce=function(route){route=route.replace(/\//g,"");var isAdmin=!1;WPGMZA.is_admin&&1===parseInt(WPGMZA.is_admin)&&(isAdmin=!0);return!(route&&["markers","features","marker-listing","datatables"].includes(route)&&!isAdmin)},WPGMZA.RestAPI.prototype.call=function(route,params){if(this.useAJAXFallback)return sendAJAXFallbackRequest(route,params);var attemptedCompressedPathVariable=!1,fallbackRoute=route,fallbackParams=$.extend({},params);if("string"!=typeof route||!route.match(/^\//)&&!route.match(/^http/))throw new Error("Invalid route");if(WPGMZA.RestAPI.URL.match(/\/$/)&&(route=route.replace(/^\//,"")),params=params||{},this.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_REST),params.error||(params.error=function(xhr,status,message){if("abort"!=status){switch(xhr.status){case 401:case 403:case 405:return($.post(WPGMZA.ajaxurl,{action:"wpgmza_report_rest_api_blocked"},function(response){}),console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users."),"DELETE"===params.method)?(console.warn("The REST API rejected a DELETE request, attempting again with POST fallback"),params.method="POST",params.data||(params.data={}),params.data.simulateDelete="yes",WPGMZA.restAPI.call(route,params)):(this.useAJAXFallback=!0,sendAJAXFallbackRequest(fallbackRoute,fallbackParams));case 414:if(!attemptedCompressedPathVariable)break;return fallbackParams.method="POST",fallbackParams.useCompressedPathVariable=!1,WPGMZA.restAPI.call(fallbackRoute,fallbackParams)}throw new Error(message)}}),params.useCompressedPathVariable&&this.isCompressedPathVariableSupported&&this.isCompressedPathVariableAllowed){var compressedParams=$.extend({},params),data=params.data,base64=this.compressParams(data);WPGMZA.isServerIIS&&(base64=base64.replace(/\+/g,"%20"));var compressedRoute=route.replace(/\/$/,"")+"/base64"+base64;WPGMZA.RestAPI.URL;compressedParams.method="GET",delete compressedParams.data,!1===params.cache&&(compressedParams.data={skip_cache:1}),compressedRoute.length<this.maxURLLength?(attemptedCompressedPathVariable=!0,route=compressedRoute,params=compressedParams):(WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed||console.warn("Compressed path variable route would exceed URL length limit"),WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed=!0)}return WPGMZA.RestAPI.URL.match(/\?/)&&(route=route.replace(/\?/,"&")),$.ajax(WPGMZA.RestAPI.URL+route,params)};var nativeCallFunction=WPGMZA.RestAPI.call;WPGMZA.RestAPI.call=function(){console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?"),nativeCallFunction.apply(this,arguments)},$(document.body).on("click","#wpgmza-rest-api-blocked button.notice-dismiss",function(event){WPGMZA.restAPI.call("/rest-api/",{method:"POST",data:{dismiss_blocked_notice:!0}})})});var $_GET={};if(-1!==document.location.toString().indexOf("?"))for(var query=document.location.toString().replace(/^.*?\?/,"").replace(/#.*$/,"").split("&"),wpgmza_i=0,wpgmza_l=query.length;wpgmza_i<wpgmza_l;wpgmza_i++){var aux=decodeURIComponent(query[wpgmza_i]).split("=");$_GET[aux[0]]=aux[1]}jQuery(function($){WPGMZA.SettingsPage=function(){var self=this;this._keypressHistory=[],this.updateEngineSpecificControls(),this.updateStorageControls(),this.updateGDPRControls(),$(window).on("keypress",function(event){self.onKeyPress(event)}),jQuery("body").on("click",".wpgmza_destroy_data",function(e){e.preventDefault();var ttype=jQuery(this).attr("danger"),warning="Are you sure?";"wpgmza_destroy_all_data"==ttype&&(warning="Are you sure? This will delete ALL data and settings for WP Google Maps!"),window.confirm(warning)&&jQuery.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_settings_danger_zone_delete_data",type:ttype,nonce:wpgmza_dz_nonce},success:function(response,status,xhr){"wpgmza_destroy_all_data"==ttype?window.location.replace("admin.php?page=wp-google-maps-menu&action=welcome_page"):"wpgmza_reset_all_settings"==ttype?window.location.reload():alert("Complete.")}})}),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$('[name="wpgmza_settings_marker_pull"]').on("click",function(event){self.updateStorageControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()}),$('select[name="tile_server_url"]').on("change",function(event){"custom_override"===$('select[name="tile_server_url"]').val()?$(".wpgmza_tile_server_override_component").removeClass("wpgmza-hidden"):$(".wpgmza_tile_server_override_component").addClass("wpgmza-hidden")}),$('select[name="tile_server_url"]').trigger("change"),jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.settingsPage.flushGeocodeCache()}),$("#wpgmza-global-settings").tabs({create:function(event,ui){if(void 0!==$_GET.highlight){var elmnt=document.getElementById($_GET.highlight);elmnt.classList.add("highlight-item"),setTimeout(function(){elmnt.classList.add("highlight-item-step-2")},1e3);var y=elmnt.getBoundingClientRect().top+window.pageYOffset+-100;window.scrollTo({top:y,behavior:"smooth"})}}}),$("#wpgmza-global-setting").bind("create",function(event,ui){alert("now")}),$("#wpgmza-global-settings fieldset").each(function(index,el){$(el).children(":not(legend)").wrapAll("<span class='settings-group'></span>")})},WPGMZA.SettingsPage.createInstance=function(){return new WPGMZA.SettingsPage},WPGMZA.SettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.SettingsPage.prototype.updateStorageControls=function(){$("input[name='wpgmza_settings_marker_pull'][value='1']").is(":checked")?$("#xml-cache-settings").show():$("#xml-cache-settings").hide()},WPGMZA.SettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},WPGMZA.SettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},WPGMZA.SettingsPage.prototype.onKeyPress=function(event){this._keypressHistory.push(event.key),9<this._keypressHistory.length&&(this._keypressHistory=this._keypressHistory.slice(this._keypressHistory.length-9)),"codecabin"!=this._keypressHistory.join("")||this._developerModeRevealed||($("fieldset#wpgmza-developer-mode").show(),this._developerModeRevealed=!0)},$(document).ready(function(event){WPGMZA.getCurrentPage()&&(WPGMZA.settingsPage=WPGMZA.SettingsPage.createInstance())})}),jQuery(function($){WPGMZA.StoreLocator=function(map,element){var self=this;WPGMZA.EventDispatcher.call(this),this._center=null,this.map=map,this.element=element,this.state=WPGMZA.StoreLocator.STATE_INITIAL,this.distanceUnits=this.map.settings.store_locator_distance,this.addressInput=WPGMZA.AddressInput.createInstance(this.addressElement,this.map),$(element).find(".wpgmza-not-found-msg").hide(),this.radiusElement&&this.map.settings.wpgmza_store_locator_default_radius&&0<this.radiusElement.find("option[value='"+this.map.settings.wpgmza_store_locator_default_radius+"']").length&&this.radiusElement.val(this.map.settings.wpgmza_store_locator_default_radius),this.map.on("storelocatorgeocodecomplete",function(event){self.onGeocodeComplete(event)}),this.map.on("init",function(event){self.map.markerFilter.on("filteringcomplete",function(event){self.onFilteringComplete(event)}),void 0!==self.map.settings.store_locator_style&&"modern"!=self.map.settings.store_locator_style&&"modern"!==WPGMZA.settings.user_interface_style||(self.legacyModernAdapter=WPGMZA.ModernStoreLocator.createInstance(map.id))}),$(document.body).on("click",".wpgmza_sl_search_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_search_button",function(event){self.onSearch(event)}),$(document.body).on("click",".wpgmza_sl_reset_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_reset_button_div",function(event){self.onReset(event)}),$(this.addressElement).on("keypress",function(event){13==event.which&&self.onSearch(event)})},WPGMZA.StoreLocator.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.StoreLocator.prototype.constructor=WPGMZA.StoreLocator,WPGMZA.StoreLocator.STATE_INITIAL="initial",WPGMZA.StoreLocator.STATE_APPLIED="applied",WPGMZA.StoreLocator.createInstance=function(map,element){return new WPGMZA.StoreLocator(map,element)},Object.defineProperty(WPGMZA.StoreLocator.prototype,"address",{get:function(){return $(this.addressElement).val()}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"addressElement",{get:function(){return this.legacyModernAdapter?$(this.legacyModernAdapter.element).find("input.wpgmza-address")[0]:$(this.element).find("input.wpgmza-address")[0]}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"countryRestriction",{get:function(){return this.map.settings.wpgmza_store_locator_restrict}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radiusElement",{get:function(){return $("#radiusSelect, #radiusSelect_"+this.map.id)}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return parseFloat(this.radiusElement.val())}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"center",{get:function(){return this._center}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"bounds",{get:function(){return this._bounds}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"marker",{get:function(){if(1!=this.map.settings.store_locator_bounce)return null;if(this._marker)return this._marker;return this._marker=WPGMZA.Marker.createInstance({visible:!1}),this._marker.disableInfoWindow=!0,this._marker.isFilterable=!1,this._marker.setAnimation(WPGMZA.Marker.ANIMATION_BOUNCE),this._marker}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"circle",{get:function(){return this._circle||("modern"!=this.map.settings.wpgmza_store_locator_radius_style||WPGMZA.isDeviceiOS()?this._circle=WPGMZA.Circle.createInstance({strokeColor:"#ff0000",strokeOpacity:"0.25",strokeWeight:2,fillColor:"#ff0000",fillOpacity:"0.15",visible:!1,clickable:!1,center:new WPGMZA.LatLng}):(this._circle=WPGMZA.ModernStoreLocatorCircle.createInstance(this.map.id),this._circle.settings.color=this.circleStrokeColor)),this._circle}}),WPGMZA.StoreLocator.prototype.onGeocodeComplete=function(event){if(!event.results||!event.results.length)return this._center=null,void(this._bounds=null);this._center=new WPGMZA.LatLng(event.results[0].latLng),this._bounds=new WPGMZA.LatLngBounds(event.results[0].bounds),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.onSearch=function(event){var self=this;if(this.state=WPGMZA.StoreLocator.STATE_APPLIED,!this.address||!this.address.length)return this.addressElement.focus(),!1;function callback(results,status){self.map.trigger({type:"storelocatorgeocodecomplete",results:results,status:status})}if(WPGMZA.animateScroll(this.map.element),WPGMZA.LatLng.isLatLngString(this.address))callback([WPGMZA.LatLng.fromString(this.address)],WPGMZA.Geocoder.SUCCESS);else{var geocoder=WPGMZA.Geocoder.createInstance(),options={address:this.address};this.countryRestriction&&(options.country=this.countryRestriction),geocoder.geocode(options,function(results,status){status==WPGMZA.Geocoder.SUCCESS?callback(results,status):alert(WPGMZA.localized_strings.address_not_found)})}return!0},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this._bounds=null,this.map.setZoom(this.map.settings.map_start_zoom),this.circle&&this.circle.setVisible(!1),this.marker&&this.marker.map&&this.map.removeMarker(this.marker),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.getZoomFromRadius=function(radius){return this.distanceUnits==WPGMZA.Distance.MILES&&(radius*=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(14-Math.log(radius)/Math.LN2)},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){var params=event.filteringParams,marker=this.marker;marker&&marker.setVisible(!1),params.center&&(this.map.setCenter(params.center),marker&&(marker.setPosition(params.center),marker.setVisible(!0),marker.map!=this.map&&this.map.addMarker(marker))),params.radius&&this.map.setZoom(this.getZoomFromRadius(params.radius));var circle=this.circle;if(circle){circle.setVisible(!1);var factor=this.distanceUnits==WPGMZA.Distance.MILES?WPGMZA.Distance.KILOMETERS_PER_MILE:1;params.center&¶ms.radius&&(circle.setRadius(params.radius*factor),circle.setCenter(params.center),circle.setVisible(!0),circle instanceof WPGMZA.ModernStoreLocatorCircle||circle.map==this.map||this.map.addCircle(circle)),circle instanceof WPGMZA.ModernStoreLocatorCircle&&(circle.settings.radiusString=this.radius)}0==event.filteredMarkers.length&&alert(this.map.settings.store_locator_not_found_message?this.map.settings.store_locator_not_found_message:WPGMZA.localized_strings.zero_results)}}),jQuery(function($){WPGMZA.Text=function(options){if(options)for(var name in options)this[name]=options[name]},WPGMZA.Text.createInstance=function(options){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLText(options);default:return new WPGMZA.GoogleText(options)}}}),jQuery(function($){WPGMZA.ThemeEditor=function(){WPGMZA.EventDispatcher.call(this),this.element=$("#wpgmza-theme-editor"),"open-layers"!=WPGMZA.settings.engine?this.element.length?(this.json=[{}],this.mapElement=WPGMZA.maps[0].element,this.element.appendTo("#wpgmza-map-theme-editor__holder"),$(window).on("scroll",function(event){}),setInterval(function(){},200),this.initHTML(),WPGMZA.themeEditor=this):console.warn("No element to initialise theme editor on"):this.element.remove()},WPGMZA.extend(WPGMZA.ThemeEditor,WPGMZA.EventDispatcher),WPGMZA.ThemeEditor.prototype.updatePosition=function(){},WPGMZA.ThemeEditor.features={all:[],administrative:["country","land_parcel","locality","neighborhood","province"],landscape:["man_made","natural","natural.landcover","natural.terrain"],poi:["attraction","business","government","medical","park","place_of_worship","school","sports_complex"],road:["arterial","highway","highway.controlled_access","local"],transit:["line","station","station.airport","station.bus","station.rail"],water:[]},WPGMZA.ThemeEditor.elements={all:[],geometry:["fill","stroke"],labels:["icon","text","text.fill","text.stroke"]},WPGMZA.ThemeEditor.prototype.parse=function(){$("#wpgmza_theme_editor_feature option, #wpgmza_theme_editor_element option").css("font-weight","normal"),$("#wpgmza_theme_editor_error").hide(),$("#wpgmza_theme_editor").show(),$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val("");var textarea=$('textarea[name="wpgmza_theme_data"]');if(!textarea.val()||textarea.val().length<1)this.json=[{}];else{try{this.json=$.parseJSON($('textarea[name="wpgmza_theme_data"]').val())}catch(e){return this.json=[{}],$("#wpgmza_theme_editor").hide(),void $("#wpgmza_theme_editor_error").show()}if(!$.isArray(this.json)){var jsonCopy=this.json;this.json=[],this.json.push(jsonCopy)}this.highlightFeatures(),this.highlightElements(),this.loadElementStylers()}},WPGMZA.ThemeEditor.prototype.highlightFeatures=function(){$("#wpgmza_theme_editor_feature option").css("font-weight","normal"),$.each(this.json,function(i,v){v.hasOwnProperty("featureType")?$('#wpgmza_theme_editor_feature option[value="'+v.featureType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_feature option[value="all"]').css("font-weight","bold")})},WPGMZA.ThemeEditor.prototype.highlightElements=function(){var feature=$("#wpgmza_theme_editor_feature").val();$("#wpgmza_theme_editor_element option").css("font-weight","normal"),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")?$('#wpgmza_theme_editor_element option[value="'+v.elementType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_element option[value="all"]').css("font-weight","bold"))})},WPGMZA.ThemeEditor.prototype.loadElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val();$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val(""),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&v.hasOwnProperty("stylers")&&$.isArray(v.stylers)&&0<v.stylers.length&&$.each(v.stylers,function(ii,vv){vv.hasOwnProperty("hue")&&($("#wpgmza_theme_editor_do_hue").prop("checked",!0),$("#wpgmza_theme_editor_hue").val(vv.hue)),vv.hasOwnProperty("lightness")&&$("#wpgmza_theme_editor_lightness").val(vv.lightness),vv.hasOwnProperty("saturation")&&$("#wpgmza_theme_editor_saturation").val(vv.xaturation),vv.hasOwnProperty("gamma")&&$("#wpgmza_theme_editor_gamma").val(vv.gamma),vv.hasOwnProperty("invert_lightness")&&$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!0),vv.hasOwnProperty("visibility")&&$("#wpgmza_theme_editor_visibility").val(vv.visibility),vv.hasOwnProperty("color")&&($("#wpgmza_theme_editor_do_color").prop("checked",!0),$("#wpgmza_theme_editor_color").val(vv.color)),vv.hasOwnProperty("weight")&&$("#wpgmza_theme_editor_weight").val(vv.weight)})})},WPGMZA.ThemeEditor.prototype.writeElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val(),indexJSON=null,stylers=[];if("inherit"!=$("#wpgmza_theme_editor_visibility").val()&&stylers.push({visibility:$("#wpgmza_theme_editor_visibility").val()}),!0===$("#wpgmza_theme_editor_do_color").prop("checked")&&stylers.push({color:$("#wpgmza_theme_editor_color").val()}),!0===$("#wpgmza_theme_editor_do_hue").prop("checked")&&stylers.push({hue:$("#wpgmza_theme_editor_hue").val()}),0<$("#wpgmza_theme_editor_gamma").val().length&&stylers.push({gamma:parseFloat($("#wpgmza_theme_editor_gamma").val())}),0<$("#wpgmza_theme_editor_weight").val().length&&stylers.push({weight:parseFloat($("#wpgmza_theme_editor_weight").val())}),0<$("#wpgmza_theme_editor_saturation").val().length&&stylers.push({saturation:parseFloat($("#wpgmza_theme_editor_saturation").val())}),0<$("#wpgmza_theme_editor_lightness").val().length&&stylers.push({lightness:parseFloat($("#wpgmza_theme_editor_lightness").val())}),!0===$("#wpgmza_theme_editor_do_invert_lightness").prop("checked")&&stylers.push({invert_lightness:!0}),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&(indexJSON=i)}),null===indexJSON){if(0<stylers.length){var new_feature_element_stylers={};"all"!=feature&&(new_feature_element_stylers.featureType=feature),"all"!=element&&(new_feature_element_stylers.elementType=element),new_feature_element_stylers.stylers=stylers,this.json.push(new_feature_element_stylers)}}else 0<stylers.length?this.json[indexJSON].stylers=stylers:this.json.splice(indexJSON,1);$('textarea[name="wpgmza_theme_data"]').val(JSON.stringify(this.json).replace(/:/g,": ").replace(/,/g,", ")),this.highlightFeatures(),this.highlightElements(),WPGMZA.themePanel.updateMapTheme()},WPGMZA.ThemeEditor.prototype.initHTML=function(){var self=this;$.each(WPGMZA.ThemeEditor.features,function(i,v){$("#wpgmza_theme_editor_feature").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_feature").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),$.each(WPGMZA.ThemeEditor.elements,function(i,v){$("#wpgmza_theme_editor_element").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_element").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),this.parse(),$('textarea[name="wpgmza_theme_data"]').on("input selectionchange propertychange",function(){self.parse()}),$(".wpgmza_theme_selection").click(function(){setTimeout(function(){$('textarea[name="wpgmza_theme_data"]').trigger("input")},1e3)}),$("#wpgmza-theme-editor__toggle").click(function(){$("#wpgmza-theme-editor").removeClass("active")}),$("#wpgmza_theme_editor_feature").on("change",function(){self.highlightElements(),self.loadElementStylers()}),$("#wpgmza_theme_editor_element").on("change",function(){self.loadElementStylers()}),$("#wpgmza_theme_editor_do_hue, #wpgmza_theme_editor_hue, #wpgmza_theme_editor_lightness, #wpgmza_theme_editor_saturation, #wpgmza_theme_editor_gamma, #wpgmza_theme_editor_do_invert_lightness, #wpgmza_theme_editor_visibility, #wpgmza_theme_editor_do_color, #wpgmza_theme_editor_color, #wpgmza_theme_editor_weight").on("input selectionchange propertychange",function(){self.writeElementStylers()}),"open-layers"==WPGMZA.settings.engine&&$("#wpgmza_theme_editor :input").prop("disabled",!0)}}),jQuery(function($){WPGMZA.ThemePanel=function(){var self=this;this.element=$("#wpgmza-theme-panel"),this.map=WPGMZA.maps[0],"open-layers"!=WPGMZA.settings.engine?this.element.length?($("#wpgmza-theme-presets").owlCarousel({items:6,dots:!0}),this.element.on("click","#wpgmza-theme-presets label",function(event){self.onThemePresetClick(event)}),$("#wpgmza-open-theme-editor").on("click",function(event){$("#wpgmza-map-theme-editor__holder").addClass("active"),$("#wpgmza-theme-editor").addClass("active"),WPGMZA.animateScroll($("#wpgmza-theme-editor"))}),WPGMZA.themePanel=this):console.warn("No element to initialise theme panel on"):this.element.remove()},WPGMZA.ThemePanel.previewImageCenter={lat:33.701806462148646,lng:-118.15949896058983},WPGMZA.ThemePanel.previewImageZoom=11,WPGMZA.ThemePanel.prototype.onThemePresetClick=function(event){var selectedData=$(event.currentTarget).find("[data-theme-json]").attr("data-theme-json"),textarea=$(this.element).find("textarea[name='wpgmza_theme_data']"),existingData=textarea.val(),allPresetData=[];$(this.element).find("[data-theme-json]").each(function(index,el){allPresetData.push($(el).attr("data-theme-json"))}),existingData.length&&-1==allPresetData.indexOf(existingData)&&!confirm(WPGMZA.localized_strings.overwrite_theme_data)||(textarea.val(selectedData),this.updateMapTheme(),WPGMZA.themeEditor.parse())},WPGMZA.ThemePanel.prototype.updateMapTheme=function(){var data;try{data=JSON.parse($("textarea[name='wpgmza_theme_data']").val())}catch(e){return void alert(WPGMZA.localized_strings.invalid_theme_data)}this.map.setOptions({styles:data})}}),jQuery(function($){WPGMZA.Version=function(){},WPGMZA.Version.GREATER_THAN=1,WPGMZA.Version.EQUAL_TO=0,WPGMZA.Version.LESS_THAN=-1,WPGMZA.Version.compare=function(v1,v2){for(var v1parts=v1.match(/\d+/g),v2parts=v2.match(/\d+/g),i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.XMLCacheConverter=function(){},WPGMZA.XMLCacheConverter.prototype.convert=function(xml){var markers=[],remap={marker_id:"id",linkd:"link"};return $(xml).find("marker").each(function(index,el){var data={};$(el).children().each(function(j,child){var key=child.nodeName;remap[key]&&(key=remap[key]),child.hasAttribute("data-json")?data[key]=JSON.parse($(child).text()):data[key]=$(child).text()}),markers.push(data)}),markers}}),jQuery(function($){WPGMZA.loadXMLAsWebWorker=function(){function tXml(a,d){function c(){for(var l=[];a[b];){if(60==a.charCodeAt(b)){if(47===a.charCodeAt(b+1)){b=a.indexOf(">",b);break}if(33===a.charCodeAt(b+1)){if(45==a.charCodeAt(b+2)){for(;62!==a.charCodeAt(b)||45!=a.charCodeAt(b-1)||45!=a.charCodeAt(b-2)||-1==b;)b=a.indexOf(">",b+1);-1===b&&(b=a.length)}else for(b+=2;62!==a.charCodeAt(b);)b++;b++;continue}var c=f();l.push(c)}else c=b,-2===(b=a.indexOf("<",b)-1)&&(b=a.length),0<(c=a.slice(c,b+1)).trim().length&&l.push(c);b++}return l}function l(){for(var c=b;-1===g.indexOf(a[b]);)b++;return a.slice(c,b)}function f(){var d={};b++,d.tagName=l();for(var f=!1;62!==a.charCodeAt(b);){if(64<(e=a.charCodeAt(b))&&e<91||96<e&&e<123){for(var g=l(),e=a.charCodeAt(b);39!==e&&34!==e&&!(64<e&&e<91||96<e&&e<123)&&62!==e;)b++,e=a.charCodeAt(b);if(f||(d.attributes={},f=!0),39===e||34===e){e=a[b];var h=++b;b=a.indexOf(e,h),e=a.slice(h,b)}else e=null,b--;d.attributes[g]=e}b++}return 47!==a.charCodeAt(b-1)&&("script"==d.tagName?(f=b+1,b=a.indexOf("<\/script>",b),d.children=[a.slice(f,b-1)],b+=8):"style"==d.tagName?(f=b+1,b=a.indexOf("</style>",b),d.children=[a.slice(f,b-1)],b+=7):-1==k.indexOf(d.tagName)&&(b++,d.children=c())),d}var g="\n\t>/= ",k=["img","br","input","meta","link"],h=null;if((d=d||{}).searchId){var b=new RegExp("s*ids*=s*['\"]"+d.searchId+"['\"]").exec(a).index;return-1!==b&&(-1!==(b=a.lastIndexOf("<",b))&&(h=f())),b}return b=0,h=c(),d.filter&&(h=tXml.filter(h,d.filter)),d.simplify&&(h=tXml.simplefy(h)),h}tXml.simplify=function(a){var d={};if(1===a.length&&"string"==typeof a[0])return a[0];for(var c in a.forEach(function(a){if(d[a.tagName]||(d[a.tagName]=[]),"object"==typeof a){var c=tXml.simplefy(a.children);d[a.tagName].push(c),a.attributes&&(c._attributes=a.attributes)}else d[a.tagName].push(a)}),d)1==d[c].length&&(d[c]=d[c][0]);return d},tXml.filter=function(a,d){var c=[];return a.forEach(function(a){"object"==typeof a&&d(a)&&c.push(a),a.children&&(a=tXml.filter(a.children,d),c=c.concat(a))}),c},tXml.domToXml=function(a){var c="";return function d(a){if(a)for(var f=0;f<a.length;f++)if("string"==typeof a[f])c+=a[f].trim();else{var g=a[f];c+="<"+g.tagName;var k=void 0;for(k in g.attributes)c=-1===g.attributes[k].indexOf('"')?c+(" "+k+'="'+g.attributes[k].trim())+'"':c+(" "+k+"='"+g.attributes[k].trim())+"'";c+=">",d(g.children),c+="</"+g.tagName+">"}}(O),c},"object"!=typeof window&&(module.exports=tXml);var inputData,totalFiles,worker=self,dataForMainThread=[],filesLoaded=0;function onXMLLoaded(request){if(4==request.readyState&&200==request.status){(new Date).getTime();!function(xml){for(var markers=xml[0].children[0],remap={marker_id:"id",linkd:"link"},i=0;i<markers.children.length;i++){var data={};markers.children[i].children.forEach(function(node){var key=node.tagName;remap[key]&&(key=remap[key]),node.attributes["data-json"]?data[key]=JSON.parse(node.children[0]):node.children.length?data[key]=node.children[0]:data[key]=""}),dataForMainThread.push(data)}}(tXml(request.responseText)),++filesLoaded>=totalFiles?worker.postMessage(dataForMainThread):loadNextFile()}}function loadNextFile(){var url=inputData.urls[filesLoaded],request=new XMLHttpRequest;request.onreadystatechange=function(){onXMLLoaded(this)},request.open("GET",inputData.protocol+url,!0),request.send()}self.addEventListener("message",function(event){var data=event.data;switch(data.command){case"load":dataForMainThread=[],filesLoaded=0,totalFiles=(inputData=data).urls.length,loadNextFile();break;default:throw new Error("Unknown command")}},!1)}}),jQuery(function($){$(document).ready(function(event){var parent=document.body.onclick;parent&&(document.body.onclick=function(event){event.target instanceof WPGMZA.Marker||parent(event)})})}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&-1<navigator.vendor.indexOf("Apple")&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.DataTable=function(element){var self=this;if(!$.fn.dataTable)return console.warn("The dataTables library is not loaded. Cannot create a dataTable. Did you enable 'Do not enqueue dataTables'?"),void(WPGMZA.settings.wpgmza_do_not_enqueue_datatables&&WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT&&alert("You have selected 'Do not enqueue DataTables' in WP Google Maps' settings. No 3rd party software is loading the DataTables library. Because of this, the marker table cannot load. Please uncheck this option to use the marker table."));if($.fn.dataTable.ext)$.fn.dataTable.ext.errMode="throw";else{var version=$.fn.dataTable.version?$.fn.dataTable.version:"unknown";console.warn("You appear to be running an outdated or modified version of the dataTables library. This may cause issues with table functionality. This is usually caused by 3rd party software loading an older version of DataTables. The loaded version is "+version+", we recommend version 1.10.12 or above.")}$.fn.dataTable.Api&&$.fn.dataTable.Api.register("processing()",function(show){return this.iterator("table",function(ctx){ctx.oApi._fnProcessingDisplay(ctx,show)})}),this.element=element,(this.element.wpgmzaDataTable=this).dataTableElement=this.getDataTableElement();var settings=this.getDataTableSettings();this.phpClass=$(element).attr("data-wpgmza-php-class"),(this.wpgmzaDataTable=this).useCompressedPathVariable=WPGMZA.restAPI.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables,this.method=this.useCompressedPathVariable?"GET":"POST",null==this.getLanguageURL()||"//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json"==this.getLanguageURL()?(this.dataTable=$(this.dataTableElement).DataTable(settings),this.dataTable.ajax.reload()):$.ajax(this.getLanguageURL(),{success:function(response,status,xhr){self.languageJSON=response,self.dataTable=$(self.dataTableElement).DataTable(settings),self.dataTable.ajax.reload()}})},WPGMZA.DataTable.prototype.getDataTableElement=function(){return $(this.element).find("table")},WPGMZA.DataTable.prototype.onAJAXRequest=function(data,settings){var params={phpClass:this.phpClass},attr=$(this.element).attr("data-wpgmza-ajax-parameters");return attr&&$.extend(params,JSON.parse(attr)),$.extend(data,params)},WPGMZA.DataTable.prototype.onDataTableAjaxRequest=function(data,callback,settings){var self=this,element=this.element,route=$(element).attr("data-wpgmza-rest-api-route"),params=this.onAJAXRequest(data,settings),draw=params.draw;if(delete params.draw,!route)throw new Error("No data-wpgmza-rest-api-route attribute specified");var options={method:"POST",useCompressedPathVariable:!0,data:params,dataType:"json",cache:!this.preventCaching,beforeSend:function(xhr){xhr.setRequestHeader("X-DataTables-Draw",draw)},success:function(response,status,xhr){response.draw=draw,self.lastResponse=response,callback(response),$("[data-marker-icon-src]").each(function(index,element){WPGMZA.MarkerIcon.createInstance($(element).attr("data-marker-icon-src")).applyToElement(element)})}};return WPGMZA.restAPI.call(route,options)},WPGMZA.DataTable.prototype.getDataTableSettings=function(){var self=this,element=this.element,options={};$(element).attr("data-wpgmza-datatable-options")&&(options=JSON.parse($(element).attr("data-wpgmza-datatable-options"))),options.deferLoading=!0,options.processing=!0,options.serverSide=!0,options.ajax=function(data,callback,settings){return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self,arguments)},WPGMZA.AdvancedTableDataTable&&this instanceof WPGMZA.AdvancedTableDataTable&&WPGMZA.settings.wpgmza_default_items&&(options.iDisplayLength=parseInt(WPGMZA.settings.wpgmza_default_items)),options.aLengthMenu=[[5,10,25,50,100,-1],["5","10","25","50","100",WPGMZA.localized_strings.all]];var languageURL=this.getLanguageURL();return languageURL&&(options.language={url:languageURL}),options},WPGMZA.DataTable.prototype.getLanguageURL=function(){if(!WPGMZA.locale)return null;var languageURL;switch(WPGMZA.locale.substr(0,2)){case"af":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Afrikaans.json";break;case"sq":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Albanian.json";break;case"am":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Amharic.json";break;case"ar":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Arabic.json";break;case"hy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Armenian.json";break;case"az":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Azerbaijan.json";break;case"bn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bangla.json";break;case"eu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Basque.json";break;case"be":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Belarusian.json";break;case"bg":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bulgarian.json";break;case"ca":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Catalan.json";break;case"zh":languageURL="zh_TW"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Chinese-traditional.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";break;case"hr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Croatian.json";break;case"cs":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Czech.json";break;case"da":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Danish.json";break;case"nl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Dutch.json";break;case"et":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Estonian.json";break;case"fi":languageURL=WPGMZA.locale.match(/^fil/)?WPGMZA.pluginDirURL+"languages/datatables/Filipino.json":WPGMZA.pluginDirURL+"languages/datatables/Finnish.json";break;case"fr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/French.json";break;case"gl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Galician.json";break;case"ka":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Georgian.json";break;case"de":languageURL=WPGMZA.pluginDirURL+"languages/datatables/German.json";break;case"el":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Greek.json";break;case"gu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Gujarati.json";break;case"he":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hebrew.json";break;case"hi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hindi.json";break;case"hu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hungarian.json";break;case"is":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Icelandic.json";break;case"id":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Indonesian.json";break;case"ga":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Irish.json";break;case"it":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Italian.json";break;case"ja":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Japanese.json";break;case"kk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kazakh.json";break;case"ko":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Korean.json";break;case"ky":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kyrgyz.json";break;case"lv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Latvian.json";break;case"lt":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Lithuanian.json";break;case"mk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Macedonian.json";break;case"ml":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Malay.json";break;case"mn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Mongolian.json";break;case"ne":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Nepali.json";break;case"nb":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Bokmal.json";break;case"nn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Nynorsk.json";break;case"ps":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Pashto.json";break;case"fa":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Persian.json";break;case"pl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Polish.json";break;case"pt":languageURL="pt_BR"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Portuguese-Brasil.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";break;case"ro":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Romanian.json";break;case"ru":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Russian.json";break;case"sr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Serbian.json";break;case"si":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Sinhala.json";break;case"sk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovak.json";break;case"sl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovenian.json";break;case"es":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Spanish.json";break;case"sw":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swahili.json";break;case"sv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swedish.json";break;case"ta":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Tamil.json";break;case"te":languageURL=WPGMZA.pluginDirURL+"languages/datatables/telugu.json";break;case"th":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Thai.json";break;case"tr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Turkish.json";break;case"uk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Ukrainian.json";break;case"ur":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Urdu.json";break;case"uz":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Uzbek.json";break;case"vi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Vietnamese.json";break;case"cy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Welsh.json"}return languageURL},WPGMZA.DataTable.prototype.onAJAXResponse=function(response){},WPGMZA.DataTable.prototype.reload=function(){this.dataTable.ajax.reload(null,!1)}}),jQuery(function($){WPGMZA.AdminFeatureDataTable=function(element){var self=this;this.allSelected=!1,WPGMZA.DataTable.call(this,element),$(element).on("click",".wpgmza.bulk_delete",function(event){self.onBulkDelete(event)}),$(element).on("click",".wpgmza.select_all_markers",function(event){self.onSelectAll(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.extend(WPGMZA.AdminFeatureDataTable,WPGMZA.DataTable),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featurePanel",{get:function(){return WPGMZA.mapEditPage[this.featureType+"Panel"]}}),WPGMZA.AdminFeatureDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaFeatureData=meta},options},WPGMZA.AdminFeatureDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0],plural=this.featureType+"s";$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaFeatureData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/"+plural+"/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminFeatureDataTable.prototype.onSelectAll=function(event){this.allSelected=!this.allSelected;var self=this;$(this.element).find("input[name='mark']").each(function(){self.allSelected?$(this).prop("checked",!0):$(this).prop("checked",!1)})},WPGMZA.AdminFeatureDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}}),jQuery(function($){WPGMZA.AdminMapDataTable=function(element){var self=this;WPGMZA.DataTable.call(this,element),$(element).on("mousedown","button[data-action='edit']",function(event){switch(event.which){case 1:var map_id=$(event.target).attr("data-map-id");window.location.href=window.location.href+"&action=edit&map_id="+map_id;break;case 2:map_id=$(event.target).attr("data-map-id");window.open(window.location.href+"&action=edit&map_id="+map_id)}}),$(element).find(".wpgmza.select_all_maps").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete_maps").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","button[data-action='duplicate']",function(event){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"POST",data:{id:map_id,action:"duplicate"},success:function(response,status,xhr){self.reload()}})}),$(element).on("click","button[data-action='trash']",function(event){if(confirm(WPGMZA.localized_strings.map_delete_prompt_text)){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{id:map_id},success:function(response,status,xhr){self.reload()}})}})},WPGMZA.extend(WPGMZA.AdminMapDataTable,WPGMZA.DataTable),WPGMZA.AdminMapDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMapData=meta},options},WPGMZA.AdminMapDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMapDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMapData.id)}),confirm(WPGMZA.localized_strings.map_bulk_delete_prompt_text)&&WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},$(document).ready(function(event){$("[data-wpgmza-admin-map-datatable]").each(function(index,el){WPGMZA.AdminMapDataTable=new WPGMZA.AdminMapDataTable(el)})})}),jQuery(function($){WPGMZA.AdminMarkerDataTable=function(element){var self=this;this.preventCaching=!0,WPGMZA.DataTable.call(this,element),$(element).on("click","[data-delete-marker-id]",function(event){self.onDeleteMarker(event)}),$(element).find(".wpgmza.select_all_markers").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.AdminMarkerDataTable.prototype=Object.create(WPGMZA.DataTable.prototype),WPGMZA.AdminMarkerDataTable.prototype.constructor=WPGMZA.AdminMarkerDataTable,WPGMZA.AdminMarkerDataTable.createInstance=function(element){return new WPGMZA.AdminMarkerDataTable(element)},WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMarkerData=meta},options},WPGMZA.AdminMarkerDataTable.prototype.onEditMarker=function(event){WPGMZA.animatedScroll("#wpgmaps_tabs_markers")},WPGMZA.AdminMarkerDataTable.prototype.onDeleteMarker=function(event){var self=this,id=$(event.currentTarget).attr("data-delete-marker-id"),data={action:"delete_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:id};$.post(ajaxurl,data,function(response){WPGMZA.mapEditPage.map.removeMarkerByID(id),self.reload()})},WPGMZA.AdminMarkerDataTable.prototype.onApproveMarker=function(event){var cur_id=$(this).attr("id"),data={action:"approve_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:cur_id};$.post(ajaxurl,data,function(response){wpgmza_InitMap(),wpgmza_reinitialisetbl()})},WPGMZA.AdminMarkerDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMarkerData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/markers/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminMarkerDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.mapEditPage.map.setZoom(6),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}}),jQuery(function($){WPGMZA.Integration={},WPGMZA.integrationModules={}}),jQuery(function($){if(window.wp&&wp.i18n&&wp.blocks&&wp.editor&&wp.components){var __=wp.i18n.__,registerBlockType=wp.blocks.registerBlockType,_wp$editor=wp.editor,InspectorControls=_wp$editor.InspectorControls,_wp$components=(_wp$editor.BlockControls,wp.components),Dashicon=_wp$components.Dashicon,PanelBody=(_wp$components.Toolbar,_wp$components.Button,_wp$components.Tooltip,_wp$components.PanelBody);_wp$components.TextareaControl,_wp$components.CheckboxControl,_wp$components.TextControl,_wp$components.SelectControl,_wp$components.RichText;WPGMZA.Integration.Gutenberg=function(){registerBlockType("gutenberg-wpgmza/block",this.getBlockDefinition())},WPGMZA.Integration.Gutenberg.prototype.getBlockTitle=function(){return __("WP Google Maps")},WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls=function(props){return React.createElement(InspectorControls,{key:"inspector"},React.createElement(PanelBody,{title:__("Map Settings")},React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:WPGMZA.adminurl+"admin.php?page=wp-google-maps-menu&action=edit&map_id=1",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-pencil-square-o","aria-hidden":"true"}),__("Go to Map Editor"))),React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:"https://www.wpgmaps.com/documentation/creating-your-first-map/",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-book","aria-hidden":"true"}),__("View Documentation")))))},WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes=function(){return{}},WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition=function(props){var _this=this;return{title:__("WP Google Maps"),description:__("The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss."),category:"common",icon:"location-alt",keywords:[__("Map"),__("Maps"),__("Google")],attributes:this.getBlockAttributes(),edit:function(props){return[!!props.isSelected&&_this.getBlockInspectorControls(props),React.createElement("div",{className:props.className+" wpgmza-gutenberg-block"},React.createElement(Dashicon,{icon:"location-alt"}),React.createElement("span",{class:"wpgmza-gutenberg-block-title"},__("Your map will appear here on your websites front end")))]},save:function(){return null}}},WPGMZA.Integration.Gutenberg.getConstructor=function(){return WPGMZA.Integration.Gutenberg},WPGMZA.Integration.Gutenberg.createInstance=function(){return new(WPGMZA.Integration.Gutenberg.getConstructor())},WPGMZA.isProVersion()||/^6/.test(WPGMZA.pro_version)||(WPGMZA.integrationModules.gutenberg=WPGMZA.Integration.Gutenberg.createInstance())}}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){var geom;if(Parent.call(this,options,olFeature),options=options||{},olFeature){var circle=olFeature.getGeometry(),center=ol.proj.toLonLat(circle.getCenter());geom=circle,options.center=new WPGMZA.LatLng(center[1],center[0]),options.radius=circle.getRadius()/1e3}else geom=new ol.geom.Circle(ol.proj.fromLonLat([parseFloat(options.center.lng),parseFloat(options.center.lat)]),1e3*options.radius);this.layer=new ol.layer.Vector({source:new ol.source.Vector}),this.olFeature=new ol.Feature({geometry:geom}),this.layer.getSource().addFeature(this.olFeature),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaCircle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)},WPGMZA.OLCircle.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olFeature.getGeometry().getCenter());return new WPGMZA.LatLng({lat:lonLat[1],lng:lonLat[0]})},WPGMZA.OLCircle.prototype.recreate=function(){if(this.olFeature&&(this.layer.getSource().removeFeature(this.olFeature),delete this.olFeature),this.center&&this.radius){var x,y,radius=1e3*parseFloat(this.radius);x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular([x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");this.olFeature=new ol.Feature(circle3857),this.layer.getSource().addFeature(this.olFeature)}},WPGMZA.OLCircle.prototype.setVisible=function(visible){this.layer.setVisible(!!visible)},WPGMZA.OLCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.recreate()},WPGMZA.OLCircle.prototype.getRadius=function(){return this.layer.getSource().getFeatures()[0].getGeometry().getRadius()/1e3},WPGMZA.OLCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments)},WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLDrawingManager=function(map){WPGMZA.DrawingManager.call(this,map),this.source=new ol.source.Vector({wrapX:!1}),this.layer=new ol.layer.Vector({source:this.source})},WPGMZA.OLDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.OLDrawingManager.prototype.constructor=WPGMZA.OLDrawingManager,WPGMZA.OLDrawingManager.prototype.setOptions=function(options){var params={};options.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(options.strokeColor,options.strokeOpacity)})),options.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(options.fillColor,options.fillOpacity)})),this.layer.setStyle(new ol.style.Style(params))},WPGMZA.OLDrawingManager.prototype.setDrawingMode=function(mode){var type,endEventType,self=this;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),this.interaction&&(this.map.olMap.removeInteraction(this.interaction),this.interaction=null),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:return;case WPGMZA.DrawingManager.MODE_POLYGON:type="Polygon",endEventType="polygonclosed";break;case WPGMZA.DrawingManager.MODE_POLYLINE:type="LineString",endEventType="polylinecomplete";break;case WPGMZA.DrawingManager.MODE_CIRCLE:type="Circle",endEventType="circlecomplete";break;case WPGMZA.DrawingManager.MODE_RECTANGLE:type="Circle",endEventType="rectanglecomplete";break;case WPGMZA.DrawingManager.MODE_HEATMAP:return;default:throw new Error("Invalid drawing mode")}WPGMZA.mapEditPage&&WPGMZA.mapEditPage.selectInteraction&&WPGMZA.mapEditPage.map.olMap.removeInteraction(WPGMZA.mapEditPage.selectInteraction);var options={source:this.source,type:type};mode==WPGMZA.DrawingManager.MODE_RECTANGLE&&(options.geometryFunction=ol.interaction.Draw.createBox()),this.interaction=new ol.interaction.Draw(options),this.interaction.on("drawend",function(event){if(endEventType){var WPGMZAEvent=new WPGMZA.Event(endEventType);switch(mode){case WPGMZA.DrawingManager.MODE_POLYGON:WPGMZAEvent.enginePolygon=event.feature;break;case WPGMZA.DrawingManager.MODE_POLYLINE:WPGMZAEvent.enginePolyline=event.feature;break;case WPGMZA.DrawingManager.MODE_CIRCLE:WPGMZAEvent.engineCircle=event.feature;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:WPGMZAEvent.engineRectangle=event.feature;break;default:throw new Error("Drawing mode not implemented")}self.dispatchEvent(WPGMZAEvent)}}),this.map.olMap.addInteraction(this.interaction)}}),jQuery(function($){WPGMZA.OLFeature=function(options){WPGMZA.assertInstangeOf(this,"OLFeature"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.extend(WPGMZA.OLFeature,WPGMZA.Feature),WPGMZA.OLFeature.getOLStyle=function(options){var translated={};if(!options)return new ol.style.Style;options=$.extend({},options);var map={fillcolor:"fillColor",opacity:"fillOpacity",linecolor:"strokeColor",lineopacity:"strokeOpacity",linethickness:"strokeWeight"};for(var name in options)name in map&&(options[map[name]]=options[name]);if(options.strokeColor){var opacity=1,weight=1;"strokeOpacity"in options&&(opacity=options.strokeOpacity),"strokeWeight"in options&&(weight=options.strokeWeight),translated.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToString(options.strokeColor,opacity),width:weight})}if(options.fillColor){opacity=1;"fillOpacity"in options&&(opacity=options.fillOpacity);var color=WPGMZA.hexOpacityToString(options.fillColor,opacity);translated.fill=new ol.style.Fill({color:color})}return new ol.style.Style(translated)},WPGMZA.OLFeature.setInteractionsOnFeature=function(feature,enable){if(enable){if(feature.modifyInteraction)return;feature.snapInteraction=new ol.interaction.Snap({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.snapInteraction),feature.modifyInteraction=new ol.interaction.Modify({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.modifyInteraction),feature.modifyInteraction.on("modifyend",function(event){feature.trigger("change")})}else{if(!feature.modifyInteraction)return;feature.map&&(feature.map.olMap.removeInteraction(feature.snapInteraction),feature.map.olMap.removeInteraction(feature.modifyInteraction)),delete feature.snapInteraction,delete feature.modifyInteraction}}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(query,callback){WPGMZA.restAPI.call("/geocode-cache",{data:{query:JSON.stringify(query)},success:function(response,xhr,status){response.lng=response.lon,callback(response)},useCompressedPathVariable:!0})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.componentRestrictions&&options.componentRestrictions.country?data.countrycodes=options.componentRestrictions.country:options.country&&(data.countrycodes=options.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(query,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:JSON.stringify(query),response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.clearCache=function(callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_clear_nominatim_cache"},method:"POST",success:function(response){callback(response)}})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");if(WPGMZA.LatLng.REGEXP.test(options.address)){var latLng=WPGMZA.LatLng.fromString(options.address);callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var finish,location;if(options.location&&(options.latLng=new WPGMZA.LatLng(options.location)),options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].bounds=new WPGMZA.LatLngBounds(new WPGMZA.LatLng({lat:response[i].boundingbox[1],lng:response[i].boundingbox[2]}),new WPGMZA.LatLng({lat:response[i].boundingbox[0],lng:response[i].boundingbox[3]})),response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}var query={location:location,options:options};this.getResponseFromCache(query,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(query,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(feature){var self=this;Parent.call(this,feature),this.element=$("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,Object.defineProperty(WPGMZA.OLInfoWindow.prototype,"isPanIntoViewAllowed",{get:function(){return!0}}),WPGMZA.OLInfoWindow.prototype.open=function(map,feature){var self=this,latLng=feature.getPosition();if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.overlay&&this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!0,insertFirst:!0}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.feature.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.setContent(this.content),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&WPGMZA.getImageDimensions(feature.getIcon(),function(size){$(self.element).css({left:Math.round(size.width/2)+"px"})}),this.trigger("infowindowopen"),this.trigger("domready")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.trigger("infowindowclose"),this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html;var eaBtn=WPGMZA.isProVersion()?"":this.addEditButton();$(this.element).html(eaBtn+"<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})},WPGMZA.OLInfoWindow.prototype.onOpen=function(){var self=this,imgs=$(this.element).find("img"),numImages=imgs.length,numImagesLoaded=0;if(WPGMZA.InfoWindow.prototype.onOpen.apply(this,arguments),this.isPanIntoViewAllowed){function inside(el,viewport){var a=$(el)[0].getBoundingClientRect(),b=$(viewport)[0].getBoundingClientRect();return a.left>=b.left&&a.left<=b.right&&a.right<=b.right&&a.right>=b.left&&a.top>=b.top&&a.top<=b.bottom&&a.bottom<=b.bottom&&a.bottom>=b.top}function panIntoView(){var offset=.45*-$(self.element).height();self.feature.map.animateNudge(0,offset,self.feature.getPosition())}imgs.each(function(index,el){el.onload=function(){++numImagesLoaded!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}),0!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();function isSettingDisabled(value){return"yes"===value||!!value}$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_draggable)):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_clickzoom)):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_scroll))},this),"greedy"!=this.settings.wpgmza_force_greedy_gestures&&"yes"!=this.settings.wpgmza_force_greedy_gestures&&1!=this.settings.wpgmza_force_greedy_gestures&&(this.gestureOverlay=$("<div class='wpgmza-gesture-overlay'></div>"),this.gestureOverlayTimeoutID=null,WPGMZA.isTouchDevice()||(this.olMap.on("wheel",function(event){if(!ol.events.condition.platformModifierKeyOnly(event))return self.showGestureOverlay(),event.originalEvent.preventDefault(),!1}),this.gestureOverlay.text(WPGMZA.localized_strings.use_ctrl_scroll_to_zoom))),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&1==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),isSettingDisabled(WPGMZA.settings.wpgmza_settings_map_full_screen_control)||this.olMap.addControl(new ol.control.FullScreen),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("click",function(event){var features=self.olMap.getFeaturesAtPixel(event.pixel);if(features&&features.length){var marker=features[0].wpgmzaMarker;marker&&(marker.trigger("click"),marker.trigger("select"))}})),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),setTimeout(function(){self.onIdle()},10)}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged(),this._mouseoverNativeFeatures=[],this.olMap.on("pointermove",function(event){if(!event.dragging){try{var featuresUnderPixel=event.target.getFeaturesAtPixel(event.pixel)}catch(e){return}featuresUnderPixel=featuresUnderPixel||[];var i,props,nativeFeaturesUnderPixel=[];for(i=0;i<featuresUnderPixel.length;i++)(props=featuresUnderPixel[i].getProperties()).wpgmzaFeature&&(nativeFeature=props.wpgmzaFeature,nativeFeaturesUnderPixel.push(nativeFeature),-1==self._mouseoverNativeFeatures.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseover"),self._mouseoverNativeFeatures.push(nativeFeature)));for(i=self._mouseoverNativeFeatures.length-1;0<=i;i--)nativeFeature=self._mouseoverNativeFeatures[i],-1==nativeFeaturesUnderPixel.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseout"),self._mouseoverNativeFeatures.splice(i,1))}}),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;if($(event.target).closest(".ol-marker").length)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){var options={};return WPGMZA.settings.tile_server_url&&(options.url=WPGMZA.settings.tile_server_url,"custom_override"===WPGMZA.settings.tile_server_url&&(WPGMZA.settings.tile_server_url_override&&""!==WPGMZA.settings.tile_server_url_override.trim()?options.url=WPGMZA.settings.tile_server_url_override.trim():options.url="https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"),WPGMZA.settings.open_layers_api_key&&""!==WPGMZA.settings.open_layers_api_key&&(options.url+="?apikey="+WPGMZA.settings.open_layers_api_key.trim())),new ol.layer.Tile({source:new ol.source.OSM(options)})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var transformed=ol.proj.transform(this.olMap.getView().getCenter(),"EPSG:3857","EPSG:4326"),center={lat:transformed[1],lng:transformed[0]};-180<=center.lng&¢er.lng<=180||(center.lng=center.lng-360*Math.floor(center.lng/360),180<center.lng&&(center.lng-=360),this.setCenter(center))},WPGMZA.OLMap.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olMap.getView().getCenter());return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.setCenter=function(latLng){var view=this.olMap.getView();WPGMZA.Map.prototype.setCenter.call(this,latLng),view.setCenter(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.wrapLongitude(),this.onBoundsChanged()},WPGMZA.OLMap.prototype.getBounds=function(){var bounds=this.olMap.getView().calculateExtent(this.olMap.getSize()),nativeBounds=new WPGMZA.LatLngBounds,topLeft=ol.proj.toLonLat([bounds[0],bounds[1]]),bottomRight=ol.proj.toLonLat([bounds[2],bounds[3]]);return nativeBounds.north=topLeft[1],nativeBounds.south=bottomRight[1],nativeBounds.west=topLeft[0],nativeBounds.east=bottomRight[0],nativeBounds},WPGMZA.OLMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var view=this.olMap.getView(),extent=ol.extent.boundingExtent([ol.proj.fromLonLat([parseFloat(southWest.lng),parseFloat(southWest.lat)]),ol.proj.fromLonLat([parseFloat(northEast.lng),parseFloat(northEast.lat)])]);view.fit(extent,this.olMap.getSize())},WPGMZA.OLMap.prototype.panTo=function(latLng,zoom){var view=this.olMap.getView(),options={center:ol.proj.fromLonLat([parseFloat(latLng.lng),parseFloat(latLng.lat)]),duration:500};1<arguments.length&&(options.zoom=parseInt(zoom)),view.animate(options)},WPGMZA.OLMap.prototype.getZoom=function(){return Math.round(this.olMap.getView().getZoom())},WPGMZA.OLMap.prototype.setZoom=function(value){this.olMap.getView().setZoom(value)},WPGMZA.OLMap.prototype.getMinZoom=function(){return this.olMap.getView().getMinZoom()},WPGMZA.OLMap.prototype.setMinZoom=function(value){this.olMap.getView().setMinZoom(value)},WPGMZA.OLMap.prototype.getMaxZoom=function(){return this.olMap.getView().getMaxZoom()},WPGMZA.OLMap.prototype.setMaxZoom=function(value){this.olMap.getView().setMaxZoom(value)},WPGMZA.OLMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.olMap&&this.olMap.getView().setProperties(this.settings.toOLViewOptions())},WPGMZA.OLMap.prototype.addMarker=function(marker){WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT?this.olMap.addOverlay(marker.overlay):(this.markerLayer.getSource().addFeature(marker.feature),marker.featureInSource=!0),Parent.prototype.addMarker.call(this,marker)},WPGMZA.OLMap.prototype.removeMarker=function(marker){WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT?this.olMap.removeOverlay(marker.overlay):(this.markerLayer.getSource().removeFeature(marker.feature),marker.featureInSource=!1),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.OLMap.prototype.addPolygon=function(polygon){this.olMap.addLayer(polygon.layer),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.OLMap.prototype.removePolygon=function(polygon){this.olMap.removeLayer(polygon.layer),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.OLMap.prototype.addPolyline=function(polyline){this.olMap.addLayer(polyline.layer),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.OLMap.prototype.removePolyline=function(polyline){this.olMap.removeLayer(polyline.layer),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.OLMap.prototype.addCircle=function(circle){this.olMap.addLayer(circle.layer),Parent.prototype.addCircle.call(this,circle)},WPGMZA.OLMap.prototype.removeCircle=function(circle){this.olMap.removeLayer(circle.layer),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.OLMap.prototype.addRectangle=function(rectangle){this.olMap.addLayer(rectangle.layer),Parent.prototype.addRectangle.call(this,rectangle)},WPGMZA.OLMap.prototype.removeRectangle=function(rectangle){this.olMap.removeLayer(rectangle.layer),Parent.prototype.removeRectangle.call(this,rectangle)},WPGMZA.OLMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var coord=this.olMap.getCoordinateFromPixel([x,y]);if(!coord)return{x:null,y:null};var lonLat=ol.proj.toLonLat(coord);return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.latLngToPixels=function(latLng){var coord=ol.proj.fromLonLat([latLng.lng,latLng.lat]),pixel=this.olMap.getPixelFromCoordinate(coord);return pixel?{x:pixel[0],y:pixel[1]}:{x:null,y:null}},WPGMZA.OLMap.prototype.enableBicycleLayer=function(value){if(value)this.bicycleLayer||(this.bicycleLayer=new ol.layer.Tile({source:new ol.source.OSM({url:"http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"})})),this.olMap.addLayer(this.bicycleLayer);else{if(!this.bicycleLayer)return;this.olMap.removeLayer(this.bicycleLayer)}},WPGMZA.OLMap.prototype.showGestureOverlay=function(){var self=this;clearTimeout(this.gestureOverlayTimeoutID),$(this.gestureOverlay).stop().animate({opacity:"100"}),$(this.element).append(this.gestureOverlay),$(this.gestureOverlay).css({"line-height":$(this.element).height()+"px",opacity:"1.0"}),$(this.gestureOverlay).show(),this.gestureOverlayTimeoutID=setTimeout(function(){self.gestureOverlay.fadeOut(2e3)},2e3)},WPGMZA.OLMap.prototype.onElementResized=function(event){this.olMap.updateSize()},WPGMZA.OLMap.prototype.onRightClick=function(event){if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)return!0;var parentOffset=$(this.element).offset(),relX=event.pageX-parentOffset.left,relY=event.pageY-parentOffset.top,latLng=this.pixelsToLatLng(relX,relY);return this.trigger({type:"rightclick",latLng:latLng}),$(this.element).trigger({type:"rightclick",latLng:latLng}),event.preventDefault(),!1},WPGMZA.OLMap.prototype.enableAllInteractions=function(){this.olMap.getInteractions().forEach(function(interaction){(interaction instanceof ol.interaction.DragPan||interaction instanceof ol.interaction.DoubleClickZoom||interaction instanceof ol.interaction.MouseWheelZoom)&&interaction.setActive(!0)},this)}}),jQuery(function($){var Parent;WPGMZA.OLMarker=function(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toLatLngLiteral():options[name]instanceof WPGMZA.Map||(settings[name]=options[name]);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);if(WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT){var img=$("<img alt=''/>")[0];img.onload=function(event){self.updateElementHeight(),self.map&&self.map.olMap.updateSize()},img.src=WPGMZA.defaultMarkerIcon,this.element=$("<div class='ol-marker'></div>")[0],this.element.appendChild(img),this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element,position:origin,positioning:"bottom-center",stopEvent:!1}),this.overlay.setPosition(origin),this.animation?this.setAnimation(this.animation):this.anim&&this.setAnimation(this.anim),options&&options.draggable&&this.setDraggable(!0),this.rebindClickListener()}else{if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)throw new Error("Invalid marker render mode");this.feature=new ol.Feature({geometry:new ol.geom.Point(origin)}),this.feature.setStyle(this.getVectorLayerStyle()),(this.feature.wpgmzaMarker=this).feature.wpgmzaFeature=this}this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT="element",WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER="vector",WPGMZA.OLMarker.renderMode=WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT,"open-layers"==WPGMZA.settings.engine&&WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(WPGMZA.OLMarker.defaultVectorLayerStyle=new ol.style.Style({image:new ol.style.Icon({anchor:[.5,1],src:WPGMZA.defaultMarkerIcon})}),WPGMZA.OLMarker.hiddenVectorLayerStyle=new ol.style.Style({})),WPGMZA.OLMarker.prototype.getVectorLayerStyle=function(){return this.vectorLayerStyle?this.vectorLayerStyle:WPGMZA.OLMarker.defaultVectorLayerStyle},WPGMZA.OLMarker.prototype.updateElementHeight=function(height,calledOnFocus){var self=this;0!=(height=height||$(this.element).find("img").height())||calledOnFocus||$(window).one("focus",function(event){self.updateElementHeight(!1,!0)}),$(this.element).css({height:height+"px"})},WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove():console.warn("Marker labels are not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.getVisible=function(visible){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)return"none"!=this.overlay.getElement().style.display},WPGMZA.OLMarker.prototype.setVisible=function(visible){if(Parent.prototype.setVisible.call(this,visible),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(visible){var style=this.getVectorLayerStyle();this.feature.setStyle(style)}else this.feature.setStyle(null);else this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?this.feature.setGeometry(new ol.geom.Point(origin)):this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.updateOffset=function(x,y){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER){x=this._offset.x,y=this._offset.y;this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"}else console.warn("Marker offset is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setAnimation=function(anim){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}else console.warn("Marker animation is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0});else console.warn("Marker dragging is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setOpacity=function(opacity){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?$(this.element).css({opacity:opacity}):console.warn("Marker opacity is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0,this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!1)})},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset_top=parseFloat($(this.element).css("top").match(/-?\d+/)[0]),offset_left=parseFloat($(this.element).css("left").match(/-?\d+/)[0]);$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset_left,y:pixelsBeforeDrag.y+offset_top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag}),this.trigger("change"),"yes"!=this.map.settings.wpgmza_settings_map_draggable&&this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!0)})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,olViewportElement=$(this.map.element).children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",olViewportElement.find(".ol-layers .ol-layer:first-child").prepend(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),(WPGMZA.isProVersion()?$(".wpgmza_map[data-map-id='"+map_id+"']"):$("#wpgmza_map")).append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(options,olFeature){if(Parent.call(this,options,olFeature),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(options&&options.polydata)for(var paths=this.parseGeometry(options.polydata),i=0;i<=paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i%paths.length].lng),parseFloat(paths[i%paths.length].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getGeometry=function(){for(var coordinates=this.olFeature.getGeometry().getCoordinates()[0],result=[],i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolygon.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(options,olFeature){if(WPGMZA.Polyline.call(this,options),olFeature)this.olFeature=olFeature;else{var coordinates=[];if(options&&options.polydata)for(var path=this.parseGeometry(options.polydata),i=0;i<path.length;i++){if(!$.isNumeric(path[i].lat))throw new Error("Invalid latitude");if(!$.isNumeric(path[i].lng))throw new Error("Invalid longitude");coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]))}this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getGeometry=function(){for(var result=[],coordinates=this.olFeature.getGeometry().getCoordinates(),i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolyline.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent=WPGMZA.Rectangle;WPGMZA.OLRectangle=function(options,olFeature){if(Parent.apply(this,arguments),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];options.cornerA&&options.cornerB&&(coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)]))),this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaRectangle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.extend(WPGMZA.OLRectangle,WPGMZA.Rectangle),WPGMZA.OLRectangle.prototype.getBounds=function(){var extent=this.olFeature.getGeometry().getExtent(),topLeft=ol.extent.getTopLeft(extent),bottomRight=ol.extent.getBottomRight(extent),topLeftLonLat=ol.proj.toLonLat(topLeft),bottomRightLonLat=ol.proj.toLonLat(bottomRight),topLeftLatLng=new WPGMZA.LatLng(topLeftLonLat[1],topLeftLonLat[0]),bottomRightLatLng=new WPGMZA.LatLng(bottomRightLonLat[1],bottomRightLonLat[0]);return new WPGMZA.LatLngBounds(topLeftLatLng,bottomRightLatLng)},WPGMZA.OLRectangle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLText=function(){}}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;WPGMZA.Circle.call(this,options,googleCircle),googleCircle?(this.googleCircle=googleCircle,options&&(options.center=WPGMZA.LatLng.fromGoogleLatLng(googleCircle.getCenter()),options.radius=googleCircle.getRadius()/1e3)):(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),this.googleFeature=this.googleCircle,options&&this.setOptions(options),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.getCenter=function(){return WPGMZA.LatLng.fromGoogleLatLng(this.googleCircle.getCenter())},WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},WPGMZA.GoogleCircle.prototype.getRadius=function(){return this.googleCircle.getRadius()/1e3},WPGMZA.GoogleCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.googleCircle.setRadius(1e3*parseFloat(radius))},WPGMZA.GoogleCircle.prototype.setVisible=function(visible){this.googleCircle.setVisible(!!visible)},WPGMZA.GoogleCircle.prototype.setDraggable=function(value){this.googleCircle.setDraggable(!!value)},WPGMZA.GoogleCircle.prototype.setEditable=function(value){var self=this;this.googleCircle.setOptions({editable:value}),value&&(google.maps.event.addListener(this.googleCircle,"center_changed",function(event){self.center=WPGMZA.LatLng.fromGoogleLatLng(self.googleCircle.getCenter()),self.trigger("change")}),google.maps.event.addListener(this.googleCircle,"radius_changed",function(event){self.radius=self.googleCircle.getRadius()/1e3,self.trigger("change")}))},WPGMZA.GoogleCircle.prototype.setOptions=function(options){WPGMZA.Circle.prototype.setOptions.apply(this,arguments),options.center&&(this.center=new WPGMZA.LatLng(options.center))},WPGMZA.GoogleCircle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),center=new WPGMZA.LatLng(this.center);googleOptions.radius*=1e3,googleOptions.center=center.toGoogleLatLng(),this.googleCircle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleDrawingManager=function(map){var self=this;WPGMZA.DrawingManager.call(this,map),this.mode=null,this.googleDrawingManager=new google.maps.drawing.DrawingManager({drawingControl:!1,polygonOptions:{editable:!0},polylineOptions:{editable:!0},circleOptions:{editable:!0},rectangleOptions:{editable:!0}}),this.googleDrawingManager.setMap(map.googleMap),google.maps.event.addListener(this.googleDrawingManager,"polygoncomplete",function(polygon){self.onPolygonClosed(polygon)}),google.maps.event.addListener(this.googleDrawingManager,"polylinecomplete",function(polyline){self.onPolylineComplete(polyline)}),google.maps.event.addListener(this.googleDrawingManager,"circlecomplete",function(circle){self.onCircleComplete(circle)}),google.maps.event.addListener(this.googleDrawingManager,"rectanglecomplete",function(rectangle){self.onRectangleComplete(rectangle)})},WPGMZA.GoogleDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.GoogleDrawingManager.prototype.constructor=WPGMZA.GoogleDrawingManager,WPGMZA.GoogleDrawingManager.prototype.setDrawingMode=function(mode){var googleMode;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:googleMode=null;break;case WPGMZA.DrawingManager.MODE_POLYGON:googleMode=google.maps.drawing.OverlayType.POLYGON;break;case WPGMZA.DrawingManager.MODE_POLYLINE:googleMode=google.maps.drawing.OverlayType.POLYLINE;break;case WPGMZA.DrawingManager.MODE_CIRCLE:googleMode=google.maps.drawing.OverlayType.CIRCLE;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:googleMode=google.maps.drawing.OverlayType.RECTANGLE;break;case WPGMZA.DrawingManager.MODE_HEATMAP:googleMode=null;break;default:throw new Error("Invalid drawing mode")}this.googleDrawingManager.setDrawingMode(googleMode)},WPGMZA.GoogleDrawingManager.prototype.setOptions=function(options){this.googleDrawingManager.setOptions({polygonOptions:options,polylineOptions:options})},WPGMZA.GoogleDrawingManager.prototype.onVertexClicked=function(event){},WPGMZA.GoogleDrawingManager.prototype.onPolygonClosed=function(googlePolygon){var event=new WPGMZA.Event("polygonclosed");event.enginePolygon=googlePolygon,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onPolylineComplete=function(googlePolyline){var event=new WPGMZA.Event("polylinecomplete");event.enginePolyline=googlePolyline,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onCircleComplete=function(googleCircle){var event=new WPGMZA.Event("circlecomplete");event.engineCircle=googleCircle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onRectangleComplete=function(googleRectangle){var event=new WPGMZA.Event("rectanglecomplete");event.engineRectangle=googleRectangle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onHeatmapPointAdded=function(googleMarker){var position=WPGMZA.LatLng.fromGoogleLatLng(googleMarker.getPosition());googleMarker.setMap(null);var marker=WPGMZA.Marker.createInstance();marker.setPosition(position);var image={url:WPGMZA.imageFolderURL+"heatmap-point.png",origin:new google.maps.Point(0,0),anchor:new google.maps.Point(13,13)};marker.googleMarker.setIcon(image),this.map.addMarker(marker);var event=new WPGMZA.Event("heatmappointadded");event.position=position,this.trigger(event)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)return nativeStatus=WPGMZA.Geocoder.NO_ADDRESS,void callback(null,nativeStatus);if(options.lat&&options.lng){var latLng={lat:options.lat,lng:options.lng};callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:null}],WPGMZA.Geocoder.SUCCESS)}if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()},bounds=null;results[0].geometry.bounds&&(bounds=WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds)),callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:bounds}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){WPGMZA.settings.engine&&"google-maps"!=WPGMZA.settings.engine||window.google&&window.google.maps&&(WPGMZA.GoogleHTMLOverlay=function(map){this.element=$("<div class='wpgmza-google-html-overlay'></div>"),this.visible=!0,this.position=new WPGMZA.LatLng,this.setMap(map.googleMap),this.wpgmzaMap=map},WPGMZA.GoogleHTMLOverlay.prototype=new google.maps.OverlayView,WPGMZA.GoogleHTMLOverlay.prototype.onAdd=function(){this.getPanes().overlayMouseTarget.appendChild(this.element[0])},WPGMZA.GoogleHTMLOverlay.prototype.onRemove=function(){this.element&&$(this.element).parent().length&&($(this.element).remove(),this.element=null)},WPGMZA.GoogleHTMLOverlay.prototype.draw=function(){this.updateElementPosition()},WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition=function(){var projection=this.getProjection();if(projection){var pixels=projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());$(this.element).css({left:pixels.x,top:pixels.y})}})}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(feature){Parent.call(this,feature),this.setFeature(feature)},WPGMZA.GoogleInfoWindow.Z_INDEX=99,Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setFeature=function(feature){(this.feature=feature)instanceof WPGMZA.Marker?this.googleObject=feature.googleMarker:feature instanceof WPGMZA.Polygon?this.googleObject=feature.googlePolygon:feature instanceof WPGMZA.Polyline&&(this.googleObject=feature.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){var self=this;this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow,this.googleInfoWindow.setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX),google.maps.event.addListener(this.googleInfoWindow,"domready",function(event){self.trigger("domready")}),google.maps.event.addListener(this.googleInfoWindow,"closeclick",function(event){self.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(self.state=WPGMZA.InfoWindow.STATE_CLOSED,self.feature.map.trigger("infowindowclose"))}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,feature){var self=this;if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setFeature(feature),this.googleInfoWindow.open(this.feature.map.googleMap,this.googleObject);var intervalID,guid=WPGMZA.guid(),eaBtn=WPGMZA.isProVersion()?"":this.addEditButton(),html="<div id='"+guid+"'>"+eaBtn+" "+this.content+"</div>";return this.googleInfoWindow.setContent(html),intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaFeature=self.feature,div.addClass("wpgmza-infowindow"),self.element=div[0],self.trigger("infowindowopen"))},50),!0},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;Parent.call(this,element,options),this.loadGoogleMap(),options?this.setOptions(options,!0):this.setOptions({},!0),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.parseThemeData=function(raw){var json;try{json=JSON.parse(raw)}catch(e){try{json=eval(raw)}catch(e){var str=raw;str=str.replace(/\\'/g,"'"),str=str.replace(/\\"/g,'"'),str=str.replace(/\\0/g,"\0"),str=str.replace(/\\\\/g,"\\");try{json=eval(str)}catch(e){return console.warn("Couldn't parse theme data"),[]}}}return json},WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),this.settings.transport_layer&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.wpgmza_show_point_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options,initializing){if(Parent.prototype.setOptions.call(this,options),options.scrollwheel&&delete options.scrollwheel,initializing){var converted=$.extend(options,this.settings.toGoogleMapsOptions()),clone=$.extend({},converted);if(!clone.center instanceof google.maps.LatLng&&(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),this.settings.hide_point_of_interest){clone.styles||(clone.styles=[]),clone.styles.push({featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]})}this.googleMap.setOptions(clone)}else this.googleMap.setOptions(options)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.addRectangle=function(rectangle){rectangle.googleRectangle.setMap(this.googleMap),Parent.prototype.addRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.removeRectangle=function(rectangle){rectangle.googleRectangle.setMap(null),Parent.prototype.removeRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(parseInt(value))},WPGMZA.GoogleMap.prototype.getBounds=function(){var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest(),nativeBounds=new WPGMZA.LatLngBounds({});return nativeBounds.north=northEast.lat(),nativeBounds.south=southWest.lat(),nativeBounds.west=southWest.lng(),nativeBounds.east=northEast.lng(),nativeBounds.topLeft={lat:northEast.lat(),lng:southWest.lng()},nativeBounds.bottomRight={lat:southWest.lat(),lng:northEast.lng()},nativeBounds},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var nativeBounds=new google.maps.LatLngBounds(southWest,northEast);this.googleMap.fitBounds(nativeBounds)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")},WPGMZA.GoogleMap.prototype.enableAllInteractions=function(){var options={scrollwheel:!0,draggable:!0,disableDoubleClickZoom:!1};this.googleMap.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toGoogleLatLng():options[name]instanceof WPGMZA.Map||"icon"==name||(settings[name]=options[name]);this.googleMarker=new google.maps.Marker(settings),(this.googleMarker.wpgmzaMarker=this).googleFeature=this.googleMarker,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.anim&&this.googleMarker.setAnimation(this.anim),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()}),self.trigger("change")}),this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,Object.defineProperty(WPGMZA.GoogleMarker.prototype,"opacity",{get:function(){return this._opacity},set:function(value){this._opacity=value,this.googleMarker.setOpacity(value)}}),WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.updateOffset=function(){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image,x=this._offset.x,y=this._offset.y;icon=icon||WPGMZA.settings.default_marker_icon,params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor_x=img.width/2,defaultAnchor_y=img.height;params.anchor=new google.maps.Point(defaultAnchor_x-x,defaultAnchor_y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(!!visible)},WPGMZA.GoogleMarker.prototype.getVisible=function(visible){return this.googleMarker.getVisible()},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)},WPGMZA.GoogleMarker.prototype.setOpacity=function(opacity){this.googleMarker.setOpacity(opacity)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){var map=this.map=WPGMZA.getMapByID(map_id);WPGMZA.ModernStoreLocator.call(this,map_id);var restrict=map.settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&restrict&&restrict.length,this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(options,googlePolygon){var self=this;options=options||{},Parent.call(this,options,googlePolygon),this.googlePolygon=googlePolygon||new google.maps.Polygon,this.googleFeature=this.googlePolygon,options&&options.polydata&&this.googlePolygon.setOptions({paths:this.parseGeometry(options.polydata)}),this.googlePolygon.wpgmzaPolygon=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.updateNativeFeature=function(){this.googlePolygon.setOptions(this.getScalarProperties())},WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){var self=this;this.googlePolygon.setOptions({editable:value}),value&&(this.googlePolygon.getPaths().forEach(function(path,index){["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})})}),google.maps.event.addListener(this.googlePolygon,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolygon,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))}))},WPGMZA.GooglePolygon.prototype.setDraggable=function(value){this.googlePolygon.setDraggable(value)},WPGMZA.GooglePolygon.prototype.getGeometry=function(){for(var result=[],path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(options,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,options,googlePolyline),this.googlePolyline=googlePolyline||new google.maps.Polyline(this.settings),this.googleFeature=this.googlePolyline,options&&options.polydata){var path=this.parseGeometry(options.polydata);this.googlePolyline.setPath(path)}this.googlePolyline.wpgmzaPolyline=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.updateNativeFeature=function(){this.googlePolyline.setOptions(this.getScalarProperties())},WPGMZA.GooglePolyline.prototype.setEditable=function(value){var self=this;if(this.googlePolyline.setOptions({editable:value}),value){var path=this.googlePolyline.getPath();["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})}),google.maps.event.addListener(this.googlePolyline,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolyline,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))})}},WPGMZA.GooglePolyline.prototype.setDraggable=function(value){this.googlePolyline.setOptions({draggable:value})},WPGMZA.GooglePolyline.prototype.getGeometry=function(){for(var result=[],path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GoogleRectangle=function(options,googleRectangle){var self=this;options=options||{},WPGMZA.Rectangle.call(this,options,googleRectangle),googleRectangle?(this.googleRectangle=googleRectangle,this.cornerA=options.cornerA=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getNorthEast().lat(),lng:googleRectangle.getBounds().getSouthWest().lng()}),this.cornerB=options.cornerB=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getSouthWest().lat(),lng:googleRectangle.getBounds().getNorthEast().lng()})):(this.googleRectangle=new google.maps.Rectangle,this.googleRectangle.wpgmzaRectangle=this),this.googleFeature=this.googleRectangle,options&&this.setOptions(options),google.maps.event.addListener(this.googleRectangle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleRectangle.prototype=Object.create(WPGMZA.Rectangle.prototype),WPGMZA.GoogleRectangle.prototype.constructor=WPGMZA.GoogleRectangle,WPGMZA.GoogleRectangle.prototype.getBounds=function(){return WPGMZA.LatLngBounds.fromGoogleLatLngBounds(this.googleRectangle.getBounds())},WPGMZA.GoogleRectangle.prototype.setVisible=function(visible){this.googleRectangle.setVisible(!!visible)},WPGMZA.GoogleRectangle.prototype.setDraggable=function(value){this.googleRectangle.setDraggable(!!value)},WPGMZA.GoogleRectangle.prototype.setEditable=function(value){var self=this;this.googleRectangle.setEditable(!!value),value&&google.maps.event.addListener(this.googleRectangle,"bounds_changed",function(event){self.trigger("change")})},WPGMZA.GoogleRectangle.prototype.setOptions=function(options){WPGMZA.Rectangle.prototype.setOptions.apply(this,arguments),options.cornerA&&options.cornerB&&(this.cornerA=new WPGMZA.LatLng(options.cornerA),this.cornerB=new WPGMZA.LatLng(options.cornerB))},WPGMZA.GoogleRectangle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),north=parseFloat(this.cornerA.lat),west=parseFloat(this.cornerA.lng),south=parseFloat(this.cornerB.lat),east=parseFloat(this.cornerB.lng);north&&west&&south&&east&&(googleOptions.bounds={north:north,west:west,south:south,east:east}),this.googleRectangle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleText=function(options){WPGMZA.Text.apply(this,arguments),this.overlay=new WPGMZA.GoogleTextOverlay(options)},WPGMZA.extend(WPGMZA.GoogleText,WPGMZA.Text)}),jQuery(function($){WPGMZA.GoogleTextOverlay=function(options){this.element=$("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>"),(options=options||{}).position&&(this.position=options.position),options.text&&this.element.find(".wpgmza-inner").text(options.text),options.map&&this.setMap(options.map.googleMap)},window.google&&google.maps&&google.maps.OverlayView&&(WPGMZA.GoogleTextOverlay.prototype=new google.maps.OverlayView),WPGMZA.GoogleTextOverlay.prototype.onAdd=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"}),this.getPanes().floatPane.appendChild(this.element[0])},WPGMZA.GoogleTextOverlay.prototype.draw=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"})},WPGMZA.GoogleTextOverlay.prototype.onRemove=function(){this.element.remove()},WPGMZA.GoogleTextOverlay.prototype.hide=function(){this.element.hide()},WPGMZA.GoogleTextOverlay.prototype.show=function(){this.element.show()},WPGMZA.GoogleTextOverlay.prototype.toggle=function(){this.element.is(":visible")?this.element.hide():this.element.show()}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&null!=vertex&&path.removeAt(vertex),this.close()}))}),jQuery(function($){WPGMZA.FeaturePanel=function(element,mapEditPage){var self=this;WPGMZA.EventDispatcher.apply(this,arguments),this.map=mapEditPage.map,this.drawingManager=mapEditPage.drawingManager,this.feature=null,this.element=element,this.initDefaults(),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.drawingInstructionsElement=$(this.element).find(".wpgmza-feature-drawing-instructions"),this.drawingInstructionsElement.detach(),this.editingInstructionsElement=$(this.element).find(".wpgmza-feature-editing-instructions"),this.editingInstructionsElement.detach(),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.newPanel[0],self.element[0])&&self.onTabActivated(event)}),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.oldPanel[0],self.element[0])&&self.onTabDeactivated(event)}),$(document.body).on("click","[data-edit-"+this.featureType+"-id]",function(event){self.onEditFeature(event)}),$(document.body).on("click","[data-delete-"+this.featureType+"-id]",function(event){self.onDeleteFeature(event)}),$(this.element).find(".wpgmza-save-feature").on("click",function(event){self.onSave(event)}),this.drawingManager.on(self.drawingManagerCompleteEvent,function(event){self.onDrawingComplete(event)}),this.drawingManager.on("drawingmodechanged",function(event){self.onDrawingModeChanged(event)}),$(this.element).on("change input",function(event){self.onPropertyChanged(event)})},WPGMZA.extend(WPGMZA.FeaturePanel,WPGMZA.EventDispatcher),WPGMZA.FeaturePanel.MODE_ADD="add",WPGMZA.FeaturePanel.MODE_EDIT="edit",WPGMZA.FeaturePanel.prevEditableFeature=null,Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"drawingManagerCompleteEvent",{get:function(){return this.featureType+"complete"}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureDataTable",{get:function(){return $("[data-wpgmza-datatable][data-wpgmza-feature-type='"+this.featureType+"']")[0].wpgmzaDataTable}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureAccordion",{get:function(){return $(this.element).closest(".wpgmza-accordion")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"map",{get:function(){return WPGMZA.mapEditPage.map}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"mode",{get:function(){return this._mode}}),WPGMZA.FeaturePanel.prototype.initPreloader=function(){this.preloader||(this.preloader=$(WPGMZA.preloaderHTML),this.preloader.hide(),$(this.element).append(this.preloader))},WPGMZA.FeaturePanel.prototype.initDataTable=function(){var el=$(this.element).find("[data-wpgmza-datatable][data-wpgmza-rest-api-route]");this[this.featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)},WPGMZA.FeaturePanel.prototype.initDefaults=function(){$(this.element).find("[data-ajax-name]:not([type='radio'])").each(function(index,el){var val=$(el).val();val&&$(el).attr("data-default-value",val)})},WPGMZA.FeaturePanel.prototype.setCaptionType=function(type,id){var icons={add:"fa-plus-circle",save:"fa-pencil-square-o"};switch(type){case WPGMZA.FeaturePanel.MODE_ADD:case WPGMZA.FeaturePanel.MODE_EDIT:this.featureAccordion.find("[data-add-caption][data-edit-caption]").each(function(index,el){var text=$(el).attr("data-"+type+"-caption"),icon=$(el).find("i.fa");id&&(text+=" "+id),$(el).text(text),icon.length&&((icon=$("<i class='fa' aria-hidden='true'></i>")).addClass(icons[type]),$(el).prepend(" "),$(el).prepend(icon))});break;default:throw new Error("Invalid type")}},WPGMZA.FeaturePanel.prototype.setMode=function(type,id){this._mode=type,this.setCaptionType(type,id)},WPGMZA.FeaturePanel.prototype.setTargetFeature=function(feature){var self=this;if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setEditable(!1),prev.setDraggable(!1),prev.off("change")}feature?(feature.setEditable(!0),feature.setDraggable(!0),feature.on("change",function(event){self.onFeatureChanged(event)}),this.setMode(WPGMZA.FeaturePanel.MODE_EDIT),this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showInstructions()):this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.feature=WPGMZA.FeaturePanel.prevEditableFeature=feature},WPGMZA.FeaturePanel.prototype.reset=function(){$(this.element).find("[data-ajax-name]:not([data-ajax-name='map_id']):not([type='color']):not([type='checkbox']):not([type='radio'])").val(""),$(this.element).find("select[data-ajax-name]>option:first-child").prop("selected",!0),$(this.element).find("[data-ajax-name='id']").val("-1"),$(this.element).find("input[type='checkbox']").prop("checked",!1),tinyMCE.get("wpgmza-description-editor")?tinyMCE.get("wpgmza-description-editor").setContent(""):$("#wpgmza-description-editor").val(""),$("#wpgmza-description-editor").val(""),this.showPreloader(!1),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),$(this.element).find("[data-ajax-name][data-default-value]").each(function(index,el){$(el).val($(el).data("default-value"))})},WPGMZA.FeaturePanel.prototype.select=function(arg){var id,expectedBaseClass,self=this;if(this.reset(),$.isNumeric(arg))id=arg;else{if(expectedBaseClass=WPGMZA[WPGMZA.capitalizeWords(this.featureType)],!(feature instanceof expectedBaseClass))throw new Error("Invalid feature type for this panel");id=arg.id}this.showPreloader(!0),WPGMZA.animateScroll($(".wpgmza_map")),WPGMZA.restAPI.call("/"+this.featureType+"s/"+id+"?skip_cache=1",{success:function(data,status,xhr){var getByIDFunction="get"+WPGMZA.capitalizeWords(self.featureType)+"ByID",feature=self.map[getByIDFunction](id);self.populate(data),self.showPreloader(!1),self.setMode(WPGMZA.FeaturePanel.MODE_EDIT,id),self.setTargetFeature(feature)}})},WPGMZA.FeaturePanel.prototype.showPreloader=function(show){this.initPreloader(),0==arguments.length||show?(this.preloader.fadeIn(),this.element.addClass("wpgmza-loading")):(this.preloader.fadeOut(),this.element.removeClass("wpgmza-loading"))},WPGMZA.FeaturePanel.prototype.populate=function(data){var value,target,name;for(name in data)switch(target=$(this.element).find("[data-ajax-name='"+name+"']"),value=data[name],(target.attr("type")||"").toLowerCase()){case"checkbox":case"radio":target.prop("checked",1==data[name]);break;case"color":value.match(/^#/)||(value="#"+value);default:"object"==typeof value&&(value=JSON.stringify(value)),$(this.element).find("[data-ajax-name='"+name+"']:not(select)").val(value),$(this.element).find("select[data-ajax-name='"+name+"']").each(function(index,el){"string"==typeof value&&0==data[name].length||$(el).val(value)})}},WPGMZA.FeaturePanel.prototype.serializeFormData=function(){var fields=$(this.element).find("[data-ajax-name]"),data={};return fields.each(function(index,el){var type="text";switch($(el).attr("type")&&(type=$(el).attr("type").toLowerCase()),type){case"checkbox":data[$(el).attr("data-ajax-name")]=$(el).prop("checked")?1:0;break;case"radio":$(el).prop("checked")&&(data[$(el).attr("data-ajax-name")]=$(el).val());break;default:data[$(el).attr("data-ajax-name")]=$(el).val()}}),data},WPGMZA.FeaturePanel.prototype.discardChanges=function(){if(this.feature){var feature=this.feature;this.setTargetFeature(null),feature&&feature.map&&(this.map["remove"+WPGMZA.capitalizeWords(this.featureType)](feature),-1<feature.id&&this.updateFeatureByID(feature.id))}},WPGMZA.FeaturePanel.prototype.updateFeatureByID=function(id){var feature,self=this,route="/"+this.featureType+"s/",functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;WPGMZA.restAPI.call(route+id,{success:function(data,status,xhr){(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature)}})},WPGMZA.FeaturePanel.prototype.showInstructions=function(){switch(this.mode){case WPGMZA.FeaturePanel.MODE_ADD:$(this.map.element).append(this.drawingInstructionsElement),$(this.drawingInstructionsElement).hide().fadeIn();break;default:$(this.map.element).append(this.editingInstructionsElement),$(this.editingInstructionsElement).hide().fadeIn()}},WPGMZA.FeaturePanel.prototype.onTabActivated=function(){this.reset(),this.drawingManager.setDrawingMode(this.featureType),this.onAddFeature(event),$(".wpgmza-table-container-title").hide(),$(".wpgmza-table-container").hide();var featureString=this.featureType.charAt(0).toUpperCase()+this.featureType.slice(1);$("#wpgmza-table-container-"+featureString).show(),$("#wpgmza-table-container-title-"+featureString).show()},WPGMZA.FeaturePanel.prototype.onTabDeactivated=function(){this.discardChanges(),this.setTargetFeature(null)},WPGMZA.FeaturePanel.prototype.onAddFeature=function(event){this.drawingManager.setDrawingMode(this.featureType)},WPGMZA.FeaturePanel.prototype.onEditFeature=function(event){var name="data-edit-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.select(id)},WPGMZA.FeaturePanel.prototype.onDeleteFeature=function(event){var self=this,name="data-delete-"+this.featureType+"-id",id=$(event.currentTarget).attr(name),route="/"+this.featureType+"s/",feature=this.map["get"+WPGMZA.capitalizeWords(this.featureType)+"ByID"](id);this.featureDataTable.dataTable.processing(!0),WPGMZA.restAPI.call(route+id,{method:"DELETE",success:function(data,status,xhr){self.map["remove"+WPGMZA.capitalizeWords(self.featureType)](feature),self.featureDataTable.reload()}})},WPGMZA.FeaturePanel.prototype.onDrawingModeChanged=function(event){$(this.drawingInstructionsElement).detach(),$(this.editingInstructionsElement).detach(),this.drawingManager.mode==this.featureType&&this.showInstructions()},WPGMZA.FeaturePanel.prototype.onDrawingComplete=function(event){var engineFeature=event["engine"+WPGMZA.capitalizeWords(this.featureType)],formData=this.serializeFormData(),geometryField=$(this.element).find("textarea[data-ajax-name$='data']");delete formData.polydata;var nativeFeature=WPGMZA[WPGMZA.capitalizeWords(this.featureType)].createInstance(formData,engineFeature);this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.map["add"+WPGMZA.capitalizeWords(this.featureType)](nativeFeature),this.setTargetFeature(nativeFeature),geometryField.length&&geometryField.val(JSON.stringify(nativeFeature.getGeometry())),this.featureType},WPGMZA.FeaturePanel.prototype.onPropertyChanged=function(event){var feature=this.feature;feature&&($(this.element).find(":input[data-ajax-name]").each(function(index,el){var key=$(el).attr("data-ajax-name");feature[key]=$(el).val()}),feature.updateNativeFeature())},WPGMZA.FeaturePanel.prototype.onFeatureChanged=function(event){var geometryField=$(this.element).find("textarea[data-ajax-name$='data']");geometryField.length&&geometryField.val(JSON.stringify(this.feature.getGeometry()))},WPGMZA.FeaturePanel.prototype.onSave=function(event){var self=this,id=$(self.element).find("[data-ajax-name='id']").val(),data=this.serializeFormData(),route="/"+this.featureType+"s/",isNew=-1==id;"circle"!=this.featureType||data.center?"rectangle"!=this.featureType||data.cornerA?"polygon"!=this.featureType||data.polydata?"polyline"!=this.featureType||data.polydata?(isNew||(route+=id),WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0),WPGMZA.restAPI.call(route,{method:"POST",data:data,success:function(data,status,xhr){var feature,functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;self.reset(),(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),self.setTargetFeature(null),self.showPreloader(!1),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature),self.featureDataTable.reload(),self.onTabActivated(event)}})):alert(WPGMZA.localized_strings.no_shape_polyline):alert(WPGMZA.localized_strings.no_shape_polygon):alert(WPGMZA.localized_strings.no_shape_rectangle):alert(WPGMZA.localized_strings.no_shape_circle)}}),jQuery(function($){WPGMZA.MarkerPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.MarkerPanel,WPGMZA.FeaturePanel),WPGMZA.MarkerPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProMarkerPanel(element,mapEditPage):new WPGMZA.MarkerPanel(element,mapEditPage)},WPGMZA.MarkerPanel.prototype.initDefaults=function(){var self=this;WPGMZA.FeaturePanel.prototype.initDefaults.apply(this,arguments),this.adjustSubMode=!1,this.onTabActivated(null),$(document.body).on("click","[data-adjust-"+this.featureType+"-id]",function(event){self.onAdjustFeature(event)}),$(document.body).find(".wpgmza_approve_btn").on("click",function(event){self.onApproveMarker(event)})},WPGMZA.MarkerPanel.prototype.onAdjustFeature=function(event){var name="data-adjust-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.adjustSubMode=!0,this.select(id)},WPGMZA.MarkerPanel.prototype.onApproveMarker=function(event){var self=this,route="/"+this.featureType+"s/"+$(event.currentTarget).attr("id");WPGMZA.restAPI.call(route,{method:"POST",data:{approved:"1"},success:function(data,status,xhr){self.featureDataTable.reload()}})},WPGMZA.MarkerPanel.prototype.onFeatureChanged=function(event){if(this.adjustSubMode){var aPos=this.feature.getPosition();aPos&&($(this.element).find("[data-ajax-name='lat']").val(aPos.lat),$(this.element).find("[data-ajax-name='lng']").val(aPos.lng))}else{var addressField=$(this.element).find("input[data-ajax-name$='address']");if(addressField.length){var pos=this.feature.getPosition();addressField.val(pos.lat+","+pos.lng)}}},WPGMZA.MarkerPanel.prototype.setTargetFeature=function(feature){if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setOpacity&&prev.setOpacity(1)}$(this.element).find("[data-ajax-name]").removeAttr("disabled"),$(this.element).find("fieldset").show(),$(this.element).find(".wpgmza-adjust-mode-notice").addClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","hidden"),$(this.element).find('[data-ajax-name="lng"]').attr("type","hidden"),$(this.element).find(".wpgmza-hide-in-adjust-mode").removeClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").addClass("wpgmza-hidden"),feature?(feature.setOpacity&&feature.setOpacity(.7),feature.getMap().panTo(feature.getPosition()),this.adjustSubMode&&($(this.element).find("[data-ajax-name]").attr("disabled","disabled"),$(this.element).find("fieldset:not(.wpgmza-always-on)").hide(),$(this.element).find(".wpgmza-adjust-mode-notice").removeClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","text").removeAttr("disabled"),$(this.element).find('[data-ajax-name="lng"]').attr("type","text").removeAttr("disabled"),$(this.element).find(".wpgmza-hide-in-adjust-mode").addClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").removeClass("wpgmza-hidden"))):this.adjustSubMode=!1,WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments)},WPGMZA.MarkerPanel.prototype.onSave=function(event){var self=this,geocoder=WPGMZA.Geocoder.createInstance(),geocodingData={address:$(this.element).find("[data-ajax-name='address']").val()};WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0);var cloud_lat=!1,cloud_lng=!1;0<document.getElementsByName("lat").length&&(cloud_lat=document.getElementsByName("lat")[0].value),0<document.getElementsByName("lng").length&&(cloud_lng=document.getElementsByName("lng")[0].value),cloud_lat&&cloud_lng&&(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey||(geocodingData.lat=parseFloat(cloud_lat),geocodingData.lng=parseFloat(cloud_lng))),this.adjustSubMode?WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments):geocoder.geocode(geocodingData,function(results,status){switch(status){case WPGMZA.Geocoder.ZERO_RESULTS:return alert(WPGMZA.localized_strings.zero_results),void self.showPreloader(!1);case WPGMZA.Geocoder.SUCCESS:break;case WPGMZA.Geocoder.NO_ADDRESS:return alert(WPGMZA.localized_strings.no_address),void self.showPreloader(!1);case WPGMZA.Geocoder.FAIL:default:return alert(WPGMZA.localized_strings.geocode_fail),void self.showPreloader(!1)}var result=results[0];$(self.element).find("[data-ajax-name='lat']").val(result.lat),$(self.element).find("[data-ajax-name='lng']").val(result.lng),WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments)}),WPGMZA.mapEditPage.map.resetBounds()}}),jQuery(function($){WPGMZA.CirclePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.CirclePanel,WPGMZA.FeaturePanel),WPGMZA.CirclePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProCirclePanel(element,mapEditPage):new WPGMZA.CirclePanel(element,mapEditPage)},WPGMZA.CirclePanel.prototype.updateFields=function(){$(this.element).find("[data-ajax-name='center']").val(this.feature.getCenter().toString()),$(this.element).find("[data-ajax-name='radius']").val(this.feature.getRadius())},WPGMZA.CirclePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.CirclePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.CirclePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}});var wpgmza_autoCompleteDisabled=!1;jQuery(function($){"map-edit"==WPGMZA.currentPage&&(WPGMZA.MapEditPage=function(){var self=this,element=document.body;WPGMZA.EventDispatcher.call(this),$("#wpgmaps_options fieldset").wrapInner("<div class='wpgmza-flex'></div>"),this.themePanel=new WPGMZA.ThemePanel,this.themeEditor=new WPGMZA.ThemeEditor,this.map=WPGMZA.maps[0],(!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.1.0")>=WPGMZA.Version.EQUAL_TO)&&(this.drawingManager=WPGMZA.DrawingManager.createInstance(this.map)),this.initDataTables(),this.initFeaturePanels(),this.initJQueryUIControls(),"en"!==WPGMZA.locale&&$("#datatable_no_result_message,#datatable_search_string").parent().parent().hide(),$("input.wpgmza-address").each(function(index,el){el.addressInput=WPGMZA.AddressInput.createInstance(el,self.map)}),$('#wpgmza-map-edit-page input[type="color"]').each(function(){$("<div class='button-secondary wpgmza-paste-color-btn' title='Paste a HEX color code'><i class='fa fa-clipboard' aria-hidden='true'></i></div>").insertAfter(this)}),jQuery("body").on("click",".wpgmza_ac_result",function(e){var index=jQuery(this).data("id"),lat=jQuery(this).data("lat"),lng=jQuery(this).data("lng"),name=jQuery("#wpgmza_item_address_"+index).html();jQuery("input[name='lat']").val(lat),jQuery("input[name='lng']").val(lng),jQuery("#wpgmza_add_address_map_editor").val(name),jQuery("#wpgmza_autocomplete_search_results").hide()}),jQuery("body").on("click",".wpgmza-paste-color-btn",function(){try{var colorBtn=$(this);if(!navigator||!navigator.clipboard||!navigator.clipboard.readText)return;navigator.clipboard.readText().then(function(textcopy){colorBtn.parent().find('input[type="color"]').val("#"+textcopy.replace("#","").trim())}).catch(function(err){console.error("WP Google Maps: Could not access clipboard",err)})}catch(c_ex){}}),jQuery("body").on("focusout","#wpgmza_add_address_map_editor",function(e){setTimeout(function(){jQuery("#wpgmza_autocomplete_search_results").fadeOut("slow")},500)});var ajaxRequest=!1,wpgmzaAjaxTimeout=!1,wpgmzaStartTyping=!1,wpgmzaKeyStrokeCount=1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0,wpgmzaTmp="",wpgmzaIdentifiedTypingSpeed=!1;$("body").on("keypress",".wpgmza-address",function(e){if("wpgmza_add_address_map_editor"==this.id){if(wpgmza_autoCompleteDisabled)return;var wpgmza_apikey=!1;if(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey)return void(wpgmza_apikey=WPGMZA_localized_data.settings.googleMapsApiKey);if("Escape"===e.key||"Alt"===e.key||"Control"===e.key||"Option"===e.key||"Shift"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)return void $("#wpgmza_autocomplete_search_results").hide();if(!wpgmzaIdentifiedTypingSpeed){var d=new Date;return clearTimeout(wpgmzaTmp),wpgmzaTmp=setTimeout(function(){wpgmzaStartTyping=!1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0},1500),wpgmzaStartTyping?1==wpgmzaKeyStrokeCount||(wpgmzaCurrentTimeBetweenStrokes=d.getTime()-wpgmzaStartTyping,wpgmzaTotalTimeForKeyStrokes+=wpgmzaCurrentTimeBetweenStrokes,wpgmzaAvgTimeBetweenStrokes=wpgmzaTotalTimeForKeyStrokes/(wpgmzaKeyStrokeCount-1),wpgmzaStartTyping=d.getTime(),3<=wpgmzaKeyStrokeCount&&(wpgmzaIdentifiedTypingSpeed=wpgmzaAvgTimeBetweenStrokes)):wpgmzaStartTyping=d.getTime(),void wpgmzaKeyStrokeCount++}clearTimeout(wpgmzaAjaxTimeout),$("#wpgmza_autocomplete_search_results").html("Searching..."),$("#wpgmza_autocomplete_search_results").show();var currentSearch=jQuery(this).val();if(""!==currentSearch){!1!==ajaxRequest&&ajaxRequest.abort();var wpgmza_api_url="";wpgmza_api_url=wpgmza_apikey?"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash+"&k="+wpgmza_apikey:"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash,wpgmzaAjaxTimeout=setTimeout(function(){ajaxRequest=$.ajax({url:wpgmza_api_url,type:"GET",dataType:"json",success:function(results){try{if(void 0!==results.error)"error1"==results.error?($("#wpgmza_autoc_disabled").html(WPGMZA.localized_strings.cloud_api_key_error_1),$("#wpgmza_autoc_disabled").fadeIn("slow"),$("#wpgmza_autocomplete_search_results").hide(),wpgmza_autoCompleteDisabled=!0):console.error(results.error);else{$("#wpgmza_autocomplete_search_results").html("");var html="";for(var i in results)html+="<div class='wpgmza_ac_result "+(""===html?"":"border-top")+"' data-id='"+i+"' data-lat='"+results[i].lat+"' data-lng='"+results[i].lng+"'><div class='wpgmza_ac_container'><div class='wpgmza_ac_icon'><img src='"+results[i].icon+"' /></div><div class='wpgmza_ac_item'><span id='wpgmza_item_name_"+i+"' class='wpgmza_item_name'>"+results[i].place_name+"</span><span id='wpgmza_item_address_"+i+"' class='wpgmza_item_address'>"+results[i].formatted_address+"</span></div></div></div>";""==html&&(html="<div class='p-2 text-center'><small>No results found...</small></div>"),$("#wpgmza_autocomplete_search_results").html(html),$("#wpgmza_autocomplete_search_results").show()}}catch(exception){console.error("WP Google Maps Plugin: There was an error returning the list of places for your search")}}})},2*wpgmzaIdentifiedTypingSpeed)}else $("#wpgmza_autocomplete_search_results").hide()}}),$("#wpgmza_map_height_type").on("change",function(event){self.onMapHeightTypeChange(event)}),$("#advanced-markers .wpgmza-feature-drawing-instructions").remove(),$("[data-search-area='auto']").hide(),$(document.body).on("click","[data-wpgmza-admin-marker-datatable] input[name='mark']",function(event){self.onShiftClick(event)}),$("#wpgmza_map_type").on("change",function(event){self.onMapTypeChanged(event)}),$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")}),this.on("markerupdated",function(event){self.onMarkerUpdated(event)}),this.map&&(this.map.on("zoomchanged",function(event){self.onZoomChanged(event)}),this.map.on("boundschanged",function(event){self.onBoundsChanged(event)}),this.map.on("rightclick",function(event){self.onRightClick(event)})),$(element).on("click",".wpgmza_poly_del_btn",function(event){self.onDeletePolygon(event)}),$(element).on("click",".wpgmza_polyline_del_btn",function(event){self.onDeletePolyline(event)}),$(element).on("click",".wpgmza_dataset_del_btn",function(evevnt){self.onDeleteHeatmap(event)}),$(element).on("click",".wpgmza_circle_del_btn",function(event){self.onDeleteCircle(event)}),$(element).on("click",".wpgmza_rectangle_del_btn",function(event){self.onDeleteRectangle(event)}),$(element).on("click","#wpgmza-open-advanced-theme-data",function(event){event.preventDefault(),$(".wpgmza_theme_data_container").toggleClass("wpgmza_hidden")})},WPGMZA.extend(WPGMZA.MapEditPage,WPGMZA.EventDispatcher),WPGMZA.MapEditPage.createInstance=function(){return WPGMZA.isProVersion()&&WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?new WPGMZA.ProMapEditPage:new WPGMZA.MapEditPage},WPGMZA.MapEditPage.prototype.initDataTables=function(){var self=this;$("[data-wpgmza-datatable][data-wpgmza-rest-api-route]").each(function(index,el){var featureType=$(el).attr("data-wpgmza-feature-type");self[featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)})},WPGMZA.MapEditPage.prototype.initFeaturePanels=function(){var self=this;$(".wpgmza-feature-accordion[data-wpgmza-feature-type]").each(function(index,el){var featurePanelElement=$(el).find(".wpgmza-feature-panel-container > *"),featureType=$(el).attr("data-wpgmza-feature-type"),panelClassName=WPGMZA.capitalizeWords(featureType)+"Panel",instance=WPGMZA[panelClassName].createInstance(featurePanelElement,self);self[featureType+"Panel"]=instance})},WPGMZA.MapEditPage.prototype.initJQueryUIControls=function(){var mapContainer,self=this;$("#wpgmaps_tabs").tabs(),mapContainer=$("#wpgmza-map-container").detach(),$("#wpgmaps_tabs_markers").tabs(),$(".map_wrapper").prepend(mapContainer),$("#slider-range-max").slider({range:"max",min:1,max:21,value:$("input[name='map_start_zoom']").val(),slide:function(event,ui){$("input[name='map_start_zoom']").val(ui.value),self.map.setZoom(ui.value)}})},WPGMZA.MapEditPage.prototype.onShiftClick=function(event){var checkbox=event.currentTarget,row=jQuery(checkbox).closest("tr");if(this.lastSelectedRow&&event.shiftKey){var prevIndex=this.lastSelectedRow.index(),currIndex=row.index(),startIndex=Math.min(prevIndex,currIndex),endIndex=Math.max(prevIndex,currIndex),rows=jQuery("[data-wpgmza-admin-marker-datatable] tbody>tr");jQuery("[data-wpgmza-admin-marker-datatable] input[name='mark']").prop("checked",!1);for(var i=startIndex;i<=endIndex;i++)jQuery(rows[i]).find("input[name='mark']").prop("checked",!0)}this.lastSelectedRow=row},WPGMZA.MapEditPage.prototype.onMapTypeChanged=function(event){if("open-layers"!=WPGMZA.settings.engine){var mapTypeId;switch(event.target.value){case"2":mapTypeId=google.maps.MapTypeId.SATELLITE;break;case"3":mapTypeId=google.maps.MapTypeId.HYBRID;break;case"4":mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:mapTypeId=google.maps.MapTypeId.ROADMAP}this.map.setOptions({mapTypeId:mapTypeId})}},WPGMZA.MapEditPage.prototype.onMarkerUpdated=function(event){this.markerDataTable.reload()},WPGMZA.MapEditPage.prototype.onZoomChanged=function(event){$(".map_start_zoom").val(this.map.getZoom())},WPGMZA.MapEditPage.prototype.onBoundsChanged=function(event){var location=this.map.getCenter();$("#wpgmza_start_location").val(location.lat+","+location.lng),$("input[name='map_start_lat']").val(location.lat),$("input[name='map_start_lng']").val(location.lng),$("#wpgmza_start_zoom").val(this.map.getZoom()),$("#wpgmaps_save_reminder").show()},WPGMZA.MapEditPage.prototype.onMapHeightTypeChange=function(event){"%"==event.target.value&&$("#wpgmza_height_warning").show()},WPGMZA.MapEditPage.prototype.onRightClick=function(event){var marker,self=this;this.drawingManager&&this.drawingManager.mode!=WPGMZA.DrawingManager.MODE_MARKER||(this.rightClickMarker||(this.rightClickMarker=WPGMZA.Marker.createInstance({draggable:!0}),this.rightClickMarker.on("dragend",function(event){$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+","+event.latLng.lng)}),this.map.on("click",function(event){self.rightClickMarker.setMap(null)})),(marker=this.rightClickMarker).setPosition(event.latLng),marker.setMap(this.map),$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+", "+event.latLng.lng))},WPGMZA.MapEditPage.prototype.onDeletePolygon=function(event){var cur_id=parseInt($(this).attr("id")),data={action:"delete_poly",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_Path[cur_id].setMap(null),delete WPGM_PathData[cur_id],delete WPGM_Path[cur_id],$("#wpgmza_poly_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeletePolyline=function(event){var cur_id=$(this).attr("id"),data={action:"delete_polyline",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_PathLine[cur_id].setMap(null),delete WPGM_PathLineData[cur_id],delete WPGM_PathLine[cur_id],$("#wpgmza_polyline_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteHeatmap=function(event){var cur_id=$(this).attr("id"),data={action:"delete_dataset",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){heatmap[cur_id].setMap(null),delete heatmap[cur_id],$("#wpgmza_heatmap_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteCircle=function(event){var circle_id=$(this).attr("id"),data={action:"delete_circle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,circle_id:circle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-5 table").replaceWith(response),circle_array.forEach(function(circle){if(circle.id==circle_id)return circle.setMap(null),!1})})},WPGMZA.MapEditPage.prototype.onDeleteRectangle=function(event){var rectangle_id=$(this).attr("id"),data={action:"delete_rectangle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,rectangle_id:rectangle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-6 table").replaceWith(response),rectangle_array.forEach(function(rectangle){if(rectangle.id==rectangle_id)return rectangle.setMap(null),!1})})},$(document).ready(function(event){WPGMZA.mapEditPage=WPGMZA.MapEditPage.createInstance()}))}),jQuery(function($){WPGMZA.PolygonPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolygonPanel,WPGMZA.FeaturePanel),WPGMZA.PolygonPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolygonPanel(element,mapEditPage):new WPGMZA.PolygonPanel(element,mapEditPage)},Object.defineProperty(WPGMZA.PolygonPanel.prototype,"drawingManagerCompleteEvent",{get:function(){return"polygonclosed"}})}),jQuery(function($){WPGMZA.PolylinePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolylinePanel,WPGMZA.FeaturePanel),WPGMZA.PolylinePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolylinePanel(element,mapEditPage):new WPGMZA.PolylinePanel(element,mapEditPage)}}),jQuery(function($){WPGMZA.RectanglePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.RectanglePanel,WPGMZA.FeaturePanel),WPGMZA.RectanglePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProRectanglePanel(element,mapEditPage):new WPGMZA.RectanglePanel(element,mapEditPage)},WPGMZA.RectanglePanel.prototype.updateFields=function(){var bounds=this.feature.getBounds();bounds.north&&bounds.west&&bounds.south&&bounds.east&&($(this.element).find("[data-ajax-name='cornerA']").val(bounds.north+", "+bounds.west),$(this.element).find("[data-ajax-name='cornerB']").val(bounds.south+", "+bounds.east))},WPGMZA.RectanglePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.RectanglePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.RectanglePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}});
|
1 |
+
jQuery(function($){var core={MARKER_PULL_DATABASE:"0",MARKER_PULL_XML:"1",PAGE_MAP_LIST:"map-list",PAGE_MAP_EDIT:"map-edit",PAGE_SETTINGS:"map-settings",PAGE_SUPPORT:"map-support",PAGE_CATEGORIES:"categories",PAGE_ADVANCED:"advanced",PAGE_CUSTOM_FIELDS:"custom-fields",maps:[],events:null,settings:null,restAPI:null,localized_strings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',preloaderHTML:"<div class='wpgmza-preloader'><div></div><div></div><div></div><div></div></div>",getCurrentPage:function(){switch(WPGMZA.getQueryParamValue("page")){case"wp-google-maps-menu":return window.location.href.match(/action=edit/)&&window.location.href.match(/map_id=\d+/)?WPGMZA.PAGE_MAP_EDIT:WPGMZA.PAGE_MAP_LIST;case"wp-google-maps-menu-settings":return WPGMZA.PAGE_SETTINGS;case"wp-google-maps-menu-support":return WPGMZA.PAGE_SUPPORT;case"wp-google-maps-menu-categories":return WPGMZA.PAGE_CATEGORIES;case"wp-google-maps-menu-advanced":return WPGMZA.PAGE_ADVANCED;case"wp-google-maps-menu-custom-fields":return WPGMZA.PAGE_CUSTOM_FIELDS;default:return null}},getScrollAnimationOffset:function(){return(WPGMZA.settings.scroll_animation_offset||0)+$("#wpadminbar").height()},getScrollAnimationDuration:function(){return WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},extend:function(child,parent){var constructor=child;child.prototype=Object.create(parent.prototype),child.prototype.constructor=constructor},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){var hex=parseInt(colour.replace(/^#/,""),16);return[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},hexOpacityToString:function(colour,opacity){var arr=WPGMZA.hexOpacityToRGBA(colour,opacity);return"rgba("+arr[0]+", "+arr[1]+", "+arr[2]+", "+arr[3]+")"},hexToRgba:function(hex){var c;return/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)?(3==(c=hex.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),{r:(c="0x"+c.join(""))>>16&255,g:c>>8&255,b:255&c,a:1}):0},rgbaToString:function(rgba){return"rgba("+rgba.r+", "+rgba.g+", "+rgba.b+", "+rgba.a+")"},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])}):null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:img.width,height:img.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},decodeEntities:function(input){return input.replace(/&(nbsp|amp|quot|lt|gt);/g,function(m,e){return m[e]}).replace(/&#(\d+);/gi,function(m,e){return String.fromCharCode(parseInt(e,10))})},isDeveloperMode:function(){return this.settings.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback,error,watch){var nativeFunction="getCurrentPosition";if(WPGMZA.userLocationDenied)error&&error({code:1,message:"Location unavailable"});else if(watch&&(nativeFunction="watchPosition"),navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation[nativeFunction]?navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){options.enableHighAccuracy=!1,navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){console.warn(err.code,err.message),1==err.code&&(WPGMZA.userLocationDenied=!0),error&&error(err)},options)},options):console.warn(nativeFunction+" is not available")}else console.warn("No geolocation available on this device")},watchPosition:function(callback,error){return WPGMZA.getCurrentPosition(callback,error,!0)},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},capitalizeWords:function(string){return(string+"").replace(/^(.)|\s+(.)/g,function(m){return m.toUpperCase()})},pluralize:function(string){return WPGMZA.singularize(string)+"s"},singularize:function(string){return string.replace(/s$/,"")},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if("OLFeature"!=(fullInstanceName=WPGMZA[engine+pro+instanceName]&&engine+instanceName!="OLFeature"?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]&&WPGMZA[engine+instanceName].prototype?engine+instanceName:instanceName)&&!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){for(var i=0;i<WPGMZA.maps.length;i++)if(WPGMZA.maps[i].id==id)return WPGMZA.maps[i];return null},isGoogleAutocompleteSupported:function(){return!!window.google&&(!!google.maps&&(!!google.maps.places&&(!!google.maps.places.Autocomplete&&(!WPGMZA.CloudAPI||!WPGMZA.CloudAPI.isBeingUsed))))},googleAPIStatus:window.wpgmza_google_api_status,isSafari:function(){var ua=navigator.userAgent.toLowerCase();return ua.match(/safari/i)&&!ua.match(/chrome/i)},isTouchDevice:function(){return"ontouchstart"in window},isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},isModernComponentStyleAllowed:function(){return!WPGMZA.settings.user_interface_style||"legacy"==WPGMZA.settings.user_interface_style||"modern"==WPGMZA.settings.user_interface_style},isElementInView:function(element){var pageTop=$(window).scrollTop(),pageBottom=pageTop+$(window).height(),elementTop=$(element).offset().top,elementBottom=elementTop+$(element).height();return elementTop<pageTop&&pageBottom<elementBottom||(pageTop<=elementTop&&elementTop<=pageBottom||pageTop<=elementBottom&&elementBottom<=pageBottom)},isFullScreen:function(){return wpgmzaisFullScreen},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&#]*)");return(m=window.location.href.match(regex))?decodeURIComponent(m[1]):null},notification:function(text,time){switch(arguments.length){case 0:text="",time=4e3;break;case 1:time=4e3}var html='<div class="wpgmza-popup-notification">'+text+"</div>";jQuery("body").append(html),setTimeout(function(){jQuery("body").find(".wpgmza-popup-notification").remove()},time)}},wpgmzaisFullScreen=!1;for(var key in[]){console.warn("It appears that the built in JavaScript Array has been extended, this can create issues with for ... in loops, which may cause failure.");break}for(var key in window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core,WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}function onScroll(event){$(".wpgmza_map").each(function(index,el){var isInView=WPGMZA.isElementInView(el);el.wpgmzaScrollIntoViewTriggerFlag?isInView||(el.wpgmzaScrollIntoViewTriggerFlag=!1):isInView&&($(el).trigger("mapscrolledintoview.wpgmza"),el.wpgmzaScrollIntoViewTriggerFlag=!0)})}WPGMZA.settings.useLegacyGlobals=!0,jQuery(function($){$(window).trigger("ready.wpgmza"),$("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length&&console.warn("Minified script is out of date, using combined script instead.");var elements=$("script").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});1<elements.length&&console.warn("Multiple jQuery versions detected: ",elements),WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),WPGMZA.CloudAPI&&(WPGMZA.cloudAPI=WPGMZA.CloudAPI.createInstance()),$(document).on("fullscreenchange",function(){wpgmzaisFullScreen=!!document.fullscreenElement}),$("body").on("click","#wpgmzaCloseChat",function(e){e.preventDefault(),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_hide_chat",nonce:WPGMZA_localized_data.ajaxnonce}}),$(".wpgmza-chat-help").remove()})}),$(document).ready(function(event){for(var key in[]){console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");break}if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").first().after($(warning))}}),$(window).on("scroll",onScroll),$(document).ready(onScroll),$(function(){WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code?jQuery(".wpgmza-gdpr-compliance").length<=0&&($("#wpgmza_map, .wpgmza_map").each(function(index,el){$(el).append($(WPGMZA.api_consent_html)),$(el).css({height:"auto"})}),$("button.wpgmza-api-consent").on("click",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()})):function initMaps(){$(document.body).find(".wpgmza_map:not(.wpgmza-initialized)").each(function(index,el){el.wpgmzaMap?console.warn("Element missing class wpgmza-initialized but does have wpgmzaMap property. No new instance will be created"):el.wpgmzaMap=WPGMZA.Map.createInstance(el)}),WPGMZA.Map.nextInitTimeoutID=setTimeout(initMaps,3e3)}()}),$(document.body).on("click","button.wpgmza-api-consent",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()}),$(document.body).on("keydown",function(event){event.altKey&&(WPGMZA.altKeyDown=!0)}),$(document.body).on("keyup",function(event){event.altKey||(WPGMZA.altKeyDown=!1)})}),jQuery(function($){WPGMZA.Compatibility=function(){this.preventDocumentWriteGoogleMapsAPI()},WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI=function(){var old=document.write;document.write=function(content){content.match&&content.match(/maps\.google/)||old.call(document,content)}},WPGMZA.compatiblityModule=new WPGMZA.Compatibility}),function(root,factory){"object"==typeof exports?module.exports=factory(root):"function"==typeof define&&define.amd?define([],factory.bind(root,root)):factory(root)}("undefined"!=typeof global?global:this,function(root){if(root.CSS&&root.CSS.escape)return root.CSS.escape;function cssEscape(value){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var codeUnit,string=String(value),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index<length;)0!=(codeUnit=string.charCodeAt(index))?result+=1<=codeUnit&&codeUnit<=31||127==codeUnit||0==index&&48<=codeUnit&&codeUnit<=57||1==index&&48<=codeUnit&&codeUnit<=57&&45==firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!=index||1!=length||45!=codeUnit)&&(128<=codeUnit||45==codeUnit||95==codeUnit||48<=codeUnit&&codeUnit<=57||65<=codeUnit&&codeUnit<=90||97<=codeUnit&&codeUnit<=122)?string.charAt(index):"\\"+string.charAt(index):result+="�";return result}return root.CSS||(root.CSS={}),root.CSS.escape=cssEscape}),jQuery(function($){Math.PI;function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Distance={MILES:!0,KILOMETERS:!1,MILES_PER_KILOMETER:.621371,KILOMETERS_PER_MILE:1.60934,uiToMeters:function(uiDistance){return parseFloat(uiDistance)/(WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?WPGMZA.Distance.MILES_PER_KILOMETER:1)*1e3},uiToKilometers:function(uiDistance){return.001*WPGMZA.Distance.uiToMeters(uiDistance)},uiToMiles:function(uiDistance){return WPGMZA.Distance.uiToKilometers(uiDistance)*WPGMZA.Distance.MILES_PER_KILOMETER},kilometersToUI:function(km){return WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?km*WPGMZA.Distance.MILES_PER_KILOMETER:km},between:function(a,b){if(!(a instanceof WPGMZA.LatLng||"lat"in a&&"lng"in a))throw new Error("First argument must be an instance of WPGMZA.LatLng or a literal");if(!(b instanceof WPGMZA.LatLng||"lat"in b&&"lng"in b))throw new Error("Second argument must be an instance of WPGMZA.LatLng or a literal");if(a===b)return 0;var lat1=a.lat,lon1=a.lng,lat2=b.lat,lon2=b.lng,dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1);a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}}),jQuery(function($){WPGMZA.EliasFano=function(){if(!WPGMZA.EliasFano.isSupported)throw new Error("Elias Fano encoding is not supported on browsers without Uint8Array");WPGMZA.EliasFano.decodingTablesInitialised||WPGMZA.EliasFano.createDecodingTable()},WPGMZA.EliasFano.isSupported="Uint8Array"in window,WPGMZA.EliasFano.decodingTableHighBits=[],WPGMZA.EliasFano.decodingTableDocIDNumber=null,WPGMZA.EliasFano.decodingTableHighBitsCarryover=null,WPGMZA.EliasFano.createDecodingTable=function(){WPGMZA.EliasFano.decodingTableDocIDNumber=new Uint8Array(256),WPGMZA.EliasFano.decodingTableHighBitsCarryover=new Uint8Array(256);for(var decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,i=0;i<256;i++){var zeroCount=0;decodingTableHighBits[i]=[];for(var j=7;0<=j;j--)zeroCount=0<(i&1<<j)?(decodingTableHighBits[i][decodingTableDocIDNumber[i]]=zeroCount,decodingTableDocIDNumber[i]++,0):(zeroCount+1)%255;decodingTableHighBitsCarryover[i]=zeroCount}WPGMZA.EliasFano.decodingTablesInitialised=!0},WPGMZA.EliasFano.prototype.encode=function(list){var lastDocID=0,buffer1=0,bufferLength1=0,buffer2=0,bufferLength2=0;if(0==list.length)return result;function toByte(n){return 255&n}var compressedBufferPointer1=0,compressedBufferPointer2=0,averageDelta=list[list.length-1]/list.length,averageDeltaLog=Math.log2(averageDelta),lowBitsLength=Math.floor(averageDeltaLog),lowBitsMask=(1<<lowBitsLength)-1,prev=null,maxCompressedSize=Math.floor((2+Math.ceil(Math.log2(averageDelta)))*list.length/8)+6,compressedBuffer=new Uint8Array(maxCompressedSize);lowBitsLength<0&&(lowBitsLength=0),compressedBufferPointer2=Math.floor(lowBitsLength*list.length/8+6),compressedBuffer[compressedBufferPointer1++]=toByte(list.length),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>8),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>16),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>24),compressedBuffer[compressedBufferPointer1++]=toByte(lowBitsLength),list.forEach(function(docID){var docIDDelta=docID-lastDocID-1;if(!$.isNumeric(docID))throw new Error("Value is not numeric");if(docID=parseInt(docID),null!==prev&&docID<=prev)throw new Error("Elias Fano encoding can only be used on a sorted, ascending list of unique integers.");for(prev=docID,buffer1<<=lowBitsLength,buffer1|=docIDDelta&lowBitsMask,bufferLength1+=lowBitsLength;7<bufferLength1;)bufferLength1-=8,compressedBuffer[compressedBufferPointer1++]=toByte(buffer1>>bufferLength1);var unaryCodeLength=1+(docIDDelta>>lowBitsLength);for(buffer2<<=unaryCodeLength,buffer2|=1,bufferLength2+=unaryCodeLength;7<bufferLength2;)bufferLength2-=8,compressedBuffer[compressedBufferPointer2++]=toByte(buffer2>>bufferLength2);lastDocID=docID}),0<bufferLength1&&(compressedBuffer[compressedBufferPointer1++]=toByte(buffer1<<8-bufferLength1)),0<bufferLength2&&(compressedBuffer[compressedBufferPointer2++]=toByte(buffer2<<8-bufferLength2));var result=new Uint8Array(compressedBuffer);return result.pointer=compressedBufferPointer2,result},WPGMZA.EliasFano.prototype.decode=function(compressedBuffer){var resultPointer=0,list=[],decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,lowBitsPointer=0,lastDocID=0,docID=0,docIDNumber=0,listCount=compressedBuffer[lowBitsPointer++];listCount|=compressedBuffer[lowBitsPointer++]<<8,listCount|=compressedBuffer[lowBitsPointer++]<<16,listCount|=compressedBuffer[lowBitsPointer++]<<24;var highBitsPointer,lowBitsLength=compressedBuffer[lowBitsPointer++],lowBitsCount=0,lowBits=0,cb=1;for(highBitsPointer=Math.floor(lowBitsLength*listCount/8+6);highBitsPointer<compressedBuffer.pointer;highBitsPointer++){docID+=decodingTableHighBitsCarryover[cb],docIDNumber=decodingTableDocIDNumber[cb=compressedBuffer[highBitsPointer]];for(var i=0;i<docIDNumber;i++){for(docID<<=lowBitsCount,docID|=lowBits&(1<<lowBitsCount)-1;lowBitsCount<lowBitsLength;)docID<<=8,docID|=lowBits=compressedBuffer[lowBitsPointer++],lowBitsCount+=8;docID>>=lowBitsCount-=lowBitsLength,docID+=(decodingTableHighBits[cb][i]<<lowBitsLength)+lastDocID+1,lastDocID=list[resultPointer++]=docID,docID=0}}return list}}),jQuery(function($){WPGMZA.EventDispatcher=function(){WPGMZA.assertInstanceOf(this,"EventDispatcher"),this._listenersByType={}},WPGMZA.EventDispatcher.prototype.addEventListener=function(type,listener,thisObject,useCapture){var types=type.split(/\s+/);if(1<types.length)for(var i=0;i<types.length;i++)this.addEventListener(types[i],listener,thisObject,useCapture);else{if(!(listener instanceof Function))throw new Error("Listener must be a function");var target;target=this._listenersByType.hasOwnProperty(type)?this._listenersByType[type]:this._listenersByType[type]=[];var obj={listener:listener,thisObject:thisObject||this,useCapture:!!useCapture};target.push(obj)}},WPGMZA.EventDispatcher.prototype.on=WPGMZA.EventDispatcher.prototype.addEventListener,WPGMZA.EventDispatcher.prototype.removeEventListener=function(type,listener,thisObject,useCapture){var arr,obj;if(arr=this._listenersByType[type]){thisObject=thisObject||this,useCapture=!!useCapture;for(var i=0;i<arr.length;i++)if(obj=arr[i],(1==arguments.length||obj.listener==listener)&&obj.thisObject==thisObject&&obj.useCapture==useCapture)return void arr.splice(i,1)}},WPGMZA.EventDispatcher.prototype.off=WPGMZA.EventDispatcher.prototype.removeEventListener,WPGMZA.EventDispatcher.prototype.hasEventListener=function(type){return!!_listenersByType[type]},WPGMZA.EventDispatcher.prototype.dispatchEvent=function(event){if(!(event instanceof WPGMZA.Event))if("string"==typeof event)event=new WPGMZA.Event(event);else{var src=event;for(var name in event=new WPGMZA.Event,src)event[name]=src[name]}for(var path=[],obj=(event.target=this).parent;null!=obj;obj=obj.parent)path.unshift(obj);event.phase=WPGMZA.Event.CAPTURING_PHASE;for(var i=0;i<path.length&&!event._cancelled;i++)path[i]._triggerListeners(event);if(!event._cancelled){for(event.phase=WPGMZA.Event.AT_TARGET,this._triggerListeners(event),event.phase=WPGMZA.Event.BUBBLING_PHASE,i=path.length-1;0<=i&&!event._cancelled;i--)path[i]._triggerListeners(event);var topMostElement=this.element;for(obj=this.parent;null!=obj;obj=obj.parent)obj.element&&(topMostElement=obj.element);if(topMostElement){var customEvent={};for(var key in event){var value=event[key];"type"==key&&(value+=".wpgmza"),customEvent[key]=value}$(topMostElement).trigger(customEvent)}}},WPGMZA.EventDispatcher.prototype.trigger=WPGMZA.EventDispatcher.prototype.dispatchEvent,WPGMZA.EventDispatcher.prototype._triggerListeners=function(event){var arr,obj;if(arr=this._listenersByType[event.type])for(var i=0;i<arr.length;i++)obj=arr[i],event.phase==WPGMZA.Event.CAPTURING_PHASE&&!obj.useCapture||obj.listener.call(arr[i].thisObject,event)},WPGMZA.events=new WPGMZA.EventDispatcher}),jQuery(function($){WPGMZA.AddressInput=function(element,map){if(!(element instanceof HTMLInputElement))throw new Error("Element is not an instance of HTMLInputElement");var json;this.element=element;var options={fields:["name","formatted_address"],types:["geocode"]};(json=$(element).attr("data-autocomplete-options"))&&(options=$.extend(options,JSON.parse(json))),map&&map.settings.wpgmza_store_locator_restrict&&(options.country=map.settings.wpgmza_store_locator_restrict),WPGMZA.isGoogleAutocompleteSupported()?"wpgmza_add_address_map_editor"!=this.id&&WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey&&(element.googleAutoComplete=new google.maps.places.Autocomplete(element,options),options.country&&element.googleAutoComplete.setComponentRestrictions({country:options.country})):WPGMZA.CloudAPI&&WPGMZA.CloudAPI.isBeingUsed&&(element.cloudAutoComplete=new WPGMZA.CloudAutocomplete(element,options))},WPGMZA.extend(WPGMZA.AddressInput,WPGMZA.EventDispatcher),WPGMZA.AddressInput.createInstance=function(element,map){return new WPGMZA.AddressInput(element,map)}}),jQuery(function($){WPGMZA.DrawingManager=function(map){WPGMZA.assertInstanceOf(this,"DrawingManager"),WPGMZA.EventDispatcher.call(this),this.map=map,this.mode=WPGMZA.DrawingManager.MODE_NONE},WPGMZA.DrawingManager.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.DrawingManager.prototype.constructor=WPGMZA.DrawingManager,WPGMZA.DrawingManager.MODE_NONE=null,WPGMZA.DrawingManager.MODE_MARKER="marker",WPGMZA.DrawingManager.MODE_POLYGON="polygon",WPGMZA.DrawingManager.MODE_POLYLINE="polyline",WPGMZA.DrawingManager.MODE_CIRCLE="circle",WPGMZA.DrawingManager.MODE_RECTANGLE="rectangle",WPGMZA.DrawingManager.MODE_HEATMAP="heatmap",WPGMZA.DrawingManager.getConstructor=function(){switch(WPGMZA.settings.engine){case"google-maps":return WPGMZA.GoogleDrawingManager;default:return WPGMZA.OLDrawingManager}},WPGMZA.DrawingManager.createInstance=function(map){return new(WPGMZA.DrawingManager.getConstructor())(map)},WPGMZA.DrawingManager.prototype.setDrawingMode=function(mode){this.mode=mode,this.trigger("drawingmodechanged")}}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){WPGMZA.FancyControls={formatToggleSwitch:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-round-flat"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)},formatToggleButton:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-yes-no"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(label).attr("data-on",WPGMZA.localized_strings.yes),$(label).attr("data-off",WPGMZA.localized_strings.no),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)}},$(".wpgmza-fancy-toggle-switch").each(function(index,el){WPGMZA.FancyControls.formatToggleSwitch(el)}),$(".wpgmza-fancy-toggle-button").each(function(index,el){WPGMZA.FancyControls.formatToggleButton(el)})}),jQuery(function($){WPGMZA.Feature=function(options){for(var key in WPGMZA.assertInstanceOf(this,"Feature"),WPGMZA.EventDispatcher.call(this),this.id=-1,options)this[key]=options[key]},WPGMZA.extend(WPGMZA.Feature,WPGMZA.EventDispatcher),WPGMZA.MapObject=WPGMZA.Feature,WPGMZA.Feature.prototype.parseGeometry=function(subject){if("string"==typeof subject&&subject.match(/^\[/))try{subject=JSON.parse(subject)}catch(e){}if("object"==typeof subject){for(var arr=subject,i=0;i<arr.length;i++)arr[i].lat=parseFloat(arr[i].lat),arr[i].lng=parseFloat(arr[i].lng);return arr}if("string"!=typeof subject)throw new Error("Invalid geometry");var pairs,coords,results=[];pairs=subject.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.Feature.prototype.setOptions=function(options){for(var key in options)this[key]=options[key];this.updateNativeFeature()},WPGMZA.Feature.prototype.setEditable=function(editable){this.setOptions({editable:editable})},WPGMZA.Feature.prototype.setDraggable=function(draggable){this.setOptions({draggable:draggable})},WPGMZA.Feature.prototype.getScalarProperties=function(){var options={};for(var key in this)switch(typeof this[key]){case"number":options[key]=parseFloat(this[key]);break;case"boolean":case"string":options[key]=this[key]}return options},WPGMZA.Feature.prototype.updateNativeFeature=function(){var props=this.getScalarProperties();switch(WPGMZA.settings.engine){case"open-layers":this.layer&&this.layer.setStyle(WPGMZA.OLFeature.getOLStyle(props));break;default:this.googleFeature.setOptions(props)}}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Circle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Circle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeColor",{enumerable:!0,get:function(){return this.lineColor?this.lineColor:"#000000"},set:function(a){this.lineColor=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineOpacity||0==this.lineOpacity?parseFloat(this.lineOpacity):0},set:function(a){this.lineOpacity=a}}),WPGMZA.Circle.createInstance=function(options,engineCircle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options,engineCircle)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.FriendlyError=function(){}}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/),latLng=new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])});callback([latLng.latLng=latLng],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)){this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find(".wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={};var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)},"google-maps"!=WPGMZA.settings.engine||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT||this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key,["https://www.wpgmaps.com/documentation/creating-a-google-maps-api-key/"])}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if(message)if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))||(m=message.match(/^Geocoding Service: .+/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){var self=this;if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){urls[i];var button=buttonTemplate.clone(),text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),$(button).find("i").addClass("fa-external-link"),$(button).append(text)}buttonContainer.append(button)}$(this.errorMessageList).append(li),$("#wpgmza_map, .wpgmza_map").each(function(index,el){var container=$(el).find(".wpgmza-google-maps-api-error-overlay");0==container.length&&(container=$("<div class='wpgmza-google-maps-api-error-overlay'></div>")).html(self.element.html()),setTimeout(function(){$(el).append(container)},1e3)}),$(".gm-err-container").parent().css({"z-index":1}),this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(feature){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),this.on("infowindowopen",function(event){self.onOpen(event)}),feature&&(this.feature=feature,this.state=WPGMZA.InfoWindow.STATE_CLOSED,feature.map?setTimeout(function(){self.onFeatureAdded(event)},100):feature.addEventListener("added",function(event){self.onFeatureAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.STATE_OPEN="open",WPGMZA.InfoWindow.STATE_CLOSED="closed",WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(feature){return new(this.getConstructor())(feature)},Object.defineProperty(WPGMZA.InfoWindow.prototype,"content",{get:function(){return this.getContent()},set:function(value){this.contentHtml=value}}),WPGMZA.InfoWindow.prototype.addEditButton=function(){return"map-edit"==WPGMZA.currentPage?' <a title="Edit this marker" style="width:15px;" class="wpgmza_edit_btn" data-edit-marker-id="'+this.feature.id+'"><i class="fa fa-edit"></i></a>':""},WPGMZA.InfoWindow.prototype.workOutDistanceBetweenTwoMarkers=function(location1,location2){if(location1&&location2){var distanceToDisplay=WPGMZA.Distance.between(location1,location2);return this.distanceUnits==WPGMZA.Distance.MILES&&(distanceToDisplay/=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(distanceToDisplay,2)}},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="",extra_html="";if(this.feature instanceof WPGMZA.Marker){if(this.feature.map.storeLocator&&this.feature.map.storeLocator.state==WPGMZA.StoreLocator.STATE_APPLIED){var currentLatLng=this.feature.getPosition(),distance=this.workOutDistanceBetweenTwoMarkers(this.feature.map.storeLocator.center,currentLatLng);extra_html+="<p>"+(this.feature.map.settings.store_locator_distance==WPGMZA.Distance.KILOMETERS?distance+WPGMZA.localized_strings.kilometers_away:distance+WPGMZA.localized_strings.miles_away)+"</p>"}html=this.feature.address+extra_html}return this.contentHtml&&(html=this.contentHtml),callback&&callback(html),html},WPGMZA.InfoWindow.prototype.open=function(map,feature){return this.feature=feature,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&(!this.feature.disableInfoWindow&&(this.state=WPGMZA.InfoWindow.STATE_OPEN,!0))},WPGMZA.InfoWindow.prototype.close=function(){this.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(this.state=WPGMZA.InfoWindow.STATE_CLOSED,this.trigger("infowindowclose"))},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onFeatureAdded=function(){1==this.feature.settings.infoopen&&this.open()},WPGMZA.InfoWindow.prototype.onOpen=function(){}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,(this._lng=0)!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},WPGMZA.LatLng.isLatLngString=function(str){return"string"==typeof str&&!!str.match(WPGMZA.LatLng.REGEXP)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.fromString=function(string){if(!WPGMZA.LatLng.isLatLngString(string))throw new Error("Not a valid latlng string");var m=string.match(WPGMZA.LatLng.REGEXP);return new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])})},WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromCurrentPosition=function(callback,options){options=options||{},callback&&WPGMZA.getCurrentPosition(function(position){var latLng=new WPGMZA.LatLng({lat:position.coords.latitude,lng:position.coords.longitude});options.geocodeAddress?WPGMZA.Geocoder.createInstance().getAddressFromLatLng({latLng:latLng},function(results){results.length&&(latLng.address=results[0]),callback(latLng)}):callback(latLng)})},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.toGoogleLatLngArray=function(arr){var result=[];return arr.forEach(function(nativeLatLng){if(!(nativeLatLng instanceof WPGMZA.LatLng||"lat"in nativeLatLng&&"lng"in nativeLatLng))throw new Error("Unexpected input");result.push(new google.maps.LatLng({lat:parseFloat(nativeLatLng.lat),lng:parseFloat(nativeLatLng.lng)}))}),result},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.toLatLngLiteral=function(){return{lat:this.lat,lng:this.lng}},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI},WPGMZA.LatLng.prototype.getGreatCircleDistance=function(arg1,arg2){var other,lat1=this.lat,lon1=this.lng;if(1==arguments.length)other=new WPGMZA.LatLng(arg1);else{if(2!=arguments.length)throw new Error("Invalid number of arguments");other=new WPGMZA.LatLng(arg1,arg2)}var lat2=other.lat,lon2=other.lng,phi1=lat1.toRadians(),phi2=lat2.toRadians(),deltaPhi=(lat2-lat1).toRadians(),deltaLambda=(lon2-lon1).toRadians(),a=Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaLambda/2)*Math.sin(deltaLambda/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLngBounds){var other=southWest;this.south=other.south,this.north=other.north,this.west=other.west,this.east=other.east}else southWest&&northEast&&(this.south=southWest.lat,this.north=northEast.lat,this.west=southWest.lng,this.east=northEast.lng)},WPGMZA.LatLngBounds.fromGoogleLatLngBounds=function(googleLatLngBounds){if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))throw new Error("Argument must be an instance of google.maps.LatLngBounds");var result=new WPGMZA.LatLngBounds,southWest=googleLatLngBounds.getSouthWest(),northEast=googleLatLngBounds.getNorthEast();return result.north=northEast.lat(),result.south=southWest.lat(),result.west=southWest.lng(),result.east=northEast.lng(),result},WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral=function(obj){var result=new WPGMZA.LatLngBounds,southWest=obj.southwest,northEast=obj.northeast;return result.north=northEast.lat,result.south=southWest.lat,result.west=southWest.lng,result.east=northEast.lng,result},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return null==this.north&&null==this.south&&null==this.west&&null==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){if(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),this.isInInitialState())return this.north=this.south=latLng.lat,void(this.west=this.east=latLng.lng);latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng)},WPGMZA.LatLngBounds.prototype.extendByPixelMargin=function(map,x,arg){var y=x;if(!(map instanceof WPGMZA.Map))throw new Error("First argument must be an instance of WPGMZA.Map");if(this.isInInitialState())throw new Error("Cannot extend by pixels in initial state");3<=arguments.length&&(y=arg);var southWest=new WPGMZA.LatLng(this.south,this.west),northEast=new WPGMZA.LatLng(this.north,this.east);southWest=map.latLngToPixels(southWest),northEast=map.latLngToPixels(northEast),southWest.x-=x,southWest.y+=y,northEast.x+=x,northEast.y-=y,southWest=map.pixelsToLatLng(southWest.x,southWest.y),northEast=map.pixelsToLatLng(northEast.x,northEast.y);this.toString();this.north=northEast.lat,this.south=southWest.lat,this.west=southWest.lng,this.east=northEast.lng},WPGMZA.LatLngBounds.prototype.contains=function(latLng){if(!(latLng instanceof WPGMZA.LatLng))throw new Error("Argument must be an instance of WPGMZA.LatLng");return!(latLng.lat<Math.min(this.north,this.south))&&(!(latLng.lat>Math.max(this.north,this.south))&&(this.west<this.east?latLng.lng>=this.west&&latLng.lng<=this.east:latLng.lng<=this.west||latLng.lng>=this.east))},WPGMZA.LatLngBounds.prototype.toString=function(){return this.north+"N "+this.south+"S "+this.west+"W "+this.east+"E"},WPGMZA.LatLngBounds.prototype.toLiteral=function(){return{north:this.north,south:this.south,west:this.west,east:this.east}}}),jQuery(function($){var legacyGlobals={marker_pull:"0",marker_array:[],MYMAP:[],infoWindow_poly:[],markerClusterer:[],heatmap:[],WPGM_Path:[],WPGM_Path_Polygon:[],WPGM_PathLine:[],WPGM_PathLineData:[],WPGM_PathData:[],original_iw:null,wpgmza_user_marker:null,wpgmaps_localize_marker_data:[],wpgmaps_localize_polygon_settings:[],wpgmaps_localize_heatmap_settings:[],wpgmaps_localize_polyline_settings:[],wpgmza_cirtcle_data_array:[],wpgmza_rectangle_data_array:[],wpgmzaForceLegacyMarkerClusterer:!1};function bindLegacyGlobalProperty(key){key in window?console.warn("Cannot redefine legacy global "+key):Object.defineProperty(window,key,{get:function(){return console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]},set:function(value){console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]=value}})}for(var key in legacyGlobals)bindLegacyGlobalProperty(key);WPGMZA.legacyGlobals=legacyGlobals,window.InitMap=window.resetLocations=window.searchLocations=window.fillInAddress=window.searchLocationsNear=function(){console.warn("This function is deprecated and should no longer be used")}}),jQuery(function($){WPGMZA.MapListPage=function(){$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")})},WPGMZA.MapListPage.createInstance=function(){return new WPGMZA.MapListPage},$(document).ready(function(event){WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_LIST&&(WPGMZA.mapListPage=WPGMZA.MapListPage.createInstance())})}),jQuery(function($){WPGMZA.MapSettings=function(element){var json,self=this,str=element.getAttribute("data-settings");try{json=JSON.parse(str)}catch(e){str=(str=str.replace(/\\%/g,"%")).replace(/\\\\"/g,'\\"');try{json=JSON.parse(str)}catch(e){json={},console.warn("Failed to parse map settings JSON")}}function addSettings(input){if(input)for(var key in input)if("other_settings"!=key){var value=input[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),self[key]=value}}WPGMZA.assertInstanceOf(this,"MapSettings"),addSettings(WPGMZA.settings),addSettings(json),json&&json.other_settings&&addSettings(json.other_settings)},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){var self=this,options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),empty("map_start_lat")||empty("map_start_lng")||(options.center=ol.proj.fromLonLat([parseFloat(this.map_start_lng),parseFloat(this.map_start_lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),this.map_start_zoom&&(options.zoom=parseInt(this.map_start_zoom)),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179];function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom)),this.map_start_zoom&&(zoom=parseInt(this.map_start_zoom));var options={zoom:zoom,center:latLng};function isSettingDisabled(value){return"yes"===value||!!value}switch(empty("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),empty("map_start_lat")||empty("map_start_lng")||(options.center=new google.maps.LatLng({lat:parseFloat(this.map_start_lat),lng:parseFloat(this.map_start_lng)})),this.wpgmza_min_zoom&&this.wpgmza_max_zoom&&(options.minZoom=Math.min(this.wpgmza_min_zoom,this.wpgmza_max_zoom),options.maxZoom=Math.max(this.wpgmza_min_zoom,this.wpgmza_max_zoom)),options.zoomControl=!isSettingDisabled(this.wpgmza_settings_map_zoom),options.panControl=!isSettingDisabled(this.wpgmza_settings_map_pan),options.mapTypeControl=!isSettingDisabled(this.wpgmza_settings_map_type),options.streetViewControl=!isSettingDisabled(this.wpgmza_settings_map_streetview),options.fullscreenControl=!isSettingDisabled(this.wpgmza_settings_map_full_screen_control),options.draggable=!isSettingDisabled(this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom=isSettingDisabled(this.wpgmza_settings_map_clickzoom),this.wpgmza_settings_map_scroll&&(options.scrollwheel=!1),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures||1==this.wpgmza_force_greedy_gestures?(options.gestureHandling="greedy",!this.wpgmza_settings_map_scroll&&"scrollwheel"in options&&delete options.scrollwheel):options.gestureHandling="cooperative",parseInt(this.type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}return this.wpgmza_theme_data&&this.wpgmza_theme_data.length&&(options.styles=WPGMZA.GoogleMap.parseThemeData(this.wpgmza_theme_data)),options}}),jQuery(function($){WPGMZA.Map=function(element,options){var self=this;if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(element.hasAttribute("data-map-id")?this.id=element.getAttribute("data-map-id"):this.id=1,!/\d+/.test(this.id))throw new Error("Map ID must be an integer");if(WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,$(this.element).addClass("wpgmza-initialized"),this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.rectangles=[],this.loadSettings(options),this.shortcodeAttributes={},$(this.element).attr("data-shortcode-attributes"))try{this.shortcodeAttributes=JSON.parse($(this.element).attr("data-shortcode-attributes")),this.shortcodeAttributes.zoom&&(this.settings.map_start_zoom=parseInt(this.shortcodeAttributes.zoom))}catch(e){console.warn("Error parsing shortcode attributes")}WPGMZA.getCurrentPage()!=WPGMZA.PAGE_MAP_EDIT&&this.initStoreLocator(),this.setDimensions(),this.setAlignment(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this),WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code&&($(element).append($(WPGMZA.api_consent_html)),$(element).css({height:"auto"})),this.on("init",function(event){self.onInit(event)}),this.on("click",function(event){self.onClick(event)}),WPGMZA.useLegacyGlobals&&(wpgmzaLegacyGlobals.MYMAP[this.id]={map:null,bounds:null,mc:null},wpgmzaLegacyGlobals.MYMAP.init=wpgmzaLegacyGlobals.MYMAP[this.id].init=wpgmzaLegacyGlobals.MYMAP.placeMarkers=wpgmzaLegacyGlobals.MYMAP[this.id].placeMarkers=function(){console.warn("This function is deprecated and should no longer be used")})},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.nightTimeThemeData=[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#575663"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#80823e"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#1b737a"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}],WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},Object.defineProperty(WPGMZA.Map.prototype,"markersPlaced",{get:function(){return this._markersPlaced},set:function(value){throw new Error("Value is read only")}}),Object.defineProperty(WPGMZA.Map.prototype,"lat",{get:function(){return this.getCenter().lat},set:function(value){var center=this.getCenter();center.lat=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"lng",{get:function(){return this.getCenter().lng},set:function(value){var center=this.getCenter();center.lng=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"zoom",{get:function(){return this.getZoom()},set:function(value){this.setZoom(value)}}),WPGMZA.Map.prototype.onInit=function(event){this.initPreloader(),"autoFetchFeatures"in this.settings&&!1===this.settings.autoFetchFeatures||this.fetchFeatures()},WPGMZA.Map.prototype.initPreloader=function(){this.preloader=$(WPGMZA.preloaderHTML),$(this.preloader).hide(),$(this.element).append(this.preloader)},WPGMZA.Map.prototype.showPreloader=function(show){show?$(this.preloader).show():$(this.preloader).hide()},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element);settings.other_settings;if(delete settings.other_settings,options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.initStoreLocator=function(){var storeLocatorElement=$(".wpgmza_sl_main_div");storeLocatorElement.length&&(this.storeLocator=WPGMZA.StoreLocator.createInstance(this,storeLocatorElement[0]))},WPGMZA.Map.prototype.getFeatureArrays=function(){var arrays=WPGMZA.Map.prototype.getFeatureArrays.call(this);return arrays.heatmaps=this.heatmaps,arrays},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]},WPGMZA.Map.prototype.getRESTParameters=function(options){var defaults={};return options&&options.filter||(defaults.filter=JSON.stringify(this.markerFilter.getFilteringParameters())),$.extend(!0,defaults,options)},WPGMZA.Map.prototype.fetchFeaturesViaREST=function(){var data,self=this,filter=this.markerFilter.getFilteringParameters();if("1"==WPGMZA.is_admin&&(filter.includeUnapproved=!0,filter.excludeIntegrated=!0),this.shortcodeAttributes.acf_post_id&&(filter.acfPostID=this.shortcodeAttributes.acf_post_id),this.showPreloader(!0),this.fetchFeaturesXhr&&this.fetchFeaturesXhr.abort(),WPGMZA.settings.fetchMarkersBatchSize){var offset=0,limit=WPGMZA.settings.fetchMarkersBatchSize;!function fetchNextBatch(){filter.offset=offset,filter.limit=limit,data=this.getRESTParameters({filter:JSON.stringify(filter)}),self.fetchFeaturesXhr=WPGMZA.restAPI.call("/markers/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){result.length?(self.onMarkersFetched(result,!0),offset+=limit,fetchNextBatch()):(self.onMarkersFetched(result),data.exclude="markers",WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}}))}})}()}else data=this.getRESTParameters({filter:JSON.stringify(filter)}),this.fetchFeaturesXhr=WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}};Math.PI;function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){0==arguments.length&&(width=this.settings.map_width?this.settings.map_width:"100",this.settings.map_width_type?width+=this.settings.map_width_type.replace("\\",""):width+="%",height=this.settings.map_height?this.settings.map_height:"400",this.settings.map_height_type?height+=this.settings.map_height_type.replace("\\",""):height+="px"),$(this.engineElement).css({width:width,height:height})},WPGMZA.Map.prototype.setAlignment=function(){switch(parseInt(this.settings.wpgmza_map_align)){case 1:$(this.element).css({float:"left"});break;case 2:$(this.element).css({"margin-left":"auto","margin-right":"auto"});break;case 3:$(this.element).css({float:"right"})}},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,(marker.parent=this).markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.infoWindow&&marker.infoWindow.close(),marker.map=null,marker.parent=null;var index=this.markers.indexOf(marker);if(-1==index)throw new Error("Marker not found in marker array");this.markers.splice(index,1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.removeAllMarkers=function(options){for(var i=this.markers.length-1;0<=i;i--)this.removeMarker(this.markers[i])},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.getMarkerByTitle=function(title){if("string"==typeof title){for(var i=0;i<this.markers.length;i++)if(this.markers[i].title==title)return this.markers[i]}else{if(!(title instanceof RegExp))throw new Error("Invalid argument");for(i=0;i<this.markers.length;i++)if(title.test(this.markers[i].title))return this.markers[i]}return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");(polygon.map=this).polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.removePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.removePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.removePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");(polyline.map=this).polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.removePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.removePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.removePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");(circle.map=this).circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.removeCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.removeCircle(circle)},WPGMZA.Map.prototype.addRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");(rectangle.map=this).rectangles.push(rectangle),this.dispatchEvent({type:"rectangleadded",rectangle:rectangle})},WPGMZA.Map.prototype.removeRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");if(rectangle.map!==this)throw new Error("Wrong map error");rectangle.map=null,this.rectangles.splice(this.rectangles.indexOf(rectangle),1),this.dispatchEvent({type:"rectangleremoved",rectangle:rectangle})},WPGMZA.Map.prototype.getRectangleByID=function(id){for(var i=0;i<this.rectangles.length;i++)if(this.rectangles[i].id==id)return this.rectangles[i];return null},WPGMZA.Map.prototype.removeRectangleByID=function(id){var rectangle=this.getRectangleByID(id);rectangle&&this.removeRectangle(rectangle)},WPGMZA.Map.prototype.resetBounds=function(){var latlng=new WPGMZA.LatLng(this.settings.map_start_lat,this.settings.map_start_lng);this.panTo(latlng),this.setZoom(this.settings.map_start_zoom)},WPGMZA.Map.prototype.nudge=function(x,y){var nudged=this.nudgeLatLng(this.getCenter(),x,y);this.setCenter(nudged)},WPGMZA.Map.prototype.nudgeLatLng=function(latLng,x,y){var pixels=this.latLngToPixels(latLng);if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");return this.pixelsToLatLng(pixels)},WPGMZA.Map.prototype.animateNudge=function(x,y,origin,milliseconds){var nudged;if(origin){if(!(origin instanceof WPGMZA.LatLng))throw new Error("Origin must be an instance of WPGMZA.LatLng")}else origin=this.getCenter();nudged=this.nudgeLatLng(origin,x,y),milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$(this).animate({lat:nudged.lat,lng:nudged.lng},milliseconds)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){this.trigger("idle")},WPGMZA.Map.prototype.onClick=function(event){},WPGMZA.Map.prototype.hasVisibleMarkers=function(){for(var marker,length=this.markers.length,i=0;i<length;i++)if((marker=this.markers[i]).isFilterable&&marker.getVisible())return!0;return!1},WPGMZA.Map.prototype.closeAllInfoWindows=function(){this.markers.forEach(function(marker){marker.infoWindow&&marker.infoWindow.close()})},$(document).ready(function(event){if(!WPGMZA.visibilityWorkaroundIntervalID){var invisibleMaps=jQuery(".wpgmza_map:hidden");WPGMZA.visibilityWorkaroundIntervalID=setInterval(function(){jQuery(invisibleMaps).each(function(index,el){if(jQuery(el).is(":visible")){var id=jQuery(el).attr("data-map-id");WPGMZA.getMapByID(id).onElementResized(),invisibleMaps.splice(invisibleMaps.toArray().indexOf(el),1)}})},1e3)}})}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1),$("#wpgmza-confirm-engine").click()}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val(),nonce:$("#wpgmza-maps-engine-dialog").attr("data-ajax-nonce")},success:function(response,status,xhr){window.location.reload()}})},$(document).ready(function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.MarkerFilter=function(map){WPGMZA.EventDispatcher.call(this),this.map=map},WPGMZA.MarkerFilter.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MarkerFilter.prototype.constructor=WPGMZA.MarkerFilter,WPGMZA.MarkerFilter.createInstance=function(map){return new WPGMZA.MarkerFilter(map)},WPGMZA.MarkerFilter.prototype.getFilteringParameters=function(){var params={map_id:this.map.id};return this.map.storeLocator&&(params=$.extend(params,this.map.storeLocator.getFilteringParameters())),params},WPGMZA.MarkerFilter.prototype.update=function(params,source){var self=this;function dispatchEvent(result){var event=new WPGMZA.Event("filteringcomplete");event.map=self.map,event.source=source,event.filteredMarkers=result,event.filteringParams=params,self.onFilteringComplete(event),self.trigger(event),self.map.trigger(event)}this.updateTimeoutID||(params=params||{},this.xhr&&(this.xhr.abort(),delete this.xhr),this.updateTimeoutID=setTimeout(function(){if((params=$.extend(self.getFilteringParameters(),params)).center instanceof WPGMZA.LatLng&&(params.center=params.center.toLatLngLiteral()),params.hideAll)return dispatchEvent([]),void delete self.updateTimeoutID;self.map.showPreloader(!0),self.xhr=WPGMZA.restAPI.call("/markers",{data:{fields:["id"],filter:JSON.stringify(params)},success:function(result,status,xhr){self.map.showPreloader(!1),dispatchEvent(result)},useCompressedPathVariable:!0}),delete self.updateTimeoutID},0))},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(event){var map=[];event.filteredMarkers.forEach(function(data){map[data.id]=!0}),this.map.markers.forEach(function(marker){if(marker.isFilterable){var allowByFilter=!!map[marker.id];marker.isFiltered=!allowByFilter,marker.setVisible(allowByFilter)}})}}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;this._offset={x:0,y:0},WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,this.isFilterable=!0,this.disableInfoWindow=!1,WPGMZA.Feature.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}),this.handleLegacyGlobals(row))},WPGMZA.Marker.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",Object.defineProperty(WPGMZA.Marker.prototype,"offsetX",{get:function(){return this._offset.x},set:function(value){this._offset.x=value,this.updateOffset()}}),Object.defineProperty(WPGMZA.Marker.prototype,"offsetY",{get:function(){return this._offset.y},set:function(value){this._offset.y=value,this.updateOffset()}}),WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select"),"1"==this.infoopen&&this.openInfoWindow(!0)},WPGMZA.Marker.prototype.handleLegacyGlobals=function(row){var m;if(WPGMZA.settings.useLegacyGlobals&&this.map_id&&this.id&&!(WPGMZA.pro_version&&(m=WPGMZA.pro_version.match(/\d+/))&&m[0]<=7)){WPGMZA.legacyGlobals.marker_array[this.map_id]||(WPGMZA.legacyGlobals.marker_array[this.map_id]=[]),WPGMZA.legacyGlobals.marker_array[this.map_id][this.id]=this,WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]||(WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]=[]);var cloned=$.extend({marker_id:this.id},row);WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id][this.id]=cloned}},WPGMZA.Marker.prototype.initInfoWindow=function(){this.infoWindow||(this.infoWindow=WPGMZA.InfoWindow.createInstance())},WPGMZA.Marker.prototype.openInfoWindow=function(autoOpen){this.map?(autoOpen||(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),this.map.lastInteractedMarker=this),this.initInfoWindow(),this.infoWindow.open(this.map,this)):console.warn("Cannot open infowindow for marker with no map")},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){WPGMZA.settings.wpgmza_settings_map_open_marker_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){function stripProtocol(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}return WPGMZA.defaultMarkerIcon?stripProtocol(WPGMZA.defaultMarkerIcon):stripProtocol(WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return new WPGMZA.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.setOffset=function(x,y){this._offset.x=x,this._offset.y=y,this.updateOffset()},WPGMZA.Marker.prototype.updateOffset=function(){},WPGMZA.Marker.prototype.getAnimation=function(){return this.anim},WPGMZA.Marker.prototype.setAnimation=function(animation){},WPGMZA.Marker.prototype.getVisible=function(){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.getMap=function(){return this.map},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this),this.map=map},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(options){},WPGMZA.Marker.prototype.setOpacity=function(opacity){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=WPGMZA.getMapByID(map_id):this.map=WPGMZA.maps[0],this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#ff0000",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#ff0000")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),start=(rgba=WPGMZA.hexToRgba(settings.color),WPGMZA.rgbaToString(rgba));rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(var i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(0<settings.numRadiusLabels){var m,x,y;radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1]),context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var spokeAngle,width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;0<Math.sin(spokeAngle)&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this,map=WPGMZA.getMapByID(map_id);if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"'], .wpgmza_sl_search_button_"+map_id).closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var addressInput,inner=$(this.element).find(".wpgmza-inner");addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),map.settings.store_locator_query_string&&map.settings.store_locator_query_string.length&&addressInput.attr("placeholder",map.settings.store_locator_query_string),inner.append(addressInput);var button,titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=map.settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}(button=$(original).find("button.wpgmza-use-my-location"))&&inner.append(button),$(addressInput).on("keydown keypress",function(event){13==event.keyCode&&self.searchButton.is(":visible")&&self.searchButton.trigger("click")}),$(addressInput).on("input",function(event){self.searchButton.show(),self.resetButton.hide()}),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button, .wpgmza_sl_search_button_div"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_APPLIED)}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_INITIAL})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),items=($(container).children("ul"),$(container).find("li")),numCategories=0,icons=[];items.each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fa fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")}),$(this.element).on("mouseover","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseOverCategory(event)}),$(this.element).on("mouseleave","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseLeaveCategory(event)}),$("body").on("click",".wpgmza_store_locator_options_button",function(event){setTimeout(function(){if($(".wpgmza_cat_checkbox_holder").hasClass("wpgmza-open")){var p_cat=$(".wpgmza_cat_checkbox_holder"),position_cat=p_cat.position().top+p_cat.outerHeight(!0)+$(".wpgmza-modern-store-locator").height(),$p_map=$(".wpgmza_map");$p_map.position().top+$p_map.outerHeight(!0)<=position_cat&&($(".wpgmza_cat_ul").css("overflow","scroll "),$(".wpgmza_cat_ul").css("height","100%"),$(".wpgmza-modern-store-locator").css("height","100%"),$(".wpgmza_cat_checkbox_holder.wpgmza-open").css({"padding-bottom":"50px",height:"100%"}))}},500)})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLModernStoreLocator(map_id);default:return new WPGMZA.GoogleModernStoreLocator(map_id)}},WPGMZA.ModernStoreLocator.prototype.onMouseOverCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeIn()},WPGMZA.ModernStoreLocator.prototype.onMouseLeaveCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeOut()}}),jQuery(function($){WPGMZA.NativeMapsAppIcon=function(){navigator.userAgent.match(/^Apple|iPhone|iPad|iPod/)?(this.type="apple",this.element=$('<span><i class="fab fa fa-apple" aria-hidden="true"></i></span>')):(this.type="google",this.element=$('<span><i class="fab fa fa-google" aria-hidden="true"></i></span>'))}}),jQuery(function($){Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(begin,end){return new Uint8Array(Array.prototype.slice.call(this,begin,end))}}),WPGMZA.isSafari()&&!window.external&&(window.external={})}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,Object.defineProperty(WPGMZA.Polygon.prototype,"fillColor",{enumerable:!0,get:function(){return this.fillcolor&&this.fillcolor.length?"#"+this.fillcolor.replace(/^#/,""):"#ff0000"},set:function(a){this.fillcolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineopacity&&this.lineopacity.length?this.lineopacity:.6},set:function(a){this.lineopacity=a}}),WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)}}),jQuery(function($){WPGMZA.Polyline=function(options,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,Object.defineProperty(WPGMZA.Polyline.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeWeight",{enumerable:!0,get:function(){return this.linethickness&&this.linethickness.length?parseInt(this.linethickness):1},set:function(a){this.linethickness=a}}),WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(options,engineObject){return new(WPGMZA.Polyline.getConstructor())(options,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.PopoutPanel=function(element){this.element=element},WPGMZA.PopoutPanel.prototype.open=function(){$(this.element).addClass("wpgmza-open")},WPGMZA.PopoutPanel.prototype.close=function(){$(this.element).removeClass("wpgmza-open")}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Rectangle=function(options,engineRectangle){WPGMZA.assertInstanceOf(this,"Rectangle"),this.name="",this.cornerA=new WPGMZA.LatLng,this.cornerB=new WPGMZA.LatLng,this.color="#ff0000",this.opacity=.5,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Rectangle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeColor",{enumerable:!0,get:function(){return"#000000"}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return 0}}),WPGMZA.Rectangle.createInstance=function(options,engineRectangle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLRectangle;break;default:constructor=WPGMZA.GoogleRectangle}return new constructor(options,engineRectangle)}}),jQuery(function($){function sendAJAXFallbackRequest(route,params){if((params=$.extend({},params)).data||(params.data={}),"route"in params.data)throw new Error("Cannot send route through this method");if("action"in params.data)throw new Error("Cannot send action through this method");return params.data.route=route,params.data.action="wpgmza_rest_api_request",WPGMZA.restAPI.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_AJAX),$.ajax(WPGMZA.ajaxurl,params)}WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl,this.useAJAXFallback=!1},WPGMZA.RestAPI.CONTEXT_REST="REST",WPGMZA.RestAPI.CONTEXT_AJAX="AJAX",WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableSupported",{get:function(){return WPGMZA.serverCanInflate&&"Uint8Array"in window&&"TextEncoder"in window}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableAllowed",{get:function(){return!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?!WPGMZA.settings.disable_compressed_path_variables:WPGMZA.settings.enable_compressed_path_variables}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"maxURLLength",{get:function(){return 2083}}),WPGMZA.RestAPI.prototype.compressParams=function(params){var suffix="";if(params.markerIDs){var markerIDs=params.markerIDs.split(",");if(1<markerIDs.length){var encoded=(new WPGMZA.EliasFano).encode(markerIDs),compressed=pako.deflate(encoded),string=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");suffix="/"+btoa(string).replace(/\//g,"-").replace(/=+$/,""),params.midcbp=encoded.pointer,delete params.markerIDs}}string=JSON.stringify(params);var input=(new TextEncoder).encode(string),raw=(compressed=pako.deflate(input),Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join(""));return btoa(raw).replace(/\//g,"-").replace(/=+$/,"")+suffix},WPGMZA.RestAPI.prototype.getNonce=function(route){var matches=[];for(var pattern in WPGMZA.restnoncetable){var regex=new RegExp(pattern);route.match(regex)&&matches.push({pattern:pattern,nonce:WPGMZA.restnoncetable[pattern],length:pattern.length})}if(!matches.length)throw new Error("No nonce found for route");return matches.sort(function(a,b){return b.length-a.length}),matches[0].nonce},WPGMZA.RestAPI.prototype.addNonce=function(route,params,context){function setRESTNonce(xhr){context==WPGMZA.RestAPI.CONTEXT_REST&&self.shouldAddNonce(route)&&xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&¶ms.method&&!params.method.match(/^GET$/i)&&xhr.setRequestHeader("X-WPGMZA-Action-Nonce",self.getNonce(route))}var self=this;if(params.beforeSend){var base=params.beforeSend;params.beforeSend=function(xhr){base(xhr),setRESTNonce(xhr)}}else params.beforeSend=setRESTNonce},WPGMZA.RestAPI.prototype.shouldAddNonce=function(route){route=route.replace(/\//g,"");var isAdmin=!1;WPGMZA.is_admin&&1===parseInt(WPGMZA.is_admin)&&(isAdmin=!0);return!(route&&["markers","features","marker-listing","datatables"].includes(route)&&!isAdmin)},WPGMZA.RestAPI.prototype.call=function(route,params){if(this.useAJAXFallback)return sendAJAXFallbackRequest(route,params);var attemptedCompressedPathVariable=!1,fallbackRoute=route,fallbackParams=$.extend({},params);if("string"!=typeof route||!route.match(/^\//)&&!route.match(/^http/))throw new Error("Invalid route");if(WPGMZA.RestAPI.URL.match(/\/$/)&&(route=route.replace(/^\//,"")),params=params||{},this.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_REST),params.error||(params.error=function(xhr,status,message){if("abort"!=status){switch(xhr.status){case 401:case 403:case 405:return($.post(WPGMZA.ajaxurl,{action:"wpgmza_report_rest_api_blocked"},function(response){}),console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users."),"DELETE"===params.method)?(console.warn("The REST API rejected a DELETE request, attempting again with POST fallback"),params.method="POST",params.data||(params.data={}),params.data.simulateDelete="yes",WPGMZA.restAPI.call(route,params)):(this.useAJAXFallback=!0,sendAJAXFallbackRequest(fallbackRoute,fallbackParams));case 414:if(!attemptedCompressedPathVariable)break;return fallbackParams.method="POST",fallbackParams.useCompressedPathVariable=!1,WPGMZA.restAPI.call(fallbackRoute,fallbackParams)}throw new Error(message)}}),params.useCompressedPathVariable&&this.isCompressedPathVariableSupported&&this.isCompressedPathVariableAllowed){var compressedParams=$.extend({},params),data=params.data,base64=this.compressParams(data);WPGMZA.isServerIIS&&(base64=base64.replace(/\+/g,"%20"));var compressedRoute=route.replace(/\/$/,"")+"/base64"+base64;WPGMZA.RestAPI.URL;compressedParams.method="GET",delete compressedParams.data,!1===params.cache&&(compressedParams.data={skip_cache:1}),compressedRoute.length<this.maxURLLength?(attemptedCompressedPathVariable=!0,route=compressedRoute,params=compressedParams):(WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed||console.warn("Compressed path variable route would exceed URL length limit"),WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed=!0)}return WPGMZA.RestAPI.URL.match(/\?/)&&(route=route.replace(/\?/,"&")),$.ajax(WPGMZA.RestAPI.URL+route,params)};var nativeCallFunction=WPGMZA.RestAPI.call;WPGMZA.RestAPI.call=function(){console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?"),nativeCallFunction.apply(this,arguments)},$(document.body).on("click","#wpgmza-rest-api-blocked button.notice-dismiss",function(event){WPGMZA.restAPI.call("/rest-api/",{method:"POST",data:{dismiss_blocked_notice:!0}})})});var $_GET={};if(-1!==document.location.toString().indexOf("?"))for(var query=document.location.toString().replace(/^.*?\?/,"").replace(/#.*$/,"").split("&"),wpgmza_i=0,wpgmza_l=query.length;wpgmza_i<wpgmza_l;wpgmza_i++){var aux=decodeURIComponent(query[wpgmza_i]).split("=");$_GET[aux[0]]=aux[1]}jQuery(function($){WPGMZA.SettingsPage=function(){var self=this;this._keypressHistory=[],this.updateEngineSpecificControls(),this.updateStorageControls(),this.updateGDPRControls(),$(window).on("keypress",function(event){self.onKeyPress(event)}),jQuery("body").on("click",".wpgmza_destroy_data",function(e){e.preventDefault();var ttype=jQuery(this).attr("danger"),warning="Are you sure?";"wpgmza_destroy_all_data"==ttype&&(warning="Are you sure? This will delete ALL data and settings for WP Google Maps!"),window.confirm(warning)&&jQuery.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_settings_danger_zone_delete_data",type:ttype,nonce:wpgmza_dz_nonce},success:function(response,status,xhr){"wpgmza_destroy_all_data"==ttype?window.location.replace("admin.php?page=wp-google-maps-menu&action=welcome_page"):"wpgmza_reset_all_settings"==ttype?window.location.reload():alert("Complete.")}})}),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$('[name="wpgmza_settings_marker_pull"]').on("click",function(event){self.updateStorageControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()}),$('select[name="tile_server_url"]').on("change",function(event){"custom_override"===$('select[name="tile_server_url"]').val()?$(".wpgmza_tile_server_override_component").removeClass("wpgmza-hidden"):$(".wpgmza_tile_server_override_component").addClass("wpgmza-hidden")}),$('select[name="tile_server_url"]').trigger("change"),jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.settingsPage.flushGeocodeCache()}),$("#wpgmza-global-settings").tabs({create:function(event,ui){if(void 0!==$_GET.highlight){var elmnt=document.getElementById($_GET.highlight);elmnt.classList.add("highlight-item"),setTimeout(function(){elmnt.classList.add("highlight-item-step-2")},1e3);var y=elmnt.getBoundingClientRect().top+window.pageYOffset+-100;window.scrollTo({top:y,behavior:"smooth"})}}}),$("#wpgmza-global-setting").bind("create",function(event,ui){alert("now")}),$("#wpgmza-global-settings fieldset").each(function(index,el){$(el).children(":not(legend)").wrapAll("<span class='settings-group'></span>")})},WPGMZA.SettingsPage.createInstance=function(){return new WPGMZA.SettingsPage},WPGMZA.SettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.SettingsPage.prototype.updateStorageControls=function(){$("input[name='wpgmza_settings_marker_pull'][value='1']").is(":checked")?$("#xml-cache-settings").show():$("#xml-cache-settings").hide()},WPGMZA.SettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},WPGMZA.SettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},WPGMZA.SettingsPage.prototype.onKeyPress=function(event){this._keypressHistory.push(event.key),9<this._keypressHistory.length&&(this._keypressHistory=this._keypressHistory.slice(this._keypressHistory.length-9)),"codecabin"!=this._keypressHistory.join("")||this._developerModeRevealed||($("fieldset#wpgmza-developer-mode").show(),this._developerModeRevealed=!0)},$(document).ready(function(event){WPGMZA.getCurrentPage()&&(WPGMZA.settingsPage=WPGMZA.SettingsPage.createInstance())})}),jQuery(function($){WPGMZA.StoreLocator=function(map,element){var self=this;WPGMZA.EventDispatcher.call(this),this._center=null,this.map=map,this.element=element,this.state=WPGMZA.StoreLocator.STATE_INITIAL,this.distanceUnits=this.map.settings.store_locator_distance,this.addressInput=WPGMZA.AddressInput.createInstance(this.addressElement,this.map),$(element).find(".wpgmza-not-found-msg").hide(),this.radiusElement&&this.map.settings.wpgmza_store_locator_default_radius&&0<this.radiusElement.find("option[value='"+this.map.settings.wpgmza_store_locator_default_radius+"']").length&&this.radiusElement.val(this.map.settings.wpgmza_store_locator_default_radius),this.map.on("storelocatorgeocodecomplete",function(event){self.onGeocodeComplete(event)}),this.map.on("init",function(event){self.map.markerFilter.on("filteringcomplete",function(event){self.onFilteringComplete(event)}),void 0!==self.map.settings.store_locator_style&&"modern"!=self.map.settings.store_locator_style&&"modern"!==WPGMZA.settings.user_interface_style||(self.legacyModernAdapter=WPGMZA.ModernStoreLocator.createInstance(map.id))}),$(document.body).on("click",".wpgmza_sl_search_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_search_button",function(event){self.onSearch(event)}),$(document.body).on("click",".wpgmza_sl_reset_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_reset_button_div",function(event){self.onReset(event)}),$(this.addressElement).on("keypress",function(event){13==event.which&&self.onSearch(event)})},WPGMZA.StoreLocator.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.StoreLocator.prototype.constructor=WPGMZA.StoreLocator,WPGMZA.StoreLocator.STATE_INITIAL="initial",WPGMZA.StoreLocator.STATE_APPLIED="applied",WPGMZA.StoreLocator.createInstance=function(map,element){return new WPGMZA.StoreLocator(map,element)},Object.defineProperty(WPGMZA.StoreLocator.prototype,"address",{get:function(){return $(this.addressElement).val()}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"addressElement",{get:function(){return this.legacyModernAdapter?$(this.legacyModernAdapter.element).find("input.wpgmza-address")[0]:$(this.element).find("input.wpgmza-address")[0]}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"countryRestriction",{get:function(){return this.map.settings.wpgmza_store_locator_restrict}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radiusElement",{get:function(){return $("#radiusSelect, #radiusSelect_"+this.map.id)}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return parseFloat(this.radiusElement.val())}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"center",{get:function(){return this._center}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"bounds",{get:function(){return this._bounds}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"marker",{get:function(){if(1!=this.map.settings.store_locator_bounce)return null;if(this._marker)return this._marker;return this._marker=WPGMZA.Marker.createInstance({visible:!1}),this._marker.disableInfoWindow=!0,this._marker.isFilterable=!1,this._marker.setAnimation(WPGMZA.Marker.ANIMATION_BOUNCE),this._marker}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"circle",{get:function(){return this._circle||("modern"!=this.map.settings.wpgmza_store_locator_radius_style||WPGMZA.isDeviceiOS()?this._circle=WPGMZA.Circle.createInstance({strokeColor:"#ff0000",strokeOpacity:"0.25",strokeWeight:2,fillColor:"#ff0000",fillOpacity:"0.15",visible:!1,clickable:!1,center:new WPGMZA.LatLng}):(this._circle=WPGMZA.ModernStoreLocatorCircle.createInstance(this.map.id),this._circle.settings.color=this.circleStrokeColor)),this._circle}}),WPGMZA.StoreLocator.prototype.onGeocodeComplete=function(event){if(!event.results||!event.results.length)return this._center=null,void(this._bounds=null);this._center=new WPGMZA.LatLng(event.results[0].latLng),this._bounds=new WPGMZA.LatLngBounds(event.results[0].bounds),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.onSearch=function(event){var self=this;if(this.state=WPGMZA.StoreLocator.STATE_APPLIED,!this.address||!this.address.length)return this.addressElement.focus(),!1;function callback(results,status){self.map.trigger({type:"storelocatorgeocodecomplete",results:results,status:status})}if(void 0!==this.map.settings.store_locator_style&&"modern"!==this.map.settings.store_locator_style&&"modern"!==WPGMZA.settings.user_interface_style&&"default"===WPGMZA.settings.user_interface_style&&WPGMZA.animateScroll(this.map.element),WPGMZA.LatLng.isLatLngString(this.address))callback([WPGMZA.LatLng.fromString(this.address)],WPGMZA.Geocoder.SUCCESS);else{var geocoder=WPGMZA.Geocoder.createInstance(),options={address:this.address};this.countryRestriction&&(options.country=this.countryRestriction),geocoder.geocode(options,function(results,status){status==WPGMZA.Geocoder.SUCCESS?callback(results,status):alert(WPGMZA.localized_strings.address_not_found)})}return!0},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this._bounds=null,this.map.setZoom(this.map.settings.map_start_zoom),this.circle&&this.circle.setVisible(!1),this.marker&&this.marker.map&&this.map.removeMarker(this.marker),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.getZoomFromRadius=function(radius){return this.distanceUnits==WPGMZA.Distance.MILES&&(radius*=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(14-Math.log(radius)/Math.LN2)},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){var params=event.filteringParams,marker=this.marker;marker&&marker.setVisible(!1),params.center&&(this.map.setCenter(params.center),marker&&(marker.setPosition(params.center),marker.setVisible(!0),marker.map!=this.map&&this.map.addMarker(marker))),params.radius&&this.map.setZoom(this.getZoomFromRadius(params.radius));var circle=this.circle;if(circle){circle.setVisible(!1);var factor=this.distanceUnits==WPGMZA.Distance.MILES?WPGMZA.Distance.KILOMETERS_PER_MILE:1;params.center&¶ms.radius&&(circle.setRadius(params.radius*factor),circle.setCenter(params.center),circle.setVisible(!0),circle instanceof WPGMZA.ModernStoreLocatorCircle||circle.map==this.map||this.map.addCircle(circle)),circle instanceof WPGMZA.ModernStoreLocatorCircle&&(circle.settings.radiusString=this.radius)}0==event.filteredMarkers.length&&alert(this.map.settings.store_locator_not_found_message?this.map.settings.store_locator_not_found_message:WPGMZA.localized_strings.zero_results)}}),jQuery(function($){WPGMZA.Text=function(options){if(options)for(var name in options)this[name]=options[name]},WPGMZA.Text.createInstance=function(options){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLText(options);default:return new WPGMZA.GoogleText(options)}}}),jQuery(function($){WPGMZA.ThemeEditor=function(){WPGMZA.EventDispatcher.call(this),this.element=$("#wpgmza-theme-editor"),"open-layers"!=WPGMZA.settings.engine?this.element.length?(this.json=[{}],this.mapElement=WPGMZA.maps[0].element,this.element.appendTo("#wpgmza-map-theme-editor__holder"),$(window).on("scroll",function(event){}),setInterval(function(){},200),this.initHTML(),WPGMZA.themeEditor=this):console.warn("No element to initialise theme editor on"):this.element.remove()},WPGMZA.extend(WPGMZA.ThemeEditor,WPGMZA.EventDispatcher),WPGMZA.ThemeEditor.prototype.updatePosition=function(){},WPGMZA.ThemeEditor.features={all:[],administrative:["country","land_parcel","locality","neighborhood","province"],landscape:["man_made","natural","natural.landcover","natural.terrain"],poi:["attraction","business","government","medical","park","place_of_worship","school","sports_complex"],road:["arterial","highway","highway.controlled_access","local"],transit:["line","station","station.airport","station.bus","station.rail"],water:[]},WPGMZA.ThemeEditor.elements={all:[],geometry:["fill","stroke"],labels:["icon","text","text.fill","text.stroke"]},WPGMZA.ThemeEditor.prototype.parse=function(){$("#wpgmza_theme_editor_feature option, #wpgmza_theme_editor_element option").css("font-weight","normal"),$("#wpgmza_theme_editor_error").hide(),$("#wpgmza_theme_editor").show(),$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val("");var textarea=$('textarea[name="wpgmza_theme_data"]');if(!textarea.val()||textarea.val().length<1)this.json=[{}];else{try{this.json=$.parseJSON($('textarea[name="wpgmza_theme_data"]').val())}catch(e){return this.json=[{}],$("#wpgmza_theme_editor").hide(),void $("#wpgmza_theme_editor_error").show()}if(!$.isArray(this.json)){var jsonCopy=this.json;this.json=[],this.json.push(jsonCopy)}this.highlightFeatures(),this.highlightElements(),this.loadElementStylers()}},WPGMZA.ThemeEditor.prototype.highlightFeatures=function(){$("#wpgmza_theme_editor_feature option").css("font-weight","normal"),$.each(this.json,function(i,v){v.hasOwnProperty("featureType")?$('#wpgmza_theme_editor_feature option[value="'+v.featureType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_feature option[value="all"]').css("font-weight","bold")})},WPGMZA.ThemeEditor.prototype.highlightElements=function(){var feature=$("#wpgmza_theme_editor_feature").val();$("#wpgmza_theme_editor_element option").css("font-weight","normal"),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")?$('#wpgmza_theme_editor_element option[value="'+v.elementType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_element option[value="all"]').css("font-weight","bold"))})},WPGMZA.ThemeEditor.prototype.loadElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val();$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val(""),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&v.hasOwnProperty("stylers")&&$.isArray(v.stylers)&&0<v.stylers.length&&$.each(v.stylers,function(ii,vv){vv.hasOwnProperty("hue")&&($("#wpgmza_theme_editor_do_hue").prop("checked",!0),$("#wpgmza_theme_editor_hue").val(vv.hue)),vv.hasOwnProperty("lightness")&&$("#wpgmza_theme_editor_lightness").val(vv.lightness),vv.hasOwnProperty("saturation")&&$("#wpgmza_theme_editor_saturation").val(vv.xaturation),vv.hasOwnProperty("gamma")&&$("#wpgmza_theme_editor_gamma").val(vv.gamma),vv.hasOwnProperty("invert_lightness")&&$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!0),vv.hasOwnProperty("visibility")&&$("#wpgmza_theme_editor_visibility").val(vv.visibility),vv.hasOwnProperty("color")&&($("#wpgmza_theme_editor_do_color").prop("checked",!0),$("#wpgmza_theme_editor_color").val(vv.color)),vv.hasOwnProperty("weight")&&$("#wpgmza_theme_editor_weight").val(vv.weight)})})},WPGMZA.ThemeEditor.prototype.writeElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val(),indexJSON=null,stylers=[];if("inherit"!=$("#wpgmza_theme_editor_visibility").val()&&stylers.push({visibility:$("#wpgmza_theme_editor_visibility").val()}),!0===$("#wpgmza_theme_editor_do_color").prop("checked")&&stylers.push({color:$("#wpgmza_theme_editor_color").val()}),!0===$("#wpgmza_theme_editor_do_hue").prop("checked")&&stylers.push({hue:$("#wpgmza_theme_editor_hue").val()}),0<$("#wpgmza_theme_editor_gamma").val().length&&stylers.push({gamma:parseFloat($("#wpgmza_theme_editor_gamma").val())}),0<$("#wpgmza_theme_editor_weight").val().length&&stylers.push({weight:parseFloat($("#wpgmza_theme_editor_weight").val())}),0<$("#wpgmza_theme_editor_saturation").val().length&&stylers.push({saturation:parseFloat($("#wpgmza_theme_editor_saturation").val())}),0<$("#wpgmza_theme_editor_lightness").val().length&&stylers.push({lightness:parseFloat($("#wpgmza_theme_editor_lightness").val())}),!0===$("#wpgmza_theme_editor_do_invert_lightness").prop("checked")&&stylers.push({invert_lightness:!0}),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&(indexJSON=i)}),null===indexJSON){if(0<stylers.length){var new_feature_element_stylers={};"all"!=feature&&(new_feature_element_stylers.featureType=feature),"all"!=element&&(new_feature_element_stylers.elementType=element),new_feature_element_stylers.stylers=stylers,this.json.push(new_feature_element_stylers)}}else 0<stylers.length?this.json[indexJSON].stylers=stylers:this.json.splice(indexJSON,1);$('textarea[name="wpgmza_theme_data"]').val(JSON.stringify(this.json).replace(/:/g,": ").replace(/,/g,", ")),this.highlightFeatures(),this.highlightElements(),WPGMZA.themePanel.updateMapTheme()},WPGMZA.ThemeEditor.prototype.initHTML=function(){var self=this;$.each(WPGMZA.ThemeEditor.features,function(i,v){$("#wpgmza_theme_editor_feature").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_feature").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),$.each(WPGMZA.ThemeEditor.elements,function(i,v){$("#wpgmza_theme_editor_element").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_element").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),this.parse(),$('textarea[name="wpgmza_theme_data"]').on("input selectionchange propertychange",function(){self.parse()}),$(".wpgmza_theme_selection").click(function(){setTimeout(function(){$('textarea[name="wpgmza_theme_data"]').trigger("input")},1e3)}),$("#wpgmza-theme-editor__toggle").click(function(){$("#wpgmza-theme-editor").removeClass("active")}),$("#wpgmza_theme_editor_feature").on("change",function(){self.highlightElements(),self.loadElementStylers()}),$("#wpgmza_theme_editor_element").on("change",function(){self.loadElementStylers()}),$("#wpgmza_theme_editor_do_hue, #wpgmza_theme_editor_hue, #wpgmza_theme_editor_lightness, #wpgmza_theme_editor_saturation, #wpgmza_theme_editor_gamma, #wpgmza_theme_editor_do_invert_lightness, #wpgmza_theme_editor_visibility, #wpgmza_theme_editor_do_color, #wpgmza_theme_editor_color, #wpgmza_theme_editor_weight").on("input selectionchange propertychange",function(){self.writeElementStylers()}),"open-layers"==WPGMZA.settings.engine&&$("#wpgmza_theme_editor :input").prop("disabled",!0)}}),jQuery(function($){WPGMZA.ThemePanel=function(){var self=this;this.element=$("#wpgmza-theme-panel"),this.map=WPGMZA.maps[0],"open-layers"!=WPGMZA.settings.engine?this.element.length?($("#wpgmza-theme-presets").owlCarousel({items:6,dots:!0}),this.element.on("click","#wpgmza-theme-presets label",function(event){self.onThemePresetClick(event)}),$("#wpgmza-open-theme-editor").on("click",function(event){$("#wpgmza-map-theme-editor__holder").addClass("active"),$("#wpgmza-theme-editor").addClass("active"),WPGMZA.animateScroll($("#wpgmza-theme-editor"))}),WPGMZA.themePanel=this):console.warn("No element to initialise theme panel on"):this.element.remove()},WPGMZA.ThemePanel.previewImageCenter={lat:33.701806462148646,lng:-118.15949896058983},WPGMZA.ThemePanel.previewImageZoom=11,WPGMZA.ThemePanel.prototype.onThemePresetClick=function(event){var selectedData=$(event.currentTarget).find("[data-theme-json]").attr("data-theme-json"),textarea=$(this.element).find("textarea[name='wpgmza_theme_data']"),existingData=textarea.val(),allPresetData=[];$(this.element).find("[data-theme-json]").each(function(index,el){allPresetData.push($(el).attr("data-theme-json"))}),existingData.length&&-1==allPresetData.indexOf(existingData)&&!confirm(WPGMZA.localized_strings.overwrite_theme_data)||(textarea.val(selectedData),this.updateMapTheme(),WPGMZA.themeEditor.parse())},WPGMZA.ThemePanel.prototype.updateMapTheme=function(){var data;try{data=JSON.parse($("textarea[name='wpgmza_theme_data']").val())}catch(e){return void alert(WPGMZA.localized_strings.invalid_theme_data)}this.map.setOptions({styles:data})}}),jQuery(function($){WPGMZA.Version=function(){},WPGMZA.Version.GREATER_THAN=1,WPGMZA.Version.EQUAL_TO=0,WPGMZA.Version.LESS_THAN=-1,WPGMZA.Version.compare=function(v1,v2){for(var v1parts=v1.match(/\d+/g),v2parts=v2.match(/\d+/g),i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.XMLCacheConverter=function(){},WPGMZA.XMLCacheConverter.prototype.convert=function(xml){var markers=[],remap={marker_id:"id",linkd:"link"};return $(xml).find("marker").each(function(index,el){var data={};$(el).children().each(function(j,child){var key=child.nodeName;remap[key]&&(key=remap[key]),child.hasAttribute("data-json")?data[key]=JSON.parse($(child).text()):data[key]=$(child).text()}),markers.push(data)}),markers}}),jQuery(function($){WPGMZA.loadXMLAsWebWorker=function(){function tXml(a,d){function c(){for(var l=[];a[b];){if(60==a.charCodeAt(b)){if(47===a.charCodeAt(b+1)){b=a.indexOf(">",b);break}if(33===a.charCodeAt(b+1)){if(45==a.charCodeAt(b+2)){for(;62!==a.charCodeAt(b)||45!=a.charCodeAt(b-1)||45!=a.charCodeAt(b-2)||-1==b;)b=a.indexOf(">",b+1);-1===b&&(b=a.length)}else for(b+=2;62!==a.charCodeAt(b);)b++;b++;continue}var c=f();l.push(c)}else c=b,-2===(b=a.indexOf("<",b)-1)&&(b=a.length),0<(c=a.slice(c,b+1)).trim().length&&l.push(c);b++}return l}function l(){for(var c=b;-1===g.indexOf(a[b]);)b++;return a.slice(c,b)}function f(){var d={};b++,d.tagName=l();for(var f=!1;62!==a.charCodeAt(b);){if(64<(e=a.charCodeAt(b))&&e<91||96<e&&e<123){for(var g=l(),e=a.charCodeAt(b);39!==e&&34!==e&&!(64<e&&e<91||96<e&&e<123)&&62!==e;)b++,e=a.charCodeAt(b);if(f||(d.attributes={},f=!0),39===e||34===e){e=a[b];var h=++b;b=a.indexOf(e,h),e=a.slice(h,b)}else e=null,b--;d.attributes[g]=e}b++}return 47!==a.charCodeAt(b-1)&&("script"==d.tagName?(f=b+1,b=a.indexOf("<\/script>",b),d.children=[a.slice(f,b-1)],b+=8):"style"==d.tagName?(f=b+1,b=a.indexOf("</style>",b),d.children=[a.slice(f,b-1)],b+=7):-1==k.indexOf(d.tagName)&&(b++,d.children=c())),d}var g="\n\t>/= ",k=["img","br","input","meta","link"],h=null;if((d=d||{}).searchId){var b=new RegExp("s*ids*=s*['\"]"+d.searchId+"['\"]").exec(a).index;return-1!==b&&(-1!==(b=a.lastIndexOf("<",b))&&(h=f())),b}return b=0,h=c(),d.filter&&(h=tXml.filter(h,d.filter)),d.simplify&&(h=tXml.simplefy(h)),h}tXml.simplify=function(a){var d={};if(1===a.length&&"string"==typeof a[0])return a[0];for(var c in a.forEach(function(a){if(d[a.tagName]||(d[a.tagName]=[]),"object"==typeof a){var c=tXml.simplefy(a.children);d[a.tagName].push(c),a.attributes&&(c._attributes=a.attributes)}else d[a.tagName].push(a)}),d)1==d[c].length&&(d[c]=d[c][0]);return d},tXml.filter=function(a,d){var c=[];return a.forEach(function(a){"object"==typeof a&&d(a)&&c.push(a),a.children&&(a=tXml.filter(a.children,d),c=c.concat(a))}),c},tXml.domToXml=function(a){var c="";return function d(a){if(a)for(var f=0;f<a.length;f++)if("string"==typeof a[f])c+=a[f].trim();else{var g=a[f];c+="<"+g.tagName;var k=void 0;for(k in g.attributes)c=-1===g.attributes[k].indexOf('"')?c+(" "+k+'="'+g.attributes[k].trim())+'"':c+(" "+k+"='"+g.attributes[k].trim())+"'";c+=">",d(g.children),c+="</"+g.tagName+">"}}(O),c},"object"!=typeof window&&(module.exports=tXml);var inputData,totalFiles,worker=self,dataForMainThread=[],filesLoaded=0;function onXMLLoaded(request){if(4==request.readyState&&200==request.status){(new Date).getTime();!function(xml){for(var markers=xml[0].children[0],remap={marker_id:"id",linkd:"link"},i=0;i<markers.children.length;i++){var data={};markers.children[i].children.forEach(function(node){var key=node.tagName;remap[key]&&(key=remap[key]),node.attributes["data-json"]?data[key]=JSON.parse(node.children[0]):node.children.length?data[key]=node.children[0]:data[key]=""}),dataForMainThread.push(data)}}(tXml(request.responseText)),++filesLoaded>=totalFiles?worker.postMessage(dataForMainThread):loadNextFile()}}function loadNextFile(){var url=inputData.urls[filesLoaded],request=new XMLHttpRequest;request.onreadystatechange=function(){onXMLLoaded(this)},request.open("GET",inputData.protocol+url,!0),request.send()}self.addEventListener("message",function(event){var data=event.data;switch(data.command){case"load":dataForMainThread=[],filesLoaded=0,totalFiles=(inputData=data).urls.length,loadNextFile();break;default:throw new Error("Unknown command")}},!1)}}),jQuery(function($){$(document).ready(function(event){var parent=document.body.onclick;parent&&(document.body.onclick=function(event){event.target instanceof WPGMZA.Marker||parent(event)})})}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&-1<navigator.vendor.indexOf("Apple")&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.DataTable=function(element){var self=this;if(!$.fn.dataTable)return console.warn("The dataTables library is not loaded. Cannot create a dataTable. Did you enable 'Do not enqueue dataTables'?"),void(WPGMZA.settings.wpgmza_do_not_enqueue_datatables&&WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT&&alert("You have selected 'Do not enqueue DataTables' in WP Google Maps' settings. No 3rd party software is loading the DataTables library. Because of this, the marker table cannot load. Please uncheck this option to use the marker table."));if($.fn.dataTable.ext)$.fn.dataTable.ext.errMode="throw";else{var version=$.fn.dataTable.version?$.fn.dataTable.version:"unknown";console.warn("You appear to be running an outdated or modified version of the dataTables library. This may cause issues with table functionality. This is usually caused by 3rd party software loading an older version of DataTables. The loaded version is "+version+", we recommend version 1.10.12 or above.")}$.fn.dataTable.Api&&$.fn.dataTable.Api.register("processing()",function(show){return this.iterator("table",function(ctx){ctx.oApi._fnProcessingDisplay(ctx,show)})}),this.element=element,(this.element.wpgmzaDataTable=this).dataTableElement=this.getDataTableElement();var settings=this.getDataTableSettings();this.phpClass=$(element).attr("data-wpgmza-php-class"),(this.wpgmzaDataTable=this).useCompressedPathVariable=WPGMZA.restAPI.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables,this.method=this.useCompressedPathVariable?"GET":"POST",null==this.getLanguageURL()||"//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json"==this.getLanguageURL()?(this.dataTable=$(this.dataTableElement).DataTable(settings),this.dataTable.ajax.reload()):$.ajax(this.getLanguageURL(),{success:function(response,status,xhr){self.languageJSON=response,self.dataTable=$(self.dataTableElement).DataTable(settings),self.dataTable.ajax.reload()}})},WPGMZA.DataTable.prototype.getDataTableElement=function(){return $(this.element).find("table")},WPGMZA.DataTable.prototype.onAJAXRequest=function(data,settings){var params={phpClass:this.phpClass},attr=$(this.element).attr("data-wpgmza-ajax-parameters");return attr&&$.extend(params,JSON.parse(attr)),$.extend(data,params)},WPGMZA.DataTable.prototype.onDataTableAjaxRequest=function(data,callback,settings){var self=this,element=this.element,route=$(element).attr("data-wpgmza-rest-api-route"),params=this.onAJAXRequest(data,settings),draw=params.draw;if(delete params.draw,!route)throw new Error("No data-wpgmza-rest-api-route attribute specified");var options={method:"POST",useCompressedPathVariable:!0,data:params,dataType:"json",cache:!this.preventCaching,beforeSend:function(xhr){xhr.setRequestHeader("X-DataTables-Draw",draw)},success:function(response,status,xhr){response.draw=draw,self.lastResponse=response,callback(response),$("[data-marker-icon-src]").each(function(index,element){WPGMZA.MarkerIcon.createInstance($(element).attr("data-marker-icon-src")).applyToElement(element)})}};return WPGMZA.restAPI.call(route,options)},WPGMZA.DataTable.prototype.getDataTableSettings=function(){var self=this,element=this.element,options={};$(element).attr("data-wpgmza-datatable-options")&&(options=JSON.parse($(element).attr("data-wpgmza-datatable-options"))),options.deferLoading=!0,options.processing=!0,options.serverSide=!0,options.ajax=function(data,callback,settings){return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self,arguments)},WPGMZA.AdvancedTableDataTable&&this instanceof WPGMZA.AdvancedTableDataTable&&WPGMZA.settings.wpgmza_default_items&&(options.iDisplayLength=parseInt(WPGMZA.settings.wpgmza_default_items)),options.aLengthMenu=[[5,10,25,50,100,-1],["5","10","25","50","100",WPGMZA.localized_strings.all]];var languageURL=this.getLanguageURL();return languageURL&&(options.language={url:languageURL}),options},WPGMZA.DataTable.prototype.getLanguageURL=function(){if(!WPGMZA.locale)return null;var languageURL;switch(WPGMZA.locale.substr(0,2)){case"af":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Afrikaans.json";break;case"sq":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Albanian.json";break;case"am":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Amharic.json";break;case"ar":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Arabic.json";break;case"hy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Armenian.json";break;case"az":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Azerbaijan.json";break;case"bn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bangla.json";break;case"eu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Basque.json";break;case"be":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Belarusian.json";break;case"bg":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bulgarian.json";break;case"ca":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Catalan.json";break;case"zh":languageURL="zh_TW"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Chinese-traditional.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";break;case"hr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Croatian.json";break;case"cs":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Czech.json";break;case"da":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Danish.json";break;case"nl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Dutch.json";break;case"et":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Estonian.json";break;case"fi":languageURL=WPGMZA.locale.match(/^fil/)?WPGMZA.pluginDirURL+"languages/datatables/Filipino.json":WPGMZA.pluginDirURL+"languages/datatables/Finnish.json";break;case"fr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/French.json";break;case"gl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Galician.json";break;case"ka":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Georgian.json";break;case"de":languageURL=WPGMZA.pluginDirURL+"languages/datatables/German.json";break;case"el":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Greek.json";break;case"gu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Gujarati.json";break;case"he":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hebrew.json";break;case"hi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hindi.json";break;case"hu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hungarian.json";break;case"is":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Icelandic.json";break;case"id":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Indonesian.json";break;case"ga":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Irish.json";break;case"it":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Italian.json";break;case"ja":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Japanese.json";break;case"kk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kazakh.json";break;case"ko":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Korean.json";break;case"ky":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kyrgyz.json";break;case"lv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Latvian.json";break;case"lt":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Lithuanian.json";break;case"mk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Macedonian.json";break;case"ml":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Malay.json";break;case"mn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Mongolian.json";break;case"ne":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Nepali.json";break;case"nb":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Bokmal.json";break;case"nn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Nynorsk.json";break;case"ps":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Pashto.json";break;case"fa":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Persian.json";break;case"pl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Polish.json";break;case"pt":languageURL="pt_BR"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Portuguese-Brasil.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";break;case"ro":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Romanian.json";break;case"ru":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Russian.json";break;case"sr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Serbian.json";break;case"si":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Sinhala.json";break;case"sk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovak.json";break;case"sl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovenian.json";break;case"es":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Spanish.json";break;case"sw":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swahili.json";break;case"sv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swedish.json";break;case"ta":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Tamil.json";break;case"te":languageURL=WPGMZA.pluginDirURL+"languages/datatables/telugu.json";break;case"th":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Thai.json";break;case"tr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Turkish.json";break;case"uk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Ukrainian.json";break;case"ur":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Urdu.json";break;case"uz":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Uzbek.json";break;case"vi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Vietnamese.json";break;case"cy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Welsh.json"}return languageURL},WPGMZA.DataTable.prototype.onAJAXResponse=function(response){},WPGMZA.DataTable.prototype.reload=function(){this.dataTable.ajax.reload(null,!1)}}),jQuery(function($){WPGMZA.AdminFeatureDataTable=function(element){var self=this;this.allSelected=!1,WPGMZA.DataTable.call(this,element),$(element).on("click",".wpgmza.bulk_delete",function(event){self.onBulkDelete(event)}),$(element).on("click",".wpgmza.select_all_markers",function(event){self.onSelectAll(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.extend(WPGMZA.AdminFeatureDataTable,WPGMZA.DataTable),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featurePanel",{get:function(){return WPGMZA.mapEditPage[this.featureType+"Panel"]}}),WPGMZA.AdminFeatureDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaFeatureData=meta},options},WPGMZA.AdminFeatureDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0],plural=this.featureType+"s";$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaFeatureData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/"+plural+"/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminFeatureDataTable.prototype.onSelectAll=function(event){this.allSelected=!this.allSelected;var self=this;$(this.element).find("input[name='mark']").each(function(){self.allSelected?$(this).prop("checked",!0):$(this).prop("checked",!1)})},WPGMZA.AdminFeatureDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}}),jQuery(function($){WPGMZA.AdminMapDataTable=function(element){var self=this;WPGMZA.DataTable.call(this,element),$(element).on("mousedown","button[data-action='edit']",function(event){switch(event.which){case 1:var map_id=$(event.target).attr("data-map-id");window.location.href=window.location.href+"&action=edit&map_id="+map_id;break;case 2:map_id=$(event.target).attr("data-map-id");window.open(window.location.href+"&action=edit&map_id="+map_id)}}),$(element).find(".wpgmza.select_all_maps").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete_maps").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","button[data-action='duplicate']",function(event){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"POST",data:{id:map_id,action:"duplicate"},success:function(response,status,xhr){self.reload()}})}),$(element).on("click","button[data-action='trash']",function(event){if(confirm(WPGMZA.localized_strings.map_delete_prompt_text)){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{id:map_id},success:function(response,status,xhr){self.reload()}})}})},WPGMZA.extend(WPGMZA.AdminMapDataTable,WPGMZA.DataTable),WPGMZA.AdminMapDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMapData=meta},options},WPGMZA.AdminMapDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMapDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMapData.id)}),confirm(WPGMZA.localized_strings.map_bulk_delete_prompt_text)&&WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},$(document).ready(function(event){$("[data-wpgmza-admin-map-datatable]").each(function(index,el){WPGMZA.AdminMapDataTable=new WPGMZA.AdminMapDataTable(el)})})}),jQuery(function($){WPGMZA.AdminMarkerDataTable=function(element){var self=this;this.preventCaching=!0,WPGMZA.DataTable.call(this,element),$(element).on("click","[data-delete-marker-id]",function(event){self.onDeleteMarker(event)}),$(element).find(".wpgmza.select_all_markers").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.AdminMarkerDataTable.prototype=Object.create(WPGMZA.DataTable.prototype),WPGMZA.AdminMarkerDataTable.prototype.constructor=WPGMZA.AdminMarkerDataTable,WPGMZA.AdminMarkerDataTable.createInstance=function(element){return new WPGMZA.AdminMarkerDataTable(element)},WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMarkerData=meta},options},WPGMZA.AdminMarkerDataTable.prototype.onEditMarker=function(event){WPGMZA.animatedScroll("#wpgmaps_tabs_markers")},WPGMZA.AdminMarkerDataTable.prototype.onDeleteMarker=function(event){var self=this,id=$(event.currentTarget).attr("data-delete-marker-id"),data={action:"delete_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:id};$.post(ajaxurl,data,function(response){WPGMZA.mapEditPage.map.removeMarkerByID(id),self.reload()})},WPGMZA.AdminMarkerDataTable.prototype.onApproveMarker=function(event){var cur_id=$(this).attr("id"),data={action:"approve_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:cur_id};$.post(ajaxurl,data,function(response){wpgmza_InitMap(),wpgmza_reinitialisetbl()})},WPGMZA.AdminMarkerDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMarkerData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/markers/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminMarkerDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.mapEditPage.map.setZoom(6),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}}),jQuery(function($){WPGMZA.Integration={},WPGMZA.integrationModules={}}),jQuery(function($){if(window.wp&&wp.i18n&&wp.blocks&&wp.editor&&wp.components){var __=wp.i18n.__,registerBlockType=wp.blocks.registerBlockType,_wp$editor=wp.editor,InspectorControls=_wp$editor.InspectorControls,_wp$components=(_wp$editor.BlockControls,wp.components),Dashicon=_wp$components.Dashicon,PanelBody=(_wp$components.Toolbar,_wp$components.Button,_wp$components.Tooltip,_wp$components.PanelBody);_wp$components.TextareaControl,_wp$components.CheckboxControl,_wp$components.TextControl,_wp$components.SelectControl,_wp$components.RichText;WPGMZA.Integration.Gutenberg=function(){registerBlockType("gutenberg-wpgmza/block",this.getBlockDefinition())},WPGMZA.Integration.Gutenberg.prototype.getBlockTitle=function(){return __("WP Google Maps")},WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls=function(props){return React.createElement(InspectorControls,{key:"inspector"},React.createElement(PanelBody,{title:__("Map Settings")},React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:WPGMZA.adminurl+"admin.php?page=wp-google-maps-menu&action=edit&map_id=1",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-pencil-square-o","aria-hidden":"true"}),__("Go to Map Editor"))),React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:"https://www.wpgmaps.com/documentation/creating-your-first-map/",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-book","aria-hidden":"true"}),__("View Documentation")))))},WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes=function(){return{}},WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition=function(props){var _this=this;return{title:__("WP Google Maps"),description:__("The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss."),category:"common",icon:"location-alt",keywords:[__("Map"),__("Maps"),__("Google")],attributes:this.getBlockAttributes(),edit:function(props){return[!!props.isSelected&&_this.getBlockInspectorControls(props),React.createElement("div",{className:props.className+" wpgmza-gutenberg-block"},React.createElement(Dashicon,{icon:"location-alt"}),React.createElement("span",{class:"wpgmza-gutenberg-block-title"},__("Your map will appear here on your websites front end")))]},save:function(){return null}}},WPGMZA.Integration.Gutenberg.getConstructor=function(){return WPGMZA.Integration.Gutenberg},WPGMZA.Integration.Gutenberg.createInstance=function(){return new(WPGMZA.Integration.Gutenberg.getConstructor())},WPGMZA.isProVersion()||/^6/.test(WPGMZA.pro_version)||(WPGMZA.integrationModules.gutenberg=WPGMZA.Integration.Gutenberg.createInstance())}}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){var geom;if(Parent.call(this,options,olFeature),options=options||{},olFeature){var circle=olFeature.getGeometry(),center=ol.proj.toLonLat(circle.getCenter());geom=circle,options.center=new WPGMZA.LatLng(center[1],center[0]),options.radius=circle.getRadius()/1e3}else geom=new ol.geom.Circle(ol.proj.fromLonLat([parseFloat(options.center.lng),parseFloat(options.center.lat)]),1e3*options.radius);this.layer=new ol.layer.Vector({source:new ol.source.Vector}),this.olFeature=new ol.Feature({geometry:geom}),this.layer.getSource().addFeature(this.olFeature),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaCircle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)},WPGMZA.OLCircle.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olFeature.getGeometry().getCenter());return new WPGMZA.LatLng({lat:lonLat[1],lng:lonLat[0]})},WPGMZA.OLCircle.prototype.recreate=function(){if(this.olFeature&&(this.layer.getSource().removeFeature(this.olFeature),delete this.olFeature),this.center&&this.radius){var x,y,radius=1e3*parseFloat(this.radius);x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular([x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");this.olFeature=new ol.Feature(circle3857),this.layer.getSource().addFeature(this.olFeature)}},WPGMZA.OLCircle.prototype.setVisible=function(visible){this.layer.setVisible(!!visible)},WPGMZA.OLCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.recreate()},WPGMZA.OLCircle.prototype.getRadius=function(){return this.layer.getSource().getFeatures()[0].getGeometry().getRadius()/1e3},WPGMZA.OLCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments)},WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLDrawingManager=function(map){WPGMZA.DrawingManager.call(this,map),this.source=new ol.source.Vector({wrapX:!1}),this.layer=new ol.layer.Vector({source:this.source})},WPGMZA.OLDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.OLDrawingManager.prototype.constructor=WPGMZA.OLDrawingManager,WPGMZA.OLDrawingManager.prototype.setOptions=function(options){var params={};options.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(options.strokeColor,options.strokeOpacity)})),options.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(options.fillColor,options.fillOpacity)})),this.layer.setStyle(new ol.style.Style(params))},WPGMZA.OLDrawingManager.prototype.setDrawingMode=function(mode){var type,endEventType,self=this;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),this.interaction&&(this.map.olMap.removeInteraction(this.interaction),this.interaction=null),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:return;case WPGMZA.DrawingManager.MODE_POLYGON:type="Polygon",endEventType="polygonclosed";break;case WPGMZA.DrawingManager.MODE_POLYLINE:type="LineString",endEventType="polylinecomplete";break;case WPGMZA.DrawingManager.MODE_CIRCLE:type="Circle",endEventType="circlecomplete";break;case WPGMZA.DrawingManager.MODE_RECTANGLE:type="Circle",endEventType="rectanglecomplete";break;case WPGMZA.DrawingManager.MODE_HEATMAP:return;default:throw new Error("Invalid drawing mode")}WPGMZA.mapEditPage&&WPGMZA.mapEditPage.selectInteraction&&WPGMZA.mapEditPage.map.olMap.removeInteraction(WPGMZA.mapEditPage.selectInteraction);var options={source:this.source,type:type};mode==WPGMZA.DrawingManager.MODE_RECTANGLE&&(options.geometryFunction=ol.interaction.Draw.createBox()),this.interaction=new ol.interaction.Draw(options),this.interaction.on("drawend",function(event){if(endEventType){var WPGMZAEvent=new WPGMZA.Event(endEventType);switch(mode){case WPGMZA.DrawingManager.MODE_POLYGON:WPGMZAEvent.enginePolygon=event.feature;break;case WPGMZA.DrawingManager.MODE_POLYLINE:WPGMZAEvent.enginePolyline=event.feature;break;case WPGMZA.DrawingManager.MODE_CIRCLE:WPGMZAEvent.engineCircle=event.feature;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:WPGMZAEvent.engineRectangle=event.feature;break;default:throw new Error("Drawing mode not implemented")}self.dispatchEvent(WPGMZAEvent)}}),this.map.olMap.addInteraction(this.interaction)}}),jQuery(function($){WPGMZA.OLFeature=function(options){WPGMZA.assertInstangeOf(this,"OLFeature"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.extend(WPGMZA.OLFeature,WPGMZA.Feature),WPGMZA.OLFeature.getOLStyle=function(options){var translated={};if(!options)return new ol.style.Style;options=$.extend({},options);var map={fillcolor:"fillColor",opacity:"fillOpacity",linecolor:"strokeColor",lineopacity:"strokeOpacity",linethickness:"strokeWeight"};for(var name in options)name in map&&(options[map[name]]=options[name]);if(options.strokeColor){var opacity=1,weight=1;"strokeOpacity"in options&&(opacity=options.strokeOpacity),"strokeWeight"in options&&(weight=options.strokeWeight),translated.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToString(options.strokeColor,opacity),width:weight})}if(options.fillColor){opacity=1;"fillOpacity"in options&&(opacity=options.fillOpacity);var color=WPGMZA.hexOpacityToString(options.fillColor,opacity);translated.fill=new ol.style.Fill({color:color})}return new ol.style.Style(translated)},WPGMZA.OLFeature.setInteractionsOnFeature=function(feature,enable){if(enable){if(feature.modifyInteraction)return;feature.snapInteraction=new ol.interaction.Snap({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.snapInteraction),feature.modifyInteraction=new ol.interaction.Modify({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.modifyInteraction),feature.modifyInteraction.on("modifyend",function(event){feature.trigger("change")})}else{if(!feature.modifyInteraction)return;feature.map&&(feature.map.olMap.removeInteraction(feature.snapInteraction),feature.map.olMap.removeInteraction(feature.modifyInteraction)),delete feature.snapInteraction,delete feature.modifyInteraction}}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(query,callback){WPGMZA.restAPI.call("/geocode-cache",{data:{query:JSON.stringify(query)},success:function(response,xhr,status){response.lng=response.lon,callback(response)},useCompressedPathVariable:!0})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.componentRestrictions&&options.componentRestrictions.country?data.countrycodes=options.componentRestrictions.country:options.country&&(data.countrycodes=options.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(query,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:JSON.stringify(query),response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.clearCache=function(callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_clear_nominatim_cache"},method:"POST",success:function(response){callback(response)}})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");if(WPGMZA.LatLng.REGEXP.test(options.address)){var latLng=WPGMZA.LatLng.fromString(options.address);callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var finish,location;if(options.location&&(options.latLng=new WPGMZA.LatLng(options.location)),options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].bounds=new WPGMZA.LatLngBounds(new WPGMZA.LatLng({lat:response[i].boundingbox[1],lng:response[i].boundingbox[2]}),new WPGMZA.LatLng({lat:response[i].boundingbox[0],lng:response[i].boundingbox[3]})),response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}var query={location:location,options:options};this.getResponseFromCache(query,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(query,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(feature){var self=this;Parent.call(this,feature),this.element=$("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,Object.defineProperty(WPGMZA.OLInfoWindow.prototype,"isPanIntoViewAllowed",{get:function(){return!0}}),WPGMZA.OLInfoWindow.prototype.open=function(map,feature){var self=this,latLng=feature.getPosition();if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.overlay&&this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!0,insertFirst:!0}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.feature.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.setContent(this.content),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&WPGMZA.getImageDimensions(feature.getIcon(),function(size){$(self.element).css({left:Math.round(size.width/2)+"px"})}),this.trigger("infowindowopen"),this.trigger("domready")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.trigger("infowindowclose"),this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html;var eaBtn=WPGMZA.isProVersion()?"":this.addEditButton();$(this.element).html(eaBtn+"<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})},WPGMZA.OLInfoWindow.prototype.onOpen=function(){var self=this,imgs=$(this.element).find("img"),numImages=imgs.length,numImagesLoaded=0;if(WPGMZA.InfoWindow.prototype.onOpen.apply(this,arguments),this.isPanIntoViewAllowed){function inside(el,viewport){var a=$(el)[0].getBoundingClientRect(),b=$(viewport)[0].getBoundingClientRect();return a.left>=b.left&&a.left<=b.right&&a.right<=b.right&&a.right>=b.left&&a.top>=b.top&&a.top<=b.bottom&&a.bottom<=b.bottom&&a.bottom>=b.top}function panIntoView(){var offset=.45*-$(self.element).height();self.feature.map.animateNudge(0,offset,self.feature.getPosition())}imgs.each(function(index,el){el.onload=function(){++numImagesLoaded!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}),0!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();function isSettingDisabled(value){return"yes"===value||!!value}$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_draggable)):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_clickzoom)):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_scroll))},this),"greedy"!=this.settings.wpgmza_force_greedy_gestures&&"yes"!=this.settings.wpgmza_force_greedy_gestures&&1!=this.settings.wpgmza_force_greedy_gestures&&(this.gestureOverlay=$("<div class='wpgmza-gesture-overlay'></div>"),this.gestureOverlayTimeoutID=null,WPGMZA.isTouchDevice()||(this.olMap.on("wheel",function(event){if(!ol.events.condition.platformModifierKeyOnly(event))return self.showGestureOverlay(),event.originalEvent.preventDefault(),!1}),this.gestureOverlay.text(WPGMZA.localized_strings.use_ctrl_scroll_to_zoom))),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&1==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),isSettingDisabled(WPGMZA.settings.wpgmza_settings_map_full_screen_control)||this.olMap.addControl(new ol.control.FullScreen),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("click",function(event){var features=self.olMap.getFeaturesAtPixel(event.pixel);if(features&&features.length){var marker=features[0].wpgmzaMarker;marker&&(marker.trigger("click"),marker.trigger("select"))}})),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),setTimeout(function(){self.onIdle()},10)}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged(),this._mouseoverNativeFeatures=[],this.olMap.on("pointermove",function(event){if(!event.dragging){try{var featuresUnderPixel=event.target.getFeaturesAtPixel(event.pixel)}catch(e){return}featuresUnderPixel=featuresUnderPixel||[];var i,props,nativeFeaturesUnderPixel=[];for(i=0;i<featuresUnderPixel.length;i++)(props=featuresUnderPixel[i].getProperties()).wpgmzaFeature&&(nativeFeature=props.wpgmzaFeature,nativeFeaturesUnderPixel.push(nativeFeature),-1==self._mouseoverNativeFeatures.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseover"),self._mouseoverNativeFeatures.push(nativeFeature)));for(i=self._mouseoverNativeFeatures.length-1;0<=i;i--)nativeFeature=self._mouseoverNativeFeatures[i],-1==nativeFeaturesUnderPixel.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseout"),self._mouseoverNativeFeatures.splice(i,1))}}),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;if($(event.target).closest(".ol-marker").length)return;try{var featuresUnderPixel=self.olMap.getFeaturesAtPixel([event.offsetX,event.offsetY])}catch(e){return}featuresUnderPixel=featuresUnderPixel||[];var i,props,nativeFeaturesUnderPixel=[];for(i=0;i<featuresUnderPixel.length;i++)(props=featuresUnderPixel[i].getProperties()).wpgmzaFeature&&(nativeFeature=props.wpgmzaFeature,nativeFeaturesUnderPixel.push(nativeFeature),nativeFeature.trigger("click"));self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){var options={};return WPGMZA.settings.tile_server_url&&(options.url=WPGMZA.settings.tile_server_url,"custom_override"===WPGMZA.settings.tile_server_url&&(WPGMZA.settings.tile_server_url_override&&""!==WPGMZA.settings.tile_server_url_override.trim()?options.url=WPGMZA.settings.tile_server_url_override.trim():options.url="https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"),WPGMZA.settings.open_layers_api_key&&""!==WPGMZA.settings.open_layers_api_key&&(options.url+="?apikey="+WPGMZA.settings.open_layers_api_key.trim())),new ol.layer.Tile({source:new ol.source.OSM(options)})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var transformed=ol.proj.transform(this.olMap.getView().getCenter(),"EPSG:3857","EPSG:4326"),center={lat:transformed[1],lng:transformed[0]};-180<=center.lng&¢er.lng<=180||(center.lng=center.lng-360*Math.floor(center.lng/360),180<center.lng&&(center.lng-=360),this.setCenter(center))},WPGMZA.OLMap.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olMap.getView().getCenter());return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.setCenter=function(latLng){var view=this.olMap.getView();WPGMZA.Map.prototype.setCenter.call(this,latLng),view.setCenter(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.wrapLongitude(),this.onBoundsChanged()},WPGMZA.OLMap.prototype.getBounds=function(){var bounds=this.olMap.getView().calculateExtent(this.olMap.getSize()),nativeBounds=new WPGMZA.LatLngBounds,topLeft=ol.proj.toLonLat([bounds[0],bounds[1]]),bottomRight=ol.proj.toLonLat([bounds[2],bounds[3]]);return nativeBounds.north=topLeft[1],nativeBounds.south=bottomRight[1],nativeBounds.west=topLeft[0],nativeBounds.east=bottomRight[0],nativeBounds},WPGMZA.OLMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var view=this.olMap.getView(),extent=ol.extent.boundingExtent([ol.proj.fromLonLat([parseFloat(southWest.lng),parseFloat(southWest.lat)]),ol.proj.fromLonLat([parseFloat(northEast.lng),parseFloat(northEast.lat)])]);view.fit(extent,this.olMap.getSize())},WPGMZA.OLMap.prototype.panTo=function(latLng,zoom){var view=this.olMap.getView(),options={center:ol.proj.fromLonLat([parseFloat(latLng.lng),parseFloat(latLng.lat)]),duration:500};1<arguments.length&&(options.zoom=parseInt(zoom)),view.animate(options)},WPGMZA.OLMap.prototype.getZoom=function(){return Math.round(this.olMap.getView().getZoom())},WPGMZA.OLMap.prototype.setZoom=function(value){this.olMap.getView().setZoom(value)},WPGMZA.OLMap.prototype.getMinZoom=function(){return this.olMap.getView().getMinZoom()},WPGMZA.OLMap.prototype.setMinZoom=function(value){this.olMap.getView().setMinZoom(value)},WPGMZA.OLMap.prototype.getMaxZoom=function(){return this.olMap.getView().getMaxZoom()},WPGMZA.OLMap.prototype.setMaxZoom=function(value){this.olMap.getView().setMaxZoom(value)},WPGMZA.OLMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.olMap&&this.olMap.getView().setProperties(this.settings.toOLViewOptions())},WPGMZA.OLMap.prototype.addMarker=function(marker){WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT?this.olMap.addOverlay(marker.overlay):(this.markerLayer.getSource().addFeature(marker.feature),marker.featureInSource=!0),Parent.prototype.addMarker.call(this,marker)},WPGMZA.OLMap.prototype.removeMarker=function(marker){WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT?this.olMap.removeOverlay(marker.overlay):(this.markerLayer.getSource().removeFeature(marker.feature),marker.featureInSource=!1),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.OLMap.prototype.addPolygon=function(polygon){this.olMap.addLayer(polygon.layer),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.OLMap.prototype.removePolygon=function(polygon){this.olMap.removeLayer(polygon.layer),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.OLMap.prototype.addPolyline=function(polyline){this.olMap.addLayer(polyline.layer),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.OLMap.prototype.removePolyline=function(polyline){this.olMap.removeLayer(polyline.layer),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.OLMap.prototype.addCircle=function(circle){this.olMap.addLayer(circle.layer),Parent.prototype.addCircle.call(this,circle)},WPGMZA.OLMap.prototype.removeCircle=function(circle){this.olMap.removeLayer(circle.layer),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.OLMap.prototype.addRectangle=function(rectangle){this.olMap.addLayer(rectangle.layer),Parent.prototype.addRectangle.call(this,rectangle)},WPGMZA.OLMap.prototype.removeRectangle=function(rectangle){this.olMap.removeLayer(rectangle.layer),Parent.prototype.removeRectangle.call(this,rectangle)},WPGMZA.OLMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var coord=this.olMap.getCoordinateFromPixel([x,y]);if(!coord)return{x:null,y:null};var lonLat=ol.proj.toLonLat(coord);return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.latLngToPixels=function(latLng){var coord=ol.proj.fromLonLat([latLng.lng,latLng.lat]),pixel=this.olMap.getPixelFromCoordinate(coord);return pixel?{x:pixel[0],y:pixel[1]}:{x:null,y:null}},WPGMZA.OLMap.prototype.enableBicycleLayer=function(value){if(value)this.bicycleLayer||(this.bicycleLayer=new ol.layer.Tile({source:new ol.source.OSM({url:"http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"})})),this.olMap.addLayer(this.bicycleLayer);else{if(!this.bicycleLayer)return;this.olMap.removeLayer(this.bicycleLayer)}},WPGMZA.OLMap.prototype.showGestureOverlay=function(){var self=this;clearTimeout(this.gestureOverlayTimeoutID),$(this.gestureOverlay).stop().animate({opacity:"100"}),$(this.element).append(this.gestureOverlay),$(this.gestureOverlay).css({"line-height":$(this.element).height()+"px",opacity:"1.0"}),$(this.gestureOverlay).show(),this.gestureOverlayTimeoutID=setTimeout(function(){self.gestureOverlay.fadeOut(2e3)},2e3)},WPGMZA.OLMap.prototype.onElementResized=function(event){this.olMap.updateSize()},WPGMZA.OLMap.prototype.onRightClick=function(event){if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)return!0;var parentOffset=$(this.element).offset(),relX=event.pageX-parentOffset.left,relY=event.pageY-parentOffset.top,latLng=this.pixelsToLatLng(relX,relY);return this.trigger({type:"rightclick",latLng:latLng}),$(this.element).trigger({type:"rightclick",latLng:latLng}),event.preventDefault(),!1},WPGMZA.OLMap.prototype.enableAllInteractions=function(){this.olMap.getInteractions().forEach(function(interaction){(interaction instanceof ol.interaction.DragPan||interaction instanceof ol.interaction.DoubleClickZoom||interaction instanceof ol.interaction.MouseWheelZoom)&&interaction.setActive(!0)},this)}}),jQuery(function($){var Parent;WPGMZA.OLMarker=function(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toLatLngLiteral():options[name]instanceof WPGMZA.Map||(settings[name]=options[name]);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);if(WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT){var img=$("<img alt=''/>")[0];img.onload=function(event){self.updateElementHeight(),self.map&&self.map.olMap.updateSize()},img.src=WPGMZA.defaultMarkerIcon,this.element=$("<div class='ol-marker'></div>")[0],this.element.appendChild(img),this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element,position:origin,positioning:"bottom-center",stopEvent:!1}),this.overlay.setPosition(origin),this.animation?this.setAnimation(this.animation):this.anim&&this.setAnimation(this.anim),options&&options.draggable&&this.setDraggable(!0),this.rebindClickListener()}else{if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)throw new Error("Invalid marker render mode");this.feature=new ol.Feature({geometry:new ol.geom.Point(origin)}),this.feature.setStyle(this.getVectorLayerStyle()),(this.feature.wpgmzaMarker=this).feature.wpgmzaFeature=this}this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT="element",WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER="vector",WPGMZA.OLMarker.renderMode=WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT,"open-layers"==WPGMZA.settings.engine&&WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(WPGMZA.OLMarker.defaultVectorLayerStyle=new ol.style.Style({image:new ol.style.Icon({anchor:[.5,1],src:WPGMZA.defaultMarkerIcon})}),WPGMZA.OLMarker.hiddenVectorLayerStyle=new ol.style.Style({})),WPGMZA.OLMarker.prototype.getVectorLayerStyle=function(){return this.vectorLayerStyle?this.vectorLayerStyle:WPGMZA.OLMarker.defaultVectorLayerStyle},WPGMZA.OLMarker.prototype.updateElementHeight=function(height,calledOnFocus){var self=this;0!=(height=height||$(this.element).find("img").height())||calledOnFocus||$(window).one("focus",function(event){self.updateElementHeight(!1,!0)}),$(this.element).css({height:height+"px"})},WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove():console.warn("Marker labels are not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.getVisible=function(visible){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)return"none"!=this.overlay.getElement().style.display},WPGMZA.OLMarker.prototype.setVisible=function(visible){if(Parent.prototype.setVisible.call(this,visible),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(visible){var style=this.getVectorLayerStyle();this.feature.setStyle(style)}else this.feature.setStyle(null);else this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?this.feature.setGeometry(new ol.geom.Point(origin)):this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.updateOffset=function(x,y){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER){x=this._offset.x,y=this._offset.y;this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"}else console.warn("Marker offset is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setAnimation=function(anim){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}else console.warn("Marker animation is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0});else console.warn("Marker dragging is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setOpacity=function(opacity){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?$(this.element).css({opacity:opacity}):console.warn("Marker opacity is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0,this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!1)})},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset_top=parseFloat($(this.element).css("top").match(/-?\d+/)[0]),offset_left=parseFloat($(this.element).css("left").match(/-?\d+/)[0]);$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset_left,y:pixelsBeforeDrag.y+offset_top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag}),this.trigger("change"),"yes"!=this.map.settings.wpgmza_settings_map_draggable&&this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!0)})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,olViewportElement=$(this.map.element).children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",olViewportElement.find(".ol-layers .ol-layer:first-child").prepend(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),(WPGMZA.isProVersion()?$(".wpgmza_map[data-map-id='"+map_id+"']"):$("#wpgmza_map")).append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(options,olFeature){if(Parent.call(this,options,olFeature),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(options&&options.polydata)for(var paths=this.parseGeometry(options.polydata),i=0;i<=paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i%paths.length].lng),parseFloat(paths[i%paths.length].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getGeometry=function(){for(var coordinates=this.olFeature.getGeometry().getCoordinates()[0],result=[],i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolygon.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(options,olFeature){if(WPGMZA.Polyline.call(this,options),olFeature)this.olFeature=olFeature;else{var coordinates=[];if(options&&options.polydata)for(var path=this.parseGeometry(options.polydata),i=0;i<path.length;i++){if(!$.isNumeric(path[i].lat))throw new Error("Invalid latitude");if(!$.isNumeric(path[i].lng))throw new Error("Invalid longitude");coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]))}this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getGeometry=function(){for(var result=[],coordinates=this.olFeature.getGeometry().getCoordinates(),i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolyline.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent=WPGMZA.Rectangle;WPGMZA.OLRectangle=function(options,olFeature){if(Parent.apply(this,arguments),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];options.cornerA&&options.cornerB&&(coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)]))),this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaRectangle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.extend(WPGMZA.OLRectangle,WPGMZA.Rectangle),WPGMZA.OLRectangle.prototype.getBounds=function(){var extent=this.olFeature.getGeometry().getExtent(),topLeft=ol.extent.getTopLeft(extent),bottomRight=ol.extent.getBottomRight(extent),topLeftLonLat=ol.proj.toLonLat(topLeft),bottomRightLonLat=ol.proj.toLonLat(bottomRight),topLeftLatLng=new WPGMZA.LatLng(topLeftLonLat[1],topLeftLonLat[0]),bottomRightLatLng=new WPGMZA.LatLng(bottomRightLonLat[1],bottomRightLonLat[0]);return new WPGMZA.LatLngBounds(topLeftLatLng,bottomRightLatLng)},WPGMZA.OLRectangle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLText=function(){}}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;WPGMZA.Circle.call(this,options,googleCircle),googleCircle?(this.googleCircle=googleCircle,options&&(options.center=WPGMZA.LatLng.fromGoogleLatLng(googleCircle.getCenter()),options.radius=googleCircle.getRadius()/1e3)):(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),this.googleFeature=this.googleCircle,options&&this.setOptions(options),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.getCenter=function(){return WPGMZA.LatLng.fromGoogleLatLng(this.googleCircle.getCenter())},WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},WPGMZA.GoogleCircle.prototype.getRadius=function(){return this.googleCircle.getRadius()/1e3},WPGMZA.GoogleCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.googleCircle.setRadius(1e3*parseFloat(radius))},WPGMZA.GoogleCircle.prototype.setVisible=function(visible){this.googleCircle.setVisible(!!visible)},WPGMZA.GoogleCircle.prototype.setDraggable=function(value){this.googleCircle.setDraggable(!!value)},WPGMZA.GoogleCircle.prototype.setEditable=function(value){var self=this;this.googleCircle.setOptions({editable:value}),value&&(google.maps.event.addListener(this.googleCircle,"center_changed",function(event){self.center=WPGMZA.LatLng.fromGoogleLatLng(self.googleCircle.getCenter()),self.trigger("change")}),google.maps.event.addListener(this.googleCircle,"radius_changed",function(event){self.radius=self.googleCircle.getRadius()/1e3,self.trigger("change")}))},WPGMZA.GoogleCircle.prototype.setOptions=function(options){WPGMZA.Circle.prototype.setOptions.apply(this,arguments),options.center&&(this.center=new WPGMZA.LatLng(options.center))},WPGMZA.GoogleCircle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),center=new WPGMZA.LatLng(this.center);googleOptions.radius*=1e3,googleOptions.center=center.toGoogleLatLng(),this.googleCircle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleDrawingManager=function(map){var self=this;WPGMZA.DrawingManager.call(this,map),this.mode=null,this.googleDrawingManager=new google.maps.drawing.DrawingManager({drawingControl:!1,polygonOptions:{editable:!0},polylineOptions:{editable:!0},circleOptions:{editable:!0},rectangleOptions:{editable:!0}}),this.googleDrawingManager.setMap(map.googleMap),google.maps.event.addListener(this.googleDrawingManager,"polygoncomplete",function(polygon){self.onPolygonClosed(polygon)}),google.maps.event.addListener(this.googleDrawingManager,"polylinecomplete",function(polyline){self.onPolylineComplete(polyline)}),google.maps.event.addListener(this.googleDrawingManager,"circlecomplete",function(circle){self.onCircleComplete(circle)}),google.maps.event.addListener(this.googleDrawingManager,"rectanglecomplete",function(rectangle){self.onRectangleComplete(rectangle)})},WPGMZA.GoogleDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.GoogleDrawingManager.prototype.constructor=WPGMZA.GoogleDrawingManager,WPGMZA.GoogleDrawingManager.prototype.setDrawingMode=function(mode){var googleMode;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:googleMode=null;break;case WPGMZA.DrawingManager.MODE_POLYGON:googleMode=google.maps.drawing.OverlayType.POLYGON;break;case WPGMZA.DrawingManager.MODE_POLYLINE:googleMode=google.maps.drawing.OverlayType.POLYLINE;break;case WPGMZA.DrawingManager.MODE_CIRCLE:googleMode=google.maps.drawing.OverlayType.CIRCLE;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:googleMode=google.maps.drawing.OverlayType.RECTANGLE;break;case WPGMZA.DrawingManager.MODE_HEATMAP:googleMode=null;break;default:throw new Error("Invalid drawing mode")}this.googleDrawingManager.setDrawingMode(googleMode)},WPGMZA.GoogleDrawingManager.prototype.setOptions=function(options){this.googleDrawingManager.setOptions({polygonOptions:options,polylineOptions:options})},WPGMZA.GoogleDrawingManager.prototype.onVertexClicked=function(event){},WPGMZA.GoogleDrawingManager.prototype.onPolygonClosed=function(googlePolygon){var event=new WPGMZA.Event("polygonclosed");event.enginePolygon=googlePolygon,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onPolylineComplete=function(googlePolyline){var event=new WPGMZA.Event("polylinecomplete");event.enginePolyline=googlePolyline,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onCircleComplete=function(googleCircle){var event=new WPGMZA.Event("circlecomplete");event.engineCircle=googleCircle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onRectangleComplete=function(googleRectangle){var event=new WPGMZA.Event("rectanglecomplete");event.engineRectangle=googleRectangle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onHeatmapPointAdded=function(googleMarker){var position=WPGMZA.LatLng.fromGoogleLatLng(googleMarker.getPosition());googleMarker.setMap(null);var marker=WPGMZA.Marker.createInstance();marker.setPosition(position);var image={url:WPGMZA.imageFolderURL+"heatmap-point.png",origin:new google.maps.Point(0,0),anchor:new google.maps.Point(13,13)};marker.googleMarker.setIcon(image),this.map.addMarker(marker);var event=new WPGMZA.Event("heatmappointadded");event.position=position,this.trigger(event)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)return nativeStatus=WPGMZA.Geocoder.NO_ADDRESS,void callback(null,nativeStatus);if(options.lat&&options.lng){var latLng={lat:options.lat,lng:options.lng};callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:null}],WPGMZA.Geocoder.SUCCESS)}if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()},bounds=null;results[0].geometry.bounds&&(bounds=WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds)),callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:bounds}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){WPGMZA.settings.engine&&"google-maps"!=WPGMZA.settings.engine||window.google&&window.google.maps&&(WPGMZA.GoogleHTMLOverlay=function(map){this.element=$("<div class='wpgmza-google-html-overlay'></div>"),this.visible=!0,this.position=new WPGMZA.LatLng,this.setMap(map.googleMap),this.wpgmzaMap=map},WPGMZA.GoogleHTMLOverlay.prototype=new google.maps.OverlayView,WPGMZA.GoogleHTMLOverlay.prototype.onAdd=function(){this.getPanes().overlayMouseTarget.appendChild(this.element[0])},WPGMZA.GoogleHTMLOverlay.prototype.onRemove=function(){this.element&&$(this.element).parent().length&&($(this.element).remove(),this.element=null)},WPGMZA.GoogleHTMLOverlay.prototype.draw=function(){this.updateElementPosition()},WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition=function(){var projection=this.getProjection();if(projection){var pixels=projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());$(this.element).css({left:pixels.x,top:pixels.y})}})}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(feature){Parent.call(this,feature),this.setFeature(feature)},WPGMZA.GoogleInfoWindow.Z_INDEX=99,Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setFeature=function(feature){(this.feature=feature)instanceof WPGMZA.Marker?this.googleObject=feature.googleMarker:feature instanceof WPGMZA.Polygon?this.googleObject=feature.googlePolygon:feature instanceof WPGMZA.Polyline&&(this.googleObject=feature.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){var self=this;this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow,this.googleInfoWindow.setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX),google.maps.event.addListener(this.googleInfoWindow,"domready",function(event){self.trigger("domready")}),google.maps.event.addListener(this.googleInfoWindow,"closeclick",function(event){self.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(self.state=WPGMZA.InfoWindow.STATE_CLOSED,self.feature.map.trigger("infowindowclose"))}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,feature){var self=this;if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setFeature(feature),this.googleInfoWindow.open(this.feature.map.googleMap,this.googleObject);var intervalID,guid=WPGMZA.guid(),eaBtn=WPGMZA.isProVersion()?"":this.addEditButton(),html="<div id='"+guid+"'>"+eaBtn+" "+this.content+"</div>";return this.googleInfoWindow.setContent(html),intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaFeature=self.feature,div.addClass("wpgmza-infowindow"),self.element=div[0],self.trigger("infowindowopen"))},50),!0},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;Parent.call(this,element,options),this.loadGoogleMap(),options?this.setOptions(options,!0):this.setOptions({},!0),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.parseThemeData=function(raw){var json;try{json=JSON.parse(raw)}catch(e){try{json=eval(raw)}catch(e){var str=raw;str=str.replace(/\\'/g,"'"),str=str.replace(/\\"/g,'"'),str=str.replace(/\\0/g,"\0"),str=str.replace(/\\\\/g,"\\");try{json=eval(str)}catch(e){return console.warn("Couldn't parse theme data"),[]}}}return json},WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),this.settings.transport_layer&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.wpgmza_show_point_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options,initializing){if(Parent.prototype.setOptions.call(this,options),options.scrollwheel&&delete options.scrollwheel,initializing){var converted=$.extend(options,this.settings.toGoogleMapsOptions()),clone=$.extend({},converted);if(!clone.center instanceof google.maps.LatLng&&(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),this.settings.hide_point_of_interest){clone.styles||(clone.styles=[]),clone.styles.push({featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]})}this.googleMap.setOptions(clone)}else this.googleMap.setOptions(options)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.addRectangle=function(rectangle){rectangle.googleRectangle.setMap(this.googleMap),Parent.prototype.addRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.removeRectangle=function(rectangle){rectangle.googleRectangle.setMap(null),Parent.prototype.removeRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(parseInt(value))},WPGMZA.GoogleMap.prototype.getBounds=function(){var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest(),nativeBounds=new WPGMZA.LatLngBounds({});return nativeBounds.north=northEast.lat(),nativeBounds.south=southWest.lat(),nativeBounds.west=southWest.lng(),nativeBounds.east=northEast.lng(),nativeBounds.topLeft={lat:northEast.lat(),lng:southWest.lng()},nativeBounds.bottomRight={lat:southWest.lat(),lng:northEast.lng()},nativeBounds},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var nativeBounds=new google.maps.LatLngBounds(southWest,northEast);this.googleMap.fitBounds(nativeBounds)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")},WPGMZA.GoogleMap.prototype.enableAllInteractions=function(){var options={scrollwheel:!0,draggable:!0,disableDoubleClickZoom:!1};this.googleMap.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toGoogleLatLng():options[name]instanceof WPGMZA.Map||"icon"==name||(settings[name]=options[name]);this.googleMarker=new google.maps.Marker(settings),(this.googleMarker.wpgmzaMarker=this).googleFeature=this.googleMarker,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.anim&&this.googleMarker.setAnimation(this.anim),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()}),self.trigger("change")}),this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,Object.defineProperty(WPGMZA.GoogleMarker.prototype,"opacity",{get:function(){return this._opacity},set:function(value){this._opacity=value,this.googleMarker.setOpacity(value)}}),WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.updateOffset=function(){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image,x=this._offset.x,y=this._offset.y;icon=icon||WPGMZA.settings.default_marker_icon,params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor_x=img.width/2,defaultAnchor_y=img.height;params.anchor=new google.maps.Point(defaultAnchor_x-x,defaultAnchor_y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(!!visible)},WPGMZA.GoogleMarker.prototype.getVisible=function(visible){return this.googleMarker.getVisible()},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)},WPGMZA.GoogleMarker.prototype.setOpacity=function(opacity){this.googleMarker.setOpacity(opacity)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){var map=this.map=WPGMZA.getMapByID(map_id);WPGMZA.ModernStoreLocator.call(this,map_id);var restrict=map.settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&restrict&&restrict.length,this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(options,googlePolygon){var self=this;options=options||{},Parent.call(this,options,googlePolygon),this.googlePolygon=googlePolygon||new google.maps.Polygon,this.googleFeature=this.googlePolygon,options&&options.polydata&&this.googlePolygon.setOptions({paths:this.parseGeometry(options.polydata)}),this.googlePolygon.wpgmzaPolygon=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.updateNativeFeature=function(){this.googlePolygon.setOptions(this.getScalarProperties())},WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){var self=this;this.googlePolygon.setOptions({editable:value}),value&&(this.googlePolygon.getPaths().forEach(function(path,index){["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})})}),google.maps.event.addListener(this.googlePolygon,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolygon,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))}))},WPGMZA.GooglePolygon.prototype.setDraggable=function(value){this.googlePolygon.setDraggable(value)},WPGMZA.GooglePolygon.prototype.getGeometry=function(){for(var result=[],path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(options,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,options,googlePolyline),this.googlePolyline=googlePolyline||new google.maps.Polyline(this.settings),this.googleFeature=this.googlePolyline,options&&options.polydata){var path=this.parseGeometry(options.polydata);this.googlePolyline.setPath(path)}this.googlePolyline.wpgmzaPolyline=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.updateNativeFeature=function(){this.googlePolyline.setOptions(this.getScalarProperties())},WPGMZA.GooglePolyline.prototype.setEditable=function(value){var self=this;if(this.googlePolyline.setOptions({editable:value}),value){var path=this.googlePolyline.getPath();["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})}),google.maps.event.addListener(this.googlePolyline,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolyline,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))})}},WPGMZA.GooglePolyline.prototype.setDraggable=function(value){this.googlePolyline.setOptions({draggable:value})},WPGMZA.GooglePolyline.prototype.getGeometry=function(){for(var result=[],path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GoogleRectangle=function(options,googleRectangle){var self=this;options=options||{},WPGMZA.Rectangle.call(this,options,googleRectangle),googleRectangle?(this.googleRectangle=googleRectangle,this.cornerA=options.cornerA=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getNorthEast().lat(),lng:googleRectangle.getBounds().getSouthWest().lng()}),this.cornerB=options.cornerB=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getSouthWest().lat(),lng:googleRectangle.getBounds().getNorthEast().lng()})):(this.googleRectangle=new google.maps.Rectangle,this.googleRectangle.wpgmzaRectangle=this),this.googleFeature=this.googleRectangle,options&&this.setOptions(options),google.maps.event.addListener(this.googleRectangle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleRectangle.prototype=Object.create(WPGMZA.Rectangle.prototype),WPGMZA.GoogleRectangle.prototype.constructor=WPGMZA.GoogleRectangle,WPGMZA.GoogleRectangle.prototype.getBounds=function(){return WPGMZA.LatLngBounds.fromGoogleLatLngBounds(this.googleRectangle.getBounds())},WPGMZA.GoogleRectangle.prototype.setVisible=function(visible){this.googleRectangle.setVisible(!!visible)},WPGMZA.GoogleRectangle.prototype.setDraggable=function(value){this.googleRectangle.setDraggable(!!value)},WPGMZA.GoogleRectangle.prototype.setEditable=function(value){var self=this;this.googleRectangle.setEditable(!!value),value&&google.maps.event.addListener(this.googleRectangle,"bounds_changed",function(event){self.trigger("change")})},WPGMZA.GoogleRectangle.prototype.setOptions=function(options){WPGMZA.Rectangle.prototype.setOptions.apply(this,arguments),options.cornerA&&options.cornerB&&(this.cornerA=new WPGMZA.LatLng(options.cornerA),this.cornerB=new WPGMZA.LatLng(options.cornerB))},WPGMZA.GoogleRectangle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),north=parseFloat(this.cornerA.lat),west=parseFloat(this.cornerA.lng),south=parseFloat(this.cornerB.lat),east=parseFloat(this.cornerB.lng);north&&west&&south&&east&&(googleOptions.bounds={north:north,west:west,south:south,east:east}),this.googleRectangle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleText=function(options){WPGMZA.Text.apply(this,arguments),this.overlay=new WPGMZA.GoogleTextOverlay(options)},WPGMZA.extend(WPGMZA.GoogleText,WPGMZA.Text)}),jQuery(function($){WPGMZA.GoogleTextOverlay=function(options){this.element=$("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>"),(options=options||{}).position&&(this.position=options.position),options.text&&this.element.find(".wpgmza-inner").text(options.text),options.map&&this.setMap(options.map.googleMap)},window.google&&google.maps&&google.maps.OverlayView&&(WPGMZA.GoogleTextOverlay.prototype=new google.maps.OverlayView),WPGMZA.GoogleTextOverlay.prototype.onAdd=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"}),this.getPanes().floatPane.appendChild(this.element[0])},WPGMZA.GoogleTextOverlay.prototype.draw=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"})},WPGMZA.GoogleTextOverlay.prototype.onRemove=function(){this.element.remove()},WPGMZA.GoogleTextOverlay.prototype.hide=function(){this.element.hide()},WPGMZA.GoogleTextOverlay.prototype.show=function(){this.element.show()},WPGMZA.GoogleTextOverlay.prototype.toggle=function(){this.element.is(":visible")?this.element.hide():this.element.show()}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&null!=vertex&&path.removeAt(vertex),this.close()}))}),jQuery(function($){WPGMZA.FeaturePanel=function(element,mapEditPage){var self=this;WPGMZA.EventDispatcher.apply(this,arguments),this.map=mapEditPage.map,this.drawingManager=mapEditPage.drawingManager,this.feature=null,this.element=element,this.initDefaults(),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.drawingInstructionsElement=$(this.element).find(".wpgmza-feature-drawing-instructions"),this.drawingInstructionsElement.detach(),this.editingInstructionsElement=$(this.element).find(".wpgmza-feature-editing-instructions"),this.editingInstructionsElement.detach(),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.newPanel[0],self.element[0])&&self.onTabActivated(event)}),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.oldPanel[0],self.element[0])&&self.onTabDeactivated(event)}),$(document.body).on("click","[data-edit-"+this.featureType+"-id]",function(event){self.onEditFeature(event)}),$(document.body).on("click","[data-delete-"+this.featureType+"-id]",function(event){self.onDeleteFeature(event)}),$(this.element).find(".wpgmza-save-feature").on("click",function(event){self.onSave(event)}),this.drawingManager.on(self.drawingManagerCompleteEvent,function(event){self.onDrawingComplete(event)}),this.drawingManager.on("drawingmodechanged",function(event){self.onDrawingModeChanged(event)}),$(this.element).on("change input",function(event){self.onPropertyChanged(event)})},WPGMZA.extend(WPGMZA.FeaturePanel,WPGMZA.EventDispatcher),WPGMZA.FeaturePanel.MODE_ADD="add",WPGMZA.FeaturePanel.MODE_EDIT="edit",WPGMZA.FeaturePanel.prevEditableFeature=null,Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"drawingManagerCompleteEvent",{get:function(){return this.featureType+"complete"}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureDataTable",{get:function(){return $("[data-wpgmza-datatable][data-wpgmza-feature-type='"+this.featureType+"']")[0].wpgmzaDataTable}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureAccordion",{get:function(){return $(this.element).closest(".wpgmza-accordion")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"map",{get:function(){return WPGMZA.mapEditPage.map}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"mode",{get:function(){return this._mode}}),WPGMZA.FeaturePanel.prototype.initPreloader=function(){this.preloader||(this.preloader=$(WPGMZA.preloaderHTML),this.preloader.hide(),$(this.element).append(this.preloader))},WPGMZA.FeaturePanel.prototype.initDataTable=function(){var el=$(this.element).find("[data-wpgmza-datatable][data-wpgmza-rest-api-route]");this[this.featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)},WPGMZA.FeaturePanel.prototype.initDefaults=function(){$(this.element).find("[data-ajax-name]:not([type='radio'])").each(function(index,el){var val=$(el).val();val&&$(el).attr("data-default-value",val)})},WPGMZA.FeaturePanel.prototype.setCaptionType=function(type,id){var icons={add:"fa-plus-circle",save:"fa-pencil-square-o"};switch(type){case WPGMZA.FeaturePanel.MODE_ADD:case WPGMZA.FeaturePanel.MODE_EDIT:this.featureAccordion.find("[data-add-caption][data-edit-caption]").each(function(index,el){var text=$(el).attr("data-"+type+"-caption"),icon=$(el).find("i.fa");id&&(text+=" "+id),$(el).text(text),icon.length&&((icon=$("<i class='fa' aria-hidden='true'></i>")).addClass(icons[type]),$(el).prepend(" "),$(el).prepend(icon))});break;default:throw new Error("Invalid type")}},WPGMZA.FeaturePanel.prototype.setMode=function(type,id){this._mode=type,this.setCaptionType(type,id)},WPGMZA.FeaturePanel.prototype.setTargetFeature=function(feature){var self=this;if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setEditable(!1),prev.setDraggable(!1),prev.off("change")}feature?(feature.setEditable(!0),feature.setDraggable(!0),feature.on("change",function(event){self.onFeatureChanged(event)}),this.setMode(WPGMZA.FeaturePanel.MODE_EDIT),this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showInstructions()):this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.feature=WPGMZA.FeaturePanel.prevEditableFeature=feature},WPGMZA.FeaturePanel.prototype.reset=function(){$(this.element).find("[data-ajax-name]:not([data-ajax-name='map_id']):not([type='color']):not([type='checkbox']):not([type='radio'])").val(""),$(this.element).find("select[data-ajax-name]>option:first-child").prop("selected",!0),$(this.element).find("[data-ajax-name='id']").val("-1"),$(this.element).find("input[type='checkbox']").prop("checked",!1),tinyMCE.get("wpgmza-description-editor")?tinyMCE.get("wpgmza-description-editor").setContent(""):$("#wpgmza-description-editor").val(""),$("#wpgmza-description-editor").val(""),this.showPreloader(!1),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),$(this.element).find("[data-ajax-name][data-default-value]").each(function(index,el){$(el).val($(el).data("default-value"))})},WPGMZA.FeaturePanel.prototype.select=function(arg){var id,expectedBaseClass,self=this;if(this.reset(),$.isNumeric(arg))id=arg;else{if(expectedBaseClass=WPGMZA[WPGMZA.capitalizeWords(this.featureType)],!(feature instanceof expectedBaseClass))throw new Error("Invalid feature type for this panel");id=arg.id}this.showPreloader(!0),WPGMZA.animateScroll($(".wpgmza_map")),WPGMZA.restAPI.call("/"+this.featureType+"s/"+id+"?skip_cache=1",{success:function(data,status,xhr){var getByIDFunction="get"+WPGMZA.capitalizeWords(self.featureType)+"ByID",feature=self.map[getByIDFunction](id);self.populate(data),self.showPreloader(!1),self.setMode(WPGMZA.FeaturePanel.MODE_EDIT,id),self.setTargetFeature(feature)}})},WPGMZA.FeaturePanel.prototype.showPreloader=function(show){this.initPreloader(),0==arguments.length||show?(this.preloader.fadeIn(),this.element.addClass("wpgmza-loading")):(this.preloader.fadeOut(),this.element.removeClass("wpgmza-loading"))},WPGMZA.FeaturePanel.prototype.populate=function(data){var value,target,name;for(name in data)switch(target=$(this.element).find("[data-ajax-name='"+name+"']"),value=data[name],(target.attr("type")||"").toLowerCase()){case"checkbox":case"radio":target.prop("checked",1==data[name]);break;case"color":value.match(/^#/)||(value="#"+value);default:"object"==typeof value&&(value=JSON.stringify(value)),$(this.element).find("[data-ajax-name='"+name+"']:not(select)").val(value),$(this.element).find("select[data-ajax-name='"+name+"']").each(function(index,el){"string"==typeof value&&0==data[name].length||$(el).val(value)})}},WPGMZA.FeaturePanel.prototype.serializeFormData=function(){var fields=$(this.element).find("[data-ajax-name]"),data={};return fields.each(function(index,el){var type="text";switch($(el).attr("type")&&(type=$(el).attr("type").toLowerCase()),type){case"checkbox":data[$(el).attr("data-ajax-name")]=$(el).prop("checked")?1:0;break;case"radio":$(el).prop("checked")&&(data[$(el).attr("data-ajax-name")]=$(el).val());break;default:data[$(el).attr("data-ajax-name")]=$(el).val()}}),data},WPGMZA.FeaturePanel.prototype.discardChanges=function(){if(this.feature){var feature=this.feature;this.setTargetFeature(null),feature&&feature.map&&(this.map["remove"+WPGMZA.capitalizeWords(this.featureType)](feature),-1<feature.id&&this.updateFeatureByID(feature.id))}},WPGMZA.FeaturePanel.prototype.updateFeatureByID=function(id){var feature,self=this,route="/"+this.featureType+"s/",functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;WPGMZA.restAPI.call(route+id,{success:function(data,status,xhr){(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature)}})},WPGMZA.FeaturePanel.prototype.showInstructions=function(){switch(this.mode){case WPGMZA.FeaturePanel.MODE_ADD:$(this.map.element).append(this.drawingInstructionsElement),$(this.drawingInstructionsElement).hide().fadeIn();break;default:$(this.map.element).append(this.editingInstructionsElement),$(this.editingInstructionsElement).hide().fadeIn()}},WPGMZA.FeaturePanel.prototype.onTabActivated=function(){this.reset(),this.drawingManager.setDrawingMode(this.featureType),this.onAddFeature(event),$(".wpgmza-table-container-title").hide(),$(".wpgmza-table-container").hide();var featureString=this.featureType.charAt(0).toUpperCase()+this.featureType.slice(1);$("#wpgmza-table-container-"+featureString).show(),$("#wpgmza-table-container-title-"+featureString).show()},WPGMZA.FeaturePanel.prototype.onTabDeactivated=function(){this.discardChanges(),this.setTargetFeature(null)},WPGMZA.FeaturePanel.prototype.onAddFeature=function(event){this.drawingManager.setDrawingMode(this.featureType)},WPGMZA.FeaturePanel.prototype.onEditFeature=function(event){var name="data-edit-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.select(id)},WPGMZA.FeaturePanel.prototype.onDeleteFeature=function(event){var self=this,name="data-delete-"+this.featureType+"-id",id=$(event.currentTarget).attr(name),route="/"+this.featureType+"s/",feature=this.map["get"+WPGMZA.capitalizeWords(this.featureType)+"ByID"](id);this.featureDataTable.dataTable.processing(!0),WPGMZA.restAPI.call(route+id,{method:"DELETE",success:function(data,status,xhr){self.map["remove"+WPGMZA.capitalizeWords(self.featureType)](feature),self.featureDataTable.reload()}})},WPGMZA.FeaturePanel.prototype.onDrawingModeChanged=function(event){$(this.drawingInstructionsElement).detach(),$(this.editingInstructionsElement).detach(),this.drawingManager.mode==this.featureType&&this.showInstructions()},WPGMZA.FeaturePanel.prototype.onDrawingComplete=function(event){var engineFeature=event["engine"+WPGMZA.capitalizeWords(this.featureType)],formData=this.serializeFormData(),geometryField=$(this.element).find("textarea[data-ajax-name$='data']");delete formData.polydata;var nativeFeature=WPGMZA[WPGMZA.capitalizeWords(this.featureType)].createInstance(formData,engineFeature);this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.map["add"+WPGMZA.capitalizeWords(this.featureType)](nativeFeature),this.setTargetFeature(nativeFeature),geometryField.length&&geometryField.val(JSON.stringify(nativeFeature.getGeometry())),this.featureType},WPGMZA.FeaturePanel.prototype.onPropertyChanged=function(event){var feature=this.feature;feature&&($(this.element).find(":input[data-ajax-name]").each(function(index,el){var key=$(el).attr("data-ajax-name");feature[key]=$(el).val()}),feature.updateNativeFeature())},WPGMZA.FeaturePanel.prototype.onFeatureChanged=function(event){var geometryField=$(this.element).find("textarea[data-ajax-name$='data']");geometryField.length&&geometryField.val(JSON.stringify(this.feature.getGeometry()))},WPGMZA.FeaturePanel.prototype.onSave=function(event){var self=this,id=$(self.element).find("[data-ajax-name='id']").val(),data=this.serializeFormData(),route="/"+this.featureType+"s/",isNew=-1==id;"circle"!=this.featureType||data.center?"rectangle"!=this.featureType||data.cornerA?"polygon"!=this.featureType||data.polydata?"polyline"!=this.featureType||data.polydata?(isNew||(route+=id),WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0),WPGMZA.restAPI.call(route,{method:"POST",data:data,success:function(data,status,xhr){var feature,functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;self.reset(),(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),self.setTargetFeature(null),self.showPreloader(!1),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature),self.featureDataTable.reload(),self.onTabActivated(event)}})):alert(WPGMZA.localized_strings.no_shape_polyline):alert(WPGMZA.localized_strings.no_shape_polygon):alert(WPGMZA.localized_strings.no_shape_rectangle):alert(WPGMZA.localized_strings.no_shape_circle)}}),jQuery(function($){WPGMZA.MarkerPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.MarkerPanel,WPGMZA.FeaturePanel),WPGMZA.MarkerPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProMarkerPanel(element,mapEditPage):new WPGMZA.MarkerPanel(element,mapEditPage)},WPGMZA.MarkerPanel.prototype.initDefaults=function(){var self=this;WPGMZA.FeaturePanel.prototype.initDefaults.apply(this,arguments),this.adjustSubMode=!1,this.onTabActivated(null),$(document.body).on("click","[data-adjust-"+this.featureType+"-id]",function(event){self.onAdjustFeature(event)}),$(document.body).on("click",".wpgmza_approve_btn",function(event){self.onApproveMarker(event)})},WPGMZA.MarkerPanel.prototype.onAdjustFeature=function(event){var name="data-adjust-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.adjustSubMode=!0,this.select(id)},WPGMZA.MarkerPanel.prototype.onApproveMarker=function(event){var self=this,route="/"+this.featureType+"s/"+$(event.currentTarget).attr("id");WPGMZA.restAPI.call(route,{method:"POST",data:{approved:"1"},success:function(data,status,xhr){self.featureDataTable.reload()}})},WPGMZA.MarkerPanel.prototype.onFeatureChanged=function(event){if(this.adjustSubMode){var aPos=this.feature.getPosition();aPos&&($(this.element).find("[data-ajax-name='lat']").val(aPos.lat),$(this.element).find("[data-ajax-name='lng']").val(aPos.lng))}else{var addressField=$(this.element).find("input[data-ajax-name$='address']");if(addressField.length){var pos=this.feature.getPosition();addressField.val(pos.lat+","+pos.lng)}}},WPGMZA.MarkerPanel.prototype.setTargetFeature=function(feature){if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setOpacity&&prev.setOpacity(1)}$(this.element).find("[data-ajax-name]").removeAttr("disabled"),$(this.element).find("fieldset").show(),$(this.element).find(".wpgmza-adjust-mode-notice").addClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","hidden"),$(this.element).find('[data-ajax-name="lng"]').attr("type","hidden"),$(this.element).find(".wpgmza-hide-in-adjust-mode").removeClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").addClass("wpgmza-hidden"),feature?(feature.setOpacity&&feature.setOpacity(.7),feature.getMap().panTo(feature.getPosition()),this.adjustSubMode&&($(this.element).find("[data-ajax-name]").attr("disabled","disabled"),$(this.element).find("fieldset:not(.wpgmza-always-on)").hide(),$(this.element).find(".wpgmza-adjust-mode-notice").removeClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","text").removeAttr("disabled"),$(this.element).find('[data-ajax-name="lng"]').attr("type","text").removeAttr("disabled"),$(this.element).find(".wpgmza-hide-in-adjust-mode").addClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").removeClass("wpgmza-hidden"))):this.adjustSubMode=!1,WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments)},WPGMZA.MarkerPanel.prototype.onSave=function(event){var self=this,geocoder=WPGMZA.Geocoder.createInstance(),geocodingData={address:$(this.element).find("[data-ajax-name='address']").val()};WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0);var cloud_lat=!1,cloud_lng=!1;0<document.getElementsByName("lat").length&&(cloud_lat=document.getElementsByName("lat")[0].value),0<document.getElementsByName("lng").length&&(cloud_lng=document.getElementsByName("lng")[0].value),cloud_lat&&cloud_lng&&(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey||(geocodingData.lat=parseFloat(cloud_lat),geocodingData.lng=parseFloat(cloud_lng))),this.adjustSubMode?WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments):geocoder.geocode(geocodingData,function(results,status){switch(status){case WPGMZA.Geocoder.ZERO_RESULTS:return alert(WPGMZA.localized_strings.zero_results),void self.showPreloader(!1);case WPGMZA.Geocoder.SUCCESS:break;case WPGMZA.Geocoder.NO_ADDRESS:return alert(WPGMZA.localized_strings.no_address),void self.showPreloader(!1);case WPGMZA.Geocoder.FAIL:default:return alert(WPGMZA.localized_strings.geocode_fail),void self.showPreloader(!1)}var result=results[0];$(self.element).find("[data-ajax-name='lat']").val(result.lat),$(self.element).find("[data-ajax-name='lng']").val(result.lng),WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments)}),WPGMZA.mapEditPage.map.resetBounds()}}),jQuery(function($){WPGMZA.CirclePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.CirclePanel,WPGMZA.FeaturePanel),WPGMZA.CirclePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProCirclePanel(element,mapEditPage):new WPGMZA.CirclePanel(element,mapEditPage)},WPGMZA.CirclePanel.prototype.updateFields=function(){$(this.element).find("[data-ajax-name='center']").val(this.feature.getCenter().toString()),$(this.element).find("[data-ajax-name='radius']").val(this.feature.getRadius())},WPGMZA.CirclePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.CirclePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.CirclePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}});var wpgmza_autoCompleteDisabled=!1;jQuery(function($){"map-edit"==WPGMZA.currentPage&&(WPGMZA.MapEditPage=function(){var self=this,element=document.body;WPGMZA.EventDispatcher.call(this),$("#wpgmaps_options fieldset").wrapInner("<div class='wpgmza-flex'></div>"),this.themePanel=new WPGMZA.ThemePanel,this.themeEditor=new WPGMZA.ThemeEditor,this.map=WPGMZA.maps[0],(!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.1.0")>=WPGMZA.Version.EQUAL_TO)&&(this.drawingManager=WPGMZA.DrawingManager.createInstance(this.map)),this.initDataTables(),this.initFeaturePanels(),this.initJQueryUIControls(),"en"!==WPGMZA.locale&&$("#datatable_no_result_message,#datatable_search_string").parent().parent().hide(),$("input.wpgmza-address").each(function(index,el){el.addressInput=WPGMZA.AddressInput.createInstance(el,self.map)}),$('#wpgmza-map-edit-page input[type="color"]').each(function(){$("<div class='button-secondary wpgmza-paste-color-btn' title='Paste a HEX color code'><i class='fa fa-clipboard' aria-hidden='true'></i></div>").insertAfter(this)}),jQuery("body").on("click",".wpgmza_ac_result",function(e){var index=jQuery(this).data("id"),lat=jQuery(this).data("lat"),lng=jQuery(this).data("lng"),name=jQuery("#wpgmza_item_address_"+index).html();jQuery("input[name='lat']").val(lat),jQuery("input[name='lng']").val(lng),jQuery("#wpgmza_add_address_map_editor").val(name),jQuery("#wpgmza_autocomplete_search_results").hide()}),jQuery("body").on("click",".wpgmza-paste-color-btn",function(){try{var colorBtn=$(this);if(!navigator||!navigator.clipboard||!navigator.clipboard.readText)return;navigator.clipboard.readText().then(function(textcopy){colorBtn.parent().find('input[type="color"]').val("#"+textcopy.replace("#","").trim())}).catch(function(err){console.error("WP Google Maps: Could not access clipboard",err)})}catch(c_ex){}}),jQuery("body").on("focusout","#wpgmza_add_address_map_editor",function(e){setTimeout(function(){jQuery("#wpgmza_autocomplete_search_results").fadeOut("slow")},500)});var ajaxRequest=!1,wpgmzaAjaxTimeout=!1,wpgmzaStartTyping=!1,wpgmzaKeyStrokeCount=1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0,wpgmzaTmp="",wpgmzaIdentifiedTypingSpeed=!1;$("body").on("keypress",".wpgmza-address",function(e){if("wpgmza_add_address_map_editor"==this.id){if(wpgmza_autoCompleteDisabled)return;var wpgmza_apikey=!1;if(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey)return void(wpgmza_apikey=WPGMZA_localized_data.settings.googleMapsApiKey);if("Escape"===e.key||"Alt"===e.key||"Control"===e.key||"Option"===e.key||"Shift"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)return void $("#wpgmza_autocomplete_search_results").hide();if(!wpgmzaIdentifiedTypingSpeed){var d=new Date;return clearTimeout(wpgmzaTmp),wpgmzaTmp=setTimeout(function(){wpgmzaStartTyping=!1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0},1500),wpgmzaStartTyping?1==wpgmzaKeyStrokeCount||(wpgmzaCurrentTimeBetweenStrokes=d.getTime()-wpgmzaStartTyping,wpgmzaTotalTimeForKeyStrokes+=wpgmzaCurrentTimeBetweenStrokes,wpgmzaAvgTimeBetweenStrokes=wpgmzaTotalTimeForKeyStrokes/(wpgmzaKeyStrokeCount-1),wpgmzaStartTyping=d.getTime(),3<=wpgmzaKeyStrokeCount&&(wpgmzaIdentifiedTypingSpeed=wpgmzaAvgTimeBetweenStrokes)):wpgmzaStartTyping=d.getTime(),void wpgmzaKeyStrokeCount++}clearTimeout(wpgmzaAjaxTimeout),$("#wpgmza_autocomplete_search_results").html("Searching..."),$("#wpgmza_autocomplete_search_results").show();var currentSearch=jQuery(this).val();if(""!==currentSearch){!1!==ajaxRequest&&ajaxRequest.abort();var wpgmza_api_url="";wpgmza_api_url=wpgmza_apikey?"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash+"&k="+wpgmza_apikey:"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash,wpgmzaAjaxTimeout=setTimeout(function(){ajaxRequest=$.ajax({url:wpgmza_api_url,type:"GET",dataType:"json",success:function(results){try{if(void 0!==results.error)"error1"==results.error?($("#wpgmza_autoc_disabled").html(WPGMZA.localized_strings.cloud_api_key_error_1),$("#wpgmza_autoc_disabled").fadeIn("slow"),$("#wpgmza_autocomplete_search_results").hide(),wpgmza_autoCompleteDisabled=!0):console.error(results.error);else{$("#wpgmza_autocomplete_search_results").html("");var html="";for(var i in results)html+="<div class='wpgmza_ac_result "+(""===html?"":"border-top")+"' data-id='"+i+"' data-lat='"+results[i].lat+"' data-lng='"+results[i].lng+"'><div class='wpgmza_ac_container'><div class='wpgmza_ac_icon'><img src='"+results[i].icon+"' /></div><div class='wpgmza_ac_item'><span id='wpgmza_item_name_"+i+"' class='wpgmza_item_name'>"+results[i].place_name+"</span><span id='wpgmza_item_address_"+i+"' class='wpgmza_item_address'>"+results[i].formatted_address+"</span></div></div></div>";""==html&&(html="<div class='p-2 text-center'><small>No results found...</small></div>"),$("#wpgmza_autocomplete_search_results").html(html),$("#wpgmza_autocomplete_search_results").show()}}catch(exception){console.error("WP Google Maps Plugin: There was an error returning the list of places for your search")}}})},2*wpgmzaIdentifiedTypingSpeed)}else $("#wpgmza_autocomplete_search_results").hide()}}),$("#wpgmza_map_height_type").on("change",function(event){self.onMapHeightTypeChange(event)}),$("#advanced-markers .wpgmza-feature-drawing-instructions").remove(),$("[data-search-area='auto']").hide(),$(document.body).on("click","[data-wpgmza-admin-marker-datatable] input[name='mark']",function(event){self.onShiftClick(event)}),$("#wpgmza_map_type").on("change",function(event){self.onMapTypeChanged(event)}),$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")}),this.on("markerupdated",function(event){self.onMarkerUpdated(event)}),this.map&&(this.map.on("zoomchanged",function(event){self.onZoomChanged(event)}),this.map.on("boundschanged",function(event){self.onBoundsChanged(event)}),this.map.on("rightclick",function(event){self.onRightClick(event)})),$(element).on("click",".wpgmza_poly_del_btn",function(event){self.onDeletePolygon(event)}),$(element).on("click",".wpgmza_polyline_del_btn",function(event){self.onDeletePolyline(event)}),$(element).on("click",".wpgmza_dataset_del_btn",function(evevnt){self.onDeleteHeatmap(event)}),$(element).on("click",".wpgmza_circle_del_btn",function(event){self.onDeleteCircle(event)}),$(element).on("click",".wpgmza_rectangle_del_btn",function(event){self.onDeleteRectangle(event)}),$(element).on("click","#wpgmza-open-advanced-theme-data",function(event){event.preventDefault(),$(".wpgmza_theme_data_container").toggleClass("wpgmza_hidden")})},WPGMZA.extend(WPGMZA.MapEditPage,WPGMZA.EventDispatcher),WPGMZA.MapEditPage.createInstance=function(){return WPGMZA.isProVersion()&&WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?new WPGMZA.ProMapEditPage:new WPGMZA.MapEditPage},WPGMZA.MapEditPage.prototype.initDataTables=function(){var self=this;$("[data-wpgmza-datatable][data-wpgmza-rest-api-route]").each(function(index,el){var featureType=$(el).attr("data-wpgmza-feature-type");self[featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)})},WPGMZA.MapEditPage.prototype.initFeaturePanels=function(){var self=this;$(".wpgmza-feature-accordion[data-wpgmza-feature-type]").each(function(index,el){var featurePanelElement=$(el).find(".wpgmza-feature-panel-container > *"),featureType=$(el).attr("data-wpgmza-feature-type"),panelClassName=WPGMZA.capitalizeWords(featureType)+"Panel",instance=WPGMZA[panelClassName].createInstance(featurePanelElement,self);self[featureType+"Panel"]=instance})},WPGMZA.MapEditPage.prototype.initJQueryUIControls=function(){var mapContainer,self=this;$("#wpgmaps_tabs").tabs(),mapContainer=$("#wpgmza-map-container").detach(),$("#wpgmaps_tabs_markers").tabs(),$(".map_wrapper").prepend(mapContainer),$("#slider-range-max").slider({range:"max",min:1,max:21,value:$("input[name='map_start_zoom']").val(),slide:function(event,ui){$("input[name='map_start_zoom']").val(ui.value),self.map.setZoom(ui.value)}})},WPGMZA.MapEditPage.prototype.onShiftClick=function(event){var checkbox=event.currentTarget,row=jQuery(checkbox).closest("tr");if(this.lastSelectedRow&&event.shiftKey){var prevIndex=this.lastSelectedRow.index(),currIndex=row.index(),startIndex=Math.min(prevIndex,currIndex),endIndex=Math.max(prevIndex,currIndex),rows=jQuery("[data-wpgmza-admin-marker-datatable] tbody>tr");jQuery("[data-wpgmza-admin-marker-datatable] input[name='mark']").prop("checked",!1);for(var i=startIndex;i<=endIndex;i++)jQuery(rows[i]).find("input[name='mark']").prop("checked",!0)}this.lastSelectedRow=row},WPGMZA.MapEditPage.prototype.onMapTypeChanged=function(event){if("open-layers"!=WPGMZA.settings.engine){var mapTypeId;switch(event.target.value){case"2":mapTypeId=google.maps.MapTypeId.SATELLITE;break;case"3":mapTypeId=google.maps.MapTypeId.HYBRID;break;case"4":mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:mapTypeId=google.maps.MapTypeId.ROADMAP}this.map.setOptions({mapTypeId:mapTypeId})}},WPGMZA.MapEditPage.prototype.onMarkerUpdated=function(event){this.markerDataTable.reload()},WPGMZA.MapEditPage.prototype.onZoomChanged=function(event){$(".map_start_zoom").val(this.map.getZoom())},WPGMZA.MapEditPage.prototype.onBoundsChanged=function(event){var location=this.map.getCenter();$("#wpgmza_start_location").val(location.lat+","+location.lng),$("input[name='map_start_lat']").val(location.lat),$("input[name='map_start_lng']").val(location.lng),$("#wpgmza_start_zoom").val(this.map.getZoom()),$("#wpgmaps_save_reminder").show()},WPGMZA.MapEditPage.prototype.onMapHeightTypeChange=function(event){"%"==event.target.value&&$("#wpgmza_height_warning").show()},WPGMZA.MapEditPage.prototype.onRightClick=function(event){var marker,self=this;this.drawingManager&&this.drawingManager.mode!=WPGMZA.DrawingManager.MODE_MARKER||(this.rightClickMarker||(this.rightClickMarker=WPGMZA.Marker.createInstance({draggable:!0}),this.rightClickMarker.on("dragend",function(event){$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+","+event.latLng.lng)}),this.map.on("click",function(event){self.rightClickMarker.setMap(null)})),(marker=this.rightClickMarker).setPosition(event.latLng),marker.setMap(this.map),$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+", "+event.latLng.lng))},WPGMZA.MapEditPage.prototype.onDeletePolygon=function(event){var cur_id=parseInt($(this).attr("id")),data={action:"delete_poly",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_Path[cur_id].setMap(null),delete WPGM_PathData[cur_id],delete WPGM_Path[cur_id],$("#wpgmza_poly_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeletePolyline=function(event){var cur_id=$(this).attr("id"),data={action:"delete_polyline",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_PathLine[cur_id].setMap(null),delete WPGM_PathLineData[cur_id],delete WPGM_PathLine[cur_id],$("#wpgmza_polyline_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteHeatmap=function(event){var cur_id=$(this).attr("id"),data={action:"delete_dataset",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){heatmap[cur_id].setMap(null),delete heatmap[cur_id],$("#wpgmza_heatmap_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteCircle=function(event){var circle_id=$(this).attr("id"),data={action:"delete_circle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,circle_id:circle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-5 table").replaceWith(response),circle_array.forEach(function(circle){if(circle.id==circle_id)return circle.setMap(null),!1})})},WPGMZA.MapEditPage.prototype.onDeleteRectangle=function(event){var rectangle_id=$(this).attr("id"),data={action:"delete_rectangle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,rectangle_id:rectangle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-6 table").replaceWith(response),rectangle_array.forEach(function(rectangle){if(rectangle.id==rectangle_id)return rectangle.setMap(null),!1})})},$(document).ready(function(event){WPGMZA.mapEditPage=WPGMZA.MapEditPage.createInstance()}))}),jQuery(function($){WPGMZA.PolygonPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolygonPanel,WPGMZA.FeaturePanel),WPGMZA.PolygonPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolygonPanel(element,mapEditPage):new WPGMZA.PolygonPanel(element,mapEditPage)},Object.defineProperty(WPGMZA.PolygonPanel.prototype,"drawingManagerCompleteEvent",{get:function(){return"polygonclosed"}})}),jQuery(function($){WPGMZA.PolylinePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolylinePanel,WPGMZA.FeaturePanel),WPGMZA.PolylinePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolylinePanel(element,mapEditPage):new WPGMZA.PolylinePanel(element,mapEditPage)}}),jQuery(function($){WPGMZA.RectanglePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.RectanglePanel,WPGMZA.FeaturePanel),WPGMZA.RectanglePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProRectanglePanel(element,mapEditPage):new WPGMZA.RectanglePanel(element,mapEditPage)},WPGMZA.RectanglePanel.prototype.updateFields=function(){var bounds=this.feature.getBounds();bounds.north&&bounds.west&&bounds.south&&bounds.east&&($(this.element).find("[data-ajax-name='cornerA']").val(bounds.north+", "+bounds.west),$(this.element).find("[data-ajax-name='cornerB']").val(bounds.south+", "+bounds.east))},WPGMZA.RectanglePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.RectanglePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.RectanglePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}});
|
lib/pep.js
ADDED
@@ -0,0 +1,1473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* PEP v0.4.3 | https://github.com/jquery/PEP
|
3 |
+
* Copyright jQuery Foundation and other contributors | http://jquery.org/license
|
4 |
+
*/
|
5 |
+
|
6 |
+
(function (global, factory) {
|
7 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
8 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
9 |
+
(global.PointerEventsPolyfill = factory());
|
10 |
+
}(this, function () { 'use strict';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* This is the constructor for new PointerEvents.
|
14 |
+
*
|
15 |
+
* New Pointer Events must be given a type, and an optional dictionary of
|
16 |
+
* initialization properties.
|
17 |
+
*
|
18 |
+
* Due to certain platform requirements, events returned from the constructor
|
19 |
+
* identify as MouseEvents.
|
20 |
+
*
|
21 |
+
* @constructor
|
22 |
+
* @param {String} inType The type of the event to create.
|
23 |
+
* @param {Object} [inDict] An optional dictionary of initial event properties.
|
24 |
+
* @return {Event} A new PointerEvent of type `inType`, initialized with properties from `inDict`.
|
25 |
+
*/
|
26 |
+
var MOUSE_PROPS = [
|
27 |
+
'bubbles',
|
28 |
+
'cancelable',
|
29 |
+
'view',
|
30 |
+
'detail',
|
31 |
+
'screenX',
|
32 |
+
'screenY',
|
33 |
+
'clientX',
|
34 |
+
'clientY',
|
35 |
+
'ctrlKey',
|
36 |
+
'altKey',
|
37 |
+
'shiftKey',
|
38 |
+
'metaKey',
|
39 |
+
'button',
|
40 |
+
'relatedTarget',
|
41 |
+
'pageX',
|
42 |
+
'pageY'
|
43 |
+
];
|
44 |
+
|
45 |
+
var MOUSE_DEFAULTS = [
|
46 |
+
false,
|
47 |
+
false,
|
48 |
+
null,
|
49 |
+
null,
|
50 |
+
0,
|
51 |
+
0,
|
52 |
+
0,
|
53 |
+
0,
|
54 |
+
false,
|
55 |
+
false,
|
56 |
+
false,
|
57 |
+
false,
|
58 |
+
0,
|
59 |
+
null,
|
60 |
+
0,
|
61 |
+
0
|
62 |
+
];
|
63 |
+
|
64 |
+
function PointerEvent(inType, inDict) {
|
65 |
+
inDict = inDict || Object.create(null);
|
66 |
+
|
67 |
+
var e = document.createEvent('Event');
|
68 |
+
e.initEvent(inType, inDict.bubbles || false, inDict.cancelable || false);
|
69 |
+
|
70 |
+
// define inherited MouseEvent properties
|
71 |
+
// skip bubbles and cancelable since they're set above in initEvent()
|
72 |
+
for (var i = 2, p; i < MOUSE_PROPS.length; i++) {
|
73 |
+
p = MOUSE_PROPS[i];
|
74 |
+
e[p] = inDict[p] || MOUSE_DEFAULTS[i];
|
75 |
+
}
|
76 |
+
e.buttons = inDict.buttons || 0;
|
77 |
+
|
78 |
+
// Spec requires that pointers without pressure specified use 0.5 for down
|
79 |
+
// state and 0 for up state.
|
80 |
+
var pressure = 0;
|
81 |
+
|
82 |
+
if (inDict.pressure && e.buttons) {
|
83 |
+
pressure = inDict.pressure;
|
84 |
+
} else {
|
85 |
+
pressure = e.buttons ? 0.5 : 0;
|
86 |
+
}
|
87 |
+
|
88 |
+
// add x/y properties aliased to clientX/Y
|
89 |
+
e.x = e.clientX;
|
90 |
+
e.y = e.clientY;
|
91 |
+
|
92 |
+
// define the properties of the PointerEvent interface
|
93 |
+
e.pointerId = inDict.pointerId || 0;
|
94 |
+
e.width = inDict.width || 0;
|
95 |
+
e.height = inDict.height || 0;
|
96 |
+
e.pressure = pressure;
|
97 |
+
e.tiltX = inDict.tiltX || 0;
|
98 |
+
e.tiltY = inDict.tiltY || 0;
|
99 |
+
e.twist = inDict.twist || 0;
|
100 |
+
e.tangentialPressure = inDict.tangentialPressure || 0;
|
101 |
+
e.pointerType = inDict.pointerType || '';
|
102 |
+
e.hwTimestamp = inDict.hwTimestamp || 0;
|
103 |
+
e.isPrimary = inDict.isPrimary || false;
|
104 |
+
return e;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* This module implements a map of pointer states
|
109 |
+
*/
|
110 |
+
var USE_MAP = window.Map && window.Map.prototype.forEach;
|
111 |
+
var PointerMap = USE_MAP ? Map : SparseArrayMap;
|
112 |
+
|
113 |
+
function SparseArrayMap() {
|
114 |
+
this.array = [];
|
115 |
+
this.size = 0;
|
116 |
+
}
|
117 |
+
|
118 |
+
SparseArrayMap.prototype = {
|
119 |
+
set: function(k, v) {
|
120 |
+
if (v === undefined) {
|
121 |
+
return this.delete(k);
|
122 |
+
}
|
123 |
+
if (!this.has(k)) {
|
124 |
+
this.size++;
|
125 |
+
}
|
126 |
+
this.array[k] = v;
|
127 |
+
},
|
128 |
+
has: function(k) {
|
129 |
+
return this.array[k] !== undefined;
|
130 |
+
},
|
131 |
+
delete: function(k) {
|
132 |
+
if (this.has(k)) {
|
133 |
+
delete this.array[k];
|
134 |
+
this.size--;
|
135 |
+
}
|
136 |
+
},
|
137 |
+
get: function(k) {
|
138 |
+
return this.array[k];
|
139 |
+
},
|
140 |
+
clear: function() {
|
141 |
+
this.array.length = 0;
|
142 |
+
this.size = 0;
|
143 |
+
},
|
144 |
+
|
145 |
+
// return value, key, map
|
146 |
+
forEach: function(callback, thisArg) {
|
147 |
+
return this.array.forEach(function(v, k) {
|
148 |
+
callback.call(thisArg, v, k, this);
|
149 |
+
}, this);
|
150 |
+
}
|
151 |
+
};
|
152 |
+
|
153 |
+
var CLONE_PROPS = [
|
154 |
+
|
155 |
+
// MouseEvent
|
156 |
+
'bubbles',
|
157 |
+
'cancelable',
|
158 |
+
'view',
|
159 |
+
'detail',
|
160 |
+
'screenX',
|
161 |
+
'screenY',
|
162 |
+
'clientX',
|
163 |
+
'clientY',
|
164 |
+
'ctrlKey',
|
165 |
+
'altKey',
|
166 |
+
'shiftKey',
|
167 |
+
'metaKey',
|
168 |
+
'button',
|
169 |
+
'relatedTarget',
|
170 |
+
|
171 |
+
// DOM Level 3
|
172 |
+
'buttons',
|
173 |
+
|
174 |
+
// PointerEvent
|
175 |
+
'pointerId',
|
176 |
+
'width',
|
177 |
+
'height',
|
178 |
+
'pressure',
|
179 |
+
'tiltX',
|
180 |
+
'tiltY',
|
181 |
+
'pointerType',
|
182 |
+
'hwTimestamp',
|
183 |
+
'isPrimary',
|
184 |
+
|
185 |
+
// event instance
|
186 |
+
'type',
|
187 |
+
'target',
|
188 |
+
'currentTarget',
|
189 |
+
'which',
|
190 |
+
'pageX',
|
191 |
+
'pageY',
|
192 |
+
'timeStamp'
|
193 |
+
];
|
194 |
+
|
195 |
+
var CLONE_DEFAULTS = [
|
196 |
+
|
197 |
+
// MouseEvent
|
198 |
+
false,
|
199 |
+
false,
|
200 |
+
null,
|
201 |
+
null,
|
202 |
+
0,
|
203 |
+
0,
|
204 |
+
0,
|
205 |
+
0,
|
206 |
+
false,
|
207 |
+
false,
|
208 |
+
false,
|
209 |
+
false,
|
210 |
+
0,
|
211 |
+
null,
|
212 |
+
|
213 |
+
// DOM Level 3
|
214 |
+
0,
|
215 |
+
|
216 |
+
// PointerEvent
|
217 |
+
0,
|
218 |
+
0,
|
219 |
+
0,
|
220 |
+
0,
|
221 |
+
0,
|
222 |
+
0,
|
223 |
+
'',
|
224 |
+
0,
|
225 |
+
false,
|
226 |
+
|
227 |
+
// event instance
|
228 |
+
'',
|
229 |
+
null,
|
230 |
+
null,
|
231 |
+
0,
|
232 |
+
0,
|
233 |
+
0,
|
234 |
+
0
|
235 |
+
];
|
236 |
+
|
237 |
+
var BOUNDARY_EVENTS = {
|
238 |
+
'pointerover': 1,
|
239 |
+
'pointerout': 1,
|
240 |
+
'pointerenter': 1,
|
241 |
+
'pointerleave': 1
|
242 |
+
};
|
243 |
+
|
244 |
+
var HAS_SVG_INSTANCE = (typeof SVGElementInstance !== 'undefined');
|
245 |
+
|
246 |
+
/**
|
247 |
+
* This module is for normalizing events. Mouse and Touch events will be
|
248 |
+
* collected here, and fire PointerEvents that have the same semantics, no
|
249 |
+
* matter the source.
|
250 |
+
* Events fired:
|
251 |
+
* - pointerdown: a pointing is added
|
252 |
+
* - pointerup: a pointer is removed
|
253 |
+
* - pointermove: a pointer is moved
|
254 |
+
* - pointerover: a pointer crosses into an element
|
255 |
+
* - pointerout: a pointer leaves an element
|
256 |
+
* - pointercancel: a pointer will no longer generate events
|
257 |
+
*/
|
258 |
+
var dispatcher = {
|
259 |
+
pointermap: new PointerMap(),
|
260 |
+
eventMap: Object.create(null),
|
261 |
+
captureInfo: Object.create(null),
|
262 |
+
|
263 |
+
// Scope objects for native events.
|
264 |
+
// This exists for ease of testing.
|
265 |
+
eventSources: Object.create(null),
|
266 |
+
eventSourceList: [],
|
267 |
+
/**
|
268 |
+
* Add a new event source that will generate pointer events.
|
269 |
+
*
|
270 |
+
* `inSource` must contain an array of event names named `events`, and
|
271 |
+
* functions with the names specified in the `events` array.
|
272 |
+
* @param {string} name A name for the event source
|
273 |
+
* @param {Object} source A new source of platform events.
|
274 |
+
*/
|
275 |
+
registerSource: function(name, source) {
|
276 |
+
var s = source;
|
277 |
+
var newEvents = s.events;
|
278 |
+
if (newEvents) {
|
279 |
+
newEvents.forEach(function(e) {
|
280 |
+
if (s[e]) {
|
281 |
+
this.eventMap[e] = s[e].bind(s);
|
282 |
+
}
|
283 |
+
}, this);
|
284 |
+
this.eventSources[name] = s;
|
285 |
+
this.eventSourceList.push(s);
|
286 |
+
}
|
287 |
+
},
|
288 |
+
register: function(element) {
|
289 |
+
var l = this.eventSourceList.length;
|
290 |
+
for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
|
291 |
+
|
292 |
+
// call eventsource register
|
293 |
+
es.register.call(es, element);
|
294 |
+
}
|
295 |
+
},
|
296 |
+
unregister: function(element) {
|
297 |
+
var l = this.eventSourceList.length;
|
298 |
+
for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
|
299 |
+
|
300 |
+
// call eventsource register
|
301 |
+
es.unregister.call(es, element);
|
302 |
+
}
|
303 |
+
},
|
304 |
+
contains: /*scope.external.contains || */function(container, contained) {
|
305 |
+
try {
|
306 |
+
return container.contains(contained);
|
307 |
+
} catch (ex) {
|
308 |
+
|
309 |
+
// most likely: https://bugzilla.mozilla.org/show_bug.cgi?id=208427
|
310 |
+
return false;
|
311 |
+
}
|
312 |
+
},
|
313 |
+
|
314 |
+
// EVENTS
|
315 |
+
down: function(inEvent) {
|
316 |
+
inEvent.bubbles = true;
|
317 |
+
this.fireEvent('pointerdown', inEvent);
|
318 |
+
},
|
319 |
+
move: function(inEvent) {
|
320 |
+
inEvent.bubbles = true;
|
321 |
+
this.fireEvent('pointermove', inEvent);
|
322 |
+
},
|
323 |
+
up: function(inEvent) {
|
324 |
+
inEvent.bubbles = true;
|
325 |
+
this.fireEvent('pointerup', inEvent);
|
326 |
+
},
|
327 |
+
enter: function(inEvent) {
|
328 |
+
inEvent.bubbles = false;
|
329 |
+
this.fireEvent('pointerenter', inEvent);
|
330 |
+
},
|
331 |
+
leave: function(inEvent) {
|
332 |
+
inEvent.bubbles = false;
|
333 |
+
this.fireEvent('pointerleave', inEvent);
|
334 |
+
},
|
335 |
+
over: function(inEvent) {
|
336 |
+
inEvent.bubbles = true;
|
337 |
+
this.fireEvent('pointerover', inEvent);
|
338 |
+
},
|
339 |
+
out: function(inEvent) {
|
340 |
+
inEvent.bubbles = true;
|
341 |
+
this.fireEvent('pointerout', inEvent);
|
342 |
+
},
|
343 |
+
cancel: function(inEvent) {
|
344 |
+
inEvent.bubbles = true;
|
345 |
+
this.fireEvent('pointercancel', inEvent);
|
346 |
+
},
|
347 |
+
leaveOut: function(event) {
|
348 |
+
this.out(event);
|
349 |
+
this.propagate(event, this.leave, false);
|
350 |
+
},
|
351 |
+
enterOver: function(event) {
|
352 |
+
this.over(event);
|
353 |
+
this.propagate(event, this.enter, true);
|
354 |
+
},
|
355 |
+
|
356 |
+
// LISTENER LOGIC
|
357 |
+
eventHandler: function(inEvent) {
|
358 |
+
|
359 |
+
// This is used to prevent multiple dispatch of pointerevents from
|
360 |
+
// platform events. This can happen when two elements in different scopes
|
361 |
+
// are set up to create pointer events, which is relevant to Shadow DOM.
|
362 |
+
if (inEvent._handledByPE) {
|
363 |
+
return;
|
364 |
+
}
|
365 |
+
var type = inEvent.type;
|
366 |
+
var fn = this.eventMap && this.eventMap[type];
|
367 |
+
if (fn) {
|
368 |
+
fn(inEvent);
|
369 |
+
}
|
370 |
+
inEvent._handledByPE = true;
|
371 |
+
},
|
372 |
+
|
373 |
+
// set up event listeners
|
374 |
+
listen: function(target, events) {
|
375 |
+
events.forEach(function(e) {
|
376 |
+
this.addEvent(target, e);
|
377 |
+
}, this);
|
378 |
+
},
|
379 |
+
|
380 |
+
// remove event listeners
|
381 |
+
unlisten: function(target, events) {
|
382 |
+
events.forEach(function(e) {
|
383 |
+
this.removeEvent(target, e);
|
384 |
+
}, this);
|
385 |
+
},
|
386 |
+
addEvent: /*scope.external.addEvent || */function(target, eventName) {
|
387 |
+
target.addEventListener(eventName, this.boundHandler);
|
388 |
+
},
|
389 |
+
removeEvent: /*scope.external.removeEvent || */function(target, eventName) {
|
390 |
+
target.removeEventListener(eventName, this.boundHandler);
|
391 |
+
},
|
392 |
+
|
393 |
+
// EVENT CREATION AND TRACKING
|
394 |
+
/**
|
395 |
+
* Creates a new Event of type `inType`, based on the information in
|
396 |
+
* `inEvent`.
|
397 |
+
*
|
398 |
+
* @param {string} inType A string representing the type of event to create
|
399 |
+
* @param {Event} inEvent A platform event with a target
|
400 |
+
* @return {Event} A PointerEvent of type `inType`
|
401 |
+
*/
|
402 |
+
makeEvent: function(inType, inEvent) {
|
403 |
+
|
404 |
+
// relatedTarget must be null if pointer is captured
|
405 |
+
if (this.captureInfo[inEvent.pointerId]) {
|
406 |
+
inEvent.relatedTarget = null;
|
407 |
+
}
|
408 |
+
var e = new PointerEvent(inType, inEvent);
|
409 |
+
if (inEvent.preventDefault) {
|
410 |
+
e.preventDefault = inEvent.preventDefault;
|
411 |
+
}
|
412 |
+
e._target = e._target || inEvent.target;
|
413 |
+
return e;
|
414 |
+
},
|
415 |
+
|
416 |
+
// make and dispatch an event in one call
|
417 |
+
fireEvent: function(inType, inEvent) {
|
418 |
+
var e = this.makeEvent(inType, inEvent);
|
419 |
+
return this.dispatchEvent(e);
|
420 |
+
},
|
421 |
+
/**
|
422 |
+
* Returns a snapshot of inEvent, with writable properties.
|
423 |
+
*
|
424 |
+
* @param {Event} inEvent An event that contains properties to copy.
|
425 |
+
* @return {Object} An object containing shallow copies of `inEvent`'s
|
426 |
+
* properties.
|
427 |
+
*/
|
428 |
+
cloneEvent: function(inEvent) {
|
429 |
+
var eventCopy = Object.create(null);
|
430 |
+
var p;
|
431 |
+
for (var i = 0; i < CLONE_PROPS.length; i++) {
|
432 |
+
p = CLONE_PROPS[i];
|
433 |
+
eventCopy[p] = inEvent[p] || CLONE_DEFAULTS[i];
|
434 |
+
|
435 |
+
// Work around SVGInstanceElement shadow tree
|
436 |
+
// Return the <use> element that is represented by the instance for Safari, Chrome, IE.
|
437 |
+
// This is the behavior implemented by Firefox.
|
438 |
+
if (HAS_SVG_INSTANCE && (p === 'target' || p === 'relatedTarget')) {
|
439 |
+
if (eventCopy[p] instanceof SVGElementInstance) {
|
440 |
+
eventCopy[p] = eventCopy[p].correspondingUseElement;
|
441 |
+
}
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
// keep the semantics of preventDefault
|
446 |
+
if (inEvent.preventDefault) {
|
447 |
+
eventCopy.preventDefault = function() {
|
448 |
+
inEvent.preventDefault();
|
449 |
+
};
|
450 |
+
}
|
451 |
+
return eventCopy;
|
452 |
+
},
|
453 |
+
getTarget: function(inEvent) {
|
454 |
+
var capture = this.captureInfo[inEvent.pointerId];
|
455 |
+
if (!capture) {
|
456 |
+
return inEvent._target;
|
457 |
+
}
|
458 |
+
if (inEvent._target === capture || !(inEvent.type in BOUNDARY_EVENTS)) {
|
459 |
+
return capture;
|
460 |
+
}
|
461 |
+
},
|
462 |
+
propagate: function(event, fn, propagateDown) {
|
463 |
+
var target = event.target;
|
464 |
+
var targets = [];
|
465 |
+
|
466 |
+
// Order of conditions due to document.contains() missing in IE.
|
467 |
+
while (target !== document && !target.contains(event.relatedTarget)) {
|
468 |
+
targets.push(target);
|
469 |
+
target = target.parentNode;
|
470 |
+
|
471 |
+
// Touch: Do not propagate if node is detached.
|
472 |
+
if (!target) {
|
473 |
+
return;
|
474 |
+
}
|
475 |
+
}
|
476 |
+
if (propagateDown) {
|
477 |
+
targets.reverse();
|
478 |
+
}
|
479 |
+
targets.forEach(function(target) {
|
480 |
+
event.target = target;
|
481 |
+
fn.call(this, event);
|
482 |
+
}, this);
|
483 |
+
},
|
484 |
+
setCapture: function(inPointerId, inTarget, skipDispatch) {
|
485 |
+
if (this.captureInfo[inPointerId]) {
|
486 |
+
this.releaseCapture(inPointerId, skipDispatch);
|
487 |
+
}
|
488 |
+
|
489 |
+
this.captureInfo[inPointerId] = inTarget;
|
490 |
+
this.implicitRelease = this.releaseCapture.bind(this, inPointerId, skipDispatch);
|
491 |
+
document.addEventListener('pointerup', this.implicitRelease);
|
492 |
+
document.addEventListener('pointercancel', this.implicitRelease);
|
493 |
+
|
494 |
+
var e = new PointerEvent('gotpointercapture');
|
495 |
+
e.pointerId = inPointerId;
|
496 |
+
e._target = inTarget;
|
497 |
+
|
498 |
+
if (!skipDispatch) {
|
499 |
+
this.asyncDispatchEvent(e);
|
500 |
+
}
|
501 |
+
},
|
502 |
+
releaseCapture: function(inPointerId, skipDispatch) {
|
503 |
+
var t = this.captureInfo[inPointerId];
|
504 |
+
if (!t) {
|
505 |
+
return;
|
506 |
+
}
|
507 |
+
|
508 |
+
this.captureInfo[inPointerId] = undefined;
|
509 |
+
document.removeEventListener('pointerup', this.implicitRelease);
|
510 |
+
document.removeEventListener('pointercancel', this.implicitRelease);
|
511 |
+
|
512 |
+
var e = new PointerEvent('lostpointercapture');
|
513 |
+
e.pointerId = inPointerId;
|
514 |
+
e._target = t;
|
515 |
+
|
516 |
+
if (!skipDispatch) {
|
517 |
+
this.asyncDispatchEvent(e);
|
518 |
+
}
|
519 |
+
},
|
520 |
+
/**
|
521 |
+
* Dispatches the event to its target.
|
522 |
+
*
|
523 |
+
* @param {Event} inEvent The event to be dispatched.
|
524 |
+
* @return {Boolean} True if an event handler returns true, false otherwise.
|
525 |
+
*/
|
526 |
+
dispatchEvent: /*scope.external.dispatchEvent || */function(inEvent) {
|
527 |
+
var t = this.getTarget(inEvent);
|
528 |
+
if (t) {
|
529 |
+
return t.dispatchEvent(inEvent);
|
530 |
+
}
|
531 |
+
},
|
532 |
+
asyncDispatchEvent: function(inEvent) {
|
533 |
+
requestAnimationFrame(this.dispatchEvent.bind(this, inEvent));
|
534 |
+
}
|
535 |
+
};
|
536 |
+
dispatcher.boundHandler = dispatcher.eventHandler.bind(dispatcher);
|
537 |
+
|
538 |
+
var targeting = {
|
539 |
+
shadow: function(inEl) {
|
540 |
+
if (inEl) {
|
541 |
+
return inEl.shadowRoot || inEl.webkitShadowRoot;
|
542 |
+
}
|
543 |
+
},
|
544 |
+
canTarget: function(shadow) {
|
545 |
+
return shadow && Boolean(shadow.elementFromPoint);
|
546 |
+
},
|
547 |
+
targetingShadow: function(inEl) {
|
548 |
+
var s = this.shadow(inEl);
|
549 |
+
if (this.canTarget(s)) {
|
550 |
+
return s;
|
551 |
+
}
|
552 |
+
},
|
553 |
+
olderShadow: function(shadow) {
|
554 |
+
var os = shadow.olderShadowRoot;
|
555 |
+
if (!os) {
|
556 |
+
var se = shadow.querySelector('shadow');
|
557 |
+
if (se) {
|
558 |
+
os = se.olderShadowRoot;
|
559 |
+
}
|
560 |
+
}
|
561 |
+
return os;
|
562 |
+
},
|
563 |
+
allShadows: function(element) {
|
564 |
+
var shadows = [];
|
565 |
+
var s = this.shadow(element);
|
566 |
+
while (s) {
|
567 |
+
shadows.push(s);
|
568 |
+
s = this.olderShadow(s);
|
569 |
+
}
|
570 |
+
return shadows;
|
571 |
+
},
|
572 |
+
searchRoot: function(inRoot, x, y) {
|
573 |
+
if (inRoot) {
|
574 |
+
var t = inRoot.elementFromPoint(x, y);
|
575 |
+
var st, sr;
|
576 |
+
|
577 |
+
// is element a shadow host?
|
578 |
+
sr = this.targetingShadow(t);
|
579 |
+
while (sr) {
|
580 |
+
|
581 |
+
// find the the element inside the shadow root
|
582 |
+
st = sr.elementFromPoint(x, y);
|
583 |
+
if (!st) {
|
584 |
+
|
585 |
+
// check for older shadows
|
586 |
+
sr = this.olderShadow(sr);
|
587 |
+
} else {
|
588 |
+
|
589 |
+
// shadowed element may contain a shadow root
|
590 |
+
var ssr = this.targetingShadow(st);
|
591 |
+
return this.searchRoot(ssr, x, y) || st;
|
592 |
+
}
|
593 |
+
}
|
594 |
+
|
595 |
+
// light dom element is the target
|
596 |
+
return t;
|
597 |
+
}
|
598 |
+
},
|
599 |
+
owner: function(element) {
|
600 |
+
var s = element;
|
601 |
+
|
602 |
+
// walk up until you hit the shadow root or document
|
603 |
+
while (s.parentNode) {
|
604 |
+
s = s.parentNode;
|
605 |
+
}
|
606 |
+
|
607 |
+
// the owner element is expected to be a Document or ShadowRoot
|
608 |
+
if (s.nodeType !== Node.DOCUMENT_NODE && s.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
|
609 |
+
s = document;
|
610 |
+
}
|
611 |
+
return s;
|
612 |
+
},
|
613 |
+
findTarget: function(inEvent) {
|
614 |
+
var x = inEvent.clientX;
|
615 |
+
var y = inEvent.clientY;
|
616 |
+
|
617 |
+
// if the listener is in the shadow root, it is much faster to start there
|
618 |
+
var s = this.owner(inEvent.target);
|
619 |
+
|
620 |
+
// if x, y is not in this root, fall back to document search
|
621 |
+
if (!s.elementFromPoint(x, y)) {
|
622 |
+
s = document;
|
623 |
+
}
|
624 |
+
return this.searchRoot(s, x, y);
|
625 |
+
}
|
626 |
+
};
|
627 |
+
|
628 |
+
var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
|
629 |
+
var map = Array.prototype.map.call.bind(Array.prototype.map);
|
630 |
+
var toArray = Array.prototype.slice.call.bind(Array.prototype.slice);
|
631 |
+
var filter = Array.prototype.filter.call.bind(Array.prototype.filter);
|
632 |
+
var MO = window.MutationObserver || window.WebKitMutationObserver;
|
633 |
+
var SELECTOR = '[touch-action]';
|
634 |
+
var OBSERVER_INIT = {
|
635 |
+
subtree: true,
|
636 |
+
childList: true,
|
637 |
+
attributes: true,
|
638 |
+
attributeOldValue: true,
|
639 |
+
attributeFilter: ['touch-action']
|
640 |
+
};
|
641 |
+
|
642 |
+
function Installer(add, remove, changed, binder) {
|
643 |
+
this.addCallback = add.bind(binder);
|
644 |
+
this.removeCallback = remove.bind(binder);
|
645 |
+
this.changedCallback = changed.bind(binder);
|
646 |
+
if (MO) {
|
647 |
+
this.observer = new MO(this.mutationWatcher.bind(this));
|
648 |
+
}
|
649 |
+
}
|
650 |
+
|
651 |
+
Installer.prototype = {
|
652 |
+
watchSubtree: function(target) {
|
653 |
+
|
654 |
+
// Only watch scopes that can target find, as these are top-level.
|
655 |
+
// Otherwise we can see duplicate additions and removals that add noise.
|
656 |
+
//
|
657 |
+
// TODO(dfreedman): For some instances with ShadowDOMPolyfill, we can see
|
658 |
+
// a removal without an insertion when a node is redistributed among
|
659 |
+
// shadows. Since it all ends up correct in the document, watching only
|
660 |
+
// the document will yield the correct mutations to watch.
|
661 |
+
if (this.observer && targeting.canTarget(target)) {
|
662 |
+
this.observer.observe(target, OBSERVER_INIT);
|
663 |
+
}
|
664 |
+
},
|
665 |
+
enableOnSubtree: function(target) {
|
666 |
+
this.watchSubtree(target);
|
667 |
+
if (target === document && document.readyState !== 'complete') {
|
668 |
+
this.installOnLoad();
|
669 |
+
} else {
|
670 |
+
this.installNewSubtree(target);
|
671 |
+
}
|
672 |
+
},
|
673 |
+
installNewSubtree: function(target) {
|
674 |
+
forEach(this.findElements(target), this.addElement, this);
|
675 |
+
},
|
676 |
+
findElements: function(target) {
|
677 |
+
if (target.querySelectorAll) {
|
678 |
+
return target.querySelectorAll(SELECTOR);
|
679 |
+
}
|
680 |
+
return [];
|
681 |
+
},
|
682 |
+
removeElement: function(el) {
|
683 |
+
this.removeCallback(el);
|
684 |
+
},
|
685 |
+
addElement: function(el) {
|
686 |
+
this.addCallback(el);
|
687 |
+
},
|
688 |
+
elementChanged: function(el, oldValue) {
|
689 |
+
this.changedCallback(el, oldValue);
|
690 |
+
},
|
691 |
+
concatLists: function(accum, list) {
|
692 |
+
return accum.concat(toArray(list));
|
693 |
+
},
|
694 |
+
|
695 |
+
// register all touch-action = none nodes on document load
|
696 |
+
installOnLoad: function() {
|
697 |
+
document.addEventListener('readystatechange', function() {
|
698 |
+
if (document.readyState === 'complete') {
|
699 |
+
this.installNewSubtree(document);
|
700 |
+
}
|
701 |
+
}.bind(this));
|
702 |
+
},
|
703 |
+
isElement: function(n) {
|
704 |
+
return n.nodeType === Node.ELEMENT_NODE;
|
705 |
+
},
|
706 |
+
flattenMutationTree: function(inNodes) {
|
707 |
+
|
708 |
+
// find children with touch-action
|
709 |
+
var tree = map(inNodes, this.findElements, this);
|
710 |
+
|
711 |
+
// make sure the added nodes are accounted for
|
712 |
+
tree.push(filter(inNodes, this.isElement));
|
713 |
+
|
714 |
+
// flatten the list
|
715 |
+
return tree.reduce(this.concatLists, []);
|
716 |
+
},
|
717 |
+
mutationWatcher: function(mutations) {
|
718 |
+
mutations.forEach(this.mutationHandler, this);
|
719 |
+
},
|
720 |
+
mutationHandler: function(m) {
|
721 |
+
if (m.type === 'childList') {
|
722 |
+
var added = this.flattenMutationTree(m.addedNodes);
|
723 |
+
added.forEach(this.addElement, this);
|
724 |
+
var removed = this.flattenMutationTree(m.removedNodes);
|
725 |
+
removed.forEach(this.removeElement, this);
|
726 |
+
} else if (m.type === 'attributes') {
|
727 |
+
this.elementChanged(m.target, m.oldValue);
|
728 |
+
}
|
729 |
+
}
|
730 |
+
};
|
731 |
+
|
732 |
+
function shadowSelector(v) {
|
733 |
+
return 'body /shadow-deep/ ' + selector(v);
|
734 |
+
}
|
735 |
+
function selector(v) {
|
736 |
+
return '[touch-action="' + v + '"]';
|
737 |
+
}
|
738 |
+
function rule(v) {
|
739 |
+
return '{ -ms-touch-action: ' + v + '; touch-action: ' + v + '; }';
|
740 |
+
}
|
741 |
+
var attrib2css = [
|
742 |
+
'none',
|
743 |
+
'auto',
|
744 |
+
'pan-x',
|
745 |
+
'pan-y',
|
746 |
+
{
|
747 |
+
rule: 'pan-x pan-y',
|
748 |
+
selectors: [
|
749 |
+
'pan-x pan-y',
|
750 |
+
'pan-y pan-x'
|
751 |
+
]
|
752 |
+
}
|
753 |
+
];
|
754 |
+
var styles = '';
|
755 |
+
|
756 |
+
// only install stylesheet if the browser has touch action support
|
757 |
+
var hasNativePE = window.PointerEvent || window.MSPointerEvent;
|
758 |
+
|
759 |
+
// only add shadow selectors if shadowdom is supported
|
760 |
+
var hasShadowRoot = !window.ShadowDOMPolyfill && document.head.createShadowRoot;
|
761 |
+
|
762 |
+
function applyAttributeStyles() {
|
763 |
+
if (hasNativePE) {
|
764 |
+
attrib2css.forEach(function(r) {
|
765 |
+
if (String(r) === r) {
|
766 |
+
styles += selector(r) + rule(r) + '\n';
|
767 |
+
if (hasShadowRoot) {
|
768 |
+
styles += shadowSelector(r) + rule(r) + '\n';
|
769 |
+
}
|
770 |
+
} else {
|
771 |
+
styles += r.selectors.map(selector) + rule(r.rule) + '\n';
|
772 |
+
if (hasShadowRoot) {
|
773 |
+
styles += r.selectors.map(shadowSelector) + rule(r.rule) + '\n';
|
774 |
+
}
|
775 |
+
}
|
776 |
+
});
|
777 |
+
|
778 |
+
var el = document.createElement('style');
|
779 |
+
el.textContent = styles;
|
780 |
+
document.head.appendChild(el);
|
781 |
+
}
|
782 |
+
}
|
783 |
+
|
784 |
+
var pointermap = dispatcher.pointermap;
|
785 |
+
|
786 |
+
// radius around touchend that swallows mouse events
|
787 |
+
var DEDUP_DIST = 25;
|
788 |
+
|
789 |
+
// left, middle, right, back, forward
|
790 |
+
var BUTTON_TO_BUTTONS = [1, 4, 2, 8, 16];
|
791 |
+
|
792 |
+
var HAS_BUTTONS = false;
|
793 |
+
try {
|
794 |
+
HAS_BUTTONS = new MouseEvent('test', { buttons: 1 }).buttons === 1;
|
795 |
+
} catch (e) {}
|
796 |
+
|
797 |
+
// handler block for native mouse events
|
798 |
+
var mouseEvents = {
|
799 |
+
POINTER_ID: 1,
|
800 |
+
POINTER_TYPE: 'mouse',
|
801 |
+
events: [
|
802 |
+
'mousedown',
|
803 |
+
'mousemove',
|
804 |
+
'mouseup',
|
805 |
+
'mouseover',
|
806 |
+
'mouseout'
|
807 |
+
],
|
808 |
+
register: function(target) {
|
809 |
+
dispatcher.listen(target, this.events);
|
810 |
+
},
|
811 |
+
unregister: function(target) {
|
812 |
+
dispatcher.unlisten(target, this.events);
|
813 |
+
},
|
814 |
+
lastTouches: [],
|
815 |
+
|
816 |
+
// collide with the global mouse listener
|
817 |
+
isEventSimulatedFromTouch: function(inEvent) {
|
818 |
+
var lts = this.lastTouches;
|
819 |
+
var x = inEvent.clientX;
|
820 |
+
var y = inEvent.clientY;
|
821 |
+
for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
|
822 |
+
|
823 |
+
// simulated mouse events will be swallowed near a primary touchend
|
824 |
+
var dx = Math.abs(x - t.x);
|
825 |
+
var dy = Math.abs(y - t.y);
|
826 |
+
if (dx <= DEDUP_DIST && dy <= DEDUP_DIST) {
|
827 |
+
return true;
|
828 |
+
}
|
829 |
+
}
|
830 |
+
},
|
831 |
+
prepareEvent: function(inEvent) {
|
832 |
+
var e = dispatcher.cloneEvent(inEvent);
|
833 |
+
|
834 |
+
// forward mouse preventDefault
|
835 |
+
var pd = e.preventDefault;
|
836 |
+
e.preventDefault = function() {
|
837 |
+
inEvent.preventDefault();
|
838 |
+
pd();
|
839 |
+
};
|
840 |
+
e.pointerId = this.POINTER_ID;
|
841 |
+
e.isPrimary = true;
|
842 |
+
e.pointerType = this.POINTER_TYPE;
|
843 |
+
return e;
|
844 |
+
},
|
845 |
+
prepareButtonsForMove: function(e, inEvent) {
|
846 |
+
var p = pointermap.get(this.POINTER_ID);
|
847 |
+
|
848 |
+
// Update buttons state after possible out-of-document mouseup.
|
849 |
+
if (inEvent.which === 0 || !p) {
|
850 |
+
e.buttons = 0;
|
851 |
+
} else {
|
852 |
+
e.buttons = p.buttons;
|
853 |
+
}
|
854 |
+
inEvent.buttons = e.buttons;
|
855 |
+
},
|
856 |
+
mousedown: function(inEvent) {
|
857 |
+
if (!this.isEventSimulatedFromTouch(inEvent)) {
|
858 |
+
var p = pointermap.get(this.POINTER_ID);
|
859 |
+
var e = this.prepareEvent(inEvent);
|
860 |
+
if (!HAS_BUTTONS) {
|
861 |
+
e.buttons = BUTTON_TO_BUTTONS[e.button];
|
862 |
+
if (p) { e.buttons |= p.buttons; }
|
863 |
+
inEvent.buttons = e.buttons;
|
864 |
+
}
|
865 |
+
pointermap.set(this.POINTER_ID, inEvent);
|
866 |
+
if (!p || p.buttons === 0) {
|
867 |
+
dispatcher.down(e);
|
868 |
+
} else {
|
869 |
+
dispatcher.move(e);
|
870 |
+
}
|
871 |
+
}
|
872 |
+
},
|
873 |
+
mousemove: function(inEvent) {
|
874 |
+
if (!this.isEventSimulatedFromTouch(inEvent)) {
|
875 |
+
var e = this.prepareEvent(inEvent);
|
876 |
+
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
|
877 |
+
e.button = -1;
|
878 |
+
pointermap.set(this.POINTER_ID, inEvent);
|
879 |
+
dispatcher.move(e);
|
880 |
+
}
|
881 |
+
},
|
882 |
+
mouseup: function(inEvent) {
|
883 |
+
if (!this.isEventSimulatedFromTouch(inEvent)) {
|
884 |
+
var p = pointermap.get(this.POINTER_ID);
|
885 |
+
var e = this.prepareEvent(inEvent);
|
886 |
+
if (!HAS_BUTTONS) {
|
887 |
+
var up = BUTTON_TO_BUTTONS[e.button];
|
888 |
+
|
889 |
+
// Produces wrong state of buttons in Browsers without `buttons` support
|
890 |
+
// when a mouse button that was pressed outside the document is released
|
891 |
+
// inside and other buttons are still pressed down.
|
892 |
+
e.buttons = p ? p.buttons & ~up : 0;
|
893 |
+
inEvent.buttons = e.buttons;
|
894 |
+
}
|
895 |
+
pointermap.set(this.POINTER_ID, inEvent);
|
896 |
+
|
897 |
+
// Support: Firefox <=44 only
|
898 |
+
// FF Ubuntu includes the lifted button in the `buttons` property on
|
899 |
+
// mouseup.
|
900 |
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1223366
|
901 |
+
e.buttons &= ~BUTTON_TO_BUTTONS[e.button];
|
902 |
+
if (e.buttons === 0) {
|
903 |
+
dispatcher.up(e);
|
904 |
+
} else {
|
905 |
+
dispatcher.move(e);
|
906 |
+
}
|
907 |
+
}
|
908 |
+
},
|
909 |
+
mouseover: function(inEvent) {
|
910 |
+
if (!this.isEventSimulatedFromTouch(inEvent)) {
|
911 |
+
var e = this.prepareEvent(inEvent);
|
912 |
+
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
|
913 |
+
e.button = -1;
|
914 |
+
pointermap.set(this.POINTER_ID, inEvent);
|
915 |
+
dispatcher.enterOver(e);
|
916 |
+
}
|
917 |
+
},
|
918 |
+
mouseout: function(inEvent) {
|
919 |
+
if (!this.isEventSimulatedFromTouch(inEvent)) {
|
920 |
+
var e = this.prepareEvent(inEvent);
|
921 |
+
if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
|
922 |
+
e.button = -1;
|
923 |
+
dispatcher.leaveOut(e);
|
924 |
+
}
|
925 |
+
},
|
926 |
+
cancel: function(inEvent) {
|
927 |
+
var e = this.prepareEvent(inEvent);
|
928 |
+
dispatcher.cancel(e);
|
929 |
+
this.deactivateMouse();
|
930 |
+
},
|
931 |
+
deactivateMouse: function() {
|
932 |
+
pointermap.delete(this.POINTER_ID);
|
933 |
+
}
|
934 |
+
};
|
935 |
+
|
936 |
+
var captureInfo = dispatcher.captureInfo;
|
937 |
+
var findTarget = targeting.findTarget.bind(targeting);
|
938 |
+
var allShadows = targeting.allShadows.bind(targeting);
|
939 |
+
var pointermap$1 = dispatcher.pointermap;
|
940 |
+
|
941 |
+
// This should be long enough to ignore compat mouse events made by touch
|
942 |
+
var DEDUP_TIMEOUT = 2500;
|
943 |
+
var CLICK_COUNT_TIMEOUT = 200;
|
944 |
+
var ATTRIB = 'touch-action';
|
945 |
+
var INSTALLER;
|
946 |
+
|
947 |
+
// handler block for native touch events
|
948 |
+
var touchEvents = {
|
949 |
+
events: [
|
950 |
+
'touchstart',
|
951 |
+
'touchmove',
|
952 |
+
'touchend',
|
953 |
+
'touchcancel'
|
954 |
+
],
|
955 |
+
register: function(target) {
|
956 |
+
INSTALLER.enableOnSubtree(target);
|
957 |
+
},
|
958 |
+
unregister: function() {
|
959 |
+
|
960 |
+
// TODO(dfreedman): is it worth it to disconnect the MO?
|
961 |
+
},
|
962 |
+
elementAdded: function(el) {
|
963 |
+
var a = el.getAttribute(ATTRIB);
|
964 |
+
var st = this.touchActionToScrollType(a);
|
965 |
+
if (st) {
|
966 |
+
el._scrollType = st;
|
967 |
+
dispatcher.listen(el, this.events);
|
968 |
+
|
969 |
+
// set touch-action on shadows as well
|
970 |
+
allShadows(el).forEach(function(s) {
|
971 |
+
s._scrollType = st;
|
972 |
+
dispatcher.listen(s, this.events);
|
973 |
+
}, this);
|
974 |
+
}
|
975 |
+
},
|
976 |
+
elementRemoved: function(el) {
|
977 |
+
el._scrollType = undefined;
|
978 |
+
dispatcher.unlisten(el, this.events);
|
979 |
+
|
980 |
+
// remove touch-action from shadow
|
981 |
+
allShadows(el).forEach(function(s) {
|
982 |
+
s._scrollType = undefined;
|
983 |
+
dispatcher.unlisten(s, this.events);
|
984 |
+
}, this);
|
985 |
+
},
|
986 |
+
elementChanged: function(el, oldValue) {
|
987 |
+
var a = el.getAttribute(ATTRIB);
|
988 |
+
var st = this.touchActionToScrollType(a);
|
989 |
+
var oldSt = this.touchActionToScrollType(oldValue);
|
990 |
+
|
991 |
+
// simply update scrollType if listeners are already established
|
992 |
+
if (st && oldSt) {
|
993 |
+
el._scrollType = st;
|
994 |
+
allShadows(el).forEach(function(s) {
|
995 |
+
s._scrollType = st;
|
996 |
+
}, this);
|
997 |
+
} else if (oldSt) {
|
998 |
+
this.elementRemoved(el);
|
999 |
+
} else if (st) {
|
1000 |
+
this.elementAdded(el);
|
1001 |
+
}
|
1002 |
+
},
|
1003 |
+
scrollTypes: {
|
1004 |
+
EMITTER: 'none',
|
1005 |
+
XSCROLLER: 'pan-x',
|
1006 |
+
YSCROLLER: 'pan-y',
|
1007 |
+
SCROLLER: /^(?:pan-x pan-y)|(?:pan-y pan-x)|auto$/
|
1008 |
+
},
|
1009 |
+
touchActionToScrollType: function(touchAction) {
|
1010 |
+
var t = touchAction;
|
1011 |
+
var st = this.scrollTypes;
|
1012 |
+
if (t === 'none') {
|
1013 |
+
return 'none';
|
1014 |
+
} else if (t === st.XSCROLLER) {
|
1015 |
+
return 'X';
|
1016 |
+
} else if (t === st.YSCROLLER) {
|
1017 |
+
return 'Y';
|
1018 |
+
} else if (st.SCROLLER.exec(t)) {
|
1019 |
+
return 'XY';
|
1020 |
+
}
|
1021 |
+
},
|
1022 |
+
POINTER_TYPE: 'touch',
|
1023 |
+
firstTouch: null,
|
1024 |
+
isPrimaryTouch: function(inTouch) {
|
1025 |
+
return this.firstTouch === inTouch.identifier;
|
1026 |
+
},
|
1027 |
+
setPrimaryTouch: function(inTouch) {
|
1028 |
+
|
1029 |
+
// set primary touch if there no pointers, or the only pointer is the mouse
|
1030 |
+
if (pointermap$1.size === 0 || (pointermap$1.size === 1 && pointermap$1.has(1))) {
|
1031 |
+
this.firstTouch = inTouch.identifier;
|
1032 |
+
this.firstXY = { X: inTouch.clientX, Y: inTouch.clientY };
|
1033 |
+
this.scrolling = false;
|
1034 |
+
this.cancelResetClickCount();
|
1035 |
+
}
|
1036 |
+
},
|
1037 |
+
removePrimaryPointer: function(inPointer) {
|
1038 |
+
if (inPointer.isPrimary) {
|
1039 |
+
this.firstTouch = null;
|
1040 |
+
this.firstXY = null;
|
1041 |
+
this.resetClickCount();
|
1042 |
+
}
|
1043 |
+
},
|
1044 |
+
clickCount: 0,
|
1045 |
+
resetId: null,
|
1046 |
+
resetClickCount: function() {
|
1047 |
+
var fn = function() {
|
1048 |
+
this.clickCount = 0;
|
1049 |
+
this.resetId = null;
|
1050 |
+
}.bind(this);
|
1051 |
+
this.resetId = setTimeout(fn, CLICK_COUNT_TIMEOUT);
|
1052 |
+
},
|
1053 |
+
cancelResetClickCount: function() {
|
1054 |
+
if (this.resetId) {
|
1055 |
+
clearTimeout(this.resetId);
|
1056 |
+
}
|
1057 |
+
},
|
1058 |
+
typeToButtons: function(type) {
|
1059 |
+
var ret = 0;
|
1060 |
+
if (type === 'touchstart' || type === 'touchmove') {
|
1061 |
+
ret = 1;
|
1062 |
+
}
|
1063 |
+
return ret;
|
1064 |
+
},
|
1065 |
+
touchToPointer: function(inTouch) {
|
1066 |
+
var cte = this.currentTouchEvent;
|
1067 |
+
var e = dispatcher.cloneEvent(inTouch);
|
1068 |
+
|
1069 |
+
// We reserve pointerId 1 for Mouse.
|
1070 |
+
// Touch identifiers can start at 0.
|
1071 |
+
// Add 2 to the touch identifier for compatibility.
|
1072 |
+
var id = e.pointerId = inTouch.identifier + 2;
|
1073 |
+
e.target = captureInfo[id] || findTarget(e);
|
1074 |
+
e.bubbles = true;
|
1075 |
+
e.cancelable = true;
|
1076 |
+
e.detail = this.clickCount;
|
1077 |
+
e.button = 0;
|
1078 |
+
e.buttons = this.typeToButtons(cte.type);
|
1079 |
+
e.width = (inTouch.radiusX || inTouch.webkitRadiusX || 0) * 2;
|
1080 |
+
e.height = (inTouch.radiusY || inTouch.webkitRadiusY || 0) * 2;
|
1081 |
+
e.pressure = inTouch.force || inTouch.webkitForce || 0.5;
|
1082 |
+
e.isPrimary = this.isPrimaryTouch(inTouch);
|
1083 |
+
e.pointerType = this.POINTER_TYPE;
|
1084 |
+
|
1085 |
+
// forward modifier keys
|
1086 |
+
e.altKey = cte.altKey;
|
1087 |
+
e.ctrlKey = cte.ctrlKey;
|
1088 |
+
e.metaKey = cte.metaKey;
|
1089 |
+
e.shiftKey = cte.shiftKey;
|
1090 |
+
|
1091 |
+
// forward touch preventDefaults
|
1092 |
+
var self = this;
|
1093 |
+
e.preventDefault = function() {
|
1094 |
+
self.scrolling = false;
|
1095 |
+
self.firstXY = null;
|
1096 |
+
cte.preventDefault();
|
1097 |
+
};
|
1098 |
+
return e;
|
1099 |
+
},
|
1100 |
+
processTouches: function(inEvent, inFunction) {
|
1101 |
+
var tl = inEvent.changedTouches;
|
1102 |
+
this.currentTouchEvent = inEvent;
|
1103 |
+
for (var i = 0, t; i < tl.length; i++) {
|
1104 |
+
t = tl[i];
|
1105 |
+
inFunction.call(this, this.touchToPointer(t));
|
1106 |
+
}
|
1107 |
+
},
|
1108 |
+
|
1109 |
+
// For single axis scrollers, determines whether the element should emit
|
1110 |
+
// pointer events or behave as a scroller
|
1111 |
+
shouldScroll: function(inEvent) {
|
1112 |
+
if (this.firstXY) {
|
1113 |
+
var ret;
|
1114 |
+
var scrollAxis = inEvent.currentTarget._scrollType;
|
1115 |
+
if (scrollAxis === 'none') {
|
1116 |
+
|
1117 |
+
// this element is a touch-action: none, should never scroll
|
1118 |
+
ret = false;
|
1119 |
+
} else if (scrollAxis === 'XY') {
|
1120 |
+
|
1121 |
+
// this element should always scroll
|
1122 |
+
ret = true;
|
1123 |
+
} else {
|
1124 |
+
var t = inEvent.changedTouches[0];
|
1125 |
+
|
1126 |
+
// check the intended scroll axis, and other axis
|
1127 |
+
var a = scrollAxis;
|
1128 |
+
var oa = scrollAxis === 'Y' ? 'X' : 'Y';
|
1129 |
+
var da = Math.abs(t['client' + a] - this.firstXY[a]);
|
1130 |
+
var doa = Math.abs(t['client' + oa] - this.firstXY[oa]);
|
1131 |
+
|
1132 |
+
// if delta in the scroll axis > delta other axis, scroll instead of
|
1133 |
+
// making events
|
1134 |
+
ret = da >= doa;
|
1135 |
+
}
|
1136 |
+
this.firstXY = null;
|
1137 |
+
return ret;
|
1138 |
+
}
|
1139 |
+
},
|
1140 |
+
findTouch: function(inTL, inId) {
|
1141 |
+
for (var i = 0, l = inTL.length, t; i < l && (t = inTL[i]); i++) {
|
1142 |
+
if (t.identifier === inId) {
|
1143 |
+
return true;
|
1144 |
+
}
|
1145 |
+
}
|
1146 |
+
},
|
1147 |
+
|
1148 |
+
// In some instances, a touchstart can happen without a touchend. This
|
1149 |
+
// leaves the pointermap in a broken state.
|
1150 |
+
// Therefore, on every touchstart, we remove the touches that did not fire a
|
1151 |
+
// touchend event.
|
1152 |
+
// To keep state globally consistent, we fire a
|
1153 |
+
// pointercancel for this "abandoned" touch
|
1154 |
+
vacuumTouches: function(inEvent) {
|
1155 |
+
var tl = inEvent.touches;
|
1156 |
+
|
1157 |
+
// pointermap.size should be < tl.length here, as the touchstart has not
|
1158 |
+
// been processed yet.
|
1159 |
+
if (pointermap$1.size >= tl.length) {
|
1160 |
+
var d = [];
|
1161 |
+
pointermap$1.forEach(function(value, key) {
|
1162 |
+
|
1163 |
+
// Never remove pointerId == 1, which is mouse.
|
1164 |
+
// Touch identifiers are 2 smaller than their pointerId, which is the
|
1165 |
+
// index in pointermap.
|
1166 |
+
if (key !== 1 && !this.findTouch(tl, key - 2)) {
|
1167 |
+
var p = value.out;
|
1168 |
+
d.push(p);
|
1169 |
+
}
|
1170 |
+
}, this);
|
1171 |
+
d.forEach(this.cancelOut, this);
|
1172 |
+
}
|
1173 |
+
},
|
1174 |
+
touchstart: function(inEvent) {
|
1175 |
+
this.vacuumTouches(inEvent);
|
1176 |
+
this.setPrimaryTouch(inEvent.changedTouches[0]);
|
1177 |
+
this.dedupSynthMouse(inEvent);
|
1178 |
+
if (!this.scrolling) {
|
1179 |
+
this.clickCount++;
|
1180 |
+
this.processTouches(inEvent, this.overDown);
|
1181 |
+
}
|
1182 |
+
},
|
1183 |
+
overDown: function(inPointer) {
|
1184 |
+
pointermap$1.set(inPointer.pointerId, {
|
1185 |
+
target: inPointer.target,
|
1186 |
+
out: inPointer,
|
1187 |
+
outTarget: inPointer.target
|
1188 |
+
});
|
1189 |
+
dispatcher.enterOver(inPointer);
|
1190 |
+
dispatcher.down(inPointer);
|
1191 |
+
},
|
1192 |
+
touchmove: function(inEvent) {
|
1193 |
+
if (!this.scrolling) {
|
1194 |
+
if (this.shouldScroll(inEvent)) {
|
1195 |
+
this.scrolling = true;
|
1196 |
+
this.touchcancel(inEvent);
|
1197 |
+
} else {
|
1198 |
+
inEvent.preventDefault();
|
1199 |
+
this.processTouches(inEvent, this.moveOverOut);
|
1200 |
+
}
|
1201 |
+
}
|
1202 |
+
},
|
1203 |
+
moveOverOut: function(inPointer) {
|
1204 |
+
var event = inPointer;
|
1205 |
+
var pointer = pointermap$1.get(event.pointerId);
|
1206 |
+
|
1207 |
+
// a finger drifted off the screen, ignore it
|
1208 |
+
if (!pointer) {
|
1209 |
+
return;
|
1210 |
+
}
|
1211 |
+
var outEvent = pointer.out;
|
1212 |
+
var outTarget = pointer.outTarget;
|
1213 |
+
dispatcher.move(event);
|
1214 |
+
if (outEvent && outTarget !== event.target) {
|
1215 |
+
outEvent.relatedTarget = event.target;
|
1216 |
+
event.relatedTarget = outTarget;
|
1217 |
+
|
1218 |
+
// recover from retargeting by shadow
|
1219 |
+
outEvent.target = outTarget;
|
1220 |
+
if (event.target) {
|
1221 |
+
dispatcher.leaveOut(outEvent);
|
1222 |
+
dispatcher.enterOver(event);
|
1223 |
+
} else {
|
1224 |
+
|
1225 |
+
// clean up case when finger leaves the screen
|
1226 |
+
event.target = outTarget;
|
1227 |
+
event.relatedTarget = null;
|
1228 |
+
this.cancelOut(event);
|
1229 |
+
}
|
1230 |
+
}
|
1231 |
+
pointer.out = event;
|
1232 |
+
pointer.outTarget = event.target;
|
1233 |
+
},
|
1234 |
+
touchend: function(inEvent) {
|
1235 |
+
this.dedupSynthMouse(inEvent);
|
1236 |
+
this.processTouches(inEvent, this.upOut);
|
1237 |
+
},
|
1238 |
+
upOut: function(inPointer) {
|
1239 |
+
if (!this.scrolling) {
|
1240 |
+
dispatcher.up(inPointer);
|
1241 |
+
dispatcher.leaveOut(inPointer);
|
1242 |
+
}
|
1243 |
+
this.cleanUpPointer(inPointer);
|
1244 |
+
},
|
1245 |
+
touchcancel: function(inEvent) {
|
1246 |
+
this.processTouches(inEvent, this.cancelOut);
|
1247 |
+
},
|
1248 |
+
cancelOut: function(inPointer) {
|
1249 |
+
dispatcher.cancel(inPointer);
|
1250 |
+
dispatcher.leaveOut(inPointer);
|
1251 |
+
this.cleanUpPointer(inPointer);
|
1252 |
+
},
|
1253 |
+
cleanUpPointer: function(inPointer) {
|
1254 |
+
pointermap$1.delete(inPointer.pointerId);
|
1255 |
+
this.removePrimaryPointer(inPointer);
|
1256 |
+
},
|
1257 |
+
|
1258 |
+
// prevent synth mouse events from creating pointer events
|
1259 |
+
dedupSynthMouse: function(inEvent) {
|
1260 |
+
var lts = mouseEvents.lastTouches;
|
1261 |
+
var t = inEvent.changedTouches[0];
|
1262 |
+
|
1263 |
+
// only the primary finger will synth mouse events
|
1264 |
+
if (this.isPrimaryTouch(t)) {
|
1265 |
+
|
1266 |
+
// remember x/y of last touch
|
1267 |
+
var lt = { x: t.clientX, y: t.clientY };
|
1268 |
+
lts.push(lt);
|
1269 |
+
var fn = (function(lts, lt) {
|
1270 |
+
var i = lts.indexOf(lt);
|
1271 |
+
if (i > -1) {
|
1272 |
+
lts.splice(i, 1);
|
1273 |
+
}
|
1274 |
+
}).bind(null, lts, lt);
|
1275 |
+
setTimeout(fn, DEDUP_TIMEOUT);
|
1276 |
+
}
|
1277 |
+
}
|
1278 |
+
};
|
1279 |
+
|
1280 |
+
INSTALLER = new Installer(touchEvents.elementAdded, touchEvents.elementRemoved,
|
1281 |
+
touchEvents.elementChanged, touchEvents);
|
1282 |
+
|
1283 |
+
var pointermap$2 = dispatcher.pointermap;
|
1284 |
+
var HAS_BITMAP_TYPE = window.MSPointerEvent &&
|
1285 |
+
typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE === 'number';
|
1286 |
+
var msEvents = {
|
1287 |
+
events: [
|
1288 |
+
'MSPointerDown',
|
1289 |
+
'MSPointerMove',
|
1290 |
+
'MSPointerUp',
|
1291 |
+
'MSPointerOut',
|
1292 |
+
'MSPointerOver',
|
1293 |
+
'MSPointerCancel',
|
1294 |
+
'MSGotPointerCapture',
|
1295 |
+
'MSLostPointerCapture'
|
1296 |
+
],
|
1297 |
+
register: function(target) {
|
1298 |
+
dispatcher.listen(target, this.events);
|
1299 |
+
},
|
1300 |
+
unregister: function(target) {
|
1301 |
+
dispatcher.unlisten(target, this.events);
|
1302 |
+
},
|
1303 |
+
POINTER_TYPES: [
|
1304 |
+
'',
|
1305 |
+
'unavailable',
|
1306 |
+
'touch',
|
1307 |
+
'pen',
|
1308 |
+
'mouse'
|
1309 |
+
],
|
1310 |
+
prepareEvent: function(inEvent) {
|
1311 |
+
var e = inEvent;
|
1312 |
+
if (HAS_BITMAP_TYPE) {
|
1313 |
+
e = dispatcher.cloneEvent(inEvent);
|
1314 |
+
e.pointerType = this.POINTER_TYPES[inEvent.pointerType];
|
1315 |
+
}
|
1316 |
+
return e;
|
1317 |
+
},
|
1318 |
+
cleanup: function(id) {
|
1319 |
+
pointermap$2.delete(id);
|
1320 |
+
},
|
1321 |
+
MSPointerDown: function(inEvent) {
|
1322 |
+
pointermap$2.set(inEvent.pointerId, inEvent);
|
1323 |
+
var e = this.prepareEvent(inEvent);
|
1324 |
+
dispatcher.down(e);
|
1325 |
+
},
|
1326 |
+
MSPointerMove: function(inEvent) {
|
1327 |
+
var e = this.prepareEvent(inEvent);
|
1328 |
+
dispatcher.move(e);
|
1329 |
+
},
|
1330 |
+
MSPointerUp: function(inEvent) {
|
1331 |
+
var e = this.prepareEvent(inEvent);
|
1332 |
+
dispatcher.up(e);
|
1333 |
+
this.cleanup(inEvent.pointerId);
|
1334 |
+
},
|
1335 |
+
MSPointerOut: function(inEvent) {
|
1336 |
+
var e = this.prepareEvent(inEvent);
|
1337 |
+
dispatcher.leaveOut(e);
|
1338 |
+
},
|
1339 |
+
MSPointerOver: function(inEvent) {
|
1340 |
+
var e = this.prepareEvent(inEvent);
|
1341 |
+
dispatcher.enterOver(e);
|
1342 |
+
},
|
1343 |
+
MSPointerCancel: function(inEvent) {
|
1344 |
+
var e = this.prepareEvent(inEvent);
|
1345 |
+
dispatcher.cancel(e);
|
1346 |
+
this.cleanup(inEvent.pointerId);
|
1347 |
+
},
|
1348 |
+
MSLostPointerCapture: function(inEvent) {
|
1349 |
+
var e = dispatcher.makeEvent('lostpointercapture', inEvent);
|
1350 |
+
dispatcher.dispatchEvent(e);
|
1351 |
+
},
|
1352 |
+
MSGotPointerCapture: function(inEvent) {
|
1353 |
+
var e = dispatcher.makeEvent('gotpointercapture', inEvent);
|
1354 |
+
dispatcher.dispatchEvent(e);
|
1355 |
+
}
|
1356 |
+
};
|
1357 |
+
|
1358 |
+
function applyPolyfill() {
|
1359 |
+
|
1360 |
+
// only activate if this platform does not have pointer events
|
1361 |
+
if (!window.PointerEvent) {
|
1362 |
+
window.PointerEvent = PointerEvent;
|
1363 |
+
|
1364 |
+
if (window.navigator.msPointerEnabled) {
|
1365 |
+
var tp = window.navigator.msMaxTouchPoints;
|
1366 |
+
Object.defineProperty(window.navigator, 'maxTouchPoints', {
|
1367 |
+
value: tp,
|
1368 |
+
enumerable: true
|
1369 |
+
});
|
1370 |
+
dispatcher.registerSource('ms', msEvents);
|
1371 |
+
} else {
|
1372 |
+
Object.defineProperty(window.navigator, 'maxTouchPoints', {
|
1373 |
+
value: 0,
|
1374 |
+
enumerable: true
|
1375 |
+
});
|
1376 |
+
dispatcher.registerSource('mouse', mouseEvents);
|
1377 |
+
if (window.ontouchstart !== undefined) {
|
1378 |
+
dispatcher.registerSource('touch', touchEvents);
|
1379 |
+
}
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
dispatcher.register(document);
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
var n = window.navigator;
|
1387 |
+
var s;
|
1388 |
+
var r;
|
1389 |
+
var h;
|
1390 |
+
function assertActive(id) {
|
1391 |
+
if (!dispatcher.pointermap.has(id)) {
|
1392 |
+
var error = new Error('InvalidPointerId');
|
1393 |
+
error.name = 'InvalidPointerId';
|
1394 |
+
throw error;
|
1395 |
+
}
|
1396 |
+
}
|
1397 |
+
function assertConnected(elem) {
|
1398 |
+
var parent = elem.parentNode;
|
1399 |
+
while (parent && parent !== elem.ownerDocument) {
|
1400 |
+
parent = parent.parentNode;
|
1401 |
+
}
|
1402 |
+
if (!parent) {
|
1403 |
+
var error = new Error('InvalidStateError');
|
1404 |
+
error.name = 'InvalidStateError';
|
1405 |
+
throw error;
|
1406 |
+
}
|
1407 |
+
}
|
1408 |
+
function inActiveButtonState(id) {
|
1409 |
+
var p = dispatcher.pointermap.get(id);
|
1410 |
+
return p.buttons !== 0;
|
1411 |
+
}
|
1412 |
+
if (n.msPointerEnabled) {
|
1413 |
+
s = function(pointerId) {
|
1414 |
+
assertActive(pointerId);
|
1415 |
+
assertConnected(this);
|
1416 |
+
if (inActiveButtonState(pointerId)) {
|
1417 |
+
dispatcher.setCapture(pointerId, this, true);
|
1418 |
+
this.msSetPointerCapture(pointerId);
|
1419 |
+
}
|
1420 |
+
};
|
1421 |
+
r = function(pointerId) {
|
1422 |
+
assertActive(pointerId);
|
1423 |
+
dispatcher.releaseCapture(pointerId, true);
|
1424 |
+
this.msReleasePointerCapture(pointerId);
|
1425 |
+
};
|
1426 |
+
} else {
|
1427 |
+
s = function setPointerCapture(pointerId) {
|
1428 |
+
assertActive(pointerId);
|
1429 |
+
assertConnected(this);
|
1430 |
+
if (inActiveButtonState(pointerId)) {
|
1431 |
+
dispatcher.setCapture(pointerId, this);
|
1432 |
+
}
|
1433 |
+
};
|
1434 |
+
r = function releasePointerCapture(pointerId) {
|
1435 |
+
assertActive(pointerId);
|
1436 |
+
dispatcher.releaseCapture(pointerId);
|
1437 |
+
};
|
1438 |
+
}
|
1439 |
+
h = function hasPointerCapture(pointerId) {
|
1440 |
+
return !!dispatcher.captureInfo[pointerId];
|
1441 |
+
};
|
1442 |
+
|
1443 |
+
function applyPolyfill$1() {
|
1444 |
+
if (window.Element && !Element.prototype.setPointerCapture) {
|
1445 |
+
Object.defineProperties(Element.prototype, {
|
1446 |
+
'setPointerCapture': {
|
1447 |
+
value: s
|
1448 |
+
},
|
1449 |
+
'releasePointerCapture': {
|
1450 |
+
value: r
|
1451 |
+
},
|
1452 |
+
'hasPointerCapture': {
|
1453 |
+
value: h
|
1454 |
+
}
|
1455 |
+
});
|
1456 |
+
}
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
applyAttributeStyles();
|
1460 |
+
applyPolyfill();
|
1461 |
+
applyPolyfill$1();
|
1462 |
+
|
1463 |
+
var pointerevents = {
|
1464 |
+
dispatcher: dispatcher,
|
1465 |
+
Installer: Installer,
|
1466 |
+
PointerEvent: PointerEvent,
|
1467 |
+
PointerMap: PointerMap,
|
1468 |
+
targetFinding: targeting
|
1469 |
+
};
|
1470 |
+
|
1471 |
+
return pointerevents;
|
1472 |
+
|
1473 |
+
}));
|
readme.txt
CHANGED
@@ -210,6 +210,14 @@ Please update your WP Google Maps version to 6.3.15 to ensure you are using the
|
|
210 |
|
211 |
== Changelog ==
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
= 8.1.7 - 2021-01-26 =
|
214 |
* Fixed issue where you could not disable FontAwesome from loading on the frontend
|
215 |
* Fixed issue where FontAwesome V4 would be loaded when V5 should have been loaded
|
@@ -1607,6 +1615,7 @@ For more, please view the WP Google Maps site
|
|
1607 |
|
1608 |
|
1609 |
|
|
|
1610 |
|
1611 |
|
1612 |
|
210 |
|
211 |
== Changelog ==
|
212 |
|
213 |
+
= 8.1.8 - 2021-02-01 =
|
214 |
+
* Fixed an issue where OpenLayers Tile Server Key field would not be visible without the Pro add-on
|
215 |
+
* Fixed an issue where OpenLayers would not allow click event bubbling for features
|
216 |
+
* Fixed an issue with marker storage logic that would prevent the Pro add-on from removing gallery images
|
217 |
+
* Fixed an issue where the store locator would scroll to the map element, even when modern locator style is active
|
218 |
+
* Fixed an issue with the onApproveMarker event trigger in the marker panel
|
219 |
+
* Added pep.js to the dependencies of the plugin to support pointer events on iOS 12 devices
|
220 |
+
|
221 |
= 8.1.7 - 2021-01-26 =
|
222 |
* Fixed issue where you could not disable FontAwesome from loading on the frontend
|
223 |
* Fixed issue where FontAwesome V4 would be loaded when V5 should have been loaded
|
1615 |
|
1616 |
|
1617 |
|
1618 |
+
|
1619 |
|
1620 |
|
1621 |
|
wpGoogleMaps.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: https://www.wpgmaps.com
|
5 |
Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
-
Version: 8.1.
|
7 |
Author: WP Google Maps
|
8 |
Author URI: https://www.wpgmaps.com
|
9 |
Text Domain: wp-google-maps
|
@@ -12,6 +12,14 @@ Domain Path: /languages
|
|
12 |
|
13 |
|
14 |
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
* 8.1.7 - 2021-01-26
|
16 |
* Fixed issue where you could not disable FontAwesome from loading on the frontend
|
17 |
* Fixed issue where FontAwesome V4 would be loaded when V5 should have been loaded
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: https://www.wpgmaps.com
|
5 |
Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
+
Version: 8.1.8
|
7 |
Author: WP Google Maps
|
8 |
Author URI: https://www.wpgmaps.com
|
9 |
Text Domain: wp-google-maps
|
12 |
|
13 |
|
14 |
/*
|
15 |
+
* 8.1.8 - 2021-02-01
|
16 |
+
* Fixed an issue where OpenLayers Tile Server Key field would not be visible without the Pro add-on
|
17 |
+
* Fixed an issue where OpenLayers would not allow click event bubbling for features
|
18 |
+
* Fixed an issue with marker storage logic that would prevent the Pro add-on from removing gallery images
|
19 |
+
* Fixed an issue where the store locator would scroll to the map element, even when modern locator style is active
|
20 |
+
* Fixed an issue with the onApproveMarker event trigger in the marker panel
|
21 |
+
* Added pep.js to the dependencies of the plugin to support pointer events on iOS 12 devices
|
22 |
+
*
|
23 |
* 8.1.7 - 2021-01-26
|
24 |
* Fixed issue where you could not disable FontAwesome from loading on the frontend
|
25 |
* Fixed issue where FontAwesome V4 would be loaded when V5 should have been loaded
|