1"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _callSuper(e,t,r){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _possibleConstructorReturn(e,t){if(t&&("object"==_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(r,e)},_wrapNativeSuper(e)}function _construct(e,t,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&_setPrototypeOf(o,r.prototype),o}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}customElements.get("cart-remove-button")||customElements.define("cart-remove-button",function(e){function t(){var e;return _classCallCheck(this,t),(e=_callSuper(this,t)).addEventListener("click",(function(t){t.preventDefault(),setTimeout((function(){document.getElementsByClassName("cart-item__details")&&document.getElementsByClassName("cart-item__details").length>0&&Array.from(document.getElementsByClassName("cart-item__details")).forEac
1h((function(e){e.querySelector(".cart-item__name").textContent.includes("Gift Card")&&e.querySelectorAll(".product-option")&&e.querySelectorAll(".product-option").length>0&&Array.from(e.querySelectorAll(".product-option")).forEach((function(e){e.querySelector("dt")&&e.querySelector("dd")&&("Recipient email:"===e.querySelector("dt").textContent&&(e.querySelector("dt").textContent="E-mail do presenteado:"),"Send on:"===e.querySelector("dt").textContent&&(e.querySelector("dt").textContent="Data de envio:"),window.innerWidth<768&&("Message:"===e.querySelector("dt").textContent||"Mensagem:"===e.querySelector("dt").textContent)?(e.querySelector("dt").remove(),e.querySelector("dd").remove()):"Message:"===e.querySelector("dt").textContent&&(e.querySelector("dt").textContent="Mensagem:"))}))}))}),1e3),(e.closest("cart-items")||e.closest("cart-drawer-items")).updateQuantity(e.dataset.index,0)})),e}return _inherits(t,_wrapNativeSuper(HTMLElement)),_createClass(t)}());var CartItems=function(e){function t(){var e;_classCallCheck(this,t),_defineProperty(e=_callSuper(this,t),"cartUpdateUnsubscriber",void 0),changePriceRegular=document.querySelectorAll(".price.price--end"),changePriceRegular.forEach((function(e){e.textContent=e.textContent.trim().replace(",","")})),document.querySelectorAll(".cart__checkout-button.button").forEach((function(e){e.textContent=e.textContent.trim().replace(",","")})),e.lineItemStatusElement=document.getElementById("shopping-cart-line-item-status")||document.getElementById("CartDrawer-LineItemStatus");var r=debounce((function(t){e.onChange(t)}),ON_CHANGE_DEBOUNCE_TIMER);return e.cartLimits=document.querySelector("cart-limits"),e.maxPerVariant=e.cartLimits.maxPerVariant,e.addEventListener("change",r.bind(e)),e}return _inherits(t,_wrapNativeSuper(HTMLElement)),_createClass(t,[{key:"c
1onnectedCallback",value:function(){var e=this;this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,(function(t){"cart-items"!==t.source&&e.onCartUpdate()}))}},{key:"disconnectedCallback",value:function(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}},{key:"getCart",value:function(e){fetch("".concat(routes.cart_url,".js")).then((function(e){return e.json()})).then((function(t){e(t)}))}},{key:"onChange",value:function(e){var t;this.updateQuantity(e.target.dataset.index,e.target.value,document.activeElement.getAttribute("name"),null===(t=e.target)||void 0===t?void 0:t.max),setTimeout((function(){document.getElementsByClassName("cart-item__details")&&document.getElementsByClassName("cart-item__details").length>0&&Array.from(document.getElementsByClassName("cart-item__details")).forEach((function(e){e.querySelector(".cart-item__name").textContent.includes("Gift Card")&&e.querySelectorAll(".product-option")&&e.querySelectorAll(".product-option").length>0&&Array.from(e.querySelectorAll(".product-option")).forEach((function(e){e.querySelector("dt")&&e.querySelector("dd")&&("Recipient email:"===e.querySelector("dt").textContent&&(e.querySelector("dt").textContent="E-mail do presenteado:"),"Send on:"===e.querySelector("dt").textContent&&(e.querySelector("dt").textContent="Data de envio:"),window.innerWidth<768&&("Message:"===e.querySelector("dt").textContent||"Mensagem:"===e.querySelector("dt").textContent)?(e.querySelector("dt").remove(),e.querySelector("dd").remove()):"Message:"===e.querySelector("dt").textContent&&(e.querySelector("dt").textContent="Mensagem:"))}))}))}),1e3)}},{key:"onCartUpdate",value:function(){var e=this;fetch("".concat(routes.cart_url,"?section_id=main-cart-items")).then((function(e){return e.text()})).then((function(t){var r=(new DOMParser).parseFromString(t,"text/html").querySelector("cart-items");e.innerHTML=r.innerHTML})).catch((function(e){console.error(e)}))}},{key:"getSectionsToRender",value:function(){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"}]}},{key:"updateQuantity",value:function(e,t,r,n){var o=this,a=parseInt(n);if(!(a&&t>a)){this.enableLoading(e);var i,c,s,u,l=JSON.stringify({line:e,quantity:t,sections:this.getSectionsToRender().map((function(e){return e.section})),sections_url:window.location.pathname}),p=_objectSpread({},fetchConfig()),d=(i=document.getElementById("CartItem-".concat(e))||document.getElementById("CartDrawer-Item-".concat(e)),c=i?i.dataset.variantid:null,s=document.getElementById("Quantity-".concat(e))||document.getElementById("Drawer-quantity-".concat(e)),(u=Number(t)-Number(s.dataset.cartQuantity))<=0?null:JSON.stringify({items:[{id:Number(c),quantity:u}]}));p.headers["site-placement"]="cart-items",d&&(p.headers["add-to-cart-original-payload"]=d),fetch("".concat(routes.cart_change_url),_objectSpread(_objectSpread({},p),{body:l})).then((function(e){return e.text()})).then((function(t){var n=JSON.parse(t),a=document.getElementById("Quantity-".concat(e))||document.getElementById("Drawer-quantity-".concat(e)),i=document.querySelectorAll(".cart-item");if(n.errors)return a.value=a.getAttribute("value"),void o.updateLiveRegions(e,n.errors);o.classList.toggle("is-empty",0===n.item_count);var c=document.querySelector("cart-drawer"),s=document.getElementById("main-cart-footer");s&&s.classList.toggle("is-empty",0===n.item_count),c&&c.classList.toggle("is-empty",0===n.item_count),o.getSectionsToRender().forEach((function(e){(document.getElementById(e.id).querySelector(e.selector)||document.getElementById(e.id)).innerHTML=o.getSectionInnerHTML(n.sections[e.section],e.selector)}));var u=n.items[e-1]?n.items[e-1].quantity:void 0,l="";i.length===n.items.length&&u!==parseInt(a.value)&&(l=void 0===u?window.cartStrings.error:window.cartStrings.quantityError.replace("[quantity]",u)),o.updateLiveRegions(e,l);var p=document.getElementById("CartItem-".concat(e))||document.getElementById("CartDrawer-Item-".concat(e));p&&p.querySelector('[name="'.concat(r,'"]'))?c?trapFocus(c,p.querySelector('[name="'.concat(r,'"]'))):p.querySelector('[name="'.concat(r,'"]')).focus():0===n.item_count&&c?trapFocus(c.querySelector(".drawer__inner-empty"),c.querySelector("a")):document.querySelector(".cart-item")&&c&&trapFocus(c,document.querySelector(".cart-item__name")),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items"}),dispatchCartEvent({source:"cart-items",operation:"update",cart:n})})).catch((function(){o.querySelectorAll(".loading-overlay").forEach((function(e){return e.classList.add("hidden")})),(document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors")).textContent=window.cartStrings.error})).finally((function(){o.disableLoading(e),o.updateKits()}))}}},{key:"updateKits",value:function(){var e=this,t={};fetch("".concat(routes.cart_url,".js")).then((function(e){return e.json()}
1)).then((function(r){r&&r.items&&(r.items.forEach((function(e){if(e.properties&&e.properties.handlesKit){var r=e.properties.__promoInstanceId||e.properties.__kitInstanceId||"",n=r?"".concat(e.properties.handlesKit.name,"--").concat(r):e.properties.handlesKit.name,o=e.properties.handlesKit.totalQty;t[n]?(t[n].items.push(e),t[n].quantity+=e.quantity):t[n]={items:[e],quantity:e.quantity,totalQty:o}}})),Object.keys(t).forEach((function(r){var n=t[r];if(n.totalQty>n.quantity){var o={};n.items.forEach((function(e){o[e.key||e.id]=0}));var a=JSON.stringify({updates:o,sections:e.getSectionsToRender().map((function(e){return e.section})),sections_url:window.location.pathname});fetch("".concat(routes.cart_update_url),_objectSpread(_objectSpread({},fetchConfig()),{body:a})).then((function(e){return e.text()})).then((function(t){var r=JSON.parse(t);if(!r.errors){e.classList.toggle("is-empty",0===r.item_count);var n=document.querySelector("cart-drawer"),o=document.getElementById("main-cart-footer");o&&o.classList.toggle("is-empty",0===r.item_count),n&&n.classList.toggle("is-empty",0===r.item_count),e.getSectionsToRender().forEach((function(t){(document.getElementById(t.id).querySelector(t.selector)||document.getElementById(t.id)).innerHTML=e.getSectionInnerHTML(r.sections[t.section],t.selector)})),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"}),dispatchCartEvent({source:"cart-items",operation:"remove",cart:r})}})).catch((function(e){console.error(e)}))}})))}))}},{key:"updateLiveRegions",value:function(e,t){var r=document.getElementById("Line-item-error-".concat(e))||document.getElementById("CartDrawer-LineItemError-".concat(e));r&&(r.querySelector(".cart-item__error-text").innerHTML=t),this.lineItemStatusElement.setAttribute("aria-hidden",!0);var n=document.getElementById("cart-live-region-text")||document.getElementById("CartDrawer-LiveRegionText");n.setAttribute("aria-hidden",!1),setTimeout((function(){n.setAttribute("aria-hidden",!0)}),1e3)}},{key:"getSectionInnerHTML",value:function(e,t){return(new DOMParser).parseFromString(e,"text/html").querySelector(t).innerHTML}},{key:"enableLoading",value:function(e){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.add("cart__items--disabled");var t=this.querySelectorAll("#CartItem-".concat(e," .loading-overlay")),r=this.querySelectorAll("#CartDrawer-Item-".concat(e," .loading-overlay"));[].concat(_toConsumableArray(t),_toConsumableArray(r)).forEach((function(e){return e.classList.remove("hidden")})),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1)}},{key:"disableLoading",value:function(e){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.remove("cart__items--disabled");var t=this.querySelectorAll("#CartItem-".concat(e," .loading-overlay")),r=this.querySelectorAll("#CartDrawer-Item-".concat(e," .loading-overlay"));t.forEach((function(e){return e.classList.add("hidden")})),r.forEach((function(e){return e.classList.add("hidden")}))}}])}();customElements.get("cart-items")||customElements.define("cart-items",CartItems),customElements.get("cart-note")||customElements.define("cart-note",function(e){function t(){var e;return _classCallCheck(this,t),(e=_callSuper(this,t)).addEventListener("change",debounce((function(e){var t=JSON.stringify({note:e.target.value});fetch("".concat(routes.cart_update_url),_objectSpread(_objectSpread({},fetchConfig()),{body:t})).then((function(e){if(!e.ok)throw new Error("cart-note update failed: ".concat(e.status));return e.json()})).then((function(e){dispatchCartEvent({source:"cart-note",operation:"update-note",cart:e})})).catch((function(e){console.warn("[cart-note] update failed:",e)}))}),ON_CHANGE_DEBOUNCE_TIMER)),e}return _inherits(t,_wrapNativeSuper(HTMLElement)),_createClass(t)}());var CartFreeShipping=function(e){function t(){var e;return _classCallCheck(this,t),(e=_callSuper(this,t)).freeShippingValue=100*parseInt(e.getAttribute("data-free-shipping-value")),e.customMessage=/true/.test(e.getAttribute("data-custom-message")),e.customMessageValue=100*parseInt(e.getAttribute("data-custom-message-value")),e.progressBar=e.querySelector(".cart-free-shipping__progress span"),e.progressTextSingular=e.querySelector(".cart-free-shipping__inner p.singular"),e.progressTextPlural=e.querySelector(".cart-free-shipping__inner p.plural"),e.progressTextCustom=e.querySelector(".cart-free-shipping__inner p.custom"),e.progressTextSuccess=e.querySelector(".cart-free-shipping__inner p.success"),e.freeGift=/true/.test(e.getAttribute("data-custom-gift")),e.freeGiftValue=100*parseInt(e.getAttribute("data-custom-gift-value")),e.freeGiftText=e.querySelector("cart-free-shipping p.gift"),e.giftTextSuccess=e.querySelector("cart-free-shipping p.gift-success"),e.shippingCalculatorText=document.querySelector(".shipping-calculator__header p"),e.updateFreeShippingProgress(),e}return _inherits(t,_wrapNativeSuper(HTMLElement)),_createClass(t,[{key:"getCart",value:function(e){fetch("".concat(routes.cart_url,".js")).then((function(e){return e.json()})).then((function(t){e(t)}))}},{key:"formatMoney",value:function(e){var t=(e/100).toFixed(2).replace(".",",");return"R$ ".concat(t.replace(/\B(?=(\d{3})+(?!\d))/g,"."))}},{key:"updateFreeShippingProgress",value:function(){var e=this;this.getCart((function(t){if(e.freeGift){var r=t.total_price/e.freeGiftValue*100;e.progressBar&&(e.progressBar.style.width="".concat(r<=100?r:100,"%"))}else{var n=t.total_price/e.freeShippingValue*100;e.progressBar&&(e.progressBar.style.width="".concat(n<=100?n:100,"%"))}var o=e.freeShippingValue-t.total_price,a=e.customMessageValue-t.total_price,i=e.freeGiftValue-t.total_price;o>0?e.customMessage?(e.progressTextCustom&&(e.progressTextCustom.innerHTML=window.cartStrings.freeShippingProgressCu
1stom.replace("[money]",e.formatMoney(o)).replace("[value]",e.formatMoney(a)),e.progressTextCustom.style.display="block"),e.progressTextSingular&&(e.progressTextSingular.style.display="none"),e.progressTextPlural&&(e.progressTextPlural.style.display="none"),e.progressTextSuccess&&(e.progressTextSuccess.style.display="none")):(e.progressTextPlural&&(e.progressTextPlural.innerHTML=window.cartStrings.freeShippingProgressPlural.replace("[money]",e.formatMoney(o)),e.progressTextPlural.style.display="block"),e.progressTextCustom&&(e.progressTextCustom.style.display="none"),e.progressTextSingular&&(e.progressTextSingular.style.display="none"),e.progressTextSuccess&&(e.progressTextSuccess.style.display="none"),e.shippingCalculatorText&&(e.shippingCalculatorText.textContent="CALCULE SEU FRETE")):(e.progressTextCustom&&(e.progressTextCustom.style.display="none"),e.progressTextSingular&&(e.progressTextSingular.style.display="none"),e.progressTextPlural&&(e.progressTextPlural.style.display="none"),e.progressTextSuccess&&(e.progressTextSuccess.style.display="block"),e.shippingCalculatorText&&(e.shippingCalculatorText.textContent="Prazo de entrega")),e.freeGift&&(t.total_price<e.freeGiftValue?e.freeGiftText&&(e.freeGiftText.innerHTML=window.cartStrings.freeGift.replace("[money]",e.formatMoney(i)),e.freeGiftText.style.display="block"):(e.freeGiftText&&(e.freeGiftText.style.display="none"),e.giftTextSuccess&&(e.giftTextSuccess.style.display="block")))}))}}])}();customElements.define("cart-free-shipping",CartFreeShipping); 2//# sourceMappingURL=cart.js.map
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.