(t=>{"function"==typeof define&&define.amd?define("listingFeed",t):t()})(function(){function i(t){return(i="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})(t)}window.revealDetails=function(i){i("body").on("click",".c27-display-button",function(){var t,e=i(this);e.hasClass("loading")||e.hasClass("loaded")||(t={listing_id:i(this).data("listing-id"),field_id:i(this).data("field-id")},e.addClass("loading"),i.post(CASE27.mylisting_ajax_url+"&action=display_contact_info&security="+CASE27.ajax_nonce,t,function(t){e.removeClass("loading").addClass("loaded"),t.value&&e.html(t.value)}))})},window.revealDetails(jQuery),MyListing.Listing_Feed=function(){document.querySelectorAll(".i-section.listing-feed").forEach(function(t){var e;t.dataset.inited||(t.dataset.inited=!0,e=JSON.parse(t.dataset.lfConfig),MyListing.ListingFeed=new Vue({el:t,data:{loading:!1,found_posts:null,query:e.query,pagination:e.pagination,isotope:!e.disable_isotope,max_pages:"",filters:e.filters,listing_types:e.listing_types,listing_wrap:e.listing_wrap,widget_id:e.widget_id,template:e.template},beforeMount:function(){this.jQueryReady()},methods:{getListings:MyListing.Helpers.debounce(function(t){this._getListings(t)},500),_getListings:function(){this.loading=!0;var e=this,t={listing_types:e.listing_types,filters:e.filters,listing_wrap:e.listing_wrap,query:e.query,widget_id:e.widget_id,req_type:"ajax_req",template:this.template};jQuery.ajax({url:CASE27.mylisting_ajax_url+"&action=get_listing_feed_listings&security="+CASE27.ajax_nonce,type:"GET",dataType:"json",data:t,success:function(t){"dev"===CASE27.env&&console.log(t),"object"===i(t)&&(e.loading=!1,e.max_pages=t.max_num_pages,e.updateView(t))}})},updateView:function(t){this.found_posts=t.found_posts;var e,i=this.$el.querySelector(".c27-explore-pagination"),i=(i&&(jQuery(i).html(t.pagination),jQuery(".c27-explore-pagination a",i).each(function(){jQuery(this).data("page")})),this.$el.querySelector(".section-body .results-wrapper"));i&&("pages"===this.pagination.type||"prev-next"===this.pagination.type?jQuery(i).html(t.html):jQuery(i).append(t.html),MyListing.BackgroundCarousel()),parseInt(this.filters.page)+1>=parseInt(this.max_pages)?(jQuery(this.$el).find(".load-more-listings").remove(),jQuery(this.$el).find(".prev-next-pagination .next").addClass("disabled")):jQuery(this.$el).find(".prev-next-pagination .next").removeClass("disabled"),this.isotope&&(i={transitionDuration:0},jQuery("body").hasClass("rtl")&&(i.originLeft=!1),e=jQuery(".grid",this.$el).isotope(i),setTimeout(function(){e.isotope("reloadItems").isotope()},10))},getNextPage:function(t){"A"!==t.target.nodeName||t.target.classList.contains("disabled")||(this.filters.page+=1,this.scrollToWidgetTop(),this._getListings())},getPrevPage:function(t){"A"!==t.target.nodeName||t.target.classList.contains("disabled")||(--this.filters.page,this.scrollToWidgetTop(),this._getListings())},loadMore:function(t){t.preventDefault(),this.filters.page?this.filters.page++:this.filters.page=1,this._getListings(),MyListing.BackgroundCarousel()},jQueryReady:function(){var i=this;jQuery(function(e){e(i.$el).on("click",".c27-explore-pagination a",function(t){t.preventDefault();t=parseInt(e(this).data("page"),10)-1;i.filters.page=t,i.scrollToWidgetTop(),i._getListings()})})},scrollToWidgetTop:function(){var t=jQuery(window).width()<=768?100:200;jQuery("html, body").animate({scrollTop:jQuery(this.$el).offset().top-t},500)}}}))})},MyListing.Listing_Feed()});
