/*! (c) Andrea Giammarchi @webreflection ISC */ !function(){"use strict";var e=function(e,t){var n=function(e){for(var t=0,n=e.length;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,l=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw l}}}} /*! (c) Andrea Giammarchi - ISC */var r=!0,o=!1,a="querySelectorAll",l="querySelectorAll",i=self,u=i.document,c=i.Element,s=i.MutationObserver,f=i.Set,d=i.WeakMap,h=function(e){return l in e},v=[].filter,g=function(e){var t=new d,i=function(n,r){var o;if(r)for(var a,l=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector}(n),i=0,u=p.length;i1&&void 0!==arguments[1])||arguments[1],n=0,r=e.length;n1&&void 0!==arguments[1]?arguments[1]:document,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:MutationObserver,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:["*"],u=function t(o,l,i,u,c,s){var f,d=n(o);try{for(d.s();!(f=d.n()).done;){var h=f.value;(s||a in h)&&(c?i.has(h)||(i.add(h),u.delete(h),e(h,c)):u.has(h)||(u.add(h),i.delete(h),e(h,c)),s||t(h[a](l),l,i,u,c,r))}}catch(e){d.e(e)}finally{d.f()}},c=new l((function(e){if(i.length){var t,a=i.join(","),l=new Set,c=new Set,s=n(e);try{for(s.s();!(t=s.n()).done;){var f=t.value,d=f.addedNodes,h=f.removedNodes;u(h,a,l,c,o,o),u(d,a,l,c,r,o)}}catch(e){s.e(e)}finally{s.f()}}})),s=c.observe;return(c.observe=function(e){return s.call(c,e,{subtree:r,childList:r})})(t),c}(i,y,s,p),b=c.prototype.attachShadow;return b&&(c.prototype.attachShadow=function(e){var t=b.call(this,e);return m.observe(t),t}),p.length&&g(y[l](p)),{drop:function(e){for(var n=0,r=e.length;n { changes.forEach((change) => { if (change.attributeName.includes('src') || change.attributeName.includes('srcset')) { this.handleLazy(); } }); }); observer.observe(this, {attributes : true}); } handleLazy () { const mql = window.matchMedia('(min-width: 750px)'); if (mql.matches && this.classList.contains('medium-hide')) return; if (!mql.matches && this.classList.contains('small-hide')) return; if (this.complete || this.classList.contains('loaded')) return; this.wrapper.classList.add('loading'); this.addEventListener('load', () => { const loaded = () => { this.classList.add('loaded'); this.wrapper.classList.remove('loading'); }; window.requestIdleCallback ? window.requestIdleCallback(loaded, {timeout: 150}) : setTimeout(loaded); }, false); } } window.customElements.define('lazy-image', LazyImage, { extends: 'img' });