/*!
* Vue-slideshow v1.1.0
*
* Copyright (C) 2019, ZhaoGang
* Released under the MIT license
*
* Update: 2019-04-20
*/
"use strict";!function(t,i,e){function o(i,e){return(e||t).querySelector(i)}function a(i,e){return[].slice.call((e||t).querySelectorAll(i))}o("style.v-slideshow-style")||o("head").insertAdjacentHTML("beforeend",'\n\t\t'),e.component("vue-slideshow",{template:'\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t',props:["data","config"],computed:{wrapperStyle:function(){return{width:"slide"===this.config.effect?100*(this.data.length+2)+"%":"100%",transform:"slide"===this.config.effect&&"translateX(-"+100/(this.data.length+2)+"%)"}},boxClass:function(){return function(t){return{"v-slideshow-box":!0,"v-slideshow-box-fade":"fade"===this.config.effect&&!0,"v-slideshow-box-show":"fade"===this.config.effect&&0===t,"v-slideshow-box-block":"fade"===this.config.effect&&0===t}}},boxStyle:function(){return function(t){return{width:("slide"!==this.config.effect?100:100/(this.data.length+2))+"%",left:"slide"===this.config.effect&&100/(this.data.length+2)*t+"%"}}},dotIClass:function(){return function(t){return{active:0===t}}}},methods:{slide:function(t){var e=i.VueSlideShowIDCache[this.$el.getAttribute("data-id")];e.animated=!0;var o=100/(this.data.length+2),a=this.data.length;this.dotChange(t,this.config.dot),-1===t&&this.dotChange(a-1,this.config.dot),t===a&&this.dotChange(0,this.config.dot);var s=this.$el.querySelector(".v-slideshow-wrapper");s.style.transition=".7s",requestAnimationFrame(function(){s.style.transform="translateX(-"+o*(t+1)+"%)"});var n=i.setTimeout(function(){s.style.transition="0s",t===a&&(e.imageIndex=0,s.style.transform="translateX(-"+o+"%)"),-1===t&&(e.imageIndex=a-1,s.style.transform="translateX(-"+o*a+"%)"),i.clearTimeout(n),e.animated=!1},700)},fade:function(t){var e=i.VueSlideShowIDCache[this.$el.getAttribute("data-id")];e.animated=!0,this.dotChange(t,this.config.dot),a(".v-slideshow-box",this.$el).forEach(function(o,a){if(a===t){o.classList.add("v-slideshow-box-block");var s=i.setTimeout(function(){o.classList.add("v-slideshow-box-show"),i.clearTimeout(s)},16)}else{o.classList.remove("v-slideshow-box-show");var n=i.setTimeout(function(){o.classList.remove("v-slideshow-box-block"),i.clearTimeout(n),e.animated=!1},700)}})},dotChange:function(t,e){i.VueSlideShowIDCache[this.$el.getAttribute("data-id")].imageIndex=t,("string"==typeof e?[].slice.call(o(e).children):a(".v-slideshow-dot i",this.$el)).forEach(function(i,e){i.classList.remove("active"),e===t&&i.classList.add("active")})},dotEvent:function(t,e){i.VueSlideShowIDCache[this.$el.getAttribute("data-id")].animated||(this["fade"===this.config.effect?"fade":"slide"](t),this.dotChange(t,e))},arrowEvent:function(t){if(!i.VueSlideShowIDCache[this.$el.getAttribute("data-id")].animated){var e=i.VueSlideShowIDCache[this.$el.getAttribute("data-id")];t?++e.imageIndex>this.data.length-1&&"slide"!==this.config.effect&&(e.imageIndex=0):--e.imageIndex<0&&"slide"!==this.config.effect&&(e.imageIndex=this.data.length-1),"fade"===this.config.effect?this.fade(e.imageIndex):this.slide(e.imageIndex)}},enter:function(){this.config.autoplay&&i.clearInterval(i.VueSlideShowIDCache[this.$el.getAttribute("data-id")].autoTimer)},leave:function(){this.config.autoplay&&this.play()},play:function(){var t=this;i.VueSlideShowIDCache[this.$el.getAttribute("data-id")].autoTimer=i.setInterval(function(){t.arrowEvent(1)},~~this.config.autoplay)}},mounted:function(){var t=this;i.VueSlideShowIDCache||(i.VueSlideShowIDCache={}),i.VueSlideShowIDCache[this.$el.getAttribute("data-id")]={imageIndex:0,animated:!1,autoTimer:null},this.config.autoplay&&this.play();var e=this.$el.getAttribute("data-custom-arrow");e&&(e=e.split("|"),o(e[0]).onclick=function(){return t.arrowEvent(0)},o(e[1]).onclick=function(){return t.arrowEvent(1)});var a=this.$el.getAttribute("data-custom-dot");a&&[].slice.call(o(a).children).forEach(function(i,e){e>t.data.length-1||(i.onclick=function(){return t.dotEvent(e,t.config.dot)})})}}),e.prototype.VueSlideShow=function(t,i){return o(t).innerHTML='',new e({el:t,data:{images:i.images,config:i.config}})}}(document,window,Vue);