customElements.get("quick-add-modal")||customElements.define("quick-add-modal",class extends ModalDialog{constructor(){super(),this.modalContent=this.querySelector('[id^="QuickAddInfo-"]')}hide(preventFocus=!1){const cartDrawer=document.querySelector("cart-drawer");cartDrawer&&cartDrawer.setActiveElement(this.openedBy),this.modalContent.innerHTML="",preventFocus&&(this.openedBy=null),super.hide()}dropdowncolor(){$(".list-choice-before").click(function(){$(".list-choice").removeClass("expanded")}),$(".list-choice-btn").click(function(e){$(this).addClass("expanded"),$(".first_label").each(function(index,item){$(this).removeClass("active_label"),$(item.children[0]).change(function(){$(this).is(":checked")&&$(".list-choice").removeClass("expanded")})}),document.querySelectorAll('.first_label input[type="radio"]:checked').forEach(function(item,index){item.parentNode.classList.add("active_label")}),$(this).hasClass("expanded")&&(e.stopPropagation(),$(document).click(function(){$(".list-choice").removeClass("expanded")}))})}show(opener){opener.setAttribute("aria-disabled",!0),opener.classList.add("loading"),opener.querySelector(".loading-overlay__spinner")&&opener.querySelector(".loading-overlay__spinner").classList.remove("hidden"),fetch(opener.getAttribute("data-product-url")).then(response=>response.text()).then(responseText=>{const responseHTML=new DOMParser().parseFromString(responseText,"text/html");this.productElement=responseHTML.querySelector('section[id^="MainProduct-"]'),this.preventDuplicatedIDs(),this.removeDOMElements(),this.setInnerHTML(this.modalContent,this.productElement.innerHTML,opener),window.Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init(),window.ProductModel&&window.ProductModel.loadShopifyXR(),this.removeGalleryListSemantic(),this.updateImageSizes(),this.preventVariantURLSwitching(),super.show(opener),this.dropdowncolor()}).finally(()=>{opener.removeAttribute("aria-disabled"),opener.classList.remove("loading"),opener.querySelector(".loading-overlay__spinner")&&opener.querySelector(".loading-overlay__spinner").classList.add("hidden");var slider=new Swiper(".quick-add-modal .js-media-list",{slidesPerView:1,autoHeight:!0,navigation:{nextEl:".swiper-btn--next",prevEl:".swiper-btn--prev"},pagination:{el:".quick-add-modal .swiper-pagination",clickable:"true",type:"bullets",renderBullet:function(activeIndex,className){return''+activeIndex+""}},on:{slideChange:function(){window.pauseAllMedia()}}})})}setInnerHTML(element,html,opener){element.innerHTML=html,element.querySelectorAll("script").forEach(oldScriptTag=>{const newScriptTag=document.createElement("script");Array.from(oldScriptTag.attributes).forEach(attribute=>{newScriptTag.setAttribute(attribute.name,attribute.value)}),newScriptTag.appendChild(document.createTextNode(oldScriptTag.innerHTML)),oldScriptTag.parentNode.replaceChild(newScriptTag,oldScriptTag)});const moreBtn=document.createElement("a");moreBtn.innerHTML=`${theme.quickviewMore}`,moreBtn.setAttribute("href",opener.getAttribute("data-product-url")),moreBtn.setAttribute("class","product__read-more button button--simple"),element.querySelector(".product__info-container").appendChild(moreBtn)}removeDOMElements(){const pickupAvailability=this.productElement.querySelector("pickup-availability");pickupAvailability&&pickupAvailability.remove();const productModal=this.productElement.querySelector("product-modal");productModal&&productModal.remove();const gift=this.productElement.querySelector(".customer");gift&&gift.remove()}preventDuplicatedIDs(){const sectionId=this.productElement.dataset.section;this.productElement.innerHTML=this.productElement.innerHTML.replaceAll(sectionId,`quickadd-${sectionId}`),this.productElement.querySelectorAll("variant-selects, variant-radios").forEach(variantSelect=>{variantSelect.dataset.originalSection=sectionId})}preventVariantURLSwitching(){this.modalContent.querySelector("variant-radios,variant-selects")&&this.modalContent.querySelector("variant-radios,variant-selects").setAttribute("data-update-url","false")}removeGalleryListSemantic(){const galleryList=this.modalContent.querySelector('[id^="Slider-Gallery"]');galleryList&&(galleryList.setAttribute("role","presentation"),galleryList.querySelectorAll('[id^="Slide-"]').forEach(li=>li.setAttribute("role","presentation")))}updateImageSizes(){const product=this.modalContent.querySelector(".product");if(!product.classList.contains("product--columns"))return;const mediaImages=product.querySelectorAll(".product__media img");if(!mediaImages.length)return;let mediaImageSizes="(min-width: 1000px) 715px, (min-width: 750px) calc((100vw - 11.5rem) / 2), calc(100vw - 4rem)";product.classList.contains("product--medium")?mediaImageSizes=mediaImageSizes.replace("715px","605px"):product.classList.contains("product--small")&&(mediaImageSizes=mediaImageSizes.replace("715px","495px")),mediaImages.forEach(img=>img.setAttribute("sizes",mediaImageSizes))}}); //# sourceMappingURL=/cdn/shop/t/5/assets/quick-add.js.map?v=30728625628072714021707847414