1class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",event=>{event.preventDefault();const cartItems=this.closest("cart-items")||this.closest("cart-drawer-items");cartItems.cartDrawerUpsells&&cartItems.cartDrawerUpsells.classList.add("cart-drawer-recommendations--loading"),this.dataset.clear?cartItems.updateQuantity(this.dataset.index,0,"",!0):cartItems.updateQuantity(this.dataset.index,0)})}}customElements.define("cart-remove-button",CartRemoveButton);class CartFreeShipping extends HTMLElement{static get observedAttributes(){return["threshold","total-price"]}constructor(){super(),this.messageElement=this.querySelector(".free-shipping__message"),this.progressBarElement=this.querySelector(".free-shipping-scale__fill")}connectedCallback(){this.threshold=Math.round(this.threshold*(Shopify.currency.rate||1)),this.updateShippingIndicator()}get threshold(){return parseFloat(this.getAttribute("threshold"))}set threshold(value){this.setAttribute("threshold",value)}get totalPrice(){return parseFloat(this.getAttribute("total-price"))}set totalPrice(value){this.setAttribute("total-price",value)}updateShippingIndicator(){const percentage=Math.round(this.totalPrice*100/this.threshold);this.progressBarElement.style.width=`${percentage}%`,this.updateMessage()}updateMessage(){if(this.totalPrice>=this.threshold)this.messageElement.innerHTML=this.dataset.reachedMessage;else{const replacement=`<span class="free-shipping__price">${Shopify.formatMoney(this.threshold-this.totalPrice,this.dataset.currencyFormat).replace(/\$/g,"$$$$")}</span>`;this.messageElement.innerHTML=this.dataset.unreachedMessage.replace(new RegExp("({{.*}})","g"),replacement)}}}customElements.define("cart-free-shipping",CartFreeShipping);class CartItems extends HTMLElement{constructor(){super(),this.lineItemStatusElement=document.getElementById("shopping-cart-line-item-status")||document.getElementById("CartDrawer-LineItemStatus"),this.colorSwatches=this.querySelectorAll(".cart__product-details .color-swatch"),hideUnavailableColors(this.colorSwatches),this.currentItemCount=Array.from(this.querySelectorAll('[name="updates[]"]')).reduce((total,quantityInput)=>total+parseInt(quantityInput.value),0),this.debouncedOnChange=debounce(event=>{this.onChange(event)},300),this.addEventListener("change",this.debouncedOnChange.bind(this))}onChange(event){this.updateQuantity(event.target.dataset.index,event.target.value,document.activeElement.getAttribute("name"))}getSectionsToRender(){return[{id:"main-cart",section:document.getElementById("main-cart").dataset.id,selector:".js-contents",childSectionSelectors:[".cart__footer",".cart__items",".cart__heading",".cart__free-shipping"]},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"cart-live-region-text",section:"cart-live-region-text",selector:".shopify-section"}]}updateQuantity(line,quantity,name,clear){this.enableLoading(line);let cartUrl=routes.cart_change_url,body=JSON.stringify({line,quantity,sections:this.getSectionsToRender().map(section=>section.section),sections_url:window.location.pathname});if(clear){cartUrl=routes.cart_update_url;const items2=(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).querySelectorAll(".cart__row"),itemsKey={};items2.forEach(item=>{const key=item.dataset.key;itemsKey[key]=0}),body=JSON.stringify({updates:itemsKey,attributes:{"gift-wrapping":"","gift-note":""},sections:this.getSectionsToRender().map(section=>section.section),sections_url:window.location.pathname})}fetch(`${cartUrl}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state),quantityElement=document.getElementById(`Quantity-${line}`)||document.getElementById(`Drawer-quantity-${line}`),items2=document.querySelectorAll(".cart__row"),cartItems=document.querySelectorAll(".cart__item");if(parsedState.errors){quantityElement.value=quantityElement.getAttribute("value");let message2=window.cartStrings.quantityError.replace("[quantity]",quantityElement.value);this.updateLiveRegions(line,message2),items2.forEach(lineItem2=>lineItem2.classList.remove("cart__row--loading")),this.disableLoading();return}this.classList.toggle("is-empty",parsedState.item_count===0);const cartDrawerWrapper=document.querySelector("cart-drawer"),cartDrawerInner=cartDrawerWrapper?cartDrawerWrapper.querySelector(".drawer__inner"):null,mainCart=document.getElementById("main-cart"),emptyContent=document.querySelector(".empty-page-content");mainCart&&mainCart.classList.toggle("is-empty",parsedState.item_count===0),c
1artDrawerWrapper&&cartDrawerWrapper.classList.toggle("is-empty",parsedState.item_count===0),emptyContent&&emptyContent.classList.toggle("hide",parsedState.item_count>0),parsedState.item_count===0&&this.cartDrawerUpsells&&this.closeUpsells(cartDrawerInner),this.getSectionsToRender().forEach((section=>{if(section.childSectionSelectors)section.childSectionSelectors.forEach(elem=>{if(elem===".cart__free-shipping"){const shippingScaleElem=document.getElementById(section.id).querySelector(elem);if(!shippingScaleElem)return;const sourceElement=new DOMParser().parseFromString(parsedState.sections[section.section],"text/html").querySelector(`${elem}`);if(!sourceElement)return;shippingScaleElem.totalPrice=sourceElement.getAttribute("total-price"),shippingScaleElem.updateShippingIndicator();return}if(parsedState.item_count>0&&quantity===0&&elem==".drawer__contents"){const cartRecommendationsHtml=this.getSectionInnerHTML(parsedState.sections[section.section],`${elem} .cart-drawer-recommendations`);this.cartDrawerUpsells&&this.updateUpsells(cartRecommendationsHtml,cartDrawerInner)}const elementToReplace=document.getElementById(section.id).querySelector(elem).querySelector(section.selector)||document.getElementById(section.id),mainCartInnerHtml=this.getSectionInnerHTML(parsedState.sections[section.section],`${elem} ${section.selector}`);mainCartInnerHtml&&(elementToReplace.innerHTML=mainCartInnerHtml)});else{const sectionElement=document.getElementById(section.id);if(sectionElement){const elementToReplace=sectionElement.querySelector(section.selector)||sectionElement;elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector)}}}));const updatedValue=parsedState.items[line-1]?parsedState.items[line-1].quantity:void 0;let message="";cartItems.length===parsedState.items.length&&updatedValue!==parseInt(quantityElement.value)&&(typeof updatedValue>"u"?message=window.cartStrings.error:message=window.cartStrings.quantityError.replace("[quantity]",updatedValue)),this.updateLiveRegions(line,message);const lineItem=document.getElementById(`CartItem-${line}`)||document.getElementById(`CartDrawer-Item-${line}`);lineItem&&lineItem.querySelector(`[name="${name}"]`)&&lineItem.querySelector(`[name="${name}"]`).focus(),this.disableLoading()}).catch(error=>{const errorElem=document.getElementById("cart-errors")||document.getElementById("cart-drawer-errors");items.forEach(lineItem=>lineItem.classList.remove("cart__row--loading")),(document.querySelector(".cart-page-section")||document.querySelector(".cart-drawer")).classList.add("cart-page-section--error"),errorElem.classList.remove("hide-general-error"),errorElem.querySelector(".cart__error-text").textContent=window.cartStrings.error,this.disableLoading()})}updateLiveRegions(line,message){const lineItemError=document.getElementById(`Line-item-error-${line}`)||document.getElementById(`CartDrawer-LineItemError-${line}`);lineItemError&&(lineItemError.querySelector(".cart__error-text").innerHTML=message,lineItemError.classList.remove("cart__error-wrapper--item--hide"),setTimeout(()=>{lineItemError.classList.add("cart__error-wrapper--item--hide")},5e3)),this.lineItemStatusElement.setAttribute("aria-hidden",!0);const cartStatus=document.getElementById("cart-live-region-text")||document.getElementById("CartDrawer-LiveRegionText");cartStatus.setAttribute("aria-hidden",!1),setTimeout(()=>{cartStatus.setAttribute("aria-hidden",!0)},1e3)}getSectionInnerHTML(html,selector){const sourceElement=new DOMParser().parseFromString(html,"text/html").querySelector(selector);if(!sourceElement)return"";const colorSwatches=sourceElement.querySelectorAll(".color-swatch");return colorSwatches.length&&hideUnavailableColors(colorSwatches),sourceElement.innerHTML}enableLoading(line){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.add("cart__items--disabled"),(
1document.querySelector(".cart-page-section")||document.querySelector(".cart-drawer")).classList.add("cart--loading"),this.querySelectorAll(`#CartItem-${line}`).forEach(lineItem=>lineItem.classList.add("cart__row--loading")),this.querySelectorAll(`#CartDrawer-Item-${line}`).forEach(lineItem=>lineItem.classList.add("cart__row--loading")),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1)}disableLoading(){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.remove("cart__items--disabled"),(document.querySelector(".cart-page-section")||document.querySelector(".cart-drawer")).classList.remove("cart--loading")}}customElements.define("cart-items",CartItems);class ProductItem extends HTMLElement{constructor(){super(),this.productForm=this.querySelector("form"),this.productForm&&(this.summitButton=this.productForm.querySelector('[type="submit"]'),this.cart=document.querySelector("cart-drawer"),this.productForm.addEventListener("submit",this.onSubmitHandler.bind(this)))}onSubmitHandler(evt){evt.preventDefault(),this.summitButton.disabled=!0,this.summitButton.setAttribute("aria-disabled",!0),this.summitButton.classList.add("btn--loading");const config=fetchConfig("javascript");config.headers["X-Requested-With"]="XMLHttpRequest",delete config.headers["Content-Type"];const formData=new FormData(this.productForm);this.cart&&(formData.append("sections",this.cart.getSectionsToRender().map(section=>section.id)),formData.append("sections_url",window.location.pathname),this.cart.setActiveElement(document.activeElement)),config.body=formData,fetch(`${routes.cart_add_url}`,config).then(response=>response.json()).then(response=>{this.cart.renderContents(response)}).finally(()=>{this.summitButton.disabled=!1,this.summitButton.removeAttribute("aria-disabled"),this.summitButton.classList.remove("btn--loading")})}}customElements.define("product-item",ProductItem);class CartGiftWrapping extends HTMLElement{constructor(){super();const giftId=this.dataset.giftId;this.giftWrappingCheckbox=this.querySelector('[name="attributes[gift-wrapping]"]');const parentContent=this.closest("#main-cart")||this.closest("#CartDrawer"),cartItems=parentContent.querySelector("cart-items")||parentContent.querySelector("cart-drawer-items");this.giftWrappingCheckbox.addEventListener("change",debounce(()=>{let body=JSON.stringify({updates:{[giftId]:0},attributes:{"gift-wrapping":"","gift-note":""},sections:cartItems.getSectionsToRender().map(section=>section.section)});this.giftWrappingCheckbox.checked&&(body=JSON.stringify({updates:{[giftId]:1},attributes:{"gift-wrapping":!0},sections:cartItems.getSectionsToRender().map(section=>section.section)})),this.giftWrappingCheckbox.disabled=!0,this.classList.add("loading-gift-wrap"),fetch(`${routes.cart_update_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);if(parsedState.errors){const errorElem=document.getElementById("cart-errors")||document.getElementById("cart-drawer-errors");errorElem.classList.remove("hide-general-error"),errorElem.querySelector(".cart__error-text").textContent=window.cartStrings.error,this.giftWrappingCheckbox.disabled=!1,this.classList.remove("loading-gift-wrap");return}cartItems.getSectionsToRender().forEach((section=>{if(section.childSectionSelectors)section.childSectionSelectors.forEach(elem=>{if(elem==".cart__free-shipping"){const shippingScaleElem=document.getElementById(section.id).querySelector(elem);if(!shippingScaleElem)return;const sourceElement=new DOMParser().parseFromString(parsedState.sections[section.section],"text/html").querySelector(`${elem}`);if(!sourceElement)return;shippingScaleElem.totalPrice=sourceElement.getAttribute("total-price"),shippingScaleElem.updateShippingIndicator();return}const elementToReplace=document.getElementById(section.id).querySelector(elem).querySelector(section.selector)||document.getElementById(section.id);if(elem===".drawer__contents"||elem===".cart__items"){const sourceElement=new DOMParser().parseFromString(parsedState.sections[section.section],"text/html").querySelector(`${elem}`),giftWrapProduct=elementToReplace.querySelector(`[data-gift-wrapping-id="${giftId}"]`),sourceGiftWrapProduct=sourceElement.querySelector(`[data-gift-wrapping-id="${giftId}"]`);if(giftWrapProduct&&!this.giftWrappingCheckbox.checked){const heightElm=giftWrapProduct.offsetHeight;giftWrapProduct.style.setProperty("--max-height",`${heightElm}px`),giftWrapProduct.classList.add("cart__row--gift"),setTimeout(()=>{giftWrapProduct.classList.add("cart__row--hide")},0),giftWrapProduct.addEventListener("transitionend",()=>{setTimeout(()=>{const mainCartInnerHtml2=cartItems.getSectionInnerHTML(parsedState.sections[section.section],`${elem} ${section.selector}`);elementToReplace.innerHTML=mainCartInnerHtml2},400)},{once:!0})}else if(sourceGiftWrapProduct&&this.giftWrappingCheckbox.checked){const cartItemsWrapper=elementToReplace.querySelector(".cart-content-items")||elementToReplace.querySelector(".drawer__cart-items-wrapper"),cartItemsSourceWrapper=sourceElement.querySelector(".cart-content-items")||sourceElement.querySelector(".drawer__cart-items-wrapper");sourceGiftWrapProduct.style.position="absolute",sourceGiftWrapProduct.style.opacity="0";const colorSwatches=cartItemsSourceWrapper.querySelectorAll(".color-swatch");colorSwatches.length&&hideUnavailableColors(colorSwatches),cartItemsWrapper.innerHTML=cartItemsSourceWrapper.innerHTML;const giftWrapProductElm=cartItemsWrapper.querySelector(`[data-gift-wrapping-id="${giftId}"]`),heightElm=giftWrapProductElm.offsetHeight;giftWrapProductElm.style.setProperty("--max-height",`${heightElm}px`),giftWrapProductElm.classList.add("cart__row--gift","cart__row--hide"),giftWrapProductElm.style.position=null,giftWrapProductElm.style.opacity=null,setTimeout(()=>{giftWrapProductElm.classList.remove("cart__row--hide")})}return}const mainCartInnerHtml=cartItems.getSectionInnerHTML(parsedState.sections[section.section],`${elem} ${section.selector}`);elementToReplace.innerHTML=mainCartInnerHtml});else{const sectionElement=document.getElementById(section.id);if(sectionElement){const elementToReplace=sectionElement.querySelector(section.selector)||sectionElement;elementToReplace.innerHTML=cartItems.getSectionInnerHTML(parsedState.sections[section.section],section.selector)}}})),this.giftWrappingCheckbox.disabled=!1,this.classList.remove("loading-gift-wrap")}).catch(e=>{const errorElem=document.getElementById("cart-errors")||document.getElementById("cart-drawer-errors");errorElem.classList.remove("hide-general-error"),errorElem.querySelector(".cart__error-text").textContent=window.cartStrings.error,this.giftWrappingCheckbox.disabled=!1,this.classList.remove("loading-gift-wrap")})},300))}}customElements.define("cart-gift-wrapping",CartGiftWrapping),customElements.get("cart-footer-modal")||customElements.define("cart-footer-modal",class extends HTMLElement{constructor(){super(),this.cartFooterModal=this.querySelector(".cart__footer-modal")}openFooterModal(content){const contentElement=this.querySelector(`.cart__footer-modal__${content}`),noteField=contentElement.querySelector("textarea"),giftNoteCount=contentElement.querySelector(".gift-note__count");if(this.value=null,noteField&&(this.value=noteField.value,giftNoteCount)){const maxLength=noteField.maxLength;giftNoteCount.textContent=maxLength-noteField.value.length}contentElement&&contentElement.classList.remove("hidden"),this.cartFooterModal.classList.add("open")}closeFooterModal(content){if(this.cartFooterModal.classList.remove("open"),this.querySelectorAll(".cart__footer-modal__content").forEach(content2=>{content2.classList.add("hidden")}),content){const noteField=this.querySelector(`.cart__footer-modal__${content}`).querySelector("textarea");this.value!==null&&(noteField.value=this.value)}}}),customElements.get("cart-note")||customElements.define("cart-note",class extends HTMLElement{constructor(){super();const saveButton=this.querySelector('button[type="submit"]'),noteField=this.querySelector('textarea[name="note"]'),cartFooterModal=this.closest("cart-footer-modal");saveButton&&saveButton.addEventListener("click",()=>{saveButton.disabled=!0,saveButton.classList.add("btn--loading");const body=JSON.stringify({note:noteField.value});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{if(JSON.parse(state).errors){const errorElem=document.getElementById("cart-errors")||document.getElementById("cart-drawer-errors");errorElem.classList.remove("hide-general-error"),errorElem.querySelector(".cart__error-text").textContent=window.cartStrings.error,saveButton.disabled=!1,saveButton.classList.remove("btn--loading"),cartFooterModal&&cartFooterModal.closeFooterModal();return}saveButton.disabled=!1,saveButton.classList.add("cart__note__btn--saved"),saveButton.classList.remove("btn--loading"),setTimeout(()=>{cartFooterModal&&cartFooterModal.closeFooterModal(),saveButton.classList.remove("cart__note__btn--saved")},1700)}).catch(e=>{const errorElem=document.getElementById("cart-errors")||document.getElementById("cart-drawer-errors");errorElem.classList.remove("hide-general-error"),errorElem.querySelector(".cart__error-text").textContent=window.cartStrings.error,saveButton.disabled=!1,saveButton.classList.remove("btn--loading")})})}}),customElements.get("cart-gift-note")||customElements.define("cart-gift-note",class extends HTMLElement{constructor(){super();const saveButton=this.querySelector('button[type="submit"]'),noteField=this.querySelector('textarea[name="attributes[gift-note]"]'),giftNoteCount=this.querySelector(".gift-note__count"),cartFooterModal=this.closest("cart-footer-modal");if(saveButton){if(giftNoteCount){const maxLength=noteField.maxLength;giftNoteCount.textContent=maxLength-noteField.value.length,noteField.addEventListener("keyup",()=>{const characterCount=maxLength-noteField.value.length;giftNoteCount.textContent=characterCount})}saveButton.addEventListener("click",()=>{saveButton.disabled=!0,saveButton.classList.add("btn--loading");const body=JSON.stringify({attributes:{"gift-note":noteField.value}});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);if(saveButton.classList.remove("btn--loading"),parsedState.errors){const errorElem=document.getElementById("cart-errors")||document.getElementById("cart-drawer-errors");errorElem.classList.remove("hide-general-error"),errorElem.querySelector(".cart__error-text").textContent=window.cartStrings.error,saveButton.disabled=!1,saveButton.classList.remove("btn--loading"),cartFooterModal&&cartFooterModal.closeFooterModal();return}saveButton.disabled=!1,saveButton.classList.add("cart__note__btn--saved"),saveButton.classList.remove("btn--loading"),setTimeout(()=>{cartFooterModal&&cartFooterModal.closeFooterModal(),saveButton.classList.remove("cart__note__btn--saved")},1700)}).catch(e=>{const errorElem=document.getElementById("cart-errors")||document.getElementById("cart-drawer-errors");errorElem.classList.remove("hide-general-error"),errorElem.querySelector(".cart__error-text").textContent=window.cartStrings.error,saveButton.disabled=!1,saveButton.classList.remove("btn--loading")})})}}}),customElements.get("cart-shipping-calculator")||customElements.define("cart-shipping-calculator",class extends HTMLElement{constructor(){super(),this.calculateForm=this.querySelector(".modal__shipping-form"),this.formContent=this.querySelector(".modal__shipping-form__content"),this.fieldsContent=this.querySelector(".cart-calculate-shipping"),this.country=this.querySelector("#CartDrawerCountry"),this.providence=this.querySelector("#CartDrawerProvince"),this.zip=this.querySelector("#CartDrawerZip"),this.messageNoShipping=this.querySelector(".calculate-shipping__message"),this.saveButton=this.querySelector('button[type="submit"]'),this.shippingRatesElem=this.querySelector(".cart-shipping-rates"),this.recalculateBtn=this.querySelector(".cart__recalculate-btn"),this.setupCountries(),this.calculateForm.addEventListener("submit",this.handleCalculation.bind(this)),this.recalculateBtn.addEventListener("click",()=>{this.recalculateBtn.classList.remove("active"),this.shippingRatesElem.classList.remove("active"),this.handleAnimation(this.shippingRatesElem,this.fieldsContent)}),this.fieldsContent.querySelectorAll("select, input").forEach(field=>{let eventName="keyup";field.tagName==="SELECT"&&(eventName="change"),field.addEventListener(eventName,()=>{this.removeErrorStyle()})})}setupCountries(){const mainCountries=["United States","United Kingdom","France","Italy","Germany","Canada"],countries=Array.from(this.country.options),optgroupMainElm=document.createElement("optgroup"),optgroupElm=document.createElement("optgroup");
1mainCountries.forEach(country=>{const foundCountry=countries.find(option=>option.value===country);foundCountry&&optgroupMainElm.appendChild(foundCountry)}),this.country.querySelectorAll("option").forEach(optionElm=>{optgroupElm.appendChild(optionElm)}),this.country.append(optgroupMainElm),this.country.append(optgroupElm),this.country.value="---",Shopify&&Shopify.CountryProvinceSelector&&this.querySelector("#CartDrawerCountry")&&new Shopify.CountryProvinceSelector("CartDrawerCountry","CartDrawerProvince",{hideElement:"CartDrawerAddressProvinceContainer"})}removeErrorStyle(){this.fieldsContent.querySelectorAll(".input--error").forEach(field_error=>{const fieldWrapper=field_error.parentElement,hasErrorMessage=fieldWrapper.nextElementSibling?fieldWrapper.nextElementSibling.classList.contains("input-error-message"):null,iconError=fieldWrapper.querySelector(".field-wrapper__icon-error");if(iconError&&iconError.classList.add("hide"),hasErrorMessage){const errorMsgElm=fieldWrapper.nextElementSibling,errorMessageText=errorMsgElm.querySelector(".input-error-message__text");errorMessageText.textContent="",errorMsgElm.classList.add("hide")}field_error.classList.remove("input--error"),field_error.classList.remove("input--not-error-msg"),field_error.removeAttribute("aria_invalid"),field_error.removeAttribute("aria_describedby")})}handleAnimation(hideElem,showElem,removeLoading){const isShippingRates=hideElem.classList.contains("cart-shipping-rates");let timer=400;this.formContent.style.height="",this.formContent.style.transition="none";const startHeight=window.getComputedStyle(this.formContent).height,cartFooter=showElem.closest(".cart__footer"),startCartFootertHeight=window.getComputedStyle(this).height;isShippingRates?(timer=200,cartFooter&&(cartFooter.style.height="")):!isShippingRates&&cartFooter&&(cartFooter.style.height="",cartFooter.style.transition="none"),hideElem.classList.remove("active"),setTimeout(()=>{hideElem.style.display="none",isShippingRates&&(hideElem.innerHTML=""),showElem.style.removeProperty("display"),setTimeout(()=>showElem.classList.add("active"),0);const height=window.getComputedStyle(this.formContent).height,cartFooterHeight=window.getComputedStyle(this).height;this.formContent.style.height=startHeight,!isShippingRates&&cartFooter&&(cartFooter.style.height=startCartFootertHeight),requestAnimationFrame(()=>{this.formContent.style.transition="",!isShippingRates&&cartFooter&&(cartFooter.style.transition=""),requestAnimationFrame(()=>{this.formContent.style.height=height,!isShippingRates&&cartFooter&&(cartFooter.style.height=cartFooterHeight)})}),this.formContent.addEventListener("transitionend",()=>{this.formContent.style.height=""},{once:!0}),removeLoading&&(this.saveButton.disabled=!1,this.saveButton.classList.remove("btn--loading"))},timer)}handleCalculation(evt){if(evt.preventDefault(),!validateForm(this.calculateForm))return;this.removeErrorStyle(),this.saveButton.disabled=!0,this.saveButton.classList.add("btn--loading");const shippingAddress={country:this.country.value||"",province:this.providence.value||"",zip:this.zip.value||""},params=`shipping_address[country]=${shippingAddress.country}&shipping_address[province]=${shippingAddress.province}&shipping_address[zip]=${shippingAddress.zip}`,url=encodeURI(`${params}`);fetch(`/cart/prepare_shipping_rates.json?${url}`,{method:"POST"}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);if(typeof parsedState=="object"&&parsedState!==null){Object.entries(parsedState).forEach(([key,value])=>{const fieldElement=this.calculateForm.querySelector(`[name=${key}]`);if(fieldElement){const fieldWrapper=fieldElement.parentElement,hasErrorMessage=fieldWrapper.nextElementSibling?fieldWrapper.nextElementSibling.classList.contains("input-error-message"):null,iconError=fieldWrapper.querySelector(".field-wrapper__icon-error");if(iconError&&iconError.classList.remove("hide"),hasErrorMessage){const errorMsgElm=fieldWrapper.nextElementSibling,errorMessageText=errorMsgElm.querySelector(".input-error-message__text");errorMessageText.textContent=`${value}.`,errorMsgElm.classList.remove("hide")}fieldElement.classList.add("input--error"),fieldElement.setAttribute("aria_invalid","true"),fieldElement.setAttribute("aria_describedby",`${fieldElement.id}-error`)}}),this.saveButton.disabled=!1,this.saveButton.classList.remove("btn--loading"),parsedState.error&&(this.messageNoShipping.querySelector(".calculate-shipping__message-text").textContent=parsedState.error,this.messageNoShipping.classList.remove("hide"));return}const fetchShippingRates=()=>{fetch(`/cart/async_shipping_rates.json?${url}`).then(response=>response.text()).then(responseText=>{const parsedResponse=JSON.parse(responseText);if(parsedResponse===null){setTimeout(fetchShippingRates,500);return}const shippingRates=parsedResponse.shipping_rates||[];shippingRates.length>0?(this.onCartShippingRatesUpdate(shippingRates),this.handleAnimation(this.fieldsContent,this.shippingRatesElem,!0)):(this.saveButton.disabled=!1,this.saveButton.classList.remove("btn--loading"),this.messageNoShipping.querySelector(".calculate-shipping__message-text").textContent="Sorry! We don\u2019t ship here.",this.messageNoShipping.classList.remove("hide"))})};fetchShippingRates()})}onCartShippingRatesUpdate=function(shippingRates){const fragment=document.createDocumentFragment(),ulElem=fragment.appendChild(document.createElement("ul"));
1shippingRates.forEach(rate=>{const textElem=ulElem.appendChild(document.createElement("li")).appendChild(document.createElement("h3"));textElem.classList.add("h2");let name=rate.name.replace("International",""),price=rate.price,estimateTime="";const deliveryDays=rate.delivery_days;price==="0.00"?price=window.cartStrings.freePrice:price=`${rate.currency} ${rate.price}`,deliveryDays.length&&(deliveryDays.forEach((t,i)=>{estimateTime=i===0?t:`${estimateTime}-${t}`}),estimateTime=`<span>${estimateTime} days</span>`),textElem.innerHTML=`<span>${name}</span> ${estimateTime} ${price}`,this.recalculateBtn.classList.add("active")}),this.shippingRatesElem.appendChild(fragment)}}); 2//# sourceMappingURL=/cdn/shop/t/8/assets/cart.js.map?v=163998188304242990891742155860
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.