<?php $scriptString = <<<script
!function(){function t(){this.settings={src:"data-original",srcset:"data-originalset",selector:".lazy",selectorClass:"lazy",loadClass:"lazy-loader",loadEvent:"lazyLoaded.oxlazy",root:null,rootMargin:"0px",threshold:0,debouncer:500},this.images=document.querySelectorAll(this.settings.selector),this.observer=null;let t=this;this.load=function(e){let o=e.target;o.src===o.getAttribute(t.settings.src)&&(t.afterImageLoaded(o),t.observer&&t.observer.unobserve(o))},this.afterImageLoaded=function(e){let o=e.parentElement;e.classList.remove(t.settings.selectorClass),o.classList.remove(t.settings.loadClass);let n=o.closest(".product-item-photo");n&&n.classList.remove(t.settings.loadClass),e.dispatchEvent(new Event(t.settings.loadEvent))},this.destroy=function(){t.observer&&t.observer.disconnect()},this.applyImage=function(e){let o=e.getAttribute(t.settings.src),n=e.getAttribute(t.settings.srcset);"img"===e.tagName.toLowerCase()?(e.onload=t.load,o&&(e.src=o),n&&(e.srcset=n)):e.style.backgroundImage="url('"+o+"')"},this.init=function(){if("loading"in HTMLImageElement.prototype){let e=document.querySelectorAll('img[loading="lazy"], img[data-ox-image]');e.forEach(function(e){e.complete?t.afterImageLoaded(e):e.onload=function(){t.afterImageLoaded(e)}})}if("IntersectionObserver"in window)try{t.observer=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&t.applyImage(e.target)})},{rootMargin:t.settings.rootMargin,threshold:[t.settings.threshold]}),t.images.forEach(function(e){t.observer.observe(e)})}catch(o){console.info(o)}},this.init()}window.lazyLoad=function(){return new t}}(),document.addEventListener("DOMContentLoaded",function(){lazyLoad()}),document.body.addEventListener("contentUpdated",function(){lazyLoad()}),document.body.addEventListener("contentUpdated.oxlazy",function(){lazyLoad()}),"undefined"!=typeof require&&require(["jquery"],function(t){t(document.body).on("contentUpdated contentUpdated.oxlazy",lazyLoad)});
script;
?>
<?php
if (isset($secureRenderer)) {
    echo /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false);
} else {
    echo /* @noEscape */ '<script>' .  $scriptString . '</script>';
}
