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