1const Shared={selectors:{thumbnails:{selector:".thumbnail",type:"all",scope:"document"},gripSelects:{selector:".grip_type_pdp",type:"all",scope:"document"},gripGuideBtn:{selector:"#grip-guide-btn",type:"single",scope:"document"},gripGuide:{selector:"#grip-guide",type:"single",scope:"document"},allSwatches:{selector:".swatch-btn",type:"all",scope:"document"},pricesMain:{selector:".product-page-template .prices",type:"single",scope:"document"},backInStockInput:{selector:".back-in-stock-notify",type:"single",scope:"document"},outOfStockBtn:{selector:".out-of-stock-main",type:"single",scope:"document"},stockAlert:{selector:".stock-alert",type:"single",scope:"document"},inventoryBullet:{selector:".bullet-point",type:"single",scope:"document"},loadingSpinner:{selector:".icon-loading-js",type:"single",scope:"document"},modalBg:{selector:".modal-background",type:"single",scope:"document"},modelInfo:{selector:".model-info",type:"all",scope:"document"},notifyButtons:{selector:".notify-me-submit",type:"all",scope:"document"},notifyContainer:{selector:".notify-me-container",type:"single",scope:"document"},notifyButton:{selector:".notify-me-submit",type:"single",scope:"document"},shippingDelay:{selector:".shipping-delay",type:"single",scope:"document"},shippingDelayInput:{selector:".shipping-delay-input",type:"single",scope:"document"},loopErrorText:{selector:".loop-exclusion-error-container",type:"single",scope:"document"},verticalGallery:{selector:".vertical-gallery-layout",type:"single",scope:"document"},verticalThumbs:{selector:".vertical-thumb-img",type:"all",scope:"document"},verticalGalleries:{selector:".vertical-gallery-layout",type:"all",scope:"document"},stickyBar:{selector:".sticky-atc-bar",type:"single",scope:"document"},stickyShapeBtns:{selector:".sticky-atc-shape-btn",type:"all",scope:"document"},stickyColorBtns:{selector:".sticky-atc-color-btn",type:"all",scope:"document"},stickySubmitBtn:{selector:".sticky-atc-submit",type:"single",scope:"document"},stickyShapeLabelText:{selector:".sticky-atc-selected-shape-text",type:"single",scope:"document"},stickyColorLabelText:{selector:".sticky-atc-selected-color-text",type:"single",scope:"document"},stickyCloseBtn:{selector:".sticky-atc-close-btn",type:"single",scope:"document"},stickyFab:{selector:".sticky-atc-fab",type:"single",scope:"document"},atcContainer:{selector:".atc-container",type:"single",scope:"document"},membersOnlyContainer:{selector:".members-only-container",type:"single",scope:"document"},productDetailsContainer:{selector:".product-details-container",type:"single",scope:"document"},vipAccessOverlay:{selector:".vip-access-overlay[data-vip-overlay-pdp='true']",type:"single",scope:"document"},vipAccessCloseBtn:{selector:"[data-vip-overlay-close]",type:"single",scope:"document"}},init:async function(handle,variantId,okendoId,productId,productType,retired){this.productType=productType,Utility.fetchEls(this.selectors,this),this.initEventListeners(),variantId&&this.checkLoopExclusions(variantId)},initEventListeners:function(){const{thumbnails}=this;this.initVerticalGallery(),(!this.modelInfo.length||window.innerWidth<1200)&&(this.initImageGalleryEventListeners(),thumbnails.length&&thumbnails.forEach(thumbnail=>{thumbnail.addEventListener("click",event=>{this.updateSelectedImage(event.target,!1)})})),this.initStickyBar(),this.initVipAccessOverlay(),this.initMaestraEventListeners()},initQuantityEventListeners:function(modal=!1){let minusBtns,plusBtns,productDetails;modal?(minusBtns=Modal.minusBtns,plusBtns=Modal.plusBtns,productDetails=Modal.productDetails):(minusBtns=ProductPage.minusBtns,plusBtns=ProductPage.plusBtns,productDetails=ProductPage.productDetails),minusBtns&&minusBtns.length&&minusBtns.forEach(btn=>{btn.addEventListener("click",()=>{this.handleQuantityChange(btn,"decrease",modal)})}),plusBtns&&plusBtns.length&&plusBtns.forEach(btn=>{btn.addEventListener("click",()=>{this.handleQuantityChange(btn,"increase",modal)})})},updateImageGallery:async function(modal=!1,variantId=ProductPage.getVariantFromUrl(ProductPage.productData).id,handle,modelInfoParts){const{verticalGallery}=this;let mainCol,thumbCols;verticalGallery&&(mainCol=verticalGallery.querySelector(".vertical-main-column"),thumbCols=vert
1icalGallery.querySelectorAll(".vertical-thumbs-column-inner, .vertical-thumbs-row"),mainCol&&(mainCol.style.opacity="0.4"),thumbCols.length&&thumbCols.forEach(col=>col.style.opacity="0.4"),mainCol&&(mainCol.style.transition="opacity 0.2s ease"),thumbCols.length&&thumbCols.forEach(col=>col.style.transition="opacity 0.2s ease"));const isVerticalLayout=!!verticalGallery;let images=await Utility.fetchProductImages(handle,variantId,isVerticalLayout),parentElement=modal?Modal.parent:ProductPage.parent;if(parentElement||(parentElement=document),verticalGallery){if(!mainCol||!thumbCols.length||!images||images.length===0){mainCol&&(mainCol.style.opacity="1"),thumbCols.length&&thumbCols.forEach(col=>{col.style.opacity="1"});return}const mainImg=mainCol.querySelector(".vertical-main-img"),videoContainer=mainCol.querySelector(".persistent-video-main");let isVideoActive=videoContainer&&(videoContainer.style.display==="block"||videoContainer.classList.contains("active-main-item")&&videoContainer.style.display!=="none");if(isVideoActive){const poster=videoContainer.querySelector(".custom-video-poster");poster&&(poster.style.display="flex");const videoEl=videoContainer.querySelector("video");videoEl&&(videoEl.pause(),videoEl.currentTime=0),videoContainer.classList.remove("active-main-item"),videoContainer.style.display="none",isVideoActive=!1}if(mainImg&&(mainImg.classList.add("active-main-item"),mainImg.style.display="block"),mainImg){const firstImgUrl=typeof images[0]=="string"?images[0]:images[0].src;mainImg.src=Utility.formatUrl(firstImgUrl,1200)}thumbCols.forEach(container=>{const persistentVidThumbs=Array.from(container.querySelectorAll(".persistent-video-thumb, .persistent-video-thumb-mobile")),persistentImgThumbs=Array.from(container.querySelectorAll(".persistent-product-thumb"));container.innerHTML="",persistentVidThumbs.forEach(thumb=>{const thumbImg=thumb.querySelector(".vertical-thumb-img");thumbImg&&(isVideoActive?thumbImg.classList.add("active"):thumbImg.classList.remove("active")),container.appendChild(thumb)});let firstImgAssigned=!1;images.forEach((imgData,index)=>{const imgUrl=typeof imgData=="string"?imgData:imgData.src,imgAlt=typeof imgData=="string"?"":imgData.alt,imgEl=document.createElement("img");imgEl.src=Utility.formatUrl(imgUrl,300),imgEl.alt=imgAlt||"",imgEl.className="vertical-thumb-img",!isVideoActive&&!firstImgAssigned&&(imgEl.classList.add("active"),firstImgAssigned=!0),imgEl.width=150,imgEl.height=200,imgEl.setAttribute("data-thumbnail-id",index),imgEl.style.cursor="pointer",imgEl.addEventListener("click",event=>{this.updateSelectedImage(event.target,modal,verticalGallery)}),container.appendChild(imgEl)}),persistentImgThumbs.forEach((thumb,idx)=>{const newIndex=(images.length>1,images.length+idx);thumb.setAttribute("data-thumbnail-id",newIndex),!isVideoActive&&!firstImgAssigned?(thumb.classList.add("active"),firstImgAssigned=!0):thumb.classList.remove("active"),container.appendChild(thumb)}),container.style.opacity="1"}),mainCol&&(mainCol.style.opacity="1");const modelInfoEl=mainCol?mainCol.querySelector(".model-info p"):null;modelInfoEl&&(modelInfoParts?(modelInfoEl.textContent=`Model is ${modelInfoParts[0]} wearing ${modelInfoParts[1]}`,modelInfoEl.closest(".model-info").style.display=""):modelInfoEl.closest(".model-info").style.display="none"),modal||(ProductPage.thumbnailImages=verticalGallery.querySelectorAll(".vertical-thumb-img"));const hasVideoForDots=!!videoContainer,imageCountForDots=images.length,productThumbsCount=verticalGallery.querySelectorAll(".vertical-thumbs-column-inner .persistent-product-thumb").length||0,totalImageCountForDots=imageCountForDots+productThumbsCount,activeDotIndex=isVideoActive&&hasVideoForDots?0:hasVideoForDots?1:0;this.rebuildGalleryDots(verticalGallery,hasVideoForDots,totalImageCountForDots,activeDotIndex),setTimeout(()=>{const innerCol=verticalGallery.querySelector(".vertical-thumbs-column-inner");innerCol&&innerCol.dispatchEvent(new Event("scroll")),window.dispatchEvent(new Event("resize"))},100);return}const variantDetails=modal?Modal.productDetails:ProductPage.productDetails;variantDetails?.image&&!images.includes(variantDetails.image)&&(images=[variantDetails.image,...images]);let selected,thumbnails,productData,template;if(modal?(selected=Modal.selected,thumbnails=Modal.thumbnails,productData=Modal.productData):(selected=ProductPage.selected,thumbnails=ProductPage.thumbnails,productData=ProductPage.productData,template=ProductPage.templateSuffix
1),!thumbnails||!selected)return;selected.querySelectorAll("img").forEach(image=>{image.remove()}),thumbnails.innerHTML="",window.innerWidth>=1200?(images.forEach((image,index)=>{if(index!==0&&template=="preview-pdp")return;let element=document.createElement("img");if(element.alt=productData.title,element.src=image,element.height=800,index===0){element.src=image.replace("&width=600","&width=1200"),element.width=1200,selected.prepend(element.cloneNode(!0));const newDiv=document.createElement("div");if(newDiv.classList.add("thumbnail-full-row"),newDiv.appendChild(element),element=newDiv,element.classList.add("active"),this.productType==="Apparel"&&modelInfoParts){const modelInfoDesktop=document.createElement("div"),modelInfoMobile=document.createElement("div");modelInfoDesktop.classList.add("model-info","desktop"),modelInfoDesktop.innerHTML=`<p>Model is ${modelInfoParts[0]} wearing ${modelInfoParts[1]}</p>`,modelInfoMobile.classList.add("model-info","mobile"),modelInfoMobile.innerHTML=`<p>Model is ${modelInfoParts[0]} wearing ${modelInfoParts[1]}</p>`,element.appendChild(modelInfoDesktop),element.appendChild(modelInfoMobile)}}else element.width=600;element.classList.add(`${modal?"modal-thumbnail":"thumbnail"}`),element.classList.add("product-thumbnail"),element.setAttribute("data-thumbnail-id",index),element.setAttribute("tabindex",0),element.setAttribute("role","button"),element.setAttribute("aria-label",themeT("product.select_image")),element.addEventListener("click",event=>{this.updateSelectedImage(event.target,modal)}),thumbnails.appendChild(element)}),initializeGalleryEventListeners()):(images.forEach((image,index)=>{const imgEl=document.createElement("img");if(imgEl.alt=productData.title,imgEl.src=image,imgEl.height="800",imgEl.width="600",imgEl.classList.add(`${modal?"modal-thumbnail":"thumbnail"}`),imgEl.classList.add("product-thumbnail"),imgEl.setAttribute("data-thumbnail-id",index),imgEl.setAttribute("tabindex",0),imgEl.setAttribute("role","button"),imgEl.setAttribute("aria-label",themeT("product.select_image")),imgEl.addEventListener("click",event=>{this.updateSelectedImage(event.target,modal)}),index===0){selected.innerHTML="";const heroClone=imgEl.cloneNode(!0);if(heroClone.classList.add("mobile"),selected.appendChild(heroClone),this.productType==="Apparel"&&modelInfoParts){const container=document.createElement("div");container.classList.add("model-info-container");const modelInfoMobile=document.createElement("div");modelInfoMobile.classList.add("model-info","mobile"),modelInfoMobile.innerHTML=`<p>Model is ${modelInfoParts[0]} wearing ${modelInfoParts[1]}</p>`,container.appendChild(modelInfoMobile),selected.appendChild(container)}const wrapper=document.createElement("div");wrapper.classList.add("thumbnail","product-thumbnail","thumbnail-full-row"),wrapper.style.position="relative",wrapper.style.display="flex",wrapper.style.alignItems="center";const desktopImg=imgEl.cloneNode(!0);if(desktopImg.src=desktopImg.src.replace(/(\?|&)width=600/,"&width=1200"),desktopImg.removeAttribute("class"),desktopImg.setAttribute("width","100%"),desktopImg.setAttribute("height","auto"),wrapper.appendChild(desktopImg),this.productType==="Apparel"&&modelInfoParts){const modelInfoDesktop=document.createElement("div");modelInfoDesktop.classList.add("model-info","desktop"),modelInfoDesktop.innerHTML=`<p>Model is ${modelInfoParts[0]} wearing ${modelInfoParts[1]}</p>`,wrapper.appendChild(modelInfoDesktop)}thumbnails.appendChild(wrapper)}else thumbnails.appendChild(imgEl)}),initializeGalleryEventListeners()),ProductPage.thumbnailImages=thumbnails.querySelectorAll(".thumbnail")},initImageGalleryEventListeners:function(){this.initKeyDownEventListeners(),this.initArrowEventListeners()},initArrowEventListeners:function(){let modalView=!1,modal;typeof Modal<"u"&&Modal&&(modal=Modal.modal),modal&&window.getComputedStyle(modal).display==="block"&&(modalView=!0);let parent;if(modalView?parent=Modal.parent:parent=document.querySelector(".product-imgs-container"),!parent)return;const thumbnailArrows=parent.querySelectorAll(".thumbnail-arrow");thumbnailArrows.length>0&&thumbnailArrows.forEach(arrow=>{arrow.addEventListener("click",()=>{let clickedArrow=arrow;arrow.tagName!=="SVG"&&(clickedArrow=arrow.querySelector("svg"));const direction=clickedArrow.dataset.icon;direction.includes("left")?this.goToPreviousImage(modalView):direction.includes("right")&&this.goToNextImage(modalView)})})},initKeyDownEventListeners:function(){document.addEventListener("keydown",event=>{let modalView=!1;const{modal}=this;let modalStyle,modalDisplay;modal&&(modalStyle=window.getComputedStyle(modal),modalDisplay=modalStyle.display),modalDisplay==="block"&&(modalView=!0),event.key==="ArrowRight"?this.goToNextImage(modalView):event.key==="ArrowLeft"&&this.goToPreviousImage(modalView)})},goToNextImage:function(modal){let thumbnails,thumbnailContainer;
1if(modal?(thumbnails=Modal.thumbnailImages,thumbnailContainer=Modal.thumbnails):(thumbnails=ProductPage.thumbnailImages,thumbnailContainer=ProductPage.thumbnails),!thumbnailContainer||!thumbnails||!thumbnails.length)return;const activeThumb=thumbnailContainer.querySelector(".active");if(!activeThumb)return;const currentIndex=activeThumb.dataset.thumbnailId;let nextIndex=parseInt(currentIndex)+1;nextIndex>thumbnails.length-1?(nextIndex=0,Utility.smoothScroll(thumbnailContainer,-(thumbnailContainer.scrollWidth-thumbnailContainer.clientWidth),300)):Utility.smoothScroll(thumbnailContainer,75,300),this.updateSelectedImage(thumbnails[nextIndex],modal)},goToPreviousImage:function(modal){let thumbnails,thumbnailContainer;if(modal?(thumbnails=Modal.thumbnailImages,thumbnailContainer=Modal.thumbnails):(thumbnails=ProductPage.thumbnailImages,thumbnailContainer=ProductPage.thumbnails),!thumbnailContainer||!thumbnails||!thumbnails.length)return;const activeThumb=thumbnailContainer.querySelector(".active");if(!activeThumb)return;const currentIndex=activeThumb.dataset.thumbnailId;let prevIndex=parseInt(currentIndex)-1;prevIndex<0?(prevIndex=thumbnails.length-1,Utility.smoothScroll(thumbnailContainer,thumbnailContainer.scrollWidth-thumbnailContainer.clientWidth,300)):Utility.smoothScroll(thumbnailContainer,-75,300),this.updateSelectedImage(thumbnails[prevIndex],modal)},updateSelectedImage:function(thumbnail,modal,explicitGalleryTarget=null){const activeVerticalGallery=explicitGalleryTarget||(thumbnail?thumbnail.closest(".vertical-gallery-layout"):null)||this.verticalGallery;if(!thumbnail||!thumbnail.src){console.warn("Invalid thumbnail passed to updateSelectedImage:",thumbnail);return}if(activeVerticalGallery){const imgSrc2=thumbnail.src.replace(/&width=\d+/g,"").replace(/\?width=\d+&/g,"?").replace(/\?width=\d+$/,""),finalImgSrc=imgSrc2+(imgSrc2.includes("?")?"&":"?")+"width=1200",altText2=thumbnail.alt||"";activeVerticalGallery.querySelectorAll(".vertical-thumb-img").forEach(thumb=>thumb.classList.remove("active")),thumbnail.classList.add("active");const mainImg=activeVerticalGallery.querySelector(".vertical-main-img");mainImg&&(mainImg.src=finalImgSrc,mainImg.alt=altText2);const desktopColInner=activeVerticalGallery.querySelector(".vertical-thumbs-column-inner");if(desktopColInner){const videoThumb=desktopColInner.querySelector(".persistent-video-thumb"),thumbPosition=Array.from(desktopColInner.querySelectorAll(".vertical-thumb-img:not(.persistent-video-thumb .vertical-thumb-img)")).indexOf(thumbnail);if(thumbPosition>=0){const dotIndex=videoThumb?thumbPosition+1:thumbPosition;this.syncGalleryDots(activeVerticalGallery,dotIndex)}}return}let selected,thumbnails;if(modal?(selected=Modal.selected,thumbnails=Modal.thumbnailImages):(selected=ProductPage.selected,thumbnails=ProductPage.thumbnailImages),!selected||!thumbnails||!thumbnails.length)return;const imgSrc=thumbnail.src.replace("&width=300","").replace("&width=500",""),altText=thumbnail.alt;thumbnails.forEach(thumb=>{thumb.classList.remove("active")}),thumbnail.classList.add("active");const imgEls=selected.querySelectorAll("img");imgEls.length&&imgEls.forEach(el=>{el.src=imgSrc,el.alt=altText})},initVerticalGallery:function(){const{verticalGalleries}=this;!verticalGalleries||verticalGalleries.length===0||verticalGalleries.forEach(galleryTarget=>{if(galleryTarget.dataset.vgalInitialized)return;galleryTarget.dataset.vgalInitialized="true";const savedVidThumbsDesktop=Array.from(galleryTarget.querySelectorAll(".persistent-video-thumb")),savedVidThumbsMobile=Array.from(galleryTarget.querySelectorAll(".persistent-video-thumb-mobile")),savedMainVideos=Array.from(galleryTarget.querySelectorAll(".persistent-video-main")),savedImgThumbsDesktop=Array.from(galleryTarget.querySelectorAll(".vertical-thumbs-column-inner .persistent-product-thumb, .vertical-thumbs-column .persistent-product-thumb")),savedImgThumbsMobile=Array.from(galleryTarget.querySelectorAll(".vertical-thumbs-row .persistent-product-thumb")),handleGalleryInteraction=e=>{if(e.type==="keydown"){const isArrowUp=e.key==="ArrowUp",isArrowDown=e.key==="ArrowDown",isArrowLeft=e.key==="ArrowLeft",isArrowRight=e.key==="ArrowRight";if(isArrowUp||isArrowDown){const thumbCol=galleryTarget.querySelector(".vertical-thumbs-column-inner");if(thumbCol&&thumbCol.contains(e.target)){e.preventDefault();const focusableItems=Array.from(thumbCol.querySelectorAll(".vertical-thumb-video-wrapper, .vertical-thumb-img
1:not(.vertical-thumb-video-wrapper .vertical-thumb-img)")),currentIndex=focusableItems.indexOf(document.activeElement);if(currentIndex>=0){const nextIndex=isArrowDown?Math.min(currentIndex+1,focusableItems.length-1):Math.max(currentIndex-1,0);nextIndex!==currentIndex&&(focusableItems[nextIndex].focus(),focusableItems[nextIndex].click())}return}}if(isArrowLeft||isArrowRight){e.preventDefault(),this.shiftGallerySlide(galleryTarget,isArrowRight?1:-1);return}if(e.key!=="Enter"&&e.key!==" ")return;e.key===" "&&e.target.closest(".vertical-thumb-video-wrapper, .vertical-thumb-img, .vertical-gallery-scroll-arrow, .vertical-gallery-dot")&&e.preventDefault()}const dotBtn=e.target.closest(".vertical-gallery-dot");if(dotBtn){const dotsContainer=galleryTarget.querySelector(".vertical-gallery-dots"),dotIndex=Array.from(dotsContainer?.querySelectorAll(".vertical-gallery-dot")||[]).indexOf(dotBtn);dotIndex>=0&&this.activateGallerySlide(galleryTarget,dotIndex);return}const videoPoster=e.target.closest(".custom-video-poster");if(videoPoster){videoPoster.style.display="none";const videoElement=videoPoster.nextElementSibling;videoElement&&typeof videoElement.play=="function"&&(videoElement.muted=!1,videoElement.play())}const videoThumb=e.target.closest(".vertical-thumb-video-wrapper"),imgThumb=e.target.closest(".vertical-thumb-img:not(.vertical-thumb-video-wrapper .vertical-thumb-img)"),mainImg=galleryTarget.querySelector(".vertical-main-img"),allVideos=galleryTarget.querySelectorAll(".vertical-main-video-container");if(videoThumb){const videoId=videoThumb.getAttribute("data-thumbnail-id");mainImg&&(mainImg.style.display="none"),allVideos.forEach(v=>{v.style.display="none",v.querySelector("video")?.pause()});const activeVideo=galleryTarget.querySelector(`[id="${videoId}"]`);if(activeVideo){activeVideo.style.display="block";const poster=activeVideo.querySelector(".custom-video-poster");poster&&(poster.style.display="flex");const videoEl=activeVideo.querySelector("video");videoEl&&(videoEl.pause(),videoEl.currentTime=0)}this.syncGalleryDots(galleryTarget,0)}else if(imgThumb){allVideos.forEach(v=>{v.style.display="none",v.querySelector("video")?.pause()}),mainImg&&(mainImg.style.display="block");const isModal=!!galleryTarget.closest(".pdp-modal, .quick-view-modal");this.updateSelectedImage(imgThumb,isModal,galleryTarget)}const leftArrow=e.target.closest(".vertical-gallery-scroll-arrow.left-arrow"),rightArrow=e.target.closest(".vertical-gallery-scroll-arrow.right-arrow"),mobileRow2=galleryTarget.querySelector(".vertical-thumbs-row");leftArrow&&mobileRow2&&mobileRow2.scrollBy({left:-165,behavior:"smooth"}),rightArrow&&mobileRow2&&mobileRow2.scrollBy({left:165,behavior:"smooth"});const upArrow=e.target.closest(".vertical-gallery-scroll-arrow.up-arrow"),downArrow=e.target.closest(".vertical-gallery-scroll-arrow.down-arrow"),desktopColInner2=galleryTarget.querySelector(".vertical-thumbs-column-inner");upArrow&&desktopColInner2&&desktopColInner2.scrollBy({top:-220,behavior:"smooth"}),downArrow&&desktopColInner2&&desktopColInner2.scrollBy({top:220,behavior:"smooth"})};galleryTarget.addEventListener("click",handleGalleryInteraction),galleryTarget.addEventListener("keydown",handleGalleryInteraction);const mainColumn=galleryTarget.querySelector(".vertical-main-column");if(mainColumn){let touchStartX=0,touchStartY=0;mainColumn.addEventListener("touchstart",e=>{touchStartX=e.touches[0].clientX,touchStartY=e.touches[0].clientY},{passive:!0}),mainColumn.addEventListener("touchend",e=>{const deltaX=e.changedTouches[0].clientX-touchStartX,deltaY=e.changedTouches[0].clientY-touchStartY;if(Math.abs(deltaX)<40||Math.abs(deltaX)<Math.abs(deltaY))return;const direction=deltaX<0?1:-1;this.shiftGallerySlide(galleryTarget,direction)},{passive:!0})}const mobileRow=galleryTarget.querySelector(".vertical-thumbs-row");if(mobileRow){const checkOverflow=()=>{const leftArrow=galleryTarget.querySelector(".vertical-gallery-scroll-arrow.left-arrow"),rightArrow=galleryTarget.querySelector(".vertical-gallery-scroll-arrow.right-arrow");leftArrow&&rightArrow&&(mobileRow.scrollWidth>mobileRow.clientWidth+5?(leftArrow.style.display="flex",rightArrow.style.display="flex"):(leftArrow.style.display="none",rightArrow.style.display="none"))};checkOverflow(),window.addEventListener("resize",checkOverflow),setTimeout(checkOverflow,500)}const desktopColInner=galleryTarget.querySelector(".vertical-thumbs-column-inner");if(desktopColInner){const checkDesktopOverflow=()=>{const upArrow=galleryTarget.querySelector(".vertical-gallery-scroll-arrow.up-arrow"),downArrow=galleryTarget.querySelector(".vertical-gallery-scroll-arrow.down-arrow");upArrow&&downArrow&&(desktopColInner.scrollHeight>desktopColInner.clientHeight+5?(desktopColInner.scrollTop>5?upArrow.style.display="flex":upArrow.style.display="none",Math.ceil(desktopColInner.scrollTop+desktopColInner.clientHeight)<desktopColInner.scrollHeight-5?downArrow.style.display="flex":downArrow.style.display="none"):(upArrow.style.display="none",downArrow.style.display="none"))};checkDesktopOverflow(),desktopColInner.addEventListener("scroll",checkDesktopOverflow),window.addEventListener("resize",checkDesktopOverflow),setTimeout(checkDesktopOverflow,500)}new MutationObserver(()=>{const desktopCol=galleryTarget.querySelector(".vertical-thumbs-column-inner")||galleryTarget.querySelector(".vertical-thumbs-column");desktopCol&&savedVidThumbsDesktop.length>0&&!desktopCol.querySelector(".persistent-video-thumb")&&savedVidThumbsDesktop.forEac
1h(v=>desktopCol.prepend(v)),desktopCol&&savedImgThumbsDesktop.length>0&&!desktopCol.querySelector(".persistent-product-thumb")&&savedImgThumbsDesktop.forEach(v=>desktopCol.appendChild(v));const row=galleryTarget.querySelector(".vertical-thumbs-row");row&&savedVidThumbsMobile.length>0&&!row.querySelector(".persistent-video-thumb-mobile")&&savedVidThumbsMobile.forEach(v=>row.prepend(v)),row&&savedImgThumbsMobile.length>0&&!row.querySelector(".persistent-product-thumb")&&savedImgThumbsMobile.forEach(v=>row.appendChild(v));const mainCol=galleryTarget.querySelector(".vertical-main-column");mainCol&&savedMainVideos.length>0&&!mainCol.querySelector(".persistent-video-main")&&savedMainVideos.forEach(v=>{v.style.display="none",mainCol.prepend(v)})}).observe(galleryTarget,{childList:!0,subtree:!0})})},syncGalleryDots:function(galleryTarget,activeDotIndex){const dotsContainer=galleryTarget.querySelector(".vertical-gallery-dots");if(!dotsContainer)return;const allDots=dotsContainer.querySelectorAll(".vertical-gallery-dot");let activeDotEl=null;if(allDots.forEach((dot,index)=>{const isActive=index===activeDotIndex;dot.classList.toggle("active",isActive),dot.setAttribute("aria-selected",isActive?"true":"false"),isActive&&(activeDotEl=dot)}),activeDotEl){const containerWidth=dotsContainer.offsetWidth,dotLeft=activeDotEl.offsetLeft,dotWidth=activeDotEl.offsetWidth;dotsContainer.scrollLeft=dotLeft-containerWidth/2+dotWidth/2}},rebuildGalleryDots:function(galleryTarget,hasVideo,imageCount,activeDotIndex){const dotsContainer=galleryTarget.querySelector(".vertical-gallery-dots");if(!dotsContainer)return;const dotFill=dotsContainer.dataset.dotFill||"#222222";dotsContainer.style.setProperty("--dot-fill",dotFill);const totalDots=(hasVideo?1:0)+imageCount;dotsContainer.innerHTML="";for(let i=0;i<totalDots;i++){const btn=document.createElement("button");btn.type="button";const isActive=i===activeDotIndex;btn.className="vertical-gallery-dot"+(isActive?" active":""),btn.setAttribute("role","tab"),btn.setAttribute("aria-selected",isActive?"true":"false"),btn.setAttribute("aria-label","Slide "+(i+1)),btn.innerHTML=`<span class="dot-state dot-state-empty" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none"><circle cx="5" cy="5" r="4.5" stroke="#222222"/></svg></span><span class="dot-state dot-state-active" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none"><circle cx="5" cy="5" r="5" fill="${dotFill}"/></svg></span>`,dotsContainer.appendChild(btn)}},activateGallerySlide:function(galleryTarget,dotIndex){const desktopColInner=galleryTarget.querySelector(".vertical-thumbs-column-inner");if(!desktopColInner)return;const videoThumb=desktopColInner.querySelector(".persistent-video-thumb"),hasVideo=!!videoThumb;if(hasVideo&&dotIndex===0){const mainImg2=galleryTarget.querySelector(".vertical-main-img"),allVideos2=galleryTarget.querySelectorAll(".vertical-main-video-container");mainImg2&&(mainImg2.style.display="none"),allVideos2.forEach(v=>{v.style.display="none",v.querySelector("video")?.pause()});const activeVideo=galleryTarget.querySelector('[id="video-main"]');if(activeVideo){activeVideo.style.display="block";const poster=activeVideo.querySelector(".custom-video-poster");poster&&(poster.style.display="flex")}galleryTarget.querySelectorAll(".vertical-thumb-img").forEach(t=>t.classList.remove("active"));const videoThumbImg=videoThumb.querySelector(".vertical-thumb-img");videoThumbImg&&videoThumbImg.classList.add("active"),this.syncGalleryDots(galleryTarget,0);return}const imgThumbs=Array.from(desktopColInner.querySelectorAll(".vertical-thumb-img:not(.persistent-video-thumb .vertical-thumb-img)")),adjustedIndex=hasVideo?dotIndex-1:dotIndex,targetThumb=imgThumbs[adjustedIndex];if(!targetThumb)return;galleryTarget.querySelectorAll(".vertical-main-video-container").forEach(v=>{v.style.display="none",v.querySelector("video")?.pause()});const mainImg=galleryTarget.querySelector(".vertical-main-img");mainImg&&(mainImg.style.display="block"),this.updateSelectedImage(targetThumb,!1,galleryTarget),this.syncGalleryDots(galleryTarget,dotIndex)},shiftGallerySlide:function(galleryTarget,direction){const dotsContainer=galleryTarget.querySelector(".vertical-gallery-dots");if(!dotsContainer)return;const allDots=Array.from(dotsContainer.querySelectorAll(".vertical-gallery-dot"));if(allDots.length===0)return;const currentIndex=allDots.findIndex(dot=>dot.classList.contains("active")),resolvedCurrent=currentIndex<0?0:currentIndex,newIndex=Math.max(0,Math.min(allDots.length-1,resolvedCurrent+direction));newIndex!==resolvedCurrent&&this.activateGallerySlide(galleryTarget,newIndex)},_getEarlyAccessMap:function(){const script=document.getElementById("raw-variant-early-access");if(!script)return{};try{return JSON.parse(script.textContent)}catch{return{}}},_isVipOverlayDismissible:function(){return this.vipAccessOverlay?.dataset.vipOverlayDismissible==="true"},showVipAccessOverlay:function(){this.vipAccessOverlay&&(this.vipAccessOverlay.classList.remove("is-hidden"),document.body.classList.add("vip-access-locked"))},hideVipAccessOverlay:function(){this.vipAccessOverlay&&(this.vipAccessOverlay.classList.add("is-hidden"),document.body.classList.remove("vip-access-locked"))},initVipAccessOverlay:function(){!this.vipAccessOverlay||!this._isVipOverlayDismissible()||(this.vipAccessCloseBtn&&this.vipAccessCloseBtn.addEventListener("click",()=>{this.dismissVipAccessOverlay()}),this._vipOverlayEscHandler=event=>{event.key==="Escape"&&this.vipAccessOverlay&&!this.vipAccessOverlay.classList.contains("is-hidden")&&this.dismissVipAccessOverlay()},document.addEventListener("keydown",this._vipOverlayEscHandler))}
1,dismissVipAccessOverlay:async function(){!this.vipAccessOverlay||!this._isVipOverlayDismissible()||(this.hideVipAccessOverlay(),await this.selectFirstNonEarlyAccessVariant())},selectFirstNonEarlyAccessVariant:async function(){let productData=typeof ProductPage<"u"?ProductPage.productData:null;if(!productData?.variants?.length){const handle=window.location.pathname.split("/products/")[1]?.split("/")[0]?.split("?")[0];if(handle)try{productData=await Utility.fetchProductDataAjax(handle)}catch(error){console.error("Failed to fetch product data for early access fallback:",error);return}}if(!productData?.variants?.length)return;const earlyAccessMap=this._getEarlyAccessMap(),publicVariant=productData.variants.find(variant=>earlyAccessMap[String(variant.id)]!==!0&&variant.available)||productData.variants.find(variant=>earlyAccessMap[String(variant.id)]!==!0);if(!publicVariant)return;const parent=this.productDetailsContainer||document,optionValues=publicVariant.title.split(" / ").map(value=>value.trim()),selections=[];for(const value of optionValues){const swatch=Array.from(parent.querySelectorAll(".swatch-btn")).find(element=>!element.closest(".sticky-atc-bar")&&element.dataset.swatchValue===value);if(swatch){selections.push({type:"swatch",element:swatch});continue}let matchedSelect=null;const selects=parent.querySelectorAll("select");for(const select of selects){const matchingOption=Array.from(select.options).find(option=>option.value===value||option.dataset.swatchValue===value);if(matchingOption){matchedSelect={select,matchingOption};break}}if(matchedSelect){selections.push({type:"select",...matchedSelect});continue}return}for(const selection of selections)selection.type==="swatch"?selection.element.classList.contains("selected")||await this.handleSwatchChange(selection.element,!1,!1):(selection.select.value=selection.matchingOption.value,selection.select.setAttribute("data-force-change","true"),await this.handleSwatchChange(selection.select,!1,!1))},updateEarlyAccessRestriction:function(variantData,surface={}){const isEligible=this.productDetailsContainer?.dataset.earlyAccessEligible==="true",isRestricted=variantData?.earlyAccess===!0&&!isEligible,{modal,card,addToCartBtn}=surface;if(modal||card){if(!addToCartBtn)return;isRestricted?(addToCartBtn.disabled=!0,addToCartBtn.classList.add("early-access-restricted","disabled-btn"),addToCartBtn.classList.remove("out-of-stock"),addToCartBtn.textContent="Early Access Only"):addToCartBtn.classList.remove("early-access-restricted","disabled-btn");return}this.atcContainer&&(this.atcContainer.style.display=isRestricted?"none":""),this.shippingDelay&&(isRestricted?this.shippingDelay.style.display="none":this.updateShippingDelay(variantData)),this.membersOnlyContainer&&(this.membersOnlyContainer.style.display="none"),this.vipAccessOverlay&&(isRestricted?this.showVipAccessOverlay():this.hideVipAccessOverlay()),this.stickyBar&&(isRestricted?this.stickyBar.style.display="none":this.stickyBar.style.removeProperty("display"),this.stickyFab&&(isRestricted?this.stickyFab.style.display="none":this.stickyFab.style.removeProperty("display")))},handleOutOfStock:async function(modal=!1,variantId=ProductPage.getVariantFromUrl(ProductPage.productData).id){let addToCartBtn,productData;if(modal?(addToCartBtn=Modal.addToCartBtn,productData=Modal.productData):(addToCartBtn=ProductPage.addToCartBtn,productData=ProductPage.productData),!productData)return;const{outOfStockBtn,stockAlert,inventoryBullet,backInStockInput,notifyContainer,notifyButton}=this,variantDetails=await Utility.fetchProductDetails(productData.handle,variantId);if(notifyContainer&¬ifyButton&&!modal&&!(notifyButton.dataset.source&¬ifyButton.dataset.source!=="LimitedEditionPdp"&¬ifyButton.dataset.formType==="notify")){const isLimited=notifyContainer.dataset.isLimitedEdition==="true"||variantDetails.limitedEdition;let limitMsg=notifyContainer.querySelector(".limited-edition-msg");
1if(isLimited){if(!limitMsg){limitMsg=document.createElement("p"),limitMsg.classList.add("limited-edition-msg");const limitedEditionMsgText=notifyContainer.dataset.limitedEditionMsg||"This limited-edition color went fast during presale! Don't miss out on the next special drop \u2014 sign up for email now to be the first to know.";limitMsg.innerHTML=limitedEditionMsgText,notifyContainer.prepend(limitMsg)}limitMsg.style.display="block";const nextEl=limitMsg.nextElementSibling;if(!nextEl||nextEl.tagName!=="BR"){const br=document.createElement("br");limitMsg.after(br)}else nextEl.style.display="";notifyButton.innerHTML=themeT("product.sign_up"),notifyButton.dataset.formType="signUp",notifyButton.dataset.source="LimitedEditionPdp",notifyButton.id="email-signup-pdp"}else limitMsg&&(limitMsg.style.display="none",limitMsg.nextElementSibling&&limitMsg.nextElementSibling.tagName==="BR"&&(limitMsg.nextElementSibling.style.display="none")),notifyButton.textContent=themeT("product.notify_when_available"),notifyButton.dataset.formType="backInStock",notifyButton.dataset.source==="LimitedEditionPdp"&&(notifyButton.dataset.source=""),notifyButton.id="back-in-stock-pdp"}let productAvailable=variantDetails.available;productAvailable?modal?addToCartBtn&&(addToCartBtn.disabled=!1,addToCartBtn.classList.remove("out-of-stock"),addToCartBtn.textContent=addToCartBtn.dataset.label||themeT("product.add_to_cart")):(addToCartBtn&&(addToCartBtn.style.display="block"),outOfStockBtn&&(outOfStockBtn.style.display="none"),stockAlert&&(variantDetails.shippingDelay!=""?(stockAlert.textContent=themeT("cart.shipping_delay_note",{delay:variantDetails.shippingDelay}),stockAlert.style.fontWeight="700"):(stockAlert.style.fontWeight="400",ProductPage.stockAlert==="low"?variantDetails.inventory==null||variantDetails.inventory>10||variantDetails.inventory<1?(stockAlert.textContent="",inventoryBullet&&(inventoryBullet.style.display="none")):(stockAlert.innerHTML=themeT("product.stock_hot",{count:variantDetails.inventory}),inventoryBullet&&(inventoryBullet.style.display="block",inventoryBullet.style.color="red")):ProductPage.stockAlert==="all"&&(variantDetails.inventory==null||variantDetails.inventory>10||variantDetails.inventory<1?(stockAlert.textContent=themeT("product.in_stock_ready"),inventoryBullet&&(inventoryBullet.style.display="block",inventoryBullet.style.color="green")):(stockAlert.innerHTML=themeT("product.stock_hot",{count:variantDetails.inventory}),inventoryBullet&&(inventoryBullet.style.display="block",inventoryBullet.style.color="red"))))),backInStockInput&&(backInStockInput.style.display="none"),notifyContainer&&(notifyContainer.style.display="none",notifyContainer.setAttribute("aria-hidden","true")),notifyButton&&(notifyButton.style.display="none")):modal?addToCartBtn&&(addToCartBtn.dataset.label||(addToCartBtn.dataset.label=addToCartBtn.textContent||themeT("product.add_to_cart")),addToCartBtn.disabled=!0,addToCartBtn.classList.add("out-of-stock"),addToCartBtn.textContent=themeT("product.out_of_stock")):(addToCartBtn&&(addToCartBtn.style.display="none"),outOfStockBtn&&(outOfStockBtn.style.display="block"),stockAlert&&(stockAlert.style.fontWeight="400",stockAlert.textContent=themeT("product.notify_out_of_stock")),inventoryBullet&&(inventoryBullet.style.display="block",inventoryBullet.style.color="red"),backInStockInput&&(backInStockInput.style.display="flex"),notifyContainer&&(notifyContainer.style.display="block",notifyContainer.removeAttribute("aria-hidden")),notifyButton&&(notifyButton.style.display="")),this.updateShippingDelay(variantDetails),modal?this.updateEarlyAccessRestriction(variantDetails,{modal:!0,addToCartBtn}):this.updateEarlyAccessRestriction(variantDetails),modal||this.checkLoopExclusions(variantId,modal,productAvailable)},updateShippingDelay:function(variantData){if(!this.shippingDelay||!variantData)return;const shippingDelay=variantData.shippingDelay,shippingDelayTextEl=this.shippingDelay.querySelector(".shipping-delay__text");if(shippingDelay&&variantData.available){const prefix=this.shippingDelay.dataset.defaultText||themeT("cart.shipping_delay_note",{delay:""});shippingDelayTextEl?shippingDelayTextEl.textContent=prefix+shippingDelay:this.shippingDelay.textContent=prefix+shippingDelay,this.shippingDelay.style.display="",this.shippingDelayInput&&(this.shippingDelayInput.value=shippingDelay,this.shippingDelayInput.disabled=!1)}else this.shippingDelay.style.display="none",this.shippingDelayInput&&(this.shippingDelayInput.value="",this.shippingDelayInput.disabled=!0)},initSwatchesStock:async function(productData,modal=!1,curVariant=ProductPage.getVariantFromUrl(ProductPage.productData).id){let parent;if(modal?parent=Modal.parent:parent=ProductPage.parent,!parent)return;let selectedSwatch=parent.querySelector(".swatch-btn.selected");if(!selectedSwatch){const select=parent.querySelector("select.swatch-btn, select[data-option-name]");select&&select.selectedOptions[0]&&(selectedSwatch=select.selectedOptions[0])}if(!selectedSwatch)return;const optionNameHandle=Utility.shopifyHandleize(selectedSwatch.dataset.optionName);this.updateSwatchesExist(selectedSwatch.dataset.swatchValue,optionNameHandle,modal),this.updateSwatchesStock(selectedSwatch.dataset.swatchValue,optionNameHandle,modal)},generateCombinations:function(options,optionIndex=0,previousCombination=[]){if(optionIndex===options.length)return[previousCombination];const allCombinations=[];
1return options[optionIndex].values.forEach(value=>{const newCombination=[...previousCombination,value],combinationsFromHere=this.generateCombinations(options,optionIndex+1,newCombination);allCombinations.push(...combinationsFromHere)}),allCombinations},updateSwatchesStock:async function(swatchValue,optionNameHandle,modal=!1,card=null,context=null){let parent,productData,allSwatches;if(context?(parent=context.parent,productData=context.productData):modal?(parent=Modal.parent,productData=Modal.productData,allSwatches=Modal.allSwatches):card?(parent=card,productData=parent.productData||ProductCards.productData):(parent=ProductPage.parent,productData=ProductPage.productData,allSwatches=ProductPage.allSwatches),!parent||!productData)return;allSwatches||(allSwatches=parent.querySelectorAll(".swatch-btn"));let outOfStock=[];const optsCount=productData.options.length;let lastOptionSwatches;if(optsCount===1){lastOptionSwatches=Array.from(allSwatches).filter(btn=>!btn.closest(".sticky-atc-bar"));const swatchValues=productData.options[0].values;
1productData.variants.forEach(variant=>{const variantTitleOpts=variant.title.split(" / ").map(v=>v.trim());swatchValues.forEach(value=>{variantTitleOpts.includes(value.trim())&&(variant.available||outOfStock.push(value))})})}else{const lastOption=productData.options[optsCount-1],lastOptionHandle=Utility.canonicalOptionHandle(lastOption.name),currentSelections=Array.from(parent.querySelectorAll(".swatch-btn.selected")).filter(swatch=>!swatch.closest(".sticky-atc-bar")&&swatch.dataset.optionName!==lastOptionHandle).map(swatch=>swatch.dataset.swatchValue.trim());lastOptionSwatches=Array.from(parent.querySelectorAll(`.swatch-btn[data-option-name="${lastOptionHandle}"]`)).filter(swatch=>!swatch.closest(".sticky-atc-bar")),lastOptionSwatches.length===0&&(lastOptionSwatches=Array.from(parent.querySelectorAll(".swatch-btn")).filter(btn=>!btn.closest(".sticky-atc-bar")&&btn.dataset.optionName===lastOptionHandle)),lastOptionSwatches.forEach(swatch=>{const testCombination=[...currentSelections,swatch.dataset.swatchValue.trim()].filter(Boolean),matchingVariant=productData.variants.find(variant=>{const variantTitleParts=variant.title.split(" / ").map(v=>v.trim());return testCombination.every(option=>variantTitleParts.includes(option))});matchingVariant&&matchingVariant.available||outOfStock.push(swatch.dataset.swatchValue)})}lastOptionSwatches&&lastOptionSwatches.length&&lastOptionSwatches.forEach(swatch=>{const isOOS=outOfStock.includes(swatch.dataset.swatchValue);isOOS?(swatch.classList.add("disabled"),swatch.tagName==="OPTION"&&(swatch.disabled=!0,swatch.textContent.includes(themeT("product.option_out_of_stock"))||(swatch.textContent+=themeT("product.option_out_of_stock")))):(swatch.disabled=!1,swatch.classList.remove("disabled"),swatch.tagName==="OPTION"&&(swatch.textContent=swatch.textContent.replace(themeT("product.option_out_of_stock"),"")));const stickyBarEl=document.querySelector(".sticky-atc-bar");if(stickyBarEl&&!modal&&!card&&!context){const stickyOptionHandle=swatch.dataset.optionName,stickySwatch=stickyBarEl.querySelector(`.swatch-btn[data-option-name="${stickyOptionHandle}"][data-swatch-value="${swatch.dataset.swatchValue}"]`);stickySwatch&&(isOOS?stickySwatch.classList.add("disabled"):stickySwatch.classList.remove("disabled"))}})},variantExistsForCombination:function(combination,variants){return variants.some(variant=>{const variantOptions=variant.title.split(" / ").map(v=>v.trim());return combination.every(value=>variantOptions.includes(value))})},updateSwatchesExist:function(swatchValue,optionNameHandle,modal=!1,card=!1,context=null){let productData,parent;if(context?(parent=context.parent,productData=context.productData):modal?(productData=Modal.modalProductData,parent=Modal.parent):card?(parent=card,productData=parent.productData||ProductCards.productData):(productData=ProductPage.productData,parent=ProductPage.parent),!parent||!productData)return;const options=productData.options||[];if(options.length<=1)return;const allSwatches=Array.from(parent.querySelectorAll(".swatch-btn")).filter(btn=>!btn.closest(".sticky-atc-bar")),optionHandles=options.map(option=>Utility.canonicalOptionHandle(option.name));optionHandles.forEach(currentOptionHandle=>{const currentOptionSwatches=allSwatches.filter(btn=>btn.dataset.optionName===currentOptionHandle);if(!currentOptionSwatches.length)return;const selectedForOtherOptions=optionHandles.filter(handle=>handle!==currentOptionHandle).map(handle=>{const selectedBtn=allSwatches.find(btn=>btn.dataset.optionName===handle&&btn.classList.contains("selected"));return selectedBtn?selectedBtn.dataset.swatchValue:null}).filter(Boolean),unavailableValues=[];currentOptionSwatches.forEach(swatch=>{const testCombination=[...selectedForOtherOptions,swatch.dataset.swatchValue];this.variantExistsForCombination(testCombination,productData.variants)||unavailableValues.push(swatch.dataset.swatchValue)}),currentOptionSwatches.forEach(swatch=>{const isUnavailable=unavailableValues.includes(swatch.dataset.swatchValue);swatch.disabled=isUnavailable,isUnavailable?(swatch.classList.add("hide-swatch"),swatch.classList.add("disabled")):(swatch.classList.remove("hide-swatch"),swatch.classList.remove("disabled"));const stickyBarEl=document.querySelector(".sticky-atc-bar");if(stickyBarEl&&!modal&&!card&&!context){const stickySwatch=stickyBarEl.querySelector(`.swatch-btn[data-option-name="${currentOptionHandle}"][data-swatch-value="${swatch.dataset.swatchValue}"]`);stickySwatch&&(stickySwatch.disabled=isUnavailable,isUnavailable?stickySwatch.classList.add("hide-swatch","disabled"):stickySwatch.classList.remove("hide-swatch","disabled"))}swatch.tagName==="OPTION"&&(isUnavailable?swatch.textContent.includes(themeT("product.option_unavailable"))||(swatch.textContent+=themeT("product.option_unavailable")):swatch.textContent=swatch.textContent.replace(themeT("product.option_unavailable"),""))});const currentlySelected=currentOptionSwatches.find(btn=>btn.classList.contains("selected")||btn.tagName==="OPTION"&&btn.selected),selectedValue=currentlySelected?currentlySelected.dataset.swatchValue:null;if(!selectedValue||unavailableValues.includes(selectedValue)){const firstAvailable=currentOptionSwatches.find(btn=>!btn.disabled&&!btn.classList.contains("hide-swatch"));firstAvailable&&firstAvailable.dataset.swatchValue!==selectedValue&&(parent._swatchCorrectionTimers||(parent._swatchCorrectionTimers={}),parent._swatchCorrectionTimers[currentOptionHandle]||(parent._swatchCorrectionTimers[currentOptionHandle]=setTimeout(()=>{if(parent._swatchCorrectionTimers[currentOptionHandle]=null,firstAvailable.tagName==="OPTION"){const select=firstAvailable.closest("select");select.value=firstAvailable.value,select.dispatchEvent(new Event("change",{bubbles:!0}))}else firstAvailable.click()},50)))}const dropdownSwatch=currentOptionSwatches.find(swatch=>swatch.tagName==="OPTION");if(dropdownSwatch){const select=dropdownSwatch.closest("select");if(select){const allOptions=Array.from(select.options),selectedOpt=allOptions.find(opt=>opt.value===select.value);if(selectedOpt&&selectedOpt.disabled){select.setAttribute("data-force-change",!0);const firstAvailableOption=allOptions.find(opt=>!opt.disabled);firstAvailableOption&&(parent._swatchCorrectionTimers||(parent._swatchCorrectionTimers={}),parent._swatchCorrectionTimers[currentOptionHandle+"_select"]||(parent._swatchCorrectionTimers[currentOptionHandle+"_select"]=setTimeout(()=>{parent._swatchCorrectionTimers[currentOptionHandle+"_select"]=null,select.value=firstAvailableOption.value;const event=new Event("change",{bubbles:!0,cancelable:!0});select.dispatchEvent(event)},50)))}}}})},handleSwatchChange:async function(swatch,modal=!1,card=!1,context=null){if(swatch&&typeof swatch.closest=="function"&&swatch.closest(".sticky-atc-bar"))return;let parent,productData,variantIdInput,addToCartBtn,fixedAddToCartBtn,prices,urls,announcementBar,productTitleH1s,retired,ogTitleWithShape,ogImage,ogImageSecureUrl,behindProdAcc,featuresAcc,techSpecsAcc,detailsCareAcc,customizeBtn;if(typeof ProductPage<"u"&&({productTitleH1s,ogTitleWithShape,ogImage,ogImageSecureUrl,behindProdAcc,featuresAcc,techSpecsAcc,detailsCareAcc,retired,customizeBtn,announcementBar}=ProductPage),context)parent=context.parent,productData=context.productData;else if(modal)variantIdInput=Modal.idInput,parent=Modal.parent,addToCartBtn=Modal.addToCartBtn,productData=Modal.productData,prices=parent.querySelector(".prices");else if(card){if(parent=swatch.closest(".product-card"),!parent)return;addToCartBtn=parent.querySelector(".quick-add"),addToCartBtn&&(addToCartBtn.disabled=!0),prices=parent.querySelector(".prices"),urls=parent.querySelectorAll(".product-url");let swatchTarget=swatch;swatch.tagName==="IMG"||swatch.tagName==="SPAN"?swatchTarget=swatch.closest(".swatch-btn")||swatch.closest("button"):swatch.tagName==="SELECT"?swatchTarget=swatch.selectedOptions[0]:swatch.tagName!=="BUTTON"&&swatch.tagName!=="OPTION"&&(swatchTarget=swatch.closest(".swatch-btn")||swatch);const handle=swatchTarget.dataset.handle;try{productData=await Utility.fetchProductDataAjax(handle),ProductCards.productData=productData,parent.productData=productData}catch(error){console.error("Error fetching product data:",error);return}variantIdInput=parent.querySelector(".var-id")}else variantIdInput=ProductPage.idInput,parent=ProductPage.parent,addToCartBtn=ProductPage.addToCartBtn,fixedAddToCartBtn=ProductPage.fixedAddToCartBtn?.querySelector(".fixed-add-to-cart-btn"),productData=ProductPage.productData,prices=ProductPage.pricesMain;let selectedOptions=[];const quantitySelector=parent?parent.querySelector(".quantity"):null;let selectedBtn=swatch,select;selectedBtn.tagName==="IMG"||selectedBtn.tagName==="SPAN"?selectedBtn=selectedBtn.closest(".swatch-btn")||selectedBtn.closest("button"):selectedBtn.tagName==="SELECT"?(select=selectedBtn,selectedBtn=selectedBtn.selectedOptions[0]):selectedBtn.tagName==="OPTION"?select=selectedBtn.closest("select"):selectedBtn.tagName!=="BUTTON"&&(selectedBtn=selectedBtn.closest(".swatch-btn")||selectedBtn);const optionName=selectedBtn.dataset.optionName,swatchValue=selectedBtn.dataset.swatchValue,optionNameHandle=Utility.shopifyHandleize(optionName);if(optionNameHandle==="color"){const isLimited=selectedBtn.dataset.isLimited==="true",limitedSwatchText=parent.querySelector(`#${optionNameHandle}-limited-selected`),coreSwatchText=parent.querySelector(`#${optionNameHandle}-core-selected`),limitedColorLabel=parent.querySelector(".limited-color-label"),coreColorLabel=parent.querySelector(".core-color-label");isLimited?(limitedSwatchText&&(limitedSwatchText.textContent=swatchValue),limitedColorLabel&&(limitedColorLabel.textContent=limitedColorLabel.dataset.base
1Label+": "),coreSwatchText&&(coreSwatchText.textContent=""),coreColorLabel&&(coreColorLabel.textContent=coreColorLabel.dataset.baseLabel)):(coreSwatchText&&(coreSwatchText.textContent=swatchValue),coreColorLabel&&(coreColorLabel.textContent=coreColorLabel.dataset.baseLabel+": "),limitedSwatchText&&(limitedSwatchText.textContent=""),limitedColorLabel&&(limitedColorLabel.textContent=limitedColorLabel.dataset.baseLabel))}else{const selectedSwatchText=parent.querySelector(`#${optionNameHandle}-selected`);selectedSwatchText&&(selectedSwatchText.textContent=swatchValue)}if(this.stickyBar&&!context){const stickyBarEl=document.querySelector(".sticky-atc-bar");if(stickyBarEl){if(optionNameHandle==="shape")this.stickyShapeBtns&&this.stickyShapeBtns.length>0&&this.stickyShapeBtns.forEach(btn=>{btn.getAttribute("data-swatch-value")===swatchValue?btn.classList.add("is-active","selected"):btn.classList.remove("is-active","selected")}),this.stickyShapeLabelText&&(this.stickyShapeLabelText.textContent=swatchValue);else if(optionNameHandle==="color"){this.stickyColorBtns&&this.stickyColorBtns.length>0&&this.stickyColorBtns.forEach(btn=>{btn.getAttribute("data-swatch-value")===swatchValue?btn.classList.add("is-active","selected"):btn.classList.remove("is-active","selected")});const isLimited=selectedBtn.dataset.isLimited==="true",stickyLimitedLabel=stickyBarEl.querySelector('.sticky-atc-selected-color-text[data-type="limited"]'),stickyCoreLabel=stickyBarEl.querySelector('.sticky-atc-selected-color-text[data-type="core"]');isLimited?(stickyLimitedLabel&&(stickyLimitedLabel.textContent=swatchValue,stickyLimitedLabel.previousElementSibling&&(stickyLimitedLabel.previousElementSibling.textContent=stickyLimitedLabel.previousElementSibling.dataset.baseLabel+": ")),stickyCoreLabel&&(stickyCoreLabel.textContent="",stickyCoreLabel.previousElementSibling&&(stickyCoreLabel.previousElementSibling.textContent=stickyCoreLabel.previousElementSibling.dataset.baseLabel))):(stickyCoreLabel&&(stickyCoreLabel.textContent=swatchValue,stickyCoreLabel.previousElementSibling&&(stickyCoreLabel.previousElementSibling.textContent=stickyCoreLabel.previousElementSibling.dataset.baseLabel+": ")),stickyLimitedLabel&&(stickyLimitedLabel.textContent="",stickyLimitedLabel.previousElementSibling&&(stickyLimitedLabel.previousElementSibling.textContent=stickyLimitedLabel.previousElementSibling.dataset.baseLabel)))}}}select&&select.getAttribute("data-force-change")!=="true"||!select?(selectedOptions=this.updateSelectedSwatches(parent,optionNameHandle,selectedBtn,card,modal),this.updateSwatchesExist(swatchValue,optionNameHandle,modal,card?parent:!1,context)):select&&select.getAttribute("data-force-change")=="true"&&(select.setAttribute("data-force-change",!1),selectedOptions=Array.from(parent.querySelectorAll(".swatch-btn.selected")).filter(el=>!el.closest(".sticky-atc-bar")).map(s=>s.dataset.swatchValue));const saveBtn=parent.querySelector(".save-btn");saveBtn&&(saveBtn.disabled=!0);const matchingVariant=productData.variants.find(variant=>{const variantAttributes=variant.title.split(" / ").map(attr=>attr.trim().toLowerCase());return selectedOptions.map(option=>option.toLowerCase()).every(option=>variantAttributes.some(variantAttr=>variantAttr===option))});if(!matchingVariant){console.error("No matching variant found for selected options:",selectedOptions);return}if(!modal&&!card&&!context&&this.updateDynamicBackground(matchingVariant.id),context){typeof context.onVariantChange=="function"&&await context.onVariantChange(matchingVariant),await this.updateSwatchesStock(swatchValue,optionNameHandle,!1,null,context);return}const variantData=await Utility.fetchProductDetails(productData.handle,matchingVariant.id);modal?Modal.productDetails=variantData:card||(ProductPage.productDetails=variantData);const limitedEditionLabel=parent.querySelector("[data-limited-edition-label]");if(limitedEditionLabel&&(variantData.limitedEdition?limitedEditionLabel.classList.remove("hidden"):limitedEditionLabel.classList.add("hidden")),card||this.updateShippingDelay(variantData),!modal&&!card&&this.updateEarlyAccessRestriction(variantData),!retired&&!card&&(variantIdInput&&(variantIdInput.value=matchingVariant.id),quantitySelector)){const mainQuantity=quantitySelector.querySelector("#main-quantity");mainQuantity&&(mainQuantity.value=1)}const formatLocalizedMoney=cents=>Utility.formatLocalizedMoney(cents);if(!modal&&!card){const variant=variantData||matchingVariant,isAvailable=!!(variant&&variant.available===!0),notifyContainer=this.notifyContainer,notifyButton=this.notifyButton;if(notifyButton&&variant&&variant.id&&(notifyButton.dataset.variantId=String(variant.id)),notifyContainer&&variantData&&(notifyContainer.dataset.isLimitedEdition=variantData.limitedEdition?"true":"false"),notifyContainer&&(notifyContainer.style.display=isAvailable?"n
1one":"block",isAvailable?notifyContainer.setAttribute("aria-hidden","true"):notifyContainer.removeAttribute("aria-hidden")),notifyButton&&(notifyButton.style.display=isAvailable?"none":""),optionNameHandle==="shape"){const shapeSwatch=document.querySelector(".swatch-btn-shape.selected");shapeSwatch&&(this.selectedShape=shapeSwatch.dataset.swatchValue),ProductPage.updateShapeGuide(),ogTitleWithShape&&ogTitleWithShape.setAttribute("content",productData.title+" - "+swatchValue),ogImage&&matchingVariant.featured_image&&ogImage.setAttribute("content",matchingVariant.featured_image.src),ogImageSecureUrl&&matchingVariant.featured_image&&ogImageSecureUrl.setAttribute("content",matchingVariant.featured_image.src),variantData.behindTheProduct&&behindProdAcc&&(behindProdAcc.innerHTML=variantData.behindTheProduct),variantData.productFeatures&&featuresAcc&&(featuresAcc.innerHTML=variantData.productFeatures),variantData.techSpecs&&techSpecsAcc&&(techSpecsAcc.innerHTML=variantData.techSpecs),variantData.detailsCare&&detailsCareAcc&&(detailsCareAcc.innerHTML=variantData.detailsCare)}if(typeof ProductPage<"u"&&typeof ProductPage.updateStatBars=="function"&&ProductPage.updateStatBars(variantData),this.updateImageGallery(modal,matchingVariant.id,productData.handle,this.modelInfoParts),optionNameHandle==="color"||optionNameHandle==="design"){const gcImage=document.querySelector(".gc-image img");if(gcImage&&(gcImage.src=matchingVariant.featured_image.src),optionNameHandle==="color"&&productData.title.includes("Pro Air")){announcementBar&&(announcementBar.style.backgroundColor=selectedBtn.dataset.bgColor),addToCartBtn&&(addToCartBtn.style.backgroundColor=selectedBtn.dataset.bgColor),fixedAddToCartBtn&&(fixedAddToCartBtn.style.backgroundColor=selectedBtn.dataset.bgColor);const fbtProducts=document.querySelectorAll(".fbt-product-card");fbtProducts.length&&fbtProducts.forEach(product=>{const swatches=product.querySelectorAll(".swatch-btn-color");let swatchToSelect=null;Array.from(swatches).forEach(swatch2=>{(swatch2.dataset.swatchValue.includes(swatchValue)||swatchValue=="Silver"&&swatch2.dataset.swatchValue.includes("Black"))&&(swatchToSelect=swatch2)}),swatchToSelect&&swatchToSelect.click()})}this.updateImageGallery(modal,matchingVariant.id,productData.handle,this.modelInfoParts)}const updatePriceElement=price=>{const surveySaleElement=price.querySelector("[data-apparel-survey-price] [data-apparel-survey-amount]");if(surveySaleElement){const surveyCompareElement=price.querySelector("[data-apparel-survey-compare-price] [data-apparel-survey-amount]");surveyCompareElement&&(surveyCompareElement.textContent=formatLocalizedMoney(matchingVariant.price)),surveySaleElement.textContent=formatLocalizedMoney(Math.floor(matchingVariant.price/2));return}price.innerHTML=matchingVariant.compare_at_price?`<span class="compare-price">${formatLocalizedMoney(matchingVariant.compare_at_price)}</span><span class="price on-sale">${formatLocalizedMoney(matchingVariant.price)}</span>`:`<span class="price">${formatLocalizedMoney(matchingVariant.price)}</span>`};if(prices&&prices.length?prices.forEach(price=>{updatePriceElement(price)}):prices&&updatePriceElement(prices),this.stickySubmitBtn&&matchingVariant){const stickyPriceSpan=this.stickySubmitBtn.querySelector("span");stickyPriceSpan&&(stickyPriceSpan.innerHTML=formatLocalizedMoney(matchingVariant.price))}const isPreorder=variantData?.preorder===!0;addToCartBtn&&(addToCartBtn.textContent=isPreorder?themeT("product.pre_order"):themeT("product.add_to_cart"),addToCartBtn.dataset.preorder=isPreorder),fixedAddToCartBtn&&(fixedAddToCartBtn.textContent=isPreorder?themeT("product.pre_order"):themeT("product.add_to_cart"),fixedAddToCartBtn.dataset.preorder=isPreorder);const url=new URL(window.location.href);url.searchParams.set("variant",matchingVariant.id),window.history.pushState({path:url.toString()},"",url.toString())}card||(this.productType=="Apparel"&&(this.modelInfoParts=variantData.modelInfo?variantData.modelInfo.split(" | "):null,!this.verticalGallery&&typeof ProductPage<"u"&&ProductPage.modelInfo&&ProductPage.modelInfo.length&&ProductPage.modelInfo.forEach(el=>{const paragraph=el.querySelector("p");paragraph&&(this.modelInfoParts?(paragraph.textContent=`Model is ${this.modelInfoParts[0]} wearing ${this.modelInfoParts[1]}`,el.style.display=""):el.style.display="none")})),retired||(this.updateSwatchesStock(swatchValue,optionNameHandle,modal,card?parent:!1),this.handleOutOfStock(modal,matchingVariant.id))),customizeBtn&&!modal&&!card&&(variantData.disableCustoms?(customizeBtn.style.display="none",ProductPage.showCustomOptionsPDP("none"),ProductPage.handleSaveCustomizations(!1)):customizeBtn.style.display="block");const gripError=parent.querySelector(".grip-error");
1if(gripError&&(gripError.style.display="none"),saveBtn&&(saveBtn.disabled=!1),card){if(urls&&urls.length&&urls.forEach((url=>url.href="/products/"+productData.handle+"?variant="+matchingVariant.id)),variantIdInput&&(variantIdInput.value=matchingVariant.id),prices&&!prices.closest(".promo-container")){const surveySaleEl=prices.querySelector("[data-apparel-survey-price] [data-apparel-survey-amount]");if(surveySaleEl){const surveyCompareEl=prices.querySelector("[data-apparel-survey-compare-price] [data-apparel-survey-amount]");if(surveyCompareEl&&(surveyCompareEl.textContent=formatLocalizedMoney(matchingVariant.price)),surveySaleEl.textContent=formatLocalizedMoney(Math.floor(matchingVariant.price/2)),addToCartBtn){const promoPrice=addToCartBtn.dataset.promoPrice;let labelPriceText;if(promoPrice){const promoPriceNumber=parseFloat(String(promoPrice).replace(/[^0-9.]/g,""));labelPriceText=Number.isFinite(promoPriceNumber)?formatLocalizedMoney(Math.round(promoPriceNumber*100)):String(promoPrice)}else labelPriceText=formatLocalizedMoney(matchingVariant.price);addToCartBtn.setAttribute("aria-label",`Click to add ${productData.title} to cart for ${labelPriceText}`)}}else{let promoPrice=null;if(addToCartBtn&&addToCartBtn.dataset.promoPrice&&(promoPrice=addToCartBtn.dataset.promoPrice),promoPrice){const promoPriceNumber=parseFloat(String(promoPrice).replace(/[^0-9.]/g,"")),promoPriceDisplay=Number.isFinite(promoPriceNumber)?formatLocalizedMoney(Math.round(promoPriceNumber*100)):String(promoPrice);prices.innerHTML=`<span class="compare-price">${formatLocalizedMoney(matchingVariant.price)}</span><span class="price on-sale">${promoPriceDisplay}</span>`}else prices.innerHTML=matchingVariant.compare_at_price?`<span class="compare-price">${formatLocalizedMoney(matchingVariant.compare_at_price)}</span><span class="price on-sale">${formatLocalizedMoney(matchingVariant.price)}</span>`:`<span class="price">${formatLocalizedMoney(matchingVariant.price)}</span>`}}const image=parent.querySelector(".product-card-img");if(image&&optionNameHandle=="color"&&(image.src=selectedBtn.dataset.firstImg,image.alt=selectedBtn.dataset.imageAlt,image.dataset.nextImg=selectedBtn.dataset.nextImg,image.dataset.firstImg=selectedBtn.dataset.firstImg),addToCartBtn&&(matchingVariant.available?(addToCartBtn.dataset.updatePrice=="true"?addToCartBtn.textContent=themeT("product.quick_add_price",{price:formatLocalizedMoney(matchingVariant.price)}):addToCartBtn.textContent=themeT("product.quick_add"),addToCartBtn.disabled=!1,addToCartBtn.classList.remove("out-of-stock")):(addToCartBtn.disabled=!0,addToCartBtn.textContent=themeT("product.out_of_stock"),addToCartBtn.classList.add("out-of-stock"))),this.updateEarlyAccessRestriction(variantData,{card:!0,addToCartBtn}),this.updateSwatchesStock(swatchValue,optionNameHandle,!1,parent),optionNameHandle=="shape"){const colorSwatches=parent.querySelectorAll(".swatch-btn-color");if(colorSwatches){const filteredVariants=productData.variants.filter(variant=>variant.title.includes(swatchValue)),filteredSwatches=Array.from(colorSwatches).filter(swatch2=>{const swatchValue2=swatch2.dataset.swatchValue;return filteredVariants.some(variant=>variant.title.includes(swatchValue2))});colorSwatches.forEach(swatch2=>{filteredSwatches.includes(swatch2)?swatch2.classList.remove("hide-swatch"):swatch2.classList.add("hide-swatch")})}}}},updateSelectedSwatches:function(parent,optionNameHandle,selectedBtn,card,modal){if(!parent||!selectedBtn)return[];parent.querySelectorAll(`[data-option-name="${selectedBtn.dataset.optionName}"]`).forEach(swatch=>{swatch.classList.remove("selected")}),selectedBtn.classList.add("selected");let allSwatches=Array.from(parent.querySelectorAll(".swatch-btn")),selectedOptions=[];return allSwatches.forEach(swatch=>{(swatch.classList.contains("selected")||swatch.tagName==="OPTION"&&swatch.selected)&&(selectedOptions.includes(swatch.dataset.swatchValue)||selectedOptions.push(swatch.dataset.swatchValue))}),selectedOptions},handleQuantityChange:function(btn,operation,modal=!1,context=null){let input,root;if(context){const baseParent=context.parent;root=baseParent.closest("#popup-chat-customizer")||baseParent.closest("[data-product-customizer-panel]")||baseParent.parentElement||baseParent,
1input=root.querySelector("[data-customizer-qty-input]")}else{const container=btn.closest(".quantity");input=container?container.querySelector(".number-input"):null}if(!input)return;let currentValue=parseInt(input.value,10)||1,newValue=currentValue;if(operation==="increase"?newValue=currentValue+1:operation==="decrease"&¤tValue>1&&(newValue=currentValue-1),input.value=newValue,context){const variantIdInput=root.querySelector("[data-customizer-variant-input]"),subtotalElement=root.querySelector("[data-customizer-subtotal]"),numericVariantId=(variantIdInput?String(variantIdInput.value):"").replace("gid://shopify/ProductVariant/",""),matchingVariant=numericVariantId?context.productData.variants.find(variant=>String(variant.id)===String(numericVariantId)):null,subtotalCents=(matchingVariant?Number(matchingVariant.price):0)*newValue;subtotalElement&&(subtotalElement.textContent=`$${(subtotalCents/100).toFixed(2)}`)}else{let addToCartBtn,variantData;modal?(addToCartBtn=Modal.addToCartBtn,variantData=Modal.productDetails):(addToCartBtn=ProductPage.addToCartBtn,variantData=ProductPage.productDetails);const inventory=variantData.inventory,price=(variantData.price*newValue/100).toFixed(2).replace(/\.00$/,"");inventory<1&&variantData.available||input.value<=inventory?(addToCartBtn&&(addToCartBtn.disabled=!1,addToCartBtn.textContent=modal?themeT("product.quick_add_price",{price}):themeT("product.add_to_cart")),input.classList.remove("invalid-quantity")):(addToCartBtn&&(addToCartBtn.disabled=!0,addToCartBtn.textContent=themeT("product.quantity_unavailable")),input.classList.add("invalid-quantity"))}},checkLoopExclusions:function(variantId,modal=!1,available=!0){const{loopErrorText}=this;let addToCartBtn,fixedAddToCartBtn;if(modal?addToCartBtn=Modal.addToCartBtn:(addToCartBtn=ProductPage.addToCartBtn,ProductPage.fixedAddToCartBtn&&(fixedAddToCartBtn=ProductPage.fixedAddToCartBtn.querySelector(".fixed-add-to-cart-btn"))),!document.body.classList.contains("loop-returns-activated")){addToCartBtn&&addToCartBtn.classList.remove("loop-excluded"),fixedAddToCartBtn&&fixedAddToCartBtn.classList.remove("loop-excluded"),loopErrorText&&loopErrorText.classList.remove("loop-excluded");return}(window.loopExcludedVariants||[]).includes(Number(variantId))?(addToCartBtn&&addToCartBtn.classList.add("loop-excluded"),fixedAddToCartBtn&&fixedAddToCartBtn.classList.add("loop-excluded"),available?loopErrorText&&loopErrorText.classList.add("loop-excluded"):loopErrorText&&loopErrorText.classList.remove("loop-excluded")):(addToCartBtn&&addToCartBtn.classList.remove("loop-excluded"),fixedAddToCartBtn&&fixedAddToCartBtn.classList.remove("loop-excluded"),loopErrorText&&loopErrorText.classList.remove("loop-excluded"))},initMaestraEventListeners:function(){document.addEventListener("maestra:fbt:loaded",event=>{const container=event.detail.container;container&&this.bindFbtCards(container)})},bindFbtCards:function(container){const newSwatches=container.querySelectorAll(".swatch-btn");newSwatches.length&&newSwatches.forEach(swatch=>{swatch.addEventListener("click",()=>{this.handleSwatchChange(swatch,!1,!0)})});const selectSwatches=container.querySelectorAll("select");selectSwatches.length&&selectSwatches.forEach(select=>{select.addEventListener("change",()=>{this.handleSwatchChange(select,!1,!0)})});const newCards=container.querySelectorAll(".fbt-product-card");newCards.length&&newCards.forEach(card=>{const firstSwatch=card.querySelector(".selected")||card.querySelector("option[selected]")||card.querySelector("option");firstSwatch&&this.handleSwatchChange(firstSwatch,!1,!0);const quickAddBtn=card.querySelector(".quick-add, .quick-add-to-cart");quickAddBtn&&typeof Cart<"u"&&quickAddBtn.addEventListener("click",event=>{Cart.addToCart(event)})})},updateDynamicBackground:function(variantId){const targets=document.querySelectorAll("[data-dynamic-bg-target]"),backgroundMap=window.dynamicVariantBackgrounds;let rawBackgroundMap=null;const rawDataEl=document.getElementById("raw-variant-backgrounds");if(rawDataEl)try{rawBackgroundMap=JSON.parse(rawDataEl.textContent)}catch{}targets.length>
10&&backgroundMap!==void 0&&targets.forEach(target=>{let newBackground=backgroundMap[variantId];if(target.hasAttribute("data-default-bg")&&rawBackgroundMap){const rawBg=rawBackgroundMap[variantId];rawBg&&rawBg.trim()!==""?newBackground=rawBg:newBackground=target.getAttribute("data-default-bg")}newBackground&&newBackground.trim()!==""?target.style.background=newBackground:target.hasAttribute("data-default-bg")?target.style.background=target.getAttribute("data-default-bg"):target.style.background=""})},initStickyBar:function(){const{stickyBar,stickyShapeBtns,stickyColorBtns,stickySubmitBtn,stickyCloseBtn,stickyFab}=this;if(!stickyBar)return;const targetSelector=stickyBar.getAttribute("data-target-selector");if(!targetSelector)return;const targetElement=document.querySelector(targetSelector);let isUserClosed=!1;if(targetElement){const handleIntersect=entries=>{entries[0].boundingClientRect.bottom<0?isUserClosed?stickyFab&&(stickyFab.classList.add("is-visible"),stickyFab.setAttribute("aria-hidden","false"),stickyFab.setAttribute("aria-expanded","false")):(stickyBar.classList.add("is-visible"),stickyBar.setAttribute("aria-hidden","false"),stickyFab&&(stickyFab.classList.remove("is-visible"),stickyFab.setAttribute("aria-hidden","true"),stickyFab.setAttribute("aria-expanded","true"))):(stickyBar.classList.remove("is-visible"),stickyBar.setAttribute("aria-hidden","true"),stickyFab&&(stickyFab.classList.remove("is-visible"),stickyFab.setAttribute("aria-hidden","true")))};new IntersectionObserver(handleIntersect,{root:null,threshold:0}).observe(targetElement),stickyCloseBtn&&stickyFab&&(stickyCloseBtn.addEventListener("click",()=>{isUserClosed=!0,stickyBar.classList.remove("is-visible"),stickyBar.setAttribute("aria-hidden","true"),stickyCloseBtn.setAttribute("aria-expanded","false"),stickyFab.classList.add("is-visible"),stickyFab.setAttribute("aria-hidden","false"),stickyFab.setAttribute("aria-expanded","false"),stickyFab.focus()}),stickyFab.addEventListener("click",()=>{isUserClosed=!1,stickyFab.classList.remove("is-visible"),stickyFab.setAttribute("aria-hidden","true"),stickyFab.setAttribute("aria-expanded","true"),stickyBar.classList.add("is-visible"),stickyBar.setAttribute("aria-hidden","false"),stickyCloseBtn.setAttribute("aria-expanded","true"),stickyCloseBtn.focus()}),document.addEventListener("keydown",event=>{(event.key==="Escape"||event.key==="Esc")&&stickyBar.classList.contains("is-visible")&&(isUserClosed=!0,stickyBar.classList.remove("is-visible"),stickyBar.setAttribute("aria-hidden","true"),stickyCloseBtn.setAttribute("aria-expanded","false"),stickyFab.classList.add("is-visible"),stickyFab.setAttribute("aria-hidden","false"),stickyFab.setAttribute("aria-expanded","false"),stickyFab.focus())}))}const findMainFormSwatch=(optionClass,value)=>{if(!value)return null;const form=document.querySelector("#product-swatches");return form?form.querySelector(`.${optionClass}[data-swatch-value="${CSS.escape(value)}"]`):null},triggerMainSwatchChange=async(optionClass,value)=>{const mainSwatch=findMainFormSwatch(optionClass,value);mainSwatch&&await this.handleSwatchChange(mainSwatch)},triggerMainFormClick=selector=>{const form=document.querySelector("#product-swatches"),mainBtn=form?form.querySelector(selector):document.querySelector(selector);mainBtn&&mainBtn.click()};stickyShapeBtns&&stickyShapeBtns.length>0&&stickyShapeBtns.forEach(btn=>{btn.addEventListener("click",event=>{const value=event.currentTarget.getAttribute("data-swatch-value");triggerMainSwatchChange("swatch-btn-shape",value)})}),stickyColorBtns&&stickyColorBtns.length>0&&stickyColorBtns.forEach(btn=>{btn.addEventListener("click",event=>{const value=event.currentTarget.getAttribute("data-swatch-value");triggerMainSwatchChange("swatch-btn-color",value)})}),stickySubmitBtn&&stickySubmitBtn.addEventListener("click",()=>{const originalHTML=stickySubmitBtn.innerHTML;stickySubmitBtn.innerHTML=themeT("product.adding_to_cart"),triggerMainFormClick(".add-to-cart-main"),setTimeout(()=>{stickySubmitBtn.innerHTML=originalHTML},2e3)})}}; 2//# sourceMappingURL=/cdn/shop/t/642/assets/product-shared-scripts.js.map?v=95202249941116742241790099258
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.