File: /home/dh_hwg2wc/fnaluxury.com/wp-content/themes/houzez/js/osm-properties.min.js
jQuery(function(e){"use strict";if("undefined"!=typeof houzez_map_properties){if(e("#houzez-properties-map").length>0){var a,t,i,r=houzez_vars.is_mapbox,n=houzez_vars.api_mapbox,o=[],l="",s=1,c=12,p="",u="",d=0,m=0,h=0,g="no",v="",f="roadmap",z=houzez_vars.admin_url+"admin-ajax.php",_=houzez_vars.user_id,$=houzez_vars.houzez_rtl,y=houzez_vars.processing_text,x=houzez_vars.not_found,w=houzez_vars.compare_url,b=houzez_vars.compare_add_icon,k=houzez_vars.add_compare_text,j=houzez_vars.compare_remove_icon,C=houzez_vars.remove_compare_text,P=houzez_vars.compare_limit;houzez_vars.compare_page_not_found;var M=houzez_vars.for_rent_price_slider,Z=parseInt(houzez_vars.search_min_price_range),S=parseInt(houzez_vars.search_max_price_range),O=parseInt(houzez_vars.search_min_price_range_for_rent),T=parseInt(houzez_vars.search_max_price_range_for_rent);parseInt(houzez_vars.get_min_price),parseInt(houzez_vars.get_max_price);var A=houzez_vars.currency_position,B=houzez_vars.currency_symbol,I=houzez_vars.thousands_separator,E=parseInt(houzez_vars.is_halfmap),U=parseFloat(houzez_vars.default_lat),D=parseFloat(houzez_vars.default_long),H=parseInt(houzez_vars.houzez_default_radius);if($="yes"==$,"undefined"!=typeof houzez_map_options&&(l=houzez_map_options.clusterIcon,s=houzez_map_options.map_cluster_enable,c=houzez_map_options.clusterer_zoom,p=houzez_map_options.closeIcon,u=houzez_map_options.infoWindowPlac,d=houzez_map_options.marker_spiderfier,g=houzez_map_options.markerPricePins,f=houzez_map_options.map_type,v=houzez_map_options.googlemap_style),"mapbox"==r&&""!=n)var N=L.tileLayer("https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token="+n,{attribution:'\xa9 <a href="https://www.mapbox.com/about/maps/">Mapbox</a> \xa9 <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',tileSize:512,maxZoom:18,zoomOffset:-1,id:"mapbox/streets-v11",accessToken:"YOUR_MAPBOX_ACCESS_TOKEN"});else var N=L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'});var R=e=>{if("number"!=typeof e)return e;for(var a=(e+="").split("."),t=a[0],i=a.length>1?"."+a[1]:"",r=/(\d+)(\d{3})/;r.test(t);)t=t.replace(r,"$1"+I+"$2");return t+i},q=function(e){for(++m>o.length&&(m=1);!1===o[m-1].visible;)++m>o.length&&(m=1);15>e.getZoom()&&e.setZoom(15),e.setView(o[m-1].getLatLng()),o[m-1]._icon||o[m-1].__parent.spiderfy(),e.setZoom(20),m-1==0||m-1==o.length?setTimeout(function(){o[m-1].fire("click")},500):o[m-1].fire("click")},W=function(e){for(--m<1&&(m=o.length);!1===o[m-1].visible;)--m>o.length&&(m=1);15>e.getZoom()&&e.setZoom(15),e.setView(o[m-1].getLatLng()),o[m-1]._icon||o[m-1].__parent.spiderfy(),e.setZoom(20),m-1==0||m==o.length?setTimeout(function(){o[m-1].fire("click")},500):o[m-1].fire("click")};e("#houzez-gmap-next").on("click",function(){q(t)}),e("#houzez-gmap-prev").on("click",function(){W(t)});var G=function(){for(var e=0;e<o.length;e++)t.removeLayer(o[e]);o=[],i&&t.removeLayer(i)},V=function(e){for(var a=[],t=0;t<e.length;t++)e[t].lat&&e[t].lng&&a.push([e[t].lat,e[t].lng]);return a},F=function(){var e=houzezGetCookie("houzez_compare_listings");add_to_compare(w,b,j,k,C,P,e,4),remove_from_compare(e,b,j,k,C)},K=function(e,a){var t,r=V(e);1<r.length&&a.fitBounds(r),1==s&&(i=new L.MarkerClusterGroup({iconCreateFunction:function(e){var a='<div class="houzez-osm-cluster">'+e.getAllChildMarkers().length+"</div>";return L.divIcon({html:a,className:"mycluster",iconSize:L.point(47,47)})},spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0}));for(var n=0;n<e.length;n++)if(e[n].lat&&e[n].lng){var l=e[n],c=L.latLng(l.lat,l.lng),p={riseOnHover:!0};if(l.title&&(p.title=l.title),"yes"==g){var d='<div data-id="'+e[n].property_id+'" class="gm-marker gm-marker-color-'+e[n].term_id+'"><div class="gm-marker-price">'+e[n].pricePin+"</div></div>",m=L.divIcon({className:"someclass",iconSize:new L.Point(0,0),html:d});t=1==s?new L.Marker(c,{icon:m}):L.marker(c,{icon:m}).addTo(a)}else{if(l.marker){var h={iconUrl:l.marker,iconSize:[44,56],iconAnchor:[20,57],popupAnchor:[1,-57]};l.retinaMarker&&(h.iconRetinaUrl=l.retinaMarker),p.icon=L.icon(h)}t=1==s?new L.Marker(c,p):L.marker(c,p).addTo(a)}1==s&&i.addLayer(t);var v=document.createElement("div");v.className="map-info-window";var f="";f+='<div class="item-wrap">',f+='<div class="item-header">',e[n].thumbnail?f+='<a target="'+e[n].link_target+'" href="'+e[n].url+'"><img class="img-fluid" src="'+e[n].thumbnail+'" alt="'+e[n].title+'"/></a>':f+='<a target="'+e[n].link_target+'" href="'+e[n].url+'"><img class="img-fluid" src="'+u+'" alt="'+e[n].title+'"/></a>',f+="</div>",f+='<div class="item-body flex-grow-1">',f+='<h2 class="item-title">',f+='<a target="'+e[n].link_target+'" href="'+e[n].url+'">'+e[n].title+"</a>",f+="</h2>",f+='<ul class="list-unstyled item-info">',e[n].price&&(f+='<li class="item-price">'+e[n].price+"</li>"),e[n].property_type&&(f+='<li class="item-type">'+e[n].property_type+"</li>"),f+="</ul>",f+="</div>",f+="</div>",v.innerHTML=f,t.id=l.property_id,o.push(t),t.bindPopup(v)}1==s&&a.addLayer(i)};if(houzez_map_properties.length>0){var X,Y,J=V(houzez_map_properties),Q=L.latLng(U,D);1==J.length&&(Q=L.latLng(J[0]));var ee={dragging:!0,center:Q,zoom:10,tap:!1};(t=L.map("houzez-properties-map",ee)).scrollWheelZoom.disable(),1<J.length&&t.fitBounds(J),t.addLayer(N),document.getElementById("listing-mapzoomin")&&(X=t,e("#listing-mapzoomin").on("click",function(){var e=parseInt(X.getZoom(),10);console.log(e),++e>20&&(e=20),console.log("=="+e+" ++ "),X.setZoom(e)})),document.getElementById("listing-mapzoomout")&&(Y=t,e("#listing-mapzoomout").on("click",function(){var e=parseInt(Y.getZoom(),10);console.log(e),--e<0&&(e=0),console.log("=="+e+" -- "),Y.setZoom(e)})),K(houzez_map_properties,t);var ea=function(e,a){for(var t=a.length,i=0;i<t;i++)if(a[i].id==e)return!0;return!1},et=function(e){t.eachLayer(function(a){if(void 0!==a._childCount){var t=a.getAllChildMarkers();ea(e,t)&&(a.spiderfy(),t.forEach(function(a){a.id==e&&a.openPopup()}))}else a.id==e&&a.openPopup()})},ei=function(e){t.eachLayer(function(a){if(void 0!==a._childCount){var i=a.getAllChildMarkers();ea(e,i)&&(a.unspiderfy(),i.forEach(function(t){t.id==e&&a.closePopup()}))}else a.id==e&&(a.closePopup(),t.closePopup())})},er=function(){return e("#half-map-listing-area .item-listing-wrap").each(function(a){var t=e(this).data("hz-id").replace(/[^\d.]/g,"");e(this).on("mouseenter",function(){et(t)}).on("mouseleave",function(){ei(t)})}),!1},en=!!/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);en||er()}else(t=L.map("houzez-properties-map",{center:[U,D],zoom:10})).addLayer(N),t.scrollWheelZoom.disable();var eo=function(a){var i=e("#houzez_ajax_container"),r=e(".map-wrap"),n=e("#half-map-listing-area .page-title span"),o=e(".houzez-search-form-js"),l=e("#ajax_sort_properties").val(),s=e(".listing-view").data("layout");return e.ajax({type:"GET",dataType:"json",url:z,data:o.serialize()+"&action=houzez_half_map_listings&paged="+a+"&sortby="+l+"&item_layout="+s,beforeSend:function(){e(".houzez-map-loading").show(),i.empty().append('<div id="houzez-map-loading" class="houzez-map-loading"><div class="mapPlaceholder"><div class="loader-ripple spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div></div>'),r.append('<div id="houzez-map-loading" class="houzez-map-loading"><div class="mapPlaceholder"><div class="loader-ripple spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div></div>')},success:function(a){return""!=a.query&&e('input[name="search_args"]').val(a.query),""!=a.search_uri&&e('input[name="search_URI"]').val(a.search_uri),e(".map-notfound").remove(),e(".search-no-results-found").remove(),e(".houzez-map-loading").hide(),!0===a.getProperties?(G(),K(a.properties,t),i.empty().html(a.propHtml),n.empty().html(a.total_results),eu(),houzez_init_add_favorite(z,_),houzez_init_remove_favorite(z,_),houzez_listing_lightbox(z,y,$,_),houzez_grid_image_gallery(),houzez_grid_call_to_action(),F(),e('[data-toggle="tooltip"]').tooltip(),en||er()):(G(),e("#houzez-properties-map").append('<div class="map-notfound">'+x+"</div>"),i.empty().html('<div class="search-no-results-found">'+x+"</div>"),n.empty().html(a.total_results)),!1},error:function(e,a,t){console.log(e.status),console.log(e.responseText),console.log(t)}}),!1},el=e=>{window.history.pushState({houzezTheme:!0},"",e)},es=()=>{var a=e("form.houzez-search-filters-js"),t=a.attr("action");if(void 0==t)return!0;var i=a.find(":input").filter(function(a,t){if(""!=e(t).val()&&"search_geolocation"!=e(t).attr("name")&&"search_URI"!=e(t).attr("name")&&"search_args"!=e(t).attr("name")&&"houzez_save_search_ajax"!=e(t).attr("name"))return!0}).serialize();void 0==t?t="":(t.indexOf("?"),t=t+"?"+i),el(t)},ec=function(a){G(),e(".hz-halfmap-paged").val(a),es(),eo(a)},ep=function(a,t){if(e(".price-range").slider({range:!0,min:a,max:t,values:[a,t],slide:function(a,t){if("after"==A)var i=R(t.values[0])+B,r=R(t.values[1])+B;else var i=B+R(t.values[0]),r=B+R(t.values[1]);e(".min-price-range-hidden").val(t.values[0]),e(".max-price-range-hidden").val(t.values[1]),e(".min-price-range").text(i),e(".max-price-range").text(r)},stop:function(e,a){ec(h=0)}}),"after"==A)var i=R(e(".price-range").slider("values",0))+B,r=R(e(".price-range").slider("values",1))+B;else var i=B+R(e(".price-range").slider("values",0)),r=B+R(e(".price-range").slider("values",1));e(".min-price-range").text(i),e(".max-price-range").text(r),e(".min-price-range-hidden").val(e(".price-range").slider("values",0)),e(".max-price-range-hidden").val(e(".price-range").slider("values",1))};e(".price-range").length>0&&1==E&&(e("select.status-js").val()==M?ep(O,T):ep(Z,S),e("select.status-js").on("change",function(){e(this).val()==M?ep(O,T):ep(Z,S)})),e("#radius-range-slider").length>0&&(a=H,e("#radius-range-slider").slider({value:a,min:0,max:100,step:1,value:e("#radius-range-value").data("default"),slide:function(a,t){e("#radius-range-text").html(t.value),e("#radius-range-value").val(t.value)},stop:function(a,t){e("#houzez-properties-map").length>0&&ec(h=0)}}),e("#radius-range-text").html(e("#radius-range-slider").slider("value")),e("#radius-range-value").val(e("#radius-range-slider").slider("value")));var eu=function(){return e(".houzez_ajax_pagination a").on("click",function(a){a.preventDefault(),h=e(this).data("houzepagi"),e(".hz-halfmap-paged").val(h),ec(h)}),!1};eu(),e("#ajax_sort_properties").on("change",function(){ec(h=0)}),e("select.houzez_search_ajax, input.houzez_search_ajax").on("change",function(){ec(h=0)}),e(".btn-apply, .half-map-search-js-btn, #auto_complete_ajax").on("click",function(e){e.preventDefault(),ec(h=0)})}e("#houzez-gmap-full-osm").on("click",function(){var a=e(this);a.hasClass("active")?(a.removeClass("active"),a.parents(".map-wrap").removeClass("houzez-fullscreen-map")):(a.parents(".map-wrap").addClass("houzez-fullscreen-map"),a.addClass("active")),t.invalidateSize(),t.panTo(t.getCenter())}),e("#houzez-btn-map-view").on("click",function(a){a.preventDefault(),e("#half-map-listing-area, .listing-wrap").hide(),e("#map-view-wrap").show(),t.invalidateSize(),t.panTo(t.getCenter());var i=V(houzez_map_properties);1<i.length&&t.fitBounds(i)}),e("#houzez-btn-listing-view").on("click",function(a){a.preventDefault(),e("#map-view-wrap").hide(),e("#half-map-listing-area, .listing-wrap").show()}),e("input.search_location_js").length>0&&jQuery("input.search_location_js").autocomplete({source:function(e,a){jQuery.get("https://nominatim.openstreetmap.org/search",{format:"json",q:e.term},function(e){if(!e.length){a([{value:"",label:"there are no results"}]);return}a(e.map(function(e){return{label:e.display_name,latitude:e.lat,longitude:e.lon,value:e.display_name}}))},"json")},select:function(a,t){e('input[name="lat"]').val(t.item.latitude),e('input[name="lng"]').val(t.item.longitude),E&&ec(0)}})}});