/*! UIkit 3.0.0-rc.6 | http://www.getuikit.com | (c) 2014 - 2017 YOOtheme | MIT License */

!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("uikit-util")):"function"==typeof define&&define.amd?define("uikitslideshow",["uikit-util"],i):i(t.UIkit.util)}(this,function(f){"use strict";var t={connected:function(){f.addClass(this.$el,this.$name)}},i={slide:{show:function(t){return[{transform:e(-100*t)},{transform:e()}]},percent:function(t){return n(t)},translate:function(t,i){return[{transform:e(-100*i*t)},{transform:e(100*i*(1-t))}]}}};function n(t){return Math.abs(f.css(t,"transform").split(",")[4]/t.offsetWidth)||0}function e(t,i){return void 0===t&&(t=0),void 0===i&&(i="%"),"translateX("+t+(t?i:"")+")"}function s(t){return"scale3d("+t+", "+t+", 1)"}function c(t,i,e){f.trigger(t,f.createEvent(i,!1,!1,e))}var r={mixins:[{attrs:!0,mixins:[{props:{autoplay:Boolean,autoplayInterval:Number,pauseOnHover:Boolean},data:{autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},connected:function(){this.startAutoplay()},disconnected:function(){this.stopAutoplay()},events:[{name:"visibilitychange",el:document,handler:function(){document.hidden?this.stopAutoplay():this.startAutoplay()}},{name:f.pointerDown,handler:"stopAutoplay"},{name:"mouseenter",filter:function(){return this.autoplay},handler:function(){this.isHovering=!0}},{name:"mouseleave",filter:function(){return this.autoplay},handler:function(){this.isHovering=!1}}],methods:{startAutoplay:function(){var t=this;this.stopAutoplay(),this.autoplay&&(this.interval=setInterval(function(){return!(t.isHovering&&t.pauseOnHover)&&!t.stack.length&&t.show("next")},this.autoplayInterval))},stopAutoplay:function(){this.interval&&clearInterval(this.interval)}}},{data:{threshold:10,preventCatch:!1},init:function(){var n=this;["start","move","end"].forEach(function(t){var e=n[t];n[t]=function(t){var i=f.getPos(t).x*(f.isRtl?-1:1);n.prevPos=i!==n.pos?n.pos:n.prevPos,n.pos=i,e(t)}})},events:[{name:f.pointerDown,delegate:function(){return this.slidesSelector},handler:function(t){var i;!f.isTouch(t)&&(!(i=t.target).children.length&&i.childNodes.length)||0<t.button||this.length<2||this.preventCatch||this.start(t)}},{name:"dragstart",handler:function(t){t.preventDefault()}}],methods:{start:function(){this.drag=this.pos,this._transitioner?(this.percent=this._transitioner.percent(),this.drag+=this._transitioner.getDistance()*this.percent*this.dir,this._transitioner.translate(this.percent),this._transitioner.cancel(),this.dragging=!0,this.stack=[]):this.prevIndex=this.index,this.unbindMove=f.on(document,f.pointerMove,this.move,{capture:!0,passive:!1}),f.on(window,"scroll",this.unbindMove),f.on(document,f.pointerUp,this.end,!0)},move:function(t){var i=this,e=this.pos-this.drag;if(!(0===e||this.prevPos===this.pos||!this.dragging&&Math.abs(e)<this.threshold)){t.cancelable&&t.preventDefault(),this.dragging=!0,this.dir=e<0?1:-1;for(var n=this.slides,s=this.prevIndex,r=Math.abs(e),o=this.getIndex(s+this.dir,s),a=this._getDistance(s,o)||n[s].offsetWidth;o!==s&&a<r;)i.drag-=a*i.dir,s=o,r-=a,o=i.getIndex(s+i.dir,s),a=i._getDistance(s,o)||n[s].offsetWidth;this.percent=r/a;var h,d=n[s],u=n[o],c=this.index!==o,l=s===o;[this.index,this.prevIndex].filter(function(t){return!f.includes([o,s],t)}).forEach(function(t){f.trigger(n[t],"itemhidden",[i]),l&&(h=!0,i.prevIndex=s)}),(this.index===s&&this.prevIndex!==s||h)&&f.trigger(n[this.index],"itemshown",[this]),c&&(this.prevIndex=s,this.index=o,!l&&f.trigger(d,"beforeitemhide",[this]),f.trigger(u,"beforeitemshow",[this])),this._transitioner=this._translate(Math.abs(this.percent),d,!l&&u),c&&(!l&&f.trigger(d,"itemhide",[this]),f.trigger(u,"itemshow",[this]))}},end:function(){if(f.off(window,"scroll",this.unbindMove),this.unbindMove(),f.off(document,f.pointerUp,this.end,!0),this.dragging){if(this.dragging=null,this.index===this.prevIndex)this.percent=1-this.percent,this.dir*=-1,this._show(!1,this.index,!0),this._transitioner=null;else{var t=(f.isRtl?this.dir*(f.isRtl?1:-1):this.dir)<0==this.prevPos>this.pos;this.index=t?this.index:this.prevIndex,t&&(this.percent=1-this.percent),this.show(0<this.dir&&!t||this.dir<0&&t?"next":"previous",!0)}f.preventClick()}this.drag=this.percent=null}}},{data:{selNav:!1},computed:{nav:function(t,i){var e=t.selNav;return f.$(e,i)},navItemSelector:function(t){var i=t.attrItem;return"["+i+"],[data-"+i+"]"},navItems:function(t,i){return f.$$(this.navItemSelector,i)}},update:[{write:function(){var e=this;this.nav&&this.length!==this.nav.children.length&&f.html(this.nav,this.slides.map(function(t,i){return"<li "+e.attrItem+'="'+i+'"><a href="#"></a></li>'}).join("")),f.toggleClass(f.$$(this.navItemSelector,this.$el).concat(this.nav),"uk-hidden",!this.maxIndex),this.updateNav()},events:["load","resize"]}],events:[{name:"click",delegate:function(){return this.navItemSelector},handler:function(t){t.preventDefault(),t.current.blur(),this.show(f.data(t.current,this.attrItem))}},{name:"itemshow",handler:"updateNav"}],methods:{updateNav:function(){var e=this,n=this.getValidIndex();this.navItems.forEach(function(t){var i=f.data(t,e.attrItem);f.toggleClass(t,e.clsActive,f.toNumber(i)===n),f.toggleClass(t,"uk-invisible",e.finite&&("previous"===i&&0===n||"next"===i&&n>=e.maxIndex))})}}}],props:{clsActivated:Boolean,easing:String,index:Number,finite:Boolean,velocity:Number},data:function(){return{easing:"ease",finite:!1,velocity:1,index:0,stack:[],percent:0,clsActive:"uk-active",clsActivated:!1,Transitioner:!1,transitionOptions:{}}},computed:{duration:function(t,i){var e=t.velocity;return.5*(i.offsetWidth/e)+300},length:function(){return this.slides.length},list:function(t,i){var e=t.selList;return f.$(e,i)},maxIndex:function(){return this.length-1},slidesSelector:function(t){return t.selList+" > *"},slides:function(){return f.toNodes(this.list.children)}},events:{itemshown:function(){this.$update(this.list)}},methods:{show:function(t,i){var e=this;if(void 0===i&&(i=!1),!this.dragging&&this.length){var n=this.stack,s=i?0:n.length,r=function(){n.splice(s,1),n.length&&e.show(n.shift(),!0)};if(n[i?"unshift":"push"](t),!i&&1<n.length)2===n.length&&this._transitioner.forward(Math.min(this.duration,200));else{var o=this.index,a=f.hasClass(this.slides,this.clsActive)&&this.slides[o],h=this.getIndex(t,this.index),d=this.slides[h];if(a!==d){var u,c;if(this.dir=(c=o,"next"===(u=t)?1:"previous"===u?-1:u<c?-1:1),this.prevIndex=o,this.index=h,a&&f.trigger(a,"beforeitemhide",[this]),!f.trigger(d,"beforeitemshow",[this,a]))return this.index=this.prevIndex,void r();var l=this._show(a,d,i).then(function(){return a&&f.trigger(a,"itemhidden",[e]),f.trigger(d,"itemshown",[e]),new f.Promise(function(t){f.fastdom.write(function(){n.shift(),n.length?e.show(n.shift(),!0):e._transitioner=null,t()})})});return a&&f.trigger(a,"itemhide",[this]),f.trigger(d,"itemshow",[this]),l}r()}}},getIndex:function(t,i){return void 0===t&&(t=this.index),void 0===i&&(i=this.index),f.clamp(f.getIndex(t,this.slides,i,this.finite),0,this.maxIndex)},getValidIndex:function(t,i){return void 0===t&&(t=this.index),void 0===i&&(i=this.prevIndex),this.getIndex(t,i)},_show:function(t,i,e){if(this._transitioner=this._getTransitioner(t,i,this.dir,f.assign({easing:e?i.offsetWidth<600?"cubic-bezier(0.25, 0.46, 0.45, 0.94)":"cubic-bezier(0.165, 0.84, 0.44, 1)":this.easing},this.transitionOptions)),!e&&!t)return this._transitioner.translate(1),f.Promise.resolve();var n=this.stack.length;return this._transitioner[1<n?"forward":"show"](1<n?Math.min(this.duration,75+75/(n-1)):this.duration,this.percent)},_getDistance:function(t,i){return new this._getTransitioner(t,t!==i&&i).getDistance()},_translate:function(t,i,e){void 0===i&&(i=this.prevIndex),void 0===e&&(e=this.index);var n=this._getTransitioner(i!==e&&i,e);return n.translate(t),n},_getTransitioner:function(t,i,e,n){return void 0===t&&(t=this.prevIndex),void 0===i&&(i=this.index),void 0===e&&(e=this.dir||1),void 0===n&&(n=this.transitionOptions),new this.Transitioner(f.isNumber(t)?this.slides[t]:t,f.isNumber(i)?this.slides[i]:i,e*(f.isRtl?-1:1),n)}}}],props:{animation:String},data:{animation:"slide",clsActivated:"uk-transition-active",Animations:i,Transitioner:function(r,o,a,t){var i=t.animation,h=t.easing,e=i.percent,n=i.translate,s=i.show;void 0===s&&(s=f.noop);var d=s(a),u=new f.Deferred;return{dir:a,show:function(t,i,e){var n=this;void 0===i&&(i=0);var s=e?"linear":h;return t-=Math.round(t*f.clamp(i,-1,1)),this.translate(i),c(o,"itemin",{percent:i,duration:t,timing:s,dir:a}),c(r,"itemout",{percent:1-i,duration:t,timing:s,dir:a}),f.Promise.all([f.Transition.start(o,d[1],t,s),f.Transition.start(r,d[0],t,s)]).then(function(){n.reset(),u.resolve()},f.noop),u.promise},stop:function(){return f.Transition.stop([o,r])},cancel:function(){f.Transition.cancel([o,r])},reset:function(){for(var t in d[0])f.css([o,r],t,"")},forward:function(t,i){return void 0===i&&(i=this.percent()),f.Transition.cancel([o,r]),this.show(t,i,!0)},translate:function(t){this.reset();var i=n(t,a);f.css(o,i[1]),f.css(r,i[0]),c(o,"itemtranslatein",{percent:t,dir:a}),c(r,"itemtranslateout",{percent:1-t,dir:a})},percent:function(){return e(r||o,o,a)},getDistance:function(){return r.offsetWidth}}}},computed:{animation:function(t){var i=t.animation,e=t.Animations;return f.assign(i in e?e[i]:e.slide,{name:i})},transitionOptions:function(){return{animation:this.animation}}},events:{"itemshow itemhide itemshown itemhidden":function(t){var i=t.target;this.$update(i)},itemshow:function(){f.isNumber(this.prevIndex)&&f.fastdom.flush()},beforeitemshow:function(t){var i=t.target;f.addClass(i,this.clsActive)},itemshown:function(t){var i=t.target;f.addClass(i,this.clsActivated)},itemhidden:function(t){var i=t.target;f.removeClass(i,this.clsActive,this.clsActivated)}}},o=f.assign({},i,{fade:{show:function(){return[{opacity:0,zIndex:0},{zIndex:-1}]},percent:function(t){return 1-f.css(t,"opacity")},translate:function(t){return[{opacity:1-t,zIndex:0},{zIndex:-1}]}},scale:{show:function(){return[{opacity:0,transform:s(1.5),zIndex:0},{zIndex:-1}]},percent:function(t){return 1-f.css(t,"opacity")},translate:function(t){return[{opacity:1-t,transform:s(1+.5*t),zIndex:0},{zIndex:-1}]}},pull:{show:function(t){return t<0?[{transform:e(30),zIndex:-1},{transform:e(),zIndex:0}]:[{transform:e(-100),zIndex:0},{transform:e(),zIndex:-1}]},percent:function(t,i,e){return e<0?1-n(i):n(t)},translate:function(t,i){return i<0?[{transform:e(30*t),zIndex:-1},{transform:e(-100*(1-t)),zIndex:0}]:[{transform:e(100*-t),zIndex:0},{transform:e(30*(1-t)),zIndex:-1}]}},push:{show:function(t){return t<0?[{transform:e(100),zIndex:0},{transform:e(),zIndex:-1}]:[{transform:e(-30),zIndex:-1},{transform:e(),zIndex:0}]},percent:function(t,i,e){return 0<e?1-n(i):n(t)},translate:function(t,i){return i<0?[{transform:e(100*t),zIndex:0},{transform:e(-30*(1-t)),zIndex:-1}]:[{transform:e(-30*t),zIndex:-1},{transform:e(100*(1-t)),zIndex:0}]}}}),a={mixins:[t,r,{update:[{write:function(){if(!this.stack.length&&!this.dragging){var t=this.getValidIndex();delete this.index,f.removeClass(this.slides,this.clsActive,this.clsActivated),this.show(t)}},events:["load","resize"]}]}],props:{ratio:String,minHeight:Boolean,maxHeight:Boolean},data:{ratio:"16:9",minHeight:!1,maxHeight:!1,selList:".uk-slideshow-items",attrItem:"uk-slideshow-item",selNav:".uk-slideshow-nav",Animations:o},update:{read:function(){var t=this.ratio.split(":").map(Number),i=t[0],e=t[1];return e=e*this.$el.offsetWidth/i,this.minHeight&&(e=Math.max(this.minHeight,e)),this.maxHeight&&(e=Math.min(this.maxHeight,e)),{height:e}},write:function(t){var i=t.height;f.height(this.list,Math.floor(i))},events:["load","resize"]}};"undefined"!=typeof window&&window.UIkit&&window.UIkit.component("slideshow",a)});