/* Generated time: January 26, 2026 23:51 This file was created by the app developer. Feel free to contact the original developer with any questions. It was minified (compressed) by AVADA. AVADA do NOT own this script. */ class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",t=>{t.preventDefault();t=this.closest("cart-items")||this.closest("cart-drawer-items");t&&this.dataset.index&&t.updateQuantity(this.dataset.index,0)})}}customElements.define("cart-remove-button",CartRemoveButton);class CartItems extends HTMLElement{constructor(){super(),this.lineItemStatusElement=document.getElementById("shopping-cart-line-item-status")||document.getElementById("CartDrawer-LineItemStatus");var t=debounce(t=>{this.onChange(t)},ON_CHANGE_DEBOUNCE_TIMER);this.addEventListener("change",t.bind(this))}cartUpdateUnsubscriber=void 0;connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,t=>{"cart-items"!==t.source&&this.onCartUpdate()})}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}resetQuantityInput(t){t=this.querySelector("#Quantity-"+t);t.value=t.getAttribute("value"),this.isEnterPressed=!1}setValidity(t,e,r){t.target.setCustomValidity(r),t.target.reportValidity(),this.resetQuantityInput(e),t.target.select()}validateQuantity(t){var e=parseInt(t.target.value),r=t.target.dataset.index;let a="";eparseInt(t.target.max)?a=window.quickOrderListStrings.max_error.replace("[max]",t.target.max):e%parseInt(t.target.step)!=0&&(a=window.quickOrderListStrings.step_error.replace("[step]",t.target.step)),a?this.setValidity(t,r,a):(t.target.setCustomValidity(""),t.target.reportValidity(),this.updateQuantity(r,e,document.activeElement.getAttribute("name"),t.target.dataset.quantityVariantId))}onChange(t){this.validateQuantity(t)}onCartUpdate(){"CART-DRAWER-ITEMS"===this.tagName?fetch(routes.cart_url+"?section_id=cart-drawer").then(t=>t.text()).then(t=>{var e,r=(new DOMParser).parseFromString(t,"text/html");for(e of["#CartDrawer-Progress","#CartDrawer-CartItems",".cart-drawer__footer",".cart-drawer__foot_discounts",".cart-drawer-dynamic-reward"]){var a=document.querySelector(e),n=r.querySelector(e);a&&n&&(a.innerHTML=n.innerHTML)}var t=document.querySelector("#cart-icon-bubble"),i=r.querySelector("#cart-icon-bubble");if(t&&i&&(t.innerHTML=i.innerHTML),"undefined"!=typeof cartRedirect)try{cartRedirect(1)}catch(t){console.warn("cartRedirect falhou após onCartUpdate:",t)}}).catch(t=>{console.error(t)}):fetch(routes.cart_url+"?section_id=main-cart-items").then(t=>t.text()).then(t=>{t=(new DOMParser).parseFromString(t,"text/html").querySelector("cart-items");this.innerHTML=t.innerHTML}).catch(t=>{console.error(t)})}getSectionsToRender(){return[{id:"main-cart-items",section:document.getElementById("main-cart-items").dataset.id,selector:".js-contents"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"cart-live-region-text",section:"cart-live-region-text",selector:".shopify-section"},{id:"main-cart-footer",section:document.getElementById("main-cart-footer").dataset.id,selector:".js-contents"}]}updateQuantity(s,t,c,o){this.enableLoading(s);t=JSON.stringify({line:s,quantity:t,sections:this.getSectionsToRender().map(t=>t.section),sections_url:window.location.pathname});fetch(""+routes.cart_change_url,{...fetchConfig(),body:t}).then(t=>("undefined"!=typeof cartRedirect&&cartRedirect(1),t.text())).then(e=>{let r=JSON.parse(e);var e=document.getElementById("Quantity-"+s)||document.getElementById("Drawer-quantity-"+s),a=document.querySelectorAll(".cart-item");if(r.errors)e.value=e.getAttribute("value"),this.updateLiveRegions(s,r.errors);else{this.classList.toggle("is-empty",0===r.item_count);var n=document.querySelector("cart-drawer"),i=document.getElementById("main-cart-footer"),i=(i&&i.classList.toggle("is-empty",0===r.item_count),n&&n.classList.toggle("is-empty",0===r.item_count),this.getSectionsToRender().forEach(t=>{var e=document.getElementById(t.id).querySelector(t.selector)||document.getElementById(t.id);e&&r.sections[t.section]&&(e.innerHTML=this.getSectionInnerHTML(r.sections[t.section],t.selector))}),r.items[s-1]?r.items[s-1].quantity:void 0);let t="";a.length===r.items.length&&i!==parseInt(e.value)&&(t=void 0===i?window.cartStrings.error:window.cartStrings.quantityError.replace("[quantity]",i)),this.updateLiveRegions(s,t);a=document.getElementById("CartItem-"+s)||document.getElementById("CartDrawer-Item-"+s);a&&a.querySelector(`[name="${c}"]`)?n?trapFocus(n,a.querySelector(`[name="${c}"]`)):a.querySelector(`[name="${c}"]`).focus():0===r.item_count&&n?trapFocus(n.querySelector(".drawer__inner-empty"),n.querySelector("a")):document.querySelector(".cart-item")&&n&&trapFocus(n,document.querySelector(".cart-item__name")),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items",cartData:r,variantId:o}),"CART-DRAWER-ITEMS"===this.tagName&&((e=document.querySelector("cart-drawer"))&&e.classList.toggle("is-empty",0===r.item_count),this.onCartUpdate())}}).catch(()=>{this.querySelectorAll(".loading__spinner").forEach(t=>t.classList.add("hidden")),(document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors")).textContent=window.cartStrings.error}).finally(()=>{this.disableLoading(s)})}updateLiveRegions(t,e){t=document.getElementById("Line-item-error-"+t)||document.getElementById("CartDrawer-LineItemError-"+t);t&&(t.querySelector(".cart-item__error-text").textContent=e),this.lineItemStatusElement.setAttribute("aria-hidden",!0);let r=document.getElementById("cart-live-region-text")||document.getElementById("CartDrawer-LiveRegionText");r.setAttribute("aria-hidden",!1),setTimeout(()=>{r.setAttribute("aria-hidden",!0)},1e3)}getSectionInnerHTML(t,e){return(new DOMParser).parseFromString(t,"text/html").querySelector(e).innerHTML}enableLoading(t){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.add("cart__items--disabled");var e=this.querySelectorAll(`#CartItem-${t} .loading__spinner`),t=this.querySelectorAll(`#CartDrawer-Item-${t} .loading__spinner`);[...e,...t].forEach(t=>t.classList.remove("hidden")),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1)}disableLoading(t){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.remove("cart__items--disabled");var e=this.querySelectorAll(`#CartItem-${t} .loading__spinner`),t=this.querySelectorAll(`#CartDrawer-Item-${t} .loading__spinner`);e.forEach(t=>t.classList.add("hidden")),t.forEach(t=>t.classList.add("hidden"))}}customElements.define("cart-items",CartItems),window.addEventListener("pageshow",()=>{if("undefined"!=typeof cartRedirect)try{cartRedirect(1)}catch(t){console.warn("cartRedirect falhou ao retornar para a página:",t)}}),customElements.get("cart-note")||customElements.define("cart-note",class extends HTMLElement{constructor(){super(),this.addEventListener("input",debounce(t=>{t=JSON.stringify({note:t.target.value});fetch(""+routes.cart_update_url,{...fetchConfig(),body:t})},ON_CHANGE_DEBOUNCE_TIMER))}});