WP Google Maps - Version 8.0.26

Version Description

Please update to 8.0.26 or above to ensure you are using the latest security enhancements.

Download this release

Release Info

Developer WPGMaps
Plugin Icon 128x128 WP Google Maps
Version 8.0.26
Comparing to
See all releases

Code changes from version 8.0.25 to 8.0.26

css/wp-google-maps-admin.css CHANGED
@@ -1262,7 +1262,6 @@ body[class*="wp-google-maps"] .ui-slider-handle:hover {
1262
 
1263
  body[class*="wp-google-maps"] input[type="text"],
1264
  body[class*="wp-google-maps"] select {
1265
- padding: 6px 8px;
1266
  box-shadow: none;
1267
  border: 1px solid #ccc;
1268
  border-radius: 2px;
@@ -1814,7 +1813,7 @@ input[type="date"],
1814
  input:not([type="checkbox"]):not([type="radio"]){
1815
  border: 1px solid #ddd;
1816
  box-shadow: none;
1817
- padding: 4px 9px;
1818
  border-radius: 2px;
1819
  transition: border-color .12s ease-in-out;
1820
  background: #fff;
1262
 
1263
  body[class*="wp-google-maps"] input[type="text"],
1264
  body[class*="wp-google-maps"] select {
 
1265
  box-shadow: none;
1266
  border: 1px solid #ccc;
1267
  border-radius: 2px;
1813
  input:not([type="checkbox"]):not([type="radio"]){
1814
  border: 1px solid #ddd;
1815
  box-shadow: none;
1816
+
1817
  border-radius: 2px;
1818
  transition: border-color .12s ease-in-out;
1819
  background: #fff;
includes/class.script-loader.php.bak DELETED
@@ -1,467 +0,0 @@
1
- <?php
2
-
3
- namespace WPGMZA;
4
-
5
- require_once(plugin_dir_path(__FILE__) . 'google-maps/class.google-maps-loader.php');
6
- require_once(plugin_dir_path(__FILE__) . 'open-layers/class.ol-loader.php');
7
-
8
- class ScriptLoader
9
- {
10
- private $proMode = false;
11
- private $logStarted = false;
12
-
13
- public $scripts;
14
-
15
- public function __construct($proMode)
16
- {
17
- $this->proMode = $proMode;
18
-
19
- if($this->proMode)
20
- $this->scriptsFileLocation = plugin_dir_path(WPGMZA_PRO_FILE) . 'js/v8/pro-scripts.json';
21
- else
22
- $this->scriptsFileLocation = plugin_dir_path(__DIR__) . 'js/v8/scripts.json';
23
- }
24
-
25
- protected function log($str)
26
- {
27
- $dest = __DIR__ . '/build.log';
28
-
29
- if(!$this->logStarted)
30
- file_put_contents($dest, "");
31
-
32
- $this->logStarted = true;
33
- file_put_contents($dest, date("Y-m-d H:i:s :-\t") . $str . "\r\n", FILE_APPEND);
34
- }
35
-
36
- protected function rglob($pattern, $flags = 0)
37
- {
38
- $files = glob($pattern, $flags);
39
-
40
- foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
41
-
42
- $files = array_merge($files, $this->rglob($dir.'/'.basename($pattern), $flags));
43
-
44
- }
45
-
46
- return $files;
47
- }
48
-
49
- protected function getHandleFromModuleName($module)
50
- {
51
- return trim(preg_replace('/^wpgmza\./', 'wpgmza-',
52
- strtolower(
53
- preg_replace('/(?<=[A-Za-z])(?=[A-Z][a-z])|(?<=[a-z0-9])(?=[0-9]?[A-Z])/', '-', $module)
54
- )
55
- ));
56
- }
57
-
58
- protected function getLibraryScripts()
59
- {
60
- global $wpgmza;
61
-
62
- $plugin_dir_url = plugin_dir_url(__DIR__);
63
-
64
- $libraryDependencies = array(
65
- 'datatables' => $plugin_dir_url . 'js/jquery.dataTables.min.js',
66
- 'jquery-cookie' => $plugin_dir_url . 'lib/jquery-cookie.js',
67
- // 'modernizr-custom' => $plugin_dir_url . 'lib/modernizr-custom.js',
68
- 'remodal' => $plugin_dir_url . 'lib/' . ($wpgmza->isUsingMinifiedScripts() ? 'remodal.min.js' : 'remodal.js'),
69
- // 'resize-sensor' => $plugin_dir_url . 'lib/ResizeSensor.js',
70
- 'spectrum' => $plugin_dir_url . 'lib/spectrum.js'
71
- );
72
-
73
- /*if($wpgmza->isProVersion())
74
- {
75
- $pro_dir = plugin_dir_url(WPGMZA_PRO_FILE);
76
-
77
- $libraryDependencies = array_merge($libraryDependencies, array(
78
- 'jstree' => $pro_dir . ($wpgmza->isUsingMinifiedScripts() ? 'lib/jstree.min.js' : 'lib/jstree.js'),
79
- 'jszip' => $pro_dir . 'lib/jszip.min.js',
80
- 'jquery-multiselect' => $pro_dir . 'lib/jquery.multiselect.js',
81
- 'owl-carousel' => $pro_dir . 'lib/owl.carousel.min.js'
82
- ));
83
- }*/
84
-
85
- if($wpgmza->getCurrentPage() && is_admin())
86
- {
87
- wp_enqueue_script('jquery-ui-core');
88
- wp_enqueue_script('jquery-ui-dialog');
89
- wp_enqueue_script('jquery-ui-slider');
90
- wp_enqueue_script('jquery-ui-tabs');
91
- wp_enqueue_script('jquery-ui-progressbar');
92
- wp_enqueue_script('jquery-ui-accordion');
93
- wp_enqueue_script('jquery-ui-sortable');
94
- wp_enqueue_script('jquery-ui-draggable');
95
- }
96
-
97
- return apply_filters('wpgmza-get-library-dependencies', $libraryDependencies);
98
- }
99
-
100
- protected function getScanDirectories()
101
- {
102
- $result = array(
103
- plugin_dir_path(__DIR__) . 'js/v8' => plugin_dir_url(__DIR__) . 'js/v8'
104
- );
105
-
106
- if($this->proMode)
107
- $result[plugin_dir_path(WPGMZA_PRO_FILE) . 'js/v8'] = plugin_dir_url(WPGMZA_PRO_FILE) . 'js/v8';
108
-
109
- return $result;
110
- }
111
-
112
- protected function scanDependencies()
113
- {
114
- $this->scripts = array();
115
-
116
- $directories = $this->getScanDirectories();
117
-
118
- $files = array();
119
- $this->dependenciesByHandle = array();
120
-
121
- $this->log("Scanning dependencies");
122
-
123
- foreach($directories as $dir => $path)
124
- {
125
- $pro_directory = (preg_match('/-pro/', $dir) ? true : false);
126
- $files = $this->rglob("$dir/*.js");
127
-
128
- foreach($files as $file)
129
- {
130
- if(preg_match('/combined\.js|min\.js$/', $file))
131
- continue;
132
-
133
- $this->log("Reading $file");
134
-
135
- $contents = file_get_contents($file);
136
-
137
- if(!preg_match('/\/\*\*.+?\*\//s', $contents, $m))
138
- continue;
139
-
140
- $header = $m[0];
141
-
142
- // Read module name
143
- if(!preg_match('/@module\s+(.+)/', $header, $m))
144
- continue;
145
-
146
- $module = trim($m[1]);
147
-
148
- $handle = $this->getHandleFromModuleName($module);
149
- if($handle != 'wpgmza')
150
- $handle = 'wpgmza-' . $handle;
151
-
152
- $dependencies = array();
153
-
154
- $this->log("Found $handle");
155
-
156
- if(preg_match_all('/@(pro-)?requires (.+)/', $header, $m))
157
- {
158
- $len = count($m[0]);
159
-
160
- for($i = 0; $i < $len; $i++)
161
- {
162
- $pro = !empty($m[1][$i]);
163
-
164
- $dependencyModule = $m[2][$i];
165
-
166
- $dependencyHandle = preg_replace('/^wpgmza\./',
167
- 'wpgmza-',
168
- $this->getHandleFromModuleName($dependencyModule)
169
- );
170
-
171
- if(!$pro)
172
- {
173
- $this->log("Adding dependency $dependencyHandle");
174
- $dependencies[] = $dependencyHandle;
175
- }
176
- else if($this->proMode)
177
- {
178
- $this->log("Adding Pro dependency $dependencyHandle");
179
- $dependencies[] = $dependencyHandle;
180
- }
181
- }
182
- }
183
-
184
- $src = str_replace($dir, 'js/v8', $file);
185
-
186
- if(empty($this->dependenciesByHandle[$handle]))
187
- $this->dependenciesByHandle[$handle] = array();
188
-
189
- $this->dependenciesByHandle[$handle][] = $file;
190
-
191
- $this->scripts[$handle] = (object)array(
192
- 'src' => $src,
193
- 'pro' => $pro_directory,
194
- 'dependencies' => $dependencies
195
- );
196
- }
197
- }
198
-
199
- file_put_contents($this->scriptsFileLocation, json_encode($this->scripts, JSON_PRETTY_PRINT));
200
- }
201
-
202
- public function getCombineOrder()
203
- {
204
- if(!$this->scripts)
205
- $this->scanDependencies();
206
-
207
- $iterations = 0;
208
- $scripts = (array)(clone (object)$this->scripts);
209
- $includedHandles = array();
210
- $combineOrder = array();
211
-
212
- $ignoreDependencyHandles = array(
213
- 'wpgmza_api_call'
214
- );
215
- $unresolvedDependencyHandles = array();
216
-
217
- while(!empty($scripts))
218
- {
219
- if(++$iterations > 100000)
220
- {
221
- //echo "Dumping included handles\r\n";
222
- //var_dump($includedHandles);
223
-
224
- //echo "Dumping remaining scripts\r\n\r\n";
225
- //var_dump($scripts);
226
-
227
- echo "<pre>";
228
- echo "Dumping unresolved dependencies\r\n\r\n";
229
- //var_dump(array_keys($unresolvedDependencyHandles));
230
-
231
- foreach($unresolvedDependencyHandles as $handle => $unused)
232
- {
233
- echo "$handle (in " . implode(', ', $this->dependenciesByHandle[$handle]) . ")\r\n";
234
- }
235
-
236
- echo "</pre>";
237
-
238
- throw new \Exception('Iteration limit hit possibly due to dependency recusion or unresolved dependencies');
239
- }
240
-
241
- foreach($scripts as $handle => $script)
242
- {
243
- // echo "\r\nLooking at $handle\r\n";
244
-
245
- foreach($script->dependencies as $dependency)
246
- {
247
- // Ignored handles (eg API call)
248
- if(array_search($dependency, $ignoreDependencyHandles) !== false)
249
- {
250
- //echo "Ignoring dependency $dependency\r\n";
251
- continue;
252
- }
253
-
254
- // Already included handles
255
- if(array_search($dependency, $includedHandles) !== false)
256
- {
257
- //echo "Already included $dependency\r\n";
258
- continue;
259
- }
260
-
261
- // External handles not handled by us. This module only handles internal dependencies
262
- if(!preg_match('/^wpgmza-/i', $dependency) && $dependency != 'wpgmza')
263
- {
264
- //echo "Ignoring external handle $dependency\r\n";
265
- continue;
266
- }
267
-
268
- $unresolvedDependencyHandles[$handle] = true;
269
-
270
- //echo "$dependency not yet included, skipping\r\n";
271
- continue 2;
272
- }
273
-
274
- //echo "Adding $handle ({$script->src})\r\n";
275
-
276
- $combineOrder[] = $script->src;
277
- $includedHandles[] = $handle;
278
-
279
- unset($scripts[$handle]);
280
- unset($unresolvedDependencyHandles[$handle]);
281
-
282
- break;
283
- }
284
- }
285
-
286
- return $combineOrder;
287
- }
288
-
289
- public function buildCombinedFile()
290
- {
291
- global $wpgmza;
292
-
293
- $order = $this->getCombineOrder();
294
-
295
- $combined = array();
296
- $dest = plugin_dir_path(($this->proMode ? WPGMZA_PRO_FILE : __DIR__)) . 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.combined.js';
297
-
298
- foreach($order as $file)
299
- {
300
- if(preg_match('/\.(combined|min)\.js$/', $file))
301
- continue;
302
-
303
- $src = plugin_dir_path(__DIR__) . $file;
304
-
305
- if(!file_exists($src))
306
- $src = plugin_dir_path(WPGMZA_PRO_FILE) . $file;
307
-
308
- $contents = "\r\n// $file\r\n" . file_get_contents($src);
309
- $combined[] = $contents;
310
- }
311
-
312
- $combined = implode("\r\n", $combined);
313
-
314
- //if(file_exists($dest) && md5(file_get_contents($dest)) == md5($combined))
315
- //return; // No changes, no need to build
316
-
317
- file_put_contents($dest, $combined);
318
- }
319
-
320
- public function build()
321
- {
322
- $this->scanDependencies();
323
- $this->buildCombinedFile();
324
- }
325
-
326
- public function enqueueStyles()
327
- {
328
- global $wpgmza;
329
-
330
- // wp_enqueue_style('wpgmza-color-picker', plugin_dir_url(__DIR__) . 'lib/spectrum.css');
331
- // wp_enqueue_style('datatables', '//cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css');
332
-
333
- wp_enqueue_style('remodal', plugin_dir_url(__DIR__) . 'lib/remodal.css');
334
- wp_enqueue_style('remodal-default-theme', plugin_dir_url(__DIR__) . 'lib/remodal-default-theme.css');
335
- }
336
-
337
- /**
338
- * Returns an array of objects representing all scripts used by the plugin
339
- * @return array
340
- */
341
- public function getPluginScripts()
342
- {
343
- global $wpgmza;
344
-
345
- if($wpgmza->isUsingMinifiedScripts())
346
- {
347
- $dir = ($this->proMode ? plugin_dir_path(WPGMZA_PRO_FILE) : plugin_dir_path(__DIR__));
348
-
349
- $combined = 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.combined.js';
350
- $minified = 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.min.js';
351
-
352
- $src = $minified;
353
-
354
- $minified_file_exists = file_exists($dir . $minified);
355
-
356
- if($minified_file_exists)
357
- $delta = filemtime($dir . $combined) - filemtime($dir . $minified);
358
-
359
- if(!$minified_file_exists || $delta > 0)
360
- $src = $combined;
361
-
362
- // TODO: Remove this, fix errors
363
- // $src = $combined;
364
-
365
- $scripts = array('wpgmza' =>
366
- (object)array(
367
- 'src' => $src,
368
- 'pro' => $this->proMode
369
- )
370
- );
371
- }
372
- else
373
- {
374
- // Enqueue core object with library dependencies
375
- $scripts = (array)json_decode(file_get_contents($this->scriptsFileLocation));
376
- }
377
-
378
- return $scripts;
379
- }
380
-
381
- public function enqueueScripts()
382
- {
383
- global $wpgmza;
384
-
385
- // Get library scripts
386
- $libraries = $this->getLibraryScripts();
387
-
388
- // Enqueue Google API call if necessary
389
- switch($wpgmza->settings->engine)
390
- {
391
- case 'google-maps':
392
- $loader = ($wpgmza->isProVersion() ? new GoogleProMapsLoader() : new GoogleMapsLoader());
393
- $loader->loadGoogleMaps();
394
- break;
395
-
396
- default:
397
- $loader = new OLLoader();
398
- $loader->loadOpenLayers();
399
- break;
400
- }
401
-
402
- // Enqueue library scripts first
403
- foreach($libraries as $handle => $src)
404
- {
405
- wp_enqueue_script($handle, $src, array('jquery'));
406
- }
407
-
408
- // FontAwesome?
409
- $version = (empty($wpgmza->settings->use_fontawesome) ? '4.*' : $wpgmza->settings->use_fontawesome);
410
-
411
- switch($version)
412
- {
413
- case 'none':
414
- break;
415
-
416
- case '5.*':
417
- wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v5.0.9/css/all.css');
418
-
419
- // If we're not in admin, break. If we are, continue and enqueue FA 4 which is used by the map edit page
420
- if(!is_admin())
421
- break;
422
-
423
- default:
424
- wp_enqueue_style('fontawesome', plugin_dir_url(__DIR__) . 'css/font-awesome.min.css');
425
- break;
426
- }
427
-
428
- // Scripts
429
- $this->scripts = $this->getPluginScripts();
430
-
431
- // Give the core script library dependencies
432
- $dependencies = array_keys($libraries);
433
-
434
- // Sometimes we need to load the plugin JS files but not the maps API. The following code stops the API being loaded as a dependency of the plugin JS files when that is the case.
435
- $apiLoader = new GoogleMapsAPILoader();
436
- if($apiLoader->isIncludeAllowed())
437
- $dependencies[] = 'wpgmza_api_call';
438
-
439
- $this->scripts['wpgmza']->dependencies = $dependencies;
440
-
441
- $version_string = $wpgmza->getBasicVersion();
442
- if(method_exists($wpgmza, 'getProVersion'))
443
- $version_string .= '+pro-' . $wpgmza->getProVersion();
444
-
445
- // Enqueue other scripts
446
- foreach($this->scripts as $handle => $script)
447
- {
448
- $fullpath = plugin_dir_url(($script->pro ? WPGMZA_PRO_FILE : __DIR__)) . $script->src;
449
-
450
- wp_enqueue_script($handle, $fullpath, $script->dependencies, $version_string);
451
- }
452
-
453
- // Enqueue localized data
454
- $this->enqueueLocalizedData();
455
- //$this->enqueueTourData();
456
- //$this->enqueueCustomJavascript();
457
- }
458
-
459
- public function enqueueLocalizedData()
460
- {
461
- global $wpgmza;
462
-
463
- $data = $wpgmza->getLocalizedData();
464
-
465
- wp_localize_script('wpgmza', 'WPGMZA_localized_data', (array)$data);
466
- }
467
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/v8/google-maps/google-map.js CHANGED
@@ -223,8 +223,8 @@ jQuery(function($) {
223
  * Removes the specified marker from this map
224
  * @return void
225
  */
226
- WPGMZA.GoogleMap.prototype.removeMarker = function(marker)
227
- {
228
  marker.googleMarker.setMap(null);
229
 
230
  Parent.prototype.removeMarker.call(this, marker);
223
  * Removes the specified marker from this map
224
  * @return void
225
  */
226
+ WPGMZA.GoogleMap.prototype.removeMarker = function(marker) {
227
+
228
  marker.googleMarker.setMap(null);
229
 
230
  Parent.prototype.removeMarker.call(this, marker);
js/v8/map.js CHANGED
@@ -295,7 +295,9 @@ jQuery(function($) {
295
  {
296
  if(!(marker instanceof WPGMZA.Marker))
297
  throw new Error("Argument must be an instance of WPGMZA.Marker");
298
-
 
 
299
  marker.map = this;
300
  marker.parent = this;
301
 
@@ -318,19 +320,21 @@ jQuery(function($) {
318
  {
319
  if(!(marker instanceof WPGMZA.Marker))
320
  throw new Error("Argument must be an instance of WPGMZA.Marker");
321
-
322
- if(marker.map !== this)
323
- throw new Error("Wrong map error");
 
 
324
 
325
  if(marker.infoWindow)
326
  marker.infoWindow.close();
327
 
328
  marker.map = null;
329
  marker.parent = null;
330
-
331
  this.markers.splice(this.markers.indexOf(marker), 1);
332
  this.dispatchEvent({type: "markerremoved", marker: marker});
333
  marker.dispatchEvent({type: "removed"});
 
334
  }
335
 
336
  /**
@@ -379,8 +383,8 @@ jQuery(function($) {
379
  * @fires markerremoved
380
  * @fires WPGMZA.Marker#removed
381
  */
382
- WPGMZA.Map.prototype.removeMarkerByID = function(id)
383
- {
384
  var marker = this.getMarkerByID(id);
385
 
386
  if(!marker)
295
  {
296
  if(!(marker instanceof WPGMZA.Marker))
297
  throw new Error("Argument must be an instance of WPGMZA.Marker");
298
+
299
+
300
+
301
  marker.map = this;
302
  marker.parent = this;
303
 
320
  {
321
  if(!(marker instanceof WPGMZA.Marker))
322
  throw new Error("Argument must be an instance of WPGMZA.Marker");
323
+
324
+ if(marker.map !== this) {
325
+ //throw new Error("Wrong map error");
326
+ console.error("Wrong map error");
327
+ }
328
 
329
  if(marker.infoWindow)
330
  marker.infoWindow.close();
331
 
332
  marker.map = null;
333
  marker.parent = null;
 
334
  this.markers.splice(this.markers.indexOf(marker), 1);
335
  this.dispatchEvent({type: "markerremoved", marker: marker});
336
  marker.dispatchEvent({type: "removed"});
337
+
338
  }
339
 
340
  /**
383
  * @fires markerremoved
384
  * @fires WPGMZA.Marker#removed
385
  */
386
+ WPGMZA.Map.prototype.removeMarkerByID = function(id) {
387
+
388
  var marker = this.getMarkerByID(id);
389
 
390
  if(!marker)
js/v8/scripts.json CHANGED
@@ -270,211 +270,211 @@
270
  "wpgmza"
271
  ]
272
  },
273
- "wpgmza-integration": {
274
- "src": "js\/v8\/3rd-party-integration\/integration.js",
275
  "pro": false,
276
  "dependencies": [
277
  "wpgmza"
278
  ]
279
  },
280
- "wpgmza-gutenberg": {
281
- "src": "js\/v8\/3rd-party-integration\/gutenberg\/dist\/gutenberg.js",
282
  "pro": false,
283
  "dependencies": [
284
- "wpgmza-integration",
285
- "wp-i18n",
286
- "wp-blocks",
287
- "wp-editor",
288
- "wp-components"
289
  ]
290
  },
291
- "wpgmza-astra-theme-compatiblity": {
292
- "src": "js\/v8\/compatibility\/astra-theme-compatibility.js",
 
 
 
 
 
 
 
293
  "pro": false,
294
  "dependencies": [
295
  "wpgmza"
296
  ]
297
  },
298
- "wpgmza-google-ui-compatibility": {
299
- "src": "js\/v8\/compatibility\/google-ui-compatibility.js",
300
  "pro": false,
301
  "dependencies": [
302
  "wpgmza"
303
  ]
304
  },
305
- "wpgmza-google-circle": {
306
- "src": "js\/v8\/google-maps\/google-circle.js",
307
  "pro": false,
308
  "dependencies": [
309
- "wpgmza-circle"
 
 
 
 
310
  ]
311
  },
312
- "wpgmza-google-geocoder": {
313
- "src": "js\/v8\/google-maps\/google-geocoder.js",
314
  "pro": false,
315
  "dependencies": [
316
- "wpgmza-geocoder"
317
  ]
318
  },
319
- "wpgmza-google-html-overlay": {
320
- "src": "js\/v8\/google-maps\/google-html-overlay.js",
321
  "pro": false,
322
  "dependencies": [
323
- "wpgmza"
324
  ]
325
  },
326
- "wpgmza-google-info-window": {
327
- "src": "js\/v8\/google-maps\/google-info-window.js",
328
  "pro": false,
329
  "dependencies": [
330
  "wpgmza-info-window"
331
  ]
332
  },
333
- "wpgmza-google-map": {
334
- "src": "js\/v8\/google-maps\/google-map.js",
335
  "pro": false,
336
  "dependencies": [
337
  "wpgmza-map"
338
  ]
339
  },
340
- "wpgmza-google-marker": {
341
- "src": "js\/v8\/google-maps\/google-marker.js",
342
  "pro": false,
343
  "dependencies": [
344
  "wpgmza-marker"
345
  ]
346
  },
347
- "wpgmza-google-modern-store-locator-circle": {
348
- "src": "js\/v8\/google-maps\/google-modern-store-locator-circle.js",
349
  "pro": false,
350
  "dependencies": [
351
  "wpgmza-modern-store-locator-circle"
352
  ]
353
  },
354
- "wpgmza-google-modern-store-locator": {
355
- "src": "js\/v8\/google-maps\/google-modern-store-locator.js",
356
  "pro": false,
357
  "dependencies": [
358
  "wpgmza-modern-store-locator"
359
  ]
360
  },
361
- "wpgmza-google-polygon": {
362
- "src": "js\/v8\/google-maps\/google-polygon.js",
363
  "pro": false,
364
  "dependencies": [
365
  "wpgmza-polygon"
366
  ]
367
  },
368
- "wpgmza-google-polyline": {
369
- "src": "js\/v8\/google-maps\/google-polyline.js",
370
  "pro": false,
371
  "dependencies": [
372
  "wpgmza-polyline"
373
  ]
374
  },
375
- "wpgmza-google-text-overlay": {
376
- "src": "js\/v8\/google-maps\/google-text-overlay.js",
377
- "pro": false,
378
- "dependencies": [
379
- "wpgmza-google-text"
380
- ]
381
- },
382
- "wpgmza-google-text": {
383
- "src": "js\/v8\/google-maps\/google-text.js",
384
  "pro": false,
385
  "dependencies": [
386
  "wpgmza-text"
387
  ]
388
  },
389
- "wpgmza-google-vertex-context-menu": {
390
- "src": "js\/v8\/google-maps\/google-vertex-context-menu.js",
391
  "pro": false,
392
  "dependencies": [
393
- "wpgmza_api_call"
394
  ]
395
  },
396
- "wpgmza-ol-circle": {
397
- "src": "js\/v8\/open-layers\/ol-circle.js",
398
  "pro": false,
399
  "dependencies": [
400
- "wpgmza-circle"
401
  ]
402
  },
403
- "wpgmza-ol-geocoder": {
404
- "src": "js\/v8\/open-layers\/ol-geocoder.js",
405
  "pro": false,
406
  "dependencies": [
407
- "wpgmza-geocoder"
408
  ]
409
  },
410
- "wpgmza-ol-info-window": {
411
- "src": "js\/v8\/open-layers\/ol-info-window.js",
412
  "pro": false,
413
  "dependencies": [
414
  "wpgmza-info-window"
415
  ]
416
  },
417
- "wpgmza-ol-map": {
418
- "src": "js\/v8\/open-layers\/ol-map.js",
419
  "pro": false,
420
  "dependencies": [
421
  "wpgmza-map"
422
  ]
423
  },
424
- "wpgmza-ol-marker": {
425
- "src": "js\/v8\/open-layers\/ol-marker.js",
426
  "pro": false,
427
  "dependencies": [
428
  "wpgmza-marker"
429
  ]
430
  },
431
- "wpgmza-ol-modern-store-locator-circle": {
432
- "src": "js\/v8\/open-layers\/ol-modern-store-locator-circle.js",
433
  "pro": false,
434
  "dependencies": [
435
  "wpgmza-modern-store-locator-circle"
436
  ]
437
  },
438
- "wpgmza-ol-modern-store-locator": {
439
- "src": "js\/v8\/open-layers\/ol-modern-store-locator.js",
440
  "pro": false,
441
  "dependencies": [
442
  "wpgmza-modern-store-locator"
443
  ]
444
  },
445
- "wpgmza-ol-polygon": {
446
- "src": "js\/v8\/open-layers\/ol-polygon.js",
447
  "pro": false,
448
  "dependencies": [
449
  "wpgmza-polygon"
450
  ]
451
  },
452
- "wpgmza-ol-polyline": {
453
- "src": "js\/v8\/open-layers\/ol-polyline.js",
454
  "pro": false,
455
  "dependencies": [
456
  "wpgmza-polyline"
457
  ]
458
  },
459
- "wpgmza-ol-text": {
460
- "src": "js\/v8\/open-layers\/ol-text.js",
461
  "pro": false,
462
  "dependencies": [
463
- "wpgmza-text"
464
  ]
465
  },
466
- "wpgmza-admin-marker-data-table": {
467
- "src": "js\/v8\/tables\/admin-marker-datatable.js",
468
  "pro": false,
469
  "dependencies": [
470
- "wpgmza-data-table"
471
  ]
472
  },
473
- "wpgmza-data-table": {
474
- "src": "js\/v8\/tables\/datatable.js",
475
  "pro": false,
476
  "dependencies": [
477
- "wpgmza"
478
  ]
479
  }
480
  }
270
  "wpgmza"
271
  ]
272
  },
273
+ "wpgmza-astra-theme-compatiblity": {
274
+ "src": "js\/v8\/compatibility\/astra-theme-compatibility.js",
275
  "pro": false,
276
  "dependencies": [
277
  "wpgmza"
278
  ]
279
  },
280
+ "wpgmza-google-ui-compatibility": {
281
+ "src": "js\/v8\/compatibility\/google-ui-compatibility.js",
282
  "pro": false,
283
  "dependencies": [
284
+ "wpgmza"
 
 
 
 
285
  ]
286
  },
287
+ "wpgmza-admin-marker-data-table": {
288
+ "src": "js\/v8\/tables\/admin-marker-datatable.js",
289
+ "pro": false,
290
+ "dependencies": [
291
+ "wpgmza-data-table"
292
+ ]
293
+ },
294
+ "wpgmza-data-table": {
295
+ "src": "js\/v8\/tables\/datatable.js",
296
  "pro": false,
297
  "dependencies": [
298
  "wpgmza"
299
  ]
300
  },
301
+ "wpgmza-integration": {
302
+ "src": "js\/v8\/3rd-party-integration\/integration.js",
303
  "pro": false,
304
  "dependencies": [
305
  "wpgmza"
306
  ]
307
  },
308
+ "wpgmza-gutenberg": {
309
+ "src": "js\/v8\/3rd-party-integration\/gutenberg\/dist\/gutenberg.js",
310
  "pro": false,
311
  "dependencies": [
312
+ "wpgmza-integration",
313
+ "wp-i18n",
314
+ "wp-blocks",
315
+ "wp-editor",
316
+ "wp-components"
317
  ]
318
  },
319
+ "wpgmza-ol-circle": {
320
+ "src": "js\/v8\/open-layers\/ol-circle.js",
321
  "pro": false,
322
  "dependencies": [
323
+ "wpgmza-circle"
324
  ]
325
  },
326
+ "wpgmza-ol-geocoder": {
327
+ "src": "js\/v8\/open-layers\/ol-geocoder.js",
328
  "pro": false,
329
  "dependencies": [
330
+ "wpgmza-geocoder"
331
  ]
332
  },
333
+ "wpgmza-ol-info-window": {
334
+ "src": "js\/v8\/open-layers\/ol-info-window.js",
335
  "pro": false,
336
  "dependencies": [
337
  "wpgmza-info-window"
338
  ]
339
  },
340
+ "wpgmza-ol-map": {
341
+ "src": "js\/v8\/open-layers\/ol-map.js",
342
  "pro": false,
343
  "dependencies": [
344
  "wpgmza-map"
345
  ]
346
  },
347
+ "wpgmza-ol-marker": {
348
+ "src": "js\/v8\/open-layers\/ol-marker.js",
349
  "pro": false,
350
  "dependencies": [
351
  "wpgmza-marker"
352
  ]
353
  },
354
+ "wpgmza-ol-modern-store-locator-circle": {
355
+ "src": "js\/v8\/open-layers\/ol-modern-store-locator-circle.js",
356
  "pro": false,
357
  "dependencies": [
358
  "wpgmza-modern-store-locator-circle"
359
  ]
360
  },
361
+ "wpgmza-ol-modern-store-locator": {
362
+ "src": "js\/v8\/open-layers\/ol-modern-store-locator.js",
363
  "pro": false,
364
  "dependencies": [
365
  "wpgmza-modern-store-locator"
366
  ]
367
  },
368
+ "wpgmza-ol-polygon": {
369
+ "src": "js\/v8\/open-layers\/ol-polygon.js",
370
  "pro": false,
371
  "dependencies": [
372
  "wpgmza-polygon"
373
  ]
374
  },
375
+ "wpgmza-ol-polyline": {
376
+ "src": "js\/v8\/open-layers\/ol-polyline.js",
377
  "pro": false,
378
  "dependencies": [
379
  "wpgmza-polyline"
380
  ]
381
  },
382
+ "wpgmza-ol-text": {
383
+ "src": "js\/v8\/open-layers\/ol-text.js",
 
 
 
 
 
 
 
384
  "pro": false,
385
  "dependencies": [
386
  "wpgmza-text"
387
  ]
388
  },
389
+ "wpgmza-google-circle": {
390
+ "src": "js\/v8\/google-maps\/google-circle.js",
391
  "pro": false,
392
  "dependencies": [
393
+ "wpgmza-circle"
394
  ]
395
  },
396
+ "wpgmza-google-geocoder": {
397
+ "src": "js\/v8\/google-maps\/google-geocoder.js",
398
  "pro": false,
399
  "dependencies": [
400
+ "wpgmza-geocoder"
401
  ]
402
  },
403
+ "wpgmza-google-html-overlay": {
404
+ "src": "js\/v8\/google-maps\/google-html-overlay.js",
405
  "pro": false,
406
  "dependencies": [
407
+ "wpgmza"
408
  ]
409
  },
410
+ "wpgmza-google-info-window": {
411
+ "src": "js\/v8\/google-maps\/google-info-window.js",
412
  "pro": false,
413
  "dependencies": [
414
  "wpgmza-info-window"
415
  ]
416
  },
417
+ "wpgmza-google-map": {
418
+ "src": "js\/v8\/google-maps\/google-map.js",
419
  "pro": false,
420
  "dependencies": [
421
  "wpgmza-map"
422
  ]
423
  },
424
+ "wpgmza-google-marker": {
425
+ "src": "js\/v8\/google-maps\/google-marker.js",
426
  "pro": false,
427
  "dependencies": [
428
  "wpgmza-marker"
429
  ]
430
  },
431
+ "wpgmza-google-modern-store-locator-circle": {
432
+ "src": "js\/v8\/google-maps\/google-modern-store-locator-circle.js",
433
  "pro": false,
434
  "dependencies": [
435
  "wpgmza-modern-store-locator-circle"
436
  ]
437
  },
438
+ "wpgmza-google-modern-store-locator": {
439
+ "src": "js\/v8\/google-maps\/google-modern-store-locator.js",
440
  "pro": false,
441
  "dependencies": [
442
  "wpgmza-modern-store-locator"
443
  ]
444
  },
445
+ "wpgmza-google-polygon": {
446
+ "src": "js\/v8\/google-maps\/google-polygon.js",
447
  "pro": false,
448
  "dependencies": [
449
  "wpgmza-polygon"
450
  ]
451
  },
452
+ "wpgmza-google-polyline": {
453
+ "src": "js\/v8\/google-maps\/google-polyline.js",
454
  "pro": false,
455
  "dependencies": [
456
  "wpgmza-polyline"
457
  ]
458
  },
459
+ "wpgmza-google-text-overlay": {
460
+ "src": "js\/v8\/google-maps\/google-text-overlay.js",
461
  "pro": false,
462
  "dependencies": [
463
+ "wpgmza-google-text"
464
  ]
465
  },
466
+ "wpgmza-google-text": {
467
+ "src": "js\/v8\/google-maps\/google-text.js",
468
  "pro": false,
469
  "dependencies": [
470
+ "wpgmza-text"
471
  ]
472
  },
473
+ "wpgmza-google-vertex-context-menu": {
474
+ "src": "js\/v8\/google-maps\/google-vertex-context-menu.js",
475
  "pro": false,
476
  "dependencies": [
477
+ "wpgmza_api_call"
478
  ]
479
  }
480
  }
js/v8/wp-google-maps.combined.js CHANGED
@@ -3826,7 +3826,9 @@ jQuery(function($) {
3826
  {
3827
  if(!(marker instanceof WPGMZA.Marker))
3828
  throw new Error("Argument must be an instance of WPGMZA.Marker");
3829
-
 
 
3830
  marker.map = this;
3831
  marker.parent = this;
3832
 
@@ -3849,19 +3851,21 @@ jQuery(function($) {
3849
  {
3850
  if(!(marker instanceof WPGMZA.Marker))
3851
  throw new Error("Argument must be an instance of WPGMZA.Marker");
3852
-
3853
- if(marker.map !== this)
3854
- throw new Error("Wrong map error");
 
 
3855
 
3856
  if(marker.infoWindow)
3857
  marker.infoWindow.close();
3858
 
3859
  marker.map = null;
3860
  marker.parent = null;
3861
-
3862
  this.markers.splice(this.markers.indexOf(marker), 1);
3863
  this.dispatchEvent({type: "markerremoved", marker: marker});
3864
  marker.dispatchEvent({type: "removed"});
 
3865
  }
3866
 
3867
  /**
@@ -3910,8 +3914,8 @@ jQuery(function($) {
3910
  * @fires markerremoved
3911
  * @fires WPGMZA.Marker#removed
3912
  */
3913
- WPGMZA.Map.prototype.removeMarkerByID = function(id)
3914
- {
3915
  var marker = this.getMarkerByID(id);
3916
 
3917
  if(!marker)
@@ -7135,200 +7139,6 @@ jQuery(function($) {
7135
 
7136
  });
7137
 
7138
- // js/v8/3rd-party-integration/integration.js
7139
- /**
7140
- * @namespace WPGMZA
7141
- * @module Integration
7142
- * @requires WPGMZA
7143
- */
7144
- jQuery(function($) {
7145
-
7146
- WPGMZA.Integration = {};
7147
- WPGMZA.integrationModules = {};
7148
-
7149
- });
7150
-
7151
- // js/v8/3rd-party-integration/gutenberg/dist/gutenberg.js
7152
- "use strict";
7153
-
7154
- /**
7155
- * @namespace WPGMZA.Integration
7156
- * @module Gutenberg
7157
- * @requires WPGMZA.Integration
7158
- * @requires wp-i18n
7159
- * @requires wp-blocks
7160
- * @requires wp-editor
7161
- * @requires wp-components
7162
- */
7163
-
7164
- /**
7165
- * Internal block libraries
7166
- */
7167
- jQuery(function ($) {
7168
-
7169
- if (!window.wp || !wp.i18n || !wp.blocks || !wp.editor || !wp.components) return;
7170
-
7171
- var __ = wp.i18n.__;
7172
- var registerBlockType = wp.blocks.registerBlockType;
7173
- var _wp$editor = wp.editor,
7174
- InspectorControls = _wp$editor.InspectorControls,
7175
- BlockControls = _wp$editor.BlockControls;
7176
- var _wp$components = wp.components,
7177
- Dashicon = _wp$components.Dashicon,
7178
- Toolbar = _wp$components.Toolbar,
7179
- Button = _wp$components.Button,
7180
- Tooltip = _wp$components.Tooltip,
7181
- PanelBody = _wp$components.PanelBody,
7182
- TextareaControl = _wp$components.TextareaControl,
7183
- CheckboxControl = _wp$components.CheckboxControl,
7184
- TextControl = _wp$components.TextControl,
7185
- SelectControl = _wp$components.SelectControl,
7186
- RichText = _wp$components.RichText;
7187
-
7188
-
7189
- WPGMZA.Integration.Gutenberg = function () {
7190
- registerBlockType('gutenberg-wpgmza/block', this.getBlockDefinition());
7191
- };
7192
-
7193
- WPGMZA.Integration.Gutenberg.prototype.getBlockTitle = function () {
7194
- return __("WP Google Maps");
7195
- };
7196
-
7197
- WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls = function (props) {
7198
-
7199
- /*
7200
- <TextControl
7201
- name="overrideWidthAmount"
7202
- label={__("Override Width Amount")}
7203
- checked={props.overrideWidthAmount}
7204
- onChange={onPropertiesChanged}
7205
- />
7206
-
7207
- <SelectControl
7208
- name="overrideWidthUnits"
7209
- label={__("Override Width Units")}
7210
- options={[
7211
- {value: "px", label: "px"},
7212
- {value: "%", label: "%"},
7213
- {value: "vw`", label: "vw"},
7214
- {value: "vh", label: "vh"}
7215
- ]}
7216
- onChange={onPropertiesChanged}
7217
- />
7218
-
7219
- <CheckboxControl
7220
- name="overrideHeight"
7221
- label={__("Override Height")}
7222
- checked={props.overrideWidth}
7223
- onChange={onPropertiesChanged}
7224
- />
7225
-
7226
- <TextControl
7227
- name="overrideHeightAmount"
7228
- label={__("Override Height Amount")}
7229
- checked={props.overrideWidthAmount}
7230
- onChange={onPropertiesChanged}
7231
- />
7232
-
7233
- <SelectControl
7234
- name="overrideHeightUnits"
7235
- label={__("Override Height Units")}
7236
- options={[
7237
- {value: "px", label: "px"},
7238
- {value: "%", label: "%"},
7239
- {value: "vw`", label: "vw"},
7240
- {value: "vh", label: "vh"}
7241
- ]}
7242
- onChange={onPropertiesChanged}
7243
- />
7244
- */
7245
-
7246
- var onOverrideWidthCheckboxChanged = function onOverrideWidthCheckboxChanged(value) {};
7247
-
7248
- return React.createElement(
7249
- InspectorControls,
7250
- { key: "inspector" },
7251
- React.createElement(
7252
- PanelBody,
7253
- { title: __('Map Settings') },
7254
- React.createElement(
7255
- "p",
7256
- { "class": "map-block-gutenberg-button-container" },
7257
- React.createElement(
7258
- "a",
7259
- { href: WPGMZA.adminurl + "admin.php?page=wp-google-maps-menu&action=edit&map_id=1",
7260
- target: "_blank",
7261
- "class": "button button-primary" },
7262
- React.createElement("i", { "class": "fa fa-pencil-square-o", "aria-hidden": "true" }),
7263
- __('Go to Map Editor')
7264
- )
7265
- ),
7266
- React.createElement(
7267
- "p",
7268
- { "class": "map-block-gutenberg-button-container" },
7269
- React.createElement(
7270
- "a",
7271
- { href: "https://www.wpgmaps.com/documentation/creating-your-first-map/",
7272
- target: "_blank",
7273
- "class": "button button-primary" },
7274
- React.createElement("i", { "class": "fa fa-book", "aria-hidden": "true" }),
7275
- __('View Documentation')
7276
- )
7277
- )
7278
- )
7279
- );
7280
- };
7281
-
7282
- WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes = function () {
7283
- return {};
7284
- };
7285
-
7286
- WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition = function (props) {
7287
- var _this = this;
7288
-
7289
- return {
7290
-
7291
- title: __("WP Google Maps"),
7292
- 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.'),
7293
- category: 'common',
7294
- icon: 'location-alt',
7295
- keywords: [__('Map'), __('Maps'), __('Google')],
7296
- attributes: this.getBlockAttributes(),
7297
-
7298
- edit: function edit(props) {
7299
- return [!!props.isSelected && _this.getBlockInspectorControls(props), React.createElement(
7300
- "div",
7301
- { className: props.className + " wpgmza-gutenberg-block" },
7302
- React.createElement(Dashicon, { icon: "location-alt" }),
7303
- React.createElement(
7304
- "span",
7305
- { "class": "wpgmza-gutenberg-block-title" },
7306
- __("Your map will appear here on your websites front end")
7307
- )
7308
- )];
7309
- },
7310
- // Defining the front-end interface
7311
- save: function save(props) {
7312
- // Rendering in PHP
7313
- return null;
7314
- }
7315
-
7316
- };
7317
- };
7318
-
7319
- WPGMZA.Integration.Gutenberg.getConstructor = function () {
7320
- return WPGMZA.Integration.Gutenberg;
7321
- };
7322
-
7323
- WPGMZA.Integration.Gutenberg.createInstance = function () {
7324
- var constructor = WPGMZA.Integration.Gutenberg.getConstructor();
7325
- return new constructor();
7326
- };
7327
-
7328
- // Allow the Pro module to extend and create the module, only create here when Pro isn't loaded
7329
- if(!WPGMZA.isProVersion() && !(/^6/.test(WPGMZA.pro_version))) WPGMZA.integrationModules.gutenberg = WPGMZA.Integration.Gutenberg.createInstance();
7330
- });
7331
-
7332
  // js/v8/compatibility/astra-theme-compatibility.js
7333
  /**
7334
  * @namespace WPGMZA
@@ -7384,4477 +7194,4671 @@ jQuery(function($) {
7384
 
7385
  });
7386
 
7387
- // js/v8/google-maps/google-circle.js
7388
  /**
7389
  * @namespace WPGMZA
7390
- * @module GoogleCircle
7391
- * @requires WPGMZA.Circle
7392
  */
7393
  jQuery(function($) {
7394
 
7395
- /**
7396
- * Subclass, used when Google is the maps engine. <strong>Please <em>do not</em> call this constructor directly. Always use createInstance rather than instantiating this class directly.</strong> Using createInstance allows this class to be externally extensible.
7397
- * @class WPGMZA.GoogleCircle
7398
- * @constructor WPGMZA.GoogleCircle
7399
- * @memberof WPGMZA
7400
- * @augments WPGMZA.Circle
7401
- * @see WPGMZA.Circle.createInstance
7402
- */
7403
- WPGMZA.GoogleCircle = function(options, googleCircle)
7404
  {
7405
  var self = this;
7406
-
7407
- WPGMZA.Circle.call(this, options, googleCircle);
7408
-
7409
- if(googleCircle)
7410
  {
7411
- this.googleCircle = googleCircle;
 
 
 
 
 
7412
  }
 
 
 
7413
  else
7414
  {
7415
- this.googleCircle = new google.maps.Circle();
7416
- this.googleCircle.wpgmzaCircle = this;
 
7417
  }
7418
 
7419
- google.maps.event.addListener(this.googleCircle, "click", function() {
7420
- self.dispatchEvent({type: "click"});
7421
- });
 
 
7422
 
7423
- if(options)
7424
- this.setOptions(options);
7425
- }
7426
-
7427
- WPGMZA.GoogleCircle.prototype = Object.create(WPGMZA.Circle.prototype);
7428
- WPGMZA.GoogleCircle.prototype.constructor = WPGMZA.GoogleCircle;
7429
-
7430
- WPGMZA.GoogleCircle.prototype.setCenter = function(center)
7431
- {
7432
- WPGMZA.Circle.prototype.setCenter.apply(this, arguments);
7433
-
7434
- this.googleCircle.setCenter(center);
7435
- }
7436
-
7437
- WPGMZA.GoogleCircle.prototype.setRadius = function(radius)
7438
- {
7439
- WPGMZA.Circle.prototype.setRadius.apply(this, arguments);
7440
-
7441
- this.googleCircle.setRadius(parseFloat(radius) * 1000);
7442
- }
7443
-
7444
- WPGMZA.GoogleCircle.prototype.setVisible = function(visible)
7445
- {
7446
- this.googleCircle.setVisible(visible ? true : false);
7447
- }
7448
-
7449
- WPGMZA.GoogleCircle.prototype.setOptions = function(options)
7450
- {
7451
- var googleOptions = {};
7452
-
7453
- googleOptions = $.extend({}, options);
7454
- delete googleOptions.map;
7455
- delete googleOptions.center;
7456
-
7457
- if(options.center)
7458
- googleOptions.center = new google.maps.LatLng({
7459
- lat: parseFloat(options.center.lat),
7460
- lng: parseFloat(options.center.lng)
7461
- });
7462
-
7463
- if(options.radius)
7464
- googleOptions.radius = parseFloat(options.radius);
7465
 
7466
- if(options.color)
7467
- googleOptions.fillColor = options.color;
7468
 
7469
- if(options.opacity)
7470
  {
7471
- googleOptions.fillOpacity = parseFloat(options.opacity);
7472
- googleOptions.strokeOpacity = parseFloat(options.opacity);
7473
-
7474
  }
 
7475
 
7476
- this.googleCircle.setOptions(googleOptions);
7477
-
7478
- if(options.map)
7479
- options.map.addCircle(this);
7480
- }
7481
-
7482
- });
7483
 
7484
- // js/v8/google-maps/google-geocoder.js
7485
- /**
7486
- * @namespace WPGMZA
7487
- * @module GoogleGeocoder
7488
- * @requires WPGMZA.Geocoder
7489
- */
7490
- jQuery(function($) {
 
 
 
 
 
 
 
 
 
 
 
7491
 
7492
- /**
7493
- * Subclass, used when Google is the maps engine. <strong>Please <em>do not</em> call this constructor directly. Always use createInstance rather than instantiating this class directly.</strong> Using createInstance allows this class to be externally extensible.
7494
- * @class WPGMZA.GoogleGeocoder
7495
- * @constructor WPGMZA.GoogleGeocoder
7496
- * @memberof WPGMZA
7497
- * @augments WPGMZA.Geocoder
7498
- * @see WPGMZA.Geocoder.createInstance
7499
- */
7500
- WPGMZA.GoogleGeocoder = function()
7501
  {
7502
- WPGMZA.Geocoder.call(this);
7503
  }
7504
 
7505
- WPGMZA.GoogleGeocoder.prototype = Object.create(WPGMZA.Geocoder.prototype);
7506
- WPGMZA.GoogleGeocoder.prototype.constructor = WPGMZA.GoogleGeocoder;
7507
-
7508
- WPGMZA.GoogleGeocoder.prototype.getGoogleGeocoder = function()
 
 
 
7509
  {
7510
- if(WPGMZA.CloudAPI && WPGMZA.CloudAPI.isBeingUsed)
7511
- return new WPGMZA.CloudGeocoder();
 
 
7512
 
7513
- return new google.maps.Geocoder();
 
 
 
 
7514
  }
7515
 
7516
- WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress = function(options, callback)
7517
  {
7518
- if(!options || !options.address)
7519
- throw new Error("No address specified");
7520
-
7521
- if(WPGMZA.isLatLngString(options.address))
7522
- return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this, options, callback);
7523
 
7524
- if(options.country)
7525
- options.componentRestrictions = {
7526
- country: options.country
7527
- };
7528
 
7529
- var geocoder = this.getGoogleGeocoder();
 
7530
 
7531
- geocoder.geocode(options, function(results, status) {
7532
-
7533
- if(status == google.maps.GeocoderStatus.OK || status == WPGMZA.CloudGeocoder.SUCCESS)
7534
- {
7535
- var location = results[0].geometry.location;
7536
- var latLng, bounds = null;
7537
-
7538
- latLng = {
7539
- lat: location.lat(),
7540
- lng: location.lng()
7541
- };
7542
-
7543
- if(bounds = results[0].geometry.bounds)
7544
- {
7545
- if(bounds instanceof google.maps.LatLngBounds)
7546
- bounds = WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds);
7547
- else
7548
- bounds = WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral(results[0].geometry.bounds);
7549
- }
7550
-
7551
- var results = [
7552
- {
7553
- geometry: {
7554
- location: latLng
7555
- },
7556
- latLng: latLng,
7557
- lat: latLng.lat,
7558
- lng: latLng.lng,
7559
- bounds: bounds
7560
- }
7561
- ];
7562
 
7563
- callback(results, WPGMZA.Geocoder.SUCCESS);
7564
- }
7565
- else
7566
- {
7567
- var nativeStatus = WPGMZA.Geocoder.FAIL;
7568
 
7569
- if(status == google.maps.GeocoderStatus.ZERO_RESULTS)
7570
- nativeStatus = WPGMZA.Geocoder.ZERO_RESULTS;
7571
 
7572
- callback(null, nativeStatus);
7573
  }
7574
- });
 
 
7575
  }
7576
 
7577
- WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng = function(options, callback)
7578
  {
7579
- if(!options || !options.latLng)
7580
- throw new Error("No latLng specified");
 
7581
 
7582
- var latLng = new WPGMZA.LatLng(options.latLng);
7583
- var geocoder = this.getGoogleGeocoder();
 
 
 
 
 
 
 
7584
 
7585
- var options = $.extend(options, {
7586
- location: {
7587
- lat: latLng.lat,
7588
- lng: latLng.lng
7589
- }
7590
- });
7591
- delete options.latLng;
7592
 
7593
- geocoder.geocode(options, function(results, status) {
7594
-
7595
- if(status !== "OK")
7596
- callback(null, WPGMZA.Geocoder.FAIL);
7597
-
7598
- if(!results || !results.length)
7599
- callback([], WPGMZA.Geocoder.NO_RESULTS);
7600
-
7601
- callback([results[0].formatted_address], WPGMZA.Geocoder.SUCCESS);
7602
-
7603
- });
7604
  }
7605
 
7606
- });
 
 
 
 
 
 
 
 
 
 
 
7607
 
7608
- // js/v8/google-maps/google-html-overlay.js
7609
- /**
7610
- * @namespace WPGMZA
7611
- * @module GoogleHTMLOverlay
7612
- * @requires WPGMZA
7613
- */
7614
- jQuery(function($) {
7615
-
7616
- // https://developers.google.com/maps/documentation/javascript/customoverlays
7617
-
7618
- if(WPGMZA.settings.engine && WPGMZA.settings.engine != "google-maps")
7619
- return;
7620
-
7621
- if(!window.google || !window.google.maps)
7622
- return;
7623
-
7624
- WPGMZA.GoogleHTMLOverlay = function(map)
7625
- {
7626
- this.element = $("<div class='wpgmza-google-html-overlay'></div>");
7627
-
7628
- this.visible = true;
7629
- this.position = new WPGMZA.LatLng();
7630
-
7631
- this.setMap(map.googleMap);
7632
- this.wpgmzaMap = map;
7633
- }
7634
-
7635
- WPGMZA.GoogleHTMLOverlay.prototype = new google.maps.OverlayView();
7636
-
7637
- WPGMZA.GoogleHTMLOverlay.prototype.onAdd = function()
7638
- {
7639
- var panes = this.getPanes();
7640
- panes.overlayMouseTarget.appendChild(this.element[0]);
7641
-
7642
- /*google.maps.event.addDomListener(this.element, "click", function() {
7643
-
7644
- });*/
7645
- }
7646
-
7647
- WPGMZA.GoogleHTMLOverlay.prototype.onRemove = function()
7648
- {
7649
- if(this.element && $(this.element).parent().length)
7650
- {
7651
- $(this.element).remove();
7652
- this.element = null;
7653
- }
7654
- }
7655
-
7656
- WPGMZA.GoogleHTMLOverlay.prototype.draw = function()
7657
- {
7658
- this.updateElementPosition();
7659
- }
7660
-
7661
- /*WPGMZA.GoogleHTMLOverlay.prototype.setMap = function(map)
7662
- {
7663
- if(!(map instanceof WPGMZA.Map))
7664
- throw new Error("Map must be an instance of WPGMZA.Map");
7665
-
7666
- google.maps.OverlayView.prototype.setMap.call(this, map.googleMap);
7667
-
7668
- this.wpgmzaMap = map;
7669
- }*/
7670
-
7671
- /*WPGMZA.GoogleHTMLOverlay.prototype.getVisible = function()
7672
- {
7673
- return $(this.element).css("display") != "none";
7674
- }
7675
-
7676
- WPGMZA.GoogleHTMLOverlay.prototype.setVisible = function(visible)
7677
- {
7678
- $(this.element).css({
7679
- "display": (visible ? "block" : "none")
7680
- });
7681
- }*/
7682
-
7683
- /*WPGMZA.GoogleHTMLOverlay.prototype.getPosition = function()
7684
- {
7685
- return new WPGMZA.LatLng(this.position);
7686
- }
7687
-
7688
- WPGMZA.GoogleHTMLOverlay.prototype.setPosition = function(position)
7689
- {
7690
- if(!(position instanceof WPGMZA.LatLng))
7691
- throw new Error("Argument must be an instance of WPGMZA.LatLng");
7692
-
7693
- this.position = position;
7694
- this.updateElementPosition();
7695
- }*/
7696
-
7697
- WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition = function()
7698
- {
7699
- //var pixels = this.wpgmzaMap.latLngToPixels(this.position);
7700
-
7701
- var projection = this.getProjection();
7702
-
7703
- if(!projection)
7704
- return;
7705
-
7706
- var pixels = projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());
7707
-
7708
- $(this.element).css({
7709
- "left": pixels.x,
7710
- "top": pixels.y
7711
- });
7712
- }
7713
- });
7714
 
7715
- // js/v8/google-maps/google-info-window.js
7716
- /**
7717
- * @namespace WPGMZA
7718
- * @module GoogleInfoWindow
7719
- * @requires WPGMZA.InfoWindow
7720
- * @pro-requires WPGMZA.ProInfoWindow
7721
- */
7722
- jQuery(function($) {
7723
-
7724
- var Parent;
7725
-
7726
- WPGMZA.GoogleInfoWindow = function(mapObject)
7727
- {
7728
- Parent.call(this, mapObject);
7729
-
7730
- this.setMapObject(mapObject);
7731
- }
7732
-
7733
- WPGMZA.GoogleInfoWindow.Z_INDEX = 99;
7734
-
7735
- if(WPGMZA.isProVersion())
7736
- Parent = WPGMZA.ProInfoWindow;
7737
- else
7738
- Parent = WPGMZA.InfoWindow;
7739
-
7740
- WPGMZA.GoogleInfoWindow.prototype = Object.create(Parent.prototype);
7741
- WPGMZA.GoogleInfoWindow.prototype.constructor = WPGMZA.GoogleInfoWindow;
7742
-
7743
- WPGMZA.GoogleInfoWindow.prototype.setMapObject = function(mapObject)
7744
- {
7745
- if(mapObject instanceof WPGMZA.Marker)
7746
- this.googleObject = mapObject.googleMarker;
7747
- else if(mapObject instanceof WPGMZA.Polygon)
7748
- this.googleObject = mapObject.googlePolygon;
7749
- else if(mapObject instanceof WPGMZA.Polyline)
7750
- this.googleObject = mapObject.googlePolyline;
7751
- }
7752
-
7753
- WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow = function()
7754
- {
7755
- var self = this;
7756
-
7757
- if(this.googleInfoWindow)
7758
- return;
7759
-
7760
- this.googleInfoWindow = new google.maps.InfoWindow();
7761
-
7762
- this.googleInfoWindow.setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX);
7763
-
7764
- google.maps.event.addListener(this.googleInfoWindow, "domready", function(event) {
7765
- self.trigger("domready");
7766
- });
7767
-
7768
- google.maps.event.addListener(this.googleInfoWindow, "closeclick", function(event) {
7769
-
7770
- if(self.state == WPGMZA.InfoWindow.STATE_CLOSED)
7771
- return;
7772
-
7773
- self.state = WPGMZA.InfoWindow.STATE_CLOSED;
7774
- self.trigger("infowindowclose");
7775
-
7776
- });
7777
- }
7778
-
7779
- /**
7780
- * Opens the info window
7781
- * @return boolean FALSE if the info window should not & will not open, TRUE if it will
7782
- */
7783
- WPGMZA.GoogleInfoWindow.prototype.open = function(map, mapObject)
7784
- {
7785
- var self = this;
7786
-
7787
- if(!Parent.prototype.open.call(this, map, mapObject))
7788
- return false;
7789
-
7790
- // Set parent for events to bubble up to
7791
- this.parent = map;
7792
-
7793
- this.createGoogleInfoWindow();
7794
- this.setMapObject(mapObject);
7795
 
7796
- if(this.googleObject instanceof google.maps.Polygon)
7797
- {
 
7798
 
7799
- }
7800
- else{
7801
- this.googleInfoWindow.open(
7802
- this.mapObject.map.googleMap,
7803
- this.googleObject
7804
- );
7805
- }
7806
-
7807
 
7808
-
7809
- var guid = WPGMZA.guid();
7810
- var html = "<div id='" + guid + "'>" + this.content + "</div>";
7811
 
7812
- this.googleInfoWindow.setContent(html);
7813
-
7814
- var intervalID;
7815
- intervalID = setInterval(function(event) {
7816
-
7817
- div = $("#" + guid);
7818
-
7819
- if(div.length)
7820
- {
7821
- clearInterval(intervalID);
7822
-
7823
- div[0].wpgmzaMapObject = self.mapObject;
7824
- div.addClass("wpgmza-infowindow");
7825
-
7826
- self.element = div[0];
7827
- self.trigger("infowindowopen");
7828
- }
7829
-
7830
- }, 50);
7831
-
7832
- return true;
7833
- }
7834
-
7835
- WPGMZA.GoogleInfoWindow.prototype.close = function()
7836
- {
7837
- if(!this.googleInfoWindow)
7838
- return;
7839
-
7840
- WPGMZA.InfoWindow.prototype.close.call(this);
7841
-
7842
- this.googleInfoWindow.close();
7843
- }
7844
-
7845
- WPGMZA.GoogleInfoWindow.prototype.setContent = function(html)
7846
- {
7847
- Parent.prototype.setContent.call(this, html);
7848
-
7849
- this.content = html;
7850
-
7851
- this.createGoogleInfoWindow();
7852
-
7853
- this.googleInfoWindow.setContent(html);
7854
- }
7855
-
7856
- WPGMZA.GoogleInfoWindow.prototype.setOptions = function(options)
7857
- {
7858
- Parent.prototype.setOptions.call(this, options);
7859
-
7860
- this.createGoogleInfoWindow();
7861
-
7862
- this.googleInfoWindow.setOptions(options);
7863
- }
7864
-
7865
- });
7866
 
7867
- // js/v8/google-maps/google-map.js
7868
- /**
7869
- * @namespace WPGMZA
7870
- * @module GoogleMap
7871
- * @requires WPGMZA.Map
7872
- * @pro-requires WPGMZA.ProMap
7873
- */
7874
- jQuery(function($) {
7875
- var Parent;
7876
-
7877
- /**
7878
- * Constructor
7879
- * @param element to contain the map
7880
- */
7881
- WPGMZA.GoogleMap = function(element, options)
7882
- {
7883
- var self = this;
7884
-
7885
- Parent.call(this, element, options);
7886
-
7887
- if(!window.google)
7888
- {
7889
- var status = WPGMZA.googleAPIStatus;
7890
- var message = "Google API not loaded";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7891
 
7892
- if(status && status.message)
7893
- message += " - " + status.message;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7894
 
7895
- if(status.code == "USER_CONSENT_NOT_GIVEN")
7896
- {
7897
- return;
7898
- }
7899
 
7900
- $(element).html("<div class='notice notice-error'><p>" + WPGMZA.localized_strings.google_api_not_loaded + "<pre>" + message + "</pre></p></div>");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7901
 
7902
- throw new Error(message);
7903
- }
7904
-
7905
- this.loadGoogleMap();
7906
-
7907
- if(options)
7908
- this.setOptions(options, true);
7909
 
7910
- google.maps.event.addListener(this.googleMap, "click", function(event) {
7911
- var wpgmzaEvent = new WPGMZA.Event("click");
7912
- wpgmzaEvent.latLng = {
7913
- lat: event.latLng.lat(),
7914
- lng: event.latLng.lng()
7915
- };
7916
- self.dispatchEvent(wpgmzaEvent);
7917
- });
7918
-
7919
- google.maps.event.addListener(this.googleMap, "rightclick", function(event) {
7920
- var wpgmzaEvent = new WPGMZA.Event("rightclick");
7921
- wpgmzaEvent.latLng = {
7922
- lat: event.latLng.lat(),
7923
- lng: event.latLng.lng()
7924
- };
7925
- self.dispatchEvent(wpgmzaEvent);
7926
- });
7927
-
7928
- google.maps.event.addListener(this.googleMap, "dragend", function(event) {
7929
- self.dispatchEvent("dragend");
7930
- });
7931
-
7932
- google.maps.event.addListener(this.googleMap, "zoom_changed", function(event) {
7933
- self.dispatchEvent("zoom_changed");
7934
- self.dispatchEvent("zoomchanged");
7935
- });
7936
-
7937
- // Idle event
7938
- google.maps.event.addListener(this.googleMap, "idle", function(event) {
7939
- self.onIdle(event);
7940
- });
7941
-
7942
- // Dispatch event
7943
- if(!WPGMZA.isProVersion())
7944
- {
7945
- this.trigger("init");
7946
-
7947
- this.dispatchEvent("created");
7948
- WPGMZA.events.dispatchEvent({type: "mapcreated", map: this});
7949
-
7950
- // Legacy event
7951
- $(this.element).trigger("wpgooglemaps_loaded");
7952
- }
7953
- }
7954
-
7955
- // If we're running the Pro version, inherit from ProMap, otherwise, inherit from Map
7956
- if(WPGMZA.isProVersion())
7957
- {
7958
- Parent = WPGMZA.ProMap;
7959
- WPGMZA.GoogleMap.prototype = Object.create(WPGMZA.ProMap.prototype);
7960
- }
7961
- else
7962
- {
7963
- Parent = WPGMZA.Map;
7964
- WPGMZA.GoogleMap.prototype = Object.create(WPGMZA.Map.prototype);
7965
- }
7966
- WPGMZA.GoogleMap.prototype.constructor = WPGMZA.GoogleMap;
7967
-
7968
- WPGMZA.GoogleMap.parseThemeData = function(raw)
7969
- {
7970
- var json;
7971
-
7972
- try{
7973
- json = JSON.parse(raw); // Try to parse strict JSON
7974
- }catch(e) {
7975
-
7976
- try{
7977
-
7978
- json = eval(raw); // Try to parse JS object
7979
-
7980
- }catch(e) {
7981
-
7982
- var str = raw;
7983
-
7984
- str = str.replace(/\\'/g, '\'');
7985
- str = str.replace(/\\"/g, '"');
7986
- str = str.replace(/\\0/g, '\0');
7987
- str = str.replace(/\\\\/g, '\\');
7988
-
7989
- try{
7990
-
7991
- json = eval(str);
7992
-
7993
- }catch(e) {
7994
-
7995
- console.warn("Couldn't parse theme data");
7996
-
7997
- return [];
7998
-
7999
- }
8000
-
8001
- }
8002
-
8003
- }
8004
-
8005
- return json;
8006
- }
8007
-
8008
- /**
8009
- * Creates the Google Maps map
8010
- * @return void
8011
- */
8012
- WPGMZA.GoogleMap.prototype.loadGoogleMap = function()
8013
- {
8014
- var self = this;
8015
- var options = this.settings.toGoogleMapsOptions();
8016
-
8017
- this.googleMap = new google.maps.Map(this.engineElement, options);
8018
-
8019
- google.maps.event.addListener(this.googleMap, "bounds_changed", function() {
8020
- self.onBoundsChanged();
8021
- });
8022
-
8023
- if(this.settings.bicycle == 1)
8024
- this.enableBicycleLayer(true);
8025
- if(this.settings.traffic == 1)
8026
- this.enableTrafficLayer(true);
8027
- if(this.settings.transport == 1)
8028
- this.enablePublicTransportLayer(true);
8029
- this.showPointsOfInterest(this.settings.show_point_of_interest);
8030
-
8031
- // Move the loading wheel into the map element (it has to live outside in the HTML file because it'll be overwritten by Google otherwise)
8032
- $(this.engineElement).append($(this.element).find(".wpgmza-loader"));
8033
- }
8034
-
8035
- WPGMZA.GoogleMap.prototype.setOptions = function(options, initializing)
8036
- {
8037
- Parent.prototype.setOptions.call(this, options);
8038
-
8039
- if(options.scrollwheel)
8040
- delete options.scrollwheel; // NB: Delete this when true, scrollwheel: true breaks gesture handling
8041
-
8042
- if(!initializing)
8043
- {
8044
- this.googleMap.setOptions(options);
8045
- return;
8046
- }
8047
-
8048
- var converted = $.extend(options, this.settings.toGoogleMapsOptions());
8049
-
8050
- var clone = $.extend({}, converted);
8051
- if(!clone.center instanceof google.maps.LatLng && (clone.center instanceof WPGMZA.LatLng || typeof clone.center == "object"))
8052
- clone.center = {
8053
- lat: parseFloat(clone.center.lat),
8054
- lng: parseFloat(clone.center.lng)
8055
- };
8056
-
8057
- if(this.settings.hide_point_of_interest == "1")
8058
- {
8059
- var noPoi = {
8060
- featureType: "poi",
8061
- elementType: "labels",
8062
- stylers: [
8063
- {
8064
- visibility: "off"
8065
- }
8066
- ]
8067
- };
8068
-
8069
- if(!clone.styles)
8070
- clone.styles = [];
8071
-
8072
- clone.styles.push(noPoi);
8073
- }
8074
-
8075
- this.googleMap.setOptions(clone);
8076
- }
8077
-
8078
- /**
8079
- * Adds the specified marker to this map
8080
- * @return void
8081
- */
8082
- WPGMZA.GoogleMap.prototype.addMarker = function(marker)
8083
- {
8084
- marker.googleMarker.setMap(this.googleMap);
8085
-
8086
- Parent.prototype.addMarker.call(this, marker);
8087
- }
8088
-
8089
- /**
8090
- * Removes the specified marker from this map
8091
- * @return void
8092
- */
8093
- WPGMZA.GoogleMap.prototype.removeMarker = function(marker)
8094
- {
8095
- marker.googleMarker.setMap(null);
8096
-
8097
- Parent.prototype.removeMarker.call(this, marker);
8098
- }
8099
-
8100
- /**
8101
- * Adds the specified polygon to this map
8102
- * @return void
8103
- */
8104
- WPGMZA.GoogleMap.prototype.addPolygon = function(polygon)
8105
- {
8106
- polygon.googlePolygon.setMap(this.googleMap);
8107
-
8108
- Parent.prototype.addPolygon.call(this, polygon);
8109
- }
8110
-
8111
- /**
8112
- * Removes the specified polygon from this map
8113
- * @return void
8114
- */
8115
- WPGMZA.GoogleMap.prototype.removePolygon = function(polygon)
8116
- {
8117
- polygon.googlePolygon.setMap(null);
8118
-
8119
- Parent.prototype.removePolygon.call(this, polygon);
8120
- }
8121
-
8122
- /**
8123
- * Adds the specified polyline to this map
8124
- * @return void
8125
- */
8126
- WPGMZA.GoogleMap.prototype.addPolyline = function(polyline)
8127
- {
8128
- polyline.googlePolyline.setMap(this.googleMap);
8129
-
8130
- Parent.prototype.addPolyline.call(this, polyline);
8131
- }
8132
-
8133
- /**
8134
- * Removes the specified polygon from this map
8135
- * @return void
8136
- */
8137
- WPGMZA.GoogleMap.prototype.removePolyline = function(polyline)
8138
- {
8139
- polyline.googlePolyline.setMap(null);
8140
-
8141
- Parent.prototype.removePolyline.call(this, polyline);
8142
- }
8143
-
8144
- WPGMZA.GoogleMap.prototype.addCircle = function(circle)
8145
- {
8146
- circle.googleCircle.setMap(this.googleMap);
8147
-
8148
- Parent.prototype.addCircle.call(this, circle);
8149
- }
8150
-
8151
- WPGMZA.GoogleMap.prototype.removeCircle = function(circle)
8152
- {
8153
- circle.googleCircle.setMap(null);
8154
-
8155
- Parent.prototype.removeCircle.call(this, circle);
8156
- }
8157
-
8158
- WPGMZA.GoogleMap.prototype.addRectangle = function(rectangle)
8159
- {
8160
- rectangle.googleRectangle.setMap(this.googleMap);
8161
-
8162
- Parent.prototype.addRectangle.call(this, rectangle);
8163
- }
8164
-
8165
- WPGMZA.GoogleMap.prototype.removeRectangle = function(rectangle)
8166
- {
8167
- rectangle.googleRectangle.setMap(null);
8168
-
8169
- Parent.prototype.removeRectangle.call(this, rectangle);
8170
- }
8171
-
8172
- /**
8173
- * Delegate for google maps getCenter
8174
- * @return void
8175
- */
8176
- WPGMZA.GoogleMap.prototype.getCenter = function()
8177
- {
8178
- var latLng = this.googleMap.getCenter();
8179
-
8180
- return {
8181
- lat: latLng.lat(),
8182
- lng: latLng.lng()
8183
- };
8184
- }
8185
-
8186
- /**
8187
- * Delegate for google maps setCenter
8188
- * @return void
8189
- */
8190
- WPGMZA.GoogleMap.prototype.setCenter = function(latLng)
8191
- {
8192
- WPGMZA.Map.prototype.setCenter.call(this, latLng);
8193
-
8194
- if(latLng instanceof WPGMZA.LatLng)
8195
- this.googleMap.setCenter({
8196
- lat: latLng.lat,
8197
- lng: latLng.lng
8198
- });
8199
- else
8200
- this.googleMap.setCenter(latLng);
8201
- }
8202
-
8203
- /**
8204
- * Delegate for google maps setPan
8205
- * @return void
8206
- */
8207
- WPGMZA.GoogleMap.prototype.panTo = function(latLng)
8208
- {
8209
- if(latLng instanceof WPGMZA.LatLng)
8210
- this.googleMap.panTo({
8211
- lat: latLng.lat,
8212
- lng: latLng.lng
8213
- });
8214
- else
8215
- this.googleMap.panTo(latLng);
8216
  }
8217
 
8218
- /**
8219
- * Delegate for google maps getCenter
8220
- * @return void
8221
- */
8222
- WPGMZA.GoogleMap.prototype.getZoom = function()
8223
  {
8224
- return this.googleMap.getZoom();
8225
  }
8226
 
8227
- /**
8228
- * Delegate for google maps getZoom
8229
- * @return void
8230
- */
8231
- WPGMZA.GoogleMap.prototype.setZoom = function(value)
8232
  {
8233
- if(isNaN(value))
8234
- throw new Error("Value must not be NaN");
8235
-
8236
- return this.googleMap.setZoom(parseInt(value));
8237
  }
8238
 
8239
- /**
8240
- * Gets the bounds
8241
- * @return object
8242
- */
8243
- WPGMZA.GoogleMap.prototype.getBounds = function()
 
 
 
 
 
 
8244
  {
8245
- var bounds = this.googleMap.getBounds();
8246
- var northEast = bounds.getNorthEast();
8247
- var southWest = bounds.getSouthWest();
8248
 
8249
- var nativeBounds = new WPGMZA.LatLngBounds({});
8250
 
8251
- nativeBounds.north = northEast.lat();
8252
- nativeBounds.south = southWest.lat();
8253
- nativeBounds.west = southWest.lng();
8254
- nativeBounds.east = northEast.lng();
8255
 
8256
- // Backward compatibility
8257
- nativeBounds.topLeft = {
8258
- lat: northEast.lat(),
8259
- lng: southWest.lng()
8260
- };
8261
 
8262
- nativeBounds.bottomRight = {
8263
- lat: southWest.lat(),
8264
- lng: northEast.lng()
8265
- };
8266
 
8267
- return nativeBounds;
 
 
 
 
 
 
 
 
 
 
8268
  }
8269
 
8270
- /**
8271
- * Fit to given boundaries
8272
- * @return void
8273
- */
8274
- WPGMZA.GoogleMap.prototype.fitBounds = function(southWest, northEast)
8275
  {
8276
- if(southWest instanceof WPGMZA.LatLng)
8277
- southWest = {lat: southWest.lat, lng: southWest.lng};
8278
- if(northEast instanceof WPGMZA.LatLng)
8279
- northEast = {lat: northEast.lat, lng: northEast.lng};
8280
- else if(southWest instanceof WPGMZA.LatLngBounds)
8281
- {
8282
- var bounds = southWest;
8283
-
8284
- southWest = {
8285
- lat: bounds.south,
8286
- lng: bounds.west
8287
- };
8288
-
8289
- northEast = {
8290
- lat: bounds.north,
8291
- lng: bounds.east
8292
- };
8293
- }
8294
-
8295
- var nativeBounds = new google.maps.LatLngBounds(southWest, northEast);
8296
- this.googleMap.fitBounds(nativeBounds);
8297
  }
8298
 
8299
- /**
8300
- * Fit the map boundaries to visible markers
8301
- * @return void
8302
- */
8303
- WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers = function()
8304
  {
8305
- var bounds = new google.maps.LatLngBounds();
8306
- for(var i = 0; i < this.markers.length; i++)
 
 
8307
  {
8308
- if(markers[i].getVisible())
8309
- bounds.extend(markers[i].getPosition());
8310
  }
8311
- this.googleMap.fitBounds(bounds);
8312
- }
8313
-
8314
- /**
8315
- * Enables / disables the bicycle layer
8316
- * @param enable boolean, enable or not
8317
- * @return void
8318
- */
8319
- WPGMZA.GoogleMap.prototype.enableBicycleLayer = function(enable)
8320
- {
8321
- if(!this.bicycleLayer)
8322
- this.bicycleLayer = new google.maps.BicyclingLayer();
8323
 
8324
- this.bicycleLayer.setMap(
8325
- enable ? this.googleMap : null
8326
- );
8327
  }
8328
 
8329
- /**
8330
- * Enables / disables the bicycle layer
8331
- * @param enable boolean, enable or not
8332
- * @return void
8333
- */
8334
- WPGMZA.GoogleMap.prototype.enableTrafficLayer = function(enable)
8335
  {
8336
- if(!this.trafficLayer)
8337
- this.trafficLayer = new google.maps.TrafficLayer();
8338
-
8339
- this.trafficLayer.setMap(
8340
- enable ? this.googleMap : null
8341
- );
8342
  }
8343
 
8344
- /**
8345
- * Enables / disables the bicycle layer
8346
- * @param enable boolean, enable or not
8347
- * @return void
8348
- */
8349
- WPGMZA.GoogleMap.prototype.enablePublicTransportLayer = function(enable)
8350
  {
8351
- if(!this.publicTransportLayer)
8352
- this.publicTransportLayer = new google.maps.TransitLayer();
8353
 
8354
- this.publicTransportLayer.setMap(
8355
- enable ? this.googleMap : null
8356
- );
 
 
 
 
 
 
 
 
 
 
8357
  }
8358
 
8359
- /**
8360
- * Shows / hides points of interest
8361
- * @param show boolean, enable or not
8362
- * @return void
8363
- */
8364
- WPGMZA.GoogleMap.prototype.showPointsOfInterest = function(show)
8365
  {
8366
- // TODO: This will bug the front end because there is no textarea with theme data
8367
- var text = $("textarea[name='theme_data']").val();
8368
-
8369
- if(!text)
8370
- return;
8371
-
8372
- var styles = JSON.parse(text);
8373
 
8374
- styles.push({
8375
- featureType: "poi",
8376
- stylers: [
8377
- {
8378
- visibility: (show ? "on" : "off")
8379
- }
8380
- ]
 
 
 
 
 
8381
  });
8382
-
8383
- this.googleMap.setOptions({styles: styles});
8384
  }
8385
 
8386
- /**
8387
- * Gets the min zoom of the map
8388
- * @return int
8389
- */
8390
- WPGMZA.GoogleMap.prototype.getMinZoom = function()
8391
  {
8392
- return parseInt(this.settings.min_zoom);
8393
  }
8394
 
8395
- /**
8396
- * Sets the min zoom of the map
8397
- * @return void
8398
- */
8399
- WPGMZA.GoogleMap.prototype.setMinZoom = function(value)
8400
  {
8401
- this.googleMap.setOptions({
8402
- minZoom: value,
8403
- maxZoom: this.getMaxZoom()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8404
  });
8405
  }
8406
-
8407
- /**
8408
- * Gets the min zoom of the map
8409
- * @return int
8410
- */
8411
- WPGMZA.GoogleMap.prototype.getMaxZoom = function()
8412
  {
8413
- return parseInt(this.settings.max_zoom);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8414
  }
8415
 
8416
- /**
8417
- * Sets the min zoom of the map
8418
- * @return void
8419
- */
8420
- WPGMZA.GoogleMap.prototype.setMaxZoom = function(value)
8421
- {
8422
- this.googleMap.setOptions({
8423
- minZoom: this.getMinZoom(),
8424
- maxZoom: value
8425
  });
8426
- }
 
8427
 
8428
- WPGMZA.GoogleMap.prototype.latLngToPixels = function(latLng)
8429
- {
8430
- var map = this.googleMap;
8431
- var nativeLatLng = new google.maps.LatLng({
8432
- lat: parseFloat(latLng.lat),
8433
- lng: parseFloat(latLng.lng)
8434
- });
8435
- var topRight = map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast());
8436
- var bottomLeft = map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest());
8437
- var scale = Math.pow(2, map.getZoom());
8438
- var worldPoint = map.getProjection().fromLatLngToPoint(nativeLatLng);
8439
- return {
8440
- x: (worldPoint.x - bottomLeft.x) * scale,
8441
- y: (worldPoint.y - topRight.y) * scale
8442
- };
8443
- }
8444
 
8445
- WPGMZA.GoogleMap.prototype.pixelsToLatLng = function(x, y)
8446
- {
8447
- if(y == undefined)
8448
- {
8449
- if("x" in x && "y" in x)
8450
- {
8451
- y = x.y;
8452
- x = x.x;
8453
- }
8454
- else
8455
- console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)");
8456
- }
8457
-
8458
- var map = this.googleMap;
8459
- var topRight = map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast());
8460
- var bottomLeft = map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest());
8461
- var scale = Math.pow(2, map.getZoom());
8462
- var worldPoint = new google.maps.Point(x / scale + bottomLeft.x, y / scale + topRight.y);
8463
- var latLng = map.getProjection().fromPointToLatLng(worldPoint);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8464
  return {
8465
- lat: latLng.lat(),
8466
- lng: latLng.lng()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8467
  };
8468
- }
8469
-
8470
- /**
8471
- * Handle the map element resizing
8472
- * @return void
8473
- */
8474
- WPGMZA.GoogleMap.prototype.onElementResized = function(event)
8475
- {
8476
- if(!this.googleMap)
8477
- return;
8478
- google.maps.event.trigger(this.googleMap, "resize");
8479
- }
8480
 
8481
- WPGMZA.GoogleMap.prototype.enableAllInteractions = function()
8482
- {
8483
- var options = {};
8484
 
8485
- options.scrollwheel = true;
8486
- options.draggable = true;
8487
- options.disableDoubleClickZoom = false;
8488
-
8489
- this.googleMap.setOptions(options);
8490
- }
8491
-
8492
  });
8493
 
8494
- // js/v8/google-maps/google-marker.js
8495
  /**
8496
  * @namespace WPGMZA
8497
- * @module GoogleMarker
8498
- * @requires WPGMZA.Marker
8499
- * @pro-requires WPGMZA.ProMarker
8500
  */
8501
  jQuery(function($) {
8502
 
8503
- var Parent;
8504
 
8505
- WPGMZA.GoogleMarker = function(row)
8506
  {
8507
  var self = this;
8508
 
8509
- Parent.call(this, row);
 
8510
 
8511
- this._opacity = 1.0;
 
8512
 
8513
- var settings = {};
8514
- if(row)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8515
  {
8516
- for(var name in row)
8517
- {
8518
- if(row[name] instanceof WPGMZA.LatLng)
8519
- {
8520
- settings[name] = row[name].toGoogleLatLng();
8521
- }
8522
- else if(row[name] instanceof WPGMZA.Map || name == "icon")
8523
- {
8524
- // NB: Ignore map here, it's not a google.maps.Map, Google would throw an exception
8525
- // NB: Ignore icon here, it conflicts with updateIcon in Pro
8526
- }
8527
- else
8528
- settings[name] = row[name];
8529
- }
8530
  }
8531
 
8532
- this.googleMarker = new google.maps.Marker(settings);
8533
- this.googleMarker.wpgmzaMarker = this;
8534
 
8535
- this.googleMarker.setPosition(new google.maps.LatLng({
8536
- lat: parseFloat(this.lat),
8537
- lng: parseFloat(this.lng)
8538
- }));
8539
-
8540
- // this.googleMarker.setLabel(this.settings.label);
8541
 
8542
- if(this.anim)
8543
- this.googleMarker.setAnimation(this.anim);
8544
- if(this.animation)
8545
- this.googleMarker.setAnimation(this.animation);
8546
-
8547
- google.maps.event.addListener(this.googleMarker, "click", function() {
8548
- self.dispatchEvent("click");
8549
- self.dispatchEvent("select");
8550
- });
8551
 
8552
- google.maps.event.addListener(this.googleMarker, "mouseover", function() {
8553
- self.dispatchEvent("mouseover");
8554
- });
8555
 
8556
- google.maps.event.addListener(this.googleMarker, "dragend", function() {
8557
- var googleMarkerPosition = self.googleMarker.getPosition();
8558
-
8559
- self.setPosition({
8560
- lat: googleMarkerPosition.lat(),
8561
- lng: googleMarkerPosition.lng()
 
 
 
 
 
 
 
 
 
 
 
8562
  });
8563
 
8564
- self.dispatchEvent({
8565
- type: "dragend",
8566
- latLng: self.getPosition()
8567
- });
8568
- });
8569
-
8570
- this.trigger("init");
8571
  }
8572
 
8573
- if(WPGMZA.isProVersion())
8574
- Parent = WPGMZA.ProMarker;
8575
- else
8576
- Parent = WPGMZA.Marker;
8577
- WPGMZA.GoogleMarker.prototype = Object.create(Parent.prototype);
8578
- WPGMZA.GoogleMarker.prototype.constructor = WPGMZA.GoogleMarker;
 
8579
 
8580
- Object.defineProperty(WPGMZA.GoogleMarker.prototype, "opacity", {
8581
-
8582
- "get": function() {
8583
- return this._opacity;
8584
- },
8585
-
8586
- "set": function(value) {
8587
- this._opacity = value;
8588
- this.googleMarker.setOpacity(value);
8589
- }
8590
 
8591
- });
 
8592
 
8593
- WPGMZA.GoogleMarker.prototype.setLabel = function(label)
8594
  {
8595
- if(!label)
8596
- {
8597
- this.googleMarker.setLabel(null);
8598
- return;
8599
- }
8600
 
8601
- this.googleMarker.setLabel({
8602
- text: label
8603
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8604
 
8605
- if(!this.googleMarker.getIcon())
8606
- this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon);
8607
  }
8608
 
 
 
 
8609
  /**
8610
- * Sets the position of the marker
8611
- * @return void
 
 
 
 
8612
  */
8613
- WPGMZA.GoogleMarker.prototype.setPosition = function(latLng)
8614
  {
8615
- Parent.prototype.setPosition.call(this, latLng);
8616
- this.googleMarker.setPosition({
8617
- lat: this.lat,
8618
- lng: this.lng
 
 
 
 
 
 
 
8619
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
8620
  }
8621
 
8622
  /**
8623
- * Sets the position offset of a marker
8624
- * @return void
 
 
 
8625
  */
8626
- WPGMZA.GoogleMarker.prototype.updateOffset = function()
8627
  {
8628
- var self = this;
8629
- var icon = this.googleMarker.getIcon();
8630
- var img = new Image();
8631
- var params;
8632
- var x = this._offset.x;
8633
- var y = this._offset.y;
8634
-
8635
- if(!icon)
8636
- icon = WPGMZA.settings.default_marker_icon;
8637
-
8638
- if(typeof icon == "string")
8639
- params = {
8640
- url: icon
8641
- };
8642
- else
8643
- params = icon;
8644
 
8645
- img.onload = function()
8646
- {
8647
- var defaultAnchor = {
8648
- x: img.width / 2,
8649
- y: img.height
8650
- };
8651
-
8652
- params.anchor = new google.maps.Point(defaultAnchor.x - x, defaultAnchor.y - y);
8653
-
8654
- self.googleMarker.setIcon(params);
8655
- }
8656
 
8657
- img.src = params.url;
8658
- }
8659
-
8660
- WPGMZA.GoogleMarker.prototype.setOptions = function(options)
8661
- {
8662
- this.googleMarker.setOptions(options);
 
 
 
8663
  }
8664
 
8665
  /**
8666
- * Set the marker animation
8667
- * @return void
 
 
 
 
8668
  */
8669
- WPGMZA.GoogleMarker.prototype.setAnimation = function(animation)
8670
  {
8671
- Parent.prototype.setAnimation.call(this, animation);
8672
- this.googleMarker.setAnimation(animation);
 
 
 
 
 
 
8673
  }
8674
-
8675
  /**
8676
- * Sets the visibility of the marker
8677
- * @return void
 
 
8678
  */
8679
- WPGMZA.GoogleMarker.prototype.setVisible = function(visible)
8680
  {
8681
- Parent.prototype.setVisible.call(this, visible);
8682
-
8683
- this.googleMarker.setVisible(visible ? true : false);
 
 
 
 
 
 
8684
  }
8685
 
8686
- WPGMZA.GoogleMarker.prototype.getVisible = function(visible)
8687
  {
8688
- return this.googleMarker.getVisible();
8689
  }
8690
 
8691
- WPGMZA.GoogleMarker.prototype.setDraggable = function(draggable)
8692
  {
8693
- this.googleMarker.setDraggable(draggable);
8694
  }
8695
 
8696
- WPGMZA.GoogleMarker.prototype.setOpacity = function(opacity)
8697
  {
8698
- this.googleMarker.setOpacity(opacity);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8699
  }
8700
 
8701
  });
8702
 
8703
- // js/v8/google-maps/google-modern-store-locator-circle.js
8704
  /**
8705
  * @namespace WPGMZA
8706
- * @module GoogleModernStoreLocatorCircle
8707
- * @requires WPGMZA.ModernStoreLocatorCircle
 
8708
  */
8709
  jQuery(function($) {
8710
 
8711
- WPGMZA.GoogleModernStoreLocatorCircle = function(map, settings)
 
 
8712
  {
8713
  var self = this;
8714
 
8715
- WPGMZA.ModernStoreLocatorCircle.call(this, map, settings);
8716
-
8717
- this.intervalID = setInterval(function() {
8718
-
8719
- var mapSize = {
8720
- width: $(self.mapElement).width(),
8721
- height: $(self.mapElement).height()
8722
- };
8723
-
8724
- if(mapSize.width == self.mapSize.width && mapSize.height == self.mapSize.height)
8725
- return;
8726
-
8727
- self.canvasLayer.resize_();
8728
- self.canvasLayer.draw();
8729
-
8730
- self.mapSize = mapSize;
8731
-
8732
- }, 1000);
8733
 
8734
- $(document).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function() {
8735
-
8736
- self.canvasLayer.resize_();
8737
- self.canvasLayer.draw();
8738
 
 
 
8739
  });
8740
  }
8741
 
8742
- WPGMZA.GoogleModernStoreLocatorCircle.prototype = Object.create(WPGMZA.ModernStoreLocatorCircle.prototype);
8743
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor = WPGMZA.GoogleModernStoreLocatorCircle;
 
 
8744
 
8745
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer = function()
8746
- {
8747
- var self = this;
 
8748
 
8749
- if(this.canvasLayer)
8750
  {
8751
- this.canvasLayer.setMap(null);
8752
- this.canvasLayer.setAnimate(false);
8753
  }
8754
 
8755
- this.canvasLayer = new CanvasLayer({
8756
- map: this.map.googleMap,
8757
- resizeHandler: function(event) {
8758
- self.onResize(event);
8759
- },
8760
- updateHandler: function(event) {
8761
- self.onUpdate(event);
8762
- },
8763
- animate: true,
8764
- resolutionScale: this.getResolutionScale()
8765
- });
8766
- }
8767
-
8768
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions = function(options)
8769
- {
8770
- WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this, options);
8771
-
8772
- this.canvasLayer.scheduleUpdate();
8773
- }
8774
 
8775
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition = function(position)
 
 
 
 
 
8776
  {
8777
- WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this, position);
 
8778
 
8779
- this.canvasLayer.scheduleUpdate();
8780
- }
8781
-
8782
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius = function(radius)
8783
- {
8784
- WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this, radius);
8785
 
8786
- this.canvasLayer.scheduleUpdate();
8787
- }
8788
-
8789
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius = function(km)
8790
- {
8791
- var multiplierAtEquator = 0.006395;
8792
- var spherical = google.maps.geometry.spherical;
8793
 
8794
- var center = this.settings.center;
8795
- var equator = new WPGMZA.LatLng({
8796
- lat: 0.0,
8797
- lng: 0.0
8798
- });
8799
- var latitude = new WPGMZA.LatLng({
8800
- lat: center.lat,
8801
- lng: 0.0
8802
  });
8803
 
8804
- var offsetAtEquator = spherical.computeOffset(equator.toGoogleLatLng(), km * 1000, 90);
8805
- var offsetAtLatitude = spherical.computeOffset(latitude.toGoogleLatLng(), km * 1000, 90);
 
 
 
8806
 
8807
- var factor = offsetAtLatitude.lng() / offsetAtEquator.lng();
8808
- var result = km * multiplierAtEquator * factor;
8809
 
8810
- if(isNaN(result))
8811
- throw new Error("here");
 
 
 
 
 
 
8812
 
8813
- return result;
8814
- }
8815
-
8816
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions = function()
8817
- {
8818
- return {
8819
- width: this.canvasLayer.canvas.width,
8820
- height: this.canvasLayer.canvas.height
8821
- };
8822
  }
8823
 
8824
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset = function()
8825
  {
8826
- var projection = this.map.googleMap.getProjection();
8827
- var position = projection.fromLatLngToPoint(this.canvasLayer.getTopLeft());
8828
 
8829
- return {
8830
- x: -position.x,
8831
- y: -position.y
8832
- };
8833
- }
8834
-
8835
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels = function()
8836
- {
8837
- var center = new WPGMZA.LatLng(this.settings.center);
8838
- var projection = this.map.googleMap.getProjection();
8839
- return projection.fromLatLngToPoint(center.toGoogleLatLng());
8840
  }
8841
 
8842
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext = function(type)
8843
  {
8844
- return this.canvasLayer.canvas.getContext("2d");
8845
  }
8846
 
8847
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale = function()
8848
  {
8849
- return Math.pow(2, this.map.getZoom()) * this.getResolutionScale();
 
 
 
8850
  }
8851
 
8852
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible = function(visible)
8853
  {
8854
- WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this, visible);
 
 
 
8855
 
8856
- this.canvasLayer.scheduleUpdate();
8857
- }
8858
-
8859
- WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy = function()
8860
- {
8861
- this.canvasLayer.setMap(null);
8862
- this.canvasLayer = null;
8863
 
8864
- clearInterval(this.intervalID);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8865
  }
8866
 
8867
  });
8868
 
8869
- // js/v8/google-maps/google-modern-store-locator.js
8870
  /**
8871
  * @namespace WPGMZA
8872
- * @module GoogleModernStoreLocator
8873
- * @requires WPGMZA.ModernStoreLocator
 
8874
  */
8875
  jQuery(function($) {
8876
 
8877
- WPGMZA.GoogleModernStoreLocator = function(map_id)
 
 
8878
  {
8879
- var googleMap, self = this;
8880
 
8881
- this.map = WPGMZA.getMapByID(map_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8882
 
8883
- WPGMZA.ModernStoreLocator.call(this, map_id);
8884
-
8885
- var options = {
8886
- fields: ["name", "formatted_address"],
8887
- types: ["geocode"]
8888
- };
8889
- var restrict = wpgmaps_localize[map_id]["other_settings"]["wpgmza_store_locator_restrict"];
 
8890
 
8891
- this.addressInput = $(this.element).find(".addressInput, #addressInput")[0];
 
8892
 
8893
- if(this.addressInput)
8894
  {
8895
- if(restrict && restrict.length)
8896
- options.componentRestrictions = {
8897
- country: restrict
8898
- };
 
 
 
8899
 
8900
- this.autoComplete = new google.maps.places.Autocomplete(
8901
- this.addressInput,
8902
- options
8903
- );
 
 
 
 
 
 
 
 
 
 
8904
  }
8905
 
8906
- // Positioning for Google
8907
- this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element);
8908
- }
8909
-
8910
- WPGMZA.GoogleModernStoreLocator.prototype = Object.create(WPGMZA.ModernStoreLocator.prototype);
8911
- WPGMZA.GoogleModernStoreLocator.prototype.constructor = WPGMZA.GoogleModernStoreLocator;
8912
-
8913
- });
8914
-
8915
- // js/v8/google-maps/google-polygon.js
8916
- /**
8917
- * @namespace WPGMZA
8918
- * @module GooglePolygon
8919
- * @requires WPGMZA.Polygon
8920
- * @pro-requires WPGMZA.ProPolygon
8921
- */
8922
- jQuery(function($) {
8923
-
8924
- var Parent;
8925
-
8926
- WPGMZA.GooglePolygon = function(options, googlePolygon)
8927
- {
8928
- var self = this;
8929
 
8930
- Parent.call(this, options, googlePolygon);
 
 
 
 
 
 
 
8931
 
8932
- if(googlePolygon)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8933
  {
8934
- this.googlePolygon = googlePolygon;
 
8935
  }
8936
- else
8937
- {
8938
- this.googlePolygon = new google.maps.Polygon();
8939
 
8940
- if(options)
 
 
 
 
 
 
 
 
 
 
8941
  {
8942
- var googleOptions = $.extend({}, options);
8943
-
8944
- if(options.polydata)
8945
- googleOptions.paths = this.parseGeometry(options.polydata);
8946
-
8947
- if(options.linecolor)
8948
- googleOptions.strokeColor = "#" + options.linecolor;
8949
-
8950
- if(options.lineopacity)
8951
- googleOptions.strokeOpacity = parseFloat(options.lineopacity);
8952
 
8953
- if(options.fillcolor)
8954
- googleOptions.fillColor = "#" + options.fillcolor;
 
8955
 
8956
- if(options.opacity)
8957
- googleOptions.fillOpacity = parseFloat(options.opacity);
 
 
8958
 
8959
- this.googlePolygon.setOptions(googleOptions);
8960
  }
8961
- }
8962
-
8963
- this.googlePolygon.wpgmzaPolygon = this;
8964
 
8965
- google.maps.event.addListener(this.googlePolygon, "click", function() {
8966
- self.dispatchEvent({type: "click"});
 
 
8967
  });
 
 
 
 
 
 
 
 
 
 
 
 
8968
  }
8969
-
8970
  if(WPGMZA.isProVersion())
8971
- Parent = WPGMZA.ProPolygon;
8972
  else
8973
- Parent = WPGMZA.Polygon;
 
 
 
 
 
 
 
8974
 
8975
- WPGMZA.GooglePolygon.prototype = Object.create(Parent.prototype);
8976
- WPGMZA.GooglePolygon.prototype.constructor = WPGMZA.GooglePolygon;
 
 
 
 
 
8977
 
8978
- /**
8979
- * Returns true if the polygon is editable
8980
- * @return void
8981
- */
8982
- WPGMZA.GooglePolygon.prototype.getEditable = function()
8983
  {
8984
- return this.googlePolygon.getOptions().editable;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8985
  }
8986
 
8987
- /**
8988
- * Sets the editable state of the polygon
8989
- * @return void
8990
- */
8991
- WPGMZA.GooglePolygon.prototype.setEditable = function(value)
8992
  {
8993
- this.googlePolygon.setOptions({editable: value});
 
 
 
 
 
 
8994
  }
8995
 
8996
- /**
8997
- * Returns the polygon represented by a JSON object
8998
- * @return object
8999
- */
9000
- WPGMZA.GooglePolygon.prototype.toJSON = function()
9001
  {
9002
- var result = WPGMZA.Polygon.prototype.toJSON.call(this);
9003
 
9004
- result.points = [];
9005
 
9006
- // TODO: Support holes using multiple paths
9007
- var path = this.googlePolygon.getPath();
9008
- for(var i = 0; i < path.getLength(); i++)
9009
- {
9010
- var latLng = path.getAt(i);
9011
- result.points.push({
9012
- lat: latLng.lat(),
9013
- lng: latLng.lng()
9014
- });
9015
- }
9016
 
9017
- return result;
9018
- }
9019
-
9020
- });
9021
 
9022
- // js/v8/google-maps/google-polyline.js
9023
- /**
9024
- * @namespace WPGMZA
9025
- * @module GooglePolyline
9026
- * @requires WPGMZA.Polyline
9027
- */
9028
- jQuery(function($) {
9029
 
9030
- WPGMZA.GooglePolyline = function(options, googlePolyline)
9031
  {
9032
- var self = this;
 
9033
 
9034
- WPGMZA.Polyline.call(this, options, googlePolyline);
 
9035
 
9036
- if(googlePolyline)
9037
- {
9038
- this.googlePolyline = googlePolyline;
9039
- }
9040
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9041
  {
9042
- this.googlePolyline = new google.maps.Polyline(this.settings);
9043
 
9044
- if(options)
9045
- {
9046
- var googleOptions = $.extend({}, options);
9047
-
9048
- if(options.polydata)
9049
- googleOptions.path = this.parseGeometry(options.polydata);
9050
-
9051
- if(options.linecolor)
9052
- googleOptions.strokeColor = "#" + options.linecolor;
9053
-
9054
- if(options.linethickness)
9055
- googleOptions.strokeWeight = parseInt(options.linethickness);
9056
-
9057
- if(options.opacity)
9058
- googleOptions.strokeOpacity = parseFloat(options.opacity);
9059
- }
9060
 
9061
- if(options && options.polydata)
9062
- {
9063
- var path = this.parseGeometry(options.polydata);
9064
- this.setPoints(path);
9065
- }
9066
  }
9067
 
9068
- this.googlePolyline.wpgmzaPolyline = this;
9069
 
9070
- google.maps.event.addListener(this.googlePolyline, "click", function() {
9071
- self.dispatchEvent({type: "click"});
9072
- });
 
 
 
 
 
 
 
 
9073
  }
9074
 
9075
- WPGMZA.GooglePolyline.prototype = Object.create(WPGMZA.Polyline.prototype);
9076
- WPGMZA.GooglePolyline.prototype.constructor = WPGMZA.GooglePolyline;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9077
 
9078
- WPGMZA.GooglePolyline.prototype.setEditable = function(value)
9079
  {
9080
- this.googlePolyline.setOptions({editable: value});
9081
  }
9082
 
9083
- WPGMZA.GooglePolyline.prototype.setPoints = function(points)
9084
  {
9085
- this.googlePolyline.setOptions({path: points});
9086
  }
9087
 
9088
- WPGMZA.GooglePolyline.prototype.toJSON = function()
9089
  {
9090
- var result = WPGMZA.Polyline.prototype.toJSON.call(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9091
 
9092
- result.points = [];
 
9093
 
9094
- var path = this.googlePolyline.getPath();
9095
- for(var i = 0; i < path.getLength(); i++)
 
 
 
 
 
 
 
 
 
9096
  {
9097
- var latLng = path.getAt(i);
9098
- result.points.push({
9099
- lat: latLng.lat(),
9100
- lng: latLng.lng()
9101
- });
9102
  }
9103
 
9104
- return result;
9105
  }
9106
 
9107
- });
9108
-
9109
- // js/v8/google-maps/google-text.js
9110
- /**
9111
- * @namespace WPGMZA
9112
- * @module GoogleText
9113
- * @requires WPGMZA.Text
9114
- */
9115
- jQuery(function($) {
 
 
 
9116
 
9117
- WPGMZA.GoogleText = function(options)
9118
  {
9119
- WPGMZA.Text.apply(this, arguments);
9120
 
9121
- this.overlay = new WPGMZA.GoogleTextOverlay(options);
9122
  }
9123
 
9124
- WPGMZA.extend(WPGMZA.GoogleText, WPGMZA.Text);
 
 
 
 
 
9125
 
9126
- });
9127
-
9128
- // js/v8/google-maps/google-text-overlay.js
9129
- /**
9130
- * @namespace WPGMZA
9131
- * @module GoogleTextOverlay
9132
- * @requires WPGMZA.GoogleText
9133
- */
9134
- jQuery(function($) {
9135
 
9136
- WPGMZA.GoogleTextOverlay = function(options)
9137
  {
9138
- this.element = $("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>");
9139
 
9140
- if(!options)
9141
- options = {};
 
 
 
 
9142
 
9143
- if(options.position)
9144
- this.position = options.position;
 
 
 
 
9145
 
9146
- if(options.text)
9147
- this.element.find(".wpgmza-inner").text(options.text);
 
 
 
 
9148
 
9149
- if(options.map)
9150
- this.setMap(options.map.googleMap);
9151
  }
9152
 
9153
- if(window.google && google.maps && google.maps.OverlayView)
9154
- WPGMZA.GoogleTextOverlay.prototype = new google.maps.OverlayView();
 
 
 
 
9155
 
9156
- WPGMZA.GoogleTextOverlay.prototype.onAdd = function()
9157
  {
9158
- var overlayProjection = this.getProjection();
9159
- var position = overlayProjection.fromLatLngToDivPixel(this.position.toGoogleLatLng());
 
 
 
 
 
 
 
 
9160
 
9161
- this.element.css({
9162
- position: "absolute",
9163
- left: position.x + "px",
9164
- top: position.y + "px"
9165
- });
9166
-
9167
- var panes = this.getPanes();
9168
- panes.floatPane.appendChild(this.element[0]);
 
 
 
 
 
9169
  }
9170
 
9171
- WPGMZA.GoogleTextOverlay.prototype.draw = function()
9172
  {
9173
- var overlayProjection = this.getProjection();
9174
- var position = overlayProjection.fromLatLngToDivPixel(this.position.toGoogleLatLng());
9175
 
9176
- this.element.css({
9177
- position: "absolute",
9178
- left: position.x + "px",
9179
- top: position.y + "px"
9180
- });
 
 
 
 
 
9181
  }
9182
 
9183
- WPGMZA.GoogleTextOverlay.prototype.onRemove = function()
9184
  {
9185
- this.element.remove();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9186
  }
9187
 
9188
- WPGMZA.GoogleTextOverlay.prototype.hide = function()
9189
  {
9190
- this.element.hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9191
  }
9192
 
9193
- WPGMZA.GoogleTextOverlay.prototype.show = function()
9194
  {
9195
- this.element.show();
9196
  }
9197
 
9198
- WPGMZA.GoogleTextOverlay.prototype.toggle = function()
9199
  {
9200
- if(this.element.is(":visible"))
9201
- this.element.hide();
9202
- else
9203
- this.element.show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9204
  }
9205
 
9206
  });
9207
 
9208
- // js/v8/google-maps/google-vertex-context-menu.js
9209
  /**
9210
  * @namespace WPGMZA
9211
- * @module GoogleVertexContextMenu
9212
- * @requires wpgmza_api_call
 
9213
  */
9214
  jQuery(function($) {
9215
 
9216
- if(WPGMZA.settings.engine != "google-maps")
9217
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9218
 
9219
- if(WPGMZA.googleAPIStatus && WPGMZA.googleAPIStatus.code == "USER_CONSENT_NOT_GIVEN")
9220
- return;
9221
 
9222
- WPGMZA.GoogleVertexContextMenu = function(mapEditPage)
 
 
9223
  {
9224
- var self = this;
9225
-
9226
- this.mapEditPage = mapEditPage;
9227
-
9228
- this.element = document.createElement("div");
9229
- this.element.className = "wpgmza-vertex-context-menu";
9230
- this.element.innerHTML = "Delete";
9231
-
9232
- google.maps.event.addDomListener(this.element, "click", function(event) {
9233
- self.removeVertex();
9234
- event.preventDefault();
9235
- event.stopPropagation();
9236
- return false;
9237
  });
 
 
9238
  }
9239
 
9240
- WPGMZA.GoogleVertexContextMenu.prototype = new google.maps.OverlayView();
9241
-
9242
- WPGMZA.GoogleVertexContextMenu.prototype.onAdd = function()
9243
  {
9244
- var self = this;
9245
- var map = this.getMap();
9246
 
9247
- this.getPanes().floatPane.appendChild(this.element);
9248
- this.divListener = google.maps.event.addDomListener(map.getDiv(), "mousedown", function(e) {
9249
- if(e.target != self.element)
9250
- self.close();
9251
- }, true);
9252
  }
9253
 
9254
- WPGMZA.GoogleVertexContextMenu.prototype.onRemove = function()
9255
  {
9256
- google.maps.event.removeListener(this.divListener);
9257
- this.element.parentNode.removeChild(this.element);
9258
 
9259
- this.set("position");
9260
- this.set("path");
9261
- this.set("vertex");
 
 
 
 
 
 
 
 
9262
  }
9263
 
9264
- WPGMZA.GoogleVertexContextMenu.prototype.open = function(map, path, vertex)
9265
  {
9266
- this.set('position', path.getAt(vertex));
9267
- this.set('path', path);
9268
- this.set('vertex', vertex);
9269
- this.setMap(map);
9270
- this.draw();
9271
  }
9272
 
9273
- WPGMZA.GoogleVertexContextMenu.prototype.close = function()
9274
  {
9275
- this.setMap(null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9276
  }
9277
 
9278
- WPGMZA.GoogleVertexContextMenu.prototype.draw = function()
9279
  {
9280
- var position = this.get('position');
9281
- var projection = this.getProjection();
9282
-
9283
- if (!position || !projection)
9284
- return;
9285
-
9286
- var point = projection.fromLatLngToDivPixel(position);
9287
- this.element.style.top = point.y + 'px';
9288
- this.element.style.left = point.x + 'px';
9289
  }
9290
 
9291
- WPGMZA.GoogleVertexContextMenu.prototype.removeVertex = function()
9292
  {
9293
- var path = this.get('path');
9294
- var vertex = this.get('vertex');
9295
-
9296
- if (!path || vertex == undefined) {
9297
- this.close();
9298
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9299
  }
9300
-
9301
- path.removeAt(vertex);
9302
- this.close();
9303
  }
9304
 
9305
- });
9306
-
9307
- // js/v8/open-layers/ol-circle.js
9308
- /**
9309
- * @namespace WPGMZA
9310
- * @module OLCircle
9311
- * @requires WPGMZA.Circle
9312
- */
9313
- jQuery(function($) {
9314
 
9315
- var Parent = WPGMZA.Circle;
 
 
 
 
9316
 
9317
- WPGMZA.OLCircle = function(options, olFeature)
9318
  {
9319
- var self = this;
 
 
 
 
9320
 
9321
- this.center = {lat: 0, lng: 0};
9322
- this.radius = 0;
9323
 
9324
- this.fillcolor = "#ff0000";
9325
- this.opacity = 0.6;
 
 
 
 
 
 
 
 
 
 
9326
 
9327
- Parent.call(this, options, olFeature);
9328
 
9329
- this.olStyle = new ol.style.Style(this.getStyleFromSettings());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9330
 
9331
- this.vectorLayer3857 = this.layer = new ol.layer.Vector({
9332
- source: new ol.source.Vector(),
9333
- style: this.olStyle
9334
- });
 
9335
 
9336
- if(olFeature)
9337
- this.olFeature = olFeature;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9338
  else
9339
- this.recreate();
9340
  }
9341
 
9342
- WPGMZA.OLCircle.prototype = Object.create(Parent.prototype);
9343
- WPGMZA.OLCircle.prototype.constructor = WPGMZA.OLCircle;
9344
-
9345
- WPGMZA.OLCircle.prototype.recreate = function()
9346
  {
9347
- if(this.olFeature)
9348
  {
9349
- this.layer.getSource().removeFeature(this.olFeature);
9350
- delete this.olFeature;
9351
- }
9352
-
9353
- if(!this.center || !this.radius)
9354
  return;
 
9355
 
9356
- // IMPORTANT: Please note that due to what appears to be a bug in OpenLayers, the following code MUST be exected specifically in this order, or the circle won't appear
9357
- var radius = parseFloat(this.radius) * 1000 / 2;
9358
- var x, y;
9359
-
9360
- x = this.center.lng;
9361
- y = this.center.lat;
9362
-
9363
- var circle4326 = ol.geom.Polygon.circular([x, y], radius, 64);
9364
- var circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857');
9365
-
9366
- this.olFeature = new ol.Feature(circle3857);
9367
-
9368
- this.layer.getSource().addFeature(this.olFeature);
9369
  }
9370
 
9371
- WPGMZA.OLCircle.prototype.getStyleFromSettings = function()
9372
  {
9373
- var params = {};
9374
-
9375
- /*if(this.settings.strokeOpacity)
9376
- params.stroke = new ol.style.Stroke({
9377
- color: WPGMZA.hexOpacityToRGBA(this.settings.strokeColor, this.settings.strokeOpacity)
9378
- });*/
9379
 
9380
- if(this.opacity)
9381
- params.fill = new ol.style.Fill({
9382
- color: WPGMZA.hexOpacityToRGBA(this.fillColor, this.opacity)
9383
- });
9384
 
9385
- return params;
9386
- }
9387
-
9388
- WPGMZA.OLCircle.prototype.updateStyleFromSettings = function()
9389
- {
9390
- // Re-create the style - working on it directly doesn't cause a re-render
9391
- var params = this.getStyleFromSettings();
9392
- this.olStyle = new ol.style.Style(params);
9393
- this.layer.setStyle(this.olStyle);
9394
  }
9395
 
9396
- WPGMZA.OLCircle.prototype.setVisible = function(visible)
9397
  {
9398
- this.layer.setVisible(visible ? true : false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9399
  }
9400
 
9401
- WPGMZA.OLCircle.prototype.setCenter = function(center)
9402
  {
9403
- WPGMZA.Circle.prototype.setCenter.apply(this, arguments);
9404
 
9405
- this.recreate();
 
 
 
 
9406
  }
9407
 
9408
- WPGMZA.OLCircle.prototype.setRadius = function(radius)
 
 
 
 
9409
  {
9410
- WPGMZA.Circle.prototype.setRadius.apply(this, arguments);
9411
-
9412
- this.recreate();
9413
  }
9414
 
9415
  });
9416
 
9417
- // js/v8/open-layers/ol-geocoder.js
9418
  /**
9419
  * @namespace WPGMZA
9420
- * @module OLGeocoder
9421
- * @requires WPGMZA.Geocoder
9422
  */
9423
  jQuery(function($) {
9424
 
9425
- /**
9426
- * @class OLGeocoder
9427
- * @extends Geocoder
9428
- * @summary OpenLayers geocoder - uses Nominatim by default
9429
- */
9430
- WPGMZA.OLGeocoder = function()
9431
  {
9432
-
9433
  }
9434
 
9435
- WPGMZA.OLGeocoder.prototype = Object.create(WPGMZA.Geocoder.prototype);
9436
- WPGMZA.OLGeocoder.prototype.constructor = WPGMZA.OLGeocoder;
9437
 
9438
- /**
9439
- * @function getResponseFromCache
9440
- * @access protected
9441
- * @summary Tries to retrieve cached coordinates from server cache
9442
- * @param {string} address The street address to geocode
9443
- * @param {function} callback Where to send the results, as an array
9444
- * @return {void}
9445
- */
9446
- WPGMZA.OLGeocoder.prototype.getResponseFromCache = function(query, callback)
9447
  {
9448
- WPGMZA.restAPI.call("/geocode-cache", {
9449
- data: {
9450
- query: JSON.stringify(query)
9451
- },
9452
- success: function(response, xhr, status) {
9453
- // Legacy compatibility support
9454
- response.lng = response.lon;
9455
-
9456
- callback(response);
9457
- },
9458
- useCompressedPathVariable: true
9459
- });
9460
 
9461
- /*$.ajax(WPGMZA.ajaxurl, {
9462
- data: {
9463
- action: "wpgmza_query_nominatim_cache",
9464
- query: JSON.stringify(query)
9465
- },
9466
- success: function(response, xhr, status) {
9467
- // Legacy compatibility support
9468
- response.lng = response.lon;
 
 
9469
 
9470
- callback(response);
 
 
 
9471
  }
9472
- });*/
 
 
 
 
 
 
 
 
 
9473
  }
9474
 
9475
- /**
9476
- * @function getResponseFromNominatim
9477
- * @access protected
9478
- * @summary Queries Nominatim on the specified address
9479
- * @param {object} options An object containing the options for geocoding, address is a mandatory field
9480
- * @param {function} callback The function to send the results to, as an array
9481
- */
9482
- WPGMZA.OLGeocoder.prototype.getResponseFromNominatim = function(options, callback)
9483
  {
9484
- var data = {
9485
- q: options.address,
9486
- format: "json"
9487
  };
 
 
 
 
 
9488
 
9489
- if(options.componentRestrictions && options.componentRestrictions.country)
9490
- data.countrycodes = options.componentRestrictions.country;
9491
 
9492
- $.ajax("https://nominatim.openstreetmap.org/search/", {
9493
- data: data,
9494
- success: function(response, xhr, status) {
9495
- callback(response);
9496
- },
9497
- error: function(response, xhr, status) {
9498
- callback(null, WPGMZA.Geocoder.FAIL)
9499
- }
9500
- });
9501
  }
9502
 
9503
- /**
9504
- * @function cacheResponse
9505
- * @access protected
9506
- * @summary Caches a response on the server, usually after it's been returned from Nominatim
9507
- * @param {string} address The street address
9508
- * @param {object|array} response The response to cache
9509
- * @returns {void}
9510
- */
9511
- WPGMZA.OLGeocoder.prototype.cacheResponse = function(query, response)
9512
  {
9513
- $.ajax(WPGMZA.ajaxurl, {
9514
- data: {
9515
- action: "wpgmza_store_nominatim_cache",
9516
- query: JSON.stringify(query),
9517
- response: JSON.stringify(response)
9518
- },
9519
- method: "POST"
9520
- });
9521
- }
9522
 
9523
- /**
9524
- * @function clearCache
9525
- * @access protected
9526
- * @summary Clears the Nomanatim geocode cache
9527
- * @returns {void}
9528
- */
9529
- WPGMZA.OLGeocoder.prototype.clearCache = function(callback)
 
 
 
 
9530
  {
9531
- $.ajax(WPGMZA.ajaxurl, {
9532
- data: {
9533
- action: "wpgmza_clear_nominatim_cache"
9534
- },
9535
- method: "POST",
9536
- success: function(response){
9537
- callback(response);
9538
- }
9539
- });
9540
  }
9541
 
9542
- WPGMZA.OLGeocoder.prototype.getLatLngFromAddress = function(options, callback)
9543
  {
9544
- return WPGMZA.OLGeocoder.prototype.geocode(options, callback);
 
 
 
 
9545
  }
9546
 
9547
- WPGMZA.OLGeocoder.prototype.getAddressFromLatLng = function(options, callback)
 
 
 
 
 
 
 
 
 
 
9548
  {
9549
- return WPGMZA.OLGeocoder.prototype.geocode(options, callback);
 
 
 
 
 
 
 
 
 
9550
  }
9551
 
9552
- WPGMZA.OLGeocoder.prototype.geocode = function(options, callback)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9553
  {
9554
  var self = this;
9555
 
9556
- if(!options)
9557
- throw new Error("Invalid options");
9558
 
9559
- if(WPGMZA.LatLng.REGEXP.test(options.address))
 
 
9560
  {
9561
- var latLng = WPGMZA.LatLng.fromString(options.address);
9562
-
9563
- callback([{
9564
- geometry: {
9565
- location: latLng
9566
- },
9567
- latLng: latLng,
9568
- lat: latLng.lat,
9569
- lng: latLng.lng
9570
- }], WPGMZA.Geocoder.SUCCESS);
9571
-
9572
- return;
9573
  }
9574
-
9575
- if(options.location)
9576
- options.latLng = new WPGMZA.LatLng(options.location);
9577
-
9578
- var finish, location;
9579
-
9580
- if(options.address)
9581
  {
9582
- location = options.address;
9583
 
9584
- finish = function(response, status)
9585
  {
9586
- for(var i = 0; i < response.length; i++)
9587
- {
9588
- response[i].geometry = {
9589
- location: new WPGMZA.LatLng({
9590
- lat: parseFloat(response[i].lat),
9591
- lng: parseFloat(response[i].lon)
9592
- })
9593
- };
9594
-
9595
- response[i].latLng = {
9596
- lat: parseFloat(response[i].lat),
9597
- lng: parseFloat(response[i].lon)
9598
- };
9599
-
9600
- response[i].bounds = new WPGMZA.LatLngBounds(
9601
- new WPGMZA.LatLng({
9602
- lat: response[i].boundingbox[1],
9603
- lng: response[i].boundingbox[2]
9604
- }),
9605
- new WPGMZA.LatLng({
9606
- lat: response[i].boundingbox[0],
9607
- lng: response[i].boundingbox[3]
9608
- })
9609
- );
9610
-
9611
- // Backward compatibility with old UGM
9612
- response[i].lng = response[i].lon;
9613
- }
9614
 
9615
- callback(response, status);
 
 
 
 
 
 
9616
  }
9617
- }
9618
- else if(options.latLng)
9619
- {
9620
- location = options.latLng.toString();
9621
 
9622
- finish = function(response, status)
9623
- {
9624
- var address = response[0].display_name;
9625
- callback([address], status);
9626
- }
9627
  }
9628
- else
9629
- throw new Error("You must supply either a latLng or address")
9630
 
9631
- var query = {location: location, options: options};
9632
- this.getResponseFromCache(query, function(response) {
9633
- if(response.length)
9634
- {
9635
- finish(response, WPGMZA.Geocoder.SUCCESS);
9636
- return;
9637
- }
9638
-
9639
- self.getResponseFromNominatim($.extend(options, {address: location}), function(response, status) {
9640
- if(status == WPGMZA.Geocoder.FAIL)
9641
- {
9642
- callback(null, WPGMZA.Geocoder.FAIL);
9643
- return;
9644
- }
9645
-
9646
- if(response.length == 0)
9647
- {
9648
- callback([], WPGMZA.Geocoder.ZERO_RESULTS);
9649
- return;
9650
- }
9651
-
9652
- finish(response, WPGMZA.Geocoder.SUCCESS);
 
9653
 
9654
- self.cacheResponse(query, response);
 
 
9655
  });
9656
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9657
  }
9658
 
9659
  });
9660
 
9661
- // js/v8/open-layers/ol-info-window.js
9662
  /**
9663
  * @namespace WPGMZA
9664
- * @module OLInfoWindow
9665
- * @requires WPGMZA.InfoWindow
9666
- * @pro-requires WPGMZA.ProInfoWindow
9667
  */
9668
  jQuery(function($) {
9669
 
9670
  var Parent;
9671
 
9672
- WPGMZA.OLInfoWindow = function(mapObject)
9673
  {
9674
  var self = this;
9675
 
9676
- Parent.call(this, mapObject);
9677
 
9678
- this.element = $("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0];
 
 
 
 
 
 
 
 
9679
 
9680
- $(this.element).on("click", ".ol-info-window-close", function(event) {
9681
- self.close();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9682
  });
9683
  }
9684
 
9685
- if(WPGMZA.isProVersion())
9686
- Parent = WPGMZA.ProInfoWindow;
9687
- else
9688
- Parent = WPGMZA.InfoWindow;
9689
-
9690
- WPGMZA.OLInfoWindow.prototype = Object.create(Parent.prototype);
9691
- WPGMZA.OLInfoWindow.prototype.constructor = WPGMZA.OLInfoWindow;
9692
 
9693
- Object.defineProperty(WPGMZA.OLInfoWindow.prototype, "isPanIntoViewAllowed", {
 
 
9694
 
9695
- "get": function()
9696
- {
9697
- return true;
9698
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9699
 
9700
- });
9701
 
9702
- /**
9703
- * Opens the info window
9704
- * TODO: This should take a mapObject, not an event
9705
- * @return boolean FALSE if the info window should not & will not open, TRUE if it will
9706
- */
9707
- WPGMZA.OLInfoWindow.prototype.open = function(map, mapObject)
9708
  {
9709
- var self = this;
9710
- var latLng = mapObject.getPosition();
9711
 
9712
- if(!Parent.prototype.open.call(this, map, mapObject))
9713
- return false;
9714
 
9715
- // Set parent for events to bubble up
9716
- this.parent = map;
 
 
 
9717
 
9718
- if(this.overlay)
9719
- this.mapObject.map.olMap.removeOverlay(this.overlay);
9720
-
9721
- this.overlay = new ol.Overlay({
9722
- element: this.element,
9723
- stopEvent: false
9724
  });
9725
 
9726
- this.overlay.setPosition(ol.proj.fromLonLat([
9727
- latLng.lng,
9728
- latLng.lat
9729
- ]));
9730
- self.mapObject.map.olMap.addOverlay(this.overlay);
 
 
9731
 
9732
- $(this.element).show();
9733
 
9734
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9735
  {
9736
- WPGMZA.getImageDimensions(mapObject.getIcon(), function(size) {
9737
-
9738
- $(self.element).css({left: Math.round(size.width / 2) + "px"});
9739
-
9740
- });
 
9741
  }
9742
 
9743
- this.trigger("infowindowopen");
9744
- this.trigger("domready");
9745
  }
9746
 
9747
- WPGMZA.OLInfoWindow.prototype.close = function(event)
 
 
 
 
 
 
 
 
 
 
9748
  {
9749
- // TODO: Why? This shouldn't have to be here. Removing the overlay should hide the element (it doesn't)
9750
- $(this.element).hide();
9751
 
9752
- if(!this.overlay)
9753
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9754
 
9755
- WPGMZA.InfoWindow.prototype.close.call(this);
9756
 
9757
- this.trigger("infowindowclose");
 
 
 
 
 
 
 
 
9758
 
9759
- this.mapObject.map.olMap.removeOverlay(this.overlay);
9760
- this.overlay = null;
 
 
 
 
9761
  }
9762
 
9763
- WPGMZA.OLInfoWindow.prototype.setContent = function(html)
 
 
 
9764
  {
9765
- $(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>" + html);
 
 
9766
  }
9767
 
9768
- WPGMZA.OLInfoWindow.prototype.setOptions = function(options)
9769
  {
9770
- if(options.maxWidth)
9771
- {
9772
- $(this.element).css({"max-width": options.maxWidth + "px"});
9773
- }
9774
  }
9775
 
9776
- WPGMZA.OLInfoWindow.prototype.onOpen = function()
9777
  {
9778
- var self = this;
9779
- var imgs = $(this.element).find("img");
9780
- var numImages = imgs.length;
9781
- var numImagesLoaded = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9782
 
9783
- WPGMZA.InfoWindow.prototype.onOpen.apply(this, arguments);
 
9784
 
9785
- if(this.isPanIntoViewAllowed)
9786
  {
9787
- function inside(el, viewport)
9788
- {
9789
- var a = $(el)[0].getBoundingClientRect();
9790
- var b = $(viewport)[0].getBoundingClientRect();
9791
-
9792
- return a.left >= b.left && a.left <= b.right &&
9793
- a.right <= b.right && a.right >= b.left &&
9794
- a.top >= b.top && a.top <= b.bottom &&
9795
- a.bottom <= b.bottom && a.bottom >= b.top;
9796
- }
9797
-
9798
- function panIntoView()
9799
- {
9800
- var height = $(self.element).height();
9801
- var offset = -height * 0.45;
9802
-
9803
- self.mapObject.map.animateNudge(0, offset, self.mapObject.getPosition());
9804
- }
9805
-
9806
- imgs.each(function(index, el) {
9807
- el.onload = function() {
9808
- if(++numImagesLoaded == numImages && !inside(self.element, self.mapObject.map.element))
9809
- panIntoView();
9810
- }
9811
- });
9812
-
9813
- if(numImages == 0 && !inside(self.element, self.mapObject.map.element))
9814
- panIntoView();
9815
  }
 
 
 
 
 
9816
  }
9817
 
9818
  });
9819
 
9820
- // js/v8/open-layers/ol-map.js
9821
  /**
9822
  * @namespace WPGMZA
9823
- * @module OLMap
9824
- * @requires WPGMZA.Map
9825
- * @pro-requires WPGMZA.ProMap
9826
  */
9827
  jQuery(function($) {
9828
 
9829
- var Parent;
 
 
 
 
 
 
 
 
 
 
 
9830
 
9831
- WPGMZA.OLMap = function(element, options)
 
 
 
9832
  {
9833
- var self = this;
9834
-
9835
- Parent.call(this, element);
9836
-
9837
- this.setOptions(options);
9838
 
9839
- var viewOptions = this.settings.toOLViewOptions();
 
 
 
 
 
 
9840
 
9841
- $(this.element).html("");
 
9842
 
9843
- this.olMap = new ol.Map({
9844
- target: $(element)[0],
9845
- layers: [
9846
- this.getTileLayer()
9847
- ],
9848
- view: new ol.View(viewOptions)
9849
- });
9850
 
9851
- // TODO: Re-implement using correct setting names
9852
- // Interactions
9853
- this.olMap.getInteractions().forEach(function(interaction) {
9854
-
9855
- // NB: The true and false values are flipped because these settings represent the "disabled" state when true
9856
- if(interaction instanceof ol.interaction.DragPan)
9857
- interaction.setActive( (self.settings.wpgmza_settings_map_draggable == "yes" ? false : true) );
9858
- else if(interaction instanceof ol.interaction.DoubleClickZoom)
9859
- interaction.setActive( (self.settings.wpgmza_settings_map_clickzoom ? false : true) );
9860
- else if(interaction instanceof ol.interaction.MouseWheelZoom)
9861
- interaction.setActive( (self.settings.wpgmza_settings_map_scroll == "yes" ? false : true) );
9862
-
9863
- }, this);
9864
 
9865
- // Cooperative gesture handling
9866
- if(!(this.settings.wpgmza_force_greedy_gestures == "greedy" || this.settings.wpgmza_force_greedy_gestures == "yes"))
9867
- {
9868
- this.gestureOverlay = $("<div class='wpgmza-gesture-overlay'></div>")
9869
- this.gestureOverlayTimeoutID = null;
9870
 
9871
- if(WPGMZA.isTouchDevice())
9872
  {
9873
- // On touch devices, require two fingers to drag and pan
9874
- // NB: Temporarily removed due to inconsistent behaviour
9875
- /*this.olMap.getInteractions().forEach(function(interaction) {
9876
-
9877
- if(interaction instanceof ol.interaction.DragPan)
9878
- self.olMap.removeInteraction(interaction);
9879
-
9880
- });
9881
 
9882
- this.olMap.addInteraction(new ol.interaction.DragPan({
9883
-
9884
- condition: function(olBrowserEvent) {
9885
-
9886
- var allowed = olBrowserEvent.originalEvent.touches.length == 2;
9887
-
9888
- if(!allowed)
9889
- self.showGestureOverlay();
9890
-
9891
- return allowed;
 
 
 
 
 
 
 
 
 
 
 
 
9892
  }
9893
-
9894
- }));
9895
 
9896
- this.gestureOverlay.text(WPGMZA.localized_strings.use_two_fingers);*/
9897
  }
9898
  else
9899
  {
9900
- // On desktops, require Ctrl + zoom to zoom, show an overlay if that condition is not met
9901
- this.olMap.on("wheel", function(event) {
9902
-
9903
- if(!ol.events.condition.platformModifierKeyOnly(event))
9904
- {
9905
- self.showGestureOverlay();
9906
- event.originalEvent.preventDefault();
9907
- return false;
9908
- }
9909
-
9910
- });
9911
 
9912
- this.gestureOverlay.text(WPGMZA.localized_strings.use_ctrl_scroll_to_zoom);
 
 
 
9913
  }
9914
- }
 
 
 
 
 
 
9915
 
9916
- // Controls
9917
- this.olMap.getControls().forEach(function(control) {
 
 
 
 
 
 
 
 
 
 
9918
 
9919
- // NB: The true and false values are flipped because these settings represent the "disabled" state when true
9920
- if(control instanceof ol.control.Zoom && WPGMZA.settings.wpgmza_settings_map_zoom == "yes")
9921
- self.olMap.removeControl(control);
9922
 
9923
- }, this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9924
 
9925
- if(WPGMZA.settings.wpgmza_settings_map_full_screen_control != "yes")
9926
- this.olMap.addControl(new ol.control.FullScreen());
 
 
 
 
 
 
 
 
 
 
 
9927
 
9928
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9929
- {
9930
- // Marker layer
9931
- this.markerLayer = new ol.layer.Vector({
9932
- source: new ol.source.Vector({
9933
- features: []
9934
- })
9935
- });
9936
- this.olMap.addLayer(this.markerLayer);
9937
 
9938
- this.olMap.on("click", function(event) {
9939
- var features = self.olMap.getFeaturesAtPixel(event.pixel);
9940
-
9941
- if(!features || !features.length)
9942
- return;
9943
-
9944
- var marker = features[0].wpgmzaMarker;
9945
-
9946
- if(!marker)
9947
- return;
9948
-
9949
- marker.trigger("click");
9950
- marker.trigger("select");
9951
- });
9952
  }
 
 
 
 
 
 
 
 
 
 
 
9953
 
9954
- // Listen for drag start
9955
- this.olMap.on("movestart", function(event) {
9956
- self.isBeingDragged = true;
9957
- });
9958
 
9959
- // Listen for end of pan so we can wrap longitude if needs be
9960
- this.olMap.on("moveend", function(event) {
9961
- self.wrapLongitude();
9962
-
9963
- self.isBeingDragged = false;
9964
- self.dispatchEvent("dragend");
9965
- self.onIdle();
 
 
 
 
 
9966
  });
 
 
 
 
 
 
 
 
 
 
 
9967
 
9968
- // Listen for zoom
9969
- this.olMap.getView().on("change:resolution", function(event) {
9970
- self.dispatchEvent("zoom_changed");
9971
- self.dispatchEvent("zoomchanged");
9972
- setTimeout(function() {
9973
- self.onIdle();
9974
- }, 10);
9975
- });
9976
 
9977
- // Listen for bounds changing
9978
- this.olMap.getView().on("change", function() {
9979
- // Wrap longitude
9980
- self.onBoundsChanged();
9981
- });
9982
- self.onBoundsChanged();
9983
 
9984
- // Store locator center
9985
- var marker;
9986
- if(this.storeLocator && (marker = this.storeLocator.centerPointMarker))
9987
- {
9988
- this.olMap.addOverlay(marker.overlay);
9989
- marker.setVisible(false);
9990
- }
9991
 
9992
- // Right click listener
9993
- $(this.element).on("click contextmenu", function(event) {
9994
-
9995
- var isRight;
9996
- event = event || window.event;
9997
-
9998
- var latLng = self.pixelsToLatLng(event.offsetX, event.offsetY);
9999
-
10000
- if("which" in event)
10001
- isRight = event.which == 3;
10002
- else if("button" in event)
10003
- isRight = event.button == 2;
10004
-
10005
- if(event.which == 1 || event.button == 1)
10006
- {
10007
- if(self.isBeingDragged)
10008
- return;
10009
-
10010
- // Left click
10011
- if($(event.target).closest(".ol-marker").length)
10012
- return; // A marker was clicked, not the map. Do nothing
10013
-
10014
- self.trigger({
10015
- type: "click",
10016
- latLng: latLng
10017
- });
10018
-
10019
- return;
10020
- }
10021
-
10022
- if(!isRight)
10023
- return;
10024
-
10025
- return self.onRightClick(event);
10026
- });
10027
 
10028
- // Dispatch event
10029
- if(!WPGMZA.isProVersion())
10030
- {
10031
- this.trigger("init");
10032
-
10033
- this.dispatchEvent("created");
10034
- WPGMZA.events.dispatchEvent({type: "mapcreated", map: this});
10035
-
10036
- // Legacy event
10037
- $(this.element).trigger("wpgooglemaps_loaded");
10038
- }
10039
  }
 
10040
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10041
  if(WPGMZA.isProVersion())
10042
- Parent = WPGMZA.ProMap;
10043
  else
10044
- Parent = WPGMZA.Map;
10045
 
10046
- WPGMZA.OLMap.prototype = Object.create(Parent.prototype);
10047
- WPGMZA.OLMap.prototype.constructor = WPGMZA.OLMap;
10048
 
10049
- WPGMZA.OLMap.prototype.getTileLayer = function()
10050
  {
10051
- var options = {};
 
 
 
 
 
 
 
 
 
 
10052
 
10053
- if(WPGMZA.settings.tile_server_url)
10054
- options.url = WPGMZA.settings.tile_server_url;
10055
 
10056
- return new ol.layer.Tile({
10057
- source: new ol.source.OSM(options)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10058
  });
10059
  }
10060
 
10061
- WPGMZA.OLMap.prototype.wrapLongitude = function()
 
 
 
 
10062
  {
10063
- var transformed = ol.proj.transform(this.olMap.getView().getCenter(), "EPSG:3857", "EPSG:4326");
10064
- var center = {
10065
- lat: transformed[1],
10066
- lng: transformed[0]
10067
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10068
 
10069
- if(center.lng >= -180 && center.lng <= 180)
10070
- return;
10071
 
10072
- center.lng = center.lng - 360 * Math.floor(center.lng / 360);
 
 
 
10073
 
10074
- if(center.lng > 180)
10075
- center.lng -= 360;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10076
 
10077
- this.setCenter(center);
10078
  }
10079
 
10080
- WPGMZA.OLMap.prototype.getCenter = function()
10081
  {
10082
- var lonLat = ol.proj.toLonLat(
10083
- this.olMap.getView().getCenter()
10084
- );
10085
- return {
10086
- lat: lonLat[1],
10087
- lng: lonLat[0]
10088
- };
10089
  }
10090
 
10091
- WPGMZA.OLMap.prototype.setCenter = function(latLng)
10092
  {
10093
- var view = this.olMap.getView();
10094
 
10095
- WPGMZA.Map.prototype.setCenter.call(this, latLng);
10096
 
10097
- view.setCenter(ol.proj.fromLonLat([
10098
- latLng.lng,
10099
- latLng.lat
10100
- ]));
10101
 
10102
- this.wrapLongitude();
10103
-
10104
- this.onBoundsChanged();
10105
  }
10106
 
10107
- WPGMZA.OLMap.prototype.getBounds = function()
10108
  {
10109
- var bounds = this.olMap.getView().calculateExtent(this.olMap.getSize());
10110
- var nativeBounds = new WPGMZA.LatLngBounds();
10111
-
10112
- var topLeft = ol.proj.toLonLat([bounds[0], bounds[1]]);
10113
- var bottomRight = ol.proj.toLonLat([bounds[2], bounds[3]]);
10114
-
10115
- nativeBounds.north = topLeft[1];
10116
- nativeBounds.south = bottomRight[1];
10117
 
10118
- nativeBounds.west = topLeft[0];
10119
- nativeBounds.east = bottomRight[0];
10120
 
10121
- return nativeBounds;
10122
  }
10123
 
 
 
 
 
 
 
 
 
 
 
 
 
10124
  /**
10125
- * Fit to given boundaries
10126
- * @return void
10127
  */
10128
- WPGMZA.OLMap.prototype.fitBounds = function(southWest, northEast)
10129
  {
10130
- if(southWest instanceof WPGMZA.LatLng)
10131
- southWest = {lat: southWest.lat, lng: southWest.lng};
10132
- if(northEast instanceof WPGMZA.LatLng)
10133
- northEast = {lat: northEast.lat, lng: northEast.lng};
10134
- else if(southWest instanceof WPGMZA.LatLngBounds)
10135
  {
10136
- var bounds = southWest;
 
10137
 
10138
- southWest = {
10139
- lat: bounds.south,
10140
- lng: bounds.west
10141
- };
10142
 
10143
- northEast = {
10144
- lat: bounds.north,
10145
- lng: bounds.east
10146
- };
 
 
 
 
10147
  }
10148
 
10149
- var view = this.olMap.getView();
10150
 
10151
- var extent = ol.extent.boundingExtent([
10152
- ol.proj.fromLonLat([
10153
- parseFloat(southWest.lng),
10154
- parseFloat(southWest.lat)
10155
- ]),
10156
- ol.proj.fromLonLat([
10157
- parseFloat(northEast.lng),
10158
- parseFloat(northEast.lat)
10159
- ])
10160
- ]);
10161
- view.fit(extent, this.olMap.getSize());
10162
- }
10163
-
10164
- WPGMZA.OLMap.prototype.panTo = function(latLng, zoom)
10165
- {
10166
- var view = this.olMap.getView();
10167
- var options = {
10168
- center: ol.proj.fromLonLat([
10169
- parseFloat(latLng.lng),
10170
- parseFloat(latLng.lat),
10171
- ]),
10172
- duration: 500
10173
- };
10174
 
10175
- if(arguments.length > 1)
10176
- options.zoom = parseInt(zoom);
 
 
 
 
 
 
10177
 
10178
- view.animate(options);
10179
- }
10180
-
10181
- WPGMZA.OLMap.prototype.getZoom = function()
10182
- {
10183
- return Math.round( this.olMap.getView().getZoom() );
10184
- }
10185
-
10186
- WPGMZA.OLMap.prototype.setZoom = function(value)
10187
- {
10188
- this.olMap.getView().setZoom(value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10189
  }
10190
 
10191
- WPGMZA.OLMap.prototype.getMinZoom = function()
 
10192
  {
10193
- return this.olMap.getView().getMinZoom();
 
10194
  }
10195
-
10196
- WPGMZA.OLMap.prototype.setMinZoom = function(value)
10197
  {
10198
- this.olMap.getView().setMinZoom(value);
 
10199
  }
 
10200
 
10201
- WPGMZA.OLMap.prototype.getMaxZoom = function()
10202
  {
10203
- return this.olMap.getView().getMaxZoom();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10204
  }
10205
 
10206
- WPGMZA.OLMap.prototype.setMaxZoom = function(value)
 
 
 
 
10207
  {
10208
- this.olMap.getView().setMaxZoom(value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10209
  }
10210
 
10211
- WPGMZA.OLMap.prototype.setOptions = function(options)
10212
  {
10213
  Parent.prototype.setOptions.call(this, options);
10214
 
10215
- if(!this.olMap)
 
 
 
 
 
10216
  return;
 
10217
 
10218
- this.olMap.getView().setProperties( this.settings.toOLViewOptions() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10219
  }
10220
 
10221
  /**
10222
- * TODO: Consider moving all these functions to their respective classes, same on google map (DO IT!!! It's very misleading having them here)
 
10223
  */
10224
- WPGMZA.OLMap.prototype.addMarker = function(marker)
10225
  {
10226
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT)
10227
- this.olMap.addOverlay(marker.overlay);
10228
- else
10229
- {
10230
- this.markerLayer.getSource().addFeature(marker.feature);
10231
- marker.featureInSource = true;
10232
- }
10233
 
10234
  Parent.prototype.addMarker.call(this, marker);
10235
  }
10236
 
10237
- WPGMZA.OLMap.prototype.removeMarker = function(marker)
10238
- {
10239
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT)
10240
- this.olMap.removeOverlay(marker.overlay);
10241
- else
10242
- {
10243
- this.markerLayer.getSource().removeFeature(marker.feature);
10244
- marker.featureInSource = false;
10245
- }
10246
 
10247
  Parent.prototype.removeMarker.call(this, marker);
10248
  }
10249
 
10250
- WPGMZA.OLMap.prototype.addPolygon = function(polygon)
 
 
 
 
10251
  {
10252
- this.olMap.addLayer(polygon.layer);
10253
 
10254
  Parent.prototype.addPolygon.call(this, polygon);
10255
  }
10256
 
10257
- WPGMZA.OLMap.prototype.removePolygon = function(polygon)
 
 
 
 
10258
  {
10259
- this.olMap.removeLayer(polygon.layer);
10260
 
10261
  Parent.prototype.removePolygon.call(this, polygon);
10262
  }
10263
 
10264
- WPGMZA.OLMap.prototype.addPolyline = function(polyline)
 
 
 
 
10265
  {
10266
- this.olMap.addLayer(polyline.layer);
10267
 
10268
  Parent.prototype.addPolyline.call(this, polyline);
10269
  }
10270
 
10271
- WPGMZA.OLMap.prototype.removePolyline = function(polyline)
 
 
 
 
10272
  {
10273
- this.olMap.removeLayer(polyline.layer);
10274
 
10275
  Parent.prototype.removePolyline.call(this, polyline);
10276
  }
10277
 
10278
- WPGMZA.OLMap.prototype.addCircle = function(circle)
10279
  {
10280
- this.olMap.addLayer(circle.layer);
10281
 
10282
  Parent.prototype.addCircle.call(this, circle);
10283
  }
10284
 
10285
- WPGMZA.OLMap.prototype.removeCircle = function(circle)
10286
  {
10287
- this.olMap.removeLayer(circle.layer);
10288
 
10289
  Parent.prototype.removeCircle.call(this, circle);
10290
  }
10291
 
10292
- WPGMZA.OLMap.prototype.addRectangle = function(rectangle)
10293
  {
10294
- this.olMap.addLayer(rectangle.layer);
10295
 
10296
  Parent.prototype.addRectangle.call(this, rectangle);
10297
  }
10298
 
10299
- WPGMZA.OLMap.prototype.removeRectangle = function(rectangle)
10300
  {
10301
- this.olMap.removeLayer(rectangle.layer);
10302
 
10303
  Parent.prototype.removeRectangle.call(this, rectangle);
10304
  }
10305
 
10306
- WPGMZA.OLMap.prototype.pixelsToLatLng = function(x, y)
 
 
 
 
10307
  {
10308
- if(y == undefined)
10309
- {
10310
- if("x" in x && "y" in x)
10311
- {
10312
- y = x.y;
10313
- x = x.x;
10314
- }
10315
- else
10316
- console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)");
10317
- }
10318
 
10319
- var coord = this.olMap.getCoordinateFromPixel([x, y]);
 
 
 
 
 
 
 
 
 
 
 
 
10320
 
10321
- if(!coord)
10322
- return {
10323
- x: null,
10324
- y: null
10325
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10326
 
10327
- var lonLat = ol.proj.toLonLat(coord);
10328
- return {
10329
- lat: lonLat[1],
10330
- lng: lonLat[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10331
  };
 
 
10332
  }
10333
 
10334
- WPGMZA.OLMap.prototype.latLngToPixels = function(latLng)
 
 
 
 
10335
  {
10336
- var coord = ol.proj.fromLonLat([latLng.lng, latLng.lat]);
10337
- var pixel = this.olMap.getPixelFromCoordinate(coord);
10338
-
10339
- if(!pixel)
10340
- return {
10341
- x: null,
10342
- y: null
 
 
 
 
 
 
 
 
 
10343
  };
 
10344
 
10345
- return {
10346
- x: pixel[0],
10347
- y: pixel[1]
10348
- };
10349
  }
10350
 
10351
- WPGMZA.OLMap.prototype.enableBicycleLayer = function(value)
 
 
 
 
10352
  {
10353
- if(value)
10354
- {
10355
- if(!this.bicycleLayer)
10356
- this.bicycleLayer = new ol.layer.Tile({
10357
- source: new ol.source.OSM({
10358
- url: "http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"
10359
- })
10360
- });
10361
-
10362
- this.olMap.addLayer(this.bicycleLayer);
10363
- }
10364
- else
10365
  {
10366
- if(!this.bicycleLayer)
10367
- return;
10368
-
10369
- this.olMap.removeLayer(this.bicycleLayer);
10370
  }
 
10371
  }
10372
 
10373
- WPGMZA.OLMap.prototype.showGestureOverlay = function()
 
 
 
 
 
10374
  {
10375
- var self = this;
10376
-
10377
- clearTimeout(this.gestureOverlayTimeoutID);
10378
-
10379
- $(this.gestureOverlay).stop().animate({opacity: "100"});
10380
- $(this.element).append(this.gestureOverlay);
10381
-
10382
- $(this.gestureOverlay).css({
10383
- "line-height": $(this.element).height() + "px",
10384
- "opacity": "1.0"
10385
- });
10386
- $(this.gestureOverlay).show();
10387
 
10388
- this.gestureOverlayTimeoutID = setTimeout(function() {
10389
- self.gestureOverlay.fadeOut(2000);
10390
- }, 2000);
10391
  }
10392
 
10393
- WPGMZA.OLMap.prototype.onElementResized = function(event)
 
 
 
 
 
10394
  {
10395
- this.olMap.updateSize();
 
 
 
 
 
10396
  }
10397
 
10398
- WPGMZA.OLMap.prototype.onRightClick = function(event)
 
 
 
 
 
10399
  {
10400
- if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)
10401
- return true;
10402
-
10403
- var parentOffset = $(this.element).offset();
10404
- var relX = event.pageX - parentOffset.left;
10405
- var relY = event.pageY - parentOffset.top;
10406
- var latLng = this.pixelsToLatLng(relX, relY);
10407
-
10408
- this.trigger({type: "rightclick", latLng: latLng});
10409
-
10410
- // Legacy event compatibility
10411
- $(this.element).trigger({type: "rightclick", latLng: latLng});
10412
 
10413
- // Prevent menu
10414
- event.preventDefault();
10415
- return false;
10416
- }
10417
-
10418
- WPGMZA.OLMap.prototype.enableAllInteractions = function()
10419
- {
10420
-
10421
- this.olMap.getInteractions().forEach(function(interaction) {
10422
-
10423
- if(interaction instanceof ol.interaction.DragPan || interaction instanceof ol.interaction.DoubleClickZoom || interaction instanceof ol.interaction.MouseWheelZoom)
10424
- {
10425
- interaction.setActive(true);
10426
- }
10427
-
10428
- }, this);
10429
-
10430
  }
10431
 
10432
- });
10433
-
10434
- // js/v8/open-layers/ol-marker.js
10435
- /**
10436
- * @namespace WPGMZA
10437
- * @module OLMarker
10438
- * @requires WPGMZA.Marker
10439
- * @pro-requires WPGMZA.ProMarker
10440
- */
10441
- jQuery(function($) {
10442
-
10443
- var Parent;
10444
-
10445
- WPGMZA.OLMarker = function(row)
10446
  {
10447
- var self = this;
 
10448
 
10449
- Parent.call(this, row);
10450
-
10451
- var origin = ol.proj.fromLonLat([
10452
- parseFloat(this.lng),
10453
- parseFloat(this.lat)
10454
- ]);
10455
 
10456
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT)
10457
- {
10458
- var img = $("<img alt=''/>")[0];
10459
- img.onload = function(event) {
10460
- self.updateElementHeight();
10461
- if(self.map)
10462
- self.map.olMap.updateSize();
10463
- }
10464
- img.src = WPGMZA.defaultMarkerIcon;
10465
-
10466
- this.element = $("<div class='ol-marker'></div>")[0];
10467
- $(this.element).attr('title', this.title);
10468
- this.element.appendChild(img);
10469
-
10470
- this.element.wpgmzaMarker = this;
10471
-
10472
- $(this.element).on("mouseover", function(event) {
10473
- self.dispatchEvent("mouseover");
10474
- });
10475
-
10476
- this.overlay = new ol.Overlay({
10477
- element: this.element,
10478
- position: origin,
10479
- positioning: "bottom-center",
10480
- stopEvent: false
10481
- });
10482
- this.overlay.setPosition(origin);
10483
-
10484
- if(this.animation)
10485
- this.setAnimation(this.animation);
10486
-
10487
- this.setLabel(this.settings.label);
10488
-
10489
- if(row)
10490
- {
10491
- if(row.draggable)
10492
- this.setDraggable(true);
10493
- }
10494
-
10495
- this.rebindClickListener();
10496
- }
10497
- else if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10498
- {
10499
- this.feature = new ol.Feature({
10500
- geometry: new ol.geom.Point(origin)
10501
- });
10502
-
10503
- this.feature.setStyle(this.getVectorLayerStyle());
10504
- this.feature.wpgmzaMarker = this;
10505
- }
10506
- else
10507
- throw new Error("Invalid marker render mode");
10508
 
10509
- this.trigger("init");
10510
- }
10511
-
10512
- if(WPGMZA.isProVersion())
10513
- Parent = WPGMZA.ProMarker;
10514
- else
10515
- Parent = WPGMZA.Marker;
10516
-
10517
- WPGMZA.OLMarker.prototype = Object.create(Parent.prototype);
10518
- WPGMZA.OLMarker.prototype.constructor = WPGMZA.OLMarker;
10519
-
10520
- WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT = "element";
10521
- WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER = "vector"; // NB: This feature is experimental
10522
-
10523
- WPGMZA.OLMarker.renderMode = WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT;
10524
-
10525
- if(WPGMZA.settings.engine == "open-layers" && WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10526
- {
10527
- WPGMZA.OLMarker.defaultVectorLayerStyle = new ol.style.Style({
10528
- image: new ol.style.Icon({
10529
- anchor: [0.5, 1],
10530
- src: WPGMZA.defaultMarkerIcon
10531
- })
10532
  });
10533
 
10534
- WPGMZA.OLMarker.hiddenVectorLayerStyle = new ol.style.Style({});
10535
  }
10536
 
10537
- WPGMZA.OLMarker.prototype.getVectorLayerStyle = function()
 
 
 
 
10538
  {
10539
- if(this.vectorLayerStyle)
10540
- return this.vectorLayerStyle;
10541
-
10542
- return WPGMZA.OLMarker.defaultVectorLayerStyle;
10543
  }
10544
 
10545
- WPGMZA.OLMarker.prototype.updateElementHeight = function(height, calledOnFocus)
 
 
 
 
10546
  {
10547
- var self = this;
10548
-
10549
- if(!height)
10550
- height = $(this.element).find("img").height();
10551
-
10552
- if(height == 0 && !calledOnFocus)
10553
- {
10554
- $(window).one("focus", function(event) {
10555
- self.updateElementHeight(false, true);
10556
- });
10557
- }
10558
-
10559
- $(this.element).css({height: height + "px"});
10560
  }
10561
 
10562
- WPGMZA.OLMarker.prototype.addLabel = function()
 
 
 
 
10563
  {
10564
- this.setLabel(this.getLabelText());
10565
  }
10566
 
10567
- WPGMZA.OLMarker.prototype.setLabel = function(label)
 
 
 
 
10568
  {
10569
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10570
- {
10571
- console.warn("Marker labels are not currently supported in Vector Layer rendering mode");
10572
- return;
10573
- }
10574
-
10575
- if(!label)
10576
- {
10577
- if(this.label)
10578
- $(this.element).find(".ol-marker-label").remove();
10579
-
10580
- return;
10581
- }
10582
-
10583
- if(!this.label)
10584
- {
10585
- this.label = $("<div class='ol-marker-label'/>");
10586
- $(this.element).append(this.label);
10587
- }
10588
-
10589
- this.label.html(label);
10590
  }
10591
 
10592
- WPGMZA.OLMarker.prototype.getVisible = function(visible)
10593
  {
10594
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10595
- {
10596
-
10597
- }
10598
- else
10599
- return this.overlay.getElement().style.display != "none";
 
 
 
 
 
 
 
10600
  }
10601
 
10602
- WPGMZA.OLMarker.prototype.setVisible = function(visible)
10603
  {
10604
- Parent.prototype.setVisible.call(this, visible);
10605
-
10606
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10607
  {
10608
- if(visible)
10609
  {
10610
- var style = this.getVectorLayerStyle();
10611
- this.feature.setStyle(style);
10612
  }
10613
  else
10614
- this.feature.setStyle(null);
10615
-
10616
- /*var source = this.map.markerLayer.getSource();
10617
-
10618
- /*if(this.featureInSource == visible)
10619
- return;
10620
-
10621
- if(visible)
10622
- source.addFeature(this.feature);
10623
- else
10624
- source.removeFeature(this.feature);
10625
-
10626
- this.featureInSource = visible;*/
10627
  }
10628
- else
10629
- this.overlay.getElement().style.display = (visible ? "block" : "none");
10630
- }
10631
-
10632
- WPGMZA.OLMarker.prototype.setPosition = function(latLng)
10633
- {
10634
- Parent.prototype.setPosition.call(this, latLng);
10635
 
10636
- var origin = ol.proj.fromLonLat([
10637
- parseFloat(this.lng),
10638
- parseFloat(this.lat)
10639
- ]);
10640
-
10641
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10642
- this.feature.setGeometry(new ol.geom.Point(origin));
10643
- else
10644
- this.overlay.setPosition(origin);
 
10645
  }
10646
 
10647
- WPGMZA.OLMarker.prototype.updateOffset = function(x, y)
 
 
 
 
10648
  {
10649
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10650
- {
10651
- console.warn("Marker offset is not currently supported in Vector Layer rendering mode");
10652
  return;
10653
- }
10654
-
10655
- var x = this._offset.x;
10656
- var y = this._offset.y;
10657
-
10658
- this.element.style.position = "relative";
10659
- this.element.style.left = x + "px";
10660
- this.element.style.top = y + "px";
10661
  }
10662
-
10663
- WPGMZA.OLMarker.prototype.setAnimation = function(anim)
10664
- {
10665
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10666
- {
10667
- console.warn("Marker animation is not currently supported in Vector Layer rendering mode");
10668
- return;
10669
- }
10670
-
10671
- Parent.prototype.setAnimation.call(this, anim);
10672
 
10673
- switch(anim)
10674
- {
10675
- case WPGMZA.Marker.ANIMATION_NONE:
10676
- $(this.element).removeAttr("data-anim");
10677
- break;
10678
-
10679
- case WPGMZA.Marker.ANIMATION_BOUNCE:
10680
- $(this.element).attr("data-anim", "bounce");
10681
- break;
10682
-
10683
- case WPGMZA.Marker.ANIMATION_DROP:
10684
- $(this.element).attr("data-anim", "drop");
10685
- break;
10686
- }
10687
  }
10688
 
10689
- WPGMZA.OLMarker.prototype.setDraggable = function(draggable)
 
 
 
 
 
 
 
 
 
 
 
 
 
10690
  {
10691
  var self = this;
10692
 
10693
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10694
- {
10695
- console.warn("Marker dragging is not currently supported in Vector Layer rendering mode");
10696
- return;
10697
- }
10698
 
10699
- if(draggable)
10700
- {
10701
- var options = {
10702
- disabled: false
10703
- };
10704
-
10705
- if(!this.jQueryDraggableInitialized)
10706
- {
10707
- options.start = function(event) {
10708
- self.onDragStart(event);
10709
- }
10710
-
10711
- options.stop = function(event) {
10712
- self.onDragEnd(event);
10713
- };
10714
- }
10715
-
10716
- $(this.element).draggable(options);
10717
- this.jQueryDraggableInitialized = true;
10718
-
10719
- this.rebindClickListener();
10720
- }
10721
- else
10722
- $(this.element).draggable({disabled: true});
10723
- }
10724
-
10725
- WPGMZA.OLMarker.prototype.setOpacity = function(opacity)
10726
- {
10727
- if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
10728
  {
10729
- console.warn("Marker opacity is not currently supported in Vector Layer rendering mode");
10730
- return;
 
 
 
 
 
 
 
 
 
 
 
 
10731
  }
10732
 
10733
- $(this.element).css({opacity: opacity});
10734
- }
10735
-
10736
- WPGMZA.OLMarker.prototype.onDragStart = function(event)
10737
- {
10738
- this.isBeingDragged = true;
10739
 
10740
- this.map.olMap.getInteractions().forEach(function(interaction) {
 
 
 
10741
 
10742
- if(interaction instanceof ol.interaction.DragPan)
10743
- interaction.setActive(false);
 
 
 
 
10744
 
 
 
 
10745
  });
10746
- }
10747
-
10748
- WPGMZA.OLMarker.prototype.onDragEnd = function(event)
10749
- {
10750
- var self = this;
10751
- var offset = {
10752
- top: parseFloat( $(this.element).css("top").match(/-?\d+/)[0] ),
10753
- left: parseFloat( $(this.element).css("left").match(/-?\d+/)[0] )
10754
- };
10755
 
10756
- $(this.element).css({
10757
- top: "0px",
10758
- left: "0px"
10759
  });
10760
 
10761
- var currentLatLng = this.getPosition();
10762
- var pixelsBeforeDrag = this.map.latLngToPixels(currentLatLng);
10763
- var pixelsAfterDrag = {
10764
- x: pixelsBeforeDrag.x + offset.left,
10765
- y: pixelsBeforeDrag.y + offset.top
10766
- };
10767
- var latLngAfterDrag = this.map.pixelsToLatLng(pixelsAfterDrag);
 
 
 
 
 
 
10768
 
10769
- this.setPosition(latLngAfterDrag);
 
 
 
 
 
 
 
 
 
 
10770
 
10771
- this.isBeingDragged = false;
10772
- this.trigger({type: "dragend", latLng: latLngAfterDrag});
 
10773
 
10774
- // NB: "yes" represents disabled
10775
- if(this.map.settings.wpgmza_settings_map_draggable != "yes")
10776
- this.map.olMap.getInteractions().forEach(function(interaction) {
10777
-
10778
- if(interaction instanceof ol.interaction.DragPan)
10779
- interaction.setActive(true);
10780
-
10781
- });
10782
- }
10783
 
10784
- WPGMZA.OLMarker.prototype.onElementClick = function(event)
10785
  {
10786
- var self = event.currentTarget.wpgmzaMarker;
 
 
 
 
10787
 
10788
- if(self.isBeingDragged)
10789
- return; // Don't dispatch click event after a drag
 
10790
 
10791
- self.dispatchEvent("click");
10792
- self.dispatchEvent("select");
10793
  }
10794
 
10795
  /**
10796
- * Binds / rebinds the click listener. This must be bound after draggable is initialized,
10797
- * this solves the click listener firing before dragend
10798
  */
10799
- WPGMZA.OLMarker.prototype.rebindClickListener = function()
10800
- {
10801
- $(this.element).off("click", this.onElementClick);
10802
- $(this.element).on("click", this.onElementClick);
10803
- }
10804
-
10805
- });
10806
-
10807
- // js/v8/open-layers/ol-modern-store-locator-circle.js
10808
- /**
10809
- * @namespace WPGMZA
10810
- * @module OLModernStoreLocatorCircle
10811
- * @requires WPGMZA.ModernStoreLocatorCircle
10812
- */
10813
- jQuery(function($) {
10814
-
10815
- WPGMZA.OLModernStoreLocatorCircle = function(map, settings)
10816
  {
10817
- WPGMZA.ModernStoreLocatorCircle.call(this, map, settings);
 
 
 
 
10818
  }
10819
 
10820
- WPGMZA.OLModernStoreLocatorCircle.prototype = Object.create(WPGMZA.ModernStoreLocatorCircle.prototype);
10821
- WPGMZA.OLModernStoreLocatorCircle.prototype.constructor = WPGMZA.OLModernStoreLocatorCircle;
10822
-
10823
- WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer = function()
 
10824
  {
10825
  var self = this;
10826
- var mapElement = $(this.map.element);
10827
- var olViewportElement = mapElement.children(".ol-viewport");
 
 
 
10828
 
10829
- this.canvas = document.createElement("canvas");
10830
- this.canvas.className = "wpgmza-ol-canvas-overlay";
10831
- mapElement.append(this.canvas);
10832
 
10833
- this.renderFunction = function(event) {
 
 
 
 
 
 
 
 
 
 
 
 
10834
 
10835
- if(self.canvas.width != olViewportElement.width() || self.canvas.height != olViewportElement.height())
10836
- {
10837
- self.canvas.width = olViewportElement.width();
10838
- self.canvas.height = olViewportElement.height();
10839
-
10840
- $(this.canvas).css({
10841
- width: olViewportElement.width() + "px",
10842
- height: olViewportElement.height() + "px"
10843
- });
10844
- }
10845
 
10846
- self.draw();
10847
- };
10848
 
10849
- this.map.olMap.on("postrender", this.renderFunction);
10850
- }
10851
-
10852
- WPGMZA.OLModernStoreLocatorCircle.prototype.getContext = function(type)
10853
- {
10854
- return this.canvas.getContext(type);
10855
  }
10856
 
10857
- WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions = function()
10858
  {
10859
- return {
10860
- width: this.canvas.width,
10861
- height: this.canvas.height
10862
- };
10863
  }
10864
 
10865
- WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels = function()
10866
- {
10867
- var center = this.map.latLngToPixels(this.settings.center);
10868
-
10869
- return center;
10870
- }
10871
-
10872
- WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset = function()
10873
  {
10874
- return {
10875
- x: 0,
10876
- y: 0
10877
- };
10878
  }
10879
 
10880
- WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius = function(km)
10881
- {
10882
- var center = new WPGMZA.LatLng(this.settings.center);
10883
- var outer = new WPGMZA.LatLng(center);
10884
-
10885
- outer.moveByDistance(km, 90);
10886
-
10887
- var centerPixels = this.map.latLngToPixels(center);
10888
- var outerPixels = this.map.latLngToPixels(outer);
10889
-
10890
- return Math.abs(outerPixels.x - centerPixels.x);
10891
-
10892
- /*if(!window.testMarker){
10893
- window.testMarker = WPGMZA.Marker.createInstance({
10894
- position: outer
10895
- });
10896
- WPGMZA.maps[0].addMarker(window.testMarker);
10897
- }
10898
 
10899
- return 100;*/
10900
  }
10901
 
10902
- WPGMZA.OLModernStoreLocatorCircle.prototype.getScale = function()
10903
  {
10904
- return 1;
10905
  }
10906
 
10907
- WPGMZA.OLModernStoreLocatorCircle.prototype.destroy = function()
10908
  {
10909
- $(this.canvas).remove();
10910
-
10911
- this.map.olMap.un("postrender", this.renderFunction);
10912
- this.map = null;
10913
- this.canvas = null;
10914
  }
10915
 
10916
- });
10917
-
10918
- // js/v8/open-layers/ol-modern-store-locator.js
10919
- /**
10920
- * @namespace WPGMZA
10921
- * @module OLModernStoreLocator
10922
- * @requires WPGMZA.ModernStoreLocator
10923
- */
10924
- jQuery(function($) {
10925
-
10926
- WPGMZA.OLModernStoreLocator = function(map_id)
10927
  {
10928
- var element;
10929
-
10930
- WPGMZA.ModernStoreLocator.call(this, map_id);
10931
-
10932
- if(WPGMZA.isProVersion())
10933
- element = $(".wpgmza_map[data-map-id='" + map_id + "']");
10934
- else
10935
- element = $("#wpgmza_map");
10936
-
10937
- element.append(this.element);
10938
  }
10939
 
10940
- WPGMZA.OLModernStoreLocator.prototype = Object.create(WPGMZA.ModernStoreLocator);
10941
- WPGMZA.OLModernStoreLocator.prototype.constructor = WPGMZA.OLModernStoreLocator;
10942
-
10943
  });
10944
 
10945
- // js/v8/open-layers/ol-polygon.js
10946
  /**
10947
  * @namespace WPGMZA
10948
- * @module OLPolygon
10949
- * @requires WPGMZA.Polygon
10950
- * @pro-requires WPGMZA.ProPolygon
10951
  */
10952
  jQuery(function($) {
10953
 
10954
- var Parent;
10955
-
10956
- WPGMZA.OLPolygon = function(options, olFeature)
10957
  {
10958
  var self = this;
10959
 
10960
- Parent.call(this, options, olFeature);
10961
-
10962
- this.olStyle = new ol.style.Style();
10963
 
10964
- if(olFeature)
10965
- {
10966
- this.olFeature = olFeature;
10967
- }
10968
- else
10969
- {
10970
- var coordinates = [[]];
10971
 
10972
- if(options && options.polydata)
10973
- {
10974
- var paths = this.parseGeometry(options.polydata);
10975
-
10976
- for(var i = 0; i < paths.length; i++)
10977
- coordinates[0].push(ol.proj.fromLonLat([
10978
- parseFloat(paths[i].lng),
10979
- parseFloat(paths[i].lat)
10980
- ]));
10981
-
10982
- this.olStyle = new ol.style.Style(this.getStyleFromSettings());
10983
- }
10984
 
10985
- this.olFeature = new ol.Feature({
10986
- geometry: new ol.geom.Polygon(coordinates)
10987
- });
10988
- }
10989
-
10990
- this.layer = new ol.layer.Vector({
10991
- source: new ol.source.Vector({
10992
- features: [this.olFeature]
10993
- }),
10994
- style: this.olStyle
10995
- });
10996
 
10997
- this.layer.getSource().getFeatures()[0].setProperties({
10998
- wpgmzaPolygon: this
 
 
 
10999
  });
11000
  }
11001
 
11002
- if(WPGMZA.isProVersion())
11003
- Parent = WPGMZA.ProPolygon;
11004
- else
11005
- Parent = WPGMZA.Polygon;
11006
 
11007
- WPGMZA.OLPolygon.prototype = Object.create(Parent.prototype);
11008
- WPGMZA.OLPolygon.prototype.constructor = WPGMZA.OLPolygon;
11009
-
11010
- WPGMZA.OLPolygon.prototype.getStyleFromSettings = function()
11011
  {
11012
- var params = {};
11013
-
11014
- if(this.linecolor && this.lineopacity)
11015
- params.stroke = new ol.style.Stroke({
11016
- color: WPGMZA.hexOpacityToRGBA("#" + this.linecolor, this.lineopacity)
11017
- });
11018
 
11019
- if(this.opacity)
11020
- params.fill = new ol.style.Fill({
11021
- color: WPGMZA.hexOpacityToRGBA(this.fillcolor, this.opacity)
11022
- });
11023
-
11024
- return params;
 
 
 
 
 
 
 
 
 
 
 
11025
  }
11026
 
11027
- WPGMZA.OLPolygon.prototype.updateStyleFromSettings = function()
11028
  {
11029
- // Re-create the style - working on it directly doesn't cause a re-render
11030
- var params = this.getStyleFromSettings();
11031
- this.olStyle = new ol.style.Style(params);
11032
- this.layer.setStyle(this.olStyle);
11033
  }
11034
 
11035
- WPGMZA.OLPolygon.prototype.setEditable = function(editable)
11036
  {
 
11037
 
 
11038
  }
11039
 
11040
- WPGMZA.OLPolygon.prototype.toJSON = function()
11041
  {
11042
- var result = Parent.prototype.toJSON.call(this);
11043
- var coordinates = this.olFeature.getGeometry().getCoordinates()[0];
11044
-
11045
- result.points = [];
11046
-
11047
- for(var i = 0; i < coordinates.length; i++)
11048
- {
11049
- var lonLat = ol.proj.toLonLat(coordinates[i]);
11050
- var latLng = {
11051
- lat: lonLat[1],
11052
- lng: lonLat[0]
11053
- };
11054
- result.points.push(latLng);
11055
- }
11056
 
11057
- return result;
11058
  }
11059
 
11060
- });
11061
-
11062
- // js/v8/open-layers/ol-polyline.js
11063
- /**
11064
- * @namespace WPGMZA
11065
- * @module OLPolyline
11066
- * @requires WPGMZA.Polyline
11067
- */
11068
- jQuery(function($) {
11069
-
11070
- var Parent;
11071
-
11072
- WPGMZA.OLPolyline = function(options, olFeature)
11073
  {
11074
- var self = this;
11075
-
11076
- WPGMZA.Polyline.call(this, options);
11077
-
11078
- this.olStyle = new ol.style.Style();
11079
-
11080
- if(olFeature)
11081
- {
11082
- this.olFeature = olFeature;
11083
- }
11084
- else
11085
- {
11086
- var coordinates = [];
11087
-
11088
- if(options && (options.polydata || options.points))
11089
- {
11090
- var path;
11091
-
11092
- if(options.polydata)
11093
- path = this.parseGeometry(options.polydata);
11094
- else
11095
- path = options.points;
11096
-
11097
- for(var i = 0; i < path.length; i++)
11098
- {
11099
- if(!($.isNumeric(path[i].lat)))
11100
- throw new Error("Invalid latitude");
11101
-
11102
- if(!($.isNumeric(path[i].lng)))
11103
- throw new Error("Invalid longitude");
11104
-
11105
- coordinates.push(ol.proj.fromLonLat([
11106
- parseFloat(path[i].lng),
11107
- parseFloat(path[i].lat)
11108
- ]));
11109
- }
11110
- }
11111
-
11112
- var params = this.getStyleFromSettings();
11113
- this.olStyle = new ol.style.Style(params);
11114
-
11115
- this.olFeature = new ol.Feature({
11116
- geometry: new ol.geom.LineString(coordinates)
11117
- });
11118
- }
11119
 
11120
- this.layer = new ol.layer.Vector({
11121
- source: new ol.source.Vector({
11122
- features: [this.olFeature]
11123
- }),
11124
- style: this.olStyle
 
 
 
11125
  });
11126
 
11127
- this.layer.getSource().getFeatures()[0].setProperties({
11128
- wpgmzaPolyline: this
11129
- });
 
 
 
 
 
 
 
11130
  }
11131
 
11132
- Parent = WPGMZA.Polyline;
11133
-
11134
- WPGMZA.OLPolyline.prototype = Object.create(Parent.prototype);
11135
- WPGMZA.OLPolyline.prototype.constructor = WPGMZA.OLPolyline;
 
 
 
11136
 
11137
- WPGMZA.OLPolyline.prototype.getStyleFromSettings = function()
11138
  {
11139
- var params = {};
 
11140
 
11141
- if(this.settings.strokeOpacity)
11142
- params.stroke = new ol.style.Stroke({
11143
- color: WPGMZA.hexOpacityToRGBA(this.settings.strokeColor, this.settings.strokeOpacity),
11144
- width: parseInt(this.settings.strokeWeight)
11145
- });
11146
-
11147
- return params;
11148
  }
11149
 
11150
- WPGMZA.OLPolyline.prototype.updateStyleFromSettings = function()
11151
  {
11152
- // Re-create the style - working on it directly doesn't cause a re-render
11153
- var params = this.getStyleFromSettings();
11154
- this.olStyle = new ol.style.Style(params);
11155
- this.layer.setStyle(this.olStyle);
11156
  }
11157
 
11158
- WPGMZA.OLPolyline.prototype.setEditable = function(editable)
11159
  {
11160
-
11161
  }
11162
 
11163
- WPGMZA.OLPolyline.prototype.setPoints = function(points)
11164
  {
11165
- if(this.olFeature)
11166
- this.layer.getSource().removeFeature(this.olFeature);
11167
-
11168
- var coordinates = [];
11169
-
11170
- for(var i = 0; i < points.length; i++)
11171
- coordinates.push(ol.proj.fromLonLat([
11172
- parseFloat(points[i].lng),
11173
- parseFloat(points[i].lat)
11174
- ]));
11175
-
11176
- this.olFeature = new ol.Feature({
11177
- geometry: new ol.geom.LineString(coordinates)
11178
- });
11179
-
11180
- this.layer.getSource().addFeature(this.olFeature);
11181
  }
11182
 
11183
- WPGMZA.OLPolyline.prototype.toJSON = function()
11184
  {
11185
- var result = Parent.prototype.toJSON.call(this);
11186
- var coordinates = this.olFeature.getGeometry().getCoordinates();
11187
-
11188
- result.points = [];
11189
-
11190
- for(var i = 0; i < coordinates.length; i++)
11191
- {
11192
- var lonLat = ol.proj.toLonLat(coordinates[i]);
11193
- var latLng = {
11194
- lat: lonLat[1],
11195
- lng: lonLat[0]
11196
- };
11197
- result.points.push(latLng);
11198
- }
11199
 
11200
- return result;
11201
  }
11202
 
11203
- });
11204
-
11205
- // js/v8/open-layers/ol-text.js
11206
- /**
11207
- * @namespace WPGMZA
11208
- * @module OLText
11209
- * @requires WPGMZA.Text
11210
- */
11211
- jQuery(function($) {
11212
-
11213
- WPGMZA.OLText = function()
11214
  {
 
 
11215
 
 
11216
  }
11217
 
11218
  });
11219
 
11220
- // js/v8/tables/datatable.js
11221
  /**
11222
  * @namespace WPGMZA
11223
- * @module DataTable
11224
- * @requires WPGMZA
11225
  */
11226
  jQuery(function($) {
11227
 
11228
- WPGMZA.DataTable = function(element)
11229
  {
11230
- var self = this;
11231
- if(!$.fn.dataTable)
11232
- {
11233
- console.warn("The dataTables library is not loaded. Cannot create a dataTable. Did you enable 'Do not enqueue dataTables'?");
11234
-
11235
- if(WPGMZA.settings.wpgmza_do_not_enqueue_datatables && WPGMZA.getCurrentPage() == WPGMZA.PAGE_MAP_EDIT)
11236
- 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.");
11237
-
11238
- return;
11239
- }
11240
 
11241
- if($.fn.dataTable.ext)
11242
- $.fn.dataTable.ext.errMode = "throw";
11243
- else
11244
- {
11245
- var version = $.fn.dataTable.version ? $.fn.dataTable.version : "unknown";
11246
-
11247
- 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.");
11248
- }
11249
 
11250
- this.element = element;
11251
- this.element.wpgmzaDataTable = this;
11252
- this.dataTableElement = this.getDataTableElement();
11253
 
11254
- var settings = this.getDataTableSettings();
11255
-
11256
- this.phpClass = $(element).attr("data-wpgmza-php-class");
11257
- this.wpgmzaDataTable = this;
 
11258
 
11259
- this.useCompressedPathVariable = (WPGMZA.restAPI.isCompressedPathVariableSupported && WPGMZA.settings.enable_compressed_path_variables);
11260
- this.method = (this.useCompressedPathVariable ? "GET" : "POST");
11261
 
11262
- if(this.getLanguageURL() == undefined || this.getLanguageURL() == "//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json")
11263
  {
11264
- this.dataTable = $(this.dataTableElement).DataTable(settings);
11265
- this.dataTable.ajax.reload();
 
 
 
 
 
 
 
11266
  }
11267
- else{
11268
 
11269
- $.ajax(this.getLanguageURL(), {
11270
-
11271
- success: function(response, status, xhr)
11272
- {
11273
- self.languageJSON = response; // TODO: This doesn't appear to go anywhere
11274
-
11275
- self.dataTable = $(self.dataTableElement).DataTable(settings);
11276
- self.dataTable.ajax.reload();
11277
- },
11278
-
11279
- error: function()
11280
- {
11281
- // TODO: Use complete instead
11282
- self.dataTable = $(self.dataTableElement).DataTable(settings);
11283
- self.dataTable.ajax.reload();
11284
- }
11285
-
11286
- });
11287
- }
11288
- }
11289
-
11290
- WPGMZA.DataTable.prototype.getDataTableElement = function()
11291
- {
11292
- return $(this.element).find("table");
11293
  }
11294
 
11295
- /**
11296
- * This function wraps the request so it doesn't collide with WP query vars,
11297
- * it also adds the PHP class so that the controller knows which class to
11298
- * instantiate
11299
- * @return object
11300
- */
11301
- WPGMZA.DataTable.prototype.onAJAXRequest = function(data, settings)
11302
- {
11303
- // TODO: Move this to the REST API module and add useCompressedPathVariable
11304
- var params = {
11305
- "phpClass": this.phpClass
11306
- };
11307
-
11308
- var attr = $(this.element).attr("data-wpgmza-ajax-parameters");
11309
- if(attr)
11310
- $.extend(params, JSON.parse(attr));
11311
-
11312
- return $.extend(data, params);
11313
- }
11314
 
11315
- WPGMZA.DataTable.prototype.onDataTableAjaxRequest = function(data, callback, settings)
11316
- {
11317
- var self = this;
11318
- var element = this.element;
11319
- var route = $(element).attr("data-wpgmza-rest-api-route");
11320
- var params = this.onAJAXRequest(data, settings);
11321
- var draw = params.draw;
11322
-
11323
- delete params.draw;
11324
-
11325
- if(!route)
11326
- throw new Error("No data-wpgmza-rest-api-route attribute specified");
11327
-
11328
- var options = {
11329
- method: "POST",
11330
- useCompressedPathVariable: true,
11331
- data: params,
11332
- dataType: "json",
11333
- cache: !this.preventCaching,
11334
- beforeSend: function(xhr) {
11335
- // Put draw in header, for compressed requests
11336
- xhr.setRequestHeader("X-DataTables-Draw", draw);
11337
- },
11338
- success: function(response, status, xhr) {
11339
-
11340
- response.draw = draw;
11341
- self.lastResponse = response;
11342
-
11343
- callback(response);
11344
- self.onAJAXResponse(response);
11345
-
11346
- }
11347
- };
11348
-
11349
- return WPGMZA.restAPI.call(route, options);
11350
- }
11351
 
11352
- WPGMZA.DataTable.prototype.getDataTableSettings = function()
 
 
11353
  {
11354
  var self = this;
11355
- var element = this.element;
11356
- var options = {};
11357
-
11358
- if($(element).attr("data-wpgmza-datatable-options"))
11359
- options = JSON.parse($(element).attr("data-wpgmza-datatable-options"));
11360
-
11361
- options.deferLoading = true;
11362
- options.processing = true;
11363
- options.serverSide = true;
11364
- options.ajax = function(data, callback, settings) {
11365
- return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self, arguments);
11366
- }
11367
-
11368
- if(WPGMZA.AdvancedTableDataTable && this instanceof WPGMZA.AdvancedTableDataTable && WPGMZA.settings.wpgmza_default_items)
11369
- options.iDisplayLength = parseInt(WPGMZA.settings.wpgmza_default_items);
11370
 
11371
- options.aLengthMenu = [[5, 10, 25, 50, 100, -1], ["5", "10", "25", "50", "100", WPGMZA.localized_strings.all]];
11372
 
11373
- var languageURL = this.getLanguageURL();
11374
- if(languageURL)
11375
- options.language = {
11376
- "url": languageURL
11377
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11378
 
11379
- return options;
 
 
 
 
11380
  }
11381
 
11382
- WPGMZA.DataTable.prototype.getLanguageURL = function()
11383
- {
11384
- if(!WPGMZA.locale)
11385
- return null;
11386
-
11387
- var languageURL;
11388
 
11389
- switch(WPGMZA.locale.substr(0, 2))
11390
- {
11391
- case "af":
11392
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Afrikaans.json";
11393
- break;
11394
-
11395
- case "sq":
11396
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Albanian.json";
11397
- break;
11398
-
11399
- case "am":
11400
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Amharic.json";
11401
- break;
11402
-
11403
- case "ar":
11404
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Arabic.json";
11405
- break;
11406
-
11407
- case "hy":
11408
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Armenian.json";
11409
- break;
11410
-
11411
- case "az":
11412
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Azerbaijan.json";
11413
- break;
11414
-
11415
- case "bn":
11416
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Bangla.json";
11417
- break;
11418
-
11419
- case "eu":
11420
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Basque.json";
11421
- break;
11422
-
11423
- case "be":
11424
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Belarusian.json";
11425
- break;
11426
-
11427
- case "bg":
11428
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Bulgarian.json";
11429
- break;
11430
-
11431
- case "ca":
11432
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Catalan.json";
11433
- break;
11434
-
11435
- case "zh":
11436
- if(WPGMZA.locale == "zh_TW")
11437
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Chinese-traditional.json";
11438
- else
11439
- languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";
11440
- break;
11441
-
11442
- case "hr":
11443
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Croatian.json";
11444
- break;
11445
-
11446
- case "cs":
11447
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Czech.json";
11448
- break;
11449
-
11450
- case "da":
11451
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Danish.json";
11452
- break;
11453
-
11454
- case "nl":
11455
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Dutch.json";
11456
- break;
11457
-
11458
- /*case "en":
11459
- languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json";
11460
- break;*/
11461
-
11462
- case "et":
11463
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Estonian.json";
11464
- break;
11465
-
11466
- case "fi":
11467
- if(WPGMZA.locale.match(/^fil/))
11468
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Filipino.json";
11469
- else
11470
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Finnish.json";
11471
- break;
11472
-
11473
- case "fr":
11474
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/French.json";
11475
- break;
11476
-
11477
- case "gl":
11478
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Galician.json";
11479
- break;
11480
-
11481
- case "ka":
11482
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Georgian.json";
11483
- break;
11484
-
11485
- case "de":
11486
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/German.json";
11487
- break;
11488
-
11489
- case "el":
11490
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Greek.json";
11491
- break;
11492
-
11493
- case "gu":
11494
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Gujarati.json";
11495
- break;
11496
-
11497
- case "he":
11498
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Hebrew.json";
11499
- break;
11500
-
11501
- case "hi":
11502
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Hindi.json";
11503
- break;
11504
-
11505
- case "hu":
11506
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Hungarian.json";
11507
- break;
11508
-
11509
- case "is":
11510
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Icelandic.json";
11511
- break;
11512
-
11513
- /*case "id":
11514
- languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/Indonesian-Alternative.json";
11515
- break;*/
11516
-
11517
- case "id":
11518
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Indonesian.json";
11519
- break;
11520
-
11521
- case "ga":
11522
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Irish.json";
11523
- break;
11524
-
11525
- case "it":
11526
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Italian.json";
11527
- break;
11528
-
11529
- case "ja":
11530
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Japanese.json";
11531
- break;
11532
-
11533
- case "kk":
11534
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Kazakh.json";
11535
- break;
11536
-
11537
- case "ko":
11538
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Korean.json";
11539
- break;
11540
-
11541
- case "ky":
11542
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Kyrgyz.json";
11543
- break;
11544
-
11545
- case "lv":
11546
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Latvian.json";
11547
- break;
11548
-
11549
- case "lt":
11550
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Lithuanian.json";
11551
- break;
11552
-
11553
- case "mk":
11554
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Macedonian.json";
11555
- break;
11556
-
11557
- case "ml":
11558
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Malay.json";
11559
- break;
11560
-
11561
- case "mn":
11562
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Mongolian.json";
11563
- break;
11564
-
11565
- case "ne":
11566
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Nepali.json";
11567
- break;
11568
 
11569
- case "nb":
11570
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Norwegian-Bokmal.json";
11571
- break;
11572
-
11573
- case "nn":
11574
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Norwegian-Nynorsk.json";
11575
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11576
 
11577
- case "ps":
11578
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Pashto.json";
11579
- break;
11580
-
11581
- case "fa":
11582
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Persian.json";
11583
- break;
11584
-
11585
- case "pl":
11586
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Polish.json";
11587
- break;
11588
-
11589
- case "pt":
11590
- if(WPGMZA.locale == "pt_BR")
11591
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Portuguese-Brasil.json";
11592
- else
11593
- languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";
11594
- break;
11595
 
11596
- case "ro":
11597
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Romanian.json";
11598
- break;
11599
-
11600
- case "ru":
11601
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Russian.json";
11602
- break;
11603
-
11604
- case "sr":
11605
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Serbian.json";
11606
- break;
11607
-
11608
- case "si":
11609
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Sinhala.json";
11610
- break;
11611
-
11612
- case "sk":
11613
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Slovak.json";
11614
- break;
11615
-
11616
- case "sl":
11617
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Slovenian.json";
11618
- break;
11619
-
11620
- case "es":
11621
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Spanish.json";
11622
- break;
11623
-
11624
- case "sw":
11625
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Swahili.json";
11626
- break;
11627
-
11628
- case "sv":
11629
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Swedish.json";
11630
- break;
11631
-
11632
- case "ta":
11633
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Tamil.json";
11634
- break;
11635
-
11636
- case "te":
11637
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/telugu.json";
11638
- break;
11639
-
11640
- case "th":
11641
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Thai.json";
11642
- break;
11643
-
11644
- case "tr":
11645
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Turkish.json";
11646
- break;
11647
-
11648
- case "uk":
11649
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Ukrainian.json";
11650
- break;
11651
-
11652
- case "ur":
11653
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Urdu.json";
11654
- break;
11655
-
11656
- case "uz":
11657
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Uzbek.json";
11658
- break;
11659
 
11660
- case "vi":
11661
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Vietnamese.json";
11662
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11663
 
11664
- case "cy":
11665
- languageURL = WPGMZA.pluginDirURL + "languages/datatables/Welsh.json";
11666
- break;
11667
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
11668
 
11669
- return languageURL;
 
 
 
 
11670
  }
11671
 
11672
- WPGMZA.DataTable.prototype.onAJAXResponse = function(response)
 
 
 
11673
  {
 
 
11674
 
 
 
 
 
 
 
 
 
11675
  }
11676
 
11677
- WPGMZA.DataTable.prototype.reload = function()
11678
  {
11679
- this.dataTable.ajax.reload(null, false); // null callback, false for resetPaging
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11680
  }
11681
 
11682
  });
11683
 
11684
- // js/v8/tables/admin-marker-datatable.js
11685
  /**
11686
  * @namespace WPGMZA
11687
- * @module AdminMarkerDataTable
11688
- * @requires WPGMZA.DataTable
11689
  */
11690
  jQuery(function($) {
11691
 
11692
- WPGMZA.AdminMarkerDataTable = function(element)
 
 
 
 
 
 
11693
  {
11694
  var self = this;
11695
 
11696
- this.preventCaching = true;
11697
-
11698
- WPGMZA.DataTable.call(this, element);
11699
-
11700
- // NB: Pro marker panel currently manages edit marker buttons
11701
-
11702
- $(element).on("click", "[data-delete-marker-id]", function(event) {
11703
- self.onDeleteMarker(event);
11704
- });
11705
 
11706
- $(element).find(".wpgmza.select_all_markers").on("click", function(event) {
11707
- self.onSelectAll(event);
11708
- });
11709
 
11710
- $(element).find(".wpgmza.bulk_delete").on("click", function(event) {
11711
- self.onBulkDelete(event);
11712
- });
11713
-
11714
- $(element).on("click", "[data-center-marker-id]", function(event) {
11715
- self.onCenterMarker(event);
11716
  });
11717
  }
11718
 
11719
- WPGMZA.AdminMarkerDataTable.prototype = Object.create(WPGMZA.DataTable.prototype);
11720
- WPGMZA.AdminMarkerDataTable.prototype.constructor = WPGMZA.AdminMarkerDataTable;
11721
-
11722
- WPGMZA.AdminMarkerDataTable.createInstance = function(element)
11723
- {
11724
- return new WPGMZA.AdminMarkerDataTable(element);
11725
- }
11726
 
11727
- WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings = function()
11728
  {
11729
  var self = this;
11730
- var options = WPGMZA.DataTable.prototype.getDataTableSettings.call(this);
11731
-
11732
- options.createdRow = function(row, data, index)
11733
- {
11734
- var meta = self.lastResponse.meta[index];
11735
- row.wpgmzaMarkerData = meta;
11736
- }
11737
 
11738
- return options;
11739
- }
11740
-
11741
- WPGMZA.AdminMarkerDataTable.prototype.onEditMarker = function(event)
11742
- {
11743
- WPGMZA.animatedScroll("#wpgmaps_tabs_markers");
11744
  }
11745
 
11746
- WPGMZA.AdminMarkerDataTable.prototype.onDeleteMarker = function(event)
11747
  {
11748
- var self = this;
11749
- var id = $(event.currentTarget).attr("data-delete-marker-id");
11750
-
11751
- var data = {
11752
- action: 'delete_marker',
11753
- security: WPGMZA.legacyajaxnonce,
11754
- map_id: WPGMZA.mapEditPage.map.id,
11755
- marker_id: id
11756
- };
11757
 
11758
- $.post(ajaxurl, data, function(response) {
11759
-
11760
- WPGMZA.mapEditPage.map.removeMarkerByID(id);
11761
- self.reload();
11762
-
11763
- });
11764
  }
11765
 
11766
- // NB: Move this to UGM
11767
- WPGMZA.AdminMarkerDataTable.prototype.onApproveMarker = function(event)
11768
  {
11769
- var self = this;
11770
- var cur_id = $(this).attr("id");
11771
-
11772
- var data = {
11773
- action: 'approve_marker',
11774
- security: WPGMZA.legacyajaxnonce,
11775
- map_id: WPGMZA.mapEditPage.map.id,
11776
- marker_id: cur_id
11777
- };
11778
- $.post(ajaxurl, data, function (response) {
11779
-
11780
-
11781
- wpgmza_InitMap();
11782
- wpgmza_reinitialisetbl();
11783
-
11784
- });
11785
  }
11786
 
11787
- WPGMZA.AdminMarkerDataTable.prototype.onSelectAll = function(event)
11788
  {
11789
- $(this.element).find("input[name='mark']").prop("checked", true);
11790
  }
11791
 
11792
- WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete = function(event)
11793
  {
11794
- var self = this;
11795
- var ids = [];
11796
- var map = WPGMZA.maps[0];
11797
-
11798
- $(this.element).find("input[name='mark']:checked").each(function(index, el) {
11799
- var row = $(el).closest("tr")[0];
11800
- ids.push(row.wpgmzaMarkerData.id);
11801
- });
11802
-
11803
- ids.forEach(function(marker_id) {
11804
- var marker = map.getMarkerByID(marker_id);
11805
-
11806
- if(marker)
11807
- map.removeMarker(marker);
11808
- });
11809
-
11810
- WPGMZA.restAPI.call("/markers/", {
11811
- method: "DELETE",
11812
- data: {
11813
- ids: ids
11814
- },
11815
- complete: function() {
11816
- self.reload();
11817
- }
11818
- });
11819
- }
11820
 
11821
- WPGMZA.AdminMarkerDataTable.prototype.onCenterMarker = function(event)
11822
- {
11823
- var id;
11824
 
11825
- //Check if we have selected the center on marker button or called this function elsewhere
11826
- if(event.currentTarget == undefined)
11827
- {
11828
- id = event;
11829
- }
11830
- else{
11831
- id = $(event.currentTarget).attr("data-center-marker-id");
11832
- }
 
11833
 
11834
- var marker = WPGMZA.mapEditPage.map.getMarkerByID(id);
11835
-
11836
- if(marker){
11837
- var latLng = new WPGMZA.LatLng({
11838
- lat: marker.lat,
11839
- lng: marker.lng
11840
- });
11841
-
11842
- //Set a static zoom level
11843
- var zoom_value = 6;
11844
- WPGMZA.mapEditPage.map.setCenter(latLng);
11845
- WPGMZA.mapEditPage.map.setZoom(zoom_value);
11846
- WPGMZA.animateScroll("#wpgmaps_tabs_markers");
11847
  }
11848
 
11849
-
 
11850
  }
11851
 
11852
- $(document).ready(function(event) {
11853
-
11854
- $("[data-wpgmza-admin-marker-datatable]").each(function(index, el) {
11855
- WPGMZA.adminMarkerDataTable = WPGMZA.AdminMarkerDataTable.createInstance(el);
11856
- });
11857
-
11858
- });
11859
-
11860
  });
3826
  {
3827
  if(!(marker instanceof WPGMZA.Marker))
3828
  throw new Error("Argument must be an instance of WPGMZA.Marker");
3829
+
3830
+
3831
+
3832
  marker.map = this;
3833
  marker.parent = this;
3834
 
3851
  {
3852
  if(!(marker instanceof WPGMZA.Marker))
3853
  throw new Error("Argument must be an instance of WPGMZA.Marker");
3854
+
3855
+ if(marker.map !== this) {
3856
+ //throw new Error("Wrong map error");
3857
+ console.error("Wrong map error");
3858
+ }
3859
 
3860
  if(marker.infoWindow)
3861
  marker.infoWindow.close();
3862
 
3863
  marker.map = null;
3864
  marker.parent = null;
 
3865
  this.markers.splice(this.markers.indexOf(marker), 1);
3866
  this.dispatchEvent({type: "markerremoved", marker: marker});
3867
  marker.dispatchEvent({type: "removed"});
3868
+
3869
  }
3870
 
3871
  /**
3914
  * @fires markerremoved
3915
  * @fires WPGMZA.Marker#removed
3916
  */
3917
+ WPGMZA.Map.prototype.removeMarkerByID = function(id) {
3918
+
3919
  var marker = this.getMarkerByID(id);
3920
 
3921
  if(!marker)
7139
 
7140
  });
7141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7142
  // js/v8/compatibility/astra-theme-compatibility.js
7143
  /**
7144
  * @namespace WPGMZA
7194
 
7195
  });
7196
 
7197
+ // js/v8/tables/datatable.js
7198
  /**
7199
  * @namespace WPGMZA
7200
+ * @module DataTable
7201
+ * @requires WPGMZA
7202
  */
7203
  jQuery(function($) {
7204
 
7205
+ WPGMZA.DataTable = function(element)
 
 
 
 
 
 
 
 
7206
  {
7207
  var self = this;
7208
+ if(!$.fn.dataTable)
 
 
 
7209
  {
7210
+ console.warn("The dataTables library is not loaded. Cannot create a dataTable. Did you enable 'Do not enqueue dataTables'?");
7211
+
7212
+ if(WPGMZA.settings.wpgmza_do_not_enqueue_datatables && WPGMZA.getCurrentPage() == WPGMZA.PAGE_MAP_EDIT)
7213
+ 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.");
7214
+
7215
+ return;
7216
  }
7217
+
7218
+ if($.fn.dataTable.ext)
7219
+ $.fn.dataTable.ext.errMode = "throw";
7220
  else
7221
  {
7222
+ var version = $.fn.dataTable.version ? $.fn.dataTable.version : "unknown";
7223
+
7224
+ 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.");
7225
  }
7226
 
7227
+ this.element = element;
7228
+ this.element.wpgmzaDataTable = this;
7229
+ this.dataTableElement = this.getDataTableElement();
7230
+
7231
+ var settings = this.getDataTableSettings();
7232
 
7233
+ this.phpClass = $(element).attr("data-wpgmza-php-class");
7234
+ this.wpgmzaDataTable = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7235
 
7236
+ this.useCompressedPathVariable = (WPGMZA.restAPI.isCompressedPathVariableSupported && WPGMZA.settings.enable_compressed_path_variables);
7237
+ this.method = (this.useCompressedPathVariable ? "GET" : "POST");
7238
 
7239
+ if(this.getLanguageURL() == undefined || this.getLanguageURL() == "//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json")
7240
  {
7241
+ this.dataTable = $(this.dataTableElement).DataTable(settings);
7242
+ this.dataTable.ajax.reload();
 
7243
  }
7244
+ else{
7245
 
7246
+ $.ajax(this.getLanguageURL(), {
 
 
 
 
 
 
7247
 
7248
+ success: function(response, status, xhr)
7249
+ {
7250
+ self.languageJSON = response; // TODO: This doesn't appear to go anywhere
7251
+
7252
+ self.dataTable = $(self.dataTableElement).DataTable(settings);
7253
+ self.dataTable.ajax.reload();
7254
+ },
7255
+
7256
+ error: function()
7257
+ {
7258
+ // TODO: Use complete instead
7259
+ self.dataTable = $(self.dataTableElement).DataTable(settings);
7260
+ self.dataTable.ajax.reload();
7261
+ }
7262
+
7263
+ });
7264
+ }
7265
+ }
7266
 
7267
+ WPGMZA.DataTable.prototype.getDataTableElement = function()
 
 
 
 
 
 
 
 
7268
  {
7269
+ return $(this.element).find("table");
7270
  }
7271
 
7272
+ /**
7273
+ * This function wraps the request so it doesn't collide with WP query vars,
7274
+ * it also adds the PHP class so that the controller knows which class to
7275
+ * instantiate
7276
+ * @return object
7277
+ */
7278
+ WPGMZA.DataTable.prototype.onAJAXRequest = function(data, settings)
7279
  {
7280
+ // TODO: Move this to the REST API module and add useCompressedPathVariable
7281
+ var params = {
7282
+ "phpClass": this.phpClass
7283
+ };
7284
 
7285
+ var attr = $(this.element).attr("data-wpgmza-ajax-parameters");
7286
+ if(attr)
7287
+ $.extend(params, JSON.parse(attr));
7288
+
7289
+ return $.extend(data, params);
7290
  }
7291
 
7292
+ WPGMZA.DataTable.prototype.onDataTableAjaxRequest = function(data, callback, settings)
7293
  {
7294
+ var self = this;
7295
+ var element = this.element;
7296
+ var route = $(element).attr("data-wpgmza-rest-api-route");
7297
+ var params = this.onAJAXRequest(data, settings);
7298
+ var draw = params.draw;
7299
 
7300
+ delete params.draw;
 
 
 
7301
 
7302
+ if(!route)
7303
+ throw new Error("No data-wpgmza-rest-api-route attribute specified");
7304
 
7305
+ var options = {
7306
+ method: "POST",
7307
+ useCompressedPathVariable: true,
7308
+ data: params,
7309
+ dataType: "json",
7310
+ cache: !this.preventCaching,
7311
+ beforeSend: function(xhr) {
7312
+ // Put draw in header, for compressed requests
7313
+ xhr.setRequestHeader("X-DataTables-Draw", draw);
7314
+ },
7315
+ success: function(response, status, xhr) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7316
 
7317
+ response.draw = draw;
7318
+ self.lastResponse = response;
 
 
 
7319
 
7320
+ callback(response);
7321
+ self.onAJAXResponse(response);
7322
 
 
7323
  }
7324
+ };
7325
+
7326
+ return WPGMZA.restAPI.call(route, options);
7327
  }
7328
 
7329
+ WPGMZA.DataTable.prototype.getDataTableSettings = function()
7330
  {
7331
+ var self = this;
7332
+ var element = this.element;
7333
+ var options = {};
7334
 
7335
+ if($(element).attr("data-wpgmza-datatable-options"))
7336
+ options = JSON.parse($(element).attr("data-wpgmza-datatable-options"));
7337
+
7338
+ options.deferLoading = true;
7339
+ options.processing = true;
7340
+ options.serverSide = true;
7341
+ options.ajax = function(data, callback, settings) {
7342
+ return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self, arguments);
7343
+ }
7344
 
7345
+ if(WPGMZA.AdvancedTableDataTable && this instanceof WPGMZA.AdvancedTableDataTable && WPGMZA.settings.wpgmza_default_items)
7346
+ options.iDisplayLength = parseInt(WPGMZA.settings.wpgmza_default_items);
 
 
 
 
 
7347
 
7348
+ options.aLengthMenu = [[5, 10, 25, 50, 100, -1], ["5", "10", "25", "50", "100", WPGMZA.localized_strings.all]];
7349
+
7350
+ var languageURL = this.getLanguageURL();
7351
+ if(languageURL)
7352
+ options.language = {
7353
+ "url": languageURL
7354
+ };
7355
+
7356
+ return options;
 
 
7357
  }
7358
 
7359
+ WPGMZA.DataTable.prototype.getLanguageURL = function()
7360
+ {
7361
+ if(!WPGMZA.locale)
7362
+ return null;
7363
+
7364
+ var languageURL;
7365
+
7366
+ switch(WPGMZA.locale.substr(0, 2))
7367
+ {
7368
+ case "af":
7369
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Afrikaans.json";
7370
+ break;
7371
 
7372
+ case "sq":
7373
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Albanian.json";
7374
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7375
 
7376
+ case "am":
7377
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Amharic.json";
7378
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7379
 
7380
+ case "ar":
7381
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Arabic.json";
7382
+ break;
7383
 
7384
+ case "hy":
7385
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Armenian.json";
7386
+ break;
 
 
 
 
 
7387
 
7388
+ case "az":
7389
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Azerbaijan.json";
7390
+ break;
7391
 
7392
+ case "bn":
7393
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Bangla.json";
7394
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7395
 
7396
+ case "eu":
7397
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Basque.json";
7398
+ break;
7399
+
7400
+ case "be":
7401
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Belarusian.json";
7402
+ break;
7403
+
7404
+ case "bg":
7405
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Bulgarian.json";
7406
+ break;
7407
+
7408
+ case "ca":
7409
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Catalan.json";
7410
+ break;
7411
+
7412
+ case "zh":
7413
+ if(WPGMZA.locale == "zh_TW")
7414
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Chinese-traditional.json";
7415
+ else
7416
+ languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";
7417
+ break;
7418
+
7419
+ case "hr":
7420
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Croatian.json";
7421
+ break;
7422
+
7423
+ case "cs":
7424
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Czech.json";
7425
+ break;
7426
+
7427
+ case "da":
7428
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Danish.json";
7429
+ break;
7430
+
7431
+ case "nl":
7432
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Dutch.json";
7433
+ break;
7434
+
7435
+ /*case "en":
7436
+ languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json";
7437
+ break;*/
7438
+
7439
+ case "et":
7440
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Estonian.json";
7441
+ break;
7442
+
7443
+ case "fi":
7444
+ if(WPGMZA.locale.match(/^fil/))
7445
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Filipino.json";
7446
+ else
7447
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Finnish.json";
7448
+ break;
7449
+
7450
+ case "fr":
7451
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/French.json";
7452
+ break;
7453
+
7454
+ case "gl":
7455
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Galician.json";
7456
+ break;
7457
+
7458
+ case "ka":
7459
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Georgian.json";
7460
+ break;
7461
+
7462
+ case "de":
7463
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/German.json";
7464
+ break;
7465
+
7466
+ case "el":
7467
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Greek.json";
7468
+ break;
7469
+
7470
+ case "gu":
7471
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Gujarati.json";
7472
+ break;
7473
+
7474
+ case "he":
7475
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Hebrew.json";
7476
+ break;
7477
+
7478
+ case "hi":
7479
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Hindi.json";
7480
+ break;
7481
+
7482
+ case "hu":
7483
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Hungarian.json";
7484
+ break;
7485
+
7486
+ case "is":
7487
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Icelandic.json";
7488
+ break;
7489
+
7490
+ /*case "id":
7491
+ languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/Indonesian-Alternative.json";
7492
+ break;*/
7493
 
7494
+ case "id":
7495
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Indonesian.json";
7496
+ break;
7497
+
7498
+ case "ga":
7499
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Irish.json";
7500
+ break;
7501
+
7502
+ case "it":
7503
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Italian.json";
7504
+ break;
7505
+
7506
+ case "ja":
7507
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Japanese.json";
7508
+ break;
7509
+
7510
+ case "kk":
7511
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Kazakh.json";
7512
+ break;
7513
+
7514
+ case "ko":
7515
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Korean.json";
7516
+ break;
7517
+
7518
+ case "ky":
7519
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Kyrgyz.json";
7520
+ break;
7521
+
7522
+ case "lv":
7523
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Latvian.json";
7524
+ break;
7525
+
7526
+ case "lt":
7527
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Lithuanian.json";
7528
+ break;
7529
+
7530
+ case "mk":
7531
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Macedonian.json";
7532
+ break;
7533
+
7534
+ case "ml":
7535
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Malay.json";
7536
+ break;
7537
+
7538
+ case "mn":
7539
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Mongolian.json";
7540
+ break;
7541
+
7542
+ case "ne":
7543
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Nepali.json";
7544
+ break;
7545
+
7546
+ case "nb":
7547
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Norwegian-Bokmal.json";
7548
+ break;
7549
 
7550
+ case "nn":
7551
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Norwegian-Nynorsk.json";
7552
+ break;
 
7553
 
7554
+ case "ps":
7555
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Pashto.json";
7556
+ break;
7557
+
7558
+ case "fa":
7559
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Persian.json";
7560
+ break;
7561
+
7562
+ case "pl":
7563
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Polish.json";
7564
+ break;
7565
+
7566
+ case "pt":
7567
+ if(WPGMZA.locale == "pt_BR")
7568
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Portuguese-Brasil.json";
7569
+ else
7570
+ languageURL = "//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";
7571
+ break;
7572
 
7573
+ case "ro":
7574
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Romanian.json";
7575
+ break;
 
 
 
 
7576
 
7577
+ case "ru":
7578
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Russian.json";
7579
+ break;
7580
+
7581
+ case "sr":
7582
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Serbian.json";
7583
+ break;
7584
+
7585
+ case "si":
7586
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Sinhala.json";
7587
+ break;
7588
+
7589
+ case "sk":
7590
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Slovak.json";
7591
+ break;
7592
+
7593
+ case "sl":
7594
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Slovenian.json";
7595
+ break;
7596
+
7597
+ case "es":
7598
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Spanish.json";
7599
+ break;
7600
+
7601
+ case "sw":
7602
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Swahili.json";
7603
+ break;
7604
+
7605
+ case "sv":
7606
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Swedish.json";
7607
+ break;
7608
+
7609
+ case "ta":
7610
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Tamil.json";
7611
+ break;
7612
+
7613
+ case "te":
7614
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/telugu.json";
7615
+ break;
7616
+
7617
+ case "th":
7618
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Thai.json";
7619
+ break;
7620
+
7621
+ case "tr":
7622
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Turkish.json";
7623
+ break;
7624
+
7625
+ case "uk":
7626
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Ukrainian.json";
7627
+ break;
7628
+
7629
+ case "ur":
7630
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Urdu.json";
7631
+ break;
7632
+
7633
+ case "uz":
7634
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Uzbek.json";
7635
+ break;
7636
+
7637
+ case "vi":
7638
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Vietnamese.json";
7639
+ break;
7640
+
7641
+ case "cy":
7642
+ languageURL = WPGMZA.pluginDirURL + "languages/datatables/Welsh.json";
7643
+ break;
7644
+ }
7645
+
7646
+ return languageURL;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7647
  }
7648
 
7649
+ WPGMZA.DataTable.prototype.onAJAXResponse = function(response)
 
 
 
 
7650
  {
7651
+
7652
  }
7653
 
7654
+ WPGMZA.DataTable.prototype.reload = function()
 
 
 
 
7655
  {
7656
+ this.dataTable.ajax.reload(null, false); // null callback, false for resetPaging
 
 
 
7657
  }
7658
 
7659
+ });
7660
+
7661
+ // js/v8/tables/admin-marker-datatable.js
7662
+ /**
7663
+ * @namespace WPGMZA
7664
+ * @module AdminMarkerDataTable
7665
+ * @requires WPGMZA.DataTable
7666
+ */
7667
+ jQuery(function($) {
7668
+
7669
+ WPGMZA.AdminMarkerDataTable = function(element)
7670
  {
7671
+ var self = this;
 
 
7672
 
7673
+ this.preventCaching = true;
7674
 
7675
+ WPGMZA.DataTable.call(this, element);
 
 
 
7676
 
7677
+ // NB: Pro marker panel currently manages edit marker buttons
 
 
 
 
7678
 
7679
+ $(element).on("click", "[data-delete-marker-id]", function(event) {
7680
+ self.onDeleteMarker(event);
7681
+ });
 
7682
 
7683
+ $(element).find(".wpgmza.select_all_markers").on("click", function(event) {
7684
+ self.onSelectAll(event);
7685
+ });
7686
+
7687
+ $(element).find(".wpgmza.bulk_delete").on("click", function(event) {
7688
+ self.onBulkDelete(event);
7689
+ });
7690
+
7691
+ $(element).on("click", "[data-center-marker-id]", function(event) {
7692
+ self.onCenterMarker(event);
7693
+ });
7694
  }
7695
 
7696
+ WPGMZA.AdminMarkerDataTable.prototype = Object.create(WPGMZA.DataTable.prototype);
7697
+ WPGMZA.AdminMarkerDataTable.prototype.constructor = WPGMZA.AdminMarkerDataTable;
7698
+
7699
+ WPGMZA.AdminMarkerDataTable.createInstance = function(element)
 
7700
  {
7701
+ return new WPGMZA.AdminMarkerDataTable(element);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7702
  }
7703
 
7704
+ WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings = function()
 
 
 
 
7705
  {
7706
+ var self = this;
7707
+ var options = WPGMZA.DataTable.prototype.getDataTableSettings.call(this);
7708
+
7709
+ options.createdRow = function(row, data, index)
7710
  {
7711
+ var meta = self.lastResponse.meta[index];
7712
+ row.wpgmzaMarkerData = meta;
7713
  }
 
 
 
 
 
 
 
 
 
 
 
 
7714
 
7715
+ return options;
 
 
7716
  }
7717
 
7718
+ WPGMZA.AdminMarkerDataTable.prototype.onEditMarker = function(event)
 
 
 
 
 
7719
  {
7720
+ WPGMZA.animatedScroll("#wpgmaps_tabs_markers");
 
 
 
 
 
7721
  }
7722
 
7723
+ WPGMZA.AdminMarkerDataTable.prototype.onDeleteMarker = function(event)
 
 
 
 
 
7724
  {
7725
+ var self = this;
7726
+ var id = $(event.currentTarget).attr("data-delete-marker-id");
7727
 
7728
+ var data = {
7729
+ action: 'delete_marker',
7730
+ security: WPGMZA.legacyajaxnonce,
7731
+ map_id: WPGMZA.mapEditPage.map.id,
7732
+ marker_id: id
7733
+ };
7734
+
7735
+ $.post(ajaxurl, data, function(response) {
7736
+
7737
+ WPGMZA.mapEditPage.map.removeMarkerByID(id);
7738
+ self.reload();
7739
+
7740
+ });
7741
  }
7742
 
7743
+ // NB: Move this to UGM
7744
+ WPGMZA.AdminMarkerDataTable.prototype.onApproveMarker = function(event)
 
 
 
 
7745
  {
7746
+ var self = this;
7747
+ var cur_id = $(this).attr("id");
 
 
 
 
 
7748
 
7749
+ var data = {
7750
+ action: 'approve_marker',
7751
+ security: WPGMZA.legacyajaxnonce,
7752
+ map_id: WPGMZA.mapEditPage.map.id,
7753
+ marker_id: cur_id
7754
+ };
7755
+ $.post(ajaxurl, data, function (response) {
7756
+
7757
+
7758
+ wpgmza_InitMap();
7759
+ wpgmza_reinitialisetbl();
7760
+
7761
  });
 
 
7762
  }
7763
 
7764
+ WPGMZA.AdminMarkerDataTable.prototype.onSelectAll = function(event)
 
 
 
 
7765
  {
7766
+ $(this.element).find("input[name='mark']").prop("checked", true);
7767
  }
7768
 
7769
+ WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete = function(event)
 
 
 
 
7770
  {
7771
+ var self = this;
7772
+ var ids = [];
7773
+ var map = WPGMZA.maps[0];
7774
+
7775
+ $(this.element).find("input[name='mark']:checked").each(function(index, el) {
7776
+ var row = $(el).closest("tr")[0];
7777
+ ids.push(row.wpgmzaMarkerData.id);
7778
+ });
7779
+
7780
+ ids.forEach(function(marker_id) {
7781
+ var marker = map.getMarkerByID(marker_id);
7782
+
7783
+ if(marker)
7784
+ map.removeMarker(marker);
7785
+ });
7786
+
7787
+ WPGMZA.restAPI.call("/markers/", {
7788
+ method: "DELETE",
7789
+ data: {
7790
+ ids: ids
7791
+ },
7792
+ complete: function() {
7793
+ self.reload();
7794
+ }
7795
  });
7796
  }
7797
+
7798
+ WPGMZA.AdminMarkerDataTable.prototype.onCenterMarker = function(event)
 
 
 
 
7799
  {
7800
+ var id;
7801
+
7802
+ //Check if we have selected the center on marker button or called this function elsewhere
7803
+ if(event.currentTarget == undefined)
7804
+ {
7805
+ id = event;
7806
+ }
7807
+ else{
7808
+ id = $(event.currentTarget).attr("data-center-marker-id");
7809
+ }
7810
+
7811
+ var marker = WPGMZA.mapEditPage.map.getMarkerByID(id);
7812
+
7813
+ if(marker){
7814
+ var latLng = new WPGMZA.LatLng({
7815
+ lat: marker.lat,
7816
+ lng: marker.lng
7817
+ });
7818
+
7819
+ //Set a static zoom level
7820
+ var zoom_value = 6;
7821
+ WPGMZA.mapEditPage.map.setCenter(latLng);
7822
+ WPGMZA.mapEditPage.map.setZoom(zoom_value);
7823
+ WPGMZA.animateScroll("#wpgmaps_tabs_markers");
7824
+ }
7825
+
7826
+
7827
  }
7828
 
7829
+ $(document).ready(function(event) {
7830
+
7831
+ $("[data-wpgmza-admin-marker-datatable]").each(function(index, el) {
7832
+ WPGMZA.adminMarkerDataTable = WPGMZA.AdminMarkerDataTable.createInstance(el);
 
 
 
 
 
7833
  });
7834
+
7835
+ });
7836
 
7837
+ });
7838
+
7839
+ // js/v8/3rd-party-integration/integration.js
7840
+ /**
7841
+ * @namespace WPGMZA
7842
+ * @module Integration
7843
+ * @requires WPGMZA
7844
+ */
7845
+ jQuery(function($) {
 
 
 
 
 
 
 
7846
 
7847
+ WPGMZA.Integration = {};
7848
+ WPGMZA.integrationModules = {};
7849
+
7850
+ });
7851
+
7852
+ // js/v8/3rd-party-integration/gutenberg/dist/gutenberg.js
7853
+ "use strict";
7854
+
7855
+ /**
7856
+ * @namespace WPGMZA.Integration
7857
+ * @module Gutenberg
7858
+ * @requires WPGMZA.Integration
7859
+ * @requires wp-i18n
7860
+ * @requires wp-blocks
7861
+ * @requires wp-editor
7862
+ * @requires wp-components
7863
+ */
7864
+
7865
+ /**
7866
+ * Internal block libraries
7867
+ */
7868
+ jQuery(function ($) {
7869
+
7870
+ if (!window.wp || !wp.i18n || !wp.blocks || !wp.editor || !wp.components) return;
7871
+
7872
+ var __ = wp.i18n.__;
7873
+ var registerBlockType = wp.blocks.registerBlockType;
7874
+ var _wp$editor = wp.editor,
7875
+ InspectorControls = _wp$editor.InspectorControls,
7876
+ BlockControls = _wp$editor.BlockControls;
7877
+ var _wp$components = wp.components,
7878
+ Dashicon = _wp$components.Dashicon,
7879
+ Toolbar = _wp$components.Toolbar,
7880
+ Button = _wp$components.Button,
7881
+ Tooltip = _wp$components.Tooltip,
7882
+ PanelBody = _wp$components.PanelBody,
7883
+ TextareaControl = _wp$components.TextareaControl,
7884
+ CheckboxControl = _wp$components.CheckboxControl,
7885
+ TextControl = _wp$components.TextControl,
7886
+ SelectControl = _wp$components.SelectControl,
7887
+ RichText = _wp$components.RichText;
7888
+
7889
+
7890
+ WPGMZA.Integration.Gutenberg = function () {
7891
+ registerBlockType('gutenberg-wpgmza/block', this.getBlockDefinition());
7892
+ };
7893
+
7894
+ WPGMZA.Integration.Gutenberg.prototype.getBlockTitle = function () {
7895
+ return __("WP Google Maps");
7896
+ };
7897
+
7898
+ WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls = function (props) {
7899
+
7900
+ /*
7901
+ <TextControl
7902
+ name="overrideWidthAmount"
7903
+ label={__("Override Width Amount")}
7904
+ checked={props.overrideWidthAmount}
7905
+ onChange={onPropertiesChanged}
7906
+ />
7907
+
7908
+ <SelectControl
7909
+ name="overrideWidthUnits"
7910
+ label={__("Override Width Units")}
7911
+ options={[
7912
+ {value: "px", label: "px"},
7913
+ {value: "%", label: "%"},
7914
+ {value: "vw`", label: "vw"},
7915
+ {value: "vh", label: "vh"}
7916
+ ]}
7917
+ onChange={onPropertiesChanged}
7918
+ />
7919
+
7920
+ <CheckboxControl
7921
+ name="overrideHeight"
7922
+ label={__("Override Height")}
7923
+ checked={props.overrideWidth}
7924
+ onChange={onPropertiesChanged}
7925
+ />
7926
+
7927
+ <TextControl
7928
+ name="overrideHeightAmount"
7929
+ label={__("Override Height Amount")}
7930
+ checked={props.overrideWidthAmount}
7931
+ onChange={onPropertiesChanged}
7932
+ />
7933
+
7934
+ <SelectControl
7935
+ name="overrideHeightUnits"
7936
+ label={__("Override Height Units")}
7937
+ options={[
7938
+ {value: "px", label: "px"},
7939
+ {value: "%", label: "%"},
7940
+ {value: "vw`", label: "vw"},
7941
+ {value: "vh", label: "vh"}
7942
+ ]}
7943
+ onChange={onPropertiesChanged}
7944
+ />
7945
+ */
7946
+
7947
+ var onOverrideWidthCheckboxChanged = function onOverrideWidthCheckboxChanged(value) {};
7948
+
7949
+ return React.createElement(
7950
+ InspectorControls,
7951
+ { key: "inspector" },
7952
+ React.createElement(
7953
+ PanelBody,
7954
+ { title: __('Map Settings') },
7955
+ React.createElement(
7956
+ "p",
7957
+ { "class": "map-block-gutenberg-button-container" },
7958
+ React.createElement(
7959
+ "a",
7960
+ { href: WPGMZA.adminurl + "admin.php?page=wp-google-maps-menu&action=edit&map_id=1",
7961
+ target: "_blank",
7962
+ "class": "button button-primary" },
7963
+ React.createElement("i", { "class": "fa fa-pencil-square-o", "aria-hidden": "true" }),
7964
+ __('Go to Map Editor')
7965
+ )
7966
+ ),
7967
+ React.createElement(
7968
+ "p",
7969
+ { "class": "map-block-gutenberg-button-container" },
7970
+ React.createElement(
7971
+ "a",
7972
+ { href: "https://www.wpgmaps.com/documentation/creating-your-first-map/",
7973
+ target: "_blank",
7974
+ "class": "button button-primary" },
7975
+ React.createElement("i", { "class": "fa fa-book", "aria-hidden": "true" }),
7976
+ __('View Documentation')
7977
+ )
7978
+ )
7979
+ )
7980
+ );
7981
+ };
7982
+
7983
+ WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes = function () {
7984
+ return {};
7985
+ };
7986
+
7987
+ WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition = function (props) {
7988
+ var _this = this;
7989
+
7990
  return {
7991
+
7992
+ title: __("WP Google Maps"),
7993
+ 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.'),
7994
+ category: 'common',
7995
+ icon: 'location-alt',
7996
+ keywords: [__('Map'), __('Maps'), __('Google')],
7997
+ attributes: this.getBlockAttributes(),
7998
+
7999
+ edit: function edit(props) {
8000
+ return [!!props.isSelected && _this.getBlockInspectorControls(props), React.createElement(
8001
+ "div",
8002
+ { className: props.className + " wpgmza-gutenberg-block" },
8003
+ React.createElement(Dashicon, { icon: "location-alt" }),
8004
+ React.createElement(
8005
+ "span",
8006
+ { "class": "wpgmza-gutenberg-block-title" },
8007
+ __("Your map will appear here on your websites front end")
8008
+ )
8009
+ )];
8010
+ },
8011
+ // Defining the front-end interface
8012
+ save: function save(props) {
8013
+ // Rendering in PHP
8014
+ return null;
8015
+ }
8016
+
8017
  };
8018
+ };
 
 
 
 
 
 
 
 
 
 
 
8019
 
8020
+ WPGMZA.Integration.Gutenberg.getConstructor = function () {
8021
+ return WPGMZA.Integration.Gutenberg;
8022
+ };
8023
 
8024
+ WPGMZA.Integration.Gutenberg.createInstance = function () {
8025
+ var constructor = WPGMZA.Integration.Gutenberg.getConstructor();
8026
+ return new constructor();
8027
+ };
8028
+
8029
+ // Allow the Pro module to extend and create the module, only create here when Pro isn't loaded
8030
+ if(!WPGMZA.isProVersion() && !(/^6/.test(WPGMZA.pro_version))) WPGMZA.integrationModules.gutenberg = WPGMZA.Integration.Gutenberg.createInstance();
8031
  });
8032
 
8033
+ // js/v8/open-layers/ol-circle.js
8034
  /**
8035
  * @namespace WPGMZA
8036
+ * @module OLCircle
8037
+ * @requires WPGMZA.Circle
 
8038
  */
8039
  jQuery(function($) {
8040
 
8041
+ var Parent = WPGMZA.Circle;
8042
 
8043
+ WPGMZA.OLCircle = function(options, olFeature)
8044
  {
8045
  var self = this;
8046
 
8047
+ this.center = {lat: 0, lng: 0};
8048
+ this.radius = 0;
8049
 
8050
+ this.fillcolor = "#ff0000";
8051
+ this.opacity = 0.6;
8052
 
8053
+ Parent.call(this, options, olFeature);
8054
+
8055
+ this.olStyle = new ol.style.Style(this.getStyleFromSettings());
8056
+
8057
+ this.vectorLayer3857 = this.layer = new ol.layer.Vector({
8058
+ source: new ol.source.Vector(),
8059
+ style: this.olStyle
8060
+ });
8061
+
8062
+ if(olFeature)
8063
+ this.olFeature = olFeature;
8064
+ else
8065
+ this.recreate();
8066
+ }
8067
+
8068
+ WPGMZA.OLCircle.prototype = Object.create(Parent.prototype);
8069
+ WPGMZA.OLCircle.prototype.constructor = WPGMZA.OLCircle;
8070
+
8071
+ WPGMZA.OLCircle.prototype.recreate = function()
8072
+ {
8073
+ if(this.olFeature)
8074
  {
8075
+ this.layer.getSource().removeFeature(this.olFeature);
8076
+ delete this.olFeature;
 
 
 
 
 
 
 
 
 
 
 
 
8077
  }
8078
 
8079
+ if(!this.center || !this.radius)
8080
+ return;
8081
 
8082
+ // IMPORTANT: Please note that due to what appears to be a bug in OpenLayers, the following code MUST be exected specifically in this order, or the circle won't appear
8083
+ var radius = parseFloat(this.radius) * 1000 / 2;
8084
+ var x, y;
 
 
 
8085
 
8086
+ x = this.center.lng;
8087
+ y = this.center.lat;
 
 
 
 
 
 
 
8088
 
8089
+ var circle4326 = ol.geom.Polygon.circular([x, y], radius, 64);
8090
+ var circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857');
 
8091
 
8092
+ this.olFeature = new ol.Feature(circle3857);
8093
+
8094
+ this.layer.getSource().addFeature(this.olFeature);
8095
+ }
8096
+
8097
+ WPGMZA.OLCircle.prototype.getStyleFromSettings = function()
8098
+ {
8099
+ var params = {};
8100
+
8101
+ /*if(this.settings.strokeOpacity)
8102
+ params.stroke = new ol.style.Stroke({
8103
+ color: WPGMZA.hexOpacityToRGBA(this.settings.strokeColor, this.settings.strokeOpacity)
8104
+ });*/
8105
+
8106
+ if(this.opacity)
8107
+ params.fill = new ol.style.Fill({
8108
+ color: WPGMZA.hexOpacityToRGBA(this.fillColor, this.opacity)
8109
  });
8110
 
8111
+ return params;
 
 
 
 
 
 
8112
  }
8113
 
8114
+ WPGMZA.OLCircle.prototype.updateStyleFromSettings = function()
8115
+ {
8116
+ // Re-create the style - working on it directly doesn't cause a re-render
8117
+ var params = this.getStyleFromSettings();
8118
+ this.olStyle = new ol.style.Style(params);
8119
+ this.layer.setStyle(this.olStyle);
8120
+ }
8121
 
8122
+ WPGMZA.OLCircle.prototype.setVisible = function(visible)
8123
+ {
8124
+ this.layer.setVisible(visible ? true : false);
8125
+ }
8126
+
8127
+ WPGMZA.OLCircle.prototype.setCenter = function(center)
8128
+ {
8129
+ WPGMZA.Circle.prototype.setCenter.apply(this, arguments);
 
 
8130
 
8131
+ this.recreate();
8132
+ }
8133
 
8134
+ WPGMZA.OLCircle.prototype.setRadius = function(radius)
8135
  {
8136
+ WPGMZA.Circle.prototype.setRadius.apply(this, arguments);
 
 
 
 
8137
 
8138
+ this.recreate();
8139
+ }
8140
+
8141
+ });
8142
+
8143
+ // js/v8/open-layers/ol-geocoder.js
8144
+ /**
8145
+ * @namespace WPGMZA
8146
+ * @module OLGeocoder
8147
+ * @requires WPGMZA.Geocoder
8148
+ */
8149
+ jQuery(function($) {
8150
+
8151
+ /**
8152
+ * @class OLGeocoder
8153
+ * @extends Geocoder
8154
+ * @summary OpenLayers geocoder - uses Nominatim by default
8155
+ */
8156
+ WPGMZA.OLGeocoder = function()
8157
+ {
8158
 
 
 
8159
  }
8160
 
8161
+ WPGMZA.OLGeocoder.prototype = Object.create(WPGMZA.Geocoder.prototype);
8162
+ WPGMZA.OLGeocoder.prototype.constructor = WPGMZA.OLGeocoder;
8163
+
8164
  /**
8165
+ * @function getResponseFromCache
8166
+ * @access protected
8167
+ * @summary Tries to retrieve cached coordinates from server cache
8168
+ * @param {string} address The street address to geocode
8169
+ * @param {function} callback Where to send the results, as an array
8170
+ * @return {void}
8171
  */
8172
+ WPGMZA.OLGeocoder.prototype.getResponseFromCache = function(query, callback)
8173
  {
8174
+ WPGMZA.restAPI.call("/geocode-cache", {
8175
+ data: {
8176
+ query: JSON.stringify(query)
8177
+ },
8178
+ success: function(response, xhr, status) {
8179
+ // Legacy compatibility support
8180
+ response.lng = response.lon;
8181
+
8182
+ callback(response);
8183
+ },
8184
+ useCompressedPathVariable: true
8185
  });
8186
+
8187
+ /*$.ajax(WPGMZA.ajaxurl, {
8188
+ data: {
8189
+ action: "wpgmza_query_nominatim_cache",
8190
+ query: JSON.stringify(query)
8191
+ },
8192
+ success: function(response, xhr, status) {
8193
+ // Legacy compatibility support
8194
+ response.lng = response.lon;
8195
+
8196
+ callback(response);
8197
+ }
8198
+ });*/
8199
  }
8200
 
8201
  /**
8202
+ * @function getResponseFromNominatim
8203
+ * @access protected
8204
+ * @summary Queries Nominatim on the specified address
8205
+ * @param {object} options An object containing the options for geocoding, address is a mandatory field
8206
+ * @param {function} callback The function to send the results to, as an array
8207
  */
8208
+ WPGMZA.OLGeocoder.prototype.getResponseFromNominatim = function(options, callback)
8209
  {
8210
+ var data = {
8211
+ q: options.address,
8212
+ format: "json"
8213
+ };
 
 
 
 
 
 
 
 
 
 
 
 
8214
 
8215
+ if(options.componentRestrictions && options.componentRestrictions.country)
8216
+ data.countrycodes = options.componentRestrictions.country;
 
 
 
 
 
 
 
 
 
8217
 
8218
+ $.ajax("https://nominatim.openstreetmap.org/search/", {
8219
+ data: data,
8220
+ success: function(response, xhr, status) {
8221
+ callback(response);
8222
+ },
8223
+ error: function(response, xhr, status) {
8224
+ callback(null, WPGMZA.Geocoder.FAIL)
8225
+ }
8226
+ });
8227
  }
8228
 
8229
  /**
8230
+ * @function cacheResponse
8231
+ * @access protected
8232
+ * @summary Caches a response on the server, usually after it's been returned from Nominatim
8233
+ * @param {string} address The street address
8234
+ * @param {object|array} response The response to cache
8235
+ * @returns {void}
8236
  */
8237
+ WPGMZA.OLGeocoder.prototype.cacheResponse = function(query, response)
8238
  {
8239
+ $.ajax(WPGMZA.ajaxurl, {
8240
+ data: {
8241
+ action: "wpgmza_store_nominatim_cache",
8242
+ query: JSON.stringify(query),
8243
+ response: JSON.stringify(response)
8244
+ },
8245
+ method: "POST"
8246
+ });
8247
  }
8248
+
8249
  /**
8250
+ * @function clearCache
8251
+ * @access protected
8252
+ * @summary Clears the Nomanatim geocode cache
8253
+ * @returns {void}
8254
  */
8255
+ WPGMZA.OLGeocoder.prototype.clearCache = function(callback)
8256
  {
8257
+ $.ajax(WPGMZA.ajaxurl, {
8258
+ data: {
8259
+ action: "wpgmza_clear_nominatim_cache"
8260
+ },
8261
+ method: "POST",
8262
+ success: function(response){
8263
+ callback(response);
8264
+ }
8265
+ });
8266
  }
8267
 
8268
+ WPGMZA.OLGeocoder.prototype.getLatLngFromAddress = function(options, callback)
8269
  {
8270
+ return WPGMZA.OLGeocoder.prototype.geocode(options, callback);
8271
  }
8272
 
8273
+ WPGMZA.OLGeocoder.prototype.getAddressFromLatLng = function(options, callback)
8274
  {
8275
+ return WPGMZA.OLGeocoder.prototype.geocode(options, callback);
8276
  }
8277
 
8278
+ WPGMZA.OLGeocoder.prototype.geocode = function(options, callback)
8279
  {
8280
+ var self = this;
8281
+
8282
+ if(!options)
8283
+ throw new Error("Invalid options");
8284
+
8285
+ if(WPGMZA.LatLng.REGEXP.test(options.address))
8286
+ {
8287
+ var latLng = WPGMZA.LatLng.fromString(options.address);
8288
+
8289
+ callback([{
8290
+ geometry: {
8291
+ location: latLng
8292
+ },
8293
+ latLng: latLng,
8294
+ lat: latLng.lat,
8295
+ lng: latLng.lng
8296
+ }], WPGMZA.Geocoder.SUCCESS);
8297
+
8298
+ return;
8299
+ }
8300
+
8301
+ if(options.location)
8302
+ options.latLng = new WPGMZA.LatLng(options.location);
8303
+
8304
+ var finish, location;
8305
+
8306
+ if(options.address)
8307
+ {
8308
+ location = options.address;
8309
+
8310
+ finish = function(response, status)
8311
+ {
8312
+ for(var i = 0; i < response.length; i++)
8313
+ {
8314
+ response[i].geometry = {
8315
+ location: new WPGMZA.LatLng({
8316
+ lat: parseFloat(response[i].lat),
8317
+ lng: parseFloat(response[i].lon)
8318
+ })
8319
+ };
8320
+
8321
+ response[i].latLng = {
8322
+ lat: parseFloat(response[i].lat),
8323
+ lng: parseFloat(response[i].lon)
8324
+ };
8325
+
8326
+ response[i].bounds = new WPGMZA.LatLngBounds(
8327
+ new WPGMZA.LatLng({
8328
+ lat: response[i].boundingbox[1],
8329
+ lng: response[i].boundingbox[2]
8330
+ }),
8331
+ new WPGMZA.LatLng({
8332
+ lat: response[i].boundingbox[0],
8333
+ lng: response[i].boundingbox[3]
8334
+ })
8335
+ );
8336
+
8337
+ // Backward compatibility with old UGM
8338
+ response[i].lng = response[i].lon;
8339
+ }
8340
+
8341
+ callback(response, status);
8342
+ }
8343
+ }
8344
+ else if(options.latLng)
8345
+ {
8346
+ location = options.latLng.toString();
8347
+
8348
+ finish = function(response, status)
8349
+ {
8350
+ var address = response[0].display_name;
8351
+ callback([address], status);
8352
+ }
8353
+ }
8354
+ else
8355
+ throw new Error("You must supply either a latLng or address")
8356
+
8357
+ var query = {location: location, options: options};
8358
+ this.getResponseFromCache(query, function(response) {
8359
+ if(response.length)
8360
+ {
8361
+ finish(response, WPGMZA.Geocoder.SUCCESS);
8362
+ return;
8363
+ }
8364
+
8365
+ self.getResponseFromNominatim($.extend(options, {address: location}), function(response, status) {
8366
+ if(status == WPGMZA.Geocoder.FAIL)
8367
+ {
8368
+ callback(null, WPGMZA.Geocoder.FAIL);
8369
+ return;
8370
+ }
8371
+
8372
+ if(response.length == 0)
8373
+ {
8374
+ callback([], WPGMZA.Geocoder.ZERO_RESULTS);
8375
+ return;
8376
+ }
8377
+
8378
+ finish(response, WPGMZA.Geocoder.SUCCESS);
8379
+
8380
+ self.cacheResponse(query, response);
8381
+ });
8382
+ });
8383
  }
8384
 
8385
  });
8386
 
8387
+ // js/v8/open-layers/ol-info-window.js
8388
  /**
8389
  * @namespace WPGMZA
8390
+ * @module OLInfoWindow
8391
+ * @requires WPGMZA.InfoWindow
8392
+ * @pro-requires WPGMZA.ProInfoWindow
8393
  */
8394
  jQuery(function($) {
8395
 
8396
+ var Parent;
8397
+
8398
+ WPGMZA.OLInfoWindow = function(mapObject)
8399
  {
8400
  var self = this;
8401
 
8402
+ Parent.call(this, mapObject);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8403
 
8404
+ this.element = $("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0];
 
 
 
8405
 
8406
+ $(this.element).on("click", ".ol-info-window-close", function(event) {
8407
+ self.close();
8408
  });
8409
  }
8410
 
8411
+ if(WPGMZA.isProVersion())
8412
+ Parent = WPGMZA.ProInfoWindow;
8413
+ else
8414
+ Parent = WPGMZA.InfoWindow;
8415
 
8416
+ WPGMZA.OLInfoWindow.prototype = Object.create(Parent.prototype);
8417
+ WPGMZA.OLInfoWindow.prototype.constructor = WPGMZA.OLInfoWindow;
8418
+
8419
+ Object.defineProperty(WPGMZA.OLInfoWindow.prototype, "isPanIntoViewAllowed", {
8420
 
8421
+ "get": function()
8422
  {
8423
+ return true;
 
8424
  }
8425
 
8426
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8427
 
8428
+ /**
8429
+ * Opens the info window
8430
+ * TODO: This should take a mapObject, not an event
8431
+ * @return boolean FALSE if the info window should not & will not open, TRUE if it will
8432
+ */
8433
+ WPGMZA.OLInfoWindow.prototype.open = function(map, mapObject)
8434
  {
8435
+ var self = this;
8436
+ var latLng = mapObject.getPosition();
8437
 
8438
+ if(!Parent.prototype.open.call(this, map, mapObject))
8439
+ return false;
 
 
 
 
8440
 
8441
+ // Set parent for events to bubble up
8442
+ this.parent = map;
 
 
 
 
 
8443
 
8444
+ if(this.overlay)
8445
+ this.mapObject.map.olMap.removeOverlay(this.overlay);
8446
+
8447
+ this.overlay = new ol.Overlay({
8448
+ element: this.element,
8449
+ stopEvent: false
 
 
8450
  });
8451
 
8452
+ this.overlay.setPosition(ol.proj.fromLonLat([
8453
+ latLng.lng,
8454
+ latLng.lat
8455
+ ]));
8456
+ self.mapObject.map.olMap.addOverlay(this.overlay);
8457
 
8458
+ $(this.element).show();
 
8459
 
8460
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
8461
+ {
8462
+ WPGMZA.getImageDimensions(mapObject.getIcon(), function(size) {
8463
+
8464
+ $(self.element).css({left: Math.round(size.width / 2) + "px"});
8465
+
8466
+ });
8467
+ }
8468
 
8469
+ this.trigger("infowindowopen");
8470
+ this.trigger("domready");
 
 
 
 
 
 
 
8471
  }
8472
 
8473
+ WPGMZA.OLInfoWindow.prototype.close = function(event)
8474
  {
8475
+ // TODO: Why? This shouldn't have to be here. Removing the overlay should hide the element (it doesn't)
8476
+ $(this.element).hide();
8477
 
8478
+ if(!this.overlay)
8479
+ return;
8480
+
8481
+ WPGMZA.InfoWindow.prototype.close.call(this);
8482
+
8483
+ this.trigger("infowindowclose");
8484
+
8485
+ this.mapObject.map.olMap.removeOverlay(this.overlay);
8486
+ this.overlay = null;
 
 
8487
  }
8488
 
8489
+ WPGMZA.OLInfoWindow.prototype.setContent = function(html)
8490
  {
8491
+ $(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>" + html);
8492
  }
8493
 
8494
+ WPGMZA.OLInfoWindow.prototype.setOptions = function(options)
8495
  {
8496
+ if(options.maxWidth)
8497
+ {
8498
+ $(this.element).css({"max-width": options.maxWidth + "px"});
8499
+ }
8500
  }
8501
 
8502
+ WPGMZA.OLInfoWindow.prototype.onOpen = function()
8503
  {
8504
+ var self = this;
8505
+ var imgs = $(this.element).find("img");
8506
+ var numImages = imgs.length;
8507
+ var numImagesLoaded = 0;
8508
 
8509
+ WPGMZA.InfoWindow.prototype.onOpen.apply(this, arguments);
 
 
 
 
 
 
8510
 
8511
+ if(this.isPanIntoViewAllowed)
8512
+ {
8513
+ function inside(el, viewport)
8514
+ {
8515
+ var a = $(el)[0].getBoundingClientRect();
8516
+ var b = $(viewport)[0].getBoundingClientRect();
8517
+
8518
+ return a.left >= b.left && a.left <= b.right &&
8519
+ a.right <= b.right && a.right >= b.left &&
8520
+ a.top >= b.top && a.top <= b.bottom &&
8521
+ a.bottom <= b.bottom && a.bottom >= b.top;
8522
+ }
8523
+
8524
+ function panIntoView()
8525
+ {
8526
+ var height = $(self.element).height();
8527
+ var offset = -height * 0.45;
8528
+
8529
+ self.mapObject.map.animateNudge(0, offset, self.mapObject.getPosition());
8530
+ }
8531
+
8532
+ imgs.each(function(index, el) {
8533
+ el.onload = function() {
8534
+ if(++numImagesLoaded == numImages && !inside(self.element, self.mapObject.map.element))
8535
+ panIntoView();
8536
+ }
8537
+ });
8538
+
8539
+ if(numImages == 0 && !inside(self.element, self.mapObject.map.element))
8540
+ panIntoView();
8541
+ }
8542
  }
8543
 
8544
  });
8545
 
8546
+ // js/v8/open-layers/ol-map.js
8547
  /**
8548
  * @namespace WPGMZA
8549
+ * @module OLMap
8550
+ * @requires WPGMZA.Map
8551
+ * @pro-requires WPGMZA.ProMap
8552
  */
8553
  jQuery(function($) {
8554
 
8555
+ var Parent;
8556
+
8557
+ WPGMZA.OLMap = function(element, options)
8558
  {
8559
+ var self = this;
8560
 
8561
+ Parent.call(this, element);
8562
+
8563
+ this.setOptions(options);
8564
+
8565
+ var viewOptions = this.settings.toOLViewOptions();
8566
+
8567
+ $(this.element).html("");
8568
+
8569
+ this.olMap = new ol.Map({
8570
+ target: $(element)[0],
8571
+ layers: [
8572
+ this.getTileLayer()
8573
+ ],
8574
+ view: new ol.View(viewOptions)
8575
+ });
8576
+
8577
+ // TODO: Re-implement using correct setting names
8578
+ // Interactions
8579
+ this.olMap.getInteractions().forEach(function(interaction) {
8580
+
8581
+ // NB: The true and false values are flipped because these settings represent the "disabled" state when true
8582
+ if(interaction instanceof ol.interaction.DragPan)
8583
+ interaction.setActive( (self.settings.wpgmza_settings_map_draggable == "yes" ? false : true) );
8584
+ else if(interaction instanceof ol.interaction.DoubleClickZoom)
8585
+ interaction.setActive( (self.settings.wpgmza_settings_map_clickzoom ? false : true) );
8586
+ else if(interaction instanceof ol.interaction.MouseWheelZoom)
8587
+ interaction.setActive( (self.settings.wpgmza_settings_map_scroll == "yes" ? false : true) );
8588
+
8589
+ }, this);
8590
+
8591
+ // Cooperative gesture handling
8592
+ if(!(this.settings.wpgmza_force_greedy_gestures == "greedy" || this.settings.wpgmza_force_greedy_gestures == "yes"))
8593
+ {
8594
+ this.gestureOverlay = $("<div class='wpgmza-gesture-overlay'></div>")
8595
+ this.gestureOverlayTimeoutID = null;
8596
+
8597
+ if(WPGMZA.isTouchDevice())
8598
+ {
8599
+ // On touch devices, require two fingers to drag and pan
8600
+ // NB: Temporarily removed due to inconsistent behaviour
8601
+ /*this.olMap.getInteractions().forEach(function(interaction) {
8602
+
8603
+ if(interaction instanceof ol.interaction.DragPan)
8604
+ self.olMap.removeInteraction(interaction);
8605
+
8606
+ });
8607
+
8608
+ this.olMap.addInteraction(new ol.interaction.DragPan({
8609
+
8610
+ condition: function(olBrowserEvent) {
8611
+
8612
+ var allowed = olBrowserEvent.originalEvent.touches.length == 2;
8613
+
8614
+ if(!allowed)
8615
+ self.showGestureOverlay();
8616
+
8617
+ return allowed;
8618
+ }
8619
+
8620
+ }));
8621
+
8622
+ this.gestureOverlay.text(WPGMZA.localized_strings.use_two_fingers);*/
8623
+ }
8624
+ else
8625
+ {
8626
+ // On desktops, require Ctrl + zoom to zoom, show an overlay if that condition is not met
8627
+ this.olMap.on("wheel", function(event) {
8628
+
8629
+ if(!ol.events.condition.platformModifierKeyOnly(event))
8630
+ {
8631
+ self.showGestureOverlay();
8632
+ event.originalEvent.preventDefault();
8633
+ return false;
8634
+ }
8635
+
8636
+ });
8637
+
8638
+ this.gestureOverlay.text(WPGMZA.localized_strings.use_ctrl_scroll_to_zoom);
8639
+ }
8640
+ }
8641
 
8642
+ // Controls
8643
+ this.olMap.getControls().forEach(function(control) {
8644
+
8645
+ // NB: The true and false values are flipped because these settings represent the "disabled" state when true
8646
+ if(control instanceof ol.control.Zoom && WPGMZA.settings.wpgmza_settings_map_zoom == "yes")
8647
+ self.olMap.removeControl(control);
8648
+
8649
+ }, this);
8650
 
8651
+ if(WPGMZA.settings.wpgmza_settings_map_full_screen_control != "yes")
8652
+ this.olMap.addControl(new ol.control.FullScreen());
8653
 
8654
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
8655
  {
8656
+ // Marker layer
8657
+ this.markerLayer = new ol.layer.Vector({
8658
+ source: new ol.source.Vector({
8659
+ features: []
8660
+ })
8661
+ });
8662
+ this.olMap.addLayer(this.markerLayer);
8663
 
8664
+ this.olMap.on("click", function(event) {
8665
+ var features = self.olMap.getFeaturesAtPixel(event.pixel);
8666
+
8667
+ if(!features || !features.length)
8668
+ return;
8669
+
8670
+ var marker = features[0].wpgmzaMarker;
8671
+
8672
+ if(!marker)
8673
+ return;
8674
+
8675
+ marker.trigger("click");
8676
+ marker.trigger("select");
8677
+ });
8678
  }
8679
 
8680
+ // Listen for drag start
8681
+ this.olMap.on("movestart", function(event) {
8682
+ self.isBeingDragged = true;
8683
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8684
 
8685
+ // Listen for end of pan so we can wrap longitude if needs be
8686
+ this.olMap.on("moveend", function(event) {
8687
+ self.wrapLongitude();
8688
+
8689
+ self.isBeingDragged = false;
8690
+ self.dispatchEvent("dragend");
8691
+ self.onIdle();
8692
+ });
8693
 
8694
+ // Listen for zoom
8695
+ this.olMap.getView().on("change:resolution", function(event) {
8696
+ self.dispatchEvent("zoom_changed");
8697
+ self.dispatchEvent("zoomchanged");
8698
+ setTimeout(function() {
8699
+ self.onIdle();
8700
+ }, 10);
8701
+ });
8702
+
8703
+ // Listen for bounds changing
8704
+ this.olMap.getView().on("change", function() {
8705
+ // Wrap longitude
8706
+ self.onBoundsChanged();
8707
+ });
8708
+ self.onBoundsChanged();
8709
+
8710
+ // Store locator center
8711
+ var marker;
8712
+ if(this.storeLocator && (marker = this.storeLocator.centerPointMarker))
8713
  {
8714
+ this.olMap.addOverlay(marker.overlay);
8715
+ marker.setVisible(false);
8716
  }
8717
+
8718
+ // Right click listener
8719
+ $(this.element).on("click contextmenu", function(event) {
8720
 
8721
+ var isRight;
8722
+ event = event || window.event;
8723
+
8724
+ var latLng = self.pixelsToLatLng(event.offsetX, event.offsetY);
8725
+
8726
+ if("which" in event)
8727
+ isRight = event.which == 3;
8728
+ else if("button" in event)
8729
+ isRight = event.button == 2;
8730
+
8731
+ if(event.which == 1 || event.button == 1)
8732
  {
8733
+ if(self.isBeingDragged)
8734
+ return;
 
 
 
 
 
 
 
 
8735
 
8736
+ // Left click
8737
+ if($(event.target).closest(".ol-marker").length)
8738
+ return; // A marker was clicked, not the map. Do nothing
8739
 
8740
+ self.trigger({
8741
+ type: "click",
8742
+ latLng: latLng
8743
+ });
8744
 
8745
+ return;
8746
  }
 
 
 
8747
 
8748
+ if(!isRight)
8749
+ return;
8750
+
8751
+ return self.onRightClick(event);
8752
  });
8753
+
8754
+ // Dispatch event
8755
+ if(!WPGMZA.isProVersion())
8756
+ {
8757
+ this.trigger("init");
8758
+
8759
+ this.dispatchEvent("created");
8760
+ WPGMZA.events.dispatchEvent({type: "mapcreated", map: this});
8761
+
8762
+ // Legacy event
8763
+ $(this.element).trigger("wpgooglemaps_loaded");
8764
+ }
8765
  }
8766
+
8767
  if(WPGMZA.isProVersion())
8768
+ Parent = WPGMZA.ProMap;
8769
  else
8770
+ Parent = WPGMZA.Map;
8771
+
8772
+ WPGMZA.OLMap.prototype = Object.create(Parent.prototype);
8773
+ WPGMZA.OLMap.prototype.constructor = WPGMZA.OLMap;
8774
+
8775
+ WPGMZA.OLMap.prototype.getTileLayer = function()
8776
+ {
8777
+ var options = {};
8778
 
8779
+ if(WPGMZA.settings.tile_server_url)
8780
+ options.url = WPGMZA.settings.tile_server_url;
8781
+
8782
+ return new ol.layer.Tile({
8783
+ source: new ol.source.OSM(options)
8784
+ });
8785
+ }
8786
 
8787
+ WPGMZA.OLMap.prototype.wrapLongitude = function()
 
 
 
 
8788
  {
8789
+ var transformed = ol.proj.transform(this.olMap.getView().getCenter(), "EPSG:3857", "EPSG:4326");
8790
+ var center = {
8791
+ lat: transformed[1],
8792
+ lng: transformed[0]
8793
+ };
8794
+
8795
+ if(center.lng >= -180 && center.lng <= 180)
8796
+ return;
8797
+
8798
+ center.lng = center.lng - 360 * Math.floor(center.lng / 360);
8799
+
8800
+ if(center.lng > 180)
8801
+ center.lng -= 360;
8802
+
8803
+ this.setCenter(center);
8804
  }
8805
 
8806
+ WPGMZA.OLMap.prototype.getCenter = function()
 
 
 
 
8807
  {
8808
+ var lonLat = ol.proj.toLonLat(
8809
+ this.olMap.getView().getCenter()
8810
+ );
8811
+ return {
8812
+ lat: lonLat[1],
8813
+ lng: lonLat[0]
8814
+ };
8815
  }
8816
 
8817
+ WPGMZA.OLMap.prototype.setCenter = function(latLng)
 
 
 
 
8818
  {
8819
+ var view = this.olMap.getView();
8820
 
8821
+ WPGMZA.Map.prototype.setCenter.call(this, latLng);
8822
 
8823
+ view.setCenter(ol.proj.fromLonLat([
8824
+ latLng.lng,
8825
+ latLng.lat
8826
+ ]));
 
 
 
 
 
 
8827
 
8828
+ this.wrapLongitude();
 
 
 
8829
 
8830
+ this.onBoundsChanged();
8831
+ }
 
 
 
 
 
8832
 
8833
+ WPGMZA.OLMap.prototype.getBounds = function()
8834
  {
8835
+ var bounds = this.olMap.getView().calculateExtent(this.olMap.getSize());
8836
+ var nativeBounds = new WPGMZA.LatLngBounds();
8837
 
8838
+ var topLeft = ol.proj.toLonLat([bounds[0], bounds[1]]);
8839
+ var bottomRight = ol.proj.toLonLat([bounds[2], bounds[3]]);
8840
 
8841
+ nativeBounds.north = topLeft[1];
8842
+ nativeBounds.south = bottomRight[1];
8843
+
8844
+ nativeBounds.west = topLeft[0];
8845
+ nativeBounds.east = bottomRight[0];
8846
+
8847
+ return nativeBounds;
8848
+ }
8849
+
8850
+ /**
8851
+ * Fit to given boundaries
8852
+ * @return void
8853
+ */
8854
+ WPGMZA.OLMap.prototype.fitBounds = function(southWest, northEast)
8855
+ {
8856
+ if(southWest instanceof WPGMZA.LatLng)
8857
+ southWest = {lat: southWest.lat, lng: southWest.lng};
8858
+ if(northEast instanceof WPGMZA.LatLng)
8859
+ northEast = {lat: northEast.lat, lng: northEast.lng};
8860
+ else if(southWest instanceof WPGMZA.LatLngBounds)
8861
  {
8862
+ var bounds = southWest;
8863
 
8864
+ southWest = {
8865
+ lat: bounds.south,
8866
+ lng: bounds.west
8867
+ };
 
 
 
 
 
 
 
 
 
 
 
 
8868
 
8869
+ northEast = {
8870
+ lat: bounds.north,
8871
+ lng: bounds.east
8872
+ };
 
8873
  }
8874
 
8875
+ var view = this.olMap.getView();
8876
 
8877
+ var extent = ol.extent.boundingExtent([
8878
+ ol.proj.fromLonLat([
8879
+ parseFloat(southWest.lng),
8880
+ parseFloat(southWest.lat)
8881
+ ]),
8882
+ ol.proj.fromLonLat([
8883
+ parseFloat(northEast.lng),
8884
+ parseFloat(northEast.lat)
8885
+ ])
8886
+ ]);
8887
+ view.fit(extent, this.olMap.getSize());
8888
  }
8889
 
8890
+ WPGMZA.OLMap.prototype.panTo = function(latLng, zoom)
8891
+ {
8892
+ var view = this.olMap.getView();
8893
+ var options = {
8894
+ center: ol.proj.fromLonLat([
8895
+ parseFloat(latLng.lng),
8896
+ parseFloat(latLng.lat),
8897
+ ]),
8898
+ duration: 500
8899
+ };
8900
+
8901
+ if(arguments.length > 1)
8902
+ options.zoom = parseInt(zoom);
8903
+
8904
+ view.animate(options);
8905
+ }
8906
 
8907
+ WPGMZA.OLMap.prototype.getZoom = function()
8908
  {
8909
+ return Math.round( this.olMap.getView().getZoom() );
8910
  }
8911
 
8912
+ WPGMZA.OLMap.prototype.setZoom = function(value)
8913
  {
8914
+ this.olMap.getView().setZoom(value);
8915
  }
8916
 
8917
+ WPGMZA.OLMap.prototype.getMinZoom = function()
8918
  {
8919
+ return this.olMap.getView().getMinZoom();
8920
+ }
8921
+
8922
+ WPGMZA.OLMap.prototype.setMinZoom = function(value)
8923
+ {
8924
+ this.olMap.getView().setMinZoom(value);
8925
+ }
8926
+
8927
+ WPGMZA.OLMap.prototype.getMaxZoom = function()
8928
+ {
8929
+ return this.olMap.getView().getMaxZoom();
8930
+ }
8931
+
8932
+ WPGMZA.OLMap.prototype.setMaxZoom = function(value)
8933
+ {
8934
+ this.olMap.getView().setMaxZoom(value);
8935
+ }
8936
+
8937
+ WPGMZA.OLMap.prototype.setOptions = function(options)
8938
+ {
8939
+ Parent.prototype.setOptions.call(this, options);
8940
 
8941
+ if(!this.olMap)
8942
+ return;
8943
 
8944
+ this.olMap.getView().setProperties( this.settings.toOLViewOptions() );
8945
+ }
8946
+
8947
+ /**
8948
+ * TODO: Consider moving all these functions to their respective classes, same on google map (DO IT!!! It's very misleading having them here)
8949
+ */
8950
+ WPGMZA.OLMap.prototype.addMarker = function(marker)
8951
+ {
8952
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT)
8953
+ this.olMap.addOverlay(marker.overlay);
8954
+ else
8955
  {
8956
+ this.markerLayer.getSource().addFeature(marker.feature);
8957
+ marker.featureInSource = true;
 
 
 
8958
  }
8959
 
8960
+ Parent.prototype.addMarker.call(this, marker);
8961
  }
8962
 
8963
+ WPGMZA.OLMap.prototype.removeMarker = function(marker)
8964
+ {
8965
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT)
8966
+ this.olMap.removeOverlay(marker.overlay);
8967
+ else
8968
+ {
8969
+ this.markerLayer.getSource().removeFeature(marker.feature);
8970
+ marker.featureInSource = false;
8971
+ }
8972
+
8973
+ Parent.prototype.removeMarker.call(this, marker);
8974
+ }
8975
 
8976
+ WPGMZA.OLMap.prototype.addPolygon = function(polygon)
8977
  {
8978
+ this.olMap.addLayer(polygon.layer);
8979
 
8980
+ Parent.prototype.addPolygon.call(this, polygon);
8981
  }
8982
 
8983
+ WPGMZA.OLMap.prototype.removePolygon = function(polygon)
8984
+ {
8985
+ this.olMap.removeLayer(polygon.layer);
8986
+
8987
+ Parent.prototype.removePolygon.call(this, polygon);
8988
+ }
8989
 
8990
+ WPGMZA.OLMap.prototype.addPolyline = function(polyline)
8991
+ {
8992
+ this.olMap.addLayer(polyline.layer);
8993
+
8994
+ Parent.prototype.addPolyline.call(this, polyline);
8995
+ }
 
 
 
8996
 
8997
+ WPGMZA.OLMap.prototype.removePolyline = function(polyline)
8998
  {
8999
+ this.olMap.removeLayer(polyline.layer);
9000
 
9001
+ Parent.prototype.removePolyline.call(this, polyline);
9002
+ }
9003
+
9004
+ WPGMZA.OLMap.prototype.addCircle = function(circle)
9005
+ {
9006
+ this.olMap.addLayer(circle.layer);
9007
 
9008
+ Parent.prototype.addCircle.call(this, circle);
9009
+ }
9010
+
9011
+ WPGMZA.OLMap.prototype.removeCircle = function(circle)
9012
+ {
9013
+ this.olMap.removeLayer(circle.layer);
9014
 
9015
+ Parent.prototype.removeCircle.call(this, circle);
9016
+ }
9017
+
9018
+ WPGMZA.OLMap.prototype.addRectangle = function(rectangle)
9019
+ {
9020
+ this.olMap.addLayer(rectangle.layer);
9021
 
9022
+ Parent.prototype.addRectangle.call(this, rectangle);
 
9023
  }
9024
 
9025
+ WPGMZA.OLMap.prototype.removeRectangle = function(rectangle)
9026
+ {
9027
+ this.olMap.removeLayer(rectangle.layer);
9028
+
9029
+ Parent.prototype.removeRectangle.call(this, rectangle);
9030
+ }
9031
 
9032
+ WPGMZA.OLMap.prototype.pixelsToLatLng = function(x, y)
9033
  {
9034
+ if(y == undefined)
9035
+ {
9036
+ if("x" in x && "y" in x)
9037
+ {
9038
+ y = x.y;
9039
+ x = x.x;
9040
+ }
9041
+ else
9042
+ console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)");
9043
+ }
9044
 
9045
+ var coord = this.olMap.getCoordinateFromPixel([x, y]);
9046
+
9047
+ if(!coord)
9048
+ return {
9049
+ x: null,
9050
+ y: null
9051
+ };
9052
+
9053
+ var lonLat = ol.proj.toLonLat(coord);
9054
+ return {
9055
+ lat: lonLat[1],
9056
+ lng: lonLat[0]
9057
+ };
9058
  }
9059
 
9060
+ WPGMZA.OLMap.prototype.latLngToPixels = function(latLng)
9061
  {
9062
+ var coord = ol.proj.fromLonLat([latLng.lng, latLng.lat]);
9063
+ var pixel = this.olMap.getPixelFromCoordinate(coord);
9064
 
9065
+ if(!pixel)
9066
+ return {
9067
+ x: null,
9068
+ y: null
9069
+ };
9070
+
9071
+ return {
9072
+ x: pixel[0],
9073
+ y: pixel[1]
9074
+ };
9075
  }
9076
 
9077
+ WPGMZA.OLMap.prototype.enableBicycleLayer = function(value)
9078
  {
9079
+ if(value)
9080
+ {
9081
+ if(!this.bicycleLayer)
9082
+ this.bicycleLayer = new ol.layer.Tile({
9083
+ source: new ol.source.OSM({
9084
+ url: "http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"
9085
+ })
9086
+ });
9087
+
9088
+ this.olMap.addLayer(this.bicycleLayer);
9089
+ }
9090
+ else
9091
+ {
9092
+ if(!this.bicycleLayer)
9093
+ return;
9094
+
9095
+ this.olMap.removeLayer(this.bicycleLayer);
9096
+ }
9097
  }
9098
 
9099
+ WPGMZA.OLMap.prototype.showGestureOverlay = function()
9100
  {
9101
+ var self = this;
9102
+
9103
+ clearTimeout(this.gestureOverlayTimeoutID);
9104
+
9105
+ $(this.gestureOverlay).stop().animate({opacity: "100"});
9106
+ $(this.element).append(this.gestureOverlay);
9107
+
9108
+ $(this.gestureOverlay).css({
9109
+ "line-height": $(this.element).height() + "px",
9110
+ "opacity": "1.0"
9111
+ });
9112
+ $(this.gestureOverlay).show();
9113
+
9114
+ this.gestureOverlayTimeoutID = setTimeout(function() {
9115
+ self.gestureOverlay.fadeOut(2000);
9116
+ }, 2000);
9117
  }
9118
 
9119
+ WPGMZA.OLMap.prototype.onElementResized = function(event)
9120
  {
9121
+ this.olMap.updateSize();
9122
  }
9123
 
9124
+ WPGMZA.OLMap.prototype.onRightClick = function(event)
9125
  {
9126
+ if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)
9127
+ return true;
9128
+
9129
+ var parentOffset = $(this.element).offset();
9130
+ var relX = event.pageX - parentOffset.left;
9131
+ var relY = event.pageY - parentOffset.top;
9132
+ var latLng = this.pixelsToLatLng(relX, relY);
9133
+
9134
+ this.trigger({type: "rightclick", latLng: latLng});
9135
+
9136
+ // Legacy event compatibility
9137
+ $(this.element).trigger({type: "rightclick", latLng: latLng});
9138
+
9139
+ // Prevent menu
9140
+ event.preventDefault();
9141
+ return false;
9142
+ }
9143
+
9144
+ WPGMZA.OLMap.prototype.enableAllInteractions = function()
9145
+ {
9146
+
9147
+ this.olMap.getInteractions().forEach(function(interaction) {
9148
+
9149
+ if(interaction instanceof ol.interaction.DragPan || interaction instanceof ol.interaction.DoubleClickZoom || interaction instanceof ol.interaction.MouseWheelZoom)
9150
+ {
9151
+ interaction.setActive(true);
9152
+ }
9153
+
9154
+ }, this);
9155
+
9156
  }
9157
 
9158
  });
9159
 
9160
+ // js/v8/open-layers/ol-marker.js
9161
  /**
9162
  * @namespace WPGMZA
9163
+ * @module OLMarker
9164
+ * @requires WPGMZA.Marker
9165
+ * @pro-requires WPGMZA.ProMarker
9166
  */
9167
  jQuery(function($) {
9168
 
9169
+ var Parent;
9170
+
9171
+ WPGMZA.OLMarker = function(row)
9172
+ {
9173
+ var self = this;
9174
+
9175
+ Parent.call(this, row);
9176
+
9177
+ var origin = ol.proj.fromLonLat([
9178
+ parseFloat(this.lng),
9179
+ parseFloat(this.lat)
9180
+ ]);
9181
+
9182
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT)
9183
+ {
9184
+ var img = $("<img alt=''/>")[0];
9185
+ img.onload = function(event) {
9186
+ self.updateElementHeight();
9187
+ if(self.map)
9188
+ self.map.olMap.updateSize();
9189
+ }
9190
+ img.src = WPGMZA.defaultMarkerIcon;
9191
+
9192
+ this.element = $("<div class='ol-marker'></div>")[0];
9193
+ $(this.element).attr('title', this.title);
9194
+ this.element.appendChild(img);
9195
+
9196
+ this.element.wpgmzaMarker = this;
9197
+
9198
+ $(this.element).on("mouseover", function(event) {
9199
+ self.dispatchEvent("mouseover");
9200
+ });
9201
+
9202
+ this.overlay = new ol.Overlay({
9203
+ element: this.element,
9204
+ position: origin,
9205
+ positioning: "bottom-center",
9206
+ stopEvent: false
9207
+ });
9208
+ this.overlay.setPosition(origin);
9209
+
9210
+ if(this.animation)
9211
+ this.setAnimation(this.animation);
9212
+
9213
+ this.setLabel(this.settings.label);
9214
+
9215
+ if(row)
9216
+ {
9217
+ if(row.draggable)
9218
+ this.setDraggable(true);
9219
+ }
9220
+
9221
+ this.rebindClickListener();
9222
+ }
9223
+ else if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9224
+ {
9225
+ this.feature = new ol.Feature({
9226
+ geometry: new ol.geom.Point(origin)
9227
+ });
9228
+
9229
+ this.feature.setStyle(this.getVectorLayerStyle());
9230
+ this.feature.wpgmzaMarker = this;
9231
+ }
9232
+ else
9233
+ throw new Error("Invalid marker render mode");
9234
+
9235
+ this.trigger("init");
9236
+ }
9237
+
9238
+ if(WPGMZA.isProVersion())
9239
+ Parent = WPGMZA.ProMarker;
9240
+ else
9241
+ Parent = WPGMZA.Marker;
9242
+
9243
+ WPGMZA.OLMarker.prototype = Object.create(Parent.prototype);
9244
+ WPGMZA.OLMarker.prototype.constructor = WPGMZA.OLMarker;
9245
 
9246
+ WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT = "element";
9247
+ WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER = "vector"; // NB: This feature is experimental
9248
 
9249
+ WPGMZA.OLMarker.renderMode = WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT;
9250
+
9251
+ if(WPGMZA.settings.engine == "open-layers" && WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9252
  {
9253
+ WPGMZA.OLMarker.defaultVectorLayerStyle = new ol.style.Style({
9254
+ image: new ol.style.Icon({
9255
+ anchor: [0.5, 1],
9256
+ src: WPGMZA.defaultMarkerIcon
9257
+ })
 
 
 
 
 
 
 
 
9258
  });
9259
+
9260
+ WPGMZA.OLMarker.hiddenVectorLayerStyle = new ol.style.Style({});
9261
  }
9262
 
9263
+ WPGMZA.OLMarker.prototype.getVectorLayerStyle = function()
 
 
9264
  {
9265
+ if(this.vectorLayerStyle)
9266
+ return this.vectorLayerStyle;
9267
 
9268
+ return WPGMZA.OLMarker.defaultVectorLayerStyle;
 
 
 
 
9269
  }
9270
 
9271
+ WPGMZA.OLMarker.prototype.updateElementHeight = function(height, calledOnFocus)
9272
  {
9273
+ var self = this;
 
9274
 
9275
+ if(!height)
9276
+ height = $(this.element).find("img").height();
9277
+
9278
+ if(height == 0 && !calledOnFocus)
9279
+ {
9280
+ $(window).one("focus", function(event) {
9281
+ self.updateElementHeight(false, true);
9282
+ });
9283
+ }
9284
+
9285
+ $(this.element).css({height: height + "px"});
9286
  }
9287
 
9288
+ WPGMZA.OLMarker.prototype.addLabel = function()
9289
  {
9290
+ this.setLabel(this.getLabelText());
 
 
 
 
9291
  }
9292
 
9293
+ WPGMZA.OLMarker.prototype.setLabel = function(label)
9294
  {
9295
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9296
+ {
9297
+ console.warn("Marker labels are not currently supported in Vector Layer rendering mode");
9298
+ return;
9299
+ }
9300
+
9301
+ if(!label)
9302
+ {
9303
+ if(this.label)
9304
+ $(this.element).find(".ol-marker-label").remove();
9305
+
9306
+ return;
9307
+ }
9308
+
9309
+ if(!this.label)
9310
+ {
9311
+ this.label = $("<div class='ol-marker-label'/>");
9312
+ $(this.element).append(this.label);
9313
+ }
9314
+
9315
+ this.label.html(label);
9316
  }
9317
 
9318
+ WPGMZA.OLMarker.prototype.getVisible = function(visible)
9319
  {
9320
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9321
+ {
9322
+
9323
+ }
9324
+ else
9325
+ return this.overlay.getElement().style.display != "none";
 
 
 
9326
  }
9327
 
9328
+ WPGMZA.OLMarker.prototype.setVisible = function(visible)
9329
  {
9330
+ Parent.prototype.setVisible.call(this, visible);
9331
+
9332
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9333
+ {
9334
+ if(visible)
9335
+ {
9336
+ var style = this.getVectorLayerStyle();
9337
+ this.feature.setStyle(style);
9338
+ }
9339
+ else
9340
+ this.feature.setStyle(null);
9341
+
9342
+ /*var source = this.map.markerLayer.getSource();
9343
+
9344
+ /*if(this.featureInSource == visible)
9345
+ return;
9346
+
9347
+ if(visible)
9348
+ source.addFeature(this.feature);
9349
+ else
9350
+ source.removeFeature(this.feature);
9351
+
9352
+ this.featureInSource = visible;*/
9353
  }
9354
+ else
9355
+ this.overlay.getElement().style.display = (visible ? "block" : "none");
 
9356
  }
9357
 
9358
+ WPGMZA.OLMarker.prototype.setPosition = function(latLng)
9359
+ {
9360
+ Parent.prototype.setPosition.call(this, latLng);
9361
+
9362
+ var origin = ol.proj.fromLonLat([
9363
+ parseFloat(this.lng),
9364
+ parseFloat(this.lat)
9365
+ ]);
 
9366
 
9367
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9368
+ this.feature.setGeometry(new ol.geom.Point(origin));
9369
+ else
9370
+ this.overlay.setPosition(origin);
9371
+ }
9372
 
9373
+ WPGMZA.OLMarker.prototype.updateOffset = function(x, y)
9374
  {
9375
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9376
+ {
9377
+ console.warn("Marker offset is not currently supported in Vector Layer rendering mode");
9378
+ return;
9379
+ }
9380
 
9381
+ var x = this._offset.x;
9382
+ var y = this._offset.y;
9383
 
9384
+ this.element.style.position = "relative";
9385
+ this.element.style.left = x + "px";
9386
+ this.element.style.top = y + "px";
9387
+ }
9388
+
9389
+ WPGMZA.OLMarker.prototype.setAnimation = function(anim)
9390
+ {
9391
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9392
+ {
9393
+ console.warn("Marker animation is not currently supported in Vector Layer rendering mode");
9394
+ return;
9395
+ }
9396
 
9397
+ Parent.prototype.setAnimation.call(this, anim);
9398
 
9399
+ switch(anim)
9400
+ {
9401
+ case WPGMZA.Marker.ANIMATION_NONE:
9402
+ $(this.element).removeAttr("data-anim");
9403
+ break;
9404
+
9405
+ case WPGMZA.Marker.ANIMATION_BOUNCE:
9406
+ $(this.element).attr("data-anim", "bounce");
9407
+ break;
9408
+
9409
+ case WPGMZA.Marker.ANIMATION_DROP:
9410
+ $(this.element).attr("data-anim", "drop");
9411
+ break;
9412
+ }
9413
+ }
9414
+
9415
+ WPGMZA.OLMarker.prototype.setDraggable = function(draggable)
9416
+ {
9417
+ var self = this;
9418
 
9419
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9420
+ {
9421
+ console.warn("Marker dragging is not currently supported in Vector Layer rendering mode");
9422
+ return;
9423
+ }
9424
 
9425
+ if(draggable)
9426
+ {
9427
+ var options = {
9428
+ disabled: false
9429
+ };
9430
+
9431
+ if(!this.jQueryDraggableInitialized)
9432
+ {
9433
+ options.start = function(event) {
9434
+ self.onDragStart(event);
9435
+ }
9436
+
9437
+ options.stop = function(event) {
9438
+ self.onDragEnd(event);
9439
+ };
9440
+ }
9441
+
9442
+ $(this.element).draggable(options);
9443
+ this.jQueryDraggableInitialized = true;
9444
+
9445
+ this.rebindClickListener();
9446
+ }
9447
  else
9448
+ $(this.element).draggable({disabled: true});
9449
  }
9450
 
9451
+ WPGMZA.OLMarker.prototype.setOpacity = function(opacity)
 
 
 
9452
  {
9453
+ if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
9454
  {
9455
+ console.warn("Marker opacity is not currently supported in Vector Layer rendering mode");
 
 
 
 
9456
  return;
9457
+ }
9458
 
9459
+ $(this.element).css({opacity: opacity});
 
 
 
 
 
 
 
 
 
 
 
 
9460
  }
9461
 
9462
+ WPGMZA.OLMarker.prototype.onDragStart = function(event)
9463
  {
9464
+ this.isBeingDragged = true;
 
 
 
 
 
9465
 
9466
+ this.map.olMap.getInteractions().forEach(function(interaction) {
 
 
 
9467
 
9468
+ if(interaction instanceof ol.interaction.DragPan)
9469
+ interaction.setActive(false);
9470
+
9471
+ });
 
 
 
 
 
9472
  }
9473
 
9474
+ WPGMZA.OLMarker.prototype.onDragEnd = function(event)
9475
  {
9476
+ var self = this;
9477
+ var offset = {
9478
+ top: parseFloat( $(this.element).css("top").match(/-?\d+/)[0] ),
9479
+ left: parseFloat( $(this.element).css("left").match(/-?\d+/)[0] )
9480
+ };
9481
+
9482
+ $(this.element).css({
9483
+ top: "0px",
9484
+ left: "0px"
9485
+ });
9486
+
9487
+ var currentLatLng = this.getPosition();
9488
+ var pixelsBeforeDrag = this.map.latLngToPixels(currentLatLng);
9489
+ var pixelsAfterDrag = {
9490
+ x: pixelsBeforeDrag.x + offset.left,
9491
+ y: pixelsBeforeDrag.y + offset.top
9492
+ };
9493
+ var latLngAfterDrag = this.map.pixelsToLatLng(pixelsAfterDrag);
9494
+
9495
+ this.setPosition(latLngAfterDrag);
9496
+
9497
+ this.isBeingDragged = false;
9498
+ this.trigger({type: "dragend", latLng: latLngAfterDrag});
9499
+
9500
+ // NB: "yes" represents disabled
9501
+ if(this.map.settings.wpgmza_settings_map_draggable != "yes")
9502
+ this.map.olMap.getInteractions().forEach(function(interaction) {
9503
+
9504
+ if(interaction instanceof ol.interaction.DragPan)
9505
+ interaction.setActive(true);
9506
+
9507
+ });
9508
  }
9509
 
9510
+ WPGMZA.OLMarker.prototype.onElementClick = function(event)
9511
  {
9512
+ var self = event.currentTarget.wpgmzaMarker;
9513
 
9514
+ if(self.isBeingDragged)
9515
+ return; // Don't dispatch click event after a drag
9516
+
9517
+ self.dispatchEvent("click");
9518
+ self.dispatchEvent("select");
9519
  }
9520
 
9521
+ /**
9522
+ * Binds / rebinds the click listener. This must be bound after draggable is initialized,
9523
+ * this solves the click listener firing before dragend
9524
+ */
9525
+ WPGMZA.OLMarker.prototype.rebindClickListener = function()
9526
  {
9527
+ $(this.element).off("click", this.onElementClick);
9528
+ $(this.element).on("click", this.onElementClick);
 
9529
  }
9530
 
9531
  });
9532
 
9533
+ // js/v8/open-layers/ol-modern-store-locator-circle.js
9534
  /**
9535
  * @namespace WPGMZA
9536
+ * @module OLModernStoreLocatorCircle
9537
+ * @requires WPGMZA.ModernStoreLocatorCircle
9538
  */
9539
  jQuery(function($) {
9540
 
9541
+ WPGMZA.OLModernStoreLocatorCircle = function(map, settings)
 
 
 
 
 
9542
  {
9543
+ WPGMZA.ModernStoreLocatorCircle.call(this, map, settings);
9544
  }
9545
 
9546
+ WPGMZA.OLModernStoreLocatorCircle.prototype = Object.create(WPGMZA.ModernStoreLocatorCircle.prototype);
9547
+ WPGMZA.OLModernStoreLocatorCircle.prototype.constructor = WPGMZA.OLModernStoreLocatorCircle;
9548
 
9549
+ WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer = function()
 
 
 
 
 
 
 
 
9550
  {
9551
+ var self = this;
9552
+ var mapElement = $(this.map.element);
9553
+ var olViewportElement = mapElement.children(".ol-viewport");
 
 
 
 
 
 
 
 
 
9554
 
9555
+ this.canvas = document.createElement("canvas");
9556
+ this.canvas.className = "wpgmza-ol-canvas-overlay";
9557
+ mapElement.append(this.canvas);
9558
+
9559
+ this.renderFunction = function(event) {
9560
+
9561
+ if(self.canvas.width != olViewportElement.width() || self.canvas.height != olViewportElement.height())
9562
+ {
9563
+ self.canvas.width = olViewportElement.width();
9564
+ self.canvas.height = olViewportElement.height();
9565
 
9566
+ $(this.canvas).css({
9567
+ width: olViewportElement.width() + "px",
9568
+ height: olViewportElement.height() + "px"
9569
+ });
9570
  }
9571
+
9572
+ self.draw();
9573
+ };
9574
+
9575
+ this.map.olMap.on("postrender", this.renderFunction);
9576
+ }
9577
+
9578
+ WPGMZA.OLModernStoreLocatorCircle.prototype.getContext = function(type)
9579
+ {
9580
+ return this.canvas.getContext(type);
9581
  }
9582
 
9583
+ WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions = function()
 
 
 
 
 
 
 
9584
  {
9585
+ return {
9586
+ width: this.canvas.width,
9587
+ height: this.canvas.height
9588
  };
9589
+ }
9590
+
9591
+ WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels = function()
9592
+ {
9593
+ var center = this.map.latLngToPixels(this.settings.center);
9594
 
9595
+ return center;
9596
+ }
9597
 
9598
+ WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset = function()
9599
+ {
9600
+ return {
9601
+ x: 0,
9602
+ y: 0
9603
+ };
 
 
 
9604
  }
9605
 
9606
+ WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius = function(km)
 
 
 
 
 
 
 
 
9607
  {
9608
+ var center = new WPGMZA.LatLng(this.settings.center);
9609
+ var outer = new WPGMZA.LatLng(center);
9610
+
9611
+ outer.moveByDistance(km, 90);
9612
+
9613
+ var centerPixels = this.map.latLngToPixels(center);
9614
+ var outerPixels = this.map.latLngToPixels(outer);
9615
+
9616
+ return Math.abs(outerPixels.x - centerPixels.x);
9617
 
9618
+ /*if(!window.testMarker){
9619
+ window.testMarker = WPGMZA.Marker.createInstance({
9620
+ position: outer
9621
+ });
9622
+ WPGMZA.maps[0].addMarker(window.testMarker);
9623
+ }
9624
+
9625
+ return 100;*/
9626
+ }
9627
+
9628
+ WPGMZA.OLModernStoreLocatorCircle.prototype.getScale = function()
9629
  {
9630
+ return 1;
 
 
 
 
 
 
 
 
9631
  }
9632
 
9633
+ WPGMZA.OLModernStoreLocatorCircle.prototype.destroy = function()
9634
  {
9635
+ $(this.canvas).remove();
9636
+
9637
+ this.map.olMap.un("postrender", this.renderFunction);
9638
+ this.map = null;
9639
+ this.canvas = null;
9640
  }
9641
 
9642
+ });
9643
+
9644
+ // js/v8/open-layers/ol-modern-store-locator.js
9645
+ /**
9646
+ * @namespace WPGMZA
9647
+ * @module OLModernStoreLocator
9648
+ * @requires WPGMZA.ModernStoreLocator
9649
+ */
9650
+ jQuery(function($) {
9651
+
9652
+ WPGMZA.OLModernStoreLocator = function(map_id)
9653
  {
9654
+ var element;
9655
+
9656
+ WPGMZA.ModernStoreLocator.call(this, map_id);
9657
+
9658
+ if(WPGMZA.isProVersion())
9659
+ element = $(".wpgmza_map[data-map-id='" + map_id + "']");
9660
+ else
9661
+ element = $("#wpgmza_map");
9662
+
9663
+ element.append(this.element);
9664
  }
9665
 
9666
+ WPGMZA.OLModernStoreLocator.prototype = Object.create(WPGMZA.ModernStoreLocator);
9667
+ WPGMZA.OLModernStoreLocator.prototype.constructor = WPGMZA.OLModernStoreLocator;
9668
+
9669
+ });
9670
+
9671
+ // js/v8/open-layers/ol-polygon.js
9672
+ /**
9673
+ * @namespace WPGMZA
9674
+ * @module OLPolygon
9675
+ * @requires WPGMZA.Polygon
9676
+ * @pro-requires WPGMZA.ProPolygon
9677
+ */
9678
+ jQuery(function($) {
9679
+
9680
+ var Parent;
9681
+
9682
+ WPGMZA.OLPolygon = function(options, olFeature)
9683
  {
9684
  var self = this;
9685
 
9686
+ Parent.call(this, options, olFeature);
 
9687
 
9688
+ this.olStyle = new ol.style.Style();
9689
+
9690
+ if(olFeature)
9691
  {
9692
+ this.olFeature = olFeature;
 
 
 
 
 
 
 
 
 
 
 
9693
  }
9694
+ else
 
 
 
 
 
 
9695
  {
9696
+ var coordinates = [[]];
9697
 
9698
+ if(options && options.polydata)
9699
  {
9700
+ var paths = this.parseGeometry(options.polydata);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9701
 
9702
+ for(var i = 0; i < paths.length; i++)
9703
+ coordinates[0].push(ol.proj.fromLonLat([
9704
+ parseFloat(paths[i].lng),
9705
+ parseFloat(paths[i].lat)
9706
+ ]));
9707
+
9708
+ this.olStyle = new ol.style.Style(this.getStyleFromSettings());
9709
  }
 
 
 
 
9710
 
9711
+ this.olFeature = new ol.Feature({
9712
+ geometry: new ol.geom.Polygon(coordinates)
9713
+ });
 
 
9714
  }
 
 
9715
 
9716
+ this.layer = new ol.layer.Vector({
9717
+ source: new ol.source.Vector({
9718
+ features: [this.olFeature]
9719
+ }),
9720
+ style: this.olStyle
9721
+ });
9722
+
9723
+ this.layer.getSource().getFeatures()[0].setProperties({
9724
+ wpgmzaPolygon: this
9725
+ });
9726
+ }
9727
+
9728
+ if(WPGMZA.isProVersion())
9729
+ Parent = WPGMZA.ProPolygon;
9730
+ else
9731
+ Parent = WPGMZA.Polygon;
9732
+
9733
+ WPGMZA.OLPolygon.prototype = Object.create(Parent.prototype);
9734
+ WPGMZA.OLPolygon.prototype.constructor = WPGMZA.OLPolygon;
9735
+
9736
+ WPGMZA.OLPolygon.prototype.getStyleFromSettings = function()
9737
+ {
9738
+ var params = {};
9739
 
9740
+ if(this.linecolor && this.lineopacity)
9741
+ params.stroke = new ol.style.Stroke({
9742
+ color: WPGMZA.hexOpacityToRGBA("#" + this.linecolor, this.lineopacity)
9743
  });
9744
+
9745
+ if(this.opacity)
9746
+ params.fill = new ol.style.Fill({
9747
+ color: WPGMZA.hexOpacityToRGBA(this.fillcolor, this.opacity)
9748
+ });
9749
+
9750
+ return params;
9751
+ }
9752
+
9753
+ WPGMZA.OLPolygon.prototype.updateStyleFromSettings = function()
9754
+ {
9755
+ // Re-create the style - working on it directly doesn't cause a re-render
9756
+ var params = this.getStyleFromSettings();
9757
+ this.olStyle = new ol.style.Style(params);
9758
+ this.layer.setStyle(this.olStyle);
9759
+ }
9760
+
9761
+ WPGMZA.OLPolygon.prototype.setEditable = function(editable)
9762
+ {
9763
+
9764
+ }
9765
+
9766
+ WPGMZA.OLPolygon.prototype.toJSON = function()
9767
+ {
9768
+ var result = Parent.prototype.toJSON.call(this);
9769
+ var coordinates = this.olFeature.getGeometry().getCoordinates()[0];
9770
+
9771
+ result.points = [];
9772
+
9773
+ for(var i = 0; i < coordinates.length; i++)
9774
+ {
9775
+ var lonLat = ol.proj.toLonLat(coordinates[i]);
9776
+ var latLng = {
9777
+ lat: lonLat[1],
9778
+ lng: lonLat[0]
9779
+ };
9780
+ result.points.push(latLng);
9781
+ }
9782
+
9783
+ return result;
9784
  }
9785
 
9786
  });
9787
 
9788
+ // js/v8/open-layers/ol-polyline.js
9789
  /**
9790
  * @namespace WPGMZA
9791
+ * @module OLPolyline
9792
+ * @requires WPGMZA.Polyline
 
9793
  */
9794
  jQuery(function($) {
9795
 
9796
  var Parent;
9797
 
9798
+ WPGMZA.OLPolyline = function(options, olFeature)
9799
  {
9800
  var self = this;
9801
 
9802
+ WPGMZA.Polyline.call(this, options);
9803
 
9804
+ this.olStyle = new ol.style.Style();
9805
+
9806
+ if(olFeature)
9807
+ {
9808
+ this.olFeature = olFeature;
9809
+ }
9810
+ else
9811
+ {
9812
+ var coordinates = [];
9813
 
9814
+ if(options && (options.polydata || options.points))
9815
+ {
9816
+ var path;
9817
+
9818
+ if(options.polydata)
9819
+ path = this.parseGeometry(options.polydata);
9820
+ else
9821
+ path = options.points;
9822
+
9823
+ for(var i = 0; i < path.length; i++)
9824
+ {
9825
+ if(!($.isNumeric(path[i].lat)))
9826
+ throw new Error("Invalid latitude");
9827
+
9828
+ if(!($.isNumeric(path[i].lng)))
9829
+ throw new Error("Invalid longitude");
9830
+
9831
+ coordinates.push(ol.proj.fromLonLat([
9832
+ parseFloat(path[i].lng),
9833
+ parseFloat(path[i].lat)
9834
+ ]));
9835
+ }
9836
+ }
9837
+
9838
+ var params = this.getStyleFromSettings();
9839
+ this.olStyle = new ol.style.Style(params);
9840
+
9841
+ this.olFeature = new ol.Feature({
9842
+ geometry: new ol.geom.LineString(coordinates)
9843
+ });
9844
+ }
9845
+
9846
+ this.layer = new ol.layer.Vector({
9847
+ source: new ol.source.Vector({
9848
+ features: [this.olFeature]
9849
+ }),
9850
+ style: this.olStyle
9851
+ });
9852
+
9853
+ this.layer.getSource().getFeatures()[0].setProperties({
9854
+ wpgmzaPolyline: this
9855
  });
9856
  }
9857
 
9858
+ Parent = WPGMZA.Polyline;
9859
+
9860
+ WPGMZA.OLPolyline.prototype = Object.create(Parent.prototype);
9861
+ WPGMZA.OLPolyline.prototype.constructor = WPGMZA.OLPolyline;
 
 
 
9862
 
9863
+ WPGMZA.OLPolyline.prototype.getStyleFromSettings = function()
9864
+ {
9865
+ var params = {};
9866
 
9867
+ if(this.settings.strokeOpacity)
9868
+ params.stroke = new ol.style.Stroke({
9869
+ color: WPGMZA.hexOpacityToRGBA(this.settings.strokeColor, this.settings.strokeOpacity),
9870
+ width: parseInt(this.settings.strokeWeight)
9871
+ });
9872
+
9873
+ return params;
9874
+ }
9875
+
9876
+ WPGMZA.OLPolyline.prototype.updateStyleFromSettings = function()
9877
+ {
9878
+ // Re-create the style - working on it directly doesn't cause a re-render
9879
+ var params = this.getStyleFromSettings();
9880
+ this.olStyle = new ol.style.Style(params);
9881
+ this.layer.setStyle(this.olStyle);
9882
+ }
9883
+
9884
+ WPGMZA.OLPolyline.prototype.setEditable = function(editable)
9885
+ {
9886
 
9887
+ }
9888
 
9889
+ WPGMZA.OLPolyline.prototype.setPoints = function(points)
 
 
 
 
 
9890
  {
9891
+ if(this.olFeature)
9892
+ this.layer.getSource().removeFeature(this.olFeature);
9893
 
9894
+ var coordinates = [];
 
9895
 
9896
+ for(var i = 0; i < points.length; i++)
9897
+ coordinates.push(ol.proj.fromLonLat([
9898
+ parseFloat(points[i].lng),
9899
+ parseFloat(points[i].lat)
9900
+ ]));
9901
 
9902
+ this.olFeature = new ol.Feature({
9903
+ geometry: new ol.geom.LineString(coordinates)
 
 
 
 
9904
  });
9905
 
9906
+ this.layer.getSource().addFeature(this.olFeature);
9907
+ }
9908
+
9909
+ WPGMZA.OLPolyline.prototype.toJSON = function()
9910
+ {
9911
+ var result = Parent.prototype.toJSON.call(this);
9912
+ var coordinates = this.olFeature.getGeometry().getCoordinates();
9913
 
9914
+ result.points = [];
9915
 
9916
+ for(var i = 0; i < coordinates.length; i++)
9917
  {
9918
+ var lonLat = ol.proj.toLonLat(coordinates[i]);
9919
+ var latLng = {
9920
+ lat: lonLat[1],
9921
+ lng: lonLat[0]
9922
+ };
9923
+ result.points.push(latLng);
9924
  }
9925
 
9926
+ return result;
 
9927
  }
9928
 
9929
+ });
9930
+
9931
+ // js/v8/open-layers/ol-text.js
9932
+ /**
9933
+ * @namespace WPGMZA
9934
+ * @module OLText
9935
+ * @requires WPGMZA.Text
9936
+ */
9937
+ jQuery(function($) {
9938
+
9939
+ WPGMZA.OLText = function()
9940
  {
 
 
9941
 
9942
+ }
9943
+
9944
+ });
9945
+
9946
+ // js/v8/google-maps/google-circle.js
9947
+ /**
9948
+ * @namespace WPGMZA
9949
+ * @module GoogleCircle
9950
+ * @requires WPGMZA.Circle
9951
+ */
9952
+ jQuery(function($) {
9953
+
9954
+ /**
9955
+ * Subclass, used when Google is the maps engine. <strong>Please <em>do not</em> call this constructor directly. Always use createInstance rather than instantiating this class directly.</strong> Using createInstance allows this class to be externally extensible.
9956
+ * @class WPGMZA.GoogleCircle
9957
+ * @constructor WPGMZA.GoogleCircle
9958
+ * @memberof WPGMZA
9959
+ * @augments WPGMZA.Circle
9960
+ * @see WPGMZA.Circle.createInstance
9961
+ */
9962
+ WPGMZA.GoogleCircle = function(options, googleCircle)
9963
+ {
9964
+ var self = this;
9965
 
9966
+ WPGMZA.Circle.call(this, options, googleCircle);
9967
 
9968
+ if(googleCircle)
9969
+ {
9970
+ this.googleCircle = googleCircle;
9971
+ }
9972
+ else
9973
+ {
9974
+ this.googleCircle = new google.maps.Circle();
9975
+ this.googleCircle.wpgmzaCircle = this;
9976
+ }
9977
 
9978
+ google.maps.event.addListener(this.googleCircle, "click", function() {
9979
+ self.dispatchEvent({type: "click"});
9980
+ });
9981
+
9982
+ if(options)
9983
+ this.setOptions(options);
9984
  }
9985
 
9986
+ WPGMZA.GoogleCircle.prototype = Object.create(WPGMZA.Circle.prototype);
9987
+ WPGMZA.GoogleCircle.prototype.constructor = WPGMZA.GoogleCircle;
9988
+
9989
+ WPGMZA.GoogleCircle.prototype.setCenter = function(center)
9990
  {
9991
+ WPGMZA.Circle.prototype.setCenter.apply(this, arguments);
9992
+
9993
+ this.googleCircle.setCenter(center);
9994
  }
9995
 
9996
+ WPGMZA.GoogleCircle.prototype.setRadius = function(radius)
9997
  {
9998
+ WPGMZA.Circle.prototype.setRadius.apply(this, arguments);
9999
+
10000
+ this.googleCircle.setRadius(parseFloat(radius) * 1000);
 
10001
  }
10002
 
10003
+ WPGMZA.GoogleCircle.prototype.setVisible = function(visible)
10004
  {
10005
+ this.googleCircle.setVisible(visible ? true : false);
10006
+ }
10007
+
10008
+ WPGMZA.GoogleCircle.prototype.setOptions = function(options)
10009
+ {
10010
+ var googleOptions = {};
10011
+
10012
+ googleOptions = $.extend({}, options);
10013
+ delete googleOptions.map;
10014
+ delete googleOptions.center;
10015
+
10016
+ if(options.center)
10017
+ googleOptions.center = new google.maps.LatLng({
10018
+ lat: parseFloat(options.center.lat),
10019
+ lng: parseFloat(options.center.lng)
10020
+ });
10021
+
10022
+ if(options.radius)
10023
+ googleOptions.radius = parseFloat(options.radius);
10024
 
10025
+ if(options.color)
10026
+ googleOptions.fillColor = options.color;
10027
 
10028
+ if(options.opacity)
10029
  {
10030
+ googleOptions.fillOpacity = parseFloat(options.opacity);
10031
+ googleOptions.strokeOpacity = parseFloat(options.opacity);
10032
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10033
  }
10034
+
10035
+ this.googleCircle.setOptions(googleOptions);
10036
+
10037
+ if(options.map)
10038
+ options.map.addCircle(this);
10039
  }
10040
 
10041
  });
10042
 
10043
+ // js/v8/google-maps/google-geocoder.js
10044
  /**
10045
  * @namespace WPGMZA
10046
+ * @module GoogleGeocoder
10047
+ * @requires WPGMZA.Geocoder
 
10048
  */
10049
  jQuery(function($) {
10050
 
10051
+ /**
10052
+ * Subclass, used when Google is the maps engine. <strong>Please <em>do not</em> call this constructor directly. Always use createInstance rather than instantiating this class directly.</strong> Using createInstance allows this class to be externally extensible.
10053
+ * @class WPGMZA.GoogleGeocoder
10054
+ * @constructor WPGMZA.GoogleGeocoder
10055
+ * @memberof WPGMZA
10056
+ * @augments WPGMZA.Geocoder
10057
+ * @see WPGMZA.Geocoder.createInstance
10058
+ */
10059
+ WPGMZA.GoogleGeocoder = function()
10060
+ {
10061
+ WPGMZA.Geocoder.call(this);
10062
+ }
10063
 
10064
+ WPGMZA.GoogleGeocoder.prototype = Object.create(WPGMZA.Geocoder.prototype);
10065
+ WPGMZA.GoogleGeocoder.prototype.constructor = WPGMZA.GoogleGeocoder;
10066
+
10067
+ WPGMZA.GoogleGeocoder.prototype.getGoogleGeocoder = function()
10068
  {
10069
+ if(WPGMZA.CloudAPI && WPGMZA.CloudAPI.isBeingUsed)
10070
+ return new WPGMZA.CloudGeocoder();
 
 
 
10071
 
10072
+ return new google.maps.Geocoder();
10073
+ }
10074
+
10075
+ WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress = function(options, callback)
10076
+ {
10077
+ if(!options || !options.address)
10078
+ throw new Error("No address specified");
10079
 
10080
+ if(WPGMZA.isLatLngString(options.address))
10081
+ return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this, options, callback);
10082
 
10083
+ if(options.country)
10084
+ options.componentRestrictions = {
10085
+ country: options.country
10086
+ };
 
 
 
10087
 
10088
+ var geocoder = this.getGoogleGeocoder();
 
 
 
 
 
 
 
 
 
 
 
 
10089
 
10090
+ geocoder.geocode(options, function(results, status) {
 
 
 
 
10091
 
10092
+ if(status == google.maps.GeocoderStatus.OK || status == WPGMZA.CloudGeocoder.SUCCESS)
10093
  {
10094
+ var location = results[0].geometry.location;
10095
+ var latLng, bounds = null;
 
 
 
 
 
 
10096
 
10097
+ latLng = {
10098
+ lat: location.lat(),
10099
+ lng: location.lng()
10100
+ };
10101
+
10102
+ if(bounds = results[0].geometry.bounds)
10103
+ {
10104
+ if(bounds instanceof google.maps.LatLngBounds)
10105
+ bounds = WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds);
10106
+ else
10107
+ bounds = WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral(results[0].geometry.bounds);
10108
+ }
10109
+
10110
+ var results = [
10111
+ {
10112
+ geometry: {
10113
+ location: latLng
10114
+ },
10115
+ latLng: latLng,
10116
+ lat: latLng.lat,
10117
+ lng: latLng.lng,
10118
+ bounds: bounds
10119
  }
10120
+ ];
 
10121
 
10122
+ callback(results, WPGMZA.Geocoder.SUCCESS);
10123
  }
10124
  else
10125
  {
10126
+ var nativeStatus = WPGMZA.Geocoder.FAIL;
 
 
 
 
 
 
 
 
 
 
10127
 
10128
+ if(status == google.maps.GeocoderStatus.ZERO_RESULTS)
10129
+ nativeStatus = WPGMZA.Geocoder.ZERO_RESULTS;
10130
+
10131
+ callback(null, nativeStatus);
10132
  }
10133
+ });
10134
+ }
10135
+
10136
+ WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng = function(options, callback)
10137
+ {
10138
+ if(!options || !options.latLng)
10139
+ throw new Error("No latLng specified");
10140
 
10141
+ var latLng = new WPGMZA.LatLng(options.latLng);
10142
+ var geocoder = this.getGoogleGeocoder();
10143
+
10144
+ var options = $.extend(options, {
10145
+ location: {
10146
+ lat: latLng.lat,
10147
+ lng: latLng.lng
10148
+ }
10149
+ });
10150
+ delete options.latLng;
10151
+
10152
+ geocoder.geocode(options, function(results, status) {
10153
 
10154
+ if(status !== "OK")
10155
+ callback(null, WPGMZA.Geocoder.FAIL);
 
10156
 
10157
+ if(!results || !results.length)
10158
+ callback([], WPGMZA.Geocoder.NO_RESULTS);
10159
+
10160
+ callback([results[0].formatted_address], WPGMZA.Geocoder.SUCCESS);
10161
+
10162
+ });
10163
+ }
10164
+
10165
+ });
10166
+
10167
+ // js/v8/google-maps/google-html-overlay.js
10168
+ /**
10169
+ * @namespace WPGMZA
10170
+ * @module GoogleHTMLOverlay
10171
+ * @requires WPGMZA
10172
+ */
10173
+ jQuery(function($) {
10174
+
10175
+ // https://developers.google.com/maps/documentation/javascript/customoverlays
10176
+
10177
+ if(WPGMZA.settings.engine && WPGMZA.settings.engine != "google-maps")
10178
+ return;
10179
+
10180
+ if(!window.google || !window.google.maps)
10181
+ return;
10182
+
10183
+ WPGMZA.GoogleHTMLOverlay = function(map)
10184
+ {
10185
+ this.element = $("<div class='wpgmza-google-html-overlay'></div>");
10186
 
10187
+ this.visible = true;
10188
+ this.position = new WPGMZA.LatLng();
10189
+
10190
+ this.setMap(map.googleMap);
10191
+ this.wpgmzaMap = map;
10192
+ }
10193
+
10194
+ WPGMZA.GoogleHTMLOverlay.prototype = new google.maps.OverlayView();
10195
+
10196
+ WPGMZA.GoogleHTMLOverlay.prototype.onAdd = function()
10197
+ {
10198
+ var panes = this.getPanes();
10199
+ panes.overlayMouseTarget.appendChild(this.element[0]);
10200
 
10201
+ /*google.maps.event.addDomListener(this.element, "click", function() {
 
 
 
 
 
 
 
 
10202
 
10203
+ });*/
10204
+ }
10205
+
10206
+ WPGMZA.GoogleHTMLOverlay.prototype.onRemove = function()
10207
+ {
10208
+ if(this.element && $(this.element).parent().length)
10209
+ {
10210
+ $(this.element).remove();
10211
+ this.element = null;
 
 
 
 
 
10212
  }
10213
+ }
10214
+
10215
+ WPGMZA.GoogleHTMLOverlay.prototype.draw = function()
10216
+ {
10217
+ this.updateElementPosition();
10218
+ }
10219
+
10220
+ /*WPGMZA.GoogleHTMLOverlay.prototype.setMap = function(map)
10221
+ {
10222
+ if(!(map instanceof WPGMZA.Map))
10223
+ throw new Error("Map must be an instance of WPGMZA.Map");
10224
 
10225
+ google.maps.OverlayView.prototype.setMap.call(this, map.googleMap);
 
 
 
10226
 
10227
+ this.wpgmzaMap = map;
10228
+ }*/
10229
+
10230
+ /*WPGMZA.GoogleHTMLOverlay.prototype.getVisible = function()
10231
+ {
10232
+ return $(this.element).css("display") != "none";
10233
+ }
10234
+
10235
+ WPGMZA.GoogleHTMLOverlay.prototype.setVisible = function(visible)
10236
+ {
10237
+ $(this.element).css({
10238
+ "display": (visible ? "block" : "none")
10239
  });
10240
+ }*/
10241
+
10242
+ /*WPGMZA.GoogleHTMLOverlay.prototype.getPosition = function()
10243
+ {
10244
+ return new WPGMZA.LatLng(this.position);
10245
+ }
10246
+
10247
+ WPGMZA.GoogleHTMLOverlay.prototype.setPosition = function(position)
10248
+ {
10249
+ if(!(position instanceof WPGMZA.LatLng))
10250
+ throw new Error("Argument must be an instance of WPGMZA.LatLng");
10251
 
10252
+ this.position = position;
10253
+ this.updateElementPosition();
10254
+ }*/
10255
+
10256
+ WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition = function()
10257
+ {
10258
+ //var pixels = this.wpgmzaMap.latLngToPixels(this.position);
 
10259
 
10260
+ var projection = this.getProjection();
 
 
 
 
 
10261
 
10262
+ if(!projection)
10263
+ return;
 
 
 
 
 
10264
 
10265
+ var pixels = projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10266
 
10267
+ $(this.element).css({
10268
+ "left": pixels.x,
10269
+ "top": pixels.y
10270
+ });
 
 
 
 
 
 
 
10271
  }
10272
+ });
10273
 
10274
+ // js/v8/google-maps/google-info-window.js
10275
+ /**
10276
+ * @namespace WPGMZA
10277
+ * @module GoogleInfoWindow
10278
+ * @requires WPGMZA.InfoWindow
10279
+ * @pro-requires WPGMZA.ProInfoWindow
10280
+ */
10281
+ jQuery(function($) {
10282
+
10283
+ var Parent;
10284
+
10285
+ WPGMZA.GoogleInfoWindow = function(mapObject)
10286
+ {
10287
+ Parent.call(this, mapObject);
10288
+
10289
+ this.setMapObject(mapObject);
10290
+ }
10291
+
10292
+ WPGMZA.GoogleInfoWindow.Z_INDEX = 99;
10293
+
10294
  if(WPGMZA.isProVersion())
10295
+ Parent = WPGMZA.ProInfoWindow;
10296
  else
10297
+ Parent = WPGMZA.InfoWindow;
10298
 
10299
+ WPGMZA.GoogleInfoWindow.prototype = Object.create(Parent.prototype);
10300
+ WPGMZA.GoogleInfoWindow.prototype.constructor = WPGMZA.GoogleInfoWindow;
10301
 
10302
+ WPGMZA.GoogleInfoWindow.prototype.setMapObject = function(mapObject)
10303
  {
10304
+ if(mapObject instanceof WPGMZA.Marker)
10305
+ this.googleObject = mapObject.googleMarker;
10306
+ else if(mapObject instanceof WPGMZA.Polygon)
10307
+ this.googleObject = mapObject.googlePolygon;
10308
+ else if(mapObject instanceof WPGMZA.Polyline)
10309
+ this.googleObject = mapObject.googlePolyline;
10310
+ }
10311
+
10312
+ WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow = function()
10313
+ {
10314
+ var self = this;
10315
 
10316
+ if(this.googleInfoWindow)
10317
+ return;
10318
 
10319
+ this.googleInfoWindow = new google.maps.InfoWindow();
10320
+
10321
+ this.googleInfoWindow.setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX);
10322
+
10323
+ google.maps.event.addListener(this.googleInfoWindow, "domready", function(event) {
10324
+ self.trigger("domready");
10325
+ });
10326
+
10327
+ google.maps.event.addListener(this.googleInfoWindow, "closeclick", function(event) {
10328
+
10329
+ if(self.state == WPGMZA.InfoWindow.STATE_CLOSED)
10330
+ return;
10331
+
10332
+ self.state = WPGMZA.InfoWindow.STATE_CLOSED;
10333
+ self.trigger("infowindowclose");
10334
+
10335
  });
10336
  }
10337
 
10338
+ /**
10339
+ * Opens the info window
10340
+ * @return boolean FALSE if the info window should not & will not open, TRUE if it will
10341
+ */
10342
+ WPGMZA.GoogleInfoWindow.prototype.open = function(map, mapObject)
10343
  {
10344
+ var self = this;
10345
+
10346
+ if(!Parent.prototype.open.call(this, map, mapObject))
10347
+ return false;
10348
+
10349
+ // Set parent for events to bubble up to
10350
+ this.parent = map;
10351
+
10352
+ this.createGoogleInfoWindow();
10353
+ this.setMapObject(mapObject);
10354
+
10355
+ if(this.googleObject instanceof google.maps.Polygon)
10356
+ {
10357
+
10358
+ }
10359
+ else{
10360
+ this.googleInfoWindow.open(
10361
+ this.mapObject.map.googleMap,
10362
+ this.googleObject
10363
+ );
10364
+ }
10365
 
10366
+
 
10367
 
10368
+ var guid = WPGMZA.guid();
10369
+ var html = "<div id='" + guid + "'>" + this.content + "</div>";
10370
+
10371
+ this.googleInfoWindow.setContent(html);
10372
 
10373
+ var intervalID;
10374
+ intervalID = setInterval(function(event) {
10375
+
10376
+ div = $("#" + guid);
10377
+
10378
+ if(div.length)
10379
+ {
10380
+ clearInterval(intervalID);
10381
+
10382
+ div[0].wpgmzaMapObject = self.mapObject;
10383
+ div.addClass("wpgmza-infowindow");
10384
+
10385
+ self.element = div[0];
10386
+ self.trigger("infowindowopen");
10387
+ }
10388
+
10389
+ }, 50);
10390
 
10391
+ return true;
10392
  }
10393
 
10394
+ WPGMZA.GoogleInfoWindow.prototype.close = function()
10395
  {
10396
+ if(!this.googleInfoWindow)
10397
+ return;
10398
+
10399
+ WPGMZA.InfoWindow.prototype.close.call(this);
10400
+
10401
+ this.googleInfoWindow.close();
 
10402
  }
10403
 
10404
+ WPGMZA.GoogleInfoWindow.prototype.setContent = function(html)
10405
  {
10406
+ Parent.prototype.setContent.call(this, html);
10407
 
10408
+ this.content = html;
10409
 
10410
+ this.createGoogleInfoWindow();
 
 
 
10411
 
10412
+ this.googleInfoWindow.setContent(html);
 
 
10413
  }
10414
 
10415
+ WPGMZA.GoogleInfoWindow.prototype.setOptions = function(options)
10416
  {
10417
+ Parent.prototype.setOptions.call(this, options);
 
 
 
 
 
 
 
10418
 
10419
+ this.createGoogleInfoWindow();
 
10420
 
10421
+ this.googleInfoWindow.setOptions(options);
10422
  }
10423
 
10424
+ });
10425
+
10426
+ // js/v8/google-maps/google-map.js
10427
+ /**
10428
+ * @namespace WPGMZA
10429
+ * @module GoogleMap
10430
+ * @requires WPGMZA.Map
10431
+ * @pro-requires WPGMZA.ProMap
10432
+ */
10433
+ jQuery(function($) {
10434
+ var Parent;
10435
+
10436
  /**
10437
+ * Constructor
10438
+ * @param element to contain the map
10439
  */
10440
+ WPGMZA.GoogleMap = function(element, options)
10441
  {
10442
+ var self = this;
10443
+
10444
+ Parent.call(this, element, options);
10445
+
10446
+ if(!window.google)
10447
  {
10448
+ var status = WPGMZA.googleAPIStatus;
10449
+ var message = "Google API not loaded";
10450
 
10451
+ if(status && status.message)
10452
+ message += " - " + status.message;
 
 
10453
 
10454
+ if(status.code == "USER_CONSENT_NOT_GIVEN")
10455
+ {
10456
+ return;
10457
+ }
10458
+
10459
+ $(element).html("<div class='notice notice-error'><p>" + WPGMZA.localized_strings.google_api_not_loaded + "<pre>" + message + "</pre></p></div>");
10460
+
10461
+ throw new Error(message);
10462
  }
10463
 
10464
+ this.loadGoogleMap();
10465
 
10466
+ if(options)
10467
+ this.setOptions(options, true);
10468
+
10469
+ google.maps.event.addListener(this.googleMap, "click", function(event) {
10470
+ var wpgmzaEvent = new WPGMZA.Event("click");
10471
+ wpgmzaEvent.latLng = {
10472
+ lat: event.latLng.lat(),
10473
+ lng: event.latLng.lng()
10474
+ };
10475
+ self.dispatchEvent(wpgmzaEvent);
10476
+ });
 
 
 
 
 
 
 
 
 
 
 
 
10477
 
10478
+ google.maps.event.addListener(this.googleMap, "rightclick", function(event) {
10479
+ var wpgmzaEvent = new WPGMZA.Event("rightclick");
10480
+ wpgmzaEvent.latLng = {
10481
+ lat: event.latLng.lat(),
10482
+ lng: event.latLng.lng()
10483
+ };
10484
+ self.dispatchEvent(wpgmzaEvent);
10485
+ });
10486
 
10487
+ google.maps.event.addListener(this.googleMap, "dragend", function(event) {
10488
+ self.dispatchEvent("dragend");
10489
+ });
10490
+
10491
+ google.maps.event.addListener(this.googleMap, "zoom_changed", function(event) {
10492
+ self.dispatchEvent("zoom_changed");
10493
+ self.dispatchEvent("zoomchanged");
10494
+ });
10495
+
10496
+ // Idle event
10497
+ google.maps.event.addListener(this.googleMap, "idle", function(event) {
10498
+ self.onIdle(event);
10499
+ });
10500
+
10501
+ // Dispatch event
10502
+ if(!WPGMZA.isProVersion())
10503
+ {
10504
+ this.trigger("init");
10505
+
10506
+ this.dispatchEvent("created");
10507
+ WPGMZA.events.dispatchEvent({type: "mapcreated", map: this});
10508
+
10509
+ // Legacy event
10510
+ $(this.element).trigger("wpgooglemaps_loaded");
10511
+ }
10512
  }
10513
 
10514
+ // If we're running the Pro version, inherit from ProMap, otherwise, inherit from Map
10515
+ if(WPGMZA.isProVersion())
10516
  {
10517
+ Parent = WPGMZA.ProMap;
10518
+ WPGMZA.GoogleMap.prototype = Object.create(WPGMZA.ProMap.prototype);
10519
  }
10520
+ else
 
10521
  {
10522
+ Parent = WPGMZA.Map;
10523
+ WPGMZA.GoogleMap.prototype = Object.create(WPGMZA.Map.prototype);
10524
  }
10525
+ WPGMZA.GoogleMap.prototype.constructor = WPGMZA.GoogleMap;
10526
 
10527
+ WPGMZA.GoogleMap.parseThemeData = function(raw)
10528
  {
10529
+ var json;
10530
+
10531
+ try{
10532
+ json = JSON.parse(raw); // Try to parse strict JSON
10533
+ }catch(e) {
10534
+
10535
+ try{
10536
+
10537
+ json = eval(raw); // Try to parse JS object
10538
+
10539
+ }catch(e) {
10540
+
10541
+ var str = raw;
10542
+
10543
+ str = str.replace(/\\'/g, '\'');
10544
+ str = str.replace(/\\"/g, '"');
10545
+ str = str.replace(/\\0/g, '\0');
10546
+ str = str.replace(/\\\\/g, '\\');
10547
+
10548
+ try{
10549
+
10550
+ json = eval(str);
10551
+
10552
+ }catch(e) {
10553
+
10554
+ console.warn("Couldn't parse theme data");
10555
+
10556
+ return [];
10557
+
10558
+ }
10559
+
10560
+ }
10561
+
10562
+ }
10563
+
10564
+ return json;
10565
  }
10566
 
10567
+ /**
10568
+ * Creates the Google Maps map
10569
+ * @return void
10570
+ */
10571
+ WPGMZA.GoogleMap.prototype.loadGoogleMap = function()
10572
  {
10573
+ var self = this;
10574
+ var options = this.settings.toGoogleMapsOptions();
10575
+
10576
+ this.googleMap = new google.maps.Map(this.engineElement, options);
10577
+
10578
+ google.maps.event.addListener(this.googleMap, "bounds_changed", function() {
10579
+ self.onBoundsChanged();
10580
+ });
10581
+
10582
+ if(this.settings.bicycle == 1)
10583
+ this.enableBicycleLayer(true);
10584
+ if(this.settings.traffic == 1)
10585
+ this.enableTrafficLayer(true);
10586
+ if(this.settings.transport == 1)
10587
+ this.enablePublicTransportLayer(true);
10588
+ this.showPointsOfInterest(this.settings.show_point_of_interest);
10589
+
10590
+ // Move the loading wheel into the map element (it has to live outside in the HTML file because it'll be overwritten by Google otherwise)
10591
+ $(this.engineElement).append($(this.element).find(".wpgmza-loader"));
10592
  }
10593
 
10594
+ WPGMZA.GoogleMap.prototype.setOptions = function(options, initializing)
10595
  {
10596
  Parent.prototype.setOptions.call(this, options);
10597
 
10598
+ if(options.scrollwheel)
10599
+ delete options.scrollwheel; // NB: Delete this when true, scrollwheel: true breaks gesture handling
10600
+
10601
+ if(!initializing)
10602
+ {
10603
+ this.googleMap.setOptions(options);
10604
  return;
10605
+ }
10606
 
10607
+ var converted = $.extend(options, this.settings.toGoogleMapsOptions());
10608
+
10609
+ var clone = $.extend({}, converted);
10610
+ if(!clone.center instanceof google.maps.LatLng && (clone.center instanceof WPGMZA.LatLng || typeof clone.center == "object"))
10611
+ clone.center = {
10612
+ lat: parseFloat(clone.center.lat),
10613
+ lng: parseFloat(clone.center.lng)
10614
+ };
10615
+
10616
+ if(this.settings.hide_point_of_interest == "1")
10617
+ {
10618
+ var noPoi = {
10619
+ featureType: "poi",
10620
+ elementType: "labels",
10621
+ stylers: [
10622
+ {
10623
+ visibility: "off"
10624
+ }
10625
+ ]
10626
+ };
10627
+
10628
+ if(!clone.styles)
10629
+ clone.styles = [];
10630
+
10631
+ clone.styles.push(noPoi);
10632
+ }
10633
+
10634
+ this.googleMap.setOptions(clone);
10635
  }
10636
 
10637
  /**
10638
+ * Adds the specified marker to this map
10639
+ * @return void
10640
  */
10641
+ WPGMZA.GoogleMap.prototype.addMarker = function(marker)
10642
  {
10643
+ marker.googleMarker.setMap(this.googleMap);
 
 
 
 
 
 
10644
 
10645
  Parent.prototype.addMarker.call(this, marker);
10646
  }
10647
 
10648
+ /**
10649
+ * Removes the specified marker from this map
10650
+ * @return void
10651
+ */
10652
+ WPGMZA.GoogleMap.prototype.removeMarker = function(marker) {
10653
+
10654
+ marker.googleMarker.setMap(null);
 
 
10655
 
10656
  Parent.prototype.removeMarker.call(this, marker);
10657
  }
10658
 
10659
+ /**
10660
+ * Adds the specified polygon to this map
10661
+ * @return void
10662
+ */
10663
+ WPGMZA.GoogleMap.prototype.addPolygon = function(polygon)
10664
  {
10665
+ polygon.googlePolygon.setMap(this.googleMap);
10666
 
10667
  Parent.prototype.addPolygon.call(this, polygon);
10668
  }
10669
 
10670
+ /**
10671
+ * Removes the specified polygon from this map
10672
+ * @return void
10673
+ */
10674
+ WPGMZA.GoogleMap.prototype.removePolygon = function(polygon)
10675
  {
10676
+ polygon.googlePolygon.setMap(null);
10677
 
10678
  Parent.prototype.removePolygon.call(this, polygon);
10679
  }
10680
 
10681
+ /**
10682
+ * Adds the specified polyline to this map
10683
+ * @return void
10684
+ */
10685
+ WPGMZA.GoogleMap.prototype.addPolyline = function(polyline)
10686
  {
10687
+ polyline.googlePolyline.setMap(this.googleMap);
10688
 
10689
  Parent.prototype.addPolyline.call(this, polyline);
10690
  }
10691
 
10692
+ /**
10693
+ * Removes the specified polygon from this map
10694
+ * @return void
10695
+ */
10696
+ WPGMZA.GoogleMap.prototype.removePolyline = function(polyline)
10697
  {
10698
+ polyline.googlePolyline.setMap(null);
10699
 
10700
  Parent.prototype.removePolyline.call(this, polyline);
10701
  }
10702
 
10703
+ WPGMZA.GoogleMap.prototype.addCircle = function(circle)
10704
  {
10705
+ circle.googleCircle.setMap(this.googleMap);
10706
 
10707
  Parent.prototype.addCircle.call(this, circle);
10708
  }
10709
 
10710
+ WPGMZA.GoogleMap.prototype.removeCircle = function(circle)
10711
  {
10712
+ circle.googleCircle.setMap(null);
10713
 
10714
  Parent.prototype.removeCircle.call(this, circle);
10715
  }
10716
 
10717
+ WPGMZA.GoogleMap.prototype.addRectangle = function(rectangle)
10718
  {
10719
+ rectangle.googleRectangle.setMap(this.googleMap);
10720
 
10721
  Parent.prototype.addRectangle.call(this, rectangle);
10722
  }
10723
 
10724
+ WPGMZA.GoogleMap.prototype.removeRectangle = function(rectangle)
10725
  {
10726
+ rectangle.googleRectangle.setMap(null);
10727
 
10728
  Parent.prototype.removeRectangle.call(this, rectangle);
10729
  }
10730
 
10731
+ /**
10732
+ * Delegate for google maps getCenter
10733
+ * @return void
10734
+ */
10735
+ WPGMZA.GoogleMap.prototype.getCenter = function()
10736
  {
10737
+ var latLng = this.googleMap.getCenter();
 
 
 
 
 
 
 
 
 
10738
 
10739
+ return {
10740
+ lat: latLng.lat(),
10741
+ lng: latLng.lng()
10742
+ };
10743
+ }
10744
+
10745
+ /**
10746
+ * Delegate for google maps setCenter
10747
+ * @return void
10748
+ */
10749
+ WPGMZA.GoogleMap.prototype.setCenter = function(latLng)
10750
+ {
10751
+ WPGMZA.Map.prototype.setCenter.call(this, latLng);
10752
 
10753
+ if(latLng instanceof WPGMZA.LatLng)
10754
+ this.googleMap.setCenter({
10755
+ lat: latLng.lat,
10756
+ lng: latLng.lng
10757
+ });
10758
+ else
10759
+ this.googleMap.setCenter(latLng);
10760
+ }
10761
+
10762
+ /**
10763
+ * Delegate for google maps setPan
10764
+ * @return void
10765
+ */
10766
+ WPGMZA.GoogleMap.prototype.panTo = function(latLng)
10767
+ {
10768
+ if(latLng instanceof WPGMZA.LatLng)
10769
+ this.googleMap.panTo({
10770
+ lat: latLng.lat,
10771
+ lng: latLng.lng
10772
+ });
10773
+ else
10774
+ this.googleMap.panTo(latLng);
10775
+ }
10776
+
10777
+ /**
10778
+ * Delegate for google maps getCenter
10779
+ * @return void
10780
+ */
10781
+ WPGMZA.GoogleMap.prototype.getZoom = function()
10782
+ {
10783
+ return this.googleMap.getZoom();
10784
+ }
10785
+
10786
+ /**
10787
+ * Delegate for google maps getZoom
10788
+ * @return void
10789
+ */
10790
+ WPGMZA.GoogleMap.prototype.setZoom = function(value)
10791
+ {
10792
+ if(isNaN(value))
10793
+ throw new Error("Value must not be NaN");
10794
 
10795
+ return this.googleMap.setZoom(parseInt(value));
10796
+ }
10797
+
10798
+ /**
10799
+ * Gets the bounds
10800
+ * @return object
10801
+ */
10802
+ WPGMZA.GoogleMap.prototype.getBounds = function()
10803
+ {
10804
+ var bounds = this.googleMap.getBounds();
10805
+ var northEast = bounds.getNorthEast();
10806
+ var southWest = bounds.getSouthWest();
10807
+
10808
+ var nativeBounds = new WPGMZA.LatLngBounds({});
10809
+
10810
+ nativeBounds.north = northEast.lat();
10811
+ nativeBounds.south = southWest.lat();
10812
+ nativeBounds.west = southWest.lng();
10813
+ nativeBounds.east = northEast.lng();
10814
+
10815
+ // Backward compatibility
10816
+ nativeBounds.topLeft = {
10817
+ lat: northEast.lat(),
10818
+ lng: southWest.lng()
10819
+ };
10820
+
10821
+ nativeBounds.bottomRight = {
10822
+ lat: southWest.lat(),
10823
+ lng: northEast.lng()
10824
  };
10825
+
10826
+ return nativeBounds;
10827
  }
10828
 
10829
+ /**
10830
+ * Fit to given boundaries
10831
+ * @return void
10832
+ */
10833
+ WPGMZA.GoogleMap.prototype.fitBounds = function(southWest, northEast)
10834
  {
10835
+ if(southWest instanceof WPGMZA.LatLng)
10836
+ southWest = {lat: southWest.lat, lng: southWest.lng};
10837
+ if(northEast instanceof WPGMZA.LatLng)
10838
+ northEast = {lat: northEast.lat, lng: northEast.lng};
10839
+ else if(southWest instanceof WPGMZA.LatLngBounds)
10840
+ {
10841
+ var bounds = southWest;
10842
+
10843
+ southWest = {
10844
+ lat: bounds.south,
10845
+ lng: bounds.west
10846
+ };
10847
+
10848
+ northEast = {
10849
+ lat: bounds.north,
10850
+ lng: bounds.east
10851
  };
10852
+ }
10853
 
10854
+ var nativeBounds = new google.maps.LatLngBounds(southWest, northEast);
10855
+ this.googleMap.fitBounds(nativeBounds);
 
 
10856
  }
10857
 
10858
+ /**
10859
+ * Fit the map boundaries to visible markers
10860
+ * @return void
10861
+ */
10862
+ WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers = function()
10863
  {
10864
+ var bounds = new google.maps.LatLngBounds();
10865
+ for(var i = 0; i < this.markers.length; i++)
 
 
 
 
 
 
 
 
 
 
10866
  {
10867
+ if(markers[i].getVisible())
10868
+ bounds.extend(markers[i].getPosition());
 
 
10869
  }
10870
+ this.googleMap.fitBounds(bounds);
10871
  }
10872
 
10873
+ /**
10874
+ * Enables / disables the bicycle layer
10875
+ * @param enable boolean, enable or not
10876
+ * @return void
10877
+ */
10878
+ WPGMZA.GoogleMap.prototype.enableBicycleLayer = function(enable)
10879
  {
10880
+ if(!this.bicycleLayer)
10881
+ this.bicycleLayer = new google.maps.BicyclingLayer();
 
 
 
 
 
 
 
 
 
 
10882
 
10883
+ this.bicycleLayer.setMap(
10884
+ enable ? this.googleMap : null
10885
+ );
10886
  }
10887
 
10888
+ /**
10889
+ * Enables / disables the bicycle layer
10890
+ * @param enable boolean, enable or not
10891
+ * @return void
10892
+ */
10893
+ WPGMZA.GoogleMap.prototype.enableTrafficLayer = function(enable)
10894
  {
10895
+ if(!this.trafficLayer)
10896
+ this.trafficLayer = new google.maps.TrafficLayer();
10897
+
10898
+ this.trafficLayer.setMap(
10899
+ enable ? this.googleMap : null
10900
+ );
10901
  }
10902
 
10903
+ /**
10904
+ * Enables / disables the bicycle layer
10905
+ * @param enable boolean, enable or not
10906
+ * @return void
10907
+ */
10908
+ WPGMZA.GoogleMap.prototype.enablePublicTransportLayer = function(enable)
10909
  {
10910
+ if(!this.publicTransportLayer)
10911
+ this.publicTransportLayer = new google.maps.TransitLayer();
 
 
 
 
 
 
 
 
 
 
10912
 
10913
+ this.publicTransportLayer.setMap(
10914
+ enable ? this.googleMap : null
10915
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10916
  }
10917
 
10918
+ /**
10919
+ * Shows / hides points of interest
10920
+ * @param show boolean, enable or not
10921
+ * @return void
10922
+ */
10923
+ WPGMZA.GoogleMap.prototype.showPointsOfInterest = function(show)
 
 
 
 
 
 
 
 
10924
  {
10925
+ // TODO: This will bug the front end because there is no textarea with theme data
10926
+ var text = $("textarea[name='theme_data']").val();
10927
 
10928
+ if(!text)
10929
+ return;
 
 
 
 
10930
 
10931
+ var styles = JSON.parse(text);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10932
 
10933
+ styles.push({
10934
+ featureType: "poi",
10935
+ stylers: [
10936
+ {
10937
+ visibility: (show ? "on" : "off")
10938
+ }
10939
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10940
  });
10941
 
10942
+ this.googleMap.setOptions({styles: styles});
10943
  }
10944
 
10945
+ /**
10946
+ * Gets the min zoom of the map
10947
+ * @return int
10948
+ */
10949
+ WPGMZA.GoogleMap.prototype.getMinZoom = function()
10950
  {
10951
+ return parseInt(this.settings.min_zoom);
 
 
 
10952
  }
10953
 
10954
+ /**
10955
+ * Sets the min zoom of the map
10956
+ * @return void
10957
+ */
10958
+ WPGMZA.GoogleMap.prototype.setMinZoom = function(value)
10959
  {
10960
+ this.googleMap.setOptions({
10961
+ minZoom: value,
10962
+ maxZoom: this.getMaxZoom()
10963
+ });
 
 
 
 
 
 
 
 
 
10964
  }
10965
 
10966
+ /**
10967
+ * Gets the min zoom of the map
10968
+ * @return int
10969
+ */
10970
+ WPGMZA.GoogleMap.prototype.getMaxZoom = function()
10971
  {
10972
+ return parseInt(this.settings.max_zoom);
10973
  }
10974
 
10975
+ /**
10976
+ * Sets the min zoom of the map
10977
+ * @return void
10978
+ */
10979
+ WPGMZA.GoogleMap.prototype.setMaxZoom = function(value)
10980
  {
10981
+ this.googleMap.setOptions({
10982
+ minZoom: this.getMinZoom(),
10983
+ maxZoom: value
10984
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10985
  }
10986
 
10987
+ WPGMZA.GoogleMap.prototype.latLngToPixels = function(latLng)
10988
  {
10989
+ var map = this.googleMap;
10990
+ var nativeLatLng = new google.maps.LatLng({
10991
+ lat: parseFloat(latLng.lat),
10992
+ lng: parseFloat(latLng.lng)
10993
+ });
10994
+ var topRight = map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast());
10995
+ var bottomLeft = map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest());
10996
+ var scale = Math.pow(2, map.getZoom());
10997
+ var worldPoint = map.getProjection().fromLatLngToPoint(nativeLatLng);
10998
+ return {
10999
+ x: (worldPoint.x - bottomLeft.x) * scale,
11000
+ y: (worldPoint.y - topRight.y) * scale
11001
+ };
11002
  }
11003
 
11004
+ WPGMZA.GoogleMap.prototype.pixelsToLatLng = function(x, y)
11005
  {
11006
+ if(y == undefined)
 
 
11007
  {
11008
+ if("x" in x && "y" in x)
11009
  {
11010
+ y = x.y;
11011
+ x = x.x;
11012
  }
11013
  else
11014
+ console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)");
 
 
 
 
 
 
 
 
 
 
 
 
11015
  }
 
 
 
 
 
 
 
11016
 
11017
+ var map = this.googleMap;
11018
+ var topRight = map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast());
11019
+ var bottomLeft = map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest());
11020
+ var scale = Math.pow(2, map.getZoom());
11021
+ var worldPoint = new google.maps.Point(x / scale + bottomLeft.x, y / scale + topRight.y);
11022
+ var latLng = map.getProjection().fromPointToLatLng(worldPoint);
11023
+ return {
11024
+ lat: latLng.lat(),
11025
+ lng: latLng.lng()
11026
+ };
11027
  }
11028
 
11029
+ /**
11030
+ * Handle the map element resizing
11031
+ * @return void
11032
+ */
11033
+ WPGMZA.GoogleMap.prototype.onElementResized = function(event)
11034
  {
11035
+ if(!this.googleMap)
 
 
11036
  return;
11037
+ google.maps.event.trigger(this.googleMap, "resize");
 
 
 
 
 
 
 
11038
  }
11039
+
11040
+ WPGMZA.GoogleMap.prototype.enableAllInteractions = function()
11041
+ {
11042
+ var options = {};
11043
+
11044
+ options.scrollwheel = true;
11045
+ options.draggable = true;
11046
+ options.disableDoubleClickZoom = false;
 
 
11047
 
11048
+ this.googleMap.setOptions(options);
 
 
 
 
 
 
 
 
 
 
 
 
 
11049
  }
11050
 
11051
+ });
11052
+
11053
+ // js/v8/google-maps/google-marker.js
11054
+ /**
11055
+ * @namespace WPGMZA
11056
+ * @module GoogleMarker
11057
+ * @requires WPGMZA.Marker
11058
+ * @pro-requires WPGMZA.ProMarker
11059
+ */
11060
+ jQuery(function($) {
11061
+
11062
+ var Parent;
11063
+
11064
+ WPGMZA.GoogleMarker = function(row)
11065
  {
11066
  var self = this;
11067
 
11068
+ Parent.call(this, row);
 
 
 
 
11069
 
11070
+ this._opacity = 1.0;
11071
+
11072
+ var settings = {};
11073
+ if(row)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11074
  {
11075
+ for(var name in row)
11076
+ {
11077
+ if(row[name] instanceof WPGMZA.LatLng)
11078
+ {
11079
+ settings[name] = row[name].toGoogleLatLng();
11080
+ }
11081
+ else if(row[name] instanceof WPGMZA.Map || name == "icon")
11082
+ {
11083
+ // NB: Ignore map here, it's not a google.maps.Map, Google would throw an exception
11084
+ // NB: Ignore icon here, it conflicts with updateIcon in Pro
11085
+ }
11086
+ else
11087
+ settings[name] = row[name];
11088
+ }
11089
  }
11090
 
11091
+ this.googleMarker = new google.maps.Marker(settings);
11092
+ this.googleMarker.wpgmzaMarker = this;
 
 
 
 
11093
 
11094
+ this.googleMarker.setPosition(new google.maps.LatLng({
11095
+ lat: parseFloat(this.lat),
11096
+ lng: parseFloat(this.lng)
11097
+ }));
11098
 
11099
+ // this.googleMarker.setLabel(this.settings.label);
11100
+
11101
+ if(this.anim)
11102
+ this.googleMarker.setAnimation(this.anim);
11103
+ if(this.animation)
11104
+ this.googleMarker.setAnimation(this.animation);
11105
 
11106
+ google.maps.event.addListener(this.googleMarker, "click", function() {
11107
+ self.dispatchEvent("click");
11108
+ self.dispatchEvent("select");
11109
  });
 
 
 
 
 
 
 
 
 
11110
 
11111
+ google.maps.event.addListener(this.googleMarker, "mouseover", function() {
11112
+ self.dispatchEvent("mouseover");
 
11113
  });
11114
 
11115
+ google.maps.event.addListener(this.googleMarker, "dragend", function() {
11116
+ var googleMarkerPosition = self.googleMarker.getPosition();
11117
+
11118
+ self.setPosition({
11119
+ lat: googleMarkerPosition.lat(),
11120
+ lng: googleMarkerPosition.lng()
11121
+ });
11122
+
11123
+ self.dispatchEvent({
11124
+ type: "dragend",
11125
+ latLng: self.getPosition()
11126
+ });
11127
+ });
11128
 
11129
+ this.trigger("init");
11130
+ }
11131
+
11132
+ if(WPGMZA.isProVersion())
11133
+ Parent = WPGMZA.ProMarker;
11134
+ else
11135
+ Parent = WPGMZA.Marker;
11136
+ WPGMZA.GoogleMarker.prototype = Object.create(Parent.prototype);
11137
+ WPGMZA.GoogleMarker.prototype.constructor = WPGMZA.GoogleMarker;
11138
+
11139
+ Object.defineProperty(WPGMZA.GoogleMarker.prototype, "opacity", {
11140
 
11141
+ "get": function() {
11142
+ return this._opacity;
11143
+ },
11144
 
11145
+ "set": function(value) {
11146
+ this._opacity = value;
11147
+ this.googleMarker.setOpacity(value);
11148
+ }
11149
+
11150
+ });
 
 
 
11151
 
11152
+ WPGMZA.GoogleMarker.prototype.setLabel = function(label)
11153
  {
11154
+ if(!label)
11155
+ {
11156
+ this.googleMarker.setLabel(null);
11157
+ return;
11158
+ }
11159
 
11160
+ this.googleMarker.setLabel({
11161
+ text: label
11162
+ });
11163
 
11164
+ if(!this.googleMarker.getIcon())
11165
+ this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon);
11166
  }
11167
 
11168
  /**
11169
+ * Sets the position of the marker
11170
+ * @return void
11171
  */
11172
+ WPGMZA.GoogleMarker.prototype.setPosition = function(latLng)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11173
  {
11174
+ Parent.prototype.setPosition.call(this, latLng);
11175
+ this.googleMarker.setPosition({
11176
+ lat: this.lat,
11177
+ lng: this.lng
11178
+ });
11179
  }
11180
 
11181
+ /**
11182
+ * Sets the position offset of a marker
11183
+ * @return void
11184
+ */
11185
+ WPGMZA.GoogleMarker.prototype.updateOffset = function()
11186
  {
11187
  var self = this;
11188
+ var icon = this.googleMarker.getIcon();
11189
+ var img = new Image();
11190
+ var params;
11191
+ var x = this._offset.x;
11192
+ var y = this._offset.y;
11193
 
11194
+ if(!icon)
11195
+ icon = WPGMZA.settings.default_marker_icon;
 
11196
 
11197
+ if(typeof icon == "string")
11198
+ params = {
11199
+ url: icon
11200
+ };
11201
+ else
11202
+ params = icon;
11203
+
11204
+ img.onload = function()
11205
+ {
11206
+ var defaultAnchor = {
11207
+ x: img.width / 2,
11208
+ y: img.height
11209
+ };
11210
 
11211
+ params.anchor = new google.maps.Point(defaultAnchor.x - x, defaultAnchor.y - y);
 
 
 
 
 
 
 
 
 
11212
 
11213
+ self.googleMarker.setIcon(params);
11214
+ }
11215
 
11216
+ img.src = params.url;
 
 
 
 
 
11217
  }
11218
 
11219
+ WPGMZA.GoogleMarker.prototype.setOptions = function(options)
11220
  {
11221
+ this.googleMarker.setOptions(options);
 
 
 
11222
  }
11223
 
11224
+ /**
11225
+ * Set the marker animation
11226
+ * @return void
11227
+ */
11228
+ WPGMZA.GoogleMarker.prototype.setAnimation = function(animation)
 
 
 
11229
  {
11230
+ Parent.prototype.setAnimation.call(this, animation);
11231
+ this.googleMarker.setAnimation(animation);
 
 
11232
  }
11233
 
11234
+ /**
11235
+ * Sets the visibility of the marker
11236
+ * @return void
11237
+ */
11238
+ WPGMZA.GoogleMarker.prototype.setVisible = function(visible)
11239
+ {
11240
+ Parent.prototype.setVisible.call(this, visible);
 
 
 
 
 
 
 
 
 
 
 
11241
 
11242
+ this.googleMarker.setVisible(visible ? true : false);
11243
  }
11244
 
11245
+ WPGMZA.GoogleMarker.prototype.getVisible = function(visible)
11246
  {
11247
+ return this.googleMarker.getVisible();
11248
  }
11249
 
11250
+ WPGMZA.GoogleMarker.prototype.setDraggable = function(draggable)
11251
  {
11252
+ this.googleMarker.setDraggable(draggable);
 
 
 
 
11253
  }
11254
 
11255
+ WPGMZA.GoogleMarker.prototype.setOpacity = function(opacity)
 
 
 
 
 
 
 
 
 
 
11256
  {
11257
+ this.googleMarker.setOpacity(opacity);
 
 
 
 
 
 
 
 
 
11258
  }
11259
 
 
 
 
11260
  });
11261
 
11262
+ // js/v8/google-maps/google-modern-store-locator-circle.js
11263
  /**
11264
  * @namespace WPGMZA
11265
+ * @module GoogleModernStoreLocatorCircle
11266
+ * @requires WPGMZA.ModernStoreLocatorCircle
 
11267
  */
11268
  jQuery(function($) {
11269
 
11270
+ WPGMZA.GoogleModernStoreLocatorCircle = function(map, settings)
 
 
11271
  {
11272
  var self = this;
11273
 
11274
+ WPGMZA.ModernStoreLocatorCircle.call(this, map, settings);
 
 
11275
 
11276
+ this.intervalID = setInterval(function() {
 
 
 
 
 
 
11277
 
11278
+ var mapSize = {
11279
+ width: $(self.mapElement).width(),
11280
+ height: $(self.mapElement).height()
11281
+ };
 
 
 
 
 
 
 
 
11282
 
11283
+ if(mapSize.width == self.mapSize.width && mapSize.height == self.mapSize.height)
11284
+ return;
11285
+
11286
+ self.canvasLayer.resize_();
11287
+ self.canvasLayer.draw();
11288
+
11289
+ self.mapSize = mapSize;
11290
+
11291
+ }, 1000);
 
 
11292
 
11293
+ $(document).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function() {
11294
+
11295
+ self.canvasLayer.resize_();
11296
+ self.canvasLayer.draw();
11297
+
11298
  });
11299
  }
11300
 
11301
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype = Object.create(WPGMZA.ModernStoreLocatorCircle.prototype);
11302
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor = WPGMZA.GoogleModernStoreLocatorCircle;
 
 
11303
 
11304
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer = function()
 
 
 
11305
  {
11306
+ var self = this;
 
 
 
 
 
11307
 
11308
+ if(this.canvasLayer)
11309
+ {
11310
+ this.canvasLayer.setMap(null);
11311
+ this.canvasLayer.setAnimate(false);
11312
+ }
11313
+
11314
+ this.canvasLayer = new CanvasLayer({
11315
+ map: this.map.googleMap,
11316
+ resizeHandler: function(event) {
11317
+ self.onResize(event);
11318
+ },
11319
+ updateHandler: function(event) {
11320
+ self.onUpdate(event);
11321
+ },
11322
+ animate: true,
11323
+ resolutionScale: this.getResolutionScale()
11324
+ });
11325
  }
11326
 
11327
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions = function(options)
11328
  {
11329
+ WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this, options);
11330
+
11331
+ this.canvasLayer.scheduleUpdate();
 
11332
  }
11333
 
11334
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition = function(position)
11335
  {
11336
+ WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this, position);
11337
 
11338
+ this.canvasLayer.scheduleUpdate();
11339
  }
11340
 
11341
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius = function(radius)
11342
  {
11343
+ WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this, radius);
 
 
 
 
 
 
 
 
 
 
 
 
 
11344
 
11345
+ this.canvasLayer.scheduleUpdate();
11346
  }
11347
 
11348
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius = function(km)
 
 
 
 
 
 
 
 
 
 
 
 
11349
  {
11350
+ var multiplierAtEquator = 0.006395;
11351
+ var spherical = google.maps.geometry.spherical;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11352
 
11353
+ var center = this.settings.center;
11354
+ var equator = new WPGMZA.LatLng({
11355
+ lat: 0.0,
11356
+ lng: 0.0
11357
+ });
11358
+ var latitude = new WPGMZA.LatLng({
11359
+ lat: center.lat,
11360
+ lng: 0.0
11361
  });
11362
 
11363
+ var offsetAtEquator = spherical.computeOffset(equator.toGoogleLatLng(), km * 1000, 90);
11364
+ var offsetAtLatitude = spherical.computeOffset(latitude.toGoogleLatLng(), km * 1000, 90);
11365
+
11366
+ var factor = offsetAtLatitude.lng() / offsetAtEquator.lng();
11367
+ var result = km * multiplierAtEquator * factor;
11368
+
11369
+ if(isNaN(result))
11370
+ throw new Error("here");
11371
+
11372
+ return result;
11373
  }
11374
 
11375
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions = function()
11376
+ {
11377
+ return {
11378
+ width: this.canvasLayer.canvas.width,
11379
+ height: this.canvasLayer.canvas.height
11380
+ };
11381
+ }
11382
 
11383
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset = function()
11384
  {
11385
+ var projection = this.map.googleMap.getProjection();
11386
+ var position = projection.fromLatLngToPoint(this.canvasLayer.getTopLeft());
11387
 
11388
+ return {
11389
+ x: -position.x,
11390
+ y: -position.y
11391
+ };
 
 
 
11392
  }
11393
 
11394
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels = function()
11395
  {
11396
+ var center = new WPGMZA.LatLng(this.settings.center);
11397
+ var projection = this.map.googleMap.getProjection();
11398
+ return projection.fromLatLngToPoint(center.toGoogleLatLng());
 
11399
  }
11400
 
11401
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext = function(type)
11402
  {
11403
+ return this.canvasLayer.canvas.getContext("2d");
11404
  }
11405
 
11406
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale = function()
11407
  {
11408
+ return Math.pow(2, this.map.getZoom()) * this.getResolutionScale();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11409
  }
11410
 
11411
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible = function(visible)
11412
  {
11413
+ WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this, visible);
 
 
 
 
 
 
 
 
 
 
 
 
 
11414
 
11415
+ this.canvasLayer.scheduleUpdate();
11416
  }
11417
 
11418
+ WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy = function()
 
 
 
 
 
 
 
 
 
 
11419
  {
11420
+ this.canvasLayer.setMap(null);
11421
+ this.canvasLayer = null;
11422
 
11423
+ clearInterval(this.intervalID);
11424
  }
11425
 
11426
  });
11427
 
11428
+ // js/v8/google-maps/google-modern-store-locator.js
11429
  /**
11430
  * @namespace WPGMZA
11431
+ * @module GoogleModernStoreLocator
11432
+ * @requires WPGMZA.ModernStoreLocator
11433
  */
11434
  jQuery(function($) {
11435
 
11436
+ WPGMZA.GoogleModernStoreLocator = function(map_id)
11437
  {
11438
+ var googleMap, self = this;
 
 
 
 
 
 
 
 
 
11439
 
11440
+ this.map = WPGMZA.getMapByID(map_id);
 
 
 
 
 
 
 
11441
 
11442
+ WPGMZA.ModernStoreLocator.call(this, map_id);
 
 
11443
 
11444
+ var options = {
11445
+ fields: ["name", "formatted_address"],
11446
+ types: ["geocode"]
11447
+ };
11448
+ var restrict = wpgmaps_localize[map_id]["other_settings"]["wpgmza_store_locator_restrict"];
11449
 
11450
+ this.addressInput = $(this.element).find(".addressInput, #addressInput")[0];
 
11451
 
11452
+ if(this.addressInput)
11453
  {
11454
+ if(restrict && restrict.length)
11455
+ options.componentRestrictions = {
11456
+ country: restrict
11457
+ };
11458
+
11459
+ this.autoComplete = new google.maps.places.Autocomplete(
11460
+ this.addressInput,
11461
+ options
11462
+ );
11463
  }
 
11464
 
11465
+ // Positioning for Google
11466
+ this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11467
  }
11468
 
11469
+ WPGMZA.GoogleModernStoreLocator.prototype = Object.create(WPGMZA.ModernStoreLocator.prototype);
11470
+ WPGMZA.GoogleModernStoreLocator.prototype.constructor = WPGMZA.GoogleModernStoreLocator;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11471
 
11472
+ });
11473
+
11474
+ // js/v8/google-maps/google-polygon.js
11475
+ /**
11476
+ * @namespace WPGMZA
11477
+ * @module GooglePolygon
11478
+ * @requires WPGMZA.Polygon
11479
+ * @pro-requires WPGMZA.ProPolygon
11480
+ */
11481
+ jQuery(function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11482
 
11483
+ var Parent;
11484
+
11485
+ WPGMZA.GooglePolygon = function(options, googlePolygon)
11486
  {
11487
  var self = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11488
 
11489
+ Parent.call(this, options, googlePolygon);
11490
 
11491
+ if(googlePolygon)
11492
+ {
11493
+ this.googlePolygon = googlePolygon;
11494
+ }
11495
+ else
11496
+ {
11497
+ this.googlePolygon = new google.maps.Polygon();
11498
+
11499
+ if(options)
11500
+ {
11501
+ var googleOptions = $.extend({}, options);
11502
+
11503
+ if(options.polydata)
11504
+ googleOptions.paths = this.parseGeometry(options.polydata);
11505
+
11506
+ if(options.linecolor)
11507
+ googleOptions.strokeColor = "#" + options.linecolor;
11508
+
11509
+ if(options.lineopacity)
11510
+ googleOptions.strokeOpacity = parseFloat(options.lineopacity);
11511
+
11512
+ if(options.fillcolor)
11513
+ googleOptions.fillColor = "#" + options.fillcolor;
11514
+
11515
+ if(options.opacity)
11516
+ googleOptions.fillOpacity = parseFloat(options.opacity);
11517
+
11518
+ this.googlePolygon.setOptions(googleOptions);
11519
+ }
11520
+ }
11521
 
11522
+ this.googlePolygon.wpgmzaPolygon = this;
11523
+
11524
+ google.maps.event.addListener(this.googlePolygon, "click", function() {
11525
+ self.dispatchEvent({type: "click"});
11526
+ });
11527
  }
11528
 
11529
+ if(WPGMZA.isProVersion())
11530
+ Parent = WPGMZA.ProPolygon;
11531
+ else
11532
+ Parent = WPGMZA.Polygon;
 
 
11533
 
11534
+ WPGMZA.GooglePolygon.prototype = Object.create(Parent.prototype);
11535
+ WPGMZA.GooglePolygon.prototype.constructor = WPGMZA.GooglePolygon;
11536
+
11537
+ /**
11538
+ * Returns true if the polygon is editable
11539
+ * @return void
11540
+ */
11541
+ WPGMZA.GooglePolygon.prototype.getEditable = function()
11542
+ {
11543
+ return this.googlePolygon.getOptions().editable;
11544
+ }
11545
+
11546
+ /**
11547
+ * Sets the editable state of the polygon
11548
+ * @return void
11549
+ */
11550
+ WPGMZA.GooglePolygon.prototype.setEditable = function(value)
11551
+ {
11552
+ this.googlePolygon.setOptions({editable: value});
11553
+ }
11554
+
11555
+ /**
11556
+ * Returns the polygon represented by a JSON object
11557
+ * @return object
11558
+ */
11559
+ WPGMZA.GooglePolygon.prototype.toJSON = function()
11560
+ {
11561
+ var result = WPGMZA.Polygon.prototype.toJSON.call(this);
11562
+
11563
+ result.points = [];
11564
+
11565
+ // TODO: Support holes using multiple paths
11566
+ var path = this.googlePolygon.getPath();
11567
+ for(var i = 0; i < path.getLength(); i++)
11568
+ {
11569
+ var latLng = path.getAt(i);
11570
+ result.points.push({
11571
+ lat: latLng.lat(),
11572
+ lng: latLng.lng()
11573
+ });
11574
+ }
11575
+
11576
+ return result;
11577
+ }
11578
+
11579
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11580
 
11581
+ // js/v8/google-maps/google-polyline.js
11582
+ /**
11583
+ * @namespace WPGMZA
11584
+ * @module GooglePolyline
11585
+ * @requires WPGMZA.Polyline
11586
+ */
11587
+ jQuery(function($) {
11588
+
11589
+ WPGMZA.GooglePolyline = function(options, googlePolyline)
11590
+ {
11591
+ var self = this;
11592
+
11593
+ WPGMZA.Polyline.call(this, options, googlePolyline);
11594
+
11595
+ if(googlePolyline)
11596
+ {
11597
+ this.googlePolyline = googlePolyline;
11598
+ }
11599
+ else
11600
+ {
11601
+ this.googlePolyline = new google.maps.Polyline(this.settings);
11602
 
11603
+ if(options)
11604
+ {
11605
+ var googleOptions = $.extend({}, options);
11606
+
11607
+ if(options.polydata)
11608
+ googleOptions.path = this.parseGeometry(options.polydata);
11609
+
11610
+ if(options.linecolor)
11611
+ googleOptions.strokeColor = "#" + options.linecolor;
11612
+
11613
+ if(options.linethickness)
11614
+ googleOptions.strokeWeight = parseInt(options.linethickness);
11615
+
11616
+ if(options.opacity)
11617
+ googleOptions.strokeOpacity = parseFloat(options.opacity);
11618
+ }
 
 
11619
 
11620
+ if(options && options.polydata)
11621
+ {
11622
+ var path = this.parseGeometry(options.polydata);
11623
+ this.setPoints(path);
11624
+ }
11625
+ }
11626
+
11627
+ this.googlePolyline.wpgmzaPolyline = this;
11628
+
11629
+ google.maps.event.addListener(this.googlePolyline, "click", function() {
11630
+ self.dispatchEvent({type: "click"});
11631
+ });
11632
+ }
11633
+
11634
+ WPGMZA.GooglePolyline.prototype = Object.create(WPGMZA.Polyline.prototype);
11635
+ WPGMZA.GooglePolyline.prototype.constructor = WPGMZA.GooglePolyline;
11636
+
11637
+ WPGMZA.GooglePolyline.prototype.setEditable = function(value)
11638
+ {
11639
+ this.googlePolyline.setOptions({editable: value});
11640
+ }
11641
+
11642
+ WPGMZA.GooglePolyline.prototype.setPoints = function(points)
11643
+ {
11644
+ this.googlePolyline.setOptions({path: points});
11645
+ }
11646
+
11647
+ WPGMZA.GooglePolyline.prototype.toJSON = function()
11648
+ {
11649
+ var result = WPGMZA.Polyline.prototype.toJSON.call(this);
11650
+
11651
+ result.points = [];
11652
+
11653
+ var path = this.googlePolyline.getPath();
11654
+ for(var i = 0; i < path.getLength(); i++)
11655
+ {
11656
+ var latLng = path.getAt(i);
11657
+ result.points.push({
11658
+ lat: latLng.lat(),
11659
+ lng: latLng.lng()
11660
+ });
11661
+ }
11662
+
11663
+ return result;
11664
+ }
11665
+
11666
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11667
 
11668
+ // js/v8/google-maps/google-text.js
11669
+ /**
11670
+ * @namespace WPGMZA
11671
+ * @module GoogleText
11672
+ * @requires WPGMZA.Text
11673
+ */
11674
+ jQuery(function($) {
11675
+
11676
+ WPGMZA.GoogleText = function(options)
11677
+ {
11678
+ WPGMZA.Text.apply(this, arguments);
11679
+
11680
+ this.overlay = new WPGMZA.GoogleTextOverlay(options);
11681
+ }
11682
+
11683
+ WPGMZA.extend(WPGMZA.GoogleText, WPGMZA.Text);
11684
+
11685
+ });
11686
 
11687
+ // js/v8/google-maps/google-text-overlay.js
11688
+ /**
11689
+ * @namespace WPGMZA
11690
+ * @module GoogleTextOverlay
11691
+ * @requires WPGMZA.GoogleText
11692
+ */
11693
+ jQuery(function($) {
11694
+
11695
+ WPGMZA.GoogleTextOverlay = function(options)
11696
+ {
11697
+ this.element = $("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>");
11698
+
11699
+ if(!options)
11700
+ options = {};
11701
+
11702
+ if(options.position)
11703
+ this.position = options.position;
11704
 
11705
+ if(options.text)
11706
+ this.element.find(".wpgmza-inner").text(options.text);
11707
+
11708
+ if(options.map)
11709
+ this.setMap(options.map.googleMap);
11710
  }
11711
 
11712
+ if(window.google && google.maps && google.maps.OverlayView)
11713
+ WPGMZA.GoogleTextOverlay.prototype = new google.maps.OverlayView();
11714
+
11715
+ WPGMZA.GoogleTextOverlay.prototype.onAdd = function()
11716
  {
11717
+ var overlayProjection = this.getProjection();
11718
+ var position = overlayProjection.fromLatLngToDivPixel(this.position.toGoogleLatLng());
11719
 
11720
+ this.element.css({
11721
+ position: "absolute",
11722
+ left: position.x + "px",
11723
+ top: position.y + "px"
11724
+ });
11725
+
11726
+ var panes = this.getPanes();
11727
+ panes.floatPane.appendChild(this.element[0]);
11728
  }
11729
 
11730
+ WPGMZA.GoogleTextOverlay.prototype.draw = function()
11731
  {
11732
+ var overlayProjection = this.getProjection();
11733
+ var position = overlayProjection.fromLatLngToDivPixel(this.position.toGoogleLatLng());
11734
+
11735
+ this.element.css({
11736
+ position: "absolute",
11737
+ left: position.x + "px",
11738
+ top: position.y + "px"
11739
+ });
11740
+ }
11741
+
11742
+ WPGMZA.GoogleTextOverlay.prototype.onRemove = function()
11743
+ {
11744
+ this.element.remove();
11745
+ }
11746
+
11747
+ WPGMZA.GoogleTextOverlay.prototype.hide = function()
11748
+ {
11749
+ this.element.hide();
11750
+ }
11751
+
11752
+ WPGMZA.GoogleTextOverlay.prototype.show = function()
11753
+ {
11754
+ this.element.show();
11755
+ }
11756
+
11757
+ WPGMZA.GoogleTextOverlay.prototype.toggle = function()
11758
+ {
11759
+ if(this.element.is(":visible"))
11760
+ this.element.hide();
11761
+ else
11762
+ this.element.show();
11763
  }
11764
 
11765
  });
11766
 
11767
+ // js/v8/google-maps/google-vertex-context-menu.js
11768
  /**
11769
  * @namespace WPGMZA
11770
+ * @module GoogleVertexContextMenu
11771
+ * @requires wpgmza_api_call
11772
  */
11773
  jQuery(function($) {
11774
 
11775
+ if(WPGMZA.settings.engine != "google-maps")
11776
+ return;
11777
+
11778
+ if(WPGMZA.googleAPIStatus && WPGMZA.googleAPIStatus.code == "USER_CONSENT_NOT_GIVEN")
11779
+ return;
11780
+
11781
+ WPGMZA.GoogleVertexContextMenu = function(mapEditPage)
11782
  {
11783
  var self = this;
11784
 
11785
+ this.mapEditPage = mapEditPage;
 
 
 
 
 
 
 
 
11786
 
11787
+ this.element = document.createElement("div");
11788
+ this.element.className = "wpgmza-vertex-context-menu";
11789
+ this.element.innerHTML = "Delete";
11790
 
11791
+ google.maps.event.addDomListener(this.element, "click", function(event) {
11792
+ self.removeVertex();
11793
+ event.preventDefault();
11794
+ event.stopPropagation();
11795
+ return false;
 
11796
  });
11797
  }
11798
 
11799
+ WPGMZA.GoogleVertexContextMenu.prototype = new google.maps.OverlayView();
 
 
 
 
 
 
11800
 
11801
+ WPGMZA.GoogleVertexContextMenu.prototype.onAdd = function()
11802
  {
11803
  var self = this;
11804
+ var map = this.getMap();
 
 
 
 
 
 
11805
 
11806
+ this.getPanes().floatPane.appendChild(this.element);
11807
+ this.divListener = google.maps.event.addDomListener(map.getDiv(), "mousedown", function(e) {
11808
+ if(e.target != self.element)
11809
+ self.close();
11810
+ }, true);
 
11811
  }
11812
 
11813
+ WPGMZA.GoogleVertexContextMenu.prototype.onRemove = function()
11814
  {
11815
+ google.maps.event.removeListener(this.divListener);
11816
+ this.element.parentNode.removeChild(this.element);
 
 
 
 
 
 
 
11817
 
11818
+ this.set("position");
11819
+ this.set("path");
11820
+ this.set("vertex");
 
 
 
11821
  }
11822
 
11823
+ WPGMZA.GoogleVertexContextMenu.prototype.open = function(map, path, vertex)
 
11824
  {
11825
+ this.set('position', path.getAt(vertex));
11826
+ this.set('path', path);
11827
+ this.set('vertex', vertex);
11828
+ this.setMap(map);
11829
+ this.draw();
 
 
 
 
 
 
 
 
 
 
 
11830
  }
11831
 
11832
+ WPGMZA.GoogleVertexContextMenu.prototype.close = function()
11833
  {
11834
+ this.setMap(null);
11835
  }
11836
 
11837
+ WPGMZA.GoogleVertexContextMenu.prototype.draw = function()
11838
  {
11839
+ var position = this.get('position');
11840
+ var projection = this.getProjection();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11841
 
11842
+ if (!position || !projection)
11843
+ return;
 
11844
 
11845
+ var point = projection.fromLatLngToDivPixel(position);
11846
+ this.element.style.top = point.y + 'px';
11847
+ this.element.style.left = point.x + 'px';
11848
+ }
11849
+
11850
+ WPGMZA.GoogleVertexContextMenu.prototype.removeVertex = function()
11851
+ {
11852
+ var path = this.get('path');
11853
+ var vertex = this.get('vertex');
11854
 
11855
+ if (!path || vertex == undefined) {
11856
+ this.close();
11857
+ return;
 
 
 
 
 
 
 
 
 
 
11858
  }
11859
 
11860
+ path.removeAt(vertex);
11861
+ this.close();
11862
  }
11863
 
 
 
 
 
 
 
 
 
11864
  });
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></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)]},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()}},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(fullInstanceName=WPGMZA[engine+pro+instanceName]?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]?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){return!WPGMZA.isProVersion()||MYMAP.map instanceof WPGMZA.Map?MYMAP.map:MYMAP[id].map},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 isFullScreen},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&#]*)");return(m=window.location.href.match(regex))?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)}};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}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("click",".wpgmza_edit_btn",function(){WPGMZA.animateScroll("#wpgmaps_tabs_markers")})});var isFullScreen=!1;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)})}$(document).on("fullscreenchange",function(){isFullScreen=!!document.fullscreenElement}),$(window).on("load",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").each(function(index,el){$(el).after($(warning))})}}),$(window).on("scroll",onScroll),$(window).on("load",onScroll),WPGMZA.refreshOnLoad&&window.location.reload()}),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()?(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.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.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(mapObject){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),this.on("infowindowopen",function(event){self.onOpen(event)}),mapObject&&(this.mapObject=mapObject,this.state=WPGMZA.InfoWindow.STATE_CLOSED,mapObject.map?setTimeout(function(){self.onMapObjectAdded(event)},100):mapObject.addEventListener("added",function(event){self.onMapObjectAdded(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(mapObject){return new(this.getConstructor())(mapObject)},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="";this.mapObject instanceof WPGMZA.Marker&&(html=this.mapObject.address),callback(html)},WPGMZA.InfoWindow.prototype.open=function(map,mapObject){return this.mapObject=mapObject,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&(!this.mapObject.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.onMapObjectAdded=function(){1==this.mapObject.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($){"map-edit"==WPGMZA.currentPage&&(WPGMZA.MapEditPage=function(){var self=this;if(this.themePanel=new WPGMZA.ThemePanel,this.themeEditor=new WPGMZA.ThemeEditor,this.map=WPGMZA.maps[0],"yes"==WPGMZA.settings.wpgmza_settings_map_scroll||"yes"==WPGMZA.settings.wpgmza_settings_map_draggable||"yes"==WPGMZA.settings.wpgmza_settings_map_clickzoom){var diplay_enable_interactions_notice=$("<div class='notice notice-info wpgmza_disabled_interactions_notice' style= 'height: 45px; padding: 7px 5px 2px 5px;'><p style='float: left; padding-top: 10px;'>"+WPGMZA.localized_strings.disabled_interactions_notice+"</p><a class='button button-primary enable_interactions_notice_button' style='float: right;'>"+WPGMZA.localized_strings.disabled_interactions_button+"</a></div>");$(".wpgmza_map").after(diplay_enable_interactions_notice),$(".enable_interactions_notice_button").on("click",function(){WPGMZA.mapEditPage.map.enableAllInteractions(),$(diplay_enable_interactions_notice).fadeOut("slow");var successNotice=$("<div class='notice notice-success'><p>"+WPGMZA.localized_strings.interactions_enabled_notice+"</p></div>");$(WPGMZA.mapEditPage.map.element).after(successNotice),$(successNotice).delay(2e3).fadeIn("slow"),$(successNotice).delay(4e3).fadeOut("slow")})}$("#wpgmza_max_zoom, #wpgmza_min_zoom").on("change input",function(event){self.onZoomLimitChanged(event)})},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.onZoomLimitChanged=function(event){this.map.setOptions({minZoom:$("#wpgmza_max_zoom").val(),maxZoom:$("#wpgmza_min_zoom").val()})},$(window).on("load",function(event){WPGMZA.mapEditPage=WPGMZA.MapEditPage.createInstance()}))}),jQuery(function($){WPGMZA.MapObject=function(row){if(WPGMZA.assertInstanceOf(this,"MapObject"),WPGMZA.EventDispatcher.call(this),this.id=-1,this.map_id=null,this.guid=WPGMZA.guid(),this.modified=!0,this.settings={},row)for(var name in row)if("settings"==name){if(null==row.settings)this.settings={};else switch(typeof row.settings){case"string":this.settings=JSON.parse(row[name]);break;case"object":this.settings=row[name];break;default:throw new Error("Don't know how to interpret settings")}for(var name in this.settings){var value=this.settings[name];String(value).match(/^-?\d+$/)&&(this.settings[name]=parseInt(value))}}else this[name]=row[name]},WPGMZA.MapObject.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MapObject.prototype.constructor=WPGMZA.MapObject,WPGMZA.MapObject.prototype.parseGeometry=function(string){var pairs,coords,results=[];if("object"==typeof string)return string;pairs=string.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(var i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.MapObject.prototype.toJSON=function(){return{id:this.id,guid:this.guid,settings:this.settings}}}),jQuery(function($){var Parent=WPGMZA.MapObject;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.Circle.prototype=Object.create(Parent.prototype),WPGMZA.Circle.prototype.constructor=WPGMZA.Circle,WPGMZA.Circle.createInstance=function(options){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options)},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.MapSettingsPage=function(){var self=this;this._keypressHistory=[],this.updateEngineSpecificControls(),this.updateGDPRControls(),$("#wpgmza-developer-mode").hide(),$(window).on("keypress",function(event){self.onKeyPress(event)}),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$("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()})},WPGMZA.MapSettingsPage.createInstance=function(){return new WPGMZA.MapSettingsPage},WPGMZA.MapSettingsPage.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.MapSettingsPage.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.MapSettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},WPGMZA.MapSettingsPage.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||($("#wpgmza-developer-mode").show(),this._developerModeRevealed=!0)},jQuery(function($){window.location.href.match(/wp-google-maps-menu-settings/)&&(WPGMZA.mapSettingsPage=WPGMZA.MapSettingsPage.createInstance(),jQuery(document).ready(function(){jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.mapSettingsPage.flushGeocodeCache()})}))})}),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_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));var options={zoom:zoom,center:latLng};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.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.zoomControl=!("yes"==this.wpgmza_settings_map_zoom),options.panControl=!("yes"==this.wpgmza_settings_map_pan),options.mapTypeControl=!("yes"==this.wpgmza_settings_map_type),options.streetViewControl=!("yes"==this.wpgmza_settings_map_streetview),options.fullscreenControl=!("yes"==this.wpgmza_settings_map_full_screen_control),options.draggable=!("yes"==this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom="yes"==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?options.gestureHandling="greedy":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){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).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"))}catch(e){console.warn("Error parsing shortcode attributes")}WPGMZA.getCurrentPage()!=WPGMZA.PAGE_MAP_EDIT&&this.initStoreLocator(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this)},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,"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.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.setOptions=function(options){for(var name in options)this.settings[name]=options[name]};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){$(this.element).css({width:width}),$(this.engineElement).css({width:"100%",height:height})},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,this.markers.splice(this.markers.indexOf(marker),1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},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.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.nudge=function(x,y){var nudged=this.nudgeLatLng(this.getCenter(),x,y);this.setCenter(nudged)},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.hasVisibleMarkers=function(event){var markers_visible=0;for(var marker_id in marker_array){var marker=marker_array[marker_id];if(marker.isFilterable&&marker.getMap()){markers_visible++;break}}return 0<markers_visible},WPGMZA.Map.prototype.closeAllInfoWindows=function(){this.markers.forEach(function(marker){marker.infoWindow&&marker.infoWindow.close()})}}),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").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()}})},$(window).on("load",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(){},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(results){}}),jQuery(function($){WPGMZA.MarkerPanel=function(element){this.element=element},$(window).on("load",function(event){WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT&&(WPGMZA.mapEditPage.markerPanel=new WPGMZA.MarkerPanel($("#wpgmza-marker-edit-panel")[0]))})}),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.MapObject.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.MapObject.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()},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)){window.marker_array||(window.marker_array={}),marker_array[this.map_id]||(marker_array[this.map_id]=[]),marker_array[this.map_id][this.id]=this,window.wpgmaps_localize_marker_data||(window.wpgmaps_localize_marker_data={}),wpgmaps_localize_marker_data[this.map_id]||(wpgmaps_localize_marker_data[this.map_id]=[]);var cloned=$.extend({marker_id:this.id},row);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(){this.map?"map-edit"==WPGMZA.currentPage&&!WPGMZA.pro_version||(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),(this.map.lastInteractedMarker=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){this.map.settings.info_window_open_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(animation){return this.settings.animation},WPGMZA.Marker.prototype.setAnimation=function(animation){this.settings.animation=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.MapObject.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=MYMAP[map_id].map:this.map=MYMAP.map,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:"#63AFF2",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="#63AFF2")},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"),wpgmaps_localize[map_id].other_settings.store_locator_query_string&&wpgmaps_localize[map_id].other_settings.store_locator_query_string.length&&addressInput.attr("placeholder",wpgmaps_localize[map_id].other_settings.store_locator_query_string),inner.append(addressInput);var button,titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=wpgmaps_localize[map_id].other_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.trigger("click"),searchLocations(map_id),map.storeLocator.onSearch(event))}),$(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)}),$(map.markerFilter).on("filteringcomplete",function(event){this.map.hasVisibleMarkers()||(this.map.settings.store_locator_not_found_message!=WPGMZA.localized_strings.zero_results&&""!=this.map.settings.store_locator_not_found_message?alert(this.map.settings.store_locator_not_found_message):alert(WPGMZA.localized_strings.zero_results))}),$("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,this.title=null,this.name=null,this.link=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,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)},WPGMZA.Polygon.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return $.extend(result,{name:this.name,title:this.title,link:this.link}),result}}),jQuery(function($){WPGMZA.Polyline=function(row,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),this.title=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(row,engineObject){return new(WPGMZA.Polyline.getConstructor())(row,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.MapObject.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($){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&&xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&&params.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.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: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."),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}})})}),jQuery(function($){WPGMZA.SettingsPage=function(){$("#wpgmza-global-settings").tabs()},WPGMZA.SettingsPage.createInstance=function(){return new WPGMZA.SettingsPage},$(window).on("load",function(event){var useLegacyHTML=WPGMZA.settings.useLegacyHTML||!window.location.href.match(/no-legacy-html/);WPGMZA.getCurrentPage()!=WPGMZA.PAGE_SETTINGS||useLegacyHTML||(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.element.wpgmzaStoreLocator=this).state=WPGMZA.StoreLocator.STATE_INITIAL,$(element).find(".wpgmza-not-found-msg").hide(),this.addressInput=WPGMZA.AddressInput.createInstance($(element).find("input.wpgmza-address")[0],map),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)})}),$(element).on("keypress","input",function(event){13==event.which&&(searchLocations(self.map.id),self.onSearch(event))}),$(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)})},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,"distanceUnits",{get:function(){return 1==this.map.settings.store_locator_distance?WPGMZA.Distance.MILES:WPGMZA.Distance.KILOMETERS}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return $("#radiusSelect, #radiusSelect_"+this.map.id).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}):(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){this.state=WPGMZA.StoreLocator.STATE_APPLIED},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this._bounds=null,this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){var params=event.filteringParams,marker=this.marker;marker&&marker.setVisible(!1),params.center&&marker&&(marker.setPosition(params.center),marker.setVisible(!0),marker.map!=this.map&&this.map.addMarker(marker));var circle=this.circle;if(circle){var factor=this.distanceUnits==WPGMZA.Distance.MILES?WPGMZA.Distance.KILOMETERS_PER_MILE:1;circle.setVisible(!1),params.center&&params.radius&&(circle.setRadius(params.radius*factor),circle.setCenter(params.center),circle.setVisible(!0),circle.map!=this.map&&this.map.addCircle(circle)),circle instanceof WPGMZA.ModernStoreLocatorCircle&&(circle.settings.radiusString=this.radius)}this.map.hasVisibleMarkers()?$(this.element).find(".wpgmza-not-found-msg").hide():$(this.element).find(".wpgmza-not-found-msg").show()}}),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"),this.element.length?"open-layers"!=WPGMZA.settings.engine?(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):this.element.remove():console.warn("No element to initialise theme editor on")},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_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],this.element.length?($("#wpgmza-theme-presets").owlCarousel({items:5,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")},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.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($){$(window).on("load",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.GoogleCircle=function(options,googleCircle){var self=this;WPGMZA.Circle.call(this,options,googleCircle),googleCircle?this.googleCircle=googleCircle:(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})}),options&&this.setOptions(options)},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},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.setOptions=function(options){var googleOptions={};delete(googleOptions=$.extend({},options)).map,delete googleOptions.center,options.center&&(googleOptions.center=new google.maps.LatLng({lat:parseFloat(options.center.lat),lng:parseFloat(options.center.lng)})),options.radius&&(googleOptions.radius=parseFloat(options.radius)),options.color&&(googleOptions.fillColor=options.color),options.opacity&&(googleOptions.fillOpacity=parseFloat(options.opacity),googleOptions.strokeOpacity=parseFloat(options.opacity)),this.googleCircle.setOptions(googleOptions),options.map&&options.map.addCircle(this)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){WPGMZA.Geocoder.call(this)},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getGoogleGeocoder=function(){return WPGMZA.CloudAPI&&WPGMZA.CloudAPI.isBeingUsed?new WPGMZA.CloudGeocoder:new google.maps.Geocoder},WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)throw new Error("No address specified");if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),this.getGoogleGeocoder().geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK||status==WPGMZA.CloudGeocoder.SUCCESS){var latLng,location=results[0].geometry.location,bounds=null;latLng={lat:location.lat(),lng:location.lng()},(bounds=results[0].geometry.bounds)&&(bounds=bounds instanceof google.maps.LatLngBounds?WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds):WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral(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=this.getGoogleGeocoder();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(mapObject){Parent.call(this,mapObject),this.setMapObject(mapObject)},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.setMapObject=function(mapObject){mapObject instanceof WPGMZA.Marker?this.googleObject=mapObject.googleMarker:mapObject instanceof WPGMZA.Polygon?this.googleObject=mapObject.googlePolygon:mapObject instanceof WPGMZA.Polyline&&(this.googleObject=mapObject.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.trigger("infowindowclose"))}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,mapObject){var self=this;if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setMapObject(mapObject),this.googleObject instanceof google.maps.Polygon||this.googleInfoWindow.open(this.mapObject.map.googleMap,this.googleObject);var intervalID,guid=WPGMZA.guid(),html="<div id='"+guid+"'>"+this.content+"</div>";return this.googleInfoWindow.setContent(html),intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaMapObject=self.mapObject,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;if(Parent.call(this,element,options),!window.google){var status=WPGMZA.googleAPIStatus,message="Google API not loaded";if(status&&status.message&&(message+=" - "+status.message),"USER_CONSENT_NOT_GIVEN"==status.code)return;throw $(element).html("<div class='notice notice-error'><p>"+WPGMZA.localized_strings.google_api_not_loaded+"<pre>"+message+"</pre></p></div>"),new Error(message)}this.loadGoogleMap(),options&&this.setOptions(options,!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),1==this.settings.transport&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.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)}),"1"==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(row){var self=this;Parent.call(this,row),this._opacity=1;var settings={};if(row)for(var name in row)row[name]instanceof WPGMZA.LatLng?settings[name]=row[name].toGoogleLatLng():row[name]instanceof WPGMZA.Map||"icon"==name||(settings[name]=row[name]);this.googleMarker=new google.maps.Marker(settings),(this.googleMarker.wpgmzaMarker=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()})}),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){this.map=WPGMZA.getMapByID(map_id),WPGMZA.ModernStoreLocator.call(this,map_id);var options={fields:["name","formatted_address"],types:["geocode"]},restrict=wpgmaps_localize[map_id].other_settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&(restrict&&restrict.length&&(options.componentRestrictions={country:restrict}),this.autoComplete=new google.maps.places.Autocomplete(this.addressInput,options)),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;if(Parent.call(this,options,googlePolygon),googlePolygon)this.googlePolygon=googlePolygon;else if(this.googlePolygon=new google.maps.Polygon,options){var googleOptions=$.extend({},options);options.polydata&&(googleOptions.paths=this.parseGeometry(options.polydata)),options.linecolor&&(googleOptions.strokeColor="#"+options.linecolor),options.lineopacity&&(googleOptions.strokeOpacity=parseFloat(options.lineopacity)),options.fillcolor&&(googleOptions.fillColor="#"+options.fillcolor),options.opacity&&(googleOptions.fillOpacity=parseFloat(options.opacity)),this.googlePolygon.setOptions(googleOptions)}this.googlePolygon.wpgmzaPolygon=this,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.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){this.googlePolygon.setOptions({editable:value})},WPGMZA.GooglePolygon.prototype.toJSON=function(){var result=WPGMZA.Polygon.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.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),googlePolyline)this.googlePolyline=googlePolyline;else{if(this.googlePolyline=new google.maps.Polyline(this.settings),options){var googleOptions=$.extend({},options);options.polydata&&(googleOptions.path=this.parseGeometry(options.polydata)),options.linecolor&&(googleOptions.strokeColor="#"+options.linecolor),options.linethickness&&(googleOptions.strokeWeight=parseInt(options.linethickness)),options.opacity&&(googleOptions.strokeOpacity=parseFloat(options.opacity))}if(options&&options.polydata){var path=this.parseGeometry(options.polydata);this.setPoints(path)}}this.googlePolyline.wpgmzaPolyline=this,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.setEditable=function(value){this.googlePolyline.setOptions({editable:value})},WPGMZA.GooglePolyline.prototype.setPoints=function(points){this.googlePolyline.setOptions({path:points})},WPGMZA.GooglePolyline.prototype.toJSON=function(){var result=WPGMZA.Polyline.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),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"}),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"})},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($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){this.center={lat:0,lng:0},this.radius=0,this.fillcolor="#ff0000",this.opacity=.6,Parent.call(this,options,olFeature),this.olStyle=new ol.style.Style(this.getStyleFromSettings()),this.vectorLayer3857=this.layer=new ol.layer.Vector({source:new ol.source.Vector,style:this.olStyle}),olFeature?this.olFeature=olFeature:this.recreate()},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,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)/2;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.getStyleFromSettings=function(){var params={};return this.opacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.fillColor,this.opacity)})),params},WPGMZA.OLCircle.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},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.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.recreate()}}),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),$.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(mapObject){var self=this;Parent.call(this,mapObject),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,mapObject){var self=this,latLng=mapObject.getPosition();if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.overlay&&this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!1}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.mapObject.map.olMap.addOverlay(this.overlay),$(this.element).show(),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&WPGMZA.getImageDimensions(mapObject.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.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){$(this.element).html("<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.mapObject.map.animateNudge(0,offset,self.mapObject.getPosition())}imgs.each(function(index,el){el.onload=function(){++numImagesLoaded!=numImages||inside(self.element,self.mapObject.map.element)||panIntoView()}}),0!=numImages||inside(self.element,self.mapObject.map.element)||panIntoView()}}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var marker,viewOptions=this.settings.toOLViewOptions();$(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("yes"!=self.settings.wpgmza_settings_map_draggable):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!self.settings.wpgmza_settings_map_clickzoom):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive("yes"!=self.settings.wpgmza_settings_map_scroll)},this),"greedy"!=this.settings.wpgmza_force_greedy_gestures&&"yes"!=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&&"yes"==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),"yes"!=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.storeLocator&&(marker=this.storeLocator.centerPointMarker)&&(this.olMap.addOverlay(marker.overlay),marker.setVisible(!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),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&&center.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(row){var self=this;Parent.call(this,row);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).attr("title",this.title),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.setLabel(this.settings.label),row&&row.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}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}),"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,mapElement=$(this.map.element),olViewportElement=mapElement.children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",mapElement.append(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),this.olStyle=new ol.style.Style,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].lng),parseFloat(paths[i].lat)]));this.olStyle=new ol.style.Style(this.getStyleFromSettings())}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({wpgmzaPolygon:this})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getStyleFromSettings=function(){var params={};return this.linecolor&&this.lineopacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA("#"+this.linecolor,this.lineopacity)})),this.opacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.fillcolor,this.opacity)})),params},WPGMZA.OLPolygon.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolygon.prototype.setEditable=function(editable){},WPGMZA.OLPolygon.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates()[0];result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(options,olFeature){if(WPGMZA.Polyline.call(this,options),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[];if(options&&(options.polydata||options.points)){var path;path=options.polydata?this.parseGeometry(options.polydata):options.points;for(var 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)]))}}var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),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]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this})},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity),width:parseInt(this.settings.strokeWeight)})),params},WPGMZA.OLPolyline.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolyline.prototype.setEditable=function(editable){},WPGMZA.OLPolyline.prototype.setPoints=function(points){this.olFeature&&this.layer.getSource().removeFeature(this.olFeature);for(var coordinates=[],i=0;i<points.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(points[i].lng),parseFloat(points[i].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)}),this.layer.getSource().addFeature(this.olFeature)},WPGMZA.OLPolyline.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates();result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){WPGMZA.OLText=function(){}}),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.")}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()},error:function(){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),self.onAJAXResponse(response)}};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.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")}},$(document).ready(function(event){$("[data-wpgmza-admin-marker-datatable]").each(function(index,el){WPGMZA.adminMarkerDataTable=WPGMZA.AdminMarkerDataTable.createInstance(el)})})});
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></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)]},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()}},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(fullInstanceName=WPGMZA[engine+pro+instanceName]?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]?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){return!WPGMZA.isProVersion()||MYMAP.map instanceof WPGMZA.Map?MYMAP.map:MYMAP[id].map},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 isFullScreen},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&#]*)");return(m=window.location.href.match(regex))?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)}};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}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("click",".wpgmza_edit_btn",function(){WPGMZA.animateScroll("#wpgmaps_tabs_markers")})});var isFullScreen=!1;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)})}$(document).on("fullscreenchange",function(){isFullScreen=!!document.fullscreenElement}),$(window).on("load",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").each(function(index,el){$(el).after($(warning))})}}),$(window).on("scroll",onScroll),$(window).on("load",onScroll),WPGMZA.refreshOnLoad&&window.location.reload()}),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()?(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.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.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(mapObject){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),this.on("infowindowopen",function(event){self.onOpen(event)}),mapObject&&(this.mapObject=mapObject,this.state=WPGMZA.InfoWindow.STATE_CLOSED,mapObject.map?setTimeout(function(){self.onMapObjectAdded(event)},100):mapObject.addEventListener("added",function(event){self.onMapObjectAdded(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(mapObject){return new(this.getConstructor())(mapObject)},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="";this.mapObject instanceof WPGMZA.Marker&&(html=this.mapObject.address),callback(html)},WPGMZA.InfoWindow.prototype.open=function(map,mapObject){return this.mapObject=mapObject,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&(!this.mapObject.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.onMapObjectAdded=function(){1==this.mapObject.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($){"map-edit"==WPGMZA.currentPage&&(WPGMZA.MapEditPage=function(){var self=this;if(this.themePanel=new WPGMZA.ThemePanel,this.themeEditor=new WPGMZA.ThemeEditor,this.map=WPGMZA.maps[0],"yes"==WPGMZA.settings.wpgmza_settings_map_scroll||"yes"==WPGMZA.settings.wpgmza_settings_map_draggable||"yes"==WPGMZA.settings.wpgmza_settings_map_clickzoom){var diplay_enable_interactions_notice=$("<div class='notice notice-info wpgmza_disabled_interactions_notice' style= 'height: 45px; padding: 7px 5px 2px 5px;'><p style='float: left; padding-top: 10px;'>"+WPGMZA.localized_strings.disabled_interactions_notice+"</p><a class='button button-primary enable_interactions_notice_button' style='float: right;'>"+WPGMZA.localized_strings.disabled_interactions_button+"</a></div>");$(".wpgmza_map").after(diplay_enable_interactions_notice),$(".enable_interactions_notice_button").on("click",function(){WPGMZA.mapEditPage.map.enableAllInteractions(),$(diplay_enable_interactions_notice).fadeOut("slow");var successNotice=$("<div class='notice notice-success'><p>"+WPGMZA.localized_strings.interactions_enabled_notice+"</p></div>");$(WPGMZA.mapEditPage.map.element).after(successNotice),$(successNotice).delay(2e3).fadeIn("slow"),$(successNotice).delay(4e3).fadeOut("slow")})}$("#wpgmza_max_zoom, #wpgmza_min_zoom").on("change input",function(event){self.onZoomLimitChanged(event)})},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.onZoomLimitChanged=function(event){this.map.setOptions({minZoom:$("#wpgmza_max_zoom").val(),maxZoom:$("#wpgmza_min_zoom").val()})},$(window).on("load",function(event){WPGMZA.mapEditPage=WPGMZA.MapEditPage.createInstance()}))}),jQuery(function($){WPGMZA.MapObject=function(row){if(WPGMZA.assertInstanceOf(this,"MapObject"),WPGMZA.EventDispatcher.call(this),this.id=-1,this.map_id=null,this.guid=WPGMZA.guid(),this.modified=!0,this.settings={},row)for(var name in row)if("settings"==name){if(null==row.settings)this.settings={};else switch(typeof row.settings){case"string":this.settings=JSON.parse(row[name]);break;case"object":this.settings=row[name];break;default:throw new Error("Don't know how to interpret settings")}for(var name in this.settings){var value=this.settings[name];String(value).match(/^-?\d+$/)&&(this.settings[name]=parseInt(value))}}else this[name]=row[name]},WPGMZA.MapObject.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MapObject.prototype.constructor=WPGMZA.MapObject,WPGMZA.MapObject.prototype.parseGeometry=function(string){var pairs,coords,results=[];if("object"==typeof string)return string;pairs=string.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(var i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.MapObject.prototype.toJSON=function(){return{id:this.id,guid:this.guid,settings:this.settings}}}),jQuery(function($){var Parent=WPGMZA.MapObject;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.Circle.prototype=Object.create(Parent.prototype),WPGMZA.Circle.prototype.constructor=WPGMZA.Circle,WPGMZA.Circle.createInstance=function(options){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options)},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.MapSettingsPage=function(){var self=this;this._keypressHistory=[],this.updateEngineSpecificControls(),this.updateGDPRControls(),$("#wpgmza-developer-mode").hide(),$(window).on("keypress",function(event){self.onKeyPress(event)}),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$("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()})},WPGMZA.MapSettingsPage.createInstance=function(){return new WPGMZA.MapSettingsPage},WPGMZA.MapSettingsPage.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.MapSettingsPage.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.MapSettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},WPGMZA.MapSettingsPage.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||($("#wpgmza-developer-mode").show(),this._developerModeRevealed=!0)},jQuery(function($){window.location.href.match(/wp-google-maps-menu-settings/)&&(WPGMZA.mapSettingsPage=WPGMZA.MapSettingsPage.createInstance(),jQuery(document).ready(function(){jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.mapSettingsPage.flushGeocodeCache()})}))})}),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_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));var options={zoom:zoom,center:latLng};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.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.zoomControl=!("yes"==this.wpgmza_settings_map_zoom),options.panControl=!("yes"==this.wpgmza_settings_map_pan),options.mapTypeControl=!("yes"==this.wpgmza_settings_map_type),options.streetViewControl=!("yes"==this.wpgmza_settings_map_streetview),options.fullscreenControl=!("yes"==this.wpgmza_settings_map_full_screen_control),options.draggable=!("yes"==this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom="yes"==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?options.gestureHandling="greedy":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){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).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"))}catch(e){console.warn("Error parsing shortcode attributes")}WPGMZA.getCurrentPage()!=WPGMZA.PAGE_MAP_EDIT&&this.initStoreLocator(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this)},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,"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.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.setOptions=function(options){for(var name in options)this.settings[name]=options[name]};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){$(this.element).css({width:width}),$(this.engineElement).css({width:"100%",height:height})},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");marker.map!==this&&console.error("Wrong map error"),marker.infoWindow&&marker.infoWindow.close(),marker.map=null,marker.parent=null,this.markers.splice(this.markers.indexOf(marker),1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},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.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.nudge=function(x,y){var nudged=this.nudgeLatLng(this.getCenter(),x,y);this.setCenter(nudged)},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.hasVisibleMarkers=function(event){var markers_visible=0;for(var marker_id in marker_array){var marker=marker_array[marker_id];if(marker.isFilterable&&marker.getMap()){markers_visible++;break}}return 0<markers_visible},WPGMZA.Map.prototype.closeAllInfoWindows=function(){this.markers.forEach(function(marker){marker.infoWindow&&marker.infoWindow.close()})}}),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").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()}})},$(window).on("load",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(){},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(results){}}),jQuery(function($){WPGMZA.MarkerPanel=function(element){this.element=element},$(window).on("load",function(event){WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT&&(WPGMZA.mapEditPage.markerPanel=new WPGMZA.MarkerPanel($("#wpgmza-marker-edit-panel")[0]))})}),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.MapObject.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.MapObject.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()},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)){window.marker_array||(window.marker_array={}),marker_array[this.map_id]||(marker_array[this.map_id]=[]),marker_array[this.map_id][this.id]=this,window.wpgmaps_localize_marker_data||(window.wpgmaps_localize_marker_data={}),wpgmaps_localize_marker_data[this.map_id]||(wpgmaps_localize_marker_data[this.map_id]=[]);var cloned=$.extend({marker_id:this.id},row);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(){this.map?"map-edit"==WPGMZA.currentPage&&!WPGMZA.pro_version||(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),(this.map.lastInteractedMarker=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){this.map.settings.info_window_open_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(animation){return this.settings.animation},WPGMZA.Marker.prototype.setAnimation=function(animation){this.settings.animation=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.MapObject.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=MYMAP[map_id].map:this.map=MYMAP.map,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:"#63AFF2",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="#63AFF2")},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"),wpgmaps_localize[map_id].other_settings.store_locator_query_string&&wpgmaps_localize[map_id].other_settings.store_locator_query_string.length&&addressInput.attr("placeholder",wpgmaps_localize[map_id].other_settings.store_locator_query_string),inner.append(addressInput);var button,titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=wpgmaps_localize[map_id].other_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.trigger("click"),searchLocations(map_id),map.storeLocator.onSearch(event))}),$(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)}),$(map.markerFilter).on("filteringcomplete",function(event){this.map.hasVisibleMarkers()||(this.map.settings.store_locator_not_found_message!=WPGMZA.localized_strings.zero_results&&""!=this.map.settings.store_locator_not_found_message?alert(this.map.settings.store_locator_not_found_message):alert(WPGMZA.localized_strings.zero_results))}),$("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,this.title=null,this.name=null,this.link=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,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)},WPGMZA.Polygon.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return $.extend(result,{name:this.name,title:this.title,link:this.link}),result}}),jQuery(function($){WPGMZA.Polyline=function(row,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),this.title=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(row,engineObject){return new(WPGMZA.Polyline.getConstructor())(row,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.MapObject.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($){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&&xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&&params.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.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: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."),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}})})}),jQuery(function($){WPGMZA.SettingsPage=function(){$("#wpgmza-global-settings").tabs()},WPGMZA.SettingsPage.createInstance=function(){return new WPGMZA.SettingsPage},$(window).on("load",function(event){var useLegacyHTML=WPGMZA.settings.useLegacyHTML||!window.location.href.match(/no-legacy-html/);WPGMZA.getCurrentPage()!=WPGMZA.PAGE_SETTINGS||useLegacyHTML||(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.element.wpgmzaStoreLocator=this).state=WPGMZA.StoreLocator.STATE_INITIAL,$(element).find(".wpgmza-not-found-msg").hide(),this.addressInput=WPGMZA.AddressInput.createInstance($(element).find("input.wpgmza-address")[0],map),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)})}),$(element).on("keypress","input",function(event){13==event.which&&(searchLocations(self.map.id),self.onSearch(event))}),$(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)})},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,"distanceUnits",{get:function(){return 1==this.map.settings.store_locator_distance?WPGMZA.Distance.MILES:WPGMZA.Distance.KILOMETERS}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return $("#radiusSelect, #radiusSelect_"+this.map.id).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}):(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){this.state=WPGMZA.StoreLocator.STATE_APPLIED},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this._bounds=null,this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){var params=event.filteringParams,marker=this.marker;marker&&marker.setVisible(!1),params.center&&marker&&(marker.setPosition(params.center),marker.setVisible(!0),marker.map!=this.map&&this.map.addMarker(marker));var circle=this.circle;if(circle){var factor=this.distanceUnits==WPGMZA.Distance.MILES?WPGMZA.Distance.KILOMETERS_PER_MILE:1;circle.setVisible(!1),params.center&&params.radius&&(circle.setRadius(params.radius*factor),circle.setCenter(params.center),circle.setVisible(!0),circle.map!=this.map&&this.map.addCircle(circle)),circle instanceof WPGMZA.ModernStoreLocatorCircle&&(circle.settings.radiusString=this.radius)}this.map.hasVisibleMarkers()?$(this.element).find(".wpgmza-not-found-msg").hide():$(this.element).find(".wpgmza-not-found-msg").show()}}),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"),this.element.length?"open-layers"!=WPGMZA.settings.engine?(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):this.element.remove():console.warn("No element to initialise theme editor on")},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_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],this.element.length?($("#wpgmza-theme-presets").owlCarousel({items:5,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")},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($){$(window).on("load",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.")}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()},error:function(){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),self.onAJAXResponse(response)}};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.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")}},$(document).ready(function(event){$("[data-wpgmza-admin-marker-datatable]").each(function(index,el){WPGMZA.adminMarkerDataTable=WPGMZA.AdminMarkerDataTable.createInstance(el)})})}),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){this.center={lat:0,lng:0},this.radius=0,this.fillcolor="#ff0000",this.opacity=.6,Parent.call(this,options,olFeature),this.olStyle=new ol.style.Style(this.getStyleFromSettings()),this.vectorLayer3857=this.layer=new ol.layer.Vector({source:new ol.source.Vector,style:this.olStyle}),olFeature?this.olFeature=olFeature:this.recreate()},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,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)/2;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.getStyleFromSettings=function(){var params={};return this.opacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.fillColor,this.opacity)})),params},WPGMZA.OLCircle.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},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.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.recreate()}}),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),$.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(mapObject){var self=this;Parent.call(this,mapObject),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,mapObject){var self=this,latLng=mapObject.getPosition();if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.overlay&&this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!1}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.mapObject.map.olMap.addOverlay(this.overlay),$(this.element).show(),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&WPGMZA.getImageDimensions(mapObject.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.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){$(this.element).html("<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.mapObject.map.animateNudge(0,offset,self.mapObject.getPosition())}imgs.each(function(index,el){el.onload=function(){++numImagesLoaded!=numImages||inside(self.element,self.mapObject.map.element)||panIntoView()}}),0!=numImages||inside(self.element,self.mapObject.map.element)||panIntoView()}}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var marker,viewOptions=this.settings.toOLViewOptions();$(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("yes"!=self.settings.wpgmza_settings_map_draggable):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!self.settings.wpgmza_settings_map_clickzoom):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive("yes"!=self.settings.wpgmza_settings_map_scroll)},this),"greedy"!=this.settings.wpgmza_force_greedy_gestures&&"yes"!=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&&"yes"==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),"yes"!=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.storeLocator&&(marker=this.storeLocator.centerPointMarker)&&(this.olMap.addOverlay(marker.overlay),marker.setVisible(!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),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&&center.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(row){var self=this;Parent.call(this,row);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).attr("title",this.title),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.setLabel(this.settings.label),row&&row.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}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}),"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,mapElement=$(this.map.element),olViewportElement=mapElement.children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",mapElement.append(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),this.olStyle=new ol.style.Style,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].lng),parseFloat(paths[i].lat)]));this.olStyle=new ol.style.Style(this.getStyleFromSettings())}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({wpgmzaPolygon:this})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getStyleFromSettings=function(){var params={};return this.linecolor&&this.lineopacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA("#"+this.linecolor,this.lineopacity)})),this.opacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.fillcolor,this.opacity)})),params},WPGMZA.OLPolygon.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolygon.prototype.setEditable=function(editable){},WPGMZA.OLPolygon.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates()[0];result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(options,olFeature){if(WPGMZA.Polyline.call(this,options),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[];if(options&&(options.polydata||options.points)){var path;path=options.polydata?this.parseGeometry(options.polydata):options.points;for(var 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)]))}}var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),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]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this})},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity),width:parseInt(this.settings.strokeWeight)})),params},WPGMZA.OLPolyline.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolyline.prototype.setEditable=function(editable){},WPGMZA.OLPolyline.prototype.setPoints=function(points){this.olFeature&&this.layer.getSource().removeFeature(this.olFeature);for(var coordinates=[],i=0;i<points.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(points[i].lng),parseFloat(points[i].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)}),this.layer.getSource().addFeature(this.olFeature)},WPGMZA.OLPolyline.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates();result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),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:(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})}),options&&this.setOptions(options)},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},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.setOptions=function(options){var googleOptions={};delete(googleOptions=$.extend({},options)).map,delete googleOptions.center,options.center&&(googleOptions.center=new google.maps.LatLng({lat:parseFloat(options.center.lat),lng:parseFloat(options.center.lng)})),options.radius&&(googleOptions.radius=parseFloat(options.radius)),options.color&&(googleOptions.fillColor=options.color),options.opacity&&(googleOptions.fillOpacity=parseFloat(options.opacity),googleOptions.strokeOpacity=parseFloat(options.opacity)),this.googleCircle.setOptions(googleOptions),options.map&&options.map.addCircle(this)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){WPGMZA.Geocoder.call(this)},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getGoogleGeocoder=function(){return WPGMZA.CloudAPI&&WPGMZA.CloudAPI.isBeingUsed?new WPGMZA.CloudGeocoder:new google.maps.Geocoder},WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)throw new Error("No address specified");if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),this.getGoogleGeocoder().geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK||status==WPGMZA.CloudGeocoder.SUCCESS){var latLng,location=results[0].geometry.location,bounds=null;latLng={lat:location.lat(),lng:location.lng()},(bounds=results[0].geometry.bounds)&&(bounds=bounds instanceof google.maps.LatLngBounds?WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds):WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral(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=this.getGoogleGeocoder();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(mapObject){Parent.call(this,mapObject),this.setMapObject(mapObject)},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.setMapObject=function(mapObject){mapObject instanceof WPGMZA.Marker?this.googleObject=mapObject.googleMarker:mapObject instanceof WPGMZA.Polygon?this.googleObject=mapObject.googlePolygon:mapObject instanceof WPGMZA.Polyline&&(this.googleObject=mapObject.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.trigger("infowindowclose"))}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,mapObject){var self=this;if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setMapObject(mapObject),this.googleObject instanceof google.maps.Polygon||this.googleInfoWindow.open(this.mapObject.map.googleMap,this.googleObject);var intervalID,guid=WPGMZA.guid(),html="<div id='"+guid+"'>"+this.content+"</div>";return this.googleInfoWindow.setContent(html),intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaMapObject=self.mapObject,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;if(Parent.call(this,element,options),!window.google){var status=WPGMZA.googleAPIStatus,message="Google API not loaded";if(status&&status.message&&(message+=" - "+status.message),"USER_CONSENT_NOT_GIVEN"==status.code)return;throw $(element).html("<div class='notice notice-error'><p>"+WPGMZA.localized_strings.google_api_not_loaded+"<pre>"+message+"</pre></p></div>"),new Error(message)}this.loadGoogleMap(),options&&this.setOptions(options,!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),1==this.settings.transport&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.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)}),"1"==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(row){var self=this;Parent.call(this,row),this._opacity=1;var settings={};if(row)for(var name in row)row[name]instanceof WPGMZA.LatLng?settings[name]=row[name].toGoogleLatLng():row[name]instanceof WPGMZA.Map||"icon"==name||(settings[name]=row[name]);this.googleMarker=new google.maps.Marker(settings),(this.googleMarker.wpgmzaMarker=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()})}),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){this.map=WPGMZA.getMapByID(map_id),WPGMZA.ModernStoreLocator.call(this,map_id);var options={fields:["name","formatted_address"],types:["geocode"]},restrict=wpgmaps_localize[map_id].other_settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&(restrict&&restrict.length&&(options.componentRestrictions={country:restrict}),this.autoComplete=new google.maps.places.Autocomplete(this.addressInput,options)),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;if(Parent.call(this,options,googlePolygon),googlePolygon)this.googlePolygon=googlePolygon;else if(this.googlePolygon=new google.maps.Polygon,options){var googleOptions=$.extend({},options);options.polydata&&(googleOptions.paths=this.parseGeometry(options.polydata)),options.linecolor&&(googleOptions.strokeColor="#"+options.linecolor),options.lineopacity&&(googleOptions.strokeOpacity=parseFloat(options.lineopacity)),options.fillcolor&&(googleOptions.fillColor="#"+options.fillcolor),options.opacity&&(googleOptions.fillOpacity=parseFloat(options.opacity)),this.googlePolygon.setOptions(googleOptions)}this.googlePolygon.wpgmzaPolygon=this,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.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){this.googlePolygon.setOptions({editable:value})},WPGMZA.GooglePolygon.prototype.toJSON=function(){var result=WPGMZA.Polygon.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.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),googlePolyline)this.googlePolyline=googlePolyline;else{if(this.googlePolyline=new google.maps.Polyline(this.settings),options){var googleOptions=$.extend({},options);options.polydata&&(googleOptions.path=this.parseGeometry(options.polydata)),options.linecolor&&(googleOptions.strokeColor="#"+options.linecolor),options.linethickness&&(googleOptions.strokeWeight=parseInt(options.linethickness)),options.opacity&&(googleOptions.strokeOpacity=parseFloat(options.opacity))}if(options&&options.polydata){var path=this.parseGeometry(options.polydata);this.setPoints(path)}}this.googlePolyline.wpgmzaPolyline=this,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.setEditable=function(value){this.googlePolyline.setOptions({editable:value})},WPGMZA.GooglePolyline.prototype.setPoints=function(points){this.googlePolyline.setOptions({path:points})},WPGMZA.GooglePolyline.prototype.toJSON=function(){var result=WPGMZA.Polyline.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),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"}),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"})},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()}))});
js/wpgmaps-admin-core.js CHANGED
@@ -529,8 +529,11 @@ jQuery(function($) {
529
 
530
 
531
  var oldMarker = WPGMZA.mapEditPage.map.getMarkerByID(wpgm_edit_id);
532
- if(oldMarker)
 
 
533
  WPGMZA.mapEditPage.map.removeMarker(oldMarker);
 
534
 
535
  var wpgm_address = "0";
536
  var wpgm_gps = "0";
@@ -553,10 +556,16 @@ jQuery(function($) {
553
  if (do_geocode === true) {
554
 
555
  geocoder.geocode( { 'address': wpgm_address}, function(results, status) {
 
556
  if (status == WPGMZA.Geocoder.SUCCESS) {
557
- wpgm_gps = String(results[0].geometry.location);
558
- var wpgm_lat = parseFloat(results[0].geometry.location.lat);
559
- var wpgm_lng = parseFloat(results[0].geometry.location.lng);
 
 
 
 
 
560
 
561
  var data = {
562
  action: 'edit_marker',
529
 
530
 
531
  var oldMarker = WPGMZA.mapEditPage.map.getMarkerByID(wpgm_edit_id);
532
+ if(oldMarker) {
533
+ console.log("removing old marker");
534
+ console.log(oldMarker);
535
  WPGMZA.mapEditPage.map.removeMarker(oldMarker);
536
+ }
537
 
538
  var wpgm_address = "0";
539
  var wpgm_gps = "0";
556
  if (do_geocode === true) {
557
 
558
  geocoder.geocode( { 'address': wpgm_address}, function(results, status) {
559
+ console.log(results);
560
  if (status == WPGMZA.Geocoder.SUCCESS) {
561
+ if (!results[0].geometry && results[0].latLng) {
562
+ var wpgm_lat = parseFloat(results[0].latLng._lat);
563
+ var wpgm_lng = parseFloat(results[0].latLng._lat);
564
+ } else {
565
+ wpgm_gps = String(results[0].geometry.location);
566
+ var wpgm_lat = parseFloat(results[0].geometry.location.lat);
567
+ var wpgm_lng = parseFloat(results[0].geometry.location.lng);
568
+ }
569
 
570
  var data = {
571
  action: 'edit_marker',
legacy-core.php CHANGED
@@ -102,7 +102,7 @@ register_deactivation_hook( $wpgmzaMainPluginFile, 'wpgmaps_deactivate' );
102
  define('WPGMZA_VERSION', $wpgmza_version);
103
  define("WPGMAPS", $wpgmza_version);
104
 
105
- $wpgmza_p_version = "6.19";
106
  $wpgmza_t = "basic";
107
 
108
  $plugin_dir_path = plugin_dir_path(__FILE__);
@@ -186,7 +186,7 @@ function wpgmaps_activate() {
186
 
187
  update_option('WPGMZA_OTHER_SETTINGS', $other_settings);
188
 
189
- update_option("wpgmza_temp_api",'AIzaSyDjyYKnTqGG2CAF9nmrfB6zgTBE6oPhMk4');
190
 
191
  // set defaults for the Marker XML Dir and Marker XML URL
192
  if (get_option("wpgmza_xml_location") == "") {
@@ -630,16 +630,11 @@ function wpgmaps_admin_javascript_basic()
630
  global $wpdb;
631
  global $wpgmza_version;
632
  global $wpgmza_tblname_maps;
633
-
 
634
  if (!is_admin() || !$wpgmza->isUserAllowedToEdit())
635
  return;
636
 
637
- if(!empty($_POST['wpgmaps_marker-nonce']) && !wp_verify_nonce($_POST['wpgmaps_marker-nonce'], 'wpgmza'))
638
- {
639
- http_response_code(403);
640
- exit;
641
- }
642
-
643
  $ajax_nonce = wp_create_nonce("wpgmza");
644
 
645
  if( isset( $_POST['wpgmza_save_google_api_key_list'] ) ){
@@ -4682,7 +4677,7 @@ function wpgmaps_permission_warning() {
4682
  function wpgmaps_update_db_check() {
4683
  global $wpgmza_version;
4684
  if (get_option('wpgmza_db_version') != $wpgmza_version) {
4685
- update_option("wpgmza_temp_api",'AIzaSyDjyYKnTqGG2CAF9nmrfB6zgTBE6oPhMk4');
4686
 
4687
  // NB: Moved to WPGMZA\Database
4688
  //wpgmaps_handle_db();
@@ -4784,12 +4779,13 @@ function wpgmaps_upgrade_notice() {
4784
  }
4785
  function wpgmaps_trash_map($map_id) {
4786
  global $wpdb;
 
4787
  global $wpgmza_tblname_maps;
4788
  if (isset($map_id)) {
4789
- $wpdb->query(
4790
- $wpdb->prepare('DELETE FROM wp_wpgmza WHERE map_id=%d', (int)$map_id)
4791
- );
4792
- $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_maps SET active = %d WHERE id = %d", 1, $map_id) );
4793
  return true;
4794
  } else {
4795
  return false;
102
  define('WPGMZA_VERSION', $wpgmza_version);
103
  define("WPGMAPS", $wpgmza_version);
104
 
105
+ $wpgmza_p_version = "8.00";
106
  $wpgmza_t = "basic";
107
 
108
  $plugin_dir_path = plugin_dir_path(__FILE__);
186
 
187
  update_option('WPGMZA_OTHER_SETTINGS', $other_settings);
188
 
189
+ update_option("wpgmza_temp_api",'AIzaSyDo_fG7DXBOVvdhlrLa-PHREuFDpTklWhY');
190
 
191
  // set defaults for the Marker XML Dir and Marker XML URL
192
  if (get_option("wpgmza_xml_location") == "") {
630
  global $wpdb;
631
  global $wpgmza_version;
632
  global $wpgmza_tblname_maps;
633
+
634
+
635
  if (!is_admin() || !$wpgmza->isUserAllowedToEdit())
636
  return;
637
 
 
 
 
 
 
 
638
  $ajax_nonce = wp_create_nonce("wpgmza");
639
 
640
  if( isset( $_POST['wpgmza_save_google_api_key_list'] ) ){
4677
  function wpgmaps_update_db_check() {
4678
  global $wpgmza_version;
4679
  if (get_option('wpgmza_db_version') != $wpgmza_version) {
4680
+ update_option("wpgmza_temp_api",'AIzaSyDo_fG7DXBOVvdhlrLa-PHREuFDpTklWhY');
4681
 
4682
  // NB: Moved to WPGMZA\Database
4683
  //wpgmaps_handle_db();
4779
  }
4780
  function wpgmaps_trash_map($map_id) {
4781
  global $wpdb;
4782
+ global $wpgmza_tblname;
4783
  global $wpgmza_tblname_maps;
4784
  if (isset($map_id)) {
4785
+
4786
+ $wpdb->query( $wpdb->prepare("DELETE FROM $wpgmza_tblname WHERE `map_id` = %d", (int)$map_id) );
4787
+
4788
+ $rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_maps SET `active` = %d WHERE `id` = %d", 1, $map_id) );
4789
  return true;
4790
  } else {
4791
  return false;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: WPGMaps, NickDuncan, CodeCabin_, DylanAuty, PerryRylance
3
  Donate link: https://www.wpgmaps.com
4
  Tags: google maps, maps, map, map markers, google map, google maps plugin, wp google maps, wp google map, map plugin, directions, google map plugin, map widget
5
  Requires at least: 3.5
6
- Tested up to: 5.4.2
7
  Requires PHP: 5.3
8
  Stable tag: trunk
9
  License: GPLv2
@@ -197,6 +197,9 @@ Try [Nifty Maps](http://www.niftymaps.co) - Comprehensive Map Builder for all we
197
 
198
  == Upgrade Notice ==
199
 
 
 
 
200
  = 7.11.19 =
201
  Please update to 7.11.18 or above to ensure you are using the latest security enhancements.
202
 
@@ -209,17 +212,13 @@ Please update your WP Google Maps version to 6.3.14 to ensure you are using the
209
  = 6.2.1 =
210
  Please update your WP Google Maps version to 6.2.1 to ensure you are using the latest security enhancements.
211
 
212
- = 6.1.10 =
213
- Please update WP Google Maps to version 6.1.10 to enable our latest security enhancements.
214
-
215
- = 6.1.5 =
216
- We no longer support timthumb and we have opted to remove it from WP Google Maps. Please update to 6.1.5 to ensure the removal of the timthumb script.
217
-
218
- = 6.0.27 =
219
- Please upgrade your version of WP Google Maps to version 6.0.27 as it includes multiple security improvements.
220
-
221
  == Changelog ==
222
 
 
 
 
 
 
223
  = 8.0.25 :- 2020-06-12 :- Medium priority =
224
  * Tested up to WordPress 5.4.2
225
  * Fixed Google Autocomplete not working due to failed check in minified code
3
  Donate link: https://www.wpgmaps.com
4
  Tags: google maps, maps, map, map markers, google map, google maps plugin, wp google maps, wp google map, map plugin, directions, google map plugin, map widget
5
  Requires at least: 3.5
6
+ Tested up to: 5.5
7
  Requires PHP: 5.3
8
  Stable tag: trunk
9
  License: GPLv2
197
 
198
  == Upgrade Notice ==
199
 
200
+ = 8.0.26 =
201
+ Please update to 8.0.26 or above to ensure you are using the latest security enhancements.
202
+
203
  = 7.11.19 =
204
  Please update to 7.11.18 or above to ensure you are using the latest security enhancements.
205
 
212
  = 6.2.1 =
213
  Please update your WP Google Maps version to 6.2.1 to ensure you are using the latest security enhancements.
214
 
 
 
 
 
 
 
 
 
 
215
  == Changelog ==
216
 
217
+ = 8.0.26 - 2020-08-25 - High priority =
218
+ * Tested up to WordPress 5.5
219
+ * Patched a vulnerability, thank you WP.org for identifying it!
220
+ * Fixed a bug that stopped markers from being deleted on some WP installations (thank you Gary Boulter!)
221
+
222
  = 8.0.25 :- 2020-06-12 :- Medium priority =
223
  * Tested up to WordPress 5.4.2
224
  * Fixed Google Autocomplete not working due to failed check in minified code
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.0.25
7
  Author: WP Google Maps
8
  Author URI: https://www.wpgmaps.com
9
  Text Domain: wp-google-maps
@@ -11,6 +11,13 @@ Domain Path: /languages
11
  */
12
 
13
  /*
 
 
 
 
 
 
 
14
  * 8.0.25 :- 2020-06-12 :- Medium priority
15
  * Tested up to WordPress 5.4.2
16
  * Fixed Google Autocomplete not working due to failed check in minified code
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.0.26
7
  Author: WP Google Maps
8
  Author URI: https://www.wpgmaps.com
9
  Text Domain: wp-google-maps
11
  */
12
 
13
  /*
14
+ * 8.0.26 - 2020-08-25 - High priority
15
+ * Tested up to WordPress 5.5
16
+ * Patched a vulnerability, thank you WP.org for identifying it!
17
+ * Fixed a bug that stopped markers from being deleted on some WP installations (thank you Gary Boulter!)
18
+ * Fixed a bug where editing a marker would cause a JS error in some instances
19
+ *
20
+ *
21
  * 8.0.25 :- 2020-06-12 :- Medium priority
22
  * Tested up to WordPress 5.4.2
23
  * Fixed Google Autocomplete not working due to failed check in minified code