var lazyLoader = function(){"use strict"; function _extends(){return(_extends = Object.assign || function(e){for (var t = 1; t < arguments.length; t++){var r = arguments[t]; for (var n in r)Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n])}return e}).apply(this, arguments)}return function(e){var t = {intersectionObserverSupport:"IntersectionObserver"in window && "IntersectionObserverEntry"in window && "intersectionRatio"in window.IntersectionObserverEntry.prototype, mutationObserverSupport:"MutationObserver"in window, idleCallbackSupport:"requestIdleCallback"in window, eventsToBind:[[document, "scroll"], [document, "touchmove"], [window, "resize"], [window, "orientationchange"]]}, r = _extends({lazyClass:"lazy", lazyBackgroundClass:"lazy-bg", lazyBackgroundLoaded:"lazy-bg-loaded", throttleTime:200, idlyLoad:!1, idleLoadTimeout:100, threshold:200, observeChanges:!1, observeRootSelector:"body", mutationObserverOptions:{childList:!0, subtree:!0}}, e), n = "img." + r.lazyClass + ",video." + r.lazyClass + ",iframe." + r.lazyClass + ",." + r.lazyBackgroundClass, o = {timeout:r.idleLoadTimeout}, a = function(e){return[].slice.call(e)}, i = function(e){if ("IMG" === e.tagName){var t = e.parentNode; "PICTURE" === t.tagName && a(t.querySelectorAll("source")).forEach(function(e){return s(e)}), s(e)}"VIDEO" === e.tagName && (a(e.querySelectorAll("source")).forEach(function(e){return s(e)}), s(e), !0 === e.autoplay && e.load()), "IFRAME" === e.tagName && s(e), e.classList.contains(r.lazyBackgroundClass) && (e.classList.remove(r.lazyBackgroundClass), e.classList.add(r.lazyBackgroundLoaded))}, s = function(e){null !== e.getAttribute("data-srcset") && e.setAttribute("srcset", e.getAttribute("data-srcset")), null !== e.getAttribute("data-src") && e.setAttribute("src", e.getAttribute("data-src")), null !== e.getAttribute("data-poster") && e.setAttribute("poster", e.getAttribute("data-poster"))}, l = function lazyLoaderBack(){var e = !1; !1 === e && u.length > 0 && (e = !0, setTimeout(function(){u.forEach(function(e){e.getBoundingClientRect().top <= window.innerHeight + r.threshold && e.getBoundingClientRect().bottom >= - r.threshold && "none" !== getComputedStyle(e).display && (!0 === r.idlyLoad && !0 === t.idleCallbackSupport?requestIdleCallback(function(){i(e)}, o):i(e), e.classList.remove(r.lazyClass), u = u.filter(function(t){return t !== e}))}), e = !1, 0 === u.length && !1 === r.observeChanges && t.eventsToBind.forEach(function(e){return e[0].removeEventListener(e[1], lazyLoaderBack)})}, r.throttleTime))}, u = a(document.querySelectorAll(n)); if (!0 === t.intersectionObserverSupport){var c = new IntersectionObserver(function(e, n){e.forEach(function(e){if (!0 === e.isIntersecting || e.intersectionRatio > 0){var a = e.target; !0 === r.idlyLoad && !0 === t.idleCallbackSupport?requestIdleCallback(function(){return i(a)}, o):i(a), a.classList.remove(r.lazyClass), n.unobserve(a), u = u.filter(function(e){return e !== a})}})}, {rootMargin:r.threshold + "px 0%"}); u.forEach(function(e){return c.observe(e)})} else t.eventsToBind.forEach(function(e){return e[0].addEventListener(e[1], l)}), l(); !0 === t.mutationObserverSupport && !0 === r.observeChanges && new MutationObserver(function(e){return e.forEach(function(){a(document.querySelectorAll(n)).forEach(function(e){ - 1 === u.indexOf(e) && (u.push(e), !0 === t.intersectionObserverSupport?c.observe(e):l())})})}).observe(document.querySelector(r.observeRootSelector), r.mutationObserverOptions)}}();