1 /*! Start of public/scripts/third-party-scripts.js. */ 2const putThirdPartyScripts=(()=>{const fdi=(window.fdi=window.fdi||{u:{},p:{}});const isMobile=window.matchMedia('(max-width: 768px)').matches;const currentPageType=""||'all';const pauseScripts="none".toLowerCase();const directStrategies={head_blocking:true,head_nonblocking:true,footer_immediate:true,legacy_immediate_head:true,legacy_immediate_footer:true};const executionGroupWeight={consent:0,tag_manager:10,analytics:20,chat:30,retail:40,accessibility:50,maps:60,experimentation:70,other:80};const registry={};const state={};fdi.u.getJSONFromDOM=(elementId)=>{const scriptElement=document.getElementById(elementId);if(!scriptElement){console.error('No element found with ID:',elementId);return null;} 3try{return JSON.parse(scriptElement.textContent);}catch(e){console.error('Error parsing JSON from DOM:',e);return null;}};fdi.p.third_party_scripts=fdi.u.getJSONFromDOM('third-party-scripts-raw');const normalizeString=(value)=>(typeof value==='string'?value.trim():'');const toBoolean=(value)=>normalizeString(value).toLowerCase()==='true';const slugify=(value)=>normalizeString(value).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-+|-+$/g,'');const getCurrentPageType=()=>{return currentPageType;};const parseNumber=(value,fallback)=>{const parsed=Number.parseInt(normalizeString(value),10);return Number.isNaN(parsed)?fallback:parsed;};const hashString=(value)=>{let hash=2166136261;const input=normalizeString(value);for(let index=0;index<input.length;index+=1){hash^=input.charCodeAt(index);hash=Math.imul(hash,16777619);} 4return`auto-${(hash>>>0).toString(16).padStart(8,'0')}`;};const copyAttributes=(sourceNode,targetNode)=>{Array.from(sourceNode.attributes).forEach((attribute)=>{targetNode.setAttribute(attribute.name,attribute.value);});};const pageMatches=(script)=>{const pageScope=normalizeString(script.third_party_script__page).toLowerCase()||'all';return pageScope==='all'||pageScope===getCurrentPageType();};const deviceMatches=(script)=>{const scope=normalizeString(script.third_party_script__device_scope).toLowerCase()||'all';if(scope==='all'){return true;} 5if(scope==='mobile'){return isMobile;} 6if(scope==='desktop'){return!isMobile;} 7return true;};const scriptIsSafe=(script)=>{const code=normalizeString(script.third_party_script__code);if(code.includes('document.write')){console.error(`Script"${script.third_party_script__title}"is not safe.`);return false;} 8return true;};const scriptIsActive=(script)=>{const isActive=script.third_party_script__is_active==='active';const placement=normalizeString(script.third_party_script__placement).toLowerCase();if(!isActive){return false;} 9if(pauseScripts==='all'){return false;} 10if(pauseScripts==='all - head'&&placement==='head'){return false;} 11if(pauseScripts==='all - footer'&&placement==='footer'){return false;} 12return true;};const getResolvedStrategy=(script)=>{const strategy=normalizeString(script.third_party_script__load_strategy).toLowerCase();if(strategy&&strategy!=='legacy'){return strategy;} 13if(script.third_party_script__defer==='false'){return normalizeString(script.third_party_script__placement).toLowerCase()==='head'?'legacy_immediate_head':'legacy_immediate_footer';} 14return'legacy_deferred';};const getScriptPayloadFingerprint=(script)=>{const payload=JSON.stringify({code:normalizeString(script.third_party_script__code),noscript:normalizeString(script.third_party_noscript__code),meta:normalizeString(script.third_party_meta_tag__code)});if(!payload||payload==='{"code":"","noscript":"","meta":""}'){return'';} 15return hashString(payload);};const getScriptKey=(script,index)=>{const explicitKey=slugify(script.third_party_script__singleton_key);const computedKey=slugify(script.third_party_script__computed_singleton_key);const payloadKey=slugify(getScriptPayloadFingerprint(script));const titleKey=slugify(script.third_party_script__title);return explicitKey||computedKey||payloadKey||titleKey||`third-party-script-${index}`;};const getDependencyKeys=(script)=>{const dependencyList=normalizeString(script.third_party_script__depends_on);if(!dependencyList){return[];}
16return dependencyList.split(',').map((item)=>slugify(item)).filter(Boolean);};const getExecutionGroupWeight=(script)=>{const group=normalizeString(script.third_party_script__execution_group).toLowerCase()||'other';return Object.prototype.hasOwnProperty.call(executionGroupWeight,group)?executionGroupWeight[group]:executionGroupWeight.other;};const getPlacementTarget=(script)=>{const placement=normalizeString(script.third_party_script__placement).toLowerCase();return placement==='head'?(document.head||document.documentElement):(document.body||document.documentElement);};const shouldWaitForConsent=(script,strategy)=>strategy==='consent_then_load'||toBoolean(script.third_party_script__requires_consent);const waitForDomReady=()=>{if(document.readyState!=='loading'){return Promise.resolve();} 17return new Promise((resolve)=>{document.addEventListener('DOMContentLoaded',resolve,{once:true});});};const waitForWindowLoad=()=>{if(document.readyState==='complete'){return Promise.resolve();} 18return new Promise((resolve)=>{window.addEventListener('load',resolve,{once:true});});};const waitForIdle=(timeoutMs)=>new Promise((resolve)=>{const timeout=timeoutMs>0?timeoutMs:3000;if('requestIdleCallback'in window){window.requestIdleCallback(()=>resolve(),{timeout});return;} 19window.setTimeout(resolve,timeout);});const waitForEvent=(eventName,timeoutMs)=>{if(!eventName){return Promise.resolve();} 20if(window.fdiThirdPartyConsentReady&&eventName==='fde:consent-ready'){return Promise.resolve();} 21return new Promise((resolve)=>{let done=false;const finish=()=>{if(done){return;} 22done=true;document.removeEventListener(eventName,finish);window.removeEventListener(eventName,finish);resolve();};document.addEventListener(eventName,finish,{once:true});window.addEventListener(eventName,finish,{once:true});if(timeoutMs>0){window.setTimeout(finish,timeoutMs);}});};const waitForFirstInteraction=(selector,timeoutMs)=>new Promise((resolve)=>{const target=selector?document.querySelector(selector):document;if(!target){resolve();return;} 23let done=false;const events=['pointerdown','keydown','touchstart','mouseover','scroll'];const finish=()=>{if(done){return;} 24done=true;events.forEach((eventName)=>{target.removeEventListener(eventName,finish);});resolve();};events.forEach((eventName)=>{target.addEventListener(eventName,finish,{once:true,passive:true});});if(timeoutMs>0){window.setTimeout(finish,timeoutMs);}});const waitForVisibility=(selector,timeoutMs)=>new Promise((resolve)=>{const target=selector?document.querySelector(selector):null;if(!target){resolve();return;} 25let done=false;const finish=()=>{if(done){return;} 26done=true;resolve();};if('IntersectionObserver'in window){const observer=new IntersectionObserver((entries)=>{if(entries[0]&&entries[0].isIntersecting){observer.disconnect();finish();}},{rootMargin:'400px 0px'});observer.observe(target);if(timeoutMs>0){window.setTimeout(()=>{observer.disconnect();finish();},timeoutMs);} 27return;} 28finish();});const appendMarkupNode=(node,target)=>new Promise((resolve)=>{if(node.nodeType!==Node.ELEMENT_NODE){resolve();return;} 29const tagName=node.tagName.toLowerCase();if(tagName==='script'){const newScript=document.createElement('script');copyAttributes(node,newScript);if(newScript.src&&document.querySelector(`script[src="${newScript.src}"]`)){resolve();return;} 30if(node.src||node.getAttribute('src')){newScript.addEventListener('load',resolve,{once:true});newScript.addEventListener('error',resolve,{once:true});}else{newScript.textContent=node.textContent;} 31target.appendChild(newScript);if(!(node.src||node.getAttribute('src'))){resolve();} 32return;} 33if(tagName==='link'){const href=node.getAttribute('href');if(href&&document.querySelector(`link[href="${href}"]`)){resolve();return;}} 34const newNode=document.createElement(node.tagName);copyAttributes(node,newNode);if(node.innerHTML){newNode.innerHTML=node.innerHTML;} 35target.appendChild(newNode);resolve();});const appendThirdPartyScripts=(script)=>{const markup=normalizeString(script.third_party_script__code);if(!markup){return Promise.resolve();} 36const parsed=new DOMParser().parseFromString(markup,'text/html');const nodes=Array.from(parsed.head.children.length?parsed.head.children:parsed.body.children);const target=getPlacementTarget(script);return nodes.reduce((promise,node)=>{return promise.then(()=>appendMarkupNode(node,target));},Promise.resolve());};const waitForStrategy=(script,strategy)=>{const timeoutMs=parseNumber(script.third_party_script__timeout_ms,0);const selector=normalizeString(script.third_party_script__trigger_selector);switch(strategy){case'dom_ready':return waitForDomReady();case'window_load':return waitForWindowLoad();case'idle':return waitForIdle(timeoutMs);case'first_interaction':return waitForFirstInteraction(selector,timeoutMs);case'element_visible':return waitForVisibility(selector,timeoutMs);case'custom_event':return waitForEvent(normalizeString(script.third_party_script__custom_event),timeoutMs);case'consent_then_load':return waitForEvent(normalizeString(script.third_party_script__consent_event)||'fde:consent-ready',timeoutMs);case'legacy_deferred':default:return waitForWindowLoad().then(()=>new Promise((resolve)=>{window.setTimeout(resolve,isMobile?10000:5000);}));}};const waitForDependencies=(script)=>{const dependencyKeys=getDependencyKeys(script);if(!dependencyKeys.length){return Promise.resolve();} 37return Promise.all(dependencyKeys.map((dependencyKey)=>{if(!registry[dependencyKey]){return Promise.resolve();} 38if(directStrategies[getResolvedStrategy(registry[dependencyKey])]){return Promise.resolve();} 39return loadScriptRecord(registry[dependencyKey]);}));};function loadScriptRecord(script){const key=script.__runtime_key;if(state[key]){return state[key];} 40const strategy=getResolvedStrategy(script);const recordPromise=waitForDependencies(script).then(()=>waitForStrategy(script,strategy)).then(()=>
40{if(shouldWaitForConsent(script,strategy)&&strategy!=='consent_then_load'){return waitForEvent(normalizeString(script.third_party_script__consent_event)||'fde:consent-ready',parseNumber(script.third_party_script__timeout_ms,0));} 41return Promise.resolve();}).then(()=>appendThirdPartyScripts(script)).then(()=>{document.dispatchEvent(new CustomEvent('fde__third_party_script_loaded',{detail:{key,title:script.third_party_script__title,strategy}}));}).catch((error)=>{console.error(`Unable to load third-party script"${script.third_party_script__title}".`,error);});state[key]=recordPromise;return recordPromise;} 42const data=Array.isArray(fdi.p.third_party_scripts)?fdi.p.third_party_scripts:[];const eligibleScripts=data.map((script,index)=>{const runtimeKey=getScriptKey(script,index);const runtimeScript={...script,__runtime_index:index,__runtime_key:runtimeKey};registry[runtimeKey]=runtimeScript;const titleKey=slugify(script.third_party_script__title);if(titleKey&&!registry[titleKey]){registry[titleKey]=runtimeScript;} 43return runtimeScript;}).filter((script)=>scriptIsActive(script)&&pageMatches(script)&&deviceMatches(script)&&scriptIsSafe(script)).filter((script)=>!directStrategies[getResolvedStrategy(script)]).sort((scriptA,scriptB)=>{const groupDiff=getExecutionGroupWeight(scriptA)-getExecutionGroupWeight(scriptB);if(groupDiff!==0){return groupDiff;} 44const priorityDiff=parseNumber(scriptA.third_party_script__priority,50)-parseNumber(scriptB.third_party_script__priority,50);if(priorityDiff!==0){return priorityDiff;} 45return scriptA.__runtime_index-scriptB.__runtime_index;});window.fdiThirdPartyScripts={data,eligibleScripts};eligibleScripts.forEach((script)=>{loadScriptRecord(script);});document.dispatchEvent(new CustomEvent('fde__third_party_scripts_loaded',{detail:{data:eligibleScripts}}));})(); 46/*! End of public/scripts/third-party-scripts.js. */
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.