!function(t,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.dBlazy=e()}(this,function(){"use strict";var t={};return t.matches=function(t,e){var n=Element.prototype;return n.matches||(n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector||function(t){for(var e=(window.document||window.ownerDocument).querySelectorAll(t),n=e.length;--n>=0&&e.item(n)!==this;);return n>-1}),!!t.matches(e)},t.pixelRatio=function(){return window.devicePixelRatio||1},t.windowWidth=function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||window.screen.width},t.activeWidth=function(t,e){var n=this,i=Object.keys(t),a=i[0],r=i[i.length-1],o=function(t){var i=n.windowWidth()*n.pixelRatio();return e?t<=n.windowWidth():t>=i},c=i.filter(o).map(function(e){return t[e]})[e?"pop":"shift"]();return"undefined"===c?t[n.windowWidth()>=r?r:a]:c},t.equal=function(t,e){return null!==t&&t.nodeName.toLowerCase()===e},t.closest=function(e,n){for(;e&&!(e instanceof HTMLDocument);e=e.parentNode)if(t.matches(e,n))return e;return null},t.extend=Object.assign||function(t){t=t||{};for(var e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var i in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],i)&&(t[i]=arguments[e][i]);return t},t.forEach=function(t,e,n){var i=Object.prototype;if("[object Object]"===i.toString.call(t))for(var a in t)i.hasOwnProperty.call(t,a)&&e.call(n,t[a],a,t);else if(t)for(var r=0,o=t.length;r<o;r++)e.call(n,t[r],r,t)},t.hasClass=function(t,e){return t.classList?t.classList.contains(e):-1!==t.className.indexOf(e)},t.addClass=function(e,n){e.classList?e.classList.add(n):t.hasClass(e,n)||(e.className+=" "+n)},t.setAttr=function(t,e,n){if(t.hasAttribute("data-"+e)){var i=t.getAttribute("data-"+e);"src"===e?t.src=i:t.setAttribute(e,i),n&&t.removeAttribute("data-"+e)}},t.setAttrs=function(t,e,n){var i=this;i.forEach(e,function(e){i.setAttr(t,e,n)})},t.setAttrsWithSources=function(t,e,n){var i=this,a=t.parentNode||null,r=a&&i.equal(a,"picture"),o=r?a.getElementsByTagName("source"):t.getElementsByTagName("source");e=e||(r?"srcset":"src"),o.length&&i.forEach(o,function(t){i.setAttr(t,e,n)})},t.updateBg=function(t,e){var n=this,i=n.parse(t.getAttribute("data-backgrounds"));if(i){var a=n.activeWidth(i,e);a&&"undefined"!==a&&(t.style.backgroundImage='url("'+a.src+'")',t.style.paddingBottom=a.ratio+"%")}},t.removeAttrs=function(t,e){this.forEach(e,function(e){t.removeAttribute("data-"+e)})},t.on=function(e,n,i,a){e&&e.addEventListener(n,function(e){for(var n=e.target;n&&n!==this;)t.matches(n,i)&&a.call(n,e),n=n.parentNode})},t.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},t.parse=function(t){try{return JSON.parse(t)}catch(t){return!1}},t.animate=function(t){function e(){t.classList.remove("animated",i),t.removeEventListener("animationend",e),n.forEach(a,function(e){t.style.removeProperty(e)})}var n=this,i=t.dataset.animation,a=["animation","animation-duration","animation-delay","animation-iteration-count"];t.classList.add("animated",i),n.forEach(["Duration","Delay","IterationCount"],function(e){"animation"+e in t.dataset&&(t.style["animation"+e]=t.dataset["animation"+e])}),n.removeAttrs(t,a),t.addEventListener("animationend",e)},t.throttle=function(t,e,n){var i=0;return function(){var a=+new Date;a-i<e||(i=a,t.apply(n,arguments))}},t.resize=function(t,e){return window.onresize=function(){window.clearTimeout(e),e=window.setTimeout(t,200)},t},t.trigger=function(t,e,n){var i,a={detail:n||{},bubbles:!0,cancelable:!0};window.CustomEvent?i=new CustomEvent(e,a):(i=document.createEvent("CustomEvent"),i.initCustomEvent(e,!0,!0,a)),t.dispatchEvent(i)},t});