const loadCss=fileName=>new Promise((resolve,reject)=>{const link=document.createElement("link"),fileId=`${fileName.toUpperCase()?.replace("-","")}CSS`,mainPath=document.getElementById("MainCssPath").href;link.onload=resolve,link.onerror=reject,link.id=fileId,link.rel="stylesheet",link.type="text/css",link.href=mainPath.includes("?v")?mainPath.split("?v")[0]?.replace("/assets/main.css",`/assets/${fileName}.css`):mainPath.replace("/assets/main.css",`/assets/${fileName}.css`),link.media="all",document.getElementById(fileId)||document.head.appendChild(link)}),loadScript=fileName=>new Promise((resolve,reject)=>{const script=document.createElement("script"),fileId=`${fileName.toUpperCase()?.replace("-","")}JS`,mainPath=document.getElementById("MainJsPath").src;script.onload=resolve,script.onerror=reject,script.async=!0,script.id=fileId,script.type="text/javascript",script.src=mainPath.includes("?v")?mainPath.split("?v")[0]?.replace("/assets/main.js",`/assets/${fileName}.js`):mainPath.replace("/assets/main.js",`/assets/${fileName}.js`),document.getElementById(fileId)||document.head.appendChild(script)}),scrollAnimationObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&(entry.target.classList.add("scroll-animation--active"),scrollAnimationObserver.unobserve(entry.target))})},{threshold:.25});(function(){document.documentElement.classList.contains("js-animations--accent")&&document.querySelectorAll(".scroll-animation").forEach((el,i)=>{scrollAnimationObserver.observe(el)})})(),window.addEventListener("DOMContentLoaded",()=>{document.querySelector(".announcement-bar")!=null&&document.body.classList.add("is-announcement-bar")});function debounce(fn,wait){let t;return(...args)=>{clearTimeout(t),t=setTimeout(()=>fn.apply(this,args),wait)}}function fetchConfig(type="json"){return{method:"POST",headers:{"Content-Type":"application/json",Accept:`application/${type}`}}}function getFocusableElements(container){return Array.from(container.querySelectorAll("summary, a[href], button:enabled, [tabindex]:not([tabindex^='-']), [draggable], area, input:not([type=hidden]):enabled, select:enabled, textarea:enabled, object, iframe, .drawer, modal-dialog"))}const trapFocusHandlers={};function trapFocus(container,elementToFocus=container){var elements=getFocusableElements(container),first=elements[0],last=elements[elements.length-1];removeTrapFocus(),trapFocusHandlers.focusin=event=>{event.target!==container&&event.target!==last&&event.target!==first||document.addEventListener("keydown",trapFocusHandlers.keydown)},trapFocusHandlers.focusout=function(){document.removeEventListener("keydown",trapFocusHandlers.keydown)},trapFocusHandlers.keydown=function(event){event.code.toUpperCase()==="TAB"&&(event.target===last&&!event.shiftKey&&(event.preventDefault(),first.focus()),(event.target===container||event.target===first)&&event.shiftKey&&(event.preventDefault(),last.focus()))},document.addEventListener("focusout",trapFocusHandlers.focusout),document.addEventListener("focusin",trapFocusHandlers.focusin),elementToFocus.focus(),elementToFocus.tagName==="INPUT"&&["search","text","email","url"].includes(elementToFocus.type)&&elementToFocus.value&&elementToFocus.setSelectionRange(0,elementToFocus.value.length)}function removeTrapFocus(elementToFocus=null){document.removeEventListener("focusin",trapFocusHandlers.focusin),document.removeEventListener("focusout",trapFocusHandlers.focusout),document.removeEventListener("keydown",trapFocusHandlers.keydown),elementToFocus&&elementToFocus.focus()}function onKeyUpEscape(event){if(event.code.toUpperCase()!=="ESCAPE")return;const openDetailsElement=event.target.closest("details[open]");if(!openDetailsElement)return;const summaryElement=openDetailsElement.querySelector("summary");openDetailsElement.classList.remove("details--active"),summaryElement.setAttribute("aria-expanded",!1),setTimeout(()=>{openDetailsElement.removeAttribute("open")},500),summaryElement.classList.contains("mmenu__hamburger")&&document.body.classList.contains("mmenu--open")&&document.body.classList.remove("mmenu--open"),summaryElement.focus()}class Accordion{constructor(el){this.details=el,this.summary=el.querySelector("summary"),this.content=el.querySelector(".details__content"),this.summary.addEventListener("click",event=>this.onClick(event)),this.details.addEventListener("keyup",onKeyUpEscape),window.addEventListener("DOMContentLoaded",this.mobileOnlyDetails()),window.addEventListener("resize",()=>{this.mobileOnlyDetails()})}onClick(event){event.preventDefault(),event.currentTarget.setAttribute("aria-expanded",!this.details.hasAttribute("open")),this.details.hasAttribute("open")?this.collapse():this.expand(),this.summary.classList.contains("mmenu__hamburger")&&document.body.classList.toggle("mmenu--open")}collapse(){this.details.classList.remove("details--active"),setTimeout(()=>{this.details.removeAttribute("open")},500)}expand(){this.details.setAttribute("open",""),setTimeout(()=>{this.details.classList.add("details--active")},250)}mobileOnlyDetails(){this.details.classList.contains("mobile--only")&&(window.innerWidth<769?this.collapse():this.expand())}}document.querySelectorAll('[id^="Details-"]').forEach(el=>{new Accordion(el)});try{document.querySelector(":focus-visible")}catch{focusVisiblePolyfill()}function focusVisiblePolyfill(){const navKeys=["ARROWUP","ARROWDOWN","ARROWLEFT","ARROWRIGHT","TAB","ENTER","SPACE","ESCAPE","HOME","END","PAGEUP","PAGEDOWN"];let currentFocusedElement=null,mouseClick=null;window.addEventListener("keydown",event=>{navKeys.includes(event.code.toUpperCase())&&(mouseClick=!1)}),window.addEventListener("mousedown",event=>{mouseClick=!0}),window.addEventListener("focus",()=>{currentFocusedElement&¤tFocusedElement.classList.remove("focused"),!mouseClick&&(currentFocusedElement=document.activeElement,currentFocusedElement.classList.add("focused"))},!0)}class VariantSelects extends HTMLElement{constructor(){super(),this.addEventListener("change",this.onVariantChange)}onVariantChange(){this.updateOptions(),this.updateMasterId(),this.toggleAddButton(!0,"",!1),this.updatePickupAvailability(),this.removeErrorMessage(),this.updateVariantStatuses(),this.currentVariant?(this.updateMedia(),this.updateURL(),this.updateVariantInput(),this.renderProductInfo(),this.updateShareUrl()):(this.toggleAddButton(!0,"",!0),this.setUnavailable())}updateOptions(){this.options=Array.from(this.querySelectorAll("select"),select=>select.value)}updateMasterId(){this.currentVariant=this.getVariantData().find(variant=>!variant.options.map((option,index)=>this.options[index]===option).includes(!1))}updateMedia(){if(!this.currentVariant||!this.currentVariant.featured_media)return;const variantImage=this.currentVariant.featured_media.preview_image.src;if(this.closest(".product-card")){const media=this.closest(".product-card").querySelector(".product-card__media .media--primary");media.innerHTML=``}else{const carousel=document.querySelector("#main-carousel");if(!carousel)return;const media=carousel.querySelector(`.splide__slide[data-media-position="${this.currentVariant.featured_media.position}"]`),mediaContainer=carousel.querySelector(".splide__list");if(carousel.classList.contains("is-active")){var Slides=main.Components.Slides.filter(".product__media-item");Slides[this.currentVariant.featured_media.position]&&(carousel.classList.contains("splide--loop")?main.go(Slides[this.currentVariant.featured_media.position].index+1):main.go(Slides[this.currentVariant.featured_media.position].index-1))}else media.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}}updateURL(){!this.closest(".product-wrapper")||!this.currentVariant||this.dataset.updateUrl==="false"||window.history.replaceState({},"",`${this.dataset.url}?variant=${this.currentVariant.id}`)}updateShareUrl(){const shareButton=document.getElementById(`Share-${this.dataset.section}`);if(!shareButton)return;const urlInput=shareButton.querySelector("input");let urlToShare=urlInput?urlInput.value:document.location.href;const url=`${window.shopUrl}${this.dataset.url}?variant=${this.currentVariant.id}`;urlToShare=url,urlInput.value=url}updateVariantInput(){if(this.closest(".product-card")){if(this.closest("form")){const productCardInput=this.closest("form").querySelector('input[name="id"]');productCardInput.value=this.currentVariant.id,productCardInput.dispatchEvent(new Event("change",{bubbles:!0}))}}else document.querySelectorAll(`#product-form-${this.dataset.section}, #product-form-installment-${this.dataset.section}`).forEach(productForm=>{const input=productForm.querySelector('input[name="id"]');input.value=this.currentVariant.id,input.dispatchEvent(new Event("change",{bubbles:!0}))})}updateVariantStatuses(){const selectedOptionOneVariants=this.variantData.filter(variant=>this.querySelector(":checked").value===variant.option1),inputWrappers=[...this.querySelectorAll(".product-form__input")];inputWrappers.forEach((option,index)=>{if(index===0)return;const optionInputs=[...option.querySelectorAll('input[type="radio"], option')],previousOptionSelected=inputWrappers[index-1].querySelector(":checked").value,availableOptionInputsValue=selectedOptionOneVariants.filter(variant=>variant.available&&variant[`option${index}`]===previousOptionSelected).map(variantOption=>variantOption[`option${index+1}`]);this.setInputAvailability(optionInputs,availableOptionInputsValue),this.querySelectorAll(":checked").forEach(el=>{el.closest(".product-form__input").querySelector("#selectedOption")&&(el.closest(".product-form__input").querySelector("#selectedOption").textContent=el.value)})})}setInputAvailability(listOfOptions,listOfAvailableOptions){listOfOptions.forEach(input=>{listOfAvailableOptions.includes(input.getAttribute("value"))?input.innerText=input.getAttribute("value"):input.innerText=window.variantStrings.unavailable_with_option.replace("[value]",input.getAttribute("value"))})}updatePickupAvailability(){const pickUpAvailability=document.querySelector("pickup-availability");pickUpAvailability&&(this.currentVariant&&this.currentVariant.available?pickUpAvailability.style.display="block":pickUpAvailability.style.display="none")}removeErrorMessage(){const section=this.closest("section");if(!section)return;const productForm=section.querySelector("product-form");productForm&&productForm.handleErrorMessage()}renderProductInfo(){fetch(`${this.dataset.url.split("?")[0]}.json`).then(response=>response.json()).then(data=>{const variant=data.product.variants.filter(v=>v.id===this.currentVariant.id),symbol=document.querySelectorAll(".price-item")[0].innerHTML.charAt(0);let currency=document.querySelectorAll(".price-item")[0].innerHTML.split(" ")[1];currency==null&&(currency="");let price,compare_price,saleBadge;const soldOutBadge=document.querySelector(".product__info .badge--sold");let compare_at_price=variant[0].compare_at_price;if(this.closest(".product-card")?(price=this.closest(".product-card").querySelector(".price-item--regular"),compare_price=this.closest(".product-card").querySelector(".price-item--compare"),saleBadge=this.closest(".product-card").querySelector(".badge--sale")):(price=this.closest(".product__info").querySelector(".price-item--regular"),compare_price=this.closest(".product__info").querySelector(".price-item--compare"),saleBadge=this.closest(".product__info").querySelector(".badge--sale")),price.closest(".price").querySelector(".price-varies__label")&&price.closest(".price").querySelector(".price-varies__label").remove(),compare_at_price&&Number(compare_at_price)>Number(variant[0].price))if(compare_price)compare_price.innerHTML=symbol+compare_at_price+" "+currency;else{const comparePriceNew=document.createElement("s");comparePriceNew.className+="price-item price-item--compare",comparePriceNew.textContent=symbol+compare_at_price+" "+currency;const saleBadgeNew=document.createElement("span");saleBadgeNew.className+="badge badge--sale",saleBadgeNew.textContent="Sale",price.closest(".price-item--regular").parentNode.insertBefore(comparePriceNew,price.closest(".price-item--regular").nextSibling),this.closest(".product-card")||price.closest(".price-item--regular").parentNode.insertBefore(saleBadgeNew,comparePriceNew.nextSibling)}else compare_price&&compare_price.remove(),saleBadge&&saleBadge.remove();if(price.textContent=symbol+variant[0].price+" "+currency,this.currentVariant.available)soldOutBadge&&soldOutBadge.setAttribute("hidden","");else if(soldOutBadge)soldOutBadge.removeAttribute("hidden");else{const soldOutBadgeNew=document.createElement("span");soldOutBadgeNew.className+="badge badge--sold",soldOutBadgeNew.textContent="Sold Out",this.closest(".product-card")||price.closest(".price").append(soldOutBadgeNew)}this.toggleAddButton(!this.currentVariant.available,window.variantStrings.soldOut)}),document.getElementById("inventoryTracker")&&this.currentVariant.inventory_quantity>0&&this.currentVariant.inventory_quantity<=5?document.getElementById("inventoryTracker").textContent=`Only ${this.currentVariant.inventory_quantity} left! Hurry before it's gone.`:this.currentVariant.inventory_quantity<=0&&(document.getElementById("inventoryTracker").textContent="")}toggleAddButton(disable=!0,text,modifyClass=!0){let productForm;if(this.closest(".product-card")?productForm=this.closest("form"):productForm=document.querySelector(".single-product--form"),!productForm)return;const addButton=productForm.querySelector('[name="add"]'),addButtonText=productForm.querySelector('[name="add"] > span');addButton&&(disable?(addButton.setAttribute("disabled","disabled"),text&&(addButtonText.textContent=text)):(addButton.removeAttribute("disabled"),addButtonText.textContent=window.variantStrings.addToCart))}setUnavailable(){let productForm;this.closest(".product-card")?productForm=this.closest("form"):productForm=document.querySelector(".single-product--form");const addButton=productForm.querySelector('[name="add"]'),addButtonText=productForm.querySelector('[name="add"] > span');addButton&&(addButtonText.textContent=window.variantStrings.unavailable),addButton.hasAttribute("hidden")&&(addButton.removeAttribute("hidden"),setTimeout(()=>addButton.setAttribute("hidden",""),3e3))}getVariantData(){return this.variantData=this.variantData||JSON.parse(this.querySelector('[type="application/json"]').textContent),this.variantData}}customElements.define("variant-selects",VariantSelects);class VariantRadios extends VariantSelects{constructor(){super()}setInputAvailability(listOfOptions,listOfAvailableOptions){listOfOptions.forEach(input=>{listOfAvailableOptions.includes(input.getAttribute("value"))?input.classList.remove("sold-out"):input.classList.add("sold-out")})}updateOptions(){const fieldsets=Array.from(this.querySelectorAll("fieldset"));this.options=fieldsets.map(fieldset=>Array.from(fieldset.querySelectorAll("input")).find(radio=>radio.checked).value)}}customElements.define("variant-radios",VariantRadios);class MainDrawer extends HTMLElement{constructor(){super(),this.trigger=this.querySelector(".drawer__trigger"),this.drawer=this.querySelector(".drawer"),this.addEventListener("keyup",evt=>evt.code==="Escape"&&this.closeDrawer()),this.querySelectorAll(".drawer-close").forEach(el=>el.addEventListener("click",()=>this.closeDrawer())),this.trigger&&this.trigger.addEventListener("click",()=>this.openDrawer()),this.setFocus=debounce(event=>{trapFocus(this,this.querySelector(".drawer__container"))},300)}openDrawer(){this.setFocus(),this.drawer.classList.add("drawer--active"),document.body.classList.add("drawer--open")}closeDrawer(){this.drawer.classList.remove("drawer--active"),setTimeout(()=>{document.body.classList.remove("drawer--open")},500),document.activeElement.blur()}}customElements.define("main-drawer",MainDrawer);class DetailsDrawer extends MainDrawer{constructor(){super(),this.details=this.querySelector("details")}closeDrawer(){this.drawer.classList.remove("drawer--active"),setTimeout(()=>{document.body.classList.remove("drawer--open"),this.details.removeAttribute("open")},500),document.activeElement.blur()}}customElements.define("details-drawer",DetailsDrawer);class SearchDrawer extends MainDrawer{constructor(){super(),this.setFocus=debounce(event=>{trapFocus(this,this.querySelector(".search-drawer")),document.getElementById("SearchInput").focus()},300),document.getElementById("SearchDrawerTrigger").addEventListener("click",e=>{this.openDrawer(),this.setFocus(),!document.getElementById("PREDICTIVESEARCHCSS")&&document.getElementById("PREDICTIVESEARCHJS")&&this.classList.add("loading"),this.querySelector("predictive-search")&&(loadScript("predictive-search").catch(error=>{console.error(error)}),loadCss("predictive-search").then(()=>{this.classList.remove("loading")}).catch(error=>{console.error(error)}))})}}customElements.define("search-drawer",SearchDrawer);class ModalDialog extends HTMLElement{constructor(){super(),this.addEventListener("keyup",evt=>evt.code==="Escape"&&this.hide()),this.querySelectorAll(".modal__close").forEach(el=>el.addEventListener("click",()=>this.hide())),this.querySelector(".modal-trigger").addEventListener("click",this.show.bind(this))}hide(){this.querySelector("dialog").removeAttribute("open"),this.querySelector(".modal").classList.remove("modal--active"),document.body.classList.remove("modal--open"),removeTrapFocus(this)}show(){this.querySelector("dialog").setAttribute("open",""),this.querySelector(".modal").classList.add("modal--active"),document.body.classList.add("modal--open"),trapFocus(this)}}customElements.define("modal-dialog",ModalDialog);class SearchDialog extends ModalDialog{constructor(){super(),this.querySelector(".modal-trigger").addEventListener("click",this.loadAssets.bind(this))}loadAssets(){this.show(),setTimeout(()=>{document.getElementById("SearchInput").focus()},500),this.querySelector("predictive-search")&&(!document.getElementById("PREDICTIVESEARCHCSS")&&!document.getElementById("PREDICTIVESEARCHJS")&&this.classList.add("loading"),loadScript("predictive-search").catch(error=>{console.error(error)}),loadCss("predictive-search").then(()=>{this.classList.remove("loading")}).catch(error=>{console.error(error)}))}}customElements.define("search-dialog",SearchDialog),function(){const trigger=document.querySelector(".btn--back-to-top");if(trigger){const backToTopReveal=e=>{window.pageYOffset>=50?trigger.classList.add("btn--back-to-top__revealed"):trigger.classList.remove("btn--back-to-top__revealed")};backToTopReveal(),window.addEventListener("scroll",backToTopReveal),trigger.addEventListener("click",e=>{window.scrollTo({top:0,behavior:"smooth"})})}}(),window.addEventListener("beforeunload",()=>{document.body.classList.remove("page-loaded"),document.body.classList.add("page-unloading")}),window.addEventListener("DOMContentLoaded",()=>{document.body.classList.remove("page-unloading"),document.body.classList.add("page-loaded")}),window.addEventListener("pageshow",event=>{(event.persisted||window.performance.navigation.type===2)&&(document.body.classList.remove("page-unloading"),document.body.classList.add("page-loaded"))});const productFormObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&(loadScript("product-form").catch(error=>{console.error(error)}),productFormObserver.unobserve(entry.target))})},{rootMargin:"0px 0px 250px 0px"});document.querySelectorAll("[product-form-oberver]").forEach(el=>productFormObserver.observe(el));const imageObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&(entry.target.classList.add("loaded"),imageObserver.unobserve(entry.target))})},{threshold:.25});document.querySelectorAll('img[loading="lazy"]').forEach(el=>imageObserver.observe(el)); //# sourceMappingURL=/cdn/shop/t/38/assets/main.js.map?v=0e1e77eb7222d163587e5de94e56c879