(function($){Vue.filter('currency',function(value){if(typeof value!=='number'){return value}
var formatter=new Intl.NumberFormat('en-IN',{style:'currency',currency:'USD',});return formatter.format(value)});Vue.component('product-item',{template:'#vc-component-product-item',props:{hasHoverImage:{type:Boolean,default:!1,},index:{type:Number,default:0,},listName:{type:String,default:null,},product:{type:Object,required:!0,},sizes:{type:Boolean,default:!1,},swatches:{type:Number,default:10,},},data:function(){return{inWishlist:this.product.stylecolour.inwishlist,selectedSize:'',showAltImage:!1,selectedBNPL:'Buy now, pay later',}},computed:{styleColour:function(){return this.product.stylecolour},variant:function(){return this.styleColour.variant},currency:function(){var currency=this.styleColour.variant.currency;var currencySymbol='';switch(currency){case 'GBP':currencySymbol='&pound;';break;default:currencySymbol='$';break}
return currency+' '+currencySymbol},bnplOptions:function(){var paylater=[];var paylaterObj=this.variant.payments;for(var i=0;i<paylaterObj.length;i++){paylater.push(paylaterObj[i])}
return paylater},highestBaseUnitPrice:function(){return this.getHighestAmount(Object.values(this.styleColour.variants),'baseunitprice')},highestUnitPrice:function(){return this.getHighestAmount(Object.values(this.styleColour.variants),'unitprice')},colourSwatches:function(){if(!this.styleColour.attributes||!this.styleColour.attributes.colourswatches)return[];return this.styleColour.attributes.colourswatches},maxColourSwatches:function(){var self=this;var currentSwatchIndex=0;if(!this.colourSwatches.length)return;this.colourSwatches.forEach(function(swatch,index){if(swatch.stylecolourid===self.styleColour.stylecolourid){currentSwatchIndex=index}});var currentSwatch=this.colourSwatches.splice(currentSwatchIndex,1)[0];this.colourSwatches.unshift(currentSwatch);return this.colourSwatches.slice(0,this.swatches)},image:function(){return this.styleColour.primaryimage},imageAlt:function(){if(this.styleColour.images&&this.styleColour.images.length>1&&this.showAltImage){return this.styleColour.images.filter(function(image){return!image.primary})[0]}
return!1},imageWide:function(){return this.styleColour.imageswide},gaImpressionData:function(){var additionalData={};if(this.index){additionalData.position=this.index}
if(this.listName){additionalData.list=this.listName}
return{type:'impressions',data:$.extend(this.styleColour.variant.gadata,additionalData),}},upsell:function(){return this.styleColour.variant.upsell},},methods:{addToCart:function(barcode,quantity){peppercheckout.globals.$eventbus.$emit('addproducttocart',{variantid:barcode,quantity:quantity,})},selectBNPL:function(value){this.selectedBNPL=value.value.type},getHighestAmount:function(variants,property){var highest=0;for(var i=0;i<variants.length;i++){if(variants[i].status==='disabled'){continue}
if(highest<parseFloat(variants[i][property])){highest=parseFloat(variants[i][property])}}
if(highest<=0){highest=parseFloat(variants[0][property])}
return highest.toFixed(2)},getSrcset:function(images){var srcset=[];for(width in images){srcset.push(images[width]+' '+width+'w')}
return srcset.join(', ')},toggleAltImage:function(){if(this.hasHoverImage){this.showAltImage=!this.showAltImage}},toggleWishlist:function(){var self=this;peppercheckout.globals.$eventbus.$emit('togglewishlistitem',{stylecolourid:self.styleColour.stylecolourid},this.toggleWishlistComplete)},toggleWishlistComplete:function(response){var self=this;if(response.status){self.product.stylecolour.inwishlist=!self.product.stylecolour.inwishlist}else{$.slideIn.open({url:'/login-slide-in',class:'ps-slide-in--login',})}},trackClick:function(){$(document).trigger('psevent',['productClick',this.styleColour.variant.gadata])},},});Vue.component('star-rating',{template:'#vc-component-star-rating',props:{rating:{type:Number,required:!0,},max:{type:Number,default:5,},},computed:{ratingArray:function(){return this.rating.toString().split('.')},fullStars:function(){return parseInt(this.ratingArray[0],10)},halfStars:function(){return this.ratingArray[1]?1:0},emptyStars:function(){return this.max-this.fullStars-this.halfStars},},});Vue.component('product-flag',{template:'#vc-component-product-flag',props:{flag:{type:Object,default:function(){return{}},},},computed:{flagClass:function(){if(!this.flag.text)return'';return's-flag--'+this.flag.text.replace(' ','-').toLowerCase()},style:function(){var styles={};if(this.flag.bgcolourcode){styles.backgroundColor=this.flag.bgcolourcode}
if(this.flag.colourcode){styles.color=this.flag.colourcode}
return styles},},});Vue.component('site-breadcrumbs',{template:'#vc-component-site-breadcrumbs',props:{breadcrumbs:{type:[Array,Object],default:function(){return[]},},},})}(jQuery))