PageSourceSearch

https://shopindoorgolf.com/cdn/shop/t/358/assets/ig-main-cart-D4zZNB3f.js?v=61970665411690948901788183396

js shopindoorgolf.com collected 2026-09-25 15:17:38 UTC 5,484 bytes, 1 lines download raw bytes

1import{l as t,b as e}from"./ig-chunk-helpers-VjLdvjhA.js";function r(t){const e=document.querySelector("input.cart__submit"),r=document.querySelector(".js__checkout--btn");if(!e||!r)return;const n=e.offsetTop;t+window.innerHeight<n?r.classList.contains("active")||r.classList.add("active"):r.classList.contains("active")&&r.classList.remove("active")}async function n(){return fetch(`/cart.js?t=${Date.now()}`,{credentials:"same-origin",method:"GET",cache:"no-store",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"}}).then(t=>t.json())}async function o(t){for(const r of t)try{await fetch(`${window.Shopify.routes.root||"/"}cart/change.js`,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({id:r,quantity:0})})}catch(e){console.error("Error removing line:",r,e)}}async function a(t){const e=[];return t.items.forEach(r=>{if(!r.properties?._product||!r.properties?._variantId)return;t.items.find(t=>parseInt(t.variant_id)===parseInt(r.properties._variantId))||e.push(r.key)}),t.items.forEach(r=>{const n=r.properties?._tpo_add_on_key;if(!r.properties?._tpo_main_product_id||!n)return;t.items.find(t=>t.properties?._tpo_add_on_keys&&String(t.properties._tpo_add_on_keys).includes(n))||e.push(r.key)}),!!e.length&&(await o(e),!0)}async function c(){try{let e=await n();try{await a(e)&&(e=await n())}catch(t){console.error("Error cleaning up orphaned items:",t)}!function(t){const e=(t.total_price/100).toLocaleString("en-US",{style:"currency",currency:t.currency}),[r,n]=e.split("."),o=`${r}<span>${n}</span> ${t.currency}`;document.querySelectorAll(".cart-subtotal__price__main, .cart-subtotal__price").forEach(t=>t.innerHTML=o)}(e),await async function(){const e=document.querySelector(".wrapper--cart--template");try{const t=await fetch(`/cart?t=${Date.now()}`,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{"X-Requested-With":"XMLHttpRequest"}}).then(t=>t.text()),e=(new DOMParser).parseFromString(t,"text/html"),r=e.querySelector(".parentFormCartInner"),n=document.querySelector(".parentFormCartInner"),o=e.querySelector(".empty--parent__cart").classList.contains("active");!function(t){const e=document.querySelector(".form--cart__template"),r=document.querySelector(".empty--parent__cart");t?(r.classList.add("active"),e.classList.add("hidden")):(r.classList.remove("active"),e.classList.remove("hidden"))}(o),r&&n&&!o&&(n.innerHTML=r.innerHTML)}catch(t){console.error("Error refreshing cart view:",t)}finally{e?.classList.remove("loading")}}()}catch(t){console.error("Error syncing cart:",t)}}if(t(()=>{document.querySelectorAll(".cart__qty-input").forEach(function(t){t.addEventListener("change",function(t){const r=document.querySelector(".footer__form--cart--inner");r&&!r.classList.contains("active")&&(r.classList.add("active"),e(r))}),t.addEventListener("keydown",function(t){const r=document.querySelector(".footer__form--cart--inner");r&&!r.classList.contains("active")&&(r.classList.add("active"),e(r))})}),document.querySelectorAll(".cart__submit--js__mobile").forEach(function(t){t.addEventListener("click",function(t){t.preventDefault();const e=document.querySelector("input.cart__submit");e&&e.click()})}),document.querySelectorAll(".input--qty--js").forEach(function(t){t.addEventListener("change",function(t){var e=this.value,r=this.closest("tr.cart__row"),n=r?.querySelector('input.cart__qty-input[name="updates[]"]');n&&(n.value=e)})}),window.addEventListener("scroll",function(t){r(window.pageYOffset||document.documentElement.scrollTop)}),window.addEventListener("load",function(t){r(window.pageYOffset||document.documentElement.scrollTop)})}),t(()=>{const t=document.querySelector(".wrapper--cart--template");t&&t.classList.remove("loading")}),t(function(){document.addEventListener("click",async t=>{const e=t.target.closest(".remove-item-button");if(!e)return;const r=e.dataset?.lineKey;if(!r)return;const a=document.querySelector(".wrapper--cart--template");a?.classList.add("loading");try{const t=await n(),a=parseInt(e.dataset?.line,10),i=t.items.find(t=>t.key===r)||Number.isInteger(a)&&t.items[a-1];if(i){const e=[i.key],r=i.properties?._tpo_add_on_keys;
1r&&t.items.forEach(t=>{const n=t.properties?._tpo_add_on_key;n&&String(r).includes(n)&&e.push(t.key)}),await o(e)}await c()}catch(i){console.error("Error removing item:",i)}finally{a?.classList.remove("loading")}})}),window.addEventListener("pageshow",t=>{t.persisted&&document.querySelector(".wrapper--cart--template")&&c()}),t(async()=>{if(document.querySelector(".wrapper--cart--template"))try{const t=await n();await a(t)&&await c()}catch(t){console.error("Error cleaning up orphaned warranties:",t)}}),window.Extend&&window.ExtendShopify&&"USD"===window.Shopify.currency.active){var i=JSON.parse(document.querySelector("[data-cart-json]").innerHTML.trim()),s=Array.prototype.slice;(d="#extend-cart-offer",u=document.querySelectorAll(d),u?s.call(u,0):[]).forEach(function(t){var e=t.getAttribute("data-extend-variant"),r=t.getAttribute("data-extend-quantity");window.ExtendShopify.warrantyAlreadyInCart(e,i.items)||window.Extend.buttons.renderSimpleOffer(t,{referenceId:e,onAddToCart:function({plan:t,product:e}){ExtendShopify.addPlanToCart({plan:t,product:e,quantity:r},function(t){t||window.location.reload()})}})}),window.ExtendShopify.normalizeCart({cart:i,balance:!1},function(t,e){e&&e.updates&&location.reload()})}var d,u;//# sourceMappingURL=ig-main-cart-D4zZNB3f.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.