1(()=>{"use strict";const context=window.westPaw=window.westPaw||{};let failedCart,syncPending=!1,destroying=!1;function activeCart(){const cart=window.Rebuy?.SmartCart;return!context.isB2B&&cart!==failedCart&&cart?.status==="ready"&&typeof cart.show=="function"&&document.getElementById("rebuy-cart")?cart:null}context.isRebuySmartCartActive=()=>!!activeCart();function updateCounts(count){!Number.isInteger(count)||count<0||(document.querySelectorAll("cart-count").forEach(badge=>{badge.textContent.trim()!==String(count)&&(badge.textContent=count),badge.getAttribute("total-items")!==String(count)&&badge.setAttribute("total-items",count),badge.classList.toggle("hidden",count===0)}),document.querySelectorAll("[data-cart-count-label]").forEach(label=>{const text=label.dataset.countTemplate.replace("__COUNT__",count);label.textContent!==text&&(label.textContent=text)}))}function synchronize(){if(syncPending=!1,!document.body)return;const cart=activeCart(),wasActive=document.body.classList.contains("rebuy-smart-cart-active");if(document.body.classList.toggle("rebuy-smart-cart-active",!!cart),cart){const drawer=document.getElementById("DrawerCart");drawer?.classList.contains("drawer__open")&&drawer.close?.(),updateCounts(cart.itemCount())}else wasActive&&(updateCounts(window.Rebuy?.Cart?.cart?.item_count),window.dispatchEvent(new CustomEvent("cart:refresh-silent")))}function scheduleSync(){syncPending||(syncPending=!0,queueMicrotask(synchronize))}function onReady(event){const cart=event?.detail?.smartcart||window.Rebuy?.SmartCart;if(failedCart=void 0,context.isB2B&&cart&&typeof cart.destroy=="function"&&!destroying){destroying=!0;try{cart.hide?.(),cart.destroy()}finally{document.body?.classList.remove("smart-cart--enabled","rebuy-cart-visible","rebuy-smart-cart-active"),destroying=!1}}scheduleSync()}function openCart(event){if(!event.target.closest?.("[data-cart-trigger]")||event.type==="keyup"&&event.code!=="Enter"||event.type==="click"&&(event.button!==0||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey))return;const cart=activeCart();if(!cart){synchronize();return}try{cart.show()}catch(error){failedCart=cart,synchronize(),console.warn("Unable to open Rebuy Smart Cart; using the theme cart.",error);return}event.preventDefault(),event.stopImmediatePropagation(),scheduleSync()}document.addEventListener("click",openCart,!0),document.addEventListener("keyup",openCart,!0),document.addEventListener("rebuy:smartcart.ready",onReady),document.addEventListener("rebuy:smartcart.show",event=>{context.isB2B?onReady(event):scheduleSync()}),["rebuy:cart.ready","rebuy:cart.change","rebuy:cart.enriched","rebuy:smartcart.hide","cart:change","cart:replaced","shopify:section:load"].forEach(name=>document.addEventListener(name,scheduleSync));function initialize(){window.Rebuy?.SmartCart?.status==="ready"?onReady():scheduleSync(),new MutationObserver(records=>{records.some(record=>[...record.addedNodes,...record.removedNodes].some(node=>node.nodeType===1&&(node.matches("#rebuy-cart, cart-count")||node.querySelector("#rebuy-cart, cart-count"))))&&scheduleSync()}).observe(document.body,{childList:!0,subtree:!0})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initialize,{once:!0}):initialize()})(); 2//# sourceMappingURL=/cdn/shop/t/464/assets/rebuy-smart-cart.js.map?v=102023630021488414011790809506
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.