!function(t,e){"function"==typeof define&&define.amd?define(["flickity/js/index","fizzy-ui-utils/utils",],e):"object"==typeof module&&module.exports?module.exports=e(require("flickity"),require("fizzy-ui-utils")):e(t.Flickity,t.fizzyUIUtils)}(this,function t(e,i){var s=e.Slide,a=s.prototype.updateTarget;s.prototype.updateTarget=function(){if(a.apply(this,arguments),this.parent.options.fade){var t=this.target-this.x,e=this.cells[0].x;this.cells.forEach(function(i){var s=i.x-e-t;i.renderPosition(s)})}},s.prototype.setOpacity=function(t){this.cells.forEach(function(e){e.element.style.opacity=t})};var n=e.prototype;e.createMethods.push("_createFade"),n._createFade=function(){this.fadeIndex=this.selectedIndex,this.prevSelectedIndex=this.selectedIndex,this.on("select",this.onSelectFade),this.on("dragEnd",this.onDragEndFade),this.on("settle",this.onSettleFade),this.on("activate",this.onActivateFade),this.on("deactivate",this.onDeactivateFade)};var d=n.updateSlides;n.updateSlides=function(){d.apply(this,arguments),this.options.fade&&this.slides.forEach(function(t,e){var i=e==this.selectedIndex?1:0;t.setOpacity(i)},this)},n.onSelectFade=function(){this.fadeIndex=Math.min(this.prevSelectedIndex,this.slides.length-1),this.prevSelectedIndex=this.selectedIndex},n.onSettleFade=function(){delete this.didDragEnd,this.options.fade&&(this.selectedSlide.setOpacity(1),this.slides[this.fadeIndex]&&this.fadeIndex!=this.selectedIndex&&this.slides[this.fadeIndex].setOpacity(0))},n.onDragEndFade=function(){this.didDragEnd=!0},n.onActivateFade=function(){this.options.fade&&this.element.classList.add("is-fade")},n.onDeactivateFade=function(){this.options.fade&&(this.element.classList.remove("is-fade"),this.slides.forEach(function(t){t.setOpacity("")}))};var h=n.positionSlider;n.positionSlider=function(){if(!this.options.fade){h.apply(this,arguments);return}this.fadeSlides(),this.dispatchScrollEvent()};var o=n.positionSliderAtSelected;n.positionSliderAtSelected=function(){this.options.fade&&this.setTranslateX(0),o.apply(this,arguments)},n.fadeSlides=function(){if(!(this.slides.length<2)){var t=this.getFadeIndexes(),e=this.slides[t.a],i=this.slides[t.b],s=this.wrapDifference(e.target,i.target),a=this.wrapDifference(e.target,-this.x);a/=s,e.setOpacity(1-a),i.setOpacity(a);var n=t.a;this.isDragging&&(n=a>.5?t.a:t.b),void 0!=this.fadeHideIndex&&this.fadeHideIndex!=n&&this.fadeHideIndex!=t.a&&this.fadeHideIndex!=t.b&&this.slides[this.fadeHideIndex].setOpacity(0),this.fadeHideIndex=n}},n.getFadeIndexes=function(){return this.isDragging||this.didDragEnd?this.options.wrapAround?this.getFadeDragWrapIndexes():this.getFadeDragLimitIndexes():{a:this.fadeIndex,b:this.selectedIndex}},n.getFadeDragWrapIndexes=function(){var t=this.slides.map(function(t,e){return this.getSlideDistance(-this.x,e)},this),e=t.map(function(t){return Math.abs(t)}),s=Math.min.apply(Math,e),a=e.indexOf(s),n=t[a],d=this.slides.length;return{a:a,b:i.modulo(a+(n>=0?1:-1),d)}},n.getFadeDragLimitIndexes=function(){for(var t=0,e=0;e<this.slides.length-1;e++){var i=this.slides[e];if(-this.x<i.target)break;t=e}return{a:t,b:t+1}},n.wrapDifference=function(t,e){var i=e-t;if(!this.options.wrapAround)return i;var s=i+this.slideableWidth,a=i-this.slideableWidth;return Math.abs(s)<Math.abs(i)&&(i=s),Math.abs(a)<Math.abs(i)&&(i=a),i};var r=n._getWrapShiftCells;n._getWrapShiftCells=function(){this.options.fade||r.apply(this,arguments)};var l=n.shiftWrapCells;return n.shiftWrapCells=function(){this.options.fade||l.apply(this,arguments)},e});