splide.min.js 29 KB

12
  1. function _defineProperties(n,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function _createClass(n,t,e){return t&&_defineProperties(n.prototype,t),e&&_defineProperties(n,e),Object.defineProperty(n,"prototype",{writable:!1}),n}!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).Splide=t()}(this,function(){"use strict";var j="mounted",r="ready",A="move",k="moved",D="shifted",T="click",z="active",M="inactive",N="visible",I="hidden",R="slide:keydown",O="refresh",F="updated",E="resize",L="resized",W="repositioned",S="scroll",B="scrolled",o="destroy",G="navigation:mounted",b="autoplay:play",w="autoplay:pause",v="lazyload:loaded",n={CREATED:1,MOUNTED:2,IDLE:3,MOVING:4,SCROLLING:5,DRAGGING:6,DESTROYED:7};function P(n){n.length=0}function C(n,t,e){return Array.prototype.slice.call(n,t,e)}function H(n){return n.bind.apply(n,[null].concat(C(arguments,1)))}function X(){}var g=setTimeout;function p(n){return requestAnimationFrame(n)}function t(n,t){return typeof t===n}function Y(n){return!s(n)&&t("object",n)}var u=Array.isArray,m=H(t,"function"),q=H(t,"string"),U=H(t,"undefined");function s(n){return null===n}function y(n){return n instanceof HTMLElement}function _(n){return u(n)?n:[n]}function x(n,t){_(n).forEach(t)}function K(n,t){return-1<n.indexOf(t)}function J(n,t){return n.push.apply(n,_(t)),n}function Q(t,n,e){t&&x(n,function(n){n&&t.classList[e?"add":"remove"](n)})}function V(n,t){Q(n,q(t)?t.split(" "):t,!0)}function Z(n,t){x(t,n.appendChild.bind(n))}function $(n,e){x(n,function(n){var t=e.parentNode;t&&t.insertBefore(n,e)})}function nn(n,t){return y(n)&&(n.msMatchesSelector||n.matches).call(n,t)}function tn(n,t){n=n?C(n.children):[];return t?n.filter(function(n){return nn(n,t)}):n}function en(n,t){return t?tn(n,t)[0]:n.firstElementChild}function on(n,t,e){if(n)for(var i=Object.keys(n),i=e?i.reverse():i,o=0;o<i.length;o++){var r=i[o];if("__proto__"!==r&&!1===t(n[r],r))break}return n}function rn(i){return C(arguments,1).forEach(function(e){on(e,function(n,t){i[t]=e[t]})}),i}function f(e){return C(arguments).forEach(function(n){on(n,function(n,t){u(n)?e[t]=n.slice():Y(n)?e[t]=f(Y(e[t])?e[t]:{},n):e[t]=n})}),e}function un(n,e){x(n,function(t){x(e,function(n){t&&t.removeAttribute(n)})})}function sn(e,t,i){Y(t)?on(t,function(n,t){sn(e,t,n)}):x(e,function(n){s(i)||""===i?un(n,t):n.setAttribute(t,String(i))})}function an(n,t,e){n=document.createElement(n);return t&&(q(t)?V:sn)(n,t),e&&Z(e,n),n}function cn(n,t,e){if(U(e))return getComputedStyle(n)[t];s(e)||(n=n.style)[t]!==(e=""+e)&&(n[t]=e)}function fn(n,t){cn(n,"display",t)}function ln(n){n.setActive&&n.setActive()||n.focus({preventScroll:!0})}function dn(n,t){return n.getAttribute(t)}function pn(n,t){return n&&n.classList.contains(t)}function hn(n){return n.getBoundingClientRect()}function gn(n){x(n,function(n){n&&n.parentNode&&n.parentNode.removeChild(n)})}function vn(n){return en((new DOMParser).parseFromString(n,"text/html").body)}function mn(n,t){n.preventDefault(),t&&(n.stopPropagation(),n.stopImmediatePropagation())}function yn(n,t){return n&&n.querySelector(t)}function bn(n,t){return t?C(n.querySelectorAll(t)):[]}function wn(n,t){Q(n,t,!1)}function _n(n){return n.timeStamp}function En(n){return q(n)?n:n?n+"px":""}var xn="splide",i="data-"+xn;function Sn(n,t){if(!n)throw new Error("["+xn+"] "+(t||""))}var Pn=Math.min,Ln=Math.max,Cn=Math.floor,An=Math.ceil,kn=Math.abs;function Dn(n,t,e,i){var o=Pn(t,e),e=Ln(t,e);return i?o<n&&n<e:o<=n&&n<=e}function Tn(n,t,e){var i=Pn(t,e),e=Ln(t,e);return Pn(Ln(i,n),e)}function zn(n){return(0<n)-(n<0)}function Mn(t,n){return x(n,function(n){t=t.replace("%s",""+n)}),t}function Nn(n){return n<10?"0"+n:""+n}var In={};function l(){var s=[];function e(n,e,i){x(n,function(t){t&&x(e,function(n){n.split(" ").forEach(function(n){n=n.split(".");i(t,n[0],n[1])})})})}return{bind:function(n,t,r,u){e(n,t,function(n,t,e){var i="addEventListener"in n,o=i?n.removeEventListener.bind(n,t,r,u):n.removeListener.bind(n,r);i?n.addEventListener(t,r,u):n.addListener(r),s.push([n,t,e,r,o])})},unbind:function(n,t,o){e(n,t,function(t,e,i){s=s.filter(function(n){return!!(n[0]!==t||n[1]!==e||n[2]!==i||o&&n[3]!==o)||(n[4](),!1)})})},dispatch:function(n,t,e){var i;return"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:!0,detail:e}):(i=document.createEvent("CustomEvent")).initEvent(t,!0,!1),n.dispatchEvent(i),i},destroy:function(){s.forEach(function(n){n[4]()}),P(s)}}}function Rn(n){var e=n?n.event.bus:document.createDocumentFragment(),i=l();return n&&n.event.on(o,i.destroy),rn(i,{bus:e,on:function(n,t){i.bind(e,_(n).join(" "),function(n){t.apply(t,u(n.detail)?n.detail:[])})},off:H(i.unbind,e),emit:function(n){i.dispatch(e,n,C(arguments,1))}})}function On(t,e,i,o){var r,n,u=Date.now,s=0,a=!0,c=0;function f(){if(!a){var n=u()-r;if(t<=n?(s=1,r=u()):s=n/t,i&&i(s),1===s&&(e(),o&&++c>=o))return l();p(f)}}function l(){a=!0}function d(){cancelAnimationFrame(n),a=!(n=s=0)}return{start:function(n){n||d(),r=u()-(n?s*t:0),a=!1,p(f)},rewind:function(){r=u(),s=0,i&&i(s)},pause:l,cancel:d,set:function(n){t=n},isPaused:function(){return a}}}function a(n){var t=n;return{set:function(n){t=n},is:function(n){return K(_(n),t)}}}function jn(e,i){var o;return function(){var n,t=this;o||(n=C(arguments),(o=On(i||0,function(){e.apply(t,n),o=null},null,1)).start())}}var Fn="ttb",c={marginRight:["marginBottom","marginLeft"],autoWidth:["autoHeight"],fixedWidth:["fixedHeight"],paddingLeft:["paddingTop","paddingRight"],paddingRight:["paddingBottom","paddingLeft"],width:["height"],Width:["Height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp","ArrowRight"],ArrowRight:["ArrowDown","ArrowLeft"]};var Wn="role",Bn="tabindex",e="aria-",Gn=e+"controls",Hn=e+"current",Xn=e+"selected",Yn=e+"label",qn=e+"hidden",Un=e+"orientation",Kn=e+"roledescription",d=e+"atomic",h=e+"live",Jn=[Wn,Bn,"disabled",Gn,Hn,Yn,qn,Un,Kn,d,h],Qn=xn,Vn=xn+"__track",Zn=xn+"__list",$n=xn+"__slide",nt=$n+"--clone",tt=$n+"__container",et=xn+"__arrows",it=xn+"__arrow",ot=it+"--prev",rt=it+"--next",ut=xn+"__pagination",st=ut+"__page",at=xn+"__progress"+"__bar",ct=xn+"__autoplay",ft=xn+"__play",lt=xn+"__pause",dt="is-active",pt="is-prev",ht="is-next",gt="is-visible",vt="is-loading",mt=[dt,gt,pt,ht,vt];var yt="slide",bt="loop",wt="fade";function _t(o,i,t,r){var u,n=Rn(o),e=n.on,s=n.emit,a=n.bind,c=n.destroy,f=o.Components,l=o.root,d=o.options,p=d.isNavigation,h=d.updateOnMove,g=d.i18n,v=d.pagination,m=f.Direction.resolve,y=dn(r,"style"),b=-1<t,w=en(r,"."+tt);function _(){var n=o.splides.map(function(n){n=n.splide.Components.Slides.getAt(i);return n?n.slide.id:""}).join(" ");sn(r,Yn,Mn(g.slideX,(b?t:i)+1)),sn(r,Gn,n),S()}function E(){u||x(!0)}function x(n){var t,e;u||(t=o.index,(e=P())!==pn(r,dt)&&(Q(r,dt,e),s(e?z:M,C)),function(){var n=L();n!==pn(r,gt)&&(Q(r,gt,n),s(n?N:I,C));n||document.activeElement!==r||(n=f.Slides.getAt(o.index))&&ln(n.slide)}(),Q(r,pt,i===t-1),Q(r,ht,i===t+1),n||S())}function S(){var n=P(),t=!L()&&(!n||b);sn(r,Hn,p&&n||""),sn(r,qn,t||""),sn(r,Bn,!t&&d.slideFocus?0:""),sn(bn(r,d.focusableNodes||""),Bn,t?-1:"")}function P(){var n=o.index;return n===i||d.cloneStatus&&n===t}function L(){if(o.is(wt))return P();var n=hn(f.Elements.track),t=hn(r),e=m("left"),i=m("right");return Cn(n[e])<=An(t[e])&&Cn(t[i])<=An(n[i])}var C={index:i,slideIndex:t,slide:r,container:w,isClone:b,mount:function(){b||(r.id=l.id+"-slide"+Nn(i+1),sn(r,Wn,v?"tabpanel":"group"),sn(r,Kn,v?"":g.slide),sn(r,Yn,Mn(g.slideLabel,[i+1,o.length]))),a(r,"click",H(s,T,C)),a(r,"keydown",H(s,R,C)),e([O,W,k,B],H(x,!1)),e(D,H(x,!0)),e(G,_),h&&e(A,E)},destroy:function(){u=!0,c(),wn(r,mt),un(r,Jn),sn(r,"style",y)},update:x,style:function(n,t,e){cn(e&&w||r,n,t)},isWithin:function(n,t){return n=kn(n-i),(n=!b&&(d.rewind||o.is(bt))?Pn(n,o.length-n):n)<=t}};return C}var Et=i+"-interval";var xt={passive:!1,capture:!0},St="touchmove mousemove",Pt="touchend touchcancel mouseup";var Lt={Spacebar:" ",Right:"ArrowRight",Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown"};function Ct(n){return n=q(n)?n:n.key,Lt[n]||n}var At="keydown";var kt=i+"-lazy",Dt=kt+"-srcset",Tt="["+kt+"], ["+Dt+"]";var zt=[" ","Enter"];var Mt=Object.freeze({__proto__:null,Media:function(i,n,t){var e=l(),o=t.breakpoints||{},r=f({},t),u=[];function s(n){n&&e.destroy()}function a(n){u.push(n.map(function(n){var t=matchMedia(n[1]);return e.bind(t,"change",c),[n[0],t]}))}function c(){var n=u.reduce(function(n,t){var e=(e=function(n){return n[1].matches},C(t).filter(e)[0]||[]);return e[1]&&i.emit("media",e[1]),f(n,e[0]||{})},f({},r)),t=n.destroy;t?(i.options=r,i.destroy("completely"===t)):i.state.is(7)?(s(!0),i.mount()):(t=i.options.direction!==n.direction,i.options=n,t&&i.refresh())}return{setup:function(){var e="min"===t.mediaQuery;a(Object.keys(o).sort(function(n,t){return e?+t-+n:+n-+t}).map(function(n){return[o[n],"("+(e?"min":"max")+"-width:"+n+"px)"]})),a([[{speed:0,autoplay:"pause"},"(prefers-reduced-motion: reduce)"]]),c()},mount:X,destroy:s}},Direction:function(n,t,i){return{resolve:function(n,t,e){return e=e||i.direction,c[n]["rtl"!==e||t?e===Fn?0:-1:1]||n},orient:function(n){return n*("rtl"===i.direction?1:-1)}}},Elements:function(n,t,e){var i,o,r=Rn(n).on,u=n.root,s=e.i18n,a={},c=[],f=[],l=[];function d(){var n;i=g("."+Vn),o=en(i,"."+Zn),Sn(i&&o,"A track/list element is missing."),J(c,tn(o,"."+$n+":not(."+nt+")")),on({arrows:et,pagination:ut,autoplay:ct,prev:ot,next:rt,bar:at,play:ft,pause:lt},function(n,t){a[t]=g("."+n)}),rn(a,{root:u,track:i,list:o,slides:c}),n=u.id||function(n){return""+n+Nn(In[n]=(In[n]||0)+1)}(xn),u.id=n,i.id=i.id||n+"-track",o.id=o.id||n+"-list",sn(u,Kn,s.carousel),sn(u,Wn,"SECTION"!==u.tagName&&e.role||""),sn(o,Wn,"none"),h()}function p(){P(c),wn(u,f),wn(i,l),un([u,i,o],Jn.concat("style"))}function h(){wn(u,f),wn(i,l),f=v(Qn),l=v(Vn),V(u,f),V(i,l)}function g(n){n=yn(u,n);return n&&function(n,t){if(m(n.closest))return n.closest(t);for(var e=n;e&&1===e.nodeType&&!nn(e,t);)e=e.parentElement;return e}(n,"."+Qn)===u?n:null}function v(n){return[n+"--"+e.type,n+"--"+e.direction,e.drag&&n+"--draggable",e.isNavigation&&n+"--nav",n===Qn&&dt]}return rn(a,{setup:d,mount:function(){r(O,p),r(O,d),r(F,h)},destroy:p})},Slides:function(i,o,r){var n=Rn(i),t=n.on,u=n.emit,s=n.bind,a=(n=o.Elements).slides,c=n.list,f=[];function e(){a.forEach(function(n,t){d(n,t,-1)})}function l(){h(function(n){n.destroy()}),P(f)}function d(n,t,e){n=_t(i,t,e,n);n.mount(),f.push(n)}function p(n){return n?g(function(n){return!n.isClone}):f}function h(n,t){p(t).forEach(n)}function g(t){return f.filter(m(t)?t:function(n){return q(t)?nn(n.slide,t):K(_(t),n.index)})}return{mount:function(){e(),t(O,l),t(O,e),t([j,O],function(){f.sort(function(n,t){return n.index-t.index})})},destroy:l,update:function(){h(function(n){n.update()})},register:d,get:p,getIn:function(n){var t=o.Controller,e=t.toIndex(n),i=t.hasFocus()?1:r.perPage;return g(function(n){return Dn(n.index,e,e+i-1)})},getAt:function(n){return g(n)[0]},add:function(n,o){x(n,function(n){var t,e,i;y(n=q(n)?vn(n):n)&&((t=a[o])?$(n,t):Z(c,n),V(n,r.classes.slide),n=n,e=H(u,E),n=bn(n,"img"),(i=n.length)?n.forEach(function(n){s(n,"load error",function(){--i||e()})}):e())}),u(O)},remove:function(n){gn(g(n).map(function(n){return n.slide})),u(O)},forEach:h,filter:g,style:function(t,e,i){h(function(n){n.style(t,e,i)})},getLength:function(n){return(n?a:f).length},isEnough:function(){return f.length>r.perPage}}},Layout:function(n,t,e){var i,o,r=(a=Rn(n)).on,u=a.bind,s=a.emit,a=t.Slides,c=t.Direction.resolve,f=(t=t.Elements).root,l=t.track,d=t.list,p=a.getAt,h=a.style;function g(){o=null,i=e.direction===Fn,cn(f,"maxWidth",En(e.width)),cn(l,c("paddingLeft"),m(!1)),cn(l,c("paddingRight"),m(!0)),v()}function v(){var n=hn(f);o&&o.width===n.width&&o.height===n.height||(cn(l,"height",function(){var n="";i&&(Sn(n=y(),"height or heightRatio is missing."),n="calc("+n+" - "+m(!1)+" - "+m(!0)+")");return n}()),h(c("marginRight"),En(e.gap)),h("width",(e.autoWidth?"":En(e.fixedWidth)||(i?"":b()))||null),h("height",En(e.fixedHeight)||(i?e.autoHeight?"":b():y())||null,!0),o=n,s(L))}function m(n){var t=e.padding,n=c(n?"right":"left");return t&&En(t[n]||(Y(t)?0:t))||"0px"}function y(){return En(e.height||hn(d).width*e.heightRatio)}function b(){var n=En(e.gap);return"calc((100%"+(n&&" + "+n)+")/"+(e.perPage||1)+(n&&" - "+n)+")"}function w(n,t){var e=p(n);if(e){n=hn(e.slide)[c("right")],e=hn(d)[c("left")];return kn(n-e)+(t?0:_())}return 0}function _(){var n=p(0);return n&&parseFloat(cn(n.slide,c("marginRight")))||0}return{mount:function(){g(),u(window,"resize load",jn(H(s,E))),r([F,O],g),r(E,v)},listSize:function(){return hn(d)[c("width")]},slideSize:function(n,t){return(n=p(n||0))?hn(n.slide)[c("width")]+(t?0:_()):0},sliderSize:function(){return w(n.length-1,!0)-w(-1,!0)},totalSize:w,getPadding:function(n){return parseFloat(cn(l,c("padding"+(n?"Right":"Left"))))||0}}},Clones:function(s,e,a){var n,t=Rn(s),i=t.on,o=t.emit,c=e.Elements,f=e.Slides,r=e.Direction.resolve,l=[];function u(){(n=h())&&(function(o){var r=f.get().slice(),u=r.length;if(u){for(;r.length<o;)J(r,r);J(r.slice(-o),r.slice(0,o)).forEach(function(n,t){var e=t<o,i=function(n,t){n=n.cloneNode(!0);return V(n,a.classes.clone),n.id=s.root.id+"-clone"+Nn(t+1),n}(n.slide,t);e?$(i,r[0].slide):Z(c.list,i),J(l,i),f.register(i,t-o+(e?0:u),n.index)})}}(n),o(E))}function d(){gn(l),P(l)}function p(){n<h()&&o(O)}function h(){var n,t=a.clones;return s.is(bt)?t||(t=(n=a[r("fixedWidth")]&&e.Layout.slideSize(0))&&An(hn(c.track)[r("width")]/n)||a[r("autoWidth")]&&s.length||2*a.perPage):t=0,t}return{mount:function(){u(),i(O,d),i(O,u),i([F,E],p)},destroy:d}},Move:function(i,s,o){var a,n=Rn(i),t=n.on,c=n.emit,f=i.state.set,r=(n=s.Layout).slideSize,e=n.getPadding,u=n.totalSize,l=n.listSize,d=n.sliderSize,p=(n=s.Direction).resolve,h=n.orient,g=(n=s.Elements).list,v=n.track;function m(){s.Controller.isBusy()||(s.Scroll.cancel(),y(i.index),c(W))}function y(n){b(E(n,!0))}function b(n,t){i.is(wt)||(t=t?n:function(n){{var t,e;i.is(bt)&&(e=h(n-x()),t=P(!1,n)&&e<0,e=P(!0,n)&&0<e,(t||e)&&(n=w(n,e)))}return n}(n),cn(g,"transform","translate"+p("X")+"("+t+"px)"),n!==t&&c(D))}function w(n,t){var e=n-S(t),i=d();return n-=h(i*(An(kn(e)/i)||1))*(t?1:-1)}function _(){b(x()),a.cancel()}function E(n,t){var e=h(u(n-1)-(e=n,"center"===(n=o.focus)?(l()-r(e,!0))/2:+n*r(e)||0));return t?function(n){o.trimSpace&&i.is(yt)&&(n=Tn(n,0,h(d()-l())));return n}(e):e}function x(){var n=p("left");return hn(g)[n]-hn(v)[n]+h(e(!1))}function S(n){return E(n?s.Controller.getEnd():0,!!o.trimSpace)}function P(n,t){t=U(t)?x():t;var e=!0!==n&&h(t)<h(S(!1)),t=!1!==n&&h(t)>h(S(!0));return e||t}return{mount:function(){a=s.Transition,t([j,L,F,O],m)},move:function(n,t,e,i){var o,r,u=x();n!==t&&(o=t<n,r=h(w(x(),o)),o?0<=r:r<=g["scroll"+p("Width")]-hn(v)[p("width")])&&(_(),b(w(u,t<n),!0)),f(4),c(A,t,e,n),a.start(t,function(){f(3),c(k,t,e,n),i&&i()})},jump:y,translate:b,shift:w,cancel:_,toIndex:function(n){for(var t=s.Slides.get(),e=0,i=1/0,o=0;o<t.length;o++){var r=t[o].index,u=kn(E(r,!0)-n);if(!(u<=i))break;i=u,e=r}return e},toPosition:E,getPosition:x,getLimit:S,exceededLimit:P,reposition:m}},Controller:function(o,r,u){var s,a,c,n=Rn(o).on,f=r.Move,l=f.getPosition,d=f.getLimit,p=f.toPosition,t=r.Slides,h=t.isEnough,e=t.getLength,g=o.is(bt),v=o.is(yt),m=H(x,!1),y=H(x,!0),b=u.start||0,w=b;function i(){s=e(!0),a=u.perMove,c=u.perPage;var n=Tn(b,0,s-1);n!==b&&(b=n,f.reposition())}function _(n,t,e,i){r.Scroll.scroll(n,t,e,function(){k(P(f.toIndex(f.getPosition()))),i&&i()})}function E(n,t,e){_(p(n,!0),t,!1,e)}function x(n,t){var e,i,o=a||(D()?1:c),r=S(b+o*(n?-1:1),b);return-1!==r||!v||(e=l(),i=d(!n),o=1,kn(e-i)<o)?t?r:P(r):n?0:L()}function S(n,t,e){var i;return h()?(i=L(),n<0||i<n?n=Dn(0,n,t,!0)||Dn(i,t,n,!0)?C(A(n)):g?a||D()?n:n<0?-(s%c||c):s:u.rewind?n<0?i:0:-1:e||n===t||(n=a?n:C(A(t)+(n<t?-1:1)))):n=-1,n}function P(n){return g?(n+s)%s||0:n}function L(){return Ln(s-(D()||g&&a?1:c),0)}function C(n){return Tn(D()?n:c*n,0,L())}function A(n){return D()?n:Cn((n>=L()?s-1:n)/c)}function k(n){n!==b&&(w=b,b=n)}function D(){return!U(u.focus)||u.isNavigation}function T(){return o.state.is([4,5])&&!!u.waitForTransition}return{mount:function(){i(),n([F,O],i)},go:function(n,t,e){var i;T()||-1<(n=function(n){if("move"===u.trimSpace&&n!==b)for(var t=l();t===p(n,!0)&&Dn(n,0,o.length-1,!0);)n<b?--n:++n;return P(n)}(i=function(n){var t=b;{var e,i;q(n)?(i=n.match(/([+\-<>])(\d+)?/)||[],e=i[1],i=i[2],"+"===e||"-"===e?t=S(b+ +(""+e+(+i||1)),b,!0):">"===e?t=i?C(+i):m(!0):"<"===e&&(t=y(!0))):t=g?n:Tn(n,0,L())}return t}(n)))&&(t||n!==b)&&(k(n),u.useScroll?E(i,u.speed,e):f.move(i,n,w,e))},scroll:_,scrollTo:E,getNext:m,getPrev:y,getAdjacent:x,getEnd:L,setIndex:k,getIndex:function(n){return n?w:b},toIndex:C,toPage:A,toDest:function(n){return n=f.toIndex(n),v?Tn(n,0,L()):n},hasFocus:D,isBusy:T}},Arrows:function(o,n,t){var e,i,r=Rn(o),u=r.on,s=r.bind,a=r.emit,c=r.destroy,f=t.classes,l=t.i18n,d=n.Elements,p=n.Controller,h=d.arrows,g=h,v=d.prev,m=d.next,y={};function b(){!function(){var n=t.arrows;!n||v&&m||(g=h||an("div",f.arrows),v=x(!0),m=x(!1),e=!0,Z(g,[v,m]),h||$(g,d.track));v&&m&&(rn(y,{prev:v,next:m}),fn(g,n?"":"none"),V(g,i=et+"--"+t.direction),n&&(u([k,O,B],S),s(m,"click",H(E,">")),s(v,"click",H(E,"<")),S(),sn([v,m],Gn,d.list.id),a("arrows:mounted",v,m)))}(),u(F,w)}function w(){_(),b()}function _(){c(),wn(g,i),e?(gn(h?[v,m]:g),v=m=null):un([v,m],Jn)}function E(n){p.go(n,!0)}function x(n){return vn('<button class="'+f.arrow+" "+(n?f.prev:f.next)+'" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="'+(t.arrowPath||"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z")+'" />')}function S(){var n=o.index,t=p.getPrev(),e=p.getNext(),i=-1<t&&n<t?l.last:l.prev,n=-1<e&&e<n?l.first:l.next;v.disabled=t<0,m.disabled=e<0,sn(v,Yn,i),sn(m,Yn,n),a("arrows:updated",v,m,t,e)}return{arrows:y,mount:b,destroy:_}},Autoplay:function(t,e,i){var o,r,n=Rn(t),u=n.on,s=n.bind,a=n.emit,c=On(i.interval,t.go.bind(t,">"),function(n){var t=l.bar;t&&cn(t,"width",100*n+"%"),a("autoplay:playing",n)}),f=c.isPaused,l=e.Elements,d=i.autoplay,p="pause"===d;function h(n){var t=n?"pause":"play",e=l[t];e&&(sn(e,Gn,l.track.id),sn(e,Yn,i.i18n[t]),s(e,"click",n?v:g))}function g(){f()&&e.Slides.isEnough()&&(c.start(!i.resetProgress),r=o=p=!1,a(b))}function v(n){void 0===n&&(n=!0),f()||(c.pause(),a(w)),p=n}function m(){p||(o||r?v(!1):g())}function y(){var n=e.Slides.getAt(t.index);c.set(n&&+dn(n.slide,Et)||i.interval)}return{mount:function(){d&&(h(!0),h(!1),function(){var n=l.root;i.pauseOnHover&&s(n,"mouseenter mouseleave",function(n){o="mouseenter"===n.type,m()});i.pauseOnFocus&&s(n,"focusin focusout",function(n){r="focusin"===n.type,m()});u([A,S,O],c.rewind),u(A,y)}(),p||g())},destroy:c.cancel,play:g,pause:v,isPaused:f}},Cover:function(n,t,e){var i=Rn(n).on;function o(e){t.Slides.forEach(function(n){var t=en(n.container||n.slide,"img");t&&t.src&&r(e,t,n)})}function r(n,t,e){e.style("background",n?'center/cover no-repeat url("'+t.src+'")':"",!0),fn(t,n?"none":"")}return{mount:function(){e.cover&&(i(v,H(r,!0)),i([j,F,O],H(o,!0)))},destroy:H(o,!1)}},Scroll:function(r,s,u){var a,c,n=Rn(r),t=n.on,f=n.emit,l=r.state.set,d=s.Move,p=d.getPosition,h=d.getLimit,g=d.exceededLimit,v=d.translate,m=1;function y(n,t,e,i,o){var r,u=p();_(),e&&(r=s.Layout.sliderSize(),e=zn(n)*r*Cn(kn(n)/r)||0,n=d.toPosition(s.Controller.toDest(n%r))+e),m=1,t=t||Ln(kn(n-u)/1.5,800),c=i,a=On(t,b,H(w,u,n,o),1),l(5),f(S),a.start()}function b(){l(3),c&&c(),f(B)}function w(n,t,e,i){var o=p(),n=(n+(t-n)*(n=i,(i=u.easingFunc)?i(n):1-Math.pow(1-n,4))-o)*m;v(o+n),r.is(yt)&&!e&&g()&&(m*=.6,kn(n)<10&&y(h(g(!0)),600,!1,void 0,!0))}function _(){a&&a.cancel()}function e(){a&&!a.isPaused()&&(_(),b())}return{mount:function(){t(A,_),t([F,O],e)},destroy:_,scroll:y,cancel:e}},Drag:function(r,u,s){var a,t,e,c,f,l,i,d,n=Rn(r),o=n.on,p=n.emit,h=n.bind,g=n.unbind,v=r.state,m=u.Move,y=u.Scroll,b=u.Controller,w=u.Elements.track,_=(n=u.Direction).resolve,E=n.orient,x=m.getPosition,S=m.exceededLimit,P=!1;function L(){var n=s.drag;O(!n),c="free"===n}function C(n){var t;l=!1,i||(t=R(n),nn(n.target,J((s.noDrag||"").split(",").filter(Boolean),["."+st,"."+it]).join(","))||!t&&n.button||(b.isBusy()?mn(n,!0):(d=t?w:window,f=v.is([4,5]),e=null,h(d,St,A,xt),h(d,Pt,k,xt),m.cancel(),y.cancel(),T(n))))}function A(n){var t,e,i,o;v.is(6)||(v.set(6),p("drag")),n.cancelable&&(f?(m.translate(a+z(n)/(P&&r.is(yt)?5:1)),e=200<M(n),i=P!==(P=S()),(e||i)&&T(n),l=!0,p("dragging"),mn(n)):kn(z(o=n))>kn(z(o,!0))&&(t=n,e=s.dragMinThreshold,i=Y(e),o=i&&e.mouse||0,e=(i?e.touch:+e)||10,f=kn(z(t))>(R(t)?e:o),mn(n)))}function k(n){var t,e,i,o;v.is(6)&&(v.set(3),p("dragged")),f&&(e=function(n){if(r.is(bt)||!P){var t=M(n);if(t&&t<200)return z(n)/t}return 0}(t=n),i=function(n){return x()+zn(n)*Pn(kn(n)*(s.flickPower||600),c?1/0:u.Layout.listSize()*(s.flickMaxPages||1))}(e),o=s.rewind&&s.rewindByDrag,t=b.go,c?b.scroll(i,0,s.snap):r.is(wt)?t(E(zn(e))<0?o?"<":"-":o?">":"+"):r.is(yt)&&P&&o?t(S(!0)?">":"<"):t(b.toDest(i),!0),mn(n)),g(d,St,A),g(d,Pt,k),f=!1}function D(n){!i&&l&&mn(n,!0)}function T(n){e=t,t=n,a=x()}function z(n,t){return I(n,t)-I(N(n),t)}function M(n){return _n(n)-_n(N(n))}function N(n){return t===n&&e||t}function I(n,t){return(R(n)?n.changedTouches[0]:n)["page"+_(t?"Y":"X")]}function R(n){return"undefined"!=typeof TouchEvent&&n instanceof TouchEvent}function O(n){i=n}return{mount:function(){h(w,St,X,xt),h(w,Pt,X,xt),h(w,"touchstart mousedown",C,xt),h(w,"click",D,{capture:!0}),h(w,"dragstart",mn),o([j,F],L)},disable:O,isDragging:function(){return f}}},Keyboard:function(t,n,e){var i,o,r=Rn(t),u=r.on,s=r.bind,a=r.unbind,c=t.root,f=n.Direction.resolve;function l(){var n=e.keyboard;n&&("focused"===n?sn(i=c,Bn,0):i=window,s(i,At,h))}function d(){a(i,At)}function p(){var n=o;o=!0,g(function(){o=n})}function h(n){o||((n=Ct(n))===f("ArrowLeft")?t.go("<"):n===f("ArrowRight")&&t.go(">"))}return{mount:function(){l(),u(F,d),u(F,l),u(A,p)},destroy:d,disable:function(n){o=n}}},LazyLoad:function(e,n,u){var t=Rn(e),i=t.on,o=t.off,r=t.bind,s=t.emit,a="sequential"===u.lazyLoad,c=[],f=0;function l(){n.Slides.forEach(function(r){bn(r.slide,Tt).forEach(function(n){var t,e,i=dn(n,kt),o=dn(n,Dt);i===n.src&&o===n.srcset||(t=u.classes.spinner,sn(e=en(e=n.parentElement,"."+t)||an("span",t,e),Wn,"presentation"),c.push({_img:n,_Slide:r,src:i,srcset:o,_spinner:e}),n.src||fn(n,"none"))})}),a&&g()}function d(){f=0,c=[]}function p(){(c=c.filter(function(n){var t=u.perPage*((u.preloadPages||1)+1)-1;return!n._Slide.isWithin(e.index,t)||h(n)})).length||o(k)}function h(t){var e=t._img;V(t._Slide.slide,vt),r(e,"load error",function(n){!function(n,t){var e=n._Slide;wn(e.slide,vt),t||(gn(n._spinner),fn(n._img,""),s(v,n._img,e),s(E));a&&g()}(t,"error"===n.type)}),["srcset","src"].forEach(function(n){t[n]&&(sn(e,n,t[n]),un(e,"src"===n?kt:Dt))})}function g(){f<c.length&&h(c[f++])}return{mount:function(){u.lazyLoad&&(l(),i(O,d),i(O,l),a||i([j,O,k,B],p))},destroy:d}},Pagination:function(f,n,l){var d,p,t=Rn(f),e=t.on,i=t.emit,h=t.bind,o=t.destroy,g=n.Slides,v=n.Elements,r=n.Controller,m=r.hasFocus,u=r.getIndex,s=r.go,a=n.Direction.resolve,y=[];function c(){d&&(o(),gn(v.pagination?C(d.children):d),wn(d,p),P(y),d=null)}function b(n){s(">"+n,!0)}function w(n,t){var e=y.length,i=Ct(t),o=_(),r=-1;i===a("ArrowRight",!1,o)?r=++n%e:i===a("ArrowLeft",!1,o)?r=(--n+e)%e:"Home"===i?r=0:"End"===i&&(r=e-1);e=y[r];e&&(ln(e.button),s(">"+r),mn(t,!0))}function _(){return l.paginationDirection||l.direction}function E(n){return y[r.toPage(n)]}function x(){var n,t=E(u(!0)),e=E(u());t&&(wn(n=t.button,dt),un(n,Xn),sn(n,Bn,-1)),e&&(V(n=e.button,dt),sn(n,Xn,!0),sn(n,Bn,"")),i("pagination:updated",{list:d,items:y},t,e)}return{items:y,mount:function n(){c(),e([F,O],n),l.pagination&&g.isEnough()&&(e([A,S,B],x),function(){var n=f.length,t=l.classes,e=l.i18n,i=l.perPage,o=m()?n:An(n/i);V(d=v.pagination||an("ul",t.pagination,v.root),p=ut+"--"+_()),sn(d,Wn,"tablist"),sn(d,Yn,e.select),sn(d,Un,_()===Fn?"vertical":"");for(var r=0;r<o;r++){var u=an("li",null,d),s=an("button",{class:t.page,type:"button"},u),a=g.getIn(r).map(function(n){return n.slide.id}),c=!m()&&1<i?e.pageX:e.slideX;h(s,"click",H(b,r)),l.paginationKeyboard&&h(s,"keydown",H(w,r)),sn(u,Wn,"none"),sn(s,Wn,"tab"),sn(s,Gn,a.join(" ")),sn(s,Yn,Mn(c,r+1)),sn(s,Bn,-1),y.push({li:u,button:s,page:r})}}(),x(),i("pagination:mounted",{list:d,items:y},E(f.index)))},destroy:c,getAt:E,update:x}},Sync:function(o,n,e){var t=n.Elements.list,r=[];function i(){var n,t;o.splides.forEach(function(n){var e;n.isParent||(e=n.splide,[o,e].forEach(function(n){var t=Rn(n),i=n===o?e:o;t.on(A,function(n,t,e){i.go(i.is(bt)?e:n)}),r.push(t)}))}),e.isNavigation&&(n=Rn(o),(t=n.on)(T,a),t(R,c),t([j,F],s),r.push(n),n.emit(G,o.splides))}function u(){r.forEach(function(n){n.destroy()}),P(r)}function s(){sn(t,Un,e.direction===Fn?"vertical":"")}function a(n){o.go(n.index)}function c(n,t){K(zt,Ct(t))&&(a(n),mn(t))}return{mount:i,destroy:u,remount:function(){u(),i()}}},Wheel:function(u,s,a){var n=Rn(u).bind,c=0;function t(n){var t,e,i,o,r;n.cancelable&&(r=(t=n.deltaY)<0,e=_n(n),i=a.wheelMinThreshold||0,o=a.wheelSleep||0,kn(t)>i&&o<e-c&&(u.go(r?"<":">"),c=e),r=r,a.releaseWheel&&!u.state.is(4)&&-1===s.Controller.getAdjacent(r)||mn(n))}return{mount:function(){a.wheel&&n(s.Elements.track,"wheel",t,xt)}}},Live:function(n,t,e){var i=Rn(n).on,o=t.Elements.list,r=e.live&&!e.isNavigation;function u(n){r&&sn(o,h,n?"off":"polite")}return{mount:function(){r&&(sn(o,d,!1),u(!t.Autoplay.isPaused()),i(b,H(u,!0)),i(w,H(u,!1)))},disable:u}}}),Nt={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:{slide:$n,clone:nt,arrows:et,arrow:it,prev:ot,next:rt,pagination:ut,page:st,spinner:xn+"__spinner"},i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select slide to show",slideLabel:"%s of %s"}};function It(n,i,t){var e=Rn(n).on;return{mount:function(){e([j,O],function(){g(function(){i.Slides.style("transition","opacity "+t.speed+"ms "+t.easing)})})},start:function(n,t){var e=i.Elements.track;cn(e,"height",En(hn(e).height)),g(function(){t(),cn(e,"height","")})},cancel:X}}function Rt(r,n,u){var s,t=Rn(r).bind,a=n.Move,c=n.Controller,e=n.Elements.list;function i(){f("")}function f(n){cn(e,"transition",n)}return{mount:function(){t(e,"transitionend",function(n){n.target===e&&s&&(i(),s())})},start:function(n,t){var e=a.toPosition(n,!0),i=a.getPosition(),o=function(n){var t=u.rewindSpeed;if(r.is(yt)&&t){var e=c.getIndex(!0),i=c.getEnd();if(0===e&&i<=n||i<=e&&0===n)return t}return u.speed}(n);1<=kn(e-i)&&1<=o?(f("transform "+o+"ms "+u.easing),a.translate(e,!0),s=t):(a.jump(n),t())},cancel:i}}e=function(){function e(n,t){this.event=Rn(),this.Components={},this.state=a(1),this.splides=[],this._options={},this._Extensions={};n=q(n)?yn(document,n):n;Sn(n,n+" is invalid."),this.root=n,t=f({},Nt,e.defaults,t||{});try{f(t,JSON.parse(dn(n,i)))}catch(n){Sn(!1,"Invalid JSON")}this._options=t}var n=e.prototype;return n.mount=function(n,t){var e=this,i=this.state,o=this.Components;return Sn(i.is([1,7]),"Already mounted!"),i.set(1),this._Components=o,this._Transition=t||this._Transition||(this.is(wt)?It:Rt),this._Extensions=n||this._Extensions,on(rn({},Mt,this._Extensions,{Transition:this._Transition}),function(n,t){n=n(e,o,e._options);(o[t]=n).setup&&n.setup()}),on(o,function(n){n.mount&&n.mount()}),this.emit(j),V(this.root,"is-initialized"),i.set(3),this.emit(r),this},n.sync=function(n){return this.splides.push({splide:n}),n.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this._Components.Sync.remount(),n.Components.Sync.remount()),this},n.go=function(n){return this._Components.Controller.go(n),this},n.on=function(n,t){return this.event.on(n,t),this},n.off=function(n){return this.event.off(n),this},n.emit=function(n){var t;return(t=this.event).emit.apply(t,[n].concat(C(arguments,1))),this},n.add=function(n,t){return this._Components.Slides.add(n,t),this},n.remove=function(n){return this._Components.Slides.remove(n),this},n.is=function(n){return this._options.type===n},n.refresh=function(){return this.emit(O),this},n.destroy=function(t){void 0===t&&(t=!0);var n=this.event,e=this.state;return e.is(1)?Rn(this).on(r,this.destroy.bind(this,t)):(on(this._Components,function(n){n.destroy&&n.destroy(t)},!0),n.emit(o),n.destroy(),t&&P(this.splides),e.set(7)),this},_createClass(e,[{key:"options",get:function(){return this._options},set:function(n){var t=this._options;f(t,n),this.state.is(1)||this.emit(F,t)}},{key:"length",get:function(){return this._Components.Slides.getLength(!0)}},{key:"index",get:function(){return this._Components.Controller.getIndex()}}]),e}();return e.defaults={},e.STATES=n,e});
  2. //# sourceMappingURL=splide.min.js.map