1document.addEventListener("alpine:init",()=>{Alpine.data("pdpQuickAdd",()=>({productId:null,colorSizes:{},selectedColorId:null,selectedSizeId:null,quantity:1,selectedColor:null,totalPrice:"",totalSavings:"",totalSavingsFloat:0,countryTax:null,fromPrice:null,fromPriceFloat:null,fromPriceWithoutTax:null,retailPrice:null,retailPriceFormatted:null,discountPercentage:0,locale:null,currency:null,insufficientStock:!1,highlightQuantities:!1,loading:!1,toPrice:null,toSeparatedPrice:null,open:!0,addedToCart:!1,isMobile:!1,initQuickAdd(t){const e=JSON.parse(t);this.productId=e.product_id,this.colorSizes=e.color_sizes||{},this.selectedColorId=e.selected_color_id,this.selectedSizeId=e.selected_size_id,this.retailPrice=e.retail_price||0,this.locale=e.locale,this.currency=e.currency,this.countryTax=e.country_tax,this.toPrice=helpers.toPriceBy(e.locale,e.currency),this.toSeparatedPrice=helpers.toSeparatedPriceBy(e.locale,e.currency),this.updatePrice()},selectColor(t){this.selectedColorId=t;const e=this.colorSizes[t]?.sizes.filter(t=>t.size.qty>0);this.selectedSizeId=e?e.find(t=>t.size.id==this.selectedSizeId)?this.selectedSizeId:e[0]?.size?.id:null,this.setQuantity(this.quantity,!1)},selectSize(t){this.selectedSizeId=t,this.setQuantity(this.quantity,!1)},setQuantity(t,e=!0){t>=1&&(this.highlightQuantities=!1);const i=this.colorSizes[this.selectedColorId]?.sizes.find(t=>t.size.id==this.selectedSizeId)?.size.qty||0;i<t?(this.quantity=i,e&&(this.insufficientStock=!0,setTimeout(()=>{this.insufficientStock=!1},2e3))):this.quantity=parseInt(t,10),this.updatePrice()},getIntervalPrice(t,e){let i=e[0]?.price||0;for(const r of e){const{min_qty:e,max_qty:o}=r.interval;if(t>=e&&t<=o){i=r.price;break}t>o&&(i=r.price)}return i},updatePrice(){if(!this.selectedColorId||!this.selectedSizeId)return;const t=this.colorSizes[this.selectedColorId];if(!t)return;const e=t.sizes.find(t=>t.size.id==this.selectedSizeId);if(!e)return;const i=e.intervals,r=(this.quantity>0?this.quantity:1)*(e.size.case_qty||1),o=this.getIntervalPrice(r,i),s=i.reduce((t,e)=>e.price<t?e.price:t,o),c=i.reduce((t,e)=>e.price>t?e.price:t,0),a=c>0?(c-o)*r:0,l=s||0,n={totalWithTax:o*r,totalSavings:a,fromPrice:l,fromPriceWithoutTax:l-(this.countryTax?l*this.countryTax:0),retailPrice:this.retailPrice},d={};for(const[t,e]of Object.entries(n))d[t]=this.toSeparatedPrice(e);this.totalPrice="left"===d.totalWithTax.currencyPosition?`${d.totalWithTax.currencySymbol}${d.totalWithTax.formattedFloat}`:`${d.totalWithTax.formattedFloat} ${d.totalWithTax.currencySymbol}`,this.totalSavings="left"===d.totalSavings.currencyPosition?`${d.totalSavings.currencySymbol}${d.totalSavings.formattedFloat}`:`${d.totalSavings.formattedFloat} ${d.totalSavings.currencySymbol}`,this.totalSavingsFloat=a,this.fromPrice="left"===d.fromPrice.currencyPosition?`${d.fromPrice.currencySymbol}${d.fromPrice.formattedFloat}`:`${d.fromPrice.formattedFloat} ${d.fromPrice.currencySymbol}`,this.fromPriceWithoutTax="left"===d.fromPriceWithoutTax.currencyPosition?`${d.fromPriceWithoutTax.currencySymbol}${d.fromPriceWithoutTax.formattedFloat}`:`${d.fromPriceWithoutTax.formattedFloat} ${d.fromPriceWithoutTax.currencySymbol}`;const h=Number(d.fromPrice.formattedFloat);this.fromPriceFloat=h,d.retailPrice&&(this.discountPercentage=Math.round(100*(1-h/this.retailPrice)),this.retailPriceFormatted="left"===d.retailPrice.currencyPosition?`${d.retailPrice.currencySymbol}${d.retailPrice.formattedFloat}`:`${d.retailPrice.formattedFloat} ${d.retailPrice.currencySymbol}`)},addToCart(){if(isNaN(this.quantity)||this.quantity<=0)return this.highlightQuantities=!0,void setTimeout(()=>{this.highlightQuantities=!1},2e3);const t="/apparel/add_to_cart?responsive=true";this.loading=!0,Alpine.store("header").autoOpenCart=!0;const e={id:this.productId,select_color:this.selectedColorId,[`qty[${this.selectedColorId}][${this.selectedSizeId}]`]:this.quantity,is_amazon_product_cart:!1,is_bulk:!0,is_pdp:!1,is_quick_add:!0};request.post(t,{responseKind:"turbo-stream",headers:{"Content-Type":"application/x-www-form-urlencoded"},query:e}).then(function(){if(window.dispatchEvent(new CustomEvent("cart-added")),navigator.userAgent.includes("netendersAndroid")){let t=document.cookie.split("; ").find(t=>t.startsWith("cart_qty")).split("=")[1];Android.sendData(t)}}).catch(function(t){Alpine.store("header").autoOpenCart=!1,this.loading=!1,console.error("A problem happened while adding to the cart products.",t)})},handleCartAdded(){this.isMobile?(this.addedToCart=!0,setTimeout(()=>{this.open=!1,this.addedToCart=!1,this.loading=!1},2e3)):(this.open=!1,this.loading=!1)}}))});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.