splide.js 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466
  1. /*!
  2. * Splide.js
  3. * Version : 4.1.3
  4. * License : MIT
  5. * Copyright: 2022 Naotoshi Fujita
  6. */
  7. (function (global, factory) {
  8. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  9. typeof define === 'function' && define.amd ? define(factory) :
  10. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Splide = factory());
  11. })(this, (function () { 'use strict';
  12. const MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
  13. const CREATED = 1;
  14. const MOUNTED = 2;
  15. const IDLE = 3;
  16. const MOVING = 4;
  17. const SCROLLING = 5;
  18. const DRAGGING = 6;
  19. const DESTROYED = 7;
  20. const STATES = {
  21. CREATED,
  22. MOUNTED,
  23. IDLE,
  24. MOVING,
  25. SCROLLING,
  26. DRAGGING,
  27. DESTROYED
  28. };
  29. function N(n) {
  30. n.length = 0;
  31. }
  32. function a(n, ...t) {
  33. return n.bind(null, ...t);
  34. }
  35. const dn = setTimeout, an = () => {
  36. };
  37. function P(n) {
  38. return requestAnimationFrame(n);
  39. }
  40. function m(n, t) {
  41. return typeof t === n;
  42. }
  43. function y(n) {
  44. return !S(n) && m("object", n);
  45. }
  46. const g = Array.isArray, ln = a(m, "function"), p = a(m, "string"); a(m, "boolean"); const Z = a(m, "undefined");
  47. function S(n) {
  48. return n === null;
  49. }
  50. function x(n) {
  51. try {
  52. return n instanceof (n.ownerDocument.defaultView || window).HTMLElement;
  53. } catch {
  54. return false;
  55. }
  56. }
  57. function q(n) {
  58. return g(n) ? n : [n];
  59. }
  60. function d(n, t) {
  61. q(n).forEach(t);
  62. }
  63. function G(n, t) {
  64. return n.includes(t);
  65. }
  66. function pn(n, t) {
  67. return n.push(...q(t)), n;
  68. }
  69. const D = Array.prototype;
  70. function F(n, t, e) {
  71. return D.slice.call(n, t, e);
  72. }
  73. function I(n, t, e) {
  74. n && d(p(t) ? t.split(" ") : t, (i) => {
  75. i && n.classList.toggle(i, e);
  76. });
  77. }
  78. function J(n, t) {
  79. I(n, t, true);
  80. }
  81. function Q(n, t) {
  82. d(t, n.appendChild.bind(n));
  83. }
  84. function yn(n, t) {
  85. d(n, (e) => {
  86. const i = (t || e).parentNode;
  87. i && i.insertBefore(e, t);
  88. });
  89. }
  90. function W(n, t) {
  91. return x(n) && n.matches(t);
  92. }
  93. function X(n, t) {
  94. const e = n ? F(n.children) : [];
  95. return t ? e.filter((i) => W(i, t)) : e;
  96. }
  97. function Y(n, t) {
  98. return t ? X(n, t)[0] : n.firstElementChild;
  99. }
  100. function En(n, t) {
  101. return n.closest(t);
  102. }
  103. const v = Object.assign, A = Object.keys;
  104. function L(n, t, e) {
  105. return n && (e ? A(n).reverse() : A(n)).forEach((i) => {
  106. i !== "__proto__" && t(n[i], i);
  107. }), n;
  108. }
  109. function k(n, ...t) {
  110. return t.forEach((e) => {
  111. L(e, (i, r) => {
  112. g(i) ? i = i.slice() : y(i) && (i = k({}, y(n[r]) ? n[r] : {}, i)), n[r] = i;
  113. });
  114. }), n;
  115. }
  116. function gn(n, t) {
  117. return d(t || A(n), (e) => {
  118. delete n[e];
  119. }), n;
  120. }
  121. function U(n, t) {
  122. d(n, (e) => {
  123. d(t, (i) => {
  124. e && e.removeAttribute(i);
  125. });
  126. });
  127. }
  128. function M(n, t, e) {
  129. y(t) ? L(t, (i, r) => {
  130. M(n, r, i);
  131. }) : d(n, (i) => {
  132. S(e) || e === "" ? U(i, t) : i.setAttribute(t, String(e));
  133. });
  134. }
  135. function j(n, t, e) {
  136. const i = document.createElement(n);
  137. return t && (p(t) ? J(i, t) : M(i, t)), e && Q(e, i), i;
  138. }
  139. function nn(n, t, e) {
  140. if (Z(e))
  141. return getComputedStyle(n)[t];
  142. S(e) || (n.style[t] = `${e}`);
  143. }
  144. function An(n, t) {
  145. nn(n, "display", t);
  146. }
  147. function $n(n) {
  148. x(n) && n.focus({ preventScroll: true });
  149. }
  150. function wn(n, t) {
  151. return n.getAttribute(t);
  152. }
  153. function Cn(n, t) {
  154. return !!n && n.classList.contains(t);
  155. }
  156. function tn(n) {
  157. return n.getBoundingClientRect();
  158. }
  159. function en(n) {
  160. d(n, (t) => {
  161. t && t.parentNode && t.parentNode.removeChild(t);
  162. });
  163. }
  164. function qn(n) {
  165. return Y(new DOMParser().parseFromString(n, "text/html").body);
  166. }
  167. function Ln(n, t) {
  168. n.preventDefault(), t && (n.stopPropagation(), n.stopImmediatePropagation());
  169. }
  170. function On(n, t) {
  171. return n && n.querySelector(t);
  172. }
  173. function Tn(n, t) {
  174. return t && n ? F(n.querySelectorAll(t)) : [];
  175. }
  176. function Pn(n, t) {
  177. I(n, t, false);
  178. }
  179. function Bn(n) {
  180. return n.timeStamp;
  181. }
  182. function Nn(n) {
  183. return p(n) ? n : n ? `${n}px` : "";
  184. }
  185. function rn(n) {
  186. let t = "";
  187. return L(n, (e, i) => {
  188. t += e || e === 0 ? ` ${i}${e !== true ? `="${e}"` : ""}` : "";
  189. }), t.trim();
  190. }
  191. function _(...n) {
  192. return n.reduce((t, e) => `${t} ${g(e) ? _(...e) : e || ""}`.trim(), "");
  193. }
  194. function on(n, t) {
  195. return t = g(t) || !y(t) ? { class: _(t) } : t, `<${`${n} ${t ? rn(t) : ""}`.trim()}>`;
  196. }
  197. a(on, "div"); const { min: E, max: $, floor: Dn, ceil: Fn, abs: un, sign: In } = Math;
  198. function Mn(n, t, e) {
  199. return un(n - t) < e;
  200. }
  201. function _n(n, t, e, i) {
  202. const r = E(t, e), o = $(t, e);
  203. return i ? r < n && n < o : r <= n && n <= o;
  204. }
  205. function bn(n, t, e) {
  206. const i = E(t, e), r = $(t, e);
  207. return E($(i, n), r);
  208. }
  209. function Kn(n, t) {
  210. return d(t, (e) => {
  211. n = n.replace("%s", `${e}`);
  212. }), n;
  213. }
  214. function cn(n, t = 2) {
  215. return `${n}`.padStart(t, "0");
  216. }
  217. const B = {};
  218. function zn(n) {
  219. return `${n}${cn(B[n] = (B[n] || 0) + 1)}`;
  220. }
  221. function w(n, t) {
  222. d(n, (e) => {
  223. p(e) && e.split(" ").forEach(t);
  224. });
  225. }
  226. function C(n, t) {
  227. const e = [];
  228. for (let i = n.length - 1; i >= 0; i--)
  229. t(n[i]) && e.push(...n.splice(i, 1));
  230. return e;
  231. }
  232. function b(n) {
  233. const t = n || [], e = n ? {} : void 0;
  234. function i(o, f, u, c) {
  235. w(f, (s) => {
  236. o.addEventListener(s, u, c), t.push([o.removeEventListener.bind(o, s, u, c), e]);
  237. });
  238. }
  239. function r() {
  240. e ? C(t, (o) => o[1] === e).forEach((o) => {
  241. o[0]();
  242. }) : (t.forEach((o) => {
  243. o[0]();
  244. }), N(t));
  245. }
  246. return {
  247. bind: i,
  248. create: a(b, t),
  249. destroy: r
  250. };
  251. }
  252. function H(n) {
  253. const t = n || [], e = n ? {} : void 0;
  254. function i(u, c) {
  255. w(u, (s) => {
  256. t.push([s, c, e]);
  257. });
  258. }
  259. function r(u, c) {
  260. w(u, (s) => {
  261. C(t, (l) => l[0] === s && (!c || l[1] === c) && l[2] === e);
  262. });
  263. }
  264. function o(u, ...c) {
  265. t.slice().forEach((s) => {
  266. s[0] === u && s[1](...c);
  267. });
  268. }
  269. function f() {
  270. e ? C(t, (u) => u[2] === e) : N(t);
  271. }
  272. return {
  273. on: i,
  274. off: r,
  275. emit: o,
  276. create: a(H, t),
  277. destroy: f
  278. };
  279. }
  280. function fn(n = b(), t = H()) {
  281. function e() {
  282. return fn(n.create(), t.create());
  283. }
  284. function i() {
  285. n.destroy(), t.destroy();
  286. }
  287. return v({}, n, t, { create: e, destroy: i });
  288. }
  289. function sn(n, t, e, i) {
  290. const { now: r } = Date;
  291. let o, f = 0, u, c = true, s = 0;
  292. function l() {
  293. if (!c) {
  294. if (f = n ? E((r() - o) / n, 1) : 1, e && e(f), f >= 1 && (t(), o = r(), i && ++s >= i))
  295. return O();
  296. u = P(l);
  297. }
  298. }
  299. function K(h) {
  300. h || T(), o = r() - (h ? f * n : 0), c = false, u = P(l);
  301. }
  302. function O() {
  303. c = true;
  304. }
  305. function z() {
  306. o = r(), f = 0, e && e(f);
  307. }
  308. function T() {
  309. u && cancelAnimationFrame(u), f = 0, u = 0, c = true;
  310. }
  311. function R(h) {
  312. n = h;
  313. }
  314. function V() {
  315. return c;
  316. }
  317. return {
  318. start: K,
  319. rewind: z,
  320. pause: O,
  321. cancel: T,
  322. set: R,
  323. isPaused: V
  324. };
  325. }
  326. function Rn(n) {
  327. let t = n;
  328. function e(r) {
  329. t = r;
  330. }
  331. function i(r) {
  332. return G(q(r), t);
  333. }
  334. return { set: e, is: i };
  335. }
  336. function Vn(n, t) {
  337. const e = sn(t || 0, n, void 0, 1);
  338. return () => {
  339. e.isPaused() && e.start();
  340. };
  341. }
  342. const EVENT_MOUNTED = "mounted";
  343. const EVENT_READY = "ready";
  344. const EVENT_MOVE = "move";
  345. const EVENT_MOVED = "moved";
  346. const EVENT_CLICK = "click";
  347. const EVENT_ACTIVE = "active";
  348. const EVENT_INACTIVE = "inactive";
  349. const EVENT_VISIBLE = "visible";
  350. const EVENT_HIDDEN = "hidden";
  351. const EVENT_REFRESH = "refresh";
  352. const EVENT_UPDATED = "updated";
  353. const EVENT_RESIZE = "resize";
  354. const EVENT_RESIZED = "resized";
  355. const EVENT_DRAG = "drag";
  356. const EVENT_DRAGGING = "dragging";
  357. const EVENT_DRAGGED = "dragged";
  358. const EVENT_SCROLL = "scroll";
  359. const EVENT_SCROLLED = "scrolled";
  360. const EVENT_OVERFLOW = "overflow";
  361. const EVENT_DESTROY = "destroy";
  362. const EVENT_ARROWS_MOUNTED = "arrows:mounted";
  363. const EVENT_ARROWS_UPDATED = "arrows:updated";
  364. const EVENT_PAGINATION_MOUNTED = "pagination:mounted";
  365. const EVENT_PAGINATION_UPDATED = "pagination:updated";
  366. const EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
  367. const EVENT_AUTOPLAY_PLAY = "autoplay:play";
  368. const EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
  369. const EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
  370. const EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
  371. const EVENT_SLIDE_KEYDOWN = "sk";
  372. const EVENT_SHIFTED = "sh";
  373. const EVENT_END_INDEX_CHANGED = "ei";
  374. const NOT_OVERFLOW_KEY = "!overflow";
  375. function Media(Splide2, Components2, options, event) {
  376. const { state } = Splide2;
  377. const breakpoints = options.breakpoints || {};
  378. const reducedMotion = options.reducedMotion || {};
  379. const binder = b();
  380. const entries = [];
  381. function setup() {
  382. const isMin = options.mediaQuery === "min";
  383. A(breakpoints).sort((n, m) => isMin ? +n - +m : +m - +n).forEach((key) => {
  384. if (key !== NOT_OVERFLOW_KEY) {
  385. register(breakpoints[key], `(${isMin ? "min" : "max"}-width:${key}px)`);
  386. }
  387. });
  388. if (breakpoints[NOT_OVERFLOW_KEY]) {
  389. entries.push([breakpoints[NOT_OVERFLOW_KEY], () => Components2.Layout && !Components2.Layout.isOverflow()]);
  390. event.on(EVENT_OVERFLOW, update);
  391. }
  392. register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION);
  393. update();
  394. }
  395. function destroy(completely) {
  396. if (completely) {
  397. binder.destroy();
  398. }
  399. }
  400. function register(options2, query) {
  401. const queryList = matchMedia(query);
  402. binder.bind(queryList, "change", update);
  403. entries.push([options2, () => queryList.matches]);
  404. }
  405. function update() {
  406. const destroyed = state.is(DESTROYED);
  407. const direction = options.direction;
  408. const merged = entries.reduce((merged2, entry) => {
  409. return k(merged2, entry[1]() ? entry[0] : {});
  410. }, {});
  411. gn(options);
  412. set(merged);
  413. if (options.destroy) {
  414. Splide2.destroy(options.destroy === "completely");
  415. } else if (destroyed) {
  416. destroy(true);
  417. Splide2.mount();
  418. } else {
  419. direction !== options.direction && Splide2.refresh();
  420. }
  421. }
  422. function reduce(enable) {
  423. if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) {
  424. enable ? k(options, reducedMotion) : gn(options, A(reducedMotion));
  425. }
  426. }
  427. function set(opts, base, notify) {
  428. k(options, opts);
  429. base && k(Object.getPrototypeOf(options), opts);
  430. if (notify || !state.is(CREATED)) {
  431. Splide2.emit(EVENT_UPDATED, options);
  432. }
  433. }
  434. return {
  435. setup,
  436. destroy,
  437. reduce,
  438. set
  439. };
  440. }
  441. const ARROW = "Arrow";
  442. const ARROW_LEFT = `${ARROW}Left`;
  443. const ARROW_RIGHT = `${ARROW}Right`;
  444. const ARROW_UP = `${ARROW}Up`;
  445. const ARROW_DOWN = `${ARROW}Down`;
  446. const RTL = "rtl";
  447. const TTB = "ttb";
  448. const ORIENTATION_MAP = {
  449. width: ["height"],
  450. left: ["top", "right"],
  451. right: ["bottom", "left"],
  452. x: ["y"],
  453. X: ["Y"],
  454. Y: ["X"],
  455. ArrowLeft: [ARROW_UP, ARROW_RIGHT],
  456. ArrowRight: [ARROW_DOWN, ARROW_LEFT]
  457. };
  458. function Direction(Splide2, Components2, options) {
  459. function resolve(prop, axisOnly, direction) {
  460. direction = direction || options.direction;
  461. const index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
  462. return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, (match, offset) => {
  463. const replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match;
  464. return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement;
  465. });
  466. }
  467. function orient(value) {
  468. return value * (options.direction === RTL ? 1 : -1);
  469. }
  470. return {
  471. resolve,
  472. orient
  473. };
  474. }
  475. const ROLE = "role";
  476. const TAB_INDEX = "tabindex";
  477. const DISABLED = "disabled";
  478. const ARIA_PREFIX = "aria-";
  479. const ARIA_CONTROLS = `${ARIA_PREFIX}controls`;
  480. const ARIA_CURRENT = `${ARIA_PREFIX}current`;
  481. const ARIA_SELECTED = `${ARIA_PREFIX}selected`;
  482. const ARIA_LABEL = `${ARIA_PREFIX}label`;
  483. const ARIA_LABELLEDBY = `${ARIA_PREFIX}labelledby`;
  484. const ARIA_HIDDEN = `${ARIA_PREFIX}hidden`;
  485. const ARIA_ORIENTATION = `${ARIA_PREFIX}orientation`;
  486. const ARIA_ROLEDESCRIPTION = `${ARIA_PREFIX}roledescription`;
  487. const ARIA_LIVE = `${ARIA_PREFIX}live`;
  488. const ARIA_BUSY = `${ARIA_PREFIX}busy`;
  489. const ARIA_ATOMIC = `${ARIA_PREFIX}atomic`;
  490. const ALL_ATTRIBUTES = [
  491. ROLE,
  492. TAB_INDEX,
  493. DISABLED,
  494. ARIA_CONTROLS,
  495. ARIA_CURRENT,
  496. ARIA_LABEL,
  497. ARIA_LABELLEDBY,
  498. ARIA_HIDDEN,
  499. ARIA_ORIENTATION,
  500. ARIA_ROLEDESCRIPTION
  501. ];
  502. const PROJECT_CODE = "splide";
  503. const DATA_ATTRIBUTE = `data-${PROJECT_CODE}`;
  504. const CLASS_PREFIX = `${PROJECT_CODE}__`;
  505. const STATUS_CLASS_PREFIX = "is-";
  506. const CLASS_ROOT = PROJECT_CODE;
  507. const CLASS_TRACK = `${CLASS_PREFIX}track`;
  508. const CLASS_LIST = `${CLASS_PREFIX}list`;
  509. const CLASS_SLIDE = `${CLASS_PREFIX}slide`;
  510. const CLASS_CLONE = `${CLASS_SLIDE}--clone`;
  511. const CLASS_CONTAINER = `${CLASS_SLIDE}__container`;
  512. const CLASS_ARROWS = `${CLASS_PREFIX}arrows`;
  513. const CLASS_ARROW = `${CLASS_PREFIX}arrow`;
  514. const CLASS_ARROW_PREV = `${CLASS_ARROW}--prev`;
  515. const CLASS_ARROW_NEXT = `${CLASS_ARROW}--next`;
  516. const CLASS_PAGINATION = `${CLASS_PREFIX}pagination`;
  517. const CLASS_PAGINATION_PAGE = `${CLASS_PAGINATION}__page`;
  518. const CLASS_PROGRESS = `${CLASS_PREFIX}progress`;
  519. const CLASS_PROGRESS_BAR = `${CLASS_PROGRESS}__bar`;
  520. const CLASS_TOGGLE = `${CLASS_PREFIX}toggle`;
  521. const CLASS_SPINNER = `${CLASS_PREFIX}spinner`;
  522. const CLASS_SR = `${CLASS_PREFIX}sr`;
  523. const CLASS_INITIALIZED = `${STATUS_CLASS_PREFIX}initialized`;
  524. const CLASS_ACTIVE = `${STATUS_CLASS_PREFIX}active`;
  525. const CLASS_PREV = `${STATUS_CLASS_PREFIX}prev`;
  526. const CLASS_NEXT = `${STATUS_CLASS_PREFIX}next`;
  527. const CLASS_VISIBLE = `${STATUS_CLASS_PREFIX}visible`;
  528. const CLASS_LOADING = `${STATUS_CLASS_PREFIX}loading`;
  529. const CLASS_FOCUS_IN = `${STATUS_CLASS_PREFIX}focus-in`;
  530. const CLASS_OVERFLOW = `${STATUS_CLASS_PREFIX}overflow`;
  531. const STATUS_CLASSES = [
  532. CLASS_ACTIVE,
  533. CLASS_VISIBLE,
  534. CLASS_PREV,
  535. CLASS_NEXT,
  536. CLASS_LOADING,
  537. CLASS_FOCUS_IN,
  538. CLASS_OVERFLOW
  539. ];
  540. const CLASSES = {
  541. slide: CLASS_SLIDE,
  542. clone: CLASS_CLONE,
  543. arrows: CLASS_ARROWS,
  544. arrow: CLASS_ARROW,
  545. prev: CLASS_ARROW_PREV,
  546. next: CLASS_ARROW_NEXT,
  547. pagination: CLASS_PAGINATION,
  548. page: CLASS_PAGINATION_PAGE,
  549. spinner: CLASS_SPINNER
  550. };
  551. function assert(condition, message) {
  552. if (!condition) {
  553. throw new Error(`[${PROJECT_CODE}] ${message || ""}`);
  554. }
  555. }
  556. const FRICTION = 5;
  557. const LOG_INTERVAL = 200;
  558. const POINTER_DOWN_EVENTS = "touchstart mousedown";
  559. const POINTER_MOVE_EVENTS = "touchmove mousemove";
  560. const POINTER_UP_EVENTS = "touchend touchcancel mouseup click";
  561. function Elements(Splide2, Components2, options, event) {
  562. const { on, bind } = event;
  563. const { root } = Splide2;
  564. const { i18n } = options;
  565. const elements = {};
  566. const slides = [];
  567. let rootClasses = [];
  568. let trackClasses = [];
  569. let track;
  570. let list;
  571. let isUsingKey;
  572. function setup() {
  573. collect();
  574. init();
  575. update();
  576. }
  577. function mount() {
  578. on(EVENT_REFRESH, destroy);
  579. on(EVENT_REFRESH, setup);
  580. on(EVENT_UPDATED, update);
  581. bind(document, `${POINTER_DOWN_EVENTS} keydown`, (e) => {
  582. isUsingKey = e.type === "keydown";
  583. }, { capture: true });
  584. bind(root, "focusin", () => {
  585. I(root, CLASS_FOCUS_IN, !!isUsingKey);
  586. });
  587. }
  588. function destroy(completely) {
  589. const attrs = ALL_ATTRIBUTES.concat("style");
  590. N(slides);
  591. Pn(root, rootClasses);
  592. Pn(track, trackClasses);
  593. U([track, list], attrs);
  594. U(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]);
  595. }
  596. function update() {
  597. Pn(root, rootClasses);
  598. Pn(track, trackClasses);
  599. rootClasses = getClasses(CLASS_ROOT);
  600. trackClasses = getClasses(CLASS_TRACK);
  601. J(root, rootClasses);
  602. J(track, trackClasses);
  603. M(root, ARIA_LABEL, options.label);
  604. M(root, ARIA_LABELLEDBY, options.labelledby);
  605. }
  606. function collect() {
  607. track = find(CLASS_TRACK);
  608. list = Y(track, `.${CLASS_LIST}`);
  609. assert(track && list, "A track/list element is missing.");
  610. pn(slides, X(list, `.${CLASS_SLIDE}:not(.${CLASS_CLONE})`));
  611. v(elements, {
  612. root,
  613. track,
  614. list,
  615. slides,
  616. arrows: find(CLASS_ARROWS),
  617. pagination: find(CLASS_PAGINATION),
  618. prev: find(CLASS_ARROW_PREV),
  619. next: find(CLASS_ARROW_NEXT),
  620. bar: find(CLASS_PROGRESS_BAR),
  621. toggle: find(CLASS_TOGGLE)
  622. });
  623. }
  624. function init() {
  625. const id = root.id || zn(PROJECT_CODE);
  626. const role = options.role;
  627. root.id = id;
  628. track.id = track.id || `${id}-track`;
  629. list.id = list.id || `${id}-list`;
  630. if (!wn(root, ROLE) && root.tagName !== "SECTION" && role) {
  631. M(root, ROLE, role);
  632. }
  633. M(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
  634. M(list, ROLE, "presentation");
  635. }
  636. function find(className) {
  637. const elm = On(root, `.${className}`);
  638. return elm && En(elm, `.${CLASS_ROOT}`) === root ? elm : void 0;
  639. }
  640. function getClasses(base) {
  641. return [
  642. `${base}--${options.type}`,
  643. `${base}--${options.direction}`,
  644. options.drag && `${base}--draggable`,
  645. options.isNavigation && `${base}--nav`,
  646. base === CLASS_ROOT && CLASS_ACTIVE
  647. ];
  648. }
  649. return v(elements, {
  650. setup,
  651. mount,
  652. destroy
  653. });
  654. }
  655. const SLIDE = "slide";
  656. const LOOP = "loop";
  657. const FADE = "fade";
  658. function Slide$1(Splide2, index, slideIndex, slide) {
  659. const event = Splide2.event.create();
  660. const { on, emit, bind } = event;
  661. const { Components, root, options } = Splide2;
  662. const { isNavigation, updateOnMove, i18n, pagination, slideFocus } = options;
  663. const { Elements } = Components;
  664. const { resolve } = Components.Direction;
  665. const styles = wn(slide, "style");
  666. const label = wn(slide, ARIA_LABEL);
  667. const isClone = slideIndex > -1;
  668. const container = Y(slide, `.${CLASS_CONTAINER}`);
  669. let destroyed;
  670. function mount() {
  671. if (!isClone) {
  672. slide.id = `${root.id}-slide${cn(index + 1)}`;
  673. M(slide, ROLE, pagination ? "tabpanel" : "group");
  674. M(slide, ARIA_ROLEDESCRIPTION, i18n.slide);
  675. M(slide, ARIA_LABEL, label || Kn(i18n.slideLabel, [index + 1, Splide2.length]));
  676. }
  677. listen();
  678. }
  679. function listen() {
  680. bind(slide, "click", a(emit, EVENT_CLICK, self));
  681. bind(slide, "keydown", a(emit, EVENT_SLIDE_KEYDOWN, self));
  682. on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update);
  683. on(EVENT_NAVIGATION_MOUNTED, initNavigation);
  684. if (updateOnMove) {
  685. on(EVENT_MOVE, onMove);
  686. }
  687. }
  688. function destroy() {
  689. destroyed = true;
  690. event.destroy();
  691. Pn(slide, STATUS_CLASSES);
  692. U(slide, ALL_ATTRIBUTES);
  693. M(slide, "style", styles);
  694. M(slide, ARIA_LABEL, label || "");
  695. }
  696. function initNavigation() {
  697. const controls = Splide2.splides.map((target) => {
  698. const Slide2 = target.splide.Components.Slides.getAt(index);
  699. return Slide2 ? Slide2.slide.id : "";
  700. }).join(" ");
  701. M(slide, ARIA_LABEL, Kn(i18n.slideX, (isClone ? slideIndex : index) + 1));
  702. M(slide, ARIA_CONTROLS, controls);
  703. M(slide, ROLE, slideFocus ? "button" : "");
  704. slideFocus && U(slide, ARIA_ROLEDESCRIPTION);
  705. }
  706. function onMove() {
  707. if (!destroyed) {
  708. update();
  709. }
  710. }
  711. function update() {
  712. if (!destroyed) {
  713. const { index: curr } = Splide2;
  714. updateActivity();
  715. updateVisibility();
  716. I(slide, CLASS_PREV, index === curr - 1);
  717. I(slide, CLASS_NEXT, index === curr + 1);
  718. }
  719. }
  720. function updateActivity() {
  721. const active = isActive();
  722. if (active !== Cn(slide, CLASS_ACTIVE)) {
  723. I(slide, CLASS_ACTIVE, active);
  724. M(slide, ARIA_CURRENT, isNavigation && active || "");
  725. emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self);
  726. }
  727. }
  728. function updateVisibility() {
  729. const visible = isVisible();
  730. const hidden = !visible && (!isActive() || isClone);
  731. if (!Splide2.state.is([MOVING, SCROLLING])) {
  732. M(slide, ARIA_HIDDEN, hidden || "");
  733. }
  734. M(Tn(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
  735. if (slideFocus) {
  736. M(slide, TAB_INDEX, hidden ? -1 : 0);
  737. }
  738. if (visible !== Cn(slide, CLASS_VISIBLE)) {
  739. I(slide, CLASS_VISIBLE, visible);
  740. emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self);
  741. }
  742. if (!visible && document.activeElement === slide) {
  743. const Slide2 = Components.Slides.getAt(Splide2.index);
  744. Slide2 && $n(Slide2.slide);
  745. }
  746. }
  747. function style(prop, value, useContainer) {
  748. nn(useContainer && container || slide, prop, value);
  749. }
  750. function isActive() {
  751. const { index: curr } = Splide2;
  752. return curr === index || options.cloneStatus && curr === slideIndex;
  753. }
  754. function isVisible() {
  755. if (Splide2.is(FADE)) {
  756. return isActive();
  757. }
  758. const trackRect = tn(Elements.track);
  759. const slideRect = tn(slide);
  760. const left = resolve("left", true);
  761. const right = resolve("right", true);
  762. return Dn(trackRect[left]) <= Fn(slideRect[left]) && Dn(slideRect[right]) <= Fn(trackRect[right]);
  763. }
  764. function isWithin(from, distance) {
  765. let diff = un(from - index);
  766. if (!isClone && (options.rewind || Splide2.is(LOOP))) {
  767. diff = E(diff, Splide2.length - diff);
  768. }
  769. return diff <= distance;
  770. }
  771. function pos() {
  772. const first = Components.Slides.get()[0];
  773. const left = resolve("left");
  774. return first ? un(tn(slide)[left] - tn(first.slide)[left]) : 0;
  775. }
  776. function size() {
  777. return tn(slide)[resolve("width")];
  778. }
  779. const self = {
  780. index,
  781. slideIndex,
  782. slide,
  783. container,
  784. isClone,
  785. mount,
  786. destroy,
  787. update,
  788. pos,
  789. size,
  790. style,
  791. isWithin
  792. };
  793. return self;
  794. }
  795. function Slides(Splide2, Components2, options, event) {
  796. const { on, emit, bind } = event;
  797. const { slides, list } = Components2.Elements;
  798. const Slides2 = [];
  799. function mount() {
  800. init();
  801. on(EVENT_REFRESH, destroy);
  802. on(EVENT_REFRESH, init);
  803. }
  804. function init() {
  805. slides.forEach((slide, index) => {
  806. register(slide, index, -1);
  807. });
  808. }
  809. function destroy() {
  810. forEach((Slide2) => {
  811. Slide2.destroy();
  812. });
  813. N(Slides2);
  814. }
  815. function update() {
  816. forEach((Slide2) => {
  817. Slide2.update();
  818. });
  819. }
  820. function register(slide, index, slideIndex) {
  821. const object = Slide$1(Splide2, index, slideIndex, slide);
  822. object.mount();
  823. Slides2.push(object);
  824. Slides2.sort((Slide1, Slide2) => Slide1.index - Slide2.index);
  825. }
  826. function get(excludeClones) {
  827. return excludeClones ? filter((Slide2) => !Slide2.isClone) : Slides2;
  828. }
  829. function getIn(page) {
  830. const { Controller } = Components2;
  831. const index = Controller.toIndex(page);
  832. const max = Controller.hasFocus() ? 1 : options.perPage;
  833. return filter((Slide2) => _n(Slide2.index, index, index + max - 1));
  834. }
  835. function getAt(index) {
  836. return filter(index)[0];
  837. }
  838. function add(items, index) {
  839. d(items, (slide) => {
  840. if (p(slide)) {
  841. slide = qn(slide);
  842. }
  843. if (x(slide)) {
  844. const ref = slides[index];
  845. ref ? yn(slide, ref) : Q(list, slide);
  846. J(slide, options.classes.slide);
  847. observeImages(slide, a(emit, EVENT_RESIZE));
  848. }
  849. });
  850. emit(EVENT_REFRESH);
  851. }
  852. function remove(matcher) {
  853. en(filter(matcher).map((Slide2) => Slide2.slide));
  854. emit(EVENT_REFRESH);
  855. }
  856. function forEach(iteratee, excludeClones) {
  857. get(excludeClones).forEach(iteratee);
  858. }
  859. function filter(matcher) {
  860. return Slides2.filter(
  861. ln(matcher) ? matcher : (Slide2) => p(matcher) ? W(Slide2.slide, matcher) : G(q(matcher), Slide2.index)
  862. );
  863. }
  864. function style(prop, value, useContainer) {
  865. forEach((Slide2) => {
  866. Slide2.style(prop, value, useContainer);
  867. });
  868. }
  869. function observeImages(elm, callback) {
  870. const images = Tn(elm, "img");
  871. let { length } = images;
  872. if (length) {
  873. images.forEach((img) => {
  874. bind(img, "load error", () => {
  875. if (!--length) {
  876. callback();
  877. }
  878. });
  879. });
  880. } else {
  881. callback();
  882. }
  883. }
  884. function getLength(excludeClones) {
  885. return excludeClones ? slides.length : Slides2.length;
  886. }
  887. function isEnough() {
  888. return Slides2.length > options.perPage;
  889. }
  890. return {
  891. mount,
  892. destroy,
  893. update,
  894. register,
  895. get,
  896. getIn,
  897. getAt,
  898. add,
  899. remove,
  900. forEach,
  901. filter,
  902. style,
  903. getLength,
  904. isEnough
  905. };
  906. }
  907. function Layout(Splide2, Components2, options, event) {
  908. const { on, bind, emit } = event;
  909. const { Slides } = Components2;
  910. const { resolve } = Components2.Direction;
  911. const { root, track, list } = Components2.Elements;
  912. const { getAt, style: styleSlides } = Slides;
  913. let vertical;
  914. let rootRect;
  915. let overflow;
  916. function mount() {
  917. init();
  918. bind(window, "resize load", Vn(a(emit, EVENT_RESIZE)));
  919. on([EVENT_UPDATED, EVENT_REFRESH], init);
  920. on(EVENT_RESIZE, resize);
  921. }
  922. function init() {
  923. vertical = options.direction === TTB;
  924. nn(root, "maxWidth", Nn(options.width));
  925. nn(track, resolve("paddingLeft"), cssPadding(false));
  926. nn(track, resolve("paddingRight"), cssPadding(true));
  927. resize(true);
  928. }
  929. function resize(force) {
  930. const newRect = tn(root);
  931. if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) {
  932. nn(track, "height", cssTrackHeight());
  933. styleSlides(resolve("marginRight"), Nn(options.gap));
  934. styleSlides("width", cssSlideWidth());
  935. styleSlides("height", cssSlideHeight(), true);
  936. rootRect = newRect;
  937. emit(EVENT_RESIZED);
  938. if (overflow !== (overflow = isOverflow())) {
  939. I(root, CLASS_OVERFLOW, overflow);
  940. emit(EVENT_OVERFLOW, overflow);
  941. }
  942. }
  943. }
  944. function cssPadding(right) {
  945. const { padding } = options;
  946. const prop = resolve(right ? "right" : "left");
  947. return padding && Nn(padding[prop] || (y(padding) ? 0 : padding)) || "0px";
  948. }
  949. function cssTrackHeight() {
  950. let height = "";
  951. if (vertical) {
  952. height = cssHeight();
  953. assert(height, "height or heightRatio is missing.");
  954. height = `calc(${height} - ${cssPadding(false)} - ${cssPadding(true)})`;
  955. }
  956. return height;
  957. }
  958. function cssHeight() {
  959. return Nn(options.height || tn(list).width * options.heightRatio);
  960. }
  961. function cssSlideWidth() {
  962. return options.autoWidth ? null : Nn(options.fixedWidth) || (vertical ? "" : cssSlideSize());
  963. }
  964. function cssSlideHeight() {
  965. return Nn(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
  966. }
  967. function cssSlideSize() {
  968. const gap = Nn(options.gap);
  969. return `calc((100%${gap && ` + ${gap}`})/${options.perPage || 1}${gap && ` - ${gap}`})`;
  970. }
  971. function listSize() {
  972. return tn(list)[resolve("width")];
  973. }
  974. function slideSize(index = 0, withoutGap) {
  975. const Slide = getAt(index);
  976. return (Slide ? Slide.size() : 0) + (withoutGap ? 0 : getGap());
  977. }
  978. function totalSize(index, withoutGap) {
  979. const Slide = getAt(index);
  980. return Slide ? Slide.pos() + Slide.size() + (withoutGap ? 0 : getGap()) : 0;
  981. }
  982. function sliderSize(withoutGap) {
  983. return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap);
  984. }
  985. function getGap() {
  986. const first = getAt(0);
  987. const second = getAt(1);
  988. return first && second ? second.pos() - first.pos() - first.size() : 0;
  989. }
  990. function getPadding(right) {
  991. return parseFloat(nn(
  992. track,
  993. resolve(`padding${right ? "Right" : "Left"}`)
  994. )) || 0;
  995. }
  996. function isOverflow() {
  997. return Splide2.is(FADE) || sliderSize(true) > listSize();
  998. }
  999. return {
  1000. mount,
  1001. resize,
  1002. listSize,
  1003. slideSize,
  1004. sliderSize,
  1005. totalSize,
  1006. getPadding,
  1007. isOverflow
  1008. };
  1009. }
  1010. const MULTIPLIER = 2;
  1011. function Clones(Splide2, Components2, options, event) {
  1012. const { on } = event;
  1013. const { Elements, Slides, Layout: { resize } } = Components2;
  1014. const { resolve } = Components2.Direction;
  1015. const clones = [];
  1016. let cloneCount;
  1017. function mount() {
  1018. on(EVENT_REFRESH, remount);
  1019. on([EVENT_UPDATED, EVENT_RESIZE], observe);
  1020. if (cloneCount = computeCloneCount()) {
  1021. generate(cloneCount);
  1022. resize(true);
  1023. }
  1024. }
  1025. function remount() {
  1026. destroy();
  1027. mount();
  1028. resize(true);
  1029. }
  1030. function destroy() {
  1031. en(clones);
  1032. N(clones);
  1033. event.destroy();
  1034. }
  1035. function observe() {
  1036. const count = computeCloneCount();
  1037. if (cloneCount !== count) {
  1038. if (cloneCount < count || !count) {
  1039. !count && Splide2.go(0);
  1040. event.emit(EVENT_REFRESH);
  1041. }
  1042. }
  1043. }
  1044. function generate(count) {
  1045. const slides = Slides.get().slice();
  1046. const { length } = slides;
  1047. if (length) {
  1048. while (slides.length < count) {
  1049. pn(slides, slides);
  1050. }
  1051. pn(slides.slice(-count), slides.slice(0, count)).forEach((Slide, index) => {
  1052. const isHead = index < count;
  1053. const clone = cloneDeep(Slide.slide, index);
  1054. isHead ? yn(clone, slides[0].slide) : Q(Elements.list, clone);
  1055. pn(clones, clone);
  1056. Slides.register(clone, index - count + (isHead ? 0 : length), Slide.index);
  1057. });
  1058. }
  1059. }
  1060. function cloneDeep(elm, index) {
  1061. const clone = elm.cloneNode(true);
  1062. J(clone, options.classes.clone);
  1063. clone.id = `${Splide2.root.id}-clone${cn(index + 1)}`;
  1064. return clone;
  1065. }
  1066. function computeCloneCount() {
  1067. let { clones: clones2 } = options;
  1068. if (!Splide2.is(LOOP)) {
  1069. clones2 = 0;
  1070. } else if (Z(clones2)) {
  1071. const fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0);
  1072. const fixedCount = fixedSize && Fn(tn(Elements.track)[resolve("width")] / fixedSize);
  1073. clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER;
  1074. }
  1075. return clones2;
  1076. }
  1077. return {
  1078. mount,
  1079. destroy
  1080. };
  1081. }
  1082. function Move(Splide2, Components2, options, event) {
  1083. const { on, emit } = event;
  1084. const { set } = Splide2.state;
  1085. const { Slides } = Components2;
  1086. const { slideSize, getPadding, listSize, sliderSize, totalSize } = Components2.Layout;
  1087. const { resolve, orient } = Components2.Direction;
  1088. const { list, track } = Components2.Elements;
  1089. let Transition;
  1090. function mount() {
  1091. Transition = Components2.Transition;
  1092. on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition);
  1093. }
  1094. function reposition() {
  1095. if (!Components2.Controller.isBusy()) {
  1096. Components2.Scroll.cancel();
  1097. jump(Splide2.index);
  1098. Components2.Slides.update();
  1099. }
  1100. }
  1101. function move(dest, index, prev, callback) {
  1102. if (dest !== index && canShift(dest > prev)) {
  1103. cancel();
  1104. translate(shift(getPosition(), dest > prev), true);
  1105. }
  1106. set(MOVING);
  1107. emit(EVENT_MOVE, index, prev, dest);
  1108. Transition.start(index, () => {
  1109. set(IDLE);
  1110. emit(EVENT_MOVED, index, prev, dest);
  1111. callback && callback();
  1112. });
  1113. }
  1114. function jump(index) {
  1115. translate(toPosition(index, true));
  1116. }
  1117. function translate(position, preventLoop) {
  1118. if (!Splide2.is(FADE)) {
  1119. const destination = preventLoop ? position : loop(position);
  1120. nn(list, "transform", `translate${resolve("X")}(${destination}px)`);
  1121. position !== destination && emit(EVENT_SHIFTED);
  1122. }
  1123. }
  1124. function loop(position) {
  1125. if (Splide2.is(LOOP)) {
  1126. const index = toIndex(position);
  1127. const exceededMax = index > Components2.Controller.getEnd();
  1128. const exceededMin = index < 0;
  1129. if (exceededMin || exceededMax) {
  1130. position = shift(position, exceededMax);
  1131. }
  1132. }
  1133. return position;
  1134. }
  1135. function shift(position, backwards) {
  1136. const excess = position - getLimit(backwards);
  1137. const size = sliderSize();
  1138. position -= orient(size * (Fn(un(excess) / size) || 1)) * (backwards ? 1 : -1);
  1139. return position;
  1140. }
  1141. function cancel() {
  1142. translate(getPosition(), true);
  1143. Transition.cancel();
  1144. }
  1145. function toIndex(position) {
  1146. const slides = Slides.get();
  1147. let index = 0;
  1148. let minDistance = Infinity;
  1149. for (let i = 0; i < slides.length; i++) {
  1150. const slideIndex = slides[i].index;
  1151. const distance = un(toPosition(slideIndex, true) - position);
  1152. if (distance <= minDistance) {
  1153. minDistance = distance;
  1154. index = slideIndex;
  1155. } else {
  1156. break;
  1157. }
  1158. }
  1159. return index;
  1160. }
  1161. function toPosition(index, trimming) {
  1162. const position = orient(totalSize(index - 1) - offset(index));
  1163. return trimming ? trim(position) : position;
  1164. }
  1165. function getPosition() {
  1166. const left = resolve("left");
  1167. return tn(list)[left] - tn(track)[left] + orient(getPadding(false));
  1168. }
  1169. function trim(position) {
  1170. if (options.trimSpace && Splide2.is(SLIDE)) {
  1171. position = bn(position, 0, orient(sliderSize(true) - listSize()));
  1172. }
  1173. return position;
  1174. }
  1175. function offset(index) {
  1176. const { focus } = options;
  1177. return focus === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus * slideSize(index) || 0;
  1178. }
  1179. function getLimit(max) {
  1180. return toPosition(max ? Components2.Controller.getEnd() : 0, !!options.trimSpace);
  1181. }
  1182. function canShift(backwards) {
  1183. const padding = getPadding(false);
  1184. const shifted = orient(shift(getPosition(), backwards));
  1185. return backwards ? shifted >= padding : shifted <= list[resolve("scrollWidth")] - tn(track)[resolve("width")] + padding;
  1186. }
  1187. function exceededLimit(max, position = getPosition()) {
  1188. const exceededMin = max !== true && orient(position) < orient(getLimit(false));
  1189. const exceededMax = max !== false && orient(position) > orient(getLimit(true));
  1190. return exceededMin || exceededMax;
  1191. }
  1192. return {
  1193. mount,
  1194. move,
  1195. jump,
  1196. translate,
  1197. shift,
  1198. cancel,
  1199. toIndex,
  1200. toPosition,
  1201. getPosition,
  1202. getLimit,
  1203. exceededLimit,
  1204. reposition
  1205. };
  1206. }
  1207. function Controller(Splide2, Components2, options, event) {
  1208. const { on, emit } = event;
  1209. const { Move } = Components2;
  1210. const { getPosition, getLimit, toPosition } = Move;
  1211. const { isEnough, getLength } = Components2.Slides;
  1212. const { omitEnd } = options;
  1213. const isLoop = Splide2.is(LOOP);
  1214. const isSlide = Splide2.is(SLIDE);
  1215. const getNext = a(getAdjacent, false);
  1216. const getPrev = a(getAdjacent, true);
  1217. let currIndex = options.start || 0;
  1218. let endIndex;
  1219. let prevIndex = currIndex;
  1220. let slideCount;
  1221. let perMove;
  1222. let perPage;
  1223. function mount() {
  1224. init();
  1225. on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init);
  1226. on(EVENT_RESIZED, onResized);
  1227. }
  1228. function init() {
  1229. slideCount = getLength(true);
  1230. perMove = options.perMove;
  1231. perPage = options.perPage;
  1232. endIndex = getEnd();
  1233. const end = omitEnd ? endIndex : slideCount - 1;
  1234. const index = bn(currIndex, 0, end);
  1235. prevIndex = bn(currIndex, 0, end);
  1236. if (index !== currIndex) {
  1237. currIndex = index;
  1238. Move.reposition();
  1239. }
  1240. }
  1241. function onResized() {
  1242. if (endIndex !== getEnd()) {
  1243. emit(EVENT_END_INDEX_CHANGED);
  1244. }
  1245. }
  1246. function go(control, allowSameIndex, callback) {
  1247. if (!isBusy()) {
  1248. const dest = parse(control);
  1249. const index = loop(dest);
  1250. if (index > -1 && (allowSameIndex || index !== currIndex)) {
  1251. setIndex(index);
  1252. Move.move(dest, index, prevIndex, callback);
  1253. }
  1254. }
  1255. }
  1256. function scroll(destination, duration, snap, callback) {
  1257. Components2.Scroll.scroll(destination, duration, snap, () => {
  1258. const index = loop(Move.toIndex(getPosition()));
  1259. setIndex(omitEnd ? E(index, endIndex) : index);
  1260. callback && callback();
  1261. });
  1262. }
  1263. function parse(control) {
  1264. let index = currIndex;
  1265. if (p(control)) {
  1266. const [, indicator, number] = control.match(/([+\-<>])(\d+)?/) || [];
  1267. if (indicator === "+" || indicator === "-") {
  1268. index = computeDestIndex(currIndex + +`${indicator}${+number || 1}`, currIndex);
  1269. } else if (indicator === ">") {
  1270. index = number ? toIndex(+number) : getNext(true);
  1271. } else if (indicator === "<") {
  1272. index = getPrev(true);
  1273. }
  1274. } else {
  1275. index = isLoop ? control : bn(control, 0, endIndex);
  1276. }
  1277. return index;
  1278. }
  1279. function getAdjacent(prev, destination) {
  1280. const number = perMove || (hasFocus() ? 1 : perPage);
  1281. const dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus()));
  1282. if (dest === -1 && isSlide) {
  1283. if (!Mn(getPosition(), getLimit(!prev), 1)) {
  1284. return prev ? 0 : endIndex;
  1285. }
  1286. }
  1287. return destination ? dest : loop(dest);
  1288. }
  1289. function computeDestIndex(dest, from, snapPage) {
  1290. if (isEnough() || hasFocus()) {
  1291. const index = computeMovableDestIndex(dest);
  1292. if (index !== dest) {
  1293. from = dest;
  1294. dest = index;
  1295. snapPage = false;
  1296. }
  1297. if (dest < 0 || dest > endIndex) {
  1298. if (!perMove && (_n(0, dest, from, true) || _n(endIndex, from, dest, true))) {
  1299. dest = toIndex(toPage(dest));
  1300. } else {
  1301. if (isLoop) {
  1302. dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest;
  1303. } else if (options.rewind) {
  1304. dest = dest < 0 ? endIndex : 0;
  1305. } else {
  1306. dest = -1;
  1307. }
  1308. }
  1309. } else {
  1310. if (snapPage && dest !== from) {
  1311. dest = toIndex(toPage(from) + (dest < from ? -1 : 1));
  1312. }
  1313. }
  1314. } else {
  1315. dest = -1;
  1316. }
  1317. return dest;
  1318. }
  1319. function computeMovableDestIndex(dest) {
  1320. if (isSlide && options.trimSpace === "move" && dest !== currIndex) {
  1321. const position = getPosition();
  1322. while (position === toPosition(dest, true) && _n(dest, 0, Splide2.length - 1, !options.rewind)) {
  1323. dest < currIndex ? --dest : ++dest;
  1324. }
  1325. }
  1326. return dest;
  1327. }
  1328. function loop(index) {
  1329. return isLoop ? (index + slideCount) % slideCount || 0 : index;
  1330. }
  1331. function getEnd() {
  1332. let end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage);
  1333. while (omitEnd && end-- > 0) {
  1334. if (toPosition(slideCount - 1, true) !== toPosition(end, true)) {
  1335. end++;
  1336. break;
  1337. }
  1338. }
  1339. return bn(end, 0, slideCount - 1);
  1340. }
  1341. function toIndex(page) {
  1342. return bn(hasFocus() ? page : perPage * page, 0, endIndex);
  1343. }
  1344. function toPage(index) {
  1345. return hasFocus() ? E(index, endIndex) : Dn((index >= endIndex ? slideCount - 1 : index) / perPage);
  1346. }
  1347. function toDest(destination) {
  1348. const closest = Move.toIndex(destination);
  1349. return isSlide ? bn(closest, 0, endIndex) : closest;
  1350. }
  1351. function setIndex(index) {
  1352. if (index !== currIndex) {
  1353. prevIndex = currIndex;
  1354. currIndex = index;
  1355. }
  1356. }
  1357. function getIndex(prev) {
  1358. return prev ? prevIndex : currIndex;
  1359. }
  1360. function hasFocus() {
  1361. return !Z(options.focus) || options.isNavigation;
  1362. }
  1363. function isBusy() {
  1364. return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition;
  1365. }
  1366. return {
  1367. mount,
  1368. go,
  1369. scroll,
  1370. getNext,
  1371. getPrev,
  1372. getAdjacent,
  1373. getEnd,
  1374. setIndex,
  1375. getIndex,
  1376. toIndex,
  1377. toPage,
  1378. toDest,
  1379. hasFocus,
  1380. isBusy
  1381. };
  1382. }
  1383. const XML_NAME_SPACE = "http://www.w3.org/2000/svg";
  1384. const PATH = "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";
  1385. const SIZE = 40;
  1386. function Arrows(Splide2, Components2, options, event) {
  1387. const { on, bind, emit } = event;
  1388. const { classes, i18n } = options;
  1389. const { Elements, Controller } = Components2;
  1390. const { arrows: placeholder, track } = Elements;
  1391. let wrapper = placeholder;
  1392. let prev = Elements.prev;
  1393. let next = Elements.next;
  1394. let created;
  1395. let wrapperClasses;
  1396. const arrows = {};
  1397. function mount() {
  1398. init();
  1399. on(EVENT_UPDATED, remount);
  1400. }
  1401. function remount() {
  1402. destroy();
  1403. mount();
  1404. }
  1405. function init() {
  1406. const enabled = options.arrows;
  1407. if (enabled && !(prev && next)) {
  1408. createArrows();
  1409. }
  1410. if (prev && next) {
  1411. v(arrows, { prev, next });
  1412. An(wrapper, enabled ? "" : "none");
  1413. J(wrapper, wrapperClasses = `${CLASS_ARROWS}--${options.direction}`);
  1414. if (enabled) {
  1415. listen();
  1416. update();
  1417. M([prev, next], ARIA_CONTROLS, track.id);
  1418. emit(EVENT_ARROWS_MOUNTED, prev, next);
  1419. }
  1420. }
  1421. }
  1422. function destroy() {
  1423. event.destroy();
  1424. Pn(wrapper, wrapperClasses);
  1425. if (created) {
  1426. en(placeholder ? [prev, next] : wrapper);
  1427. prev = next = null;
  1428. } else {
  1429. U([prev, next], ALL_ATTRIBUTES);
  1430. }
  1431. }
  1432. function listen() {
  1433. on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update);
  1434. bind(next, "click", a(go, ">"));
  1435. bind(prev, "click", a(go, "<"));
  1436. }
  1437. function go(control) {
  1438. Controller.go(control, true);
  1439. }
  1440. function createArrows() {
  1441. wrapper = placeholder || j("div", classes.arrows);
  1442. prev = createArrow(true);
  1443. next = createArrow(false);
  1444. created = true;
  1445. Q(wrapper, [prev, next]);
  1446. !placeholder && yn(wrapper, track);
  1447. }
  1448. function createArrow(prev2) {
  1449. const arrow = `<button class="${classes.arrow} ${prev2 ? classes.prev : classes.next}" type="button"><svg xmlns="${XML_NAME_SPACE}" viewBox="0 0 ${SIZE} ${SIZE}" width="${SIZE}" height="${SIZE}"><path d="${options.arrowPath || PATH}" />`;
  1450. return qn(arrow);
  1451. }
  1452. function update() {
  1453. if (prev && next) {
  1454. const index = Splide2.index;
  1455. const prevIndex = Controller.getPrev();
  1456. const nextIndex = Controller.getNext();
  1457. const prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev;
  1458. const nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next;
  1459. prev.disabled = prevIndex < 0;
  1460. next.disabled = nextIndex < 0;
  1461. M(prev, ARIA_LABEL, prevLabel);
  1462. M(next, ARIA_LABEL, nextLabel);
  1463. emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex);
  1464. }
  1465. }
  1466. return {
  1467. arrows,
  1468. mount,
  1469. destroy,
  1470. update
  1471. };
  1472. }
  1473. const INTERVAL_DATA_ATTRIBUTE = `${DATA_ATTRIBUTE}-interval`;
  1474. function Autoplay(Splide2, Components2, options, event) {
  1475. const { on, bind, emit } = event;
  1476. const interval = sn(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame);
  1477. const { isPaused } = interval;
  1478. const { Elements, Elements: { root, toggle } } = Components2;
  1479. const { autoplay } = options;
  1480. let hovered;
  1481. let focused;
  1482. let stopped = autoplay === "pause";
  1483. function mount() {
  1484. if (autoplay) {
  1485. listen();
  1486. toggle && M(toggle, ARIA_CONTROLS, Elements.track.id);
  1487. stopped || play();
  1488. update();
  1489. }
  1490. }
  1491. function listen() {
  1492. if (options.pauseOnHover) {
  1493. bind(root, "mouseenter mouseleave", (e) => {
  1494. hovered = e.type === "mouseenter";
  1495. autoToggle();
  1496. });
  1497. }
  1498. if (options.pauseOnFocus) {
  1499. bind(root, "focusin focusout", (e) => {
  1500. focused = e.type === "focusin";
  1501. autoToggle();
  1502. });
  1503. }
  1504. if (toggle) {
  1505. bind(toggle, "click", () => {
  1506. stopped ? play() : pause(true);
  1507. });
  1508. }
  1509. on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind);
  1510. on(EVENT_MOVE, onMove);
  1511. }
  1512. function play() {
  1513. if (isPaused() && Components2.Slides.isEnough()) {
  1514. interval.start(!options.resetProgress);
  1515. focused = hovered = stopped = false;
  1516. update();
  1517. emit(EVENT_AUTOPLAY_PLAY);
  1518. }
  1519. }
  1520. function pause(stop = true) {
  1521. stopped = !!stop;
  1522. update();
  1523. if (!isPaused()) {
  1524. interval.pause();
  1525. emit(EVENT_AUTOPLAY_PAUSE);
  1526. }
  1527. }
  1528. function autoToggle() {
  1529. if (!stopped) {
  1530. hovered || focused ? pause(false) : play();
  1531. }
  1532. }
  1533. function update() {
  1534. if (toggle) {
  1535. I(toggle, CLASS_ACTIVE, !stopped);
  1536. M(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]);
  1537. }
  1538. }
  1539. function onAnimationFrame(rate) {
  1540. const { bar } = Elements;
  1541. bar && nn(bar, "width", `${rate * 100}%`);
  1542. emit(EVENT_AUTOPLAY_PLAYING, rate);
  1543. }
  1544. function onMove(index) {
  1545. const Slide = Components2.Slides.getAt(index);
  1546. interval.set(Slide && +wn(Slide.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval);
  1547. }
  1548. return {
  1549. mount,
  1550. destroy: interval.cancel,
  1551. play,
  1552. pause,
  1553. isPaused
  1554. };
  1555. }
  1556. const BOUNCE_DIFF_THRESHOLD = 10;
  1557. const BOUNCE_DURATION = 600;
  1558. const FRICTION_FACTOR = 0.6;
  1559. const BASE_VELOCITY = 1.5;
  1560. const MIN_DURATION = 800;
  1561. function Scroll(Splide2, Components2, options, event) {
  1562. const { on, emit } = event;
  1563. const { state: { set } } = Splide2;
  1564. const { Move } = Components2;
  1565. const { getPosition, getLimit, exceededLimit, translate } = Move;
  1566. const isSlide = Splide2.is(SLIDE);
  1567. let interval;
  1568. let callback;
  1569. let friction = 1;
  1570. function mount() {
  1571. on(EVENT_MOVE, clear);
  1572. on([EVENT_UPDATED, EVENT_REFRESH], cancel);
  1573. }
  1574. function scroll(destination, duration, snap, onScrolled, noConstrain) {
  1575. const from = getPosition();
  1576. clear();
  1577. if (snap && (!isSlide || !exceededLimit())) {
  1578. const size = Components2.Layout.sliderSize();
  1579. const offset = In(destination) * size * Dn(un(destination) / size) || 0;
  1580. destination = Move.toPosition(Components2.Controller.toDest(destination % size)) + offset;
  1581. }
  1582. const noDistance = Mn(from, destination, 1);
  1583. friction = 1;
  1584. duration = noDistance ? 0 : duration || $(un(destination - from) / BASE_VELOCITY, MIN_DURATION);
  1585. callback = onScrolled;
  1586. interval = sn(duration, onEnd, a(update, from, destination, noConstrain), 1);
  1587. set(SCROLLING);
  1588. emit(EVENT_SCROLL);
  1589. interval.start();
  1590. }
  1591. function onEnd() {
  1592. set(IDLE);
  1593. callback && callback();
  1594. emit(EVENT_SCROLLED);
  1595. }
  1596. function update(from, to, noConstrain, rate) {
  1597. const position = getPosition();
  1598. const target = from + (to - from) * easing(rate);
  1599. const diff = (target - position) * friction;
  1600. translate(position + diff);
  1601. if (isSlide && !noConstrain && exceededLimit()) {
  1602. friction *= FRICTION_FACTOR;
  1603. if (un(diff) < BOUNCE_DIFF_THRESHOLD) {
  1604. scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true);
  1605. }
  1606. }
  1607. }
  1608. function clear() {
  1609. if (interval) {
  1610. interval.cancel();
  1611. }
  1612. }
  1613. function cancel() {
  1614. if (interval && !interval.isPaused()) {
  1615. clear();
  1616. onEnd();
  1617. }
  1618. }
  1619. function easing(t) {
  1620. const { easingFunc } = options;
  1621. return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4);
  1622. }
  1623. return {
  1624. mount,
  1625. destroy: clear,
  1626. scroll,
  1627. cancel
  1628. };
  1629. }
  1630. const SCROLL_LISTENER_OPTIONS = { passive: false, capture: true };
  1631. function Drag(Splide2, Components2, options, event) {
  1632. const { on, emit, bind } = event;
  1633. const binder = event.create();
  1634. const { state } = Splide2;
  1635. const { Move, Scroll, Controller, Elements: { track }, Media: { reduce } } = Components2;
  1636. const { resolve, orient } = Components2.Direction;
  1637. const { getPosition, exceededLimit } = Move;
  1638. let basePosition;
  1639. let baseEvent;
  1640. let prevBaseEvent;
  1641. let isFree;
  1642. let dragging;
  1643. let exceeded = false;
  1644. let clickPrevented;
  1645. let disabled;
  1646. let target;
  1647. function mount() {
  1648. bind(track, POINTER_MOVE_EVENTS, an, SCROLL_LISTENER_OPTIONS);
  1649. bind(track, POINTER_UP_EVENTS, an, SCROLL_LISTENER_OPTIONS);
  1650. bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS);
  1651. bind(track, "click", onClick, { capture: true });
  1652. bind(track, "dragstart", Ln);
  1653. on([EVENT_MOUNTED, EVENT_UPDATED], init);
  1654. }
  1655. function init() {
  1656. const { drag } = options;
  1657. disable(!drag);
  1658. isFree = drag === "free";
  1659. }
  1660. function onPointerDown(e) {
  1661. clickPrevented = false;
  1662. if (!disabled) {
  1663. const isTouch = isTouchEvent(e);
  1664. if (isDraggable(e.target) && (isTouch || !e.button)) {
  1665. if (!Controller.isBusy()) {
  1666. target = isTouch ? track : window;
  1667. dragging = state.is([MOVING, SCROLLING]);
  1668. prevBaseEvent = null;
  1669. binder.bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS);
  1670. binder.bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS);
  1671. Move.cancel();
  1672. Scroll.cancel();
  1673. save(e);
  1674. } else {
  1675. Ln(e, true);
  1676. }
  1677. }
  1678. }
  1679. }
  1680. function onPointerMove(e) {
  1681. if (!state.is(DRAGGING)) {
  1682. state.set(DRAGGING);
  1683. emit(EVENT_DRAG);
  1684. }
  1685. if (e.cancelable) {
  1686. if (dragging) {
  1687. Move.translate(basePosition + constrain(diffCoord(e)));
  1688. const expired = diffTime(e) > LOG_INTERVAL;
  1689. const hasExceeded = exceeded !== (exceeded = exceededLimit());
  1690. if (expired || hasExceeded) {
  1691. save(e);
  1692. }
  1693. clickPrevented = true;
  1694. emit(EVENT_DRAGGING);
  1695. Ln(e);
  1696. } else if (isSliderDirection(e)) {
  1697. dragging = shouldStart(e);
  1698. Ln(e);
  1699. }
  1700. }
  1701. }
  1702. function onPointerUp(e) {
  1703. if (state.is(DRAGGING)) {
  1704. state.set(IDLE);
  1705. emit(EVENT_DRAGGED);
  1706. }
  1707. if (dragging) {
  1708. move(e);
  1709. Ln(e);
  1710. }
  1711. binder.destroy();
  1712. dragging = false;
  1713. }
  1714. function onClick(e) {
  1715. if (!disabled && clickPrevented) {
  1716. Ln(e, true);
  1717. }
  1718. }
  1719. function save(e) {
  1720. prevBaseEvent = baseEvent;
  1721. baseEvent = e;
  1722. basePosition = getPosition();
  1723. }
  1724. function move(e) {
  1725. const velocity = computeVelocity(e);
  1726. const destination = computeDestination(velocity);
  1727. const rewind = options.rewind && options.rewindByDrag;
  1728. reduce(false);
  1729. if (isFree) {
  1730. Controller.scroll(destination, 0, options.snap);
  1731. } else if (Splide2.is(FADE)) {
  1732. Controller.go(orient(In(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+");
  1733. } else if (Splide2.is(SLIDE) && exceeded && rewind) {
  1734. Controller.go(exceededLimit(true) ? ">" : "<");
  1735. } else {
  1736. Controller.go(Controller.toDest(destination), true);
  1737. }
  1738. reduce(true);
  1739. }
  1740. function shouldStart(e) {
  1741. const { dragMinThreshold: thresholds } = options;
  1742. const isObj = y(thresholds);
  1743. const mouse = isObj && thresholds.mouse || 0;
  1744. const touch = (isObj ? thresholds.touch : +thresholds) || 10;
  1745. return un(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse);
  1746. }
  1747. function isSliderDirection(e) {
  1748. return un(diffCoord(e)) > un(diffCoord(e, true));
  1749. }
  1750. function computeVelocity(e) {
  1751. if (Splide2.is(LOOP) || !exceeded) {
  1752. const time = diffTime(e);
  1753. if (time && time < LOG_INTERVAL) {
  1754. return diffCoord(e) / time;
  1755. }
  1756. }
  1757. return 0;
  1758. }
  1759. function computeDestination(velocity) {
  1760. return getPosition() + In(velocity) * E(
  1761. un(velocity) * (options.flickPower || 600),
  1762. isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1)
  1763. );
  1764. }
  1765. function diffCoord(e, orthogonal) {
  1766. return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal);
  1767. }
  1768. function diffTime(e) {
  1769. return Bn(e) - Bn(getBaseEvent(e));
  1770. }
  1771. function getBaseEvent(e) {
  1772. return baseEvent === e && prevBaseEvent || baseEvent;
  1773. }
  1774. function coordOf(e, orthogonal) {
  1775. return (isTouchEvent(e) ? e.changedTouches[0] : e)[`page${resolve(orthogonal ? "Y" : "X")}`];
  1776. }
  1777. function constrain(diff) {
  1778. return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1);
  1779. }
  1780. function isDraggable(target2) {
  1781. const { noDrag } = options;
  1782. return !W(target2, `.${CLASS_PAGINATION_PAGE}, .${CLASS_ARROW}`) && (!noDrag || !W(target2, noDrag));
  1783. }
  1784. function isTouchEvent(e) {
  1785. return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
  1786. }
  1787. function isDragging() {
  1788. return dragging;
  1789. }
  1790. function disable(value) {
  1791. disabled = value;
  1792. }
  1793. return {
  1794. mount,
  1795. disable,
  1796. isDragging
  1797. };
  1798. }
  1799. const KEYBOARD_EVENT = "keydown";
  1800. function Keyboard(Splide2, Components2, options, event) {
  1801. const { on, bind, destroy } = event;
  1802. const { root } = Splide2;
  1803. const { resolve } = Components2.Direction;
  1804. let target;
  1805. let disabled;
  1806. function mount() {
  1807. init();
  1808. on(EVENT_UPDATED, destroy);
  1809. on(EVENT_UPDATED, init);
  1810. on(EVENT_MOVE, onMove);
  1811. }
  1812. function init() {
  1813. const { keyboard } = options;
  1814. if (keyboard) {
  1815. target = keyboard === "global" ? window : root;
  1816. bind(target, KEYBOARD_EVENT, onKeydown);
  1817. }
  1818. }
  1819. function disable(value) {
  1820. disabled = value;
  1821. }
  1822. function onMove() {
  1823. const _disabled = disabled;
  1824. disabled = true;
  1825. dn(() => {
  1826. disabled = _disabled;
  1827. });
  1828. }
  1829. function onKeydown(e) {
  1830. if (!disabled) {
  1831. if (e.key === resolve(ARROW_LEFT)) {
  1832. Splide2.go("<");
  1833. } else if (e.key === resolve(ARROW_RIGHT)) {
  1834. Splide2.go(">");
  1835. }
  1836. }
  1837. }
  1838. return {
  1839. mount,
  1840. destroy,
  1841. disable
  1842. };
  1843. }
  1844. const SRC_DATA_ATTRIBUTE = `${DATA_ATTRIBUTE}-lazy`;
  1845. const SRCSET_DATA_ATTRIBUTE = `${SRC_DATA_ATTRIBUTE}-srcset`;
  1846. const IMAGE_SELECTOR = `[${SRC_DATA_ATTRIBUTE}], [${SRCSET_DATA_ATTRIBUTE}]`;
  1847. function LazyLoad(Splide2, Components2, options, event) {
  1848. const { on, off, bind, emit } = event;
  1849. const isSequential = options.lazyLoad === "sequential";
  1850. const events = [EVENT_MOVED, EVENT_SCROLLED];
  1851. let entries = [];
  1852. function mount() {
  1853. if (options.lazyLoad) {
  1854. init();
  1855. on(EVENT_REFRESH, init);
  1856. }
  1857. }
  1858. function init() {
  1859. N(entries);
  1860. register();
  1861. if (isSequential) {
  1862. loadNext();
  1863. } else {
  1864. off(events);
  1865. on(events, check);
  1866. check();
  1867. }
  1868. }
  1869. function register() {
  1870. Components2.Slides.forEach((Slide) => {
  1871. Tn(Slide.slide, IMAGE_SELECTOR).forEach((img) => {
  1872. const src = wn(img, SRC_DATA_ATTRIBUTE);
  1873. const srcset = wn(img, SRCSET_DATA_ATTRIBUTE);
  1874. if (src !== img.src || srcset !== img.srcset) {
  1875. const className = options.classes.spinner;
  1876. const parent = img.parentElement;
  1877. const spinner = Y(parent, `.${className}`) || j("span", className, parent);
  1878. entries.push([img, Slide, spinner]);
  1879. img.src || An(img, "none");
  1880. }
  1881. });
  1882. });
  1883. }
  1884. function check() {
  1885. entries = entries.filter((data) => {
  1886. const distance = options.perPage * ((options.preloadPages || 1) + 1) - 1;
  1887. return data[1].isWithin(Splide2.index, distance) ? load(data) : true;
  1888. });
  1889. entries.length || off(events);
  1890. }
  1891. function load(data) {
  1892. const [img] = data;
  1893. J(data[1].slide, CLASS_LOADING);
  1894. bind(img, "load error", a(onLoad, data));
  1895. M(img, "src", wn(img, SRC_DATA_ATTRIBUTE));
  1896. M(img, "srcset", wn(img, SRCSET_DATA_ATTRIBUTE));
  1897. U(img, SRC_DATA_ATTRIBUTE);
  1898. U(img, SRCSET_DATA_ATTRIBUTE);
  1899. }
  1900. function onLoad(data, e) {
  1901. const [img, Slide] = data;
  1902. Pn(Slide.slide, CLASS_LOADING);
  1903. if (e.type !== "error") {
  1904. en(data[2]);
  1905. An(img, "");
  1906. emit(EVENT_LAZYLOAD_LOADED, img, Slide);
  1907. emit(EVENT_RESIZE);
  1908. }
  1909. isSequential && loadNext();
  1910. }
  1911. function loadNext() {
  1912. entries.length && load(entries.shift());
  1913. }
  1914. return {
  1915. mount,
  1916. destroy: a(N, entries),
  1917. check
  1918. };
  1919. }
  1920. function Pagination(Splide2, Components2, options, event) {
  1921. const { on, emit, bind } = event;
  1922. const { Slides, Elements, Controller } = Components2;
  1923. const { hasFocus, getIndex, go } = Controller;
  1924. const { resolve } = Components2.Direction;
  1925. const { pagination: placeholder } = Elements;
  1926. const items = [];
  1927. let list;
  1928. let paginationClasses;
  1929. function mount() {
  1930. destroy();
  1931. on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount);
  1932. const enabled = options.pagination;
  1933. placeholder && An(placeholder, enabled ? "" : "none");
  1934. if (enabled) {
  1935. on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update);
  1936. createPagination();
  1937. update();
  1938. emit(EVENT_PAGINATION_MOUNTED, { list, items }, getAt(Splide2.index));
  1939. }
  1940. }
  1941. function destroy() {
  1942. if (list) {
  1943. en(placeholder ? F(list.children) : list);
  1944. Pn(list, paginationClasses);
  1945. N(items);
  1946. list = null;
  1947. }
  1948. event.destroy();
  1949. }
  1950. function createPagination() {
  1951. const { length } = Splide2;
  1952. const { classes, i18n, perPage } = options;
  1953. const max = hasFocus() ? Controller.getEnd() + 1 : Fn(length / perPage);
  1954. list = placeholder || j("ul", classes.pagination, Elements.track.parentElement);
  1955. J(list, paginationClasses = `${CLASS_PAGINATION}--${getDirection()}`);
  1956. M(list, ROLE, "tablist");
  1957. M(list, ARIA_LABEL, i18n.select);
  1958. M(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : "");
  1959. for (let i = 0; i < max; i++) {
  1960. const li = j("li", null, list);
  1961. const button = j("button", { class: classes.page, type: "button" }, li);
  1962. const controls = Slides.getIn(i).map((Slide) => Slide.slide.id);
  1963. const text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
  1964. bind(button, "click", a(onClick, i));
  1965. if (options.paginationKeyboard) {
  1966. bind(button, "keydown", a(onKeydown, i));
  1967. }
  1968. M(li, ROLE, "presentation");
  1969. M(button, ROLE, "tab");
  1970. M(button, ARIA_CONTROLS, controls.join(" "));
  1971. M(button, ARIA_LABEL, Kn(text, i + 1));
  1972. M(button, TAB_INDEX, -1);
  1973. items.push({ li, button, page: i });
  1974. }
  1975. }
  1976. function onClick(page) {
  1977. go(`>${page}`, true);
  1978. }
  1979. function onKeydown(page, e) {
  1980. const { length } = items;
  1981. const { key } = e;
  1982. const dir = getDirection();
  1983. let nextPage = -1;
  1984. if (key === resolve(ARROW_RIGHT, false, dir)) {
  1985. nextPage = ++page % length;
  1986. } else if (key === resolve(ARROW_LEFT, false, dir)) {
  1987. nextPage = (--page + length) % length;
  1988. } else if (key === "Home") {
  1989. nextPage = 0;
  1990. } else if (key === "End") {
  1991. nextPage = length - 1;
  1992. }
  1993. const item = items[nextPage];
  1994. if (item) {
  1995. $n(item.button);
  1996. go(`>${nextPage}`);
  1997. Ln(e, true);
  1998. }
  1999. }
  2000. function getDirection() {
  2001. return options.paginationDirection || options.direction;
  2002. }
  2003. function getAt(index) {
  2004. return items[Controller.toPage(index)];
  2005. }
  2006. function update() {
  2007. const prev = getAt(getIndex(true));
  2008. const curr = getAt(getIndex());
  2009. if (prev) {
  2010. const { button } = prev;
  2011. Pn(button, CLASS_ACTIVE);
  2012. U(button, ARIA_SELECTED);
  2013. M(button, TAB_INDEX, -1);
  2014. }
  2015. if (curr) {
  2016. const { button } = curr;
  2017. J(button, CLASS_ACTIVE);
  2018. M(button, ARIA_SELECTED, true);
  2019. M(button, TAB_INDEX, "");
  2020. }
  2021. emit(EVENT_PAGINATION_UPDATED, { list, items }, prev, curr);
  2022. }
  2023. return {
  2024. items,
  2025. mount,
  2026. destroy,
  2027. getAt,
  2028. update
  2029. };
  2030. }
  2031. const TRIGGER_KEYS = [" ", "Enter"];
  2032. function Sync(Splide2, Components2, options, event) {
  2033. const { isNavigation, slideFocus } = options;
  2034. const events = [];
  2035. function mount() {
  2036. Splide2.splides.forEach((target) => {
  2037. if (!target.isParent) {
  2038. sync(Splide2, target.splide);
  2039. sync(target.splide, Splide2);
  2040. }
  2041. });
  2042. if (isNavigation) {
  2043. navigate();
  2044. }
  2045. }
  2046. function destroy() {
  2047. events.forEach((event2) => {
  2048. event2.destroy();
  2049. });
  2050. N(events);
  2051. }
  2052. function remount() {
  2053. destroy();
  2054. mount();
  2055. }
  2056. function sync(splide, target) {
  2057. const event2 = splide.event.create();
  2058. event2.on(EVENT_MOVE, (index, prev, dest) => {
  2059. target.go(target.is(LOOP) ? dest : index);
  2060. });
  2061. events.push(event2);
  2062. }
  2063. function navigate() {
  2064. const ev = event.create();
  2065. const { on } = ev;
  2066. on(EVENT_CLICK, onClick);
  2067. on(EVENT_SLIDE_KEYDOWN, onKeydown);
  2068. on([EVENT_MOUNTED, EVENT_UPDATED], update);
  2069. events.push(ev);
  2070. ev.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides);
  2071. }
  2072. function update() {
  2073. M(
  2074. Components2.Elements.list,
  2075. ARIA_ORIENTATION,
  2076. options.direction === TTB ? "vertical" : ""
  2077. );
  2078. }
  2079. function onClick(Slide) {
  2080. Splide2.go(Slide.index);
  2081. }
  2082. function onKeydown(Slide, e) {
  2083. if (G(TRIGGER_KEYS, e.key)) {
  2084. onClick(Slide);
  2085. Ln(e);
  2086. }
  2087. }
  2088. return {
  2089. setup: a(
  2090. Components2.Media.set,
  2091. { slideFocus: Z(slideFocus) ? isNavigation : slideFocus },
  2092. true
  2093. ),
  2094. mount,
  2095. destroy,
  2096. remount
  2097. };
  2098. }
  2099. function Wheel(Splide2, Components2, options, event) {
  2100. let lastTime = 0;
  2101. function mount() {
  2102. if (options.wheel) {
  2103. event.bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS);
  2104. }
  2105. }
  2106. function onWheel(e) {
  2107. if (e.cancelable) {
  2108. const { deltaY } = e;
  2109. const backwards = deltaY < 0;
  2110. const timeStamp = Bn(e);
  2111. const min = options.wheelMinThreshold || 0;
  2112. const sleep = options.wheelSleep || 0;
  2113. if (un(deltaY) > min && timeStamp - lastTime > sleep) {
  2114. Splide2.go(backwards ? "<" : ">");
  2115. lastTime = timeStamp;
  2116. }
  2117. shouldPrevent(backwards) && Ln(e);
  2118. }
  2119. }
  2120. function shouldPrevent(backwards) {
  2121. return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1;
  2122. }
  2123. return {
  2124. mount
  2125. };
  2126. }
  2127. const VISUALLY_HIDDEN = `border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px`;
  2128. const SR_REMOVAL_DELAY = 90;
  2129. function Live(Splide2, Components2, options, event) {
  2130. const { on } = event;
  2131. const { track } = Components2.Elements;
  2132. const enabled = options.live && !options.isNavigation;
  2133. const sr = j("span", CLASS_SR);
  2134. const interval = sn(SR_REMOVAL_DELAY, a(toggle, false));
  2135. function mount() {
  2136. if (enabled) {
  2137. disable(!Components2.Autoplay.isPaused());
  2138. M(track, ARIA_ATOMIC, true);
  2139. sr.textContent = "\u2026";
  2140. sr.style.cssText = VISUALLY_HIDDEN;
  2141. on(EVENT_AUTOPLAY_PLAY, a(disable, true));
  2142. on(EVENT_AUTOPLAY_PAUSE, a(disable, false));
  2143. on([EVENT_MOVED, EVENT_SCROLLED], a(toggle, true));
  2144. }
  2145. }
  2146. function toggle(active) {
  2147. M(track, ARIA_BUSY, active);
  2148. if (active) {
  2149. Q(track, sr);
  2150. interval.start();
  2151. } else {
  2152. en(sr);
  2153. interval.cancel();
  2154. }
  2155. }
  2156. function destroy() {
  2157. U(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]);
  2158. en(sr);
  2159. }
  2160. function disable(disabled) {
  2161. if (enabled) {
  2162. M(track, ARIA_LIVE, disabled ? "off" : "polite");
  2163. }
  2164. }
  2165. return {
  2166. mount,
  2167. disable,
  2168. destroy
  2169. };
  2170. }
  2171. const COMPONENTS = {
  2172. Media,
  2173. Direction,
  2174. Elements,
  2175. Slides,
  2176. Layout,
  2177. Clones,
  2178. Move,
  2179. Controller,
  2180. Arrows,
  2181. Autoplay,
  2182. Scroll,
  2183. Drag,
  2184. Keyboard,
  2185. LazyLoad,
  2186. Pagination,
  2187. Sync,
  2188. Wheel,
  2189. Live
  2190. };
  2191. const I18N = {
  2192. prev: "Previous slide",
  2193. next: "Next slide",
  2194. first: "Go to first slide",
  2195. last: "Go to last slide",
  2196. slideX: "Go to slide %s",
  2197. pageX: "Go to page %s",
  2198. play: "Start autoplay",
  2199. pause: "Pause autoplay",
  2200. carousel: "carousel",
  2201. slide: "slide",
  2202. select: "Select a slide to show",
  2203. slideLabel: "%s of %s"
  2204. };
  2205. const DEFAULTS = {
  2206. type: "slide",
  2207. role: "region",
  2208. speed: 400,
  2209. perPage: 1,
  2210. cloneStatus: true,
  2211. arrows: true,
  2212. pagination: true,
  2213. paginationKeyboard: true,
  2214. interval: 5e3,
  2215. pauseOnHover: true,
  2216. pauseOnFocus: true,
  2217. resetProgress: true,
  2218. easing: "cubic-bezier(0.25, 1, 0.5, 1)",
  2219. drag: true,
  2220. direction: "ltr",
  2221. trimSpace: true,
  2222. focusableNodes: "a, button, textarea, input, select, iframe",
  2223. live: true,
  2224. classes: CLASSES,
  2225. i18n: I18N,
  2226. reducedMotion: {
  2227. speed: 0,
  2228. rewindSpeed: 0,
  2229. autoplay: "pause"
  2230. }
  2231. };
  2232. function Fade(Splide2, Components2, options, event) {
  2233. const { Slides } = Components2;
  2234. function mount() {
  2235. event.on([EVENT_MOUNTED, EVENT_REFRESH], init);
  2236. }
  2237. function init() {
  2238. Slides.forEach((Slide) => {
  2239. Slide.style("transform", `translateX(-${100 * Slide.index}%)`);
  2240. });
  2241. }
  2242. function start(index, done) {
  2243. Slides.style("transition", `opacity ${options.speed}ms ${options.easing}`);
  2244. dn(done);
  2245. }
  2246. return {
  2247. mount,
  2248. start,
  2249. cancel: an
  2250. };
  2251. }
  2252. function Slide(Splide2, Components2, options, event) {
  2253. const { Move, Controller, Scroll } = Components2;
  2254. const { list } = Components2.Elements;
  2255. const transition = a(nn, list, "transition");
  2256. let endCallback;
  2257. function mount() {
  2258. event.bind(list, "transitionend", (e) => {
  2259. if (e.target === list && endCallback) {
  2260. cancel();
  2261. endCallback();
  2262. }
  2263. });
  2264. }
  2265. function start(index, done) {
  2266. const destination = Move.toPosition(index, true);
  2267. const position = Move.getPosition();
  2268. const speed = getSpeed(index);
  2269. if (un(destination - position) >= 1 && speed >= 1) {
  2270. if (options.useScroll) {
  2271. Scroll.scroll(destination, speed, false, done);
  2272. } else {
  2273. transition(`transform ${speed}ms ${options.easing}`);
  2274. Move.translate(destination, true);
  2275. endCallback = done;
  2276. }
  2277. } else {
  2278. Move.jump(index);
  2279. done();
  2280. }
  2281. }
  2282. function cancel() {
  2283. transition("");
  2284. Scroll.cancel();
  2285. }
  2286. function getSpeed(index) {
  2287. const { rewindSpeed } = options;
  2288. if (Splide2.is(SLIDE) && rewindSpeed) {
  2289. const prev = Controller.getIndex(true);
  2290. const end = Controller.getEnd();
  2291. if (prev === 0 && index >= end || prev >= end && index === 0) {
  2292. return rewindSpeed;
  2293. }
  2294. }
  2295. return options.speed;
  2296. }
  2297. return {
  2298. mount,
  2299. start,
  2300. cancel
  2301. };
  2302. }
  2303. class Splide {
  2304. static defaults = {};
  2305. static STATES = STATES;
  2306. root;
  2307. event = fn();
  2308. Components = {};
  2309. state = Rn(CREATED);
  2310. splides = [];
  2311. _o = {};
  2312. _C;
  2313. _E = {};
  2314. _T;
  2315. constructor(target, options = {}) {
  2316. const root = p(target) ? On(document, target) : target;
  2317. assert(root, `${root} is invalid.`);
  2318. this.root = root;
  2319. options = k({
  2320. label: wn(root, ARIA_LABEL) || "",
  2321. labelledby: wn(root, ARIA_LABELLEDBY) || ""
  2322. }, DEFAULTS, Splide.defaults, options);
  2323. try {
  2324. k(options, JSON.parse(wn(root, DATA_ATTRIBUTE)));
  2325. } catch (e) {
  2326. assert(false, "Invalid JSON");
  2327. }
  2328. this._o = Object.create(k({}, options));
  2329. }
  2330. mount(Extensions = this._E, Transition = this._T) {
  2331. const { state, Components: Components2 } = this;
  2332. assert(state.is([CREATED, DESTROYED]), "Already mounted!");
  2333. state.set(CREATED);
  2334. this._C = Components2;
  2335. this._T = Transition || (this.is(FADE) ? Fade : Slide);
  2336. this._E = Extensions;
  2337. const Constructors = v({}, COMPONENTS, this._E, { Transition: this._T });
  2338. L(Constructors, (Component, key) => {
  2339. const component = Component(this, Components2, this._o, this.event.create());
  2340. Components2[key] = component;
  2341. component.setup && component.setup();
  2342. });
  2343. L(Components2, (component) => {
  2344. component.mount && component.mount();
  2345. });
  2346. this.emit(EVENT_MOUNTED);
  2347. J(this.root, CLASS_INITIALIZED);
  2348. state.set(IDLE);
  2349. this.emit(EVENT_READY);
  2350. return this;
  2351. }
  2352. sync(splide) {
  2353. this.splides.push({ splide });
  2354. splide.splides.push({ splide: this, isParent: true });
  2355. if (this.state.is(IDLE)) {
  2356. this._C.Sync.remount();
  2357. splide.Components.Sync.remount();
  2358. }
  2359. return this;
  2360. }
  2361. go(control) {
  2362. this._C.Controller.go(control);
  2363. return this;
  2364. }
  2365. on(events, callback) {
  2366. this.event.on(events, callback);
  2367. return this;
  2368. }
  2369. off(events, callback) {
  2370. this.event.off(events, callback);
  2371. return this;
  2372. }
  2373. emit(event, ...args) {
  2374. this.event.emit(event, ...args);
  2375. return this;
  2376. }
  2377. add(slides, index) {
  2378. this._C.Slides.add(slides, index);
  2379. return this;
  2380. }
  2381. remove(matcher) {
  2382. this._C.Slides.remove(matcher);
  2383. return this;
  2384. }
  2385. is(type) {
  2386. return this._o.type === type;
  2387. }
  2388. refresh() {
  2389. this.emit(EVENT_REFRESH);
  2390. return this;
  2391. }
  2392. destroy(completely = true) {
  2393. const { event, state } = this;
  2394. if (state.is(CREATED)) {
  2395. this.on(EVENT_READY, this.destroy.bind(this, completely));
  2396. } else {
  2397. L(this._C, (component) => {
  2398. component.destroy && component.destroy(completely);
  2399. }, true);
  2400. event.emit(EVENT_DESTROY);
  2401. event.destroy();
  2402. completely && N(this.splides);
  2403. state.set(DESTROYED);
  2404. }
  2405. return this;
  2406. }
  2407. get options() {
  2408. return this._o;
  2409. }
  2410. set options(options) {
  2411. this._C.Media.set(options, true, true);
  2412. }
  2413. get length() {
  2414. return this._C.Slides.getLength(true);
  2415. }
  2416. get index() {
  2417. return this._C.Controller.getIndex();
  2418. }
  2419. }
  2420. return Splide;
  2421. }));