var LaStudioPageSpeedConfigs={"delay":10000,"version":"1.0.6","nativelazyoad":true,"e_animation":true,"detected":true};class LaStudioPageSpeedClass{constructor(e){this.triggerEvents=e,this.eventOptions={passive:!0},this.userEventListener=this.triggerListener.bind(this),this.scripts_load_fire=!1,this.enqueued_fonts=[],this.enqueued_styles=[],this.enqueued_scripts={normal:[],async:[],defer:[],lazy:[]},this.allJQueries=[]}is_pagespeed(){return"undefined"!=typeof navigator&&(/(lighthouse|gtmetrix)/i.test(navigator.userAgent.toLocaleLowerCase())||/mozilla\/5\.0 \(x11; linux x86_64\)/i.test(navigator.userAgent.toLocaleLowerCase()))}user_events_add(e){this.triggerEvents.forEach(t=>window.addEventListener(t,e.userEventListener,e.eventOptions))}user_events_remove(e){this.triggerEvents.forEach(t=>window.removeEventListener(t,e.userEventListener,e.eventOptions))}triggerListener(){this.user_events_remove(this),"loading"===document.readyState?(document.addEventListener("DOMContentLoaded",this.load_style_resources.bind(this)),this.scripts_load_fire||document.addEventListener("DOMContentLoaded",this.load_resources.bind(this))):(this.load_style_resources(),this.scripts_load_fire||this.load_resources())}async load_style_resources(){this.register_styles(),this.load_styles(this.enqueued_styles)}async load_resources(){this.hold_event_listeners(),this.hold_jquery(this),this.exe_document_write(),this.register_scripts(),this.add_html_class("lasf_ps-start"),this.preload_scripts(),await this.load_scripts(this.enqueued_scripts.normal),await this.load_scripts(this.enqueued_scripts.defer),await this.load_scripts(this.enqueued_scripts.async),await this.execute_domcontentloaded(),await this.execute_window_load(),window.dispatchEvent(new Event("LaStudioPageSpeed:Loaded")),this.add_html_class("lasf_ps-start_js"),await this.load_scripts(this.enqueued_scripts.lazy),this.add_html_class("lasf_ps-js_loaded")}add_html_class(e){document.documentElement.classList.add(e)}register_scripts(){document.querySelectorAll("script[data-lastudiopagespeed-action=reorder]").forEach(e=>{e.hasAttribute("src")||e.hasAttribute("data-src")?e.hasAttribute("async")&&!1!==e.async?this.enqueued_scripts.async.push(e):e.hasAttribute("defer")&&!1!==e.defer||"module"===e.getAttribute("data-lastudiopagespeed-module")?this.enqueued_scripts.defer.push(e):this.enqueued_scripts.normal.push(e):this.enqueued_scripts.normal.push(e)}),document.querySelectorAll("script[data-lastudiopagespeed-action=lazyload_ext]").forEach(e=>{this.enqueued_scripts.lazy.push(e)})}register_styles(){document.querySelectorAll("link[data-href]").forEach(e=>{this.enqueued_styles.push(e)})}async execute_script(e){return await this.repaint_frame(),new Promise(t=>{const s=document.createElement("script");let n;[...e.attributes].forEach(e=>{let t=e.nodeName;"type"!==t&&"data-lastudiopagespeed-action"!==t&&(n=e.nodeValue,"data-lastudiopagespeed-module"===t&&(t="type",n="module"),"data-src"===t&&(t="src"),s.setAttribute(t,n))}),e.hasAttribute("src")||e.hasAttribute("data-src")?(s.addEventListener("load",t),s.addEventListener("error",t)):(s.text=e.text,t()),e.parentNode.replaceChild(s,e)})}async execute_styles(e){return function(e){const t=document.createElement("link");t.href=e.getAttribute("data-href"),t.rel="stylesheet",e.parentNode.replaceChild(t,e)}(e)}async load_scripts(e){const t=e.shift();return t?(await this.execute_script(t),this.load_scripts(e)):Promise.resolve()}async load_styles(e){const t=e.shift();return t?(await this.execute_styles(t),this.load_styles(e)):"loaded"}async load_fonts(e){var t=document.createDocumentFragment();e.forEach(e=>{const s=document.createElement("link");s.href=e,s.rel="stylesheet",t.appendChild(s)}),setTimeout(function(){document.head.appendChild(t)},LaStudioPageSpeedConfigs.delay)}preload_scripts(){var e=document.createDocumentFragment();[...this.enqueued_styles,...this.enqueued_scripts.normal,...this.enqueued_scripts.defer,...this.enqueued_scripts.async].forEach(t=>{const s=t.getAttribute("src")||t.getAttribute("data-src"),n=t.getAttribute("rel");if(s){const t=document.createElement("link");t.href=s,t.rel="preload",t.as="stylesheet"==n?"style":"script",e.appendChild(t)}}),document.head.appendChild(e)}hold_event_listeners(){let e={};function t(t,s){!function(t){function s(s){return e[t].eventsToRewrite.indexOf(s)>=0?"lasfps-"+s:s}e[t]||(e[t]={originalFunctions:{add:t.addEventListener,remove:t.removeEventListener},eventsToRewrite:[]},t.addEventListener=function(){arguments[0]=s(arguments[0]),e[t].originalFunctions.add.apply(t,arguments)},t.removeEventListener=function(){arguments[0]=s(arguments[0]),e[t].originalFunctions.remove.apply(t,arguments)})}(t),e[t].eventsToRewrite.push(s)}function s(e,t){let s=e[t];Object.defineProperty(e,t,{get:()=>s||function(){},set(n){e["lasfps"+t]=s=n}})}t(document,"DOMContentLoaded"),t(window,"DOMContentLoaded"),t(window,"load"),t(window,"pageshow"),t(document,"readystatechange"),s(document,"onreadystatechange"),s(window,"onload"),s(window,"onpageshow")}hold_jquery(e){let t=window.jQuery;Object.defineProperty(window,"jQuery",{get:()=>t,set(s){if(s&&s.fn&&!e.allJQueries.includes(s)){s.fn.ready=s.fn.init.prototype.ready=function(t){e.domReadyFired?t.bind(document)(s):document.addEventListener("lasfps-DOMContentLoaded",()=>t.bind(document)(s))};const t=s.fn.on;s.fn.on=s.fn.init.prototype.on=function(){if(this[0]===window){function e(e){return e.split(" ").map(e=>"load"===e||0===e.indexOf("load.")?"lasf_ps-jquery_loaded":e).join(" ")}"string"==typeof arguments[0]||arguments[0]instanceof String?arguments[0]=e(arguments[0]):"object"==typeof arguments[0]&&Object.keys(arguments[0]).forEach(t=>{Object.assign(arguments[0],{[e(t)]:arguments[0][t]})[t]})}return t.apply(this,arguments),this},e.allJQueries.push(s)}t=s}})}async execute_domcontentloaded(){this.domReadyFired=!0,await this.repaint_frame(),document.dispatchEvent(new Event("lasfps-DOMContentLoaded")),await this.repaint_frame(),window.dispatchEvent(new Event("lasfps-DOMContentLoaded")),await this.repaint_frame(),document.dispatchEvent(new Event("lasfps-readystatechange")),await this.repaint_frame(),document.lasfpsonreadystatechange&&document.lasfpsonreadystatechange()}async execute_window_load(){await this.repaint_frame(),window.dispatchEvent(new Event("lasfps-load")),await this.repaint_frame(),window.lasfpsonload&&window.lasfpsonload(),await this.repaint_frame(),this.allJQueries.forEach(e=>e(window).trigger("lasf_ps-jquery_loaded")),window.dispatchEvent(new Event("lasfps-pageshow")),await this.repaint_frame(),window.lasfpsonpageshow&&window.lasfpsonpageshow()}exe_document_write(){const e=new Map;document.write=document.writeln=function(t){const s=document.currentScript,n=document.createRange(),a=s.parentElement;let i=e.get(s);void 0===i&&(i=s.nextSibling,e.set(s,i));const r=document.createDocumentFragment();n.setStart(r,0),r.appendChild(n.createContextualFragment(t)),a.insertBefore(r,i)}}async repaint_frame(){return new Promise(e=>requestAnimationFrame(e))}static runoptimize(){const e=new LaStudioPageSpeedClass(["keydown","mousemove","touchmove","touchstart","touchend","wheel"]);e.load_fonts(e.enqueued_fonts),e.user_events_add(e),LaStudioPageSpeedConfigs.detected?e.is_pagespeed()?(e.add_html_class("isPageSpeed"),setTimeout(function(e){document.documentElement.classList.contains("lasf_ps-start")||e.triggerListener()},LaStudioPageSpeedConfigs.delay,e)):(e.scripts_load_fire,e.triggerListener()):setTimeout(function(e){document.documentElement.classList.contains("lasf_ps-start")||e.triggerListener()},LaStudioPageSpeedConfigs.delay,e)}}LaStudioPageSpeedClass.runoptimize();