1window.Eurus.loadedScript.has("preview-color-swatches.js")||(window.Eurus.loadedScript.add("preview-color-swatches.js"),requestAnimationFrame(()=>{document.addEventListener("alpine:init",()=>{Alpine.data("xProductCard",(sectionId,productUrl,productId)=>({currentVariantCard:"",options:[],isSelect:!1,productId,showOptions:!1,init(){document.addEventListener(`eurus:product-card-variant-select:updated:${sectionId}`,e=>{this.checkVariantSelected(),this.currentVariantCard=e.detail.currentVariant,this.options=e.detail.options})},checkVariantSelected(){[...document.querySelectorAll(`#variant-update-${sectionId} fieldset`)].findIndex(item=>!item.querySelector("input:checked"))=="-1"&&(this.isSelect=!0)}})),Alpine.data("xDoubleTouch",productUrl=>({lastTapTime:0,DOUBLE_TAP_DELAY:300,singleTapTimeout:null,touchStartX:0,touchStartY:0,touchMoved:!1,MAX_MOVE_THRESHOLD:10,showSecond:!1,onTouchStart(event){const touch=event.touches[0];this.touchStartX=touch.clientX,this.touchStartY=touch.clientY,this.touchMoved=!1},onTouchMove(event){const touch=event.touches[0],deltaX=Math.abs(touch.clientX-this.touchStartX),deltaY=Math.abs(touch.clientY-this.touchStartY);(deltaX>this.MAX_MOVE_THRESHOLD||deltaY>this.MAX_MOVE_THRESHOLD)&&(this.touchMoved=!0)},onTouchEnd(splide,carousel){if(this.touchMoved)return;const currentTime=new Date().getTime(),tapLength=currentTime-this.lastTapTime;tapLength<this.DOUBLE_TAP_DELAY&&tapLength>0?(clearTimeout(this.singleTapTimeout),this.lastTapTime=0,this.onDoubleTap(splide,carousel)):(this.lastTapTime=currentTime,this.singleTapTimeout=setTimeout(()=>{this.onSingleTap()},this.DOUBLE_TAP_DELAY))},onSingleTap(){window.location.href=productUrl},onDoubleTap(splide,carousel){carousel?Alpine.store("xSplide").togglePlayPause(splide):this.showSecond=!this.showSecond}})),Alpine.store("xPreviewColorSwatch",{onChangeVariant(el,productUrl,src,variantId,sectionId,isColor=!1){setTimeout(()=>{if(document.addEventListener(`eurus:product-card-variant-select:updated:${sectionId}`,e=>{e.detail.currentVariant==null&&this.updateImage(el,productUrl,src,variantId,sectionId)}),!isColor){let productVariants="";if(document.dispatchEvent(new CustomEvent(`eurus:product-variant-get:${sectionId}`,{detail:{callback:variants=>{productVariants=variants}}})),productVariants){let variantSrc=productVariants.reduce((acc,variant)=>(variant.featured_image&&(acc[variant.id]=variant.featured_image.src),acc),{});const swatchesContainer=el.closest(".options-container");if(swatchesContainer){const swatches=swatchesContainer.querySelectorAll("label.color-watches"),inputs=swatchesContainer.querySelectorAll("input:checked");let selectedOption=[];inputs.forEach(input=>{[...swatches].some(swatch=>swatch.dataset.optionvalue===input.value)||selectedOption.push(input.value.replace(/\\u003c/g,"<").replace(/\\u003e/g,">"))});let imageSrc=productVariants.filter(variant=>selectedOption.every(option=>variant.options.includes(option))).reduce((acc,variant)=>(swatches.forEach(swatch=>{variant.options.includes(swatch.getAttribute("data-optionvalue"))&&(acc[swatch.getAttribute("data-optionvalue")]=`url(${variantSrc[variant.id]?variantSrc[variant.id]:src})`)}),acc),{});swatches.forEach(swatch=>{swatch.style.setProperty("--bg-image",imageSrc[swatch.getAttribute("data-optionvalue")])})}}}},0)},updateImage(el,productUrl,src,variantId,sectionId,hasVariant){const cardProduct=el.closest(".card-product");let getLink=productUrl+`?variant=${variantId}`;if(!cardProduct)return;const linkVariant=cardProduct.getElementsByClassName("link-product-variant");for(var i=0;i<linkVariant.length;i++)linkVariant[i].setAttribute("href",getLink);const currentVariant=cardProduct.querySelector(".current-variant");if(currentVariant&&!hasVariant&&(currentVariant.innerText=variantId),src!=""){let media=cardProduct.querySelector(`[media="${src}"]`);if(media){let index=media.getAttribute("index"),slide2=cardProduct.querySelector(".x-splide");if(slide2){slide2.splide?slide2.splide.go(Number(index)):document.addEventListener(`eurus:${sectionId}:splide-ready`,()=>{slide2.splide.go(Number(index))});return}}const previewImg=cardProduct.getElementsByClassName("preview-img")[0];if(!previewImg)return;previewImg.removeAttribute("srcset"),previewImg.setAttribute("src",src);let slide=cardProduct.querySelector(".x-splide");slide&&slide.splide&&slide.splide.go(0)}else{let slide=cardProduct.querySelector(".x-splide");slide&&slide.splide&&slide.splide.go(0)}}
1,updateQuickAdd(productUrl,variantId,quickAddPageParam,productId,el){}})})})); 2//# sourceMappingURL=/cdn/shop/t/29/assets/preview-color-swatches.js.map?v=149005175958883517951780939948
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.