(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=jQuery;var r=t.n(e);const o=lodash;function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function a(t,e){for(var r=0;r1,s={zoom:parseInt(e.zoom_level),zoomControl:e.allow_zoom,draggable:e.allow_dragging,mapTypeId:e.map_style};i||(s.center={lat:Number(a[Object.keys(a)[0]].lat),lng:Number(a[Object.keys(a)[0]].lng)});var l=new google.maps.Map(document.getElementById(t),s),c=new google.maps.InfoWindow;(0,o.forEach)(a,(function(t,o){var i=new google.maps.Marker({position:new google.maps.LatLng(t.lat,t.lng),map:l,type:t.terms});n.extend(i.position),a[o].content=t.content,e.show_infowindow&&google.maps.event.addListener(i,"click",function(t,e){return function(){c.setContent(a[e].content),c.setOptions({maxWidth:200}),c.open(l,t)}}(i,o)),r.markers[o]=i})),i&&l.fitBounds(n),e.show_clustering&&this.markerClusterer(l),this.getRoute(l)}},{key:"markerClusterer",value:function(t){new MarkerClusterer(t,this.markers,{imagePath:"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m"})}},{key:"categoryFilter",value:function(){var t=this;if(!this.categorySelector.length)return!1;this.categorySelector.on("change",(function(){var e=parseInt(t.categorySelector.val());(0,o.forEach)(t.markers,(function(n,a){isNaN(e)?t.markers[a].setVisible(!0):(0,o.isUndefined)(n.type)||-1===r().inArray(e,n.type)?t.markers[a].setVisible(!1):t.markers[a].setVisible(!0)}))}))}},{key:"initStoreLocator",value:function(){if(this.storeLocator.length){var t=new google.maps.Geocoder,e=1;r()("#rank-math-local-store-locator").on("submit",(function(o){var n=this;if(1===e){o.preventDefault();var a=r()(this).find("#rank-math-search-address").val();return t.geocode({address:a},(function(t,o){"OK"===o?(r()(n).find("#rank-math-lat").val(t[0].geometry.location.lat()),r()(n).find("#rank-math-lng").val(t[0].geometry.location.lng()),e++,r()(n).trigger("submit")):console.error("Geocode was not successful for the following reason: "+o)})),!1}}))}}},{key:"detectLocation",value:function(){var t=this;this.currentLocation.length&&navigator.geolocation&&this.currentLocation.on("click",(function(e){return e.preventDefault(),navigator.geolocation.getCurrentPosition((function(e){var r={lat:parseFloat(e.coords.latitude),lng:parseFloat(e.coords.longitude)};(new google.maps.Geocoder).geocode({location:r},(function(e,r){"OK"===r&&t.address.val(e[0].formatted_address)}))})),!1}))}},{key:"getRoute",value:function(t){var e=this;if(this.directionsWrapper.length){this.directionsWrapper.find(".rank-math-show-route").on("click",(function(t){t.preventDefault();var e=r()(this).data("toggle-text");return r()(this).data("toggle-text",r()(this).text()).text(e),r()(this).parent().toggleClass("show"),r()(this).parent().find(".rank-math-directions").html()||r()(this).parent().find("form").trigger("submit"),!1}));var o=r()(".rank-math-directions-wrapper").find("form"),n=new google.maps.DirectionsRenderer,a=new google.maps.DirectionsService;n.setMap(t),o.on("submit",(function(t){t.preventDefault();var i=r()(t.target).parent().next(".rank-math-directions"),s={origin:o.find("#rank-math-origin").val(),destination:new google.maps.LatLng(r()(t.target).find("#rank-math-lat").val(),r()(t.target).find("#rank-math-lng").val()),travelMode:"DRIVING",unitSystem:google.maps.UnitSystem.IMPERIAL};return a.route(s,(function(t,r){"OK"===r&&(n.setDirections(t),i.html(e.getDirectionsData(t)))})),!1}))}}},{key:"getDirectionsData",value:function(t){var e="",r=t.routes[0].legs[0];return e+="

"+r.start_address+"

",e+="",e+="

"+r.end_address+"

",e+="
"+t.routes[0].copyrights+"
"}}])&&a(e.prototype,n),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();google.maps.event.addDomListener(window,"load",new i)})();