!function(window,factory){"function"==typeof define&&define.amd?define(["flickity/js/index","fizzy-ui-utils/utils"],factory):"object"==typeof module&&module.exports?module.exports=factory(require("flickity"),require("fizzy-ui-utils")):factory(window.Flickity,window.fizzyUIUtils)}(window,(function(Flickity,utils){"use strict";Flickity.createMethods.push("_createBgLazyLoad");var proto=Flickity.prototype;function BgLazyLoader(elem,url,flickity){this.element=elem,this.url=url,this.img=new Image,this.flickity=flickity,this.load()}return proto._createBgLazyLoad=function(){this.on("select",this.bgLazyLoad)},proto.bgLazyLoad=function(){var lazyLoad=this.options.bgLazyLoad;if(lazyLoad)for(var adjCount="number"==typeof lazyLoad?lazyLoad:0,cellElems=this.getAdjacentCellElements(adjCount),i=0;i<cellElems.length;i++){var cellElem=cellElems[i];this.bgLazyLoadElem(cellElem);for(var children=cellElem.querySelectorAll("[data-flickity-bg-lazyload]"),j=0;j<children.length;j++)this.bgLazyLoadElem(children[j])}},proto.bgLazyLoadElem=function(elem){var attr=elem.getAttribute("data-flickity-bg-lazyload");attr&&new BgLazyLoader(elem,attr,this)},BgLazyLoader.prototype.handleEvent=utils.handleEvent,BgLazyLoader.prototype.load=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.element.removeAttribute("data-flickity-bg-lazyload")},BgLazyLoader.prototype.onload=function(event){this.element.style.backgroundImage='url("'+this.url+'")',this.complete(event,"flickity-bg-lazyloaded")},BgLazyLoader.prototype.onerror=function(event){this.complete(event,"flickity-bg-lazyerror")},BgLazyLoader.prototype.complete=function(event,className){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this),this.element.classList.add(className),this.flickity.dispatchEvent("bgLazyLoad",event,this.element)},Flickity.BgLazyLoader=BgLazyLoader,Flickity}));
//# sourceURL=https://6317423.fs1.hubspotusercontent-na1.net/hub/6317423/hub_generated/template_assets/50907146776/1729701610848/CLEAN-6-1-theme_child/js/slider-flickity-bg-lazy.js