(function($){var vcPopupLeisureClub={template:'#vc-component-popup-leisure-club',data:function(){return{fields:{email:'',},success:'',error:'',errors:{},}},methods:{redirect:function(){window.location.href='/'},submit:function(){var self=this;this.error='';$.ajax({url:'/api-customer/apicustomersignup',method:'post',data:$.extend(this.fields,{location:'gate',csrftoken:this.$store.state.category.csrftoken.gate,}),}).then(function(response){if(response.success){$.setCookie('categorygateunlocked',1,30);$.setCookie('show_bp_welcome',1,-1);window.location.reload()}else{self.error=response.message}})},updatePopupOffset:function(){var offset=$('.j-site-header')[0].getBoundingClientRect().bottom;$(this.$refs.popup.$el).css('top',offset)},},mounted:function(){this.updatePopupOffset();$(window).on('resize.leisure scroll.leisure',$.throttle(this.updatePopupOffset,10))},destroyed:function(){$(window).off('.leisure')},};new Vue({el:'#v-category',name:'Category',store:peppercheckout.cart.$store,mixins:[PsCategory.mixins.base],components:{'popup-leisure-club':vcPopupLeisureClub,},data:function(){return{customFilters:{BRAND:{limit:4,visible:!1,},},isFiltersActive:!1,isSortActive:!1,layout:3,popups:{leisureClub:!1,},}},computed:{allPersonalisedBrands:function(){if(!this.$store.state.category.customfilters)return{};return this.$store.state.category.customfilters.BRAND},personalisedBrands:function(){if(this.customFilters.BRAND.limit===-1)return this.allPersonalisedBrands;var brandNames=Object.keys(this.allPersonalisedBrands);var brands={};var max=Math.min(this.customFilters.BRAND.limit,brandNames.length);for(var i=0;i<max;i++){brands[brandNames[i]]=this.allPersonalisedBrands[brandNames[i]]}
return brands},list:function(){return this.$store.state.category.list},showGate:function(){return this.$store.state.category.showgate},},methods:{initGate:function(){if(this.showGate){$('body').addClass('is-unscrollable');$('.j-category').addClass('is-locked');this.popups.leisureClub=!0}},isActiveFilter:function(attribute,name){if(!this.activeFilters[attribute])return!1;return Object.keys(this.activeFilters[attribute]).indexOf(name)>-1},toggleFiltersState:function(toggle){this.isFiltersActive=toggle},toggleSortState:function(toggle){this.isSortActive=toggle},toggleLayout:function(layout){this.layout=layout},updateCustomFilterLimit:function(filter,limit){this.customFilters[filter].limit=limit},toggleCustomFilter:function(filter){this.customFilters[filter].visible=!this.customFilters[filter].visible},},mounted:function(){this.initGate()},})}(jQuery))