1/*! 2 * Easy Optimizer â unified beacon (2.4.3). 3 * 4 * One lightweight script that reports up to three things in a single request: 5 * ⢠LCP element (PerformanceObserver) â for per-URL image preloading 6 * ⢠JS-generated class set â for Used CSS tree-shake safety 7 * ⢠Above-the-fold font URLs â for font preloading 8 * 9 * The server tells us which parts are still cold via easyoptBeacon.need, so a 10 * warm page collects nothing. Everything is sent ONCE, at end-of-life 11 * (visibilitychangeâhidden / pagehide) or after a short settle timer, 12 * whichever comes first, via navigator.sendBeacon (fetch keepalive fallback). 13 * 14 * Build: this is the readable source; assets/easyopt-beacon.min.js is the 15 * shipped, minified copy. 16 */ !function(){if("undefined"!=typeof easyoptBeacon){var e=easyoptBeacon,t=e.need||{},n={lcp:+t.lcp||0,classes:+t.classes||0,fonts:+t.fonts||0},r=window.innerWidth<(e.mobileBreak||768)?"mobile":"desktop",i=!1,a=null,o=null,l=Object.create(null),s=!1,c="PerformanceObserver"in window&&!!PerformanceObserver.supportedEntryTypes&&-1!==PerformanceObserver.supportedEntryTypes.indexOf("largest-contentful-paint");if(n.lcp&&c)try{(o=new PerformanceObserver(function(e){for(var t=e.getEntries(),n=0;n<t.length;n++)a=t[n]})).observe({type:"largest-contentful-paint",buffered:!0})}catch(u){c=!1}var f={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1,"ui-sans-serif":1,"ui-serif":1,"ui-monospace":1,"ui-rounded":1,math:1,emoji:1,fangsong:1,"-apple-system":1,blinkmacsystemfont:1,inherit:1,initial:1,unset:1,revert:1},d=null,p=!1;"complete"===document.readyState?E(m):window.addEventListener("load",function(){E(m)},{once:!0}),["pointerdown","keydown","touchstart","scroll"].forEach(function(e){window.addEventListener(e,function(){E(S)},{once:!0,passive:!0})}),setTimeout(function(){E(m)},3500),E(function(){try{y()}catch(e){}},4e3),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&k()},{once:!0}),window.addEventListener("pagehide",k,{once:!0}),setTimeout(k,8e3)}function $(e){if(!e||1!==e.nodeType||0===e.offsetWidth||0===e.offsetHeight)return!1;var t=window.getComputedStyle?window.getComputedStyle(e):null;if(!t)return!0;if("none"===t.display||"hidden"===t.visibility||"collapse"===t.visibility)return!1;var n=parseFloat(t.opacity||"1");return!(!isNaN(n)&&n<.1)}function m(){if(n.classes)try{for(var e=document.querySelectorAll("[class]"),t=0;t<e.length;t++){var r=e[t].classList;if(r)for(var i=0;i<r.length;i++)l[r[i]]=1}s=!0}catch(a){}}function g(e){var t=(String(e).split(",")[0]||"").trim().replace(/^['"]+|['"]+$/g,"");return!t||f[t.toLowerCase()]?"":t}function v(e){if("normal"===(e=String(e).toLowerCase()))return"400";if("bold"===e)return"700";var t=parseInt(e,10);return isNaN(t)?"400":String(t)}function h(e){for(var t="",n=e.firstChild;n;n=n.nextSibling)3===n.nodeType&&n.nodeValue&&(t+=n.nodeValue);return t}function y(){if(!n.fonts)return null;if(p)return d;p=!0;try{var e=window.innerHeight||document.documentElement&&document.documentElement.clientHeight||0,t=window.innerWidth||document.documentElement&&document.documentElement.clientWidth||0;if(!e||!document.body)return null;for(var r=Object.create(null),i=document.body.getElementsByTagName("*"),a=0;a<i.length&&a<5e3;a++){var o,l=i[a],s=h(l);if(s&&/\S/.test(s)){try{o=l.getBoundingClientRect()}catch(c){continue}if(o&&0!==o.width&&0!==o.height&&!(o.top>=e)&&!(o.bottom<=0)&&!(o.left>=t)&&!(o.right<=0)){var u=window.getComputedStyle?window.getComputedStyle(l):null;if(u&&"none"!==u.display&&"hidden"!==u.visibility&&"collapse"!==u.visibility){var f=g(u.fontFamily||"");if(f){var $=f+"|"+v(u.fontWeight||"400")+"|"+(0===String(u.fontStyle||"").indexOf("italic")?"italic":"normal"),m=r[$];if(!m){if(Object.keys(r).length>=12)continue;m=r[$]={cp:Object.create(null),n:0}}for(var y=0;y<s.length&&m.n<300;y++){var _=s.charCodeAt(y);_>32&&!m.cp[_]&&(m.cp[_]=1,m.n++)}}}}}}var b=[];for(var k in r){var S=k.split("|"),E=Object.keys(r[k].cp).map(Number);E.sort(function(e,t){return e-t}),b.push({f:S[0],w:S[1],s:S[2],u:E})}return d=b.length?b:null}catch(C){return d=null,null}}function _(){return"eo_beacon:"+(e.urlType||"")+":"+r}function b(){try{window.sessionStorage&&sessionStorage.setItem(_(),"1")}catch(e){}}function k(){if(!(i||(i=!0,function e(){try{return!!window.sessionStorage&&!!sessionStorage.getItem(_())}catch(t){return!1}}()))){if(o)try{o.disconnect()}catch(t){}m();var u=new FormData;u.append("action","easyopt_beacon"),u.append("nonce",e.nonce),e.token&&u.append("token",e.token),u.append("url_type",e.urlType||""),u.append("page_url",e.pageUrl||location.href),u.append("viewport",r);var f=!1;if(!n.lcp||a||c||(a=function t(){var n=window.innerHeight||document.documentElement&&document.documentElement.clientHeight||0,r=window.innerWidth||document.documentElement&&document.documentElement.clientWidth||0;if(!n||!r)return null;var i,a=null,o=0;function l(e){if($(e)){try{i=e.getBoundingClientRect()}catch(t){return}if(!(i.top>=n)&&!(i.left>=r)&&!(i.bottom<=0)&&!(i.right<=0)){var i,l=Math.min(i.bottom,n)-Math.max(i.top,0),s=Math.min(i.right,r)-Math.max(i.left,0),c=l>0&&s>0?l*s:0;c>o&&(o=c,a=e)}}}var s=document.getElementsByTagName("img");for(i=0;i<s.length&&i<600;i++)l(s[i]);var c=document.querySelectorAll("video[poster]");for(i=0;i<c.length&&i<50;i++)l(c[i]);var u=document.querySelectorAll('[style*="background-image"]');for(i=0;i<u.length&&i<200;i++)l(u[i]);return!a||o<(e.minLcpSize||1e4)?null:{element:a,size:o,url:""}}()),n.lcp&&a){var d=a.element,p=a.size||0;if(d&&$(d)&&p>=(e.minLcpSize||1e4)){var g=function e(t){if(!t)return null;var n=(t.tagName||"").toLowerCase();if("img"===n){var r=t.currentSrc||t.src||"";return r?{tag:"img",kind:t.parentNode&&"picture"===(t.parentNode.tagName||"").toLowerCase()?"picture":t.srcset?"img-srcset":"img",url:r,srcset:t.srcset||"",sizes:t.sizes||""}:null}if("video"===n&&t.poster)return{tag:"video",kind:"video-poster",url:t.poster,srcset:"",sizes:""};if(window.getComputedStyle){var i=window.getComputedStyle(t).backgroundImage||"",a=function e(t){if(!t||"none"===t)return[];for(var n,r=[],i={},a=/url\((?:"([^"]+)"|'([^']+)'|([^)]+))\)/g;null!==(n=a.exec(t));){var o=(n[1]||n[2]||n[3]||"").trim();o&&!i[o]&&0!==o.indexOf("data:")&&(i[o]=1,r.push(o))}return r}(i);
16if(a.length){if(/image-set\(/i.test(i)){var o=function e(t){var n=String(t).match(/image-set\(([\s\S]*)\)/i);if(!n)return"";for(var r,i=[],a={},o=/url\((?:"([^"]+)"|'([^']+)'|([^)]+))\)\s*([0-9.]+(?:x|w|dppx)?)?/g;null!==(r=o.exec(n[1]));){var l=(r[1]||r[2]||r[3]||"").trim();if(l&&0!==l.indexOf("data:")&&!a[l]){a[l]=1;var s=(r[4]||"").trim();s&&/^[0-9.]+$/.test(s)&&(s+="x"),i.push(s?l+" "+s:l)}}return i.length?i.join(", "):""}(i);if(o)return{tag:n,kind:"background-set",url:a[0],srcset:o,sizes:""}}return{tag:n,kind:"background",url:a[0],srcset:"",sizes:""}}}return{tag:n,kind:n,url:"",srcset:"",sizes:""}}(d),v=g&&g.url?g.url:a.url||"";g&&v&&(u.append("element_tag",g.tag),u.append("element_kind",g.kind),u.append("image_url",v),u.append("srcset",g.srcset||""),u.append("sizes",g.sizes||""),u.append("selector",function e(t){if(!t||!t.nodeType)return"";for(var n=[],r=t,i=0;r&&1===r.nodeType&&i<6;){var a=r.nodeName.toLowerCase();if(r.id){n.unshift(a+"#"+r.id);break}var o="string"==typeof r.className?r.className.trim():"";o&&(a+="."+o.split(/\s+/).slice(0,2).join(".")),n.unshift(a),r=r.parentElement,i++}return n.join(" > ")}(d)),u.append("lcp_size",String(Math.round(p))),f=!0)}}if(n.classes&&s){var h=Object.keys(l);h.length&&(h.length>5e3&&(h=h.slice(0,5e3)),u.append("classes",h.join(",")),f=!0)}if(n.fonts){var k=y();k&&(u.append("fonts",JSON.stringify(k)),f=!0)}if(f){if(navigator.sendBeacon)try{navigator.sendBeacon(e.ajaxUrl,u)&&b();return}catch(S){}try{fetch(e.ajaxUrl,{method:"POST",body:u,keepalive:!0,credentials:"same-origin"}),b()}catch(E){}}}}function S(){m()}function E(e,t){window.requestIdleCallback?window.requestIdleCallback(e,{timeout:t||2e3}):setTimeout(e,200)}}();
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.