PageSourceSearch

https://xyxxcrew.com/cdn/shop/t/628/assets/bundle-set.js?v=96373923647334291121785829838

js xyxxcrew.com collected 2026-10-02 18:47:21 UTC 7,424 bytes, 2 lines download raw bytes

1document.addEventListener("click",e=>{const trigger=e.target.closest("[js-size_guide_popup_bundle]");if(trigger){e.preventDefault();const type=trigger.dataset.type,popup2=document.getElementById(`${type}-size_guide_popup_open`);popup2&&(popup2.classList.add("active"),popup2.style.display="block");return}if(e.target.closest(".closeBtn-pro")){const popup2=e.target.closest(".popup-pro");popup2&&(popup2.classList.remove("active"),popup2.style.display="none");return}document.querySelectorAll(".popup-pro.active").forEach(popup2=>{popup2.contains(e.target)||(popup2.classList.remove("active"),popup2.style.display="none")});const tab=e.target.closest(".popup_size_guide_tab_title_1_new, .popup_size_guide_tab_title_2_new");if(!tab)return;e.preventDefault();const popup=tab.closest(".popup-pro");popup&&(popup.querySelectorAll("ul li a").forEach(el=>{el.classList.remove("active")}),popup.querySelectorAll(".popup_size_guide_tab_details_in_new").forEach(el=>{el.style.display="none"}),tab.classList.add("active"),tab.classList.contains("popup_size_guide_tab_title_1_new")?popup.querySelector(".popup_size_guide_tab_1_new").style.display="block":popup.querySelector(".popup_size_guide_tab_2_new").style.display="block")}),(function(){if(window.BundleSet)return;const STRINGS=Object.assign({selectVariants:"Please select variants",addToCart:"Add to Cart",soldOut:"Sold out",sale:"Sale",genericError:"Unable to add items to your cart. Please try again."},window.bundleSetStrings||{});class BundleSet{constructor(root){this.root=root,this.state={top:null,bottom:null},this.variantData={top:this.parseVariantJSON("top"),bottom:this.parseVariantJSON("bottom")},this.button=root.querySelector("[data-bundle-add-to-cart]"),this.buttonText=root.querySelector("[data-bundle-button-text]"),this.errorEl=root.querySelector("[data-bundle-error]"),this.topTitleEl=root.querySelector("[data-bundle-top-title]"),this.bottomTitleEl=root.querySelector("[data-bundle-bottom-title]"),this.onChange=this.onChange.bind(this),this.onSubmit=this.onSubmit.bind(this),this.bindEvents(),this.variantData.top.length&&this.initSelection("top"),this.variantData.bottom.length&&this.initSelection("bottom")}parseVariantJSON(type){const el=this.root.querySelector(`[data-bundle-variant-json="${type}"]`);if(!el)return[];try{return JSON.parse(el.textContent)}catch(error){return console.error(`Bundle Set: could not parse variant JSON for "${type}"`,error),[]}}bindEvents(){this.root.addEventListener("change",this.onChange),this.button&&this.button.addEventListener("click",this.onSubmit)}initSelection(type){let checked=this.root.querySelector(`input[name="${type}Size"]:checked`);checked||(checked=this.root.querySelector(`input[name="${type}Size"]:not(:disabled)`),checked&&(checked.checked=!0)),checked&&this.applySelection(type,checked),this.updateValidation()}onChange(event){const target=event.target;!target||target.tagName!=="INPUT"||(target.name==="topSize"&&this.applySelection("top",target),target.name==="bottomSize"&&this.applySelection("bottom",target))}getVariant(type,id){return this.variantData[type].find(variant=>`${variant.id}`==`${id}`)}applySelection(type,input){const variant=this.getVariant(type,input.dataset.bundleId);variant&&(this.state[type]=variant.available?variant:null,this.updateTitle(type,input),this.updatePrice(type,variant),this.updateValidation(),this.hideError())}updateTitle(type,input){const el=type==="top"?this.topTitleEl:this.bottomTitleEl;if(!el)return;const label=this.root.querySelector(`label[for="${input.id}"]`);el.textContent=label?label.getAttribute("data-meta-label"):input.getAttribute("data-meta-size")}updatePrice(type,variant){const wrapper=this.root.querySelector(`[data-bundle-price="${type}"]`);if(!wrapper||!variant)return;const priceEl=wrapper.querySelector("[data-bundle-price-regular]"),compareEl=wrapper.querySelector("[data-bundle-price-compare]"),badgeEl=wrapper.querySelector("[data-bundle-badge]");priceEl&&(priceEl.textContent=variant.price_formatted);const onSale=variant.compare_at_price&&variant.compare_at_price>variant.price;compareEl&&(onSale?(compareEl.textContent=variant.compare_at_price_formatted,compareEl.hidden=!1):compareEl.hidden=!0),badgeEl&&(variant.available?onSale?(badgeEl.textContent=STRINGS.sale,badgeEl.hidden=!1):(badgeEl.hidden=!0,badgeEl.textContent=""):(badgeEl.textContent=STRINGS.soldOut,badgeEl.hidden=!1))}updateValidation(){if(!this.button)return;const hasTopProduct=this.variantData.top.length>0,hasBottomProduct=this.variantData.bottom.length>
10,ready=(!hasTopProduct||this.state.top)&&(!hasBottomProduct||this.state.bottom);this.button.disabled=!1,ready?this.button.removeAttribute("aria-disabled"):this.button.setAttribute("aria-disabled","true"),this.buttonText&&(this.buttonText.textContent=STRINGS.addToCart)}async onSubmit(event){if(event.preventDefault(),this.button.getAttribute("aria-disabled")==="true")return;const hasTopProduct=this.variantData.top.length>0,hasBottomProduct=this.variantData.bottom.length>0;if(hasTopProduct&&!this.state.top||hasBottomProduct&&!this.state.bottom)return;this.button.setAttribute("aria-disabled","true"),this.setLoading(!0),this.hideError();const items=[];if(this.state.top&&items.push({id:this.state.top.id,quantity:1}),this.state.bottom&&items.push({id:this.state.bottom.id,quantity:1}),!items.length){this.showError("Please select a variant.");return}try{await this.addToCart(items)}catch(error){this.showError(error.message||STRINGS.genericError)}finally{this.setLoading(!1),this.updateValidation()}}async addToCart(items){const cart=document.querySelector("cart-drawer")||document.querySelector("cart-notification"),config=fetchConfig("javascript");config.body=JSON.stringify({items,sections:cart?cart.getSectionsToRender().map(section=>section.id):void 0,sections_url:window.location.pathname}),cart&&cart.setActiveElement(document.activeElement);const result=await(await fetch(routes.cart_add_url,config)).json();if(result.status)throw publish(PUB_SUB_EVENTS.cartError,{source:"bundle-set",productVariantId:items[0]?.id,errors:result.errors||result.description,message:result.message}),new Error(result.description||result.message);if(!cart){window.location=routes.cart_url;return}const startMarker=CartPerformance.createStartingMarker("bundle:wait-for-subscribers");publish(PUB_SUB_EVENTS.cartUpdate,{source:"bundle-set",cartData:result}).then(()=>{CartPerformance.measureFromMarker("bundle:wait-for-subscribers",startMarker)}),cart.classList.contains("is-empty")&&cart.classList.remove("is-empty"),CartPerformance.measure("bundle:paint-updated-sections",()=>{cart.renderContents(result)})}setLoading(isLoading){this.button&&(this.button.classList.toggle("loading",isLoading),this.button.disabled=isLoading?!0:this.button.disabled,this.button.setAttribute("aria-busy",String(isLoading)))}showError(message){this.errorEl&&(this.errorEl.textContent=message,this.errorEl.hidden=!1)}hideError(){this.errorEl&&(this.errorEl.hidden=!0,this.errorEl.textContent="")}}function init(scope){(scope||document).querySelectorAll("[data-bundle-set]").forEach(root=>{root.bundleSetInstance||(root.bundleSetInstance=new BundleSet(root))})}document.addEventListener("DOMContentLoaded",()=>init()),document.addEventListener("quick-add:load",event=>init(event.target)),window.BundleSet=BundleSet,window.initBundleSet=init})();
2//# sourceMappingURL=/cdn/shop/t/628/assets/bundle-set.js.map?v=96373923647334291121785829838

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.