WP Google Maps - Version 8.1.17

Version Description

  • 2021-10-13 =
  • Improved marker editor geocode usage to only geocode when an address has changed, or is being added for the first time. (Reduced API calls due to usage)
  • Fixed issue where editing a marker which has already been position adusted would trigger a geocode on the original address, moving the marker back to the original placement
  • Fixed issue where map preview would not load on some elementor pages (Preview view only)
  • Fixed issue where RTL sites would misplace markers in OpenLayers
  • Fixed issue where StreetView icon would not show on some websites (Theme dependent)
  • Fixed issue where SQL quotation mark usage for actions on marker, map, and features (trait) would cause datatable failures
  • Removed uses of 'SQL_CALC_FOUND_ROWS' AND 'FOUND_ROWS' in queries to ensure MySQL 8.0.17 and above compatibility
Download this release

Release Info

Developer DylanAuty
Plugin Icon 128x128 WP Google Maps
Version 8.1.17
Comparing to
See all releases

Code changes from version 8.1.16 to 8.1.17

README.md CHANGED
@@ -1 +1 @@
1
- # wp-google-maps-version8
1
+ # wp-google-maps-version-8.1
css/common.css CHANGED
@@ -793,4 +793,8 @@ input[type='radio']:checked + .wpgmza-infowindow-picker__item span{
793
  clear: both;
794
  display: block;
795
  overflow: auto;
 
 
 
 
796
  }
793
  clear: both;
794
  display: block;
795
  overflow: auto;
796
+ }
797
+
798
+ .wpgmza_map .gm-svpc img {
799
+ max-width: initial;
800
  }
css/open-layers.css CHANGED
@@ -181,4 +181,13 @@
181
 
182
  .ol-info-window-polygon {
183
  bottom: 0 !important;
 
 
 
 
 
 
 
 
 
184
  }
181
 
182
  .ol-info-window-polygon {
183
  bottom: 0 !important;
184
+ }
185
+
186
+ .rtl .wpgmza_map * {
187
+ direction: ltr;
188
+ }
189
+
190
+ .rtl .wpgmza_map .wpgmza-infowindow,
191
+ .rtl .wpgmza_map .wpgmza-infowindow *{
192
+ direction: rtl;
193
  }
includes/tables/class.admin-map-datatable.php CHANGED
@@ -59,9 +59,9 @@ class AdminMapDataTable extends DataTable
59
  switch($name) {
60
  case 'mark':
61
 
62
- $columns[$key] = "REPLACE(\"
63
- <input type='checkbox' name='mark' data-map-id='$placeholder'/>
64
- \", \"$placeholder\", id) AS mark";
65
 
66
  break;
67
 
59
  switch($name) {
60
  case 'mark':
61
 
62
+ $columns[$key] = "REPLACE('
63
+ <input type=\'checkbox\' name=\'mark\' data-map-id=\'$placeholder\'/>
64
+ ', '$placeholder', id) AS mark";
65
 
66
  break;
67
 
includes/tables/class.admin-marker-datatable.php CHANGED
@@ -48,29 +48,29 @@ class AdminMarkerDataTable extends MarkerDataTable
48
  {
49
  $id_placeholder = AdminMarkerDataTable::ID_PLACEHOLDER;
50
 
51
- return apply_filters('wpgmza_admin_marker_datatable_action_buttons_sql', 'REPLACE(\'
52
- <div class="wpgmza-action-buttons wpgmza-flex">
53
- <a title="Edit this marker" class="wpgmza_edit_btn button" data-edit-marker-id="' . $id_placeholder . '">
54
- <i class="fa fa-edit"> </i>
55
  </a>
56
- <a title="' . esc_attr( __('Edit this marker location', 'wp-google-maps') ) . '" data-adjust-marker-id="' . $id_placeholder . '" class="wpgmza_edit_btn button">
57
- <i class="fa fa-map-marker"> </i>
58
  </a>
59
- <a title="Center on marker" class="wpgmza_center_btn button" data-center-marker-id="' . $id_placeholder . '">
60
- <i class="fa fa-eye"> </i>
61
  </a>
62
- <a href="javascript: ;" title="'
63
  . esc_attr( __('Delete this marker', 'wp-google-maps') ) .
64
- '" class="wpgmza_del_btn button" data-delete-marker-id="' . $id_placeholder . '">
65
- <i class="fa fa-times"> </i>
66
  </a>
67
  </div>
68
 
69
- \',
70
- "' . $id_placeholder . '",
71
  id
72
  ) AS `action`
73
- ');
74
  }
75
 
76
  protected function filterColumns(&$columns, $input_params)
@@ -98,7 +98,7 @@ class AdminMarkerDataTable extends MarkerDataTable
98
  break;
99
 
100
  case 'sticky':
101
- $columns[$key] = '(CASE WHEN sticky = 1 THEN "&#x2714;" ELSE "" END) AS sticky';
102
  break;
103
  }
104
  }
48
  {
49
  $id_placeholder = AdminMarkerDataTable::ID_PLACEHOLDER;
50
 
51
+ return apply_filters('wpgmza_admin_marker_datatable_action_buttons_sql', "REPLACE('
52
+ <div class=\'wpgmza-action-buttons wpgmza-flex\'>
53
+ <a title=\'Edit this marker\' class=\'wpgmza_edit_btn button\' data-edit-marker-id=\'{$id_placeholder}\'>
54
+ <i class=\'fa fa-edit\'> </i>
55
  </a>
56
+ <a title=\'" . esc_attr( __('Edit this marker location', 'wp-google-maps') ) . "\' data-adjust-marker-id=\'{$id_placeholder}\' class=\'wpgmza_edit_btn button\'>
57
+ <i class=\'fa fa-map-marker\'> </i>
58
  </a>
59
+ <a title=\'Center on marker\' class=\'wpgmza_center_btn button\' data-center-marker-id=\'{$id_placeholder}\'>
60
+ <i class=\'fa fa-eye\'> </i>
61
  </a>
62
+ <a href=\'javascript: ;\' title=\'"
63
  . esc_attr( __('Delete this marker', 'wp-google-maps') ) .
64
+ "\' class=\'wpgmza_del_btn button\' data-delete-marker-id=\'{$id_placeholder}\'>
65
+ <i class=\'fa fa-times\'> </i>
66
  </a>
67
  </div>
68
 
69
+ ',
70
+ '{$id_placeholder}',
71
  id
72
  ) AS `action`
73
+ ");
74
  }
75
 
76
  protected function filterColumns(&$columns, $input_params)
98
  break;
99
 
100
  case 'sticky':
101
+ $columns[$key] = '(CASE WHEN sticky = 1 THEN \'&#x2714;\' ELSE \'\' END) AS sticky';
102
  break;
103
  }
104
  }
includes/tables/class.ajax-table.php CHANGED
@@ -249,8 +249,13 @@ class AjaxTable extends Table
249
  protected function buildQueryString($columns, $where, $having, $input_params, &$query_params)
250
  {
251
  $imploded = implode(',', $columns);
252
-
253
- $qstr = "SELECT SQL_CALC_FOUND_ROWS $imploded FROM {$this->table_name} " . $this->getSQLBeforeWhere($input_params, $query_params) . " WHERE $where " . $this->getSQLAfterWhere($input_params, $query_params, $where);
 
 
 
 
 
254
 
255
  if(!empty($having))
256
  $qstr .= " HAVING $having";
@@ -264,7 +269,12 @@ class AjaxTable extends Table
264
 
265
  return "SELECT COUNT(id) FROM {$this->table_name} WHERE $count_where";
266
  }
267
-
 
 
 
 
 
268
  public function getRecords($input_params)
269
  {
270
  global $wpdb;
@@ -293,7 +303,7 @@ class AjaxTable extends Table
293
 
294
  // Build query string
295
  $qstr = $this->buildQueryString($columns, $where, $having, $input_params, $query_params);
296
-
297
  // This code allows for more natural numeric sorting on text fields, not just numeric fields
298
  if(empty($order_column))
299
  $order_column = 'id';
@@ -323,25 +333,37 @@ class AjaxTable extends Table
323
  $count_query_params = array();
324
  $count_qstr = $this->buildCountQueryString($input_params, $count_query_params);
325
 
326
- if(!empty($query_params))
327
  $stmt = $wpdb->prepare($count_qstr, $count_query_params);
328
- else
329
  $stmt = $count_qstr;
 
330
 
331
  $total_count = (int)$wpdb->get_var($stmt);
332
 
333
  // Body
334
- if(!empty($query_params))
335
  $stmt = $wpdb->prepare($qstr, $query_params);
336
- else
337
  $stmt = $qstr;
 
338
 
339
  $rows = $wpdb->get_results($stmt);
340
 
341
  $this->filterResults($rows);
342
 
343
  // Found rows
344
- $found_rows = $wpdb->get_var('SELECT FOUND_ROWS()');
 
 
 
 
 
 
 
 
 
 
345
 
346
  // Meta
347
  $meta = array();
249
  protected function buildQueryString($columns, $where, $having, $input_params, &$query_params)
250
  {
251
  $imploded = implode(',', $columns);
252
+ /**
253
+ * Modified: 2021-10-11
254
+ * Change: Remove 'SQL_CALC_FOUND_ROWS' as it is being deprecated
255
+ * Reason: Some sites experiencing issues with this modifier and subsequent "FOUND_ROWS()" calls as it is being deprecated
256
+ * Author: Dylan Auty
257
+ */
258
+ $qstr = "SELECT $imploded FROM {$this->table_name} " . $this->getSQLBeforeWhere($input_params, $query_params) . " WHERE $where " . $this->getSQLAfterWhere($input_params, $query_params, $where);
259
 
260
  if(!empty($having))
261
  $qstr .= " HAVING $having";
269
 
270
  return "SELECT COUNT(id) FROM {$this->table_name} WHERE $count_where";
271
  }
272
+
273
+ protected function buildFilteredCountQueryString($input_params, &$count_query_params){
274
+ $count_where = $this->getWhereClause($input_params, $count_query_params, false);
275
+ return "SELECT COUNT(id) FROM {$this->table_name} WHERE $count_where";
276
+ }
277
+
278
  public function getRecords($input_params)
279
  {
280
  global $wpdb;
303
 
304
  // Build query string
305
  $qstr = $this->buildQueryString($columns, $where, $having, $input_params, $query_params);
306
+
307
  // This code allows for more natural numeric sorting on text fields, not just numeric fields
308
  if(empty($order_column))
309
  $order_column = 'id';
333
  $count_query_params = array();
334
  $count_qstr = $this->buildCountQueryString($input_params, $count_query_params);
335
 
336
+ if(!empty($query_params)){
337
  $stmt = $wpdb->prepare($count_qstr, $count_query_params);
338
+ } else {
339
  $stmt = $count_qstr;
340
+ }
341
 
342
  $total_count = (int)$wpdb->get_var($stmt);
343
 
344
  // Body
345
+ if(!empty($query_params)){
346
  $stmt = $wpdb->prepare($qstr, $query_params);
347
+ } else{
348
  $stmt = $qstr;
349
+ }
350
 
351
  $rows = $wpdb->get_results($stmt);
352
 
353
  $this->filterResults($rows);
354
 
355
  // Found rows
356
+ // DEPRECATED AS PER NOTES RE: MySQL 8.0.17 -> This now requires a separate count query as seen
357
+ // $found_rows = $wpdb->get_var('SELECT FOUND_ROWS()');
358
+ $filtered_query_params = array();
359
+ $filtered_count_qstr = $this->buildFilteredCountQueryString($input_params, $filtered_query_params);
360
+ if(!empty($filtered_query_params)){
361
+ $stmt = $wpdb->prepare($filtered_count_qstr, $filtered_query_params);
362
+ } else {
363
+ $stmt = $filtered_count_qstr;
364
+ }
365
+
366
+ $found_rows = (int)$wpdb->get_var($stmt);
367
 
368
  // Meta
369
  $meta = array();
includes/tables/trait.admin-feature-datatable.php CHANGED
@@ -9,22 +9,22 @@ trait AdminFeatureDatatable
9
  $type = $this->getFeatureType();
10
  $id_placeholder = '__5d5621cf7b6bb90bfb7bda85a0df7293';
11
 
12
- return apply_filters("wpgmza_admin_{$type}_datatable_action_buttons_sql", 'REPLACE(\'
13
- <div class="wpgmza-action-buttons wpgmza-flex">
14
- <a title="' . esc_attr('Edit this feature', 'wp-google-maps') . '"
15
- class="wpgmza_edit_btn button"
16
- data-edit-'.$type.'-id="'.$id_placeholder.'">
17
- <i class="fa fa-edit"> </i>
18
  </a>
19
- <a href="javascript: ;" title="'
20
  . esc_attr( __('Delete this feature', 'wp-google-maps') ) .
21
- '" class="wpgmza_del_btn button" data-delete-'.$type.'-id="' . $id_placeholder . '">
22
- <i class="fa fa-times"> </i>
23
  </a>
24
  </div>
25
- \',
26
- "' . $id_placeholder . '",
27
  id
28
- ) AS `action`');
29
  }
30
  }
9
  $type = $this->getFeatureType();
10
  $id_placeholder = '__5d5621cf7b6bb90bfb7bda85a0df7293';
11
 
12
+ return apply_filters("wpgmza_admin_{$type}_datatable_action_buttons_sql", "REPLACE('
13
+ <div class=\'wpgmza-action-buttons wpgmza-flex\'>
14
+ <a title=\'" . esc_attr('Edit this feature', 'wp-google-maps') . "\'
15
+ class=\'wpgmza_edit_btn button\'
16
+ data-edit-{$type}-id=\'{$id_placeholder}\'>
17
+ <i class=\'fa fa-edit\'> </i>
18
  </a>
19
+ <a href=\'javascript: ;\' title=\'"
20
  . esc_attr( __('Delete this feature', 'wp-google-maps') ) .
21
+ "\' class=\'wpgmza_del_btn button\' data-delete-{$type}-id=\'{$id_placeholder}\'>
22
+ <i class=\'fa fa-times\'> </i>
23
  </a>
24
  </div>
25
+ ',
26
+ '{$id_placeholder}',
27
  id
28
+ ) AS `action`");
29
  }
30
  }
js/v8/map-edit-page/marker-panel.js CHANGED
@@ -170,7 +170,17 @@ jQuery(function($) {
170
  }
171
  }
172
 
173
- if(this.adjustSubMode){
 
 
 
 
 
 
 
 
 
 
174
  // Trust the force!
175
  WPGMZA.FeaturePanel.prototype.onSave.apply(self, arguments);
176
  } else {
170
  }
171
  }
172
 
173
+ var addressUnchanged = false;
174
+ if(this.feature && this.feature.address && address){
175
+ if(typeof this.feature.address === 'string' && typeof address === 'string'){
176
+ if(this.feature.address.trim() === address.trim()){
177
+ /** Address was not changed by the edit, let's go ahead and skip geocoding on save */
178
+ addressUnchanged = true;
179
+ }
180
+ }
181
+ }
182
+
183
+ if(this.adjustSubMode || addressUnchanged){
184
  // Trust the force!
185
  WPGMZA.FeaturePanel.prototype.onSave.apply(self, arguments);
186
  } else {
js/v8/map.js CHANGED
@@ -22,8 +22,18 @@ jQuery(function($) {
22
 
23
  WPGMZA.EventDispatcher.call(this);
24
 
25
- if(!(element instanceof HTMLElement))
26
- throw new Error("Argument must be a HTMLElement");
 
 
 
 
 
 
 
 
 
 
27
 
28
  // NB: This should be moved to a getID function or similar and offloaded to Pro. ID should be fixed to 1 in basic.
29
  if(element.hasAttribute("data-map-id"))
22
 
23
  WPGMZA.EventDispatcher.call(this);
24
 
25
+ if(!(element instanceof HTMLElement)){
26
+ if(!window.elementor){
27
+ /**
28
+ * Temporary Solution
29
+ *
30
+ * If elementor is active, it won't be an HTML Element just yet, due to preview block loading
31
+ *
32
+ * However, our timer initializer will load it later, so we just don't throw the error
33
+ */
34
+ throw new Error("Argument must be a HTMLElement");
35
+ }
36
+ }
37
 
38
  // NB: This should be moved to a getID function or similar and offloaded to Pro. ID should be fixed to 1 in basic.
39
  if(element.hasAttribute("data-map-id"))
js/v8/wp-google-maps.combined.js CHANGED
@@ -1,5638 +1,5648 @@
1
 
2
  // js/v8/core.js
3
- /**
4
- * @module WPGMZA
5
- * @summary This is the core Javascript module. Some code exists in ../core.js, the functionality there will slowly be handed over to this module.
6
- */
7
- jQuery(function($) {
8
-
9
- var core = {
10
- MARKER_PULL_DATABASE: "0",
11
- MARKER_PULL_XML: "1",
12
-
13
- PAGE_MAP_LIST: "map-list",
14
- PAGE_MAP_EDIT: "map-edit",
15
- PAGE_SETTINGS: "map-settings",
16
- PAGE_SUPPORT: "map-support",
17
-
18
- PAGE_CATEGORIES: "categories",
19
- PAGE_ADVANCED: "advanced",
20
- PAGE_CUSTOM_FIELDS: "custom-fields",
21
-
22
- /**
23
- * Indexed array of map instances
24
- * @constant {array} maps
25
- * @static
26
- */
27
- maps: [],
28
-
29
- /**
30
- * Global EventDispatcher used to listen for global plugin events
31
- * @constant {EventDispatcher} events
32
- * @static
33
- */
34
- events: null,
35
-
36
- /**
37
- * Settings, passed from the server
38
- * @constant {object} settings
39
- * @static
40
- */
41
- settings: null,
42
-
43
- /**
44
- * Instance of the restAPI. Not to be confused with WPGMZA.RestAPI, which is the instances constructor
45
- * @constant {RestAPI} restAPI
46
- * @static
47
- */
48
- restAPI: null,
49
-
50
- /**
51
- * Key and value pairs of localized strings passed from the server
52
- * @constant {object} localized_strings
53
- * @static
54
- */
55
- localized_strings: null,
56
-
57
- // NB: Legacy
58
- loadingHTML: '<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',
59
-
60
- // NB: Correct
61
- preloaderHTML: "<div class='wpgmza-preloader'><div></div><div></div><div></div><div></div></div>",
62
-
63
- getCurrentPage: function() {
64
-
65
- switch(WPGMZA.getQueryParamValue("page"))
66
- {
67
- case "wp-google-maps-menu":
68
- if(window.location.href.match(/action=edit/) && window.location.href.match(/map_id=\d+/))
69
- return WPGMZA.PAGE_MAP_EDIT;
70
-
71
- return WPGMZA.PAGE_MAP_LIST;
72
- break;
73
-
74
- case 'wp-google-maps-menu-settings':
75
- return WPGMZA.PAGE_SETTINGS;
76
- break;
77
-
78
- case 'wp-google-maps-menu-support':
79
- return WPGMZA.PAGE_SUPPORT;
80
- break;
81
-
82
- case 'wp-google-maps-menu-categories':
83
- return WPGMZA.PAGE_CATEGORIES;
84
- break;
85
-
86
- case 'wp-google-maps-menu-advanced':
87
- return WPGMZA.PAGE_ADVANCED;
88
- break;
89
-
90
- case 'wp-google-maps-menu-custom-fields':
91
- return WPGMZA.PAGE_CUSTOM_FIELDS;
92
- break;
93
-
94
- default:
95
- return null;
96
- break;
97
- }
98
-
99
- },
100
-
101
- /**
102
- * Override this method to add a scroll offset when using animated scroll, useful for sites with fixed headers.
103
- * @method getScrollAnimationOffset
104
- * @static
105
- * @return {number} The scroll offset
106
- */
107
- getScrollAnimationOffset: function() {
108
- return (WPGMZA.settings.scroll_animation_offset || 0) + $("#wpadminbar").height();
109
- },
110
-
111
- getScrollAnimationDuration: function() {
112
- if(WPGMZA.settings.scroll_animation_milliseconds)
113
- return WPGMZA.settings.scroll_animation_milliseconds;
114
- else
115
- return 500;
116
- },
117
-
118
- /**
119
- * Animated scroll, accounts for animation settings and fixed header height
120
- * @method animateScroll
121
- * @static
122
- * @param {HTMLElement} element The element to scroll to
123
- * @param {number} [milliseconds] The time in milliseconds to scroll over. Defaults to 500 if no value is specified.
124
- * @return void
125
- */
126
- animateScroll: function(element, milliseconds) {
127
-
128
- var offset = WPGMZA.getScrollAnimationOffset();
129
-
130
- if(!milliseconds)
131
- milliseconds = WPGMZA.getScrollAnimationDuration();
132
-
133
- $("html, body").animate({
134
- scrollTop: $(element).offset().top - offset
135
- }, milliseconds);
136
-
137
- },
138
-
139
- extend: function(child, parent) {
140
-
141
- var constructor = child;
142
-
143
- child.prototype = Object.create(parent.prototype);
144
- child.prototype.constructor = constructor;
145
-
146
- },
147
-
148
- /**
149
- * Generates and returns a GUID
150
- * @method guid
151
- * @static
152
- * @return {string} The GUID
153
- */
154
- guid: function() { // Public Domain/MIT
155
- var d = new Date().getTime();
156
- if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
157
- d += performance.now(); //use high-precision timer if available
158
- }
159
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
160
- var r = (d + Math.random() * 16) % 16 | 0;
161
- d = Math.floor(d / 16);
162
- return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
163
- });
164
- },
165
-
166
- /**
167
- * Takes a hex string and opacity value and converts it to Openlayers RGBA format
168
- * @method hexOpacityToRGBA
169
- * @static
170
- * @param {string} colour The hex color string
171
- * @param {number} opacity The opacity from 0.0 - 1.0
172
- * @return {array} RGBA array where color components are 0 - 255 and opacity is 0.0 - 1.0
173
- */
174
- hexOpacityToRGBA: function(colour, opacity)
175
- {
176
- var hex = parseInt(colour.replace(/^#/, ""), 16);
177
- return [
178
- (hex & 0xFF0000) >> 16,
179
- (hex & 0xFF00) >> 8,
180
- hex & 0xFF,
181
- parseFloat(opacity)
182
- ];
183
- },
184
-
185
- hexOpacityToString: function(colour, opacity)
186
- {
187
- var arr = WPGMZA.hexOpacityToRGBA(colour, opacity);
188
- return "rgba(" + arr[0] + ", " + arr[1] + ", " + arr[2] + ", " + arr[3] + ")";
189
- },
190
-
191
- /**
192
- * Takes a hex color string and converts it to an RGBA object.
193
- * @method hexToRgba
194
- * @static
195
- * @param {string} hex The hex color string
196
- * @return {object} Object with r, g, b and a properties, or 0 if the input is invalid.
197
- */
198
- hexToRgba: function(hex) {
199
- var c;
200
- if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){
201
- c= hex.substring(1).split('');
202
- if(c.length== 3){
203
- c= [c[0], c[0], c[1], c[1], c[2], c[2]];
204
- }
205
- c= '0x'+c.join('');
206
-
207
- return {
208
- r: (c>>16)&255,
209
- g: (c>>8)&255,
210
- b: c&255,
211
- a: 1
212
- };
213
- }
214
-
215
- return 0;
216
-
217
- //throw new Error('Bad Hex');
218
- },
219
-
220
- /**
221
- * Takes an object with r, g, b and a properties and returns a CSS rgba color string
222
- * @method rgbaToString
223
- * @static
224
- * @param {string} rgba The input object
225
- * @return {string} The CSS rgba color string
226
- */
227
- rgbaToString: function(rgba) {
228
- return "rgba(" + rgba.r + ", " + rgba.g + ", " + rgba.b + ", " + rgba.a + ")";
229
- },
230
-
231
- /**
232
- * A regular expression that matches a latitude / longitude coordinate pair
233
- * @constant {RegExp} latLngRegexp
234
- * @static
235
- */
236
- latLngRegexp: /^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,
237
-
238
- /**
239
- * Utility function returns true is string is a latitude and longitude
240
- * @method isLatLngString
241
- * @deprecated Moved to WPGMZA.LatLng.isLatLngString
242
- * @static
243
- * @param str {string} The string to attempt to parse as coordinates
244
- * @return {array} the matched latitude and longitude or null if no match
245
- */
246
- isLatLngString: function(str)
247
- {
248
- if(typeof str != "string")
249
- return null;
250
-
251
- // Remove outer brackets
252
- if(str.match(/^\(.+\)$/))
253
- str = str.replace(/^\(|\)$/, "");
254
-
255
- var m = str.match(WPGMZA.latLngRegexp);
256
-
257
- if(!m)
258
- return null;
259
-
260
- return new WPGMZA.LatLng({
261
- lat: parseFloat(m[1]),
262
- lng: parseFloat(m[3])
263
- });
264
- },
265
-
266
- /**
267
- * Utility function returns a latLng literal given a valid latLng string
268
- * @method stringToLatLng
269
- * @static
270
- * @param str {string} The string to attempt to parse as coordinates
271
- * @return {object} LatLng literal
272
- */
273
- stringToLatLng: function(str)
274
- {
275
- var result = WPGMZA.isLatLngString(str);
276
-
277
- if(!result)
278
- throw new Error("Not a valid latLng");
279
-
280
- return result;
281
- },
282
-
283
- /**
284
- * Utility function returns a latLng literal given a valid latLng string
285
- * @method stringToLatLng
286
- * @static
287
- * @param str {string} The string to attempt to parse as coordinates
288
- * @return {object} LatLng literal
289
- */
290
- isHexColorString: function(str)
291
- {
292
- if(typeof str != "string")
293
- return false;
294
-
295
- return (str.match(/#[0-9A-F]{6}/i) ? true : false);
296
- },
297
-
298
- /**
299
- * Cache of image dimensions by URL, for internal use only
300
- * @var imageDimensionsCache
301
- * @inner
302
- * @see WPGMZA.getImageDimensions
303
- */
304
- imageDimensionsCache: {},
305
-
306
- /**
307
- * Utility function to get the dimensions of an image, caches results for best performance
308
- * @method getImageDimensions
309
- * @static
310
- * @param src {string} Image source URL
311
- * @param callback {function} Callback to recieve image dimensions
312
- * @return {void}
313
- */
314
- getImageDimensions: function(src, callback)
315
- {
316
- if(WPGMZA.imageDimensionsCache[src])
317
- {
318
- callback(WPGMZA.imageDimensionsCache[src]);
319
- return;
320
- }
321
-
322
- var img = document.createElement("img");
323
- img.onload = function(event) {
324
- var result = {
325
- width: img.width,
326
- height: img.height
327
- };
328
- WPGMZA.imageDimensionsCache[src] = result;
329
- callback(result);
330
- };
331
- img.src = src;
332
- },
333
-
334
- decodeEntities: function(input)
335
- {
336
- return input.replace(/&(nbsp|amp|quot|lt|gt);/g, function(m, e) {
337
- return m[e];
338
- }).replace(/&#(\d+);/gi, function(m, e) {
339
- return String.fromCharCode(parseInt(e, 10));
340
- });
341
- },
342
-
343
- /**
344
- * Returns true if developer mode is set or if developer mode cookie is set
345
- * @method isDeveloperMode
346
- * @static
347
- * @return {boolean} True if developer mode is on
348
- */
349
- isDeveloperMode: function()
350
- {
351
- return this.settings.developer_mode || (window.Cookies && window.Cookies.get("wpgmza-developer-mode"));
352
- },
353
-
354
- /**
355
- * Returns true if the Pro add-on is active
356
- * @method isProVersion
357
- * @static
358
- * @return {boolean} True if the Pro add-on is active
359
- */
360
- isProVersion: function()
361
- {
362
- return (this._isProVersion == "1");
363
- },
364
-
365
- /**
366
- * Opens the WP media dialog and returns the result to a callback
367
- * @method openMediaDialog
368
- * @param {function} callback Callback to recieve the attachment ID as the first parameter and URL as the second
369
- * @static
370
- * @return {void}
371
- */
372
- openMediaDialog: function(callback) {
373
- // Media upload
374
- var file_frame;
375
-
376
- // If the media frame already exists, reopen it.
377
- if ( file_frame ) {
378
- // Set the post ID to what we want
379
- file_frame.uploader.uploader.param( 'post_id', set_to_post_id );
380
- // Open frame
381
- file_frame.open();
382
- return;
383
- }
384
-
385
- // Create the media frame.
386
- file_frame = wp.media.frames.file_frame = wp.media({
387
- title: 'Select a image to upload',
388
- button: {
389
- text: 'Use this image',
390
- },
391
- multiple: false // Set to true to allow multiple files to be selected
392
- });
393
-
394
- // When an image is selected, run a callback.
395
- file_frame.on( 'select', function() {
396
- // We set multiple to false so only get one image from the uploader
397
- attachment = file_frame.state().get('selection').first().toJSON();
398
-
399
- callback(attachment.id, attachment.url);
400
- });
401
-
402
- // Finally, open the modal
403
- file_frame.open();
404
- },
405
-
406
- /**
407
- * @function getCurrentPosition
408
- * @summary This function will get the users position, it first attempts to get
409
- * high accuracy position (mobile with GPS sensors etc.), if that fails
410
- * (desktops will time out) then it tries again without high accuracy
411
- * enabled
412
- * @static
413
- * @return {object} The users position as a LatLng literal
414
- */
415
- getCurrentPosition: function(callback, error, watch)
416
- {
417
- var trigger = "userlocationfound";
418
- var nativeFunction = "getCurrentPosition";
419
-
420
- if(WPGMZA.userLocationDenied)
421
- {
422
- // NB: This code can also be reached on non https:// sites, the error code is the same
423
- if(error)
424
- error({code: 1, message: "Location unavailable"});
425
-
426
- return; // NB: The user has declined to share location. Only ask once per session.
427
- }
428
-
429
- if(watch)
430
- {
431
- trigger = "userlocationupdated";
432
- nativeFunction = "watchPosition";
433
-
434
- // Call again immediatly to get current position, watchPosition won't fire until the user moves
435
- /*setTimeout(function() {
436
- WPGMZA.getCurrentPosition(callback, false);
437
- }, 0);*/
438
- }
439
-
440
- if(!navigator.geolocation)
441
- {
442
- console.warn("No geolocation available on this device");
443
- return;
444
- }
445
-
446
- var options = {
447
- enableHighAccuracy: true
448
- };
449
-
450
- if(!navigator.geolocation[nativeFunction])
451
- {
452
- console.warn(nativeFunction + " is not available");
453
- return;
454
- }
455
-
456
- navigator.geolocation[nativeFunction](function(position) {
457
- if(callback)
458
- callback(position);
459
-
460
- WPGMZA.events.trigger("userlocationfound");
461
- },
462
- function(err) {
463
-
464
- options.enableHighAccuracy = false;
465
-
466
- navigator.geolocation[nativeFunction](function(position) {
467
- if(callback)
468
- callback(position);
469
-
470
- WPGMZA.events.trigger("userlocationfound");
471
- },
472
- function(err) {
473
- console.warn(err.code, err.message);
474
-
475
- if(err.code == 1)
476
- WPGMZA.userLocationDenied = true;
477
-
478
- if(error)
479
- error(err);
480
- },
481
- options);
482
-
483
- },
484
- options);
485
- },
486
-
487
- watchPosition: function(callback, error)
488
- {
489
- return WPGMZA.getCurrentPosition(callback, error, true);
490
- },
491
-
492
- /**
493
- * Runs a catchable task and displays a friendly error if the function throws an error
494
- * @method runCatchableTask
495
- * @static
496
- * @param {function} callback The function to run
497
- * @param {HTMLElement} friendlyErrorContainer The container element to hold the error
498
- * @return {void}
499
- * @see WPGMZA.FriendlyError
500
- */
501
- runCatchableTask: function(callback, friendlyErrorContainer) {
502
-
503
- if(WPGMZA.isDeveloperMode())
504
- callback();
505
- else
506
- try{
507
- callback();
508
- }catch(e) {
509
- var friendlyError = new WPGMZA.FriendlyError(e);
510
- $(friendlyErrorContainer).html("");
511
- $(friendlyErrorContainer).append(friendlyError.element);
512
- $(friendlyErrorContainer).show();
513
- }
514
- },
515
-
516
- capitalizeWords: function(string)
517
- {
518
- return (string + "").replace(/^(.)|\s+(.)/g, function(m) {
519
- return m.toUpperCase()
520
- });
521
- },
522
-
523
- pluralize: function(string)
524
- {
525
- return WPGMZA.singularize(string) + "s";
526
- },
527
-
528
- singularize: function(string)
529
- {
530
- return string.replace(/s$/, "");
531
- },
532
-
533
- /**
534
- * This function is for checking inheritence has been setup correctly. For objects that have engine and Pro specific classes, it will automatically add the engine and pro prefix to the supplied string and if such an object exists it will test against that name rather than the un-prefix argument supplied.
535
- *
536
- * For example, if we are running the Pro addon with Google maps as the engine, if you supply Marker as the instance name the function will check to see if instance is an instance of GoogleProMarker
537
- * @method assertInstanceOf
538
- * @static
539
- * @param {object} instance The object to check
540
- * @param {string} instanceName The class name as a string which this object should be an instance of
541
- * @return {void}
542
- */
543
- assertInstanceOf: function(instance, instanceName) {
544
- var engine, fullInstanceName, assert;
545
- var pro = WPGMZA.isProVersion() ? "Pro" : "";
546
-
547
- switch(WPGMZA.settings.engine)
548
- {
549
- case "open-layers":
550
- engine = "OL";
551
- break;
552
-
553
- default:
554
- engine = "Google";
555
- break;
556
- }
557
-
558
- if(
559
- WPGMZA[engine + pro + instanceName]
560
- &&
561
- engine + instanceName != "OLFeature" // NB: Some classes, such as OLFeature, are static utility classes and cannot be inherited from, do not check the inheritence chain for these
562
- )
563
- fullInstanceName = engine + pro + instanceName;
564
- else if(WPGMZA[pro + instanceName])
565
- fullInstanceName = pro + instanceName;
566
- else if(
567
- WPGMZA[engine + instanceName]
568
- &&
569
- WPGMZA[engine + instanceName].prototype
570
- )
571
- fullInstanceName = engine + instanceName;
572
- else
573
- fullInstanceName = instanceName;
574
-
575
- if(fullInstanceName == "OLFeature")
576
- return; // Nothing inherits from OLFeature - it's purely a "static" utility class
577
-
578
- assert = instance instanceof WPGMZA[fullInstanceName];
579
-
580
- if(!assert)
581
- throw new Error("Object must be an instance of " + fullInstanceName + " (did you call a constructor directly, rather than createInstance?)");
582
- },
583
-
584
- /**
585
- * @method getMapByID
586
- * @static
587
- * @param {mixed} id The ID of the map to retrieve
588
- * @return {object} The map object, or null if no such map exists
589
- */
590
- getMapByID: function(id) {
591
-
592
- for(var i = 0; i < WPGMZA.maps.length; i++) {
593
- if(WPGMZA.maps[i].id == id)
594
- return WPGMZA.maps[i];
595
- }
596
-
597
- return null;
598
-
599
- },
600
-
601
- /**
602
- * Shorthand function to determine if the Places Autocomplete is available
603
- * @method isGoogleAutocompleteSupported
604
- * @static
605
- * @return {boolean} True if the places autocomplete is available
606
- */
607
- isGoogleAutocompleteSupported: function() {
608
-
609
- if(!window.google)
610
- return false;
611
-
612
- if(!google.maps)
613
- return false;
614
-
615
- if(!google.maps.places)
616
- return false;
617
-
618
- if(!google.maps.places.Autocomplete)
619
- return false;
620
-
621
- if(WPGMZA.CloudAPI && WPGMZA.CloudAPI.isBeingUsed)
622
- return false;
623
-
624
- return true;
625
-
626
- },
627
-
628
- /**
629
- * The Google API status script enqueue, as reported by the server
630
- * @constant
631
- * @static
632
- */
633
- googleAPIStatus: window.wpgmza_google_api_status,
634
-
635
- /**
636
- * Makes an educated guess as to whether the browser is Safari
637
- * @method isSafari
638
- * @static
639
- * @return {boolean} True if it's likely the browser is Safari
640
- */
641
- isSafari: function() {
642
-
643
- var ua = navigator.userAgent.toLowerCase();
644
- return (ua.match(/safari/i) && !ua.match(/chrome/i));
645
-
646
- },
647
-
648
- /**
649
- * Makes an educated guess as to whether the browser is running on a touch device
650
- * @method isTouchDevice
651
- * @static
652
- * @return {boolean} True if it's likely the browser is running on a touch device
653
- */
654
- isTouchDevice: function() {
655
-
656
- return ("ontouchstart" in window);
657
-
658
- },
659
-
660
- /**
661
- * Makes an educated guess whether the browser is running on an iOS device
662
- * @method isDeviceiOS
663
- * @static
664
- * @return {boolean} True if it's likely the browser is running on an iOS device
665
- */
666
- isDeviceiOS: function() {
667
-
668
- return (
669
-
670
- (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
671
-
672
- ||
673
-
674
- (!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform))
675
-
676
- );
677
-
678
- },
679
-
680
- /**
681
- * This function prevents modern style components being used with new UI styles (8.0.0)
682
- * @method isModernComponentStyleAllowed
683
- * @static
684
- * @return {boolean} True if modern or legacy style is selected, or no UI style is selected
685
- */
686
- isModernComponentStyleAllowed: function() {
687
-
688
- return (!WPGMZA.settings.user_interface_style || WPGMZA.settings.user_interface_style == "legacy" || WPGMZA.settings.user_interface_style == "modern");
689
-
690
- },
691
-
692
- isElementInView: function(element) {
693
-
694
- var pageTop = $(window).scrollTop();
695
- var pageBottom = pageTop + $(window).height();
696
- var elementTop = $(element).offset().top;
697
- var elementBottom = elementTop + $(element).height();
698
-
699
- if(elementTop < pageTop && elementBottom > pageBottom)
700
- return true;
701
-
702
- if(elementTop >= pageTop && elementTop <= pageBottom)
703
- return true;
704
-
705
- if(elementBottom >= pageTop && elementBottom <= pageBottom)
706
- return true;
707
-
708
- return false;
709
-
710
- },
711
-
712
- isFullScreen: function() {
713
-
714
- return wpgmzaisFullScreen;
715
-
716
- },
717
-
718
- getQueryParamValue: function(name) {
719
-
720
- var regex = new RegExp(name + "=([^&#]*)");
721
- var m;
722
-
723
- if(!(m = window.location.href.match(regex)))
724
- return null;
725
-
726
- return decodeURIComponent(m[1]);
727
- },
728
-
729
- notification: function(text, time) {
730
-
731
- switch(arguments.length)
732
- {
733
- case 0:
734
- text = "";
735
- time = 4000;
736
- break;
737
-
738
- case 1:
739
- time = 4000;
740
- break;
741
- }
742
-
743
- var html = '<div class="wpgmza-popup-notification">' + text + '</div>';
744
- jQuery('body').append(html);
745
- setTimeout(function(){
746
- jQuery('body').find('.wpgmza-popup-notification').remove();
747
- }, time);
748
-
749
- },
750
-
751
- initMaps: function(){
752
- $(document.body).find(".wpgmza_map:not(.wpgmza-initialized)").each(function(index, el) {
753
- if(el.wpgmzaMap) {
754
- console.warn("Element missing class wpgmza-initialized but does have wpgmzaMap property. No new instance will be created");
755
- return;
756
- }
757
-
758
- el.wpgmzaMap = WPGMZA.Map.createInstance(el);
759
- });
760
-
761
- WPGMZA.Map.nextInitTimeoutID = setTimeout(WPGMZA.initMaps, 3000);
762
- },
763
-
764
- onScroll: function(){
765
- $(".wpgmza_map").each(function(index, el) {
766
- var isInView = WPGMZA.isElementInView(el);
767
- if(!el.wpgmzaScrollIntoViewTriggerFlag){
768
- if(isInView){
769
- $(el).trigger("mapscrolledintoview.wpgmza");
770
- el.wpgmzaScrollIntoViewTriggerFlag = true;
771
- }
772
- } else if(!isInView){
773
- el.wpgmzaScrollIntoViewTriggerFlag = false;
774
- }
775
-
776
- });
777
- }
778
-
779
- };
780
-
781
- var wpgmzaisFullScreen = false;
782
-
783
-
784
- // NB: Warn the user if the built in Array prototype has been extended. This will save debugging headaches where for ... in loops do bizarre things.
785
- for(var key in [])
786
- {
787
- console.warn("It appears that the built in JavaScript Array has been extended, this can create issues with for ... in loops, which may cause failure.");
788
- break;
789
- }
790
-
791
- if(window.WPGMZA)
792
- window.WPGMZA = $.extend(window.WPGMZA, core);
793
- else
794
- window.WPGMZA = core;
795
-
796
- /* Usercentrics base level integration */
797
- if(window.uc && window.uc.reloadOnOptIn){
798
- window.uc.reloadOnOptIn(
799
- 'S1pcEj_jZX'
800
- );
801
-
802
- window.uc.reloadOnOptOut(
803
- 'S1pcEj_jZX'
804
- );
805
- }
806
-
807
-
808
- for(var key in WPGMZA_localized_data){
809
- var value = WPGMZA_localized_data[key];
810
- WPGMZA[key] = value;
811
- }
812
-
813
- // delete window.WPGMZA_localized_data;
814
-
815
- WPGMZA.settings.useLegacyGlobals = true;
816
-
817
- $(document).on("fullscreenchange", function() {
818
- wpgmzaisFullScreen = document.fullscreenElement ? true : false;
819
- });
820
-
821
- $('body').on('click',"#wpgmzaCloseChat", function(e) {
822
- e.preventDefault();
823
- $.ajax(WPGMZA.ajaxurl, {
824
- method: 'POST',
825
- data: {
826
- action: 'wpgmza_hide_chat',
827
- nonce: WPGMZA_localized_data.ajaxnonce
828
- }
829
- });
830
- $('.wpgmza-chat-help').remove();
831
- });
832
-
833
-
834
- $(window).on("scroll", WPGMZA.onScroll);
835
-
836
- $(document.body).on("click", "button.wpgmza-api-consent", function(event) {
837
- Cookies.set("wpgmza-api-consent-given", true);
838
- window.location.reload();
839
- });
840
-
841
- $(document.body).on("keydown", function(event) {
842
- if(event.altKey)
843
- WPGMZA.altKeyDown = true;
844
- });
845
-
846
- $(document.body).on("keyup", function(event) {
847
- if(!event.altKey)
848
- WPGMZA.altKeyDown = false;
849
- });
850
-
851
- $(document.body).on('preinit.wpgmza', function(){
852
- $(window).trigger("ready.wpgmza");
853
-
854
- // Combined script warning
855
- if($("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length){
856
- console.warn("Minified script is out of date, using combined script instead.");
857
- }
858
-
859
- // Check for multiple jQuery versions
860
- var elements = $("script[src]").filter(function() {
861
- return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i);
862
- });
863
-
864
- if(elements.length > 1){
865
- console.warn("Multiple jQuery versions detected: ", elements);
866
- }
867
-
868
- // Rest API
869
- WPGMZA.restAPI = WPGMZA.RestAPI.createInstance();
870
- if(WPGMZA.CloudAPI){
871
- WPGMZA.cloudAPI = WPGMZA.CloudAPI.createInstance();
872
- }
873
-
874
- // Array incorrectly extended warning
875
- var test = [];
876
- for(var key in test) {
877
- console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");
878
- break;
879
- }
880
-
881
- // Geolocation warnings
882
- if(window.location.protocol != 'https:'){
883
- var warning = '<div class="notice notice-warning"><p>' + WPGMZA.localized_strings.unsecure_geolocation + "</p></div>";
884
-
885
- $(".wpgmza-geolocation-setting").first().after( $(warning) );
886
- }
887
-
888
- if(WPGMZA.googleAPIStatus && WPGMZA.googleAPIStatus.code == "USER_CONSENT_NOT_GIVEN") {
889
- if(jQuery('.wpgmza-gdpr-compliance').length <= 0){
890
- /*$("#wpgmza_map, .wpgmza_map").each(function(index, el) {
891
- $(el).append($(WPGMZA.api_consent_html));
892
- $(el).css({height: "auto"});
893
- });*/
894
-
895
- $("button.wpgmza-api-consent").on("click", function(event) {
896
- Cookies.set("wpgmza-api-consent-given", true);
897
- window.location.reload();
898
- });
899
- }
900
-
901
- return;
902
- }
903
- });
904
-
905
- /**
906
- * Set timeout has the same effect as an embedded $.ready call,
907
- *
908
- * It's not ideal, our architecture should be more robust and not rely on win-the-race execution orders,
909
- *
910
- * For now this will do the job, but V9 should really look at reworking this across the board into something that fires via events
911
- */
912
-
913
- setTimeout(function(){
914
- $(document.body).trigger('preinit.wpgmza');
915
- }, 0);
916
-
917
-
918
- setTimeout(function(){
919
- WPGMZA.initMaps();
920
- WPGMZA.onScroll();
921
- }, 0)
922
-
923
- });
924
-
925
- // js/v8/compatibility.js
926
- /**
927
- * @namespace WPGMZA
928
- * @module Compatibility
929
- * @requires WPGMZA
930
- */
931
- jQuery(function($) {
932
-
933
- /**
934
- * Reverse compatibility module
935
- *
936
- * @class WPGMZA.Compatibility
937
- * @constructor WPGMZA.Compatibility
938
- * @memberof WPGMZA
939
- */
940
- WPGMZA.Compatibility = function()
941
- {
942
- this.preventDocumentWriteGoogleMapsAPI();
943
- }
944
-
945
- /**
946
- * Prevents document.write from outputting Google Maps API script tag
947
- *
948
- * @method
949
- * @memberof WPGMZA.Compatibility
950
- */
951
- WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI = function()
952
- {
953
- var old = document.write;
954
-
955
- document.write = function(content)
956
- {
957
- if(content.match && content.match(/maps\.google/))
958
- return;
959
-
960
- old.call(document, content);
961
- }
962
- }
963
-
964
- WPGMZA.compatiblityModule = new WPGMZA.Compatibility();
965
-
966
- });
967
-
968
- // js/v8/css-escape.js
969
- /**
970
- * Polyfill for CSS.escape, with thanks to @mathias
971
- * @namespace WPGMZA
972
- * @module CSS
973
- * @requires WPGMZA
974
- */
975
-
976
- /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
977
- ;(function(root, factory) {
978
- // https://github.com/umdjs/umd/blob/master/returnExports.js
979
- if (typeof exports == 'object') {
980
- // For Node.js.
981
- module.exports = factory(root);
982
- } else if (typeof define == 'function' && define.amd) {
983
- // For AMD. Register as an anonymous module.
984
- define([], factory.bind(root, root));
985
- } else {
986
- // For browser globals (not exposing the function separately).
987
- factory(root);
988
- }
989
- }(typeof global != 'undefined' ? global : this, function(root) {
990
-
991
- if (root.CSS && root.CSS.escape) {
992
- return root.CSS.escape;
993
- }
994
-
995
- // https://drafts.csswg.org/cssom/#serialize-an-identifier
996
- var cssEscape = function(value) {
997
- if (arguments.length == 0) {
998
- throw new TypeError('`CSS.escape` requires an argument.');
999
- }
1000
- var string = String(value);
1001
- var length = string.length;
1002
- var index = -1;
1003
- var codeUnit;
1004
- var result = '';
1005
- var firstCodeUnit = string.charCodeAt(0);
1006
- while (++index < length) {
1007
- codeUnit = string.charCodeAt(index);
1008
- // Note: there’s no need to special-case astral symbols, surrogate
1009
- // pairs, or lone surrogates.
1010
-
1011
- // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
1012
- // (U+FFFD).
1013
- if (codeUnit == 0x0000) {
1014
- result += '\uFFFD';
1015
- continue;
1016
- }
1017
-
1018
- if (
1019
- // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
1020
- // U+007F, […]
1021
- (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
1022
- // If the character is the first character and is in the range [0-9]
1023
- // (U+0030 to U+0039), […]
1024
- (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
1025
- // If the character is the second character and is in the range [0-9]
1026
- // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
1027
- (
1028
- index == 1 &&
1029
- codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
1030
- firstCodeUnit == 0x002D
1031
- )
1032
- ) {
1033
- // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
1034
- result += '\\' + codeUnit.toString(16) + ' ';
1035
- continue;
1036
- }
1037
-
1038
- if (
1039
- // If the character is the first character and is a `-` (U+002D), and
1040
- // there is no second character, […]
1041
- index == 0 &&
1042
- length == 1 &&
1043
- codeUnit == 0x002D
1044
- ) {
1045
- result += '\\' + string.charAt(index);
1046
- continue;
1047
- }
1048
-
1049
- // If the character is not handled by one of the above rules and is
1050
- // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
1051
- // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
1052
- // U+005A), or [a-z] (U+0061 to U+007A), […]
1053
- if (
1054
- codeUnit >= 0x0080 ||
1055
- codeUnit == 0x002D ||
1056
- codeUnit == 0x005F ||
1057
- codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
1058
- codeUnit >= 0x0041 && codeUnit <= 0x005A ||
1059
- codeUnit >= 0x0061 && codeUnit <= 0x007A
1060
- ) {
1061
- // the character itself
1062
- result += string.charAt(index);
1063
- continue;
1064
- }
1065
-
1066
- // Otherwise, the escaped character.
1067
- // https://drafts.csswg.org/cssom/#escape-a-character
1068
- result += '\\' + string.charAt(index);
1069
-
1070
- }
1071
- return result;
1072
- };
1073
-
1074
- if (!root.CSS) {
1075
- root.CSS = {};
1076
- }
1077
-
1078
- root.CSS.escape = cssEscape;
1079
- return cssEscape;
1080
-
1081
- }));
1082
-
1083
- // js/v8/distance.js
1084
- /**
1085
- * Collection of distance utility functions and constants
1086
- * @namespace WPGMZA
1087
- * @module Distance
1088
- * @requires WPGMZA
1089
- */
1090
- jQuery(function($) {
1091
-
1092
- var earthRadiusMeters = 6371;
1093
- var piTimes360 = Math.PI / 360;
1094
-
1095
- function deg2rad(deg) {
1096
- return deg * (Math.PI/180)
1097
- };
1098
-
1099
- /**
1100
- * @class WPGMZA.Distance
1101
- * @memberof WPGMZA
1102
- * @deprecated Will be dropped wiht the introduction of global distance units
1103
- */
1104
- WPGMZA.Distance = {
1105
-
1106
- /**
1107
- * Miles, represented as true by legacy versions of the plugin
1108
- * @constant MILES
1109
- * @static
1110
- * @memberof WPGMZA.Distance
1111
- */
1112
- MILES: true,
1113
-
1114
- /**
1115
- * Kilometers, represented as false by legacy versions of the plugin
1116
- * @constant KILOMETERS
1117
- * @static
1118
- * @memberof WPGMZA.Distance
1119
- */
1120
- KILOMETERS: false,
1121
-
1122
- /**
1123
- * Miles per kilometer
1124
- * @constant MILES_PER_KILOMETER
1125
- * @static
1126
- * @memberof WPGMZA.Distance
1127
- */
1128
- MILES_PER_KILOMETER: 0.621371,
1129
-
1130
- /**
1131
- * Kilometers per mile
1132
- * @constant KILOMETERS_PER_MILE
1133
- * @static
1134
- */
1135
- KILOMETERS_PER_MILE: 1.60934,
1136
-
1137
- // TODO: Implement WPGMZA.settings.distance_units
1138
-
1139
- /**
1140
- * Converts a UI distance (eg from a form control) to meters,
1141
- * accounting for the global units setting
1142
- * @method uiToMeters
1143
- * @static
1144
- * @memberof WPGMZA.Distance
1145
- * @param {number} uiDistance The distance from the UI, could be in miles or kilometers depending on settings
1146
- * @return {number} The input distance in meters
1147
- */
1148
- uiToMeters: function(uiDistance)
1149
- {
1150
- return parseFloat(uiDistance) / (WPGMZA.settings.distance_units == WPGMZA.Distance.MILES ? WPGMZA.Distance.MILES_PER_KILOMETER : 1) * 1000;
1151
- },
1152
-
1153
- /**
1154
- * Converts a UI distance (eg from a form control) to kilometers,
1155
- * accounting for the global units setting
1156
- * @method uiToKilometers
1157
- * @static
1158
- * @memberof WPGMZA.Distance
1159
- * @param {number} uiDistance The distance from the UI, could be in miles or kilometers depending on settings
1160
- * @return {number} The input distance in kilometers
1161
- */
1162
- uiToKilometers: function(uiDistance)
1163
- {
1164
- return WPGMZA.Distance.uiToMeters(uiDistance) * 0.001;
1165
- },
1166
-
1167
- /**
1168
- * Converts a UI distance (eg from a form control) to miles, according to settings
1169
- * @method uiToMiles
1170
- * @static
1171
- * @memberof WPGMZA.Distance
1172
- * @param {number} uiDistance The distance from the UI, could be in miles or kilometers depending on settings
1173
- * @return {number} The input distance
1174
- */
1175
- uiToMiles: function(uiDistance)
1176
- {
1177
- return WPGMZA.Distance.uiToKilometers(uiDistance) * WPGMZA.Distance.MILES_PER_KILOMETER;
1178
- },
1179
-
1180
- /**
1181
- * Converts kilometers to a UI distance, either the same value, or converted to miles depending on settings.
1182
- * @method kilometersToUI
1183
- * @static
1184
- * @memberof WPGMZA.Distance
1185
- * @param {number} km The input distance in kilometers
1186
- * @param {number} The UI distance in the units specified by settings
1187
- */
1188
- kilometersToUI: function(km)
1189
- {
1190
- if(WPGMZA.settings.distance_units == WPGMZA.Distance.MILES)
1191
- return km * WPGMZA.Distance.MILES_PER_KILOMETER;
1192
- return km;
1193
- },
1194
-
1195
- /**
1196
- * Returns the distance, in kilometers, between two LatLng's
1197
- * @method between
1198
- * @static
1199
- * @memberof WPGMZA.Distance
1200
- * @param {WPGMZA.Latlng} The first point
1201
- * @param {WPGMZA.Latlng} The second point
1202
- * @return {number} The distance, in kilometers
1203
- */
1204
- between: function(a, b)
1205
- {
1206
- if(!(a instanceof WPGMZA.LatLng) && !("lat" in a && "lng" in a))
1207
- throw new Error("First argument must be an instance of WPGMZA.LatLng or a literal");
1208
-
1209
- if(!(b instanceof WPGMZA.LatLng) && !("lat" in b && "lng" in b))
1210
- throw new Error("Second argument must be an instance of WPGMZA.LatLng or a literal");
1211
-
1212
- if(a === b)
1213
- return 0.0;
1214
-
1215
- var lat1 = a.lat;
1216
- var lon1 = a.lng;
1217
- var lat2 = b.lat;
1218
- var lon2 = b.lng;
1219
-
1220
- var dLat = deg2rad(lat2 - lat1);
1221
- var dLon = deg2rad(lon2 - lon1);
1222
-
1223
- var a =
1224
- Math.sin(dLat/2) * Math.sin(dLat/2) +
1225
- Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
1226
- Math.sin(dLon/2) * Math.sin(dLon/2);
1227
-
1228
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
1229
- var d = earthRadiusMeters * c; // Distance in km
1230
-
1231
- return d;
1232
- }
1233
-
1234
- };
1235
-
1236
- });
1237
-
1238
- // js/v8/elias-fano.js
1239
- /**
1240
- * @namespace WPGMZA
1241
- * @module EliasFano
1242
- * @requires WPGMZA
1243
- */
1244
- jQuery(function($) {
1245
-
1246
- WPGMZA.EliasFano = function()
1247
- {
1248
- if(!WPGMZA.EliasFano.isSupported)
1249
- throw new Error("Elias Fano encoding is not supported on browsers without Uint8Array");
1250
-
1251
- if(!WPGMZA.EliasFano.decodingTablesInitialised)
1252
- WPGMZA.EliasFano.createDecodingTable();
1253
- }
1254
-
1255
- WPGMZA.EliasFano.isSupported = ("Uint8Array" in window);
1256
-
1257
- WPGMZA.EliasFano.decodingTableHighBits = [];
1258
- WPGMZA.EliasFano.decodingTableDocIDNumber = null;
1259
- WPGMZA.EliasFano.decodingTableHighBitsCarryover = null;
1260
-
1261
- WPGMZA.EliasFano.createDecodingTable = function()
1262
- {
1263
- WPGMZA.EliasFano.decodingTableDocIDNumber = new Uint8Array(256);
1264
- WPGMZA.EliasFano.decodingTableHighBitsCarryover = new Uint8Array(256);
1265
-
1266
- var decodingTableHighBits = WPGMZA.EliasFano.decodingTableHighBits;
1267
- var decodingTableDocIDNumber = WPGMZA.EliasFano.decodingTableDocIDNumber;
1268
- var decodingTableHighBitsCarryover = WPGMZA.EliasFano.decodingTableHighBitsCarryover;
1269
-
1270
- for(var i = 0; i < 256; i++)
1271
- {
1272
- var zeroCount = 0;
1273
-
1274
- decodingTableHighBits[i] = [];
1275
-
1276
- for(var j = 7; j >= 0; j--)
1277
- {
1278
- if((i & (1 << j)) > 0)
1279
- {
1280
- decodingTableHighBits[i][decodingTableDocIDNumber[i]] = zeroCount;
1281
-
1282
- decodingTableDocIDNumber[i]++;
1283
- zeroCount = 0;
1284
- }
1285
- else
1286
- zeroCount = (zeroCount + 1) % 0xFF;
1287
- }
1288
-
1289
- decodingTableHighBitsCarryover[i] = zeroCount;
1290
- }
1291
-
1292
- WPGMZA.EliasFano.decodingTablesInitialised = true;
1293
- }
1294
-
1295
- WPGMZA.EliasFano.prototype.encode = function(list)
1296
- {
1297
- var lastDocID = 0,
1298
- buffer1 = 0,
1299
- bufferLength1 = 0,
1300
- buffer2 = 0,
1301
- bufferLength2 = 0;
1302
-
1303
- if(list.length == 0)
1304
- return result;
1305
-
1306
- function toByte(n)
1307
- {
1308
- return n & 0xFF;
1309
- }
1310
-
1311
- var compressedBufferPointer1 = 0;
1312
- var compressedBufferPointer2 = 0;
1313
- var largestBlockID = list[list.length - 1];
1314
- var averageDelta = largestBlockID / list.length;
1315
- var averageDeltaLog = Math.log2(averageDelta);
1316
- var lowBitsLength = Math.floor(averageDeltaLog);
1317
- var lowBitsMask = (1 << lowBitsLength) - 1;
1318
- var prev = null;
1319
-
1320
- var maxCompressedSize = Math.floor(
1321
- (
1322
- 2 + Math.ceil(
1323
- Math.log2(averageDelta)
1324
- )
1325
- ) * list.length / 8
1326
- ) + 6;
1327
-
1328
- var compressedBuffer = new Uint8Array(maxCompressedSize);
1329
-
1330
- if(lowBitsLength < 0)
1331
- lowBitsLength = 0;
1332
-
1333
- compressedBufferPointer2 = Math.floor(lowBitsLength * list.length / 8 + 6);
1334
-
1335
- compressedBuffer[compressedBufferPointer1++] = toByte( list.length );
1336
- compressedBuffer[compressedBufferPointer1++] = toByte( list.length >> 8 );
1337
- compressedBuffer[compressedBufferPointer1++] = toByte( list.length >> 16 );
1338
- compressedBuffer[compressedBufferPointer1++] = toByte( list.length >> 24 );
1339
-
1340
- compressedBuffer[compressedBufferPointer1++] = toByte( lowBitsLength );
1341
-
1342
- list.forEach(function(docID) {
1343
-
1344
- var docIDDelta = (docID - lastDocID - 1);
1345
-
1346
- if(!$.isNumeric(docID))
1347
- throw new Error("Value is not numeric");
1348
-
1349
- // NB: Force docID to an integer in case it's a string
1350
- docID = parseInt(docID);
1351
-
1352
- if(prev !== null && docID <= prev)
1353
- throw new Error("Elias Fano encoding can only be used on a sorted, ascending list of unique integers.");
1354
-
1355
- prev = docID;
1356
-
1357
- buffer1 <<= lowBitsLength;
1358
- buffer1 |= (docIDDelta & lowBitsMask);
1359
- bufferLength1 += lowBitsLength;
1360
-
1361
- // Flush buffer 1
1362
- while(bufferLength1 > 7)
1363
- {
1364
- bufferLength1 -= 8;
1365
- compressedBuffer[compressedBufferPointer1++] = toByte( buffer1 >> bufferLength1 );
1366
- }
1367
-
1368
- var unaryCodeLength = (docIDDelta >> lowBitsLength) + 1;
1369
-
1370
- buffer2 <<= unaryCodeLength;
1371
- buffer2 |= 1;
1372
- bufferLength2 += unaryCodeLength;
1373
-
1374
- // Flush buffer 2
1375
- while(bufferLength2 > 7)
1376
- {
1377
- bufferLength2 -= 8;
1378
- compressedBuffer[compressedBufferPointer2++] = toByte( buffer2 >> bufferLength2 );
1379
- }
1380
-
1381
- lastDocID = docID;
1382
- });
1383
-
1384
- if(bufferLength1 > 0)
1385
- compressedBuffer[compressedBufferPointer1++] = toByte( buffer1 << (8 - bufferLength1) );
1386
-
1387
- if(bufferLength2 > 0)
1388
- compressedBuffer[compressedBufferPointer2++] = toByte( buffer2 << (8 - bufferLength2) );
1389
-
1390
- var result = new Uint8Array(compressedBuffer);
1391
-
1392
- result.pointer = compressedBufferPointer2;
1393
-
1394
- return result;
1395
- }
1396
-
1397
- WPGMZA.EliasFano.prototype.decode = function(compressedBuffer)
1398
- {
1399
- var resultPointer = 0;
1400
- var list = [];
1401
-
1402
- //console.log("Decoding buffer from pointer " + compressedBuffer.pointer);
1403
- //console.log(compressedBuffer);
1404
-
1405
- var decodingTableHighBits = WPGMZA.EliasFano.decodingTableHighBits;
1406
- var decodingTableDocIDNumber = WPGMZA.EliasFano.decodingTableDocIDNumber;
1407
- var decodingTableHighBitsCarryover = WPGMZA.EliasFano.decodingTableHighBitsCarryover;
1408
-
1409
- var lowBitsPointer = 0,
1410
- lastDocID = 0,
1411
- docID = 0,
1412
- docIDNumber = 0;
1413
-
1414
- var listCount = compressedBuffer[lowBitsPointer++];
1415
-
1416
- //console.log("listCount is now " + listCount);
1417
-
1418
- listCount |= compressedBuffer[lowBitsPointer++] << 8;
1419
-
1420
- //console.log("listCount is now " + listCount);
1421
-
1422
- listCount |= compressedBuffer[lowBitsPointer++] << 16;
1423
-
1424
- //console.log("listCount is now " + listCount);
1425
-
1426
- listCount |= compressedBuffer[lowBitsPointer++] << 24;
1427
-
1428
- //console.log("Read list count " + listCount);
1429
-
1430
- var lowBitsLength = compressedBuffer[lowBitsPointer++];
1431
-
1432
- //console.log("lowBitsLength = " + lowBitsLength);
1433
-
1434
- var highBitsPointer,
1435
- lowBitsCount = 0,
1436
- lowBits = 0,
1437
- cb = 1;
1438
-
1439
- for(
1440
- highBitsPointer = Math.floor(lowBitsLength * listCount / 8 + 6);
1441
- highBitsPointer < compressedBuffer.pointer;
1442
- highBitsPointer++
1443
- )
1444
- {
1445
- docID += decodingTableHighBitsCarryover[cb];
1446
- cb = compressedBuffer[highBitsPointer];
1447
-
1448
- docIDNumber = decodingTableDocIDNumber[cb];
1449
-
1450
- for(var i = 0; i < docIDNumber; i++)
1451
- {
1452
- docID <<= lowBitsCount;
1453
- docID |= lowBits & ((1 << lowBitsCount) - 1);
1454
-
1455
- while(lowBitsCount < lowBitsLength)
1456
- {
1457
- docID <<= 8;
1458
-
1459
- lowBits = compressedBuffer[lowBitsPointer++];
1460
- docID |= lowBits;
1461
- lowBitsCount += 8;
1462
- }
1463
-
1464
- lowBitsCount -= lowBitsLength;
1465
- docID >>= lowBitsCount;
1466
-
1467
- docID += (decodingTableHighBits[cb][i] << lowBitsLength) + lastDocID + 1;
1468
-
1469
- list[resultPointer++] = docID;
1470
-
1471
- lastDocID = docID;
1472
- docID = 0;
1473
- }
1474
- }
1475
-
1476
- return list;
1477
- }
1478
-
1479
- });
1480
-
1481
- // js/v8/event-dispatcher.js
1482
- /**
1483
- * @namespace WPGMZA
1484
- * @module EventDispatcher
1485
- * @requires WPGMZA
1486
- */
1487
- jQuery(function($) {
1488
-
1489
- /**
1490
- * Base class for any (non HTMLElement) object which dispatches or listens for events
1491
- * @class WPGMZA.EventDispatcher
1492
- * @constructor WPGMZA.EventDispatcher
1493
- * @memberof WPGMZA
1494
- */
1495
- WPGMZA.EventDispatcher = function()
1496
- {
1497
- WPGMZA.assertInstanceOf(this, "EventDispatcher");
1498
-
1499
- this._listenersByType = {};
1500
- }
1501
-
1502
- /**
1503
- * Adds an event listener on this object
1504
- * @method
1505
- * @memberof WPGMZA.EventDispatcher
1506
- * @param {string} type The event type, or multiple types separated by spaces
1507
- * @param {function} callback The callback to call when the event fires
1508
- * @param {object} [thisObject] The object to use as "this" when firing the callback
1509
- * @param {bool} [useCapture] If true, fires the callback on the capture phase, as opposed to bubble phase
1510
- */
1511
- WPGMZA.EventDispatcher.prototype.addEventListener = function(type, listener, thisObject, useCapture)
1512
- {
1513
- var types = type.split(/\s+/);
1514
- if(types.length > 1)
1515
- {
1516
- for(var i = 0; i < types.length; i++)
1517
- this.addEventListener(types[i], listener, thisObject, useCapture);
1518
-
1519
- return;
1520
- }
1521
-
1522
- if(!(listener instanceof Function))
1523
- throw new Error("Listener must be a function");
1524
-
1525
- var target;
1526
- if(!this._listenersByType.hasOwnProperty(type))
1527
- target = this._listenersByType[type] = [];
1528
- else
1529
- target = this._listenersByType[type];
1530
-
1531
- var obj = {
1532
- listener: listener,
1533
- thisObject: (thisObject ? thisObject : this),
1534
- useCapture: (useCapture ? true : false)
1535
- };
1536
-
1537
- target.push(obj);
1538
- }
1539
-
1540
- /**
1541
- * Alias for addEventListener
1542
- * @method
1543
- * @memberof WPGMZA.EventDispatcher
1544
- * @see WPGMZA.EventDispatcher#addEventListener
1545
- */
1546
- WPGMZA.EventDispatcher.prototype.on = WPGMZA.EventDispatcher.prototype.addEventListener;
1547
-
1548
- /**
1549
- * Removes event listeners from this object
1550
- * @method
1551
- * @memberof WPGMZA.EventDispatcher
1552
- * @param {string} type The event type to remove listeners from
1553
- * @param {function} [listener] The function to remove. If omitted, all listeners will be removed
1554
- * @param {object} [thisObject] Use the parameter to remove listeners bound with the same thisObject
1555
- * @param {bool} [useCapture] Remove the capture phase event listener. Otherwise, the bubble phase event listener will be removed.
1556
- */
1557
- WPGMZA.EventDispatcher.prototype.removeEventListener = function(type, listener, thisObject, useCapture)
1558
- {
1559
- var arr, index, obj;
1560
-
1561
- if(!(arr = this._listenersByType[type]))
1562
- return;
1563
-
1564
- if(!thisObject)
1565
- thisObject = this;
1566
-
1567
- useCapture = (useCapture ? true : false);
1568
-
1569
- for(var i = 0; i < arr.length; i++)
1570
- {
1571
- obj = arr[i];
1572
-
1573
- if((arguments.length == 1 || obj.listener == listener) && obj.thisObject == thisObject && obj.useCapture == useCapture)
1574
- {
1575
- arr.splice(i, 1);
1576
- return;
1577
- }
1578
- }
1579
- }
1580
-
1581
- /**
1582
- * Alias for removeEventListener
1583
- * @method
1584
- * @memberof WPGMZA.EventDispatcher
1585
- * @see WPGMZA.EventDispatcher#removeEventListener
1586
- */
1587
- WPGMZA.EventDispatcher.prototype.off = WPGMZA.EventDispatcher.prototype.removeEventListener;
1588
-
1589
- /**
1590
- * Test for listeners of type on this object
1591
- * @method
1592
- * @memberof WPGMZA.EventDispatcher
1593
- * @param {string} type The event type to test for
1594
- * @return {bool} True if this object has listeners bound for the specified type
1595
- */
1596
- WPGMZA.EventDispatcher.prototype.hasEventListener = function(type)
1597
- {
1598
- return (_listenersByType[type] ? true : false);
1599
- }
1600
-
1601
- /**
1602
- * Fires an event on this object
1603
- * @method
1604
- * @memberof WPGMZA.EventDispatcher
1605
- * @param {string|WPGMZA.Event} event Either the event type as a string, or an instance of WPGMZA.Event
1606
- */
1607
- WPGMZA.EventDispatcher.prototype.dispatchEvent = function(event) {
1608
-
1609
- if(!(event instanceof WPGMZA.Event)) {
1610
- if(typeof event == "string")
1611
- event = new WPGMZA.Event(event);
1612
- else
1613
- {
1614
- var src = event;
1615
- event = new WPGMZA.Event();
1616
- for(var name in src)
1617
- event[name] = src[name];
1618
- }
1619
- }
1620
-
1621
-
1622
-
1623
- event.target = this;
1624
-
1625
- var path = [];
1626
- for(var obj = this.parent; obj != null; obj = obj.parent)
1627
- path.unshift(obj);
1628
-
1629
- event.phase = WPGMZA.Event.CAPTURING_PHASE;
1630
- for(var i = 0; i < path.length && !event._cancelled; i++)
1631
- path[i]._triggerListeners(event);
1632
-
1633
- if(event._cancelled)
1634
- return;
1635
-
1636
- event.phase = WPGMZA.Event.AT_TARGET;
1637
- this._triggerListeners(event);
1638
-
1639
- event.phase = WPGMZA.Event.BUBBLING_PHASE;
1640
- for(i = path.length - 1; i >= 0 && !event._cancelled; i--)
1641
- path[i]._triggerListeners(event);
1642
-
1643
- // Native DOM event
1644
- var topMostElement = this.element;
1645
- for(var obj = this.parent; obj != null; obj = obj.parent)
1646
- {
1647
- if(obj.element)
1648
- topMostElement = obj.element;
1649
- }
1650
-
1651
- if(topMostElement)
1652
- {
1653
- var customEvent = {};
1654
-
1655
- for(var key in event)
1656
- {
1657
- var value = event[key];
1658
-
1659
- if(key == "type")
1660
- value += ".wpgmza";
1661
-
1662
- customEvent[key] = value;
1663
- }
1664
- $(topMostElement).trigger(customEvent);
1665
- }
1666
- }
1667
-
1668
- /**
1669
- * Alias for removeEventListener
1670
- * @method
1671
- * @memberof WPGMZA.EventDispatcher
1672
- * @see WPGMZA.EventDispatcher#removeEventListener
1673
- */
1674
- WPGMZA.EventDispatcher.prototype.trigger = WPGMZA.EventDispatcher.prototype.dispatchEvent;
1675
-
1676
- /**
1677
- * Handles the logic of triggering listeners
1678
- * @method
1679
- * @memberof WPGMZA.EventDispatcher
1680
- * @inner
1681
- */
1682
- WPGMZA.EventDispatcher.prototype._triggerListeners = function(event)
1683
- {
1684
- var arr, obj;
1685
-
1686
- if(!(arr = this._listenersByType[event.type]))
1687
- return;
1688
-
1689
- for(var i = 0; i < arr.length; i++)
1690
- {
1691
- obj = arr[i];
1692
-
1693
- if(event.phase == WPGMZA.Event.CAPTURING_PHASE && !obj.useCapture)
1694
- continue;
1695
-
1696
- obj.listener.call(arr[i].thisObject, event);
1697
- }
1698
- }
1699
-
1700
- WPGMZA.events = new WPGMZA.EventDispatcher();
1701
-
1702
- });
1703
 
1704
- // js/v8/address-input.js
1705
- /**
1706
- * @namespace WPGMZA
1707
- * @module AddressInput
1708
- * @requires WPGMZA.EventDispatcher
1709
- */
1710
- jQuery(function($) {
1711
-
1712
- WPGMZA.AddressInput = function(element, map)
1713
- {
1714
- if(!(element instanceof HTMLInputElement))
1715
- throw new Error("Element is not an instance of HTMLInputElement");
1716
-
1717
- this.element = element;
1718
-
1719
-
1720
-
1721
- var json;
1722
- var options = {
1723
- fields: ["name", "formatted_address"],
1724
- types: ["geocode", "establishment"]
1725
- };
1726
-
1727
- if(json = $(element).attr("data-autocomplete-options"))
1728
- options = $.extend(options, JSON.parse(json));
1729
-
1730
- if(map && map.settings.wpgmza_store_locator_restrict)
1731
- options.country = map.settings.wpgmza_store_locator_restrict;
1732
-
1733
- if(WPGMZA.isGoogleAutocompleteSupported()) {
1734
- // only apply Google Places Autocomplete if they are usig their own API key. If not, they will use our Cloud API Complete Service
1735
- if (this.id != 'wpgmza_add_address_map_editor' && WPGMZA_localized_data.settings.googleMapsApiKey && WPGMZA_localized_data.settings.googleMapsApiKey !== '') {
1736
- element.googleAutoComplete = new google.maps.places.Autocomplete(element, options);
1737
-
1738
- if(options.country)
1739
- element.googleAutoComplete.setComponentRestrictions({country: options.country});
1740
- }
1741
- }
1742
- else if(WPGMZA.CloudAPI && WPGMZA.CloudAPI.isBeingUsed)
1743
- element.cloudAutoComplete = new WPGMZA.CloudAutocomplete(element, options);
1744
- }
1745
-
1746
- WPGMZA.extend(WPGMZA.AddressInput, WPGMZA.EventDispatcher);
1747
-
1748
- WPGMZA.AddressInput.createInstance = function(element, map) {
1749
- return new WPGMZA.AddressInput(element, map);
1750
- }
1751
-
1752
- /*$(window).on("load", function(event) {
1753
-
1754
- $("input.wpgmza-address").each(function(index, el) {
1755
-
1756
- el.wpgmzaAddressInput = WPGMZA.AddressInput.createInstance(el);
1757
-
1758
- });
1759
-
1760
- });*/
1761
-
1762
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1763
 
1764
- // js/v8/drawing-manager.js
1765
- /**
1766
- * @namespace WPGMZA
1767
- * @module DrawingManager
1768
- * @requires WPGMZA.EventDispatcher
1769
- */
1770
- jQuery(function($) {
1771
-
1772
- WPGMZA.DrawingManager = function(map)
1773
- {
1774
- WPGMZA.assertInstanceOf(this, "DrawingManager");
1775
-
1776
- WPGMZA.EventDispatcher.call(this);
1777
-
1778
- this.map = map;
1779
- this.mode = WPGMZA.DrawingManager.MODE_NONE;
1780
- }
1781
-
1782
- WPGMZA.DrawingManager.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
1783
- WPGMZA.DrawingManager.prototype.constructor = WPGMZA.DrawingManager;
1784
-
1785
- WPGMZA.DrawingManager.MODE_NONE = null;
1786
- WPGMZA.DrawingManager.MODE_MARKER = "marker";
1787
- WPGMZA.DrawingManager.MODE_POLYGON = "polygon";
1788
- WPGMZA.DrawingManager.MODE_POLYLINE = "polyline";
1789
- WPGMZA.DrawingManager.MODE_CIRCLE = "circle";
1790
- WPGMZA.DrawingManager.MODE_RECTANGLE = "rectangle";
1791
- WPGMZA.DrawingManager.MODE_HEATMAP = "heatmap";
1792
-
1793
- WPGMZA.DrawingManager.getConstructor = function()
1794
- {
1795
- switch(WPGMZA.settings.engine)
1796
- {
1797
- case "google-maps":
1798
- return WPGMZA.GoogleDrawingManager;
1799
- break;
1800
-
1801
- default:
1802
- return WPGMZA.OLDrawingManager;
1803
- break;
1804
- }
1805
- }
1806
-
1807
- WPGMZA.DrawingManager.createInstance = function(map)
1808
- {
1809
- var constructor = WPGMZA.DrawingManager.getConstructor();
1810
- return new constructor(map);
1811
- }
1812
-
1813
- WPGMZA.DrawingManager.prototype.setDrawingMode = function(mode) {
1814
-
1815
- this.mode = mode;
1816
-
1817
- this.trigger("drawingmodechanged");
1818
- }
1819
-
1820
  });
1821
 
1822
- // js/v8/event.js
 
1823
  /**
1824
  * @namespace WPGMZA
1825
- * @module Event
1826
  * @requires WPGMZA
1827
- */
1828
  jQuery(function($) {
1829
-
1830
  /**
1831
- * Base class used for events (for non-HTMLElement objects)
1832
- * @class WPGMZA.Event
1833
- * @constructor WPGMZA.Event
 
1834
  * @memberof WPGMZA
1835
- * @param {string|object} options The event type as a string, or an object of options to be mapped to this event
1836
  */
1837
- WPGMZA.Event = function(options)
1838
  {
1839
- if(typeof options == "string")
1840
- this.type = options;
1841
-
1842
- this.bubbles = true;
1843
- this.cancelable = true;
1844
- this.phase = WPGMZA.Event.PHASE_CAPTURE;
1845
- this.target = null;
1846
-
1847
- this._cancelled = false;
1848
-
1849
- if(typeof options == "object")
1850
- for(var name in options)
1851
- this[name] = options[name];
1852
  }
1853
-
1854
- WPGMZA.Event.CAPTURING_PHASE = 0;
1855
- WPGMZA.Event.AT_TARGET = 1;
1856
- WPGMZA.Event.BUBBLING_PHASE = 2;
1857
-
1858
  /**
1859
- * Prevents any further propagation of this event
 
1860
  * @method
1861
- * @memberof WPGMZA.Event
1862
  */
1863
- WPGMZA.Event.prototype.stopPropagation = function()
1864
  {
1865
- this._cancelled = true;
 
 
 
 
 
 
 
 
1866
  }
1867
 
 
 
1868
  });
1869
 
1870
- // js/v8/fancy-controls.js
1871
  /**
 
1872
  * @namespace WPGMZA
1873
- * @module FancyControls
1874
  * @requires WPGMZA
1875
  */
1876
- jQuery(function($) {
1877
-
1878
- WPGMZA.FancyControls = {
1879
-
1880
- formatToggleSwitch: function(el)
1881
- {
1882
- var div = $("<div class='switch'></div>");
1883
- var input = el;
1884
- var container = el.parentNode;
1885
- var text = $(container).text().trim();
1886
- var label = $("<label></label>");
1887
-
1888
- $(input).addClass("cmn-toggle cmn-toggle-round-flat");
1889
- $(input).attr("id", $(input).attr("name"));
1890
-
1891
- $(label).attr("for", $(input).attr("name"));
1892
-
1893
- $(div).append(input);
1894
- $(div).append(label);
1895
-
1896
- $(container).replaceWith(div);
1897
-
1898
- $(div).wrap($("<div></div>"));
1899
- $(div).after(text);
1900
- },
1901
-
1902
- formatToggleButton: function(el)
1903
- {
1904
- var div = $("<div class='switch'></div>");
1905
- var input = el;
1906
- var container = el.parentNode;
1907
- var text = $(container).text().trim();
1908
- var label = $("<label></label>");
1909
-
1910
- $(input).addClass("cmn-toggle cmn-toggle-yes-no");
1911
- $(input).attr("id", $(input).attr("name"));
1912
-
1913
- $(label).attr("for", $(input).attr("name"));
1914
-
1915
- $(label).attr("data-on", WPGMZA.localized_strings.yes);
1916
- $(label).attr("data-off", WPGMZA.localized_strings.no);
1917
-
1918
- $(div).append(input);
1919
- $(div).append(label);
1920
-
1921
- $(container).replaceWith(div);
1922
-
1923
- $(div).wrap($("<div></div>"));
1924
- $(div).after(text);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1925
  }
1926
-
1927
  };
1928
-
1929
- $(".wpgmza-fancy-toggle-switch").each(function(index, el) {
1930
- WPGMZA.FancyControls.formatToggleSwitch(el);
1931
- });
1932
-
1933
- $(".wpgmza-fancy-toggle-button").each(function(index, el) {
1934
- WPGMZA.FancyControls.formatToggleButton(el);
1935
- });
1936
-
1937
- });
1938
 
1939
- // js/v8/feature.js
1940
  /**
 
1941
  * @namespace WPGMZA
1942
- * @module Feature
1943
- * @requires WPGMZA.EventDispatcher
1944
  */
1945
  jQuery(function($) {
1946
 
 
 
 
 
 
 
 
1947
  /**
1948
- * Base class for featuers (formerlly MapObjects), that is, markers, polygons, polylines, circles, rectangles and heatmaps. Implements functionality shared by all map objects, such as parsing geometry and serialization.
1949
- * @class WPGMZA.Feature
1950
- * @constructor WPGMZA.Feature
1951
  * @memberof WPGMZA
1952
- * @augments WPGMZA.EventDispatcher
1953
  */
1954
- WPGMZA.Feature = function(options)
1955
- {
1956
- var self = this;
1957
-
1958
- WPGMZA.assertInstanceOf(this, "Feature");
1959
 
1960
- WPGMZA.EventDispatcher.call(this);
 
 
 
 
 
 
1961
 
1962
- this.id = -1;
1963
-
1964
- for(var key in options)
1965
- this[key] = options[key];
1966
- }
1967
-
1968
- WPGMZA.extend(WPGMZA.Feature, WPGMZA.EventDispatcher);
1969
-
1970
- // NB: Legacy compatibility
1971
- WPGMZA.MapObject = WPGMZA.Feature;
1972
-
1973
- /**
1974
- * Scans a string for all floating point numbers and build an array of latitude and longitude literals from the matched numbers
1975
- * @method
1976
- * @memberof WPGMZA.Feature
1977
- * @param {string} string The string to parse numbers from
1978
- * @return {array} An array of LatLng literals parsed from the string
1979
- */
1980
- WPGMZA.Feature.prototype.parseGeometry = function(subject)
1981
- {
1982
- // TODO: Rename "subject" to "subject". It's unclear right now
1983
 
1984
- if(typeof subject == "string" && subject.match(/^\[/))
1985
- {
1986
- try{
1987
-
1988
- var json = JSON.parse(subject);
1989
- subject = json;
1990
-
1991
- }catch(e) {
1992
- // Continue execution
1993
- }
1994
- }
1995
 
1996
- if(typeof subject == "object")
1997
- {
1998
- var arr = subject;
1999
-
2000
- for(var i = 0; i < arr.length; i++)
2001
- {
2002
- arr[i].lat = parseFloat(arr[i].lat);
2003
- arr[i].lng = parseFloat(arr[i].lng);
2004
- }
2005
-
2006
- return arr;
2007
- }
2008
- else if(typeof subject == "string")
2009
- {
2010
- // Guessing old format
2011
- var stripped, pairs, coords, results = [];
2012
-
2013
- stripped = subject.replace(/[^ ,\d\.\-+e]/g, "");
2014
- pairs = stripped.split(",");
2015
-
2016
- for(var i = 0; i < pairs.length; i++)
2017
- {
2018
- coords = pairs[i].split(" ");
2019
- results.push({
2020
- lat: parseFloat(coords[1]),
2021
- lng: parseFloat(coords[0])
2022
- });
2023
- }
2024
-
2025
- return results;
2026
- }
2027
 
2028
- throw new Error("Invalid geometry");
2029
- }
2030
-
2031
- WPGMZA.Feature.prototype.setOptions = function(options)
2032
- {
2033
- for(var key in options)
2034
- this[key] = options[key];
2035
-
2036
-
2037
- this.updateNativeFeature();
2038
- }
2039
-
2040
- WPGMZA.Feature.prototype.setEditable = function(editable)
2041
- {
2042
- this.setOptions({
2043
- editable: editable
2044
- });
2045
- }
2046
-
2047
- WPGMZA.Feature.prototype.setDraggable = function(draggable)
2048
- {
2049
- this.setOptions({
2050
- draggable: draggable
2051
- });
2052
 
2053
- // this.layer.setVisible(visible ? true : false);
2054
- }
2055
-
2056
- WPGMZA.Feature.prototype.getScalarProperties = function()
2057
- {
2058
- var options = {};
 
 
 
 
 
 
 
2059
 
2060
- for(var key in this)
 
 
 
 
 
 
 
 
 
2061
  {
2062
- switch(typeof this[key])
2063
- {
2064
- case "number":
2065
- options[key] = parseFloat(this[key]);
2066
- break;
2067
-
2068
- case "boolean":
2069
- case "string":
2070
- options[key] = this[key];
2071
- break;
2072
-
2073
- default:
2074
- break;
2075
- }
2076
- }
2077
 
2078
- return options;
2079
- }
2080
-
2081
- WPGMZA.Feature.prototype.updateNativeFeature = function()
2082
- {
2083
- // NB: Because we don't have different base classes for GoogleFeature and OLFeature*, it's necessary to have an if/else here. This design pattern should be avoided wherever possible. Prefer adding engine specific code on the OL / Google modules.
2084
- // * - OLFeature is actually a class, but nothing extends from it. It's purely provided as a utility.
 
 
 
 
 
2085
 
2086
- var props = this.getScalarProperties();
 
 
 
 
 
 
 
 
 
 
 
 
 
2087
 
2088
- switch(WPGMZA.settings.engine)
 
 
 
 
 
 
 
 
 
2089
  {
2090
- case "open-layers":
 
2091
 
2092
- // The native properties (strokeColor, fillOpacity, etc) have to be translated for OpenLayers.
2093
- if(this.layer){
2094
- this.layer.setStyle(WPGMZA.OLFeature.getOLStyle(props));
2095
- }
2096
- break;
2097
 
2098
- default:
 
2099
 
2100
- // For Google, because the native properties share the same name as the Google properties, we can just pass them straight in
 
 
 
 
 
 
 
 
 
 
 
2101
 
2102
- this.googleFeature.setOptions(props);
 
2103
 
2104
- break;
2105
  }
2106
- }
 
2107
 
2108
  });
2109
 
2110
- // js/v8/circle.js
2111
  /**
2112
  * @namespace WPGMZA
2113
- * @module Circle
2114
- * @requires WPGMZA.Feature
2115
  */
2116
  jQuery(function($) {
2117
 
2118
- var Parent = WPGMZA.Feature;
2119
-
2120
- /**
2121
- * Base class for circles. <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.
2122
- * @class WPGMZA.Circle
2123
- * @constructor WPGMZA.Circle
2124
- * @memberof WPGMZA
2125
- * @augments WPGMZA.Feature
2126
- * @see WPGMZA.Circle.createInstance
2127
- */
2128
- WPGMZA.Circle = function(options, engineCircle)
2129
  {
2130
- var self = this;
2131
-
2132
- WPGMZA.assertInstanceOf(this, "Circle");
2133
-
2134
- this.center = new WPGMZA.LatLng();
2135
- this.radius = 100;
2136
 
2137
- Parent.apply(this, arguments);
 
2138
  }
2139
 
2140
- WPGMZA.extend(WPGMZA.Circle, WPGMZA.Feature);
2141
 
2142
- Object.defineProperty(WPGMZA.Circle.prototype, "fillColor", {
 
 
 
 
 
 
 
2143
 
2144
- enumerable: true,
 
 
2145
 
2146
- "get": function()
2147
  {
2148
- if(!this.color || !this.color.length)
2149
- return "#ff0000";
2150
 
2151
- return this.color;
2152
- },
2153
- "set" : function(a){
2154
- this.color = a;
 
 
 
 
 
 
 
 
 
 
 
 
2155
  }
2156
 
2157
- });
2158
-
2159
- Object.defineProperty(WPGMZA.Circle.prototype, "fillOpacity", {
2160
 
2161
- enumerable: true,
 
 
 
 
 
 
2162
 
2163
- "get": function()
 
 
 
2164
  {
2165
- if(!this.opacity && this.opacity != 0)
2166
- return 0.5;
2167
-
2168
- return parseFloat(this.opacity);
2169
- },
2170
- "set": function(a){
2171
- this.opacity = a;
2172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2173
 
2174
- });
2175
-
2176
- Object.defineProperty(WPGMZA.Circle.prototype, "strokeColor", {
 
 
 
 
 
 
 
 
 
 
 
 
 
2177
 
2178
- enumerable: true,
2179
 
2180
- "get": function()
2181
- {
2182
- if(!this.lineColor){
2183
- return "#000000";
2184
- }
2185
- return this.lineColor;
2186
- },
2187
- "set": function(a){
2188
- this.lineColor = a;
2189
- }
2190
 
2191
- });
2192
-
2193
- Object.defineProperty(WPGMZA.Circle.prototype, "strokeOpacity", {
2194
 
2195
- enumerable: true,
2196
 
2197
- "get": function()
2198
- {
2199
- if(!this.lineOpacity && this.lineOpacity != 0)
2200
- return 0;
2201
-
2202
- return parseFloat(this.lineOpacity);
2203
- },
2204
- "set": function(a){
2205
- this.lineOpacity = a;
2206
- }
2207
 
2208
- });
2209
-
2210
- /**
2211
- * Creates an instance of a circle, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
2212
- * @method
2213
- * @memberof WPGMZA.Circle
2214
- * @param {object} options Options for the object (optional)
2215
- */
2216
- WPGMZA.Circle.createInstance = function(options, engineCircle)
2217
- {
2218
- var constructor;
2219
 
2220
- switch(WPGMZA.settings.engine)
2221
- {
2222
- case "open-layers":
2223
- constructor = WPGMZA.OLCircle;
2224
- break;
2225
-
2226
- default:
2227
- constructor = WPGMZA.GoogleCircle;
2228
- break;
2229
- }
2230
 
2231
- return new constructor(options, engineCircle);
2232
- }
2233
-
2234
- /**
2235
- * Gets the circles center
2236
- *
2237
- * @method
2238
- * @memberof WPGMZA.Circle
2239
- * @returns {WPGMZA.LatLng}
2240
- */
2241
- WPGMZA.Circle.prototype.getCenter = function()
2242
- {
2243
- return this.center.clone();
2244
- }
2245
-
2246
- /**
2247
- * Sets the circles center
2248
- *
2249
- * @method
2250
- * @memberof WPGMZA.Circle
2251
- * @param {object|WPGMZA.LatLng} latLng either a literal or as a WPGMZA.LatLng
2252
- */
2253
- WPGMZA.Circle.prototype.setCenter = function(latLng)
2254
- {
2255
- this.center.lat = latLng.lat;
2256
- this.center.lng = latLng.lng;
2257
- }
2258
-
2259
- /**
2260
- * Gets the circles radius, in kilometers
2261
- *
2262
- * @method
2263
- * @memberof WPGMZA.Circle
2264
- * @param {object|WPGMZA.LatLng} latLng either a literal or as a WPGMZA.LatLng
2265
- * @returns {WPGMZA.LatLng}
2266
- */
2267
- WPGMZA.Circle.prototype.getRadius = function()
2268
- {
2269
- return this.radius;
2270
- }
2271
-
2272
- /**
2273
- * Sets the circles radius, in kilometers
2274
- *
2275
- * @method
2276
- * @memberof WPGMZA.Circle
2277
- * @param {number} radius The radius
2278
- * @returns {void}
2279
- */
2280
- WPGMZA.Circle.prototype.setRadius = function(radius)
2281
- {
2282
- this.radius = radius;
2283
- }
2284
-
2285
- /**
2286
- * Returns the map that this circle is being displayed on
2287
- *
2288
- * @method
2289
- * @memberof WPGMZA.Circle
2290
- * @return {WPGMZA.Map}
2291
- */
2292
- WPGMZA.Circle.prototype.getMap = function()
2293
- {
2294
- return this.map;
2295
- }
2296
-
2297
- /**
2298
- * Puts this circle on a map
2299
- *
2300
- * @method
2301
- * @memberof WPGMZA.Circle
2302
- * @param {WPGMZA.Map} map The target map
2303
- * @return {void}
2304
- */
2305
- WPGMZA.Circle.prototype.setMap = function(map)
2306
- {
2307
- if(this.map)
2308
- this.map.removeCircle(this);
2309
 
2310
- if(map)
2311
- map.addCircle(this);
2312
-
2313
- }
2314
-
2315
- });
2316
-
2317
- // js/v8/friendly-error.js
2318
- /**
2319
- * @namespace WPGMZA
2320
- * @module FriendlyError
2321
- * @requires WPGMZA
2322
- */
2323
- jQuery(function($) {
2324
-
2325
- /**
2326
- * Deprecated
2327
- * @class WPGMZA.FriendlyError
2328
- * @constructor WPGMZA.FriendlyError
2329
- * @memberof WPGMZA
2330
- * @deprecated
2331
- */
2332
- WPGMZA.FriendlyError = function()
2333
- {
2334
 
2335
- }
2336
-
2337
- /*var template = '\
2338
- <div class="notice notice-error"> \
2339
- <p> \
2340
- ' + WPGMZA.localized_strings.friendly_error + ' \
2341
- </p> \
2342
- <pre style="white-space: pre-line;"></pre> \
2343
- <div> \
2344
- ';
2345
-
2346
- WPGMZA.FriendlyError = function(nativeError)
2347
- {
2348
- if(!WPGMZA.is_admin)
2349
  {
2350
- this.element = $(WPGMZA.preloaderHTML);
2351
- $(this.element).removeClass("animated");
2352
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2353
  }
2354
 
2355
- $("#wpgmza-map-edit-page>.wpgmza-preloader").remove();
2356
-
2357
- this.element = $(template);
2358
- this.element.find("pre").html(nativeError.message + "\r\n" + nativeError.stack + "\r\n\r\n on " + window.location.href);
2359
- }*/
2360
-
2361
- });
2362
-
2363
- // js/v8/geocoder.js
2364
- /**
2365
- * @namespace WPGMZA
2366
- * @module Geocoder
2367
- * @requires WPGMZA
2368
- */
2369
- jQuery(function($) {
2370
-
2371
- /**
2372
- * Base class for geocoders. <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.
2373
- * @class WPGMZA.Geocoder
2374
- * @constructor WPGMZA.Geocoder
2375
- * @memberof WPGMZA
2376
- * @see WPGMZA.Geocoder.createInstance
2377
- */
2378
- WPGMZA.Geocoder = function()
2379
- {
2380
- WPGMZA.assertInstanceOf(this, "Geocoder");
2381
  }
2382
 
2383
- /**
2384
- * Indicates a successful geocode, with one or more results
2385
- * @constant SUCCESS
2386
- * @memberof WPGMZA.Geocoder
2387
- */
2388
- WPGMZA.Geocoder.SUCCESS = "success";
2389
-
2390
- /**
2391
- * Indicates the geocode was successful, but returned no results
2392
- * @constant ZERO_RESULTS
2393
- * @memberof WPGMZA.Geocoder
2394
- */
2395
- WPGMZA.Geocoder.ZERO_RESULTS = "zero-results";
2396
 
2397
  /**
2398
- * Indicates the geocode failed, usually due to technical reasons (eg connectivity)
2399
- * @constant FAIL
2400
- * @memberof WPGMZA.Geocoder
 
2401
  */
2402
- WPGMZA.Geocoder.FAIL = "fail";
2403
-
 
 
 
 
 
2404
  /**
2405
- * Returns the contructor to be used by createInstance, depending on the selected maps engine.
2406
  * @method
2407
- * @memberof WPGMZA.Geocoder
2408
- * @return {function} The appropriate contructor
 
 
 
2409
  */
2410
- WPGMZA.Geocoder.getConstructor = function()
2411
  {
2412
- switch(WPGMZA.settings.engine)
 
2413
  {
2414
- case "open-layers":
2415
- return WPGMZA.OLGeocoder;
2416
- break;
2417
-
2418
- default:
2419
- return WPGMZA.GoogleGeocoder;
2420
- break;
2421
  }
2422
- }
 
 
2423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2424
  /**
2425
- * Creates an instance of a Geocoder, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>
2426
  * @method
2427
- * @memberof WPGMZA.Geocoder
2428
- * @return {WPGMZA.Geocoder} A subclass of WPGMZA.Geocoder
2429
  */
2430
- WPGMZA.Geocoder.createInstance = function()
2431
- {
2432
- var constructor = WPGMZA.Geocoder.getConstructor();
2433
- return new constructor();
2434
- }
2435
-
2436
  /**
2437
- * Attempts to convert a street address to an array of potential coordinates that match the address, which are passed to a callback. If the address is interpreted as a latitude and longitude coordinate pair, the callback is immediately fired.
2438
  * @method
2439
- * @memberof WPGMZA.Geocoder
2440
- * @param {object} options The options to geocode, address is mandatory.
2441
- * @param {function} callback The callback to receive the geocode result.
2442
- * @return {void}
 
2443
  */
2444
- WPGMZA.Geocoder.prototype.getLatLngFromAddress = function(options, callback)
2445
  {
2446
- if(WPGMZA.isLatLngString(options.address))
2447
- {
2448
- var parts = options.address.split(/,\s*/);
2449
- var latLng = new WPGMZA.LatLng({
2450
- lat: parseFloat(parts[0]),
2451
- lng: parseFloat(parts[1])
2452
- });
2453
 
2454
- // NB: Quick fix, solves issue with right click marker. Solve this there by making behaviour consistent
2455
- latLng.latLng = latLng;
2456
 
2457
- callback([latLng], WPGMZA.Geocoder.SUCCESS);
 
 
 
 
 
 
 
 
 
 
2458
  }
2459
  }
2460
-
2461
  /**
2462
- * Attempts to convert latitude eand longitude coordinates into a street address. By default this will simply return the coordinates wrapped in an array.
2463
  * @method
2464
- * @memberof WPGMZA.Geocoder
2465
- * @param {object} options The options to geocode, latLng is mandatory.
2466
- * @param {function} callback The callback to receive the geocode result.
2467
- * @return {void}
2468
  */
2469
- WPGMZA.Geocoder.prototype.getAddressFromLatLng = function(options, callback)
2470
- {
2471
- var latLng = new WPGMZA.LatLng(options.latLng);
2472
- callback([latLng.toString()], WPGMZA.Geocoder.SUCCESS);
2473
- }
2474
-
2475
  /**
2476
- * Geocodes either an address or a latitude and longitude coordinate pair, depending on the input
2477
  * @method
2478
- * @memberof WPGMZA.Geocoder
2479
- * @param {object} options The options to geocode, you must supply <em>either</em> latLng <em>or</em> address.
2480
- * @throws You must supply either a latLng or address
2481
- * @return {void}
2482
  */
2483
- WPGMZA.Geocoder.prototype.geocode = function(options, callback)
2484
  {
2485
- if("address" in options)
2486
- return this.getLatLngFromAddress(options, callback);
2487
- else if("latLng" in options)
2488
- return this.getAddressFromLatLng(options, callback);
2489
-
2490
- throw new Error("You must supply either a latLng or address");
2491
  }
2492
-
2493
- });
2494
-
2495
- // js/v8/google-api-error-handler.js
2496
- /**
2497
- * @namespace WPGMZA
2498
- * @module GoogleAPIErrorHandler
2499
- * @requires WPGMZA
2500
- */
2501
- jQuery(function($) {
2502
 
2503
  /**
2504
- * This class catches Google Maps API errors and presents them in a friendly manner, before sending them on to the consoles default error handler.
2505
- * @class WPGMZA.GoogleAPIErrorHandler
2506
- * @constructor WPGMZA.GoogleAPIErrorHandler
2507
- * @memberof WPGMZA
2508
  */
2509
- WPGMZA.GoogleAPIErrorHandler = function() {
2510
-
2511
- var self = this;
2512
-
2513
- // Don't do anything if Google isn't the selected API
2514
- if(WPGMZA.settings.engine != "google-maps")
2515
- return;
2516
-
2517
- // Only allow on the map edit page, or front end if user has administrator role
2518
- if(!(WPGMZA.currentPage == "map-edit" || (WPGMZA.is_admin == 0 && WPGMZA.userCanAdministrator == 1)))
2519
- return;
2520
-
2521
- this.element = $(WPGMZA.html.googleMapsAPIErrorDialog);
2522
-
2523
- if(WPGMZA.is_admin == 1)
2524
- this.element.find(".wpgmza-front-end-only").remove();
2525
-
2526
- this.errorMessageList = this.element.find(".wpgmza-google-api-error-list");
2527
- this.templateListItem = this.element.find("li.template").remove();
2528
-
2529
- this.messagesAlreadyDisplayed = {};
2530
-
2531
- //if(WPGMZA.settings.developer_mode)
2532
- //return;
2533
-
2534
- // Override error function
2535
- var _error = console.error;
2536
-
2537
- console.error = function(message)
2538
- {
2539
- self.onErrorMessage(message);
2540
-
2541
- _error.apply(this, arguments);
2542
  }
 
 
 
 
 
 
 
 
2543
 
2544
- // Check for no API key
2545
- if(
2546
- WPGMZA.settings.engine == "google-maps"
2547
- &&
2548
- (!WPGMZA.settings.wpgmza_google_maps_api_key || !WPGMZA.settings.wpgmza_google_maps_api_key.length)
2549
- &&
2550
- WPGMZA.getCurrentPage() != WPGMZA.PAGE_MAP_EDIT
2551
- )
2552
- this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key, ["https://www.wpgmaps.com/documentation/creating-a-google-maps-api-key/"]);
2553
- }
2554
-
2555
- /**
2556
- * Overrides console.error to scan the error message for Google Maps API error messages.
2557
- * @method
2558
- * @memberof WPGMZA.GoogleAPIErrorHandler
2559
- * @param {string} message The error message passed to the console
2560
- */
2561
- WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage = function(message)
2562
- {
2563
- var m;
2564
- var regexURL = /http(s)?:\/\/[^\s]+/gm;
2565
-
2566
- if(!message)
2567
  return;
 
 
 
 
 
 
 
2568
 
2569
- 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: .+/)))
 
 
2570
  {
2571
- var urls = message.match(regexURL);
2572
- this.addErrorMessage(m[0], urls);
2573
  }
2574
- else if(m = message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))
 
2575
  {
2576
- this.addErrorMessage(m[1].replace(/([A-Z])/g, " $1"), [m[2]]);
 
 
 
 
 
 
 
 
 
 
 
2577
  }
2578
  }
2579
-
2580
  /**
2581
- * Called by onErrorMessage when a Google Maps API error is picked up, this will add the specified message to the Maps API error message dialog, along with URLs to compliment it. This function ignores duplicate error messages.
2582
  * @method
2583
- * @memberof WPGMZA.GoogleAPIErrorHandler
2584
- * @param {string} message The message, or part of the message, intercepted from the console
2585
- * @param {array} [urls] An array of URLs relating to the error message to compliment the message.
2586
  */
2587
- WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage = function(message, urls)
 
 
 
 
 
 
 
 
2588
  {
2589
- var self = this;
2590
 
2591
- if(this.messagesAlreadyDisplayed[message])
2592
  return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2593
 
2594
- var li = this.templateListItem.clone();
2595
- $(li).find(".wpgmza-message").html(message);
 
2596
 
2597
- var buttonContainer = $(li).find(".wpgmza-documentation-buttons");
 
 
 
 
2598
 
2599
- var buttonTemplate = $(li).find(".wpgmza-documentation-buttons>a");
2600
- buttonTemplate.remove();
2601
 
2602
- if(urls && urls.length)
2603
- {
2604
- for(var i = 0; i < urls.length; i++)
2605
- {
2606
- var url = urls[i];
2607
- var button = buttonTemplate.clone();
2608
- var icon = "fa-external-link";
2609
- var text = WPGMZA.localized_strings.documentation;
2610
-
2611
- button.attr("href", urls[i]);
2612
-
2613
- /*if(url.match(/google.+documentation/))
2614
- {
2615
- // icon = "fa-google";
2616
- icon = "fa-wrench"
2617
- }
2618
- else if(url.match(/maps-no-account/))
2619
- {
2620
- icon = "fa-wrench"
2621
- text = WPGMZA.localized_strings.verify_project;
2622
- }
2623
- else if(url.match(/console\.developers\.google/))
2624
- {
2625
- icon = "fa-wrench";
2626
- text = WPGMZA.localized_strings.api_dashboard;
2627
- }*/
2628
 
2629
- $(button).find("i").addClass(icon);
2630
- $(button).append(text);
2631
  }
2632
-
2633
- buttonContainer.append(button);
2634
  }
 
 
 
 
 
 
 
 
 
 
 
2635
 
2636
- $(this.errorMessageList).append(li);
 
 
 
 
2637
 
2638
- /*if(!this.dialog)
2639
- this.dialog = $(this.element).remodal();
 
 
 
 
 
 
 
 
 
 
 
 
 
2640
 
2641
- switch(this.dialog.getState())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2642
  {
2643
- case "open":
2644
- case "opened":
2645
- case "opening":
2646
  break;
2647
 
2648
  default:
2649
- this.dialog.open();
2650
  break;
2651
- }*/
 
 
 
 
 
 
 
 
 
2652
 
2653
- $("#wpgmza_map, .wpgmza_map").each(function(index, el) {
2654
-
2655
- var container = $(el).find(".wpgmza-google-maps-api-error-overlay");
2656
-
2657
- if(container.length == 0)
2658
- {
2659
- container = $("<div class='wpgmza-google-maps-api-error-overlay'></div>");
2660
- container.html(self.element.html());
2661
- }
2662
-
2663
- setTimeout(function() {
2664
- $(el).append(container);
2665
- }, 1000);
2666
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2667
 
2668
- $(".gm-err-container").parent().css({"z-index": 1});
2669
 
2670
- this.messagesAlreadyDisplayed[message] = true;
 
 
2671
  }
2672
-
2673
- WPGMZA.googleAPIErrorHandler = new WPGMZA.GoogleAPIErrorHandler();
2674
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2675
  });
2676
 
2677
- // js/v8/info-window.js
2678
- /**
2679
- * @namespace WPGMZA
2680
- * @module InfoWindow
2681
- * @requires WPGMZA.EventDispatcher
2682
- */
2683
- jQuery(function($) {
2684
-
2685
- /**
2686
- * Base class for infoWindows. This acts as an abstract class so that infoWindows for both Google and OpenLayers can be interacted with seamlessly by the overlying logic. <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.
2687
- * @class WPGMZA.InfoWindow
2688
- * @constructor WPGMZA.InfoWindow
2689
- * @memberof WPGMZA
2690
- * @see WPGMZA.InfoWindow.createInstance
2691
- */
2692
- WPGMZA.InfoWindow = function(feature) {
2693
- var self = this;
2694
-
2695
-
2696
-
2697
- WPGMZA.EventDispatcher.call(this);
2698
-
2699
- WPGMZA.assertInstanceOf(this, "InfoWindow");
2700
-
2701
- this.on("infowindowopen", function(event) {
2702
- self.onOpen(event);
2703
- });
2704
-
2705
- if(!feature)
2706
- return;
2707
-
2708
- this.feature = feature;
2709
- this.state = WPGMZA.InfoWindow.STATE_CLOSED;
2710
-
2711
- if(feature.map)
2712
- {
2713
- // This has to be slightly delayed so the map initialization won't overwrite the infowindow element
2714
- setTimeout(function() {
2715
- self.onFeatureAdded(event);
2716
- }, 100);
2717
- }
2718
- else
2719
- feature.addEventListener("added", function(event) {
2720
- self.onFeatureAdded(event);
2721
- });
2722
- }
2723
-
2724
-
2725
-
2726
- WPGMZA.InfoWindow.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
2727
- WPGMZA.InfoWindow.prototype.constructor = WPGMZA.InfoWindow;
2728
-
2729
- WPGMZA.InfoWindow.OPEN_BY_CLICK = 1;
2730
- WPGMZA.InfoWindow.OPEN_BY_HOVER = 2;
2731
-
2732
- WPGMZA.InfoWindow.STATE_OPEN = "open";
2733
- WPGMZA.InfoWindow.STATE_CLOSED = "closed";
2734
-
2735
- /**
2736
- * Fetches the constructor to be used by createInstance, based on the selected maps engine
2737
- * @method
2738
- * @memberof WPGMZA.InfoWindow
2739
- * @return {function} The appropriate constructor
2740
- */
2741
- WPGMZA.InfoWindow.getConstructor = function()
2742
- {
2743
- switch(WPGMZA.settings.engine)
2744
- {
2745
- case "open-layers":
2746
- if(WPGMZA.isProVersion())
2747
- return WPGMZA.OLProInfoWindow;
2748
- return WPGMZA.OLInfoWindow;
2749
- break;
2750
-
2751
- default:
2752
- if(WPGMZA.isProVersion())
2753
- return WPGMZA.GoogleProInfoWindow;
2754
- return WPGMZA.GoogleInfoWindow;
2755
- break;
2756
- }
2757
- }
2758
-
2759
- /**
2760
- * Creates an instance of an InfoWindow, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>
2761
- * @method
2762
- * @memberof WPGMZA.InfoWindow
2763
- * @param {object} options Options for the object (optional)
2764
- */
2765
- WPGMZA.InfoWindow.createInstance = function(feature)
2766
- {
2767
- var constructor = this.getConstructor();
2768
- return new constructor(feature);
2769
- }
2770
-
2771
- Object.defineProperty(WPGMZA.InfoWindow.prototype, "content", {
2772
-
2773
- "get": function()
2774
- {
2775
- return this.getContent();
2776
- },
2777
-
2778
- "set": function(value)
2779
- {
2780
- this.contentHtml = value;
2781
- }
2782
- });
2783
-
2784
-
2785
- WPGMZA.InfoWindow.prototype.addEditButton = function() {
2786
- if (WPGMZA.currentPage == "map-edit") {
2787
- if(this.feature instanceof WPGMZA.Marker){
2788
- return ' <a title="Edit this marker" style="width:15px;" class="wpgmza_edit_btn" data-edit-marker-id="'+this.feature.id+'"><i class="fa fa-edit"></i></a>';
2789
- }
2790
- }
2791
- return '';
2792
-
2793
- }
2794
-
2795
- WPGMZA.InfoWindow.prototype.workOutDistanceBetweenTwoMarkers = function(location1, location2) {
2796
- if(!location1 || !location2)
2797
- return; // No location (no search performed, user location unavailable)
2798
-
2799
- var distanceInKM = WPGMZA.Distance.between(location1, location2);
2800
- var distanceToDisplay = distanceInKM;
2801
-
2802
- if(this.distanceUnits == WPGMZA.Distance.MILES)
2803
- distanceToDisplay /= WPGMZA.Distance.KILOMETERS_PER_MILE;
2804
-
2805
- var text = Math.round(distanceToDisplay, 2);
2806
-
2807
- return text;
2808
- }
2809
-
2810
-
2811
- /**
2812
- * Gets the content for the info window and passes it to the specified callback - this allows for delayed loading (eg AJAX) as well as instant content
2813
- * @method
2814
- * @memberof WPGMZA.InfoWindow
2815
- * @return void
2816
- */
2817
- WPGMZA.InfoWindow.prototype.getContent = function(callback) {
2818
- var html = "";
2819
- var extra_html = "";
2820
-
2821
- if (this.feature instanceof WPGMZA.Marker) {
2822
- // Store locator distance away
2823
- // added by Nick 2020-01-12
2824
- if (this.feature.map.settings.store_locator_show_distance && this.feature.map.storeLocator && (this.feature.map.storeLocator.state == WPGMZA.StoreLocator.STATE_APPLIED)) {
2825
- var currentLatLng = this.feature.getPosition();
2826
- var distance = this.workOutDistanceBetweenTwoMarkers(this.feature.map.storeLocator.center, currentLatLng);
2827
-
2828
- extra_html += "<p>"+(this.feature.map.settings.store_locator_distance == WPGMZA.Distance.KILOMETERS ? distance + WPGMZA.localized_strings.kilometers_away : distance + " " + WPGMZA.localized_strings.miles_away)+"</p>";
2829
- }
2830
-
2831
- html = this.feature.address+extra_html;
2832
- }
2833
-
2834
- if (this.contentHtml){
2835
- html = this.contentHtml;
2836
- }
2837
-
2838
-
2839
- if(callback)
2840
- callback(html);
2841
-
2842
- return html;
2843
- }
2844
-
2845
- /**
2846
- * Opens the info window on the specified map, with the specified map object as the subject.
2847
- * @method
2848
- * @memberof WPGMZA.InfoWindow
2849
- * @param {WPGMZA.Map} map The map to open this InfoWindow on.
2850
- * @param {WPGMZA.Feature} feature The map object (eg marker, polygon) to open this InfoWindow on.
2851
- * @return boolean FALSE if the info window should not and will not open, TRUE if it will. This can be used by subclasses to establish whether or not the subclassed open should bail or open the window.
2852
- */
2853
- WPGMZA.InfoWindow.prototype.open = function(map, feature) {
2854
- var self = this;
2855
-
2856
- this.feature = feature;
2857
-
2858
- if(WPGMZA.settings.disable_infowindows || WPGMZA.settings.wpgmza_settings_disable_infowindows == "1")
2859
- return false;
2860
-
2861
- if(this.feature.disableInfoWindow)
2862
- return false;
2863
-
2864
- this.state = WPGMZA.InfoWindow.STATE_OPEN;
2865
-
2866
- return true;
2867
- }
2868
-
2869
- /**
2870
- * Abstract function, closes this InfoWindow
2871
- * @method
2872
- * @memberof WPGMZA.InfoWindow
2873
- */
2874
- WPGMZA.InfoWindow.prototype.close = function()
2875
- {
2876
- if(this.state == WPGMZA.InfoWindow.STATE_CLOSED)
2877
- return;
2878
-
2879
- this.state = WPGMZA.InfoWindow.STATE_CLOSED;
2880
- this.trigger("infowindowclose");
2881
- }
2882
-
2883
- /**
2884
- * Abstract function, sets the content in this InfoWindow
2885
- * @method
2886
- * @memberof WPGMZA.InfoWindow
2887
- */
2888
- WPGMZA.InfoWindow.prototype.setContent = function(options)
2889
- {
2890
-
2891
- }
2892
-
2893
- /**
2894
- * Abstract function, sets options on this InfoWindow
2895
- * @method
2896
- * @memberof WPGMZA.InfoWindow
2897
- */
2898
- WPGMZA.InfoWindow.prototype.setOptions = function(options)
2899
- {
2900
-
2901
- }
2902
-
2903
- /**
2904
- * Event listener for when the map object is added. This will cause the info window to open if the map object has infoopen set
2905
- * @method
2906
- * @memberof WPGMZA.InfoWindow
2907
- * @return void
2908
- */
2909
- WPGMZA.InfoWindow.prototype.onFeatureAdded = function()
2910
- {
2911
- if(this.feature.settings.infoopen == 1)
2912
- this.open();
2913
- }
2914
-
2915
- WPGMZA.InfoWindow.prototype.onOpen = function()
2916
- {
2917
-
2918
- }
2919
-
2920
- });
2921
-
2922
- // js/v8/latlng.js
2923
  /**
2924
  * @namespace WPGMZA
2925
- * @module LatLng
2926
  * @requires WPGMZA
2927
  */
2928
  jQuery(function($) {
2929
-
2930
- /**
2931
- * This class represents a latitude and longitude coordinate pair, and provides utilities to work with coordinates, parsing and conversion.
2932
- * @class WPGMZA.LatLng
2933
- * @constructor WPGMZA.LatLng
2934
- * @memberof WPGMZA
2935
- * @param {number|object} arg A latLng literal, or latitude
2936
- * @param {number} [lng] The latitude, where arg is a longitude
2937
- */
2938
- WPGMZA.LatLng = function(arg, lng)
2939
- {
2940
- this._lat = 0;
2941
- this._lng = 0;
2942
-
2943
- if(arguments.length == 0)
2944
- return;
2945
 
2946
- if(arguments.length == 1)
2947
  {
2948
- // TODO: Support latlng string
 
 
 
 
2949
 
2950
- if(typeof arg == "string")
2951
- {
2952
- var m;
2953
-
2954
- if(!(m = arg.match(WPGMZA.LatLng.REGEXP)))
2955
- throw new Error("Invalid LatLng string");
2956
-
2957
- arg = {
2958
- lat: m[1],
2959
- lng: m[3]
2960
- };
2961
- }
2962
 
2963
- if(typeof arg != "object" || !("lat" in arg && "lng" in arg))
2964
- throw new Error("Argument must be a LatLng literal");
2965
 
2966
- this.lat = arg.lat;
2967
- this.lng = arg.lng;
2968
- }
2969
- else
 
 
 
 
 
 
2970
  {
2971
- this.lat = arg;
2972
- this.lng = lng;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2973
  }
2974
- }
2975
-
2976
- /**
2977
- * A regular expression which matches latitude and longitude coordinate pairs from a string. Matches 1 and 3 correspond to latitude and longitude, respectively,
2978
- * @constant {RegExp}
2979
- * @memberof WPGMZA.LatLng
2980
- */
2981
- WPGMZA.LatLng.REGEXP = /^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/;
2982
-
2983
- /**
2984
- * Returns true if the supplied object is a LatLng literal, also returns true for instances of WPGMZA.LatLng
2985
- * @method
2986
- * @static
2987
- * @memberof WPGMZA.LatLng
2988
- * @param {object} obj A LatLng literal, or an instance of WPGMZA.LatLng
2989
- * @return {bool} True if this object is a valid LatLng literal or instance of WPGMZA.LatLng
2990
- */
2991
- WPGMZA.LatLng.isValid = function(obj)
2992
- {
2993
- if(typeof obj != "object")
2994
- return false;
2995
 
2996
- if(!("lat" in obj && "lng" in obj))
2997
- return false;
2998
-
2999
- return true;
3000
- }
3001
 
3002
- WPGMZA.LatLng.isLatLngString = function(str)
3003
- {
3004
- if(typeof str != "string")
3005
- return false;
3006
-
3007
- return str.match(WPGMZA.LatLng.REGEXP) ? true : false;
3008
- }
3009
 
3010
- /**
3011
- * The latitude, guaranteed to be a number
3012
- * @property lat
3013
- * @memberof WPGMZA.LatLng
3014
- */
3015
- Object.defineProperty(WPGMZA.LatLng.prototype, "lat", {
3016
- get: function() {
3017
- return this._lat;
3018
- },
3019
- set: function(val) {
3020
- if(!$.isNumeric(val))
3021
- throw new Error("Latitude must be numeric");
3022
- this._lat = parseFloat( val );
3023
- }
3024
  });
3025
 
 
 
 
 
 
 
 
 
 
 
3026
  /**
3027
- * The longitude, guaranteed to be a number
3028
- * @property lng
3029
- * @memberof WPGMZA.LatLng
 
 
3030
  */
3031
- Object.defineProperty(WPGMZA.LatLng.prototype, "lng", {
3032
- get: function() {
3033
- return this._lng;
3034
- },
3035
- set: function(val) {
3036
- if(!$.isNumeric(val))
3037
- throw new Error("Longitude must be numeric");
3038
- this._lng = parseFloat( val );
3039
- }
3040
- });
3041
-
3042
- WPGMZA.LatLng.fromString = function(string)
3043
  {
3044
- if(!WPGMZA.LatLng.isLatLngString(string))
3045
- throw new Error("Not a valid latlng string");
3046
 
3047
- var m = string.match(WPGMZA.LatLng.REGEXP);
3048
 
3049
- return new WPGMZA.LatLng({
3050
- lat: parseFloat(m[1]),
3051
- lng: parseFloat(m[3])
3052
- });
 
 
3053
  }
3054
 
3055
- /**
3056
- * Returns this latitude and longitude as a string
3057
- * @method
3058
- * @memberof WPGMZA.LatLng
3059
- * @return {string} This object represented as a string
3060
- */
3061
- WPGMZA.LatLng.prototype.toString = function()
3062
- {
3063
- return this._lat + ", " + this._lng;
3064
- }
3065
 
3066
  /**
3067
- * Queries the users current location and passes it to a callback, you can pass
3068
- * geocodeAddress through options if you would like to also receive the address
3069
  * @method
3070
- * @memberof WPGMZA.LatLng
3071
- * @param {function} A callback to receive the WPGMZA.LatLng
3072
- * @param {object} An object of options, only geocodeAddress is currently supported
3073
- * @return void
3074
  */
3075
- WPGMZA.LatLng.fromCurrentPosition = function(callback, options)
3076
  {
3077
- if(!options)
3078
- options = {};
3079
 
3080
- if(!callback)
3081
- return;
 
 
 
 
 
 
 
 
 
3082
 
3083
- WPGMZA.getCurrentPosition(function(position) {
 
 
3084
 
3085
- var latLng = new WPGMZA.LatLng({
3086
- lat: position.coords.latitude,
3087
- lng: position.coords.longitude
3088
- });
 
 
 
 
 
 
 
 
3089
 
3090
- if(options.geocodeAddress)
 
 
 
3091
  {
3092
- var geocoder = WPGMZA.Geocoder.createInstance();
3093
-
3094
- geocoder.getAddressFromLatLng({
3095
- latLng: latLng
3096
- }, function(results) {
3097
-
3098
- if(results.length)
3099
- latLng.address = results[0];
3100
-
3101
- callback(latLng);
3102
-
3103
  });
3104
-
3105
-
3106
- }
3107
- else
3108
- callback(latLng);
3109
 
3110
- });
 
 
 
3111
  }
3112
 
3113
- /**
3114
- * Returns an instnace of WPGMZA.LatLng from an instance of google.maps.LatLng
3115
- * @method
3116
- * @static
3117
- * @memberof WPGMZA.LatLng
3118
- * @param {google.maps.LatLng} The google.maps.LatLng to convert
3119
- * @return {WPGMZA.LatLng} An instance of WPGMZA.LatLng built from the supplied google.maps.LatLng
3120
- */
3121
- WPGMZA.LatLng.fromGoogleLatLng = function(googleLatLng)
3122
  {
3123
- return new WPGMZA.LatLng(
3124
- googleLatLng.lat(),
3125
- googleLatLng.lng()
3126
- );
 
3127
  }
3128
 
3129
- WPGMZA.LatLng.toGoogleLatLngArray = function(arr)
3130
  {
3131
- var result = [];
3132
-
3133
- arr.forEach(function(nativeLatLng) {
3134
-
3135
- if(! (nativeLatLng instanceof WPGMZA.LatLng || ("lat" in nativeLatLng && "lng" in nativeLatLng)) )
3136
- throw new Error("Unexpected input");
3137
-
3138
- result.push(new google.maps.LatLng({
3139
- lat: parseFloat(nativeLatLng.lat),
3140
- lng: parseFloat(nativeLatLng.lng)
3141
- }));
3142
-
3143
  });
3144
-
3145
- return result;
3146
  }
3147
 
3148
- /**
3149
- * Returns an instance of google.maps.LatLng with the same coordinates as this object
3150
- * @method
3151
- * @memberof WPGMZA.LatLng
3152
- * @return {google.maps.LatLng} This object, expressed as a google.maps.LatLng
3153
- */
3154
- WPGMZA.LatLng.prototype.toGoogleLatLng = function()
3155
  {
3156
- return new google.maps.LatLng({
3157
- lat: this.lat,
3158
- lng: this.lng
3159
  });
 
 
3160
  }
3161
 
3162
- WPGMZA.LatLng.prototype.toLatLngLiteral = function()
3163
  {
3164
- return {
3165
- lat: this.lat,
3166
- lng: this.lng
3167
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3168
  }
3169
 
 
 
 
 
 
 
 
 
 
 
 
 
3170
  /**
3171
- * Moves this latLng by the specified kilometers along the given heading. This function operates in place, as opposed to creating a new instance of WPGMZA.LatLng. With many thanks to Hu Kenneth - https://gis.stackexchange.com/questions/234473/get-a-lonlat-point-by-distance-or-between-2-lonlat-points
3172
- * @method
3173
- * @memberof WPGMZA.LatLng
3174
- * @param {number} kilometers The number of kilometers to move this LatLng by
3175
- * @param {number} heading The heading, in degrees, to move along, where zero is North
3176
- * @return {void}
3177
  */
3178
- WPGMZA.LatLng.prototype.moveByDistance = function(kilometers, heading)
3179
  {
3180
- var radius = 6371;
3181
 
3182
- var delta = parseFloat(kilometers) / radius;
3183
- var theta = parseFloat(heading) / 180 * Math.PI;
3184
 
3185
- var phi1 = this.lat / 180 * Math.PI;
3186
- var lambda1 = this.lng / 180 * Math.PI;
3187
 
3188
- var sinPhi1 = Math.sin(phi1), cosPhi1 = Math.cos(phi1);
3189
- var sinDelta = Math.sin(delta), cosDelta = Math.cos(delta);
3190
- var sinTheta = Math.sin(theta), cosTheta = Math.cos(theta);
 
 
 
3191
 
3192
- var sinPhi2 = sinPhi1 * cosDelta + cosPhi1 * sinDelta * cosTheta;
3193
- var phi2 = Math.asin(sinPhi2);
3194
- var y = sinTheta * sinDelta * cosPhi1;
3195
- var x = cosDelta - sinPhi1 * sinPhi2;
3196
- var lambda2 = lambda1 + Math.atan2(y, x);
3197
 
3198
- this.lat = phi2 * 180 / Math.PI;
3199
- this.lng = lambda2 * 180 / Math.PI;
3200
- }
 
 
 
 
 
 
 
 
 
3201
 
3202
- /**
3203
- * @function getGreatCircleDistance
3204
- * @summary Uses the haversine formula to get the great circle distance between this and another LatLng / lat & lng pair
3205
- * @param arg1 [WPGMZA.LatLng|Object|Number] Either a WPGMZA.LatLng, an object representing a lat/lng literal, or a latitude
3206
- * @param arg2 (optional) If arg1 is a Number representing latitude, pass arg2 to represent the longitude
3207
- * @return number The distance "as the crow files" between this point and the other
3208
- */
3209
- WPGMZA.LatLng.prototype.getGreatCircleDistance = function(arg1, arg2)
3210
- {
3211
- var lat1 = this.lat;
3212
- var lon1 = this.lng;
3213
- var other;
3214
 
3215
- if(arguments.length == 1)
3216
- other = new WPGMZA.LatLng(arg1);
3217
- else if(arguments.length == 2)
3218
- other = new WPGMZA.LatLng(arg1, arg2);
3219
- else
3220
- throw new Error("Invalid number of arguments");
 
 
 
 
 
 
 
 
3221
 
3222
- var lat2 = other.lat;
3223
- var lon2 = other.lng;
3224
 
3225
- var R = 6371; // Kilometers
3226
- var phi1 = lat1.toRadians();
3227
- var phi2 = lat2.toRadians();
3228
- var deltaPhi = (lat2-lat1).toRadians();
3229
- var deltaLambda = (lon2-lon1).toRadians();
3230
-
3231
- var a = Math.sin(deltaPhi/2) * Math.sin(deltaPhi/2) +
3232
- Math.cos(phi1) * Math.cos(phi2) *
3233
- Math.sin(deltaLambda/2) * Math.sin(deltaLambda/2);
3234
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
3235
-
3236
- var d = R * c;
3237
 
3238
- return d;
3239
- }
3240
 
3241
- });
3242
-
3243
- // js/v8/latlngbounds.js
3244
- /**
3245
- * @namespace WPGMZA
3246
- * @module LatLngBounds
3247
- * @requires WPGMZA
3248
- */
3249
- jQuery(function($) {
 
 
 
 
 
 
 
3250
 
3251
  /**
3252
- * This class represents latitude and longitude bounds as a rectangular area.
3253
- * NB: This class is not fully implemented
3254
- * @class WPGMZA.LatLngBounds
3255
- * @constructor WPGMZA.LatLngBounds
3256
- * @memberof WPGMZA
3257
  */
3258
- WPGMZA.LatLngBounds = function(southWest, northEast)
3259
  {
3260
- //console.log("Created bounds", southWest, northEast);
3261
 
3262
- if(southWest instanceof WPGMZA.LatLngBounds)
3263
- {
3264
- var other = southWest;
3265
- this.south = other.south;
3266
- this.north = other.north;
3267
- this.west = other.west;
3268
- this.east = other.east;
3269
- }
3270
- else if(southWest && northEast)
3271
  {
3272
- // TODO: Add checks and errors
3273
- this.south = southWest.lat;
3274
- this.north = northEast.lat;
3275
- this.west = southWest.lng;
3276
- this.east = northEast.lng;
 
 
3277
  }
 
 
3278
  }
3279
 
3280
- WPGMZA.LatLngBounds.fromGoogleLatLngBounds = function(googleLatLngBounds)
 
 
 
 
 
 
 
3281
  {
3282
- if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))
3283
- throw new Error("Argument must be an instance of google.maps.LatLngBounds");
3284
-
3285
- var result = new WPGMZA.LatLngBounds();
3286
- var southWest = googleLatLngBounds.getSouthWest();
3287
- var northEast = googleLatLngBounds.getNorthEast();
3288
-
3289
- result.north = northEast.lat();
3290
- result.south = southWest.lat();
3291
- result.west = southWest.lng();
3292
- result.east = northEast.lng();
3293
-
3294
- return result;
3295
  }
3296
 
3297
- WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral = function(obj)
 
 
 
 
 
 
 
3298
  {
3299
- var result = new WPGMZA.LatLngBounds();
3300
-
3301
- var southWest = obj.southwest;
3302
- var northEast = obj.northeast;
3303
-
3304
- result.north = northEast.lat;
3305
- result.south = southWest.lat;
3306
- result.west = southWest.lng;
3307
- result.east = northEast.lng;
3308
-
3309
- return result;
3310
  }
3311
 
3312
  /**
3313
- * Returns true if this object is in it's initial state (eg no points specified to gather bounds from)
 
3314
  * @method
3315
- * @memberof WPGMZA.LatLngBounds
3316
- * @return {bool} True if the object is in it's initial state
 
3317
  */
3318
- WPGMZA.LatLngBounds.prototype.isInInitialState = function()
3319
  {
3320
- return (this.north == undefined && this.south == undefined && this.west == undefined && this.east == undefined);
3321
  }
3322
 
3323
  /**
3324
- * Extends this bounds object to encompass the given latitude and longitude coordinates
 
3325
  * @method
3326
- * @memberof WPGMZA.LatLngBounds
3327
- * @param {object|WPGMZA.LatLng} latLng either a LatLng literal or an instance of WPGMZA.LatLng
 
3328
  */
3329
- WPGMZA.LatLngBounds.prototype.extend = function(latLng)
3330
  {
3331
- if(!(latLng instanceof WPGMZA.LatLng))
3332
- latLng = new WPGMZA.LatLng(latLng);
3333
-
3334
- //console.log("Expanding bounds to " + latLng.toString());
3335
-
3336
- if(this.isInInitialState())
3337
- {
3338
- this.north = this.south = latLng.lat;
3339
- this.west = this.east = latLng.lng;
3340
- return;
3341
- }
3342
-
3343
- if(latLng.lat < this.north)
3344
- this.north = latLng.lat;
3345
-
3346
- if(latLng.lat > this.south)
3347
- this.south = latLng.lat;
3348
-
3349
- if(latLng.lng < this.west)
3350
- this.west = latLng.lng;
3351
-
3352
- if(latLng.lng > this.east)
3353
- this.east = latLng.lng;
3354
  }
3355
 
3356
- WPGMZA.LatLngBounds.prototype.extendByPixelMargin = function(map, x, arg)
 
 
 
 
 
 
 
3357
  {
3358
- var y = x;
3359
-
3360
- if(!(map instanceof WPGMZA.Map))
3361
- throw new Error("First argument must be an instance of WPGMZA.Map");
3362
-
3363
- if(this.isInInitialState())
3364
- throw new Error("Cannot extend by pixels in initial state");
3365
-
3366
- if(arguments.length >= 3)
3367
- y = arg;
3368
-
3369
- var southWest = new WPGMZA.LatLng(this.south, this.west);
3370
- var northEast = new WPGMZA.LatLng(this.north, this.east);
3371
-
3372
- southWest = map.latLngToPixels(southWest);
3373
- northEast = map.latLngToPixels(northEast);
3374
-
3375
- southWest.x -= x;
3376
- southWest.y += y;
3377
-
3378
- northEast.x += x;
3379
- northEast.y -= y;
3380
-
3381
- southWest = map.pixelsToLatLng(southWest.x, southWest.y);
3382
- northEast = map.pixelsToLatLng(northEast.x, northEast.y);
3383
-
3384
- var temp = this.toString();
3385
-
3386
- this.north = northEast.lat;
3387
- this.south = southWest.lat;
3388
- this.west = southWest.lng;
3389
- this.east = northEast.lng;
3390
-
3391
- // console.log("Extended", temp, "to", this.toString());
3392
  }
3393
 
3394
- WPGMZA.LatLngBounds.prototype.contains = function(latLng)
 
 
 
 
 
 
 
 
3395
  {
3396
- //console.log("Checking if latLng ", latLng, " is within bounds " + this.toString());
3397
-
3398
- if(!(latLng instanceof WPGMZA.LatLng))
3399
- throw new Error("Argument must be an instance of WPGMZA.LatLng");
3400
-
3401
- if(latLng.lat < Math.min(this.north, this.south))
3402
- return false;
3403
-
3404
- if(latLng.lat > Math.max(this.north, this.south))
3405
- return false;
3406
-
3407
- if(this.west < this.east)
3408
- return (latLng.lng >= this.west && latLng.lng <= this.east);
3409
 
3410
- return (latLng.lng <= this.west || latLng.lng >= this.east);
 
 
3411
  }
3412
 
3413
- WPGMZA.LatLngBounds.prototype.toString = function()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3414
  {
3415
- return this.north + "N " + this.south + "S " + this.west + "W " + this.east + "E";
3416
  }
3417
 
3418
- WPGMZA.LatLngBounds.prototype.toLiteral = function()
 
 
 
 
 
 
 
 
 
3419
  {
3420
- return {
3421
- north: this.north,
3422
- south: this.south,
3423
- west: this.west,
3424
- east: this.east
3425
- };
3426
- }
 
 
 
 
 
3427
 
3428
  });
3429
 
3430
- // js/v8/legacy-global-symbols.js
3431
  /**
3432
  * @namespace WPGMZA
3433
- * @module LegacyGlobalSymbols
3434
  * @requires WPGMZA
3435
  */
3436
- jQuery(function($) {
3437
-
3438
- var legacyGlobals = {
3439
- marker_pull: "0",
3440
- marker_array: [],
3441
- MYMAP: [],
3442
- infoWindow_poly: [],
3443
- markerClusterer: [],
3444
- heatmap: [],
3445
- WPGM_Path: [],
3446
- WPGM_Path_Polygon: [],
3447
- WPGM_PathLine: [],
3448
- WPGM_PathLineData: [],
3449
- WPGM_PathData: [],
3450
- original_iw: null,
3451
- wpgmza_user_marker: null,
3452
-
3453
- wpgmaps_localize_marker_data: [],
3454
- wpgmaps_localize_polygon_settings: [],
3455
- wpgmaps_localize_heatmap_settings: [],
3456
- wpgmaps_localize_polyline_settings: [],
3457
- wpgmza_cirtcle_data_array: [],
3458
- wpgmza_rectangle_data_array: [],
3459
-
3460
- wpgmzaForceLegacyMarkerClusterer: false
3461
- };
3462
 
3463
- function bindLegacyGlobalProperty(key)
 
 
 
 
 
 
 
3464
  {
3465
- if(key in window)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3466
  {
3467
- console.warn("Cannot redefine legacy global " + key);
3468
- return;
3469
- }
3470
-
3471
- Object.defineProperty(window, key, {
3472
- "get": function() {
3473
-
3474
- console.warn("This property is deprecated and should no longer be used");
3475
-
3476
- return legacyGlobals[key];
3477
-
3478
- },
3479
- "set": function(value) {
3480
-
3481
- console.warn("This property is deprecated and should no longer be used");
3482
-
3483
- legacyGlobals[key] = value;
3484
 
3485
- }
3486
- });
 
 
3487
  }
3488
 
3489
- for(var key in legacyGlobals)
3490
- bindLegacyGlobalProperty(key);
3491
-
3492
- WPGMZA.legacyGlobals = legacyGlobals;
3493
-
3494
- window.InitMap =
3495
- window.resetLocations =
3496
- window.searchLocations =
3497
- window.fillInAddress =
3498
- window.searchLocationsNear =
3499
- function () {
3500
- console.warn("This function is deprecated and should no longer be used");
3501
  }
3502
-
3503
- /*window.add_polygon = function (mapid, polygonid) {
3504
-
3505
- console.warn("This function is deprecated and should no longer be used");
3506
-
3507
- if (WPGMZA.settings.engine == "open-layers")
3508
- return;
3509
-
3510
- var tmp_data = wpgmaps_localize_polygon_settings[mapid][polygonid];
3511
- var current_poly_id = polygonid;
3512
- var tmp_polydata = tmp_data['polydata'];
3513
- var WPGM_PathData = new Array();
3514
- for (tmp_entry2 in tmp_polydata) {
3515
- if (typeof tmp_polydata[tmp_entry2][0] !== "undefined") {
3516
-
3517
- WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1]));
3518
- }
3519
- }
3520
- if (tmp_data['lineopacity'] === null || tmp_data['lineopacity'] === "") {
3521
- tmp_data['lineopacity'] = 1;
3522
- }
3523
-
3524
- var bounds = new google.maps.LatLngBounds();
3525
- for (i = 0; i < WPGM_PathData.length; i++) {
3526
- bounds.extend(WPGM_PathData[i]);
3527
- }
3528
-
3529
- function addPolygonLabel(googleLatLngs) {
3530
- var label = tmp_data.title;
3531
-
3532
- var geojson = [[]];
3533
-
3534
- googleLatLngs.forEach(function (latLng) {
3535
- geojson[0].push([
3536
- latLng.lng(),
3537
- latLng.lat()
3538
- ])
3539
- });
3540
-
3541
- var lngLat = WPGMZA.ProPolygon.getLabelPosition(geojson);
3542
-
3543
- var latLng = new WPGMZA.LatLng({
3544
- lat: lngLat[1],
3545
- lng: lngLat[0]
3546
- });
3547
-
3548
- var marker = WPGMZA.Marker.createInstance({
3549
- position: latLng
3550
- });
3551
-
3552
- // TODO: Support target map
3553
- // TODO: Read polygon title
3554
-
3555
- var text = WPGMZA.Text.createInstance({
3556
- text: label,
3557
- map: WPGMZA.getMapByID(mapid),
3558
- position: latLng
3559
- });
3560
-
3561
- //var marker = WPGMZA.Marker.createInst)
3562
- }
3563
-
3564
- WPGM_Path_Polygon[polygonid] = new google.maps.Polygon({
3565
- path: WPGM_PathData,
3566
- clickable: true,
3567
- strokeColor: "#" + tmp_data['linecolor'],
3568
- fillOpacity: tmp_data['opacity'],
3569
- strokeOpacity: tmp_data['lineopacity'],
3570
- fillColor: "#" + tmp_data['fillcolor'],
3571
- strokeWeight: 2,
3572
- map: MYMAP[mapid].map.googleMap
3573
- });
3574
- WPGM_Path_Polygon[polygonid].setMap(MYMAP[mapid].map.googleMap);
3575
-
3576
- var map = WPGMZA.getMapByID(mapid);
3577
- if (map.settings.polygon_labels)
3578
- addPolygonLabel(WPGM_PathData);
3579
-
3580
- if (tmp_data['title'] !== "") {
3581
- infoWindow_poly[polygonid] = new google.maps.InfoWindow();
3582
- infoWindow_poly[polygonid].setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX);
3583
-
3584
- google.maps.event.addListener(WPGM_Path_Polygon[polygonid], 'click', function (event) {
3585
- infoWindow_poly[polygonid].setPosition(event.latLng);
3586
- content = "";
3587
- if (tmp_data['link'] !== "") {
3588
- var content = "<a href='" + tmp_data['link'] + "'><h4 class='wpgmza_polygon_title'>" + tmp_data['title'] + "</h4></a>";
3589
- if (tmp_data['description'] !== "") {
3590
- content += '<p class="wpgmza_polygon_description">' + tmp_data['description'] + '</p>';
3591
- }
3592
- } else {
3593
- var content = '<h4 class="wpgmza_polygon_title">' + tmp_data['title'] + '</h4>';
3594
- if (tmp_data['description'] !== "") {
3595
- content += '<p class="wpgmza_polygon_description">' + tmp_data['description'] + '</p>';
3596
- }
3597
- }
3598
- infoWindow_poly[polygonid].setContent(content);
3599
- infoWindow_poly[polygonid].open(MYMAP[mapid].map.googleMap, this.position);
3600
  });
 
 
 
 
 
3601
  }
3602
-
3603
- google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseover", function (event) {
3604
- this.setOptions({
3605
- fillColor: "#" + tmp_data['ohfillcolor']
3606
- });
3607
- this.setOptions({
3608
- fillOpacity: tmp_data['ohopacity']
3609
- });
3610
- this.setOptions({
3611
- strokeColor: "#" + tmp_data['ohlinecolor']
3612
- });
3613
- this.setOptions({
3614
- strokeWeight: 2
3615
- });
3616
- this.setOptions({
3617
- strokeOpacity: 0.9
3618
- });
3619
- });
3620
- google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "click", function (event) {
3621
-
3622
- this.setOptions({
3623
- fillColor: "#" + tmp_data['ohfillcolor']
3624
- });
3625
- this.setOptions({
3626
- fillOpacity: tmp_data['ohopacity']
3627
- });
3628
- this.setOptions({
3629
- strokeColor: "#" + tmp_data['ohlinecolor']
3630
- });
3631
- this.setOptions({
3632
- strokeWeight: 2
3633
- });
3634
- this.setOptions({
3635
- strokeOpacity: 0.9
3636
- });
3637
- });
3638
- google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseout", function (event) {
3639
- this.setOptions({
3640
- fillColor: "#" + tmp_data['fillcolor']
3641
- });
3642
- this.setOptions({
3643
- fillOpacity: tmp_data['opacity']
3644
- });
3645
- this.setOptions({
3646
- strokeColor: "#" + tmp_data['linecolor']
3647
- });
3648
- this.setOptions({
3649
- strokeWeight: 2
3650
- });
3651
- this.setOptions({
3652
- strokeOpacity: tmp_data['lineopacity']
3653
- });
3654
- });
3655
  }
3656
 
3657
- window.add_polyline = function (mapid, polyline) {
3658
-
3659
- console.warn("This function is deprecated and should no longer be used");
3660
-
3661
- if (WPGMZA.settings.engine == "open-layers")
3662
- return;
3663
-
3664
- var tmp_data = wpgmaps_localize_polyline_settings[mapid][polyline];
3665
-
3666
- var current_poly_id = polyline;
3667
- var tmp_polydata = tmp_data['polydata'];
3668
- var WPGM_Polyline_PathData = new Array();
3669
- for (tmp_entry2 in tmp_polydata) {
3670
- if (typeof tmp_polydata[tmp_entry2][0] !== "undefined" && typeof tmp_polydata[tmp_entry2][1] !== "undefined") {
3671
- var lat = tmp_polydata[tmp_entry2][0].replace(')', '');
3672
- lat = lat.replace('(', '');
3673
- var lng = tmp_polydata[tmp_entry2][1].replace(')', '');
3674
- lng = lng.replace('(', '');
3675
- WPGM_Polyline_PathData.push(new google.maps.LatLng(lat, lng));
3676
- }
3677
-
3678
- }
3679
- if (tmp_data['lineopacity'] === null || tmp_data['lineopacity'] === "") {
3680
- tmp_data['lineopacity'] = 1;
3681
- }
3682
-
3683
- WPGM_Path[polyline] = new google.maps.Polyline({
3684
- path: WPGM_Polyline_PathData,
3685
- strokeColor: "#" + tmp_data['linecolor'],
3686
- strokeOpacity: tmp_data['opacity'],
3687
- strokeWeight: tmp_data['linethickness'],
3688
- map: MYMAP[mapid].map.googleMap
3689
- });
3690
- WPGM_Path[polyline].setMap(MYMAP[mapid].map.googleMap);
3691
-
3692
  }
3693
-
3694
- window.add_circle = function (mapid, data) {
3695
-
3696
- console.warn("This function is deprecated and should no longer be used");
 
 
 
 
 
 
 
 
 
 
 
3697
 
3698
- if (WPGMZA.settings.engine != "google-maps" || !MYMAP.hasOwnProperty(mapid))
3699
- return;
3700
-
3701
- data.map = MYMAP[mapid].map.googleMap;
3702
-
3703
- if (!(data.center instanceof google.maps.LatLng)) {
3704
- var m = data.center.match(/-?\d+(\.\d*)?/g);
3705
- data.center = new google.maps.LatLng({
3706
- lat: parseFloat(m[0]),
3707
- lng: parseFloat(m[1]),
3708
- });
3709
- }
3710
-
3711
- data.radius = parseFloat(data.radius);
3712
- data.fillColor = data.color;
3713
- data.fillOpacity = parseFloat(data.opacity);
3714
-
3715
- data.strokeOpacity = 0;
3716
-
3717
- var circle = new google.maps.Circle(data);
3718
- circle_array.push(circle);
3719
  }
 
 
 
 
 
 
 
 
 
 
3720
 
3721
- window.add_rectangle = function (mapid, data) {
 
 
 
 
 
 
3722
 
3723
- console.warn("This function is deprecated and should no longer be used");
3724
 
3725
- if (WPGMZA.settings.engine != "google-maps" || !MYMAP.hasOwnProperty(mapid))
 
3726
  return;
3727
-
3728
- data.map = MYMAP[mapid].map.googleMap;
3729
-
3730
- data.fillColor = data.color;
3731
- data.fillOpacity = parseFloat(data.opacity);
3732
-
3733
- var northWest = data.cornerA;
3734
- var southEast = data.cornerB;
3735
-
3736
- var m = northWest.match(/-?\d+(\.\d+)?/g);
3737
- var north = parseFloat(m[0]);
3738
- var west = parseFloat(m[1]);
3739
-
3740
- m = southEast.match(/-?\d+(\.\d+)?/g);
3741
- var south = parseFloat(m[0]);
3742
- var east = parseFloat(m[1]);
3743
-
3744
- data.bounds = {
3745
- north: north,
3746
- west: west,
3747
- south: south,
3748
- east: east
3749
- };
3750
-
3751
- data.strokeOpacity = 0;
3752
-
3753
- var rectangle = new google.maps.Rectangle(data);
3754
- rectangle_array.push(rectangle);
3755
- }
3756
-
3757
- window.add_heatmap = function (mapid, datasetid) {
3758
 
3759
- console.warn("This function is deprecated and should no longer be used");
3760
-
3761
- if (WPGMZA.settings.engine != "google-maps")
3762
  return;
3763
-
3764
- var tmp_data = wpgmaps_localize_heatmap_settings[mapid][datasetid];
3765
- var current_poly_id = datasetid;
3766
- var tmp_polydata = tmp_data['polydata'];
3767
- var WPGM_PathData = new Array();
3768
- for (tmp_entry2 in tmp_polydata) {
3769
- if (typeof tmp_polydata[tmp_entry2][0] !== "undefined") {
3770
-
3771
- WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1]));
3772
- }
3773
- }
3774
- if (tmp_data['radius'] === null || tmp_data['radius'] === "") {
3775
- tmp_data['radius'] = 20;
3776
- }
3777
- if (tmp_data['gradient'] === null || tmp_data['gradient'] === "") {
3778
- tmp_data['gradient'] = null;
3779
- }
3780
- if (tmp_data['opacity'] === null || tmp_data['opacity'] === "") {
3781
- tmp_data['opacity'] = 0.6;
3782
- }
3783
-
3784
- var bounds = new google.maps.LatLngBounds();
3785
- for (i = 0; i < WPGM_PathData.length; i++) {
3786
- bounds.extend(WPGM_PathData[i]);
3787
  }
3788
-
3789
- WPGM_Path_Polygon[datasetid] = new google.maps.visualization.HeatmapLayer({
3790
- data: WPGM_PathData,
3791
- map: MYMAP[mapid].map.googleMap
3792
- });
3793
-
3794
- WPGM_Path_Polygon[datasetid].setMap(MYMAP[mapid].map.googleMap);
3795
- var gradient = JSON.parse(tmp_data['gradient']);
3796
- WPGM_Path_Polygon[datasetid].set('radius', tmp_data['radius']);
3797
- WPGM_Path_Polygon[datasetid].set('opacity', tmp_data['opacity']);
3798
- WPGM_Path_Polygon[datasetid].set('gradient', gradient);
3799
- };*/
3800
-
3801
- });
3802
-
3803
- // js/v8/map-list-page.js
3804
- /**
3805
- * @namespace WPGMZA
3806
- * @module MapListPage
3807
- * @requires WPGMZA
3808
- */
3809
- jQuery(function($) {
3810
-
3811
- WPGMZA.MapListPage = function()
3812
- {
3813
-
3814
- $("body").on("click",".wpgmza_copy_shortcode", function() {
3815
- var $temp = jQuery('<input>');
3816
- var $tmp2 = jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');
3817
- jQuery("body").append($temp);
3818
- $temp.val(jQuery(this).val()).select();
3819
- document.execCommand("copy");
3820
- $temp.remove();
3821
- WPGMZA.notification("Shortcode Copied");
3822
- });
3823
 
 
 
 
 
 
 
 
 
 
3824
  }
3825
 
3826
- WPGMZA.MapListPage.createInstance = function()
 
 
 
 
 
 
3827
  {
3828
- return new WPGMZA.MapListPage();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3829
  }
3830
 
3831
- $(document).ready(function(event) {
 
 
 
 
 
 
 
 
 
3832
 
3833
- if(WPGMZA.getCurrentPage() == WPGMZA.PAGE_MAP_LIST)
3834
- WPGMZA.mapListPage = WPGMZA.MapListPage.createInstance();
3835
 
3836
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3837
 
 
 
3838
  });
3839
 
3840
- // js/v8/map-settings.js
3841
  /**
3842
  * @namespace WPGMZA
3843
- * @module MapSettings
3844
- * @requires WPGMZA
3845
  */
3846
  jQuery(function($) {
3847
-
3848
- /**
3849
- * Handles map settings, parsing them from the data-settings attribute on the maps HTML element.
3850
- * NB: This will be split into GoogleMapSettings and OLMapSettings in the future.
3851
- * @class WPGMZA.MapSettings
3852
- * @constructor WPGMZA.MapSettings
3853
- */
3854
- WPGMZA.MapSettings = function(element)
3855
- {
3856
- var self = this;
3857
- var str = element.getAttribute("data-settings");
3858
- var json;
3859
-
3860
- try{
3861
- json = JSON.parse(str);
3862
- }catch(e) {
3863
-
3864
- str = str.replace(/\\%/g, "%");
3865
- str = str.replace(/\\\\"/g, '\\"');
3866
-
3867
- try{
3868
- json = JSON.parse(str);
3869
- }catch(e) {
3870
- json = {};
3871
- console.warn("Failed to parse map settings JSON");
3872
- }
3873
-
3874
- }
3875
-
3876
- WPGMZA.assertInstanceOf(this, "MapSettings");
3877
-
3878
-
3879
-
3880
- function addSettings(input) {
3881
- if(!input)
3882
- return;
3883
-
3884
- for(var key in input) {
3885
- if(key == "other_settings")
3886
- continue; // Ignore other_settings
3887
-
3888
- var value = input[key];
3889
-
3890
- if(String(value).match(/^-?\d+$/))
3891
- value = parseInt(value);
3892
-
3893
- self[key] = value;
3894
- }
3895
- }
3896
-
3897
- addSettings(WPGMZA.settings);
3898
-
3899
- addSettings(json);
3900
-
3901
- if(json && json.other_settings)
3902
- addSettings(json.other_settings);
3903
-
3904
- }
3905
-
3906
- /**
3907
- * Returns settings on this object converted to OpenLayers view options
3908
- * @method
3909
- * @memberof WPGMZA.MapSettings
3910
- * @return {object} The map settings, in a format understood by OpenLayers
3911
- */
3912
- WPGMZA.MapSettings.prototype.toOLViewOptions = function()
3913
- {
3914
- var self = this;
3915
- var options = {
3916
- center: ol.proj.fromLonLat([-119.4179, 36.7783]),
3917
- zoom: 4
3918
- };
3919
-
3920
- function empty(name)
3921
- {
3922
- if(typeof self[name] == "object")
3923
- return false;
3924
-
3925
- return !self[name] || !self[name].length;
3926
- }
3927
 
3928
- // Start location
3929
- if(typeof this.start_location == "string")
3930
- {
3931
- var coords = this.start_location.replace(/^\(|\)$/g, "").split(",");
3932
- if(WPGMZA.isLatLngString(this.start_location))
3933
- options.center = ol.proj.fromLonLat([
3934
- parseFloat(coords[1]),
3935
- parseFloat(coords[0])
3936
- ]);
3937
- else
3938
- console.warn("Invalid start location");
3939
- }
3940
 
3941
- if(this.center)
3942
- {
3943
- options.center = ol.proj.fromLonLat([
3944
- parseFloat(this.center.lng),
3945
- parseFloat(this.center.lat)
3946
- ]);
3947
- }
3948
 
3949
- if(!empty("map_start_lat") && !empty("map_start_lng"))
3950
- {
3951
- options.center = ol.proj.fromLonLat([
3952
- parseFloat(this.map_start_lng),
3953
- parseFloat(this.map_start_lat)
3954
- ]);
3955
- }
3956
 
3957
- // Start zoom
3958
- if(this.zoom){
3959
- options.zoom = parseInt(this.zoom);
3960
- }
3961
 
3962
- if(this.start_zoom){
3963
- options.zoom = parseInt(this.start_zoom);
3964
- }
3965
-
3966
- if(this.map_start_zoom){
3967
- options.zoom = parseInt(this.map_start_zoom);
3968
- }
3969
 
3970
- // Zoom limits
3971
- // TODO: This matches the Google code, so some of these could be potentially put on a parent class
3972
- if(this.map_min_zoom && this.map_max_zoom)
3973
  {
3974
- options.minZoom = Math.min(this.map_min_zoom, this.map_max_zoom);
3975
- options.maxZoom = Math.max(this.map_min_zoom, this.map_max_zoom);
 
 
3976
  }
3977
-
3978
- return options;
 
 
3979
  }
 
 
 
 
 
 
 
 
 
 
 
3980
 
3981
  /**
3982
- * Returns settings on this object converted to Google's MapOptions spec.
3983
  * @method
3984
- * @memberof WPGMZA.MapSettings
3985
- * @return {object} The map settings, in the format specified by google.maps.MapOptions
3986
  */
3987
- WPGMZA.MapSettings.prototype.toGoogleMapsOptions = function()
3988
  {
3989
- var self = this;
3990
- var latLngCoords = (this.start_location && this.start_location.length ? this.start_location.split(",") : [36.7783, -119.4179]);
3991
-
3992
- function empty(name)
3993
  {
3994
- if(typeof self[name] == "object")
3995
- return false;
 
 
 
3996
 
3997
- return !self[name] || !self[name].length;
 
 
 
 
3998
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3999
 
4000
- function formatCoord(coord)
4001
  {
4002
- if($.isNumeric(coord))
4003
- return coord;
4004
- return parseFloat( String(coord).replace(/[\(\)\s]/, "") );
 
 
 
4005
  }
4006
-
4007
- var latLng = new google.maps.LatLng(
4008
- formatCoord(latLngCoords[0]),
4009
- formatCoord(latLngCoords[1])
4010
- );
4011
-
4012
- var zoom = (this.start_zoom ? parseInt(this.start_zoom) : 4);
4013
-
4014
- if(!this.start_zoom && this.zoom){
4015
- zoom = parseInt( this.zoom );
4016
  }
 
4017
 
4018
- if(this.map_start_zoom){
4019
- zoom = parseInt(this.map_start_zoom);
4020
- }
 
 
4021
 
4022
- var options = {
4023
- zoom: zoom,
4024
- center: latLng
4025
- };
 
4026
 
4027
- if(!empty("center"))
4028
- options.center = new google.maps.LatLng({
4029
- lat: parseFloat(this.center.lat),
4030
- lng: parseFloat(this.center.lng)
4031
- });
4032
 
4033
- if(!empty("map_start_lat") && !empty("map_start_lng"))
4034
- {
4035
- // NB: map_start_lat and map_start_lng are the "real" values. Not sure where start_location comes from
4036
- options.center = new google.maps.LatLng({
4037
- lat: parseFloat(this.map_start_lat),
4038
- lng: parseFloat(this.map_start_lng)
4039
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4040
  }
4041
 
4042
- if(this.map_min_zoom && this.map_max_zoom)
4043
- {
4044
- options.minZoom = Math.min(this.map_min_zoom, this.map_max_zoom);
4045
- options.maxZoom = Math.max(this.map_min_zoom, this.map_max_zoom);
4046
  }
 
 
 
 
4047
 
4048
- // NB: Handles legacy checkboxes as well as new, standard controls
4049
- function isSettingDisabled(value)
4050
- {
4051
- if(value === "yes")
4052
- return true;
4053
-
4054
- return (value ? true : false);
4055
- }
 
 
 
 
 
4056
 
4057
- // These settings are all inverted because the checkbox being set means "disabled"
4058
- options.zoomControl = !isSettingDisabled(this.wpgmza_settings_map_zoom);
4059
- options.panControl = !isSettingDisabled(this.wpgmza_settings_map_pan);
4060
- options.mapTypeControl = !isSettingDisabled(this.wpgmza_settings_map_type);
4061
- options.streetViewControl = !isSettingDisabled(this.wpgmza_settings_map_streetview);
4062
- options.fullscreenControl = !isSettingDisabled(this.wpgmza_settings_map_full_screen_control);
4063
-
4064
- options.draggable = !isSettingDisabled(this.wpgmza_settings_map_draggable);
4065
- options.disableDoubleClickZoom = isSettingDisabled(this.wpgmza_settings_map_clickzoom);
4066
-
4067
- if(isSettingDisabled(this.wpgmza_settings_map_tilt_controls)){
4068
- options.rotateControl = false;
4069
- options.tilt = 0;
4070
- }
4071
 
4072
- // NB: This setting is handled differently as setting scrollwheel to true breaks gestureHandling
4073
- if(this.wpgmza_settings_map_scroll)
4074
- options.scrollwheel = false;
4075
 
4076
- if(this.wpgmza_force_greedy_gestures == "greedy"
4077
- || this.wpgmza_force_greedy_gestures == "yes"
4078
- || this.wpgmza_force_greedy_gestures == true)
4079
- {
4080
- options.gestureHandling = "greedy";
4081
-
4082
- // Setting this at all will break gesture handling. Make sure we delete it when using greedy gesture handling
4083
- if(!this.wpgmza_settings_map_scroll && "scrollwheel" in options)
4084
- delete options.scrollwheel;
4085
- }
4086
- else
4087
- options.gestureHandling = "cooperative";
4088
 
4089
- switch(parseInt(this.type))
4090
- {
4091
- case 2:
4092
- options.mapTypeId = google.maps.MapTypeId.SATELLITE;
4093
- break;
4094
-
4095
- case 3:
4096
- options.mapTypeId = google.maps.MapTypeId.HYBRID;
4097
- break;
4098
-
4099
- case 4:
4100
- options.mapTypeId = google.maps.MapTypeId.TERRAIN;
4101
- break;
4102
-
4103
- default:
4104
- options.mapTypeId = google.maps.MapTypeId.ROADMAP;
4105
- break;
4106
- }
4107
 
4108
- if(this.wpgmza_theme_data && this.wpgmza_theme_data.length)
4109
- options.styles = WPGMZA.GoogleMap.parseThemeData(this.wpgmza_theme_data);
 
 
 
 
 
 
 
 
 
 
4110
 
4111
- return options;
 
4112
  }
4113
- });
4114
-
4115
- // js/v8/map.js
4116
- /**
4117
- * @namespace WPGMZA
4118
- * @module Map
4119
- * @requires WPGMZA.EventDispatcher
4120
- */
4121
- jQuery(function($) {
4122
-
4123
- /**
4124
- * Base class for maps. <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.
4125
- * @class WPGMZA.Map
4126
- * @constructor WPGMZA.Map
4127
- * @memberof WPGMZA
4128
- * @param {HTMLElement} element to contain map
4129
- * @param {object} [options] Options to apply to this map
4130
- * @augments WPGMZA.EventDispatcher
4131
- */
4132
- WPGMZA.Map = function(element, options)
4133
- {
4134
- var self = this;
4135
-
4136
- WPGMZA.assertInstanceOf(this, "Map");
4137
-
4138
- WPGMZA.EventDispatcher.call(this);
4139
-
4140
- if(!(element instanceof HTMLElement))
4141
- throw new Error("Argument must be a HTMLElement");
4142
-
4143
- // NB: This should be moved to a getID function or similar and offloaded to Pro. ID should be fixed to 1 in basic.
4144
- if(element.hasAttribute("data-map-id"))
4145
- this.id = element.getAttribute("data-map-id");
4146
- else
4147
- this.id = 1;
4148
-
4149
- if(!/\d+/.test(this.id))
4150
- throw new Error("Map ID must be an integer");
4151
-
4152
- WPGMZA.maps.push(this);
4153
-
4154
- this.element = element;
4155
- this.element.wpgmzaMap = this;
4156
- $(this.element).addClass("wpgmza-initialized");
4157
-
4158
- this.engineElement = element;
4159
-
4160
- this.markers = [];
4161
- this.polygons = [];
4162
- this.polylines = [];
4163
- this.circles = [];
4164
- this.rectangles = [];
4165
-
4166
- this.loadSettings(options);
4167
-
4168
- this.shortcodeAttributes = {};
4169
- if($(this.element).attr("data-shortcode-attributes")){
4170
- try{
4171
- this.shortcodeAttributes = JSON.parse($(this.element).attr("data-shortcode-attributes"));
4172
- if(this.shortcodeAttributes.zoom){
4173
- this.settings.map_start_zoom = parseInt(this.shortcodeAttributes.zoom);
4174
- }
4175
- }catch(e) {
4176
- console.warn("Error parsing shortcode attributes");
4177
- }
4178
- }
4179
-
4180
- if(WPGMZA.getCurrentPage() != WPGMZA.PAGE_MAP_EDIT)
4181
- this.initStoreLocator();
4182
- this.setDimensions();
4183
- this.setAlignment();
4184
-
4185
- // Init marker filter
4186
- this.markerFilter = WPGMZA.MarkerFilter.createInstance(this);
4187
-
4188
- // GDPR
4189
-
4190
- if(WPGMZA.googleAPIStatus && WPGMZA.googleAPIStatus.code == "USER_CONSENT_NOT_GIVEN") {
4191
- $(element).append($(WPGMZA.api_consent_html));
4192
- $(element).css({height: "auto"});
4193
- }
4194
-
4195
- // Initialisation
4196
- this.on("init", function(event) {
4197
- self.onInit(event);
4198
- });
4199
-
4200
- this.on("click", function(event){
4201
- self.onClick(event);
4202
- });
4203
-
4204
- // Legacy support
4205
- if(WPGMZA.useLegacyGlobals)
4206
- {
4207
- // NB: this.id stuff should be moved to Map
4208
- wpgmzaLegacyGlobals.MYMAP[this.id] = {
4209
- map: null,
4210
- bounds: null,
4211
- mc: null
4212
- };
4213
-
4214
- wpgmzaLegacyGlobals.MYMAP.init =
4215
- wpgmzaLegacyGlobals.MYMAP[this.id].init =
4216
- wpgmzaLegacyGlobals.MYMAP.placeMarkers =
4217
- wpgmzaLegacyGlobals.MYMAP[this.id].placeMarkers =
4218
- function() {
4219
- console.warn("This function is deprecated and should no longer be used");
4220
- }
4221
- }
4222
- }
4223
-
4224
- WPGMZA.Map.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
4225
- WPGMZA.Map.prototype.constructor = WPGMZA.Map;
4226
- 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"}]}];
4227
-
4228
- /**
4229
- * Returns the contructor to be used by createInstance, depending on the selected maps engine.
4230
- * @method
4231
- * @memberof WPGMZA.Map
4232
- * @return {function} The appropriate contructor
4233
- */
4234
- WPGMZA.Map.getConstructor = function()
4235
- {
4236
- switch(WPGMZA.settings.engine)
4237
- {
4238
- case "open-layers":
4239
- if(WPGMZA.isProVersion())
4240
- return WPGMZA.OLProMap;
4241
-
4242
- return WPGMZA.OLMap;
4243
- break;
4244
-
4245
- default:
4246
- if(WPGMZA.isProVersion())
4247
- return WPGMZA.GoogleProMap;
4248
-
4249
- return WPGMZA.GoogleMap;
4250
- break;
4251
- }
4252
- }
4253
-
4254
- /**
4255
- * Creates an instance of a map, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
4256
- * @method
4257
- * @memberof WPGMZA.Map
4258
- * @param {HTMLElement} element to contain map
4259
- * @param {object} [options] Options to apply to this map
4260
- * @return {WPGMZA.Map} An instance of WPGMZA.Map
4261
- */
4262
- WPGMZA.Map.createInstance = function(element, options)
4263
- {
4264
- var constructor = WPGMZA.Map.getConstructor();
4265
- return new constructor(element, options);
4266
- }
4267
-
4268
- /**
4269
- * Whether or not the markers have been placed yet
4270
- *
4271
- * @name WPGMZA.ProMap#markersPlaced
4272
- * @type Boolean
4273
- * @readonly
4274
- */
4275
- Object.defineProperty(WPGMZA.Map.prototype, "markersPlaced", {
4276
-
4277
- get: function() {
4278
- return this._markersPlaced;
4279
- },
4280
-
4281
- set: function(value) {
4282
- throw new Error("Value is read only");
4283
- }
4284
-
4285
- });
4286
-
4287
- /**
4288
- * The maps current latitude
4289
- *
4290
- * @property lat
4291
- * @memberof WPGMZA.Map
4292
- * @name WPGMZA.Map#lat
4293
- * @type Number
4294
- */
4295
- Object.defineProperty(WPGMZA.Map.prototype, "lat", {
4296
-
4297
- get: function() {
4298
- return this.getCenter().lat;
4299
- },
4300
-
4301
- set: function(value) {
4302
- var center = this.getCenter();
4303
- center.lat = value;
4304
- this.setCenter(center);
4305
- }
4306
-
4307
- });
4308
-
4309
- /**
4310
- * The maps current longitude
4311
- *
4312
- * @property lng
4313
- * @memberof WPGMZA.Map
4314
- * @name WPGMZA.Map#lng
4315
- * @type Number
4316
- */
4317
- Object.defineProperty(WPGMZA.Map.prototype, "lng", {
4318
-
4319
- get: function() {
4320
- return this.getCenter().lng;
4321
- },
4322
-
4323
- set: function(value) {
4324
- var center = this.getCenter();
4325
- center.lng = value;
4326
- this.setCenter(center);
4327
- }
4328
-
4329
- });
4330
-
4331
- /**
4332
- * The maps current zoom level
4333
- *
4334
- * @property zoom
4335
- * @memberof WPGMZA.Map
4336
- * @name WPGMZA.Map#zoom
4337
- * @type Number
4338
- */
4339
- Object.defineProperty(WPGMZA.Map.prototype, "zoom", {
4340
-
4341
- get: function() {
4342
- return this.getZoom();
4343
- },
4344
-
4345
- set: function(value) {
4346
- this.setZoom(value);
4347
- }
4348
-
4349
- });
4350
-
4351
- /**
4352
- * Called by the engine specific map classes when the map has fully initialised
4353
- * @method
4354
- * @memberof WPGMZA.Map
4355
- * @param {WPGMZA.Event} The event
4356
- * @listens module:WPGMZA.Map~init
4357
- */
4358
- WPGMZA.Map.prototype.onInit = function(event)
4359
- {
4360
- var self = this;
4361
-
4362
- this.initPreloader();
4363
-
4364
- if(!("autoFetchFeatures" in this.settings) || (this.settings.autoFetchFeatures !== false))
4365
- this.fetchFeatures();
4366
- }
4367
-
4368
- /**
4369
- * Initialises the preloader
4370
- * @method
4371
- * @memberof WPGMZA.Map
4372
- * @protected
4373
- */
4374
- WPGMZA.Map.prototype.initPreloader = function()
4375
- {
4376
- this.preloader = $(WPGMZA.preloaderHTML);
4377
-
4378
- $(this.preloader).hide();
4379
-
4380
- $(this.element).append(this.preloader);
4381
- }
4382
-
4383
- /**
4384
- * Shows or hides the maps preloader
4385
- * @method
4386
- * @memberof WPGMZA.Map
4387
- */
4388
- WPGMZA.Map.prototype.showPreloader = function(show)
4389
- {
4390
- if(show)
4391
- $(this.preloader).show();
4392
- else
4393
- $(this.preloader).hide();
4394
- }
4395
-
4396
- /**
4397
- * Loads the maps settings and sets some defaults
4398
- * @method
4399
- * @memberof WPGMZA.Map
4400
- */
4401
- WPGMZA.Map.prototype.loadSettings = function(options)
4402
- {
4403
- var settings = new WPGMZA.MapSettings(this.element);
4404
- var other_settings = settings.other_settings;
4405
-
4406
- delete settings.other_settings;
4407
-
4408
- /*if(other_settings)
4409
- for(var key in other_settings)
4410
- settings[key] = other_settings[key];*/
4411
-
4412
- if(options)
4413
- for(var key in options)
4414
- settings[key] = options[key];
4415
-
4416
- this.settings = settings;
4417
- }
4418
-
4419
- WPGMZA.Map.prototype.initStoreLocator = function()
4420
- {
4421
- var storeLocatorElement = $(".wpgmza_sl_main_div");
4422
- if(storeLocatorElement.length)
4423
- this.storeLocator = WPGMZA.StoreLocator.createInstance(this, storeLocatorElement[0]);
4424
- }
4425
-
4426
- /**
4427
- * Get's arrays of all features for each of the feature types on the map
4428
- * @method
4429
- * @protected
4430
- * @memberof WPGMZA.Map
4431
- */
4432
- WPGMZA.Map.prototype.getFeatureArrays = function()
4433
- {
4434
- var arrays = WPGMZA.Map.prototype.getFeatureArrays.call(this);
4435
-
4436
- arrays.heatmaps = this.heatmaps;
4437
-
4438
- return arrays;
4439
- }
4440
-
4441
  /**
4442
- * Sets options in bulk on map
4443
- * @method
4444
- * @memberof WPGMZA.Map
 
 
 
4445
  */
4446
- WPGMZA.Map.prototype.setOptions = function(options)
4447
- {
4448
- for(var name in options)
4449
- this.settings[name] = options[name];
4450
- }
4451
-
4452
- WPGMZA.Map.prototype.getRESTParameters = function(options)
4453
- {
4454
- var defaults = {};
4455
-
4456
- if(!options || !options.filter)
4457
- defaults.filter = JSON.stringify(this.markerFilter.getFilteringParameters());
4458
-
4459
- return $.extend(true, defaults, options);
4460
- }
4461
-
4462
- WPGMZA.Map.prototype.fetchFeaturesViaREST = function()
4463
- {
4464
- var self = this;
4465
- var data;
4466
- var filter = this.markerFilter.getFilteringParameters();
4467
-
4468
- if(WPGMZA.is_admin == "1")
4469
- {
4470
- filter.includeUnapproved = true;
4471
- filter.excludeIntegrated = true;
4472
- }
4473
-
4474
- if(this.shortcodeAttributes.acf_post_id)
4475
- filter.acfPostID = this.shortcodeAttributes.acf_post_id;
4476
-
4477
- this.showPreloader(true);
4478
-
4479
- if(this.fetchFeaturesXhr)
4480
- this.fetchFeaturesXhr.abort();
4481
-
4482
- if(!WPGMZA.settings.fetchMarkersBatchSize)
4483
- {
4484
- data = this.getRESTParameters({
4485
- filter: JSON.stringify(filter)
4486
- });
4487
-
4488
- this.fetchFeaturesXhr = WPGMZA.restAPI.call("/features/", {
4489
-
4490
- useCompressedPathVariable: true,
4491
- data: data,
4492
- success: function(result, status, xhr) {
4493
- self.onFeaturesFetched(result);
4494
- }
4495
-
4496
- });
4497
- }
4498
- else
4499
- {
4500
- var offset = 0;
4501
- var limit = WPGMZA.settings.fetchMarkersBatchSize;
4502
-
4503
- function fetchNextBatch()
4504
- {
4505
- filter.offset = offset;
4506
- filter.limit = limit;
4507
-
4508
- data = this.getRESTParameters({
4509
- filter: JSON.stringify(filter)
4510
- });
4511
-
4512
- self.fetchFeaturesXhr = WPGMZA.restAPI.call("/markers/", {
4513
-
4514
- useCompressedPathVariable: true,
4515
- data: data,
4516
- success: function(result, status, xhr) {
4517
-
4518
- if(result.length)
4519
- {
4520
- self.onMarkersFetched(result, true); // Expect more batches
4521
-
4522
- offset += limit;
4523
- fetchNextBatch();
4524
- }
4525
- else
4526
- {
4527
- self.onMarkersFetched(result); // Final batch
4528
-
4529
- data.exclude = "markers";
4530
-
4531
- WPGMZA.restAPI.call("/features/", {
4532
-
4533
- useCompressedPathVariable: true,
4534
- data: data,
4535
- success: function(result, status, xhr) {
4536
- self.onFeaturesFetched(result);
4537
- }
4538
-
4539
- });
4540
- }
4541
-
4542
- }
4543
-
4544
- });
4545
- }
4546
-
4547
- fetchNextBatch();
4548
- }
4549
- }
4550
-
4551
- WPGMZA.Map.prototype.fetchFeaturesViaXML = function()
4552
- {
4553
- var self = this;
4554
-
4555
- var urls = [
4556
- WPGMZA.markerXMLPathURL + this.id + "markers.xml"
4557
- ];
4558
-
4559
- if(this.mashupIDs)
4560
- this.mashupIDs.forEach(function(id) {
4561
- urls.push(WPGMZA.markerXMLPathURL + id + "markers.xml")
4562
- });
4563
-
4564
- var unique = urls.filter(function(item, index) {
4565
- return urls.indexOf(item) == index;
4566
- });
4567
-
4568
- urls = unique;
4569
-
4570
- function fetchFeaturesExcludingMarkersViaREST()
4571
- {
4572
- var filter = {
4573
- map_id: this.id,
4574
- mashup_ids: this.mashupIDs
4575
- };
4576
-
4577
- var data = {
4578
- filter: JSON.stringify(filter),
4579
- exclude: "markers"
4580
- };
4581
-
4582
- WPGMZA.restAPI.call("/features/", {
4583
-
4584
- useCompressedPathVariable: true,
4585
- data: data,
4586
- success: function(result, status, xhr) {
4587
- self.onFeaturesFetched(result);
4588
- }
4589
-
4590
- });
4591
- }
4592
-
4593
- if(window.Worker && window.Blob && window.URL && WPGMZA.settings.enable_asynchronous_xml_parsing)
4594
- {
4595
- var source = WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/, "$1");
4596
- var blob = new Blob([source], {type: "text/javascript"});
4597
- var worker = new Worker(URL.createObjectURL(blob));
4598
-
4599
- worker.onmessage = function(event) {
4600
- self.onMarkersFetched(event.data);
4601
-
4602
- fetchFeaturesExcludingMarkersViaREST();
4603
- };
4604
-
4605
- worker.postMessage({
4606
- command: "load",
4607
- protocol: window.location.protocol,
4608
- urls: urls
4609
- });
4610
- }
4611
- else
4612
- {
4613
- var filesLoaded = 0;
4614
- var converter = new WPGMZA.XMLCacheConverter();
4615
- var converted = [];
4616
-
4617
- for(var i = 0; i < urls.length; i++)
4618
- {
4619
- $.ajax(urls[i], {
4620
- success: function(response, status, xhr) {
4621
- converted = converted.concat( converter.convert(response) );
4622
-
4623
- if(++filesLoaded == urls.length)
4624
- {
4625
- self.onMarkersFetched(converted);
4626
-
4627
- fetchFeaturesExcludingMarkersViaREST();
4628
- }
4629
- }
4630
- });
4631
- }
4632
- }
4633
- }
4634
-
4635
- WPGMZA.Map.prototype.fetchFeatures = function()
4636
- {
4637
- var self = this;
4638
-
4639
- if(WPGMZA.settings.wpgmza_settings_marker_pull != WPGMZA.MARKER_PULL_XML || WPGMZA.is_admin == "1")
4640
- {
4641
- this.fetchFeaturesViaREST();
4642
- }
4643
- else
4644
- {
4645
- this.fetchFeaturesViaXML();
4646
- }
4647
- }
4648
-
4649
- WPGMZA.Map.prototype.onFeaturesFetched = function(data)
4650
- {
4651
- if(data.markers)
4652
- this.onMarkersFetched(data.markers);
4653
-
4654
- for(var type in data)
4655
- {
4656
- if(type == "markers")
4657
- continue; // NB: Ignore markers for now - onMarkersFetched processes them
4658
-
4659
- var module = type.substr(0, 1).toUpperCase() + type.substr(1).replace(/s$/, "");
4660
-
4661
- for(var i = 0; i < data[type].length; i++)
4662
- {
4663
- var instance = WPGMZA[module].createInstance(data[type][i]);
4664
- var addFunctionName = "add" + module;
4665
-
4666
- this[addFunctionName](instance);
4667
- }
4668
- }
4669
- }
4670
-
4671
- WPGMZA.Map.prototype.onMarkersFetched = function(data, expectMoreBatches)
4672
  {
4673
- var self = this;
4674
- var startFiltered = (this.shortcodeAttributes.cat && this.shortcodeAttributes.cat.length)
4675
-
4676
- for(var i = 0; i < data.length; i++)
4677
- {
4678
- var obj = data[i];
4679
- var marker = WPGMZA.Marker.createInstance(obj);
4680
-
4681
- if(startFiltered)
4682
- {
4683
- marker.isFiltered = true;
4684
- marker.setVisible(false);
4685
- }
4686
-
4687
- this.addMarker(marker);
4688
- }
4689
 
4690
- if(expectMoreBatches)
4691
  return;
4692
 
4693
- this.showPreloader(false);
4694
-
4695
- var triggerEvent = function()
4696
- {
4697
- self._markersPlaced = true;
4698
- self.trigger("markersplaced");
4699
- self.off("filteringcomplete", triggerEvent);
4700
- }
4701
-
4702
- if(this.shortcodeAttributes.cat)
4703
  {
4704
- var categories = this.shortcodeAttributes.cat.split(",");
4705
-
4706
- // Set filtering controls
4707
- var select = $("select[mid='" + this.id + "'][name='wpgmza_filter_select']");
4708
 
4709
- for(var i = 0; i < categories.length; i++)
4710
  {
4711
- $("input[type='checkbox'][mid='" + this.id + "'][value='" + categories[i] + "']").prop("checked", true);
4712
- select.val(categories[i]);
4713
- }
4714
-
4715
- this.on("filteringcomplete", triggerEvent);
4716
-
4717
- // Force category ID's in case no filtering controls are present
4718
- this.markerFilter.update({
4719
- categories: categories
4720
- });
4721
- }
4722
- else
4723
- triggerEvent();
4724
-
4725
- //Check to see if they have added markers in the shortcode
4726
- if(this.shortcodeAttributes.markers)
4727
- {
4728
- //remove all , from the shortcode to find ID's
4729
- var arr = this.shortcodeAttributes.markers.split(",");
4730
-
4731
- //Store all the markers ID's
4732
- var markers = [];
4733
-
4734
- //loop through the shortcode
4735
- for (var i = 0; i < arr.length; i++) {
4736
- var id = arr[i];
4737
- id = id.replace(' ', '');
4738
- var marker = this.getMarkerByID(id);
4739
-
4740
- //push the marker infromation to markers
4741
- markers.push(marker);
4742
- }
4743
-
4744
- //call fitMapBoundsToMarkers function on markers ID's in shortcode
4745
- this.fitMapBoundsToMarkers(markers);
4746
- }
4747
- }
4748
-
4749
- WPGMZA.Map.prototype.fetchFeaturesViaXML = function()
4750
- {
4751
- var self = this;
4752
-
4753
- var urls = [
4754
- WPGMZA.markerXMLPathURL + this.id + "markers.xml"
4755
- ];
4756
-
4757
- if(this.mashupIDs)
4758
- this.mashupIDs.forEach(function(id) {
4759
- urls.push(WPGMZA.markerXMLPathURL + id + "markers.xml")
4760
- });
4761
-
4762
- var unique = urls.filter(function(item, index) {
4763
- return urls.indexOf(item) == index;
4764
- });
4765
-
4766
- urls = unique;
4767
-
4768
- function fetchFeaturesExcludingMarkersViaREST()
4769
- {
4770
- var filter = {
4771
- map_id: this.id,
4772
- mashup_ids: this.mashupIDs
4773
- };
4774
-
4775
- var data = {
4776
- filter: JSON.stringify(filter),
4777
- exclude: "markers"
4778
- };
4779
-
4780
- WPGMZA.restAPI.call("/features/", {
4781
-
4782
- useCompressedPathVariable: true,
4783
- data: data,
4784
- success: function(result, status, xhr) {
4785
- self.onFeaturesFetched(result);
4786
- }
4787
-
4788
- });
4789
- }
4790
-
4791
- if(window.Worker && window.Blob && window.URL && WPGMZA.settings.enable_asynchronous_xml_parsing)
4792
- {
4793
- var source = WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/, "$1");
4794
- var blob = new Blob([source], {type: "text/javascript"});
4795
- var worker = new Worker(URL.createObjectURL(blob));
4796
-
4797
- worker.onmessage = function(event) {
4798
- self.onMarkersFetched(event.data);
4799
 
4800
- fetchFeaturesExcludingMarkersViaREST();
4801
- };
4802
-
4803
- worker.postMessage({
4804
- command: "load",
4805
- protocol: window.location.protocol,
4806
- urls: urls
4807
- });
4808
- }
4809
- else
4810
- {
4811
- var filesLoaded = 0;
4812
- var converter = new WPGMZA.XMLCacheConverter();
4813
- var converted = [];
4814
-
4815
- for(var i = 0; i < urls.length; i++)
4816
- {
4817
- $.ajax(urls[i], {
4818
- success: function(response, status, xhr) {
4819
- converted = converted.concat( converter.convert(response) );
4820
-
4821
- if(++filesLoaded == urls.length)
4822
- {
4823
- self.onMarkersFetched(converted);
4824
-
4825
- fetchFeaturesExcludingMarkersViaREST();
4826
- }
4827
- }
4828
- });
4829
- }
4830
- }
4831
- }
4832
-
4833
- WPGMZA.Map.prototype.fetchFeatures = function()
4834
- {
4835
- var self = this;
4836
-
4837
- if(WPGMZA.settings.wpgmza_settings_marker_pull != WPGMZA.MARKER_PULL_XML || WPGMZA.is_admin == "1")
4838
- {
4839
- this.fetchFeaturesViaREST();
4840
- }
4841
- else
4842
- {
4843
- this.fetchFeaturesViaXML();
4844
- }
4845
- }
4846
-
4847
- WPGMZA.Map.prototype.onFeaturesFetched = function(data)
4848
- {
4849
- if(data.markers)
4850
- this.onMarkersFetched(data.markers);
4851
-
4852
- for(var type in data)
4853
- {
4854
- if(type == "markers")
4855
- continue; // NB: Ignore markers for now - onMarkersFetched processes them
4856
-
4857
- var module = type.substr(0, 1).toUpperCase() + type.substr(1).replace(/s$/, "");
4858
-
4859
- for(var i = 0; i < data[type].length; i++)
4860
- {
4861
- var instance = WPGMZA[module].createInstance(data[type][i]);
4862
- var addFunctionName = "add" + module;
4863
 
4864
- this[addFunctionName](instance);
4865
- }
4866
- }
4867
- }
4868
-
4869
- WPGMZA.Map.prototype.onMarkersFetched = function(data, expectMoreBatches)
4870
- {
4871
- var self = this;
4872
- var startFiltered = (this.shortcodeAttributes.cat && this.shortcodeAttributes.cat.length)
4873
-
4874
- for(var i = 0; i < data.length; i++)
4875
- {
4876
- var obj = data[i];
4877
- var marker = WPGMZA.Marker.createInstance(obj);
4878
-
4879
- if(startFiltered)
4880
- {
4881
- marker.isFiltered = true;
4882
- marker.setVisible(false);
4883
- }
4884
-
4885
- this.addMarker(marker);
4886
- }
4887
-
4888
- if(expectMoreBatches)
4889
- return;
4890
-
4891
- this.showPreloader(false);
4892
-
4893
- var triggerEvent = function()
4894
- {
4895
- self._markersPlaced = true;
4896
- self.trigger("markersplaced");
4897
- self.off("filteringcomplete", triggerEvent);
4898
- }
4899
-
4900
- if(this.shortcodeAttributes.cat)
4901
- {
4902
- var categories = this.shortcodeAttributes.cat.split(",");
4903
-
4904
- // Set filtering controls
4905
- var select = $("select[mid='" + this.id + "'][name='wpgmza_filter_select']");
4906
-
4907
- for(var i = 0; i < categories.length; i++)
4908
- {
4909
- $("input[type='checkbox'][mid='" + this.id + "'][value='" + categories[i] + "']").prop("checked", true);
4910
- select.val(categories[i]);
4911
  }
4912
 
4913
- this.on("filteringcomplete", triggerEvent);
 
4914
 
4915
- // Force category ID's in case no filtering controls are present
4916
- this.markerFilter.update({
4917
- categories: categories
4918
- });
4919
  }
4920
  else
4921
- triggerEvent();
4922
-
4923
- //Check to see if they have added markers in the shortcode
4924
- if(this.shortcodeAttributes.markers)
4925
- {
4926
- //remove all , from the shortcode to find ID's
4927
- var arr = this.shortcodeAttributes.markers.split(",");
4928
-
4929
- //Store all the markers ID's
4930
- var markers = [];
4931
-
4932
- //loop through the shortcode
4933
- for (var i = 0; i < arr.length; i++) {
4934
- var id = arr[i];
4935
- id = id.replace(' ', '');
4936
- var marker = this.getMarkerByID(id);
4937
-
4938
- //push the marker infromation to markers
4939
- markers.push(marker);
4940
- }
4941
-
4942
- //call fitMapBoundsToMarkers function on markers ID's in shortcode
4943
- this.fitMapBoundsToMarkers(markers);
4944
  }
4945
  }
4946
 
4947
  /**
4948
- * Gets the distance between two latLngs in kilometers
4949
- * NB: Static function
4950
- * @return number
4951
  */
4952
- var earthRadiusMeters = 6371;
4953
- var piTimes360 = Math.PI / 360;
4954
-
4955
- function deg2rad(deg) {
4956
- return deg * (Math.PI/180)
4957
- };
4958
 
4959
  /**
4960
- * This gets the distance in kilometers between two latitude / longitude points
4961
- * TODO: Move this to the distance class, or the LatLng class
4962
  * @method
4963
- * @memberof WPGMZA.Map
4964
- * @param {number} lat1 Latitude from the first coordinate pair
4965
- * @param {number} lon1 Longitude from the first coordinate pair
4966
- * @param {number} lat2 Latitude from the second coordinate pair
4967
- * @param {number} lon1 Longitude from the second coordinate pair
4968
- * @return {number} The distance between the latitude and longitudes, in kilometers
4969
  */
4970
- WPGMZA.Map.getGeographicDistance = function(lat1, lon1, lat2, lon2)
4971
  {
4972
- var dLat = deg2rad(lat2-lat1);
4973
- var dLon = deg2rad(lon2-lon1);
4974
 
4975
- var a =
4976
- Math.sin(dLat/2) * Math.sin(dLat/2) +
4977
- Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
4978
- Math.sin(dLon/2) * Math.sin(dLon/2);
4979
-
4980
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
4981
- var d = earthRadiusMeters * c; // Distance in km
4982
 
4983
- return d;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4984
  }
4985
 
4986
  /**
4987
- * Centers the map on the supplied latitude and longitude
4988
  * @method
4989
- * @memberof WPGMZA.Map
4990
- * @param {object|WPGMZA.LatLng} latLng A LatLng literal or an instance of WPGMZA.LatLng
4991
  */
4992
- WPGMZA.Map.prototype.setCenter = function(latLng)
4993
  {
4994
- if(!("lat" in latLng && "lng" in latLng))
4995
- throw new Error("Argument is not an object with lat and lng");
4996
  }
4997
 
4998
  /**
4999
- * Sets the dimensions of the map engine element
 
5000
  * @method
5001
- * @memberof WPGMZA.Map
5002
- * @param {number} width Width as a CSS string
5003
- * @param {number} height Height as a CSS string
 
5004
  */
5005
- WPGMZA.Map.prototype.setDimensions = function(width, height)
5006
  {
5007
- if(arguments.length == 0)
5008
- {
5009
- if(this.settings.map_width)
5010
- width = this.settings.map_width;
5011
- else
5012
- width = "100";
 
5013
 
5014
- if(this.settings.map_width_type)
5015
- width += this.settings.map_width_type.replace("\\", "");
5016
- else
5017
- width += "%";
5018
 
5019
- if(this.settings.map_height)
5020
- height = this.settings.map_height;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5021
  else
5022
- height = "400";
5023
 
5024
- if(this.settings.map_height_type)
5025
- height += this.settings.map_height_type.replace("\\", "");
5026
- else
5027
- height += "px";
5028
- }
5029
-
5030
- $(this.engineElement).css({
5031
- width: width,
5032
- height: height
5033
  });
5034
  }
5035
 
5036
- WPGMZA.Map.prototype.setAlignment = function()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5037
  {
5038
- switch(parseInt(this.settings.wpgmza_map_align))
5039
- {
5040
- case 1:
5041
- $(this.element).css({"float": "left"});
5042
- break;
5043
-
5044
- case 2:
5045
- $(this.element).css({
5046
- "margin-left": "auto",
5047
- "margin-right": "auto"
5048
- });
5049
- break;
5050
 
5051
- case 3:
5052
- $(this.element).css({"float": "right"});
5053
- break;
5054
 
5055
- default:
5056
- break;
5057
- }
 
 
 
 
 
5058
  }
5059
 
5060
  /**
5061
- * Adds the specified marker to this map
5062
  * @method
5063
- * @memberof WPGMZA.Map
5064
- * @param {WPGMZA.Marker} marker The marker to add
5065
- * @fires markeradded
5066
- * @fires WPGMZA.Marker#added
5067
- * @throws Argument must be an instance of WPGMZA.Marker
5068
  */
5069
- WPGMZA.Map.prototype.addMarker = function(marker)
5070
  {
5071
- if(!(marker instanceof WPGMZA.Marker))
5072
- throw new Error("Argument must be an instance of WPGMZA.Marker");
5073
-
5074
- marker.map = this;
5075
- marker.parent = this;
5076
-
5077
- this.markers.push(marker);
5078
- this.dispatchEvent({type: "markeradded", marker: marker});
5079
- marker.dispatchEvent({type: "added"});
 
 
 
5080
  }
5081
 
5082
  /**
5083
- * Removes the specified marker from this map
5084
  * @method
5085
- * @memberof WPGMZA.Map
5086
- * @param {WPGMZA.Marker} marker The marker to remove
5087
- * @fires markerremoved
5088
- * @fires WPGMZA.Marker#removed
5089
- * @throws Argument must be an instance of WPGMZA.Marker
5090
- * @throws Wrong map error
5091
  */
5092
- WPGMZA.Map.prototype.removeMarker = function(marker)
5093
  {
5094
- if(!(marker instanceof WPGMZA.Marker))
5095
- throw new Error("Argument must be an instance of WPGMZA.Marker");
5096
-
5097
- if(marker.map !== this)
5098
- throw new Error("Wrong map error");
5099
-
5100
- if(marker.infoWindow)
5101
- marker.infoWindow.close();
5102
 
5103
- marker.map = null;
5104
- marker.parent = null;
5105
 
5106
- var index = this.markers.indexOf(marker);
 
5107
 
5108
- if(index == -1)
5109
- throw new Error("Marker not found in marker array");
 
5110
 
5111
- this.markers.splice(index, 1);
 
 
 
 
5112
 
5113
- this.dispatchEvent({type: "markerremoved", marker: marker});
5114
- marker.dispatchEvent({type: "removed"});
5115
- }
5116
-
5117
- WPGMZA.Map.prototype.removeAllMarkers = function(options)
5118
- {
5119
- for(var i = this.markers.length - 1; i >= 0; i--)
5120
- this.removeMarker(this.markers[i]);
5121
  }
5122
 
5123
  /**
5124
- * Gets a marker by ID
5125
- * @method
5126
- * @memberof WPGMZA.Map
5127
- * @param {int} id The ID of the marker to get
5128
- * @return {WPGMZA.Marker|null} The marker, or null if no marker with the specified ID is found
5129
  */
5130
- WPGMZA.Map.prototype.getMarkerByID = function(id)
5131
  {
5132
- for(var i = 0; i < this.markers.length; i++)
5133
- {
5134
- if(this.markers[i].id == id)
5135
- return this.markers[i];
5136
- }
5137
 
5138
- return null;
5139
- }
5140
-
5141
- WPGMZA.Map.prototype.getMarkerByTitle = function(title)
5142
- {
5143
- if(typeof title == "string")
5144
- for(var i = 0; i < this.markers.length; i++)
5145
- {
5146
- if(this.markers[i].title == title)
5147
- return this.markers[i];
5148
- }
5149
- else if(title instanceof RegExp)
5150
- for(var i = 0; i < this.markers.length; i++)
5151
- {
5152
- if(title.test(this.markers[i].title))
5153
- return this.markers[i];
5154
- }
5155
  else
5156
- throw new Error("Invalid argument");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5157
 
5158
- return null;
5159
  }
5160
 
 
 
 
 
 
 
 
 
 
 
5161
  /**
5162
- * Removes a marker by ID
5163
- * @method
5164
- * @memberof WPGMZA.Map
5165
- * @param {int} id The ID of the marker to remove
5166
- * @fires markerremoved
5167
- * @fires WPGMZA.Marker#removed
5168
  */
5169
- WPGMZA.Map.prototype.removeMarkerByID = function(id)
5170
  {
5171
- var marker = this.getMarkerByID(id);
5172
-
5173
- if(!marker)
5174
- return;
5175
 
5176
- this.removeMarker(marker);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5177
  }
5178
 
5179
- /**
5180
- * Adds the specified polygon to this map
5181
- * @method
5182
- * @memberof WPGMZA.Map
5183
- * @param {WPGMZA.Polygon} polygon The polygon to add
5184
- * @fires polygonadded
5185
- * @throws Argument must be an instance of WPGMZA.Polygon
5186
- */
5187
- WPGMZA.Map.prototype.addPolygon = function(polygon)
5188
  {
5189
- if(!(polygon instanceof WPGMZA.Polygon))
5190
- throw new Error("Argument must be an instance of WPGMZA.Polygon");
 
 
 
 
5191
 
5192
- polygon.map = this;
 
 
 
5193
 
5194
- this.polygons.push(polygon);
5195
- this.dispatchEvent({type: "polygonadded", polygon: polygon});
5196
  }
5197
 
5198
- /**
5199
- * Removes the specified polygon from this map
5200
- * @method
5201
- * @memberof WPGMZA.Map
5202
- * @param {WPGMZA.Polygon} polygon The polygon to remove
5203
- * @fires polygonremoved
5204
- * @throws Argument must be an instance of WPGMZA.Polygon
5205
- * @throws Wrong map error
5206
- */
5207
- WPGMZA.Map.prototype.removePolygon = function(polygon)
5208
  {
5209
- if(!(polygon instanceof WPGMZA.Polygon))
5210
- throw new Error("Argument must be an instance of WPGMZA.Polygon");
5211
 
5212
- if(polygon.map !== this)
5213
- throw new Error("Wrong map error");
5214
 
5215
- polygon.map = null;
 
 
 
5216
 
5217
- this.polygons.splice(this.polygons.indexOf(polygon), 1);
5218
- this.dispatchEvent({type: "polygonremoved", polygon: polygon});
5219
  }
5220
 
5221
  /**
5222
- * Gets a polygon by ID
5223
  * @method
5224
- * @memberof WPGMZA.Map
5225
- * @param {int} id The ID of the polygon to get
5226
- * @return {WPGMZA.Polygon|null} The polygon, or null if no polygon with the specified ID is found
5227
  */
5228
- WPGMZA.Map.prototype.getPolygonByID = function(id)
5229
  {
5230
- for(var i = 0; i < this.polygons.length; i++)
5231
- {
5232
- if(this.polygons[i].id == id)
5233
- return this.polygons[i];
5234
- }
5235
-
5236
- return null;
5237
  }
5238
 
5239
  /**
5240
- * Removes a polygon by ID
5241
  * @method
5242
- * @memberof WPGMZA.Map
5243
- * @param {int} id The ID of the polygon to remove
5244
  */
5245
- WPGMZA.Map.prototype.removePolygonByID = function(id)
5246
  {
5247
- var polygon = this.getPolygonByID(id);
 
5248
 
5249
- if(!polygon)
5250
- return;
5251
 
5252
- this.removePolygon(polygon);
5253
- }
5254
-
5255
- /**
5256
- * Gets a polyline by ID
5257
- * @return void
5258
- */
5259
- WPGMZA.Map.prototype.getPolylineByID = function(id)
5260
- {
5261
- for(var i = 0; i < this.polylines.length; i++)
5262
  {
5263
- if(this.polylines[i].id == id)
5264
- return this.polylines[i];
 
5265
  }
5266
 
5267
- return null;
5268
- }
5269
-
5270
- /**
5271
- * Adds the specified polyline to this map
5272
- * @method
5273
- * @memberof WPGMZA.Map
5274
- * @param {WPGMZA.Polyline} polyline The polyline to add
5275
- * @fires polylineadded
5276
- * @throws Argument must be an instance of WPGMZA.Polyline
5277
- */
5278
- WPGMZA.Map.prototype.addPolyline = function(polyline)
5279
- {
5280
- if(!(polyline instanceof WPGMZA.Polyline))
5281
- throw new Error("Argument must be an instance of WPGMZA.Polyline");
5282
 
5283
- polyline.map = this;
 
5284
 
5285
- this.polylines.push(polyline);
5286
- this.dispatchEvent({type: "polylineadded", polyline: polyline});
5287
  }
5288
 
5289
- /**
5290
- * Removes the specified polyline from this map
5291
- * @method
5292
- * @memberof WPGMZA.Map
5293
- * @param {WPGMZA.Polyline} polyline The polyline to remove
5294
- * @fires polylineremoved
5295
- * @throws Argument must be an instance of WPGMZA.Polyline
5296
- * @throws Wrong map error
5297
- */
5298
- WPGMZA.Map.prototype.removePolyline = function(polyline)
5299
  {
5300
- if(!(polyline instanceof WPGMZA.Polyline))
5301
- throw new Error("Argument must be an instance of WPGMZA.Polyline");
5302
 
5303
- if(polyline.map !== this)
5304
- throw new Error("Wrong map error");
5305
 
5306
- polyline.map = null;
 
5307
 
5308
- this.polylines.splice(this.polylines.indexOf(polyline), 1);
5309
- this.dispatchEvent({type: "polylineremoved", polyline: polyline});
5310
- }
5311
-
5312
- /**
5313
- * Gets a polyline by ID
5314
- * @method
5315
- * @memberof WPGMZA.Map
5316
- * @param {int} id The ID of the polyline to get
5317
- * @return {WPGMZA.Polyline|null} The polyline, or null if no polyline with the specified ID is found
5318
- */
5319
- WPGMZA.Map.prototype.getPolylineByID = function(id)
5320
- {
5321
- for(var i = 0; i < this.polylines.length; i++)
5322
- {
5323
- if(this.polylines[i].id == id)
5324
- return this.polylines[i];
5325
- }
5326
 
5327
- return null;
5328
- }
5329
-
5330
- /**
5331
- * Removes a polyline by ID
5332
- * @method
5333
- * @memberof WPGMZA.Map
5334
- * @param {int} id The ID of the polyline to remove
5335
- */
5336
- WPGMZA.Map.prototype.removePolylineByID = function(id)
5337
- {
5338
- var polyline = this.getPolylineByID(id);
5339
 
5340
- if(!polyline)
5341
- return;
5342
 
5343
- this.removePolyline(polyline);
5344
- }
5345
-
5346
- /**
5347
- * Adds the specified circle to this map
5348
- * @method
5349
- * @memberof WPGMZA.Map
5350
- * @param {WPGMZA.Circle} circle The circle to add
5351
- * @fires polygonadded
5352
- * @throws Argument must be an instance of WPGMZA.Circle
5353
- */
5354
- WPGMZA.Map.prototype.addCircle = function(circle)
5355
- {
5356
- if(!(circle instanceof WPGMZA.Circle))
5357
- throw new Error("Argument must be an instance of WPGMZA.Circle");
5358
 
5359
- circle.map = this;
 
5360
 
5361
- this.circles.push(circle);
5362
- this.dispatchEvent({type: "circleadded", circle: circle});
5363
- }
5364
-
5365
- /**
5366
- * Removes the specified circle from this map
5367
- * @method
5368
- * @memberof WPGMZA.Map
5369
- * @param {WPGMZA.Circle} circle The circle to remove
5370
- * @fires circleremoved
5371
- * @throws Argument must be an instance of WPGMZA.Circle
5372
- * @throws Wrong map error
5373
- */
5374
- WPGMZA.Map.prototype.removeCircle = function(circle)
5375
- {
5376
- if(!(circle instanceof WPGMZA.Circle))
5377
- throw new Error("Argument must be an instance of WPGMZA.Circle");
5378
 
5379
- if(circle.map !== this)
5380
- throw new Error("Wrong map error");
5381
 
5382
- circle.map = null;
 
 
 
5383
 
5384
- this.circles.splice(this.circles.indexOf(circle), 1);
5385
- this.dispatchEvent({type: "circleremoved", circle: circle});
5386
  }
5387
 
5388
- /**
5389
- * Gets a circle by ID
5390
- * @method
5391
- * @memberof WPGMZA.Map
5392
- * @param {int} id The ID of the circle to get
5393
- * @return {WPGMZA.Circle|null} The circle, or null if no circle with the specified ID is found
5394
- */
5395
- WPGMZA.Map.prototype.getCircleByID = function(id)
5396
  {
5397
- for(var i = 0; i < this.circles.length; i++)
5398
- {
5399
- if(this.circles[i].id == id)
5400
- return this.circles[i];
5401
- }
5402
 
5403
- return null;
5404
- }
5405
-
5406
- /**
5407
- * Removes a circle by ID
5408
- * @method
5409
- * @memberof WPGMZA.Map
5410
- * @param {int} id The ID of the circle to remove
5411
- */
5412
- WPGMZA.Map.prototype.removeCircleByID = function(id)
5413
- {
5414
- var circle = this.getCircleByID(id);
5415
 
5416
- if(!circle)
5417
- return;
5418
 
5419
- this.removeCircle(circle);
5420
- }
5421
-
5422
- WPGMZA.Map.prototype.addRectangle = function(rectangle)
5423
- {
5424
- if(!(rectangle instanceof WPGMZA.Rectangle))
5425
- throw new Error("Argument must be an instance of WPGMZA.Rectangle");
5426
 
5427
- rectangle.map = this;
 
5428
 
5429
- this.rectangles.push(rectangle);
5430
- this.dispatchEvent({type: "rectangleadded", rectangle: rectangle});
5431
  }
5432
 
5433
- WPGMZA.Map.prototype.removeRectangle = function(rectangle)
5434
  {
5435
- if(!(rectangle instanceof WPGMZA.Rectangle))
5436
- throw new Error("Argument must be an instance of WPGMZA.Rectangle");
5437
-
5438
- if(rectangle.map !== this)
5439
- throw new Error("Wrong map error");
5440
-
5441
- rectangle.map = null;
5442
-
5443
- this.rectangles.splice(this.rectangles.indexOf(rectangle), 1);
5444
- this.dispatchEvent({type: "rectangleremoved", rectangle: rectangle});
5445
  }
5446
 
5447
- WPGMZA.Map.prototype.getRectangleByID = function(id)
5448
  {
5449
- for(var i = 0; i < this.rectangles.length; i++)
5450
- {
5451
- if(this.rectangles[i].id == id)
5452
- return this.rectangles[i];
5453
- }
5454
-
5455
- return null;
5456
  }
5457
 
5458
- WPGMZA.Map.prototype.removeRectangleByID = function(id)
5459
- {
5460
- var rectangle = this.getRectangleByID(id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5461
 
5462
- if(!rectangle)
5463
- return;
 
 
 
 
5464
 
5465
- this.removeRectangle(rectangle);
5466
- }
5467
 
5468
- /**
5469
- * Resets the map latitude, longitude and zoom to their starting values in the map settings.
5470
- * @method
5471
- * @memberof WPGMZA.Map
5472
- */
5473
- WPGMZA.Map.prototype.resetBounds = function()
5474
  {
5475
- var latlng = new WPGMZA.LatLng(this.settings.map_start_lat, this.settings.map_start_lng);
5476
- this.panTo(latlng);
5477
- this.setZoom(this.settings.map_start_zoom);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5478
  }
5479
 
5480
- /**
5481
- * Nudges the map viewport by the given pixel coordinates
5482
- * @method
5483
- * @memberof WPGMZA.Map
5484
- * @param {number} x Number of pixels to nudge along the x axis
5485
- * @param {number} y Number of pixels to nudge along the y axis
5486
- * @throws Invalid coordinates supplied
5487
- */
5488
- WPGMZA.Map.prototype.nudge = function(x, y)
5489
- {
5490
- var nudged = this.nudgeLatLng(this.getCenter(), x, y);
5491
-
5492
- this.setCenter(nudged);
5493
- }
5494
 
5495
- WPGMZA.Map.prototype.nudgeLatLng = function(latLng, x, y)
5496
- {
5497
- var pixels = this.latLngToPixels(latLng);
5498
-
5499
- pixels.x += parseFloat(x);
5500
- pixels.y += parseFloat(y);
5501
-
5502
- if(isNaN(pixels.x) || isNaN(pixels.y))
5503
- throw new Error("Invalid coordinates supplied");
5504
-
5505
- return this.pixelsToLatLng(pixels);
5506
  }
5507
-
5508
- WPGMZA.Map.prototype.animateNudge = function(x, y, origin, milliseconds)
5509
- {
5510
- var nudged;
5511
-
5512
- if(!origin)
5513
- origin = this.getCenter();
5514
- else if(!(origin instanceof WPGMZA.LatLng))
5515
- throw new Error("Origin must be an instance of WPGMZA.LatLng");
5516
 
5517
- nudged = this.nudgeLatLng(origin, x, y);
5518
 
5519
- if(!milliseconds)
5520
- milliseconds = WPGMZA.getScrollAnimationDuration();
5521
 
5522
- $(this).animate({
5523
- lat: nudged.lat,
5524
- lng: nudged.lng
5525
- }, milliseconds);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5526
  }
5527
 
5528
- /**
5529
- * Called when the window resizes
5530
- * @method
5531
- * @memberof WPGMZA.Map
5532
- */
5533
- WPGMZA.Map.prototype.onWindowResize = function(event)
5534
- {
5535
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5536
  }
5537
-
5538
- /**
5539
- * Called when the engine map div is resized
5540
- * @method
5541
- * @memberof WPGMZA.Map
5542
- */
5543
- WPGMZA.Map.prototype.onElementResized = function(event)
5544
- {
5545
 
5546
- }
5547
-
5548
- /**
5549
- * Called when the map viewport bounds change. Fires the legacy bounds_changed event.
5550
- * @method
5551
- * @memberof WPGMZA.Map
5552
- * @fires boundschanged
5553
- * @fires bounds_changed
5554
- */
5555
- WPGMZA.Map.prototype.onBoundsChanged = function(event)
5556
- {
5557
- // Native events
5558
- this.trigger("boundschanged");
5559
 
5560
- // Google / legacy compatibility events
5561
- this.trigger("bounds_changed");
5562
- }
5563
-
5564
- /**
5565
- * Called when the map viewport becomes idle (eg movement done, tiles loaded)
5566
- * @method
5567
- * @memberof WPGMZA.Map
5568
- * @fires idle
5569
- */
5570
- WPGMZA.Map.prototype.onIdle = function(event)
5571
- {
5572
- this.trigger("idle");
 
 
 
 
 
 
 
 
5573
  }
5574
 
5575
- WPGMZA.Map.prototype.onClick = function(event){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5576
 
 
 
5577
  }
5578
 
5579
- /**
5580
- * Find out if the map has visible markers. Only counts filterable markers (not the user location marker, store locator center point marker, etc.)
5581
- * @method
5582
- * @memberof WPGMZA.Map
5583
- * @returns {Boolean} True if at least one marker is visible
5584
- */
5585
- WPGMZA.Map.prototype.hasVisibleMarkers = function()
5586
- {
5587
- var length = this.markers.length, marker;
5588
 
5589
- for(var i = 0; i < length; i++)
5590
- {
5591
- marker = this.markers[i];
5592
-
5593
- if(marker.isFilterable && marker.getVisible())
5594
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5595
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5596
 
5597
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
5598
  }
5599
 
5600
- WPGMZA.Map.prototype.closeAllInfoWindows = function()
5601
  {
5602
- this.markers.forEach(function(marker) {
5603
-
5604
- if(marker.infoWindow)
5605
- marker.infoWindow.close();
5606
-
5607
- });
5608
  }
5609
 
5610
  $(document).ready(function(event) {
5611
 
5612
- if(!WPGMZA.visibilityWorkaroundIntervalID)
5613
- {
5614
- // This should handle all cases of tabs, accordions or any other offscreen maps
5615
- var invisibleMaps = jQuery(".wpgmza_map:hidden");
5616
-
5617
- WPGMZA.visibilityWorkaroundIntervalID = setInterval(function() {
5618
-
5619
- jQuery(invisibleMaps).each(function(index, el) {
5620
-
5621
- if(jQuery(el).is(":visible"))
5622
- {
5623
- var id = jQuery(el).attr("data-map-id");
5624
- var map = WPGMZA.getMapByID(id);
5625
-
5626
- map.onElementResized();
5627
-
5628
- invisibleMaps.splice(invisibleMaps.toArray().indexOf(el), 1);
5629
- }
5630
-
5631
- });
5632
-
5633
- }, 1000);
5634
- }
5635
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5636
  });
5637
 
5638
  // js/v8/maps-engine-dialog.js
@@ -7495,410 +7505,410 @@ jQuery(function($) {
7495
  }
7496
 
7497
  });
7498
-
7499
- Object.defineProperty(WPGMZA.Rectangle.prototype, "strokeColor", {
7500
-
7501
- enumerable: true,
7502
-
7503
- "get": function()
7504
- {
7505
- return "#000000";
7506
- }
7507
-
7508
- });
7509
-
7510
- Object.defineProperty(WPGMZA.Rectangle.prototype, "strokeOpacity", {
7511
-
7512
- enumerable: true,
7513
-
7514
- "get": function()
7515
- {
7516
- return 0;
7517
- }
7518
-
7519
- });
7520
-
7521
- WPGMZA.Rectangle.createInstance = function(options, engineRectangle)
7522
- {
7523
- var constructor;
7524
-
7525
- switch(WPGMZA.settings.engine)
7526
- {
7527
- case "open-layers":
7528
- constructor = WPGMZA.OLRectangle;
7529
- break;
7530
-
7531
- default:
7532
- constructor = WPGMZA.GoogleRectangle;
7533
- break;
7534
- }
7535
-
7536
- return new constructor(options, engineRectangle);
7537
- }
7538
-
7539
- });
7540
-
7541
- // js/v8/rest-api.js
7542
- /**
7543
- * @namespace WPGMZA
7544
- * @module WPGMZA.RestAPI
7545
- * @requires WPGMZA
7546
- */
7547
- jQuery(function($) {
7548
-
7549
- /**
7550
- * Used to interact with the WordPress REST API. <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.
7551
- * @class WPGMZA.RestAPI
7552
- * @constructor WPGMZA.RestAPI
7553
- * @memberof WPGMZA
7554
- */
7555
- WPGMZA.RestAPI = function()
7556
- {
7557
- WPGMZA.RestAPI.URL = WPGMZA.resturl;
7558
-
7559
- this.useAJAXFallback = false;
7560
- }
7561
-
7562
- WPGMZA.RestAPI.CONTEXT_REST = "REST";
7563
- WPGMZA.RestAPI.CONTEXT_AJAX = "AJAX";
7564
-
7565
- /**
7566
- * Creates an instance of a RestAPI, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
7567
- * @method
7568
- * @memberof WPGMZA.RestAPI
7569
- */
7570
- WPGMZA.RestAPI.createInstance = function()
7571
- {
7572
- return new WPGMZA.RestAPI();
7573
- }
7574
-
7575
- Object.defineProperty(WPGMZA.RestAPI.prototype, "isCompressedPathVariableSupported", {
7576
-
7577
- get: function()
7578
- {
7579
- return WPGMZA.serverCanInflate && "Uint8Array" in window && "TextEncoder" in window;
7580
- }
7581
-
7582
- });
7583
-
7584
- Object.defineProperty(WPGMZA.RestAPI.prototype, "isCompressedPathVariableAllowed", {
7585
-
7586
- get: function()
7587
- {
7588
- // NB: Pro 7 still has a "disable" setting. So use that if Pro 7 is installed.
7589
- if(!WPGMZA.pro_version || WPGMZA.Version.compare(WPGMZA.pro_version, "8.0.0") >= WPGMZA.Version.EQUAL_TO)
7590
- return !WPGMZA.settings.disable_compressed_path_variables;
7591
-
7592
- // Running Pro 7 or below
7593
- return WPGMZA.settings.enable_compressed_path_variables;
7594
- }
7595
-
7596
- });
7597
-
7598
- Object.defineProperty(WPGMZA.RestAPI.prototype, "maxURLLength", {
7599
-
7600
- get: function()
7601
- {
7602
- return 2083;
7603
- }
7604
-
7605
- });
7606
-
7607
- WPGMZA.RestAPI.prototype.compressParams = function(params)
7608
- {
7609
- var suffix = "";
7610
-
7611
- if(params.markerIDs)
7612
- {
7613
- var markerIDs = params.markerIDs.split(",");
7614
-
7615
- if(markerIDs.length > 1)
7616
- {
7617
- // NB: Only use Elias Fano encoding if more than one marker is present. The server side decoder does not correctly decode a single digit.
7618
- var encoder = new WPGMZA.EliasFano();
7619
- var encoded = encoder.encode(markerIDs);
7620
- var compressed = pako.deflate(encoded);
7621
- var string = Array.prototype.map.call(compressed, function(ch) {
7622
- return String.fromCharCode(ch);
7623
- }).join("");
7624
-
7625
- // NB: Append as another path component, this stops the code below performing base64 encoding twice and enlarging the request
7626
- suffix = "/" + btoa(string).replace(/\//g, "-").replace(/=+$/, "");
7627
-
7628
- // NB: midcbp = Marker ID compressed buffer pointer, abbreviated to save space
7629
- params.midcbp = encoded.pointer;
7630
-
7631
- delete params.markerIDs;
7632
- }
7633
- }
7634
-
7635
- var string = JSON.stringify(params);
7636
- var encoder = new TextEncoder();
7637
- var input = encoder.encode(string);
7638
- var compressed = pako.deflate(input);
7639
- var raw = Array.prototype.map.call(compressed, function(ch) {
7640
- return String.fromCharCode(ch);
7641
- }).join("");
7642
-
7643
- var base64 = btoa(raw);
7644
- return base64.replace(/\//g, "-").replace(/=+$/, "") + suffix;
7645
- }
7646
-
7647
- function sendAJAXFallbackRequest(route, params)
7648
- {
7649
- var params = $.extend({}, params);
7650
-
7651
- if(!params.data)
7652
- params.data = {};
7653
-
7654
- if("route" in params.data)
7655
- throw new Error("Cannot send route through this method");
7656
-
7657
- if("action" in params.data)
7658
- throw new Error("Cannot send action through this method");
7659
-
7660
- params.data.route = route;
7661
- params.data.action = "wpgmza_rest_api_request";
7662
-
7663
- WPGMZA.restAPI.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_AJAX);
7664
-
7665
- return $.ajax(WPGMZA.ajaxurl, params);
7666
- }
7667
-
7668
- WPGMZA.RestAPI.prototype.getNonce = function(route)
7669
- {
7670
- var matches = [];
7671
-
7672
- for(var pattern in WPGMZA.restnoncetable)
7673
- {
7674
- var regex = new RegExp(pattern);
7675
-
7676
- if(route.match(regex))
7677
- matches.push({
7678
- pattern: pattern,
7679
- nonce: WPGMZA.restnoncetable[pattern],
7680
- length: pattern.length
7681
- });
7682
- }
7683
-
7684
- if(!matches.length)
7685
- throw new Error("No nonce found for route");
7686
-
7687
- matches.sort(function(a, b) {
7688
- return b.length - a.length;
7689
- });
7690
-
7691
- return matches[0].nonce;
7692
- }
7693
-
7694
- WPGMZA.RestAPI.prototype.addNonce = function(route, params, context)
7695
- {
7696
- var self = this;
7697
-
7698
- var setRESTNonce = function(xhr) {
7699
- if(context == WPGMZA.RestAPI.CONTEXT_REST && self.shouldAddNonce(route)){
7700
- xhr.setRequestHeader('X-WP-Nonce', WPGMZA.restnonce);
7701
- }
7702
-
7703
- if(params && params.method && !params.method.match(/^GET$/i)){
7704
- xhr.setRequestHeader('X-WPGMZA-Action-Nonce', self.getNonce(route));
7705
- }
7706
- };
7707
-
7708
- if(!params.beforeSend){
7709
- params.beforeSend = setRESTNonce;
7710
- } else {
7711
- var base = params.beforeSend;
7712
-
7713
- params.beforeSend = function(xhr) {
7714
- base(xhr);
7715
- setRESTNonce(xhr);
7716
- }
7717
- }
7718
- }
7719
-
7720
- WPGMZA.RestAPI.prototype.shouldAddNonce = function(route){
7721
- route = route.replace(/\//g, '');
7722
-
7723
- var isAdmin = false;
7724
- if(WPGMZA.is_admin){
7725
- if(parseInt(WPGMZA.is_admin) === 1){
7726
- isAdmin = true;
7727
- }
7728
- }
7729
-
7730
- var skipNonceRoutes = ['markers', 'features', 'marker-listing', 'datatables'];
7731
- if(route && skipNonceRoutes.includes(route) && !isAdmin){
7732
- return false;
7733
- }
7734
-
7735
- return true;
7736
- }
7737
-
7738
- /**
7739
- * Makes an AJAX to the REST API, this function is a wrapper for $.ajax
7740
- * @method
7741
- * @memberof WPGMZA.RestAPI
7742
- * @param {string} route The REST API route
7743
- * @param {object} params The request parameters, see http://api.jquery.com/jquery.ajax/
7744
- */
7745
- WPGMZA.RestAPI.prototype.call = function(route, params)
7746
- {
7747
- if(this.useAJAXFallback)
7748
- return sendAJAXFallbackRequest(route, params);
7749
 
7750
- var self = this;
7751
- var attemptedCompressedPathVariable = false;
7752
- var fallbackRoute = route;
7753
- var fallbackParams = $.extend({}, params);
7754
 
7755
- if(typeof route != "string" || (!route.match(/^\//) && !route.match(/^http/)))
7756
- throw new Error("Invalid route");
 
 
7757
 
7758
- if(WPGMZA.RestAPI.URL.match(/\/$/))
7759
- route = route.replace(/^\//, "");
 
7760
 
7761
- if(!params)
7762
- params = {};
7763
 
7764
- this.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_REST);
 
 
 
7765
 
7766
- if(!params.error)
7767
- params.error = function(xhr, status, message) {
7768
- if(status == "abort")
7769
- return; // Don't report abort, let it happen silently
7770
-
7771
- switch(xhr.status)
7772
- {
7773
- case 401:
7774
- case 403:
7775
- case 405:
7776
- // Report back to the server. This is usually due to a security plugin blocking REST requests for non-authenticated users
7777
- $.post(WPGMZA.ajaxurl, {
7778
- action: "wpgmza_report_rest_api_blocked"
7779
- }, function(response) {});
7780
-
7781
- console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users.");
7782
-
7783
- if(params.method === "DELETE"){
7784
- console.warn("The REST API rejected a DELETE request, attempting again with POST fallback");
7785
- params.method = "POST";
7786
-
7787
- if(!params.data){
7788
- params.data = {};
7789
- }
7790
-
7791
- params.data.simulateDelete = 'yes';
7792
-
7793
- return WPGMZA.restAPI.call(route, params);
7794
-
7795
- }
7796
-
7797
- this.useAJAXFallback = true;
7798
-
7799
- return sendAJAXFallbackRequest(fallbackRoute, fallbackParams);
7800
- break;
7801
-
7802
- case 414:
7803
- if(!attemptedCompressedPathVariable)
7804
- break;
7805
-
7806
- // Fallback for HTTP 414 - Request too long with compressed requests
7807
- fallbackParams.method = "POST";
7808
- fallbackParams.useCompressedPathVariable = false;
7809
-
7810
- return WPGMZA.restAPI.call(fallbackRoute, fallbackParams);
7811
-
7812
- break;
7813
- }
7814
-
7815
- throw new Error(message);
7816
- }
7817
 
7818
- if(params.useCompressedPathVariable &&
7819
- this.isCompressedPathVariableSupported &&
7820
- this.isCompressedPathVariableAllowed)
7821
  {
7822
- var compressedParams = $.extend({}, params);
7823
- var data = params.data;
7824
- var base64 = this.compressParams(data);
7825
-
7826
- if(WPGMZA.isServerIIS)
7827
- base64 = base64.replace(/\+/g, "%20");
7828
-
7829
- var compressedRoute = route.replace(/\/$/, "") + "/base64" + base64;
7830
- var fullCompressedRoute = WPGMZA.RestAPI.URL + compressedRoute;
7831
-
7832
- compressedParams.method = "GET";
7833
- delete compressedParams.data;
7834
-
7835
- if(params.cache === false)
7836
- compressedParams.data = {
7837
- skip_cache: 1
7838
- };
7839
 
7840
- if(compressedRoute.length < this.maxURLLength)
7841
- {
7842
- attemptedCompressedPathVariable = true;
7843
-
7844
- route = compressedRoute;
7845
- params = compressedParams;
7846
- }
7847
- else
7848
- {
7849
- // Fallback for when URL exceeds predefined length limit
7850
- if(!WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed)
7851
- console.warn("Compressed path variable route would exceed URL length limit");
7852
-
7853
- WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed = true;
7854
- }
7855
- }
7856
-
7857
- var onSuccess = null;
7858
- if(params.success){
7859
- onSuccess = params.success;
7860
  }
7861
-
7862
- params.success = function(result, status, xhr){
7863
- if(typeof result !== 'object'){
7864
- var rawResult = result;
7865
- try{
7866
- result = JSON.parse(result);
7867
- } catch (parseExc){
7868
- result = rawResult;
7869
- }
7870
- }
7871
-
7872
- if(onSuccess && typeof onSuccess === 'function'){
7873
- onSuccess(result, status, xhr);
7874
- }
7875
- };
7876
-
7877
- // NB: Support plain permalinks
7878
- if(WPGMZA.RestAPI.URL.match(/\?/))
7879
- route = route.replace(/\?/, "&");
7880
 
7881
- return $.ajax(WPGMZA.RestAPI.URL + route, params);
7882
  }
7883
 
7884
- var nativeCallFunction = WPGMZA.RestAPI.call;
7885
- WPGMZA.RestAPI.call = function()
7886
- {
7887
- console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?");
7888
-
7889
- nativeCallFunction.apply(this, arguments);
7890
- }
7891
-
7892
- $(document.body).on("click", "#wpgmza-rest-api-blocked button.notice-dismiss", function(event) {
7893
-
7894
- WPGMZA.restAPI.call("/rest-api/", {
7895
- method: "POST",
7896
- data: {
7897
- dismiss_blocked_notice: true
7898
- }
7899
- });
7900
-
7901
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7902
  });
7903
 
7904
  // js/v8/settings-page.js
@@ -12653,7 +12663,17 @@ jQuery(function($) {
12653
  }
12654
  }
12655
 
12656
- if(this.adjustSubMode){
 
 
 
 
 
 
 
 
 
 
12657
  // Trust the force!
12658
  WPGMZA.FeaturePanel.prototype.onSave.apply(self, arguments);
12659
  } else {
@@ -15926,7 +15946,7 @@ jQuery(function($) {
15926
  // this.dataTable = $(this.dataTableElement).DataTable(settings);
15927
  this.wpgmzaDataTable = this;
15928
 
15929
- this.useCompressedPathVariable = (WPGMZA.restAPI.isCompressedPathVariableSupported && WPGMZA.settings.enable_compressed_path_variables);
15930
  this.method = (this.useCompressedPathVariable ? "GET" : "POST");
15931
 
15932
  if(this.getLanguageURL() == undefined || this.getLanguageURL() == "//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json") {
1
 
2
  // js/v8/core.js
3
+ /**
4
+ * @module WPGMZA
5
+ * @summary This is the core Javascript module. Some code exists in ../core.js, the functionality there will slowly be handed over to this module.
6
+ */
7
+ jQuery(function($) {
8
+
9
+ var core = {
10
+ MARKER_PULL_DATABASE: "0",
11
+ MARKER_PULL_XML: "1",
12
+
13
+ PAGE_MAP_LIST: "map-list",
14
+ PAGE_MAP_EDIT: "map-edit",
15
+ PAGE_SETTINGS: "map-settings",
16
+ PAGE_SUPPORT: "map-support",
17
+
18
+ PAGE_CATEGORIES: "categories",
19
+ PAGE_ADVANCED: "advanced",
20
+ PAGE_CUSTOM_FIELDS: "custom-fields",
21
+
22
+ /**
23
+ * Indexed array of map instances
24
+ * @constant {array} maps
25
+ * @static
26
+ */
27
+ maps: [],
28
+
29
+ /**
30
+ * Global EventDispatcher used to listen for global plugin events
31
+ * @constant {EventDispatcher} events
32
+ * @static
33
+ */
34
+ events: null,
35
+
36
+ /**
37
+ * Settings, passed from the server
38
+ * @constant {object} settings
39
+ * @static
40
+ */
41
+ settings: null,
42
+
43
+ /**
44
+ * Instance of the restAPI. Not to be confused with WPGMZA.RestAPI, which is the instances constructor
45
+ * @constant {RestAPI} restAPI
46
+ * @static
47
+ */
48
+ restAPI: null,
49
+
50
+ /**
51
+ * Key and value pairs of localized strings passed from the server
52
+ * @constant {object} localized_strings
53
+ * @static
54
+ */
55
+ localized_strings: null,
56
+
57
+ // NB: Legacy
58
+ loadingHTML: '<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',
59
+
60
+ // NB: Correct
61
+ preloaderHTML: "<div class='wpgmza-preloader'><div></div><div></div><div></div><div></div></div>",
62
+
63
+ getCurrentPage: function() {
64
+
65
+ switch(WPGMZA.getQueryParamValue("page"))
66
+ {
67
+ case "wp-google-maps-menu":
68
+ if(window.location.href.match(/action=edit/) && window.location.href.match(/map_id=\d+/))
69
+ return WPGMZA.PAGE_MAP_EDIT;
70
+
71
+ return WPGMZA.PAGE_MAP_LIST;
72
+ break;
73
+
74
+ case 'wp-google-maps-menu-settings':
75
+ return WPGMZA.PAGE_SETTINGS;
76
+ break;
77
+
78
+ case 'wp-google-maps-menu-support':
79
+ return WPGMZA.PAGE_SUPPORT;
80
+ break;
81
+
82
+ case 'wp-google-maps-menu-categories':
83
+ return WPGMZA.PAGE_CATEGORIES;
84
+ break;
85
+
86
+ case 'wp-google-maps-menu-advanced':
87
+ return WPGMZA.PAGE_ADVANCED;
88
+ break;
89
+
90
+ case 'wp-google-maps-menu-custom-fields':
91
+ return WPGMZA.PAGE_CUSTOM_FIELDS;
92
+ break;
93
+
94
+ default:
95
+ return null;
96
+ break;
97
+ }
98
+
99
+ },
100
+
101
+ /**
102
+ * Override this method to add a scroll offset when using animated scroll, useful for sites with fixed headers.
103
+ * @method getScrollAnimationOffset
104
+ * @static
105
+ * @return {number} The scroll offset
106
+ */
107
+ getScrollAnimationOffset: function() {
108
+ return (WPGMZA.settings.scroll_animation_offset || 0) + ($("#wpadminbar").height() || 0);
109
+ },
110
+
111
+ getScrollAnimationDuration: function() {
112
+ if(WPGMZA.settings.scroll_animation_milliseconds)
113
+ return WPGMZA.settings.scroll_animation_milliseconds;
114
+ else
115
+ return 500;
116
+ },
117
+
118
+ /**
119
+ * Animated scroll, accounts for animation settings and fixed header height
120
+ * @method animateScroll
121
+ * @static
122
+ * @param {HTMLElement} element The element to scroll to
123
+ * @param {number} [milliseconds] The time in milliseconds to scroll over. Defaults to 500 if no value is specified.
124
+ * @return void
125
+ */
126
+ animateScroll: function(element, milliseconds) {
127
+
128
+ var offset = WPGMZA.getScrollAnimationOffset();
129
+
130
+ if(!milliseconds)
131
+ milliseconds = WPGMZA.getScrollAnimationDuration();
132
+
133
+ $("html, body").animate({
134
+ scrollTop: $(element).offset().top - offset
135
+ }, milliseconds);
136
+
137
+ },
138
+
139
+ extend: function(child, parent) {
140
+
141
+ var constructor = child;
142
+
143
+ child.prototype = Object.create(parent.prototype);
144
+ child.prototype.constructor = constructor;
145
+
146
+ },
147
+
148
+ /**
149
+ * Generates and returns a GUID
150
+ * @method guid
151
+ * @static
152
+ * @return {string} The GUID
153
+ */
154
+ guid: function() { // Public Domain/MIT
155
+ var d = new Date().getTime();
156
+ if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
157
+ d += performance.now(); //use high-precision timer if available
158
+ }
159
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
160
+ var r = (d + Math.random() * 16) % 16 | 0;
161
+ d = Math.floor(d / 16);
162
+ return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
163
+ });
164
+ },
165
+
166
+ /**
167
+ * Takes a hex string and opacity value and converts it to Openlayers RGBA format
168
+ * @method hexOpacityToRGBA
169
+ * @static
170
+ * @param {string} colour The hex color string
171
+ * @param {number} opacity The opacity from 0.0 - 1.0
172
+ * @return {array} RGBA array where color components are 0 - 255 and opacity is 0.0 - 1.0
173
+ */
174
+ hexOpacityToRGBA: function(colour, opacity)
175
+ {
176
+ var hex = parseInt(colour.replace(/^#/, ""), 16);
177
+ return [
178
+ (hex & 0xFF0000) >> 16,
179
+ (hex & 0xFF00) >> 8,
180
+ hex & 0xFF,
181
+ parseFloat(opacity)
182
+ ];
183
+ },
184
+
185
+ hexOpacityToString: function(colour, opacity)
186
+ {
187
+ var arr = WPGMZA.hexOpacityToRGBA(colour, opacity);
188
+ return "rgba(" + arr[0] + ", " + arr[1] + ", " + arr[2] + ", " + arr[3] + ")";
189
+ },
190
+
191
+ /**
192
+ * Takes a hex color string and converts it to an RGBA object.
193
+ * @method hexToRgba
194
+ * @static
195
+ * @param {string} hex The hex color string
196
+ * @return {object} Object with r, g, b and a properties, or 0 if the input is invalid.
197
+ */
198
+ hexToRgba: function(hex) {
199
+ var c;
200
+ if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){
201
+ c= hex.substring(1).split('');
202
+ if(c.length== 3){
203
+ c= [c[0], c[0], c[1], c[1], c[2], c[2]];
204
+ }
205
+ c= '0x'+c.join('');
206
+
207
+ return {
208
+ r: (c>>16)&255,
209
+ g: (c>>8)&255,
210
+ b: c&255,
211
+ a: 1
212
+ };
213
+ }
214
+
215
+ return 0;
216
+
217
+ //throw new Error('Bad Hex');
218
+ },
219
+
220
+ /**
221
+ * Takes an object with r, g, b and a properties and returns a CSS rgba color string
222
+ * @method rgbaToString
223
+ * @static
224
+ * @param {string} rgba The input object
225
+ * @return {string} The CSS rgba color string
226
+ */
227
+ rgbaToString: function(rgba) {
228
+ return "rgba(" + rgba.r + ", " + rgba.g + ", " + rgba.b + ", " + rgba.a + ")";
229
+ },
230
+
231
+ /**
232
+ * A regular expression that matches a latitude / longitude coordinate pair
233
+ * @constant {RegExp} latLngRegexp
234
+ * @static
235
+ */
236
+ latLngRegexp: /^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,
237
+
238
+ /**
239
+ * Utility function returns true is string is a latitude and longitude
240
+ * @method isLatLngString
241
+ * @deprecated Moved to WPGMZA.LatLng.isLatLngString
242
+ * @static
243
+ * @param str {string} The string to attempt to parse as coordinates
244
+ * @return {array} the matched latitude and longitude or null if no match
245
+ */
246
+ isLatLngString: function(str)
247
+ {
248
+ if(typeof str != "string")
249
+ return null;
250
+
251
+ // Remove outer brackets
252
+ if(str.match(/^\(.+\)$/))
253
+ str = str.replace(/^\(|\)$/, "");
254
+
255
+ var m = str.match(WPGMZA.latLngRegexp);
256
+
257
+ if(!m)
258
+ return null;
259
+
260
+ return new WPGMZA.LatLng({
261
+ lat: parseFloat(m[1]),
262
+ lng: parseFloat(m[3])
263
+ });
264
+ },
265
+
266
+ /**
267
+ * Utility function returns a latLng literal given a valid latLng string
268
+ * @method stringToLatLng
269
+ * @static
270
+ * @param str {string} The string to attempt to parse as coordinates
271
+ * @return {object} LatLng literal
272
+ */
273
+ stringToLatLng: function(str)
274
+ {
275
+ var result = WPGMZA.isLatLngString(str);
276
+
277
+ if(!result)
278
+ throw new Error("Not a valid latLng");
279
+
280
+ return result;
281
+ },
282
+
283
+ /**
284
+ * Utility function returns a latLng literal given a valid latLng string
285
+ * @method stringToLatLng
286
+ * @static
287
+ * @param str {string} The string to attempt to parse as coordinates
288
+ * @return {object} LatLng literal
289
+ */
290
+ isHexColorString: function(str)
291
+ {
292
+ if(typeof str != "string")
293
+ return false;
294
+
295
+ return (str.match(/#[0-9A-F]{6}/i) ? true : false);
296
+ },
297
+
298
+ /**
299
+ * Cache of image dimensions by URL, for internal use only
300
+ * @var imageDimensionsCache
301
+ * @inner
302
+ * @see WPGMZA.getImageDimensions
303
+ */
304
+ imageDimensionsCache: {},
305
+
306
+ /**
307
+ * Utility function to get the dimensions of an image, caches results for best performance
308
+ * @method getImageDimensions
309
+ * @static
310
+ * @param src {string} Image source URL
311
+ * @param callback {function} Callback to recieve image dimensions
312
+ * @return {void}
313
+ */
314
+ getImageDimensions: function(src, callback)
315
+ {
316
+ if(WPGMZA.imageDimensionsCache[src])
317
+ {
318
+ callback(WPGMZA.imageDimensionsCache[src]);
319
+ return;
320
+ }
321
+
322
+ var img = document.createElement("img");
323
+ img.onload = function(event) {
324
+ var result = {
325
+ width: img.width,
326
+ height: img.height
327
+ };
328
+ WPGMZA.imageDimensionsCache[src] = result;
329
+ callback(result);
330
+ };
331
+ img.src = src;
332
+ },
333
+
334
+ decodeEntities: function(input)
335
+ {
336
+ return input.replace(/&(nbsp|amp|quot|lt|gt);/g, function(m, e) {
337
+ return m[e];
338
+ }).replace(/&#(\d+);/gi, function(m, e) {
339
+ return String.fromCharCode(parseInt(e, 10));
340
+ });
341
+ },
342
+
343
+ /**
344
+ * Returns true if developer mode is set or if developer mode cookie is set
345
+ * @method isDeveloperMode
346
+ * @static
347
+ * @return {boolean} True if developer mode is on
348
+ */
349
+ isDeveloperMode: function()
350
+ {
351
+ return this.settings.developer_mode || (window.Cookies && window.Cookies.get("wpgmza-developer-mode"));
352
+ },
353
+
354
+ /**
355
+ * Returns true if the Pro add-on is active
356
+ * @method isProVersion
357
+ * @static
358
+ * @return {boolean} True if the Pro add-on is active
359
+ */
360
+ isProVersion: function()
361
+ {
362
+ return (this._isProVersion == "1");
363
+ },
364
+
365
+ /**
366
+ * Opens the WP media dialog and returns the result to a callback
367
+ * @method openMediaDialog
368
+ * @param {function} callback Callback to recieve the attachment ID as the first parameter and URL as the second
369
+ * @static
370
+ * @return {void}
371
+ */
372
+ openMediaDialog: function(callback) {
373
+ // Media upload
374
+ var file_frame;
375
+
376
+ // If the media frame already exists, reopen it.
377
+ if ( file_frame ) {
378
+ // Set the post ID to what we want
379
+ file_frame.uploader.uploader.param( 'post_id', set_to_post_id );
380
+ // Open frame
381
+ file_frame.open();
382
+ return;
383
+ }
384
+
385
+ // Create the media frame.
386
+ file_frame = wp.media.frames.file_frame = wp.media({
387
+ title: 'Select a image to upload',
388
+ button: {
389
+ text: 'Use this image',
390
+ },
391
+ multiple: false // Set to true to allow multiple files to be selected
392
+ });
393
+
394
+ // When an image is selected, run a callback.
395
+ file_frame.on( 'select', function() {
396
+ // We set multiple to false so only get one image from the uploader
397
+ attachment = file_frame.state().get('selection').first().toJSON();
398
+
399
+ callback(attachment.id, attachment.url);
400
+ });
401
+
402
+ // Finally, open the modal
403
+ file_frame.open();
404
+ },
405
+
406
+ /**
407
+ * @function getCurrentPosition
408
+ * @summary This function will get the users position, it first attempts to get
409
+ * high accuracy position (mobile with GPS sensors etc.), if that fails
410
+ * (desktops will time out) then it tries again without high accuracy
411
+ * enabled
412
+ * @static
413
+ * @return {object} The users position as a LatLng literal
414
+ */
415
+ getCurrentPosition: function(callback, error, watch)
416
+ {
417
+ var trigger = "userlocationfound";
418
+ var nativeFunction = "getCurrentPosition";
419
+
420
+ if(WPGMZA.userLocationDenied)
421
+ {
422
+ // NB: This code can also be reached on non https:// sites, the error code is the same
423
+ if(error)
424
+ error({code: 1, message: "Location unavailable"});
425
+
426
+ return; // NB: The user has declined to share location. Only ask once per session.
427
+ }
428
+
429
+ if(watch)
430
+ {
431
+ trigger = "userlocationupdated";
432
+ nativeFunction = "watchPosition";
433
+
434
+ // Call again immediatly to get current position, watchPosition won't fire until the user moves
435
+ /*setTimeout(function() {
436
+ WPGMZA.getCurrentPosition(callback, false);
437
+ }, 0);*/
438
+ }
439
+
440
+ if(!navigator.geolocation)
441
+ {
442
+ console.warn("No geolocation available on this device");
443
+ return;
444
+ }
445
+
446
+ var options = {
447
+ enableHighAccuracy: true
448
+ };
449
+
450
+ if(!navigator.geolocation[nativeFunction])
451
+ {
452
+ console.warn(nativeFunction + " is not available");
453
+ return;
454
+ }
455
+
456
+ navigator.geolocation[nativeFunction](function(position) {
457
+ if(callback)
458
+ callback(position);
459
+
460
+ WPGMZA.events.trigger("userlocationfound");
461
+ },
462
+ function(err) {
463
+
464
+ options.enableHighAccuracy = false;
465
+
466
+ navigator.geolocation[nativeFunction](function(position) {
467
+ if(callback)
468
+ callback(position);
469
+
470
+ WPGMZA.events.trigger("userlocationfound");
471
+ },
472
+ function(err) {
473
+ console.warn(err.code, err.message);
474
+
475
+ if(err.code == 1)
476
+ WPGMZA.userLocationDenied = true;
477
+
478
+ if(error)
479
+ error(err);
480
+ },
481
+ options);
482
+
483
+ },
484
+ options);
485
+ },
486
+
487
+ watchPosition: function(callback, error)
488
+ {
489
+ return WPGMZA.getCurrentPosition(callback, error, true);
490
+ },
491
+
492
+ /**
493
+ * Runs a catchable task and displays a friendly error if the function throws an error
494
+ * @method runCatchableTask
495
+ * @static
496
+ * @param {function} callback The function to run
497
+ * @param {HTMLElement} friendlyErrorContainer The container element to hold the error
498
+ * @return {void}
499
+ * @see WPGMZA.FriendlyError
500
+ */
501
+ runCatchableTask: function(callback, friendlyErrorContainer) {
502
+
503
+ if(WPGMZA.isDeveloperMode())
504
+ callback();
505
+ else
506
+ try{
507
+ callback();
508
+ }catch(e) {
509
+ var friendlyError = new WPGMZA.FriendlyError(e);
510
+ $(friendlyErrorContainer).html("");
511
+ $(friendlyErrorContainer).append(friendlyError.element);
512
+ $(friendlyErrorContainer).show();
513
+ }
514
+ },
515
+
516
+ capitalizeWords: function(string)
517
+ {
518
+ return (string + "").replace(/^(.)|\s+(.)/g, function(m) {
519
+ return m.toUpperCase()
520
+ });
521
+ },
522
+
523
+ pluralize: function(string)
524
+ {
525
+ return WPGMZA.singularize(string) + "s";
526
+ },
527
+
528
+ singularize: function(string)
529
+ {
530
+ return string.replace(/s$/, "");
531
+ },
532
+
533
+ /**
534
+ * This function is for checking inheritence has been setup correctly. For objects that have engine and Pro specific classes, it will automatically add the engine and pro prefix to the supplied string and if such an object exists it will test against that name rather than the un-prefix argument supplied.
535
+ *
536
+ * For example, if we are running the Pro addon with Google maps as the engine, if you supply Marker as the instance name the function will check to see if instance is an instance of GoogleProMarker
537
+ * @method assertInstanceOf
538
+ * @static
539
+ * @param {object} instance The object to check
540
+ * @param {string} instanceName The class name as a string which this object should be an instance of
541
+ * @return {void}
542
+ */
543
+ assertInstanceOf: function(instance, instanceName) {
544
+ var engine, fullInstanceName, assert;
545
+ var pro = WPGMZA.isProVersion() ? "Pro" : "";
546
+
547
+ switch(WPGMZA.settings.engine)
548
+ {
549
+ case "open-layers":
550
+ engine = "OL";
551
+ break;
552
+
553
+ default:
554
+ engine = "Google";
555
+ break;
556
+ }
557
+
558
+ if(
559
+ WPGMZA[engine + pro + instanceName]
560
+ &&
561
+ engine + instanceName != "OLFeature" // NB: Some classes, such as OLFeature, are static utility classes and cannot be inherited from, do not check the inheritence chain for these
562
+ )
563
+ fullInstanceName = engine + pro + instanceName;
564
+ else if(WPGMZA[pro + instanceName])
565
+ fullInstanceName = pro + instanceName;
566
+ else if(
567
+ WPGMZA[engine + instanceName]
568
+ &&
569
+ WPGMZA[engine + instanceName].prototype
570
+ )
571
+ fullInstanceName = engine + instanceName;
572
+ else
573
+ fullInstanceName = instanceName;
574
+
575
+ if(fullInstanceName == "OLFeature")
576
+ return; // Nothing inherits from OLFeature - it's purely a "static" utility class
577
+
578
+ assert = instance instanceof WPGMZA[fullInstanceName];
579
+
580
+ if(!assert)
581
+ throw new Error("Object must be an instance of " + fullInstanceName + " (did you call a constructor directly, rather than createInstance?)");
582
+ },
583
+
584
+ /**
585
+ * @method getMapByID
586
+ * @static
587
+ * @param {mixed} id The ID of the map to retrieve
588
+ * @return {object} The map object, or null if no such map exists
589
+ */
590
+ getMapByID: function(id) {
591
+
592
+ for(var i = 0; i < WPGMZA.maps.length; i++) {
593
+ if(WPGMZA.maps[i].id == id)
594
+ return WPGMZA.maps[i];
595
+ }
596
+
597
+ return null;
598
+
599
+ },
600
+
601
+ /**
602
+ * Shorthand function to determine if the Places Autocomplete is available
603
+ * @method isGoogleAutocompleteSupported
604
+ * @static
605
+ * @return {boolean} True if the places autocomplete is available
606
+ */
607
+ isGoogleAutocompleteSupported: function() {
608
+
609
+ if(!window.google)
610
+ return false;
611
+
612
+ if(!google.maps)
613
+ return false;
614
+
615
+ if(!google.maps.places)
616
+ return false;
617
+
618
+ if(!google.maps.places.Autocomplete)
619
+ return false;
620
+
621
+ if(WPGMZA.CloudAPI && WPGMZA.CloudAPI.isBeingUsed)
622
+ return false;
623
+
624
+ return true;
625
+
626
+ },
627
+
628
+ /**
629
+ * The Google API status script enqueue, as reported by the server
630
+ * @constant
631
+ * @static
632
+ */
633
+ googleAPIStatus: window.wpgmza_google_api_status,
634
+
635
+ /**
636
+ * Makes an educated guess as to whether the browser is Safari
637
+ * @method isSafari
638
+ * @static
639
+ * @return {boolean} True if it's likely the browser is Safari
640
+ */
641
+ isSafari: function() {
642
+
643
+ var ua = navigator.userAgent.toLowerCase();
644
+ return (ua.match(/safari/i) && !ua.match(/chrome/i));
645
+
646
+ },
647
+
648
+ /**
649
+ * Makes an educated guess as to whether the browser is running on a touch device
650
+ * @method isTouchDevice
651
+ * @static
652
+ * @return {boolean} True if it's likely the browser is running on a touch device
653
+ */
654
+ isTouchDevice: function() {
655
+
656
+ return ("ontouchstart" in window);
657
+
658
+ },
659
+
660
+ /**
661
+ * Makes an educated guess whether the browser is running on an iOS device
662
+ * @method isDeviceiOS
663
+ * @static
664
+ * @return {boolean} True if it's likely the browser is running on an iOS device
665
+ */
666
+ isDeviceiOS: function() {
667
+
668
+ return (
669
+
670
+ (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
671
+
672
+ ||
673
+
674
+ (!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform))
675
+
676
+ );
677
+
678
+ },
679
+
680
+ /**
681
+ * This function prevents modern style components being used with new UI styles (8.0.0)
682
+ * @method isModernComponentStyleAllowed
683
+ * @static
684
+ * @return {boolean} True if modern or legacy style is selected, or no UI style is selected
685
+ */
686
+ isModernComponentStyleAllowed: function() {
687
+
688
+ return (!WPGMZA.settings.user_interface_style || WPGMZA.settings.user_interface_style == "legacy" || WPGMZA.settings.user_interface_style == "modern");
689
+
690
+ },
691
+
692
+ isElementInView: function(element) {
693
+
694
+ var pageTop = $(window).scrollTop();
695
+ var pageBottom = pageTop + $(window).height();
696
+ var elementTop = $(element).offset().top;
697
+ var elementBottom = elementTop + $(element).height();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698
 
699
+ if(elementTop < pageTop && elementBottom > pageBottom)
700
+ return true;
701
+
702
+ if(elementTop >= pageTop && elementTop <= pageBottom)
703
+ return true;
704
+
705
+ if(elementBottom >= pageTop && elementBottom <= pageBottom)
706
+ return true;
707
+
708
+ return false;
709
+
710
+ },
711
+
712
+ isFullScreen: function() {
713
+
714
+ return wpgmzaisFullScreen;
715
+
716
+ },
717
+
718
+ getQueryParamValue: function(name) {
719
+
720
+ var regex = new RegExp(name + "=([^&#]*)");
721
+ var m;
722
+
723
+ if(!(m = window.location.href.match(regex)))
724
+ return null;
725
+
726
+ return decodeURIComponent(m[1]);
727
+ },
728
+
729
+ notification: function(text, time) {
730
+
731
+ switch(arguments.length)
732
+ {
733
+ case 0:
734
+ text = "";
735
+ time = 4000;
736
+ break;
737
+
738
+ case 1:
739
+ time = 4000;
740
+ break;
741
+ }
742
+
743
+ var html = '<div class="wpgmza-popup-notification">' + text + '</div>';
744
+ jQuery('body').append(html);
745
+ setTimeout(function(){
746
+ jQuery('body').find('.wpgmza-popup-notification').remove();
747
+ }, time);
748
+
749
+ },
750
+
751
+ initMaps: function(){
752
+ $(document.body).find(".wpgmza_map:not(.wpgmza-initialized)").each(function(index, el) {
753
+ if(el.wpgmzaMap) {
754
+ console.warn("Element missing class wpgmza-initialized but does have wpgmzaMap property. No new instance will be created");
755
+ return;
756
+ }
757
+
758
+ el.wpgmzaMap = WPGMZA.Map.createInstance(el);
759
+ });
760
+
761
+ WPGMZA.Map.nextInitTimeoutID = setTimeout(WPGMZA.initMaps, 3000);
762
+ },
763
+
764
+ onScroll: function(){
765
+ $(".wpgmza_map").each(function(index, el) {
766
+ var isInView = WPGMZA.isElementInView(el);
767
+ if(!el.wpgmzaScrollIntoViewTriggerFlag){
768
+ if(isInView){
769
+ $(el).trigger("mapscrolledintoview.wpgmza");
770
+ el.wpgmzaScrollIntoViewTriggerFlag = true;
771
+ }
772
+ } else if(!isInView){
773
+ el.wpgmzaScrollIntoViewTriggerFlag = false;
774
+ }
775
+
776
+ });
777
+ }
778
+
779
+ };
780
+
781
+ var wpgmzaisFullScreen = false;
782
+
783
+
784
+ // NB: Warn the user if the built in Array prototype has been extended. This will save debugging headaches where for ... in loops do bizarre things.
785
+ for(var key in [])
786
+ {
787
+ console.warn("It appears that the built in JavaScript Array has been extended, this can create issues with for ... in loops, which may cause failure.");
788
+ break;
789
+ }
790
+
791
+ if(window.WPGMZA)
792
+ window.WPGMZA = $.extend(window.WPGMZA, core);
793
+ else
794
+ window.WPGMZA = core;
795
+
796
+ /* Usercentrics base level integration */
797
+ if(window.uc && window.uc.reloadOnOptIn){
798
+ window.uc.reloadOnOptIn(
799
+ 'S1pcEj_jZX'
800
+ );
801
+
802
+ window.uc.reloadOnOptOut(
803
+ 'S1pcEj_jZX'
804
+ );
805
+ }
806
+
807
+
808
+ for(var key in WPGMZA_localized_data){
809
+ var value = WPGMZA_localized_data[key];
810
+ WPGMZA[key] = value;
811
+ }
812
+
813
+ // delete window.WPGMZA_localized_data;
814
+
815
+ WPGMZA.settings.useLegacyGlobals = true;
816
+
817
+ $(document).on("fullscreenchange", function() {
818
+ wpgmzaisFullScreen = document.fullscreenElement ? true : false;
819
+ });
820
+
821
+ $('body').on('click',"#wpgmzaCloseChat", function(e) {
822
+ e.preventDefault();
823
+ $.ajax(WPGMZA.ajaxurl, {
824
+ method: 'POST',
825
+ data: {
826
+ action: 'wpgmza_hide_chat',
827
+ nonce: WPGMZA_localized_data.ajaxnonce
828
+ }
829
+ });
830
+ $('.wpgmza-chat-help').remove();
831
+ });
832
+
833
+
834
+ $(window).on("scroll", WPGMZA.onScroll);
835
+
836
+ $(document.body).on("click", "button.wpgmza-api-consent", function(event) {
837
+ Cookies.set("wpgmza-api-consent-given", true);
838
+ window.location.reload();
839
+ });
840
+
841
+ $(document.body).on("keydown", function(event) {
842
+ if(event.altKey)
843
+ WPGMZA.altKeyDown = true;
844
+ });
845
+
846
+ $(document.body).on("keyup", function(event) {
847
+ if(!event.altKey)
848
+ WPGMZA.altKeyDown = false;
849
+ });
850
+
851
+ $(document.body).on('preinit.wpgmza', function(){
852
+ $(window).trigger("ready.wpgmza");
853
+
854
+ // Combined script warning
855
+ if($("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length){
856
+ console.warn("Minified script is out of date, using combined script instead.");
857
+ }
858
+
859
+ // Check for multiple jQuery versions
860
+ var elements = $("script[src]").filter(function() {
861
+ return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i);
862
+ });
863
+
864
+ if(elements.length > 1){
865
+ console.warn("Multiple jQuery versions detected: ", elements);
866
+ }
867
+
868
+ // Array incorrectly extended warning
869
+ var test = [];
870
+ for(var key in test) {
871
+ console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");
872
+ break;
873
+ }
874
+
875
+ // Geolocation warnings
876
+ if(window.location.protocol != 'https:'){
877
+ var warning = '<div class="notice notice-warning"><p>' + WPGMZA.localized_strings.unsecure_geolocation + "</p></div>";
878
+
879
+ $(".wpgmza-geolocation-setting").first().after( $(warning) );
880
+ }
881
+
882
+ if(WPGMZA.googleAPIStatus && WPGMZA.googleAPIStatus.code == "USER_CONSENT_NOT_GIVEN") {
883
+ if(jQuery('.wpgmza-gdpr-compliance').length <= 0){
884
+ /*$("#wpgmza_map, .wpgmza_map").each(function(index, el) {
885
+ $(el).append($(WPGMZA.api_consent_html));
886
+ $(el).css({height: "auto"});
887
+ });*/
888
+
889
+ $("button.wpgmza-api-consent").on("click", function(event) {
890
+ Cookies.set("wpgmza-api-consent-given", true);
891
+ window.location.reload();
892
+ });
893
+ }
894
+
895
+ return;
896
+ }
897
+ });
898
+
899
+ /**
900
+ * We use to use the win-the-race approach with set timeouts
901
+ *
902
+ * This caused immense issues with older versions of WP
903
+ *
904
+ * Instead, we call an anon-func, which queues on the ready call, this controls the queue without the need for timeouts
905
+ *
906
+ * While also maintaining the stack order, and the ability for consent plugins to stop ready calls early
907
+ */
908
+ (function($){
909
+ $(function(){
910
+ WPGMZA.restAPI = WPGMZA.RestAPI.createInstance();
911
+ if(WPGMZA.CloudAPI){
912
+ WPGMZA.cloudAPI = WPGMZA.CloudAPI.createInstance();
913
+ }
914
+
915
+ $(document.body).trigger('preinit.wpgmza');
916
+
917
+ WPGMZA.initMaps();
918
+ WPGMZA.onScroll();
919
+ });
920
+ })($);
921
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  });
923
 
924
+
925
+ // js/v8/compatibility.js
926
  /**
927
  * @namespace WPGMZA
928
+ * @module Compatibility
929
  * @requires WPGMZA
930
+ */
931
  jQuery(function($) {
932
+
933
  /**
934
+ * Reverse compatibility module
935
+ *
936
+ * @class WPGMZA.Compatibility
937
+ * @constructor WPGMZA.Compatibility
938
  * @memberof WPGMZA
 
939
  */
940
+ WPGMZA.Compatibility = function()
941
  {
942
+ this.preventDocumentWriteGoogleMapsAPI();
 
 
 
 
 
 
 
 
 
 
 
 
943
  }
944
+
 
 
 
 
945
  /**
946
+ * Prevents document.write from outputting Google Maps API script tag
947
+ *
948
  * @method
949
+ * @memberof WPGMZA.Compatibility
950
  */
951
+ WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI = function()
952
  {
953
+ var old = document.write;
954
+
955
+ document.write = function(content)
956
+ {
957
+ if(content.match && content.match(/maps\.google/))
958
+ return;
959
+
960
+ old.call(document, content);
961
+ }
962
  }
963
 
964
+ WPGMZA.compatiblityModule = new WPGMZA.Compatibility();
965
+
966
  });
967
 
968
+ // js/v8/css-escape.js
969
  /**
970
+ * Polyfill for CSS.escape, with thanks to @mathias
971
  * @namespace WPGMZA
972
+ * @module CSS
973
  * @requires WPGMZA
974
  */
975
+
976
+ /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
977
+ ;(function(root, factory) {
978
+ // https://github.com/umdjs/umd/blob/master/returnExports.js
979
+ if (typeof exports == 'object') {
980
+ // For Node.js.
981
+ module.exports = factory(root);
982
+ } else if (typeof define == 'function' && define.amd) {
983
+ // For AMD. Register as an anonymous module.
984
+ define([], factory.bind(root, root));
985
+ } else {
986
+ // For browser globals (not exposing the function separately).
987
+ factory(root);
988
+ }
989
+ }(typeof global != 'undefined' ? global : this, function(root) {
990
+
991
+ if (root.CSS && root.CSS.escape) {
992
+ return root.CSS.escape;
993
+ }
994
+
995
+ // https://drafts.csswg.org/cssom/#serialize-an-identifier
996
+ var cssEscape = function(value) {
997
+ if (arguments.length == 0) {
998
+ throw new TypeError('`CSS.escape` requires an argument.');
999
+ }
1000
+ var string = String(value);
1001
+ var length = string.length;
1002
+ var index = -1;
1003
+ var codeUnit;
1004
+ var result = '';
1005
+ var firstCodeUnit = string.charCodeAt(0);
1006
+ while (++index < length) {
1007
+ codeUnit = string.charCodeAt(index);
1008
+ // Note: there’s no need to special-case astral symbols, surrogate
1009
+ // pairs, or lone surrogates.
1010
+
1011
+ // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
1012
+ // (U+FFFD).
1013
+ if (codeUnit == 0x0000) {
1014
+ result += '\uFFFD';
1015
+ continue;
1016
+ }
1017
+
1018
+ if (
1019
+ // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
1020
+ // U+007F, […]
1021
+ (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
1022
+ // If the character is the first character and is in the range [0-9]
1023
+ // (U+0030 to U+0039), […]
1024
+ (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
1025
+ // If the character is the second character and is in the range [0-9]
1026
+ // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
1027
+ (
1028
+ index == 1 &&
1029
+ codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
1030
+ firstCodeUnit == 0x002D
1031
+ )
1032
+ ) {
1033
+ // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
1034
+ result += '\\' + codeUnit.toString(16) + ' ';
1035
+ continue;
1036
+ }
1037
+
1038
+ if (
1039
+ // If the character is the first character and is a `-` (U+002D), and
1040
+ // there is no second character, […]
1041
+ index == 0 &&
1042
+ length == 1 &&
1043
+ codeUnit == 0x002D
1044
+ ) {
1045
+ result += '\\' + string.charAt(index);
1046
+ continue;
1047
+ }
1048
+
1049
+ // If the character is not handled by one of the above rules and is
1050
+ // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
1051
+ // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
1052
+ // U+005A), or [a-z] (U+0061 to U+007A), […]
1053
+ if (
1054
+ codeUnit >= 0x0080 ||
1055
+ codeUnit == 0x002D ||
1056
+ codeUnit == 0x005F ||
1057
+ codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
1058
+ codeUnit >= 0x0041 && codeUnit <= 0x005A ||
1059
+ codeUnit >= 0x0061 && codeUnit <= 0x007A
1060
+ ) {
1061
+ // the character itself
1062
+ result += string.charAt(index);
1063
+ continue;
1064
+ }
1065
+
1066
+ // Otherwise, the escaped character.
1067
+ // https://drafts.csswg.org/cssom/#escape-a-character
1068
+ result += '\\' + string.charAt(index);
1069
+
1070
  }
1071
+ return result;
1072
  };
1073
+
1074
+ if (!root.CSS) {
1075
+ root.CSS = {};
1076
+ }
1077
+
1078
+ root.CSS.escape = cssEscape;
1079
+ return cssEscape;
1080
+
1081
+ }));
 
1082
 
1083
+ // js/v8/distance.js
1084
  /**
1085
+ * Collection of distance utility functions and constants
1086
  * @namespace WPGMZA
1087
+ * @module Distance
1088
+ * @requires WPGMZA
1089
  */
1090
  jQuery(function($) {
1091
 
1092
+ var earthRadiusMeters = 6371;
1093
+ var piTimes360 = Math.PI / 360;
1094
+
1095
+ function deg2rad(deg) {
1096
+ return deg * (Math.PI/180)
1097
+ };
1098
+
1099
  /**
1100
+ * @class WPGMZA.Distance
 
 
1101
  * @memberof WPGMZA
1102
+ * @deprecated Will be dropped wiht the introduction of global distance units
1103
  */
1104
+ WPGMZA.Distance = {
 
 
 
 
1105
 
1106
+ /**
1107
+ * Miles, represented as true by legacy versions of the plugin
1108
+ * @constant MILES
1109
+ * @static
1110
+ * @memberof WPGMZA.Distance
1111
+ */
1112
+ MILES: true,
1113
 
1114
+ /**
1115
+ * Kilometers, represented as false by legacy versions of the plugin
1116
+ * @constant KILOMETERS
1117
+ * @static
1118
+ * @memberof WPGMZA.Distance
1119
+ */
1120
+ KILOMETERS: false,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1121
 
1122
+ /**
1123
+ * Miles per kilometer
1124
+ * @constant MILES_PER_KILOMETER
1125
+ * @static
1126
+ * @memberof WPGMZA.Distance
1127
+ */
1128
+ MILES_PER_KILOMETER: 0.621371,
 
 
 
 
1129
 
1130
+ /**
1131
+ * Kilometers per mile
1132
+ * @constant KILOMETERS_PER_MILE
1133
+ * @static
1134
+ */
1135
+ KILOMETERS_PER_MILE: 1.60934,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1136
 
1137
+ // TODO: Implement WPGMZA.settings.distance_units
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1138
 
1139
+ /**
1140
+ * Converts a UI distance (eg from a form control) to meters,
1141
+ * accounting for the global units setting
1142
+ * @method uiToMeters
1143
+ * @static
1144
+ * @memberof WPGMZA.Distance
1145
+ * @param {number} uiDistance The distance from the UI, could be in miles or kilometers depending on settings
1146
+ * @return {number} The input distance in meters
1147
+ */
1148
+ uiToMeters: function(uiDistance)
1149
+ {
1150
+ return parseFloat(uiDistance) / (WPGMZA.settings.distance_units == WPGMZA.Distance.MILES ? WPGMZA.Distance.MILES_PER_KILOMETER : 1) * 1000;
1151
+ },
1152
 
1153
+ /**
1154
+ * Converts a UI distance (eg from a form control) to kilometers,
1155
+ * accounting for the global units setting
1156
+ * @method uiToKilometers
1157
+ * @static
1158
+ * @memberof WPGMZA.Distance
1159
+ * @param {number} uiDistance The distance from the UI, could be in miles or kilometers depending on settings
1160
+ * @return {number} The input distance in kilometers
1161
+ */
1162
+ uiToKilometers: function(uiDistance)
1163
  {
1164
+ return WPGMZA.Distance.uiToMeters(uiDistance) * 0.001;
1165
+ },
 
 
 
 
 
 
 
 
 
 
 
 
 
1166
 
1167
+ /**
1168
+ * Converts a UI distance (eg from a form control) to miles, according to settings
1169
+ * @method uiToMiles
1170
+ * @static
1171
+ * @memberof WPGMZA.Distance
1172
+ * @param {number} uiDistance The distance from the UI, could be in miles or kilometers depending on settings
1173
+ * @return {number} The input distance
1174
+ */
1175
+ uiToMiles: function(uiDistance)
1176
+ {
1177
+ return WPGMZA.Distance.uiToKilometers(uiDistance) * WPGMZA.Distance.MILES_PER_KILOMETER;
1178
+ },
1179
 
1180
+ /**
1181
+ * Converts kilometers to a UI distance, either the same value, or converted to miles depending on settings.
1182
+ * @method kilometersToUI
1183
+ * @static
1184
+ * @memberof WPGMZA.Distance
1185
+ * @param {number} km The input distance in kilometers
1186
+ * @param {number} The UI distance in the units specified by settings
1187
+ */
1188
+ kilometersToUI: function(km)
1189
+ {
1190
+ if(WPGMZA.settings.distance_units == WPGMZA.Distance.MILES)
1191
+ return km * WPGMZA.Distance.MILES_PER_KILOMETER;
1192
+ return km;
1193
+ },
1194
 
1195
+ /**
1196
+ * Returns the distance, in kilometers, between two LatLng's
1197
+ * @method between
1198
+ * @static
1199
+ * @memberof WPGMZA.Distance
1200
+ * @param {WPGMZA.Latlng} The first point
1201
+ * @param {WPGMZA.Latlng} The second point
1202
+ * @return {number} The distance, in kilometers
1203
+ */
1204
+ between: function(a, b)
1205
  {
1206
+ if(!(a instanceof WPGMZA.LatLng) && !("lat" in a && "lng" in a))
1207
+ throw new Error("First argument must be an instance of WPGMZA.LatLng or a literal");
1208
 
1209
+ if(!(b instanceof WPGMZA.LatLng) && !("lat" in b && "lng" in b))
1210
+ throw new Error("Second argument must be an instance of WPGMZA.LatLng or a literal");
 
 
 
1211
 
1212
+ if(a === b)
1213
+ return 0.0;
1214
 
1215
+ var lat1 = a.lat;
1216
+ var lon1 = a.lng;
1217
+ var lat2 = b.lat;
1218
+ var lon2 = b.lng;
1219
+
1220
+ var dLat = deg2rad(lat2 - lat1);
1221
+ var dLon = deg2rad(lon2 - lon1);
1222
+
1223
+ var a =
1224
+ Math.sin(dLat/2) * Math.sin(dLat/2) +
1225
+ Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
1226
+ Math.sin(dLon/2) * Math.sin(dLon/2);
1227
 
1228
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
1229
+ var d = earthRadiusMeters * c; // Distance in km
1230
 
1231
+ return d;
1232
  }
1233
+
1234
+ };
1235
 
1236
  });
1237
 
1238
+ // js/v8/elias-fano.js
1239
  /**
1240
  * @namespace WPGMZA
1241
+ * @module EliasFano
1242
+ * @requires WPGMZA
1243
  */
1244
  jQuery(function($) {
1245
 
1246
+ WPGMZA.EliasFano = function()
 
 
 
 
 
 
 
 
 
 
1247
  {
1248
+ if(!WPGMZA.EliasFano.isSupported)
1249
+ throw new Error("Elias Fano encoding is not supported on browsers without Uint8Array");
 
 
 
 
1250
 
1251
+ if(!WPGMZA.EliasFano.decodingTablesInitialised)
1252
+ WPGMZA.EliasFano.createDecodingTable();
1253
  }
1254
 
1255
+ WPGMZA.EliasFano.isSupported = ("Uint8Array" in window);
1256
 
1257
+ WPGMZA.EliasFano.decodingTableHighBits = [];
1258
+ WPGMZA.EliasFano.decodingTableDocIDNumber = null;
1259
+ WPGMZA.EliasFano.decodingTableHighBitsCarryover = null;
1260
+
1261
+ WPGMZA.EliasFano.createDecodingTable = function()
1262
+ {
1263
+ WPGMZA.EliasFano.decodingTableDocIDNumber = new Uint8Array(256);
1264
+ WPGMZA.EliasFano.decodingTableHighBitsCarryover = new Uint8Array(256);
1265
 
1266
+ var decodingTableHighBits = WPGMZA.EliasFano.decodingTableHighBits;
1267
+ var decodingTableDocIDNumber = WPGMZA.EliasFano.decodingTableDocIDNumber;
1268
+ var decodingTableHighBitsCarryover = WPGMZA.EliasFano.decodingTableHighBitsCarryover;
1269
 
1270
+ for(var i = 0; i < 256; i++)
1271
  {
1272
+ var zeroCount = 0;
 
1273
 
1274
+ decodingTableHighBits[i] = [];
1275
+
1276
+ for(var j = 7; j >= 0; j--)
1277
+ {
1278
+ if((i & (1 << j)) > 0)
1279
+ {
1280
+ decodingTableHighBits[i][decodingTableDocIDNumber[i]] = zeroCount;
1281
+
1282
+ decodingTableDocIDNumber[i]++;
1283
+ zeroCount = 0;
1284
+ }
1285
+ else
1286
+ zeroCount = (zeroCount + 1) % 0xFF;
1287
+ }
1288
+
1289
+ decodingTableHighBitsCarryover[i] = zeroCount;
1290
  }
1291
 
1292
+ WPGMZA.EliasFano.decodingTablesInitialised = true;
1293
+ }
 
1294
 
1295
+ WPGMZA.EliasFano.prototype.encode = function(list)
1296
+ {
1297
+ var lastDocID = 0,
1298
+ buffer1 = 0,
1299
+ bufferLength1 = 0,
1300
+ buffer2 = 0,
1301
+ bufferLength2 = 0;
1302
 
1303
+ if(list.length == 0)
1304
+ return result;
1305
+
1306
+ function toByte(n)
1307
  {
1308
+ return n & 0xFF;
 
 
 
 
 
 
1309
  }
1310
+
1311
+ var compressedBufferPointer1 = 0;
1312
+ var compressedBufferPointer2 = 0;
1313
+ var largestBlockID = list[list.length - 1];
1314
+ var averageDelta = largestBlockID / list.length;
1315
+ var averageDeltaLog = Math.log2(averageDelta);
1316
+ var lowBitsLength = Math.floor(averageDeltaLog);
1317
+ var lowBitsMask = (1 << lowBitsLength) - 1;
1318
+ var prev = null;
1319
+
1320
+ var maxCompressedSize = Math.floor(
1321
+ (
1322
+ 2 + Math.ceil(
1323
+ Math.log2(averageDelta)
1324
+ )
1325
+ ) * list.length / 8
1326
+ ) + 6;
1327
+
1328
+ var compressedBuffer = new Uint8Array(maxCompressedSize);
1329
+
1330
+ if(lowBitsLength < 0)
1331
+ lowBitsLength = 0;
1332
+
1333
+ compressedBufferPointer2 = Math.floor(lowBitsLength * list.length / 8 + 6);
1334
+
1335
+ compressedBuffer[compressedBufferPointer1++] = toByte( list.length );
1336
+ compressedBuffer[compressedBufferPointer1++] = toByte( list.length >> 8 );
1337
+ compressedBuffer[compressedBufferPointer1++] = toByte( list.length >> 16 );
1338
+ compressedBuffer[compressedBufferPointer1++] = toByte( list.length >> 24 );
1339
+
1340
+ compressedBuffer[compressedBufferPointer1++] = toByte( lowBitsLength );
1341
+
1342
+ list.forEach(function(docID) {
1343
+
1344
+ var docIDDelta = (docID - lastDocID - 1);
1345
+
1346
+ if(!$.isNumeric(docID))
1347
+ throw new Error("Value is not numeric");
1348
+
1349
+ // NB: Force docID to an integer in case it's a string
1350
+ docID = parseInt(docID);
1351
+
1352
+ if(prev !== null && docID <= prev)
1353
+ throw new Error("Elias Fano encoding can only be used on a sorted, ascending list of unique integers.");
1354
+
1355
+ prev = docID;
1356
+
1357
+ buffer1 <<= lowBitsLength;
1358
+ buffer1 |= (docIDDelta & lowBitsMask);
1359
+ bufferLength1 += lowBitsLength;
1360
+
1361
+ // Flush buffer 1
1362
+ while(bufferLength1 > 7)
1363
+ {
1364
+ bufferLength1 -= 8;
1365
+ compressedBuffer[compressedBufferPointer1++] = toByte( buffer1 >> bufferLength1 );
1366
+ }
1367
+
1368
+ var unaryCodeLength = (docIDDelta >> lowBitsLength) + 1;
1369
+
1370
+ buffer2 <<= unaryCodeLength;
1371
+ buffer2 |= 1;
1372
+ bufferLength2 += unaryCodeLength;
1373
+
1374
+ // Flush buffer 2
1375
+ while(bufferLength2 > 7)
1376
+ {
1377
+ bufferLength2 -= 8;
1378
+ compressedBuffer[compressedBufferPointer2++] = toByte( buffer2 >> bufferLength2 );
1379
+ }
1380
+
1381
+ lastDocID = docID;
1382
+ });
1383
+
1384
+ if(bufferLength1 > 0)
1385
+ compressedBuffer[compressedBufferPointer1++] = toByte( buffer1 << (8 - bufferLength1) );
1386
+
1387
+ if(bufferLength2 > 0)
1388
+ compressedBuffer[compressedBufferPointer2++] = toByte( buffer2 << (8 - bufferLength2) );
1389
+
1390
+ var result = new Uint8Array(compressedBuffer);
1391
+
1392
+ result.pointer = compressedBufferPointer2;
1393
+
1394
+ return result;
1395
+ }
1396
 
1397
+ WPGMZA.EliasFano.prototype.decode = function(compressedBuffer)
1398
+ {
1399
+ var resultPointer = 0;
1400
+ var list = [];
1401
+
1402
+ //console.log("Decoding buffer from pointer " + compressedBuffer.pointer);
1403
+ //console.log(compressedBuffer);
1404
+
1405
+ var decodingTableHighBits = WPGMZA.EliasFano.decodingTableHighBits;
1406
+ var decodingTableDocIDNumber = WPGMZA.EliasFano.decodingTableDocIDNumber;
1407
+ var decodingTableHighBitsCarryover = WPGMZA.EliasFano.decodingTableHighBitsCarryover;
1408
+
1409
+ var lowBitsPointer = 0,
1410
+ lastDocID = 0,
1411
+ docID = 0,
1412
+ docIDNumber = 0;
1413
 
1414
+ var listCount = compressedBuffer[lowBitsPointer++];
1415
 
1416
+ //console.log("listCount is now " + listCount);
 
 
 
 
 
 
 
 
 
1417
 
1418
+ listCount |= compressedBuffer[lowBitsPointer++] << 8;
 
 
1419
 
1420
+ //console.log("listCount is now " + listCount);
1421
 
1422
+ listCount |= compressedBuffer[lowBitsPointer++] << 16;
 
 
 
 
 
 
 
 
 
1423
 
1424
+ //console.log("listCount is now " + listCount);
 
 
 
 
 
 
 
 
 
 
1425
 
1426
+ listCount |= compressedBuffer[lowBitsPointer++] << 24;
 
 
 
 
 
 
 
 
 
1427
 
1428
+ //console.log("Read list count " + listCount);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1429
 
1430
+ var lowBitsLength = compressedBuffer[lowBitsPointer++];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1431
 
1432
+ //console.log("lowBitsLength = " + lowBitsLength);
1433
+
1434
+ var highBitsPointer,
1435
+ lowBitsCount = 0,
1436
+ lowBits = 0,
1437
+ cb = 1;
1438
+
1439
+ for(
1440
+ highBitsPointer = Math.floor(lowBitsLength * listCount / 8 + 6);
1441
+ highBitsPointer < compressedBuffer.pointer;
1442
+ highBitsPointer++
1443
+ )
 
 
1444
  {
1445
+ docID += decodingTableHighBitsCarryover[cb];
1446
+ cb = compressedBuffer[highBitsPointer];
1447
+
1448
+ docIDNumber = decodingTableDocIDNumber[cb];
1449
+
1450
+ for(var i = 0; i < docIDNumber; i++)
1451
+ {
1452
+ docID <<= lowBitsCount;
1453
+ docID |= lowBits & ((1 << lowBitsCount) - 1);
1454
+
1455
+ while(lowBitsCount < lowBitsLength)
1456
+ {
1457
+ docID <<= 8;
1458
+
1459
+ lowBits = compressedBuffer[lowBitsPointer++];
1460
+ docID |= lowBits;
1461
+ lowBitsCount += 8;
1462
+ }
1463
+
1464
+ lowBitsCount -= lowBitsLength;
1465
+ docID >>= lowBitsCount;
1466
+
1467
+ docID += (decodingTableHighBits[cb][i] << lowBitsLength) + lastDocID + 1;
1468
+
1469
+ list[resultPointer++] = docID;
1470
+
1471
+ lastDocID = docID;
1472
+ docID = 0;
1473
+ }
1474
  }
1475
 
1476
+ return list;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1477
  }
1478
 
1479
+ });
1480
+
1481
+ // js/v8/event-dispatcher.js
1482
+ /**
1483
+ * @namespace WPGMZA
1484
+ * @module EventDispatcher
1485
+ * @requires WPGMZA
1486
+ */
1487
+ jQuery(function($) {
 
 
 
 
1488
 
1489
  /**
1490
+ * Base class for any (non HTMLElement) object which dispatches or listens for events
1491
+ * @class WPGMZA.EventDispatcher
1492
+ * @constructor WPGMZA.EventDispatcher
1493
+ * @memberof WPGMZA
1494
  */
1495
+ WPGMZA.EventDispatcher = function()
1496
+ {
1497
+ WPGMZA.assertInstanceOf(this, "EventDispatcher");
1498
+
1499
+ this._listenersByType = {};
1500
+ }
1501
+
1502
  /**
1503
+ * Adds an event listener on this object
1504
  * @method
1505
+ * @memberof WPGMZA.EventDispatcher
1506
+ * @param {string} type The event type, or multiple types separated by spaces
1507
+ * @param {function} callback The callback to call when the event fires
1508
+ * @param {object} [thisObject] The object to use as "this" when firing the callback
1509
+ * @param {bool} [useCapture] If true, fires the callback on the capture phase, as opposed to bubble phase
1510
  */
1511
+ WPGMZA.EventDispatcher.prototype.addEventListener = function(type, listener, thisObject, useCapture)
1512
  {
1513
+ var types = type.split(/\s+/);
1514
+ if(types.length > 1)
1515
  {
1516
+ for(var i = 0; i < types.length; i++)
1517
+ this.addEventListener(types[i], listener, thisObject, useCapture);
1518
+
1519
+ return;
 
 
 
1520
  }
1521
+
1522
+ if(!(listener instanceof Function))
1523
+ throw new Error("Listener must be a function");
1524
 
1525
+ var target;
1526
+ if(!this._listenersByType.hasOwnProperty(type))
1527
+ target = this._listenersByType[type] = [];
1528
+ else
1529
+ target = this._listenersByType[type];
1530
+
1531
+ var obj = {
1532
+ listener: listener,
1533
+ thisObject: (thisObject ? thisObject : this),
1534
+ useCapture: (useCapture ? true : false)
1535
+ };
1536
+
1537
+ target.push(obj);
1538
+ }
1539
+
1540
  /**
1541
+ * Alias for addEventListener
1542
  * @method
1543
+ * @memberof WPGMZA.EventDispatcher
1544
+ * @see WPGMZA.EventDispatcher#addEventListener
1545
  */
1546
+ WPGMZA.EventDispatcher.prototype.on = WPGMZA.EventDispatcher.prototype.addEventListener;
1547
+
 
 
 
 
1548
  /**
1549
+ * Removes event listeners from this object
1550
  * @method
1551
+ * @memberof WPGMZA.EventDispatcher
1552
+ * @param {string} type The event type to remove listeners from
1553
+ * @param {function} [listener] The function to remove. If omitted, all listeners will be removed
1554
+ * @param {object} [thisObject] Use the parameter to remove listeners bound with the same thisObject
1555
+ * @param {bool} [useCapture] Remove the capture phase event listener. Otherwise, the bubble phase event listener will be removed.
1556
  */
1557
+ WPGMZA.EventDispatcher.prototype.removeEventListener = function(type, listener, thisObject, useCapture)
1558
  {
1559
+ var arr, index, obj;
1560
+
1561
+ if(!(arr = this._listenersByType[type]))
1562
+ return;
 
 
 
1563
 
1564
+ if(!thisObject)
1565
+ thisObject = this;
1566
 
1567
+ useCapture = (useCapture ? true : false);
1568
+
1569
+ for(var i = 0; i < arr.length; i++)
1570
+ {
1571
+ obj = arr[i];
1572
+
1573
+ if((arguments.length == 1 || obj.listener == listener) && obj.thisObject == thisObject && obj.useCapture == useCapture)
1574
+ {
1575
+ arr.splice(i, 1);
1576
+ return;
1577
+ }
1578
  }
1579
  }
1580
+
1581
  /**
1582
+ * Alias for removeEventListener
1583
  * @method
1584
+ * @memberof WPGMZA.EventDispatcher
1585
+ * @see WPGMZA.EventDispatcher#removeEventListener
 
 
1586
  */
1587
+ WPGMZA.EventDispatcher.prototype.off = WPGMZA.EventDispatcher.prototype.removeEventListener;
1588
+
 
 
 
 
1589
  /**
1590
+ * Test for listeners of type on this object
1591
  * @method
1592
+ * @memberof WPGMZA.EventDispatcher
1593
+ * @param {string} type The event type to test for
1594
+ * @return {bool} True if this object has listeners bound for the specified type
 
1595
  */
1596
+ WPGMZA.EventDispatcher.prototype.hasEventListener = function(type)
1597
  {
1598
+ return (_listenersByType[type] ? true : false);
 
 
 
 
 
1599
  }
 
 
 
 
 
 
 
 
 
 
1600
 
1601
  /**
1602
+ * Fires an event on this object
1603
+ * @method
1604
+ * @memberof WPGMZA.EventDispatcher
1605
+ * @param {string|WPGMZA.Event} event Either the event type as a string, or an instance of WPGMZA.Event
1606
  */
1607
+ WPGMZA.EventDispatcher.prototype.dispatchEvent = function(event) {
1608
+
1609
+ if(!(event instanceof WPGMZA.Event)) {
1610
+ if(typeof event == "string")
1611
+ event = new WPGMZA.Event(event);
1612
+ else
1613
+ {
1614
+ var src = event;
1615
+ event = new WPGMZA.Event();
1616
+ for(var name in src)
1617
+ event[name] = src[name];
1618
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1619
  }
1620
+
1621
+
1622
+
1623
+ event.target = this;
1624
+
1625
+ var path = [];
1626
+ for(var obj = this.parent; obj != null; obj = obj.parent)
1627
+ path.unshift(obj);
1628
 
1629
+ event.phase = WPGMZA.Event.CAPTURING_PHASE;
1630
+ for(var i = 0; i < path.length && !event._cancelled; i++)
1631
+ path[i]._triggerListeners(event);
1632
+
1633
+ if(event._cancelled)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1634
  return;
1635
+
1636
+ event.phase = WPGMZA.Event.AT_TARGET;
1637
+ this._triggerListeners(event);
1638
+
1639
+ event.phase = WPGMZA.Event.BUBBLING_PHASE;
1640
+ for(i = path.length - 1; i >= 0 && !event._cancelled; i--)
1641
+ path[i]._triggerListeners(event);
1642
 
1643
+ // Native DOM event
1644
+ var topMostElement = this.element;
1645
+ for(var obj = this.parent; obj != null; obj = obj.parent)
1646
  {
1647
+ if(obj.element)
1648
+ topMostElement = obj.element;
1649
  }
1650
+
1651
+ if(topMostElement)
1652
  {
1653
+ var customEvent = {};
1654
+
1655
+ for(var key in event)
1656
+ {
1657
+ var value = event[key];
1658
+
1659
+ if(key == "type")
1660
+ value += ".wpgmza";
1661
+
1662
+ customEvent[key] = value;
1663
+ }
1664
+ $(topMostElement).trigger(customEvent);
1665
  }
1666
  }
1667
+
1668
  /**
1669
+ * Alias for removeEventListener
1670
  * @method
1671
+ * @memberof WPGMZA.EventDispatcher
1672
+ * @see WPGMZA.EventDispatcher#removeEventListener
 
1673
  */
1674
+ WPGMZA.EventDispatcher.prototype.trigger = WPGMZA.EventDispatcher.prototype.dispatchEvent;
1675
+
1676
+ /**
1677
+ * Handles the logic of triggering listeners
1678
+ * @method
1679
+ * @memberof WPGMZA.EventDispatcher
1680
+ * @inner
1681
+ */
1682
+ WPGMZA.EventDispatcher.prototype._triggerListeners = function(event)
1683
  {
1684
+ var arr, obj;
1685
 
1686
+ if(!(arr = this._listenersByType[event.type]))
1687
  return;
1688
+
1689
+ for(var i = 0; i < arr.length; i++)
1690
+ {
1691
+ obj = arr[i];
1692
+
1693
+ if(event.phase == WPGMZA.Event.CAPTURING_PHASE && !obj.useCapture)
1694
+ continue;
1695
+
1696
+ obj.listener.call(arr[i].thisObject, event);
1697
+ }
1698
+ }
1699
+
1700
+ WPGMZA.events = new WPGMZA.EventDispatcher();
1701
+
1702
+ });
1703
+
1704
+ // js/v8/address-input.js
1705
+ /**
1706
+ * @namespace WPGMZA
1707
+ * @module AddressInput
1708
+ * @requires WPGMZA.EventDispatcher
1709
+ */
1710
+ jQuery(function($) {
1711
+
1712
+ WPGMZA.AddressInput = function(element, map)
1713
+ {
1714
+ if(!(element instanceof HTMLInputElement))
1715
+ throw new Error("Element is not an instance of HTMLInputElement");
1716
 
1717
+ this.element = element;
1718
+
1719
+
1720
 
1721
+ var json;
1722
+ var options = {
1723
+ fields: ["name", "formatted_address"],
1724
+ types: ["geocode", "establishment"]
1725
+ };
1726
 
1727
+ if(json = $(element).attr("data-autocomplete-options"))
1728
+ options = $.extend(options, JSON.parse(json));
1729
 
1730
+ if(map && map.settings.wpgmza_store_locator_restrict)
1731
+ options.country = map.settings.wpgmza_store_locator_restrict;
1732
+
1733
+ if(WPGMZA.isGoogleAutocompleteSupported()) {
1734
+ // only apply Google Places Autocomplete if they are usig their own API key. If not, they will use our Cloud API Complete Service
1735
+ if (this.id != 'wpgmza_add_address_map_editor' && WPGMZA_localized_data.settings.googleMapsApiKey && WPGMZA_localized_data.settings.googleMapsApiKey !== '') {
1736
+ element.googleAutoComplete = new google.maps.places.Autocomplete(element, options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1737
 
1738
+ if(options.country)
1739
+ element.googleAutoComplete.setComponentRestrictions({country: options.country});
1740
  }
 
 
1741
  }
1742
+ else if(WPGMZA.CloudAPI && WPGMZA.CloudAPI.isBeingUsed)
1743
+ element.cloudAutoComplete = new WPGMZA.CloudAutocomplete(element, options);
1744
+ }
1745
+
1746
+ WPGMZA.extend(WPGMZA.AddressInput, WPGMZA.EventDispatcher);
1747
+
1748
+ WPGMZA.AddressInput.createInstance = function(element, map) {
1749
+ return new WPGMZA.AddressInput(element, map);
1750
+ }
1751
+
1752
+ /*$(window).on("load", function(event) {
1753
 
1754
+ $("input.wpgmza-address").each(function(index, el) {
1755
+
1756
+ el.wpgmzaAddressInput = WPGMZA.AddressInput.createInstance(el);
1757
+
1758
+ });
1759
 
1760
+ });*/
1761
+
1762
+ });
1763
+
1764
+ // js/v8/drawing-manager.js
1765
+ /**
1766
+ * @namespace WPGMZA
1767
+ * @module DrawingManager
1768
+ * @requires WPGMZA.EventDispatcher
1769
+ */
1770
+ jQuery(function($) {
1771
+
1772
+ WPGMZA.DrawingManager = function(map)
1773
+ {
1774
+ WPGMZA.assertInstanceOf(this, "DrawingManager");
1775
 
1776
+ WPGMZA.EventDispatcher.call(this);
1777
+
1778
+ this.map = map;
1779
+ this.mode = WPGMZA.DrawingManager.MODE_NONE;
1780
+ }
1781
+
1782
+ WPGMZA.DrawingManager.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
1783
+ WPGMZA.DrawingManager.prototype.constructor = WPGMZA.DrawingManager;
1784
+
1785
+ WPGMZA.DrawingManager.MODE_NONE = null;
1786
+ WPGMZA.DrawingManager.MODE_MARKER = "marker";
1787
+ WPGMZA.DrawingManager.MODE_POLYGON = "polygon";
1788
+ WPGMZA.DrawingManager.MODE_POLYLINE = "polyline";
1789
+ WPGMZA.DrawingManager.MODE_CIRCLE = "circle";
1790
+ WPGMZA.DrawingManager.MODE_RECTANGLE = "rectangle";
1791
+ WPGMZA.DrawingManager.MODE_HEATMAP = "heatmap";
1792
+
1793
+ WPGMZA.DrawingManager.getConstructor = function()
1794
+ {
1795
+ switch(WPGMZA.settings.engine)
1796
  {
1797
+ case "google-maps":
1798
+ return WPGMZA.GoogleDrawingManager;
 
1799
  break;
1800
 
1801
  default:
1802
+ return WPGMZA.OLDrawingManager;
1803
  break;
1804
+ }
1805
+ }
1806
+
1807
+ WPGMZA.DrawingManager.createInstance = function(map)
1808
+ {
1809
+ var constructor = WPGMZA.DrawingManager.getConstructor();
1810
+ return new constructor(map);
1811
+ }
1812
+
1813
+ WPGMZA.DrawingManager.prototype.setDrawingMode = function(mode) {
1814
 
1815
+ this.mode = mode;
1816
+
1817
+ this.trigger("drawingmodechanged");
1818
+ }
1819
+
1820
+ });
1821
+
1822
+ // js/v8/event.js
1823
+ /**
1824
+ * @namespace WPGMZA
1825
+ * @module Event
1826
+ * @requires WPGMZA
1827
+ */
1828
+ jQuery(function($) {
1829
+
1830
+ /**
1831
+ * Base class used for events (for non-HTMLElement objects)
1832
+ * @class WPGMZA.Event
1833
+ * @constructor WPGMZA.Event
1834
+ * @memberof WPGMZA
1835
+ * @param {string|object} options The event type as a string, or an object of options to be mapped to this event
1836
+ */
1837
+ WPGMZA.Event = function(options)
1838
+ {
1839
+ if(typeof options == "string")
1840
+ this.type = options;
1841
+
1842
+ this.bubbles = true;
1843
+ this.cancelable = true;
1844
+ this.phase = WPGMZA.Event.PHASE_CAPTURE;
1845
+ this.target = null;
1846
 
1847
+ this._cancelled = false;
1848
 
1849
+ if(typeof options == "object")
1850
+ for(var name in options)
1851
+ this[name] = options[name];
1852
  }
 
 
1853
 
1854
+ WPGMZA.Event.CAPTURING_PHASE = 0;
1855
+ WPGMZA.Event.AT_TARGET = 1;
1856
+ WPGMZA.Event.BUBBLING_PHASE = 2;
1857
+
1858
+ /**
1859
+ * Prevents any further propagation of this event
1860
+ * @method
1861
+ * @memberof WPGMZA.Event
1862
+ */
1863
+ WPGMZA.Event.prototype.stopPropagation = function()
1864
+ {
1865
+ this._cancelled = true;
1866
+ }
1867
+
1868
  });
1869
 
1870
+ // js/v8/fancy-controls.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1871
  /**
1872
  * @namespace WPGMZA
1873
+ * @module FancyControls
1874
  * @requires WPGMZA
1875
  */
1876
  jQuery(function($) {
1877
+
1878
+ WPGMZA.FancyControls = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1879
 
1880
+ formatToggleSwitch: function(el)
1881
  {
1882
+ var div = $("<div class='switch'></div>");
1883
+ var input = el;
1884
+ var container = el.parentNode;
1885
+ var text = $(container).text().trim();
1886
+ var label = $("<label></label>");
1887
 
1888
+ $(input).addClass("cmn-toggle cmn-toggle-round-flat");
1889
+ $(input).attr("id", $(input).attr("name"));
 
 
 
 
 
 
 
 
 
 
1890
 
1891
+ $(label).attr("for", $(input).attr("name"));
 
1892
 
1893
+ $(div).append(input);
1894
+ $(div).append(label);
1895
+
1896
+ $(container).replaceWith(div);
1897
+
1898
+ $(div).wrap($("<div></div>"));
1899
+ $(div).after(text);
1900
+ },
1901
+
1902
+ formatToggleButton: function(el)
1903
  {
1904
+ var div = $("<div class='switch'></div>");
1905
+ var input = el;
1906
+ var container = el.parentNode;
1907
+ var text = $(container).text().trim();
1908
+ var label = $("<label></label>");
1909
+
1910
+ $(input).addClass("cmn-toggle cmn-toggle-yes-no");
1911
+ $(input).attr("id", $(input).attr("name"));
1912
+
1913
+ $(label).attr("for", $(input).attr("name"));
1914
+
1915
+ $(label).attr("data-on", WPGMZA.localized_strings.yes);
1916
+ $(label).attr("data-off", WPGMZA.localized_strings.no);
1917
+
1918
+ $(div).append(input);
1919
+ $(div).append(label);
1920
+
1921
+ $(container).replaceWith(div);
1922
+
1923
+ $(div).wrap($("<div></div>"));
1924
+ $(div).after(text);
1925
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1926
 
1927
+ };
 
 
 
 
1928
 
1929
+ $(".wpgmza-fancy-toggle-switch").each(function(index, el) {
1930
+ WPGMZA.FancyControls.formatToggleSwitch(el);
1931
+ });
 
 
 
 
1932
 
1933
+ $(".wpgmza-fancy-toggle-button").each(function(index, el) {
1934
+ WPGMZA.FancyControls.formatToggleButton(el);
 
 
 
 
 
 
 
 
 
 
 
 
1935
  });
1936
 
1937
+ });
1938
+
1939
+ // js/v8/feature.js
1940
+ /**
1941
+ * @namespace WPGMZA
1942
+ * @module Feature
1943
+ * @requires WPGMZA.EventDispatcher
1944
+ */
1945
+ jQuery(function($) {
1946
+
1947
  /**
1948
+ * Base class for featuers (formerlly MapObjects), that is, markers, polygons, polylines, circles, rectangles and heatmaps. Implements functionality shared by all map objects, such as parsing geometry and serialization.
1949
+ * @class WPGMZA.Feature
1950
+ * @constructor WPGMZA.Feature
1951
+ * @memberof WPGMZA
1952
+ * @augments WPGMZA.EventDispatcher
1953
  */
1954
+ WPGMZA.Feature = function(options)
 
 
 
 
 
 
 
 
 
 
 
1955
  {
1956
+ var self = this;
 
1957
 
1958
+ WPGMZA.assertInstanceOf(this, "Feature");
1959
 
1960
+ WPGMZA.EventDispatcher.call(this);
1961
+
1962
+ this.id = -1;
1963
+
1964
+ for(var key in options)
1965
+ this[key] = options[key];
1966
  }
1967
 
1968
+ WPGMZA.extend(WPGMZA.Feature, WPGMZA.EventDispatcher);
1969
+
1970
+ // NB: Legacy compatibility
1971
+ WPGMZA.MapObject = WPGMZA.Feature;
 
 
 
 
 
 
1972
 
1973
  /**
1974
+ * Scans a string for all floating point numbers and build an array of latitude and longitude literals from the matched numbers
 
1975
  * @method
1976
+ * @memberof WPGMZA.Feature
1977
+ * @param {string} string The string to parse numbers from
1978
+ * @return {array} An array of LatLng literals parsed from the string
 
1979
  */
1980
+ WPGMZA.Feature.prototype.parseGeometry = function(subject)
1981
  {
1982
+ // TODO: Rename "subject" to "subject". It's unclear right now
 
1983
 
1984
+ if(typeof subject == "string" && subject.match(/^\[/))
1985
+ {
1986
+ try{
1987
+
1988
+ var json = JSON.parse(subject);
1989
+ subject = json;
1990
+
1991
+ }catch(e) {
1992
+ // Continue execution
1993
+ }
1994
+ }
1995
 
1996
+ if(typeof subject == "object")
1997
+ {
1998
+ var arr = subject;
1999
 
2000
+ for(var i = 0; i < arr.length; i++)
2001
+ {
2002
+ arr[i].lat = parseFloat(arr[i].lat);
2003
+ arr[i].lng = parseFloat(arr[i].lng);
2004
+ }
2005
+
2006
+ return arr;
2007
+ }
2008
+ else if(typeof subject == "string")
2009
+ {
2010
+ // Guessing old format
2011
+ var stripped, pairs, coords, results = [];
2012
 
2013
+ stripped = subject.replace(/[^ ,\d\.\-+e]/g, "");
2014
+ pairs = stripped.split(",");
2015
+
2016
+ for(var i = 0; i < pairs.length; i++)
2017
  {
2018
+ coords = pairs[i].split(" ");
2019
+ results.push({
2020
+ lat: parseFloat(coords[1]),
2021
+ lng: parseFloat(coords[0])
 
 
 
 
 
 
 
2022
  });
2023
+ }
 
 
 
 
2024
 
2025
+ return results;
2026
+ }
2027
+
2028
+ throw new Error("Invalid geometry");
2029
  }
2030
 
2031
+ WPGMZA.Feature.prototype.setOptions = function(options)
 
 
 
 
 
 
 
 
2032
  {
2033
+ for(var key in options)
2034
+ this[key] = options[key];
2035
+
2036
+
2037
+ this.updateNativeFeature();
2038
  }
2039
 
2040
+ WPGMZA.Feature.prototype.setEditable = function(editable)
2041
  {
2042
+ this.setOptions({
2043
+ editable: editable
 
 
 
 
 
 
 
 
 
 
2044
  });
 
 
2045
  }
2046
 
2047
+ WPGMZA.Feature.prototype.setDraggable = function(draggable)
 
 
 
 
 
 
2048
  {
2049
+ this.setOptions({
2050
+ draggable: draggable
 
2051
  });
2052
+
2053
+ // this.layer.setVisible(visible ? true : false);
2054
  }
2055
 
2056
+ WPGMZA.Feature.prototype.getScalarProperties = function()
2057
  {
2058
+ var options = {};
2059
+
2060
+ for(var key in this)
2061
+ {
2062
+ switch(typeof this[key])
2063
+ {
2064
+ case "number":
2065
+ options[key] = parseFloat(this[key]);
2066
+ break;
2067
+
2068
+ case "boolean":
2069
+ case "string":
2070
+ options[key] = this[key];
2071
+ break;
2072
+
2073
+ default:
2074
+ break;
2075
+ }
2076
+ }
2077
+
2078
+ return options;
2079
+ }
2080
+
2081
+ WPGMZA.Feature.prototype.updateNativeFeature = function()
2082
+ {
2083
+ // NB: Because we don't have different base classes for GoogleFeature and OLFeature*, it's necessary to have an if/else here. This design pattern should be avoided wherever possible. Prefer adding engine specific code on the OL / Google modules.
2084
+ // * - OLFeature is actually a class, but nothing extends from it. It's purely provided as a utility.
2085
+
2086
+ var props = this.getScalarProperties();
2087
+
2088
+ switch(WPGMZA.settings.engine)
2089
+ {
2090
+ case "open-layers":
2091
+
2092
+ // The native properties (strokeColor, fillOpacity, etc) have to be translated for OpenLayers.
2093
+ if(this.layer){
2094
+ this.layer.setStyle(WPGMZA.OLFeature.getOLStyle(props));
2095
+ }
2096
+ break;
2097
+
2098
+ default:
2099
+
2100
+ // For Google, because the native properties share the same name as the Google properties, we can just pass them straight in
2101
+
2102
+ this.googleFeature.setOptions(props);
2103
+
2104
+ break;
2105
+ }
2106
  }
2107
 
2108
+ });
2109
+
2110
+ // js/v8/circle.js
2111
+ /**
2112
+ * @namespace WPGMZA
2113
+ * @module Circle
2114
+ * @requires WPGMZA.Feature
2115
+ */
2116
+ jQuery(function($) {
2117
+
2118
+ var Parent = WPGMZA.Feature;
2119
+
2120
  /**
2121
+ * Base class for circles. <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.
2122
+ * @class WPGMZA.Circle
2123
+ * @constructor WPGMZA.Circle
2124
+ * @memberof WPGMZA
2125
+ * @augments WPGMZA.Feature
2126
+ * @see WPGMZA.Circle.createInstance
2127
  */
2128
+ WPGMZA.Circle = function(options, engineCircle)
2129
  {
2130
+ var self = this;
2131
 
2132
+ WPGMZA.assertInstanceOf(this, "Circle");
 
2133
 
2134
+ this.center = new WPGMZA.LatLng();
2135
+ this.radius = 100;
2136
 
2137
+ Parent.apply(this, arguments);
2138
+ }
2139
+
2140
+ WPGMZA.extend(WPGMZA.Circle, WPGMZA.Feature);
2141
+
2142
+ Object.defineProperty(WPGMZA.Circle.prototype, "fillColor", {
2143
 
2144
+ enumerable: true,
 
 
 
 
2145
 
2146
+ "get": function()
2147
+ {
2148
+ if(!this.color || !this.color.length)
2149
+ return "#ff0000";
2150
+
2151
+ return this.color;
2152
+ },
2153
+ "set" : function(a){
2154
+ this.color = a;
2155
+ }
2156
+
2157
+ });
2158
 
2159
+ Object.defineProperty(WPGMZA.Circle.prototype, "fillOpacity", {
2160
+
2161
+ enumerable: true,
 
 
 
 
 
 
 
 
 
2162
 
2163
+ "get": function()
2164
+ {
2165
+ if(!this.opacity && this.opacity != 0)
2166
+ return 0.5;
2167
+
2168
+ return parseFloat(this.opacity);
2169
+ },
2170
+ "set": function(a){
2171
+ this.opacity = a;
2172
+ }
2173
+
2174
+ });
2175
+
2176
+ Object.defineProperty(WPGMZA.Circle.prototype, "strokeColor", {
2177
 
2178
+ enumerable: true,
 
2179
 
2180
+ "get": function()
2181
+ {
2182
+ if(!this.lineColor){
2183
+ return "#000000";
2184
+ }
2185
+ return this.lineColor;
2186
+ },
2187
+ "set": function(a){
2188
+ this.lineColor = a;
2189
+ }
 
 
2190
 
2191
+ });
 
2192
 
2193
+ Object.defineProperty(WPGMZA.Circle.prototype, "strokeOpacity", {
2194
+
2195
+ enumerable: true,
2196
+
2197
+ "get": function()
2198
+ {
2199
+ if(!this.lineOpacity && this.lineOpacity != 0)
2200
+ return 0;
2201
+
2202
+ return parseFloat(this.lineOpacity);
2203
+ },
2204
+ "set": function(a){
2205
+ this.lineOpacity = a;
2206
+ }
2207
+
2208
+ });
2209
 
2210
  /**
2211
+ * Creates an instance of a circle, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
2212
+ * @method
2213
+ * @memberof WPGMZA.Circle
2214
+ * @param {object} options Options for the object (optional)
 
2215
  */
2216
+ WPGMZA.Circle.createInstance = function(options, engineCircle)
2217
  {
2218
+ var constructor;
2219
 
2220
+ switch(WPGMZA.settings.engine)
 
 
 
 
 
 
 
 
2221
  {
2222
+ case "open-layers":
2223
+ constructor = WPGMZA.OLCircle;
2224
+ break;
2225
+
2226
+ default:
2227
+ constructor = WPGMZA.GoogleCircle;
2228
+ break;
2229
  }
2230
+
2231
+ return new constructor(options, engineCircle);
2232
  }
2233
 
2234
+ /**
2235
+ * Gets the circles center
2236
+ *
2237
+ * @method
2238
+ * @memberof WPGMZA.Circle
2239
+ * @returns {WPGMZA.LatLng}
2240
+ */
2241
+ WPGMZA.Circle.prototype.getCenter = function()
2242
  {
2243
+ return this.center.clone();
 
 
 
 
 
 
 
 
 
 
 
 
2244
  }
2245
 
2246
+ /**
2247
+ * Sets the circles center
2248
+ *
2249
+ * @method
2250
+ * @memberof WPGMZA.Circle
2251
+ * @param {object|WPGMZA.LatLng} latLng either a literal or as a WPGMZA.LatLng
2252
+ */
2253
+ WPGMZA.Circle.prototype.setCenter = function(latLng)
2254
  {
2255
+ this.center.lat = latLng.lat;
2256
+ this.center.lng = latLng.lng;
 
 
 
 
 
 
 
 
 
2257
  }
2258
 
2259
  /**
2260
+ * Gets the circles radius, in kilometers
2261
+ *
2262
  * @method
2263
+ * @memberof WPGMZA.Circle
2264
+ * @param {object|WPGMZA.LatLng} latLng either a literal or as a WPGMZA.LatLng
2265
+ * @returns {WPGMZA.LatLng}
2266
  */
2267
+ WPGMZA.Circle.prototype.getRadius = function()
2268
  {
2269
+ return this.radius;
2270
  }
2271
 
2272
  /**
2273
+ * Sets the circles radius, in kilometers
2274
+ *
2275
  * @method
2276
+ * @memberof WPGMZA.Circle
2277
+ * @param {number} radius The radius
2278
+ * @returns {void}
2279
  */
2280
+ WPGMZA.Circle.prototype.setRadius = function(radius)
2281
  {
2282
+ this.radius = radius;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2283
  }
2284
 
2285
+ /**
2286
+ * Returns the map that this circle is being displayed on
2287
+ *
2288
+ * @method
2289
+ * @memberof WPGMZA.Circle
2290
+ * @return {WPGMZA.Map}
2291
+ */
2292
+ WPGMZA.Circle.prototype.getMap = function()
2293
  {
2294
+ return this.map;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2295
  }
2296
 
2297
+ /**
2298
+ * Puts this circle on a map
2299
+ *
2300
+ * @method
2301
+ * @memberof WPGMZA.Circle
2302
+ * @param {WPGMZA.Map} map The target map
2303
+ * @return {void}
2304
+ */
2305
+ WPGMZA.Circle.prototype.setMap = function(map)
2306
  {
2307
+ if(this.map)
2308
+ this.map.removeCircle(this);
 
 
 
 
 
 
 
 
 
 
 
2309
 
2310
+ if(map)
2311
+ map.addCircle(this);
2312
+
2313
  }
2314
 
2315
+ });
2316
+
2317
+ // js/v8/friendly-error.js
2318
+ /**
2319
+ * @namespace WPGMZA
2320
+ * @module FriendlyError
2321
+ * @requires WPGMZA
2322
+ */
2323
+ jQuery(function($) {
2324
+
2325
+ /**
2326
+ * Deprecated
2327
+ * @class WPGMZA.FriendlyError
2328
+ * @constructor WPGMZA.FriendlyError
2329
+ * @memberof WPGMZA
2330
+ * @deprecated
2331
+ */
2332
+ WPGMZA.FriendlyError = function()
2333
  {
2334
+
2335
  }
2336
 
2337
+ /*var template = '\
2338
+ <div class="notice notice-error"> \
2339
+ <p> \
2340
+ ' + WPGMZA.localized_strings.friendly_error + ' \
2341
+ </p> \
2342
+ <pre style="white-space: pre-line;"></pre> \
2343
+ <div> \
2344
+ ';
2345
+
2346
+ WPGMZA.FriendlyError = function(nativeError)
2347
  {
2348
+ if(!WPGMZA.is_admin)
2349
+ {
2350
+ this.element = $(WPGMZA.preloaderHTML);
2351
+ $(this.element).removeClass("animated");
2352
+ return;
2353
+ }
2354
+
2355
+ $("#wpgmza-map-edit-page>.wpgmza-preloader").remove();
2356
+
2357
+ this.element = $(template);
2358
+ this.element.find("pre").html(nativeError.message + "\r\n" + nativeError.stack + "\r\n\r\n on " + window.location.href);
2359
+ }*/
2360
 
2361
  });
2362
 
2363
+ // js/v8/geocoder.js
2364
  /**
2365
  * @namespace WPGMZA
2366
+ * @module Geocoder
2367
  * @requires WPGMZA
2368
  */
2369
+ jQuery(function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2370
 
2371
+ /**
2372
+ * Base class for geocoders. <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.
2373
+ * @class WPGMZA.Geocoder
2374
+ * @constructor WPGMZA.Geocoder
2375
+ * @memberof WPGMZA
2376
+ * @see WPGMZA.Geocoder.createInstance
2377
+ */
2378
+ WPGMZA.Geocoder = function()
2379
  {
2380
+ WPGMZA.assertInstanceOf(this, "Geocoder");
2381
+ }
2382
+
2383
+ /**
2384
+ * Indicates a successful geocode, with one or more results
2385
+ * @constant SUCCESS
2386
+ * @memberof WPGMZA.Geocoder
2387
+ */
2388
+ WPGMZA.Geocoder.SUCCESS = "success";
2389
+
2390
+ /**
2391
+ * Indicates the geocode was successful, but returned no results
2392
+ * @constant ZERO_RESULTS
2393
+ * @memberof WPGMZA.Geocoder
2394
+ */
2395
+ WPGMZA.Geocoder.ZERO_RESULTS = "zero-results";
2396
+
2397
+ /**
2398
+ * Indicates the geocode failed, usually due to technical reasons (eg connectivity)
2399
+ * @constant FAIL
2400
+ * @memberof WPGMZA.Geocoder
2401
+ */
2402
+ WPGMZA.Geocoder.FAIL = "fail";
2403
+
2404
+ /**
2405
+ * Returns the contructor to be used by createInstance, depending on the selected maps engine.
2406
+ * @method
2407
+ * @memberof WPGMZA.Geocoder
2408
+ * @return {function} The appropriate contructor
2409
+ */
2410
+ WPGMZA.Geocoder.getConstructor = function()
2411
+ {
2412
+ switch(WPGMZA.settings.engine)
2413
  {
2414
+ case "open-layers":
2415
+ return WPGMZA.OLGeocoder;
2416
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2417
 
2418
+ default:
2419
+ return WPGMZA.GoogleGeocoder;
2420
+ break;
2421
+ }
2422
  }
2423
 
2424
+ /**
2425
+ * Creates an instance of a Geocoder, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>
2426
+ * @method
2427
+ * @memberof WPGMZA.Geocoder
2428
+ * @return {WPGMZA.Geocoder} A subclass of WPGMZA.Geocoder
2429
+ */
2430
+ WPGMZA.Geocoder.createInstance = function()
2431
+ {
2432
+ var constructor = WPGMZA.Geocoder.getConstructor();
2433
+ return new constructor();
 
 
2434
  }
2435
+
2436
+ /**
2437
+ * Attempts to convert a street address to an array of potential coordinates that match the address, which are passed to a callback. If the address is interpreted as a latitude and longitude coordinate pair, the callback is immediately fired.
2438
+ * @method
2439
+ * @memberof WPGMZA.Geocoder
2440
+ * @param {object} options The options to geocode, address is mandatory.
2441
+ * @param {function} callback The callback to receive the geocode result.
2442
+ * @return {void}
2443
+ */
2444
+ WPGMZA.Geocoder.prototype.getLatLngFromAddress = function(options, callback)
2445
+ {
2446
+ if(WPGMZA.isLatLngString(options.address))
2447
+ {
2448
+ var parts = options.address.split(/,\s*/);
2449
+ var latLng = new WPGMZA.LatLng({
2450
+ lat: parseFloat(parts[0]),
2451
+ lng: parseFloat(parts[1])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2452
  });
2453
+
2454
+ // NB: Quick fix, solves issue with right click marker. Solve this there by making behaviour consistent
2455
+ latLng.latLng = latLng;
2456
+
2457
+ callback([latLng], WPGMZA.Geocoder.SUCCESS);
2458
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2459
  }
2460
 
2461
+ /**
2462
+ * Attempts to convert latitude eand longitude coordinates into a street address. By default this will simply return the coordinates wrapped in an array.
2463
+ * @method
2464
+ * @memberof WPGMZA.Geocoder
2465
+ * @param {object} options The options to geocode, latLng is mandatory.
2466
+ * @param {function} callback The callback to receive the geocode result.
2467
+ * @return {void}
2468
+ */
2469
+ WPGMZA.Geocoder.prototype.getAddressFromLatLng = function(options, callback)
2470
+ {
2471
+ var latLng = new WPGMZA.LatLng(options.latLng);
2472
+ callback([latLng.toString()], WPGMZA.Geocoder.SUCCESS);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2473
  }
2474
+
2475
+ /**
2476
+ * Geocodes either an address or a latitude and longitude coordinate pair, depending on the input
2477
+ * @method
2478
+ * @memberof WPGMZA.Geocoder
2479
+ * @param {object} options The options to geocode, you must supply <em>either</em> latLng <em>or</em> address.
2480
+ * @throws You must supply either a latLng or address
2481
+ * @return {void}
2482
+ */
2483
+ WPGMZA.Geocoder.prototype.geocode = function(options, callback)
2484
+ {
2485
+ if("address" in options)
2486
+ return this.getLatLngFromAddress(options, callback);
2487
+ else if("latLng" in options)
2488
+ return this.getAddressFromLatLng(options, callback);
2489
 
2490
+ throw new Error("You must supply either a latLng or address");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2491
  }
2492
+
2493
+ });
2494
+
2495
+ // js/v8/google-api-error-handler.js
2496
+ /**
2497
+ * @namespace WPGMZA
2498
+ * @module GoogleAPIErrorHandler
2499
+ * @requires WPGMZA
2500
+ */
2501
+ jQuery(function($) {
2502
 
2503
+ /**
2504
+ * This class catches Google Maps API errors and presents them in a friendly manner, before sending them on to the consoles default error handler.
2505
+ * @class WPGMZA.GoogleAPIErrorHandler
2506
+ * @constructor WPGMZA.GoogleAPIErrorHandler
2507
+ * @memberof WPGMZA
2508
+ */
2509
+ WPGMZA.GoogleAPIErrorHandler = function() {
2510
 
2511
+ var self = this;
2512
 
2513
+ // Don't do anything if Google isn't the selected API
2514
+ if(WPGMZA.settings.engine != "google-maps")
2515
  return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2516
 
2517
+ // Only allow on the map edit page, or front end if user has administrator role
2518
+ if(!(WPGMZA.currentPage == "map-edit" || (WPGMZA.is_admin == 0 && WPGMZA.userCanAdministrator == 1)))
 
2519
  return;
2520
+
2521
+ this.element = $(WPGMZA.html.googleMapsAPIErrorDialog);
2522
+
2523
+ if(WPGMZA.is_admin == 1)
2524
+ this.element.find(".wpgmza-front-end-only").remove();
2525
+
2526
+ this.errorMessageList = this.element.find(".wpgmza-google-api-error-list");
2527
+ this.templateListItem = this.element.find("li.template").remove();
2528
+
2529
+ this.messagesAlreadyDisplayed = {};
2530
+
2531
+ //if(WPGMZA.settings.developer_mode)
2532
+ //return;
2533
+
2534
+ // Override error function
2535
+ var _error = console.error;
2536
+
2537
+ console.error = function(message)
2538
+ {
2539
+ self.onErrorMessage(message);
2540
+
2541
+ _error.apply(this, arguments);
 
 
2542
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2543
 
2544
+ // Check for no API key
2545
+ if(
2546
+ WPGMZA.settings.engine == "google-maps"
2547
+ &&
2548
+ (!WPGMZA.settings.wpgmza_google_maps_api_key || !WPGMZA.settings.wpgmza_google_maps_api_key.length)
2549
+ &&
2550
+ WPGMZA.getCurrentPage() != WPGMZA.PAGE_MAP_EDIT
2551
+ )
2552
+ this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key, ["https://www.wpgmaps.com/documentation/creating-a-google-maps-api-key/"]);
2553
  }
2554
 
2555
+ /**
2556
+ * Overrides console.error to scan the error message for Google Maps API error messages.
2557
+ * @method
2558
+ * @memberof WPGMZA.GoogleAPIErrorHandler
2559
+ * @param {string} message The error message passed to the console
2560
+ */
2561
+ WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage = function(message)
2562
  {
2563
+ var m;
2564
+ var regexURL = /http(s)?:\/\/[^\s]+/gm;
2565
+
2566
+ if(!message)
2567
+ return;
2568
+
2569
+ 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: .+/)))
2570
+ {
2571
+ var urls = message.match(regexURL);
2572
+ this.addErrorMessage(m[0], urls);
2573
+ }
2574
+ else if(m = message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))
2575
+ {
2576
+ this.addErrorMessage(m[1].replace(/([A-Z])/g, " $1"), [m[2]]);
2577
+ }
2578
  }
2579
 
2580
+ /**
2581
+ * Called by onErrorMessage when a Google Maps API error is picked up, this will add the specified message to the Maps API error message dialog, along with URLs to compliment it. This function ignores duplicate error messages.
2582
+ * @method
2583
+ * @memberof WPGMZA.GoogleAPIErrorHandler
2584
+ * @param {string} message The message, or part of the message, intercepted from the console
2585
+ * @param {array} [urls] An array of URLs relating to the error message to compliment the message.
2586
+ */
2587
+ WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage = function(message, urls)
2588
+ {
2589
+ var self = this;
2590
 
2591
+ if(this.messagesAlreadyDisplayed[message])
2592
+ return;
2593
 
2594
+ var li = this.templateListItem.clone();
2595
+ $(li).find(".wpgmza-message").html(message);
2596
+
2597
+ var buttonContainer = $(li).find(".wpgmza-documentation-buttons");
2598
+
2599
+ var buttonTemplate = $(li).find(".wpgmza-documentation-buttons>a");
2600
+ buttonTemplate.remove();
2601
+
2602
+ if(urls && urls.length)
2603
+ {
2604
+ for(var i = 0; i < urls.length; i++)
2605
+ {
2606
+ var url = urls[i];
2607
+ var button = buttonTemplate.clone();
2608
+ var icon = "fa-external-link";
2609
+ var text = WPGMZA.localized_strings.documentation;
2610
+
2611
+ button.attr("href", urls[i]);
2612
+
2613
+ /*if(url.match(/google.+documentation/))
2614
+ {
2615
+ // icon = "fa-google";
2616
+ icon = "fa-wrench"
2617
+ }
2618
+ else if(url.match(/maps-no-account/))
2619
+ {
2620
+ icon = "fa-wrench"
2621
+ text = WPGMZA.localized_strings.verify_project;
2622
+ }
2623
+ else if(url.match(/console\.developers\.google/))
2624
+ {
2625
+ icon = "fa-wrench";
2626
+ text = WPGMZA.localized_strings.api_dashboard;
2627
+ }*/
2628
+
2629
+ $(button).find("i").addClass(icon);
2630
+ $(button).append(text);
2631
+ }
2632
+
2633
+ buttonContainer.append(button);
2634
+ }
2635
+
2636
+ $(this.errorMessageList).append(li);
2637
+
2638
+ /*if(!this.dialog)
2639
+ this.dialog = $(this.element).remodal();
2640
+
2641
+ switch(this.dialog.getState())
2642
+ {
2643
+ case "open":
2644
+ case "opened":
2645
+ case "opening":
2646
+ break;
2647
+
2648
+ default:
2649
+ this.dialog.open();
2650
+ break;
2651
+ }*/
2652
+
2653
+ $("#wpgmza_map, .wpgmza_map").each(function(index, el) {
2654
+
2655
+ var container = $(el).find(".wpgmza-google-maps-api-error-overlay");
2656
+
2657
+ if(container.length == 0)
2658
+ {
2659
+ container = $("<div class='wpgmza-google-maps-api-error-overlay'></div>");
2660
+ container.html(self.element.html());
2661
+ }
2662
+
2663
+ setTimeout(function() {
2664
+ $(el).append(container);
2665
+ }, 1000);
2666
+ });
2667
+
2668
+ $(".gm-err-container").parent().css({"z-index": 1});
2669
+
2670
+ this.messagesAlreadyDisplayed[message] = true;
2671
+ }
2672
 
2673
+ WPGMZA.googleAPIErrorHandler = new WPGMZA.GoogleAPIErrorHandler();
2674
+
2675
  });
2676
 
2677
+ // js/v8/info-window.js
2678
  /**
2679
  * @namespace WPGMZA
2680
+ * @module InfoWindow
2681
+ * @requires WPGMZA.EventDispatcher
2682
  */
2683
  jQuery(function($) {
2684
+
2685
+ /**
2686
+ * Base class for infoWindows. This acts as an abstract class so that infoWindows for both Google and OpenLayers can be interacted with seamlessly by the overlying logic. <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.
2687
+ * @class WPGMZA.InfoWindow
2688
+ * @constructor WPGMZA.InfoWindow
2689
+ * @memberof WPGMZA
2690
+ * @see WPGMZA.InfoWindow.createInstance
2691
+ */
2692
+ WPGMZA.InfoWindow = function(feature) {
2693
+ var self = this;
2694
+
2695
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2696
 
2697
+ WPGMZA.EventDispatcher.call(this);
 
 
 
 
 
 
 
 
 
 
 
2698
 
2699
+ WPGMZA.assertInstanceOf(this, "InfoWindow");
 
 
 
 
 
 
2700
 
2701
+ this.on("infowindowopen", function(event) {
2702
+ self.onOpen(event);
2703
+ });
 
 
 
 
2704
 
2705
+ if(!feature)
2706
+ return;
 
 
2707
 
2708
+ this.feature = feature;
2709
+ this.state = WPGMZA.InfoWindow.STATE_CLOSED;
 
 
 
 
 
2710
 
2711
+ if(feature.map)
 
 
2712
  {
2713
+ // This has to be slightly delayed so the map initialization won't overwrite the infowindow element
2714
+ setTimeout(function() {
2715
+ self.onFeatureAdded(event);
2716
+ }, 100);
2717
  }
2718
+ else
2719
+ feature.addEventListener("added", function(event) {
2720
+ self.onFeatureAdded(event);
2721
+ });
2722
  }
2723
+
2724
+
2725
+
2726
+ WPGMZA.InfoWindow.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
2727
+ WPGMZA.InfoWindow.prototype.constructor = WPGMZA.InfoWindow;
2728
+
2729
+ WPGMZA.InfoWindow.OPEN_BY_CLICK = 1;
2730
+ WPGMZA.InfoWindow.OPEN_BY_HOVER = 2;
2731
+
2732
+ WPGMZA.InfoWindow.STATE_OPEN = "open";
2733
+ WPGMZA.InfoWindow.STATE_CLOSED = "closed";
2734
 
2735
  /**
2736
+ * Fetches the constructor to be used by createInstance, based on the selected maps engine
2737
  * @method
2738
+ * @memberof WPGMZA.InfoWindow
2739
+ * @return {function} The appropriate constructor
2740
  */
2741
+ WPGMZA.InfoWindow.getConstructor = function()
2742
  {
2743
+ switch(WPGMZA.settings.engine)
 
 
 
2744
  {
2745
+ case "open-layers":
2746
+ if(WPGMZA.isProVersion())
2747
+ return WPGMZA.OLProInfoWindow;
2748
+ return WPGMZA.OLInfoWindow;
2749
+ break;
2750
 
2751
+ default:
2752
+ if(WPGMZA.isProVersion())
2753
+ return WPGMZA.GoogleProInfoWindow;
2754
+ return WPGMZA.GoogleInfoWindow;
2755
+ break;
2756
  }
2757
+ }
2758
+
2759
+ /**
2760
+ * Creates an instance of an InfoWindow, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>
2761
+ * @method
2762
+ * @memberof WPGMZA.InfoWindow
2763
+ * @param {object} options Options for the object (optional)
2764
+ */
2765
+ WPGMZA.InfoWindow.createInstance = function(feature)
2766
+ {
2767
+ var constructor = this.getConstructor();
2768
+ return new constructor(feature);
2769
+ }
2770
+
2771
+ Object.defineProperty(WPGMZA.InfoWindow.prototype, "content", {
2772
 
2773
+ "get": function()
2774
  {
2775
+ return this.getContent();
2776
+ },
2777
+
2778
+ "set": function(value)
2779
+ {
2780
+ this.contentHtml = value;
2781
  }
2782
+ });
2783
+
2784
+
2785
+ WPGMZA.InfoWindow.prototype.addEditButton = function() {
2786
+ if (WPGMZA.currentPage == "map-edit") {
2787
+ if(this.feature instanceof WPGMZA.Marker){
2788
+ return ' <a title="Edit this marker" style="width:15px;" class="wpgmza_edit_btn" data-edit-marker-id="'+this.feature.id+'"><i class="fa fa-edit"></i></a>';
2789
+ }
 
 
2790
  }
2791
+ return '';
2792
 
2793
+ }
2794
+
2795
+ WPGMZA.InfoWindow.prototype.workOutDistanceBetweenTwoMarkers = function(location1, location2) {
2796
+ if(!location1 || !location2)
2797
+ return; // No location (no search performed, user location unavailable)
2798
 
2799
+ var distanceInKM = WPGMZA.Distance.between(location1, location2);
2800
+ var distanceToDisplay = distanceInKM;
2801
+
2802
+ if(this.distanceUnits == WPGMZA.Distance.MILES)
2803
+ distanceToDisplay /= WPGMZA.Distance.KILOMETERS_PER_MILE;
2804
 
2805
+ var text = Math.round(distanceToDisplay, 2);
 
 
 
 
2806
 
2807
+ return text;
2808
+ }
2809
+
2810
+
2811
+ /**
2812
+ * Gets the content for the info window and passes it to the specified callback - this allows for delayed loading (eg AJAX) as well as instant content
2813
+ * @method
2814
+ * @memberof WPGMZA.InfoWindow
2815
+ * @return void
2816
+ */
2817
+ WPGMZA.InfoWindow.prototype.getContent = function(callback) {
2818
+ var html = "";
2819
+ var extra_html = "";
2820
+
2821
+ if (this.feature instanceof WPGMZA.Marker) {
2822
+ // Store locator distance away
2823
+ // added by Nick 2020-01-12
2824
+ if (this.feature.map.settings.store_locator_show_distance && this.feature.map.storeLocator && (this.feature.map.storeLocator.state == WPGMZA.StoreLocator.STATE_APPLIED)) {
2825
+ var currentLatLng = this.feature.getPosition();
2826
+ var distance = this.workOutDistanceBetweenTwoMarkers(this.feature.map.storeLocator.center, currentLatLng);
2827
+
2828
+ extra_html += "<p>"+(this.feature.map.settings.store_locator_distance == WPGMZA.Distance.KILOMETERS ? distance + WPGMZA.localized_strings.kilometers_away : distance + " " + WPGMZA.localized_strings.miles_away)+"</p>";
2829
+ }
2830
+
2831
+ html = this.feature.address+extra_html;
2832
  }
2833
 
2834
+ if (this.contentHtml){
2835
+ html = this.contentHtml;
 
 
2836
  }
2837
+
2838
+
2839
+ if(callback)
2840
+ callback(html);
2841
 
2842
+ return html;
2843
+ }
2844
+
2845
+ /**
2846
+ * Opens the info window on the specified map, with the specified map object as the subject.
2847
+ * @method
2848
+ * @memberof WPGMZA.InfoWindow
2849
+ * @param {WPGMZA.Map} map The map to open this InfoWindow on.
2850
+ * @param {WPGMZA.Feature} feature The map object (eg marker, polygon) to open this InfoWindow on.
2851
+ * @return boolean FALSE if the info window should not and will not open, TRUE if it will. This can be used by subclasses to establish whether or not the subclassed open should bail or open the window.
2852
+ */
2853
+ WPGMZA.InfoWindow.prototype.open = function(map, feature) {
2854
+ var self = this;
2855
 
2856
+ this.feature = feature;
 
 
 
 
 
 
 
 
 
 
 
 
 
2857
 
2858
+ if(WPGMZA.settings.disable_infowindows || WPGMZA.settings.wpgmza_settings_disable_infowindows == "1")
2859
+ return false;
 
2860
 
2861
+ if(this.feature.disableInfoWindow)
2862
+ return false;
 
 
 
 
 
 
 
 
 
 
2863
 
2864
+ this.state = WPGMZA.InfoWindow.STATE_OPEN;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2865
 
2866
+ return true;
2867
+ }
2868
+
2869
+ /**
2870
+ * Abstract function, closes this InfoWindow
2871
+ * @method
2872
+ * @memberof WPGMZA.InfoWindow
2873
+ */
2874
+ WPGMZA.InfoWindow.prototype.close = function()
2875
+ {
2876
+ if(this.state == WPGMZA.InfoWindow.STATE_CLOSED)
2877
+ return;
2878
 
2879
+ this.state = WPGMZA.InfoWindow.STATE_CLOSED;
2880
+ this.trigger("infowindowclose");
2881
  }
2882
+
2883
+ /**
2884
+ * Abstract function, sets the content in this InfoWindow
2885
+ * @method
2886
+ * @memberof WPGMZA.InfoWindow
2887
+ */
2888
+ WPGMZA.InfoWindow.prototype.setContent = function(options)
2889
+ {
2890
+
2891
+ }
2892
+
2893
+ /**
2894
+ * Abstract function, sets options on this InfoWindow
2895
+ * @method
2896
+ * @memberof WPGMZA.InfoWindow
2897
+ */
2898
+ WPGMZA.InfoWindow.prototype.setOptions = function(options)
2899
+ {
2900
+
2901
+ }
2902
+
2903
+ /**
2904
+ * Event listener for when the map object is added. This will cause the info window to open if the map object has infoopen set
2905
+ * @method
2906
+ * @memberof WPGMZA.InfoWindow
2907
+ * @return void
2908
+ */
2909
+ WPGMZA.InfoWindow.prototype.onFeatureAdded = function()
2910
+ {
2911
+ if(this.feature.settings.infoopen == 1)
2912
+ this.open();
2913
+ }
2914
+
2915
+ WPGMZA.InfoWindow.prototype.onOpen = function()
2916
+ {
2917
+
2918
+ }
2919
+
2920
+ });
2921
+
2922
+ // js/v8/latlng.js
2923
+ /**
2924
+ * @namespace WPGMZA
2925
+ * @module LatLng
2926
+ * @requires WPGMZA
2927
+ */
2928
+ jQuery(function($) {
2929
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2930
  /**
2931
+ * This class represents a latitude and longitude coordinate pair, and provides utilities to work with coordinates, parsing and conversion.
2932
+ * @class WPGMZA.LatLng
2933
+ * @constructor WPGMZA.LatLng
2934
+ * @memberof WPGMZA
2935
+ * @param {number|object} arg A latLng literal, or latitude
2936
+ * @param {number} [lng] The latitude, where arg is a longitude
2937
  */
2938
+ WPGMZA.LatLng = function(arg, lng)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2939
  {
2940
+ this._lat = 0;
2941
+ this._lng = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2942
 
2943
+ if(arguments.length == 0)
2944
  return;
2945
 
2946
+ if(arguments.length == 1)
 
 
 
 
 
 
 
 
 
2947
  {
2948
+ // TODO: Support latlng string
 
 
 
2949
 
2950
+ if(typeof arg == "string")
2951
  {
2952
+ var m;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2953
 
2954
+ if(!(m = arg.match(WPGMZA.LatLng.REGEXP)))
2955
+ throw new Error("Invalid LatLng string");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2956
 
2957
+ arg = {
2958
+ lat: m[1],
2959
+ lng: m[3]
2960
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2961
  }
2962
 
2963
+ if(typeof arg != "object" || !("lat" in arg && "lng" in arg))
2964
+ throw new Error("Argument must be a LatLng literal");
2965
 
2966
+ this.lat = arg.lat;
2967
+ this.lng = arg.lng;
 
 
2968
  }
2969
  else
2970
+ {
2971
+ this.lat = arg;
2972
+ this.lng = lng;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2973
  }
2974
  }
2975
 
2976
  /**
2977
+ * A regular expression which matches latitude and longitude coordinate pairs from a string. Matches 1 and 3 correspond to latitude and longitude, respectively,
2978
+ * @constant {RegExp}
2979
+ * @memberof WPGMZA.LatLng
2980
  */
2981
+ WPGMZA.LatLng.REGEXP = /^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/;
 
 
 
 
 
2982
 
2983
  /**
2984
+ * Returns true if the supplied object is a LatLng literal, also returns true for instances of WPGMZA.LatLng
 
2985
  * @method
2986
+ * @static
2987
+ * @memberof WPGMZA.LatLng
2988
+ * @param {object} obj A LatLng literal, or an instance of WPGMZA.LatLng
2989
+ * @return {bool} True if this object is a valid LatLng literal or instance of WPGMZA.LatLng
 
 
2990
  */
2991
+ WPGMZA.LatLng.isValid = function(obj)
2992
  {
2993
+ if(typeof obj != "object")
2994
+ return false;
2995
 
2996
+ if(!("lat" in obj && "lng" in obj))
2997
+ return false;
 
 
 
 
 
2998
 
2999
+ return true;
3000
+ }
3001
+
3002
+ WPGMZA.LatLng.isLatLngString = function(str)
3003
+ {
3004
+ if(typeof str != "string")
3005
+ return false;
3006
+
3007
+ return str.match(WPGMZA.LatLng.REGEXP) ? true : false;
3008
+ }
3009
+
3010
+ /**
3011
+ * The latitude, guaranteed to be a number
3012
+ * @property lat
3013
+ * @memberof WPGMZA.LatLng
3014
+ */
3015
+ Object.defineProperty(WPGMZA.LatLng.prototype, "lat", {
3016
+ get: function() {
3017
+ return this._lat;
3018
+ },
3019
+ set: function(val) {
3020
+ if(!$.isNumeric(val))
3021
+ throw new Error("Latitude must be numeric");
3022
+ this._lat = parseFloat( val );
3023
+ }
3024
+ });
3025
+
3026
+ /**
3027
+ * The longitude, guaranteed to be a number
3028
+ * @property lng
3029
+ * @memberof WPGMZA.LatLng
3030
+ */
3031
+ Object.defineProperty(WPGMZA.LatLng.prototype, "lng", {
3032
+ get: function() {
3033
+ return this._lng;
3034
+ },
3035
+ set: function(val) {
3036
+ if(!$.isNumeric(val))
3037
+ throw new Error("Longitude must be numeric");
3038
+ this._lng = parseFloat( val );
3039
+ }
3040
+ });
3041
+
3042
+ WPGMZA.LatLng.fromString = function(string)
3043
+ {
3044
+ if(!WPGMZA.LatLng.isLatLngString(string))
3045
+ throw new Error("Not a valid latlng string");
3046
+
3047
+ var m = string.match(WPGMZA.LatLng.REGEXP);
3048
+
3049
+ return new WPGMZA.LatLng({
3050
+ lat: parseFloat(m[1]),
3051
+ lng: parseFloat(m[3])
3052
+ });
3053
  }
3054
 
3055
  /**
3056
+ * Returns this latitude and longitude as a string
3057
  * @method
3058
+ * @memberof WPGMZA.LatLng
3059
+ * @return {string} This object represented as a string
3060
  */
3061
+ WPGMZA.LatLng.prototype.toString = function()
3062
  {
3063
+ return this._lat + ", " + this._lng;
 
3064
  }
3065
 
3066
  /**
3067
+ * Queries the users current location and passes it to a callback, you can pass
3068
+ * geocodeAddress through options if you would like to also receive the address
3069
  * @method
3070
+ * @memberof WPGMZA.LatLng
3071
+ * @param {function} A callback to receive the WPGMZA.LatLng
3072
+ * @param {object} An object of options, only geocodeAddress is currently supported
3073
+ * @return void
3074
  */
3075
+ WPGMZA.LatLng.fromCurrentPosition = function(callback, options)
3076
  {
3077
+ if(!options)
3078
+ options = {};
3079
+
3080
+ if(!callback)
3081
+ return;
3082
+
3083
+ WPGMZA.getCurrentPosition(function(position) {
3084
 
3085
+ var latLng = new WPGMZA.LatLng({
3086
+ lat: position.coords.latitude,
3087
+ lng: position.coords.longitude
3088
+ });
3089
 
3090
+ if(options.geocodeAddress)
3091
+ {
3092
+ var geocoder = WPGMZA.Geocoder.createInstance();
3093
+
3094
+ geocoder.getAddressFromLatLng({
3095
+ latLng: latLng
3096
+ }, function(results) {
3097
+
3098
+ if(results.length)
3099
+ latLng.address = results[0];
3100
+
3101
+ callback(latLng);
3102
+
3103
+ });
3104
+
3105
+
3106
+ }
3107
  else
3108
+ callback(latLng);
3109
 
 
 
 
 
 
 
 
 
 
3110
  });
3111
  }
3112
 
3113
+ /**
3114
+ * Returns an instnace of WPGMZA.LatLng from an instance of google.maps.LatLng
3115
+ * @method
3116
+ * @static
3117
+ * @memberof WPGMZA.LatLng
3118
+ * @param {google.maps.LatLng} The google.maps.LatLng to convert
3119
+ * @return {WPGMZA.LatLng} An instance of WPGMZA.LatLng built from the supplied google.maps.LatLng
3120
+ */
3121
+ WPGMZA.LatLng.fromGoogleLatLng = function(googleLatLng)
3122
+ {
3123
+ return new WPGMZA.LatLng(
3124
+ googleLatLng.lat(),
3125
+ googleLatLng.lng()
3126
+ );
3127
+ }
3128
+
3129
+ WPGMZA.LatLng.toGoogleLatLngArray = function(arr)
3130
  {
3131
+ var result = [];
3132
+
3133
+ arr.forEach(function(nativeLatLng) {
 
 
 
 
 
 
 
 
 
3134
 
3135
+ if(! (nativeLatLng instanceof WPGMZA.LatLng || ("lat" in nativeLatLng && "lng" in nativeLatLng)) )
3136
+ throw new Error("Unexpected input");
 
3137
 
3138
+ result.push(new google.maps.LatLng({
3139
+ lat: parseFloat(nativeLatLng.lat),
3140
+ lng: parseFloat(nativeLatLng.lng)
3141
+ }));
3142
+
3143
+ });
3144
+
3145
+ return result;
3146
  }
3147
 
3148
  /**
3149
+ * Returns an instance of google.maps.LatLng with the same coordinates as this object
3150
  * @method
3151
+ * @memberof WPGMZA.LatLng
3152
+ * @return {google.maps.LatLng} This object, expressed as a google.maps.LatLng
 
 
 
3153
  */
3154
+ WPGMZA.LatLng.prototype.toGoogleLatLng = function()
3155
  {
3156
+ return new google.maps.LatLng({
3157
+ lat: this.lat,
3158
+ lng: this.lng
3159
+ });
3160
+ }
3161
+
3162
+ WPGMZA.LatLng.prototype.toLatLngLiteral = function()
3163
+ {
3164
+ return {
3165
+ lat: this.lat,
3166
+ lng: this.lng
3167
+ };
3168
  }
3169
 
3170
  /**
3171
+ * Moves this latLng by the specified kilometers along the given heading. This function operates in place, as opposed to creating a new instance of WPGMZA.LatLng. With many thanks to Hu Kenneth - https://gis.stackexchange.com/questions/234473/get-a-lonlat-point-by-distance-or-between-2-lonlat-points
3172
  * @method
3173
+ * @memberof WPGMZA.LatLng
3174
+ * @param {number} kilometers The number of kilometers to move this LatLng by
3175
+ * @param {number} heading The heading, in degrees, to move along, where zero is North
3176
+ * @return {void}
 
 
3177
  */
3178
+ WPGMZA.LatLng.prototype.moveByDistance = function(kilometers, heading)
3179
  {
3180
+ var radius = 6371;
 
 
 
 
 
 
 
3181
 
3182
+ var delta = parseFloat(kilometers) / radius;
3183
+ var theta = parseFloat(heading) / 180 * Math.PI;
3184
 
3185
+ var phi1 = this.lat / 180 * Math.PI;
3186
+ var lambda1 = this.lng / 180 * Math.PI;
3187
 
3188
+ var sinPhi1 = Math.sin(phi1), cosPhi1 = Math.cos(phi1);
3189
+ var sinDelta = Math.sin(delta), cosDelta = Math.cos(delta);
3190
+ var sinTheta = Math.sin(theta), cosTheta = Math.cos(theta);
3191
 
3192
+ var sinPhi2 = sinPhi1 * cosDelta + cosPhi1 * sinDelta * cosTheta;
3193
+ var phi2 = Math.asin(sinPhi2);
3194
+ var y = sinTheta * sinDelta * cosPhi1;
3195
+ var x = cosDelta - sinPhi1 * sinPhi2;
3196
+ var lambda2 = lambda1 + Math.atan2(y, x);
3197
 
3198
+ this.lat = phi2 * 180 / Math.PI;
3199
+ this.lng = lambda2 * 180 / Math.PI;
 
 
 
 
 
 
3200
  }
3201
 
3202
  /**
3203
+ * @function getGreatCircleDistance
3204
+ * @summary Uses the haversine formula to get the great circle distance between this and another LatLng / lat & lng pair
3205
+ * @param arg1 [WPGMZA.LatLng|Object|Number] Either a WPGMZA.LatLng, an object representing a lat/lng literal, or a latitude
3206
+ * @param arg2 (optional) If arg1 is a Number representing latitude, pass arg2 to represent the longitude
3207
+ * @return number The distance "as the crow files" between this point and the other
3208
  */
3209
+ WPGMZA.LatLng.prototype.getGreatCircleDistance = function(arg1, arg2)
3210
  {
3211
+ var lat1 = this.lat;
3212
+ var lon1 = this.lng;
3213
+ var other;
 
 
3214
 
3215
+ if(arguments.length == 1)
3216
+ other = new WPGMZA.LatLng(arg1);
3217
+ else if(arguments.length == 2)
3218
+ other = new WPGMZA.LatLng(arg1, arg2);
 
 
 
 
 
 
 
 
 
 
 
 
 
3219
  else
3220
+ throw new Error("Invalid number of arguments");
3221
+
3222
+ var lat2 = other.lat;
3223
+ var lon2 = other.lng;
3224
+
3225
+ var R = 6371; // Kilometers
3226
+ var phi1 = lat1.toRadians();
3227
+ var phi2 = lat2.toRadians();
3228
+ var deltaPhi = (lat2-lat1).toRadians();
3229
+ var deltaLambda = (lon2-lon1).toRadians();
3230
+
3231
+ var a = Math.sin(deltaPhi/2) * Math.sin(deltaPhi/2) +
3232
+ Math.cos(phi1) * Math.cos(phi2) *
3233
+ Math.sin(deltaLambda/2) * Math.sin(deltaLambda/2);
3234
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
3235
+
3236
+ var d = R * c;
3237
 
3238
+ return d;
3239
  }
3240
 
3241
+ });
3242
+
3243
+ // js/v8/latlngbounds.js
3244
+ /**
3245
+ * @namespace WPGMZA
3246
+ * @module LatLngBounds
3247
+ * @requires WPGMZA
3248
+ */
3249
+ jQuery(function($) {
3250
+
3251
  /**
3252
+ * This class represents latitude and longitude bounds as a rectangular area.
3253
+ * NB: This class is not fully implemented
3254
+ * @class WPGMZA.LatLngBounds
3255
+ * @constructor WPGMZA.LatLngBounds
3256
+ * @memberof WPGMZA
 
3257
  */
3258
+ WPGMZA.LatLngBounds = function(southWest, northEast)
3259
  {
3260
+ //console.log("Created bounds", southWest, northEast);
 
 
 
3261
 
3262
+ if(southWest instanceof WPGMZA.LatLngBounds)
3263
+ {
3264
+ var other = southWest;
3265
+ this.south = other.south;
3266
+ this.north = other.north;
3267
+ this.west = other.west;
3268
+ this.east = other.east;
3269
+ }
3270
+ else if(southWest && northEast)
3271
+ {
3272
+ // TODO: Add checks and errors
3273
+ this.south = southWest.lat;
3274
+ this.north = northEast.lat;
3275
+ this.west = southWest.lng;
3276
+ this.east = northEast.lng;
3277
+ }
3278
  }
3279
 
3280
+ WPGMZA.LatLngBounds.fromGoogleLatLngBounds = function(googleLatLngBounds)
 
 
 
 
 
 
 
 
3281
  {
3282
+ if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))
3283
+ throw new Error("Argument must be an instance of google.maps.LatLngBounds");
3284
+
3285
+ var result = new WPGMZA.LatLngBounds();
3286
+ var southWest = googleLatLngBounds.getSouthWest();
3287
+ var northEast = googleLatLngBounds.getNorthEast();
3288
 
3289
+ result.north = northEast.lat();
3290
+ result.south = southWest.lat();
3291
+ result.west = southWest.lng();
3292
+ result.east = northEast.lng();
3293
 
3294
+ return result;
 
3295
  }
3296
 
3297
+ WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral = function(obj)
 
 
 
 
 
 
 
 
 
3298
  {
3299
+ var result = new WPGMZA.LatLngBounds();
 
3300
 
3301
+ var southWest = obj.southwest;
3302
+ var northEast = obj.northeast;
3303
 
3304
+ result.north = northEast.lat;
3305
+ result.south = southWest.lat;
3306
+ result.west = southWest.lng;
3307
+ result.east = northEast.lng;
3308
 
3309
+ return result;
 
3310
  }
3311
 
3312
  /**
3313
+ * Returns true if this object is in it's initial state (eg no points specified to gather bounds from)
3314
  * @method
3315
+ * @memberof WPGMZA.LatLngBounds
3316
+ * @return {bool} True if the object is in it's initial state
 
3317
  */
3318
+ WPGMZA.LatLngBounds.prototype.isInInitialState = function()
3319
  {
3320
+ return (this.north == undefined && this.south == undefined && this.west == undefined && this.east == undefined);
 
 
 
 
 
 
3321
  }
3322
 
3323
  /**
3324
+ * Extends this bounds object to encompass the given latitude and longitude coordinates
3325
  * @method
3326
+ * @memberof WPGMZA.LatLngBounds
3327
+ * @param {object|WPGMZA.LatLng} latLng either a LatLng literal or an instance of WPGMZA.LatLng
3328
  */
3329
+ WPGMZA.LatLngBounds.prototype.extend = function(latLng)
3330
  {
3331
+ if(!(latLng instanceof WPGMZA.LatLng))
3332
+ latLng = new WPGMZA.LatLng(latLng);
3333
 
3334
+ //console.log("Expanding bounds to " + latLng.toString());
 
3335
 
3336
+ if(this.isInInitialState())
 
 
 
 
 
 
 
 
 
3337
  {
3338
+ this.north = this.south = latLng.lat;
3339
+ this.west = this.east = latLng.lng;
3340
+ return;
3341
  }
3342
 
3343
+ if(latLng.lat < this.north)
3344
+ this.north = latLng.lat;
3345
+
3346
+ if(latLng.lat > this.south)
3347
+ this.south = latLng.lat;
 
 
 
 
 
 
 
 
 
 
3348
 
3349
+ if(latLng.lng < this.west)
3350
+ this.west = latLng.lng;
3351
 
3352
+ if(latLng.lng > this.east)
3353
+ this.east = latLng.lng;
3354
  }
3355
 
3356
+ WPGMZA.LatLngBounds.prototype.extendByPixelMargin = function(map, x, arg)
 
 
 
 
 
 
 
 
 
3357
  {
3358
+ var y = x;
 
3359
 
3360
+ if(!(map instanceof WPGMZA.Map))
3361
+ throw new Error("First argument must be an instance of WPGMZA.Map");
3362
 
3363
+ if(this.isInInitialState())
3364
+ throw new Error("Cannot extend by pixels in initial state");
3365
 
3366
+ if(arguments.length >= 3)
3367
+ y = arg;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3368
 
3369
+ var southWest = new WPGMZA.LatLng(this.south, this.west);
3370
+ var northEast = new WPGMZA.LatLng(this.north, this.east);
 
 
 
 
 
 
 
 
 
 
3371
 
3372
+ southWest = map.latLngToPixels(southWest);
3373
+ northEast = map.latLngToPixels(northEast);
3374
 
3375
+ southWest.x -= x;
3376
+ southWest.y += y;
 
 
 
 
 
 
 
 
 
 
 
 
 
3377
 
3378
+ northEast.x += x;
3379
+ northEast.y -= y;
3380
 
3381
+ southWest = map.pixelsToLatLng(southWest.x, southWest.y);
3382
+ northEast = map.pixelsToLatLng(northEast.x, northEast.y);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3383
 
3384
+ var temp = this.toString();
 
3385
 
3386
+ this.north = northEast.lat;
3387
+ this.south = southWest.lat;
3388
+ this.west = southWest.lng;
3389
+ this.east = northEast.lng;
3390
 
3391
+ // console.log("Extended", temp, "to", this.toString());
 
3392
  }
3393
 
3394
+ WPGMZA.LatLngBounds.prototype.contains = function(latLng)
 
 
 
 
 
 
 
3395
  {
3396
+ //console.log("Checking if latLng ", latLng, " is within bounds " + this.toString());
 
 
 
 
3397
 
3398
+ if(!(latLng instanceof WPGMZA.LatLng))
3399
+ throw new Error("Argument must be an instance of WPGMZA.LatLng");
 
 
 
 
 
 
 
 
 
 
3400
 
3401
+ if(latLng.lat < Math.min(this.north, this.south))
3402
+ return false;
3403
 
3404
+ if(latLng.lat > Math.max(this.north, this.south))
3405
+ return false;
 
 
 
 
 
3406
 
3407
+ if(this.west < this.east)
3408
+ return (latLng.lng >= this.west && latLng.lng <= this.east);
3409
 
3410
+ return (latLng.lng <= this.west || latLng.lng >= this.east);
 
3411
  }
3412
 
3413
+ WPGMZA.LatLngBounds.prototype.toString = function()
3414
  {
3415
+ return this.north + "N " + this.south + "S " + this.west + "W " + this.east + "E";
 
 
 
 
 
 
 
 
 
3416
  }
3417
 
3418
+ WPGMZA.LatLngBounds.prototype.toLiteral = function()
3419
  {
3420
+ return {
3421
+ north: this.north,
3422
+ south: this.south,
3423
+ west: this.west,
3424
+ east: this.east
3425
+ };
 
3426
  }
3427
 
3428
+ });
3429
+
3430
+ // js/v8/legacy-global-symbols.js
3431
+ /**
3432
+ * @namespace WPGMZA
3433
+ * @module LegacyGlobalSymbols
3434
+ * @requires WPGMZA
3435
+ */
3436
+ jQuery(function($) {
3437
+
3438
+ var legacyGlobals = {
3439
+ marker_pull: "0",
3440
+ marker_array: [],
3441
+ MYMAP: [],
3442
+ infoWindow_poly: [],
3443
+ markerClusterer: [],
3444
+ heatmap: [],
3445
+ WPGM_Path: [],
3446
+ WPGM_Path_Polygon: [],
3447
+ WPGM_PathLine: [],
3448
+ WPGM_PathLineData: [],
3449
+ WPGM_PathData: [],
3450
+ original_iw: null,
3451
+ wpgmza_user_marker: null,
3452
 
3453
+ wpgmaps_localize_marker_data: [],
3454
+ wpgmaps_localize_polygon_settings: [],
3455
+ wpgmaps_localize_heatmap_settings: [],
3456
+ wpgmaps_localize_polyline_settings: [],
3457
+ wpgmza_cirtcle_data_array: [],
3458
+ wpgmza_rectangle_data_array: [],
3459
 
3460
+ wpgmzaForceLegacyMarkerClusterer: false
3461
+ };
3462
 
3463
+ function bindLegacyGlobalProperty(key)
 
 
 
 
 
3464
  {
3465
+ if(key in window)
3466
+ {
3467
+ console.warn("Cannot redefine legacy global " + key);
3468
+ return;
3469
+ }
3470
+
3471
+ Object.defineProperty(window, key, {
3472
+ "get": function() {
3473
+
3474
+ console.warn("This property is deprecated and should no longer be used");
3475
+
3476
+ return legacyGlobals[key];
3477
+
3478
+ },
3479
+ "set": function(value) {
3480
+
3481
+ console.warn("This property is deprecated and should no longer be used");
3482
+
3483
+ legacyGlobals[key] = value;
3484
+
3485
+ }
3486
+ });
3487
  }
3488
 
3489
+ for(var key in legacyGlobals)
3490
+ bindLegacyGlobalProperty(key);
 
 
 
 
 
 
 
 
 
 
 
 
3491
 
3492
+ WPGMZA.legacyGlobals = legacyGlobals;
3493
+
3494
+ window.InitMap =
3495
+ window.resetLocations =
3496
+ window.searchLocations =
3497
+ window.fillInAddress =
3498
+ window.searchLocationsNear =
3499
+ function () {
3500
+ console.warn("This function is deprecated and should no longer be used");
 
 
3501
  }
 
 
 
 
 
 
 
 
 
3502
 
3503
+ /*window.add_polygon = function (mapid, polygonid) {
3504
 
3505
+ console.warn("This function is deprecated and should no longer be used");
 
3506
 
3507
+ if (WPGMZA.settings.engine == "open-layers")
3508
+ return;
3509
+
3510
+ var tmp_data = wpgmaps_localize_polygon_settings[mapid][polygonid];
3511
+ var current_poly_id = polygonid;
3512
+ var tmp_polydata = tmp_data['polydata'];
3513
+ var WPGM_PathData = new Array();
3514
+ for (tmp_entry2 in tmp_polydata) {
3515
+ if (typeof tmp_polydata[tmp_entry2][0] !== "undefined") {
3516
+
3517
+ WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1]));
3518
+ }
3519
+ }
3520
+ if (tmp_data['lineopacity'] === null || tmp_data['lineopacity'] === "") {
3521
+ tmp_data['lineopacity'] = 1;
3522
+ }
3523
+
3524
+ var bounds = new google.maps.LatLngBounds();
3525
+ for (i = 0; i < WPGM_PathData.length; i++) {
3526
+ bounds.extend(WPGM_PathData[i]);
3527
+ }
3528
+
3529
+ function addPolygonLabel(googleLatLngs) {
3530
+ var label = tmp_data.title;
3531
+
3532
+ var geojson = [[]];
3533
+
3534
+ googleLatLngs.forEach(function (latLng) {
3535
+ geojson[0].push([
3536
+ latLng.lng(),
3537
+ latLng.lat()
3538
+ ])
3539
+ });
3540
+
3541
+ var lngLat = WPGMZA.ProPolygon.getLabelPosition(geojson);
3542
+
3543
+ var latLng = new WPGMZA.LatLng({
3544
+ lat: lngLat[1],
3545
+ lng: lngLat[0]
3546
+ });
3547
+
3548
+ var marker = WPGMZA.Marker.createInstance({
3549
+ position: latLng
3550
+ });
3551
+
3552
+ // TODO: Support target map
3553
+ // TODO: Read polygon title
3554
+
3555
+ var text = WPGMZA.Text.createInstance({
3556
+ text: label,
3557
+ map: WPGMZA.getMapByID(mapid),
3558
+ position: latLng
3559
+ });
3560
+
3561
+ //var marker = WPGMZA.Marker.createInst)
3562
+ }
3563
+
3564
+ WPGM_Path_Polygon[polygonid] = new google.maps.Polygon({
3565
+ path: WPGM_PathData,
3566
+ clickable: true,
3567
+ strokeColor: "#" + tmp_data['linecolor'],
3568
+ fillOpacity: tmp_data['opacity'],
3569
+ strokeOpacity: tmp_data['lineopacity'],
3570
+ fillColor: "#" + tmp_data['fillcolor'],
3571
+ strokeWeight: 2,
3572
+ map: MYMAP[mapid].map.googleMap
3573
+ });
3574
+ WPGM_Path_Polygon[polygonid].setMap(MYMAP[mapid].map.googleMap);
3575
+
3576
+ var map = WPGMZA.getMapByID(mapid);
3577
+ if (map.settings.polygon_labels)
3578
+ addPolygonLabel(WPGM_PathData);
3579
+
3580
+ if (tmp_data['title'] !== "") {
3581
+ infoWindow_poly[polygonid] = new google.maps.InfoWindow();
3582
+ infoWindow_poly[polygonid].setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX);
3583
+
3584
+ google.maps.event.addListener(WPGM_Path_Polygon[polygonid], 'click', function (event) {
3585
+ infoWindow_poly[polygonid].setPosition(event.latLng);
3586
+ content = "";
3587
+ if (tmp_data['link'] !== "") {
3588
+ var content = "<a href='" + tmp_data['link'] + "'><h4 class='wpgmza_polygon_title'>" + tmp_data['title'] + "</h4></a>";
3589
+ if (tmp_data['description'] !== "") {
3590
+ content += '<p class="wpgmza_polygon_description">' + tmp_data['description'] + '</p>';
3591
+ }
3592
+ } else {
3593
+ var content = '<h4 class="wpgmza_polygon_title">' + tmp_data['title'] + '</h4>';
3594
+ if (tmp_data['description'] !== "") {
3595
+ content += '<p class="wpgmza_polygon_description">' + tmp_data['description'] + '</p>';
3596
+ }
3597
+ }
3598
+ infoWindow_poly[polygonid].setContent(content);
3599
+ infoWindow_poly[polygonid].open(MYMAP[mapid].map.googleMap, this.position);
3600
+ });
3601
+ }
3602
+
3603
+ google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseover", function (event) {
3604
+ this.setOptions({
3605
+ fillColor: "#" + tmp_data['ohfillcolor']
3606
+ });
3607
+ this.setOptions({
3608
+ fillOpacity: tmp_data['ohopacity']
3609
+ });
3610
+ this.setOptions({
3611
+ strokeColor: "#" + tmp_data['ohlinecolor']
3612
+ });
3613
+ this.setOptions({
3614
+ strokeWeight: 2
3615
+ });
3616
+ this.setOptions({
3617
+ strokeOpacity: 0.9
3618
+ });
3619
+ });
3620
+ google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "click", function (event) {
3621
+
3622
+ this.setOptions({
3623
+ fillColor: "#" + tmp_data['ohfillcolor']
3624
+ });
3625
+ this.setOptions({
3626
+ fillOpacity: tmp_data['ohopacity']
3627
+ });
3628
+ this.setOptions({
3629
+ strokeColor: "#" + tmp_data['ohlinecolor']
3630
+ });
3631
+ this.setOptions({
3632
+ strokeWeight: 2
3633
+ });
3634
+ this.setOptions({
3635
+ strokeOpacity: 0.9
3636
+ });
3637
+ });
3638
+ google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseout", function (event) {
3639
+ this.setOptions({
3640
+ fillColor: "#" + tmp_data['fillcolor']
3641
+ });
3642
+ this.setOptions({
3643
+ fillOpacity: tmp_data['opacity']
3644
+ });
3645
+ this.setOptions({
3646
+ strokeColor: "#" + tmp_data['linecolor']
3647
+ });
3648
+ this.setOptions({
3649
+ strokeWeight: 2
3650
+ });
3651
+ this.setOptions({
3652
+ strokeOpacity: tmp_data['lineopacity']
3653
+ });
3654
+ });
3655
  }
3656
 
3657
+ window.add_polyline = function (mapid, polyline) {
 
 
 
 
 
 
3658
 
3659
+ console.warn("This function is deprecated and should no longer be used");
3660
+
3661
+ if (WPGMZA.settings.engine == "open-layers")
3662
+ return;
3663
+
3664
+ var tmp_data = wpgmaps_localize_polyline_settings[mapid][polyline];
3665
+
3666
+ var current_poly_id = polyline;
3667
+ var tmp_polydata = tmp_data['polydata'];
3668
+ var WPGM_Polyline_PathData = new Array();
3669
+ for (tmp_entry2 in tmp_polydata) {
3670
+ if (typeof tmp_polydata[tmp_entry2][0] !== "undefined" && typeof tmp_polydata[tmp_entry2][1] !== "undefined") {
3671
+ var lat = tmp_polydata[tmp_entry2][0].replace(')', '');
3672
+ lat = lat.replace('(', '');
3673
+ var lng = tmp_polydata[tmp_entry2][1].replace(')', '');
3674
+ lng = lng.replace('(', '');
3675
+ WPGM_Polyline_PathData.push(new google.maps.LatLng(lat, lng));
3676
+ }
3677
+
3678
+ }
3679
+ if (tmp_data['lineopacity'] === null || tmp_data['lineopacity'] === "") {
3680
+ tmp_data['lineopacity'] = 1;
3681
+ }
3682
+
3683
+ WPGM_Path[polyline] = new google.maps.Polyline({
3684
+ path: WPGM_Polyline_PathData,
3685
+ strokeColor: "#" + tmp_data['linecolor'],
3686
+ strokeOpacity: tmp_data['opacity'],
3687
+ strokeWeight: tmp_data['linethickness'],
3688
+ map: MYMAP[mapid].map.googleMap
3689
+ });
3690
+ WPGM_Path[polyline].setMap(MYMAP[mapid].map.googleMap);
3691
+
3692
  }
3693
+
3694
+ window.add_circle = function (mapid, data) {
 
 
 
 
 
 
3695
 
3696
+ console.warn("This function is deprecated and should no longer be used");
 
 
 
 
 
 
 
 
 
 
 
 
3697
 
3698
+ if (WPGMZA.settings.engine != "google-maps" || !MYMAP.hasOwnProperty(mapid))
3699
+ return;
3700
+
3701
+ data.map = MYMAP[mapid].map.googleMap;
3702
+
3703
+ if (!(data.center instanceof google.maps.LatLng)) {
3704
+ var m = data.center.match(/-?\d+(\.\d*)?/g);
3705
+ data.center = new google.maps.LatLng({
3706
+ lat: parseFloat(m[0]),
3707
+ lng: parseFloat(m[1]),
3708
+ });
3709
+ }
3710
+
3711
+ data.radius = parseFloat(data.radius);
3712
+ data.fillColor = data.color;
3713
+ data.fillOpacity = parseFloat(data.opacity);
3714
+
3715
+ data.strokeOpacity = 0;
3716
+
3717
+ var circle = new google.maps.Circle(data);
3718
+ circle_array.push(circle);
3719
  }
3720
 
3721
+ window.add_rectangle = function (mapid, data) {
3722
+
3723
+ console.warn("This function is deprecated and should no longer be used");
3724
+
3725
+ if (WPGMZA.settings.engine != "google-maps" || !MYMAP.hasOwnProperty(mapid))
3726
+ return;
3727
+
3728
+ data.map = MYMAP[mapid].map.googleMap;
3729
+
3730
+ data.fillColor = data.color;
3731
+ data.fillOpacity = parseFloat(data.opacity);
3732
+
3733
+ var northWest = data.cornerA;
3734
+ var southEast = data.cornerB;
3735
+
3736
+ var m = northWest.match(/-?\d+(\.\d+)?/g);
3737
+ var north = parseFloat(m[0]);
3738
+ var west = parseFloat(m[1]);
3739
+
3740
+ m = southEast.match(/-?\d+(\.\d+)?/g);
3741
+ var south = parseFloat(m[0]);
3742
+ var east = parseFloat(m[1]);
3743
+
3744
+ data.bounds = {
3745
+ north: north,
3746
+ west: west,
3747
+ south: south,
3748
+ east: east
3749
+ };
3750
+
3751
+ data.strokeOpacity = 0;
3752
 
3753
+ var rectangle = new google.maps.Rectangle(data);
3754
+ rectangle_array.push(rectangle);
3755
  }
3756
 
3757
+ window.add_heatmap = function (mapid, datasetid) {
 
 
 
 
 
 
 
 
3758
 
3759
+ console.warn("This function is deprecated and should no longer be used");
3760
+
3761
+ if (WPGMZA.settings.engine != "google-maps")
3762
+ return;
3763
+
3764
+ var tmp_data = wpgmaps_localize_heatmap_settings[mapid][datasetid];
3765
+ var current_poly_id = datasetid;
3766
+ var tmp_polydata = tmp_data['polydata'];
3767
+ var WPGM_PathData = new Array();
3768
+ for (tmp_entry2 in tmp_polydata) {
3769
+ if (typeof tmp_polydata[tmp_entry2][0] !== "undefined") {
3770
+
3771
+ WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1]));
3772
+ }
3773
+ }
3774
+ if (tmp_data['radius'] === null || tmp_data['radius'] === "") {
3775
+ tmp_data['radius'] = 20;
3776
+ }
3777
+ if (tmp_data['gradient'] === null || tmp_data['gradient'] === "") {
3778
+ tmp_data['gradient'] = null;
3779
+ }
3780
+ if (tmp_data['opacity'] === null || tmp_data['opacity'] === "") {
3781
+ tmp_data['opacity'] = 0.6;
3782
+ }
3783
+
3784
+ var bounds = new google.maps.LatLngBounds();
3785
+ for (i = 0; i < WPGM_PathData.length; i++) {
3786
+ bounds.extend(WPGM_PathData[i]);
3787
  }
3788
+
3789
+ WPGM_Path_Polygon[datasetid] = new google.maps.visualization.HeatmapLayer({
3790
+ data: WPGM_PathData,
3791
+ map: MYMAP[mapid].map.googleMap
3792
+ });
3793
+
3794
+ WPGM_Path_Polygon[datasetid].setMap(MYMAP[mapid].map.googleMap);
3795
+ var gradient = JSON.parse(tmp_data['gradient']);
3796
+ WPGM_Path_Polygon[datasetid].set('radius', tmp_data['radius']);
3797
+ WPGM_Path_Polygon[datasetid].set('opacity', tmp_data['opacity']);
3798
+ WPGM_Path_Polygon[datasetid].set('gradient', gradient);
3799
+ };*/
3800
+
3801
+ });
3802
+
3803
+ // js/v8/map-list-page.js
3804
+ /**
3805
+ * @namespace WPGMZA
3806
+ * @module MapListPage
3807
+ * @requires WPGMZA
3808
+ */
3809
+ jQuery(function($) {
3810
 
3811
+ WPGMZA.MapListPage = function()
3812
+ {
3813
+
3814
+ $("body").on("click",".wpgmza_copy_shortcode", function() {
3815
+ var $temp = jQuery('<input>');
3816
+ var $tmp2 = jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');
3817
+ jQuery("body").append($temp);
3818
+ $temp.val(jQuery(this).val()).select();
3819
+ document.execCommand("copy");
3820
+ $temp.remove();
3821
+ WPGMZA.notification("Shortcode Copied");
3822
+ });
3823
+
3824
  }
3825
 
3826
+ WPGMZA.MapListPage.createInstance = function()
3827
  {
3828
+ return new WPGMZA.MapListPage();
 
 
 
 
 
3829
  }
3830
 
3831
  $(document).ready(function(event) {
3832
 
3833
+ if(WPGMZA.getCurrentPage() == WPGMZA.PAGE_MAP_LIST)
3834
+ WPGMZA.mapListPage = WPGMZA.MapListPage.createInstance();
3835
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3836
  });
3837
+
3838
+ });
3839
+
3840
+ // js/v8/map-settings.js
3841
+ /**
3842
+ * @namespace WPGMZA
3843
+ * @module MapSettings
3844
+ * @requires WPGMZA
3845
+ */
3846
+ jQuery(function($) {
3847
+
3848
+ /**
3849
+ * Handles map settings, parsing them from the data-settings attribute on the maps HTML element.
3850
+ * NB: This will be split into GoogleMapSettings and OLMapSettings in the future.
3851
+ * @class WPGMZA.MapSettings
3852
+ * @constructor WPGMZA.MapSettings
3853
+ */
3854
+ WPGMZA.MapSettings = function(element)
3855
+ {
3856
+ var self = this;
3857
+ var str = element.getAttribute("data-settings");
3858
+ var json;
3859
+
3860
+ try{
3861
+ json = JSON.parse(str);
3862
+ }catch(e) {
3863
+
3864
+ str = str.replace(/\\%/g, "%");
3865
+ str = str.replace(/\\\\"/g, '\\"');
3866
+
3867
+ try{
3868
+ json = JSON.parse(str);
3869
+ }catch(e) {
3870
+ json = {};
3871
+ console.warn("Failed to parse map settings JSON");
3872
+ }
3873
+
3874
+ }
3875
+
3876
+ WPGMZA.assertInstanceOf(this, "MapSettings");
3877
+
3878
+
3879
+
3880
+ function addSettings(input) {
3881
+ if(!input)
3882
+ return;
3883
+
3884
+ for(var key in input) {
3885
+ if(key == "other_settings")
3886
+ continue; // Ignore other_settings
3887
+
3888
+ var value = input[key];
3889
+
3890
+ if(String(value).match(/^-?\d+$/))
3891
+ value = parseInt(value);
3892
+
3893
+ self[key] = value;
3894
+ }
3895
+ }
3896
+
3897
+ addSettings(WPGMZA.settings);
3898
+
3899
+ addSettings(json);
3900
+
3901
+ if(json && json.other_settings)
3902
+ addSettings(json.other_settings);
3903
+
3904
+ }
3905
+
3906
+ /**
3907
+ * Returns settings on this object converted to OpenLayers view options
3908
+ * @method
3909
+ * @memberof WPGMZA.MapSettings
3910
+ * @return {object} The map settings, in a format understood by OpenLayers
3911
+ */
3912
+ WPGMZA.MapSettings.prototype.toOLViewOptions = function()
3913
+ {
3914
+ var self = this;
3915
+ var options = {
3916
+ center: ol.proj.fromLonLat([-119.4179, 36.7783]),
3917
+ zoom: 4
3918
+ };
3919
+
3920
+ function empty(name)
3921
+ {
3922
+ if(typeof self[name] == "object")
3923
+ return false;
3924
+
3925
+ return !self[name] || !self[name].length;
3926
+ }
3927
+
3928
+ // Start location
3929
+ if(typeof this.start_location == "string")
3930
+ {
3931
+ var coords = this.start_location.replace(/^\(|\)$/g, "").split(",");
3932
+ if(WPGMZA.isLatLngString(this.start_location))
3933
+ options.center = ol.proj.fromLonLat([
3934
+ parseFloat(coords[1]),
3935
+ parseFloat(coords[0])
3936
+ ]);
3937
+ else
3938
+ console.warn("Invalid start location");
3939
+ }
3940
+
3941
+ if(this.center)
3942
+ {
3943
+ options.center = ol.proj.fromLonLat([
3944
+ parseFloat(this.center.lng),
3945
+ parseFloat(this.center.lat)
3946
+ ]);
3947
+ }
3948
+
3949
+ if(!empty("map_start_lat") && !empty("map_start_lng"))
3950
+ {
3951
+ options.center = ol.proj.fromLonLat([
3952
+ parseFloat(this.map_start_lng),
3953
+ parseFloat(this.map_start_lat)
3954
+ ]);
3955
+ }
3956
+
3957
+ // Start zoom
3958
+ if(this.zoom){
3959
+ options.zoom = parseInt(this.zoom);
3960
+ }
3961
+
3962
+ if(this.start_zoom){
3963
+ options.zoom = parseInt(this.start_zoom);
3964
+ }
3965
+
3966
+ if(this.map_start_zoom){
3967
+ options.zoom = parseInt(this.map_start_zoom);
3968
+ }
3969
+
3970
+ // Zoom limits
3971
+ // TODO: This matches the Google code, so some of these could be potentially put on a parent class
3972
+ if(this.map_min_zoom && this.map_max_zoom)
3973
+ {
3974
+ options.minZoom = Math.min(this.map_min_zoom, this.map_max_zoom);
3975
+ options.maxZoom = Math.max(this.map_min_zoom, this.map_max_zoom);
3976
+ }
3977
+
3978
+ return options;
3979
+ }
3980
+
3981
+ /**
3982
+ * Returns settings on this object converted to Google's MapOptions spec.
3983
+ * @method
3984
+ * @memberof WPGMZA.MapSettings
3985
+ * @return {object} The map settings, in the format specified by google.maps.MapOptions
3986
+ */
3987
+ WPGMZA.MapSettings.prototype.toGoogleMapsOptions = function()
3988
+ {
3989
+ var self = this;
3990
+ var latLngCoords = (this.start_location && this.start_location.length ? this.start_location.split(",") : [36.7783, -119.4179]);
3991
+
3992
+ function empty(name)
3993
+ {
3994
+ if(typeof self[name] == "object")
3995
+ return false;
3996
+
3997
+ return !self[name] || !self[name].length;
3998
+ }
3999
+
4000
+ function formatCoord(coord)
4001
+ {
4002
+ if($.isNumeric(coord))
4003
+ return coord;
4004
+ return parseFloat( String(coord).replace(/[\(\)\s]/, "") );
4005
+ }
4006
+
4007
+ var latLng = new google.maps.LatLng(
4008
+ formatCoord(latLngCoords[0]),
4009
+ formatCoord(latLngCoords[1])
4010
+ );
4011
+
4012
+ var zoom = (this.start_zoom ? parseInt(this.start_zoom) : 4);
4013
+
4014
+ if(!this.start_zoom && this.zoom){
4015
+ zoom = parseInt( this.zoom );
4016
+ }
4017
+
4018
+ if(this.map_start_zoom){
4019
+ zoom = parseInt(this.map_start_zoom);
4020
+ }
4021
+
4022
+ var options = {
4023
+ zoom: zoom,
4024
+ center: latLng
4025
+ };
4026
+
4027
+ if(!empty("center"))
4028
+ options.center = new google.maps.LatLng({
4029
+ lat: parseFloat(this.center.lat),
4030
+ lng: parseFloat(this.center.lng)
4031
+ });
4032
+
4033
+ if(!empty("map_start_lat") && !empty("map_start_lng"))
4034
+ {
4035
+ // NB: map_start_lat and map_start_lng are the "real" values. Not sure where start_location comes from
4036
+ options.center = new google.maps.LatLng({
4037
+ lat: parseFloat(this.map_start_lat),
4038
+ lng: parseFloat(this.map_start_lng)
4039
+ });
4040
+ }
4041
+
4042
+ if(this.map_min_zoom && this.map_max_zoom)
4043
+ {
4044
+ options.minZoom = Math.min(this.map_min_zoom, this.map_max_zoom);
4045
+ options.maxZoom = Math.max(this.map_min_zoom, this.map_max_zoom);
4046
+ }
4047
+
4048
+ // NB: Handles legacy checkboxes as well as new, standard controls
4049
+ function isSettingDisabled(value)
4050
+ {
4051
+ if(value === "yes")
4052
+ return true;
4053
+
4054
+ return (value ? true : false);
4055
+ }
4056
+
4057
+ // These settings are all inverted because the checkbox being set means "disabled"
4058
+ options.zoomControl = !isSettingDisabled(this.wpgmza_settings_map_zoom);
4059
+ options.panControl = !isSettingDisabled(this.wpgmza_settings_map_pan);
4060
+ options.mapTypeControl = !isSettingDisabled(this.wpgmza_settings_map_type);
4061
+ options.streetViewControl = !isSettingDisabled(this.wpgmza_settings_map_streetview);
4062
+ options.fullscreenControl = !isSettingDisabled(this.wpgmza_settings_map_full_screen_control);
4063
+
4064
+ options.draggable = !isSettingDisabled(this.wpgmza_settings_map_draggable);
4065
+ options.disableDoubleClickZoom = isSettingDisabled(this.wpgmza_settings_map_clickzoom);
4066
+
4067
+ if(isSettingDisabled(this.wpgmza_settings_map_tilt_controls)){
4068
+ options.rotateControl = false;
4069
+ options.tilt = 0;
4070
+ }
4071
+
4072
+ // NB: This setting is handled differently as setting scrollwheel to true breaks gestureHandling
4073
+ if(this.wpgmza_settings_map_scroll)
4074
+ options.scrollwheel = false;
4075
+
4076
+ if(this.wpgmza_force_greedy_gestures == "greedy"
4077
+ || this.wpgmza_force_greedy_gestures == "yes"
4078
+ || this.wpgmza_force_greedy_gestures == true)
4079
+ {
4080
+ options.gestureHandling = "greedy";
4081
+
4082
+ // Setting this at all will break gesture handling. Make sure we delete it when using greedy gesture handling
4083
+ if(!this.wpgmza_settings_map_scroll && "scrollwheel" in options)
4084
+ delete options.scrollwheel;
4085
+ }
4086
+ else
4087
+ options.gestureHandling = "cooperative";
4088
+
4089
+ switch(parseInt(this.type))
4090
+ {
4091
+ case 2:
4092
+ options.mapTypeId = google.maps.MapTypeId.SATELLITE;
4093
+ break;
4094
+
4095
+ case 3:
4096
+ options.mapTypeId = google.maps.MapTypeId.HYBRID;
4097
+ break;
4098
+
4099
+ case 4:
4100
+ options.mapTypeId = google.maps.MapTypeId.TERRAIN;
4101
+ break;
4102
+
4103
+ default:
4104
+ options.mapTypeId = google.maps.MapTypeId.ROADMAP;
4105
+ break;
4106
+ }
4107
+
4108
+ if(this.wpgmza_theme_data && this.wpgmza_theme_data.length)
4109
+ options.styles = WPGMZA.GoogleMap.parseThemeData(this.wpgmza_theme_data);
4110
+
4111
+ return options;
4112
+ }
4113
+ });
4114
+
4115
+ // js/v8/map.js
4116
+ /**
4117
+ * @namespace WPGMZA
4118
+ * @module Map
4119
+ * @requires WPGMZA.EventDispatcher
4120
+ */
4121
+ jQuery(function($) {
4122
+
4123
+ /**
4124
+ * Base class for maps. <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.
4125
+ * @class WPGMZA.Map
4126
+ * @constructor WPGMZA.Map
4127
+ * @memberof WPGMZA
4128
+ * @param {HTMLElement} element to contain map
4129
+ * @param {object} [options] Options to apply to this map
4130
+ * @augments WPGMZA.EventDispatcher
4131
+ */
4132
+ WPGMZA.Map = function(element, options)
4133
+ {
4134
+ var self = this;
4135
+
4136
+ WPGMZA.assertInstanceOf(this, "Map");
4137
+
4138
+ WPGMZA.EventDispatcher.call(this);
4139
+
4140
+ if(!(element instanceof HTMLElement)){
4141
+ if(!window.elementor){
4142
+ /**
4143
+ * Temporary Solution
4144
+ *
4145
+ * If elementor is active, it won't be an HTML Element just yet, due to preview block loading
4146
+ *
4147
+ * However, our timer initializer will load it later, so we just don't throw the error
4148
+ */
4149
+ throw new Error("Argument must be a HTMLElement");
4150
+ }
4151
+ }
4152
+
4153
+ // NB: This should be moved to a getID function or similar and offloaded to Pro. ID should be fixed to 1 in basic.
4154
+ if(element.hasAttribute("data-map-id"))
4155
+ this.id = element.getAttribute("data-map-id");
4156
+ else
4157
+ this.id = 1;
4158
+
4159
+ if(!/\d+/.test(this.id))
4160
+ throw new Error("Map ID must be an integer");
4161
+
4162
+ WPGMZA.maps.push(this);
4163
+
4164
+ this.element = element;
4165
+ this.element.wpgmzaMap = this;
4166
+ $(this.element).addClass("wpgmza-initialized");
4167
+
4168
+ this.engineElement = element;
4169
+
4170
+ this.markers = [];
4171
+ this.polygons = [];
4172
+ this.polylines = [];
4173
+ this.circles = [];
4174
+ this.rectangles = [];
4175
+
4176
+ this.loadSettings(options);
4177
+
4178
+ this.shortcodeAttributes = {};
4179
+ if($(this.element).attr("data-shortcode-attributes")){
4180
+ try{
4181
+ this.shortcodeAttributes = JSON.parse($(this.element).attr("data-shortcode-attributes"));
4182
+ if(this.shortcodeAttributes.zoom){
4183
+ this.settings.map_start_zoom = parseInt(this.shortcodeAttributes.zoom);
4184
+ }
4185
+ }catch(e) {
4186
+ console.warn("Error parsing shortcode attributes");
4187
+ }
4188
+ }
4189
+
4190
+ if(WPGMZA.getCurrentPage() != WPGMZA.PAGE_MAP_EDIT)
4191
+ this.initStoreLocator();
4192
+ this.setDimensions();
4193
+ this.setAlignment();
4194
+
4195
+ // Init marker filter
4196
+ this.markerFilter = WPGMZA.MarkerFilter.createInstance(this);
4197
+
4198
+ // GDPR
4199
+
4200
+ if(WPGMZA.googleAPIStatus && WPGMZA.googleAPIStatus.code == "USER_CONSENT_NOT_GIVEN") {
4201
+ $(element).append($(WPGMZA.api_consent_html));
4202
+ $(element).css({height: "auto"});
4203
+ }
4204
+
4205
+ // Initialisation
4206
+ this.on("init", function(event) {
4207
+ self.onInit(event);
4208
+ });
4209
+
4210
+ this.on("click", function(event){
4211
+ self.onClick(event);
4212
+ });
4213
+
4214
+ // Legacy support
4215
+ if(WPGMZA.useLegacyGlobals)
4216
+ {
4217
+ // NB: this.id stuff should be moved to Map
4218
+ wpgmzaLegacyGlobals.MYMAP[this.id] = {
4219
+ map: null,
4220
+ bounds: null,
4221
+ mc: null
4222
+ };
4223
+
4224
+ wpgmzaLegacyGlobals.MYMAP.init =
4225
+ wpgmzaLegacyGlobals.MYMAP[this.id].init =
4226
+ wpgmzaLegacyGlobals.MYMAP.placeMarkers =
4227
+ wpgmzaLegacyGlobals.MYMAP[this.id].placeMarkers =
4228
+ function() {
4229
+ console.warn("This function is deprecated and should no longer be used");
4230
+ }
4231
+ }
4232
+ }
4233
+
4234
+ WPGMZA.Map.prototype = Object.create(WPGMZA.EventDispatcher.prototype);
4235
+ WPGMZA.Map.prototype.constructor = WPGMZA.Map;
4236
+ 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"}]}];
4237
+
4238
+ /**
4239
+ * Returns the contructor to be used by createInstance, depending on the selected maps engine.
4240
+ * @method
4241
+ * @memberof WPGMZA.Map
4242
+ * @return {function} The appropriate contructor
4243
+ */
4244
+ WPGMZA.Map.getConstructor = function()
4245
+ {
4246
+ switch(WPGMZA.settings.engine)
4247
+ {
4248
+ case "open-layers":
4249
+ if(WPGMZA.isProVersion())
4250
+ return WPGMZA.OLProMap;
4251
+
4252
+ return WPGMZA.OLMap;
4253
+ break;
4254
+
4255
+ default:
4256
+ if(WPGMZA.isProVersion())
4257
+ return WPGMZA.GoogleProMap;
4258
+
4259
+ return WPGMZA.GoogleMap;
4260
+ break;
4261
+ }
4262
+ }
4263
+
4264
+ /**
4265
+ * Creates an instance of a map, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
4266
+ * @method
4267
+ * @memberof WPGMZA.Map
4268
+ * @param {HTMLElement} element to contain map
4269
+ * @param {object} [options] Options to apply to this map
4270
+ * @return {WPGMZA.Map} An instance of WPGMZA.Map
4271
+ */
4272
+ WPGMZA.Map.createInstance = function(element, options)
4273
+ {
4274
+ var constructor = WPGMZA.Map.getConstructor();
4275
+ return new constructor(element, options);
4276
+ }
4277
+
4278
+ /**
4279
+ * Whether or not the markers have been placed yet
4280
+ *
4281
+ * @name WPGMZA.ProMap#markersPlaced
4282
+ * @type Boolean
4283
+ * @readonly
4284
+ */
4285
+ Object.defineProperty(WPGMZA.Map.prototype, "markersPlaced", {
4286
+
4287
+ get: function() {
4288
+ return this._markersPlaced;
4289
+ },
4290
+
4291
+ set: function(value) {
4292
+ throw new Error("Value is read only");
4293
+ }
4294
+
4295
+ });
4296
+
4297
+ /**
4298
+ * The maps current latitude
4299
+ *
4300
+ * @property lat
4301
+ * @memberof WPGMZA.Map
4302
+ * @name WPGMZA.Map#lat
4303
+ * @type Number
4304
+ */
4305
+ Object.defineProperty(WPGMZA.Map.prototype, "lat", {
4306
+
4307
+ get: function() {
4308
+ return this.getCenter().lat;
4309
+ },
4310
+
4311
+ set: function(value) {
4312
+ var center = this.getCenter();
4313
+ center.lat = value;
4314
+ this.setCenter(center);
4315
+ }
4316
+
4317
+ });
4318
+
4319
+ /**
4320
+ * The maps current longitude
4321
+ *
4322
+ * @property lng
4323
+ * @memberof WPGMZA.Map
4324
+ * @name WPGMZA.Map#lng
4325
+ * @type Number
4326
+ */
4327
+ Object.defineProperty(WPGMZA.Map.prototype, "lng", {
4328
+
4329
+ get: function() {
4330
+ return this.getCenter().lng;
4331
+ },
4332
+
4333
+ set: function(value) {
4334
+ var center = this.getCenter();
4335
+ center.lng = value;
4336
+ this.setCenter(center);
4337
+ }
4338
+
4339
+ });
4340
+
4341
+ /**
4342
+ * The maps current zoom level
4343
+ *
4344
+ * @property zoom
4345
+ * @memberof WPGMZA.Map
4346
+ * @name WPGMZA.Map#zoom
4347
+ * @type Number
4348
+ */
4349
+ Object.defineProperty(WPGMZA.Map.prototype, "zoom", {
4350
+
4351
+ get: function() {
4352
+ return this.getZoom();
4353
+ },
4354
+
4355
+ set: function(value) {
4356
+ this.setZoom(value);
4357
+ }
4358
+
4359
+ });
4360
+
4361
+ /**
4362
+ * Called by the engine specific map classes when the map has fully initialised
4363
+ * @method
4364
+ * @memberof WPGMZA.Map
4365
+ * @param {WPGMZA.Event} The event
4366
+ * @listens module:WPGMZA.Map~init
4367
+ */
4368
+ WPGMZA.Map.prototype.onInit = function(event)
4369
+ {
4370
+ var self = this;
4371
+
4372
+ this.initPreloader();
4373
+
4374
+ if(!("autoFetchFeatures" in this.settings) || (this.settings.autoFetchFeatures !== false))
4375
+ this.fetchFeatures();
4376
+ }
4377
+
4378
+ /**
4379
+ * Initialises the preloader
4380
+ * @method
4381
+ * @memberof WPGMZA.Map
4382
+ * @protected
4383
+ */
4384
+ WPGMZA.Map.prototype.initPreloader = function()
4385
+ {
4386
+ this.preloader = $(WPGMZA.preloaderHTML);
4387
+
4388
+ $(this.preloader).hide();
4389
+
4390
+ $(this.element).append(this.preloader);
4391
+ }
4392
+
4393
+ /**
4394
+ * Shows or hides the maps preloader
4395
+ * @method
4396
+ * @memberof WPGMZA.Map
4397
+ */
4398
+ WPGMZA.Map.prototype.showPreloader = function(show)
4399
+ {
4400
+ if(show)
4401
+ $(this.preloader).show();
4402
+ else
4403
+ $(this.preloader).hide();
4404
+ }
4405
+
4406
+ /**
4407
+ * Loads the maps settings and sets some defaults
4408
+ * @method
4409
+ * @memberof WPGMZA.Map
4410
+ */
4411
+ WPGMZA.Map.prototype.loadSettings = function(options)
4412
+ {
4413
+ var settings = new WPGMZA.MapSettings(this.element);
4414
+ var other_settings = settings.other_settings;
4415
+
4416
+ delete settings.other_settings;
4417
+
4418
+ /*if(other_settings)
4419
+ for(var key in other_settings)
4420
+ settings[key] = other_settings[key];*/
4421
+
4422
+ if(options)
4423
+ for(var key in options)
4424
+ settings[key] = options[key];
4425
+
4426
+ this.settings = settings;
4427
+ }
4428
+
4429
+ WPGMZA.Map.prototype.initStoreLocator = function()
4430
+ {
4431
+ var storeLocatorElement = $(".wpgmza_sl_main_div");
4432
+ if(storeLocatorElement.length)
4433
+ this.storeLocator = WPGMZA.StoreLocator.createInstance(this, storeLocatorElement[0]);
4434
+ }
4435
+
4436
+ /**
4437
+ * Get's arrays of all features for each of the feature types on the map
4438
+ * @method
4439
+ * @protected
4440
+ * @memberof WPGMZA.Map
4441
+ */
4442
+ WPGMZA.Map.prototype.getFeatureArrays = function()
4443
+ {
4444
+ var arrays = WPGMZA.Map.prototype.getFeatureArrays.call(this);
4445
+
4446
+ arrays.heatmaps = this.heatmaps;
4447
+
4448
+ return arrays;
4449
+ }
4450
+
4451
+ /**
4452
+ * Sets options in bulk on map
4453
+ * @method
4454
+ * @memberof WPGMZA.Map
4455
+ */
4456
+ WPGMZA.Map.prototype.setOptions = function(options)
4457
+ {
4458
+ for(var name in options)
4459
+ this.settings[name] = options[name];
4460
+ }
4461
+
4462
+ WPGMZA.Map.prototype.getRESTParameters = function(options)
4463
+ {
4464
+ var defaults = {};
4465
+
4466
+ if(!options || !options.filter)
4467
+ defaults.filter = JSON.stringify(this.markerFilter.getFilteringParameters());
4468
+
4469
+ return $.extend(true, defaults, options);
4470
+ }
4471
+
4472
+ WPGMZA.Map.prototype.fetchFeaturesViaREST = function()
4473
+ {
4474
+ var self = this;
4475
+ var data;
4476
+ var filter = this.markerFilter.getFilteringParameters();
4477
+
4478
+ if(WPGMZA.is_admin == "1")
4479
+ {
4480
+ filter.includeUnapproved = true;
4481
+ filter.excludeIntegrated = true;
4482
+ }
4483
+
4484
+ if(this.shortcodeAttributes.acf_post_id)
4485
+ filter.acfPostID = this.shortcodeAttributes.acf_post_id;
4486
+
4487
+ this.showPreloader(true);
4488
+
4489
+ if(this.fetchFeaturesXhr)
4490
+ this.fetchFeaturesXhr.abort();
4491
+
4492
+ if(!WPGMZA.settings.fetchMarkersBatchSize)
4493
+ {
4494
+ data = this.getRESTParameters({
4495
+ filter: JSON.stringify(filter)
4496
+ });
4497
+
4498
+ this.fetchFeaturesXhr = WPGMZA.restAPI.call("/features/", {
4499
+
4500
+ useCompressedPathVariable: true,
4501
+ data: data,
4502
+ success: function(result, status, xhr) {
4503
+ self.onFeaturesFetched(result);
4504
+ }
4505
+
4506
+ });
4507
+ }
4508
+ else
4509
+ {
4510
+ var offset = 0;
4511
+ var limit = WPGMZA.settings.fetchMarkersBatchSize;
4512
+
4513
+ function fetchNextBatch()
4514
+ {
4515
+ filter.offset = offset;
4516
+ filter.limit = limit;
4517
+
4518
+ data = this.getRESTParameters({
4519
+ filter: JSON.stringify(filter)
4520
+ });
4521
+
4522
+ self.fetchFeaturesXhr = WPGMZA.restAPI.call("/markers/", {
4523
+
4524
+ useCompressedPathVariable: true,
4525
+ data: data,
4526
+ success: function(result, status, xhr) {
4527
+
4528
+ if(result.length)
4529
+ {
4530
+ self.onMarkersFetched(result, true); // Expect more batches
4531
+
4532
+ offset += limit;
4533
+ fetchNextBatch();
4534
+ }
4535
+ else
4536
+ {
4537
+ self.onMarkersFetched(result); // Final batch
4538
+
4539
+ data.exclude = "markers";
4540
+
4541
+ WPGMZA.restAPI.call("/features/", {
4542
+
4543
+ useCompressedPathVariable: true,
4544
+ data: data,
4545
+ success: function(result, status, xhr) {
4546
+ self.onFeaturesFetched(result);
4547
+ }
4548
+
4549
+ });
4550
+ }
4551
+
4552
+ }
4553
+
4554
+ });
4555
+ }
4556
+
4557
+ fetchNextBatch();
4558
+ }
4559
+ }
4560
+
4561
+ WPGMZA.Map.prototype.fetchFeaturesViaXML = function()
4562
+ {
4563
+ var self = this;
4564
+
4565
+ var urls = [
4566
+ WPGMZA.markerXMLPathURL + this.id + "markers.xml"
4567
+ ];
4568
+
4569
+ if(this.mashupIDs)
4570
+ this.mashupIDs.forEach(function(id) {
4571
+ urls.push(WPGMZA.markerXMLPathURL + id + "markers.xml")
4572
+ });
4573
+
4574
+ var unique = urls.filter(function(item, index) {
4575
+ return urls.indexOf(item) == index;
4576
+ });
4577
+
4578
+ urls = unique;
4579
+
4580
+ function fetchFeaturesExcludingMarkersViaREST()
4581
+ {
4582
+ var filter = {
4583
+ map_id: this.id,
4584
+ mashup_ids: this.mashupIDs
4585
+ };
4586
+
4587
+ var data = {
4588
+ filter: JSON.stringify(filter),
4589
+ exclude: "markers"
4590
+ };
4591
+
4592
+ WPGMZA.restAPI.call("/features/", {
4593
+
4594
+ useCompressedPathVariable: true,
4595
+ data: data,
4596
+ success: function(result, status, xhr) {
4597
+ self.onFeaturesFetched(result);
4598
+ }
4599
+
4600
+ });
4601
+ }
4602
+
4603
+ if(window.Worker && window.Blob && window.URL && WPGMZA.settings.enable_asynchronous_xml_parsing)
4604
+ {
4605
+ var source = WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/, "$1");
4606
+ var blob = new Blob([source], {type: "text/javascript"});
4607
+ var worker = new Worker(URL.createObjectURL(blob));
4608
+
4609
+ worker.onmessage = function(event) {
4610
+ self.onMarkersFetched(event.data);
4611
+
4612
+ fetchFeaturesExcludingMarkersViaREST();
4613
+ };
4614
+
4615
+ worker.postMessage({
4616
+ command: "load",
4617
+ protocol: window.location.protocol,
4618
+ urls: urls
4619
+ });
4620
+ }
4621
+ else
4622
+ {
4623
+ var filesLoaded = 0;
4624
+ var converter = new WPGMZA.XMLCacheConverter();
4625
+ var converted = [];
4626
+
4627
+ for(var i = 0; i < urls.length; i++)
4628
+ {
4629
+ $.ajax(urls[i], {
4630
+ success: function(response, status, xhr) {
4631
+ converted = converted.concat( converter.convert(response) );
4632
+
4633
+ if(++filesLoaded == urls.length)
4634
+ {
4635
+ self.onMarkersFetched(converted);
4636
+
4637
+ fetchFeaturesExcludingMarkersViaREST();
4638
+ }
4639
+ }
4640
+ });
4641
+ }
4642
+ }
4643
+ }
4644
+
4645
+ WPGMZA.Map.prototype.fetchFeatures = function()
4646
+ {
4647
+ var self = this;
4648
+
4649
+ if(WPGMZA.settings.wpgmza_settings_marker_pull != WPGMZA.MARKER_PULL_XML || WPGMZA.is_admin == "1")
4650
+ {
4651
+ this.fetchFeaturesViaREST();
4652
+ }
4653
+ else
4654
+ {
4655
+ this.fetchFeaturesViaXML();
4656
+ }
4657
+ }
4658
+
4659
+ WPGMZA.Map.prototype.onFeaturesFetched = function(data)
4660
+ {
4661
+ if(data.markers)
4662
+ this.onMarkersFetched(data.markers);
4663
+
4664
+ for(var type in data)
4665
+ {
4666
+ if(type == "markers")
4667
+ continue; // NB: Ignore markers for now - onMarkersFetched processes them
4668
+
4669
+ var module = type.substr(0, 1).toUpperCase() + type.substr(1).replace(/s$/, "");
4670
+
4671
+ for(var i = 0; i < data[type].length; i++)
4672
+ {
4673
+ var instance = WPGMZA[module].createInstance(data[type][i]);
4674
+ var addFunctionName = "add" + module;
4675
+
4676
+ this[addFunctionName](instance);
4677
+ }
4678
+ }
4679
+ }
4680
+
4681
+ WPGMZA.Map.prototype.onMarkersFetched = function(data, expectMoreBatches)
4682
+ {
4683
+ var self = this;
4684
+ var startFiltered = (this.shortcodeAttributes.cat && this.shortcodeAttributes.cat.length)
4685
+
4686
+ for(var i = 0; i < data.length; i++)
4687
+ {
4688
+ var obj = data[i];
4689
+ var marker = WPGMZA.Marker.createInstance(obj);
4690
+
4691
+ if(startFiltered)
4692
+ {
4693
+ marker.isFiltered = true;
4694
+ marker.setVisible(false);
4695
+ }
4696
+
4697
+ this.addMarker(marker);
4698
+ }
4699
+
4700
+ if(expectMoreBatches)
4701
+ return;
4702
+
4703
+ this.showPreloader(false);
4704
+
4705
+ var triggerEvent = function()
4706
+ {
4707
+ self._markersPlaced = true;
4708
+ self.trigger("markersplaced");
4709
+ self.off("filteringcomplete", triggerEvent);
4710
+ }
4711
+
4712
+ if(this.shortcodeAttributes.cat)
4713
+ {
4714
+ var categories = this.shortcodeAttributes.cat.split(",");
4715
+
4716
+ // Set filtering controls
4717
+ var select = $("select[mid='" + this.id + "'][name='wpgmza_filter_select']");
4718
+
4719
+ for(var i = 0; i < categories.length; i++)
4720
+ {
4721
+ $("input[type='checkbox'][mid='" + this.id + "'][value='" + categories[i] + "']").prop("checked", true);
4722
+ select.val(categories[i]);
4723
+ }
4724
+
4725
+ this.on("filteringcomplete", triggerEvent);
4726
+
4727
+ // Force category ID's in case no filtering controls are present
4728
+ this.markerFilter.update({
4729
+ categories: categories
4730
+ });
4731
+ }
4732
+ else
4733
+ triggerEvent();
4734
+
4735
+ //Check to see if they have added markers in the shortcode
4736
+ if(this.shortcodeAttributes.markers)
4737
+ {
4738
+ //remove all , from the shortcode to find ID's
4739
+ var arr = this.shortcodeAttributes.markers.split(",");
4740
+
4741
+ //Store all the markers ID's
4742
+ var markers = [];
4743
+
4744
+ //loop through the shortcode
4745
+ for (var i = 0; i < arr.length; i++) {
4746
+ var id = arr[i];
4747
+ id = id.replace(' ', '');
4748
+ var marker = this.getMarkerByID(id);
4749
+
4750
+ //push the marker infromation to markers
4751
+ markers.push(marker);
4752
+ }
4753
+
4754
+ //call fitMapBoundsToMarkers function on markers ID's in shortcode
4755
+ this.fitMapBoundsToMarkers(markers);
4756
+ }
4757
+ }
4758
+
4759
+ WPGMZA.Map.prototype.fetchFeaturesViaXML = function()
4760
+ {
4761
+ var self = this;
4762
+
4763
+ var urls = [
4764
+ WPGMZA.markerXMLPathURL + this.id + "markers.xml"
4765
+ ];
4766
+
4767
+ if(this.mashupIDs)
4768
+ this.mashupIDs.forEach(function(id) {
4769
+ urls.push(WPGMZA.markerXMLPathURL + id + "markers.xml")
4770
+ });
4771
+
4772
+ var unique = urls.filter(function(item, index) {
4773
+ return urls.indexOf(item) == index;
4774
+ });
4775
+
4776
+ urls = unique;
4777
+
4778
+ function fetchFeaturesExcludingMarkersViaREST()
4779
+ {
4780
+ var filter = {
4781
+ map_id: this.id,
4782
+ mashup_ids: this.mashupIDs
4783
+ };
4784
+
4785
+ var data = {
4786
+ filter: JSON.stringify(filter),
4787
+ exclude: "markers"
4788
+ };
4789
+
4790
+ WPGMZA.restAPI.call("/features/", {
4791
+
4792
+ useCompressedPathVariable: true,
4793
+ data: data,
4794
+ success: function(result, status, xhr) {
4795
+ self.onFeaturesFetched(result);
4796
+ }
4797
+
4798
+ });
4799
+ }
4800
+
4801
+ if(window.Worker && window.Blob && window.URL && WPGMZA.settings.enable_asynchronous_xml_parsing)
4802
+ {
4803
+ var source = WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/, "$1");
4804
+ var blob = new Blob([source], {type: "text/javascript"});
4805
+ var worker = new Worker(URL.createObjectURL(blob));
4806
+
4807
+ worker.onmessage = function(event) {
4808
+ self.onMarkersFetched(event.data);
4809
+
4810
+ fetchFeaturesExcludingMarkersViaREST();
4811
+ };
4812
+
4813
+ worker.postMessage({
4814
+ command: "load",
4815
+ protocol: window.location.protocol,
4816
+ urls: urls
4817
+ });
4818
+ }
4819
+ else
4820
+ {
4821
+ var filesLoaded = 0;
4822
+ var converter = new WPGMZA.XMLCacheConverter();
4823
+ var converted = [];
4824
+
4825
+ for(var i = 0; i < urls.length; i++)
4826
+ {
4827
+ $.ajax(urls[i], {
4828
+ success: function(response, status, xhr) {
4829
+ converted = converted.concat( converter.convert(response) );
4830
+
4831
+ if(++filesLoaded == urls.length)
4832
+ {
4833
+ self.onMarkersFetched(converted);
4834
+
4835
+ fetchFeaturesExcludingMarkersViaREST();
4836
+ }
4837
+ }
4838
+ });
4839
+ }
4840
+ }
4841
+ }
4842
+
4843
+ WPGMZA.Map.prototype.fetchFeatures = function()
4844
+ {
4845
+ var self = this;
4846
+
4847
+ if(WPGMZA.settings.wpgmza_settings_marker_pull != WPGMZA.MARKER_PULL_XML || WPGMZA.is_admin == "1")
4848
+ {
4849
+ this.fetchFeaturesViaREST();
4850
+ }
4851
+ else
4852
+ {
4853
+ this.fetchFeaturesViaXML();
4854
+ }
4855
+ }
4856
+
4857
+ WPGMZA.Map.prototype.onFeaturesFetched = function(data)
4858
+ {
4859
+ if(data.markers)
4860
+ this.onMarkersFetched(data.markers);
4861
+
4862
+ for(var type in data)
4863
+ {
4864
+ if(type == "markers")
4865
+ continue; // NB: Ignore markers for now - onMarkersFetched processes them
4866
+
4867
+ var module = type.substr(0, 1).toUpperCase() + type.substr(1).replace(/s$/, "");
4868
+
4869
+ for(var i = 0; i < data[type].length; i++)
4870
+ {
4871
+ var instance = WPGMZA[module].createInstance(data[type][i]);
4872
+ var addFunctionName = "add" + module;
4873
+
4874
+ this[addFunctionName](instance);
4875
+ }
4876
+ }
4877
+ }
4878
+
4879
+ WPGMZA.Map.prototype.onMarkersFetched = function(data, expectMoreBatches)
4880
+ {
4881
+ var self = this;
4882
+ var startFiltered = (this.shortcodeAttributes.cat && this.shortcodeAttributes.cat.length)
4883
+
4884
+ for(var i = 0; i < data.length; i++)
4885
+ {
4886
+ var obj = data[i];
4887
+ var marker = WPGMZA.Marker.createInstance(obj);
4888
+
4889
+ if(startFiltered)
4890
+ {
4891
+ marker.isFiltered = true;
4892
+ marker.setVisible(false);
4893
+ }
4894
+
4895
+ this.addMarker(marker);
4896
+ }
4897
+
4898
+ if(expectMoreBatches)
4899
+ return;
4900
+
4901
+ this.showPreloader(false);
4902
+
4903
+ var triggerEvent = function()
4904
+ {
4905
+ self._markersPlaced = true;
4906
+ self.trigger("markersplaced");
4907
+ self.off("filteringcomplete", triggerEvent);
4908
+ }
4909
+
4910
+ if(this.shortcodeAttributes.cat)
4911
+ {
4912
+ var categories = this.shortcodeAttributes.cat.split(",");
4913
+
4914
+ // Set filtering controls
4915
+ var select = $("select[mid='" + this.id + "'][name='wpgmza_filter_select']");
4916
+
4917
+ for(var i = 0; i < categories.length; i++)
4918
+ {
4919
+ $("input[type='checkbox'][mid='" + this.id + "'][value='" + categories[i] + "']").prop("checked", true);
4920
+ select.val(categories[i]);
4921
+ }
4922
+
4923
+ this.on("filteringcomplete", triggerEvent);
4924
+
4925
+ // Force category ID's in case no filtering controls are present
4926
+ this.markerFilter.update({
4927
+ categories: categories
4928
+ });
4929
+ }
4930
+ else
4931
+ triggerEvent();
4932
+
4933
+ //Check to see if they have added markers in the shortcode
4934
+ if(this.shortcodeAttributes.markers)
4935
+ {
4936
+ //remove all , from the shortcode to find ID's
4937
+ var arr = this.shortcodeAttributes.markers.split(",");
4938
+
4939
+ //Store all the markers ID's
4940
+ var markers = [];
4941
+
4942
+ //loop through the shortcode
4943
+ for (var i = 0; i < arr.length; i++) {
4944
+ var id = arr[i];
4945
+ id = id.replace(' ', '');
4946
+ var marker = this.getMarkerByID(id);
4947
+
4948
+ //push the marker infromation to markers
4949
+ markers.push(marker);
4950
+ }
4951
+
4952
+ //call fitMapBoundsToMarkers function on markers ID's in shortcode
4953
+ this.fitMapBoundsToMarkers(markers);
4954
+ }
4955
+ }
4956
+
4957
+ /**
4958
+ * Gets the distance between two latLngs in kilometers
4959
+ * NB: Static function
4960
+ * @return number
4961
+ */
4962
+ var earthRadiusMeters = 6371;
4963
+ var piTimes360 = Math.PI / 360;
4964
+
4965
+ function deg2rad(deg) {
4966
+ return deg * (Math.PI/180)
4967
+ };
4968
+
4969
+ /**
4970
+ * This gets the distance in kilometers between two latitude / longitude points
4971
+ * TODO: Move this to the distance class, or the LatLng class
4972
+ * @method
4973
+ * @memberof WPGMZA.Map
4974
+ * @param {number} lat1 Latitude from the first coordinate pair
4975
+ * @param {number} lon1 Longitude from the first coordinate pair
4976
+ * @param {number} lat2 Latitude from the second coordinate pair
4977
+ * @param {number} lon1 Longitude from the second coordinate pair
4978
+ * @return {number} The distance between the latitude and longitudes, in kilometers
4979
+ */
4980
+ WPGMZA.Map.getGeographicDistance = function(lat1, lon1, lat2, lon2)
4981
+ {
4982
+ var dLat = deg2rad(lat2-lat1);
4983
+ var dLon = deg2rad(lon2-lon1);
4984
+
4985
+ var a =
4986
+ Math.sin(dLat/2) * Math.sin(dLat/2) +
4987
+ Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
4988
+ Math.sin(dLon/2) * Math.sin(dLon/2);
4989
+
4990
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
4991
+ var d = earthRadiusMeters * c; // Distance in km
4992
+
4993
+ return d;
4994
+ }
4995
+
4996
+ /**
4997
+ * Centers the map on the supplied latitude and longitude
4998
+ * @method
4999
+ * @memberof WPGMZA.Map
5000
+ * @param {object|WPGMZA.LatLng} latLng A LatLng literal or an instance of WPGMZA.LatLng
5001
+ */
5002
+ WPGMZA.Map.prototype.setCenter = function(latLng)
5003
+ {
5004
+ if(!("lat" in latLng && "lng" in latLng))
5005
+ throw new Error("Argument is not an object with lat and lng");
5006
+ }
5007
+
5008
+ /**
5009
+ * Sets the dimensions of the map engine element
5010
+ * @method
5011
+ * @memberof WPGMZA.Map
5012
+ * @param {number} width Width as a CSS string
5013
+ * @param {number} height Height as a CSS string
5014
+ */
5015
+ WPGMZA.Map.prototype.setDimensions = function(width, height)
5016
+ {
5017
+ if(arguments.length == 0)
5018
+ {
5019
+ if(this.settings.map_width)
5020
+ width = this.settings.map_width;
5021
+ else
5022
+ width = "100";
5023
+
5024
+ if(this.settings.map_width_type)
5025
+ width += this.settings.map_width_type.replace("\\", "");
5026
+ else
5027
+ width += "%";
5028
+
5029
+ if(this.settings.map_height)
5030
+ height = this.settings.map_height;
5031
+ else
5032
+ height = "400";
5033
+
5034
+ if(this.settings.map_height_type)
5035
+ height += this.settings.map_height_type.replace("\\", "");
5036
+ else
5037
+ height += "px";
5038
+ }
5039
+
5040
+ $(this.engineElement).css({
5041
+ width: width,
5042
+ height: height
5043
+ });
5044
+ }
5045
+
5046
+ WPGMZA.Map.prototype.setAlignment = function()
5047
+ {
5048
+ switch(parseInt(this.settings.wpgmza_map_align))
5049
+ {
5050
+ case 1:
5051
+ $(this.element).css({"float": "left"});
5052
+ break;
5053
+
5054
+ case 2:
5055
+ $(this.element).css({
5056
+ "margin-left": "auto",
5057
+ "margin-right": "auto"
5058
+ });
5059
+ break;
5060
+
5061
+ case 3:
5062
+ $(this.element).css({"float": "right"});
5063
+ break;
5064
+
5065
+ default:
5066
+ break;
5067
+ }
5068
+ }
5069
+
5070
+ /**
5071
+ * Adds the specified marker to this map
5072
+ * @method
5073
+ * @memberof WPGMZA.Map
5074
+ * @param {WPGMZA.Marker} marker The marker to add
5075
+ * @fires markeradded
5076
+ * @fires WPGMZA.Marker#added
5077
+ * @throws Argument must be an instance of WPGMZA.Marker
5078
+ */
5079
+ WPGMZA.Map.prototype.addMarker = function(marker)
5080
+ {
5081
+ if(!(marker instanceof WPGMZA.Marker))
5082
+ throw new Error("Argument must be an instance of WPGMZA.Marker");
5083
+
5084
+ marker.map = this;
5085
+ marker.parent = this;
5086
+
5087
+ this.markers.push(marker);
5088
+ this.dispatchEvent({type: "markeradded", marker: marker});
5089
+ marker.dispatchEvent({type: "added"});
5090
+ }
5091
+
5092
+ /**
5093
+ * Removes the specified marker from this map
5094
+ * @method
5095
+ * @memberof WPGMZA.Map
5096
+ * @param {WPGMZA.Marker} marker The marker to remove
5097
+ * @fires markerremoved
5098
+ * @fires WPGMZA.Marker#removed
5099
+ * @throws Argument must be an instance of WPGMZA.Marker
5100
+ * @throws Wrong map error
5101
+ */
5102
+ WPGMZA.Map.prototype.removeMarker = function(marker)
5103
+ {
5104
+ if(!(marker instanceof WPGMZA.Marker))
5105
+ throw new Error("Argument must be an instance of WPGMZA.Marker");
5106
+
5107
+ if(marker.map !== this)
5108
+ throw new Error("Wrong map error");
5109
+
5110
+ if(marker.infoWindow)
5111
+ marker.infoWindow.close();
5112
+
5113
+ marker.map = null;
5114
+ marker.parent = null;
5115
+
5116
+ var index = this.markers.indexOf(marker);
5117
+
5118
+ if(index == -1)
5119
+ throw new Error("Marker not found in marker array");
5120
+
5121
+ this.markers.splice(index, 1);
5122
+
5123
+ this.dispatchEvent({type: "markerremoved", marker: marker});
5124
+ marker.dispatchEvent({type: "removed"});
5125
+ }
5126
+
5127
+ WPGMZA.Map.prototype.removeAllMarkers = function(options)
5128
+ {
5129
+ for(var i = this.markers.length - 1; i >= 0; i--)
5130
+ this.removeMarker(this.markers[i]);
5131
+ }
5132
+
5133
+ /**
5134
+ * Gets a marker by ID
5135
+ * @method
5136
+ * @memberof WPGMZA.Map
5137
+ * @param {int} id The ID of the marker to get
5138
+ * @return {WPGMZA.Marker|null} The marker, or null if no marker with the specified ID is found
5139
+ */
5140
+ WPGMZA.Map.prototype.getMarkerByID = function(id)
5141
+ {
5142
+ for(var i = 0; i < this.markers.length; i++)
5143
+ {
5144
+ if(this.markers[i].id == id)
5145
+ return this.markers[i];
5146
+ }
5147
+
5148
+ return null;
5149
+ }
5150
+
5151
+ WPGMZA.Map.prototype.getMarkerByTitle = function(title)
5152
+ {
5153
+ if(typeof title == "string")
5154
+ for(var i = 0; i < this.markers.length; i++)
5155
+ {
5156
+ if(this.markers[i].title == title)
5157
+ return this.markers[i];
5158
+ }
5159
+ else if(title instanceof RegExp)
5160
+ for(var i = 0; i < this.markers.length; i++)
5161
+ {
5162
+ if(title.test(this.markers[i].title))
5163
+ return this.markers[i];
5164
+ }
5165
+ else
5166
+ throw new Error("Invalid argument");
5167
+
5168
+ return null;
5169
+ }
5170
+
5171
+ /**
5172
+ * Removes a marker by ID
5173
+ * @method
5174
+ * @memberof WPGMZA.Map
5175
+ * @param {int} id The ID of the marker to remove
5176
+ * @fires markerremoved
5177
+ * @fires WPGMZA.Marker#removed
5178
+ */
5179
+ WPGMZA.Map.prototype.removeMarkerByID = function(id)
5180
+ {
5181
+ var marker = this.getMarkerByID(id);
5182
+
5183
+ if(!marker)
5184
+ return;
5185
+
5186
+ this.removeMarker(marker);
5187
+ }
5188
+
5189
+ /**
5190
+ * Adds the specified polygon to this map
5191
+ * @method
5192
+ * @memberof WPGMZA.Map
5193
+ * @param {WPGMZA.Polygon} polygon The polygon to add
5194
+ * @fires polygonadded
5195
+ * @throws Argument must be an instance of WPGMZA.Polygon
5196
+ */
5197
+ WPGMZA.Map.prototype.addPolygon = function(polygon)
5198
+ {
5199
+ if(!(polygon instanceof WPGMZA.Polygon))
5200
+ throw new Error("Argument must be an instance of WPGMZA.Polygon");
5201
+
5202
+ polygon.map = this;
5203
+
5204
+ this.polygons.push(polygon);
5205
+ this.dispatchEvent({type: "polygonadded", polygon: polygon});
5206
+ }
5207
+
5208
+ /**
5209
+ * Removes the specified polygon from this map
5210
+ * @method
5211
+ * @memberof WPGMZA.Map
5212
+ * @param {WPGMZA.Polygon} polygon The polygon to remove
5213
+ * @fires polygonremoved
5214
+ * @throws Argument must be an instance of WPGMZA.Polygon
5215
+ * @throws Wrong map error
5216
+ */
5217
+ WPGMZA.Map.prototype.removePolygon = function(polygon)
5218
+ {
5219
+ if(!(polygon instanceof WPGMZA.Polygon))
5220
+ throw new Error("Argument must be an instance of WPGMZA.Polygon");
5221
+
5222
+ if(polygon.map !== this)
5223
+ throw new Error("Wrong map error");
5224
+
5225
+ polygon.map = null;
5226
+
5227
+ this.polygons.splice(this.polygons.indexOf(polygon), 1);
5228
+ this.dispatchEvent({type: "polygonremoved", polygon: polygon});
5229
+ }
5230
+
5231
+ /**
5232
+ * Gets a polygon by ID
5233
+ * @method
5234
+ * @memberof WPGMZA.Map
5235
+ * @param {int} id The ID of the polygon to get
5236
+ * @return {WPGMZA.Polygon|null} The polygon, or null if no polygon with the specified ID is found
5237
+ */
5238
+ WPGMZA.Map.prototype.getPolygonByID = function(id)
5239
+ {
5240
+ for(var i = 0; i < this.polygons.length; i++)
5241
+ {
5242
+ if(this.polygons[i].id == id)
5243
+ return this.polygons[i];
5244
+ }
5245
+
5246
+ return null;
5247
+ }
5248
+
5249
+ /**
5250
+ * Removes a polygon by ID
5251
+ * @method
5252
+ * @memberof WPGMZA.Map
5253
+ * @param {int} id The ID of the polygon to remove
5254
+ */
5255
+ WPGMZA.Map.prototype.removePolygonByID = function(id)
5256
+ {
5257
+ var polygon = this.getPolygonByID(id);
5258
+
5259
+ if(!polygon)
5260
+ return;
5261
+
5262
+ this.removePolygon(polygon);
5263
+ }
5264
+
5265
+ /**
5266
+ * Gets a polyline by ID
5267
+ * @return void
5268
+ */
5269
+ WPGMZA.Map.prototype.getPolylineByID = function(id)
5270
+ {
5271
+ for(var i = 0; i < this.polylines.length; i++)
5272
+ {
5273
+ if(this.polylines[i].id == id)
5274
+ return this.polylines[i];
5275
+ }
5276
+
5277
+ return null;
5278
+ }
5279
+
5280
+ /**
5281
+ * Adds the specified polyline to this map
5282
+ * @method
5283
+ * @memberof WPGMZA.Map
5284
+ * @param {WPGMZA.Polyline} polyline The polyline to add
5285
+ * @fires polylineadded
5286
+ * @throws Argument must be an instance of WPGMZA.Polyline
5287
+ */
5288
+ WPGMZA.Map.prototype.addPolyline = function(polyline)
5289
+ {
5290
+ if(!(polyline instanceof WPGMZA.Polyline))
5291
+ throw new Error("Argument must be an instance of WPGMZA.Polyline");
5292
+
5293
+ polyline.map = this;
5294
+
5295
+ this.polylines.push(polyline);
5296
+ this.dispatchEvent({type: "polylineadded", polyline: polyline});
5297
+ }
5298
+
5299
+ /**
5300
+ * Removes the specified polyline from this map
5301
+ * @method
5302
+ * @memberof WPGMZA.Map
5303
+ * @param {WPGMZA.Polyline} polyline The polyline to remove
5304
+ * @fires polylineremoved
5305
+ * @throws Argument must be an instance of WPGMZA.Polyline
5306
+ * @throws Wrong map error
5307
+ */
5308
+ WPGMZA.Map.prototype.removePolyline = function(polyline)
5309
+ {
5310
+ if(!(polyline instanceof WPGMZA.Polyline))
5311
+ throw new Error("Argument must be an instance of WPGMZA.Polyline");
5312
+
5313
+ if(polyline.map !== this)
5314
+ throw new Error("Wrong map error");
5315
+
5316
+ polyline.map = null;
5317
+
5318
+ this.polylines.splice(this.polylines.indexOf(polyline), 1);
5319
+ this.dispatchEvent({type: "polylineremoved", polyline: polyline});
5320
+ }
5321
+
5322
+ /**
5323
+ * Gets a polyline by ID
5324
+ * @method
5325
+ * @memberof WPGMZA.Map
5326
+ * @param {int} id The ID of the polyline to get
5327
+ * @return {WPGMZA.Polyline|null} The polyline, or null if no polyline with the specified ID is found
5328
+ */
5329
+ WPGMZA.Map.prototype.getPolylineByID = function(id)
5330
+ {
5331
+ for(var i = 0; i < this.polylines.length; i++)
5332
+ {
5333
+ if(this.polylines[i].id == id)
5334
+ return this.polylines[i];
5335
+ }
5336
+
5337
+ return null;
5338
+ }
5339
+
5340
+ /**
5341
+ * Removes a polyline by ID
5342
+ * @method
5343
+ * @memberof WPGMZA.Map
5344
+ * @param {int} id The ID of the polyline to remove
5345
+ */
5346
+ WPGMZA.Map.prototype.removePolylineByID = function(id)
5347
+ {
5348
+ var polyline = this.getPolylineByID(id);
5349
+
5350
+ if(!polyline)
5351
+ return;
5352
+
5353
+ this.removePolyline(polyline);
5354
+ }
5355
+
5356
+ /**
5357
+ * Adds the specified circle to this map
5358
+ * @method
5359
+ * @memberof WPGMZA.Map
5360
+ * @param {WPGMZA.Circle} circle The circle to add
5361
+ * @fires polygonadded
5362
+ * @throws Argument must be an instance of WPGMZA.Circle
5363
+ */
5364
+ WPGMZA.Map.prototype.addCircle = function(circle)
5365
+ {
5366
+ if(!(circle instanceof WPGMZA.Circle))
5367
+ throw new Error("Argument must be an instance of WPGMZA.Circle");
5368
+
5369
+ circle.map = this;
5370
+
5371
+ this.circles.push(circle);
5372
+ this.dispatchEvent({type: "circleadded", circle: circle});
5373
+ }
5374
+
5375
+ /**
5376
+ * Removes the specified circle from this map
5377
+ * @method
5378
+ * @memberof WPGMZA.Map
5379
+ * @param {WPGMZA.Circle} circle The circle to remove
5380
+ * @fires circleremoved
5381
+ * @throws Argument must be an instance of WPGMZA.Circle
5382
+ * @throws Wrong map error
5383
+ */
5384
+ WPGMZA.Map.prototype.removeCircle = function(circle)
5385
+ {
5386
+ if(!(circle instanceof WPGMZA.Circle))
5387
+ throw new Error("Argument must be an instance of WPGMZA.Circle");
5388
+
5389
+ if(circle.map !== this)
5390
+ throw new Error("Wrong map error");
5391
+
5392
+ circle.map = null;
5393
+
5394
+ this.circles.splice(this.circles.indexOf(circle), 1);
5395
+ this.dispatchEvent({type: "circleremoved", circle: circle});
5396
+ }
5397
+
5398
+ /**
5399
+ * Gets a circle by ID
5400
+ * @method
5401
+ * @memberof WPGMZA.Map
5402
+ * @param {int} id The ID of the circle to get
5403
+ * @return {WPGMZA.Circle|null} The circle, or null if no circle with the specified ID is found
5404
+ */
5405
+ WPGMZA.Map.prototype.getCircleByID = function(id)
5406
+ {
5407
+ for(var i = 0; i < this.circles.length; i++)
5408
+ {
5409
+ if(this.circles[i].id == id)
5410
+ return this.circles[i];
5411
+ }
5412
+
5413
+ return null;
5414
+ }
5415
+
5416
+ /**
5417
+ * Removes a circle by ID
5418
+ * @method
5419
+ * @memberof WPGMZA.Map
5420
+ * @param {int} id The ID of the circle to remove
5421
+ */
5422
+ WPGMZA.Map.prototype.removeCircleByID = function(id)
5423
+ {
5424
+ var circle = this.getCircleByID(id);
5425
+
5426
+ if(!circle)
5427
+ return;
5428
+
5429
+ this.removeCircle(circle);
5430
+ }
5431
+
5432
+ WPGMZA.Map.prototype.addRectangle = function(rectangle)
5433
+ {
5434
+ if(!(rectangle instanceof WPGMZA.Rectangle))
5435
+ throw new Error("Argument must be an instance of WPGMZA.Rectangle");
5436
+
5437
+ rectangle.map = this;
5438
+
5439
+ this.rectangles.push(rectangle);
5440
+ this.dispatchEvent({type: "rectangleadded", rectangle: rectangle});
5441
+ }
5442
+
5443
+ WPGMZA.Map.prototype.removeRectangle = function(rectangle)
5444
+ {
5445
+ if(!(rectangle instanceof WPGMZA.Rectangle))
5446
+ throw new Error("Argument must be an instance of WPGMZA.Rectangle");
5447
+
5448
+ if(rectangle.map !== this)
5449
+ throw new Error("Wrong map error");
5450
+
5451
+ rectangle.map = null;
5452
+
5453
+ this.rectangles.splice(this.rectangles.indexOf(rectangle), 1);
5454
+ this.dispatchEvent({type: "rectangleremoved", rectangle: rectangle});
5455
+ }
5456
+
5457
+ WPGMZA.Map.prototype.getRectangleByID = function(id)
5458
+ {
5459
+ for(var i = 0; i < this.rectangles.length; i++)
5460
+ {
5461
+ if(this.rectangles[i].id == id)
5462
+ return this.rectangles[i];
5463
+ }
5464
+
5465
+ return null;
5466
+ }
5467
+
5468
+ WPGMZA.Map.prototype.removeRectangleByID = function(id)
5469
+ {
5470
+ var rectangle = this.getRectangleByID(id);
5471
+
5472
+ if(!rectangle)
5473
+ return;
5474
+
5475
+ this.removeRectangle(rectangle);
5476
+ }
5477
+
5478
+ /**
5479
+ * Resets the map latitude, longitude and zoom to their starting values in the map settings.
5480
+ * @method
5481
+ * @memberof WPGMZA.Map
5482
+ */
5483
+ WPGMZA.Map.prototype.resetBounds = function()
5484
+ {
5485
+ var latlng = new WPGMZA.LatLng(this.settings.map_start_lat, this.settings.map_start_lng);
5486
+ this.panTo(latlng);
5487
+ this.setZoom(this.settings.map_start_zoom);
5488
+ }
5489
+
5490
+ /**
5491
+ * Nudges the map viewport by the given pixel coordinates
5492
+ * @method
5493
+ * @memberof WPGMZA.Map
5494
+ * @param {number} x Number of pixels to nudge along the x axis
5495
+ * @param {number} y Number of pixels to nudge along the y axis
5496
+ * @throws Invalid coordinates supplied
5497
+ */
5498
+ WPGMZA.Map.prototype.nudge = function(x, y)
5499
+ {
5500
+ var nudged = this.nudgeLatLng(this.getCenter(), x, y);
5501
+
5502
+ this.setCenter(nudged);
5503
+ }
5504
+
5505
+ WPGMZA.Map.prototype.nudgeLatLng = function(latLng, x, y)
5506
+ {
5507
+ var pixels = this.latLngToPixels(latLng);
5508
+
5509
+ pixels.x += parseFloat(x);
5510
+ pixels.y += parseFloat(y);
5511
+
5512
+ if(isNaN(pixels.x) || isNaN(pixels.y))
5513
+ throw new Error("Invalid coordinates supplied");
5514
+
5515
+ return this.pixelsToLatLng(pixels);
5516
+ }
5517
+
5518
+ WPGMZA.Map.prototype.animateNudge = function(x, y, origin, milliseconds)
5519
+ {
5520
+ var nudged;
5521
+
5522
+ if(!origin)
5523
+ origin = this.getCenter();
5524
+ else if(!(origin instanceof WPGMZA.LatLng))
5525
+ throw new Error("Origin must be an instance of WPGMZA.LatLng");
5526
+
5527
+ nudged = this.nudgeLatLng(origin, x, y);
5528
+
5529
+ if(!milliseconds)
5530
+ milliseconds = WPGMZA.getScrollAnimationDuration();
5531
+
5532
+ $(this).animate({
5533
+ lat: nudged.lat,
5534
+ lng: nudged.lng
5535
+ }, milliseconds);
5536
+ }
5537
+
5538
+ /**
5539
+ * Called when the window resizes
5540
+ * @method
5541
+ * @memberof WPGMZA.Map
5542
+ */
5543
+ WPGMZA.Map.prototype.onWindowResize = function(event)
5544
+ {
5545
+
5546
+ }
5547
+
5548
+ /**
5549
+ * Called when the engine map div is resized
5550
+ * @method
5551
+ * @memberof WPGMZA.Map
5552
+ */
5553
+ WPGMZA.Map.prototype.onElementResized = function(event)
5554
+ {
5555
+
5556
+ }
5557
+
5558
+ /**
5559
+ * Called when the map viewport bounds change. Fires the legacy bounds_changed event.
5560
+ * @method
5561
+ * @memberof WPGMZA.Map
5562
+ * @fires boundschanged
5563
+ * @fires bounds_changed
5564
+ */
5565
+ WPGMZA.Map.prototype.onBoundsChanged = function(event)
5566
+ {
5567
+ // Native events
5568
+ this.trigger("boundschanged");
5569
+
5570
+ // Google / legacy compatibility events
5571
+ this.trigger("bounds_changed");
5572
+ }
5573
+
5574
+ /**
5575
+ * Called when the map viewport becomes idle (eg movement done, tiles loaded)
5576
+ * @method
5577
+ * @memberof WPGMZA.Map
5578
+ * @fires idle
5579
+ */
5580
+ WPGMZA.Map.prototype.onIdle = function(event)
5581
+ {
5582
+ this.trigger("idle");
5583
+ }
5584
+
5585
+ WPGMZA.Map.prototype.onClick = function(event){
5586
+
5587
+ }
5588
+
5589
+ /**
5590
+ * Find out if the map has visible markers. Only counts filterable markers (not the user location marker, store locator center point marker, etc.)
5591
+ * @method
5592
+ * @memberof WPGMZA.Map
5593
+ * @returns {Boolean} True if at least one marker is visible
5594
+ */
5595
+ WPGMZA.Map.prototype.hasVisibleMarkers = function()
5596
+ {
5597
+ var length = this.markers.length, marker;
5598
+
5599
+ for(var i = 0; i < length; i++)
5600
+ {
5601
+ marker = this.markers[i];
5602
+
5603
+ if(marker.isFilterable && marker.getVisible())
5604
+ return true;
5605
+ }
5606
+
5607
+ return false;
5608
+ }
5609
+
5610
+ WPGMZA.Map.prototype.closeAllInfoWindows = function()
5611
+ {
5612
+ this.markers.forEach(function(marker) {
5613
+
5614
+ if(marker.infoWindow)
5615
+ marker.infoWindow.close();
5616
+
5617
+ });
5618
+ }
5619
+
5620
+ $(document).ready(function(event) {
5621
+
5622
+ if(!WPGMZA.visibilityWorkaroundIntervalID)
5623
+ {
5624
+ // This should handle all cases of tabs, accordions or any other offscreen maps
5625
+ var invisibleMaps = jQuery(".wpgmza_map:hidden");
5626
+
5627
+ WPGMZA.visibilityWorkaroundIntervalID = setInterval(function() {
5628
+
5629
+ jQuery(invisibleMaps).each(function(index, el) {
5630
+
5631
+ if(jQuery(el).is(":visible"))
5632
+ {
5633
+ var id = jQuery(el).attr("data-map-id");
5634
+ var map = WPGMZA.getMapByID(id);
5635
+
5636
+ map.onElementResized();
5637
+
5638
+ invisibleMaps.splice(invisibleMaps.toArray().indexOf(el), 1);
5639
+ }
5640
+
5641
+ });
5642
+
5643
+ }, 1000);
5644
+ }
5645
+ });
5646
  });
5647
 
5648
  // js/v8/maps-engine-dialog.js
7505
  }
7506
 
7507
  });
7508
+
7509
+ Object.defineProperty(WPGMZA.Rectangle.prototype, "strokeColor", {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7510
 
7511
+ enumerable: true,
 
 
 
7512
 
7513
+ "get": function()
7514
+ {
7515
+ return "#000000";
7516
+ }
7517
 
7518
+ });
7519
+
7520
+ Object.defineProperty(WPGMZA.Rectangle.prototype, "strokeOpacity", {
7521
 
7522
+ enumerable: true,
 
7523
 
7524
+ "get": function()
7525
+ {
7526
+ return 0;
7527
+ }
7528
 
7529
+ });
7530
+
7531
+ WPGMZA.Rectangle.createInstance = function(options, engineRectangle)
7532
+ {
7533
+ var constructor;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7534
 
7535
+ switch(WPGMZA.settings.engine)
 
 
7536
  {
7537
+ case "open-layers":
7538
+ constructor = WPGMZA.OLRectangle;
7539
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7540
 
7541
+ default:
7542
+ constructor = WPGMZA.GoogleRectangle;
7543
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7544
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7545
 
7546
+ return new constructor(options, engineRectangle);
7547
  }
7548
 
7549
+ });
7550
+
7551
+ // js/v8/rest-api.js
7552
+ /**
7553
+ * @namespace WPGMZA
7554
+ * @module WPGMZA.RestAPI
7555
+ * @requires WPGMZA
7556
+ */
7557
+ jQuery(function($) {
7558
+
7559
+ /**
7560
+ * Used to interact with the WordPress REST API. <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.
7561
+ * @class WPGMZA.RestAPI
7562
+ * @constructor WPGMZA.RestAPI
7563
+ * @memberof WPGMZA
7564
+ */
7565
+ WPGMZA.RestAPI = function()
7566
+ {
7567
+ WPGMZA.RestAPI.URL = WPGMZA.resturl;
7568
+
7569
+ this.useAJAXFallback = false;
7570
+ }
7571
+
7572
+ WPGMZA.RestAPI.CONTEXT_REST = "REST";
7573
+ WPGMZA.RestAPI.CONTEXT_AJAX = "AJAX";
7574
+
7575
+ /**
7576
+ * Creates an instance of a RestAPI, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
7577
+ * @method
7578
+ * @memberof WPGMZA.RestAPI
7579
+ */
7580
+ WPGMZA.RestAPI.createInstance = function()
7581
+ {
7582
+ return new WPGMZA.RestAPI();
7583
+ }
7584
+
7585
+ Object.defineProperty(WPGMZA.RestAPI.prototype, "isCompressedPathVariableSupported", {
7586
+
7587
+ get: function()
7588
+ {
7589
+ return WPGMZA.serverCanInflate && "Uint8Array" in window && "TextEncoder" in window;
7590
+ }
7591
+
7592
+ });
7593
+
7594
+ Object.defineProperty(WPGMZA.RestAPI.prototype, "isCompressedPathVariableAllowed", {
7595
+
7596
+ get: function()
7597
+ {
7598
+ // NB: Pro 7 still has a "disable" setting. So use that if Pro 7 is installed.
7599
+ if(!WPGMZA.pro_version || WPGMZA.Version.compare(WPGMZA.pro_version, "8.0.0") >= WPGMZA.Version.EQUAL_TO)
7600
+ return !WPGMZA.settings.disable_compressed_path_variables;
7601
+
7602
+ // Running Pro 7 or below
7603
+ return WPGMZA.settings.enable_compressed_path_variables;
7604
+ }
7605
+
7606
+ });
7607
+
7608
+ Object.defineProperty(WPGMZA.RestAPI.prototype, "maxURLLength", {
7609
+
7610
+ get: function()
7611
+ {
7612
+ return 2083;
7613
+ }
7614
+
7615
+ });
7616
+
7617
+ WPGMZA.RestAPI.prototype.compressParams = function(params)
7618
+ {
7619
+ var suffix = "";
7620
+
7621
+ if(params.markerIDs)
7622
+ {
7623
+ var markerIDs = params.markerIDs.split(",");
7624
+
7625
+ if(markerIDs.length > 1)
7626
+ {
7627
+ // NB: Only use Elias Fano encoding if more than one marker is present. The server side decoder does not correctly decode a single digit.
7628
+ var encoder = new WPGMZA.EliasFano();
7629
+ var encoded = encoder.encode(markerIDs);
7630
+ var compressed = pako.deflate(encoded);
7631
+ var string = Array.prototype.map.call(compressed, function(ch) {
7632
+ return String.fromCharCode(ch);
7633
+ }).join("");
7634
+
7635
+ // NB: Append as another path component, this stops the code below performing base64 encoding twice and enlarging the request
7636
+ suffix = "/" + btoa(string).replace(/\//g, "-").replace(/=+$/, "");
7637
+
7638
+ // NB: midcbp = Marker ID compressed buffer pointer, abbreviated to save space
7639
+ params.midcbp = encoded.pointer;
7640
+
7641
+ delete params.markerIDs;
7642
+ }
7643
+ }
7644
+
7645
+ var string = JSON.stringify(params);
7646
+ var encoder = new TextEncoder();
7647
+ var input = encoder.encode(string);
7648
+ var compressed = pako.deflate(input);
7649
+ var raw = Array.prototype.map.call(compressed, function(ch) {
7650
+ return String.fromCharCode(ch);
7651
+ }).join("");
7652
+
7653
+ var base64 = btoa(raw);
7654
+ return base64.replace(/\//g, "-").replace(/=+$/, "") + suffix;
7655
+ }
7656
+
7657
+ function sendAJAXFallbackRequest(route, params)
7658
+ {
7659
+ var params = $.extend({}, params);
7660
+
7661
+ if(!params.data)
7662
+ params.data = {};
7663
+
7664
+ if("route" in params.data)
7665
+ throw new Error("Cannot send route through this method");
7666
+
7667
+ if("action" in params.data)
7668
+ throw new Error("Cannot send action through this method");
7669
+
7670
+ params.data.route = route;
7671
+ params.data.action = "wpgmza_rest_api_request";
7672
+
7673
+ WPGMZA.restAPI.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_AJAX);
7674
+
7675
+ return $.ajax(WPGMZA.ajaxurl, params);
7676
+ }
7677
+
7678
+ WPGMZA.RestAPI.prototype.getNonce = function(route)
7679
+ {
7680
+ var matches = [];
7681
+
7682
+ for(var pattern in WPGMZA.restnoncetable)
7683
+ {
7684
+ var regex = new RegExp(pattern);
7685
+
7686
+ if(route.match(regex))
7687
+ matches.push({
7688
+ pattern: pattern,
7689
+ nonce: WPGMZA.restnoncetable[pattern],
7690
+ length: pattern.length
7691
+ });
7692
+ }
7693
+
7694
+ if(!matches.length)
7695
+ throw new Error("No nonce found for route");
7696
+
7697
+ matches.sort(function(a, b) {
7698
+ return b.length - a.length;
7699
+ });
7700
+
7701
+ return matches[0].nonce;
7702
+ }
7703
+
7704
+ WPGMZA.RestAPI.prototype.addNonce = function(route, params, context)
7705
+ {
7706
+ var self = this;
7707
+
7708
+ var setRESTNonce = function(xhr) {
7709
+ if(context == WPGMZA.RestAPI.CONTEXT_REST && self.shouldAddNonce(route)){
7710
+ xhr.setRequestHeader('X-WP-Nonce', WPGMZA.restnonce);
7711
+ }
7712
+
7713
+ if(params && params.method && !params.method.match(/^GET$/i)){
7714
+ xhr.setRequestHeader('X-WPGMZA-Action-Nonce', self.getNonce(route));
7715
+ }
7716
+ };
7717
+
7718
+ if(!params.beforeSend){
7719
+ params.beforeSend = setRESTNonce;
7720
+ } else {
7721
+ var base = params.beforeSend;
7722
+
7723
+ params.beforeSend = function(xhr) {
7724
+ base(xhr);
7725
+ setRESTNonce(xhr);
7726
+ }
7727
+ }
7728
+ }
7729
+
7730
+ WPGMZA.RestAPI.prototype.shouldAddNonce = function(route){
7731
+ route = route.replace(/\//g, '');
7732
+
7733
+ var isAdmin = false;
7734
+ if(WPGMZA.is_admin){
7735
+ if(parseInt(WPGMZA.is_admin) === 1){
7736
+ isAdmin = true;
7737
+ }
7738
+ }
7739
+
7740
+ var skipNonceRoutes = ['markers', 'features', 'marker-listing', 'datatables'];
7741
+ if(route && skipNonceRoutes.includes(route) && !isAdmin){
7742
+ return false;
7743
+ }
7744
+
7745
+ return true;
7746
+ }
7747
+
7748
+ /**
7749
+ * Makes an AJAX to the REST API, this function is a wrapper for $.ajax
7750
+ * @method
7751
+ * @memberof WPGMZA.RestAPI
7752
+ * @param {string} route The REST API route
7753
+ * @param {object} params The request parameters, see http://api.jquery.com/jquery.ajax/
7754
+ */
7755
+ WPGMZA.RestAPI.prototype.call = function(route, params)
7756
+ {
7757
+ if(this.useAJAXFallback)
7758
+ return sendAJAXFallbackRequest(route, params);
7759
+
7760
+ var self = this;
7761
+ var attemptedCompressedPathVariable = false;
7762
+ var fallbackRoute = route;
7763
+ var fallbackParams = $.extend({}, params);
7764
+
7765
+ if(typeof route != "string" || (!route.match(/^\//) && !route.match(/^http/)))
7766
+ throw new Error("Invalid route");
7767
+
7768
+ if(WPGMZA.RestAPI.URL.match(/\/$/))
7769
+ route = route.replace(/^\//, "");
7770
+
7771
+ if(!params)
7772
+ params = {};
7773
+
7774
+ this.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_REST);
7775
+
7776
+ if(!params.error)
7777
+ params.error = function(xhr, status, message) {
7778
+ if(status == "abort")
7779
+ return; // Don't report abort, let it happen silently
7780
+
7781
+ switch(xhr.status)
7782
+ {
7783
+ case 401:
7784
+ case 403:
7785
+ case 405:
7786
+ // Report back to the server. This is usually due to a security plugin blocking REST requests for non-authenticated users
7787
+ $.post(WPGMZA.ajaxurl, {
7788
+ action: "wpgmza_report_rest_api_blocked"
7789
+ }, function(response) {});
7790
+
7791
+ console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users.");
7792
+
7793
+ if(params.method === "DELETE"){
7794
+ console.warn("The REST API rejected a DELETE request, attempting again with POST fallback");
7795
+ params.method = "POST";
7796
+
7797
+ if(!params.data){
7798
+ params.data = {};
7799
+ }
7800
+
7801
+ params.data.simulateDelete = 'yes';
7802
+
7803
+ return WPGMZA.restAPI.call(route, params);
7804
+
7805
+ }
7806
+
7807
+ this.useAJAXFallback = true;
7808
+
7809
+ return sendAJAXFallbackRequest(fallbackRoute, fallbackParams);
7810
+ break;
7811
+
7812
+ case 414:
7813
+ if(!attemptedCompressedPathVariable)
7814
+ break;
7815
+
7816
+ // Fallback for HTTP 414 - Request too long with compressed requests
7817
+ fallbackParams.method = "POST";
7818
+ fallbackParams.useCompressedPathVariable = false;
7819
+
7820
+ return WPGMZA.restAPI.call(fallbackRoute, fallbackParams);
7821
+
7822
+ break;
7823
+ }
7824
+
7825
+ throw new Error(message);
7826
+ }
7827
+
7828
+ if(params.useCompressedPathVariable &&
7829
+ this.isCompressedPathVariableSupported &&
7830
+ this.isCompressedPathVariableAllowed)
7831
+ {
7832
+ var compressedParams = $.extend({}, params);
7833
+ var data = params.data;
7834
+ var base64 = this.compressParams(data);
7835
+
7836
+ if(WPGMZA.isServerIIS)
7837
+ base64 = base64.replace(/\+/g, "%20");
7838
+
7839
+ var compressedRoute = route.replace(/\/$/, "") + "/base64" + base64;
7840
+ var fullCompressedRoute = WPGMZA.RestAPI.URL + compressedRoute;
7841
+
7842
+ compressedParams.method = "GET";
7843
+ delete compressedParams.data;
7844
+
7845
+ if(params.cache === false)
7846
+ compressedParams.data = {
7847
+ skip_cache: 1
7848
+ };
7849
+
7850
+ if(compressedRoute.length < this.maxURLLength)
7851
+ {
7852
+ attemptedCompressedPathVariable = true;
7853
+
7854
+ route = compressedRoute;
7855
+ params = compressedParams;
7856
+ }
7857
+ else
7858
+ {
7859
+ // Fallback for when URL exceeds predefined length limit
7860
+ if(!WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed)
7861
+ console.warn("Compressed path variable route would exceed URL length limit");
7862
+
7863
+ WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed = true;
7864
+ }
7865
+ }
7866
+
7867
+ var onSuccess = null;
7868
+ if(params.success){
7869
+ onSuccess = params.success;
7870
+ }
7871
+
7872
+ params.success = function(result, status, xhr){
7873
+ if(typeof result !== 'object'){
7874
+ var rawResult = result;
7875
+ try{
7876
+ result = JSON.parse(result);
7877
+ } catch (parseExc){
7878
+ result = rawResult;
7879
+ }
7880
+ }
7881
+
7882
+ if(onSuccess && typeof onSuccess === 'function'){
7883
+ onSuccess(result, status, xhr);
7884
+ }
7885
+ };
7886
+
7887
+ // NB: Support plain permalinks
7888
+ if(WPGMZA.RestAPI.URL.match(/\?/))
7889
+ route = route.replace(/\?/, "&");
7890
+
7891
+ return $.ajax(WPGMZA.RestAPI.URL + route, params);
7892
+ }
7893
+
7894
+ var nativeCallFunction = WPGMZA.RestAPI.call;
7895
+ WPGMZA.RestAPI.call = function()
7896
+ {
7897
+ console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?");
7898
+
7899
+ nativeCallFunction.apply(this, arguments);
7900
+ }
7901
+
7902
+ $(document.body).on("click", "#wpgmza-rest-api-blocked button.notice-dismiss", function(event) {
7903
+
7904
+ WPGMZA.restAPI.call("/rest-api/", {
7905
+ method: "POST",
7906
+ data: {
7907
+ dismiss_blocked_notice: true
7908
+ }
7909
+ });
7910
+
7911
+ });
7912
  });
7913
 
7914
  // js/v8/settings-page.js
12663
  }
12664
  }
12665
 
12666
+ var addressUnchanged = false;
12667
+ if(this.feature && this.feature.address && address){
12668
+ if(typeof this.feature.address === 'string' && typeof address === 'string'){
12669
+ if(this.feature.address.trim() === address.trim()){
12670
+ /** Address was not changed by the edit, let's go ahead and skip geocoding on save */
12671
+ addressUnchanged = true;
12672
+ }
12673
+ }
12674
+ }
12675
+
12676
+ if(this.adjustSubMode || addressUnchanged){
12677
  // Trust the force!
12678
  WPGMZA.FeaturePanel.prototype.onSave.apply(self, arguments);
12679
  } else {
15946
  // this.dataTable = $(this.dataTableElement).DataTable(settings);
15947
  this.wpgmzaDataTable = this;
15948
 
15949
+ this.useCompressedPathVariable = (WPGMZA.restAPI && WPGMZA.restAPI.isCompressedPathVariableSupported && WPGMZA.settings.enable_compressed_path_variables);
15950
  this.method = (this.useCompressedPathVariable ? "GET" : "POST");
15951
 
15952
  if(this.getLanguageURL() == undefined || this.getLanguageURL() == "//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json") {
js/v8/wp-google-maps.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){var core={MARKER_PULL_DATABASE:"0",MARKER_PULL_XML:"1",PAGE_MAP_LIST:"map-list",PAGE_MAP_EDIT:"map-edit",PAGE_SETTINGS:"map-settings",PAGE_SUPPORT:"map-support",PAGE_CATEGORIES:"categories",PAGE_ADVANCED:"advanced",PAGE_CUSTOM_FIELDS:"custom-fields",maps:[],events:null,settings:null,restAPI:null,localized_strings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',preloaderHTML:"<div class='wpgmza-preloader'><div></div><div></div><div></div><div></div></div>",getCurrentPage:function(){switch(WPGMZA.getQueryParamValue("page")){case"wp-google-maps-menu":return window.location.href.match(/action=edit/)&&window.location.href.match(/map_id=\d+/)?WPGMZA.PAGE_MAP_EDIT:WPGMZA.PAGE_MAP_LIST;case"wp-google-maps-menu-settings":return WPGMZA.PAGE_SETTINGS;case"wp-google-maps-menu-support":return WPGMZA.PAGE_SUPPORT;case"wp-google-maps-menu-categories":return WPGMZA.PAGE_CATEGORIES;case"wp-google-maps-menu-advanced":return WPGMZA.PAGE_ADVANCED;case"wp-google-maps-menu-custom-fields":return WPGMZA.PAGE_CUSTOM_FIELDS;default:return null}},getScrollAnimationOffset:function(){return(WPGMZA.settings.scroll_animation_offset||0)+$("#wpadminbar").height()},getScrollAnimationDuration:function(){return WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},extend:function(child,parent){var constructor=child;child.prototype=Object.create(parent.prototype),child.prototype.constructor=constructor},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){var hex=parseInt(colour.replace(/^#/,""),16);return[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},hexOpacityToString:function(colour,opacity){var arr=WPGMZA.hexOpacityToRGBA(colour,opacity);return"rgba("+arr[0]+", "+arr[1]+", "+arr[2]+", "+arr[3]+")"},hexToRgba:function(hex){var c;return/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)?(3==(c=hex.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),{r:(c="0x"+c.join(""))>>16&255,g:c>>8&255,b:255&c,a:1}):0},rgbaToString:function(rgba){return"rgba("+rgba.r+", "+rgba.g+", "+rgba.b+", "+rgba.a+")"},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])}):null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:img.width,height:img.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},decodeEntities:function(input){return input.replace(/&(nbsp|amp|quot|lt|gt);/g,function(m,e){return m[e]}).replace(/&#(\d+);/gi,function(m,e){return String.fromCharCode(parseInt(e,10))})},isDeveloperMode:function(){return this.settings.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback,error,watch){var nativeFunction="getCurrentPosition";if(WPGMZA.userLocationDenied)error&&error({code:1,message:"Location unavailable"});else if(watch&&(nativeFunction="watchPosition"),navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation[nativeFunction]?navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){options.enableHighAccuracy=!1,navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){console.warn(err.code,err.message),1==err.code&&(WPGMZA.userLocationDenied=!0),error&&error(err)},options)},options):console.warn(nativeFunction+" is not available")}else console.warn("No geolocation available on this device")},watchPosition:function(callback,error){return WPGMZA.getCurrentPosition(callback,error,!0)},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},capitalizeWords:function(string){return(string+"").replace(/^(.)|\s+(.)/g,function(m){return m.toUpperCase()})},pluralize:function(string){return WPGMZA.singularize(string)+"s"},singularize:function(string){return string.replace(/s$/,"")},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if("OLFeature"!=(fullInstanceName=WPGMZA[engine+pro+instanceName]&&engine+instanceName!="OLFeature"?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]&&WPGMZA[engine+instanceName].prototype?engine+instanceName:instanceName)&&!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){for(var i=0;i<WPGMZA.maps.length;i++)if(WPGMZA.maps[i].id==id)return WPGMZA.maps[i];return null},isGoogleAutocompleteSupported:function(){return!!window.google&&(!!google.maps&&(!!google.maps.places&&(!!google.maps.places.Autocomplete&&(!WPGMZA.CloudAPI||!WPGMZA.CloudAPI.isBeingUsed))))},googleAPIStatus:window.wpgmza_google_api_status,isSafari:function(){var ua=navigator.userAgent.toLowerCase();return ua.match(/safari/i)&&!ua.match(/chrome/i)},isTouchDevice:function(){return"ontouchstart"in window},isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},isModernComponentStyleAllowed:function(){return!WPGMZA.settings.user_interface_style||"legacy"==WPGMZA.settings.user_interface_style||"modern"==WPGMZA.settings.user_interface_style},isElementInView:function(element){var pageTop=$(window).scrollTop(),pageBottom=pageTop+$(window).height(),elementTop=$(element).offset().top,elementBottom=elementTop+$(element).height();return elementTop<pageTop&&pageBottom<elementBottom||(pageTop<=elementTop&&elementTop<=pageBottom||pageTop<=elementBottom&&elementBottom<=pageBottom)},isFullScreen:function(){return wpgmzaisFullScreen},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&#]*)");return(m=window.location.href.match(regex))?decodeURIComponent(m[1]):null},notification:function(text,time){switch(arguments.length){case 0:text="",time=4e3;break;case 1:time=4e3}var html='<div class="wpgmza-popup-notification">'+text+"</div>";jQuery("body").append(html),setTimeout(function(){jQuery("body").find(".wpgmza-popup-notification").remove()},time)},initMaps:function(){$(document.body).find(".wpgmza_map:not(.wpgmza-initialized)").each(function(index,el){el.wpgmzaMap?console.warn("Element missing class wpgmza-initialized but does have wpgmzaMap property. No new instance will be created"):el.wpgmzaMap=WPGMZA.Map.createInstance(el)}),WPGMZA.Map.nextInitTimeoutID=setTimeout(WPGMZA.initMaps,3e3)},onScroll:function(){$(".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)})}},wpgmzaisFullScreen=!1;for(var key in[]){console.warn("It appears that the built in JavaScript Array has been extended, this can create issues with for ... in loops, which may cause failure.");break}for(var key in window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core,window.uc&&window.uc.reloadOnOptIn&&(window.uc.reloadOnOptIn("S1pcEj_jZX"),window.uc.reloadOnOptOut("S1pcEj_jZX")),WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}WPGMZA.settings.useLegacyGlobals=!0,$(document).on("fullscreenchange",function(){wpgmzaisFullScreen=!!document.fullscreenElement}),$("body").on("click","#wpgmzaCloseChat",function(e){e.preventDefault(),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_hide_chat",nonce:WPGMZA_localized_data.ajaxnonce}}),$(".wpgmza-chat-help").remove()}),$(window).on("scroll",WPGMZA.onScroll),$(document.body).on("click","button.wpgmza-api-consent",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()}),$(document.body).on("keydown",function(event){event.altKey&&(WPGMZA.altKeyDown=!0)}),$(document.body).on("keyup",function(event){event.altKey||(WPGMZA.altKeyDown=!1)}),$(document.body).on("preinit.wpgmza",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[src]").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());for(var key in[]){console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");break}if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").first().after($(warning))}WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code&&jQuery(".wpgmza-gdpr-compliance").length<=0&&$("button.wpgmza-api-consent").on("click",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()})}),setTimeout(function(){$(document.body).trigger("preinit.wpgmza")},0),setTimeout(function(){WPGMZA.initMaps(),WPGMZA.onScroll()},0)}),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","establishment"]};(json=$(element).attr("data-autocomplete-options"))&&(options=$.extend(options,JSON.parse(json))),map&&map.settings.wpgmza_store_locator_restrict&&(options.country=map.settings.wpgmza_store_locator_restrict),WPGMZA.isGoogleAutocompleteSupported()?"wpgmza_add_address_map_editor"!=this.id&&WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey&&(element.googleAutoComplete=new google.maps.places.Autocomplete(element,options),options.country&&element.googleAutoComplete.setComponentRestrictions({country:options.country})):WPGMZA.CloudAPI&&WPGMZA.CloudAPI.isBeingUsed&&(element.cloudAutoComplete=new WPGMZA.CloudAutocomplete(element,options))},WPGMZA.extend(WPGMZA.AddressInput,WPGMZA.EventDispatcher),WPGMZA.AddressInput.createInstance=function(element,map){return new WPGMZA.AddressInput(element,map)}}),jQuery(function($){WPGMZA.DrawingManager=function(map){WPGMZA.assertInstanceOf(this,"DrawingManager"),WPGMZA.EventDispatcher.call(this),this.map=map,this.mode=WPGMZA.DrawingManager.MODE_NONE},WPGMZA.DrawingManager.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.DrawingManager.prototype.constructor=WPGMZA.DrawingManager,WPGMZA.DrawingManager.MODE_NONE=null,WPGMZA.DrawingManager.MODE_MARKER="marker",WPGMZA.DrawingManager.MODE_POLYGON="polygon",WPGMZA.DrawingManager.MODE_POLYLINE="polyline",WPGMZA.DrawingManager.MODE_CIRCLE="circle",WPGMZA.DrawingManager.MODE_RECTANGLE="rectangle",WPGMZA.DrawingManager.MODE_HEATMAP="heatmap",WPGMZA.DrawingManager.getConstructor=function(){switch(WPGMZA.settings.engine){case"google-maps":return WPGMZA.GoogleDrawingManager;default:return WPGMZA.OLDrawingManager}},WPGMZA.DrawingManager.createInstance=function(map){return new(WPGMZA.DrawingManager.getConstructor())(map)},WPGMZA.DrawingManager.prototype.setDrawingMode=function(mode){this.mode=mode,this.trigger("drawingmodechanged")}}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){WPGMZA.FancyControls={formatToggleSwitch:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-round-flat"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)},formatToggleButton:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-yes-no"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(label).attr("data-on",WPGMZA.localized_strings.yes),$(label).attr("data-off",WPGMZA.localized_strings.no),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)}},$(".wpgmza-fancy-toggle-switch").each(function(index,el){WPGMZA.FancyControls.formatToggleSwitch(el)}),$(".wpgmza-fancy-toggle-button").each(function(index,el){WPGMZA.FancyControls.formatToggleButton(el)})}),jQuery(function($){WPGMZA.Feature=function(options){for(var key in WPGMZA.assertInstanceOf(this,"Feature"),WPGMZA.EventDispatcher.call(this),this.id=-1,options)this[key]=options[key]},WPGMZA.extend(WPGMZA.Feature,WPGMZA.EventDispatcher),WPGMZA.MapObject=WPGMZA.Feature,WPGMZA.Feature.prototype.parseGeometry=function(subject){if("string"==typeof subject&&subject.match(/^\[/))try{subject=JSON.parse(subject)}catch(e){}if("object"==typeof subject){for(var arr=subject,i=0;i<arr.length;i++)arr[i].lat=parseFloat(arr[i].lat),arr[i].lng=parseFloat(arr[i].lng);return arr}if("string"!=typeof subject)throw new Error("Invalid geometry");var pairs,coords,results=[];pairs=subject.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.Feature.prototype.setOptions=function(options){for(var key in options)this[key]=options[key];this.updateNativeFeature()},WPGMZA.Feature.prototype.setEditable=function(editable){this.setOptions({editable:editable})},WPGMZA.Feature.prototype.setDraggable=function(draggable){this.setOptions({draggable:draggable})},WPGMZA.Feature.prototype.getScalarProperties=function(){var options={};for(var key in this)switch(typeof this[key]){case"number":options[key]=parseFloat(this[key]);break;case"boolean":case"string":options[key]=this[key]}return options},WPGMZA.Feature.prototype.updateNativeFeature=function(){var props=this.getScalarProperties();switch(WPGMZA.settings.engine){case"open-layers":this.layer&&this.layer.setStyle(WPGMZA.OLFeature.getOLStyle(props));break;default:this.googleFeature.setOptions(props)}}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Circle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Circle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeColor",{enumerable:!0,get:function(){return this.lineColor?this.lineColor:"#000000"},set:function(a){this.lineColor=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineOpacity||0==this.lineOpacity?parseFloat(this.lineOpacity):0},set:function(a){this.lineOpacity=a}}),WPGMZA.Circle.createInstance=function(options,engineCircle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options,engineCircle)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.FriendlyError=function(){}}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/),latLng=new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])});callback([latLng.latLng=latLng],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)){this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find(".wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={};var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)},"google-maps"!=WPGMZA.settings.engine||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT||this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key,["https://www.wpgmaps.com/documentation/creating-a-google-maps-api-key/"])}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if(message)if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))||(m=message.match(/^Geocoding Service: .+/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){var self=this;if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){urls[i];var button=buttonTemplate.clone(),text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),$(button).find("i").addClass("fa-external-link"),$(button).append(text)}buttonContainer.append(button)}$(this.errorMessageList).append(li),$("#wpgmza_map, .wpgmza_map").each(function(index,el){var container=$(el).find(".wpgmza-google-maps-api-error-overlay");0==container.length&&(container=$("<div class='wpgmza-google-maps-api-error-overlay'></div>")).html(self.element.html()),setTimeout(function(){$(el).append(container)},1e3)}),$(".gm-err-container").parent().css({"z-index":1}),this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(feature){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),this.on("infowindowopen",function(event){self.onOpen(event)}),feature&&(this.feature=feature,this.state=WPGMZA.InfoWindow.STATE_CLOSED,feature.map?setTimeout(function(){self.onFeatureAdded(event)},100):feature.addEventListener("added",function(event){self.onFeatureAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.STATE_OPEN="open",WPGMZA.InfoWindow.STATE_CLOSED="closed",WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(feature){return new(this.getConstructor())(feature)},Object.defineProperty(WPGMZA.InfoWindow.prototype,"content",{get:function(){return this.getContent()},set:function(value){this.contentHtml=value}}),WPGMZA.InfoWindow.prototype.addEditButton=function(){return"map-edit"==WPGMZA.currentPage&&this.feature instanceof WPGMZA.Marker?' <a title="Edit this marker" style="width:15px;" class="wpgmza_edit_btn" data-edit-marker-id="'+this.feature.id+'"><i class="fa fa-edit"></i></a>':""},WPGMZA.InfoWindow.prototype.workOutDistanceBetweenTwoMarkers=function(location1,location2){if(location1&&location2){var distanceToDisplay=WPGMZA.Distance.between(location1,location2);return this.distanceUnits==WPGMZA.Distance.MILES&&(distanceToDisplay/=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(distanceToDisplay,2)}},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="",extra_html="";if(this.feature instanceof WPGMZA.Marker){if(this.feature.map.settings.store_locator_show_distance&&this.feature.map.storeLocator&&this.feature.map.storeLocator.state==WPGMZA.StoreLocator.STATE_APPLIED){var currentLatLng=this.feature.getPosition(),distance=this.workOutDistanceBetweenTwoMarkers(this.feature.map.storeLocator.center,currentLatLng);extra_html+="<p>"+(this.feature.map.settings.store_locator_distance==WPGMZA.Distance.KILOMETERS?distance+WPGMZA.localized_strings.kilometers_away:distance+" "+WPGMZA.localized_strings.miles_away)+"</p>"}html=this.feature.address+extra_html}return this.contentHtml&&(html=this.contentHtml),callback&&callback(html),html},WPGMZA.InfoWindow.prototype.open=function(map,feature){return this.feature=feature,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&(!this.feature.disableInfoWindow&&(this.state=WPGMZA.InfoWindow.STATE_OPEN,!0))},WPGMZA.InfoWindow.prototype.close=function(){this.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(this.state=WPGMZA.InfoWindow.STATE_CLOSED,this.trigger("infowindowclose"))},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onFeatureAdded=function(){1==this.feature.settings.infoopen&&this.open()},WPGMZA.InfoWindow.prototype.onOpen=function(){}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,(this._lng=0)!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},WPGMZA.LatLng.isLatLngString=function(str){return"string"==typeof str&&!!str.match(WPGMZA.LatLng.REGEXP)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.fromString=function(string){if(!WPGMZA.LatLng.isLatLngString(string))throw new Error("Not a valid latlng string");var m=string.match(WPGMZA.LatLng.REGEXP);return new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])})},WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromCurrentPosition=function(callback,options){options=options||{},callback&&WPGMZA.getCurrentPosition(function(position){var latLng=new WPGMZA.LatLng({lat:position.coords.latitude,lng:position.coords.longitude});options.geocodeAddress?WPGMZA.Geocoder.createInstance().getAddressFromLatLng({latLng:latLng},function(results){results.length&&(latLng.address=results[0]),callback(latLng)}):callback(latLng)})},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.toGoogleLatLngArray=function(arr){var result=[];return arr.forEach(function(nativeLatLng){if(!(nativeLatLng instanceof WPGMZA.LatLng||"lat"in nativeLatLng&&"lng"in nativeLatLng))throw new Error("Unexpected input");result.push(new google.maps.LatLng({lat:parseFloat(nativeLatLng.lat),lng:parseFloat(nativeLatLng.lng)}))}),result},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.toLatLngLiteral=function(){return{lat:this.lat,lng:this.lng}},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI},WPGMZA.LatLng.prototype.getGreatCircleDistance=function(arg1,arg2){var other,lat1=this.lat,lon1=this.lng;if(1==arguments.length)other=new WPGMZA.LatLng(arg1);else{if(2!=arguments.length)throw new Error("Invalid number of arguments");other=new WPGMZA.LatLng(arg1,arg2)}var lat2=other.lat,lon2=other.lng,phi1=lat1.toRadians(),phi2=lat2.toRadians(),deltaPhi=(lat2-lat1).toRadians(),deltaLambda=(lon2-lon1).toRadians(),a=Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaLambda/2)*Math.sin(deltaLambda/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLngBounds){var other=southWest;this.south=other.south,this.north=other.north,this.west=other.west,this.east=other.east}else southWest&&northEast&&(this.south=southWest.lat,this.north=northEast.lat,this.west=southWest.lng,this.east=northEast.lng)},WPGMZA.LatLngBounds.fromGoogleLatLngBounds=function(googleLatLngBounds){if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))throw new Error("Argument must be an instance of google.maps.LatLngBounds");var result=new WPGMZA.LatLngBounds,southWest=googleLatLngBounds.getSouthWest(),northEast=googleLatLngBounds.getNorthEast();return result.north=northEast.lat(),result.south=southWest.lat(),result.west=southWest.lng(),result.east=northEast.lng(),result},WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral=function(obj){var result=new WPGMZA.LatLngBounds,southWest=obj.southwest,northEast=obj.northeast;return result.north=northEast.lat,result.south=southWest.lat,result.west=southWest.lng,result.east=northEast.lng,result},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return null==this.north&&null==this.south&&null==this.west&&null==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){if(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),this.isInInitialState())return this.north=this.south=latLng.lat,void(this.west=this.east=latLng.lng);latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng)},WPGMZA.LatLngBounds.prototype.extendByPixelMargin=function(map,x,arg){var y=x;if(!(map instanceof WPGMZA.Map))throw new Error("First argument must be an instance of WPGMZA.Map");if(this.isInInitialState())throw new Error("Cannot extend by pixels in initial state");3<=arguments.length&&(y=arg);var southWest=new WPGMZA.LatLng(this.south,this.west),northEast=new WPGMZA.LatLng(this.north,this.east);southWest=map.latLngToPixels(southWest),northEast=map.latLngToPixels(northEast),southWest.x-=x,southWest.y+=y,northEast.x+=x,northEast.y-=y,southWest=map.pixelsToLatLng(southWest.x,southWest.y),northEast=map.pixelsToLatLng(northEast.x,northEast.y);this.toString();this.north=northEast.lat,this.south=southWest.lat,this.west=southWest.lng,this.east=northEast.lng},WPGMZA.LatLngBounds.prototype.contains=function(latLng){if(!(latLng instanceof WPGMZA.LatLng))throw new Error("Argument must be an instance of WPGMZA.LatLng");return!(latLng.lat<Math.min(this.north,this.south))&&(!(latLng.lat>Math.max(this.north,this.south))&&(this.west<this.east?latLng.lng>=this.west&&latLng.lng<=this.east:latLng.lng<=this.west||latLng.lng>=this.east))},WPGMZA.LatLngBounds.prototype.toString=function(){return this.north+"N "+this.south+"S "+this.west+"W "+this.east+"E"},WPGMZA.LatLngBounds.prototype.toLiteral=function(){return{north:this.north,south:this.south,west:this.west,east:this.east}}}),jQuery(function($){var legacyGlobals={marker_pull:"0",marker_array:[],MYMAP:[],infoWindow_poly:[],markerClusterer:[],heatmap:[],WPGM_Path:[],WPGM_Path_Polygon:[],WPGM_PathLine:[],WPGM_PathLineData:[],WPGM_PathData:[],original_iw:null,wpgmza_user_marker:null,wpgmaps_localize_marker_data:[],wpgmaps_localize_polygon_settings:[],wpgmaps_localize_heatmap_settings:[],wpgmaps_localize_polyline_settings:[],wpgmza_cirtcle_data_array:[],wpgmza_rectangle_data_array:[],wpgmzaForceLegacyMarkerClusterer:!1};function bindLegacyGlobalProperty(key){key in window?console.warn("Cannot redefine legacy global "+key):Object.defineProperty(window,key,{get:function(){return console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]},set:function(value){console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]=value}})}for(var key in legacyGlobals)bindLegacyGlobalProperty(key);WPGMZA.legacyGlobals=legacyGlobals,window.InitMap=window.resetLocations=window.searchLocations=window.fillInAddress=window.searchLocationsNear=function(){console.warn("This function is deprecated and should no longer be used")}}),jQuery(function($){WPGMZA.MapListPage=function(){$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")})},WPGMZA.MapListPage.createInstance=function(){return new WPGMZA.MapListPage},$(document).ready(function(event){WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_LIST&&(WPGMZA.mapListPage=WPGMZA.MapListPage.createInstance())})}),jQuery(function($){WPGMZA.MapSettings=function(element){var json,self=this,str=element.getAttribute("data-settings");try{json=JSON.parse(str)}catch(e){str=(str=str.replace(/\\%/g,"%")).replace(/\\\\"/g,'\\"');try{json=JSON.parse(str)}catch(e){json={},console.warn("Failed to parse map settings JSON")}}function addSettings(input){if(input)for(var key in input)if("other_settings"!=key){var value=input[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),self[key]=value}}WPGMZA.assertInstanceOf(this,"MapSettings"),addSettings(WPGMZA.settings),addSettings(json),json&&json.other_settings&&addSettings(json.other_settings)},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){var self=this,options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),empty("map_start_lat")||empty("map_start_lng")||(options.center=ol.proj.fromLonLat([parseFloat(this.map_start_lng),parseFloat(this.map_start_lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),this.map_start_zoom&&(options.zoom=parseInt(this.map_start_zoom)),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179];function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom)),this.map_start_zoom&&(zoom=parseInt(this.map_start_zoom));var options={zoom:zoom,center:latLng};function isSettingDisabled(value){return"yes"===value||!!value}switch(empty("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),empty("map_start_lat")||empty("map_start_lng")||(options.center=new google.maps.LatLng({lat:parseFloat(this.map_start_lat),lng:parseFloat(this.map_start_lng)})),this.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=!isSettingDisabled(this.wpgmza_settings_map_zoom),options.panControl=!isSettingDisabled(this.wpgmza_settings_map_pan),options.mapTypeControl=!isSettingDisabled(this.wpgmza_settings_map_type),options.streetViewControl=!isSettingDisabled(this.wpgmza_settings_map_streetview),options.fullscreenControl=!isSettingDisabled(this.wpgmza_settings_map_full_screen_control),options.draggable=!isSettingDisabled(this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom=isSettingDisabled(this.wpgmza_settings_map_clickzoom),isSettingDisabled(this.wpgmza_settings_map_tilt_controls)&&(options.rotateControl=!1,options.tilt=0),this.wpgmza_settings_map_scroll&&(options.scrollwheel=!1),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures||1==this.wpgmza_force_greedy_gestures?(options.gestureHandling="greedy",!this.wpgmza_settings_map_scroll&&"scrollwheel"in options&&delete options.scrollwheel):options.gestureHandling="cooperative",parseInt(this.type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}return this.wpgmza_theme_data&&this.wpgmza_theme_data.length&&(options.styles=WPGMZA.GoogleMap.parseThemeData(this.wpgmza_theme_data)),options}}),jQuery(function($){WPGMZA.Map=function(element,options){var self=this;if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(element.hasAttribute("data-map-id")?this.id=element.getAttribute("data-map-id"):this.id=1,!/\d+/.test(this.id))throw new Error("Map ID must be an integer");if(WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,$(this.element).addClass("wpgmza-initialized"),this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.rectangles=[],this.loadSettings(options),this.shortcodeAttributes={},$(this.element).attr("data-shortcode-attributes"))try{this.shortcodeAttributes=JSON.parse($(this.element).attr("data-shortcode-attributes")),this.shortcodeAttributes.zoom&&(this.settings.map_start_zoom=parseInt(this.shortcodeAttributes.zoom))}catch(e){console.warn("Error parsing shortcode attributes")}WPGMZA.getCurrentPage()!=WPGMZA.PAGE_MAP_EDIT&&this.initStoreLocator(),this.setDimensions(),this.setAlignment(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this),WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code&&($(element).append($(WPGMZA.api_consent_html)),$(element).css({height:"auto"})),this.on("init",function(event){self.onInit(event)}),this.on("click",function(event){self.onClick(event)}),WPGMZA.useLegacyGlobals&&(wpgmzaLegacyGlobals.MYMAP[this.id]={map:null,bounds:null,mc:null},wpgmzaLegacyGlobals.MYMAP.init=wpgmzaLegacyGlobals.MYMAP[this.id].init=wpgmzaLegacyGlobals.MYMAP.placeMarkers=wpgmzaLegacyGlobals.MYMAP[this.id].placeMarkers=function(){console.warn("This function is deprecated and should no longer be used")})},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.nightTimeThemeData=[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#575663"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#80823e"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#1b737a"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}],WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},Object.defineProperty(WPGMZA.Map.prototype,"markersPlaced",{get:function(){return this._markersPlaced},set:function(value){throw new Error("Value is read only")}}),Object.defineProperty(WPGMZA.Map.prototype,"lat",{get:function(){return this.getCenter().lat},set:function(value){var center=this.getCenter();center.lat=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"lng",{get:function(){return this.getCenter().lng},set:function(value){var center=this.getCenter();center.lng=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"zoom",{get:function(){return this.getZoom()},set:function(value){this.setZoom(value)}}),WPGMZA.Map.prototype.onInit=function(event){this.initPreloader(),"autoFetchFeatures"in this.settings&&!1===this.settings.autoFetchFeatures||this.fetchFeatures()},WPGMZA.Map.prototype.initPreloader=function(){this.preloader=$(WPGMZA.preloaderHTML),$(this.preloader).hide(),$(this.element).append(this.preloader)},WPGMZA.Map.prototype.showPreloader=function(show){show?$(this.preloader).show():$(this.preloader).hide()},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element);settings.other_settings;if(delete settings.other_settings,options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.initStoreLocator=function(){var storeLocatorElement=$(".wpgmza_sl_main_div");storeLocatorElement.length&&(this.storeLocator=WPGMZA.StoreLocator.createInstance(this,storeLocatorElement[0]))},WPGMZA.Map.prototype.getFeatureArrays=function(){var arrays=WPGMZA.Map.prototype.getFeatureArrays.call(this);return arrays.heatmaps=this.heatmaps,arrays},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]},WPGMZA.Map.prototype.getRESTParameters=function(options){var defaults={};return options&&options.filter||(defaults.filter=JSON.stringify(this.markerFilter.getFilteringParameters())),$.extend(!0,defaults,options)},WPGMZA.Map.prototype.fetchFeaturesViaREST=function(){var data,self=this,filter=this.markerFilter.getFilteringParameters();if("1"==WPGMZA.is_admin&&(filter.includeUnapproved=!0,filter.excludeIntegrated=!0),this.shortcodeAttributes.acf_post_id&&(filter.acfPostID=this.shortcodeAttributes.acf_post_id),this.showPreloader(!0),this.fetchFeaturesXhr&&this.fetchFeaturesXhr.abort(),WPGMZA.settings.fetchMarkersBatchSize){var offset=0,limit=WPGMZA.settings.fetchMarkersBatchSize;!function fetchNextBatch(){filter.offset=offset,filter.limit=limit,data=this.getRESTParameters({filter:JSON.stringify(filter)}),self.fetchFeaturesXhr=WPGMZA.restAPI.call("/markers/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){result.length?(self.onMarkersFetched(result,!0),offset+=limit,fetchNextBatch()):(self.onMarkersFetched(result),data.exclude="markers",WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}}))}})}()}else data=this.getRESTParameters({filter:JSON.stringify(filter)}),this.fetchFeaturesXhr=WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}};Math.PI;function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){0==arguments.length&&(width=this.settings.map_width?this.settings.map_width:"100",this.settings.map_width_type?width+=this.settings.map_width_type.replace("\\",""):width+="%",height=this.settings.map_height?this.settings.map_height:"400",this.settings.map_height_type?height+=this.settings.map_height_type.replace("\\",""):height+="px"),$(this.engineElement).css({width:width,height:height})},WPGMZA.Map.prototype.setAlignment=function(){switch(parseInt(this.settings.wpgmza_map_align)){case 1:$(this.element).css({float:"left"});break;case 2:$(this.element).css({"margin-left":"auto","margin-right":"auto"});break;case 3:$(this.element).css({float:"right"})}},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,(marker.parent=this).markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.infoWindow&&marker.infoWindow.close(),marker.map=null,marker.parent=null;var index=this.markers.indexOf(marker);if(-1==index)throw new Error("Marker not found in marker array");this.markers.splice(index,1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.removeAllMarkers=function(options){for(var i=this.markers.length-1;0<=i;i--)this.removeMarker(this.markers[i])},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.getMarkerByTitle=function(title){if("string"==typeof title){for(var i=0;i<this.markers.length;i++)if(this.markers[i].title==title)return this.markers[i]}else{if(!(title instanceof RegExp))throw new Error("Invalid argument");for(i=0;i<this.markers.length;i++)if(title.test(this.markers[i].title))return this.markers[i]}return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");(polygon.map=this).polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.removePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.removePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.removePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");(polyline.map=this).polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.removePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.removePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.removePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");(circle.map=this).circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.removeCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.removeCircle(circle)},WPGMZA.Map.prototype.addRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");(rectangle.map=this).rectangles.push(rectangle),this.dispatchEvent({type:"rectangleadded",rectangle:rectangle})},WPGMZA.Map.prototype.removeRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");if(rectangle.map!==this)throw new Error("Wrong map error");rectangle.map=null,this.rectangles.splice(this.rectangles.indexOf(rectangle),1),this.dispatchEvent({type:"rectangleremoved",rectangle:rectangle})},WPGMZA.Map.prototype.getRectangleByID=function(id){for(var i=0;i<this.rectangles.length;i++)if(this.rectangles[i].id==id)return this.rectangles[i];return null},WPGMZA.Map.prototype.removeRectangleByID=function(id){var rectangle=this.getRectangleByID(id);rectangle&&this.removeRectangle(rectangle)},WPGMZA.Map.prototype.resetBounds=function(){var latlng=new WPGMZA.LatLng(this.settings.map_start_lat,this.settings.map_start_lng);this.panTo(latlng),this.setZoom(this.settings.map_start_zoom)},WPGMZA.Map.prototype.nudge=function(x,y){var nudged=this.nudgeLatLng(this.getCenter(),x,y);this.setCenter(nudged)},WPGMZA.Map.prototype.nudgeLatLng=function(latLng,x,y){var pixels=this.latLngToPixels(latLng);if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");return this.pixelsToLatLng(pixels)},WPGMZA.Map.prototype.animateNudge=function(x,y,origin,milliseconds){var nudged;if(origin){if(!(origin instanceof WPGMZA.LatLng))throw new Error("Origin must be an instance of WPGMZA.LatLng")}else origin=this.getCenter();nudged=this.nudgeLatLng(origin,x,y),milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$(this).animate({lat:nudged.lat,lng:nudged.lng},milliseconds)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){this.trigger("idle")},WPGMZA.Map.prototype.onClick=function(event){},WPGMZA.Map.prototype.hasVisibleMarkers=function(){for(var marker,length=this.markers.length,i=0;i<length;i++)if((marker=this.markers[i]).isFilterable&&marker.getVisible())return!0;return!1},WPGMZA.Map.prototype.closeAllInfoWindows=function(){this.markers.forEach(function(marker){marker.infoWindow&&marker.infoWindow.close()})},$(document).ready(function(event){if(!WPGMZA.visibilityWorkaroundIntervalID){var invisibleMaps=jQuery(".wpgmza_map:hidden");WPGMZA.visibilityWorkaroundIntervalID=setInterval(function(){jQuery(invisibleMaps).each(function(index,el){if(jQuery(el).is(":visible")){var id=jQuery(el).attr("data-map-id");WPGMZA.getMapByID(id).onElementResized(),invisibleMaps.splice(invisibleMaps.toArray().indexOf(el),1)}})},1e3)}})}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1),$("#wpgmza-confirm-engine").click()}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val(),nonce:$("#wpgmza-maps-engine-dialog").attr("data-ajax-nonce")},success:function(response,status,xhr){window.location.reload()}})},$(document).ready(function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.MarkerFilter=function(map){WPGMZA.EventDispatcher.call(this),this.map=map},WPGMZA.MarkerFilter.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MarkerFilter.prototype.constructor=WPGMZA.MarkerFilter,WPGMZA.MarkerFilter.createInstance=function(map){return new WPGMZA.MarkerFilter(map)},WPGMZA.MarkerFilter.prototype.getFilteringParameters=function(){var params={map_id:this.map.id};return this.map.storeLocator&&(params=$.extend(params,this.map.storeLocator.getFilteringParameters())),params},WPGMZA.MarkerFilter.prototype.update=function(params,source){var self=this;function dispatchEvent(result){var event=new WPGMZA.Event("filteringcomplete");event.map=self.map,event.source=source,event.filteredMarkers=result,event.filteringParams=params,self.onFilteringComplete(event),self.trigger(event),self.map.trigger(event)}this.updateTimeoutID||(params=params||{},this.xhr&&(this.xhr.abort(),delete this.xhr),this.updateTimeoutID=setTimeout(function(){if((params=$.extend(self.getFilteringParameters(),params)).center instanceof WPGMZA.LatLng&&(params.center=params.center.toLatLngLiteral()),params.hideAll)return dispatchEvent([]),void delete self.updateTimeoutID;self.map.showPreloader(!0),self.xhr=WPGMZA.restAPI.call("/markers",{data:{fields:["id"],filter:JSON.stringify(params)},success:function(result,status,xhr){self.map.showPreloader(!1),dispatchEvent(result)},useCompressedPathVariable:!0}),delete self.updateTimeoutID},0))},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(event){var map=[];event.filteredMarkers.forEach(function(data){map[data.id]=!0}),this.map.markers.forEach(function(marker){if(marker.isFilterable){var allowByFilter=!!map[marker.id];marker.isFiltered=!allowByFilter,marker.setVisible(allowByFilter)}})}}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;this._offset={x:0,y:0},WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,this.isFilterable=!0,this.disableInfoWindow=!1,WPGMZA.Feature.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}),this.handleLegacyGlobals(row))},WPGMZA.Marker.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",Object.defineProperty(WPGMZA.Marker.prototype,"offsetX",{get:function(){return this._offset.x},set:function(value){this._offset.x=value,this.updateOffset()}}),Object.defineProperty(WPGMZA.Marker.prototype,"offsetY",{get:function(){return this._offset.y},set:function(value){this._offset.y=value,this.updateOffset()}}),WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select"),"1"==this.infoopen&&this.openInfoWindow(!0)},WPGMZA.Marker.prototype.handleLegacyGlobals=function(row){var m;if(WPGMZA.settings.useLegacyGlobals&&this.map_id&&this.id&&!(WPGMZA.pro_version&&(m=WPGMZA.pro_version.match(/\d+/))&&m[0]<=7)){WPGMZA.legacyGlobals.marker_array[this.map_id]||(WPGMZA.legacyGlobals.marker_array[this.map_id]=[]),WPGMZA.legacyGlobals.marker_array[this.map_id][this.id]=this,WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]||(WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]=[]);var cloned=$.extend({marker_id:this.id},row);WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id][this.id]=cloned}},WPGMZA.Marker.prototype.initInfoWindow=function(){this.infoWindow||(this.infoWindow=WPGMZA.InfoWindow.createInstance())},WPGMZA.Marker.prototype.openInfoWindow=function(autoOpen){this.map?(autoOpen||(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),this.map.lastInteractedMarker=this),this.initInfoWindow(),this.infoWindow.open(this.map,this)):console.warn("Cannot open infowindow for marker with no map")},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){WPGMZA.settings.wpgmza_settings_map_open_marker_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){function stripProtocol(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}return WPGMZA.defaultMarkerIcon?stripProtocol(WPGMZA.defaultMarkerIcon):stripProtocol(WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return new WPGMZA.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.setOffset=function(x,y){this._offset.x=x,this._offset.y=y,this.updateOffset()},WPGMZA.Marker.prototype.updateOffset=function(){},WPGMZA.Marker.prototype.getAnimation=function(){return this.anim},WPGMZA.Marker.prototype.setAnimation=function(animation){},WPGMZA.Marker.prototype.getVisible=function(){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.getMap=function(){return this.map},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this),this.map=map},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(options){},WPGMZA.Marker.prototype.setOpacity=function(opacity){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=WPGMZA.getMapByID(map_id):this.map=WPGMZA.maps[0],this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#ff0000",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#ff0000")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),start=(rgba=WPGMZA.hexToRgba(settings.color),WPGMZA.rgbaToString(rgba));rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(var i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(0<settings.numRadiusLabels){var m,x,y;radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1]),context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var spokeAngle,width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;0<Math.sin(spokeAngle)&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this,map=WPGMZA.getMapByID(map_id);if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"'], .wpgmza_sl_search_button_"+map_id).closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var addressInput,inner=$(this.element).find(".wpgmza-inner");addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),map.settings.store_locator_query_string&&map.settings.store_locator_query_string.length&&addressInput.attr("placeholder",map.settings.store_locator_query_string),inner.append(addressInput);var button,titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=map.settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}(button=$(original).find("button.wpgmza-use-my-location"))&&inner.append(button),$(addressInput).on("keydown keypress",function(event){13==event.keyCode&&self.searchButton.is(":visible")&&self.searchButton.trigger("click")}),$(addressInput).on("input",function(event){self.searchButton.show(),self.resetButton.hide()}),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button, .wpgmza_sl_search_button_div"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_APPLIED)}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_INITIAL})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),items=($(container).children("ul"),$(container).find("li")),numCategories=0,icons=[];items.each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fa fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")}),$(this.element).on("mouseover","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseOverCategory(event)}),$(this.element).on("mouseleave","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseLeaveCategory(event)}),$("body").on("click",".wpgmza_store_locator_options_button",function(event){setTimeout(function(){if($(".wpgmza_cat_checkbox_holder").hasClass("wpgmza-open")){var p_cat=$(".wpgmza_cat_checkbox_holder"),position_cat=p_cat.position().top+p_cat.outerHeight(!0)+$(".wpgmza-modern-store-locator").height(),$p_map=$(".wpgmza_map");$p_map.position().top+$p_map.outerHeight(!0)<=position_cat&&($(".wpgmza_cat_ul").css("overflow","scroll "),$(".wpgmza_cat_ul").css("height","100%"),$(".wpgmza-modern-store-locator").css("height","100%"),$(".wpgmza_cat_checkbox_holder.wpgmza-open").css({"padding-bottom":"50px",height:"100%"}))}},500)})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLModernStoreLocator(map_id);default:return new WPGMZA.GoogleModernStoreLocator(map_id)}},WPGMZA.ModernStoreLocator.prototype.onMouseOverCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeIn()},WPGMZA.ModernStoreLocator.prototype.onMouseLeaveCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeOut()}}),jQuery(function($){WPGMZA.NativeMapsAppIcon=function(){navigator.userAgent.match(/^Apple|iPhone|iPad|iPod/)?(this.type="apple",this.element=$('<span><i class="fab fa fa-apple" aria-hidden="true"></i></span>')):(this.type="google",this.element=$('<span><i class="fab fa fa-google" aria-hidden="true"></i></span>'))}}),jQuery(function($){Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(begin,end){return new Uint8Array(Array.prototype.slice.call(this,begin,end))}}),WPGMZA.isSafari()&&!window.external&&(window.external={})}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,Object.defineProperty(WPGMZA.Polygon.prototype,"fillColor",{enumerable:!0,get:function(){return this.fillcolor&&this.fillcolor.length?"#"+this.fillcolor.replace(/^#/,""):"#ff0000"},set:function(a){this.fillcolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineopacity&&this.lineopacity.length?this.lineopacity:.6},set:function(a){this.lineopacity=a}}),WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)}}),jQuery(function($){WPGMZA.Polyline=function(options,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,Object.defineProperty(WPGMZA.Polyline.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeWeight",{enumerable:!0,get:function(){return this.linethickness&&this.linethickness.length?parseInt(this.linethickness):1},set:function(a){this.linethickness=a}}),WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(options,engineObject){return new(WPGMZA.Polyline.getConstructor())(options,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.PopoutPanel=function(element){this.element=element},WPGMZA.PopoutPanel.prototype.open=function(){$(this.element).addClass("wpgmza-open")},WPGMZA.PopoutPanel.prototype.close=function(){$(this.element).removeClass("wpgmza-open")}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Rectangle=function(options,engineRectangle){WPGMZA.assertInstanceOf(this,"Rectangle"),this.name="",this.cornerA=new WPGMZA.LatLng,this.cornerB=new WPGMZA.LatLng,this.color="#ff0000",this.opacity=.5,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Rectangle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeColor",{enumerable:!0,get:function(){return"#000000"}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return 0}}),WPGMZA.Rectangle.createInstance=function(options,engineRectangle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLRectangle;break;default:constructor=WPGMZA.GoogleRectangle}return new constructor(options,engineRectangle)}}),jQuery(function($){function sendAJAXFallbackRequest(route,params){if((params=$.extend({},params)).data||(params.data={}),"route"in params.data)throw new Error("Cannot send route through this method");if("action"in params.data)throw new Error("Cannot send action through this method");return params.data.route=route,params.data.action="wpgmza_rest_api_request",WPGMZA.restAPI.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_AJAX),$.ajax(WPGMZA.ajaxurl,params)}WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl,this.useAJAXFallback=!1},WPGMZA.RestAPI.CONTEXT_REST="REST",WPGMZA.RestAPI.CONTEXT_AJAX="AJAX",WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableSupported",{get:function(){return WPGMZA.serverCanInflate&&"Uint8Array"in window&&"TextEncoder"in window}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableAllowed",{get:function(){return!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?!WPGMZA.settings.disable_compressed_path_variables:WPGMZA.settings.enable_compressed_path_variables}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"maxURLLength",{get:function(){return 2083}}),WPGMZA.RestAPI.prototype.compressParams=function(params){var suffix="";if(params.markerIDs){var markerIDs=params.markerIDs.split(",");if(1<markerIDs.length){var encoded=(new WPGMZA.EliasFano).encode(markerIDs),compressed=pako.deflate(encoded),string=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");suffix="/"+btoa(string).replace(/\//g,"-").replace(/=+$/,""),params.midcbp=encoded.pointer,delete params.markerIDs}}string=JSON.stringify(params);var input=(new TextEncoder).encode(string),raw=(compressed=pako.deflate(input),Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join(""));return btoa(raw).replace(/\//g,"-").replace(/=+$/,"")+suffix},WPGMZA.RestAPI.prototype.getNonce=function(route){var matches=[];for(var pattern in WPGMZA.restnoncetable){var regex=new RegExp(pattern);route.match(regex)&&matches.push({pattern:pattern,nonce:WPGMZA.restnoncetable[pattern],length:pattern.length})}if(!matches.length)throw new Error("No nonce found for route");return matches.sort(function(a,b){return b.length-a.length}),matches[0].nonce},WPGMZA.RestAPI.prototype.addNonce=function(route,params,context){function setRESTNonce(xhr){context==WPGMZA.RestAPI.CONTEXT_REST&&self.shouldAddNonce(route)&&xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&&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.shouldAddNonce=function(route){route=route.replace(/\//g,"");var isAdmin=!1;WPGMZA.is_admin&&1===parseInt(WPGMZA.is_admin)&&(isAdmin=!0);return!(route&&["markers","features","marker-listing","datatables"].includes(route)&&!isAdmin)},WPGMZA.RestAPI.prototype.call=function(route,params){if(this.useAJAXFallback)return sendAJAXFallbackRequest(route,params);var attemptedCompressedPathVariable=!1,fallbackRoute=route,fallbackParams=$.extend({},params);if("string"!=typeof route||!route.match(/^\//)&&!route.match(/^http/))throw new Error("Invalid route");if(WPGMZA.RestAPI.URL.match(/\/$/)&&(route=route.replace(/^\//,"")),params=params||{},this.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_REST),params.error||(params.error=function(xhr,status,message){if("abort"!=status){switch(xhr.status){case 401:case 403:case 405:return($.post(WPGMZA.ajaxurl,{action:"wpgmza_report_rest_api_blocked"},function(response){}),console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users."),"DELETE"===params.method)?(console.warn("The REST API rejected a DELETE request, attempting again with POST fallback"),params.method="POST",params.data||(params.data={}),params.data.simulateDelete="yes",WPGMZA.restAPI.call(route,params)):(this.useAJAXFallback=!0,sendAJAXFallbackRequest(fallbackRoute,fallbackParams));case 414:if(!attemptedCompressedPathVariable)break;return fallbackParams.method="POST",fallbackParams.useCompressedPathVariable=!1,WPGMZA.restAPI.call(fallbackRoute,fallbackParams)}throw new Error(message)}}),params.useCompressedPathVariable&&this.isCompressedPathVariableSupported&&this.isCompressedPathVariableAllowed){var compressedParams=$.extend({},params),data=params.data,base64=this.compressParams(data);WPGMZA.isServerIIS&&(base64=base64.replace(/\+/g,"%20"));var compressedRoute=route.replace(/\/$/,"")+"/base64"+base64;WPGMZA.RestAPI.URL;compressedParams.method="GET",delete compressedParams.data,!1===params.cache&&(compressedParams.data={skip_cache:1}),compressedRoute.length<this.maxURLLength?(attemptedCompressedPathVariable=!0,route=compressedRoute,params=compressedParams):(WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed||console.warn("Compressed path variable route would exceed URL length limit"),WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed=!0)}var onSuccess=null;return params.success&&(onSuccess=params.success),params.success=function(result,status,xhr){if("object"!=typeof result){var rawResult=result;try{result=JSON.parse(result)}catch(parseExc){result=rawResult}}onSuccess&&"function"==typeof onSuccess&&onSuccess(result,status,xhr)},WPGMZA.RestAPI.URL.match(/\?/)&&(route=route.replace(/\?/,"&")),$.ajax(WPGMZA.RestAPI.URL+route,params)};var nativeCallFunction=WPGMZA.RestAPI.call;WPGMZA.RestAPI.call=function(){console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?"),nativeCallFunction.apply(this,arguments)},$(document.body).on("click","#wpgmza-rest-api-blocked button.notice-dismiss",function(event){WPGMZA.restAPI.call("/rest-api/",{method:"POST",data:{dismiss_blocked_notice:!0}})})});var $_GET={};if(-1!==document.location.toString().indexOf("?"))for(var query=document.location.toString().replace(/^.*?\?/,"").replace(/#.*$/,"").split("&"),wpgmza_i=0,wpgmza_l=query.length;wpgmza_i<wpgmza_l;wpgmza_i++){var aux=decodeURIComponent(query[wpgmza_i]).split("=");$_GET[aux[0]]=aux[1]}jQuery(function($){WPGMZA.SettingsPage=function(){var self=this;this._keypressHistory=[],this.updateEngineSpecificControls(),this.updateStorageControls(),this.updateGDPRControls(),$(window).on("keypress",function(event){self.onKeyPress(event)}),jQuery("body").on("click",".wpgmza_destroy_data",function(e){e.preventDefault();var ttype=jQuery(this).attr("danger"),warning="Are you sure?";"wpgmza_destroy_all_data"==ttype&&(warning="Are you sure? This will delete ALL data and settings for WP Google Maps!"),window.confirm(warning)&&jQuery.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_settings_danger_zone_delete_data",type:ttype,nonce:wpgmza_dz_nonce},success:function(response,status,xhr){"wpgmza_destroy_all_data"==ttype?window.location.replace("admin.php?page=wp-google-maps-menu&action=welcome_page"):"wpgmza_reset_all_settings"==ttype?window.location.reload():alert("Complete.")}})}),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$('[name="wpgmza_settings_marker_pull"]').on("click",function(event){self.updateStorageControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()}),$('select[name="tile_server_url"]').on("change",function(event){"custom_override"===$('select[name="tile_server_url"]').val()?$(".wpgmza_tile_server_override_component").removeClass("wpgmza-hidden"):$(".wpgmza_tile_server_override_component").addClass("wpgmza-hidden")}),$('select[name="tile_server_url"]').trigger("change"),jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.settingsPage.flushGeocodeCache()}),$("#wpgmza-global-settings").tabs({create:function(event,ui){if(void 0!==$_GET.highlight){var elmnt=document.getElementById($_GET.highlight);elmnt.classList.add("highlight-item"),setTimeout(function(){elmnt.classList.add("highlight-item-step-2")},1e3);var y=elmnt.getBoundingClientRect().top+window.pageYOffset+-100;window.scrollTo({top:y,behavior:"smooth"})}}}),$("#wpgmza-global-setting").bind("create",function(event,ui){alert("now")}),$("#wpgmza-global-settings fieldset").each(function(index,el){$(el).children(":not(legend)").wrapAll("<span class='settings-group'></span>")})},WPGMZA.SettingsPage.createInstance=function(){return new WPGMZA.SettingsPage},WPGMZA.SettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.SettingsPage.prototype.updateStorageControls=function(){$("input[name='wpgmza_settings_marker_pull'][value='1']").is(":checked")?$("#xml-cache-settings").show():$("#xml-cache-settings").hide()},WPGMZA.SettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},WPGMZA.SettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},WPGMZA.SettingsPage.prototype.onKeyPress=function(event){this._keypressHistory.push(event.key),9<this._keypressHistory.length&&(this._keypressHistory=this._keypressHistory.slice(this._keypressHistory.length-9)),"codecabin"!=this._keypressHistory.join("")||this._developerModeRevealed||($("fieldset#wpgmza-developer-mode").show(),this._developerModeRevealed=!0)},$(document).ready(function(event){WPGMZA.getCurrentPage()&&(WPGMZA.settingsPage=WPGMZA.SettingsPage.createInstance())})}),jQuery(function($){WPGMZA.StoreLocator=function(map,element){var self=this;WPGMZA.EventDispatcher.call(this),this._center=null,this.map=map,this.element=element,this.state=WPGMZA.StoreLocator.STATE_INITIAL,this.distanceUnits=this.map.settings.store_locator_distance,this.addressInput=WPGMZA.AddressInput.createInstance(this.addressElement,this.map),$(element).find(".wpgmza-not-found-msg").hide(),this.radiusElement&&this.map.settings.wpgmza_store_locator_default_radius&&0<this.radiusElement.find("option[value='"+this.map.settings.wpgmza_store_locator_default_radius+"']").length&&this.radiusElement.val(this.map.settings.wpgmza_store_locator_default_radius),this.map.on("storelocatorgeocodecomplete",function(event){self.onGeocodeComplete(event)}),this.map.on("init",function(event){self.map.markerFilter.on("filteringcomplete",function(event){self.onFilteringComplete(event)}),void 0!==self.map.settings.store_locator_style&&"modern"!=self.map.settings.store_locator_style&&"modern"!==WPGMZA.settings.user_interface_style||"default"!==WPGMZA.settings.user_interface_style&&"modern"!=WPGMZA.settings.user_interface_style&&"legacy"!=WPGMZA.settings.user_interface_style||(self.legacyModernAdapter=WPGMZA.ModernStoreLocator.createInstance(map.id))}),$(document.body).on("click",".wpgmza_sl_search_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_search_button",function(event){self.onSearch(event)}),$(document.body).on("click",".wpgmza_sl_reset_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_reset_button_div",function(event){self.onReset(event)}),$(this.addressElement).on("keypress",function(event){13==event.which&&self.onSearch(event)})},WPGMZA.StoreLocator.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.StoreLocator.prototype.constructor=WPGMZA.StoreLocator,WPGMZA.StoreLocator.STATE_INITIAL="initial",WPGMZA.StoreLocator.STATE_APPLIED="applied",WPGMZA.StoreLocator.createInstance=function(map,element){return new WPGMZA.StoreLocator(map,element)},Object.defineProperty(WPGMZA.StoreLocator.prototype,"address",{get:function(){return $(this.addressElement).val()}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"addressElement",{get:function(){return this.legacyModernAdapter?$(this.legacyModernAdapter.element).find("input.wpgmza-address")[0]:$(this.element).find("input.wpgmza-address")[0]}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"countryRestriction",{get:function(){return this.map.settings.wpgmza_store_locator_restrict}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radiusElement",{get:function(){return $("#radiusSelect, #radiusSelect_"+this.map.id)}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return parseFloat(this.radiusElement.val())}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"center",{get:function(){return this._center}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"bounds",{get:function(){return this._bounds}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"marker",{get:function(){if(1!=this.map.settings.store_locator_bounce)return null;if(this._marker)return this._marker;return this._marker=WPGMZA.Marker.createInstance({visible:!1}),this._marker.disableInfoWindow=!0,this._marker.isFilterable=!1,this._marker.setAnimation(WPGMZA.Marker.ANIMATION_BOUNCE),this._marker}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"circle",{get:function(){return this._circle||("modern"!=this.map.settings.wpgmza_store_locator_radius_style||WPGMZA.isDeviceiOS()?this._circle=WPGMZA.Circle.createInstance({strokeColor:"#ff0000",strokeOpacity:"0.25",strokeWeight:2,fillColor:"#ff0000",fillOpacity:"0.15",visible:!1,clickable:!1,center:new WPGMZA.LatLng}):(this._circle=WPGMZA.ModernStoreLocatorCircle.createInstance(this.map.id),this._circle.settings.color=this.circleStrokeColor)),this._circle}}),WPGMZA.StoreLocator.prototype.onGeocodeComplete=function(event){if(!event.results||!event.results.length)return this._center=null,void(this._bounds=null);this._center=new WPGMZA.LatLng(event.results[0].latLng),this._bounds=new WPGMZA.LatLngBounds(event.results[0].bounds),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.onSearch=function(event){var self=this;if(this.state=WPGMZA.StoreLocator.STATE_APPLIED,!this.address||!this.address.length)return this.addressElement.focus(),!1;function callback(results,status){self.map.trigger({type:"storelocatorgeocodecomplete",results:results,status:status})}if(void 0!==this.map.settings.store_locator_style&&"modern"!==this.map.settings.store_locator_style&&"modern"!==WPGMZA.settings.user_interface_style&&"default"===WPGMZA.settings.user_interface_style&&WPGMZA.animateScroll(this.map.element),$(this.element).find(".wpgmza-not-found-msg").hide(),WPGMZA.LatLng.isLatLngString(this.address))callback([WPGMZA.LatLng.fromString(this.address)],WPGMZA.Geocoder.SUCCESS);else{var geocoder=WPGMZA.Geocoder.createInstance(),options={address:this.address};this.countryRestriction&&(options.country=this.countryRestriction),geocoder.geocode(options,function(results,status){status==WPGMZA.Geocoder.SUCCESS?callback(results,status):alert(WPGMZA.localized_strings.address_not_found)})}return!0},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this._bounds=null,this.map.setZoom(this.map.settings.map_start_zoom),$(this.element).find(".wpgmza-not-found-msg").hide(),this.circle&&this.circle.setVisible(!1),this.marker&&this.marker.map&&this.map.removeMarker(this.marker),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.getZoomFromRadius=function(radius){return this.distanceUnits==WPGMZA.Distance.MILES&&(radius*=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(14-Math.log(radius)/Math.LN2)},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){var params=event.filteringParams,marker=this.marker;marker&&marker.setVisible(!1),params.center&&(this.map.setCenter(params.center),marker&&(marker.setPosition(params.center),marker.setVisible(!0),marker.map!=this.map&&this.map.addMarker(marker))),params.radius&&this.map.setZoom(this.getZoomFromRadius(params.radius));var circle=this.circle;if(circle){circle.setVisible(!1);var factor=this.distanceUnits==WPGMZA.Distance.MILES?WPGMZA.Distance.KILOMETERS_PER_MILE:1;params.center&&params.radius&&(circle.setRadius(params.radius*factor),circle.setCenter(params.center),circle.setVisible(!0),circle instanceof WPGMZA.ModernStoreLocatorCircle||circle.map==this.map||this.map.addCircle(circle)),circle instanceof WPGMZA.ModernStoreLocatorCircle&&(circle.settings.radiusString=this.radius)}0==event.filteredMarkers.length&&this.state===WPGMZA.StoreLocator.STATE_APPLIED&&(0<$(this.element).find(".wpgmza-no-results").length&&"legacy"===WPGMZA.settings.user_interface_style?$(this.element).find(".wpgmza-no-results").show():alert(this.map.settings.store_locator_not_found_message?this.map.settings.store_locator_not_found_message:WPGMZA.localized_strings.zero_results))}}),jQuery(function($){WPGMZA.Text=function(options){if(options)for(var name in options)this[name]=options[name]},WPGMZA.Text.createInstance=function(options){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLText(options);default:return new WPGMZA.GoogleText(options)}}}),jQuery(function($){WPGMZA.ThemeEditor=function(){WPGMZA.EventDispatcher.call(this),this.element=$("#wpgmza-theme-editor"),"open-layers"!=WPGMZA.settings.engine?this.element.length?(this.json=[{}],this.mapElement=WPGMZA.maps[0].element,this.element.appendTo("#wpgmza-map-theme-editor__holder"),$(window).on("scroll",function(event){}),setInterval(function(){},200),this.initHTML(),WPGMZA.themeEditor=this):console.warn("No element to initialise theme editor on"):this.element.remove()},WPGMZA.extend(WPGMZA.ThemeEditor,WPGMZA.EventDispatcher),WPGMZA.ThemeEditor.prototype.updatePosition=function(){},WPGMZA.ThemeEditor.features={all:[],administrative:["country","land_parcel","locality","neighborhood","province"],landscape:["man_made","natural","natural.landcover","natural.terrain"],poi:["attraction","business","government","medical","park","place_of_worship","school","sports_complex"],road:["arterial","highway","highway.controlled_access","local"],transit:["line","station","station.airport","station.bus","station.rail"],water:[]},WPGMZA.ThemeEditor.elements={all:[],geometry:["fill","stroke"],labels:["icon","text","text.fill","text.stroke"]},WPGMZA.ThemeEditor.prototype.parse=function(){$("#wpgmza_theme_editor_feature option, #wpgmza_theme_editor_element option").css("font-weight","normal"),$("#wpgmza_theme_editor_error").hide(),$("#wpgmza_theme_editor").show(),$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val("");var textarea=$('textarea[name="wpgmza_theme_data"]');if(!textarea.val()||textarea.val().length<1)this.json=[{}];else{try{this.json=$.parseJSON($('textarea[name="wpgmza_theme_data"]').val())}catch(e){return this.json=[{}],$("#wpgmza_theme_editor").hide(),void $("#wpgmza_theme_editor_error").show()}if(!$.isArray(this.json)){var jsonCopy=this.json;this.json=[],this.json.push(jsonCopy)}this.highlightFeatures(),this.highlightElements(),this.loadElementStylers()}},WPGMZA.ThemeEditor.prototype.highlightFeatures=function(){$("#wpgmza_theme_editor_feature option").css("font-weight","normal"),$.each(this.json,function(i,v){v.hasOwnProperty("featureType")?$('#wpgmza_theme_editor_feature option[value="'+v.featureType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_feature option[value="all"]').css("font-weight","bold")})},WPGMZA.ThemeEditor.prototype.highlightElements=function(){var feature=$("#wpgmza_theme_editor_feature").val();$("#wpgmza_theme_editor_element option").css("font-weight","normal"),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")?$('#wpgmza_theme_editor_element option[value="'+v.elementType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_element option[value="all"]').css("font-weight","bold"))})},WPGMZA.ThemeEditor.prototype.loadElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val();$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val(""),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&v.hasOwnProperty("stylers")&&$.isArray(v.stylers)&&0<v.stylers.length&&$.each(v.stylers,function(ii,vv){vv.hasOwnProperty("hue")&&($("#wpgmza_theme_editor_do_hue").prop("checked",!0),$("#wpgmza_theme_editor_hue").val(vv.hue)),vv.hasOwnProperty("lightness")&&$("#wpgmza_theme_editor_lightness").val(vv.lightness),vv.hasOwnProperty("saturation")&&$("#wpgmza_theme_editor_saturation").val(vv.xaturation),vv.hasOwnProperty("gamma")&&$("#wpgmza_theme_editor_gamma").val(vv.gamma),vv.hasOwnProperty("invert_lightness")&&$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!0),vv.hasOwnProperty("visibility")&&$("#wpgmza_theme_editor_visibility").val(vv.visibility),vv.hasOwnProperty("color")&&($("#wpgmza_theme_editor_do_color").prop("checked",!0),$("#wpgmza_theme_editor_color").val(vv.color)),vv.hasOwnProperty("weight")&&$("#wpgmza_theme_editor_weight").val(vv.weight)})})},WPGMZA.ThemeEditor.prototype.writeElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val(),indexJSON=null,stylers=[];if("inherit"!=$("#wpgmza_theme_editor_visibility").val()&&stylers.push({visibility:$("#wpgmza_theme_editor_visibility").val()}),!0===$("#wpgmza_theme_editor_do_color").prop("checked")&&stylers.push({color:$("#wpgmza_theme_editor_color").val()}),!0===$("#wpgmza_theme_editor_do_hue").prop("checked")&&stylers.push({hue:$("#wpgmza_theme_editor_hue").val()}),0<$("#wpgmza_theme_editor_gamma").val().length&&stylers.push({gamma:parseFloat($("#wpgmza_theme_editor_gamma").val())}),0<$("#wpgmza_theme_editor_weight").val().length&&stylers.push({weight:parseFloat($("#wpgmza_theme_editor_weight").val())}),0<$("#wpgmza_theme_editor_saturation").val().length&&stylers.push({saturation:parseFloat($("#wpgmza_theme_editor_saturation").val())}),0<$("#wpgmza_theme_editor_lightness").val().length&&stylers.push({lightness:parseFloat($("#wpgmza_theme_editor_lightness").val())}),!0===$("#wpgmza_theme_editor_do_invert_lightness").prop("checked")&&stylers.push({invert_lightness:!0}),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&(indexJSON=i)}),null===indexJSON){if(0<stylers.length){var new_feature_element_stylers={};"all"!=feature&&(new_feature_element_stylers.featureType=feature),"all"!=element&&(new_feature_element_stylers.elementType=element),new_feature_element_stylers.stylers=stylers,this.json.push(new_feature_element_stylers)}}else 0<stylers.length?this.json[indexJSON].stylers=stylers:this.json.splice(indexJSON,1);$('textarea[name="wpgmza_theme_data"]').val(JSON.stringify(this.json).replace(/:/g,": ").replace(/,/g,", ")),this.highlightFeatures(),this.highlightElements(),WPGMZA.themePanel.updateMapTheme()},WPGMZA.ThemeEditor.prototype.initHTML=function(){var self=this;$.each(WPGMZA.ThemeEditor.features,function(i,v){$("#wpgmza_theme_editor_feature").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_feature").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),$.each(WPGMZA.ThemeEditor.elements,function(i,v){$("#wpgmza_theme_editor_element").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_element").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),this.parse(),$('textarea[name="wpgmza_theme_data"]').on("input selectionchange propertychange",function(){self.parse()}),$(".wpgmza_theme_selection").click(function(){setTimeout(function(){$('textarea[name="wpgmza_theme_data"]').trigger("input")},1e3)}),$("#wpgmza-theme-editor__toggle").click(function(){$("#wpgmza-theme-editor").removeClass("active")}),$("#wpgmza_theme_editor_feature").on("change",function(){self.highlightElements(),self.loadElementStylers()}),$("#wpgmza_theme_editor_element").on("change",function(){self.loadElementStylers()}),$("#wpgmza_theme_editor_do_hue, #wpgmza_theme_editor_hue, #wpgmza_theme_editor_lightness, #wpgmza_theme_editor_saturation, #wpgmza_theme_editor_gamma, #wpgmza_theme_editor_do_invert_lightness, #wpgmza_theme_editor_visibility, #wpgmza_theme_editor_do_color, #wpgmza_theme_editor_color, #wpgmza_theme_editor_weight").on("input selectionchange propertychange",function(){self.writeElementStylers()}),"open-layers"==WPGMZA.settings.engine&&$("#wpgmza_theme_editor :input").prop("disabled",!0)}}),jQuery(function($){WPGMZA.ThemePanel=function(){var self=this;this.element=$("#wpgmza-theme-panel"),this.map=WPGMZA.maps[0],"open-layers"!=WPGMZA.settings.engine?this.element.length?($("#wpgmza-theme-presets").owlCarousel({items:6,dots:!0}),this.element.on("click","#wpgmza-theme-presets label",function(event){self.onThemePresetClick(event)}),$("#wpgmza-open-theme-editor").on("click",function(event){$("#wpgmza-map-theme-editor__holder").addClass("active"),$("#wpgmza-theme-editor").addClass("active"),WPGMZA.animateScroll($("#wpgmza-theme-editor"))}),WPGMZA.themePanel=this):console.warn("No element to initialise theme panel on"):this.element.remove()},WPGMZA.ThemePanel.previewImageCenter={lat:33.701806462148646,lng:-118.15949896058983},WPGMZA.ThemePanel.previewImageZoom=11,WPGMZA.ThemePanel.prototype.onThemePresetClick=function(event){var selectedData=$(event.currentTarget).find("[data-theme-json]").attr("data-theme-json"),textarea=$(this.element).find("textarea[name='wpgmza_theme_data']"),existingData=textarea.val(),allPresetData=[];$(this.element).find("[data-theme-json]").each(function(index,el){allPresetData.push($(el).attr("data-theme-json"))}),existingData.length&&-1==allPresetData.indexOf(existingData)&&!confirm(WPGMZA.localized_strings.overwrite_theme_data)||(textarea.val(selectedData),this.updateMapTheme(),WPGMZA.themeEditor.parse())},WPGMZA.ThemePanel.prototype.updateMapTheme=function(){var data;try{data=JSON.parse($("textarea[name='wpgmza_theme_data']").val())}catch(e){return void alert(WPGMZA.localized_strings.invalid_theme_data)}this.map.setOptions({styles:data})}}),jQuery(function($){WPGMZA.Version=function(){},WPGMZA.Version.GREATER_THAN=1,WPGMZA.Version.EQUAL_TO=0,WPGMZA.Version.LESS_THAN=-1,WPGMZA.Version.compare=function(v1,v2){for(var v1parts=v1.match(/\d+/g),v2parts=v2.match(/\d+/g),i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.XMLCacheConverter=function(){},WPGMZA.XMLCacheConverter.prototype.convert=function(xml){var markers=[],remap={marker_id:"id",linkd:"link"};return $(xml).find("marker").each(function(index,el){var data={};$(el).children().each(function(j,child){var key=child.nodeName;remap[key]&&(key=remap[key]),child.hasAttribute("data-json")?data[key]=JSON.parse($(child).text()):data[key]=$(child).text()}),markers.push(data)}),markers}}),jQuery(function($){WPGMZA.loadXMLAsWebWorker=function(){function tXml(a,d){function c(){for(var l=[];a[b];){if(60==a.charCodeAt(b)){if(47===a.charCodeAt(b+1)){b=a.indexOf(">",b);break}if(33===a.charCodeAt(b+1)){if(45==a.charCodeAt(b+2)){for(;62!==a.charCodeAt(b)||45!=a.charCodeAt(b-1)||45!=a.charCodeAt(b-2)||-1==b;)b=a.indexOf(">",b+1);-1===b&&(b=a.length)}else for(b+=2;62!==a.charCodeAt(b);)b++;b++;continue}var c=f();l.push(c)}else c=b,-2===(b=a.indexOf("<",b)-1)&&(b=a.length),0<(c=a.slice(c,b+1)).trim().length&&l.push(c);b++}return l}function l(){for(var c=b;-1===g.indexOf(a[b]);)b++;return a.slice(c,b)}function f(){var d={};b++,d.tagName=l();for(var f=!1;62!==a.charCodeAt(b);){if(64<(e=a.charCodeAt(b))&&e<91||96<e&&e<123){for(var g=l(),e=a.charCodeAt(b);39!==e&&34!==e&&!(64<e&&e<91||96<e&&e<123)&&62!==e;)b++,e=a.charCodeAt(b);if(f||(d.attributes={},f=!0),39===e||34===e){e=a[b];var h=++b;b=a.indexOf(e,h),e=a.slice(h,b)}else e=null,b--;d.attributes[g]=e}b++}return 47!==a.charCodeAt(b-1)&&("script"==d.tagName?(f=b+1,b=a.indexOf("<\/script>",b),d.children=[a.slice(f,b-1)],b+=8):"style"==d.tagName?(f=b+1,b=a.indexOf("</style>",b),d.children=[a.slice(f,b-1)],b+=7):-1==k.indexOf(d.tagName)&&(b++,d.children=c())),d}var g="\n\t>/= ",k=["img","br","input","meta","link"],h=null;if((d=d||{}).searchId){var b=new RegExp("s*ids*=s*['\"]"+d.searchId+"['\"]").exec(a).index;return-1!==b&&(-1!==(b=a.lastIndexOf("<",b))&&(h=f())),b}return b=0,h=c(),d.filter&&(h=tXml.filter(h,d.filter)),d.simplify&&(h=tXml.simplefy(h)),h}tXml.simplify=function(a){var d={};if(1===a.length&&"string"==typeof a[0])return a[0];for(var c in a.forEach(function(a){if(d[a.tagName]||(d[a.tagName]=[]),"object"==typeof a){var c=tXml.simplefy(a.children);d[a.tagName].push(c),a.attributes&&(c._attributes=a.attributes)}else d[a.tagName].push(a)}),d)1==d[c].length&&(d[c]=d[c][0]);return d},tXml.filter=function(a,d){var c=[];return a.forEach(function(a){"object"==typeof a&&d(a)&&c.push(a),a.children&&(a=tXml.filter(a.children,d),c=c.concat(a))}),c},tXml.domToXml=function(a){var c="";return function d(a){if(a)for(var f=0;f<a.length;f++)if("string"==typeof a[f])c+=a[f].trim();else{var g=a[f];c+="<"+g.tagName;var k=void 0;for(k in g.attributes)c=-1===g.attributes[k].indexOf('"')?c+(" "+k+'="'+g.attributes[k].trim())+'"':c+(" "+k+"='"+g.attributes[k].trim())+"'";c+=">",d(g.children),c+="</"+g.tagName+">"}}(O),c},"object"!=typeof window&&(module.exports=tXml);var inputData,totalFiles,worker=self,dataForMainThread=[],filesLoaded=0;function onXMLLoaded(request){if(4==request.readyState&&200==request.status){(new Date).getTime();!function(xml){for(var markers=xml[0].children[0],remap={marker_id:"id",linkd:"link"},i=0;i<markers.children.length;i++){var data={};markers.children[i].children.forEach(function(node){var key=node.tagName;remap[key]&&(key=remap[key]),node.attributes["data-json"]?data[key]=JSON.parse(node.children[0]):node.children.length?data[key]=node.children[0]:data[key]=""}),dataForMainThread.push(data)}}(tXml(request.responseText)),++filesLoaded>=totalFiles?worker.postMessage(dataForMainThread):loadNextFile()}}function loadNextFile(){var url=inputData.urls[filesLoaded],request=new XMLHttpRequest;request.onreadystatechange=function(){onXMLLoaded(this)},request.open("GET",inputData.protocol+url,!0),request.send()}self.addEventListener("message",function(event){var data=event.data;switch(data.command){case"load":dataForMainThread=[],filesLoaded=0,totalFiles=(inputData=data).urls.length,loadNextFile();break;default:throw new Error("Unknown command")}},!1)}}),jQuery(function($){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($){$(document).ready(function(event){var parent=document.body.onclick;parent&&(document.body.onclick=function(event){event.target instanceof WPGMZA.Marker||parent(event)})})}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&-1<navigator.vendor.indexOf("Apple")&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;WPGMZA.Circle.call(this,options,googleCircle),googleCircle?(this.googleCircle=googleCircle,options&&(options.center=WPGMZA.LatLng.fromGoogleLatLng(googleCircle.getCenter()),options.radius=googleCircle.getRadius()/1e3)):(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),this.googleFeature=this.googleCircle,options&&this.setOptions(options),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.getCenter=function(){return WPGMZA.LatLng.fromGoogleLatLng(this.googleCircle.getCenter())},WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},WPGMZA.GoogleCircle.prototype.getRadius=function(){return this.googleCircle.getRadius()/1e3},WPGMZA.GoogleCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.googleCircle.setRadius(1e3*parseFloat(radius))},WPGMZA.GoogleCircle.prototype.setVisible=function(visible){this.googleCircle.setVisible(!!visible)},WPGMZA.GoogleCircle.prototype.setDraggable=function(value){this.googleCircle.setDraggable(!!value)},WPGMZA.GoogleCircle.prototype.setEditable=function(value){var self=this;this.googleCircle.setOptions({editable:value}),value&&(google.maps.event.addListener(this.googleCircle,"center_changed",function(event){self.center=WPGMZA.LatLng.fromGoogleLatLng(self.googleCircle.getCenter()),self.trigger("change")}),google.maps.event.addListener(this.googleCircle,"radius_changed",function(event){self.radius=self.googleCircle.getRadius()/1e3,self.trigger("change")}))},WPGMZA.GoogleCircle.prototype.setOptions=function(options){WPGMZA.Circle.prototype.setOptions.apply(this,arguments),options.center&&(this.center=new WPGMZA.LatLng(options.center))},WPGMZA.GoogleCircle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),center=new WPGMZA.LatLng(this.center);googleOptions.radius*=1e3,googleOptions.center=center.toGoogleLatLng(),this.googleCircle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleDrawingManager=function(map){var self=this;WPGMZA.DrawingManager.call(this,map),this.mode=null,this.googleDrawingManager=new google.maps.drawing.DrawingManager({drawingControl:!1,polygonOptions:{editable:!0},polylineOptions:{editable:!0},circleOptions:{editable:!0},rectangleOptions:{editable:!0}}),this.googleDrawingManager.setMap(map.googleMap),google.maps.event.addListener(this.googleDrawingManager,"polygoncomplete",function(polygon){self.onPolygonClosed(polygon)}),google.maps.event.addListener(this.googleDrawingManager,"polylinecomplete",function(polyline){self.onPolylineComplete(polyline)}),google.maps.event.addListener(this.googleDrawingManager,"circlecomplete",function(circle){self.onCircleComplete(circle)}),google.maps.event.addListener(this.googleDrawingManager,"rectanglecomplete",function(rectangle){self.onRectangleComplete(rectangle)})},WPGMZA.GoogleDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.GoogleDrawingManager.prototype.constructor=WPGMZA.GoogleDrawingManager,WPGMZA.GoogleDrawingManager.prototype.setDrawingMode=function(mode){var googleMode;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:googleMode=null;break;case WPGMZA.DrawingManager.MODE_POLYGON:googleMode=google.maps.drawing.OverlayType.POLYGON;break;case WPGMZA.DrawingManager.MODE_POLYLINE:googleMode=google.maps.drawing.OverlayType.POLYLINE;break;case WPGMZA.DrawingManager.MODE_CIRCLE:googleMode=google.maps.drawing.OverlayType.CIRCLE;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:googleMode=google.maps.drawing.OverlayType.RECTANGLE;break;case WPGMZA.DrawingManager.MODE_HEATMAP:googleMode=null;break;default:throw new Error("Invalid drawing mode")}this.googleDrawingManager.setDrawingMode(googleMode)},WPGMZA.GoogleDrawingManager.prototype.setOptions=function(options){this.googleDrawingManager.setOptions({polygonOptions:options,polylineOptions:options})},WPGMZA.GoogleDrawingManager.prototype.onVertexClicked=function(event){},WPGMZA.GoogleDrawingManager.prototype.onPolygonClosed=function(googlePolygon){var event=new WPGMZA.Event("polygonclosed");event.enginePolygon=googlePolygon,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onPolylineComplete=function(googlePolyline){var event=new WPGMZA.Event("polylinecomplete");event.enginePolyline=googlePolyline,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onCircleComplete=function(googleCircle){var event=new WPGMZA.Event("circlecomplete");event.engineCircle=googleCircle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onRectangleComplete=function(googleRectangle){var event=new WPGMZA.Event("rectanglecomplete");event.engineRectangle=googleRectangle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onHeatmapPointAdded=function(googleMarker){var position=WPGMZA.LatLng.fromGoogleLatLng(googleMarker.getPosition());googleMarker.setMap(null);var marker=WPGMZA.Marker.createInstance();marker.setPosition(position);var image={url:WPGMZA.imageFolderURL+"heatmap-point.png",origin:new google.maps.Point(0,0),anchor:new google.maps.Point(13,13)};marker.googleMarker.setIcon(image),this.map.addMarker(marker);var event=new WPGMZA.Event("heatmappointadded");event.position=position,this.trigger(event)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)return nativeStatus=WPGMZA.Geocoder.NO_ADDRESS,void callback(null,nativeStatus);if(options.lat&&options.lng){var latLng={lat:options.lat,lng:options.lng};callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:null}],WPGMZA.Geocoder.SUCCESS)}if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()},bounds=null;results[0].geometry.bounds&&(bounds=WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds)),callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:bounds}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){WPGMZA.settings.engine&&"google-maps"!=WPGMZA.settings.engine||window.google&&window.google.maps&&(WPGMZA.GoogleHTMLOverlay=function(map){this.element=$("<div class='wpgmza-google-html-overlay'></div>"),this.visible=!0,this.position=new WPGMZA.LatLng,this.setMap(map.googleMap),this.wpgmzaMap=map},WPGMZA.GoogleHTMLOverlay.prototype=new google.maps.OverlayView,WPGMZA.GoogleHTMLOverlay.prototype.onAdd=function(){this.getPanes().overlayMouseTarget.appendChild(this.element[0])},WPGMZA.GoogleHTMLOverlay.prototype.onRemove=function(){this.element&&$(this.element).parent().length&&($(this.element).remove(),this.element=null)},WPGMZA.GoogleHTMLOverlay.prototype.draw=function(){this.updateElementPosition()},WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition=function(){var projection=this.getProjection();if(projection){var pixels=projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());$(this.element).css({left:pixels.x,top:pixels.y})}})}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(feature){Parent.call(this,feature),this.setFeature(feature)},WPGMZA.GoogleInfoWindow.Z_INDEX=99,Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setFeature=function(feature){(this.feature=feature)instanceof WPGMZA.Marker?this.googleObject=feature.googleMarker:feature instanceof WPGMZA.Polygon?this.googleObject=feature.googlePolygon:feature instanceof WPGMZA.Polyline&&(this.googleObject=feature.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){var self=this;this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow,this.googleInfoWindow.setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX),google.maps.event.addListener(this.googleInfoWindow,"domready",function(event){self.trigger("domready")}),google.maps.event.addListener(this.googleInfoWindow,"closeclick",function(event){self.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(self.state=WPGMZA.InfoWindow.STATE_CLOSED,self.feature.map.trigger("infowindowclose"))}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,feature){var self=this;if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setFeature(feature),this.googleInfoWindow.open(this.feature.map.googleMap,this.googleObject);var intervalID,guid=WPGMZA.guid(),eaBtn=WPGMZA.isProVersion()?"":this.addEditButton(),html="<div id='"+guid+"'>"+eaBtn+" "+this.content+"</div>";return this.googleInfoWindow.setContent(html),intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaFeature=self.feature,div.addClass("wpgmza-infowindow"),self.element=div[0],self.trigger("infowindowopen"))},50),!0},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;Parent.call(this,element,options),this.loadGoogleMap(),options?this.setOptions(options,!0):this.setOptions({},!0),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.parseThemeData=function(raw){var json;try{json=JSON.parse(raw)}catch(e){try{json=eval(raw)}catch(e){var str=raw;str=str.replace(/\\'/g,"'"),str=str.replace(/\\"/g,'"'),str=str.replace(/\\0/g,"\0"),str=str.replace(/\\\\/g,"\\");try{json=eval(str)}catch(e){return console.warn("Couldn't parse theme data"),[]}}}return json},WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),this.settings.transport_layer&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.wpgmza_show_point_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options,initializing){if(Parent.prototype.setOptions.call(this,options),options.scrollwheel&&delete options.scrollwheel,initializing){var converted=$.extend(options,this.settings.toGoogleMapsOptions()),clone=$.extend({},converted);if(!clone.center instanceof google.maps.LatLng&&(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),this.settings.hide_point_of_interest){clone.styles||(clone.styles=[]),clone.styles.push({featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]})}this.googleMap.setOptions(clone)}else this.googleMap.setOptions(options)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.addRectangle=function(rectangle){rectangle.googleRectangle.setMap(this.googleMap),Parent.prototype.addRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.removeRectangle=function(rectangle){rectangle.googleRectangle.setMap(null),Parent.prototype.removeRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(parseInt(value))},WPGMZA.GoogleMap.prototype.getBounds=function(){var nativeBounds=new WPGMZA.LatLngBounds({});try{var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest();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()}}catch(ex){}return nativeBounds},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var nativeBounds=new google.maps.LatLngBounds(southWest,northEast);this.googleMap.fitBounds(nativeBounds)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")},WPGMZA.GoogleMap.prototype.enableAllInteractions=function(){var options={scrollwheel:!0,draggable:!0,disableDoubleClickZoom:!1};this.googleMap.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toGoogleLatLng():options[name]instanceof WPGMZA.Map||"icon"==name||(settings[name]=options[name]);this.googleMarker=new google.maps.Marker(settings),(this.googleMarker.wpgmzaMarker=this).googleFeature=this.googleMarker,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.anim&&this.googleMarker.setAnimation(this.anim),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()}),self.trigger("change")}),this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,Object.defineProperty(WPGMZA.GoogleMarker.prototype,"opacity",{get:function(){return this._opacity},set:function(value){this._opacity=value,this.googleMarker.setOpacity(value)}}),WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.updateOffset=function(){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image,x=this._offset.x,y=this._offset.y;icon=icon||WPGMZA.settings.default_marker_icon,params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor_x=img.width/2,defaultAnchor_y=img.height;params.anchor=new google.maps.Point(defaultAnchor_x-x,defaultAnchor_y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(!!visible)},WPGMZA.GoogleMarker.prototype.getVisible=function(visible){return this.googleMarker.getVisible()},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)},WPGMZA.GoogleMarker.prototype.setOpacity=function(opacity){this.googleMarker.setOpacity(opacity)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){var map=this.map=WPGMZA.getMapByID(map_id);WPGMZA.ModernStoreLocator.call(this,map_id);var restrict=map.settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&restrict&&restrict.length,this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(options,googlePolygon){var self=this;options=options||{},Parent.call(this,options,googlePolygon),this.googlePolygon=googlePolygon||new google.maps.Polygon,this.googleFeature=this.googlePolygon,options&&options.polydata&&this.googlePolygon.setOptions({paths:this.parseGeometry(options.polydata)}),this.googlePolygon.wpgmzaPolygon=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.updateNativeFeature=function(){this.googlePolygon.setOptions(this.getScalarProperties())},WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){var self=this;this.googlePolygon.setOptions({editable:value}),value&&(this.googlePolygon.getPaths().forEach(function(path,index){["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})})}),google.maps.event.addListener(this.googlePolygon,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolygon,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))}))},WPGMZA.GooglePolygon.prototype.setDraggable=function(value){this.googlePolygon.setDraggable(value)},WPGMZA.GooglePolygon.prototype.getGeometry=function(){for(var result=[],path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(options,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,options,googlePolyline),this.googlePolyline=googlePolyline||new google.maps.Polyline(this.settings),this.googleFeature=this.googlePolyline,options&&options.polydata){var path=this.parseGeometry(options.polydata);this.googlePolyline.setPath(path)}this.googlePolyline.wpgmzaPolyline=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.updateNativeFeature=function(){this.googlePolyline.setOptions(this.getScalarProperties())},WPGMZA.GooglePolyline.prototype.setEditable=function(value){var self=this;if(this.googlePolyline.setOptions({editable:value}),value){var path=this.googlePolyline.getPath();["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})}),google.maps.event.addListener(this.googlePolyline,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolyline,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))})}},WPGMZA.GooglePolyline.prototype.setDraggable=function(value){this.googlePolyline.setOptions({draggable:value})},WPGMZA.GooglePolyline.prototype.getGeometry=function(){for(var result=[],path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GoogleRectangle=function(options,googleRectangle){var self=this;options=options||{},WPGMZA.Rectangle.call(this,options,googleRectangle),googleRectangle?(this.googleRectangle=googleRectangle,this.cornerA=options.cornerA=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getNorthEast().lat(),lng:googleRectangle.getBounds().getSouthWest().lng()}),this.cornerB=options.cornerB=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getSouthWest().lat(),lng:googleRectangle.getBounds().getNorthEast().lng()})):(this.googleRectangle=new google.maps.Rectangle,this.googleRectangle.wpgmzaRectangle=this),this.googleFeature=this.googleRectangle,options&&this.setOptions(options),google.maps.event.addListener(this.googleRectangle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleRectangle.prototype=Object.create(WPGMZA.Rectangle.prototype),WPGMZA.GoogleRectangle.prototype.constructor=WPGMZA.GoogleRectangle,WPGMZA.GoogleRectangle.prototype.getBounds=function(){return WPGMZA.LatLngBounds.fromGoogleLatLngBounds(this.googleRectangle.getBounds())},WPGMZA.GoogleRectangle.prototype.setVisible=function(visible){this.googleRectangle.setVisible(!!visible)},WPGMZA.GoogleRectangle.prototype.setDraggable=function(value){this.googleRectangle.setDraggable(!!value)},WPGMZA.GoogleRectangle.prototype.setEditable=function(value){var self=this;this.googleRectangle.setEditable(!!value),value&&google.maps.event.addListener(this.googleRectangle,"bounds_changed",function(event){self.trigger("change")})},WPGMZA.GoogleRectangle.prototype.setOptions=function(options){WPGMZA.Rectangle.prototype.setOptions.apply(this,arguments),options.cornerA&&options.cornerB&&(this.cornerA=new WPGMZA.LatLng(options.cornerA),this.cornerB=new WPGMZA.LatLng(options.cornerB))},WPGMZA.GoogleRectangle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),north=parseFloat(this.cornerA.lat),west=parseFloat(this.cornerA.lng),south=parseFloat(this.cornerB.lat),east=parseFloat(this.cornerB.lng);north&&west&&south&&east&&(googleOptions.bounds={north:north,west:west,south:south,east:east}),this.googleRectangle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleText=function(options){WPGMZA.Text.apply(this,arguments),this.overlay=new WPGMZA.GoogleTextOverlay(options)},WPGMZA.extend(WPGMZA.GoogleText,WPGMZA.Text)}),jQuery(function($){WPGMZA.GoogleTextOverlay=function(options){this.element=$("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>"),(options=options||{}).position&&(this.position=options.position),options.text&&this.element.find(".wpgmza-inner").text(options.text),options.map&&this.setMap(options.map.googleMap)},window.google&&google.maps&&google.maps.OverlayView&&(WPGMZA.GoogleTextOverlay.prototype=new google.maps.OverlayView),WPGMZA.GoogleTextOverlay.prototype.onAdd=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"}),this.getPanes().floatPane.appendChild(this.element[0])},WPGMZA.GoogleTextOverlay.prototype.draw=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"})},WPGMZA.GoogleTextOverlay.prototype.onRemove=function(){this.element.remove()},WPGMZA.GoogleTextOverlay.prototype.hide=function(){this.element.hide()},WPGMZA.GoogleTextOverlay.prototype.show=function(){this.element.show()},WPGMZA.GoogleTextOverlay.prototype.toggle=function(){this.element.is(":visible")?this.element.hide():this.element.show()}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&null!=vertex&&path.removeAt(vertex),this.close()}))}),jQuery(function($){WPGMZA.FeaturePanel=function(element,mapEditPage){var self=this;WPGMZA.EventDispatcher.apply(this,arguments),this.map=mapEditPage.map,this.drawingManager=mapEditPage.drawingManager,this.feature=null,this.element=element,this.initDefaults(),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.drawingInstructionsElement=$(this.element).find(".wpgmza-feature-drawing-instructions"),this.drawingInstructionsElement.detach(),this.editingInstructionsElement=$(this.element).find(".wpgmza-feature-editing-instructions"),this.editingInstructionsElement.detach(),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.newPanel[0],self.element[0])&&self.onTabActivated(event)}),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.oldPanel[0],self.element[0])&&self.onTabDeactivated(event)}),$(document.body).on("click","[data-edit-"+this.featureType+"-id]",function(event){self.onEditFeature(event)}),$(document.body).on("click","[data-delete-"+this.featureType+"-id]",function(event){self.onDeleteFeature(event)}),$(this.element).find(".wpgmza-save-feature").on("click",function(event){self.onSave(event)}),this.drawingManager.on(self.drawingManagerCompleteEvent,function(event){self.onDrawingComplete(event)}),this.drawingManager.on("drawingmodechanged",function(event){self.onDrawingModeChanged(event)}),$(this.element).on("change input",function(event){self.onPropertyChanged(event)})},WPGMZA.extend(WPGMZA.FeaturePanel,WPGMZA.EventDispatcher),WPGMZA.FeaturePanel.MODE_ADD="add",WPGMZA.FeaturePanel.MODE_EDIT="edit",WPGMZA.FeaturePanel.prevEditableFeature=null,Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"drawingManagerCompleteEvent",{get:function(){return this.featureType+"complete"}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureDataTable",{get:function(){return $("[data-wpgmza-datatable][data-wpgmza-feature-type='"+this.featureType+"']")[0].wpgmzaDataTable}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureAccordion",{get:function(){return $(this.element).closest(".wpgmza-accordion")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"map",{get:function(){return WPGMZA.mapEditPage.map}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"mode",{get:function(){return this._mode}}),WPGMZA.FeaturePanel.prototype.initPreloader=function(){this.preloader||(this.preloader=$(WPGMZA.preloaderHTML),this.preloader.hide(),$(this.element).append(this.preloader))},WPGMZA.FeaturePanel.prototype.initDataTable=function(){var el=$(this.element).find("[data-wpgmza-datatable][data-wpgmza-rest-api-route]");this[this.featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)},WPGMZA.FeaturePanel.prototype.initDefaults=function(){$(this.element).find("[data-ajax-name]:not([type='radio'])").each(function(index,el){var val=$(el).val();val&&$(el).attr("data-default-value",val)})},WPGMZA.FeaturePanel.prototype.setCaptionType=function(type,id){var icons={add:"fa-plus-circle",save:"fa-pencil-square-o"};switch(type){case WPGMZA.FeaturePanel.MODE_ADD:case WPGMZA.FeaturePanel.MODE_EDIT:this.featureAccordion.find("[data-add-caption][data-edit-caption]").each(function(index,el){var text=$(el).attr("data-"+type+"-caption"),icon=$(el).find("i.fa");id&&(text+=" "+id),$(el).text(text),icon.length&&((icon=$("<i class='fa' aria-hidden='true'></i>")).addClass(icons[type]),$(el).prepend(" "),$(el).prepend(icon))});break;default:throw new Error("Invalid type")}},WPGMZA.FeaturePanel.prototype.setMode=function(type,id){this._mode=type,this.setCaptionType(type,id)},WPGMZA.FeaturePanel.prototype.setTargetFeature=function(feature){var self=this;if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setEditable(!1),prev.setDraggable(!1),prev.off("change")}feature?(feature.setEditable(!0),feature.setDraggable(!0),feature.on("change",function(event){self.onFeatureChanged(event)}),this.setMode(WPGMZA.FeaturePanel.MODE_EDIT),this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showInstructions()):this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.feature=WPGMZA.FeaturePanel.prevEditableFeature=feature},WPGMZA.FeaturePanel.prototype.reset=function(){$(this.element).find("[data-ajax-name]:not([data-ajax-name='map_id']):not([type='color']):not([type='checkbox']):not([type='radio'])").val(""),$(this.element).find("select[data-ajax-name]>option:first-child").prop("selected",!0),$(this.element).find("[data-ajax-name='id']").val("-1"),$(this.element).find("input[type='checkbox']").prop("checked",!1),tinyMCE.get("wpgmza-description-editor")?tinyMCE.get("wpgmza-description-editor").setContent(""):$("#wpgmza-description-editor").val(""),$("#wpgmza-description-editor").val(""),this.showPreloader(!1),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),$(this.element).find("[data-ajax-name][data-default-value]").each(function(index,el){$(el).val($(el).data("default-value"))})},WPGMZA.FeaturePanel.prototype.select=function(arg){var id,expectedBaseClass,self=this;if(this.reset(),$.isNumeric(arg))id=arg;else{if(expectedBaseClass=WPGMZA[WPGMZA.capitalizeWords(this.featureType)],!(feature instanceof expectedBaseClass))throw new Error("Invalid feature type for this panel");id=arg.id}this.showPreloader(!0),WPGMZA.animateScroll($(".wpgmza_map")),WPGMZA.restAPI.call("/"+this.featureType+"s/"+id+"?skip_cache=1",{success:function(data,status,xhr){var getByIDFunction="get"+WPGMZA.capitalizeWords(self.featureType)+"ByID",feature=self.map[getByIDFunction](id);self.populate(data),self.showPreloader(!1),self.setMode(WPGMZA.FeaturePanel.MODE_EDIT,id),self.setTargetFeature(feature)}})},WPGMZA.FeaturePanel.prototype.showPreloader=function(show){this.initPreloader(),0==arguments.length||show?(this.preloader.fadeIn(),this.element.addClass("wpgmza-loading")):(this.preloader.fadeOut(),this.element.removeClass("wpgmza-loading"))},WPGMZA.FeaturePanel.prototype.populate=function(data){var value,target,name;for(name in data)switch(target=$(this.element).find("[data-ajax-name='"+name+"']"),value=data[name],(target.attr("type")||"").toLowerCase()){case"checkbox":case"radio":target.prop("checked",1==data[name]);break;case"color":value.match(/^#/)||(value="#"+value);default:"object"==typeof value&&(value=JSON.stringify(value)),$(this.element).find("[data-ajax-name='"+name+"']:not(select)").val(value),$(this.element).find("select[data-ajax-name='"+name+"']").each(function(index,el){"string"==typeof value&&0==data[name].length||$(el).val(value)})}},WPGMZA.FeaturePanel.prototype.serializeFormData=function(){var fields=$(this.element).find("[data-ajax-name]"),data={};return fields.each(function(index,el){var type="text";switch($(el).attr("type")&&(type=$(el).attr("type").toLowerCase()),type){case"checkbox":data[$(el).attr("data-ajax-name")]=$(el).prop("checked")?1:0;break;case"radio":$(el).prop("checked")&&(data[$(el).attr("data-ajax-name")]=$(el).val());break;default:data[$(el).attr("data-ajax-name")]=$(el).val()}}),data},WPGMZA.FeaturePanel.prototype.discardChanges=function(){if(this.feature){var feature=this.feature;this.setTargetFeature(null),feature&&feature.map&&(this.map["remove"+WPGMZA.capitalizeWords(this.featureType)](feature),-1<feature.id&&this.updateFeatureByID(feature.id))}},WPGMZA.FeaturePanel.prototype.updateFeatureByID=function(id){var feature,self=this,route="/"+this.featureType+"s/",functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;WPGMZA.restAPI.call(route+id,{success:function(data,status,xhr){(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature)}})},WPGMZA.FeaturePanel.prototype.showInstructions=function(){switch(this.mode){case WPGMZA.FeaturePanel.MODE_ADD:$(this.map.element).append(this.drawingInstructionsElement),$(this.drawingInstructionsElement).hide().fadeIn();break;default:$(this.map.element).append(this.editingInstructionsElement),$(this.editingInstructionsElement).hide().fadeIn()}},WPGMZA.FeaturePanel.prototype.onTabActivated=function(){this.reset(),this.drawingManager.setDrawingMode(this.featureType),this.onAddFeature(event),$(".wpgmza-table-container-title").hide(),$(".wpgmza-table-container").hide();var featureString=this.featureType.charAt(0).toUpperCase()+this.featureType.slice(1);$("#wpgmza-table-container-"+featureString).show(),$("#wpgmza-table-container-title-"+featureString).show()},WPGMZA.FeaturePanel.prototype.onTabDeactivated=function(){this.discardChanges(),this.setTargetFeature(null)},WPGMZA.FeaturePanel.prototype.onAddFeature=function(event){this.drawingManager.setDrawingMode(this.featureType)},WPGMZA.FeaturePanel.prototype.onEditFeature=function(event){var name="data-edit-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.select(id)},WPGMZA.FeaturePanel.prototype.onDeleteFeature=function(event){var self=this,name="data-delete-"+this.featureType+"-id",id=$(event.currentTarget).attr(name),route="/"+this.featureType+"s/",feature=this.map["get"+WPGMZA.capitalizeWords(this.featureType)+"ByID"](id);this.featureDataTable.dataTable.processing(!0),WPGMZA.restAPI.call(route+id,{method:"DELETE",success:function(data,status,xhr){self.map["remove"+WPGMZA.capitalizeWords(self.featureType)](feature),self.featureDataTable.reload()}})},WPGMZA.FeaturePanel.prototype.onDrawingModeChanged=function(event){$(this.drawingInstructionsElement).detach(),$(this.editingInstructionsElement).detach(),this.drawingManager.mode==this.featureType&&this.showInstructions()},WPGMZA.FeaturePanel.prototype.onDrawingComplete=function(event){var engineFeature=event["engine"+WPGMZA.capitalizeWords(this.featureType)],formData=this.serializeFormData(),geometryField=$(this.element).find("textarea[data-ajax-name$='data']");delete formData.polydata;var nativeFeature=WPGMZA[WPGMZA.capitalizeWords(this.featureType)].createInstance(formData,engineFeature);this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.map["add"+WPGMZA.capitalizeWords(this.featureType)](nativeFeature),this.setTargetFeature(nativeFeature),geometryField.length&&geometryField.val(JSON.stringify(nativeFeature.getGeometry())),this.featureType},WPGMZA.FeaturePanel.prototype.onPropertyChanged=function(event){var feature=this.feature;feature&&($(this.element).find(":input[data-ajax-name]").each(function(index,el){var key=$(el).attr("data-ajax-name");feature[key]=$(el).val()}),feature.updateNativeFeature())},WPGMZA.FeaturePanel.prototype.onFeatureChanged=function(event){var geometryField=$(this.element).find("textarea[data-ajax-name$='data']");geometryField.length&&geometryField.val(JSON.stringify(this.feature.getGeometry()))},WPGMZA.FeaturePanel.prototype.onSave=function(event){var self=this,id=$(self.element).find("[data-ajax-name='id']").val(),data=this.serializeFormData(),route="/"+this.featureType+"s/",isNew=-1==id;"circle"!=this.featureType||data.center?"rectangle"!=this.featureType||data.cornerA?"polygon"!=this.featureType||data.polydata?"polyline"!=this.featureType||data.polydata?(isNew||(route+=id),WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0),WPGMZA.restAPI.call(route,{method:"POST",data:data,success:function(data,status,xhr){var feature,functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;self.reset(),(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),self.setTargetFeature(null),self.showPreloader(!1),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature),self.featureDataTable.reload(),self.onTabActivated(event)}})):alert(WPGMZA.localized_strings.no_shape_polyline):alert(WPGMZA.localized_strings.no_shape_polygon):alert(WPGMZA.localized_strings.no_shape_rectangle):alert(WPGMZA.localized_strings.no_shape_circle)}}),jQuery(function($){WPGMZA.MarkerPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.MarkerPanel,WPGMZA.FeaturePanel),WPGMZA.MarkerPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProMarkerPanel(element,mapEditPage):new WPGMZA.MarkerPanel(element,mapEditPage)},WPGMZA.MarkerPanel.prototype.initDefaults=function(){var self=this;WPGMZA.FeaturePanel.prototype.initDefaults.apply(this,arguments),this.adjustSubMode=!1,this.onTabActivated(null),$(document.body).on("click","[data-adjust-"+this.featureType+"-id]",function(event){self.onAdjustFeature(event)}),$(document.body).on("click",".wpgmza_approve_btn",function(event){self.onApproveMarker(event)})},WPGMZA.MarkerPanel.prototype.onAdjustFeature=function(event){var name="data-adjust-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.adjustSubMode=!0,this.select(id)},WPGMZA.MarkerPanel.prototype.onApproveMarker=function(event){var self=this,route="/"+this.featureType+"s/"+$(event.currentTarget).attr("id");WPGMZA.restAPI.call(route,{method:"POST",data:{approved:"1"},success:function(data,status,xhr){self.featureDataTable.reload()}})},WPGMZA.MarkerPanel.prototype.onFeatureChanged=function(event){if(this.adjustSubMode){var aPos=this.feature.getPosition();aPos&&($(this.element).find("[data-ajax-name='lat']").val(aPos.lat),$(this.element).find("[data-ajax-name='lng']").val(aPos.lng))}else{var addressField=$(this.element).find("input[data-ajax-name$='address']");if(addressField.length){var pos=this.feature.getPosition();addressField.val(pos.lat+","+pos.lng)}}},WPGMZA.MarkerPanel.prototype.setTargetFeature=function(feature){if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setOpacity&&prev.setOpacity(1)}$(this.element).find("[data-ajax-name]").removeAttr("disabled"),$(this.element).find("fieldset").show(),$(this.element).find(".wpgmza-adjust-mode-notice").addClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","hidden"),$(this.element).find('[data-ajax-name="lng"]').attr("type","hidden"),$(this.element).find(".wpgmza-hide-in-adjust-mode").removeClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").addClass("wpgmza-hidden"),feature?(feature.setOpacity&&feature.setOpacity(.7),feature.getMap().panTo(feature.getPosition()),this.adjustSubMode&&($(this.element).find("[data-ajax-name]").attr("disabled","disabled"),$(this.element).find("fieldset:not(.wpgmza-always-on)").hide(),$(this.element).find(".wpgmza-adjust-mode-notice").removeClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","text").removeAttr("disabled"),$(this.element).find('[data-ajax-name="lng"]').attr("type","text").removeAttr("disabled"),$(this.element).find(".wpgmza-hide-in-adjust-mode").addClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").removeClass("wpgmza-hidden"))):this.adjustSubMode=!1,WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments)},WPGMZA.MarkerPanel.prototype.onSave=function(event){var self=this,geocoder=WPGMZA.Geocoder.createInstance(),geocodingData={address:$(this.element).find("[data-ajax-name='address']").val()};WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0);var cloud_lat=!1,cloud_lng=!1;0<document.getElementsByName("lat").length&&(cloud_lat=document.getElementsByName("lat")[0].value),0<document.getElementsByName("lng").length&&(cloud_lng=document.getElementsByName("lng")[0].value),cloud_lat&&cloud_lng&&(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey||(geocodingData.lat=parseFloat(cloud_lat),geocodingData.lng=parseFloat(cloud_lng))),this.adjustSubMode?WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments):geocoder.geocode(geocodingData,function(results,status){switch(status){case WPGMZA.Geocoder.ZERO_RESULTS:return alert(WPGMZA.localized_strings.zero_results),void self.showPreloader(!1);case WPGMZA.Geocoder.SUCCESS:break;case WPGMZA.Geocoder.NO_ADDRESS:return alert(WPGMZA.localized_strings.no_address),void self.showPreloader(!1);case WPGMZA.Geocoder.FAIL:default:return alert(WPGMZA.localized_strings.geocode_fail),void self.showPreloader(!1)}var result=results[0];$(self.element).find("[data-ajax-name='lat']").val(result.lat),$(self.element).find("[data-ajax-name='lng']").val(result.lng),WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments)}),WPGMZA.mapEditPage.map.resetBounds()}}),jQuery(function($){WPGMZA.CirclePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.CirclePanel,WPGMZA.FeaturePanel),WPGMZA.CirclePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProCirclePanel(element,mapEditPage):new WPGMZA.CirclePanel(element,mapEditPage)},WPGMZA.CirclePanel.prototype.updateFields=function(){$(this.element).find("[data-ajax-name='center']").val(this.feature.getCenter().toString()),$(this.element).find("[data-ajax-name='radius']").val(this.feature.getRadius())},WPGMZA.CirclePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.CirclePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.CirclePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}});var wpgmza_autoCompleteDisabled=!1;jQuery(function($){"map-edit"==WPGMZA.currentPage&&(WPGMZA.MapEditPage=function(){var self=this,element=document.body;WPGMZA.EventDispatcher.call(this),$("#wpgmaps_options fieldset").wrapInner("<div class='wpgmza-flex'></div>"),this.themePanel=new WPGMZA.ThemePanel,this.themeEditor=new WPGMZA.ThemeEditor,this.map=WPGMZA.maps[0],(!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.1.0")>=WPGMZA.Version.EQUAL_TO)&&(this.drawingManager=WPGMZA.DrawingManager.createInstance(this.map)),this.initDataTables(),this.initFeaturePanels(),this.initJQueryUIControls(),"en"!==WPGMZA.locale&&$("#datatable_no_result_message,#datatable_search_string").parent().parent().hide(),$("input.wpgmza-address").each(function(index,el){el.addressInput=WPGMZA.AddressInput.createInstance(el,self.map)}),$('#wpgmza-map-edit-page input[type="color"]').each(function(){$("<div class='button-secondary wpgmza-paste-color-btn' title='Paste a HEX color code'><i class='fa fa-clipboard' aria-hidden='true'></i></div>").insertAfter(this)}),jQuery("body").on("click",".wpgmza_ac_result",function(e){var index=jQuery(this).data("id"),lat=jQuery(this).data("lat"),lng=jQuery(this).data("lng"),name=jQuery("#wpgmza_item_address_"+index).html();jQuery("input[name='lat']").val(lat),jQuery("input[name='lng']").val(lng),jQuery("#wpgmza_add_address_map_editor").val(name),jQuery("#wpgmza_autocomplete_search_results").hide()}),jQuery("body").on("click",".wpgmza-paste-color-btn",function(){try{var colorBtn=$(this);if(!navigator||!navigator.clipboard||!navigator.clipboard.readText)return;navigator.clipboard.readText().then(function(textcopy){colorBtn.parent().find('input[type="color"]').val("#"+textcopy.replace("#","").trim())}).catch(function(err){console.error("WP Google Maps: Could not access clipboard",err)})}catch(c_ex){}}),jQuery("body").on("focusout","#wpgmza_add_address_map_editor",function(e){setTimeout(function(){jQuery("#wpgmza_autocomplete_search_results").fadeOut("slow")},500)});var ajaxRequest=!1,wpgmzaAjaxTimeout=!1,wpgmzaStartTyping=!1,wpgmzaKeyStrokeCount=1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0,wpgmzaTmp="",wpgmzaIdentifiedTypingSpeed=!1;$("body").on("keypress",".wpgmza-address",function(e){if("wpgmza_add_address_map_editor"==this.id){if(wpgmza_autoCompleteDisabled)return;var wpgmza_apikey=!1;if(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey)return void(wpgmza_apikey=WPGMZA_localized_data.settings.googleMapsApiKey);if("Escape"===e.key||"Alt"===e.key||"Control"===e.key||"Option"===e.key||"Shift"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)return void $("#wpgmza_autocomplete_search_results").hide();if(!wpgmzaIdentifiedTypingSpeed){var d=new Date;return clearTimeout(wpgmzaTmp),wpgmzaTmp=setTimeout(function(){wpgmzaStartTyping=!1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0},1500),wpgmzaStartTyping?1==wpgmzaKeyStrokeCount||(wpgmzaCurrentTimeBetweenStrokes=d.getTime()-wpgmzaStartTyping,wpgmzaTotalTimeForKeyStrokes+=wpgmzaCurrentTimeBetweenStrokes,wpgmzaAvgTimeBetweenStrokes=wpgmzaTotalTimeForKeyStrokes/(wpgmzaKeyStrokeCount-1),wpgmzaStartTyping=d.getTime(),3<=wpgmzaKeyStrokeCount&&(wpgmzaIdentifiedTypingSpeed=wpgmzaAvgTimeBetweenStrokes)):wpgmzaStartTyping=d.getTime(),void wpgmzaKeyStrokeCount++}clearTimeout(wpgmzaAjaxTimeout),$("#wpgmza_autocomplete_search_results").html("Searching..."),$("#wpgmza_autocomplete_search_results").show();var currentSearch=jQuery(this).val();if(""!==currentSearch){!1!==ajaxRequest&&ajaxRequest.abort();var wpgmza_api_url="";wpgmza_api_url=wpgmza_apikey?"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash+"&k="+wpgmza_apikey:"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash,wpgmzaAjaxTimeout=setTimeout(function(){ajaxRequest=$.ajax({url:wpgmza_api_url,type:"GET",dataType:"json",success:function(results){try{if(void 0!==results.error)"error1"==results.error?($("#wpgmza_autoc_disabled").html(WPGMZA.localized_strings.cloud_api_key_error_1),$("#wpgmza_autoc_disabled").fadeIn("slow"),$("#wpgmza_autocomplete_search_results").hide(),wpgmza_autoCompleteDisabled=!0):console.error(results.error);else{$("#wpgmza_autocomplete_search_results").html("");var html="";for(var i in results)html+="<div class='wpgmza_ac_result "+(""===html?"":"border-top")+"' data-id='"+i+"' data-lat='"+results[i].lat+"' data-lng='"+results[i].lng+"'><div class='wpgmza_ac_container'><div class='wpgmza_ac_icon'><img src='"+results[i].icon+"' /></div><div class='wpgmza_ac_item'><span id='wpgmza_item_name_"+i+"' class='wpgmza_item_name'>"+results[i].place_name+"</span><span id='wpgmza_item_address_"+i+"' class='wpgmza_item_address'>"+results[i].formatted_address+"</span></div></div></div>";""==html&&(html="<div class='p-2 text-center'><small>No results found...</small></div>"),$("#wpgmza_autocomplete_search_results").html(html),$("#wpgmza_autocomplete_search_results").show()}}catch(exception){console.error("WP Google Maps Plugin: There was an error returning the list of places for your search")}}})},2*wpgmzaIdentifiedTypingSpeed)}else $("#wpgmza_autocomplete_search_results").hide()}}),$("#wpgmza_map_height_type").on("change",function(event){self.onMapHeightTypeChange(event)}),$("#advanced-markers .wpgmza-feature-drawing-instructions").remove(),$("[data-search-area='auto']").hide(),$(document.body).on("click","[data-wpgmza-admin-marker-datatable] input[name='mark']",function(event){self.onShiftClick(event)}),$("#wpgmza_map_type").on("change",function(event){self.onMapTypeChanged(event)}),$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")}),this.on("markerupdated",function(event){self.onMarkerUpdated(event)}),this.map&&(this.map.on("zoomchanged",function(event){self.onZoomChanged(event)}),this.map.on("boundschanged",function(event){self.onBoundsChanged(event)}),this.map.on("rightclick",function(event){self.onRightClick(event)})),$(element).on("click",".wpgmza_poly_del_btn",function(event){self.onDeletePolygon(event)}),$(element).on("click",".wpgmza_polyline_del_btn",function(event){self.onDeletePolyline(event)}),$(element).on("click",".wpgmza_dataset_del_btn",function(evevnt){self.onDeleteHeatmap(event)}),$(element).on("click",".wpgmza_circle_del_btn",function(event){self.onDeleteCircle(event)}),$(element).on("click",".wpgmza_rectangle_del_btn",function(event){self.onDeleteRectangle(event)}),$(element).on("click","#wpgmza-open-advanced-theme-data",function(event){event.preventDefault(),$(".wpgmza_theme_data_container").toggleClass("wpgmza_hidden")})},WPGMZA.extend(WPGMZA.MapEditPage,WPGMZA.EventDispatcher),WPGMZA.MapEditPage.createInstance=function(){return WPGMZA.isProVersion()&&WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?new WPGMZA.ProMapEditPage:new WPGMZA.MapEditPage},WPGMZA.MapEditPage.prototype.initDataTables=function(){var self=this;$("[data-wpgmza-datatable][data-wpgmza-rest-api-route]").each(function(index,el){var featureType=$(el).attr("data-wpgmza-feature-type");self[featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)})},WPGMZA.MapEditPage.prototype.initFeaturePanels=function(){var self=this;$(".wpgmza-feature-accordion[data-wpgmza-feature-type]").each(function(index,el){var featurePanelElement=$(el).find(".wpgmza-feature-panel-container > *"),featureType=$(el).attr("data-wpgmza-feature-type"),panelClassName=WPGMZA.capitalizeWords(featureType)+"Panel",instance=WPGMZA[panelClassName].createInstance(featurePanelElement,self);self[featureType+"Panel"]=instance})},WPGMZA.MapEditPage.prototype.initJQueryUIControls=function(){var mapContainer,self=this;$("#wpgmaps_tabs").tabs(),mapContainer=$("#wpgmza-map-container").detach(),$("#wpgmaps_tabs_markers").tabs(),$(".map_wrapper").prepend(mapContainer),$("#slider-range-max").slider({range:"max",min:1,max:21,value:$("input[name='map_start_zoom']").val(),slide:function(event,ui){$("input[name='map_start_zoom']").val(ui.value),self.map.setZoom(ui.value)}})},WPGMZA.MapEditPage.prototype.onShiftClick=function(event){var checkbox=event.currentTarget,row=jQuery(checkbox).closest("tr");if(this.lastSelectedRow&&event.shiftKey){var prevIndex=this.lastSelectedRow.index(),currIndex=row.index(),startIndex=Math.min(prevIndex,currIndex),endIndex=Math.max(prevIndex,currIndex),rows=jQuery("[data-wpgmza-admin-marker-datatable] tbody>tr");jQuery("[data-wpgmza-admin-marker-datatable] input[name='mark']").prop("checked",!1);for(var i=startIndex;i<=endIndex;i++)jQuery(rows[i]).find("input[name='mark']").prop("checked",!0)}this.lastSelectedRow=row},WPGMZA.MapEditPage.prototype.onMapTypeChanged=function(event){if("open-layers"!=WPGMZA.settings.engine){var mapTypeId;switch(event.target.value){case"2":mapTypeId=google.maps.MapTypeId.SATELLITE;break;case"3":mapTypeId=google.maps.MapTypeId.HYBRID;break;case"4":mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:mapTypeId=google.maps.MapTypeId.ROADMAP}this.map.setOptions({mapTypeId:mapTypeId})}},WPGMZA.MapEditPage.prototype.onMarkerUpdated=function(event){this.markerDataTable.reload()},WPGMZA.MapEditPage.prototype.onZoomChanged=function(event){$(".map_start_zoom").val(this.map.getZoom())},WPGMZA.MapEditPage.prototype.onBoundsChanged=function(event){var location=this.map.getCenter();$("#wpgmza_start_location").val(location.lat+","+location.lng),$("input[name='map_start_lat']").val(location.lat),$("input[name='map_start_lng']").val(location.lng),$("#wpgmza_start_zoom").val(this.map.getZoom()),$("#wpgmaps_save_reminder").show()},WPGMZA.MapEditPage.prototype.onMapHeightTypeChange=function(event){"%"==event.target.value&&$("#wpgmza_height_warning").show()},WPGMZA.MapEditPage.prototype.onRightClick=function(event){var marker,self=this;this.drawingManager&&this.drawingManager.mode!=WPGMZA.DrawingManager.MODE_MARKER||(this.rightClickMarker||(this.rightClickMarker=WPGMZA.Marker.createInstance({draggable:!0}),this.rightClickMarker.on("dragend",function(event){$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+","+event.latLng.lng)}),this.map.on("click",function(event){self.rightClickMarker.setMap(null)})),(marker=this.rightClickMarker).setPosition(event.latLng),marker.setMap(this.map),$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+", "+event.latLng.lng))},WPGMZA.MapEditPage.prototype.onDeletePolygon=function(event){var cur_id=parseInt($(this).attr("id")),data={action:"delete_poly",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_Path[cur_id].setMap(null),delete WPGM_PathData[cur_id],delete WPGM_Path[cur_id],$("#wpgmza_poly_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeletePolyline=function(event){var cur_id=$(this).attr("id"),data={action:"delete_polyline",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_PathLine[cur_id].setMap(null),delete WPGM_PathLineData[cur_id],delete WPGM_PathLine[cur_id],$("#wpgmza_polyline_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteHeatmap=function(event){var cur_id=$(this).attr("id"),data={action:"delete_dataset",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){heatmap[cur_id].setMap(null),delete heatmap[cur_id],$("#wpgmza_heatmap_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteCircle=function(event){var circle_id=$(this).attr("id"),data={action:"delete_circle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,circle_id:circle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-5 table").replaceWith(response),circle_array.forEach(function(circle){if(circle.id==circle_id)return circle.setMap(null),!1})})},WPGMZA.MapEditPage.prototype.onDeleteRectangle=function(event){var rectangle_id=$(this).attr("id"),data={action:"delete_rectangle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,rectangle_id:rectangle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-6 table").replaceWith(response),rectangle_array.forEach(function(rectangle){if(rectangle.id==rectangle_id)return rectangle.setMap(null),!1})})},$(document).ready(function(event){WPGMZA.mapEditPage=WPGMZA.MapEditPage.createInstance()}))}),jQuery(function($){WPGMZA.PolygonPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolygonPanel,WPGMZA.FeaturePanel),WPGMZA.PolygonPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolygonPanel(element,mapEditPage):new WPGMZA.PolygonPanel(element,mapEditPage)},Object.defineProperty(WPGMZA.PolygonPanel.prototype,"drawingManagerCompleteEvent",{get:function(){return"polygonclosed"}})}),jQuery(function($){WPGMZA.PolylinePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolylinePanel,WPGMZA.FeaturePanel),WPGMZA.PolylinePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolylinePanel(element,mapEditPage):new WPGMZA.PolylinePanel(element,mapEditPage)}}),jQuery(function($){WPGMZA.RectanglePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.RectanglePanel,WPGMZA.FeaturePanel),WPGMZA.RectanglePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProRectanglePanel(element,mapEditPage):new WPGMZA.RectanglePanel(element,mapEditPage)},WPGMZA.RectanglePanel.prototype.updateFields=function(){var bounds=this.feature.getBounds();bounds.north&&bounds.west&&bounds.south&&bounds.east&&($(this.element).find("[data-ajax-name='cornerA']").val(bounds.north+", "+bounds.west),$(this.element).find("[data-ajax-name='cornerB']").val(bounds.south+", "+bounds.east))},WPGMZA.RectanglePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.RectanglePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.RectanglePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){var geom;if(Parent.call(this,options,olFeature),options=options||{},olFeature){var circle=olFeature.getGeometry(),center=ol.proj.toLonLat(circle.getCenter());geom=circle,options.center=new WPGMZA.LatLng(center[1],center[0]),options.radius=circle.getRadius()/1e3}else geom=new ol.geom.Circle(ol.proj.fromLonLat([parseFloat(options.center.lng),parseFloat(options.center.lat)]),1e3*options.radius);this.layer=new ol.layer.Vector({source:new ol.source.Vector}),this.olFeature=new ol.Feature({geometry:geom}),this.layer.getSource().addFeature(this.olFeature),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaCircle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)},WPGMZA.OLCircle.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olFeature.getGeometry().getCenter());return new WPGMZA.LatLng({lat:lonLat[1],lng:lonLat[0]})},WPGMZA.OLCircle.prototype.recreate=function(){if(this.olFeature&&(this.layer.getSource().removeFeature(this.olFeature),delete this.olFeature),this.center&&this.radius){var x,y,radius=1e3*parseFloat(this.radius);x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular([x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");this.olFeature=new ol.Feature(circle3857),this.layer.getSource().addFeature(this.olFeature)}},WPGMZA.OLCircle.prototype.setVisible=function(visible){this.layer.setVisible(!!visible)},WPGMZA.OLCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.recreate()},WPGMZA.OLCircle.prototype.getRadius=function(){return this.layer.getSource().getFeatures()[0].getGeometry().getRadius()/1e3},WPGMZA.OLCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments)},WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLDrawingManager=function(map){WPGMZA.DrawingManager.call(this,map),this.source=new ol.source.Vector({wrapX:!1}),this.layer=new ol.layer.Vector({source:this.source})},WPGMZA.OLDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.OLDrawingManager.prototype.constructor=WPGMZA.OLDrawingManager,WPGMZA.OLDrawingManager.prototype.setOptions=function(options){var params={};options.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(options.strokeColor,options.strokeOpacity)})),options.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(options.fillColor,options.fillOpacity)})),this.layer.setStyle(new ol.style.Style(params))},WPGMZA.OLDrawingManager.prototype.setDrawingMode=function(mode){var type,endEventType,self=this;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),this.interaction&&(this.map.olMap.removeInteraction(this.interaction),this.interaction=null),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:return;case WPGMZA.DrawingManager.MODE_POLYGON:type="Polygon",endEventType="polygonclosed";break;case WPGMZA.DrawingManager.MODE_POLYLINE:type="LineString",endEventType="polylinecomplete";break;case WPGMZA.DrawingManager.MODE_CIRCLE:type="Circle",endEventType="circlecomplete";break;case WPGMZA.DrawingManager.MODE_RECTANGLE:type="Circle",endEventType="rectanglecomplete";break;case WPGMZA.DrawingManager.MODE_HEATMAP:return;default:throw new Error("Invalid drawing mode")}WPGMZA.mapEditPage&&WPGMZA.mapEditPage.selectInteraction&&WPGMZA.mapEditPage.map.olMap.removeInteraction(WPGMZA.mapEditPage.selectInteraction);var options={source:this.source,type:type};mode==WPGMZA.DrawingManager.MODE_RECTANGLE&&(options.geometryFunction=ol.interaction.Draw.createBox()),this.interaction=new ol.interaction.Draw(options),this.interaction.on("drawend",function(event){if(endEventType){var WPGMZAEvent=new WPGMZA.Event(endEventType);switch(mode){case WPGMZA.DrawingManager.MODE_POLYGON:WPGMZAEvent.enginePolygon=event.feature;break;case WPGMZA.DrawingManager.MODE_POLYLINE:WPGMZAEvent.enginePolyline=event.feature;break;case WPGMZA.DrawingManager.MODE_CIRCLE:WPGMZAEvent.engineCircle=event.feature;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:WPGMZAEvent.engineRectangle=event.feature;break;default:throw new Error("Drawing mode not implemented")}self.dispatchEvent(WPGMZAEvent)}}),this.map.olMap.addInteraction(this.interaction)}}),jQuery(function($){WPGMZA.OLFeature=function(options){WPGMZA.assertInstangeOf(this,"OLFeature"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.extend(WPGMZA.OLFeature,WPGMZA.Feature),WPGMZA.OLFeature.getOLStyle=function(options){var translated={};if(!options)return new ol.style.Style;options=$.extend({},options);var map={fillcolor:"fillColor",opacity:"fillOpacity",linecolor:"strokeColor",lineopacity:"strokeOpacity",linethickness:"strokeWeight"};for(var name in options)name in map&&(options[map[name]]=options[name]);if(options.strokeColor){var opacity=1,weight=1;"strokeOpacity"in options&&(opacity=options.strokeOpacity),"strokeWeight"in options&&(weight=options.strokeWeight),translated.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToString(options.strokeColor,opacity),width:weight})}if(options.fillColor){opacity=1;"fillOpacity"in options&&(opacity=options.fillOpacity);var color=WPGMZA.hexOpacityToString(options.fillColor,opacity);translated.fill=new ol.style.Fill({color:color})}return new ol.style.Style(translated)},WPGMZA.OLFeature.setInteractionsOnFeature=function(feature,enable){if(enable){if(feature.modifyInteraction)return;feature.snapInteraction=new ol.interaction.Snap({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.snapInteraction),feature.modifyInteraction=new ol.interaction.Modify({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.modifyInteraction),feature.modifyInteraction.on("modifyend",function(event){feature.trigger("change")})}else{if(!feature.modifyInteraction)return;feature.map&&(feature.map.olMap.removeInteraction(feature.snapInteraction),feature.map.olMap.removeInteraction(feature.modifyInteraction)),delete feature.snapInteraction,delete feature.modifyInteraction}}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(query,callback){WPGMZA.restAPI.call("/geocode-cache",{data:{query:JSON.stringify(query)},success:function(response,xhr,status){response.lng=response.lon,callback(response)},useCompressedPathVariable:!0})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.componentRestrictions&&options.componentRestrictions.country?data.countrycodes=options.componentRestrictions.country:options.country&&(data.countrycodes=options.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(query,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:JSON.stringify(query),response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.clearCache=function(callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_clear_nominatim_cache"},method:"POST",success:function(response){callback(response)}})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");if(WPGMZA.LatLng.REGEXP.test(options.address)){var latLng=WPGMZA.LatLng.fromString(options.address);callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var finish,location;if(options.location&&(options.latLng=new WPGMZA.LatLng(options.location)),options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].bounds=new WPGMZA.LatLngBounds(new WPGMZA.LatLng({lat:response[i].boundingbox[1],lng:response[i].boundingbox[2]}),new WPGMZA.LatLng({lat:response[i].boundingbox[0],lng:response[i].boundingbox[3]})),response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}var query={location:location,options:options};this.getResponseFromCache(query,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(query,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(feature){var self=this;Parent.call(this,feature),this.element=$("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,Object.defineProperty(WPGMZA.OLInfoWindow.prototype,"isPanIntoViewAllowed",{get:function(){return!0}}),WPGMZA.OLInfoWindow.prototype.open=function(map,feature){var self=this,latLng=feature.getPosition();if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.overlay&&this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!0,insertFirst:!0}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.feature.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.setContent(this.content),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&WPGMZA.getImageDimensions(feature.getIcon(),function(size){$(self.element).css({left:Math.round(size.width/2)+"px"})}),this.trigger("infowindowopen"),this.trigger("domready")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.trigger("infowindowclose"),this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html;var eaBtn=WPGMZA.isProVersion()?"":this.addEditButton();$(this.element).html(eaBtn+"<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})},WPGMZA.OLInfoWindow.prototype.onOpen=function(){var self=this,imgs=$(this.element).find("img"),numImages=imgs.length,numImagesLoaded=0;if(WPGMZA.InfoWindow.prototype.onOpen.apply(this,arguments),this.isPanIntoViewAllowed){function inside(el,viewport){var a=$(el)[0].getBoundingClientRect(),b=$(viewport)[0].getBoundingClientRect();return a.left>=b.left&&a.left<=b.right&&a.right<=b.right&&a.right>=b.left&&a.top>=b.top&&a.top<=b.bottom&&a.bottom<=b.bottom&&a.bottom>=b.top}function panIntoView(){var offset=.45*-$(self.element).height();self.feature.map.animateNudge(0,offset,self.feature.getPosition())}imgs.each(function(index,el){el.onload=function(){++numImagesLoaded!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}),0!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();function isSettingDisabled(value){return"yes"===value||!!value}$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_draggable)):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_clickzoom)):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_scroll))},this),"greedy"!=this.settings.wpgmza_force_greedy_gestures&&"yes"!=this.settings.wpgmza_force_greedy_gestures&&1!=this.settings.wpgmza_force_greedy_gestures&&(this.gestureOverlay=$("<div class='wpgmza-gesture-overlay'></div>"),this.gestureOverlayTimeoutID=null,WPGMZA.isTouchDevice()||(this.olMap.on("wheel",function(event){if(!ol.events.condition.platformModifierKeyOnly(event))return self.showGestureOverlay(),event.originalEvent.preventDefault(),!1}),this.gestureOverlay.text(WPGMZA.localized_strings.use_ctrl_scroll_to_zoom))),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&1==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),isSettingDisabled(WPGMZA.settings.wpgmza_settings_map_full_screen_control)||this.olMap.addControl(new ol.control.FullScreen),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("click",function(event){var features=self.olMap.getFeaturesAtPixel(event.pixel);if(features&&features.length){var marker=features[0].wpgmzaMarker;marker&&(marker.trigger("click"),marker.trigger("select"))}})),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),setTimeout(function(){self.onIdle()},10)}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged(),this._mouseoverNativeFeatures=[],this.olMap.on("pointermove",function(event){if(!event.dragging){try{var featuresUnderPixel=event.target.getFeaturesAtPixel(event.pixel)}catch(e){return}featuresUnderPixel=featuresUnderPixel||[];var i,props,nativeFeaturesUnderPixel=[];for(i=0;i<featuresUnderPixel.length;i++)(props=featuresUnderPixel[i].getProperties()).wpgmzaFeature&&(nativeFeature=props.wpgmzaFeature,nativeFeaturesUnderPixel.push(nativeFeature),-1==self._mouseoverNativeFeatures.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseover"),self._mouseoverNativeFeatures.push(nativeFeature)));for(i=self._mouseoverNativeFeatures.length-1;0<=i;i--)nativeFeature=self._mouseoverNativeFeatures[i],-1==nativeFeaturesUnderPixel.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseout"),self._mouseoverNativeFeatures.splice(i,1))}}),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;if($(event.target).closest(".ol-marker").length)return;try{var featuresUnderPixel=self.olMap.getFeaturesAtPixel([event.offsetX,event.offsetY])}catch(e){return}featuresUnderPixel=featuresUnderPixel||[];var i,props,nativeFeaturesUnderPixel=[];for(i=0;i<featuresUnderPixel.length;i++)(props=featuresUnderPixel[i].getProperties()).wpgmzaFeature&&(nativeFeature=props.wpgmzaFeature,nativeFeaturesUnderPixel.push(nativeFeature),nativeFeature.trigger("click"));if(0<featuresUnderPixel.length)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){var options={};return WPGMZA.settings.tile_server_url&&(options.url=WPGMZA.settings.tile_server_url,"custom_override"===WPGMZA.settings.tile_server_url&&(WPGMZA.settings.tile_server_url_override&&""!==WPGMZA.settings.tile_server_url_override.trim()?options.url=WPGMZA.settings.tile_server_url_override.trim():options.url="https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"),WPGMZA.settings.open_layers_api_key&&""!==WPGMZA.settings.open_layers_api_key&&(options.url+="?apikey="+WPGMZA.settings.open_layers_api_key.trim())),new ol.layer.Tile({source:new ol.source.OSM(options)})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var transformed=ol.proj.transform(this.olMap.getView().getCenter(),"EPSG:3857","EPSG:4326"),center={lat:transformed[1],lng:transformed[0]};-180<=center.lng&&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(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toLatLngLiteral():options[name]instanceof WPGMZA.Map||(settings[name]=options[name]);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);if(WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT){var img=$("<img alt=''/>")[0];img.onload=function(event){self.updateElementHeight(),self.map&&self.map.olMap.updateSize()},img.src=WPGMZA.defaultMarkerIcon,this.element=$("<div class='ol-marker'></div>")[0],this.element.appendChild(img),this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element,position:origin,positioning:"bottom-center",stopEvent:!1}),this.overlay.setPosition(origin),this.animation?this.setAnimation(this.animation):this.anim&&this.setAnimation(this.anim),options&&options.draggable&&this.setDraggable(!0),this.rebindClickListener()}else{if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)throw new Error("Invalid marker render mode");this.feature=new ol.Feature({geometry:new ol.geom.Point(origin)}),this.feature.setStyle(this.getVectorLayerStyle()),(this.feature.wpgmzaMarker=this).feature.wpgmzaFeature=this}this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT="element",WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER="vector",WPGMZA.OLMarker.renderMode=WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT,"open-layers"==WPGMZA.settings.engine&&WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(WPGMZA.OLMarker.defaultVectorLayerStyle=new ol.style.Style({image:new ol.style.Icon({anchor:[.5,1],src:WPGMZA.defaultMarkerIcon})}),WPGMZA.OLMarker.hiddenVectorLayerStyle=new ol.style.Style({})),WPGMZA.OLMarker.prototype.getVectorLayerStyle=function(){return this.vectorLayerStyle?this.vectorLayerStyle:WPGMZA.OLMarker.defaultVectorLayerStyle},WPGMZA.OLMarker.prototype.updateElementHeight=function(height,calledOnFocus){var self=this;0!=(height=height||$(this.element).find("img").height())||calledOnFocus||$(window).one("focus",function(event){self.updateElementHeight(!1,!0)}),$(this.element).css({height:height+"px"})},WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove():console.warn("Marker labels are not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.getVisible=function(visible){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)return"none"!=this.overlay.getElement().style.display},WPGMZA.OLMarker.prototype.setVisible=function(visible){if(Parent.prototype.setVisible.call(this,visible),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(visible){var style=this.getVectorLayerStyle();this.feature.setStyle(style)}else this.feature.setStyle(null);else this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?this.feature.setGeometry(new ol.geom.Point(origin)):this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.updateOffset=function(x,y){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER){x=this._offset.x,y=this._offset.y;this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"}else console.warn("Marker offset is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setAnimation=function(anim){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}else console.warn("Marker animation is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0});else console.warn("Marker dragging is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setOpacity=function(opacity){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?$(this.element).css({opacity:opacity}):console.warn("Marker opacity is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0,this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!1)})},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset_top=parseFloat($(this.element).css("top").match(/-?\d+/)[0]),offset_left=parseFloat($(this.element).css("left").match(/-?\d+/)[0]);$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset_left,y:pixelsBeforeDrag.y+offset_top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag}),this.trigger("change"),"yes"!=this.map.settings.wpgmza_settings_map_draggable&&this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!0)})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,olViewportElement=$(this.map.element).children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",olViewportElement.find(".ol-layers .ol-layer:first-child").prepend(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),(WPGMZA.isProVersion()?$(".wpgmza_map[data-map-id='"+map_id+"']"):$("#wpgmza_map")).append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(options,olFeature){if(Parent.call(this,options,olFeature),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(options&&options.polydata)for(var paths=this.parseGeometry(options.polydata),i=0;i<=paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i%paths.length].lng),parseFloat(paths[i%paths.length].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getGeometry=function(){for(var coordinates=this.olFeature.getGeometry().getCoordinates()[0],result=[],i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolygon.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(options,olFeature){if(WPGMZA.Polyline.call(this,options),olFeature)this.olFeature=olFeature;else{var coordinates=[];if(options&&options.polydata)for(var path=this.parseGeometry(options.polydata),i=0;i<path.length;i++){if(!$.isNumeric(path[i].lat))throw new Error("Invalid latitude");if(!$.isNumeric(path[i].lng))throw new Error("Invalid longitude");coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]))}this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getGeometry=function(){for(var result=[],coordinates=this.olFeature.getGeometry().getCoordinates(),i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolyline.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent=WPGMZA.Rectangle;WPGMZA.OLRectangle=function(options,olFeature){if(Parent.apply(this,arguments),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];options.cornerA&&options.cornerB&&(coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)]))),this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaRectangle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.extend(WPGMZA.OLRectangle,WPGMZA.Rectangle),WPGMZA.OLRectangle.prototype.getBounds=function(){var extent=this.olFeature.getGeometry().getExtent(),topLeft=ol.extent.getTopLeft(extent),bottomRight=ol.extent.getBottomRight(extent),topLeftLonLat=ol.proj.toLonLat(topLeft),bottomRightLonLat=ol.proj.toLonLat(bottomRight),topLeftLatLng=new WPGMZA.LatLng(topLeftLonLat[1],topLeftLonLat[0]),bottomRightLatLng=new WPGMZA.LatLng(bottomRightLonLat[1],bottomRightLonLat[0]);return new WPGMZA.LatLngBounds(topLeftLatLng,bottomRightLatLng)},WPGMZA.OLRectangle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLText=function(){}}),jQuery(function($){WPGMZA.DataTable=function(element){var self=this;if(!$.fn.dataTable)return console.warn("The dataTables library is not loaded. Cannot create a dataTable. Did you enable 'Do not enqueue dataTables'?"),void(WPGMZA.settings.wpgmza_do_not_enqueue_datatables&&WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT&&alert("You have selected 'Do not enqueue DataTables' in WP Google Maps' settings. No 3rd party software is loading the DataTables library. Because of this, the marker table cannot load. Please uncheck this option to use the marker table."));if($.fn.dataTable.ext)$.fn.dataTable.ext.errMode="throw";else{var version=$.fn.dataTable.version?$.fn.dataTable.version:"unknown";console.warn("You appear to be running an outdated or modified version of the dataTables library. This may cause issues with table functionality. This is usually caused by 3rd party software loading an older version of DataTables. The loaded version is "+version+", we recommend version 1.10.12 or above.")}$.fn.dataTable.Api&&$.fn.dataTable.Api.register("processing()",function(show){return this.iterator("table",function(ctx){ctx.oApi._fnProcessingDisplay(ctx,show)})}),this.element=element,(this.element.wpgmzaDataTable=this).dataTableElement=this.getDataTableElement();var settings=this.getDataTableSettings();this.phpClass=$(element).attr("data-wpgmza-php-class"),(this.wpgmzaDataTable=this).useCompressedPathVariable=WPGMZA.restAPI.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables,this.method=this.useCompressedPathVariable?"GET":"POST",null==this.getLanguageURL()||"//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json"==this.getLanguageURL()?(this.dataTable=$(this.dataTableElement).DataTable(settings),this.dataTable.ajax.reload()):$.ajax(this.getLanguageURL(),{success:function(response,status,xhr){self.languageJSON=response,self.dataTable=$(self.dataTableElement).DataTable(settings),self.dataTable.ajax.reload()}})},WPGMZA.DataTable.prototype.getDataTableElement=function(){return $(this.element).find("table")},WPGMZA.DataTable.prototype.onAJAXRequest=function(data,settings){var params={phpClass:this.phpClass},attr=$(this.element).attr("data-wpgmza-ajax-parameters");return attr&&$.extend(params,JSON.parse(attr)),$.extend(data,params)},WPGMZA.DataTable.prototype.onDataTableAjaxRequest=function(data,callback,settings){var self=this,element=this.element,route=$(element).attr("data-wpgmza-rest-api-route"),params=this.onAJAXRequest(data,settings),draw=params.draw;if(delete params.draw,!route)throw new Error("No data-wpgmza-rest-api-route attribute specified");var options={method:"POST",useCompressedPathVariable:!0,data:params,dataType:"json",cache:!this.preventCaching,beforeSend:function(xhr){xhr.setRequestHeader("X-DataTables-Draw",draw)},success:function(response,status,xhr){response.draw=draw,self.lastResponse=response,callback(response),$("[data-marker-icon-src]").each(function(index,element){WPGMZA.MarkerIcon.createInstance($(element).attr("data-marker-icon-src")).applyToElement(element)})}};return WPGMZA.restAPI.call(route,options)},WPGMZA.DataTable.prototype.getDataTableSettings=function(){var self=this,element=this.element,options={};$(element).attr("data-wpgmza-datatable-options")&&(options=JSON.parse($(element).attr("data-wpgmza-datatable-options"))),options.deferLoading=!0,options.processing=!0,options.serverSide=!0,options.ajax=function(data,callback,settings){return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self,arguments)},WPGMZA.AdvancedTableDataTable&&this instanceof WPGMZA.AdvancedTableDataTable&&WPGMZA.settings.wpgmza_default_items&&(options.iDisplayLength=parseInt(WPGMZA.settings.wpgmza_default_items)),options.aLengthMenu=[[5,10,25,50,100,-1],["5","10","25","50","100",WPGMZA.localized_strings.all]];var languageURL=this.getLanguageURL();return languageURL&&(options.language={url:languageURL}),options},WPGMZA.DataTable.prototype.getLanguageURL=function(){if(!WPGMZA.locale)return null;var languageURL;switch(WPGMZA.locale.substr(0,2)){case"af":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Afrikaans.json";break;case"sq":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Albanian.json";break;case"am":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Amharic.json";break;case"ar":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Arabic.json";break;case"hy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Armenian.json";break;case"az":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Azerbaijan.json";break;case"bn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bangla.json";break;case"eu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Basque.json";break;case"be":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Belarusian.json";break;case"bg":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bulgarian.json";break;case"ca":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Catalan.json";break;case"zh":languageURL="zh_TW"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Chinese-traditional.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";break;case"hr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Croatian.json";break;case"cs":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Czech.json";break;case"da":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Danish.json";break;case"nl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Dutch.json";break;case"et":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Estonian.json";break;case"fi":languageURL=WPGMZA.locale.match(/^fil/)?WPGMZA.pluginDirURL+"languages/datatables/Filipino.json":WPGMZA.pluginDirURL+"languages/datatables/Finnish.json";break;case"fr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/French.json";break;case"gl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Galician.json";break;case"ka":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Georgian.json";break;case"de":languageURL=WPGMZA.pluginDirURL+"languages/datatables/German.json";break;case"el":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Greek.json";break;case"gu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Gujarati.json";break;case"he":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hebrew.json";break;case"hi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hindi.json";break;case"hu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hungarian.json";break;case"is":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Icelandic.json";break;case"id":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Indonesian.json";break;case"ga":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Irish.json";break;case"it":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Italian.json";break;case"ja":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Japanese.json";break;case"kk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kazakh.json";break;case"ko":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Korean.json";break;case"ky":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kyrgyz.json";break;case"lv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Latvian.json";break;case"lt":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Lithuanian.json";break;case"mk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Macedonian.json";break;case"ml":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Malay.json";break;case"mn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Mongolian.json";break;case"ne":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Nepali.json";break;case"nb":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Bokmal.json";break;case"nn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Nynorsk.json";break;case"ps":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Pashto.json";break;case"fa":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Persian.json";break;case"pl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Polish.json";break;case"pt":languageURL="pt_BR"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Portuguese-Brasil.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";break;case"ro":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Romanian.json";break;case"ru":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Russian.json";break;case"sr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Serbian.json";break;case"si":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Sinhala.json";break;case"sk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovak.json";break;case"sl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovenian.json";break;case"es":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Spanish.json";break;case"sw":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swahili.json";break;case"sv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swedish.json";break;case"ta":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Tamil.json";break;case"te":languageURL=WPGMZA.pluginDirURL+"languages/datatables/telugu.json";break;case"th":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Thai.json";break;case"tr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Turkish.json";break;case"uk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Ukrainian.json";break;case"ur":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Urdu.json";break;case"uz":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Uzbek.json";break;case"vi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Vietnamese.json";break;case"cy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Welsh.json"}return languageURL},WPGMZA.DataTable.prototype.onAJAXResponse=function(response){},WPGMZA.DataTable.prototype.reload=function(){this.dataTable.ajax.reload(null,!1)}}),jQuery(function($){WPGMZA.AdminFeatureDataTable=function(element){var self=this;this.allSelected=!1,WPGMZA.DataTable.call(this,element),$(element).on("click",".wpgmza.bulk_delete",function(event){self.onBulkDelete(event)}),$(element).on("click",".wpgmza.select_all_markers",function(event){self.onSelectAll(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.extend(WPGMZA.AdminFeatureDataTable,WPGMZA.DataTable),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featurePanel",{get:function(){return WPGMZA.mapEditPage[this.featureType+"Panel"]}}),WPGMZA.AdminFeatureDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaFeatureData=meta},options},WPGMZA.AdminFeatureDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0],plural=this.featureType+"s";$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaFeatureData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/"+plural+"/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminFeatureDataTable.prototype.onSelectAll=function(event){this.allSelected=!this.allSelected;var self=this;$(this.element).find("input[name='mark']").each(function(){self.allSelected?$(this).prop("checked",!0):$(this).prop("checked",!1)})},WPGMZA.AdminFeatureDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}}),jQuery(function($){WPGMZA.AdminMapDataTable=function(element){var self=this;WPGMZA.DataTable.call(this,element),$(element).on("mousedown","button[data-action='edit']",function(event){switch(event.which){case 1:var map_id=$(event.target).attr("data-map-id");window.location.href=window.location.href+"&action=edit&map_id="+map_id;break;case 2:map_id=$(event.target).attr("data-map-id");window.open(window.location.href+"&action=edit&map_id="+map_id)}}),$(element).find(".wpgmza.select_all_maps").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete_maps").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","button[data-action='duplicate']",function(event){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"POST",data:{id:map_id,action:"duplicate"},success:function(response,status,xhr){self.reload()}})}),$(element).on("click","button[data-action='trash']",function(event){if(confirm(WPGMZA.localized_strings.map_delete_prompt_text)){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{id:map_id},success:function(response,status,xhr){self.reload()}})}})},WPGMZA.extend(WPGMZA.AdminMapDataTable,WPGMZA.DataTable),WPGMZA.AdminMapDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMapData=meta},options},WPGMZA.AdminMapDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMapDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMapData.id)}),confirm(WPGMZA.localized_strings.map_bulk_delete_prompt_text)&&WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},$(document).ready(function(event){$("[data-wpgmza-admin-map-datatable]").each(function(index,el){WPGMZA.AdminMapDataTable=new WPGMZA.AdminMapDataTable(el)})})}),jQuery(function($){WPGMZA.AdminMarkerDataTable=function(element){var self=this;this.preventCaching=!0,WPGMZA.DataTable.call(this,element),$(element).on("click","[data-delete-marker-id]",function(event){self.onDeleteMarker(event)}),$(element).find(".wpgmza.select_all_markers").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.AdminMarkerDataTable.prototype=Object.create(WPGMZA.DataTable.prototype),WPGMZA.AdminMarkerDataTable.prototype.constructor=WPGMZA.AdminMarkerDataTable,WPGMZA.AdminMarkerDataTable.createInstance=function(element){return new WPGMZA.AdminMarkerDataTable(element)},WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMarkerData=meta},options},WPGMZA.AdminMarkerDataTable.prototype.onEditMarker=function(event){WPGMZA.animatedScroll("#wpgmaps_tabs_markers")},WPGMZA.AdminMarkerDataTable.prototype.onDeleteMarker=function(event){var self=this,id=$(event.currentTarget).attr("data-delete-marker-id"),data={action:"delete_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:id};$.post(ajaxurl,data,function(response){WPGMZA.mapEditPage.map.removeMarkerByID(id),self.reload()})},WPGMZA.AdminMarkerDataTable.prototype.onApproveMarker=function(event){var cur_id=$(this).attr("id"),data={action:"approve_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:cur_id};$.post(ajaxurl,data,function(response){wpgmza_InitMap(),wpgmza_reinitialisetbl()})},WPGMZA.AdminMarkerDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMarkerData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/markers/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminMarkerDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.mapEditPage.map.setZoom(6),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}});
1
+ jQuery(function($){var core={MARKER_PULL_DATABASE:"0",MARKER_PULL_XML:"1",PAGE_MAP_LIST:"map-list",PAGE_MAP_EDIT:"map-edit",PAGE_SETTINGS:"map-settings",PAGE_SUPPORT:"map-support",PAGE_CATEGORIES:"categories",PAGE_ADVANCED:"advanced",PAGE_CUSTOM_FIELDS:"custom-fields",maps:[],events:null,settings:null,restAPI:null,localized_strings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',preloaderHTML:"<div class='wpgmza-preloader'><div></div><div></div><div></div><div></div></div>",getCurrentPage:function(){switch(WPGMZA.getQueryParamValue("page")){case"wp-google-maps-menu":return window.location.href.match(/action=edit/)&&window.location.href.match(/map_id=\d+/)?WPGMZA.PAGE_MAP_EDIT:WPGMZA.PAGE_MAP_LIST;case"wp-google-maps-menu-settings":return WPGMZA.PAGE_SETTINGS;case"wp-google-maps-menu-support":return WPGMZA.PAGE_SUPPORT;case"wp-google-maps-menu-categories":return WPGMZA.PAGE_CATEGORIES;case"wp-google-maps-menu-advanced":return WPGMZA.PAGE_ADVANCED;case"wp-google-maps-menu-custom-fields":return WPGMZA.PAGE_CUSTOM_FIELDS;default:return null}},getScrollAnimationOffset:function(){return(WPGMZA.settings.scroll_animation_offset||0)+($("#wpadminbar").height()||0)},getScrollAnimationDuration:function(){return WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},extend:function(child,parent){var constructor=child;child.prototype=Object.create(parent.prototype),child.prototype.constructor=constructor},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){var hex=parseInt(colour.replace(/^#/,""),16);return[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},hexOpacityToString:function(colour,opacity){var arr=WPGMZA.hexOpacityToRGBA(colour,opacity);return"rgba("+arr[0]+", "+arr[1]+", "+arr[2]+", "+arr[3]+")"},hexToRgba:function(hex){var c;return/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)?(3==(c=hex.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),{r:(c="0x"+c.join(""))>>16&255,g:c>>8&255,b:255&c,a:1}):0},rgbaToString:function(rgba){return"rgba("+rgba.r+", "+rgba.g+", "+rgba.b+", "+rgba.a+")"},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])}):null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:img.width,height:img.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},decodeEntities:function(input){return input.replace(/&(nbsp|amp|quot|lt|gt);/g,function(m,e){return m[e]}).replace(/&#(\d+);/gi,function(m,e){return String.fromCharCode(parseInt(e,10))})},isDeveloperMode:function(){return this.settings.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback,error,watch){var nativeFunction="getCurrentPosition";if(WPGMZA.userLocationDenied)error&&error({code:1,message:"Location unavailable"});else if(watch&&(nativeFunction="watchPosition"),navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation[nativeFunction]?navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){options.enableHighAccuracy=!1,navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(err){console.warn(err.code,err.message),1==err.code&&(WPGMZA.userLocationDenied=!0),error&&error(err)},options)},options):console.warn(nativeFunction+" is not available")}else console.warn("No geolocation available on this device")},watchPosition:function(callback,error){return WPGMZA.getCurrentPosition(callback,error,!0)},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},capitalizeWords:function(string){return(string+"").replace(/^(.)|\s+(.)/g,function(m){return m.toUpperCase()})},pluralize:function(string){return WPGMZA.singularize(string)+"s"},singularize:function(string){return string.replace(/s$/,"")},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if("OLFeature"!=(fullInstanceName=WPGMZA[engine+pro+instanceName]&&engine+instanceName!="OLFeature"?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]&&WPGMZA[engine+instanceName].prototype?engine+instanceName:instanceName)&&!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){for(var i=0;i<WPGMZA.maps.length;i++)if(WPGMZA.maps[i].id==id)return WPGMZA.maps[i];return null},isGoogleAutocompleteSupported:function(){return!!window.google&&(!!google.maps&&(!!google.maps.places&&(!!google.maps.places.Autocomplete&&(!WPGMZA.CloudAPI||!WPGMZA.CloudAPI.isBeingUsed))))},googleAPIStatus:window.wpgmza_google_api_status,isSafari:function(){var ua=navigator.userAgent.toLowerCase();return ua.match(/safari/i)&&!ua.match(/chrome/i)},isTouchDevice:function(){return"ontouchstart"in window},isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},isModernComponentStyleAllowed:function(){return!WPGMZA.settings.user_interface_style||"legacy"==WPGMZA.settings.user_interface_style||"modern"==WPGMZA.settings.user_interface_style},isElementInView:function(element){var pageTop=$(window).scrollTop(),pageBottom=pageTop+$(window).height(),elementTop=$(element).offset().top,elementBottom=elementTop+$(element).height();return elementTop<pageTop&&pageBottom<elementBottom||(pageTop<=elementTop&&elementTop<=pageBottom||pageTop<=elementBottom&&elementBottom<=pageBottom)},isFullScreen:function(){return wpgmzaisFullScreen},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&#]*)");return(m=window.location.href.match(regex))?decodeURIComponent(m[1]):null},notification:function(text,time){switch(arguments.length){case 0:text="",time=4e3;break;case 1:time=4e3}var html='<div class="wpgmza-popup-notification">'+text+"</div>";jQuery("body").append(html),setTimeout(function(){jQuery("body").find(".wpgmza-popup-notification").remove()},time)},initMaps:function(){$(document.body).find(".wpgmza_map:not(.wpgmza-initialized)").each(function(index,el){el.wpgmzaMap?console.warn("Element missing class wpgmza-initialized but does have wpgmzaMap property. No new instance will be created"):el.wpgmzaMap=WPGMZA.Map.createInstance(el)}),WPGMZA.Map.nextInitTimeoutID=setTimeout(WPGMZA.initMaps,3e3)},onScroll:function(){$(".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)})}},wpgmzaisFullScreen=!1;for(var key in[]){console.warn("It appears that the built in JavaScript Array has been extended, this can create issues with for ... in loops, which may cause failure.");break}for(var key in window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core,window.uc&&window.uc.reloadOnOptIn&&(window.uc.reloadOnOptIn("S1pcEj_jZX"),window.uc.reloadOnOptOut("S1pcEj_jZX")),WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}WPGMZA.settings.useLegacyGlobals=!0,$(document).on("fullscreenchange",function(){wpgmzaisFullScreen=!!document.fullscreenElement}),$("body").on("click","#wpgmzaCloseChat",function(e){e.preventDefault(),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_hide_chat",nonce:WPGMZA_localized_data.ajaxnonce}}),$(".wpgmza-chat-help").remove()}),$(window).on("scroll",WPGMZA.onScroll),$(document.body).on("click","button.wpgmza-api-consent",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()}),$(document.body).on("keydown",function(event){event.altKey&&(WPGMZA.altKeyDown=!0)}),$(document.body).on("keyup",function(event){event.altKey||(WPGMZA.altKeyDown=!1)}),$(document.body).on("preinit.wpgmza",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[src]").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});1<elements.length&&console.warn("Multiple jQuery versions detected: ",elements);for(var key in[]){console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");break}if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").first().after($(warning))}WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code&&jQuery(".wpgmza-gdpr-compliance").length<=0&&$("button.wpgmza-api-consent").on("click",function(event){Cookies.set("wpgmza-api-consent-given",!0),window.location.reload()})}),function($){$(function(){WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),WPGMZA.CloudAPI&&(WPGMZA.cloudAPI=WPGMZA.CloudAPI.createInstance()),$(document.body).trigger("preinit.wpgmza"),WPGMZA.initMaps(),WPGMZA.onScroll()})}($)}),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","establishment"]};(json=$(element).attr("data-autocomplete-options"))&&(options=$.extend(options,JSON.parse(json))),map&&map.settings.wpgmza_store_locator_restrict&&(options.country=map.settings.wpgmza_store_locator_restrict),WPGMZA.isGoogleAutocompleteSupported()?"wpgmza_add_address_map_editor"!=this.id&&WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey&&(element.googleAutoComplete=new google.maps.places.Autocomplete(element,options),options.country&&element.googleAutoComplete.setComponentRestrictions({country:options.country})):WPGMZA.CloudAPI&&WPGMZA.CloudAPI.isBeingUsed&&(element.cloudAutoComplete=new WPGMZA.CloudAutocomplete(element,options))},WPGMZA.extend(WPGMZA.AddressInput,WPGMZA.EventDispatcher),WPGMZA.AddressInput.createInstance=function(element,map){return new WPGMZA.AddressInput(element,map)}}),jQuery(function($){WPGMZA.DrawingManager=function(map){WPGMZA.assertInstanceOf(this,"DrawingManager"),WPGMZA.EventDispatcher.call(this),this.map=map,this.mode=WPGMZA.DrawingManager.MODE_NONE},WPGMZA.DrawingManager.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.DrawingManager.prototype.constructor=WPGMZA.DrawingManager,WPGMZA.DrawingManager.MODE_NONE=null,WPGMZA.DrawingManager.MODE_MARKER="marker",WPGMZA.DrawingManager.MODE_POLYGON="polygon",WPGMZA.DrawingManager.MODE_POLYLINE="polyline",WPGMZA.DrawingManager.MODE_CIRCLE="circle",WPGMZA.DrawingManager.MODE_RECTANGLE="rectangle",WPGMZA.DrawingManager.MODE_HEATMAP="heatmap",WPGMZA.DrawingManager.getConstructor=function(){switch(WPGMZA.settings.engine){case"google-maps":return WPGMZA.GoogleDrawingManager;default:return WPGMZA.OLDrawingManager}},WPGMZA.DrawingManager.createInstance=function(map){return new(WPGMZA.DrawingManager.getConstructor())(map)},WPGMZA.DrawingManager.prototype.setDrawingMode=function(mode){this.mode=mode,this.trigger("drawingmodechanged")}}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){WPGMZA.FancyControls={formatToggleSwitch:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-round-flat"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)},formatToggleButton:function(el){var div=$("<div class='switch'></div>"),input=el,container=el.parentNode,text=$(container).text().trim(),label=$("<label></label>");$(input).addClass("cmn-toggle cmn-toggle-yes-no"),$(input).attr("id",$(input).attr("name")),$(label).attr("for",$(input).attr("name")),$(label).attr("data-on",WPGMZA.localized_strings.yes),$(label).attr("data-off",WPGMZA.localized_strings.no),$(div).append(input),$(div).append(label),$(container).replaceWith(div),$(div).wrap($("<div></div>")),$(div).after(text)}},$(".wpgmza-fancy-toggle-switch").each(function(index,el){WPGMZA.FancyControls.formatToggleSwitch(el)}),$(".wpgmza-fancy-toggle-button").each(function(index,el){WPGMZA.FancyControls.formatToggleButton(el)})}),jQuery(function($){WPGMZA.Feature=function(options){for(var key in WPGMZA.assertInstanceOf(this,"Feature"),WPGMZA.EventDispatcher.call(this),this.id=-1,options)this[key]=options[key]},WPGMZA.extend(WPGMZA.Feature,WPGMZA.EventDispatcher),WPGMZA.MapObject=WPGMZA.Feature,WPGMZA.Feature.prototype.parseGeometry=function(subject){if("string"==typeof subject&&subject.match(/^\[/))try{subject=JSON.parse(subject)}catch(e){}if("object"==typeof subject){for(var arr=subject,i=0;i<arr.length;i++)arr[i].lat=parseFloat(arr[i].lat),arr[i].lng=parseFloat(arr[i].lng);return arr}if("string"!=typeof subject)throw new Error("Invalid geometry");var pairs,coords,results=[];pairs=subject.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.Feature.prototype.setOptions=function(options){for(var key in options)this[key]=options[key];this.updateNativeFeature()},WPGMZA.Feature.prototype.setEditable=function(editable){this.setOptions({editable:editable})},WPGMZA.Feature.prototype.setDraggable=function(draggable){this.setOptions({draggable:draggable})},WPGMZA.Feature.prototype.getScalarProperties=function(){var options={};for(var key in this)switch(typeof this[key]){case"number":options[key]=parseFloat(this[key]);break;case"boolean":case"string":options[key]=this[key]}return options},WPGMZA.Feature.prototype.updateNativeFeature=function(){var props=this.getScalarProperties();switch(WPGMZA.settings.engine){case"open-layers":this.layer&&this.layer.setStyle(WPGMZA.OLFeature.getOLStyle(props));break;default:this.googleFeature.setOptions(props)}}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Circle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Circle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeColor",{enumerable:!0,get:function(){return this.lineColor?this.lineColor:"#000000"},set:function(a){this.lineColor=a}}),Object.defineProperty(WPGMZA.Circle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineOpacity||0==this.lineOpacity?parseFloat(this.lineOpacity):0},set:function(a){this.lineOpacity=a}}),WPGMZA.Circle.createInstance=function(options,engineCircle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options,engineCircle)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.FriendlyError=function(){}}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/),latLng=new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])});callback([latLng.latLng=latLng],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)){this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find(".wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={};var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)},"google-maps"!=WPGMZA.settings.engine||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT||this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key,["https://www.wpgmaps.com/documentation/creating-a-google-maps-api-key/"])}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if(message)if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))||(m=message.match(/^Geocoding Service: .+/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){var self=this;if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){urls[i];var button=buttonTemplate.clone(),text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),$(button).find("i").addClass("fa-external-link"),$(button).append(text)}buttonContainer.append(button)}$(this.errorMessageList).append(li),$("#wpgmza_map, .wpgmza_map").each(function(index,el){var container=$(el).find(".wpgmza-google-maps-api-error-overlay");0==container.length&&(container=$("<div class='wpgmza-google-maps-api-error-overlay'></div>")).html(self.element.html()),setTimeout(function(){$(el).append(container)},1e3)}),$(".gm-err-container").parent().css({"z-index":1}),this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(feature){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),this.on("infowindowopen",function(event){self.onOpen(event)}),feature&&(this.feature=feature,this.state=WPGMZA.InfoWindow.STATE_CLOSED,feature.map?setTimeout(function(){self.onFeatureAdded(event)},100):feature.addEventListener("added",function(event){self.onFeatureAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.STATE_OPEN="open",WPGMZA.InfoWindow.STATE_CLOSED="closed",WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(feature){return new(this.getConstructor())(feature)},Object.defineProperty(WPGMZA.InfoWindow.prototype,"content",{get:function(){return this.getContent()},set:function(value){this.contentHtml=value}}),WPGMZA.InfoWindow.prototype.addEditButton=function(){return"map-edit"==WPGMZA.currentPage&&this.feature instanceof WPGMZA.Marker?' <a title="Edit this marker" style="width:15px;" class="wpgmza_edit_btn" data-edit-marker-id="'+this.feature.id+'"><i class="fa fa-edit"></i></a>':""},WPGMZA.InfoWindow.prototype.workOutDistanceBetweenTwoMarkers=function(location1,location2){if(location1&&location2){var distanceToDisplay=WPGMZA.Distance.between(location1,location2);return this.distanceUnits==WPGMZA.Distance.MILES&&(distanceToDisplay/=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(distanceToDisplay,2)}},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="",extra_html="";if(this.feature instanceof WPGMZA.Marker){if(this.feature.map.settings.store_locator_show_distance&&this.feature.map.storeLocator&&this.feature.map.storeLocator.state==WPGMZA.StoreLocator.STATE_APPLIED){var currentLatLng=this.feature.getPosition(),distance=this.workOutDistanceBetweenTwoMarkers(this.feature.map.storeLocator.center,currentLatLng);extra_html+="<p>"+(this.feature.map.settings.store_locator_distance==WPGMZA.Distance.KILOMETERS?distance+WPGMZA.localized_strings.kilometers_away:distance+" "+WPGMZA.localized_strings.miles_away)+"</p>"}html=this.feature.address+extra_html}return this.contentHtml&&(html=this.contentHtml),callback&&callback(html),html},WPGMZA.InfoWindow.prototype.open=function(map,feature){return this.feature=feature,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&(!this.feature.disableInfoWindow&&(this.state=WPGMZA.InfoWindow.STATE_OPEN,!0))},WPGMZA.InfoWindow.prototype.close=function(){this.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(this.state=WPGMZA.InfoWindow.STATE_CLOSED,this.trigger("infowindowclose"))},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onFeatureAdded=function(){1==this.feature.settings.infoopen&&this.open()},WPGMZA.InfoWindow.prototype.onOpen=function(){}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,(this._lng=0)!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},WPGMZA.LatLng.isLatLngString=function(str){return"string"==typeof str&&!!str.match(WPGMZA.LatLng.REGEXP)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.fromString=function(string){if(!WPGMZA.LatLng.isLatLngString(string))throw new Error("Not a valid latlng string");var m=string.match(WPGMZA.LatLng.REGEXP);return new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])})},WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromCurrentPosition=function(callback,options){options=options||{},callback&&WPGMZA.getCurrentPosition(function(position){var latLng=new WPGMZA.LatLng({lat:position.coords.latitude,lng:position.coords.longitude});options.geocodeAddress?WPGMZA.Geocoder.createInstance().getAddressFromLatLng({latLng:latLng},function(results){results.length&&(latLng.address=results[0]),callback(latLng)}):callback(latLng)})},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.toGoogleLatLngArray=function(arr){var result=[];return arr.forEach(function(nativeLatLng){if(!(nativeLatLng instanceof WPGMZA.LatLng||"lat"in nativeLatLng&&"lng"in nativeLatLng))throw new Error("Unexpected input");result.push(new google.maps.LatLng({lat:parseFloat(nativeLatLng.lat),lng:parseFloat(nativeLatLng.lng)}))}),result},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.toLatLngLiteral=function(){return{lat:this.lat,lng:this.lng}},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI},WPGMZA.LatLng.prototype.getGreatCircleDistance=function(arg1,arg2){var other,lat1=this.lat,lon1=this.lng;if(1==arguments.length)other=new WPGMZA.LatLng(arg1);else{if(2!=arguments.length)throw new Error("Invalid number of arguments");other=new WPGMZA.LatLng(arg1,arg2)}var lat2=other.lat,lon2=other.lng,phi1=lat1.toRadians(),phi2=lat2.toRadians(),deltaPhi=(lat2-lat1).toRadians(),deltaLambda=(lon2-lon1).toRadians(),a=Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaLambda/2)*Math.sin(deltaLambda/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLngBounds){var other=southWest;this.south=other.south,this.north=other.north,this.west=other.west,this.east=other.east}else southWest&&northEast&&(this.south=southWest.lat,this.north=northEast.lat,this.west=southWest.lng,this.east=northEast.lng)},WPGMZA.LatLngBounds.fromGoogleLatLngBounds=function(googleLatLngBounds){if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))throw new Error("Argument must be an instance of google.maps.LatLngBounds");var result=new WPGMZA.LatLngBounds,southWest=googleLatLngBounds.getSouthWest(),northEast=googleLatLngBounds.getNorthEast();return result.north=northEast.lat(),result.south=southWest.lat(),result.west=southWest.lng(),result.east=northEast.lng(),result},WPGMZA.LatLngBounds.fromGoogleLatLngBoundsLiteral=function(obj){var result=new WPGMZA.LatLngBounds,southWest=obj.southwest,northEast=obj.northeast;return result.north=northEast.lat,result.south=southWest.lat,result.west=southWest.lng,result.east=northEast.lng,result},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return null==this.north&&null==this.south&&null==this.west&&null==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){if(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),this.isInInitialState())return this.north=this.south=latLng.lat,void(this.west=this.east=latLng.lng);latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng)},WPGMZA.LatLngBounds.prototype.extendByPixelMargin=function(map,x,arg){var y=x;if(!(map instanceof WPGMZA.Map))throw new Error("First argument must be an instance of WPGMZA.Map");if(this.isInInitialState())throw new Error("Cannot extend by pixels in initial state");3<=arguments.length&&(y=arg);var southWest=new WPGMZA.LatLng(this.south,this.west),northEast=new WPGMZA.LatLng(this.north,this.east);southWest=map.latLngToPixels(southWest),northEast=map.latLngToPixels(northEast),southWest.x-=x,southWest.y+=y,northEast.x+=x,northEast.y-=y,southWest=map.pixelsToLatLng(southWest.x,southWest.y),northEast=map.pixelsToLatLng(northEast.x,northEast.y);this.toString();this.north=northEast.lat,this.south=southWest.lat,this.west=southWest.lng,this.east=northEast.lng},WPGMZA.LatLngBounds.prototype.contains=function(latLng){if(!(latLng instanceof WPGMZA.LatLng))throw new Error("Argument must be an instance of WPGMZA.LatLng");return!(latLng.lat<Math.min(this.north,this.south))&&(!(latLng.lat>Math.max(this.north,this.south))&&(this.west<this.east?latLng.lng>=this.west&&latLng.lng<=this.east:latLng.lng<=this.west||latLng.lng>=this.east))},WPGMZA.LatLngBounds.prototype.toString=function(){return this.north+"N "+this.south+"S "+this.west+"W "+this.east+"E"},WPGMZA.LatLngBounds.prototype.toLiteral=function(){return{north:this.north,south:this.south,west:this.west,east:this.east}}}),jQuery(function($){var legacyGlobals={marker_pull:"0",marker_array:[],MYMAP:[],infoWindow_poly:[],markerClusterer:[],heatmap:[],WPGM_Path:[],WPGM_Path_Polygon:[],WPGM_PathLine:[],WPGM_PathLineData:[],WPGM_PathData:[],original_iw:null,wpgmza_user_marker:null,wpgmaps_localize_marker_data:[],wpgmaps_localize_polygon_settings:[],wpgmaps_localize_heatmap_settings:[],wpgmaps_localize_polyline_settings:[],wpgmza_cirtcle_data_array:[],wpgmza_rectangle_data_array:[],wpgmzaForceLegacyMarkerClusterer:!1};function bindLegacyGlobalProperty(key){key in window?console.warn("Cannot redefine legacy global "+key):Object.defineProperty(window,key,{get:function(){return console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]},set:function(value){console.warn("This property is deprecated and should no longer be used"),legacyGlobals[key]=value}})}for(var key in legacyGlobals)bindLegacyGlobalProperty(key);WPGMZA.legacyGlobals=legacyGlobals,window.InitMap=window.resetLocations=window.searchLocations=window.fillInAddress=window.searchLocationsNear=function(){console.warn("This function is deprecated and should no longer be used")}}),jQuery(function($){WPGMZA.MapListPage=function(){$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")})},WPGMZA.MapListPage.createInstance=function(){return new WPGMZA.MapListPage},$(document).ready(function(event){WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_LIST&&(WPGMZA.mapListPage=WPGMZA.MapListPage.createInstance())})}),jQuery(function($){WPGMZA.MapSettings=function(element){var json,self=this,str=element.getAttribute("data-settings");try{json=JSON.parse(str)}catch(e){str=(str=str.replace(/\\%/g,"%")).replace(/\\\\"/g,'\\"');try{json=JSON.parse(str)}catch(e){json={},console.warn("Failed to parse map settings JSON")}}function addSettings(input){if(input)for(var key in input)if("other_settings"!=key){var value=input[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),self[key]=value}}WPGMZA.assertInstanceOf(this,"MapSettings"),addSettings(WPGMZA.settings),addSettings(json),json&&json.other_settings&&addSettings(json.other_settings)},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){var self=this,options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),empty("map_start_lat")||empty("map_start_lng")||(options.center=ol.proj.fromLonLat([parseFloat(this.map_start_lng),parseFloat(this.map_start_lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),this.map_start_zoom&&(options.zoom=parseInt(this.map_start_zoom)),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179];function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom)),this.map_start_zoom&&(zoom=parseInt(this.map_start_zoom));var options={zoom:zoom,center:latLng};function isSettingDisabled(value){return"yes"===value||!!value}switch(empty("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),empty("map_start_lat")||empty("map_start_lng")||(options.center=new google.maps.LatLng({lat:parseFloat(this.map_start_lat),lng:parseFloat(this.map_start_lng)})),this.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=!isSettingDisabled(this.wpgmza_settings_map_zoom),options.panControl=!isSettingDisabled(this.wpgmza_settings_map_pan),options.mapTypeControl=!isSettingDisabled(this.wpgmza_settings_map_type),options.streetViewControl=!isSettingDisabled(this.wpgmza_settings_map_streetview),options.fullscreenControl=!isSettingDisabled(this.wpgmza_settings_map_full_screen_control),options.draggable=!isSettingDisabled(this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom=isSettingDisabled(this.wpgmza_settings_map_clickzoom),isSettingDisabled(this.wpgmza_settings_map_tilt_controls)&&(options.rotateControl=!1,options.tilt=0),this.wpgmza_settings_map_scroll&&(options.scrollwheel=!1),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures||1==this.wpgmza_force_greedy_gestures?(options.gestureHandling="greedy",!this.wpgmza_settings_map_scroll&&"scrollwheel"in options&&delete options.scrollwheel):options.gestureHandling="cooperative",parseInt(this.type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}return this.wpgmza_theme_data&&this.wpgmza_theme_data.length&&(options.styles=WPGMZA.GoogleMap.parseThemeData(this.wpgmza_theme_data)),options}}),jQuery(function($){WPGMZA.Map=function(element,options){var self=this;if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement||window.elementor))throw new Error("Argument must be a HTMLElement");if(element.hasAttribute("data-map-id")?this.id=element.getAttribute("data-map-id"):this.id=1,!/\d+/.test(this.id))throw new Error("Map ID must be an integer");if(WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,$(this.element).addClass("wpgmza-initialized"),this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.rectangles=[],this.loadSettings(options),this.shortcodeAttributes={},$(this.element).attr("data-shortcode-attributes"))try{this.shortcodeAttributes=JSON.parse($(this.element).attr("data-shortcode-attributes")),this.shortcodeAttributes.zoom&&(this.settings.map_start_zoom=parseInt(this.shortcodeAttributes.zoom))}catch(e){console.warn("Error parsing shortcode attributes")}WPGMZA.getCurrentPage()!=WPGMZA.PAGE_MAP_EDIT&&this.initStoreLocator(),this.setDimensions(),this.setAlignment(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this),WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code&&($(element).append($(WPGMZA.api_consent_html)),$(element).css({height:"auto"})),this.on("init",function(event){self.onInit(event)}),this.on("click",function(event){self.onClick(event)}),WPGMZA.useLegacyGlobals&&(wpgmzaLegacyGlobals.MYMAP[this.id]={map:null,bounds:null,mc:null},wpgmzaLegacyGlobals.MYMAP.init=wpgmzaLegacyGlobals.MYMAP[this.id].init=wpgmzaLegacyGlobals.MYMAP.placeMarkers=wpgmzaLegacyGlobals.MYMAP[this.id].placeMarkers=function(){console.warn("This function is deprecated and should no longer be used")})},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.nightTimeThemeData=[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#575663"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#80823e"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#1b737a"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}],WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},Object.defineProperty(WPGMZA.Map.prototype,"markersPlaced",{get:function(){return this._markersPlaced},set:function(value){throw new Error("Value is read only")}}),Object.defineProperty(WPGMZA.Map.prototype,"lat",{get:function(){return this.getCenter().lat},set:function(value){var center=this.getCenter();center.lat=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"lng",{get:function(){return this.getCenter().lng},set:function(value){var center=this.getCenter();center.lng=value,this.setCenter(center)}}),Object.defineProperty(WPGMZA.Map.prototype,"zoom",{get:function(){return this.getZoom()},set:function(value){this.setZoom(value)}}),WPGMZA.Map.prototype.onInit=function(event){this.initPreloader(),"autoFetchFeatures"in this.settings&&!1===this.settings.autoFetchFeatures||this.fetchFeatures()},WPGMZA.Map.prototype.initPreloader=function(){this.preloader=$(WPGMZA.preloaderHTML),$(this.preloader).hide(),$(this.element).append(this.preloader)},WPGMZA.Map.prototype.showPreloader=function(show){show?$(this.preloader).show():$(this.preloader).hide()},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element);settings.other_settings;if(delete settings.other_settings,options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.initStoreLocator=function(){var storeLocatorElement=$(".wpgmza_sl_main_div");storeLocatorElement.length&&(this.storeLocator=WPGMZA.StoreLocator.createInstance(this,storeLocatorElement[0]))},WPGMZA.Map.prototype.getFeatureArrays=function(){var arrays=WPGMZA.Map.prototype.getFeatureArrays.call(this);return arrays.heatmaps=this.heatmaps,arrays},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]},WPGMZA.Map.prototype.getRESTParameters=function(options){var defaults={};return options&&options.filter||(defaults.filter=JSON.stringify(this.markerFilter.getFilteringParameters())),$.extend(!0,defaults,options)},WPGMZA.Map.prototype.fetchFeaturesViaREST=function(){var data,self=this,filter=this.markerFilter.getFilteringParameters();if("1"==WPGMZA.is_admin&&(filter.includeUnapproved=!0,filter.excludeIntegrated=!0),this.shortcodeAttributes.acf_post_id&&(filter.acfPostID=this.shortcodeAttributes.acf_post_id),this.showPreloader(!0),this.fetchFeaturesXhr&&this.fetchFeaturesXhr.abort(),WPGMZA.settings.fetchMarkersBatchSize){var offset=0,limit=WPGMZA.settings.fetchMarkersBatchSize;!function fetchNextBatch(){filter.offset=offset,filter.limit=limit,data=this.getRESTParameters({filter:JSON.stringify(filter)}),self.fetchFeaturesXhr=WPGMZA.restAPI.call("/markers/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){result.length?(self.onMarkersFetched(result,!0),offset+=limit,fetchNextBatch()):(self.onMarkersFetched(result),data.exclude="markers",WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}}))}})}()}else data=this.getRESTParameters({filter:JSON.stringify(filter)}),this.fetchFeaturesXhr=WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}},WPGMZA.Map.prototype.fetchFeaturesViaXML=function(){var self=this,urls=[WPGMZA.markerXMLPathURL+this.id+"markers.xml"];function fetchFeaturesExcludingMarkersViaREST(){var filter={map_id:this.id,mashup_ids:this.mashupIDs},data={filter:JSON.stringify(filter),exclude:"markers"};WPGMZA.restAPI.call("/features/",{useCompressedPathVariable:!0,data:data,success:function(result,status,xhr){self.onFeaturesFetched(result)}})}if(this.mashupIDs&&this.mashupIDs.forEach(function(id){urls.push(WPGMZA.markerXMLPathURL+id+"markers.xml")}),urls=urls.filter(function(item,index){return urls.indexOf(item)==index}),window.Worker&&window.Blob&&window.URL&&WPGMZA.settings.enable_asynchronous_xml_parsing){var source=WPGMZA.loadXMLAsWebWorker.toString().replace(/function\(\)\s*{([\s\S]+)}/,"$1"),blob=new Blob([source],{type:"text/javascript"}),worker=new Worker(URL.createObjectURL(blob));worker.onmessage=function(event){self.onMarkersFetched(event.data),fetchFeaturesExcludingMarkersViaREST()},worker.postMessage({command:"load",protocol:window.location.protocol,urls:urls})}else for(var filesLoaded=0,converter=new WPGMZA.XMLCacheConverter,converted=[],i=0;i<urls.length;i++)$.ajax(urls[i],{success:function(response,status,xhr){converted=converted.concat(converter.convert(response)),++filesLoaded==urls.length&&(self.onMarkersFetched(converted),fetchFeaturesExcludingMarkersViaREST())}})},WPGMZA.Map.prototype.fetchFeatures=function(){WPGMZA.settings.wpgmza_settings_marker_pull!=WPGMZA.MARKER_PULL_XML||"1"==WPGMZA.is_admin?this.fetchFeaturesViaREST():this.fetchFeaturesViaXML()},WPGMZA.Map.prototype.onFeaturesFetched=function(data){for(var type in data.markers&&this.onMarkersFetched(data.markers),data)if("markers"!=type)for(var module=type.substr(0,1).toUpperCase()+type.substr(1).replace(/s$/,""),i=0;i<data[type].length;i++){var instance=WPGMZA[module].createInstance(data[type][i]);this["add"+module](instance)}},WPGMZA.Map.prototype.onMarkersFetched=function(data,expectMoreBatches){for(var self=this,startFiltered=this.shortcodeAttributes.cat&&this.shortcodeAttributes.cat.length,i=0;i<data.length;i++){var obj=data[i],marker=WPGMZA.Marker.createInstance(obj);startFiltered&&(marker.isFiltered=!0,marker.setVisible(!1)),this.addMarker(marker)}if(!expectMoreBatches){this.showPreloader(!1);var triggerEvent=function(){self._markersPlaced=!0,self.trigger("markersplaced"),self.off("filteringcomplete",triggerEvent)};if(this.shortcodeAttributes.cat){var categories=this.shortcodeAttributes.cat.split(","),select=$("select[mid='"+this.id+"'][name='wpgmza_filter_select']");for(i=0;i<categories.length;i++)$("input[type='checkbox'][mid='"+this.id+"'][value='"+categories[i]+"']").prop("checked",!0),select.val(categories[i]);this.on("filteringcomplete",triggerEvent),this.markerFilter.update({categories:categories})}else triggerEvent();if(this.shortcodeAttributes.markers){var arr=this.shortcodeAttributes.markers.split(","),markers=[];for(i=0;i<arr.length;i++){var id=arr[i];id=id.replace(" ","");marker=this.getMarkerByID(id);markers.push(marker)}this.fitMapBoundsToMarkers(markers)}}};Math.PI;function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){0==arguments.length&&(width=this.settings.map_width?this.settings.map_width:"100",this.settings.map_width_type?width+=this.settings.map_width_type.replace("\\",""):width+="%",height=this.settings.map_height?this.settings.map_height:"400",this.settings.map_height_type?height+=this.settings.map_height_type.replace("\\",""):height+="px"),$(this.engineElement).css({width:width,height:height})},WPGMZA.Map.prototype.setAlignment=function(){switch(parseInt(this.settings.wpgmza_map_align)){case 1:$(this.element).css({float:"left"});break;case 2:$(this.element).css({"margin-left":"auto","margin-right":"auto"});break;case 3:$(this.element).css({float:"right"})}},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,(marker.parent=this).markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.infoWindow&&marker.infoWindow.close(),marker.map=null,marker.parent=null;var index=this.markers.indexOf(marker);if(-1==index)throw new Error("Marker not found in marker array");this.markers.splice(index,1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.removeAllMarkers=function(options){for(var i=this.markers.length-1;0<=i;i--)this.removeMarker(this.markers[i])},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.getMarkerByTitle=function(title){if("string"==typeof title){for(var i=0;i<this.markers.length;i++)if(this.markers[i].title==title)return this.markers[i]}else{if(!(title instanceof RegExp))throw new Error("Invalid argument");for(i=0;i<this.markers.length;i++)if(title.test(this.markers[i].title))return this.markers[i]}return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");(polygon.map=this).polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.removePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.removePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.removePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");(polyline.map=this).polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.removePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.removePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.removePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");(circle.map=this).circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.removeCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.removeCircle(circle)},WPGMZA.Map.prototype.addRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");(rectangle.map=this).rectangles.push(rectangle),this.dispatchEvent({type:"rectangleadded",rectangle:rectangle})},WPGMZA.Map.prototype.removeRectangle=function(rectangle){if(!(rectangle instanceof WPGMZA.Rectangle))throw new Error("Argument must be an instance of WPGMZA.Rectangle");if(rectangle.map!==this)throw new Error("Wrong map error");rectangle.map=null,this.rectangles.splice(this.rectangles.indexOf(rectangle),1),this.dispatchEvent({type:"rectangleremoved",rectangle:rectangle})},WPGMZA.Map.prototype.getRectangleByID=function(id){for(var i=0;i<this.rectangles.length;i++)if(this.rectangles[i].id==id)return this.rectangles[i];return null},WPGMZA.Map.prototype.removeRectangleByID=function(id){var rectangle=this.getRectangleByID(id);rectangle&&this.removeRectangle(rectangle)},WPGMZA.Map.prototype.resetBounds=function(){var latlng=new WPGMZA.LatLng(this.settings.map_start_lat,this.settings.map_start_lng);this.panTo(latlng),this.setZoom(this.settings.map_start_zoom)},WPGMZA.Map.prototype.nudge=function(x,y){var nudged=this.nudgeLatLng(this.getCenter(),x,y);this.setCenter(nudged)},WPGMZA.Map.prototype.nudgeLatLng=function(latLng,x,y){var pixels=this.latLngToPixels(latLng);if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");return this.pixelsToLatLng(pixels)},WPGMZA.Map.prototype.animateNudge=function(x,y,origin,milliseconds){var nudged;if(origin){if(!(origin instanceof WPGMZA.LatLng))throw new Error("Origin must be an instance of WPGMZA.LatLng")}else origin=this.getCenter();nudged=this.nudgeLatLng(origin,x,y),milliseconds=milliseconds||WPGMZA.getScrollAnimationDuration(),$(this).animate({lat:nudged.lat,lng:nudged.lng},milliseconds)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){this.trigger("idle")},WPGMZA.Map.prototype.onClick=function(event){},WPGMZA.Map.prototype.hasVisibleMarkers=function(){for(var marker,length=this.markers.length,i=0;i<length;i++)if((marker=this.markers[i]).isFilterable&&marker.getVisible())return!0;return!1},WPGMZA.Map.prototype.closeAllInfoWindows=function(){this.markers.forEach(function(marker){marker.infoWindow&&marker.infoWindow.close()})},$(document).ready(function(event){if(!WPGMZA.visibilityWorkaroundIntervalID){var invisibleMaps=jQuery(".wpgmza_map:hidden");WPGMZA.visibilityWorkaroundIntervalID=setInterval(function(){jQuery(invisibleMaps).each(function(index,el){if(jQuery(el).is(":visible")){var id=jQuery(el).attr("data-map-id");WPGMZA.getMapByID(id).onElementResized(),invisibleMaps.splice(invisibleMaps.toArray().indexOf(el),1)}})},1e3)}})}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1),$("#wpgmza-confirm-engine").click()}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val(),nonce:$("#wpgmza-maps-engine-dialog").attr("data-ajax-nonce")},success:function(response,status,xhr){window.location.reload()}})},$(document).ready(function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.MarkerFilter=function(map){WPGMZA.EventDispatcher.call(this),this.map=map},WPGMZA.MarkerFilter.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MarkerFilter.prototype.constructor=WPGMZA.MarkerFilter,WPGMZA.MarkerFilter.createInstance=function(map){return new WPGMZA.MarkerFilter(map)},WPGMZA.MarkerFilter.prototype.getFilteringParameters=function(){var params={map_id:this.map.id};return this.map.storeLocator&&(params=$.extend(params,this.map.storeLocator.getFilteringParameters())),params},WPGMZA.MarkerFilter.prototype.update=function(params,source){var self=this;function dispatchEvent(result){var event=new WPGMZA.Event("filteringcomplete");event.map=self.map,event.source=source,event.filteredMarkers=result,event.filteringParams=params,self.onFilteringComplete(event),self.trigger(event),self.map.trigger(event)}this.updateTimeoutID||(params=params||{},this.xhr&&(this.xhr.abort(),delete this.xhr),this.updateTimeoutID=setTimeout(function(){if((params=$.extend(self.getFilteringParameters(),params)).center instanceof WPGMZA.LatLng&&(params.center=params.center.toLatLngLiteral()),params.hideAll)return dispatchEvent([]),void delete self.updateTimeoutID;self.map.showPreloader(!0),self.xhr=WPGMZA.restAPI.call("/markers",{data:{fields:["id"],filter:JSON.stringify(params)},success:function(result,status,xhr){self.map.showPreloader(!1),dispatchEvent(result)},useCompressedPathVariable:!0}),delete self.updateTimeoutID},0))},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(event){var map=[];event.filteredMarkers.forEach(function(data){map[data.id]=!0}),this.map.markers.forEach(function(marker){if(marker.isFilterable){var allowByFilter=!!map[marker.id];marker.isFiltered=!allowByFilter,marker.setVisible(allowByFilter)}})}}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;this._offset={x:0,y:0},WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,this.isFilterable=!0,this.disableInfoWindow=!1,WPGMZA.Feature.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}),this.handleLegacyGlobals(row))},WPGMZA.Marker.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",Object.defineProperty(WPGMZA.Marker.prototype,"offsetX",{get:function(){return this._offset.x},set:function(value){this._offset.x=value,this.updateOffset()}}),Object.defineProperty(WPGMZA.Marker.prototype,"offsetY",{get:function(){return this._offset.y},set:function(value){this._offset.y=value,this.updateOffset()}}),WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select"),"1"==this.infoopen&&this.openInfoWindow(!0)},WPGMZA.Marker.prototype.handleLegacyGlobals=function(row){var m;if(WPGMZA.settings.useLegacyGlobals&&this.map_id&&this.id&&!(WPGMZA.pro_version&&(m=WPGMZA.pro_version.match(/\d+/))&&m[0]<=7)){WPGMZA.legacyGlobals.marker_array[this.map_id]||(WPGMZA.legacyGlobals.marker_array[this.map_id]=[]),WPGMZA.legacyGlobals.marker_array[this.map_id][this.id]=this,WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]||(WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id]=[]);var cloned=$.extend({marker_id:this.id},row);WPGMZA.legacyGlobals.wpgmaps_localize_marker_data[this.map_id][this.id]=cloned}},WPGMZA.Marker.prototype.initInfoWindow=function(){this.infoWindow||(this.infoWindow=WPGMZA.InfoWindow.createInstance())},WPGMZA.Marker.prototype.openInfoWindow=function(autoOpen){this.map?(autoOpen||(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),this.map.lastInteractedMarker=this),this.initInfoWindow(),this.infoWindow.open(this.map,this)):console.warn("Cannot open infowindow for marker with no map")},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){WPGMZA.settings.wpgmza_settings_map_open_marker_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){function stripProtocol(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}return WPGMZA.defaultMarkerIcon?stripProtocol(WPGMZA.defaultMarkerIcon):stripProtocol(WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return new WPGMZA.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.setOffset=function(x,y){this._offset.x=x,this._offset.y=y,this.updateOffset()},WPGMZA.Marker.prototype.updateOffset=function(){},WPGMZA.Marker.prototype.getAnimation=function(){return this.anim},WPGMZA.Marker.prototype.setAnimation=function(animation){},WPGMZA.Marker.prototype.getVisible=function(){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.getMap=function(){return this.map},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this),this.map=map},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(options){},WPGMZA.Marker.prototype.setOpacity=function(opacity){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=WPGMZA.getMapByID(map_id):this.map=WPGMZA.maps[0],this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#ff0000",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#ff0000")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),start=(rgba=WPGMZA.hexToRgba(settings.color),WPGMZA.rgbaToString(rgba));rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(var i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(0<settings.numRadiusLabels){var m,x,y;radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1]),context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var spokeAngle,width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;0<Math.sin(spokeAngle)&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this,map=WPGMZA.getMapByID(map_id);if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"'], .wpgmza_sl_search_button_"+map_id).closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var addressInput,inner=$(this.element).find(".wpgmza-inner");addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),map.settings.store_locator_query_string&&map.settings.store_locator_query_string.length&&addressInput.attr("placeholder",map.settings.store_locator_query_string),inner.append(addressInput);var button,titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=map.settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}(button=$(original).find("button.wpgmza-use-my-location"))&&inner.append(button),$(addressInput).on("keydown keypress",function(event){13==event.keyCode&&self.searchButton.is(":visible")&&self.searchButton.trigger("click")}),$(addressInput).on("input",function(event){self.searchButton.show(),self.resetButton.hide()}),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button, .wpgmza_sl_search_button_div"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_APPLIED)}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_INITIAL})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),items=($(container).children("ul"),$(container).find("li")),numCategories=0,icons=[];items.each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fa fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")}),$(this.element).on("mouseover","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseOverCategory(event)}),$(this.element).on("mouseleave","li.wpgmza_cat_checkbox_item_holder",function(event){self.onMouseLeaveCategory(event)}),$("body").on("click",".wpgmza_store_locator_options_button",function(event){setTimeout(function(){if($(".wpgmza_cat_checkbox_holder").hasClass("wpgmza-open")){var p_cat=$(".wpgmza_cat_checkbox_holder"),position_cat=p_cat.position().top+p_cat.outerHeight(!0)+$(".wpgmza-modern-store-locator").height(),$p_map=$(".wpgmza_map");$p_map.position().top+$p_map.outerHeight(!0)<=position_cat&&($(".wpgmza_cat_ul").css("overflow","scroll "),$(".wpgmza_cat_ul").css("height","100%"),$(".wpgmza-modern-store-locator").css("height","100%"),$(".wpgmza_cat_checkbox_holder.wpgmza-open").css({"padding-bottom":"50px",height:"100%"}))}},500)})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLModernStoreLocator(map_id);default:return new WPGMZA.GoogleModernStoreLocator(map_id)}},WPGMZA.ModernStoreLocator.prototype.onMouseOverCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeIn()},WPGMZA.ModernStoreLocator.prototype.onMouseLeaveCategory=function(event){var li=event.currentTarget;$(li).children("ul.wpgmza_cat_checkbox_item_holder").stop(!0,!1).fadeOut()}}),jQuery(function($){WPGMZA.NativeMapsAppIcon=function(){navigator.userAgent.match(/^Apple|iPhone|iPad|iPod/)?(this.type="apple",this.element=$('<span><i class="fab fa fa-apple" aria-hidden="true"></i></span>')):(this.type="google",this.element=$('<span><i class="fab fa fa-google" aria-hidden="true"></i></span>'))}}),jQuery(function($){Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(begin,end){return new Uint8Array(Array.prototype.slice.call(this,begin,end))}}),WPGMZA.isSafari()&&!window.external&&(window.external={})}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,Object.defineProperty(WPGMZA.Polygon.prototype,"fillColor",{enumerable:!0,get:function(){return this.fillcolor&&this.fillcolor.length?"#"+this.fillcolor.replace(/^#/,""):"#ff0000"},set:function(a){this.fillcolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polygon.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.lineopacity&&this.lineopacity.length?this.lineopacity:.6},set:function(a){this.lineopacity=a}}),WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)}}),jQuery(function($){WPGMZA.Polyline=function(options,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.Feature.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,Object.defineProperty(WPGMZA.Polyline.prototype,"strokeColor",{enumerable:!0,get:function(){return this.linecolor&&this.linecolor.length?"#"+this.linecolor.replace(/^#/,""):"#ff0000"},set:function(a){this.linecolor=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeOpacity",{enumerable:!0,get:function(){return this.opacity&&this.opacity.length?this.opacity:.6},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Polyline.prototype,"strokeWeight",{enumerable:!0,get:function(){return this.linethickness&&this.linethickness.length?parseInt(this.linethickness):1},set:function(a){this.linethickness=a}}),WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(options,engineObject){return new(WPGMZA.Polyline.getConstructor())(options,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.Feature.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.PopoutPanel=function(element){this.element=element},WPGMZA.PopoutPanel.prototype.open=function(){$(this.element).addClass("wpgmza-open")},WPGMZA.PopoutPanel.prototype.close=function(){$(this.element).removeClass("wpgmza-open")}}),jQuery(function($){var Parent=WPGMZA.Feature;WPGMZA.Rectangle=function(options,engineRectangle){WPGMZA.assertInstanceOf(this,"Rectangle"),this.name="",this.cornerA=new WPGMZA.LatLng,this.cornerB=new WPGMZA.LatLng,this.color="#ff0000",this.opacity=.5,Parent.apply(this,arguments)},WPGMZA.extend(WPGMZA.Rectangle,WPGMZA.Feature),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillColor",{enumerable:!0,get:function(){return this.color&&this.color.length?this.color:"#ff0000"},set:function(a){this.color=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"fillOpacity",{enumerable:!0,get:function(){return this.opacity||0==this.opacity?parseFloat(this.opacity):.5},set:function(a){this.opacity=a}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeColor",{enumerable:!0,get:function(){return"#000000"}}),Object.defineProperty(WPGMZA.Rectangle.prototype,"strokeOpacity",{enumerable:!0,get:function(){return 0}}),WPGMZA.Rectangle.createInstance=function(options,engineRectangle){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLRectangle;break;default:constructor=WPGMZA.GoogleRectangle}return new constructor(options,engineRectangle)}}),jQuery(function($){function sendAJAXFallbackRequest(route,params){if((params=$.extend({},params)).data||(params.data={}),"route"in params.data)throw new Error("Cannot send route through this method");if("action"in params.data)throw new Error("Cannot send action through this method");return params.data.route=route,params.data.action="wpgmza_rest_api_request",WPGMZA.restAPI.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_AJAX),$.ajax(WPGMZA.ajaxurl,params)}WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl,this.useAJAXFallback=!1},WPGMZA.RestAPI.CONTEXT_REST="REST",WPGMZA.RestAPI.CONTEXT_AJAX="AJAX",WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableSupported",{get:function(){return WPGMZA.serverCanInflate&&"Uint8Array"in window&&"TextEncoder"in window}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableAllowed",{get:function(){return!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?!WPGMZA.settings.disable_compressed_path_variables:WPGMZA.settings.enable_compressed_path_variables}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"maxURLLength",{get:function(){return 2083}}),WPGMZA.RestAPI.prototype.compressParams=function(params){var suffix="";if(params.markerIDs){var markerIDs=params.markerIDs.split(",");if(1<markerIDs.length){var encoded=(new WPGMZA.EliasFano).encode(markerIDs),compressed=pako.deflate(encoded),string=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");suffix="/"+btoa(string).replace(/\//g,"-").replace(/=+$/,""),params.midcbp=encoded.pointer,delete params.markerIDs}}string=JSON.stringify(params);var input=(new TextEncoder).encode(string),raw=(compressed=pako.deflate(input),Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join(""));return btoa(raw).replace(/\//g,"-").replace(/=+$/,"")+suffix},WPGMZA.RestAPI.prototype.getNonce=function(route){var matches=[];for(var pattern in WPGMZA.restnoncetable){var regex=new RegExp(pattern);route.match(regex)&&matches.push({pattern:pattern,nonce:WPGMZA.restnoncetable[pattern],length:pattern.length})}if(!matches.length)throw new Error("No nonce found for route");return matches.sort(function(a,b){return b.length-a.length}),matches[0].nonce},WPGMZA.RestAPI.prototype.addNonce=function(route,params,context){function setRESTNonce(xhr){context==WPGMZA.RestAPI.CONTEXT_REST&&self.shouldAddNonce(route)&&xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&&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.shouldAddNonce=function(route){route=route.replace(/\//g,"");var isAdmin=!1;WPGMZA.is_admin&&1===parseInt(WPGMZA.is_admin)&&(isAdmin=!0);return!(route&&["markers","features","marker-listing","datatables"].includes(route)&&!isAdmin)},WPGMZA.RestAPI.prototype.call=function(route,params){if(this.useAJAXFallback)return sendAJAXFallbackRequest(route,params);var attemptedCompressedPathVariable=!1,fallbackRoute=route,fallbackParams=$.extend({},params);if("string"!=typeof route||!route.match(/^\//)&&!route.match(/^http/))throw new Error("Invalid route");if(WPGMZA.RestAPI.URL.match(/\/$/)&&(route=route.replace(/^\//,"")),params=params||{},this.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_REST),params.error||(params.error=function(xhr,status,message){if("abort"!=status){switch(xhr.status){case 401:case 403:case 405:return($.post(WPGMZA.ajaxurl,{action:"wpgmza_report_rest_api_blocked"},function(response){}),console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users."),"DELETE"===params.method)?(console.warn("The REST API rejected a DELETE request, attempting again with POST fallback"),params.method="POST",params.data||(params.data={}),params.data.simulateDelete="yes",WPGMZA.restAPI.call(route,params)):(this.useAJAXFallback=!0,sendAJAXFallbackRequest(fallbackRoute,fallbackParams));case 414:if(!attemptedCompressedPathVariable)break;return fallbackParams.method="POST",fallbackParams.useCompressedPathVariable=!1,WPGMZA.restAPI.call(fallbackRoute,fallbackParams)}throw new Error(message)}}),params.useCompressedPathVariable&&this.isCompressedPathVariableSupported&&this.isCompressedPathVariableAllowed){var compressedParams=$.extend({},params),data=params.data,base64=this.compressParams(data);WPGMZA.isServerIIS&&(base64=base64.replace(/\+/g,"%20"));var compressedRoute=route.replace(/\/$/,"")+"/base64"+base64;WPGMZA.RestAPI.URL;compressedParams.method="GET",delete compressedParams.data,!1===params.cache&&(compressedParams.data={skip_cache:1}),compressedRoute.length<this.maxURLLength?(attemptedCompressedPathVariable=!0,route=compressedRoute,params=compressedParams):(WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed||console.warn("Compressed path variable route would exceed URL length limit"),WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed=!0)}var onSuccess=null;return params.success&&(onSuccess=params.success),params.success=function(result,status,xhr){if("object"!=typeof result){var rawResult=result;try{result=JSON.parse(result)}catch(parseExc){result=rawResult}}onSuccess&&"function"==typeof onSuccess&&onSuccess(result,status,xhr)},WPGMZA.RestAPI.URL.match(/\?/)&&(route=route.replace(/\?/,"&")),$.ajax(WPGMZA.RestAPI.URL+route,params)};var nativeCallFunction=WPGMZA.RestAPI.call;WPGMZA.RestAPI.call=function(){console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?"),nativeCallFunction.apply(this,arguments)},$(document.body).on("click","#wpgmza-rest-api-blocked button.notice-dismiss",function(event){WPGMZA.restAPI.call("/rest-api/",{method:"POST",data:{dismiss_blocked_notice:!0}})})});var $_GET={};if(-1!==document.location.toString().indexOf("?"))for(var query=document.location.toString().replace(/^.*?\?/,"").replace(/#.*$/,"").split("&"),wpgmza_i=0,wpgmza_l=query.length;wpgmza_i<wpgmza_l;wpgmza_i++){var aux=decodeURIComponent(query[wpgmza_i]).split("=");$_GET[aux[0]]=aux[1]}jQuery(function($){WPGMZA.SettingsPage=function(){var self=this;this._keypressHistory=[],this.updateEngineSpecificControls(),this.updateStorageControls(),this.updateGDPRControls(),$(window).on("keypress",function(event){self.onKeyPress(event)}),jQuery("body").on("click",".wpgmza_destroy_data",function(e){e.preventDefault();var ttype=jQuery(this).attr("danger"),warning="Are you sure?";"wpgmza_destroy_all_data"==ttype&&(warning="Are you sure? This will delete ALL data and settings for WP Google Maps!"),window.confirm(warning)&&jQuery.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_settings_danger_zone_delete_data",type:ttype,nonce:wpgmza_dz_nonce},success:function(response,status,xhr){"wpgmza_destroy_all_data"==ttype?window.location.replace("admin.php?page=wp-google-maps-menu&action=welcome_page"):"wpgmza_reset_all_settings"==ttype?window.location.reload():alert("Complete.")}})}),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$('[name="wpgmza_settings_marker_pull"]').on("click",function(event){self.updateStorageControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()}),$('select[name="tile_server_url"]').on("change",function(event){"custom_override"===$('select[name="tile_server_url"]').val()?$(".wpgmza_tile_server_override_component").removeClass("wpgmza-hidden"):$(".wpgmza_tile_server_override_component").addClass("wpgmza-hidden")}),$('select[name="tile_server_url"]').trigger("change"),jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.settingsPage.flushGeocodeCache()}),$("#wpgmza-global-settings").tabs({create:function(event,ui){if(void 0!==$_GET.highlight){var elmnt=document.getElementById($_GET.highlight);elmnt.classList.add("highlight-item"),setTimeout(function(){elmnt.classList.add("highlight-item-step-2")},1e3);var y=elmnt.getBoundingClientRect().top+window.pageYOffset+-100;window.scrollTo({top:y,behavior:"smooth"})}}}),$("#wpgmza-global-setting").bind("create",function(event,ui){alert("now")}),$("#wpgmza-global-settings fieldset").each(function(index,el){$(el).children(":not(legend)").wrapAll("<span class='settings-group'></span>")})},WPGMZA.SettingsPage.createInstance=function(){return new WPGMZA.SettingsPage},WPGMZA.SettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.SettingsPage.prototype.updateStorageControls=function(){$("input[name='wpgmza_settings_marker_pull'][value='1']").is(":checked")?$("#xml-cache-settings").show():$("#xml-cache-settings").hide()},WPGMZA.SettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},WPGMZA.SettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},WPGMZA.SettingsPage.prototype.onKeyPress=function(event){this._keypressHistory.push(event.key),9<this._keypressHistory.length&&(this._keypressHistory=this._keypressHistory.slice(this._keypressHistory.length-9)),"codecabin"!=this._keypressHistory.join("")||this._developerModeRevealed||($("fieldset#wpgmza-developer-mode").show(),this._developerModeRevealed=!0)},$(document).ready(function(event){WPGMZA.getCurrentPage()&&(WPGMZA.settingsPage=WPGMZA.SettingsPage.createInstance())})}),jQuery(function($){WPGMZA.StoreLocator=function(map,element){var self=this;WPGMZA.EventDispatcher.call(this),this._center=null,this.map=map,this.element=element,this.state=WPGMZA.StoreLocator.STATE_INITIAL,this.distanceUnits=this.map.settings.store_locator_distance,this.addressInput=WPGMZA.AddressInput.createInstance(this.addressElement,this.map),$(element).find(".wpgmza-not-found-msg").hide(),this.radiusElement&&this.map.settings.wpgmza_store_locator_default_radius&&0<this.radiusElement.find("option[value='"+this.map.settings.wpgmza_store_locator_default_radius+"']").length&&this.radiusElement.val(this.map.settings.wpgmza_store_locator_default_radius),this.map.on("storelocatorgeocodecomplete",function(event){self.onGeocodeComplete(event)}),this.map.on("init",function(event){self.map.markerFilter.on("filteringcomplete",function(event){self.onFilteringComplete(event)}),void 0!==self.map.settings.store_locator_style&&"modern"!=self.map.settings.store_locator_style&&"modern"!==WPGMZA.settings.user_interface_style||"default"!==WPGMZA.settings.user_interface_style&&"modern"!=WPGMZA.settings.user_interface_style&&"legacy"!=WPGMZA.settings.user_interface_style||(self.legacyModernAdapter=WPGMZA.ModernStoreLocator.createInstance(map.id))}),$(document.body).on("click",".wpgmza_sl_search_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_search_button",function(event){self.onSearch(event)}),$(document.body).on("click",".wpgmza_sl_reset_button_"+map.id+", [data-map-id='"+map.id+"'] .wpgmza_sl_reset_button_div",function(event){self.onReset(event)}),$(this.addressElement).on("keypress",function(event){13==event.which&&self.onSearch(event)})},WPGMZA.StoreLocator.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.StoreLocator.prototype.constructor=WPGMZA.StoreLocator,WPGMZA.StoreLocator.STATE_INITIAL="initial",WPGMZA.StoreLocator.STATE_APPLIED="applied",WPGMZA.StoreLocator.createInstance=function(map,element){return new WPGMZA.StoreLocator(map,element)},Object.defineProperty(WPGMZA.StoreLocator.prototype,"address",{get:function(){return $(this.addressElement).val()}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"addressElement",{get:function(){return this.legacyModernAdapter?$(this.legacyModernAdapter.element).find("input.wpgmza-address")[0]:$(this.element).find("input.wpgmza-address")[0]}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"countryRestriction",{get:function(){return this.map.settings.wpgmza_store_locator_restrict}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radiusElement",{get:function(){return $("#radiusSelect, #radiusSelect_"+this.map.id)}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return parseFloat(this.radiusElement.val())}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"center",{get:function(){return this._center}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"bounds",{get:function(){return this._bounds}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"marker",{get:function(){if(1!=this.map.settings.store_locator_bounce)return null;if(this._marker)return this._marker;return this._marker=WPGMZA.Marker.createInstance({visible:!1}),this._marker.disableInfoWindow=!0,this._marker.isFilterable=!1,this._marker.setAnimation(WPGMZA.Marker.ANIMATION_BOUNCE),this._marker}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"circle",{get:function(){return this._circle||("modern"!=this.map.settings.wpgmza_store_locator_radius_style||WPGMZA.isDeviceiOS()?this._circle=WPGMZA.Circle.createInstance({strokeColor:"#ff0000",strokeOpacity:"0.25",strokeWeight:2,fillColor:"#ff0000",fillOpacity:"0.15",visible:!1,clickable:!1,center:new WPGMZA.LatLng}):(this._circle=WPGMZA.ModernStoreLocatorCircle.createInstance(this.map.id),this._circle.settings.color=this.circleStrokeColor)),this._circle}}),WPGMZA.StoreLocator.prototype.onGeocodeComplete=function(event){if(!event.results||!event.results.length)return this._center=null,void(this._bounds=null);this._center=new WPGMZA.LatLng(event.results[0].latLng),this._bounds=new WPGMZA.LatLngBounds(event.results[0].bounds),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.onSearch=function(event){var self=this;if(this.state=WPGMZA.StoreLocator.STATE_APPLIED,!this.address||!this.address.length)return this.addressElement.focus(),!1;function callback(results,status){self.map.trigger({type:"storelocatorgeocodecomplete",results:results,status:status})}if(void 0!==this.map.settings.store_locator_style&&"modern"!==this.map.settings.store_locator_style&&"modern"!==WPGMZA.settings.user_interface_style&&"default"===WPGMZA.settings.user_interface_style&&WPGMZA.animateScroll(this.map.element),$(this.element).find(".wpgmza-not-found-msg").hide(),WPGMZA.LatLng.isLatLngString(this.address))callback([WPGMZA.LatLng.fromString(this.address)],WPGMZA.Geocoder.SUCCESS);else{var geocoder=WPGMZA.Geocoder.createInstance(),options={address:this.address};this.countryRestriction&&(options.country=this.countryRestriction),geocoder.geocode(options,function(results,status){status==WPGMZA.Geocoder.SUCCESS?callback(results,status):alert(WPGMZA.localized_strings.address_not_found)})}return!0},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this._bounds=null,this.map.setZoom(this.map.settings.map_start_zoom),$(this.element).find(".wpgmza-not-found-msg").hide(),this.circle&&this.circle.setVisible(!1),this.marker&&this.marker.map&&this.map.removeMarker(this.marker),this.map.markerFilter.update({},this)},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.getZoomFromRadius=function(radius){return this.distanceUnits==WPGMZA.Distance.MILES&&(radius*=WPGMZA.Distance.KILOMETERS_PER_MILE),Math.round(14-Math.log(radius)/Math.LN2)},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){var params=event.filteringParams,marker=this.marker;marker&&marker.setVisible(!1),params.center&&(this.map.setCenter(params.center),marker&&(marker.setPosition(params.center),marker.setVisible(!0),marker.map!=this.map&&this.map.addMarker(marker))),params.radius&&this.map.setZoom(this.getZoomFromRadius(params.radius));var circle=this.circle;if(circle){circle.setVisible(!1);var factor=this.distanceUnits==WPGMZA.Distance.MILES?WPGMZA.Distance.KILOMETERS_PER_MILE:1;params.center&&params.radius&&(circle.setRadius(params.radius*factor),circle.setCenter(params.center),circle.setVisible(!0),circle instanceof WPGMZA.ModernStoreLocatorCircle||circle.map==this.map||this.map.addCircle(circle)),circle instanceof WPGMZA.ModernStoreLocatorCircle&&(circle.settings.radiusString=this.radius)}0==event.filteredMarkers.length&&this.state===WPGMZA.StoreLocator.STATE_APPLIED&&(0<$(this.element).find(".wpgmza-no-results").length&&"legacy"===WPGMZA.settings.user_interface_style?$(this.element).find(".wpgmza-no-results").show():alert(this.map.settings.store_locator_not_found_message?this.map.settings.store_locator_not_found_message:WPGMZA.localized_strings.zero_results))}}),jQuery(function($){WPGMZA.Text=function(options){if(options)for(var name in options)this[name]=options[name]},WPGMZA.Text.createInstance=function(options){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLText(options);default:return new WPGMZA.GoogleText(options)}}}),jQuery(function($){WPGMZA.ThemeEditor=function(){WPGMZA.EventDispatcher.call(this),this.element=$("#wpgmza-theme-editor"),"open-layers"!=WPGMZA.settings.engine?this.element.length?(this.json=[{}],this.mapElement=WPGMZA.maps[0].element,this.element.appendTo("#wpgmza-map-theme-editor__holder"),$(window).on("scroll",function(event){}),setInterval(function(){},200),this.initHTML(),WPGMZA.themeEditor=this):console.warn("No element to initialise theme editor on"):this.element.remove()},WPGMZA.extend(WPGMZA.ThemeEditor,WPGMZA.EventDispatcher),WPGMZA.ThemeEditor.prototype.updatePosition=function(){},WPGMZA.ThemeEditor.features={all:[],administrative:["country","land_parcel","locality","neighborhood","province"],landscape:["man_made","natural","natural.landcover","natural.terrain"],poi:["attraction","business","government","medical","park","place_of_worship","school","sports_complex"],road:["arterial","highway","highway.controlled_access","local"],transit:["line","station","station.airport","station.bus","station.rail"],water:[]},WPGMZA.ThemeEditor.elements={all:[],geometry:["fill","stroke"],labels:["icon","text","text.fill","text.stroke"]},WPGMZA.ThemeEditor.prototype.parse=function(){$("#wpgmza_theme_editor_feature option, #wpgmza_theme_editor_element option").css("font-weight","normal"),$("#wpgmza_theme_editor_error").hide(),$("#wpgmza_theme_editor").show(),$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val("");var textarea=$('textarea[name="wpgmza_theme_data"]');if(!textarea.val()||textarea.val().length<1)this.json=[{}];else{try{this.json=$.parseJSON($('textarea[name="wpgmza_theme_data"]').val())}catch(e){return this.json=[{}],$("#wpgmza_theme_editor").hide(),void $("#wpgmza_theme_editor_error").show()}if(!$.isArray(this.json)){var jsonCopy=this.json;this.json=[],this.json.push(jsonCopy)}this.highlightFeatures(),this.highlightElements(),this.loadElementStylers()}},WPGMZA.ThemeEditor.prototype.highlightFeatures=function(){$("#wpgmza_theme_editor_feature option").css("font-weight","normal"),$.each(this.json,function(i,v){v.hasOwnProperty("featureType")?$('#wpgmza_theme_editor_feature option[value="'+v.featureType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_feature option[value="all"]').css("font-weight","bold")})},WPGMZA.ThemeEditor.prototype.highlightElements=function(){var feature=$("#wpgmza_theme_editor_feature").val();$("#wpgmza_theme_editor_element option").css("font-weight","normal"),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")?$('#wpgmza_theme_editor_element option[value="'+v.elementType+'"]').css("font-weight","bold"):$('#wpgmza_theme_editor_element option[value="all"]').css("font-weight","bold"))})},WPGMZA.ThemeEditor.prototype.loadElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val();$("#wpgmza_theme_editor_do_hue").prop("checked",!1),$("#wpgmza_theme_editor_hue").val("#000000"),$("#wpgmza_theme_editor_lightness").val(""),$("#wpgmza_theme_editor_saturation").val(""),$("#wpgmza_theme_editor_gamma").val(""),$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!1),$("#wpgmza_theme_editor_visibility").val("inherit"),$("#wpgmza_theme_editor_do_color").prop("checked",!1),$("#wpgmza_theme_editor_color").val("#000000"),$("#wpgmza_theme_editor_weight").val(""),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&v.hasOwnProperty("stylers")&&$.isArray(v.stylers)&&0<v.stylers.length&&$.each(v.stylers,function(ii,vv){vv.hasOwnProperty("hue")&&($("#wpgmza_theme_editor_do_hue").prop("checked",!0),$("#wpgmza_theme_editor_hue").val(vv.hue)),vv.hasOwnProperty("lightness")&&$("#wpgmza_theme_editor_lightness").val(vv.lightness),vv.hasOwnProperty("saturation")&&$("#wpgmza_theme_editor_saturation").val(vv.xaturation),vv.hasOwnProperty("gamma")&&$("#wpgmza_theme_editor_gamma").val(vv.gamma),vv.hasOwnProperty("invert_lightness")&&$("#wpgmza_theme_editor_do_invert_lightness").prop("checked",!0),vv.hasOwnProperty("visibility")&&$("#wpgmza_theme_editor_visibility").val(vv.visibility),vv.hasOwnProperty("color")&&($("#wpgmza_theme_editor_do_color").prop("checked",!0),$("#wpgmza_theme_editor_color").val(vv.color)),vv.hasOwnProperty("weight")&&$("#wpgmza_theme_editor_weight").val(vv.weight)})})},WPGMZA.ThemeEditor.prototype.writeElementStylers=function(){var feature=$("#wpgmza_theme_editor_feature").val(),element=$("#wpgmza_theme_editor_element").val(),indexJSON=null,stylers=[];if("inherit"!=$("#wpgmza_theme_editor_visibility").val()&&stylers.push({visibility:$("#wpgmza_theme_editor_visibility").val()}),!0===$("#wpgmza_theme_editor_do_color").prop("checked")&&stylers.push({color:$("#wpgmza_theme_editor_color").val()}),!0===$("#wpgmza_theme_editor_do_hue").prop("checked")&&stylers.push({hue:$("#wpgmza_theme_editor_hue").val()}),0<$("#wpgmza_theme_editor_gamma").val().length&&stylers.push({gamma:parseFloat($("#wpgmza_theme_editor_gamma").val())}),0<$("#wpgmza_theme_editor_weight").val().length&&stylers.push({weight:parseFloat($("#wpgmza_theme_editor_weight").val())}),0<$("#wpgmza_theme_editor_saturation").val().length&&stylers.push({saturation:parseFloat($("#wpgmza_theme_editor_saturation").val())}),0<$("#wpgmza_theme_editor_lightness").val().length&&stylers.push({lightness:parseFloat($("#wpgmza_theme_editor_lightness").val())}),!0===$("#wpgmza_theme_editor_do_invert_lightness").prop("checked")&&stylers.push({invert_lightness:!0}),$.each(this.json,function(i,v){(v.hasOwnProperty("featureType")&&v.featureType==feature||"all"==feature&&!v.hasOwnProperty("featureType"))&&(v.hasOwnProperty("elementType")&&v.elementType==element||"all"==element&&!v.hasOwnProperty("elementType"))&&(indexJSON=i)}),null===indexJSON){if(0<stylers.length){var new_feature_element_stylers={};"all"!=feature&&(new_feature_element_stylers.featureType=feature),"all"!=element&&(new_feature_element_stylers.elementType=element),new_feature_element_stylers.stylers=stylers,this.json.push(new_feature_element_stylers)}}else 0<stylers.length?this.json[indexJSON].stylers=stylers:this.json.splice(indexJSON,1);$('textarea[name="wpgmza_theme_data"]').val(JSON.stringify(this.json).replace(/:/g,": ").replace(/,/g,", ")),this.highlightFeatures(),this.highlightElements(),WPGMZA.themePanel.updateMapTheme()},WPGMZA.ThemeEditor.prototype.initHTML=function(){var self=this;$.each(WPGMZA.ThemeEditor.features,function(i,v){$("#wpgmza_theme_editor_feature").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_feature").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),$.each(WPGMZA.ThemeEditor.elements,function(i,v){$("#wpgmza_theme_editor_element").append('<option value="'+i+'">'+i+"</option>"),0<v.length&&$.each(v,function(ii,vv){$("#wpgmza_theme_editor_element").append('<option value="'+i+"."+vv+'">'+i+"."+vv+"</option>")})}),this.parse(),$('textarea[name="wpgmza_theme_data"]').on("input selectionchange propertychange",function(){self.parse()}),$(".wpgmza_theme_selection").click(function(){setTimeout(function(){$('textarea[name="wpgmza_theme_data"]').trigger("input")},1e3)}),$("#wpgmza-theme-editor__toggle").click(function(){$("#wpgmza-theme-editor").removeClass("active")}),$("#wpgmza_theme_editor_feature").on("change",function(){self.highlightElements(),self.loadElementStylers()}),$("#wpgmza_theme_editor_element").on("change",function(){self.loadElementStylers()}),$("#wpgmza_theme_editor_do_hue, #wpgmza_theme_editor_hue, #wpgmza_theme_editor_lightness, #wpgmza_theme_editor_saturation, #wpgmza_theme_editor_gamma, #wpgmza_theme_editor_do_invert_lightness, #wpgmza_theme_editor_visibility, #wpgmza_theme_editor_do_color, #wpgmza_theme_editor_color, #wpgmza_theme_editor_weight").on("input selectionchange propertychange",function(){self.writeElementStylers()}),"open-layers"==WPGMZA.settings.engine&&$("#wpgmza_theme_editor :input").prop("disabled",!0)}}),jQuery(function($){WPGMZA.ThemePanel=function(){var self=this;this.element=$("#wpgmza-theme-panel"),this.map=WPGMZA.maps[0],"open-layers"!=WPGMZA.settings.engine?this.element.length?($("#wpgmza-theme-presets").owlCarousel({items:6,dots:!0}),this.element.on("click","#wpgmza-theme-presets label",function(event){self.onThemePresetClick(event)}),$("#wpgmza-open-theme-editor").on("click",function(event){$("#wpgmza-map-theme-editor__holder").addClass("active"),$("#wpgmza-theme-editor").addClass("active"),WPGMZA.animateScroll($("#wpgmza-theme-editor"))}),WPGMZA.themePanel=this):console.warn("No element to initialise theme panel on"):this.element.remove()},WPGMZA.ThemePanel.previewImageCenter={lat:33.701806462148646,lng:-118.15949896058983},WPGMZA.ThemePanel.previewImageZoom=11,WPGMZA.ThemePanel.prototype.onThemePresetClick=function(event){var selectedData=$(event.currentTarget).find("[data-theme-json]").attr("data-theme-json"),textarea=$(this.element).find("textarea[name='wpgmza_theme_data']"),existingData=textarea.val(),allPresetData=[];$(this.element).find("[data-theme-json]").each(function(index,el){allPresetData.push($(el).attr("data-theme-json"))}),existingData.length&&-1==allPresetData.indexOf(existingData)&&!confirm(WPGMZA.localized_strings.overwrite_theme_data)||(textarea.val(selectedData),this.updateMapTheme(),WPGMZA.themeEditor.parse())},WPGMZA.ThemePanel.prototype.updateMapTheme=function(){var data;try{data=JSON.parse($("textarea[name='wpgmza_theme_data']").val())}catch(e){return void alert(WPGMZA.localized_strings.invalid_theme_data)}this.map.setOptions({styles:data})}}),jQuery(function($){WPGMZA.Version=function(){},WPGMZA.Version.GREATER_THAN=1,WPGMZA.Version.EQUAL_TO=0,WPGMZA.Version.LESS_THAN=-1,WPGMZA.Version.compare=function(v1,v2){for(var v1parts=v1.match(/\d+/g),v2parts=v2.match(/\d+/g),i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.XMLCacheConverter=function(){},WPGMZA.XMLCacheConverter.prototype.convert=function(xml){var markers=[],remap={marker_id:"id",linkd:"link"};return $(xml).find("marker").each(function(index,el){var data={};$(el).children().each(function(j,child){var key=child.nodeName;remap[key]&&(key=remap[key]),child.hasAttribute("data-json")?data[key]=JSON.parse($(child).text()):data[key]=$(child).text()}),markers.push(data)}),markers}}),jQuery(function($){WPGMZA.loadXMLAsWebWorker=function(){function tXml(a,d){function c(){for(var l=[];a[b];){if(60==a.charCodeAt(b)){if(47===a.charCodeAt(b+1)){b=a.indexOf(">",b);break}if(33===a.charCodeAt(b+1)){if(45==a.charCodeAt(b+2)){for(;62!==a.charCodeAt(b)||45!=a.charCodeAt(b-1)||45!=a.charCodeAt(b-2)||-1==b;)b=a.indexOf(">",b+1);-1===b&&(b=a.length)}else for(b+=2;62!==a.charCodeAt(b);)b++;b++;continue}var c=f();l.push(c)}else c=b,-2===(b=a.indexOf("<",b)-1)&&(b=a.length),0<(c=a.slice(c,b+1)).trim().length&&l.push(c);b++}return l}function l(){for(var c=b;-1===g.indexOf(a[b]);)b++;return a.slice(c,b)}function f(){var d={};b++,d.tagName=l();for(var f=!1;62!==a.charCodeAt(b);){if(64<(e=a.charCodeAt(b))&&e<91||96<e&&e<123){for(var g=l(),e=a.charCodeAt(b);39!==e&&34!==e&&!(64<e&&e<91||96<e&&e<123)&&62!==e;)b++,e=a.charCodeAt(b);if(f||(d.attributes={},f=!0),39===e||34===e){e=a[b];var h=++b;b=a.indexOf(e,h),e=a.slice(h,b)}else e=null,b--;d.attributes[g]=e}b++}return 47!==a.charCodeAt(b-1)&&("script"==d.tagName?(f=b+1,b=a.indexOf("<\/script>",b),d.children=[a.slice(f,b-1)],b+=8):"style"==d.tagName?(f=b+1,b=a.indexOf("</style>",b),d.children=[a.slice(f,b-1)],b+=7):-1==k.indexOf(d.tagName)&&(b++,d.children=c())),d}var g="\n\t>/= ",k=["img","br","input","meta","link"],h=null;if((d=d||{}).searchId){var b=new RegExp("s*ids*=s*['\"]"+d.searchId+"['\"]").exec(a).index;return-1!==b&&(-1!==(b=a.lastIndexOf("<",b))&&(h=f())),b}return b=0,h=c(),d.filter&&(h=tXml.filter(h,d.filter)),d.simplify&&(h=tXml.simplefy(h)),h}tXml.simplify=function(a){var d={};if(1===a.length&&"string"==typeof a[0])return a[0];for(var c in a.forEach(function(a){if(d[a.tagName]||(d[a.tagName]=[]),"object"==typeof a){var c=tXml.simplefy(a.children);d[a.tagName].push(c),a.attributes&&(c._attributes=a.attributes)}else d[a.tagName].push(a)}),d)1==d[c].length&&(d[c]=d[c][0]);return d},tXml.filter=function(a,d){var c=[];return a.forEach(function(a){"object"==typeof a&&d(a)&&c.push(a),a.children&&(a=tXml.filter(a.children,d),c=c.concat(a))}),c},tXml.domToXml=function(a){var c="";return function d(a){if(a)for(var f=0;f<a.length;f++)if("string"==typeof a[f])c+=a[f].trim();else{var g=a[f];c+="<"+g.tagName;var k=void 0;for(k in g.attributes)c=-1===g.attributes[k].indexOf('"')?c+(" "+k+'="'+g.attributes[k].trim())+'"':c+(" "+k+"='"+g.attributes[k].trim())+"'";c+=">",d(g.children),c+="</"+g.tagName+">"}}(O),c},"object"!=typeof window&&(module.exports=tXml);var inputData,totalFiles,worker=self,dataForMainThread=[],filesLoaded=0;function onXMLLoaded(request){if(4==request.readyState&&200==request.status){(new Date).getTime();!function(xml){for(var markers=xml[0].children[0],remap={marker_id:"id",linkd:"link"},i=0;i<markers.children.length;i++){var data={};markers.children[i].children.forEach(function(node){var key=node.tagName;remap[key]&&(key=remap[key]),node.attributes["data-json"]?data[key]=JSON.parse(node.children[0]):node.children.length?data[key]=node.children[0]:data[key]=""}),dataForMainThread.push(data)}}(tXml(request.responseText)),++filesLoaded>=totalFiles?worker.postMessage(dataForMainThread):loadNextFile()}}function loadNextFile(){var url=inputData.urls[filesLoaded],request=new XMLHttpRequest;request.onreadystatechange=function(){onXMLLoaded(this)},request.open("GET",inputData.protocol+url,!0),request.send()}self.addEventListener("message",function(event){var data=event.data;switch(data.command){case"load":dataForMainThread=[],filesLoaded=0,totalFiles=(inputData=data).urls.length,loadNextFile();break;default:throw new Error("Unknown command")}},!1)}}),jQuery(function($){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($){$(document).ready(function(event){var parent=document.body.onclick;parent&&(document.body.onclick=function(event){event.target instanceof WPGMZA.Marker||parent(event)})})}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&-1<navigator.vendor.indexOf("Apple")&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;WPGMZA.Circle.call(this,options,googleCircle),googleCircle?(this.googleCircle=googleCircle,options&&(options.center=WPGMZA.LatLng.fromGoogleLatLng(googleCircle.getCenter()),options.radius=googleCircle.getRadius()/1e3)):(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),this.googleFeature=this.googleCircle,options&&this.setOptions(options),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.getCenter=function(){return WPGMZA.LatLng.fromGoogleLatLng(this.googleCircle.getCenter())},WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},WPGMZA.GoogleCircle.prototype.getRadius=function(){return this.googleCircle.getRadius()/1e3},WPGMZA.GoogleCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.googleCircle.setRadius(1e3*parseFloat(radius))},WPGMZA.GoogleCircle.prototype.setVisible=function(visible){this.googleCircle.setVisible(!!visible)},WPGMZA.GoogleCircle.prototype.setDraggable=function(value){this.googleCircle.setDraggable(!!value)},WPGMZA.GoogleCircle.prototype.setEditable=function(value){var self=this;this.googleCircle.setOptions({editable:value}),value&&(google.maps.event.addListener(this.googleCircle,"center_changed",function(event){self.center=WPGMZA.LatLng.fromGoogleLatLng(self.googleCircle.getCenter()),self.trigger("change")}),google.maps.event.addListener(this.googleCircle,"radius_changed",function(event){self.radius=self.googleCircle.getRadius()/1e3,self.trigger("change")}))},WPGMZA.GoogleCircle.prototype.setOptions=function(options){WPGMZA.Circle.prototype.setOptions.apply(this,arguments),options.center&&(this.center=new WPGMZA.LatLng(options.center))},WPGMZA.GoogleCircle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),center=new WPGMZA.LatLng(this.center);googleOptions.radius*=1e3,googleOptions.center=center.toGoogleLatLng(),this.googleCircle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleDrawingManager=function(map){var self=this;WPGMZA.DrawingManager.call(this,map),this.mode=null,this.googleDrawingManager=new google.maps.drawing.DrawingManager({drawingControl:!1,polygonOptions:{editable:!0},polylineOptions:{editable:!0},circleOptions:{editable:!0},rectangleOptions:{editable:!0}}),this.googleDrawingManager.setMap(map.googleMap),google.maps.event.addListener(this.googleDrawingManager,"polygoncomplete",function(polygon){self.onPolygonClosed(polygon)}),google.maps.event.addListener(this.googleDrawingManager,"polylinecomplete",function(polyline){self.onPolylineComplete(polyline)}),google.maps.event.addListener(this.googleDrawingManager,"circlecomplete",function(circle){self.onCircleComplete(circle)}),google.maps.event.addListener(this.googleDrawingManager,"rectanglecomplete",function(rectangle){self.onRectangleComplete(rectangle)})},WPGMZA.GoogleDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.GoogleDrawingManager.prototype.constructor=WPGMZA.GoogleDrawingManager,WPGMZA.GoogleDrawingManager.prototype.setDrawingMode=function(mode){var googleMode;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:googleMode=null;break;case WPGMZA.DrawingManager.MODE_POLYGON:googleMode=google.maps.drawing.OverlayType.POLYGON;break;case WPGMZA.DrawingManager.MODE_POLYLINE:googleMode=google.maps.drawing.OverlayType.POLYLINE;break;case WPGMZA.DrawingManager.MODE_CIRCLE:googleMode=google.maps.drawing.OverlayType.CIRCLE;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:googleMode=google.maps.drawing.OverlayType.RECTANGLE;break;case WPGMZA.DrawingManager.MODE_HEATMAP:googleMode=null;break;default:throw new Error("Invalid drawing mode")}this.googleDrawingManager.setDrawingMode(googleMode)},WPGMZA.GoogleDrawingManager.prototype.setOptions=function(options){this.googleDrawingManager.setOptions({polygonOptions:options,polylineOptions:options})},WPGMZA.GoogleDrawingManager.prototype.onVertexClicked=function(event){},WPGMZA.GoogleDrawingManager.prototype.onPolygonClosed=function(googlePolygon){var event=new WPGMZA.Event("polygonclosed");event.enginePolygon=googlePolygon,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onPolylineComplete=function(googlePolyline){var event=new WPGMZA.Event("polylinecomplete");event.enginePolyline=googlePolyline,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onCircleComplete=function(googleCircle){var event=new WPGMZA.Event("circlecomplete");event.engineCircle=googleCircle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onRectangleComplete=function(googleRectangle){var event=new WPGMZA.Event("rectanglecomplete");event.engineRectangle=googleRectangle,this.dispatchEvent(event)},WPGMZA.GoogleDrawingManager.prototype.onHeatmapPointAdded=function(googleMarker){var position=WPGMZA.LatLng.fromGoogleLatLng(googleMarker.getPosition());googleMarker.setMap(null);var marker=WPGMZA.Marker.createInstance();marker.setPosition(position);var image={url:WPGMZA.imageFolderURL+"heatmap-point.png",origin:new google.maps.Point(0,0),anchor:new google.maps.Point(13,13)};marker.googleMarker.setIcon(image),this.map.addMarker(marker);var event=new WPGMZA.Event("heatmappointadded");event.position=position,this.trigger(event)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)return nativeStatus=WPGMZA.Geocoder.NO_ADDRESS,void callback(null,nativeStatus);if(options.lat&&options.lng){var latLng={lat:options.lat,lng:options.lng};callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:null}],WPGMZA.Geocoder.SUCCESS)}if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()},bounds=null;results[0].geometry.bounds&&(bounds=WPGMZA.LatLngBounds.fromGoogleLatLngBounds(results[0].geometry.bounds)),callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng,bounds:bounds}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){WPGMZA.settings.engine&&"google-maps"!=WPGMZA.settings.engine||window.google&&window.google.maps&&(WPGMZA.GoogleHTMLOverlay=function(map){this.element=$("<div class='wpgmza-google-html-overlay'></div>"),this.visible=!0,this.position=new WPGMZA.LatLng,this.setMap(map.googleMap),this.wpgmzaMap=map},WPGMZA.GoogleHTMLOverlay.prototype=new google.maps.OverlayView,WPGMZA.GoogleHTMLOverlay.prototype.onAdd=function(){this.getPanes().overlayMouseTarget.appendChild(this.element[0])},WPGMZA.GoogleHTMLOverlay.prototype.onRemove=function(){this.element&&$(this.element).parent().length&&($(this.element).remove(),this.element=null)},WPGMZA.GoogleHTMLOverlay.prototype.draw=function(){this.updateElementPosition()},WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition=function(){var projection=this.getProjection();if(projection){var pixels=projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());$(this.element).css({left:pixels.x,top:pixels.y})}})}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(feature){Parent.call(this,feature),this.setFeature(feature)},WPGMZA.GoogleInfoWindow.Z_INDEX=99,Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setFeature=function(feature){(this.feature=feature)instanceof WPGMZA.Marker?this.googleObject=feature.googleMarker:feature instanceof WPGMZA.Polygon?this.googleObject=feature.googlePolygon:feature instanceof WPGMZA.Polyline&&(this.googleObject=feature.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){var self=this;this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow,this.googleInfoWindow.setZIndex(WPGMZA.GoogleInfoWindow.Z_INDEX),google.maps.event.addListener(this.googleInfoWindow,"domready",function(event){self.trigger("domready")}),google.maps.event.addListener(this.googleInfoWindow,"closeclick",function(event){self.state!=WPGMZA.InfoWindow.STATE_CLOSED&&(self.state=WPGMZA.InfoWindow.STATE_CLOSED,self.feature.map.trigger("infowindowclose"))}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,feature){var self=this;if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setFeature(feature),this.googleInfoWindow.open(this.feature.map.googleMap,this.googleObject);var intervalID,guid=WPGMZA.guid(),eaBtn=WPGMZA.isProVersion()?"":this.addEditButton(),html="<div id='"+guid+"'>"+eaBtn+" "+this.content+"</div>";return this.googleInfoWindow.setContent(html),intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaFeature=self.feature,div.addClass("wpgmza-infowindow"),self.element=div[0],self.trigger("infowindowopen"))},50),!0},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;Parent.call(this,element,options),this.loadGoogleMap(),options?this.setOptions(options,!0):this.setOptions({},!0),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.parseThemeData=function(raw){var json;try{json=JSON.parse(raw)}catch(e){try{json=eval(raw)}catch(e){var str=raw;str=str.replace(/\\'/g,"'"),str=str.replace(/\\"/g,'"'),str=str.replace(/\\0/g,"\0"),str=str.replace(/\\\\/g,"\\");try{json=eval(str)}catch(e){return console.warn("Couldn't parse theme data"),[]}}}return json},WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),this.settings.transport_layer&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.wpgmza_show_point_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options,initializing){if(Parent.prototype.setOptions.call(this,options),options.scrollwheel&&delete options.scrollwheel,initializing){var converted=$.extend(options,this.settings.toGoogleMapsOptions()),clone=$.extend({},converted);if(!clone.center instanceof google.maps.LatLng&&(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),this.settings.hide_point_of_interest){clone.styles||(clone.styles=[]),clone.styles.push({featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]})}this.googleMap.setOptions(clone)}else this.googleMap.setOptions(options)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.addRectangle=function(rectangle){rectangle.googleRectangle.setMap(this.googleMap),Parent.prototype.addRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.removeRectangle=function(rectangle){rectangle.googleRectangle.setMap(null),Parent.prototype.removeRectangle.call(this,rectangle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(parseInt(value))},WPGMZA.GoogleMap.prototype.getBounds=function(){var nativeBounds=new WPGMZA.LatLngBounds({});try{var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest();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()}}catch(ex){}return nativeBounds},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var nativeBounds=new google.maps.LatLngBounds(southWest,northEast);this.googleMap.fitBounds(nativeBounds)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")},WPGMZA.GoogleMap.prototype.enableAllInteractions=function(){var options={scrollwheel:!0,draggable:!0,disableDoubleClickZoom:!1};this.googleMap.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toGoogleLatLng():options[name]instanceof WPGMZA.Map||"icon"==name||(settings[name]=options[name]);this.googleMarker=new google.maps.Marker(settings),(this.googleMarker.wpgmzaMarker=this).googleFeature=this.googleMarker,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.anim&&this.googleMarker.setAnimation(this.anim),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()}),self.trigger("change")}),this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,Object.defineProperty(WPGMZA.GoogleMarker.prototype,"opacity",{get:function(){return this._opacity},set:function(value){this._opacity=value,this.googleMarker.setOpacity(value)}}),WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.updateOffset=function(){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image,x=this._offset.x,y=this._offset.y;icon=icon||WPGMZA.settings.default_marker_icon,params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor_x=img.width/2,defaultAnchor_y=img.height;params.anchor=new google.maps.Point(defaultAnchor_x-x,defaultAnchor_y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(!!visible)},WPGMZA.GoogleMarker.prototype.getVisible=function(visible){return this.googleMarker.getVisible()},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)},WPGMZA.GoogleMarker.prototype.setOpacity=function(opacity){this.googleMarker.setOpacity(opacity)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){var map=this.map=WPGMZA.getMapByID(map_id);WPGMZA.ModernStoreLocator.call(this,map_id);var restrict=map.settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&restrict&&restrict.length,this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(options,googlePolygon){var self=this;options=options||{},Parent.call(this,options,googlePolygon),this.googlePolygon=googlePolygon||new google.maps.Polygon,this.googleFeature=this.googlePolygon,options&&options.polydata&&this.googlePolygon.setOptions({paths:this.parseGeometry(options.polydata)}),this.googlePolygon.wpgmzaPolygon=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.updateNativeFeature=function(){this.googlePolygon.setOptions(this.getScalarProperties())},WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){var self=this;this.googlePolygon.setOptions({editable:value}),value&&(this.googlePolygon.getPaths().forEach(function(path,index){["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})})}),google.maps.event.addListener(this.googlePolygon,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolygon,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))}))},WPGMZA.GooglePolygon.prototype.setDraggable=function(value){this.googlePolygon.setDraggable(value)},WPGMZA.GooglePolygon.prototype.getGeometry=function(){for(var result=[],path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(options,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,options,googlePolyline),this.googlePolyline=googlePolyline||new google.maps.Polyline(this.settings),this.googleFeature=this.googlePolyline,options&&options.polydata){var path=this.parseGeometry(options.polydata);this.googlePolyline.setPath(path)}this.googlePolyline.wpgmzaPolyline=this,options&&this.setOptions(options),google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.updateNativeFeature=function(){this.googlePolyline.setOptions(this.getScalarProperties())},WPGMZA.GooglePolyline.prototype.setEditable=function(value){var self=this;if(this.googlePolyline.setOptions({editable:value}),value){var path=this.googlePolyline.getPath();["insert_at","remove_at","set_at"].forEach(function(name){google.maps.event.addListener(path,name,function(){self.trigger("change")})}),google.maps.event.addListener(this.googlePolyline,"dragend",function(event){self.trigger("change")}),google.maps.event.addListener(this.googlePolyline,"click",function(event){WPGMZA.altKeyDown&&(this.getPath().removeAt(event.vertex),self.trigger("change"))})}},WPGMZA.GooglePolyline.prototype.setDraggable=function(value){this.googlePolyline.setOptions({draggable:value})},WPGMZA.GooglePolyline.prototype.getGeometry=function(){for(var result=[],path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GoogleRectangle=function(options,googleRectangle){var self=this;options=options||{},WPGMZA.Rectangle.call(this,options,googleRectangle),googleRectangle?(this.googleRectangle=googleRectangle,this.cornerA=options.cornerA=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getNorthEast().lat(),lng:googleRectangle.getBounds().getSouthWest().lng()}),this.cornerB=options.cornerB=new WPGMZA.LatLng({lat:googleRectangle.getBounds().getSouthWest().lat(),lng:googleRectangle.getBounds().getNorthEast().lng()})):(this.googleRectangle=new google.maps.Rectangle,this.googleRectangle.wpgmzaRectangle=this),this.googleFeature=this.googleRectangle,options&&this.setOptions(options),google.maps.event.addListener(this.googleRectangle,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GoogleRectangle.prototype=Object.create(WPGMZA.Rectangle.prototype),WPGMZA.GoogleRectangle.prototype.constructor=WPGMZA.GoogleRectangle,WPGMZA.GoogleRectangle.prototype.getBounds=function(){return WPGMZA.LatLngBounds.fromGoogleLatLngBounds(this.googleRectangle.getBounds())},WPGMZA.GoogleRectangle.prototype.setVisible=function(visible){this.googleRectangle.setVisible(!!visible)},WPGMZA.GoogleRectangle.prototype.setDraggable=function(value){this.googleRectangle.setDraggable(!!value)},WPGMZA.GoogleRectangle.prototype.setEditable=function(value){var self=this;this.googleRectangle.setEditable(!!value),value&&google.maps.event.addListener(this.googleRectangle,"bounds_changed",function(event){self.trigger("change")})},WPGMZA.GoogleRectangle.prototype.setOptions=function(options){WPGMZA.Rectangle.prototype.setOptions.apply(this,arguments),options.cornerA&&options.cornerB&&(this.cornerA=new WPGMZA.LatLng(options.cornerA),this.cornerB=new WPGMZA.LatLng(options.cornerB))},WPGMZA.GoogleRectangle.prototype.updateNativeFeature=function(){var googleOptions=this.getScalarProperties(),north=parseFloat(this.cornerA.lat),west=parseFloat(this.cornerA.lng),south=parseFloat(this.cornerB.lat),east=parseFloat(this.cornerB.lng);north&&west&&south&&east&&(googleOptions.bounds={north:north,west:west,south:south,east:east}),this.googleRectangle.setOptions(googleOptions)}}),jQuery(function($){WPGMZA.GoogleText=function(options){WPGMZA.Text.apply(this,arguments),this.overlay=new WPGMZA.GoogleTextOverlay(options)},WPGMZA.extend(WPGMZA.GoogleText,WPGMZA.Text)}),jQuery(function($){WPGMZA.GoogleTextOverlay=function(options){this.element=$("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>"),(options=options||{}).position&&(this.position=options.position),options.text&&this.element.find(".wpgmza-inner").text(options.text),options.map&&this.setMap(options.map.googleMap)},window.google&&google.maps&&google.maps.OverlayView&&(WPGMZA.GoogleTextOverlay.prototype=new google.maps.OverlayView),WPGMZA.GoogleTextOverlay.prototype.onAdd=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"}),this.getPanes().floatPane.appendChild(this.element[0])},WPGMZA.GoogleTextOverlay.prototype.draw=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px",minWidth:"200px"})},WPGMZA.GoogleTextOverlay.prototype.onRemove=function(){this.element.remove()},WPGMZA.GoogleTextOverlay.prototype.hide=function(){this.element.hide()},WPGMZA.GoogleTextOverlay.prototype.show=function(){this.element.show()},WPGMZA.GoogleTextOverlay.prototype.toggle=function(){this.element.is(":visible")?this.element.hide():this.element.show()}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&null!=vertex&&path.removeAt(vertex),this.close()}))}),jQuery(function($){WPGMZA.FeaturePanel=function(element,mapEditPage){var self=this;WPGMZA.EventDispatcher.apply(this,arguments),this.map=mapEditPage.map,this.drawingManager=mapEditPage.drawingManager,this.feature=null,this.element=element,this.initDefaults(),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.drawingInstructionsElement=$(this.element).find(".wpgmza-feature-drawing-instructions"),this.drawingInstructionsElement.detach(),this.editingInstructionsElement=$(this.element).find(".wpgmza-feature-editing-instructions"),this.editingInstructionsElement.detach(),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.newPanel[0],self.element[0])&&self.onTabActivated(event)}),$("#wpgmaps_tabs_markers").on("tabsactivate",function(event,ui){$.contains(ui.oldPanel[0],self.element[0])&&self.onTabDeactivated(event)}),$(document.body).on("click","[data-edit-"+this.featureType+"-id]",function(event){self.onEditFeature(event)}),$(document.body).on("click","[data-delete-"+this.featureType+"-id]",function(event){self.onDeleteFeature(event)}),$(this.element).find(".wpgmza-save-feature").on("click",function(event){self.onSave(event)}),this.drawingManager.on(self.drawingManagerCompleteEvent,function(event){self.onDrawingComplete(event)}),this.drawingManager.on("drawingmodechanged",function(event){self.onDrawingModeChanged(event)}),$(this.element).on("change input",function(event){self.onPropertyChanged(event)})},WPGMZA.extend(WPGMZA.FeaturePanel,WPGMZA.EventDispatcher),WPGMZA.FeaturePanel.MODE_ADD="add",WPGMZA.FeaturePanel.MODE_EDIT="edit",WPGMZA.FeaturePanel.prevEditableFeature=null,Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"drawingManagerCompleteEvent",{get:function(){return this.featureType+"complete"}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureDataTable",{get:function(){return $("[data-wpgmza-datatable][data-wpgmza-feature-type='"+this.featureType+"']")[0].wpgmzaDataTable}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"featureAccordion",{get:function(){return $(this.element).closest(".wpgmza-accordion")}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"map",{get:function(){return WPGMZA.mapEditPage.map}}),Object.defineProperty(WPGMZA.FeaturePanel.prototype,"mode",{get:function(){return this._mode}}),WPGMZA.FeaturePanel.prototype.initPreloader=function(){this.preloader||(this.preloader=$(WPGMZA.preloaderHTML),this.preloader.hide(),$(this.element).append(this.preloader))},WPGMZA.FeaturePanel.prototype.initDataTable=function(){var el=$(this.element).find("[data-wpgmza-datatable][data-wpgmza-rest-api-route]");this[this.featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)},WPGMZA.FeaturePanel.prototype.initDefaults=function(){$(this.element).find("[data-ajax-name]:not([type='radio'])").each(function(index,el){var val=$(el).val();val&&$(el).attr("data-default-value",val)})},WPGMZA.FeaturePanel.prototype.setCaptionType=function(type,id){var icons={add:"fa-plus-circle",save:"fa-pencil-square-o"};switch(type){case WPGMZA.FeaturePanel.MODE_ADD:case WPGMZA.FeaturePanel.MODE_EDIT:this.featureAccordion.find("[data-add-caption][data-edit-caption]").each(function(index,el){var text=$(el).attr("data-"+type+"-caption"),icon=$(el).find("i.fa");id&&(text+=" "+id),$(el).text(text),icon.length&&((icon=$("<i class='fa' aria-hidden='true'></i>")).addClass(icons[type]),$(el).prepend(" "),$(el).prepend(icon))});break;default:throw new Error("Invalid type")}},WPGMZA.FeaturePanel.prototype.setMode=function(type,id){this._mode=type,this.setCaptionType(type,id)},WPGMZA.FeaturePanel.prototype.setTargetFeature=function(feature){var self=this;if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setEditable(!1),prev.setDraggable(!1),prev.off("change")}feature?(feature.setEditable(!0),feature.setDraggable(!0),feature.on("change",function(event){self.onFeatureChanged(event)}),this.setMode(WPGMZA.FeaturePanel.MODE_EDIT),this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showInstructions()):this.setMode(WPGMZA.FeaturePanel.MODE_ADD),this.feature=WPGMZA.FeaturePanel.prevEditableFeature=feature},WPGMZA.FeaturePanel.prototype.reset=function(){$(this.element).find("[data-ajax-name]:not([data-ajax-name='map_id']):not([type='color']):not([type='checkbox']):not([type='radio'])").val(""),$(this.element).find("select[data-ajax-name]>option:first-child").prop("selected",!0),$(this.element).find("[data-ajax-name='id']").val("-1"),$(this.element).find("input[type='checkbox']").prop("checked",!1),tinyMCE.get("wpgmza-description-editor")?tinyMCE.get("wpgmza-description-editor").setContent(""):$("#wpgmza-description-editor").val(""),$("#wpgmza-description-editor").val(""),this.showPreloader(!1),this.setMode(WPGMZA.FeaturePanel.MODE_ADD),$(this.element).find("[data-ajax-name][data-default-value]").each(function(index,el){$(el).val($(el).data("default-value"))})},WPGMZA.FeaturePanel.prototype.select=function(arg){var id,expectedBaseClass,self=this;if(this.reset(),$.isNumeric(arg))id=arg;else{if(expectedBaseClass=WPGMZA[WPGMZA.capitalizeWords(this.featureType)],!(feature instanceof expectedBaseClass))throw new Error("Invalid feature type for this panel");id=arg.id}this.showPreloader(!0),WPGMZA.animateScroll($(".wpgmza_map")),WPGMZA.restAPI.call("/"+this.featureType+"s/"+id+"?skip_cache=1",{success:function(data,status,xhr){var getByIDFunction="get"+WPGMZA.capitalizeWords(self.featureType)+"ByID",feature=self.map[getByIDFunction](id);self.populate(data),self.showPreloader(!1),self.setMode(WPGMZA.FeaturePanel.MODE_EDIT,id),self.setTargetFeature(feature)}})},WPGMZA.FeaturePanel.prototype.showPreloader=function(show){this.initPreloader(),0==arguments.length||show?(this.preloader.fadeIn(),this.element.addClass("wpgmza-loading")):(this.preloader.fadeOut(),this.element.removeClass("wpgmza-loading"))},WPGMZA.FeaturePanel.prototype.populate=function(data){var value,target,name;for(name in data)switch(target=$(this.element).find("[data-ajax-name='"+name+"']"),value=data[name],(target.attr("type")||"").toLowerCase()){case"checkbox":case"radio":target.prop("checked",1==data[name]);break;case"color":value.match(/^#/)||(value="#"+value);default:"object"==typeof value&&(value=JSON.stringify(value)),$(this.element).find("[data-ajax-name='"+name+"']:not(select)").val(value),$(this.element).find("select[data-ajax-name='"+name+"']").each(function(index,el){"string"==typeof value&&0==data[name].length||$(el).val(value)})}},WPGMZA.FeaturePanel.prototype.serializeFormData=function(){var fields=$(this.element).find("[data-ajax-name]"),data={};return fields.each(function(index,el){var type="text";switch($(el).attr("type")&&(type=$(el).attr("type").toLowerCase()),type){case"checkbox":data[$(el).attr("data-ajax-name")]=$(el).prop("checked")?1:0;break;case"radio":$(el).prop("checked")&&(data[$(el).attr("data-ajax-name")]=$(el).val());break;default:data[$(el).attr("data-ajax-name")]=$(el).val()}}),data},WPGMZA.FeaturePanel.prototype.discardChanges=function(){if(this.feature){var feature=this.feature;this.setTargetFeature(null),feature&&feature.map&&(this.map["remove"+WPGMZA.capitalizeWords(this.featureType)](feature),-1<feature.id&&this.updateFeatureByID(feature.id))}},WPGMZA.FeaturePanel.prototype.updateFeatureByID=function(id){var feature,self=this,route="/"+this.featureType+"s/",functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;WPGMZA.restAPI.call(route+id,{success:function(data,status,xhr){(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature)}})},WPGMZA.FeaturePanel.prototype.showInstructions=function(){switch(this.mode){case WPGMZA.FeaturePanel.MODE_ADD:$(this.map.element).append(this.drawingInstructionsElement),$(this.drawingInstructionsElement).hide().fadeIn();break;default:$(this.map.element).append(this.editingInstructionsElement),$(this.editingInstructionsElement).hide().fadeIn()}},WPGMZA.FeaturePanel.prototype.onTabActivated=function(){this.reset(),this.drawingManager.setDrawingMode(this.featureType),this.onAddFeature(event),$(".wpgmza-table-container-title").hide(),$(".wpgmza-table-container").hide();var featureString=this.featureType.charAt(0).toUpperCase()+this.featureType.slice(1);$("#wpgmza-table-container-"+featureString).show(),$("#wpgmza-table-container-title-"+featureString).show()},WPGMZA.FeaturePanel.prototype.onTabDeactivated=function(){this.discardChanges(),this.setTargetFeature(null)},WPGMZA.FeaturePanel.prototype.onAddFeature=function(event){this.drawingManager.setDrawingMode(this.featureType)},WPGMZA.FeaturePanel.prototype.onEditFeature=function(event){var name="data-edit-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.select(id)},WPGMZA.FeaturePanel.prototype.onDeleteFeature=function(event){var self=this,name="data-delete-"+this.featureType+"-id",id=$(event.currentTarget).attr(name),route="/"+this.featureType+"s/",feature=this.map["get"+WPGMZA.capitalizeWords(this.featureType)+"ByID"](id);this.featureDataTable.dataTable.processing(!0),WPGMZA.restAPI.call(route+id,{method:"DELETE",success:function(data,status,xhr){self.map["remove"+WPGMZA.capitalizeWords(self.featureType)](feature),self.featureDataTable.reload()}})},WPGMZA.FeaturePanel.prototype.onDrawingModeChanged=function(event){$(this.drawingInstructionsElement).detach(),$(this.editingInstructionsElement).detach(),this.drawingManager.mode==this.featureType&&this.showInstructions()},WPGMZA.FeaturePanel.prototype.onDrawingComplete=function(event){var engineFeature=event["engine"+WPGMZA.capitalizeWords(this.featureType)],formData=this.serializeFormData(),geometryField=$(this.element).find("textarea[data-ajax-name$='data']");delete formData.polydata;var nativeFeature=WPGMZA[WPGMZA.capitalizeWords(this.featureType)].createInstance(formData,engineFeature);this.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.map["add"+WPGMZA.capitalizeWords(this.featureType)](nativeFeature),this.setTargetFeature(nativeFeature),geometryField.length&&geometryField.val(JSON.stringify(nativeFeature.getGeometry())),this.featureType},WPGMZA.FeaturePanel.prototype.onPropertyChanged=function(event){var feature=this.feature;feature&&($(this.element).find(":input[data-ajax-name]").each(function(index,el){var key=$(el).attr("data-ajax-name");feature[key]=$(el).val()}),feature.updateNativeFeature())},WPGMZA.FeaturePanel.prototype.onFeatureChanged=function(event){var geometryField=$(this.element).find("textarea[data-ajax-name$='data']");geometryField.length&&geometryField.val(JSON.stringify(this.feature.getGeometry()))},WPGMZA.FeaturePanel.prototype.onSave=function(event){var self=this,id=$(self.element).find("[data-ajax-name='id']").val(),data=this.serializeFormData(),route="/"+this.featureType+"s/",isNew=-1==id;"circle"!=this.featureType||data.center?"rectangle"!=this.featureType||data.cornerA?"polygon"!=this.featureType||data.polydata?"polyline"!=this.featureType||data.polydata?(isNew||(route+=id),WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0),WPGMZA.restAPI.call(route,{method:"POST",data:data,success:function(data,status,xhr){var feature,functionSuffix=WPGMZA.capitalizeWords(self.featureType),getByIDFunction="get"+functionSuffix+"ByID",removeFunction="remove"+functionSuffix,addFunction="add"+functionSuffix;self.reset(),(feature=self.map[getByIDFunction](id))&&self.map[removeFunction](feature),self.setTargetFeature(null),self.showPreloader(!1),feature=WPGMZA[WPGMZA.capitalizeWords(self.featureType)].createInstance(data),self.map[addFunction](feature),self.featureDataTable.reload(),self.onTabActivated(event)}})):alert(WPGMZA.localized_strings.no_shape_polyline):alert(WPGMZA.localized_strings.no_shape_polygon):alert(WPGMZA.localized_strings.no_shape_rectangle):alert(WPGMZA.localized_strings.no_shape_circle)}}),jQuery(function($){WPGMZA.MarkerPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.MarkerPanel,WPGMZA.FeaturePanel),WPGMZA.MarkerPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProMarkerPanel(element,mapEditPage):new WPGMZA.MarkerPanel(element,mapEditPage)},WPGMZA.MarkerPanel.prototype.initDefaults=function(){var self=this;WPGMZA.FeaturePanel.prototype.initDefaults.apply(this,arguments),this.adjustSubMode=!1,this.onTabActivated(null),$(document.body).on("click","[data-adjust-"+this.featureType+"-id]",function(event){self.onAdjustFeature(event)}),$(document.body).on("click",".wpgmza_approve_btn",function(event){self.onApproveMarker(event)})},WPGMZA.MarkerPanel.prototype.onAdjustFeature=function(event){var name="data-adjust-"+this.featureType+"-id",id=$(event.currentTarget).attr(name);this.discardChanges(),this.adjustSubMode=!0,this.select(id)},WPGMZA.MarkerPanel.prototype.onApproveMarker=function(event){var self=this,route="/"+this.featureType+"s/"+$(event.currentTarget).attr("id");WPGMZA.restAPI.call(route,{method:"POST",data:{approved:"1"},success:function(data,status,xhr){self.featureDataTable.reload()}})},WPGMZA.MarkerPanel.prototype.onFeatureChanged=function(event){if(this.adjustSubMode){var aPos=this.feature.getPosition();aPos&&($(this.element).find("[data-ajax-name='lat']").val(aPos.lat),$(this.element).find("[data-ajax-name='lng']").val(aPos.lng))}else{var addressField=$(this.element).find("input[data-ajax-name$='address']");if(addressField.length){var pos=this.feature.getPosition();addressField.val(pos.lat+","+pos.lng)}}},WPGMZA.MarkerPanel.prototype.setTargetFeature=function(feature){if(WPGMZA.FeaturePanel.prevEditableFeature){var prev=WPGMZA.FeaturePanel.prevEditableFeature;prev.setOpacity&&prev.setOpacity(1)}$(this.element).find("[data-ajax-name]").removeAttr("disabled"),$(this.element).find("fieldset").show(),$(this.element).find(".wpgmza-adjust-mode-notice").addClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","hidden"),$(this.element).find('[data-ajax-name="lng"]').attr("type","hidden"),$(this.element).find(".wpgmza-hide-in-adjust-mode").removeClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").addClass("wpgmza-hidden"),feature?(feature.setOpacity&&feature.setOpacity(.7),feature.getMap().panTo(feature.getPosition()),this.adjustSubMode&&($(this.element).find("[data-ajax-name]").attr("disabled","disabled"),$(this.element).find("fieldset:not(.wpgmza-always-on)").hide(),$(this.element).find(".wpgmza-adjust-mode-notice").removeClass("wpgmza-hidden"),$(this.element).find('[data-ajax-name="lat"]').attr("type","text").removeAttr("disabled"),$(this.element).find('[data-ajax-name="lng"]').attr("type","text").removeAttr("disabled"),$(this.element).find(".wpgmza-hide-in-adjust-mode").addClass("wpgmza-hidden"),$(this.element).find(".wpgmza-show-in-adjust-mode").removeClass("wpgmza-hidden"))):this.adjustSubMode=!1,WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments)},WPGMZA.MarkerPanel.prototype.onSave=function(event){var self=this,geocoder=WPGMZA.Geocoder.createInstance(),address=$(this.element).find("[data-ajax-name='address']").val(),geocodingData={address:address};WPGMZA.mapEditPage.drawingManager.setDrawingMode(WPGMZA.DrawingManager.MODE_NONE),this.showPreloader(!0);var cloud_lat=!1,cloud_lng=!1;0<document.getElementsByName("lat").length&&(cloud_lat=document.getElementsByName("lat")[0].value),0<document.getElementsByName("lng").length&&(cloud_lng=document.getElementsByName("lng")[0].value),cloud_lat&&cloud_lng&&(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey||(geocodingData.lat=parseFloat(cloud_lat),geocodingData.lng=parseFloat(cloud_lng)));var addressUnchanged=!1;this.feature&&this.feature.address&&address&&"string"==typeof this.feature.address&&"string"==typeof address&&this.feature.address.trim()===address.trim()&&(addressUnchanged=!0),this.adjustSubMode||addressUnchanged?WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments):geocoder.geocode(geocodingData,function(results,status){switch(status){case WPGMZA.Geocoder.ZERO_RESULTS:return alert(WPGMZA.localized_strings.zero_results),void self.showPreloader(!1);case WPGMZA.Geocoder.SUCCESS:break;case WPGMZA.Geocoder.NO_ADDRESS:return alert(WPGMZA.localized_strings.no_address),void self.showPreloader(!1);case WPGMZA.Geocoder.FAIL:default:return alert(WPGMZA.localized_strings.geocode_fail),void self.showPreloader(!1)}var result=results[0];$(self.element).find("[data-ajax-name='lat']").val(result.lat),$(self.element).find("[data-ajax-name='lng']").val(result.lng),WPGMZA.FeaturePanel.prototype.onSave.apply(self,arguments)}),WPGMZA.mapEditPage.map.resetBounds()}}),jQuery(function($){WPGMZA.CirclePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.CirclePanel,WPGMZA.FeaturePanel),WPGMZA.CirclePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProCirclePanel(element,mapEditPage):new WPGMZA.CirclePanel(element,mapEditPage)},WPGMZA.CirclePanel.prototype.updateFields=function(){$(this.element).find("[data-ajax-name='center']").val(this.feature.getCenter().toString()),$(this.element).find("[data-ajax-name='radius']").val(this.feature.getRadius())},WPGMZA.CirclePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.CirclePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.CirclePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}});var wpgmza_autoCompleteDisabled=!1;jQuery(function($){"map-edit"==WPGMZA.currentPage&&(WPGMZA.MapEditPage=function(){var self=this,element=document.body;WPGMZA.EventDispatcher.call(this),$("#wpgmaps_options fieldset").wrapInner("<div class='wpgmza-flex'></div>"),this.themePanel=new WPGMZA.ThemePanel,this.themeEditor=new WPGMZA.ThemeEditor,this.map=WPGMZA.maps[0],(!WPGMZA.pro_version||WPGMZA.Version.compare(WPGMZA.pro_version,"8.1.0")>=WPGMZA.Version.EQUAL_TO)&&(this.drawingManager=WPGMZA.DrawingManager.createInstance(this.map)),this.initDataTables(),this.initFeaturePanels(),this.initJQueryUIControls(),"en"!==WPGMZA.locale&&$("#datatable_no_result_message,#datatable_search_string").parent().parent().hide(),$("input.wpgmza-address").each(function(index,el){el.addressInput=WPGMZA.AddressInput.createInstance(el,self.map)}),$('#wpgmza-map-edit-page input[type="color"]').each(function(){$("<div class='button-secondary wpgmza-paste-color-btn' title='Paste a HEX color code'><i class='fa fa-clipboard' aria-hidden='true'></i></div>").insertAfter(this)}),jQuery("body").on("click",".wpgmza_ac_result",function(e){var index=jQuery(this).data("id"),lat=jQuery(this).data("lat"),lng=jQuery(this).data("lng"),name=jQuery("#wpgmza_item_address_"+index).html();jQuery("input[name='lat']").val(lat),jQuery("input[name='lng']").val(lng),jQuery("#wpgmza_add_address_map_editor").val(name),jQuery("#wpgmza_autocomplete_search_results").hide()}),jQuery("body").on("click",".wpgmza-paste-color-btn",function(){try{var colorBtn=$(this);if(!navigator||!navigator.clipboard||!navigator.clipboard.readText)return;navigator.clipboard.readText().then(function(textcopy){colorBtn.parent().find('input[type="color"]').val("#"+textcopy.replace("#","").trim())}).catch(function(err){console.error("WP Google Maps: Could not access clipboard",err)})}catch(c_ex){}}),jQuery("body").on("focusout","#wpgmza_add_address_map_editor",function(e){setTimeout(function(){jQuery("#wpgmza_autocomplete_search_results").fadeOut("slow")},500)});var ajaxRequest=!1,wpgmzaAjaxTimeout=!1,wpgmzaStartTyping=!1,wpgmzaKeyStrokeCount=1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0,wpgmzaTmp="",wpgmzaIdentifiedTypingSpeed=!1;$("body").on("keypress",".wpgmza-address",function(e){if("wpgmza_add_address_map_editor"==this.id){if(wpgmza_autoCompleteDisabled)return;var wpgmza_apikey=!1;if(WPGMZA_localized_data.settings.googleMapsApiKey&&""!==WPGMZA_localized_data.settings.googleMapsApiKey)return void(wpgmza_apikey=WPGMZA_localized_data.settings.googleMapsApiKey);if("Escape"===e.key||"Alt"===e.key||"Control"===e.key||"Option"===e.key||"Shift"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)return void $("#wpgmza_autocomplete_search_results").hide();if(!wpgmzaIdentifiedTypingSpeed){var d=new Date;return clearTimeout(wpgmzaTmp),wpgmzaTmp=setTimeout(function(){wpgmzaStartTyping=!1,wpgmzaAvgTimeBetweenStrokes=300,wpgmzaTotalTimeForKeyStrokes=0},1500),wpgmzaStartTyping?1==wpgmzaKeyStrokeCount||(wpgmzaCurrentTimeBetweenStrokes=d.getTime()-wpgmzaStartTyping,wpgmzaTotalTimeForKeyStrokes+=wpgmzaCurrentTimeBetweenStrokes,wpgmzaAvgTimeBetweenStrokes=wpgmzaTotalTimeForKeyStrokes/(wpgmzaKeyStrokeCount-1),wpgmzaStartTyping=d.getTime(),3<=wpgmzaKeyStrokeCount&&(wpgmzaIdentifiedTypingSpeed=wpgmzaAvgTimeBetweenStrokes)):wpgmzaStartTyping=d.getTime(),void wpgmzaKeyStrokeCount++}clearTimeout(wpgmzaAjaxTimeout),$("#wpgmza_autocomplete_search_results").html("Searching..."),$("#wpgmza_autocomplete_search_results").show();var currentSearch=jQuery(this).val();if(""!==currentSearch){!1!==ajaxRequest&&ajaxRequest.abort();var wpgmza_api_url="";wpgmza_api_url=wpgmza_apikey?"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash+"&k="+wpgmza_apikey:"https://wpgmaps.us-3.evennode.com/api/v1/autocomplete?s="+currentSearch+"&d="+window.location.hostname+"&hash="+WPGMZA_localized_data.siteHash,wpgmzaAjaxTimeout=setTimeout(function(){ajaxRequest=$.ajax({url:wpgmza_api_url,type:"GET",dataType:"json",success:function(results){try{if(void 0!==results.error)"error1"==results.error?($("#wpgmza_autoc_disabled").html(WPGMZA.localized_strings.cloud_api_key_error_1),$("#wpgmza_autoc_disabled").fadeIn("slow"),$("#wpgmza_autocomplete_search_results").hide(),wpgmza_autoCompleteDisabled=!0):console.error(results.error);else{$("#wpgmza_autocomplete_search_results").html("");var html="";for(var i in results)html+="<div class='wpgmza_ac_result "+(""===html?"":"border-top")+"' data-id='"+i+"' data-lat='"+results[i].lat+"' data-lng='"+results[i].lng+"'><div class='wpgmza_ac_container'><div class='wpgmza_ac_icon'><img src='"+results[i].icon+"' /></div><div class='wpgmza_ac_item'><span id='wpgmza_item_name_"+i+"' class='wpgmza_item_name'>"+results[i].place_name+"</span><span id='wpgmza_item_address_"+i+"' class='wpgmza_item_address'>"+results[i].formatted_address+"</span></div></div></div>";""==html&&(html="<div class='p-2 text-center'><small>No results found...</small></div>"),$("#wpgmza_autocomplete_search_results").html(html),$("#wpgmza_autocomplete_search_results").show()}}catch(exception){console.error("WP Google Maps Plugin: There was an error returning the list of places for your search")}}})},2*wpgmzaIdentifiedTypingSpeed)}else $("#wpgmza_autocomplete_search_results").hide()}}),$("#wpgmza_map_height_type").on("change",function(event){self.onMapHeightTypeChange(event)}),$("#advanced-markers .wpgmza-feature-drawing-instructions").remove(),$("[data-search-area='auto']").hide(),$(document.body).on("click","[data-wpgmza-admin-marker-datatable] input[name='mark']",function(event){self.onShiftClick(event)}),$("#wpgmza_map_type").on("change",function(event){self.onMapTypeChanged(event)}),$("body").on("click",".wpgmza_copy_shortcode",function(){var $temp=jQuery("<input>");jQuery('<span id="wpgmza_tmp" style="display:none; width:100%; text-align:center;">');jQuery("body").append($temp),$temp.val(jQuery(this).val()).select(),document.execCommand("copy"),$temp.remove(),WPGMZA.notification("Shortcode Copied")}),this.on("markerupdated",function(event){self.onMarkerUpdated(event)}),this.map&&(this.map.on("zoomchanged",function(event){self.onZoomChanged(event)}),this.map.on("boundschanged",function(event){self.onBoundsChanged(event)}),this.map.on("rightclick",function(event){self.onRightClick(event)})),$(element).on("click",".wpgmza_poly_del_btn",function(event){self.onDeletePolygon(event)}),$(element).on("click",".wpgmza_polyline_del_btn",function(event){self.onDeletePolyline(event)}),$(element).on("click",".wpgmza_dataset_del_btn",function(evevnt){self.onDeleteHeatmap(event)}),$(element).on("click",".wpgmza_circle_del_btn",function(event){self.onDeleteCircle(event)}),$(element).on("click",".wpgmza_rectangle_del_btn",function(event){self.onDeleteRectangle(event)}),$(element).on("click","#wpgmza-open-advanced-theme-data",function(event){event.preventDefault(),$(".wpgmza_theme_data_container").toggleClass("wpgmza_hidden")})},WPGMZA.extend(WPGMZA.MapEditPage,WPGMZA.EventDispatcher),WPGMZA.MapEditPage.createInstance=function(){return WPGMZA.isProVersion()&&WPGMZA.Version.compare(WPGMZA.pro_version,"8.0.0")>=WPGMZA.Version.EQUAL_TO?new WPGMZA.ProMapEditPage:new WPGMZA.MapEditPage},WPGMZA.MapEditPage.prototype.initDataTables=function(){var self=this;$("[data-wpgmza-datatable][data-wpgmza-rest-api-route]").each(function(index,el){var featureType=$(el).attr("data-wpgmza-feature-type");self[featureType+"AdminDataTable"]=new WPGMZA.AdminFeatureDataTable(el)})},WPGMZA.MapEditPage.prototype.initFeaturePanels=function(){var self=this;$(".wpgmza-feature-accordion[data-wpgmza-feature-type]").each(function(index,el){var featurePanelElement=$(el).find(".wpgmza-feature-panel-container > *"),featureType=$(el).attr("data-wpgmza-feature-type"),panelClassName=WPGMZA.capitalizeWords(featureType)+"Panel",instance=WPGMZA[panelClassName].createInstance(featurePanelElement,self);self[featureType+"Panel"]=instance})},WPGMZA.MapEditPage.prototype.initJQueryUIControls=function(){var mapContainer,self=this;$("#wpgmaps_tabs").tabs(),mapContainer=$("#wpgmza-map-container").detach(),$("#wpgmaps_tabs_markers").tabs(),$(".map_wrapper").prepend(mapContainer),$("#slider-range-max").slider({range:"max",min:1,max:21,value:$("input[name='map_start_zoom']").val(),slide:function(event,ui){$("input[name='map_start_zoom']").val(ui.value),self.map.setZoom(ui.value)}})},WPGMZA.MapEditPage.prototype.onShiftClick=function(event){var checkbox=event.currentTarget,row=jQuery(checkbox).closest("tr");if(this.lastSelectedRow&&event.shiftKey){var prevIndex=this.lastSelectedRow.index(),currIndex=row.index(),startIndex=Math.min(prevIndex,currIndex),endIndex=Math.max(prevIndex,currIndex),rows=jQuery("[data-wpgmza-admin-marker-datatable] tbody>tr");jQuery("[data-wpgmza-admin-marker-datatable] input[name='mark']").prop("checked",!1);for(var i=startIndex;i<=endIndex;i++)jQuery(rows[i]).find("input[name='mark']").prop("checked",!0)}this.lastSelectedRow=row},WPGMZA.MapEditPage.prototype.onMapTypeChanged=function(event){if("open-layers"!=WPGMZA.settings.engine){var mapTypeId;switch(event.target.value){case"2":mapTypeId=google.maps.MapTypeId.SATELLITE;break;case"3":mapTypeId=google.maps.MapTypeId.HYBRID;break;case"4":mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:mapTypeId=google.maps.MapTypeId.ROADMAP}this.map.setOptions({mapTypeId:mapTypeId})}},WPGMZA.MapEditPage.prototype.onMarkerUpdated=function(event){this.markerDataTable.reload()},WPGMZA.MapEditPage.prototype.onZoomChanged=function(event){$(".map_start_zoom").val(this.map.getZoom())},WPGMZA.MapEditPage.prototype.onBoundsChanged=function(event){var location=this.map.getCenter();$("#wpgmza_start_location").val(location.lat+","+location.lng),$("input[name='map_start_lat']").val(location.lat),$("input[name='map_start_lng']").val(location.lng),$("#wpgmza_start_zoom").val(this.map.getZoom()),$("#wpgmaps_save_reminder").show()},WPGMZA.MapEditPage.prototype.onMapHeightTypeChange=function(event){"%"==event.target.value&&$("#wpgmza_height_warning").show()},WPGMZA.MapEditPage.prototype.onRightClick=function(event){var marker,self=this;this.drawingManager&&this.drawingManager.mode!=WPGMZA.DrawingManager.MODE_MARKER||(this.rightClickMarker||(this.rightClickMarker=WPGMZA.Marker.createInstance({draggable:!0}),this.rightClickMarker.on("dragend",function(event){$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+","+event.latLng.lng)}),this.map.on("click",function(event){self.rightClickMarker.setMap(null)})),(marker=this.rightClickMarker).setPosition(event.latLng),marker.setMap(this.map),$(".wpgmza-marker-panel [data-ajax-name='address']").val(event.latLng.lat+", "+event.latLng.lng))},WPGMZA.MapEditPage.prototype.onDeletePolygon=function(event){var cur_id=parseInt($(this).attr("id")),data={action:"delete_poly",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_Path[cur_id].setMap(null),delete WPGM_PathData[cur_id],delete WPGM_Path[cur_id],$("#wpgmza_poly_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeletePolyline=function(event){var cur_id=$(this).attr("id"),data={action:"delete_polyline",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){WPGM_PathLine[cur_id].setMap(null),delete WPGM_PathLineData[cur_id],delete WPGM_PathLine[cur_id],$("#wpgmza_polyline_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteHeatmap=function(event){var cur_id=$(this).attr("id"),data={action:"delete_dataset",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,poly_id:cur_id};$.post(ajaxurl,data,function(response){heatmap[cur_id].setMap(null),delete heatmap[cur_id],$("#wpgmza_heatmap_holder").html(response)})},WPGMZA.MapEditPage.prototype.onDeleteCircle=function(event){var circle_id=$(this).attr("id"),data={action:"delete_circle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,circle_id:circle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-5 table").replaceWith(response),circle_array.forEach(function(circle){if(circle.id==circle_id)return circle.setMap(null),!1})})},WPGMZA.MapEditPage.prototype.onDeleteRectangle=function(event){var rectangle_id=$(this).attr("id"),data={action:"delete_rectangle",security:wpgmza_legacy_map_edit_page_vars.ajax_nonce,map_id:this.map.id,rectangle_id:rectangle_id};$.post(ajaxurl,data,function(response){$("#tabs-m-6 table").replaceWith(response),rectangle_array.forEach(function(rectangle){if(rectangle.id==rectangle_id)return rectangle.setMap(null),!1})})},$(document).ready(function(event){WPGMZA.mapEditPage=WPGMZA.MapEditPage.createInstance()}))}),jQuery(function($){WPGMZA.PolygonPanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolygonPanel,WPGMZA.FeaturePanel),WPGMZA.PolygonPanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolygonPanel(element,mapEditPage):new WPGMZA.PolygonPanel(element,mapEditPage)},Object.defineProperty(WPGMZA.PolygonPanel.prototype,"drawingManagerCompleteEvent",{get:function(){return"polygonclosed"}})}),jQuery(function($){WPGMZA.PolylinePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.PolylinePanel,WPGMZA.FeaturePanel),WPGMZA.PolylinePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProPolylinePanel(element,mapEditPage):new WPGMZA.PolylinePanel(element,mapEditPage)}}),jQuery(function($){WPGMZA.RectanglePanel=function(element,mapEditPage){WPGMZA.FeaturePanel.apply(this,arguments)},WPGMZA.extend(WPGMZA.RectanglePanel,WPGMZA.FeaturePanel),WPGMZA.RectanglePanel.createInstance=function(element,mapEditPage){return WPGMZA.isProVersion()?new WPGMZA.ProRectanglePanel(element,mapEditPage):new WPGMZA.RectanglePanel(element,mapEditPage)},WPGMZA.RectanglePanel.prototype.updateFields=function(){var bounds=this.feature.getBounds();bounds.north&&bounds.west&&bounds.south&&bounds.east&&($(this.element).find("[data-ajax-name='cornerA']").val(bounds.north+", "+bounds.west),$(this.element).find("[data-ajax-name='cornerB']").val(bounds.south+", "+bounds.east))},WPGMZA.RectanglePanel.prototype.setTargetFeature=function(feature){WPGMZA.FeaturePanel.prototype.setTargetFeature.apply(this,arguments),feature&&this.updateFields()},WPGMZA.RectanglePanel.prototype.onDrawingComplete=function(event){WPGMZA.FeaturePanel.prototype.onDrawingComplete.apply(this,arguments),this.updateFields()},WPGMZA.RectanglePanel.prototype.onFeatureChanged=function(event){WPGMZA.FeaturePanel.prototype.onFeatureChanged.apply(this,arguments),this.updateFields()}}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){var geom;if(Parent.call(this,options,olFeature),options=options||{},olFeature){var circle=olFeature.getGeometry(),center=ol.proj.toLonLat(circle.getCenter());geom=circle,options.center=new WPGMZA.LatLng(center[1],center[0]),options.radius=circle.getRadius()/1e3}else geom=new ol.geom.Circle(ol.proj.fromLonLat([parseFloat(options.center.lng),parseFloat(options.center.lat)]),1e3*options.radius);this.layer=new ol.layer.Vector({source:new ol.source.Vector}),this.olFeature=new ol.Feature({geometry:geom}),this.layer.getSource().addFeature(this.olFeature),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaCircle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)},WPGMZA.OLCircle.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olFeature.getGeometry().getCenter());return new WPGMZA.LatLng({lat:lonLat[1],lng:lonLat[0]})},WPGMZA.OLCircle.prototype.recreate=function(){if(this.olFeature&&(this.layer.getSource().removeFeature(this.olFeature),delete this.olFeature),this.center&&this.radius){var x,y,radius=1e3*parseFloat(this.radius);x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular([x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");this.olFeature=new ol.Feature(circle3857),this.layer.getSource().addFeature(this.olFeature)}},WPGMZA.OLCircle.prototype.setVisible=function(visible){this.layer.setVisible(!!visible)},WPGMZA.OLCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.recreate()},WPGMZA.OLCircle.prototype.getRadius=function(){return this.layer.getSource().getFeatures()[0].getGeometry().getRadius()/1e3},WPGMZA.OLCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments)},WPGMZA.OLCircle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLDrawingManager=function(map){WPGMZA.DrawingManager.call(this,map),this.source=new ol.source.Vector({wrapX:!1}),this.layer=new ol.layer.Vector({source:this.source})},WPGMZA.OLDrawingManager.prototype=Object.create(WPGMZA.DrawingManager.prototype),WPGMZA.OLDrawingManager.prototype.constructor=WPGMZA.OLDrawingManager,WPGMZA.OLDrawingManager.prototype.setOptions=function(options){var params={};options.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(options.strokeColor,options.strokeOpacity)})),options.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(options.fillColor,options.fillOpacity)})),this.layer.setStyle(new ol.style.Style(params))},WPGMZA.OLDrawingManager.prototype.setDrawingMode=function(mode){var type,endEventType,self=this;switch(WPGMZA.DrawingManager.prototype.setDrawingMode.call(this,mode),this.interaction&&(this.map.olMap.removeInteraction(this.interaction),this.interaction=null),mode){case WPGMZA.DrawingManager.MODE_NONE:case WPGMZA.DrawingManager.MODE_MARKER:return;case WPGMZA.DrawingManager.MODE_POLYGON:type="Polygon",endEventType="polygonclosed";break;case WPGMZA.DrawingManager.MODE_POLYLINE:type="LineString",endEventType="polylinecomplete";break;case WPGMZA.DrawingManager.MODE_CIRCLE:type="Circle",endEventType="circlecomplete";break;case WPGMZA.DrawingManager.MODE_RECTANGLE:type="Circle",endEventType="rectanglecomplete";break;case WPGMZA.DrawingManager.MODE_HEATMAP:return;default:throw new Error("Invalid drawing mode")}WPGMZA.mapEditPage&&WPGMZA.mapEditPage.selectInteraction&&WPGMZA.mapEditPage.map.olMap.removeInteraction(WPGMZA.mapEditPage.selectInteraction);var options={source:this.source,type:type};mode==WPGMZA.DrawingManager.MODE_RECTANGLE&&(options.geometryFunction=ol.interaction.Draw.createBox()),this.interaction=new ol.interaction.Draw(options),this.interaction.on("drawend",function(event){if(endEventType){var WPGMZAEvent=new WPGMZA.Event(endEventType);switch(mode){case WPGMZA.DrawingManager.MODE_POLYGON:WPGMZAEvent.enginePolygon=event.feature;break;case WPGMZA.DrawingManager.MODE_POLYLINE:WPGMZAEvent.enginePolyline=event.feature;break;case WPGMZA.DrawingManager.MODE_CIRCLE:WPGMZAEvent.engineCircle=event.feature;break;case WPGMZA.DrawingManager.MODE_RECTANGLE:WPGMZAEvent.engineRectangle=event.feature;break;default:throw new Error("Drawing mode not implemented")}self.dispatchEvent(WPGMZAEvent)}}),this.map.olMap.addInteraction(this.interaction)}}),jQuery(function($){WPGMZA.OLFeature=function(options){WPGMZA.assertInstangeOf(this,"OLFeature"),WPGMZA.Feature.apply(this,arguments)},WPGMZA.extend(WPGMZA.OLFeature,WPGMZA.Feature),WPGMZA.OLFeature.getOLStyle=function(options){var translated={};if(!options)return new ol.style.Style;options=$.extend({},options);var map={fillcolor:"fillColor",opacity:"fillOpacity",linecolor:"strokeColor",lineopacity:"strokeOpacity",linethickness:"strokeWeight"};for(var name in options)name in map&&(options[map[name]]=options[name]);if(options.strokeColor){var opacity=1,weight=1;"strokeOpacity"in options&&(opacity=options.strokeOpacity),"strokeWeight"in options&&(weight=options.strokeWeight),translated.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToString(options.strokeColor,opacity),width:weight})}if(options.fillColor){opacity=1;"fillOpacity"in options&&(opacity=options.fillOpacity);var color=WPGMZA.hexOpacityToString(options.fillColor,opacity);translated.fill=new ol.style.Fill({color:color})}return new ol.style.Style(translated)},WPGMZA.OLFeature.setInteractionsOnFeature=function(feature,enable){if(enable){if(feature.modifyInteraction)return;feature.snapInteraction=new ol.interaction.Snap({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.snapInteraction),feature.modifyInteraction=new ol.interaction.Modify({source:feature.layer.getSource()}),feature.map.olMap.addInteraction(feature.modifyInteraction),feature.modifyInteraction.on("modifyend",function(event){feature.trigger("change")})}else{if(!feature.modifyInteraction)return;feature.map&&(feature.map.olMap.removeInteraction(feature.snapInteraction),feature.map.olMap.removeInteraction(feature.modifyInteraction)),delete feature.snapInteraction,delete feature.modifyInteraction}}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(query,callback){WPGMZA.restAPI.call("/geocode-cache",{data:{query:JSON.stringify(query)},success:function(response,xhr,status){response.lng=response.lon,callback(response)},useCompressedPathVariable:!0})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.componentRestrictions&&options.componentRestrictions.country?data.countrycodes=options.componentRestrictions.country:options.country&&(data.countrycodes=options.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(query,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:JSON.stringify(query),response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.clearCache=function(callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_clear_nominatim_cache"},method:"POST",success:function(response){callback(response)}})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");if(WPGMZA.LatLng.REGEXP.test(options.address)){var latLng=WPGMZA.LatLng.fromString(options.address);callback([{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var finish,location;if(options.location&&(options.latLng=new WPGMZA.LatLng(options.location)),options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].bounds=new WPGMZA.LatLngBounds(new WPGMZA.LatLng({lat:response[i].boundingbox[1],lng:response[i].boundingbox[2]}),new WPGMZA.LatLng({lat:response[i].boundingbox[0],lng:response[i].boundingbox[3]})),response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}var query={location:location,options:options};this.getResponseFromCache(query,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(query,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(feature){var self=this;Parent.call(this,feature),this.element=$("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,Object.defineProperty(WPGMZA.OLInfoWindow.prototype,"isPanIntoViewAllowed",{get:function(){return!0}}),WPGMZA.OLInfoWindow.prototype.open=function(map,feature){var self=this,latLng=feature.getPosition();if(!Parent.prototype.open.call(this,map,feature))return!1;this.parent=map,this.overlay&&this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!0,insertFirst:!0}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.feature.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.setContent(this.content),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&WPGMZA.getImageDimensions(feature.getIcon(),function(size){$(self.element).css({left:Math.round(size.width/2)+"px"})}),this.trigger("infowindowopen"),this.trigger("domready")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.trigger("infowindowclose"),this.feature.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html;var eaBtn=WPGMZA.isProVersion()?"":this.addEditButton();$(this.element).html(eaBtn+"<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})},WPGMZA.OLInfoWindow.prototype.onOpen=function(){var self=this,imgs=$(this.element).find("img"),numImages=imgs.length,numImagesLoaded=0;if(WPGMZA.InfoWindow.prototype.onOpen.apply(this,arguments),this.isPanIntoViewAllowed){function inside(el,viewport){var a=$(el)[0].getBoundingClientRect(),b=$(viewport)[0].getBoundingClientRect();return a.left>=b.left&&a.left<=b.right&&a.right<=b.right&&a.right>=b.left&&a.top>=b.top&&a.top<=b.bottom&&a.bottom<=b.bottom&&a.bottom>=b.top}function panIntoView(){var offset=.45*-$(self.element).height();self.feature.map.animateNudge(0,offset,self.feature.getPosition())}imgs.each(function(index,el){el.onload=function(){++numImagesLoaded!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}),0!=numImages||inside(self.element,self.feature.map.element)||panIntoView()}}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();function isSettingDisabled(value){return"yes"===value||!!value}$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_draggable)):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_clickzoom)):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive(!isSettingDisabled(self.settings.wpgmza_settings_map_scroll))},this),"greedy"!=this.settings.wpgmza_force_greedy_gestures&&"yes"!=this.settings.wpgmza_force_greedy_gestures&&1!=this.settings.wpgmza_force_greedy_gestures&&(this.gestureOverlay=$("<div class='wpgmza-gesture-overlay'></div>"),this.gestureOverlayTimeoutID=null,WPGMZA.isTouchDevice()||(this.olMap.on("wheel",function(event){if(!ol.events.condition.platformModifierKeyOnly(event))return self.showGestureOverlay(),event.originalEvent.preventDefault(),!1}),this.gestureOverlay.text(WPGMZA.localized_strings.use_ctrl_scroll_to_zoom))),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&1==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),isSettingDisabled(WPGMZA.settings.wpgmza_settings_map_full_screen_control)||this.olMap.addControl(new ol.control.FullScreen),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("click",function(event){var features=self.olMap.getFeaturesAtPixel(event.pixel);if(features&&features.length){var marker=features[0].wpgmzaMarker;marker&&(marker.trigger("click"),marker.trigger("select"))}})),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),setTimeout(function(){self.onIdle()},10)}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged(),this._mouseoverNativeFeatures=[],this.olMap.on("pointermove",function(event){if(!event.dragging){try{var featuresUnderPixel=event.target.getFeaturesAtPixel(event.pixel)}catch(e){return}featuresUnderPixel=featuresUnderPixel||[];var i,props,nativeFeaturesUnderPixel=[];for(i=0;i<featuresUnderPixel.length;i++)(props=featuresUnderPixel[i].getProperties()).wpgmzaFeature&&(nativeFeature=props.wpgmzaFeature,nativeFeaturesUnderPixel.push(nativeFeature),-1==self._mouseoverNativeFeatures.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseover"),self._mouseoverNativeFeatures.push(nativeFeature)));for(i=self._mouseoverNativeFeatures.length-1;0<=i;i--)nativeFeature=self._mouseoverNativeFeatures[i],-1==nativeFeaturesUnderPixel.indexOf(nativeFeature)&&(nativeFeature.trigger("mouseout"),self._mouseoverNativeFeatures.splice(i,1))}}),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;if($(event.target).closest(".ol-marker").length)return;try{var featuresUnderPixel=self.olMap.getFeaturesAtPixel([event.offsetX,event.offsetY])}catch(e){return}featuresUnderPixel=featuresUnderPixel||[];var i,props,nativeFeaturesUnderPixel=[];for(i=0;i<featuresUnderPixel.length;i++)(props=featuresUnderPixel[i].getProperties()).wpgmzaFeature&&(nativeFeature=props.wpgmzaFeature,nativeFeaturesUnderPixel.push(nativeFeature),nativeFeature.trigger("click"));if(0<featuresUnderPixel.length)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}),$(this.element).trigger("wpgooglemaps_loaded"))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){var options={};return WPGMZA.settings.tile_server_url&&(options.url=WPGMZA.settings.tile_server_url,"custom_override"===WPGMZA.settings.tile_server_url&&(WPGMZA.settings.tile_server_url_override&&""!==WPGMZA.settings.tile_server_url_override.trim()?options.url=WPGMZA.settings.tile_server_url_override.trim():options.url="https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"),WPGMZA.settings.open_layers_api_key&&""!==WPGMZA.settings.open_layers_api_key&&(options.url+="?apikey="+WPGMZA.settings.open_layers_api_key.trim())),new ol.layer.Tile({source:new ol.source.OSM(options)})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var transformed=ol.proj.transform(this.olMap.getView().getCenter(),"EPSG:3857","EPSG:4326"),center={lat:transformed[1],lng:transformed[0]};-180<=center.lng&&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(options){var self=this;Parent.call(this,options);var settings={};if(options)for(var name in options)options[name]instanceof WPGMZA.LatLng?settings[name]=options[name].toLatLngLiteral():options[name]instanceof WPGMZA.Map||(settings[name]=options[name]);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);if(WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT){var img=$("<img alt=''/>")[0];img.onload=function(event){self.updateElementHeight(),self.map&&self.map.olMap.updateSize()},img.src=WPGMZA.defaultMarkerIcon,this.element=$("<div class='ol-marker'></div>")[0],this.element.appendChild(img),this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element,position:origin,positioning:"bottom-center",stopEvent:!1}),this.overlay.setPosition(origin),this.animation?this.setAnimation(this.animation):this.anim&&this.setAnimation(this.anim),options&&options.draggable&&this.setDraggable(!0),this.rebindClickListener()}else{if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)throw new Error("Invalid marker render mode");this.feature=new ol.Feature({geometry:new ol.geom.Point(origin)}),this.feature.setStyle(this.getVectorLayerStyle()),(this.feature.wpgmzaMarker=this).feature.wpgmzaFeature=this}this.setOptions(settings),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT="element",WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER="vector",WPGMZA.OLMarker.renderMode=WPGMZA.OLMarker.RENDER_MODE_HTML_ELEMENT,"open-layers"==WPGMZA.settings.engine&&WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER&&(WPGMZA.OLMarker.defaultVectorLayerStyle=new ol.style.Style({image:new ol.style.Icon({anchor:[.5,1],src:WPGMZA.defaultMarkerIcon})}),WPGMZA.OLMarker.hiddenVectorLayerStyle=new ol.style.Style({})),WPGMZA.OLMarker.prototype.getVectorLayerStyle=function(){return this.vectorLayerStyle?this.vectorLayerStyle:WPGMZA.OLMarker.defaultVectorLayerStyle},WPGMZA.OLMarker.prototype.updateElementHeight=function(height,calledOnFocus){var self=this;0!=(height=height||$(this.element).find("img").height())||calledOnFocus||$(window).one("focus",function(event){self.updateElementHeight(!1,!0)}),$(this.element).css({height:height+"px"})},WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove():console.warn("Marker labels are not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.getVisible=function(visible){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)return"none"!=this.overlay.getElement().style.display},WPGMZA.OLMarker.prototype.setVisible=function(visible){if(Parent.prototype.setVisible.call(this,visible),WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(visible){var style=this.getVectorLayerStyle();this.feature.setStyle(style)}else this.feature.setStyle(null);else this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);WPGMZA.OLMarker.renderMode==WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?this.feature.setGeometry(new ol.geom.Point(origin)):this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.updateOffset=function(x,y){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER){x=this._offset.x,y=this._offset.y;this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"}else console.warn("Marker offset is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setAnimation=function(anim){if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}else console.warn("Marker animation is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0});else console.warn("Marker dragging is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.setOpacity=function(opacity){WPGMZA.OLMarker.renderMode!=WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER?$(this.element).css({opacity:opacity}):console.warn("Marker opacity is not currently supported in Vector Layer rendering mode")},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0,this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!1)})},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset_top=parseFloat($(this.element).css("top").match(/-?\d+/)[0]),offset_left=parseFloat($(this.element).css("left").match(/-?\d+/)[0]);$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset_left,y:pixelsBeforeDrag.y+offset_top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag}),this.trigger("change"),"yes"!=this.map.settings.wpgmza_settings_map_draggable&&this.map.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan&&interaction.setActive(!0)})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,olViewportElement=$(this.map.element).children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",olViewportElement.find(".ol-layers .ol-layer:first-child").prepend(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),(WPGMZA.isProVersion()?$(".wpgmza_map[data-map-id='"+map_id+"']"):$("#wpgmza_map")).append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(options,olFeature){if(Parent.call(this,options,olFeature),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(options&&options.polydata)for(var paths=this.parseGeometry(options.polydata),i=0;i<=paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i%paths.length].lng),parseFloat(paths[i%paths.length].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getGeometry=function(){for(var coordinates=this.olFeature.getGeometry().getCoordinates()[0],result=[],i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolygon.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(options,olFeature){if(WPGMZA.Polyline.call(this,options),olFeature)this.olFeature=olFeature;else{var coordinates=[];if(options&&options.polydata)for(var path=this.parseGeometry(options.polydata),i=0;i<path.length;i++){if(!$.isNumeric(path[i].lat))throw new Error("Invalid latitude");if(!$.isNumeric(path[i].lng))throw new Error("Invalid longitude");coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]))}this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]})}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this,wpgmzaFeature:this}),options&&this.setOptions(options)},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getGeometry=function(){for(var result=[],coordinates=this.olFeature.getGeometry().getCoordinates(),i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.push(latLng)}return result},WPGMZA.OLPolyline.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){var Parent=WPGMZA.Rectangle;WPGMZA.OLRectangle=function(options,olFeature){if(Parent.apply(this,arguments),olFeature)this.olFeature=olFeature;else{var coordinates=[[]];options.cornerA&&options.cornerB&&(coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerA.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerB.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerB.lat)])),coordinates[0].push(ol.proj.fromLonLat([parseFloat(options.cornerA.lng),parseFloat(options.cornerA.lat)]))),this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaRectangle:this,wpgmzaFeature:this}),options&&this.setOptions(options)},WPGMZA.extend(WPGMZA.OLRectangle,WPGMZA.Rectangle),WPGMZA.OLRectangle.prototype.getBounds=function(){var extent=this.olFeature.getGeometry().getExtent(),topLeft=ol.extent.getTopLeft(extent),bottomRight=ol.extent.getBottomRight(extent),topLeftLonLat=ol.proj.toLonLat(topLeft),bottomRightLonLat=ol.proj.toLonLat(bottomRight),topLeftLatLng=new WPGMZA.LatLng(topLeftLonLat[1],topLeftLonLat[0]),bottomRightLatLng=new WPGMZA.LatLng(bottomRightLonLat[1],bottomRightLonLat[0]);return new WPGMZA.LatLngBounds(topLeftLatLng,bottomRightLatLng)},WPGMZA.OLRectangle.prototype.setOptions=function(options){Parent.prototype.setOptions.apply(this,arguments),"editable"in options&&WPGMZA.OLFeature.setInteractionsOnFeature(this,options.editable)}}),jQuery(function($){WPGMZA.OLText=function(){}}),jQuery(function($){WPGMZA.DataTable=function(element){var self=this;if(!$.fn.dataTable)return console.warn("The dataTables library is not loaded. Cannot create a dataTable. Did you enable 'Do not enqueue dataTables'?"),void(WPGMZA.settings.wpgmza_do_not_enqueue_datatables&&WPGMZA.getCurrentPage()==WPGMZA.PAGE_MAP_EDIT&&alert("You have selected 'Do not enqueue DataTables' in WP Google Maps' settings. No 3rd party software is loading the DataTables library. Because of this, the marker table cannot load. Please uncheck this option to use the marker table."));if($.fn.dataTable.ext)$.fn.dataTable.ext.errMode="throw";else{var version=$.fn.dataTable.version?$.fn.dataTable.version:"unknown";console.warn("You appear to be running an outdated or modified version of the dataTables library. This may cause issues with table functionality. This is usually caused by 3rd party software loading an older version of DataTables. The loaded version is "+version+", we recommend version 1.10.12 or above.")}$.fn.dataTable.Api&&$.fn.dataTable.Api.register("processing()",function(show){return this.iterator("table",function(ctx){ctx.oApi._fnProcessingDisplay(ctx,show)})}),this.element=element,(this.element.wpgmzaDataTable=this).dataTableElement=this.getDataTableElement();var settings=this.getDataTableSettings();this.phpClass=$(element).attr("data-wpgmza-php-class"),(this.wpgmzaDataTable=this).useCompressedPathVariable=WPGMZA.restAPI&&WPGMZA.restAPI.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables,this.method=this.useCompressedPathVariable?"GET":"POST",null==this.getLanguageURL()||"//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json"==this.getLanguageURL()?(this.dataTable=$(this.dataTableElement).DataTable(settings),this.dataTable.ajax.reload()):$.ajax(this.getLanguageURL(),{success:function(response,status,xhr){self.languageJSON=response,self.dataTable=$(self.dataTableElement).DataTable(settings),self.dataTable.ajax.reload()}})},WPGMZA.DataTable.prototype.getDataTableElement=function(){return $(this.element).find("table")},WPGMZA.DataTable.prototype.onAJAXRequest=function(data,settings){var params={phpClass:this.phpClass},attr=$(this.element).attr("data-wpgmza-ajax-parameters");return attr&&$.extend(params,JSON.parse(attr)),$.extend(data,params)},WPGMZA.DataTable.prototype.onDataTableAjaxRequest=function(data,callback,settings){var self=this,element=this.element,route=$(element).attr("data-wpgmza-rest-api-route"),params=this.onAJAXRequest(data,settings),draw=params.draw;if(delete params.draw,!route)throw new Error("No data-wpgmza-rest-api-route attribute specified");var options={method:"POST",useCompressedPathVariable:!0,data:params,dataType:"json",cache:!this.preventCaching,beforeSend:function(xhr){xhr.setRequestHeader("X-DataTables-Draw",draw)},success:function(response,status,xhr){response.draw=draw,self.lastResponse=response,callback(response),$("[data-marker-icon-src]").each(function(index,element){WPGMZA.MarkerIcon.createInstance($(element).attr("data-marker-icon-src")).applyToElement(element)})}};return WPGMZA.restAPI.call(route,options)},WPGMZA.DataTable.prototype.getDataTableSettings=function(){var self=this,element=this.element,options={};$(element).attr("data-wpgmza-datatable-options")&&(options=JSON.parse($(element).attr("data-wpgmza-datatable-options"))),options.deferLoading=!0,options.processing=!0,options.serverSide=!0,options.ajax=function(data,callback,settings){return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self,arguments)},WPGMZA.AdvancedTableDataTable&&this instanceof WPGMZA.AdvancedTableDataTable&&WPGMZA.settings.wpgmza_default_items&&(options.iDisplayLength=parseInt(WPGMZA.settings.wpgmza_default_items)),options.aLengthMenu=[[5,10,25,50,100,-1],["5","10","25","50","100",WPGMZA.localized_strings.all]];var languageURL=this.getLanguageURL();return languageURL&&(options.language={url:languageURL}),options},WPGMZA.DataTable.prototype.getLanguageURL=function(){if(!WPGMZA.locale)return null;var languageURL;switch(WPGMZA.locale.substr(0,2)){case"af":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Afrikaans.json";break;case"sq":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Albanian.json";break;case"am":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Amharic.json";break;case"ar":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Arabic.json";break;case"hy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Armenian.json";break;case"az":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Azerbaijan.json";break;case"bn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bangla.json";break;case"eu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Basque.json";break;case"be":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Belarusian.json";break;case"bg":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Bulgarian.json";break;case"ca":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Catalan.json";break;case"zh":languageURL="zh_TW"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Chinese-traditional.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";break;case"hr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Croatian.json";break;case"cs":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Czech.json";break;case"da":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Danish.json";break;case"nl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Dutch.json";break;case"et":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Estonian.json";break;case"fi":languageURL=WPGMZA.locale.match(/^fil/)?WPGMZA.pluginDirURL+"languages/datatables/Filipino.json":WPGMZA.pluginDirURL+"languages/datatables/Finnish.json";break;case"fr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/French.json";break;case"gl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Galician.json";break;case"ka":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Georgian.json";break;case"de":languageURL=WPGMZA.pluginDirURL+"languages/datatables/German.json";break;case"el":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Greek.json";break;case"gu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Gujarati.json";break;case"he":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hebrew.json";break;case"hi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hindi.json";break;case"hu":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Hungarian.json";break;case"is":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Icelandic.json";break;case"id":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Indonesian.json";break;case"ga":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Irish.json";break;case"it":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Italian.json";break;case"ja":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Japanese.json";break;case"kk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kazakh.json";break;case"ko":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Korean.json";break;case"ky":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Kyrgyz.json";break;case"lv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Latvian.json";break;case"lt":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Lithuanian.json";break;case"mk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Macedonian.json";break;case"ml":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Malay.json";break;case"mn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Mongolian.json";break;case"ne":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Nepali.json";break;case"nb":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Bokmal.json";break;case"nn":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Norwegian-Nynorsk.json";break;case"ps":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Pashto.json";break;case"fa":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Persian.json";break;case"pl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Polish.json";break;case"pt":languageURL="pt_BR"==WPGMZA.locale?WPGMZA.pluginDirURL+"languages/datatables/Portuguese-Brasil.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";break;case"ro":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Romanian.json";break;case"ru":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Russian.json";break;case"sr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Serbian.json";break;case"si":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Sinhala.json";break;case"sk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovak.json";break;case"sl":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Slovenian.json";break;case"es":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Spanish.json";break;case"sw":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swahili.json";break;case"sv":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Swedish.json";break;case"ta":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Tamil.json";break;case"te":languageURL=WPGMZA.pluginDirURL+"languages/datatables/telugu.json";break;case"th":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Thai.json";break;case"tr":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Turkish.json";break;case"uk":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Ukrainian.json";break;case"ur":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Urdu.json";break;case"uz":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Uzbek.json";break;case"vi":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Vietnamese.json";break;case"cy":languageURL=WPGMZA.pluginDirURL+"languages/datatables/Welsh.json"}return languageURL},WPGMZA.DataTable.prototype.onAJAXResponse=function(response){},WPGMZA.DataTable.prototype.reload=function(){this.dataTable.ajax.reload(null,!1)}}),jQuery(function($){WPGMZA.AdminFeatureDataTable=function(element){var self=this;this.allSelected=!1,WPGMZA.DataTable.call(this,element),$(element).on("click",".wpgmza.bulk_delete",function(event){self.onBulkDelete(event)}),$(element).on("click",".wpgmza.select_all_markers",function(event){self.onSelectAll(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.extend(WPGMZA.AdminFeatureDataTable,WPGMZA.DataTable),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featureType",{get:function(){return $(this.element).attr("data-wpgmza-feature-type")}}),Object.defineProperty(WPGMZA.AdminFeatureDataTable.prototype,"featurePanel",{get:function(){return WPGMZA.mapEditPage[this.featureType+"Panel"]}}),WPGMZA.AdminFeatureDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaFeatureData=meta},options},WPGMZA.AdminFeatureDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0],plural=this.featureType+"s";$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaFeatureData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/"+plural+"/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminFeatureDataTable.prototype.onSelectAll=function(event){this.allSelected=!this.allSelected;var self=this;$(this.element).find("input[name='mark']").each(function(){self.allSelected?$(this).prop("checked",!0):$(this).prop("checked",!1)})},WPGMZA.AdminFeatureDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}}),jQuery(function($){WPGMZA.AdminMapDataTable=function(element){var self=this;WPGMZA.DataTable.call(this,element),$(element).on("mousedown","button[data-action='edit']",function(event){switch(event.which){case 1:var map_id=$(event.target).attr("data-map-id");window.location.href=window.location.href+"&action=edit&map_id="+map_id;break;case 2:map_id=$(event.target).attr("data-map-id");window.open(window.location.href+"&action=edit&map_id="+map_id)}}),$(element).find(".wpgmza.select_all_maps").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete_maps").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","button[data-action='duplicate']",function(event){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"POST",data:{id:map_id,action:"duplicate"},success:function(response,status,xhr){self.reload()}})}),$(element).on("click","button[data-action='trash']",function(event){if(confirm(WPGMZA.localized_strings.map_delete_prompt_text)){var map_id=$(event.target).attr("data-map-id");WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{id:map_id},success:function(response,status,xhr){self.reload()}})}})},WPGMZA.extend(WPGMZA.AdminMapDataTable,WPGMZA.DataTable),WPGMZA.AdminMapDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMapData=meta},options},WPGMZA.AdminMapDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMapDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMapData.id)}),confirm(WPGMZA.localized_strings.map_bulk_delete_prompt_text)&&WPGMZA.restAPI.call("/maps/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},$(document).ready(function(event){$("[data-wpgmza-admin-map-datatable]").each(function(index,el){WPGMZA.AdminMapDataTable=new WPGMZA.AdminMapDataTable(el)})})}),jQuery(function($){WPGMZA.AdminMarkerDataTable=function(element){var self=this;this.preventCaching=!0,WPGMZA.DataTable.call(this,element),$(element).on("click","[data-delete-marker-id]",function(event){self.onDeleteMarker(event)}),$(element).find(".wpgmza.select_all_markers").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete").on("click",function(event){self.onBulkDelete(event)}),$(element).on("click","[data-center-marker-id]",function(event){self.onCenterMarker(event)})},WPGMZA.AdminMarkerDataTable.prototype=Object.create(WPGMZA.DataTable.prototype),WPGMZA.AdminMarkerDataTable.prototype.constructor=WPGMZA.AdminMarkerDataTable,WPGMZA.AdminMarkerDataTable.createInstance=function(element){return new WPGMZA.AdminMarkerDataTable(element)},WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMarkerData=meta},options},WPGMZA.AdminMarkerDataTable.prototype.onEditMarker=function(event){WPGMZA.animatedScroll("#wpgmaps_tabs_markers")},WPGMZA.AdminMarkerDataTable.prototype.onDeleteMarker=function(event){var self=this,id=$(event.currentTarget).attr("data-delete-marker-id"),data={action:"delete_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:id};$.post(ajaxurl,data,function(response){WPGMZA.mapEditPage.map.removeMarkerByID(id),self.reload()})},WPGMZA.AdminMarkerDataTable.prototype.onApproveMarker=function(event){var cur_id=$(this).attr("id"),data={action:"approve_marker",security:WPGMZA.legacyajaxnonce,map_id:WPGMZA.mapEditPage.map.id,marker_id:cur_id};$.post(ajaxurl,data,function(response){wpgmza_InitMap(),wpgmza_reinitialisetbl()})},WPGMZA.AdminMarkerDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMarkerData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/markers/",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},WPGMZA.AdminMarkerDataTable.prototype.onCenterMarker=function(event){var id;id=null==event.currentTarget?event:$(event.currentTarget).attr("data-center-marker-id");var marker=WPGMZA.mapEditPage.map.getMarkerByID(id);if(marker){var latLng=new WPGMZA.LatLng({lat:marker.lat,lng:marker.lng});WPGMZA.mapEditPage.map.setCenter(latLng),WPGMZA.mapEditPage.map.setZoom(6),WPGMZA.animateScroll("#wpgmaps_tabs_markers")}}});
languages/datatables/{finnish.json → Finnish.json} RENAMED
File without changes
readme.txt CHANGED
@@ -8,7 +8,7 @@ Requires PHP: 5.3
8
  Stable tag: trunk
9
  License: GPLv2
10
 
11
- The easiest to use Google maps plugin! Create a custom Google map or Store Locator with high quality markers containing categories, descriptions, images and links.
12
 
13
  == Description ==
14
 
@@ -18,7 +18,7 @@ Add a customized Google map or Store Locator to your WordPress posts and/or page
18
 
19
  While the free version of WP Google Maps allows you to create a Google map with as many markers as you like, the Pro version allows you to do so much more!
20
 
21
- Create Elementor Maps and map blocks easily with our WP Google Maps Elementor map block integration, straight out the box!
22
 
23
  The [WP Google Maps Pro Version](https://www.wpgmaps.com/purchase-professional-version/) version allows you create custom Google maps with high quality markers containing locations, descriptions, images, categories, links and directions.
24
 
@@ -222,6 +222,15 @@ Please update your WP Google Maps version to 6.3.15 to ensure you are using the
222
 
223
  == Changelog ==
224
 
 
 
 
 
 
 
 
 
 
225
  = 8.1.16 - 2021-09-20 =
226
  * Fixed issue where map editor would not initialize on some older WordPress versions
227
  * Fixed issue where admin bar scroll offset would sometimes be undefined
8
  Stable tag: trunk
9
  License: GPLv2
10
 
11
+ The easiest to use Google maps plugin! Create a custom Google map, store locator or map widget with high quality markers containing categories, descriptions, images and links.
12
 
13
  == Description ==
14
 
18
 
19
  While the free version of WP Google Maps allows you to create a Google map with as many markers as you like, the Pro version allows you to do so much more!
20
 
21
+ Create Elementor Maps, map blocks and map widgets easily with our WP Google Maps Elementor map block integration, straight out the box!
22
 
23
  The [WP Google Maps Pro Version](https://www.wpgmaps.com/purchase-professional-version/) version allows you create custom Google maps with high quality markers containing locations, descriptions, images, categories, links and directions.
24
 
222
 
223
  == Changelog ==
224
 
225
+ = 8.1.17 - 2021-10-13 =
226
+ * Improved marker editor geocode usage to only geocode when an address has changed, or is being added for the first time. (Reduced API calls due to usage)
227
+ * Fixed issue where editing a marker which has already been position adusted would trigger a geocode on the original address, moving the marker back to the original placement
228
+ * Fixed issue where map preview would not load on some elementor pages (Preview view only)
229
+ * Fixed issue where RTL sites would misplace markers in OpenLayers
230
+ * Fixed issue where StreetView icon would not show on some websites (Theme dependent)
231
+ * Fixed issue where SQL quotation mark usage for actions on marker, map, and features (trait) would cause datatable failures
232
+ * Removed uses of 'SQL_CALC_FOUND_ROWS' AND 'FOUND_ROWS' in queries to ensure MySQL 8.0.17 and above compatibility
233
+
234
  = 8.1.16 - 2021-09-20 =
235
  * Fixed issue where map editor would not initialize on some older WordPress versions
236
  * Fixed issue where admin bar scroll offset would sometimes be undefined
wpGoogleMaps.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Google Maps
4
  Plugin URI: https://www.wpgmaps.com
5
  Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
6
- Version: 8.1.16
7
  Author: WP Google Maps
8
  Author URI: https://www.wpgmaps.com
9
  Text Domain: wp-google-maps
@@ -12,6 +12,15 @@ Domain Path: /languages
12
 
13
 
14
  /*
 
 
 
 
 
 
 
 
 
15
  * 8.1.16 - 2021-09-20
16
  * Fixed issue where map editor would not initialize on some older WordPress versions
17
  * Fixed issue where admin bar scroll offset would sometimes be undefined
3
  Plugin Name: WP Google Maps
4
  Plugin URI: https://www.wpgmaps.com
5
  Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
6
+ Version: 8.1.17
7
  Author: WP Google Maps
8
  Author URI: https://www.wpgmaps.com
9
  Text Domain: wp-google-maps
12
 
13
 
14
  /*
15
+ * 8.1.17 - 2021-10-18
16
+ * Improved marker editor geocode usage to only geocode when an address has changed, or is being added for the first time. (Reduced API calls due to usage)
17
+ * Fixed issue where editing a marker which has already been position adusted would trigger a geocode on the original address, moving the marker back to the original placement
18
+ * Fixed issue where map preview would not load on some elementor pages (Preview view only)
19
+ * Fixed issue where RTL sites would misplace markers in OpenLayers
20
+ * Fixed issue where StreetView icon would not show on some websites (Theme dependent)
21
+ * Fixed issue where SQL quotation mark usage for actions on marker, map, and features (trait) would cause datatable failures
22
+ * Removed uses of 'SQL_CALC_FOUND_ROWS' AND 'FOUND_ROWS' in queries to ensure MySQL 8.0.17 and above compatibility
23
+ *
24
  * 8.1.16 - 2021-09-20
25
  * Fixed issue where map editor would not initialize on some older WordPress versions
26
  * Fixed issue where admin bar scroll offset would sometimes be undefined