1(function(){"use strict";var root=document.getElementById("cart-analytics-config");if(!root)return;var ENDPOINT=root.getAttribute("data-ca-endpoint"),ENV=root.getAttribute("data-ca-env")||"live",SHOP=root.getAttribute("data-ca-shop")||"",CA_DROP_DRAFT=root.getAttribute("data-ca-drop-draft")==="true";if(!ENDPOINT||ENV!=="live"&&CA_DROP_DRAFT||window.__caCollectorLoaded)return;window.__caCollectorLoaded=!0;var NATIVE_FETCH=window.fetch.bind(window);function getSessionId(){var m=document.cookie.match(/(?:^|;\s*)ca_sid=([^;]+)/);if(m)return m[1];var sid="s_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,10),d=new Date;return d.setDate(d.getDate()+180),document.cookie="ca_sid="+sid+";expires="+d.toUTCString()+";path=/;SameSite=Lax",sid}var SID=getSessionId(),MAX_BYTES=6e4,FLUSH_MS=4e3,buffer=[],flushTimer=null;function flush(useBeacon){if(buffer.length){var batch=buffer;buffer=[],flushTimer&&(clearTimeout(flushTimer),flushTimer=null);var body=JSON.stringify({shop:SHOP,sessionId:SID,environment:ENV,events:batch});useBeacon&&navigator.sendBeacon&&navigator.sendBeacon(ENDPOINT,new Blob([body],{type:"text/plain"}))||sendFetch(body)}}function sendFetch(body){try{NATIVE_FETCH(ENDPOINT,{method:"POST",headers:{"Content-Type":"text/plain"},body:body,keepalive:!0,mode:"cors",credentials:"omit"}).catch(function(){})}catch(e){}}function emit(type,payload){if(buffer.push({t:type,p:payload||{},ts:new Date().toISOString(),cv:currentCart?currentCart.total_price:null,ic:currentCart?currentCart.item_count:null,ct:currentCart&¤tCart.token||null}),JSON.stringify(buffer).length>MAX_BYTES){var last=buffer.pop();flush(!0),buffer.push(last)}flushTimer||(flushTimer=setTimeout(function(){flush(!0)},FLUSH_MS))}var currentCart=null,maxGiftTier=0,snapTimer=null;function refreshCart(){NATIVE_FETCH("/cart.js",{headers:{Accept:"application/json"}}).then(function(r){return r.json()}).then(function(cart){currentCart=cart,checkGiftTiers(cart)}).catch(function(){})}function scheduleCartRefresh(){clearTimeout(snapTimer),snapTimer=setTimeout(refreshCart,600)}function giftThresholds(){try{var el=document.querySelector("cart-drawer .e5cd__data"),goals=el?JSON.parse(el.getAttribute("data-goals")||"[]"):[];return goals.map(function(g){return{threshold:g.threshold,reward_type:g.reward_type}})}catch(e){return[]}}function checkGiftTiers(cart){if(cart){var total=cart.total_price||0;giftThresholds().forEach(function(g){total>=g.threshold&&g.threshold>maxGiftTier&&(maxGiftTier=g.threshold,emit("gift_tier",{threshold:g.threshold,rewardType:g.reward_type}))})}}function inDrawer(el){return el&&el.closest&&el.closest("cart-drawer")}var cd=document.querySelector("cart-drawer");if(cd){var wasOpen=cd.classList.contains("active");new MutationObserver(function(){var open=cd.classList.contains("active");open&&!wasOpen&&(emit("drawer_open",{}),refreshCart(),scanUpsells()),!open&&wasOpen&&(emit("drawer_close",{}),flush(!0)),wasOpen=open}).observe(cd,{attributes:!0,attributeFilter:["class"]})}var upsellArmedUntil=0,lastUpsellHandle=null;document.addEventListener("click",function(e){var el=e.target&&e.target.closest?e.target.closest('[data-e5-action],[name="checkout"]'):null;if(!(!el||!inDrawer(el))){var action=el.getAttribute("data-e5-action")||(el.getAttribute("name")==="checkout"?"checkout":"");if(action==="checkout"){emit("checkout_click",{}),flush(!0);return}if(action==="qty"){var lk=el.getAttribute("data-line-key");setTimeout(function(){var input=document.querySelector('cart-drawer .e5cd__qty-input[data-line-key="'+(window.CSS&&CSS.escape?CSS.escape(lk||""):lk)+'"], cart-drawer [data-e5-qty-input][data-line-key="'+lk+'"]'),q=parseInt(input?input.value:el.getAttribute("data-to"),10);isNaN(q)||emit("qty_change",{qtyAfter:q,lineKey:lk}),scheduleCartRefresh()},50);return}if(action==="sub-on"){emit("plan_change",{to:"sub",sellingPlanId:el.getAttribute("data-plan-id")||null}),scheduleCartRefresh();return}if(action==="apply-discount"){var di=document.querySelector("cart-drawer [data-e5-discount-input]");di&&di.value.trim()&&emit("discount_apply",{code:di.value.trim()}),scheduleCartRefresh();return}if(action==="add"){var card=el.closest(".e5cd__upsell-card");card&&(emit("upsell_add",{ruleHandle:card.getAttribute("data-rule-handle")||null}),scheduleCartRefresh());return}}},!0),document.addEventListener("change",function(e){var t=e.target;if(!(!t||!inDrawer(t)))if(t.matches&&t.matches("[data-e5-qty-input],.e5cd__qty-input")){var q=parseInt(t.value,10);
1isNaN(q)||emit("qty_change",{qtyAfter:q,lineKey:t.getAttribute("data-line-key")}),scheduleCartRefresh()}else t.matches&&t.matches('[data-e5-action="plan-select"]')&&(emit("plan_change",{to:t.value?"sub":"onetime",sellingPlanId:t.value||null}),scheduleCartRefresh())},!0),document.addEventListener("submit",function(e){e.target&&(e.target.id==="e5cd-checkout-form"||inDrawer(e.target)&&e.target.querySelector('[name="checkout"]'))&&(emit("checkout_click",{}),flush(!0))},!0);var io="IntersectionObserver"in window?new IntersectionObserver(function(entries){entries.forEach(function(en){en.isIntersecting&&(emit("upsell_shown",{ruleHandle:en.target.getAttribute("data-rule-handle")||null}),io.unobserve(en.target))})},{threshold:.5}):null;function scanUpsells(){io&&document.querySelectorAll("cart-drawer .e5cd__upsell-card").forEach(function(card){card.__caSeen||(card.__caSeen=!0,io.observe(card))})}cd&&new MutationObserver(function(){scanUpsells()}).observe(cd,{childList:!0,subtree:!0}),document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&flush(!0)}),window.addEventListener("pagehide",function(){flush(!0)}),scanUpsells()})(); 2//# sourceMappingURL=/cdn/shop/t/26/assets/cart-analytics.js.map?v=86410807998839489761785933136
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.