1(function($){'use strict';if(window.svTwFunnelLoaded||!window.svTwConfig)return;window.svTwFunnelLoaded=!0;const config=window.svTwConfig;const pending=new Map();const memory=new Map();const storageKey='sv_tw_dispatched_v1';const names=new Set(['AddToCart','checkoutStarted','addressSubmitted','paymentSubmitted','Purchase','Contact']);let busy=!1;let refreshAgain=!1;let retryTimer=null;let retryCount=0;let lastContact='';function consent(){try{return!!config.consentService&&window.BorlabsCookie?.Consents?.hasConsent(config.consentService)===!0}catch(_){return!1}} 2function history(){try{const entries=JSON.parse(window.localStorage.getItem(storageKey)||'[]');return Array.isArray(entries)?entries.filter(e=>Array.isArray(e)&&e[1]>Date.now()):[]}catch(_){return[]}} 3function wasSent(id){return(memory.get(id)||0)>Date.now()||history().some(e=>e[0]===id)} 4function remember(event){const until=Date.now()+(event.name==='Purchase'?30:1)*86400000;memory.set(event.id,until);try{const entries=history().filter(e=>e[0]!==event.id);entries.push([event.id,until]);window.localStorage.setItem(storageKey,JSON.stringify(entries.slice(-512)))}catch(_){}} 5function drain(){if(!consent())return;try{if(typeof window.TriplePixel!=='function'||window.TriplePixel('State')!=='Ready'){retry();return}}catch(_){retry();return} 6for(const[id,event]of pending){if(event.expires*1000<=Date.now()||wasSent(id)){pending.delete(id);continue} 7if(!consent())return;try{window.TriplePixel(event.name,event.payload);remember(event);pending.delete(id)}catch(_){retry();return}}} 8function retry(){if(!retryTimer&&pending.size&&retryCount<120){retryTimer=window.setTimeout(function(){retryTimer=null;retryCount++;drain()},1000)}} 9function accept(events){if(!Array.isArray(events))return;for(const event of events){if(!event||typeof event.id!=='string'||!names.has(event.name)||!event.payload||!Number.isFinite(event.expires)||event.expires*1000<=Date.now())continue;pending.set(event.id,event)} 10while(pending.size>128)pending.delete(pending.keys().next().value);retryCount=0;drain()} 11function field(name){return String($('form.checkout [name="'+name+'"]').val()||'').trim()} 12function currentIdentity(context){const data=Object.assign({},context);const fields={email:'email',phone:'phone',firstName:'first_name',lastName:'last_name'};for(const[key,suffix]of Object.entries(fields)){const value=field('billing_'+suffix);if(value)data[key]=value} 13data.address=Object.assign({},data.address);for(const[key,suffix]of Object.entries({zip:'postcode',city:'city',countryCode:'country',provinceCode:'state'})){const value=field('billing_'+suffix);if(value)data.address[key]=value} 14return data} 15function refresh(){if(!consent())return;if(busy){refreshAgain=!0;return} 16busy=!0;$.ajax({url:config.endpoint,method:'GET',dataType:'json',cache:!1,timeout:5000}).done(function(response){if(!response?.success||!response.data)return;const data=response.data;if(config.checkout&&data.checkoutId&&data.context?.lineItems?.length){accept([{id:data.checkoutId,name:'checkoutStarted',expires:Math.floor(Date.now()/1000)+900,payload:Object.assign(currentIdentity(data.context),{eventId:data.checkoutId})}])} 17accept(data.events)}).always(function(){busy=!1;if(refreshAgain){refreshAgain=!1;refresh()}})} 18function fragments(){const node=document.querySelector('div.sv-tw-events');if(node){try{accept(JSON.parse(node.getAttribute('data-events')||'[]'))}catch(_){}}} 19function contact(){if(!config.checkout||!consent())return;const email=field('billing_email');const phone=field('billing_phone');if((!email||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email))&&!phone)return;const identity=email+'\n'+phone;if(identity===lastContact)return;lastContact=identity;const id='svtw-contact-'+(window.crypto?.randomUUID?.()||Date.now()+'-'+Math.random());accept([{id,name:'Contact',payload:{email,phone},expires:Math.floor(Date.now()/1000)+900}])} 20$(function(){if(!document.querySelector('div.sv-tw-events')){const node=document.createElement('div');node.className='sv-tw-events';node.hidden=!0;document.body.appendChild(node)} 21accept(window.svTwInitialEvents||[]);delete window.svTwInitialEvents;fragments();refresh();$(document.body).on('added_to_cart wc_fragments_refreshed wc_fragments_loaded',function(){fragments();refresh()});$('form.checkout').on('checkout_place_order_success',function(_event,result){accept(result?.sv_tw_events)});$(document.body).on('checkout_error',refresh);$(document).on('change','form.checkout [name="billing_email"], form.checkout [name="billing_phone"]',contact)});$(document).ajaxComplete(function(_event,xhr,settings){try{if(new
21URL(settings.url,window.location.href).origin!==window.location.origin)return;const result=xhr.responseJSON;accept(result?.sv_tw_events);accept(result?.data?.sv_tw_events);const request=String(settings.url)+'&'+(typeof settings.data==='string'?settings.data:'');if(/wc-ajax=checkout|add[_-]to[_-]cart|product_id=/.test(request))refresh()}catch(_){}});window.addEventListener('borlabs-cookie-consent-saved',function(){if(consent()){retryCount=0;drain();refresh()}else{pending.clear();lastContact=''}});window.addEventListener('borlabs-cookie-after-init',function(){drain();refresh()});window.addEventListener('pageshow',function(){fragments();refresh()})})(jQuery)
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.