splide.min.js 28 KB

12345678
  1. /*!
  2. * Splide.js
  3. * Version : 4.1.3
  4. * License : MIT
  5. * Copyright: 2022 Naotoshi Fujita
  6. */
  7. var n,t;n=this,t=function(){"use strict";const p="(prefers-reduced-motion: reduce)";const R=4,F=5;var e={CREATED:1,MOUNTED:2,IDLE:3,MOVING:R,SCROLLING:F,DRAGGING:6,DESTROYED:7};function _(n){n.length=0}function T(n,...t){return n.bind(null,...t)}const u=setTimeout,un=()=>{};function v(n){return requestAnimationFrame(n)}function t(n,t){return typeof t===n}function cn(n){return!i(n)&&t("object",n)}const o=Array.isArray,m=T(t,"function"),M=T(t,"string"),sn=(T(t,"boolean"),T(t,"undefined"));function i(n){return null===n}function y(n){try{return n instanceof(n.ownerDocument.defaultView||window).HTMLElement}catch(n){return!1}}function w(n){return o(n)?n:[n]}function g(n,t){w(n).forEach(t)}function b(n,t){return n.push(...w(t)),n}const r=Array.prototype;function s(n,t,e){return r.slice.call(n,t,e)}function x(n,t){return r.includes.call(n,t)}function L(t,n,e){t&&g(M(n)?n.split(" "):n,n=>{n&&t.classList.toggle(n,e)})}function O(n,t){L(n,t,!0)}function A(n,...t){n&&n.append(...t)}function $(n,...t){n&&n.before(...t)}function an(n,t){return y(n)&&n.matches(t)}function S(n,t){const e=n?s(n.children):[];return t?e.filter(n=>an(n,t)):e}function fn(n,t){return t?S(n,t)[0]:n.firstElementChild}const ln=Object.assign,k=Object.keys;function c(t,e,n){t&&(n?k(t).reverse():k(t)).forEach(n=>{"__proto__"!==n&&e(t[n],n)})}function h(e,...n){return n.forEach(n=>{c(n,(n,t)=>{o(n)?n=n.slice():cn(n)&&(n=h({},cn(e[t])?e[t]:{},n)),e[t]=n})}),e}function E(t,n){g(n||k(t),n=>{delete t[n]})}function C(n,e){g(n,t=>{g(e,n=>{t&&t.removeAttribute(n)})})}function D(e,t,o){cn(t)?c(t,(n,t)=>{D(e,t,n)}):g(e,n=>{i(o)||""===o?C(n,t):n.setAttribute(t,String(o))})}function I(n,t,e){n=document.createElement(n);return t&&(M(t)?O:D)(n,t),e&&A(e,n),n}function P(n,t,e){if(sn(e))return getComputedStyle(n)[t];i(e)||(n.style[t]=""+e)}function dn(n,t){P(n,"display",t)}function vn(n){y(n)&&n.focus({preventScroll:!0})}function N(n,t){return n.getAttribute(t)}function hn(n,t){return!!n&&n.classList.contains(t)}function j(n){return n.getBoundingClientRect()}function G(n){g(n,n=>{n&&n.parentNode&&n.parentNode.removeChild(n)})}function pn(n){return fn((new DOMParser).parseFromString(n,"text/html").body)}function X(n,t){n.preventDefault(),t&&(n.stopPropagation(),n.stopImmediatePropagation())}function gn(n,t){return n&&n.querySelector(t)}function mn(n,t){return t&&n?s(n.querySelectorAll(t)):[]}function W(n,t){L(n,t,!1)}function yn(n){return n.timeStamp}function z(n){return M(n)?n:n?n+"px":""}const{min:Y,max:wn,floor:bn,ceil:xn,abs:B,sign:Sn}=Math;function kn(n,t,e){return B(n-t)<e}function En(n,t,e,o){var i=Y(t,e),t=wn(t,e);return o?i<n&&n<t:i<=n&&n<=t}function q(n,t,e){var o=Y(t,e),t=wn(t,e);return Y(wn(o,n),t)}function An(t,n){return g(n,n=>{t=t.replace("%s",""+n)}),t}function $n(n,t=2){return(""+n).padStart(t,"0")}const zn={};function a(n,t){g(n,n=>{M(n)&&n.split(" ").forEach(t)})}function f(t,e){const o=[];for(let n=t.length-1;0<=n;n--)e(t[n])&&o.push(...t.splice(n,1));return o}function Ln(n){const i=n||[],r=n?{}:void 0;return{bind:function(t,n,e,o){a(n,n=>{t.addEventListener(n,e,o),i.push([t.removeEventListener.bind(t,n,e,o),r])})},create:T(Ln,i),destroy:function(){r?f(i,n=>n[1]===r).forEach(n=>{n[0]()}):(i.forEach(n=>{n[0]()}),_(i))}}}function l(n){const o=n||[],i=n?{}:void 0;return{on:function(n,t){a(n,n=>{o.push([n,t,i])})},off:function(n,e){a(n,t=>{f(o,n=>n[0]===t&&(!e||n[1]===e)&&n[2]===i)})},emit:function(t,...e){o.slice().forEach(n=>{n[0]===t&&n[1](...e)})},create:T(l,o),destroy:function(){i?f(o,n=>n[2]===i):_(o)}}}function Pn(t,n,e,o){const i=Date["now"];let r,u=0,c,s=!0,a=0;function f(){if(!s){if(u=t?Y((i()-r)/t,1):1,e&&e(u),1<=u&&(n(),r=i(),o&&++a>=o))return l();c=v(f)}}function l(){s=!0}function d(){c&&cancelAnimationFrame(c),u=0,c=0,s=!0}return{start:function(n){n||d(),r=i()-(n?u*t:0),s=!1,c=v(f)},rewind:function(){r=i(),u=0,e&&e(u)},pause:l,cancel:d,set:function(n){t=n},isPaused:function(){return s}}}function d(n){let t=n;return{set:function(n){t=n},is:function(n){return x(w(n),t)}}}const H="mounted",J="move",_n="moved",On="click",Cn="active",Dn="inactive",In="visible",Tn="hidden",K="refresh",U="updated",Mn="resize",Nn="resized",jn="scroll",V="scrolled",Rn="overflow",Fn="navigation:mounted",Gn="autoplay:play",Xn="autoplay:pause",Wn="_sk",Yn="_sh",Bn="_ei",qn="!overflow";const Hn="ArrowLeft",Jn="ArrowRight";const Kn="ttb",Un={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp",Jn],ArrowRight:["ArrowDown",Hn]};const Q="role",Z="tabindex";const Vn="aria-controls",Qn="aria-current",Zn="aria-selected",nn="aria-label",nt="aria-labelledby",tt="aria-hidden",et="aria-orientation",ot="aria-roledescription",it="aria-live",rt="aria-busy",ut="aria-atomic",ct=[Q,Z,"disabled",Vn,Qn,nn,nt,tt,et,ot],st="splide",at="data-"+st;var n=st+"__";const ft=st,lt=n+"track",dt=n+"list",vt=n+"slide",ht=vt+"--clone",pt=vt+"__container",gt=n+"arrows",mt=n+"arrow",yt=mt+"--prev",wt=mt+"--next",bt=n+"pagination",xt=bt+"__page",St=n+"progress"+"__bar",kt=n+"toggle",Et=n+"spinner",At=n+"sr",tn="is-active",$t="is-prev",zt="is-next",Lt="is-visible",Pt="is-loading",_t="is-focus-in",Ot="is-overflow",Ct=[tn,Lt,$t,zt,Pt,_t,Ot];n={slide:vt,clone:ht,arrows:gt,arrow:mt,prev:yt,next:wt,pagination:bt,page:xt,spinner:Et};function Dt(n,t){if(!n)throw new Error(`[${st}] `+(t||""))}const It="touchstart mousedown",Tt="touchmove mousemove",Mt="touchend touchcancel mouseup click";const en="slide",on="loop",Nt="fade",jt=(i,o,e,r)=>{const n=i.event.create(),{on:t,emit:u,bind:c}=n,{Components:s,root:a,options:f}=i,{isNavigation:l,updateOnMove:d,i18n:v,pagination:h,slideFocus:p}=f,g=s["Elements"],m=s.Direction["resolve"],y=N(r,"style"),w=N(r,nn),b=-1<e,x=fn(r,"."+pt);let S;function k(){var n=i.splides.map(n=>{n=n.splide.Components.Slides.getAt(o);return n?n.slide.id:""}).join(" ");D(r,nn,An(v.slideX,(b?e:o)+1)),D(r,Vn,n),D(r,Q,p?"button":""),p&&C(r,ot)}function E(){S||A()}function A(){var n,t,e;S||(n=i["index"],(e=$())!==hn(r,tn)&&(L(r,tn,e),D(r,Qn,l&&e||""),u(e?Cn:Dn,z)),e=function(){if(i.is(Nt))return $();var n=j(g.track),t=j(r),e=m("left",!0),o=m("right",!0);return bn(n[e])<=xn(t[e])&&bn(t[o])<=xn(n[o])}(),t=!e&&(!$()||b),i.state.is([R,F])||D(r,tt,t||""),D(mn(r,f.focusableNodes||""),Z,t?-1:""),p&&D(r,Z,t?-1:0),e!==hn(r,Lt)&&(L(r,Lt,e),u(e?In:Tn,z)),e||document.activeElement!==r||(t=s.Slides.getAt(i.index))&&vn(t.slide),L(r,$t,o===n-1),L(r,zt,o===n+1))}function $(){var n=i["index"],{cloneStatus:t=!0}=f;return n===o||t&&n===e}const z={index:o,slideIndex:e,slide:r,container:x,isClone:b,mount:function(){b||(r.id=a.id+"-slide"+$n(o+1),D(r,Q,h?"tabpanel":"group"),D(r,ot,v.slide),D(r,nn,w||An(v.slideLabel,[o+1,i.length]))),c(r,"click",T(u,On,z)),c(r,"keydown",T(u,Wn,z)),t([_n,Yn,V],A),t(Fn,k),d&&t(J,E)},destroy:function(){S=!0,n.destroy(),W(r,Ct),C(r,ct),D(r,"style",y),D(r,nn,w||"")},update:A,pos:function(){var n=s.Slides.get()[0],t=m("left");return n?B(j(r)[t]-j(n.slide)[t]):0},size:function(){return j(r)[m("width")]},style:function(n,t,e){P(e&&x||r,n,t)},isWithin:function(n,t){let e=B(n-o);return(e=b||!f.rewind&&!i.is(on)?e:Y(e,i.length-e))<=t}};return z};const Rt=at+"-interval";const rn={passive:!1,capture:!0};const Ft=at+"-lazy",Gt=Ft+"-srcset",Xt=`[${Ft}], [${Gt}]`;const Wt=[" ","Enter"];const Yt={Breakpoints:(o,n,i,t)=>{const r=o["state"],u=i.breakpoints||{},c=i.reducedMotion||{},s=Ln(),a=[];function f(n){n&&s.destroy()}function l(n,t){const e=matchMedia(t);s.bind(e,"change",d),a.push([n,()=>e.matches])}function d(){var n=r.is(7),t=i.direction,e=a.reduce((n,t)=>h(n,t[1]()?t[0]:{}),{});E(i),v(e,!1,!r.is(1)),i.destroy?o.destroy("completely"===i.destroy):n?(f(!0),o.mount()):t!==i.direction&&o.refresh()}function v(n,t,e){h(i,n),t&&h(Object.getPrototypeOf(i),n),e&&o.emit(U,i)}return{setup:function(){const e="min"===i.mediaQuery;k(u).sort((n,t)=>e?+n-+t:+t-+n).forEach(n=>{n!==qn&&l(u[n],`(${e?"min":"max"}-width:${n}px)`)}),u[qn]&&(a.push([u[qn],()=>n.Layout&&!n.Layout.isOverflow()]),t.on(Rn,d)),l(c,p),d()},destroy:f,reduce:function(n){matchMedia(p).matches&&(n?h(i,c):E(i,k(c)))},set:v}},Direction:(n,t,i)=>{return{resolve:function(n,t,e){const o="rtl"!==(e=e||i.direction)||t?e===Kn?0:-1:1;return Un[n]&&Un[n][o]||n.replace(/width|left|right/i,(n,t)=>{const e=Un[n.toLowerCase()][o]||n;return 0<t?e.charAt(0).toUpperCase()+e.slice(1):e})},orient:function(n){return n*("rtl"===i.direction?1:-1)}}},Elements:(n,t,e,o)=>{const{on:i,bind:r}=o,u=n["root"],c=e["i18n"],s={},a=[];let f=[],l=[],d,v,h;function p(){d=y(lt),v=fn(d,"."+dt),Dt(d&&v,"A track/list element is missing."),b(a,S(v,`.${vt}:not(.${ht})`)),ln(s,{root:u,track:d,list:v,slides:a,arrows:y(gt),pagination:y(bt),prev:y(yt),next:y(wt),bar:y(St),toggle:y(kt)});var{role:n="region"}=e,t=u.id||function(n){return""+n+$n(zn[n]=(zn[n]||0)+1)}(st);u.id=t,d.id=d.id||t+"-track",v.id=v.id||t+"-list",!N(u,Q)&&"SECTION"!==u.tagName&&n&&D(u,Q,n),D(u,ot,c.carousel),D(v,Q,"presentation"),m()}function g(n){var t=ct.concat("style");_(a),W(u,f),W(d,l),C([d,v],t),C(u,n?t:["style",ot])}function m(){W(u,f),W(d,l),f=w(ft),l=w(lt),O(u,f),O(d,l),D(u,nn,e.label),D(u,nt,e.labelledby)}function y(n){var t,e,n=gn(u,"."+n);return n&&(t=n,e="."+ft,t.closest(e)===u)?n:void 0}function w(n){return[n+"--"+e.type,n+"--"+e.direction,e.drag&&n+"--draggable",e.isNavigation&&n+"--nav",n===ft&&tn]}return ln(s,{setup:p,mount:function(){i(K,g),i(K,p),i(U,m),r(document,It+" keydown",n=>{h="keydown"===n.type},{capture:!0}),r(u,"focusin",()=>{L(u,_t,!!h)})},destroy:g})},Slides:(i,r,u,n)=>{const{on:t,emit:c,bind:s}=n,{slides:a,list:f}=r.Elements,l=[];function e(){a.forEach((n,t)=>{d(n,t,-1)})}function o(){h(n=>{n.destroy()}),_(l)}function d(n,t,e){const o=jt(i,t,e,n);o.mount(),l.push(o),l.sort((n,t)=>n.index-t.index)}function v(n){return n?p(n=>!n.isClone):l}function h(n,t){v(t).forEach(n)}function p(t){return l.filter(m(t)?t:n=>M(t)?an(n.slide,t):x(w(t),n.index))}return{mount:function(){e(),t(K,o),t(K,e)},destroy:o,update:function(){h(n=>{n.update()})},register:d,get:v,getIn:function(n){const t=r["Controller"],e=t.toIndex(n),o=t.hasFocus()?1:u.perPage;return p(n=>En(n.index,e,e+o-1))},getAt:function(n){return p(n)[0]},add:function(n,t){g(n,n=>{if(y(n=M(n)?pn(n):n)){var e=a[t];e?$(e,n):A(f,n),O(n,u.classes.slide);{var e=n,o=T(c,Mn);const i=mn(e,"img");let t=i["length"];t?i.forEach(n=>{s(n,"load error",()=>{--t||o()})}):o()}}}),c(K)},remove:function(n){G(p(n).map(n=>n.slide)),c(K)},forEach:h,filter:p,style:function(t,e,o){h(n=>{n.style(t,e,o)})},getLength:function(n){return(n?a:l).length},isEnough:function(){return l.length>u.perPage}}},Layout:(t,n,e,o)=>{const{on:i,bind:r,emit:u}=o;o=n.Slides;const c=n.Direction["resolve"],{root:s,track:a,list:f}=n.Elements,{getAt:l,style:d}=o;let v,h,p;function g(){v=e.direction===Kn,P(s,"maxWidth",z(e.width)),P(a,c("paddingLeft"),y(!1)),P(a,c("paddingRight"),y(!0)),m(!0)}function m(n){var t=j(s);!n&&h.width===t.width&&h.height===t.height||(P(a,"height",function(){let n="";v&&(Dt(n=w(),"height or heightRatio is missing."),n=`calc(${n} - ${y(!1)} - ${y(!0)})`);return n}()),d(c("marginRight"),z(e.gap)),d("width",e.autoWidth?null:z(e.fixedWidth)||(v?"":b())),d("height",z(e.fixedHeight)||(v?e.autoHeight?null:b():w()),!0),h=t,u(Nn),p!==(p=$())&&(L(s,Ot,p),u(Rn,p)))}function y(n){var t=e["padding"],n=c(n?"right":"left");return t&&z(t[n]||(cn(t)?0:t))||"0px"}function w(){return z(e.height||j(f).width*e.heightRatio)}function b(){var n=z(e.gap);return`calc((100%${n&&" + "+n})/${e.perPage||1}${n&&" - "+n})`}function x(){return j(f)[c("width")]}function S(n=0,t){const e=l(n);return(e?e.size():0)+(t?0:A())}function k(n,t){const e=l(n);return e?e.pos()+e.size()+(t?0:A()):0}function E(n){return k(t.length-1)-k(0)+S(0,n)}function A(){const n=l(0),t=l(1);return n&&t?t.pos()-n.pos()-n.size():0}function $(){return t.is(Nt)||E(!0)>x()}return{mount:function(){g(),r(window,"resize load",function(n,t){const e=Pn(t||0,n,void 0,1);return()=>{e.isPaused()&&e.start()}}(T(u,Mn))),i([U,K],g),i(Mn,m)},resize:m,listSize:x,slideSize:S,sliderSize:E,totalSize:k,getPadding:function(n){return parseFloat(P(a,c("padding"+(n?"Right":"Left"))))||0},isOverflow:$}},Clones:(c,e,s,t)=>{const n=t["on"],{Elements:a,Slides:f,Layout:{resize:o}}=e,i=e.Direction["resolve"],l=[];let d;function r(){if(n(K,v),n([U,Mn],h),d=p()){{var i=d;const r=f.get().slice(),u=r["length"];if(u){for(;r.length<i;)b(r,r);b(r.slice(-i),r.slice(0,i)).forEach((n,t)=>{var e=t<i,o=function(n,t){const e=n.cloneNode(!0);return O(e,s.classes.clone),e.id=c.root.id+"-clone"+$n(t+1),e}(n.slide,t);e?$(r[0].slide,o):A(a.list,o),b(l,o),f.register(o,t-i+(e?0:u),n.index)})}}o(!0)}}function v(){u(),r(),o(!0)}function u(){G(l),_(l),t.destroy()}function h(){var n=p();d!==n&&(d<n||!n)&&(n||c.go(0),t.emit(K))}function p(){let n=s["clones"];var t;return c.is(on)?sn(n)&&(t=(t=s[i("fixedWidth")]&&e.Layout.slideSize(0))&&xn(j(a.track)[i("width")]/t),n=t||s[i("autoWidth")]&&c.length||2*s.perPage):n=0,n}return{mount:r,destroy:u}},Move:(o,t,i,n)=>{const{on:e,emit:r}=n,u=o.state["set"],c=t["Slides"],{slideSize:s,getPadding:a,listSize:f,sliderSize:l,totalSize:d}=t.Layout,{resolve:v,orient:h}=t.Direction,{list:p,track:g}=t.Elements;let m;function y(){t.Controller.isBusy()||(t.Scroll.cancel(),w(o.index),t.Slides.update())}function w(n){b(k(n,!0))}function b(n,t){o.is(Nt)||(t=t?n:function(n){{var t;o.is(on)&&(t=z(!0,n),(z(!1,n)||t)&&(n=x(n,t)))}return n}(n),P(p,"transform",`translate${v("X")}(${t}px)`),n!==t&&r(Yn))}function x(n,t){var e=n-A(t),o=l();return n-=h(o*(xn(B(e)/o)||1))*(t?1:-1)}function S(){b(E(),!0),m.cancel()}function k(n,t){var e=h(d(n-1)-(n=n,"center"===(e=i.focus)?(f()-s(n,!0))/2:+e*s(n)||0));return t?(n=e,n=i.trimSpace&&o.is(en)?q(n,0,h(l(!0)-f())):n):e}function E(){var n=v("left");return j(p)[n]-j(g)[n]+h(a(!1))}function A(n){return k(n?t.Controller.getEnd():0,!!i.trimSpace)}function $(n){var t=a(!1),e=h(x(E(),n));return n?t<=e:e<=p[v("scrollWidth")]-j(g)[v("width")]+t}function z(n,t=E()){var e=!0!==n&&h(t)<h(A(!1)),n=!1!==n&&h(t)>h(A(!0));return e||n}return{mount:function(){m=t.Transition,e([H,Nn,U,K],y)},move:function(n,t,e,o){n!==t&&$(e<n)?(S(),b(x(E(),e<n),!0)):m.cancel(),u(R),r(J,t,e,n),m.start(t,()=>{u(3),r(_n,t,e,n),o&&o()})},jump:w,translate:b,shift:x,cancel:S,toIndex:function(t){var e=c.get();let o=0,i=1/0;for(let n=0;n<e.length;n++){var r=e[n].index,u=B(k(r,!0)-t);if(!(u<=i))break;i=u,o=r}return o},toPosition:k,getPosition:E,getLimit:A,exceededLimit:z,reposition:y,canShift:$}},Controller:(i,r,u,n)=>{const{on:t,emit:e}=n,c=r["Move"],{getPosition:s,getLimit:o,toPosition:a}=c,{isEnough:f,getLength:l}=r.Slides,d=u["omitEnd"],v=i.is(on),h=i.is(en),p=T($,!1),g=T($,!0);let m=u.start||0,y,w=m,b,x,S;function k(){b=l(!0),x=u.perMove,S=u.perPage,y=P();var n=d?y:b-1,n=q(m,0,n);(w=n)!==m&&(m=n,c.reposition())}function E(){y!==P()&&e(Bn)}function A(n,t,e){var o,i;I()||(t=-1<(o=L(n=function(n){let t=m;{var e,o;M(n)?([,e,o]=n.match(/([+\-<>])(\d+)?/)||[],"+"===e||"-"===e?t=z(m+ +(""+e+(+o||1)),m):">"===e?t=o?_(+o):p(!0):"<"===e&&(t=g(!0))):t=v?n:q(n,0,y)}return t}(n)))&&(t||o!==m),i=n===o||c.canShift(n>w),t&&i&&(C(o),c.move(n,o,w,e)))}function $(n,t){var e=x||(D()?1:S),e=z(m+e*(n?-1:1),m,!(x||D()));return-1===e&&h&&!kn(s(),o(!n),1)?n?0:y:t?e:L(e)}function z(n,t,e){var o;return f()||D()?((o=function(n){if(h&&"move"===u.trimSpace&&n!==m)for(var t=s();t===a(n,!0)&&En(n,0,i.length-1,!u.rewind);)n<m?--n:++n;return n}(n))!==n&&(t=n,n=o,e=!1),n<0||n>y?n=x||!En(0,n,t,!0)&&!En(y,t,n,!0)?v?e?n<0?-(b%S||S):b:n:u.rewind?n<0?y:0:-1:_(O(n)):e&&n!==t&&(n=_(O(t)+(n<t?-1:1)))):n=-1,n}function L(n){return v?(n+b)%b||0:n}function P(){let n=b-(D()||v&&x?1:S);for(;d&&0<n--;)if(a(b-1,!0)!==a(n,!0)){n++;break}return q(n,0,b-1)}function _(n){return q(D()?n:S*n,0,y)}function O(n){return D()?Y(n,y):bn((n>=y?b-1:n)/S)}function C(n){n!==m&&(w=m,m=n)}function D(){return!sn(u.focus)||u.isNavigation}function I(){return i.state.is([R,F])&&!!u.waitForTransition}return{mount:function(){k(),t([U,K,Bn],k),t(Nn,E)},go:A,jump:function(n){const t=r.Breakpoints["set"];var e=u["speed"];t({speed:0}),A(n),t({speed:e})},scroll:function(n,t,e,o){r.Scroll.scroll(n,t,e,()=>{var n=L(c.toIndex(s()));C(d?Y(n,y):n),o&&o()})},getNext:p,getPrev:g,getAdjacent:$,getEnd:P,setIndex:C,getIndex:function(n){return n?w:m},toIndex:_,toPage:O,toDest:function(n){return n=c.toIndex(n),h?q(n,0,y):n},hasFocus:D,isBusy:I}},Arrows:(i,n,t,e)=>{const{on:o,bind:r,emit:u}=e,{classes:c,i18n:s}=t,{Elements:a,Controller:f}=n,{arrows:l,track:d}=a;let v=l,h=a.prev,p=a.next,g,m;const y={};function w(){var{arrows:n=!0}=t;!n||h&&p||(v=l||I("div",c.arrows),h=k(!0),p=k(!1),g=!0,A(v,h,p),l||$(d,v)),h&&p&&(ln(y,{prev:h,next:p}),dn(v,n?"":"none"),O(v,m=gt+"--"+t.direction),n&&(o([H,_n,K,V,Bn],E),r(p,"click",T(S,">")),r(h,"click",T(S,"<")),E(),D([h,p],Vn,d.id),u("arrows:mounted",h,p))),o(U,b)}function b(){x(),w()}function x(){e.destroy(),W(v,m),g?(G(l?[h,p]:v),h=p=null):C([h,p],ct)}function S(n){f.go(n,!0)}function k(n){return pn(`<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="${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 E(){var n,t,e,o;h&&p&&(o=i.index,n=f.getPrev(),t=f.getNext(),e=-1<n&&o<n?s.last:s.prev,o=-1<t&&t<o?s.first:s.next,h.disabled=n<0,p.disabled=t<0,D(h,nn,e),D(p,nn,o),u("arrows:updated",h,p,n,t))}return{arrows:y,mount:w,destroy:x,update:E}},Autoplay:(n,t,e,o)=>{const{on:i,bind:r,emit:u}=o,{interval:c=5e3,pauseOnHover:s=!0,pauseOnFocus:a=!0,resetProgress:f=!0}=e,l=Pn(c,n.go.bind(n,">"),function(n){var t=v["bar"];t&&P(t,"width",100*n+"%"),u("autoplay:playing",n)}),d=l["isPaused"],{Elements:v,Elements:{root:h,toggle:p}}=t,g=e["autoplay"];let m,y,w="pause"===g;function b(){d()&&t.Slides.isEnough()&&(l.start(!f),y=m=w=!1,k(),u(Gn))}function x(n=!0){w=!!n,k(),d()||(l.pause(),u(Xn))}function S(){w||(m||y?x(!1):b())}function k(){p&&(L(p,tn,!w),D(p,nn,e.i18n[w?"play":"pause"]))}function E(n){n=t.Slides.getAt(n);l.set(n&&+N(n.slide,Rt)||e.interval)}return{mount:function(){g&&(s&&r(h,"mouseenter mouseleave",n=>{m="mouseenter"===n.type,S()}),a&&r(h,"focusin focusout",n=>{y="focusin"===n.type,S()}),p&&r(p,"click",()=>{w?b():x(!0)}),i([J,jn,K],l.rewind),i(J,E),p&&D(p,Vn,v.track.id),w||b(),k())},destroy:l.cancel,play:b,pause:x,isPaused:d}},Scroll:(n,c,r,t)=>{const{on:e,emit:s}=t,{set:a}=n["state"],f=c["Move"],{getPosition:l,getLimit:u,exceededLimit:d,translate:v}=f,h=n.is(en);let p,g,m=1;function y(n,t,e,o,i){var r,u=l(),e=(x(),!e||h&&d()||(e=c.Layout.sliderSize(),r=Sn(n)*e*bn(B(n)/e)||0,n=f.toPosition(c.Controller.toDest(n%e))+r),kn(u,n,1)||0===t);m=1,t=e?0:t||wn(B(n-u)/1.5,800),g=o,p=Pn(t,w,T(b,u,n,i),1),a(F),s(jn),p.start()}function w(){a(3),g&&g(),s(V)}function b(n,t,e,o){var i=l(),t=(n+(t-n)*function(n){const t=r["easingFunc"];return t?t(n):1-Math.pow(1-n,4)}(o)-i)*m;v(i+t),h&&!e&&d()&&(m*=.6,B(t)<10&&y(u(d(!0)),600,!1,g,!0))}function x(){p&&p.cancel()}function o(){p&&!p.isPaused()&&(x(),w())}return{mount:function(){e(J,x),e([U,K],o)},destroy:x,scroll:y,cancel:o}},Drag:(c,s,a,n)=>{const{on:t,emit:f,bind:e}=n,l=n.create(),d=c["state"],{Move:u,Scroll:v,Controller:h,Elements:{track:i},Breakpoints:{reduce:p}}=s,{resolve:o,orient:g}=s.Direction,{getPosition:m,exceededLimit:y}=u;let w,r,b,x,S,k=!1,E,A,$;function z(){var n=a["drag"];T(!n),x="free"===n}function M(n){var t,e,o;E=!1,A||(t=I(n),e=n.target,o=a.noDrag,an(e,`.${xt}, .`+mt)||o&&an(e,o)||!t&&n.button||(h.isBusy()?X(n,!0):($=t?i:window,S=d.is([R,F]),b=null,l.bind($,Tt,N,rn),l.bind($,Mt,L,rn),u.cancel(),v.cancel(),P(n))))}function N(n){if(d.is(6)||(d.set(6),f("drag")),function(n){if(a.releaseTouch&&c.is(en)&&I(n)){var t=c["index"],n=_(n);if(y()||0===t&&0<n||t===c.length-1&&n<0)return 1}return}(n))return L(n);var t,e,o,i,r;n.cancelable&&(S?(u.translate(w+_(n)/(k&&c.is(en)?5:1)),r=200<O(n),t=k!==(k=y()),(r||t)&&P(n),E=!0,f("dragging"),X(n)):(r=n,B(_(r))>B(_(r,!0))&&(S=(t=n,e=a.dragMinThreshold,o=cn(e),i=o&&e.mouse||0,o=(o?e.touch:+e)||10,B(_(t))>(I(t)?o:i)),X(n))))}function L(n){if(d.is(6)&&(d.set(3),f("dragged")),S){{var t=n;const{updateOnDragged:e=!0}=a,o=function(n){if(c.is(on)||!k){var t=O(n);if(t&&t<200)return _(n)/t}return 0}(t),i=function(n){return m()+Sn(n)*Y(B(n)*(a.flickPower||600),x?1/0:s.Layout.listSize()*(a.flickMaxPages||1))}(o),r=a.rewind&&a.rewindByDrag,u=(e?h:v).scroll;p(!1),x?u(i,void 0,a.snap):c.is(Nt)?h.go(g(Sn(o))<0?r?"<":"-":r?">":"+"):c.is(en)&&k&&r?h.go(y(!0)?">":"<"):h.go(h.toDest(i),!0);p(!0)}X(n)}l.destroy(),S=!1,k=!1}function j(n){!A&&E&&X(n,!0)}function P(n){b=r,r=n,w=m()}function _(n,t){return D(n,t)-D(C(n),t)}function O(n){return yn(n)-yn(C(n))}function C(n){return r===n&&b||r}function D(n,t){return(I(n)?n.changedTouches[0]:n)["page"+o(t?"Y":"X")]}function I(n){return"undefined"!=typeof TouchEvent&&n instanceof TouchEvent}function T(n){A=n}return{mount:function(){e(i,Tt,un,rn),e(i,Mt,un,rn),e(i,It,M,rn),e(i,"click",j,{capture:!0}),e(i,"dragstart",X),t([H,U],z)},disable:T,isDragging:function(){return S}}},Keyboard:(t,n,e,o)=>{const i=o["destroy"],r=n.Direction["resolve"];function u(){var n=e["keyboard"];i(),n&&o.bind("global"===n?window:t.root,"keydown",c),o.on(U,u)}function c(n){n.key===r(Hn)?(t.go("<"),X(n,!0)):n.key===r(Jn)&&(t.go(">"),X(n,!0))}return{mount:u,destroy:i,disable:function(n){(n?i:u)()}}},LazyLoad:(e,n,i,t)=>{const{on:o,off:r,bind:u,emit:c}=t,s="sequential"===i.lazyLoad,a=[_n,V];let f=[];function l(){_(f),n.Slides.forEach(o=>{mn(o.slide,Xt).forEach(n=>{var t=N(n,Ft),e=N(n,Gt);t===n.src&&e===n.srcset||(e=fn(t=n.parentElement,"."+Et)||I("span",i.classes.spinner,t),f.push([n,o,e]),n.src||dn(n,"none"))})}),(s?p:(r(a),o(a,d),d))()}function d(){(f=f.filter(n=>{var t=i.perPage*((i.preloadPages||1)+1)-1;return!n[1].isWithin(e.index,t)||v(n)})).length||r(a)}function v(n){var[t]=n;O(n[1].slide,Pt),u(t,"load error",T(h,n)),D(t,"src",N(t,Ft)),D(t,"srcset",N(t,Gt)),C(t,[Ft,Gt])}function h(n,t){var[e,o]=n;W(o.slide,Pt),"error"!==t.type?(G(n[2]),dn(e,""),c("lazyload:loaded",e,o),c(Mn)):c("lazyload:error",e,o),s&&p()}function p(){f.length&&v(f.shift())}return{mount:function(){i.lazyLoad&&(l(),o(K,l))},destroy:T(_,f),check:d}},Pagination:(l,n,d,t)=>{const{on:v,emit:h,bind:p}=t,{Slides:g,Elements:m,Controller:y}=n,{hasFocus:w,getIndex:o,go:u}=y,c=n.Direction["resolve"],b=m["pagination"],x=[];let S,k;function E(){S&&(G(b?s(S.children):S),W(S,k),_(x),S=null),t.destroy()}function A(n){u(">"+n,!0)}function $(n,t){var e=x["length"],o=t["key"],i=z();let r=-1;o===c(Jn,!1,i)?r=++n%e:o===c(Hn,!1,i)?r=(--n+e)%e:"Home"===o?r=0:"End"===o&&(r=e-1);i=x[r];i&&(vn(i.button),u(">"+r),X(t,!0))}function z(){return d.paginationDirection||d.direction}function L(n){return x[y.toPage(n)]}function P(){var n,t=L(o(!0)),e=L(o());t&&(n=t["button"],W(n,tn),C(n,Zn),D(n,Z,-1)),e&&(n=e["button"],O(n,tn),D(n,Zn,!0),D(n,Z,"")),h("pagination:updated",{list:S,items:x},t,e)}return{items:x,mount:function n(){E(),v([U,K,Bn],n);var{pagination:t=!0}=d;if(b&&dn(b,t?"":"none"),t){v([J,jn,V],P);var t=l.length,{classes:e,i18n:o,perPage:i,paginationKeyboard:r=!0}=d,u=w()?y.getEnd()+1:xn(t/i);O(S=b||I("ul",e.pagination,m.track.parentElement),k=bt+"--"+z()),D(S,Q,"tablist"),D(S,nn,o.select),D(S,et,z()===Kn?"vertical":"");for(let n=0;n<u;n++){var c=I("li",null,S),s=I("button",{class:e.page,type:"button"},c);const f=g.getIn(n).map(n=>n.slide.id);var a=!w()&&1<i?o.pageX:o.slideX;p(s,"click",T(A,n)),r&&p(s,"keydown",T($,n)),D(c,Q,"presentation"),D(s,Q,"tab"),D(s,Vn,f.join(" ")),D(s,nn,An(a,n+1)),D(s,Z,-1),x.push({li:c,button:s,page:n})}P(),h("pagination:mounted",{list:S,items:x},L(l.index))}},destroy:E,getAt:L,update:P}},Sync:(e,n,t,o)=>{const{isNavigation:i,slideFocus:r}=t,u=[];function c(){if(e.splides.forEach(n=>{n.isParent||(a(e,n.splide),a(n.splide,e))}),i){const n=o.create(),t=n["on"];t(On,l),t(Wn,d),t([H,U],f),u.push(n),n.emit(Fn,e.splides)}}function s(){u.forEach(n=>{n.destroy()}),_(u)}function a(n,o){const t=n.event.create();t.on(J,(n,t,e)=>{o.go(o.is(on)?e:n)}),u.push(t)}function f(){D(n.Elements.list,et,t.direction===Kn?"vertical":"")}function l(n){e.go(n.index)}function d(n,t){x(Wt,t.key)&&(l(n),X(t))}return{setup:T(n.Breakpoints.set,{slideFocus:sn(r)?i:r},!0),mount:c,destroy:s,remount:function(){s(),c()}}},Wheel:(u,c,s,t)=>{let a=0;function e(n){var t,e,o,i,r;n.cancelable&&(e=(t=function(n){var{wheelAxis:t="y"}=s,{deltaX:n,deltaY:e}=n,n=x(t,"x")?c.Direction.orient(-n):0,t=x(t,"y")?e:0;return n||t}(n))<0,o=yn(n),r=s.wheelMinThreshold||0,i=s.wheelSleep||0,B(t)>r&&o-a>i&&(u.go(t<0?"<":">"),a=o),r=e,s.releaseWheel&&!u.state.is(R)&&-1===c.Controller.getAdjacent(r)||X(n))}return{mount:function n(){t.destroy(),s.wheel&&t.bind(c.Elements.track,"wheel",e,rn),t.on(U,n)}}},Live:(n,t,e,o)=>{const i=o["on"],r=t.Elements["track"];var{live:o=!0}=e;const u=o&&!e.isNavigation,c=I("span",At),s=Pn(90,T(a,!1));function a(n){D(r,rt,n),n?(A(r,c),s.start()):(G(c),s.cancel())}function f(n){u&&D(r,it,n?"off":"polite")}return{mount:function(){u&&(f(!t.Autoplay.isPaused()),D(r,ut,!0),c.textContent="…",i(Gn,T(f,!0)),i(Xn,T(f,!1)),i([_n,V],T(a,!0)))},disable:f,destroy:function(){C(r,[it,ut,rt]),G(c)}}}};const Bt={type:"slide",speed:400,perPage:1,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",classes:n,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 a slide to show",slideLabel:"%s of %s"},reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}},qt=(n,t,e,o)=>{const i=t["Slides"];function r(){i.forEach(n=>{n.style("transform",`translateX(-${100*n.index}%)`)})}return{mount:function(){o.on([H,K],r)},start:function(n,t){i.style("transition",`opacity ${e.speed}ms `+e.easing),u(t)},cancel:un}},Ht=(r,n,u,t)=>{const{Move:c,Controller:s,Scroll:a}=n,e=n.Elements["list"],f=T(P,e,"transition");let l;function o(){f(""),a.cancel()}return{mount:function(){t.bind(e,"transitionend",n=>{n.target===e&&l&&(o(),l())})},start:function(n,t){var e=c.toPosition(n,!0),o=c.getPosition(),i=function(n){var t=u["rewindSpeed"];if(r.is(en)&&t){var e=s.getIndex(!0),o=s.getEnd();if(0===e&&o<=n||o<=e&&0===n)return t}return u.speed}(n);1<=B(e-o)&&1<=i?u.useScroll?a.scroll(e,i,!1,t):(f(`transform ${i}ms `+u.easing),c.translate(e,!0),l=t):(c.jump(n),t())},cancel:o}};return class Jt{static defaults={};static STATES=e;root;event=function n(t=Ln(),e=l()){return ln({},t,e,{create:function(){return n(t.create(),e.create())},destroy:function(){t.destroy(),e.destroy()}})}();Components={};state=d(1);splides=[];n={};t;e={};o;constructor(n,t={}){Dt(n=M(n)?gn(document,n):n,n+" is invalid."),t=h({label:N(this.root=n,nn)||"",labelledby:N(n,nt)||""},Bt,Jt.defaults,t);try{h(t,JSON.parse(N(n,at)))}catch(n){Dt(!1,"Invalid JSON")}this.n=Object.create(h({},t))}mount(n=this.e,t=this.o){const{state:e,Components:o}=this;return Dt(e.is([1,7]),"Already mounted!"),e.set(1),this.t=o,this.o=t||(this.is(Nt)?qt:Ht),this.e=n,c(ln({},Yt,this.e,{Transition:this.o}),(n,t)=>{const e=n(this,o,this.n,this.event.create());(o[t]=e).setup&&e.setup()}),c(o,n=>{n.mount&&n.mount()}),this.emit(H),O(this.root,"is-initialized"),e.set(3),this.emit("ready"),this}sync(n){return this.splides.push({splide:n}),n.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this.t.Sync.remount(),n.Components.Sync.remount()),this}go(n){return this.t.Controller.go(n),this}jump(n){return this.t.Controller.jump(n),this}on(n,t){return this.event.on(n,t),this}off(n,t){return this.event.off(n,t),this}emit(n,...t){return this.event.emit(n,...t),this}add(n,t){return this.t.Slides.add(n,t),this}remove(n){return this.t.Slides.remove(n),this}is(n){return this.n.type===n}refresh(){return this.emit(K),this}destroy(t=!0){const{event:n,state:e}=this;return e.is(1)?this.on("ready",this.destroy.bind(this,t)):(c(this.t,n=>{n.destroy&&n.destroy(t)},!0),n.emit("destroy"),n.destroy(),t&&_(this.splides),e.set(7)),this}get options(){return this.n}set options(n){this.t.Breakpoints.set(n,!0,!0)}get length(){return this.t.Slides.getLength(!0)}get index(){return this.t.Controller.getIndex()}}},"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();
  8. //# sourceMappingURL=splide.min.js.map