1(function(){if(!document.body)return;async function customCartEmpty(){try{const res=await fetch(window.Shopify.routes.root+"cart/clear.js",{method:"POST",headers:{"Content-Type":"application/json"}});if(!res.ok)throw new Error(`HTTP ${res.status} from cart clear API`);const cart=await res.json();document.dispatchEvent(new CustomEvent("cart:updated",{detail:{cart}}));const countEvent=new CustomEvent("cartcount:update",{detail:cart});return window.dispatchEvent(countEvent),cart}catch(err){throw console.error("[CartEmpty] empty failed:",err),err}}function initializeEmptyCartButton(){document.body.addEventListener("click",function(e){const emptyButton=e.target.closest("#empty-cart-btn");if(!emptyButton||(e.preventDefault(),e.stopPropagation(),emptyButton.hasAttribute("data-processing")))return;emptyButton.setAttribute("data-processing","true"),emptyButton.classList.add("disabled");const originalContent=emptyButton.innerHTML;emptyButton.innerHTML=` 2 EN COURS... 3 <svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-spinner" viewBox="0 0 20 20" style="width: 20px; height: 20px; display: inline-block; vertical-align: middle; margin-left: 8px; animation: spin 1s linear infinite;"><path d="M7.229 1.173a9.25 9.25 0 1 0 11.655 11.412 1.25 1.25 0 1 0-2.455-1.372A6.75 6.75 0 1 1 10 3.25a1.25 1.25 0 1 0 0-2.5 9.25 9.25 0 0 0-2.771.423z" fill="currentColor"/><style>@keyframes spin { to { transform: rotate(360deg); } }</style></svg> 4 `,typeof window.customCartEmpty=="function"?window.customCartEmpty().then(cart=>{document.body.classList.contains("template-cart")&&typeof window.refreshCartPageSection=="function"&&window.refreshCartPageSection()}).catch(err=>{console.error("[StaticCart] Error emptying cart:",err),emptyButton.removeAttribute("data-processing"),emptyButton.classList.remove("disabled"),emptyButton.innerHTML=originalContent}):(console.error("[StaticCart] `customCartEmpty` function is not available."),emptyButton.removeAttribute("data-processing"),emptyButton.classList.remove("disabled"),emptyButton.innerHTML=originalContent)})}function initializeStaticCartRemove(){document.body.hasAttribute("data-static-cart-remove-init")||(document.body.setAttribute("data-static-cart-remove-init","true"),document.body.addEventListener("click",function(e){const removeLink=e.target.closest(".template-cart .cart-item__remove-link");if(!removeLink)return;e.preventDefault(),e.stopImmediatePropagation();const cartItem=removeLink.closest(".cart-item");if(!cartItem)return;const lineKey=cartItem.getAttribute("data-cartitem-key");if(!lineKey){console.error("[StaticCart] Remove failed: cart item key not found.");return}cartItem.classList.add("removing"),typeof window.customCartRemove=="function"?window.customCartRemove(lineKey).then(cart=>{typeof window.showSuccessToast=="function"&&window.showSuccessToast("Article supprim\xE9 du panier."),document.body.classList.contains("template-cart")&&typeof window.refreshCartPageSection=="function"&&window.refreshCartPageSection()}).catch(err=>{console.error("[StaticCart] Error removing item:",err),cartItem.classList.remove("removing"),typeof window.showFailedToast=="function"&&window.showFailedToast("Erreur lors de la suppression de l'article.")}):(console.error("[StaticCart] `customCartRemove` function is not available."),cartItem.classList.remove("removing"))},!0))}window.customCartEmpty=customCartEmpty,document.addEventListener("DOMContentLoaded",()=>{initializeEmptyCartButton(),initializeStaticCartRemove()}),document.addEventListener("shopify:section:load",e=>{e.target.matches("#shopify-section-static-cart")&&initializeStaticCartRemove()})})(); 5//# sourceMappingURL=/cdn/shop/t/7/assets/cart-empty-api.js.map?v=27619467354039508071765375820
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.