PageSourceSearch

https://elektrospank.com/modules/mod_jmgarticleslider/assets/js/splide.js

js elektrospank.com collected 2026-10-02 16:21:04 UTC 143,599 bytes, 5,859 lines download raw bytes

1/*!
2 * Splide.js
3 * Version  : 2.4.20
4 * License  : MIT
5 * Copyright: 2020 Naotoshi Fujita
6 */
7/******/ (function() { // webpackBootstrap
8/******/ 	"use strict";
9/******/ 	// The require scope
10/******/ 	var __webpack_require__ = {};
11/******/ 	
12/************************************************************************/
13/******/ 	/* webpack/runtime/define property getters */
14/******/ 	!function() {
15/******/ 		// define getter functions for harmony exports
16/******/ 		__webpack_require__.d = function(exports, definition) {
17/******/ 			for(var key in definition) {
18/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
19/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
20/******/ 				}
21/******/ 			}
22/******/ 		};
23/******/ 	}();
24/******/ 	
25/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
26/******/ 	!function() {
27/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
28/******/ 	}();
29/******/ 	
30/******/ 	/* webpack/runtime/make namespace object */
31/******/ 	!function() {
32/******/ 		// define __esModule on exports
33/******/ 		__webpack_require__.r = function(exports) {
34/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36/******/ 			}
37/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
38/******/ 		};
39/******/ 	}();
40/******/ 	
41/************************************************************************/
42
43// UNUSED EXPORTS: Splide
44
45// NAMESPACE OBJECT: ./src/js/constants/states.js
46var states_namespaceObject = {};
47__webpack_require__.r(states_namespaceObject);
48__webpack_require__.d(states_namespaceObject, {
49  "CREATED": function() { return CREATED; },
50  "DESTROYED": function() { return DESTROYED; },
51  "IDLE": function() { return IDLE; },
52  "MOUNTED": function() { return MOUNTED; },
53  "MOVING": function() { return MOVING; }
54});
55
56;// CONCATENATED MODULE: ./src/js/core/event.js
57/**
58 * The function for providing an Event object simply managing events.
59 *
60 * @author    Naotoshi Fujita
61 * @copyright Naotoshi Fujita. All rights reserved.
62 */
63
64/**
65 * The function for providing an Event object simply managing events.
66 */
67/* harmony default export */ var core_event = (function () {
68  /**
69   * Store all event data.
70   *
71   * @type {Array}
72   */
73  var data = [];
74  var Event = {
75    /**
76     * Subscribe the given event(s).
77     *
78     * @param {string}   events  - An event name. Use space to separate multiple events.
79     *                             Also, namespace is accepted by dot, such as 'resize.{namespace}'.
80     * @param {function} handler - A callback function.
81     * @param {Element}  elm     - Optional. Native event will be listened to when this arg is provided.
82     * @param {Object}   options - Optional. Options for addEventListener.
83     */
84    on: function on(events, handler, elm, options) {
85      if (elm === void 0) {
86        elm = null;
87      }
88
89      if (options === void 0) {
90        options = {};
91      }
92
93      events.split(' ').forEach(function (event) {
94        if (elm) {
95          elm.addEventListener(event, handler, options);
96        }
97
98        data.push({
99          event: event,
100          handler: handler,
101          elm: elm,
102          options: options
103        });
104      });
105    },
106
107    /**
108     * Unsubscribe the given event(s).
109     *
110     * @param {string}  events - A event name or names split by space.
111     * @param {Element} elm    - Optional. removeEventListener() will be called when this arg is provided.
112     */
113    off: function off(events, elm) {
114      if (elm === void 0) {
115        elm = null;
116      }
117
118      events.split(' ').forEach(function (event) {
119        data = data.filter(function (item) {
120          if (item && item.event === event && item.elm === elm) {
121            unsubscribe(item);
122            return false;
123          }
124
125          return true;
126        });
127      });
128    },
129
130    /**
131     * Emit an event.
132     * This method is only for custom events.
133     *
134     * @param {string}  event - An event name.
135     * @param {*}       args  - Any number of arguments passed to handlers.
136     */
137    emit: function emit(event) {
138      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
139        args[_key - 1] = arguments[_key];
140      }
141
142      data.forEach(function (item) {
143        if (!item.elm && item.event.split('.')[0] === event) {
144          item.handler.apply(item, args);
145        }
146      });
147    },
148
149    /**
150     * Clear event data.
151     */
152    destroy: function destroy() {
153      data.forEach(unsubscribe);
154      data = [];
155    }
156  };
157  /**
158   * Remove the registered event listener.
159   *
160   * @param {Object} item - An object containing event data.
161   */
162
163  function unsubscribe(item) {
164    if (item.elm) {
165      item.elm.removeEventListener(item.event, item.handler, item.options);
166    }
167  }
168
169  return Event;
170});
171;// CONCATENATED MODULE: ./src/js/core/state.js
172/**
173 * The function providing a super simple state system.
174 *
175 * @author    Naotoshi Fujita
176 * @copyright Naotoshi Fujita. All rights reserved.
177 */
178
179/**
180 * The function providing a super simple state system.
181 *
182 * @param {string|number} initialState - Provide the initial state value.
183 */
184/* harmony default export */ var state = (function (initialState) {
185  /**
186   * Store the current state.
187   *
188   * @type {string|number}
189   */
190  var curr = initialState;
191  return {
192    /**
193     * Change state.
194     *
195     * @param {string|number} state - A new state.
196     */
197    set: function set(state) {
198      curr = state;
199    },
200
201    /**
202     * Verify if the current state is given one or not.
203     *
204     * @param {string|number} state - A state name to be verified.
205     *
206     * @return {boolean} - True if the current state is the given one.
207     */
208    is: function is(state) {
209      return state === curr;
210    }
211  };
212});
213;// CONCATENATED MODULE: ./src/js/utils/object.js
214function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
215
216/**
217 * Some utility functions related with Object, supporting IE.
218 *
219 * @author    Naotoshi Fujita
220 * @copyright Naotoshi Fujita. All rights reserved.
221 */
222var keys = Object.keys;
223/**
224 * Iterate an object like Array.forEach.
225 * IE doesn't support forEach of HTMLCollection.
226 *
227 * @param {Object}    obj       - An object.
228 * @param {function}  callback  - A function handling each value. Arguments are value, property and index.
229 */
230
231function each(obj, callback) {
232  keys(obj).some(function (key, index) {
233    return callback(obj[key], key, index);
234  });
235}
236/**
237 * Return values of the given object as an array.
238 * IE doesn't support Object.values.
239 *
240 * @param {Object} obj - An object.
241 *
242 * @return {Array} - An array containing all values of the given object.
243 */
244
245function values(obj) {
246  return keys(obj).map(function (key) {
247    return obj[key];
248  });
249}
250/**
251 * Check if the given subject is object or not.
252 *
253 * @param {*} subject - A subject to be verified.
254 *
255 * @return {boolean} - True if object, false otherwise.
256 */
257
258function isObject(subject) {
259  return typeof subject === 'object';
260}
261/**
262 * Merge two objects deeply.
263 *
264 * @param {Object} to   - An object where "from" is merged.
265 * @param {Object} from - An object merged to "to".
266 *
267 * @return {Object} - A merged object.
268 */
269
270function merge(_ref, from) {
271  var to = _extends({}, _ref);
272
273  each(from, function (value, key) {
274    if (isObject(value)) {
275      if (!isObject(to[key])) {
276        to[key] = {};
277      }
278
279      to[key] = merge(to[key], value);
280    } else {
281      to[key] = value;
282    }
283  });
284  return to;
285}
286/**
287 * Assign all properties "from" to "to" object.
288 *
289 * @param {Object} to   - An object where properties are assigned.
290 * @param {Object} from - An object whose properties are assigned to "to".
291 *
292 * @return {Object} - An assigned object.
293 */
294
295function object_assign(to, from) {
296  keys(from).forEach(function (key) {
297    if (!to[key]) {
298      Object.defineProperty(to, key, Object.getOwnPropertyDescriptor(from, key));
299    }
300  });
301  return to;
302}
303;// CONCATENATED MODULE: ./src/js/utils/utils.js
304/**
305 * A package of some miscellaneous utility functions.
306 *
307 * @author    Naotoshi Fujita
308 * @copyright Naotoshi Fujita. All rights reserved.
309 */
310
311/**
312 * Convert the given value to array.
313 *
314 * @param {*} value - Any value.
315 *
316 * @return {*[]} - Array containing the given value.
317 */
318
319function toArray(value) {
320  return Array.isArray(value) ? value : [value];
321}
322/**
323 * Check if the given value is between min and max.
324 * Min will be returned when the value is less than min or max will do when greater than max.
325 *
326 * @param {number} value - A number to be checked.
327 * @param {number} m1    - Minimum or maximum number.
328 * @param {number} m2    - Maximum or minimum number.
329 *
330 * @return {number} - A value itself, min or max.
331 */
332
333function between(value, m1, m2) {
334  return Math.min(Math.max(value, m1 > m2 ? m2 : m1), m1 > m2 ? m1 : m2);
335}
336/**
337 * The sprintf method with minimum functionality.
338 *
339 * @param {string}       format       - The string format.
340 * @param {string|Array} replacements - Replacements accepting multiple arguments.
341 *
342 * @returns {string} - Converted string.
343 */
344
345function sprintf(format, replacements) {
346  var i = 0;
347  return format.replace(/%s/g, function () {
348    return toArray(replacements)[i++];
349  });
350}
351/**
352 * Append px unit to the given subject if necessary.
353 *
354 * @param {number|string} value - A value that may not include an unit.
355 *
356 * @return {string} - If the value is string, return itself.
357 *                    If number, do value + "px". An empty string, otherwise.
358 */
359
360function unit(value) {
361  var type = typeof value;
362
363  if (type === 'number' && value > 0) {
364    return parseFloat(value) + 'px';
365  }
366
367  return type === 'string' ? value : '';
368}
369/**
370 * Pad start with 0.
371 *
372 * @param {number} number - A number to be filled with 0.
373 *
374 * @return {string|number} - Padded number.
375 */
376
377function pad(number) {
378  return number < 10 ? '0' + number : number;
379}
380/**
381 * Convert the given value to pixel.
382 *
383 * @param {Element}       root  - Root element where a dummy div is appended.
384 * @param {string|number} value - CSS value to be converted, such as 10rem.
385 *
386 * @return {number} - Pixel.
387 */
388
389function toPixel(root, value) {
390  if (typeof value === 'string') {
391    var div = create('div', {});
392    applyStyle(div, {
393      position: 'absolute',
394      width: value
395    });
396    append(root, div);
397    value = div.clientWidth;
398    dom_remove(div);
399  }
400
401  return +value || 0;
402}
403;// CONCATENATED MODULE: ./src/js/utils/dom.js
404/**
405 * Some utility functions related with DOM.
406 *
407 * @author    Naotoshi Fujita
408 * @copyright Naotoshi Fujita. All rights reserved.
409 */
410
411
412/**
413 * Find the first element matching the given selector.
414 * Be aware that all selectors after a space are ignored.
415 *
416 * @param {Element|Node}  elm       - An ancestor element.
417 * @param {string}        selector  - DOMString.
418 *
419 * @return {Element|null} - A found element or null.
420 */
421
422function find(elm, selector) {
423  return elm ? elm.querySelector(selector.split(' ')[0]) : null;
424}
425/**
426 * Find a first child having the given tag or class name.
427 *
428 * @param {Element} parent         - A parent element.
429 * @param {string}  tagOrClassName - A tag or class name.
430 *
431 * @return {Element|undefined} - A found element on success or undefined on failure.
432 */
433
434function child(parent, tagOrClassName) {
435  return children(parent, tagOrClassName)[0];
436}
437/**
438 * Return chile elements that matches the provided tag or class name.
439 *
440 * @param {Element} parent         - A parent element.
441 * @param {string}  tagOrClassName - A tag or class name.
442 *
443 * @return {Element[]} - Found elements.
444 */
445
446function children(parent, tagOrClassName) {
447  if (parent) {
448    return values(parent.children).filter(function (child) {
449      return hasClass(child, tagOrClassName.split(' ')[0]) || child.tagName === tagOrClassName;
450    });
451  }
452
453  return [];
454}
455/**
456 * Create an element with some optional attributes.
457 *
458 * @param {string} tag   - A tag name.
459 * @param {Object} attrs - An object any attribute pairs of name and value.
460 *
461 * @return {Element} - A created element.
462 */
463
464function create(tag, attrs) {
465  var elm = document.createElement(tag);
466  each(attrs, function (value, key) {
467    return setAttribute(elm, key, value);
468  });
469  return elm;
470}
471/**
472 * Convert HTML string to DOM node.
473 *
474 * @param {string} html - HTML string.
475 *
476 * @return {Node} - A created node.
477 */
478
479function domify(html) {
480  var div = create('div', {});
481  div.innerHTML = html;
482  return div.firstChild;
483}
484/**
485 * Remove a given element from a DOM tree.
486 *
487 * @param {Element|Element[]} elms - Element(s) to be removed.
488 */
489
490function dom_remove(elms) {
491  toArray(elms).forEach(function (elm) {
492    if (elm) {
493      var parent = elm.parentElement;
494      parent && parent.removeChild(elm);
495    }
496  });
497}
498/**
499 * Append a child to a given element.
500 *
501 * @param {Element} parent - A parent element.
502 * @param {Element} child  - An element to be appended.
503 */
504
505function append(parent, child) {
506  if (parent) {
507    parent.appendChild(child);
508  }
509}
510/**
511 * Insert an element before the reference element.
512 *
513 * @param {Element|Node} ref - A reference element.
514 * @param {Element}      elm - An element to be inserted.
515 */
516
517function before(elm, ref) {
518  if (elm && ref) {
519    var parent = ref.parentElement;
520    parent && parent.insertBefore(elm, ref);
521  }
522}
523/**
524 * Apply styles to the given element.
525 *
526 * @param {Element} elm     - An element where styles are applied.
527 * @param {Object}  styles  - Object containing styles.
528 */
529
530function applyStyle(elm, styles) {
531  if (elm) {
532    each(styles, function (value, prop) {
533      if (value !== null) {
534        elm.style[prop] = value;
535      }
536    });
537  }
538}
539/**
540 * Add or remove classes to/from the element.
541 * This function is for internal usage.
542 *
543 * @param {Element}         elm     - An element where classes are added.
544 * @param {string|string[]} classes - Class names being added.
545 * @param {boolean}         remove  - Whether to remove or add classes.
546 */
547
548function addOrRemoveClasses(elm, classes, remove) {
549  if (elm) {
550    toArray(classes).forEach(function (name) {
551      if (name) {
552        elm.classList[remove ? 'remove' : 'add'](name);
553      }
554    });
555  }
556}
557/**
558 * Add classes to the element.
559 *
560 * @param {Element}          elm     - An element where classes are added.
561 * @param {string|string[]}  classes - Class names being added.
562 */
563
564
565function addClass(elm, classes) {
566  addOrRemoveClasses(elm, classes, false);
567}
568/**
569 * Remove a class from the element.
570 *
571 * @param {Element}         elm     - An element where classes are removed.
572 * @param {string|string[]} classes - A class name being removed.
573 */
574
575function removeClass(elm, classes) {
576  addOrRemoveClasses(elm, classes, true);
577}
578/**
579 * Verify if the provided element has the class or not.
580 *
581 * @param {Element} elm       - An element.
582 * @param {string}  className - A class name.
583 *
584 * @return {boolean} - True if the element has the class or false if not.
585 */
586
587function hasClass(elm, className) {
588  return !!elm && elm.classList.contains(className);
589}
590/**
591 * Set attribute to the given element.
592 *
593 * @param {Element}                 elm   - An element where an attribute is assigned.
594 * @param {string}                  name  - Attribute name.
595 * @param {string|number|boolean}   value - Attribute value.
596 */
597
598function setAttribute(elm, name, value) {
599  if (elm) {
600    elm.setAttribute(name, value);
601  }
602}
603/**
604 * Get attribute from the given element.
605 *
606 * @param {Element} elm  - An element where an attribute is assigned.
607 * @param {string}  name - Attribute name.
608 *
609 * @return {string} - The value of the given attribute if available. An empty string if not.
610 */
611
612function getAttribute(elm, name) {
613  return elm ? elm.getAttribute(name) : '';
614}
615/**
616 * Remove attribute from the given element.
617 *
618 * @param {Element|Element[]} elms  - An element where an attribute is removed.
619 * @param {string|string[]}      names - Attribute name.
620 */
621
622function removeAttribute(elms, names) {
623  toArray(names).forEach(function (name) {
624    toArray(elms).forEach(function (elm) {
625      return elm && elm.removeAttribute(name);
626    });
627  });
628}
629/**
630 * Return the Rect object of the provided object.
631 *
632 * @param {Element} elm - An element.
633 *
634 * @return {ClientRect|DOMRect} - A rect object.
635 */
636
637function getRect(elm) {
638  return elm.getBoundingClientRect();
639}
640/**
641 * Trigger the given callback after all images contained by the element are loaded.
642 *
643 * @param {Element}  elm      - Element that may contain images.
644 * @param {Function} callback - Callback function fired right after all images are loaded.
645 */
646
647function loaded(elm, callback) {
648  var images = elm.querySelectorAll('img');
649  var length = images.length;
650
651  if (length) {
652    var count = 0;
653    each(images, function (img) {
654      img.onload = img.onerror = function () {
655        if (++count === length) {
656          callback();
657        }
658      };
659    });
660  } else {
661    // Trigger the callback immediately if there is no image.
662    callback();
663  }
664}
665;// CONCATENATED MODULE: ./src/js/constants/types.js
666/**
667 * Export slider types.
668 *
669 * @author    Naotoshi Fujita
670 * @copyright Naotoshi Fujita. All rights reserved.
671 */
672
673/**
674 * Normal slider.
675 *
676 * @type {string}
677 */
678var SLIDE = 'slide';
679/**
680 * Loop after the last slide and before the first one.
681 *
682 * @type {string}
683 */
684
685var LOOP = 'loop';
686/**
687 * The track doesn't move.
688 *
689 * @type {string}
690 */
691
692var FADE = 'fade';
693;// CONCATENATED MODULE: ./src/js/transitions/slide/index.js
694/**
695 * The component for general slide effect transition.
696 *
697 * @author    Naotoshi Fujita
698 * @copyright Naotoshi Fujita. All rights reserved.
699 */
700
701
702/**
703 * The component for general slide effect transition.
704 *
705 * @param {Splide} Splide     - A Splide instance.
706 * @param {Object} Components - An object containing components.
707 *
708 * @return {Object} - The component object.
709 */
710
711/* harmony default export */ var slide = (function (Splide, Components) {
712  /**
713   * Hold the list element.
714   *
715   * @type {Element}
716   */
717  var list;
718  /**
719   * Hold the onEnd callback function.
720   *
721   * @type {function}
722   */
723
724  var endCallback;
725  return {
726    /**
727     * Called when the component is mounted.
728     */
729    mount: function mount() {
730      list = Components.Elements.list;
731      Splide.on('transitionend', function (e) {
732        if (e.target === list && endCallback) {
733          endCallback();
734        }
735      }, list);
736    },
737
738    /**
739     * Start transition.
740     *
741     * @param {number}   destIndex - Destination slide index that might be clone's.
742     * @param {number}   newIndex  - New index.
743     * @param {number}   prevIndex - Previous index.
744     * @param {Object}   coord     - Destination coordinates.
745     * @param {function} done      - Callback function must be invoked when transition is completed.
746     */
747    start: function start(destIndex, newIndex, prevIndex, coord, done) {
748      var options = Splide.options;
749      var edgeIndex = Components.Controller.edgeIndex;
750      var speed = options.speed;
751      endCallback = done;
752
753      if (Splide.is(SLIDE)) {
754        if (prevIndex === 0 && newIndex >= edgeIndex || prevIndex >= edgeIndex && newIndex === 0) {
755          speed = options.rewindSpeed || speed;
756        }
757      }
758
759      applyStyle(list, {
760        transition: "transform " + speed + "ms " + options.easing,
761        transform: "translate(" + coord.x + "px," + coord.y + "px)"
762      });
763    }
764  };
765});
766;// CONCATENATED MODULE: ./src/js/transitions/fade/index.js
767/**
768 * The component for fade transition.
769 *
770 * @author    Naotoshi Fujita
771 * @copyright Naotoshi Fujita. All rights reserved.
772 */
773
774
775/**
776 * The component for fade transition.
777 *
778 * @param {Splide} Splide     - A Splide instance.
779 * @param {Object} Components - An object containing components.
780 *
781 * @return {Object} - The component object.
782 */
783
784/* harmony default export */ var fade = (function (Splide, Components) {
785  var Fade = {
786    /**
787     * Called when the component is mounted.
788     * Apply transition style to the first slide.
789     */
790    mount: function mount() {
791      apply(Splide.index);
792    },
793
794    /**
795     * Start transition.
796     *
797     * @param {number}
797    destIndex - Destination slide index that might be clone's.
798     * @param {number}    newIndex  - New index.
799     * @param {number}    prevIndex - Previous index.
800     * @param {Object}    coord     - Destination coordinates.
801     * @param {function}  done      - Callback function must be invoked when transition is completed.
802     */
803    start: function start(destIndex, newIndex, prevIndex, coord, done) {
804      var track = Components.Elements.track;
805      applyStyle(track, {
806        height: unit(track.clientHeight)
807      });
808      apply(newIndex);
809      setTimeout(function () {
810        done();
811        applyStyle(track, {
812          height: ''
813        });
814      });
815    }
816  };
817  /**
818   * Apply transition style to the slide specified by the given index.
819   *
820   * @param {number} index - A slide index.
821   */
822
823  function apply(index) {
824    var options = Splide.options;
825    applyStyle(Components.Elements.slides[index], {
826      transition: "opacity " + options.speed + "ms " + options.easing
827    });
828  }
829
830  return Fade;
831});
832;// CONCATENATED MODULE: ./src/js/transitions/index.js
833/**
834 * Export transition components.
835 *
836 * @author    Naotoshi Fujita
837 * @copyright Naotoshi Fujita. All rights reserved.
838 */
839
840
841;// CONCATENATED MODULE: ./src/js/core/composer.js
842/**
843 * Provide a function for composing components.
844 *
845 * @author    Naotoshi Fujita
846 * @copyright Naotoshi Fujita. All rights reserved.
847 */
848
849
850
851/**
852 * Compose components.
853 *
854 * @param {Splide}   Splide     - Splide instance.
855 * @param {Object}   Components - Additional components.
856 * @param {function} Transition - Change component for transition.
857 *
858 * @return {Object} - An object containing all components.
859 */
860
861function compose(Splide, Components, Transition) {
862  var components = {};
863  each(Components, function (Component, name) {
864    components[name] = Component(Splide, components, name.toLowerCase());
865  });
866
867  if (!Transition) {
868    Transition = Splide.is(FADE) ? fade : slide;
869  }
870
871  components.Transition = Transition(Splide, components);
872  return components;
873}
874;// CONCATENATED MODULE: ./src/js/utils/error.js
875/**
876 * Utility functions for outputting logs.
877 *
878 * @author    Naotoshi Fujita
879 * @copyright Naotoshi Fujita. All rights reserved.
880 */
881
882/**
883 * Prefix of an error massage.
884 *
885 * @type {string}
886 */
887var MESSAGE_PREFIX = '[SPLIDE]';
888/**
889 * Display an error message on the browser console.
890 *
891 * @param {string} message - An error message.
892 */
893
894function error(message) {
895  console.error(MESSAGE_PREFIX + " " + message);
896}
897/**
898 * Check existence of the given object and throw an error if it doesn't.
899 *
900 * @throws {Error}
901 *
902 * @param {*}      subject - A subject to be confirmed.
903 * @param {string} message - An error message.
904 */
905
906function exist(subject, message) {
907  if (!subject) {
908    throw new Error(message);
909  }
910}
911;// CONCATENATED MODULE: ./src/js/constants/classes.js
912/**
913 * Export class names.
914 *
915 * @author    Naotoshi Fujita
916 * @copyright Naotoshi Fujita. All rights reserved.
917 */
918
919/**
920 * A root class name.
921 *
922 * @type {string}
923 */
924var ROOT = 'splide';
925/**
926 * The definition table of all classes for elements.
927 * They might be modified by options.
928 *
929 * @type {Object}
930 */
931
932var ELEMENT_CLASSES = {
933  root: ROOT,
934  slider: ROOT + "__slider",
935  track: ROOT + "__track",
936  list: ROOT + "__list",
937  slide: ROOT + "__slide",
938  container: ROOT + "__slide__container",
939  arrows: ROOT + "__arrows",
940  arrow: ROOT + "__arrow",
941  prev: ROOT + "__arrow--prev",
942  next: ROOT + "__arrow--next",
943  pagination: ROOT + "__pagination",
944  page: ROOT + "__pagination__page",
945  clone: ROOT + "__slide--clone",
946  progress: ROOT + "__progress",
947  bar: ROOT + "__progress__bar",
948  autoplay: ROOT + "__autoplay",
949  play: ROOT + "__play",
950  pause: ROOT + "__pause",
951  spinner: ROOT + "__spinner",
952  sr: ROOT + "__sr"
953};
954/**
955 * Definitions of status classes.
956 *
957 * @type {Object}
958 */
959
960var STATUS_CLASSES = {
961  active: 'is-active',
962  visible: 'is-visible',
963  loading: 'is-loading'
964};
965;// CONCATENATED MODULE: ./src/js/constants/i18n.js
966/**
967 * Export i18n texts as object.
968 *
969 * @author    Naotoshi Fujita
970 * @copyright Naotoshi Fujita. All rights reserved.
971 */
972
973/**
974 * Texts for i18n.
975 *
976 * @type {Object}
977 */
978var I18N = {
979  prev: 'Previous slide',
980  next: 'Next slide',
981  first: 'Go to first slide',
982  last: 'Go to last slide',
983  slideX: 'Go to slide %s',
984  pageX: 'Go to page %s',
985  play: 'Start autoplay',
986  pause: 'Pause autoplay'
987};
988;// CONCATENATED MODULE: ./src/js/constants/defaults.js
989/**
990 * Export default options.
991 *
992 * @author    Naotoshi Fujita
993 * @copyright Naotoshi Fujita. All rights reserved.
994 */
995
996
997var DEFAULTS = {
998  /**
999   * Determine a slider type.
1000   * - 'slide': Regular slider.
1001   * - 'loop' : Carousel slider.
1002   * - 'fade' : Change slides with fade transition. perPage, drag options are ignored.
1003   *
1004   * @type {string}
1005   */
1006  type: 'slide',
1007
1008  /**
1009   * Whether to rewind a slider before the first slide or after the last one.
1010   * In "loop" mode, this option is ignored.
1011   *
1012   * @type {boolean}
1013   */
1014  rewind: false,
1015
1016  /**
1017   * Transition speed in milliseconds.
1018   *
1019   * @type {number}
1020   */
1021  speed: 400,
1022
1023  /**
1024   * Transition speed on rewind in milliseconds.
1025   *
1026   * @type {number}
1027   */
1028  rewindSpeed: 0,
1029
1030  /**
1031   * Whether to prevent any actions while a slider is transitioning.
1032   * If false, navigation, drag and swipe work while the slider is running.
1033   * Even so, it will be forced to wait for transition in some cases in the loop mode to shift a slider.
1034   *
1035   * @type {boolean}
1036   */
1037  waitForTransition: true,
1038
1039  /**
1040   * Define slider max width.
1041   *
1042   * @type {number}
1043   */
1044  width: 0,
1045
1046  /**
1047   * Define slider height.
1048   *
1049   * @type {number}
1050   */
1051  height: 0,
1052
1053  /**
1054   * Fix width of slides. CSS format is allowed such as 10em, 80% or 80vw.
1055   * perPage number will be ignored when this option is falsy.
1056   *
1057   * @type {number|string}
1058   */
1059  fixedWidth: 0,
1060
1061  /**
1062   * Fix height of slides. CSS format is allowed such as 10em, 80vh but % unit is not accepted.
1063   * heightRatio option will be ignored when this option is falsy.
1064   *
1065   * @type {number|string}
1066   */
1067  fixedHeight: 0,
1068
1069  /**
1070   * Determine height of slides by ratio to a slider width.
1071   * This will be ignored when the fixedHeight is provided.
1072   *
1073   * @type {number}
1074   */
1075  heightRatio: 0,
1076
1077  /**
1078   * If true, slide width will be determined by the element width itself.
1079   * - perPage/perMove should be 1.
1080   *
1081   * @type {boolean}
1082   */
1083  autoWidth: false,
1084
1085  /**
1086   * If true, slide height will be determined by the element width itself.
1087   * - perPage/perMove should be 1.
1088   *
1089   * @type {boolean}
1090   */
1091  autoHeight: false,
1092
1093  /**
1094   * Determine how many slides should be displayed per page.
1095   *
1096   * @type {number}
1097   */
1098  perPage: 1,
1099
1100  /**
1101   * Determine how many slides should be moved when a slider goes to next or perv.
1102   *
1103   * @type {number}
1104   */
1105  perMove: 0,
1106
1107  /**
1108   * Determine manually how many clones should be generated on the left and right side.
1109   * The total number of clones will be twice of this number.
1110   *
1111   * @type {number}
1112   */
1113  clones: 0,
1114
1115  /**
1116   * Start index.
1117   *
1118   * @type {number}
1119   */
1120  start: 0,
1121
1122  /**
1123   * Determine which slide should be focused if there are multiple slides in a page.
1124   * A string "center" is acceptable for centering slides.
1125   *
1126   * @type {boolean|number|string}
1127   */
1128  focus: false,
1129
1130  /**
1131   * Gap between slides. CSS format is allowed such as 1em.
1132   *
1133   * @type {number|string}
1134   */
1135  gap: 0,
1136
1137  /**
1138   * Set padding-left/right in horizontal mode or padding-top/bottom in vertical one.
1139   * Give a single value to set a same size for both sides or
1140   * do an object for different sizes.
1141   * Also, CSS format is allowed such as 1em.
1142   *
1143   * @example
1144   * - 10: Number
1145   * - '1em': CSS format.
1146   * - { left: 0, right: 20 }: Object for different sizes in horizontal mode.
1147   * - { top: 0, bottom: 20 }: Object for different sizes in vertical mode.
1148   *
1149   * @type {number|string|Object}
1150   */
1151  padding: 0,
1152
1153  /**
1154   * Whether to append arrows.
1155   *
1156   * @type {boolean}
1157   */
1158  arrows: true,
1159
1160  /**
1161   * Change the arrow SVG path like 'm7.61 0.807-2.12...'.
1162   *
1163   * @type {string}
1164   */
1165  arrowPath: '',
1166
1167  /**
1168   * Whether to append pagination(indicator dots) or not.
1169   *
1170   * @type {boolean}
1171   */
1172  pagination: true,
1173
1174  /**
1175   * Activate autoplay.
1176   *
1177   * @type {boolean}
1178   */
1179  autoplay: false,
1180
1181  /**
1182   * Autoplay interval in milliseconds.
1183   *
1184   * @type {number}
1185   */
1186  interval: 5000,
1187
1188  /**
1189   * Whether to stop autoplay when a slider is hovered.
1190   *
1191   * @type {boolean}
1192   */
1193  pauseOnHover: true,
1194
1195  /**
1196   * Whether to stop autoplay when a slider elements are focused.
1197   * True is recommended for accessibility.
1198   *
1199   * @type {boolean}
1200   */
1201  pauseOnFocus: true,
1202
1203  /**
1204   * Whether to reset progress of the autoplay timer when resumed.
1205   *
1206   * @type {boolean}
1207   */
1208  resetProgress: true,
1209
1210  /**
1211   * Loading images lazily.
1212   * Image src must be provided by a data-splide-lazy attribute.
1213   *
1214   * - false: Do nothing.
1215   * - 'nearby': Only images around an active slide will be loaded.
1216   * - 'sequential': All images will be sequentially loaded.
1217   *
1218   * @type {boolean|string}
1219   */
1220  lazyLoad: false,
1221
1222  /**
1223   * This option works only when a lazyLoad option is "nearby".
1224   * Determine how many pages(not slides) around an active slide should be loaded beforehand.
1225   *
1226   * @type {number}
1227   */
1228  preloadPages: 1,
1229
1230  /**
1231   * Easing for CSS transition. For example, linear, ease or cubic-bezier().
1232   *
1233   * @type {string}
1234   */
1235  easing: 'cubic-bezier(.42,.65,.27,.99)',
1236
1237  /**
1238   * Whether to enable keyboard shortcuts
1239   * - true or 'global': Listen to keydown event of the document.
1240   * - 'focused': Listen to the keydown event of the slider root element. tabindex="0" will be added to the element.
1241   * - false: Disable keyboard shortcuts.
1242   *
1243   * @type {boolean|string}
1244   */
1245  keyboard: 'global',
1246
1247  /**
1248   * Whether to allow mouse drag and touch swipe.
1249   *
1250   * @type {boolean}
1251   */
1252  drag: true,
1253
1254  /**
1255   * The angle threshold for drag.
1256   * The slider starts moving only when the drag angle is less than this threshold.
1257   *
1258   * @type {number}
1259   */
1260  dragAngleThreshold: 30,
1261
1262  /**
1263   * Distance threshold for determining if the action is "flick" or "swipe".
1264   * When a drag distance is over this value, the action will be treated as "swipe", not "flick".
1265   *
1266   * @type {number}
1267   */
1268  swipeDistanceThreshold: 150,
1269
1270  /**
1271   * Velocity threshold for determining if the action is "flick" or "swipe".
1272   * Around 0.5 is recommended.
1273   *
1274   * @type {number}
1275   */
1276  flickVelocityThreshold: .6,
1277
1278  /**
1279   * Determine power of flick. The larger number this is, the farther a slider runs by flick.
1280   * Around 500 is recommended.
1281   *
1282   * @type {number}
1283   */
1284  flickPower: 600,
1285
1286  /**
1287   * Limit a number of pages to move by flick.
1288   *
1289   * @type {number}
1290   */
1291  flickMaxPages: 1,
1292
1293  /**
1294   * Slider direction.
1295   * - 'ltr': Left to right.
1296   * - 'rtl': Right to left.
1297   * - 'ttb': Top to bottom.
1298   *
1299   * @type {string}
1300   */
1301  direction: 'ltr',
1302
1303  /**
1304   * Set img src to background-image of its parent element.
1305   * Images with various sizes can be displayed as same dimension without cropping work.
1306   * fixedHeight or heightRatio is required.
1307   *
1308   * @type {boolean}
1309   */
1310  cover: false,
1311
1312  /**
1313   * Whether to enable accessibility(aria and screen reader texts) or not.
1314   *
1315   * @type {boolean}
1316   */
1317  accessibility: true,
1318
1319  /**
1320   * Whether to add tabindex="0" to visible slides or not.
1321   *
1322   * @type {boolean}
1323   */
1324  slideFocus: true,
1325
1326  /**
1327   * Determine if a slider is navigation for another.
1328   * Use "sync" API to synchronize two sliders.
1329   *
1330   * @type {boolean}
1331   */
1332  isNavigation: false,
1333
1334  /**
1335   * Whether to trim spaces before the fist slide or after the last one when "focus" is not 0.
1336   *
1337   * @type {boolean}
1338   */
1339  trimSpace: true,
1340
1341  /**
1342   * The "is-active" class is added after transition as default.
1343   * If true, it will be added before move.
1344   *
1345   * @type {boolean}
1346   */
1347  updateOnMove: false,
1348
1349  /**
1350   * Throttle duration in milliseconds for the resize event.
1351   *
1352   * @type {number}
1353   */
1354  throttle: 100,
1355
1356  /**
1357   * Whether to destroy a slider or not.
1358   *
1359   * @type {boolean}
1360   */
1361  destroy: false,
1362
1363  /**
1364   * Options for specific breakpoints.
1365   *
1366   * @example
1367   * {
1368   *   1000: {
1369   *     perPage: 3,
1370   *     gap: 20
1371   *   },
1372   *   600: {
1373   *     perPage: 1,
1374   *     gap: 5,
1375   *   }
1376   * }
1377   *
1378   * @type {boolean|Object}
1379   */
1380  breakpoints: false,
1381
1382  /**
1383   * Collection of class names.
1384   *
1385   * @see ./classes.js
1386   *
1387   * @type {Object}
1388   */
1389  classes: ELEMENT_CLASSES,
1390
1391  /**
1392   * Collection of i18n texts.
1393   *
1394   * @see ./i18n.js
1395   *
1396   * @type {Object}
1397   */
1398  i18n: I18N
1399};
1400;// CONCATENATED MODULE: ./src/js/constants/states.js
1401/**
1402 * Export state constants.
1403 *
1404 * @author    Naotoshi Fujita
1405 * @copyright Naotoshi Fujita. All rights reserved.
1406 */
1407
1408/**
1409 * Splide has been just created.
1410 *
1411 * @type {number}
1412 */
1413var CREATED = 1;
1414/**
1415 * All components have been mounted and initialized.
1416 *
1417 * @type {number}
1418 */
1419
1420var MOUNTED = 2;
1421/**
1422 * Splide is ready for transition.
1423 *
1424 * @type {number}
1425 */
1426
1427var IDLE = 3;
1428/**
1429 * Splide is moving.
1430 *
1431 * @type {number}
1432 */
1433
1434var MOVING = 4;
1435/**
1436 * Splide is moving.
1437 *
1438 * @type {number}
1439 */
1440
1441var DESTROYED = 5;
1442;// CONCATENATED MODULE: ./src/js/splide.js
1443function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1444
1445function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1446
1447/**
1448 * The main class for applying Splide to an element.
1449 *
1450 * @author    Naotoshi Fujita
1451 * @copyright Naotoshi Fujita. All rights reserved.
1452 */
1453
1454
1455
1456
1457
1458
1459
1460
1461/**
1462 * The main class for applying Splide to an element,
1463 * providing some APIs to control the behavior.
1464 */
1465
1466var Splide = /*#__PURE__*/function () {
1467  /**
1468   * Splide constructor.
1469   *
1470   * @throws {Error} When the given root element or selector is invalid.
1471   *
1472   * @param {Element|string}  root       - A selector for a root element or an element itself.
1473   * @param {Object}          options    - Optional. Options to change default behaviour.
1474   * @param {Object}          Components - Optional. Components.
1475   */
1476  function Splide(root, options, Components) {
1477    if (options === void 0) {
1478      options = {};
1479    }
1480
1481    if (Components === void 0) {
1482      Components = {};
1483    }
1484
1485    this.root = root instanceof Element ? root : document.querySelector(root);
1486    exist(this.root, 'An invalid element/selector was given.');
1487    this.Components = null;
1488    this.Event = core_event();
1489    this.State = state(CREATED);
1490    this.STATES = states_namespaceObject;
1491    this._o = merge(DEFAULTS, options);
1492    this._i = 0;
1493    this._c = Components;
1494    this._e = {}; // Extensions
1495
1496    this._t = null; // Transition
1497  }
1498  /**
1499   * Compose and mount components.
1500   *
1501   * @param {Object}   Extensions - Optional. Additional components.
1502   * @param {function} Transition - Optional. Set a custom transition component.
1503   *
1504   * @return {Splide|undefined} - This instance or undefined if an exception occurred.
1505   */
1506
1507
1508  var _proto = Splide.prototype;
1509
1510  _proto.mount = function mount(Extensions, Transition) {
1511    var _this = this;
1512
1513    if (Extensions === void 0) {
1514      Extensions = this._e;
1515    }
1516
1517    if (Transition === void 0) {
1518      Transition = this._t;
1519    }
1520
1521    // Reset the state.
1522    this.State.set(CREATED);
1523    this._e = Extensions;
1524    this._t = Transition;
1525    this.Components = compose(this, merge(this._c, Extensions), Transition);
1526
1527    try {
1528      each(this.Components, function (component, key) {
1529        var required = component.required;
1530
1531        if (required === undefined || required) {
1532          component.mount && component.mount();
1533        } else {
1534          delete _this.Components[key];
1535        }
1536      });
1537    } catch (e) {
1538      error(e.message);
1539      return;
1540    }
1541
1542    var State = this.State;
1543    State.set(MOUNTED);
1544    each(this.Components, function (component) {
1545      component.mounted && component.mounted();
1546    });
1547    this.emit('mounted');
1548    State.set(IDLE);
1549    this.emit('ready');
1550    applyStyle(this.root, {
1551      visibility: 'visible'
1552    });
1553    this.on('move drag', function () {
1554      return State.set(MOVING);
1555    }).on('moved dragged', function () {
1556      return State.set(IDLE);
1557    });
1558    return this;
1559  }
1560  /**
1561   * Set sync target.
1562   *
1563   * @param {Splide} splide - A Splide instance.
1564   *
1565   * @return {Splide} - This instance.
1566   */
1567  ;
1568
1569  _proto.sync = function sync(splide) {
1570    this.sibling = splide;
1571    return this;
1572  }
1573  /**
1574   * Register callback fired on the given event(s).
1575   *
1576   * @param {string}   events  - An event name. Use space to separate multiple events.
1577   *                             Also, namespace is accepted by dot, such as 'resize.{namespace}'.
1578   * @param {function} handler - A callback function.
1579   * @param {Element}  elm     - Optional. Native event will be listened to when this arg is provided.
1580   * @param {Object}   options - Optional. Options for addEventListener.
1581   *
1582   * @return {Splide} - This instance.
1583   */
1584  ;
1585
1586  _proto.on = function on(events, handler, elm, options) {
1587    if (elm === void 0) {
1588      elm = null;
1589    }
1590
1591    if (options === void 0) {
1592      options = {};
1593    }
1594
1595    this.Event.on(events, handler, elm, options);
1596    return this;
1597  }
1598  /**
1599   * Unsubscribe the given event.
1600   *
1601   * @param {string}  events - A event name.
1602   * @param {Element} elm    - Optional. removeEventListener() will be called when this arg is provided.
1603   *
1604   * @return {Splide} - This instance.
1605   */
1606  ;
1607
1608  _proto.off = function off(events, elm) {
1609    if (elm === void 0) {
1610      elm = null;
1611    }
1612
1613    this.Event.off(events, elm);
1614    return this;
1615  }
1616  /**
1617   * Emit an event.
1618   *
1619   * @param {string} event - An event name.
1620   * @param {*}      args  - Any number of arguments passed to handlers.
1621   */
1622  ;
1623
1624  _proto.emit = function emit(event) {
1625    var _this$Event;
1626
1627    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1628      args[_key - 1] = arguments[_key];
1629    }
1630
1631    (_this$Event = this.Event).emit.apply(_this$Event, [event].concat(args));
1632
1633    return this;
1634  }
1635  /**
1636   * Go to the slide specified by the given control.
1637   *
1638   * @param {string|number} control - A control pattern.
1639   * @param {boolean}       wait    - Optional. Whether to wait for transition.
1640   */
1641  ;
1642
1643  _proto.go = function go(control, wait) {
1644    if (wait === void 0) {
1645      wait = this.options.waitForTransition;
1646    }
1647
1648    if (this.State.is(IDLE) || this.State.is(MOVING) && !wait) {
1649      this.Components.Controller.go(control, false);
1650    }
1651
1652    return this;
1653  }
1654  /**
1655   * Verify whether the slider type is the given one or not.
1656   *
1657   * @param {string} type - A slider type.
1658   *
1659   * @return {boolean} - True if the slider type is the provided type or false if not.
1660   */
1661  ;
1662
1663  _proto.is = function is(type) {
1664    return type === this._o.type;
1665  }
1666  /**
1667   * Insert a slide.
1668   *
1669   * @param {Element|string} slide - A slide element to be added.
1670   * @param {number}         index - A slide will be added at the position.
1671   */
1672  ;
1673
1674  _proto.add = function add(slide, index) {
1675    if (index === void 0) {
1676      index = -1;
1677    }
1678
1679    this.Components.Elements.add(slide, index, this.refresh.bind(this));
1680    return this;
1681  }
1682  /**
1683   * Remove the slide designated by the index.
1684   *
1685   * @param {number} index - A slide index.
1686   */
1687  ;
1688
1689  _proto.remove = function remove(index) {
1690    this.Components.Elements.remove(index);
1691    this.refresh();
1692    return this;
1693  }
1694  /**
1695   * Destroy all Slide objects and clones and recreate them again.
1696   */
1697  ;
1698
1699  _proto.refresh = function refresh() {
1700    this.emit('refresh:before').emit('refresh').emit('resize');
1701    return this;
1702  }
1703  /**
1704   * Destroy the Splide.
1705   * "Completely" boolean is mainly for breakpoints.
1706   *
1707   * @param {boolean} completely - Destroy completely.
1708   */
1709  ;
1710
1711  _proto.destroy = function destroy(completely) {
1712    var _this2 = this;
1713
1714    if (completely === void 0) {
1715      completely = true;
1716    }
1717
1718    // Postpone destroy because it should be done after mount.
1719    if (this.State.is(CREATED)) {
1720      this.on('ready', function () {
1721        return _this2.destroy(completely);
1722      });
1723      return;
1724    }
1725
1726    values(this.Components).reverse().forEach(function (component) {
1727      component.destroy && component.destroy(completely);
1728    });
1729    this.emit('destroy', completely); // Destroy all event handlers, including ones for native events.
1730
1731    this.Event.destroy();
1732    this.State.set(DESTROYED);
1733    return this;
1734  }
1735  /**
1736   * Return the current slide index.
1737   *
1738   * @return {number} - The current slide index.
1739   // */
1740  ;
1741
1742  _createClass(Splide, [{
1743    key: "index",
1744    get: function get() {
1745      return this._i;
1746    }
1747    /**
1748     * Set the current slide index.
1749     *
1750     * @param {number|string} index - A new index.
1751     */
1752    ,
1753    set: function set(index) {
1754      this._i = parseInt(index);
1755    }
1756    /**
1757     * Return length of slides.
1758     * This is an alias of Elements.length.
1759     *
1760     * @return {number} - A number of slides.
1761     */
1762
1763  }, {
1764    key: "length",
1765    get: function get() {
1766      return this.Components.Elements.length;
1767    }
1768    /**
1769     * Return options.
1770     *
1771     * @return {Object} - Options object.
1772     */
1773
1774  }, {
1775    key: "options",
1776    get: function get() {
1777      return this._o;
1778    }
1779    /**
1780     * Set options with merging the given object to the current one.
1781     *
1782     * @param {Object} options - New options.
1783     */
1784    ,
1785    set: function set(options) {
1786      var created = this.State.is(CREATED);
1787
1788      if (!created) {
1789        this.emit('update');
1790      }
1791
1792      this._o = merge(this._o, options);
1793
1794      if (!created) {
1795        this.emit('updated', this._o);
1796      }
1797    }
1798    /**
1799     * Return the class list.
1800     * This is an alias of Splide.options.classList.
1801     *
1802     * @return {Object} - An object containing all class list.
1803     */
1804
1805  }, {
1806    key: "classes",
1807    get: function get() {
1808      return this._o.classes;
1809    }
1810    /**
1811     * Return the i18n strings.
1812     * This is an alias of Splide.options.i18n.
1813     *
1814     * @return {Object} - An object containing all i18n strings.
1815     */
1816
1817  }, {
1818    key: "i18n",
1819    get: function get() {
1820      return this._o.i18n;
1821    }
1822  }]);
1823
1824  return Splide;
1825}();
1826
1827
1828;// CONCATENATED MODULE: ./src/js/components/options/index.js
1829/**
1830 * The component for initializing options.
1831 *
1832 * @author    Naotoshi Fujita
1833 * @copyright Naotoshi Fujita. All rights reserved.
1834 */
1835
1836
1837
1838/**
1839 * The component for initializing options.
1840 *
1841 * @param {Splide} Splide - A Splide instance.
1842 *
1843 * @return {Object} - The component object.
1844 */
1845
1846/* harmony default export */ var options = (function (Splide) {
1847  /**
1848   * Retrieve options from the data attribute.
1849   * Note that IE10 doesn't support dataset property.
1850   *
1851   * @type {string}
1852   */
1853  var options = getAttribute(Splide.root, 'data-splide');
1854
1855  if (options) {
1856    try {
1857      Splide.options = JSON.parse(options);
1858    } catch (e) {
1859      error(e.message);
1860    }
1861  }
1862
1863  return {
1864    /**
1865     * Called when the component is mounted.
1866     */
1867    mount: function mount() {
1868      if (Splide.State.is(CREATED)) {
1869        Splide.index = Splide.options.start;
1870      }
1871    }
1872  };
1873});
1874;// CONCATENATED MODULE: ./src/js/constants/directions.js
1875/**
1876 * Export layout modes.
1877 *
1878 * @author    Naotoshi Fujita
1879 * @copyright Naotoshi Fujita. All rights reserved.
1880 */
1881
1882/**
1883 * Enumerate slides from left to right.
1884 *
1885 * @type {string}
1886 */
1887var LTR = 'ltr';
1888/**
1889 * Enumerate slides from right to left.
1890 *
1891 * @type {string}
1892 */
1893
1894var RTL = 'rtl';
1895/**
1896 * Enumerate slides in a col.
1897 *
1898 * @type {string}
1899 */
1900
1901var TTB = 'ttb';
1902;// CONCATENATED MODULE: ./src/js/components/elements/slide.js
1903/**
1904 * The sub component for handling each slide.
1905 *
1906 * @author    Naotoshi Fujita
1907 * @copyright Naotoshi Fujita. All rights reserved.
1908 */
1909
1910
1911
1912
1913
1914
1915/**
1916 * Events for restoring original styles.
1917 *
1918 * @type {string}
1919 */
1920
1921var STYLE_RESTORE_EVENTS = 'update.slide';
1922/**
1923 * The sub component for handling each slide.
1924 *
1925 * @param {Splide}  Splide    - A Splide instance.
1926 * @param {number}  index     - An unique slide index.
1927 * @param {number}  realIndex - Clones should pass a real slide index.
1928 * @param {Element} slide     - A slide element.
1929 *
1930 * @return {Object} - The sub component object.
1931 */
1932
1933/* harmony default export */ var elements_slide = (function (Splide, index, realIndex, slide) {
1934  /**
1935   * Whether to update "is-active" class before or after transition.
1936   *
1937   * @type {boolean}
1938   */
1939  var updateOnMove = Splide.options.updateOnMove;
1940  /**
1941   * Events when the slide status is updated.
1942   * Append a namespace to remove listeners later.
1943   *
1944   * @type {string}
1945   */
1946
1947  var STATUS_UPDATE_EVENTS = 'ready.slide updated.slide resized.slide moved.slide' + (updateOnMove ? ' move.slide' : '');
1948  /**
1949   * Slide sub component object.
1950   *
1951   * @type {Object}
1952   */
1953
1954  var Slide = {
1955    /**
1956     * Slide element.
1957     *
1958     * @type {Element}
1959     */
1960    slide: slide,
1961
1962    /**
1963     * Slide index.
1964     *
1965     * @type {number}
1966     */
1967    index: index,
1968
1969    /**
1970     * Real index for clones.
1971     *
1972     * @type {number}
1973     */
1974    realIndex: realIndex,
1975
1976    /**
1977     * Container element if available.
1978     *
1979     * @type {Element|undefined}
1980     */
1981    container: child(slide, Splide.classes.container),
1982
1983    /**
1984     * Whether this is a cloned slide or not.
1985     *
1986     * @type {boolean}
1987     */
1988    isClone: realIndex > -1,
1989
1990    /**
1991     * Called when the component is mounted.
1992     */
1993    mount: function mount() {
1994      var _this = this;
1995
1996      if (!this.isClone) {
1997        slide.id = Splide.root.id + "-slide" + pad(index + 1);
1998      }
1999
2000      Splide.on(STATUS_UPDATE_EVENTS, function () {
2001        return _this.update();
2002      }).on(STYLE_RESTORE_EVENTS, restoreStyles).on('click', function () {
2003        return Splide.emit('click', _this);
2004      }, slide);
2005      /*
2006       * Add "is-active" class to a clone element temporarily
2007       * and it will be removed on "moved" event.
2008       */
2009
2010      if (updateOnMove) {
2011        Splide.on('move.slide', function (newIndex) {
2012          if (newIndex === realIndex) {
2013            _update(true, false);
2014          }
2015        });
2016      } // Make sure the slide is shown.
2017
2018
2019      applyStyle(slide, {
2020        display: ''
2021      }); // Hold the original styles.
2022
2023      this.styles = getAttribute(slide, 'style') || '';
2024    },
2025
2026    /**
2027     * Destroy.
2028     */
2029    destroy: function destroy() {
2030      Splide.off(STATUS_UPDATE_EVENTS).off(STYLE_RESTORE_EVENTS).off('click', slide);
2031      removeClass(slide, values(STATUS_CLASSES));
2032      restoreStyles();
2033      removeAttribute(this.container, 'style');
2034    },
2035
2036    /**
2037     * Update active and visible status.
2038     */
2039    update: function update() {
2040      _update(this.isActive(), false);
2041
2042      _update(this.isVisible(), true);
2043    },
2044
2045    /**
2046     * Check whether this slide is active or not.
2047     *
2048     * @return {boolean} - True if the slide is active or false if not.
2049     */
2050    isActive: function isActive() {
2051      return Splide.index === index;
2052    },
2053
2054    /**
2055     * Check whether this slide is visible in the viewport or not.
2056     *
2057     * @return {boolean} - True if the slide is visible or false if not.
2058     */
2059    isVisible: function isVisible() {
2060      var active = this.isActive();
2061
2062      if (Splide.is(FADE) || active) {
2063        return active;
2064      }
2065
2066      var ceil = Math.ceil;
2067      var trackRect = getRect(Splide.Components.Elements.track);
2068      var slideRect = getRect(slide);
2069
2070      if (Splide.options.direction === TTB) {
2071        return trackRect.top <= slideRect.top && slideRect.bottom <= ceil(trackRect.bottom);
2072      }
2073
2074      return trackRect.left <= slideRect.left && slideRect.right <= ceil(trackRect.right);
2075    },
2076
2077    /**
2078     * Calculate how far this slide is from another slide and
2079     * return true if the distance is within the given number.
2080     *
2081     * @param {number} from   - Index of a target slide.
2082     * @param {number} within - True if the slide is within this number.
2083     *
2084     * @return {boolean} - True if the slide is within the number or false otherwise.
2085     */
2086    isWithin: function isWithin(from, within) {
2087      var diff = Math.abs(from - index);
2088
2089      if (!Splide.is(SLIDE) && !this.isClone) {
2090        diff = Math.min(diff, Splide.length - diff);
2091      }
2092
2093      return diff < within;
2094    }
2095  };
2096  /**
2097   * Update classes for activity or visibility.
2098   *
2099   * @param {boolean} active        - Is active/visible or not.
2100   * @param {boolean} forVisibility - Toggle classes for activity or visibility.
2101   */
2102
2103  function _update(active, forVisibility) {
2104    var type = forVisibility ? 'visible' : 'active';
2105    var className = STATUS_CLASSES[type];
2106
2107    if (active) {
2108      addClass(slide, className);
2109      Splide.emit("" + type, Slide);
2110    } else {
2111      if (hasClass(slide, className)) {
2112        removeClass(slide, className);
2113        Splide.emit("" + (forVisibility ? 'hidden' : 'inactive'), Slide);
2114      }
2115    }
2116  }
2117  /**
2118   * Restore the original styles.
2119   */
2120
2121
2122  function restoreStyles() {
2123    setAttribute(slide, 'style', Slide.styles);
2124  }
2125
2126  return Slide;
2127});
2128;// CONCATENATED MODULE: ./src/js/components/elements/index.js
2129/**
2130 * The component for main elements.
2131 *
2132 * @author    Naotoshi Fujita
2133 * @copyright Naotoshi Fujita. All rights reserved.
2134 */
2135
2136
2137
2138
2139
2140/**
2141 * The property name for UID stored in a window object.
2142 *
2143 * @type {string}
2144 */
2145
2146var UID_NAME = 'uid';
2147/**
2148 * The component for main elements.
2149 *
2150 * @param {Splide} Splide     - A Splide instance.
2151 * @param {Object}
2151 Components - An object containing components.
2152 *
2153 * @return {Object} - The component object.
2154 */
2155
2156/* harmony default export */ var components_elements = (function (Splide, Components) {
2157  /**
2158   * Hold the root element.
2159   *
2160   * @type {Element}
2161   */
2162  var root = Splide.root;
2163  /**
2164   * Hold the class list.
2165   *
2166   * @type {Object}
2167   */
2168
2169  var classes = Splide.classes;
2170  /**
2171   * Store Slide objects.
2172   *
2173   * @type {Array}
2174   */
2175
2176  var Slides = [];
2177  /*
2178   * Assign unique ID to the root element if it doesn't have the one.
2179   * Note that IE doesn't support padStart() to fill the uid by 0.
2180   */
2181
2182  if (!root.id) {
2183    window.splide = window.splide || {};
2184    var uid = window.splide[UID_NAME] || 0;
2185    window.splide[UID_NAME] = ++uid;
2186    root.id = "splide" + pad(uid);
2187  }
2188  /**
2189   * Elements component object.
2190   *
2191   * @type {Object}
2192   */
2193
2194
2195  var Elements = {
2196    /**
2197     * Called when the component is mounted.
2198     * Collect main elements and store them as member properties.
2199     */
2200    mount: function mount() {
2201      var _this = this;
2202
2203      this.init();
2204      Splide.on('refresh', function () {
2205        _this.destroy();
2206
2207        _this.init();
2208      }).on('updated', function () {
2209        removeClass(root, getClasses());
2210        addClass(root, getClasses());
2211      });
2212    },
2213
2214    /**
2215     * Destroy.
2216     */
2217    destroy: function destroy() {
2218      Slides.forEach(function (Slide) {
2219        Slide.destroy();
2220      });
2221      Slides = [];
2222      removeClass(root, getClasses());
2223    },
2224
2225    /**
2226     * Initialization.
2227     */
2228    init: function init() {
2229      var _this2 = this;
2230
2231      collect();
2232      addClass(root, getClasses());
2233      this.slides.forEach(function (slide, index) {
2234        _this2.register(slide, index, -1);
2235      });
2236    },
2237
2238    /**
2239     * Register a slide to create a Slide object and handle its behavior.
2240     *
2241     * @param {Element} slide     - A slide element.
2242     * @param {number}  index     - A unique index. This can be negative.
2243     * @param {number}  realIndex - A real index for clones. Set -1 for real slides.
2244     */
2245    register: function register(slide, index, realIndex) {
2246      var SlideObject = elements_slide(Splide, index, realIndex, slide);
2247      SlideObject.mount();
2248      Slides.push(SlideObject);
2249    },
2250
2251    /**
2252     * Return the Slide object designated by the index.
2253     * Note that "find" is not supported by IE.
2254     *
2255     * @return {Object|undefined} - A Slide object if available. Undefined if not.
2256     */
2257    getSlide: function getSlide(index) {
2258      return Slides.filter(function (Slide) {
2259        return Slide.index === index;
2260      })[0];
2261    },
2262
2263    /**
2264     * Return all Slide objects.
2265     *
2266     * @param {boolean} includeClones - Whether to include cloned slides or not.
2267     *
2268     * @return {Object[]} - Slide objects.
2269     */
2270    getSlides: function getSlides(includeClones) {
2271      return includeClones ? Slides : Slides.filter(function (Slide) {
2272        return !Slide.isClone;
2273      });
2274    },
2275
2276    /**
2277     * Return Slide objects belonging to the given page.
2278     *
2279     * @param {number} page - A page number.
2280     *
2281     * @return {Object[]} - An array containing Slide objects.
2282     */
2283    getSlidesByPage: function getSlidesByPage(page) {
2284      var idx = Components.Controller.toIndex(page);
2285      var options = Splide.options;
2286      var max = options.focus !== false ? 1 : options.perPage;
2287      return Slides.filter(function (_ref) {
2288        var index = _ref.index;
2289        return idx <= index && index < idx + max;
2290      });
2291    },
2292
2293    /**
2294     * Insert a slide to a slider.
2295     * Need to refresh Splide after adding a slide.
2296     *
2297     * @param {Node|string} slide    - A slide element to be added.
2298     * @param {number}      index    - A slide will be added at the position.
2299     * @param {Function}    callback - Called right after the slide is added to the DOM tree.
2300     */
2301    add: function add(slide, index, callback) {
2302      if (typeof slide === 'string') {
2303        slide = domify(slide);
2304      }
2305
2306      if (slide instanceof Element) {
2307        var ref = this.slides[index]; // This will be removed in mount() of a Slide component.
2308
2309        applyStyle(slide, {
2310          display: 'none'
2311        });
2312
2313        if (ref) {
2314          before(slide, ref);
2315          this.slides.splice(index, 0, slide);
2316        } else {
2317          append(this.list, slide);
2318          this.slides.push(slide);
2319        }
2320
2321        loaded(slide, function () {
2322          callback && callback(slide);
2323        });
2324      }
2325    },
2326
2327    /**
2328     * Remove a slide from a slider.
2329     * Need to refresh Splide after removing a slide.
2330     *
2331     * @param index - Slide index.
2332     */
2333    remove: function remove(index) {
2334      dom_remove(this.slides.splice(index, 1)[0]);
2335    },
2336
2337    /**
2338     * Trigger the provided callback for each Slide object.
2339     *
2340     * @param {Function} callback - A callback function. The first argument will be the Slide object.
2341     */
2342    each: function each(callback) {
2343      Slides.forEach(callback);
2344    },
2345
2346    /**
2347     * Return slides length without clones.
2348     *
2349     * @return {number} - Slide length.
2350     */
2351    get length() {
2352      return this.slides.length;
2353    },
2354
2355    /**
2356     * Return "SlideObjects" length including clones.
2357     *
2358     * @return {number} - Slide length including clones.
2359     */
2360    get total() {
2361      return Slides.length;
2362    }
2363
2364  };
2365  /**
2366   * Collect elements.
2367   */
2368
2369  function collect() {
2370    Elements.slider = child(root, classes.slider);
2371    Elements.track = find(root, "." + classes.track);
2372    Elements.list = child(Elements.track, classes.list);
2373    exist(Elements.track && Elements.list, 'Track or list was not found.');
2374    Elements.slides = children(Elements.list, classes.slide);
2375    var arrows = findParts(classes.arrows);
2376    Elements.arrows = {
2377      prev: find(arrows, "." + classes.prev),
2378      next: find(arrows, "." + classes.next)
2379    };
2380    var autoplay = findParts(classes.autoplay);
2381    Elements.bar = find(findParts(classes.progress), "." + classes.bar);
2382    Elements.play = find(autoplay, "." + classes.play);
2383    Elements.pause = find(autoplay, "." + classes.pause);
2384    Elements.track.id = Elements.track.id || root.id + "-track";
2385    Elements.list.id = Elements.list.id || root.id + "-list";
2386  }
2387  /**
2388   * Return class names for the root element.
2389   */
2390
2391
2392  function getClasses() {
2393    var rootClass = classes.root;
2394    var options = Splide.options;
2395    return [rootClass + "--" + options.type, rootClass + "--" + options.direction, options.drag ? rootClass + "--draggable" : '', options.isNavigation ? rootClass + "--nav" : '', STATUS_CLASSES.active];
2396  }
2397  /**
2398   * Find parts only from children of the root or track.
2399   *
2400   * @return {Element} - A found element or undefined.
2401   */
2402
2403
2404  function findParts(className) {
2405    return child(root, className) || child(Elements.slider, className);
2406  }
2407
2408  return Elements;
2409});
2410;// CONCATENATED MODULE: ./src/js/components/controller/index.js
2411/**
2412 * The component for controlling the track.
2413 *
2414 * @author    Naotoshi Fujita
2415 * @copyright Naotoshi Fujita. All rights reserved.
2416 */
2417
2418
2419
2420var floor = Math.floor;
2421/**
2422 * The component for controlling the track.
2423 *
2424 * @param {Splide} Splide     - A Splide instance.
2425 * @param {Object} Components - An object containing components.
2426 *
2427 * @return {Object} - The component object.
2428 */
2429
2430/* harmony default export */ var controller = (function (Splide, Components) {
2431  /**
2432   * Store current options.
2433   *
2434   * @type {Object}
2435   */
2436  var options;
2437  /**
2438   * True if the slide is LOOP mode.
2439   *
2440   * @type {boolean}
2441   */
2442
2443  var isLoop;
2444  /**
2445   * Controller component object.
2446   *
2447   * @type {Object}
2448   */
2449
2450  var Controller = {
2451    /**
2452     * Called when the component is mounted.
2453     */
2454    mount: function mount() {
2455      options = Splide.options;
2456      isLoop = Splide.is(LOOP);
2457      bind();
2458    },
2459
2460    /**
2461     * Make track run by the given control.
2462     * - "+{i}" : Increment the slide index by i.
2463     * - "-{i}" : Decrement the slide index by i.
2464     * - "{i}"  : Go to the slide whose index is i.
2465     * - ">"    : Go to next page.
2466     * - "<"    : Go to prev page.
2467     * - ">{i}" : Go to page i.
2468     *
2469     * @param {string|number} control  - A control pattern.
2470     * @param {boolean}       silently - Go to the destination without event emission.
2471     */
2472    go: function go(control, silently) {
2473      var destIndex = this.trim(this.parse(control));
2474      Components.Track.go(destIndex, this.rewind(destIndex), silently);
2475    },
2476
2477    /**
2478     * Parse the given control and return the destination index for the track.
2479     *
2480     * @param {string} control - A control target pattern.
2481     *
2482     * @return {number} - A parsed target.
2483     */
2484    parse: function parse(control) {
2485      var index = Splide.index;
2486      var matches = String(control).match(/([+\-<>]+)(\d+)?/);
2487      var indicator = matches ? matches[1] : '';
2488      var number = matches ? parseInt(matches[2]) : 0;
2489
2490      switch (indicator) {
2491        case '+':
2492          index += number || 1;
2493          break;
2494
2495        case '-':
2496          index -= number || 1;
2497          break;
2498
2499        case '>':
2500        case '<':
2501          index = parsePage(number, index, indicator === '<');
2502          break;
2503
2504        default:
2505          index = parseInt(control);
2506      }
2507
2508      return index;
2509    },
2510
2511    /**
2512     * Compute index from the given page number.
2513     *
2514     * @param {number} page - Page number.
2515     *
2516     * @return {number} - A computed page number.
2517     */
2518    toIndex: function toIndex(page) {
2519      if (hasFocus()) {
2520        return page;
2521      }
2522
2523      var length = Splide.length;
2524      var perPage = options.perPage;
2525      var index = page * perPage;
2526      index = index - (this.pageLength * perPage - length) * floor(index / length); // Adjustment for the last page.
2527
2528      if (length - perPage <= index && index < length) {
2529        index = length - perPage;
2530      }
2531
2532      return index;
2533    },
2534
2535    /**
2536     * Compute page number from the given slide index.
2537     *
2538     * @param {number} index - Slide index.
2539     *
2540     * @return {number} - A computed page number.
2541     */
2542    toPage: function toPage(index) {
2543      if (hasFocus()) {
2544        return index;
2545      }
2546
2547      var length = Splide.length;
2548      var perPage = options.perPage; // Make the last "perPage" number of slides belong to the last page.
2549
2550      if (length - perPage <= index && index < length) {
2551        return floor((length - 1) / perPage);
2552      }
2553
2554      return floor(index / perPage);
2555    },
2556
2557    /**
2558     * Trim the given index according to the current mode.
2559     * Index being returned could be less than 0 or greater than the length in Loop mode.
2560     *
2561     * @param {number} index - An index being trimmed.
2562     *
2563     * @return {number} - A trimmed index.
2564     */
2565    trim: function trim(index) {
2566      if (!isLoop) {
2567        index = options.rewind ? this.rewind(index) : between(index, 0, this.edgeIndex);
2568      }
2569
2570      return index;
2571    },
2572
2573    /**
2574     * Rewind the given index if it's out of range.
2575     *
2576     * @param {number} index - An index.
2577     *
2578     * @return {number} - A rewound index.
2579     */
2580    rewind: function rewind(index) {
2581      var edge = this.edgeIndex;
2582
2583      if (isLoop) {
2584        while (index > edge) {
2585          index -= edge + 1;
2586        }
2587
2588        while (index < 0) {
2589          index += edge + 1;
2590        }
2591      } else {
2592        if (index > edge) {
2593          index = 0;
2594        } else if (index < 0) {
2595          index = edge;
2596        }
2597      }
2598
2599      return index;
2600    },
2601
2602    /**
2603     * Check if the direction is "rtl" or not.
2604     *
2605     * @return {boolean} - True if "rtl" or false if not.
2606     */
2607    isRtl: function isRtl() {
2608      return options.direction === RTL;
2609    },
2610
2611    /**
2612     * Return the page length.
2613     *
2614     * @return {number} - Max page number.
2615     */
2616    get pageLength() {
2617      var length = Splide.length;
2618      return hasFocus() ? length : Math.ceil(length / options.perPage);
2619    },
2620
2621    /**
2622     * Return the edge index.
2623     *
2624     * @return {number} - Edge index.
2625     */
2626    get edgeIndex() {
2627      var length = Splide.length;
2628
2629      if (!length) {
2630        return 0;
2631      }
2632
2633      if (hasFocus() || options.isNavigation || isLoop) {
2634        return length - 1;
2635      }
2636
2637      return length - options.perPage;
2638    },
2639
2640    /**
2641     * Return the index of the previous slide.
2642     *
2643     * @return {number} - The index of the previous slide if available. -1 otherwise.
2644     */
2645    get prevIndex() {
2646      var prev = Splide.index - 1;
2647
2648      if (isLoop || options.rewind) {
2649        prev = this.rewind(prev);
2650      }
2651
2652      return prev > -1 ? prev : -1;
2653    },
2654
2655    /**
2656     * Return the index of the next slide.
2657     *
2658     * @return {number} - The index of the next slide if available. -1 otherwise.
2659     */
2660    get nextIndex() {
2661      var next = Splide.index + 1;
2662
2663      if (isLoop || options.rewind) {
2664        next = this.rewind(next);
2665      }
2666
2667      return Splide.index < next && next <= this.edgeIndex || next === 0 ? next : -1;
2668    }
2669
2670  };
2671  /**
2672   * Listen to some events.
2673   */
2674
2675  function bind() {
2676    Splide.on('move', function (newIndex) {
2677      Splide.index = newIndex;
2678    }).on('updated refresh', function (newOptions) {
2679      options = newOptions || options;
2680      Splide.index = between(Splide.index, 0, Controller.edgeIndex);
2681    });
2682  }
2683  /**
2684   * Verify if the focus option is available or not.
2685   *
2686   * @return {boolean} - True if a slider has the focus option.
2687   */
2688
2689
2690  function hasFocus() {
2691    return options.focus !== false;
2692  }
2693  /**
2694   * Return the next or previous page index computed by the page number and current index.
2695   *
2696   * @param {number}  number - Specify the page number.
2697   * @param {number}  index  - Current index.
2698   * @param {boolean} prev   - Prev or next.
2699   *
2700   * @return {number} - Slide index.
2701   */
2702
2703
2704  function parsePage(number, index, prev) {
2705    if (number > -1) {
2706      return Controller.toIndex(number);
2707    }
2708
2709    var perMove = options.perMove;
2710    var sign = prev ? -1 : 1;
2711
2712    if (perMove) {
2713      return index + perMove * sign;
2714    }
2715
2716    return Controller.toIndex(Controller.toPage(index) + sign);
2717  }
2718
2719  return Controller;
2720});
2721;// CONCATENATED MODULE: ./src/js/components/track/index.js
2722/**
2723 * The component for moving list in the track.
2724 *
2725 * @author    Naotoshi Fujita
2726 * @copyright Naotoshi Fujita. All rights reserved.
2727 */
2728
2729
2730
2731
2732
2733var abs = Math.abs;
2734/**
2735 * The component for moving list in the track.
2736 *
2737 * @param {Splide} Splide     - A Splide instance.
2738 * @param {Object} Components - An object containing components.
2739 *
2740 * @return {Object} - The component object.
2741 */
2742
2743/* harmony default export */ var track = (function (Splide, Components) {
2744  /**
2745   * Hold the Layout component.
2746   *
2747   * @type {Object}
2748   */
2749  var Layout;
2750  /**
2751   * Hold the Layout component.
2752   *
2753   * @type {Object}
2754   */
2755
2756  var Elements;
2757  /**
2758   * Store the list element.
2759   *
2760   * @type {Element}
2761   */
2762
2763  var list;
2764  /**
2765   * Whether the current direction is vertical or not.
2766   *
2767   * @type {boolean}
2768   */
2769
2770  var isVertical = Splide.options.direction === TTB;
2771  /**
2772   * Whether the slider type is FADE or not.
2773   *
2774   * @type {boolean}
2775   */
2776
2777  var isFade = Splide.is(FADE);
2778  /**
2779   * Whether the slider direction is RTL or not.
2780   *
2781   * @type {boolean}
2782   */
2783
2784  var isRTL = Splide.options.direction === RTL;
2785  /**
2786   * This will be true while transitioning from the last index to the first one.
2787   *
2788   * @type {boolean}
2789   */
2790
2791  var isLoopPending = false;
2792  /**
2793   * Sign for the direction. Only RTL mode uses the positive sign.
2794   *
2795   * @type {number}
2796   */
2797
2798  var sign = isRTL ? 1 : -1;
2799  /**
2800   * Track component object.
2801   *
2802   * @type {Object}
2803   */
2804
2805  var Track = {
2806    /**
2807     * Make public the sign defined locally.
2808     *
2809     * @type {number}
2810     */
2811    sign: sign,
2812
2813    /**
2814     * Called when the component is mounted.
2815     */
2816    mount: function mount() {
2817      Elements = Components.Elements;
2818      Layout = Components.Layout;
2819      list = Elements.list;
2820    },
2821
2822    /**
2823     * Called after the component is mounted.
2824     * The resize event must be registered after the Layout's one is done.
2825     */
2826    mounted: function mounted() {
2827      var _this = this;
2828
2829      if (!isFade) {
2830        this.jump(0);
2831        Splide.on('mounted resize updated', function () {
2832          _this.jump(Splide.index);
2833        });
2834      }
2835    },
2836
2837    /**
2838     * Go to the given destination index.
2839     * After arriving there, the track is jump to the new index without animation, mainly for loop mode.
2840     *
2841     * @param {number}  destIndex - A destination index.
2842     *                              This can be negative or greater than slides length for reaching clones.
2843     * @param {number}  newIndex  - An actual new index. They are always same in Slide and Rewind mode.
2844     * @param {boolean} silently  - If true, suppress emitting events.
2845     */
2846    go: function go(destIndex, newIndex, silently) {
2847      var newPosition = getTrimmedPosition(destIndex);
2848      var prevIndex = Splide.index; // Prevent any actions while transitioning from the last index to the first one for jump.
2849
2850      if (Splide.State.is(MOVING) && isLoopPending) {
2851        return;
2852      }
2853
2854      isLoopPending = destIndex !== newIndex;
2855
2856      if (!silently) {
2857        Splide.emit('move', newIndex, prevIndex, destIndex);
2858      }
2859
2860      if (Math.abs(newPosition - this.position) >= 1 || isFade) {
2861        Components.Transition.start(destIndex, newIndex, prevIndex, this.toCoord(newPosition), function () {
2862          onTransitionEnd(destIndex, newIndex, prevIndex, silently);
2863        });
2864      } else {
2865        if (destIndex !== prevIndex && Splide.options.trimSpace === 'move') {
2866          Components.Controller.go(destIndex + destIndex - prevIndex, silently);
2867        } else {
2868          onTransitionEnd(destIndex, newIndex, prevIndex, silently);
2869        }
2870      }
2871    },
2872
2873    /**
2874     * Move the track to the specified index.
2875     *
2876     * @param {number} index - A destination index where the track jumps.
2877     */
2878    jump: function jump(index) {
2879      this.translate(getTrimmedPosition(index));
2880    },
2881
2882    /**
2883     * Set the list position by CSS translate property.
2884     *
2885     * @param {number} position - A new position value.
2886     */
2887    translate: function translate(position) {
2888      applyStyle(list, {
2889        transform: "translate" + (isVertical ? 'Y' : 'X') + "(" + position + "px)"
2890      });
2891    },
2892
2893    /**
2894     * Cancel the transition and set the list position.
2895     * Also, loop the slider if necessary.
2896     */
2897    cancel: function cancel() {
2898      if (Splide.is(LOOP)) {
2899        this.shift();
2900      } else {
2901        // Ensure the current position.
2902        this.translate(this.position);
2903      }
2904
2905      applyStyle(list, {
2906        transition: ''
2907      });
2908    },
2909
2910    /**
2911     * Shift the slider if it exceeds borders on the edge.
2912     */
2913    shift: function shift() {
2914      var position = abs(this.position);
2915      var left = abs(this.toPosition(0));
2916      var right = abs(this.toPosition(Splide.length));
2917      var innerSize = right - left;
2918
2919      if (position < left) {
2920        position += innerSize;
2921      } else if (position > right) {
2922        position -= innerSize;
2923      }
2924
2925      this.translate(sign * position);
2926    },
2927
2928    /**
2929     * Trim redundant spaces on the left or right edge if necessary.
2930     *
2931     * @param {number} position - Position value to be trimmed.
2932     *
2933     * @return {number} - Trimmed position.
2934     */
2935    trim: function trim(position) {
2936      if (!Splide.options.trimSpace || Splide.is(LOOP)) {
2937        return position;
2938      }
2939
2940      var edge = sign * (Layout.totalSize() - Layout.size - Layout.gap);
2941      return between(position, edge, 0);
2942    },
2943
2944    /**
2945     * Calculate the closest slide index from the given position.
2946     *
2947     * @param {number} position - A position converted to an slide index.
2948     *
2949     * @return {number} - The closest slide index.
2950     */
2951    toIndex: function toIndex(position) {
2952      var _this2 = this;
2953
2954      var index = 0;
2955      var minDistance = Infinity;
2956      Elements.getSlides(true).forEach(function (Slide) {
2957        var slideIndex = Slide.index;
2958        var distance = abs(_this2.toPosition(slideIndex) - position);
2959
2960        if (distance < minDistance) {
2961          minDistance = distance;
2962          index = slideIndex;
2963        }
2964      });
2965      return index;
2966    },
2967
2968    /**
2969     * Return coordinates object by the given position.
2970     *
2971     * @param {number} position - A position value.
2972     *
2973     * @return {Object} - A coordinates object.
2974     */
2975    toCoord: function toCoord(position) {
2976      return {
2977        x: isVertical ? 0 : position,
2978        y: isVertical ? position : 0
2979      };
2980    },
2981
2982    /**
2983     * Calculate the track position by a slide index.
2984     *
2985     * @param {number} index - Slide index.
2986     *
2987     * @return {Object} - Calculated position.
2988     */
2989    toPosition: function toPosition(index) {
2990      var position = Layout.totalSize(index) - Layout.slideSize(index) - Layout.gap;
2991      return sign * (position + this.offset(index));
2992    },
2993
2994    /**
2995     * Return the current offset value, considering direction.
2996     *
2997     * @return {number} - Offset amount.
2998     */
2999    offset: function offset(index) {
3000      var focus = Splide.options.focus;
3001      var slideSize = Layout.slideSize(index);
3002
3003      if (focus === 'center') {
3004        return -(Layout.size - slideSize) / 2;
3005      }
3006
3007      return -(parseInt(focus) || 0) * (slideSize + Layout.gap);
3008    },
3009
3010    /**
3011     * Return the current position.
3012     * This returns the correct position even while transitioning by CSS.
3013     *
3014     * @return {number} - Current position.
3015     */
3016    get position() {
3017      var prop = isVertical ? 'top' : isRTL ? 'right' : 'left';
3018      return getRect(list)[prop] - (getRect(Elements.track)[prop] - Layout.padding[prop] * sign);
3019    }
3020
3021  };
3022  /**
3023   * Called whenever slides arrive at a destination.
3024   *
3025   * @param {number}  destIndex - A destination index.
3026   * @param {number}  newIndex  - A new index.
3027   * @param {number}  prevIndex - A previous index.
3028   * @param {boolean} silently  - If true, suppress emitting events.
3029   */
3030
3031  function onTransitionEnd(destIndex, newIndex, prevIndex, silently) {
3032    applyStyle(list, {
3033      transition: ''
3034    });
3035    isLoopPending = false;
3036
3037    if (!isFade) {
3038      Track.jump(newIndex);
3039    }
3040
3041    if (!silently) {
3042      Splide.emit('moved', newIndex, prevIndex, destIndex);
3043    }
3044  }
3045  /**
3046   * Convert index to the trimmed position.
3047   *
3048   * @return {number} - Trimmed position.
3049   */
3050
3051
3052  function getTrimmedPosition(index) {
3053    return Track.trim(Track.toPosition(index));
3054  }
3055
3056  return Track;
3057});
3058;// CONCATENATED MODULE: ./src/js/components/clones/index.js
3059/**
3060 * The component for cloning some slides for "loop" mode of the track.
3061 *
3062 * @author    Naotoshi Fujita
3063 * @copyright Naotoshi Fujita. All rights reserved.
3064 */
3065
3066
3067
3068
3069/**
3070 * The component for cloning some slides for "loop" mode of the track.
3071 *
3072 * @param {Splide} Splide     - A Splide instance.
3073 * @param {Object} Components - An object containing components.
3074 *
3075 * @return {Object} - The component object.
3076 */
3077
3078/* harmony default export */ var clones = (function (Splide, Components) {
3079  /**
3080   * Store information of all clones.
3081   *
3082   * @type {Array}
3083   */
3084  var clones = [];
3085  /**
3086   * Store the current clone count on one side.
3087   *
3088   * @type {number}
3089   */
3090
3091  var cloneCount = 0;
3092  /**
3093   * Keep Elements component.
3094   *
3095   * @type {Object}
3096   */
3097
3098  var Elements = Components.Elements;
3099  /**
3100   * Clones component object.
3101   *
3102   * @type {Object}
3103   */
3104
3105  var Clones = {
3106    /**
3107     * Called when the component is mounted.
3108     */
3109    mount: function mount() {
3110      var _this = this;
3111
3112      if (Splide.is(LOOP)) {
3113        init();
3114        Splide.on('refresh:before', function () {
3115          _this.destroy();
3116        }).on('refresh', init).on('resize', function () {
3117          if (cloneCount !== getCloneCount()) {
3118            // Destroy before refresh not to collect clones by the Elements component.
3119            _this.destroy();
3120
3121            Splide.refresh();
3122          }
3123        });
3124      }
3125    },
3126
3127    /**
3128     * Destroy.
3129     */
3130    destroy: function destroy() {
3131      dom_remove(clones);
3132      clones = [];
3133    },
3134
3135    /**
3136     * Return all clones.
3137     *
3138     * @return {Element[]} - Cloned elements.
3139     */
3140    get clones() {
3141      return clones;
3142    },
3143
3144    /**
3145     * Return clone length.
3146     *
3147     * @return {number} - A length of clones.
3148     */
3149    get length() {
3150      return clones.length;
3151    }
3152
3153  };
3154  /**
3155   * Initialization.
3156   */
3157
3158  function init() {
3159    Clones.destroy();
3160    cloneCount = getCloneCount();
3161    generateClones(cloneCount);
3162  }
3163  /**
3164   * Generate and append/prepend clones.
3165   *
3166   * @param {number} count - The half number of clones.
3167   */
3168
3169
3170  function generateClones(count) {
3171    var length = Elements.length,
3172        register = Elements.register;
3173
3174    if (length) {
3175      var slides = Elements.slides;
3176
3177      while (slides.length < count) {
3178        slides = slides.concat(slides);
3179      } // Clones after the last element.
3180
3181
3182      slides.slice(0, count).forEach(function (elm, index) {
3183        var clone = cloneDeeply(elm);
3184        append(Elements.list, clone);
3185        clones.push(clone);
3186        register(clone, index + length, index % length);
3187      }); // Clones before the first element.
3188
3189      slides.slice(-count).forEach(function (elm, index) {
3190        var clone = cloneDeeply(elm);
3191        before(clone, slides[0]);
3192        clones.push(clone);
3193        register(clone, index - count, (length + index - count % length) % length);
3194      });
3195    }
3196  }
3197  /**
3198   * Return half count of clones to be generated.
3199   * Clone count is determined by:
3200   * - "clones" value in the options.
3201   * - Number of slides that can be placed in a view in "fixed" mode.
3202   * - Max pages a flick action can move.
3203   * - Whether the slide length is enough for perPage.
3204   *
3205   * @return {number} - Count for clones.
3206   */
3207
3208
3209  function getCloneCount() {
3210    var options = Splide.options;
3211
3212    if (options.clones) {
3213      return options.clones;
3214    } // Use the slide length in autoWidth mode because the number cannot be calculated.
3215
3216
3217    var baseCount = options.autoWidth || options.autoHeight ? Elements.length : options.perPage;
3218    var dimension = options.direction === TTB ? 'Height' : 'Width';
3219    var fixedSize = toPixel(Splide.root, options["fixed" + dimension]);
3220
3221    if (fixedSize) {
3222      // Roughly calculate the count. This needs not to be strict.
3223      baseCount = Math.ceil(Elements.track["client" + dimension] / fixedSize);
3224    }
3225
3226    return baseCount * (options.drag ? options.flickMaxPages + 1 : 1);
3227  }
3228  /**
3229   * Clone deeply the given element.
3230   *
3231   * @param {Element} elm - An element being duplicated.
3232   *
3233   * @return {Node} - A cloned node(element).
3234   */
3235
3236
3237  function cloneDeeply(elm) {
3238    var clone = elm.cloneNode(true);
3239    addClass(clone, Splide.classes.clone); // ID should not be duplicated.
3240
3241    removeAttribute(clone, 'id');
3242    return clone;
3243  }
3244
3245  return Clones;
3246});
3247;// CONCATENATED MODULE: ./src/js/components/layout/directions/horizontal.js
3248/**
3249 * The resolver component for horizontal layout.
3250 *
3251 * @author    Naotoshi Fujita
3252 * @copyright Naotoshi Fujita. All rights reserved.
3253 */
3254
3255
3256
3257/**
3258 * The resolver component for horizontal layout.
3259 *
3260 * @param {Splide} Splide     - A Splide instance.
3261 * @param {Object} Components - An object containing components.
3262 *
3263 * @return {Object} - The resolver object.
3264 */
3265
3266/* harmony default export */ var horizontal = (function (Splide, Components) {
3267  /**
3268   * Keep the Elements component.
3269   *
3270   * @type {string}
3271   */
3272  var Elements = Components.Elements;
3273  /**
3274   * Keep the root element.
3275   *
3276   * @type {Element}
3277   */
3278
3279  var root = Splide.root;
3280  /**
3281   * Keep the track element.
3282   *
3283   * @type {Element}
3284   */
3285
3286  var track;
3287  /**
3288   * Keep the latest options.
3289   *
3290   * @type {Element}
3291   */
3292
3293  var options = Splide.options;
3294  return {
3295    /**
3296     * Margin property name.
3297     *
3298     * @type {string}
3299     */
3300    margin: 'margin' + (options.direction === RTL ? 'Left' : 'Right'),
3301
3302    /**
3303     * Always 0 because the height will be determined by inner contents.
3304     *
3305     * @type {number}
3306     */
3307    height: 0,
3308
3309    /**
3310     * Initialization.
3311     */
3312    init: function init() {
3313      this.resize();
3314    },
3315
3316    /**
3317     * Resize gap and padding.
3318     * This must be called on init.
3319     */
3320    resize: function resize() {
3321      options = Splide.options;
3322      track = Elements.track;
3323      this.gap = toPixel(root, options.gap);
3324      var padding = options.padding;
3325      var left = toPixel(root, padding.left || padding);
3326      var right = toPixel(root, padding.right || padding);
3327      this.padding = {
3328        left: left,
3329        right: right
3330      };
3331      applyStyle(track, {
3332        paddingLeft: unit(left),
3333        paddingRight: unit(right)
3334      });
3335    },
3336
3337    /**
3338     * Return total width from the left of the list to the right of the slide specified by the provided index.
3339     *
3340     * @param {number} index - Optional. A slide index. If undefined, total width of the slider will be returned.
3341     *
3342     * @return {number} - Total width to the right side of the specified slide, or 0 for an invalid index.
3343     */
3344    totalWidth: function totalWidth(index) {
3345      if (index === void 0) {
3346        index = Splide.length - 1;
3347      }
3348
3349      var Slide = Elements.getSlide(index);
3350      var width = 0;
3351
3352      if (Slide) {
3353        var slideRect = getRect(Slide.slide);
3354        var listRect = getRect(Elements.list);
3355
3356        if (options.direction === RTL) {
3357          width = listRect.right - slideRect.left;
3358        } else {
3359          width = slideRect.right - listRect.left;
3360        }
3361
3362        width += this.gap;
3363      }
3364
3365      return width;
3366    },
3367
3368    /**
3369     * Return the slide width in px.
3370     *
3371     * @param {number} index - Slide index.
3372     *
3373     * @return {number} - The slide width.
3374     */
3375    slideWidth: function slideWidth(index) {
3376      if (options.autoWidth) {
3377        var Slide = Elements.getSlide(index);
3378        return Slide ? Slide.slide.offsetWidth : 0;
3379      }
3380
3381      var width = options.fixedWidth || (this.width + this.gap) / options.perPage - this.gap;
3382      return toPixel(root, width);
3383    },
3384
3385    /**
3386     * Return the slide height in px.
3387     *
3388     * @return {number} - The slide height.
3389     */
3390    slideHeight: function slideHeight() {
3391      var height = options.height || options.fixedHeight || this.width * options.heightRatio;
3392      return toPixel(root, height);
3393    },
3394
3395    /**
3396     * Return slider width without padding.
3397     *
3398     * @return {number} - Current slider width.
3399     */
3400    get width() {
3401      return track.clientWidth - this.padding.left - this.padding.right;
3402    }
3403
3404  };
3405});
3406;// CONCATENATED MODULE: ./src/js/components/layout/directions/vertical.js
3407/**
3408 * The resolver component for vertical layout.
3409 *
3410 * @author    Naotoshi Fujita
3411 * @copyright Naotoshi Fujita. All rights reserved.
3412 */
3413
3414
3415
3416/**
3417 * The resolver component for vertical layout.
3418 *
3419 * @param {Splide} Splide     - A Splide instance.
3420 * @param {Object} Components - An object containing components.
3421 *
3422 * @return {Object} - The resolver object.
3423 */
3424
3425/* harmony default export */ var vertical = (function (Splide, Components) {
3426  /**
3427   * Keep the Elements component.
3428   *
3429   * @type {string}
3430   */
3431  var Elements = Components.Elements;
3432  /**
3433   * Keep the root element.
3434   *
3435   * @type {Element}
3436   */
3437
3438  var root = Splide.root;
3439  /**
3440   * Keep the track element.
3441   *
3442   * @type {Element}
3443   */
3444
3445  var track;
3446  /**
3447   * Keep the latest options.
3448   *
3449   * @type {Element}
3450   */
3451
3452  var options;
3453  return {
3454    /**
3455     * Margin property name.
3456     *
3457     * @type {string}
3458     */
3459    margin: 'marginBottom',
3460
3461    /**
3462     * Initialization.
3463     */
3464    init: function init() {
3465      this.resize();
3466    },
3467
3468    /**
3469     * Resize gap and padding.
3470     * This must be called on init.
3471     */
3472    resize: function resize() {
3473      options = Splide.options;
3474      track = Elements.track;
3475      this.gap = toPixel(root, options.gap);
3476      var padding = options.padding;
3477      var top = toPixel(root, padding.top || padding);
3478      var bottom = toPixel(root, padding.bottom || padding);
3479      this.padding = {
3480        top: top,
3481        bottom: bottom
3482      };
3483      applyStyle(track, {
3484        paddingTop: unit(top),
3485        paddingBottom: unit(bottom)
3486      });
3487    },
3488
3489    /**
3490     * Return total height from the top of the list to the bottom of the slide specified by the provided index.
3491     *
3492     * @param {number} index - Optional. A slide index. If undefined, total height of the slider will be returned.
3493     *
3494     * @return {number} - Total height to the bottom of the specified slide, or 0 for an invali
3494d index.
3495     */
3496    totalHeight: function totalHeight(index) {
3497      if (index === void 0) {
3498        index = Splide.length - 1;
3499      }
3500
3501      var Slide = Elements.getSlide(index);
3502
3503      if (Slide) {
3504        return getRect(Slide.slide).bottom - getRect(Elements.list).top + this.gap;
3505      }
3506
3507      return 0;
3508    },
3509
3510    /**
3511     * Return the slide width in px.
3512     *
3513     * @return {number} - The slide width.
3514     */
3515    slideWidth: function slideWidth() {
3516      return toPixel(root, options.fixedWidth || this.width);
3517    },
3518
3519    /**
3520     * Return the slide height in px.
3521     *
3522     * @param {number} index - Slide index.
3523     *
3524     * @return {number} - The slide height.
3525     */
3526    slideHeight: function slideHeight(index) {
3527      if (options.autoHeight) {
3528        var Slide = Elements.getSlide(index);
3529        return Slide ? Slide.slide.offsetHeight : 0;
3530      }
3531
3532      var height = options.fixedHeight || (this.height + this.gap) / options.perPage - this.gap;
3533      return toPixel(root, height);
3534    },
3535
3536    /**
3537     * Return slider width without padding.
3538     *
3539     * @return {number} - Current slider width.
3540     */
3541    get width() {
3542      return track.clientWidth;
3543    },
3544
3545    /**
3546     * Return slide height without padding.
3547     *
3548     * @return {number} - Slider height.
3549     */
3550    get height() {
3551      var height = options.height || this.width * options.heightRatio;
3552      exist(height, '"height" or "heightRatio" is missing.');
3553      return toPixel(root, height) - this.padding.top - this.padding.bottom;
3554    }
3555
3556  };
3557});
3558;// CONCATENATED MODULE: ./src/js/utils/time.js
3559/**
3560 * A package of utility functions related with time.
3561 *
3562 * @author    Naotoshi Fujita
3563 * @copyright Naotoshi Fujita. All rights reserved.
3564 */
3565
3566/**
3567 * Simple throttle function that controls how often the given function is executed.
3568 *
3569 * @param {function} func - A function to be throttled.
3570 * @param {number}   wait - Time in millisecond for interval of execution.
3571 *
3572 * @return {Function} - A debounced function.
3573 */
3574function throttle(func, wait) {
3575  var timeout; // Declare function by the "function" keyword to prevent "this" from being inherited.
3576
3577  return function () {
3578    if (!timeout) {
3579      timeout = setTimeout(function () {
3580        func();
3581        timeout = null;
3582      }, wait);
3583    }
3584  };
3585}
3586/**
3587 * Custom setInterval function that provides progress rate as callback.
3588 *
3589 * @param {function} callback - A callback function fired every time the interval time passes.
3590 * @param {number}   interval - Interval duration in milliseconds.
3591 * @param {function} progress - A callback function fired whenever the progress goes.
3592 *
3593 * @return {Object} - An object containing play() and pause() functions.
3594 */
3595
3596function createInterval(callback, interval, progress) {
3597  var _window = window,
3598      requestAnimationFrame = _window.requestAnimationFrame;
3599  var start,
3600      elapse,
3601      rate,
3602      _pause = true;
3603
3604  var step = function step(timestamp) {
3605    if (!_pause) {
3606      if (!start) {
3607        start = timestamp;
3608
3609        if (rate && rate < 1) {
3610          start -= rate * interval;
3611        }
3612      }
3613
3614      elapse = timestamp - start;
3615      rate = elapse / interval;
3616
3617      if (elapse >= interval) {
3618        start = 0;
3619        rate = 1;
3620        callback();
3621      }
3622
3623      if (progress) {
3624        progress(rate);
3625      }
3626
3627      requestAnimationFrame(step);
3628    }
3629  };
3630
3631  return {
3632    pause: function pause() {
3633      _pause = true;
3634      start = 0;
3635    },
3636    play: function play(reset) {
3637      start = 0;
3638
3639      if (reset) {
3640        rate = 0;
3641      }
3642
3643      if (_pause) {
3644        _pause = false;
3645        requestAnimationFrame(step);
3646      }
3647    }
3648  };
3649}
3650;// CONCATENATED MODULE: ./src/js/components/layout/index.js
3651/**
3652 * The component for handing slide layouts and their sizes.
3653 *
3654 * @author    Naotoshi Fujita
3655 * @copyright Naotoshi Fujita. All rights reserved.
3656 */
3657
3658
3659
3660
3661
3662
3663
3664/**
3665 * The component for handing slide layouts and their sizes.
3666 *
3667 * @param {Splide} Splide     - A Splide instance.
3668 * @param {Object}
3668 Components - An object containing components.
3669 *
3670 * @return {Object} - The component object.
3671 */
3672
3673/* harmony default export */ var layout = (function (Splide, Components) {
3674  /**
3675   * Keep the Elements component.
3676   *
3677   * @type {string}
3678   */
3679  var Elements = Components.Elements;
3680  /**
3681   * Whether the slider is vertical or not.
3682   *
3683   * @type {boolean}
3684   */
3685
3686  var isVertical = Splide.options.direction === TTB;
3687  /**
3688   * Layout component object.
3689   *
3690   * @type {Object}
3691   */
3692
3693  var Layout = object_assign({
3694    /**
3695     * Called when the component is mounted.
3696     */
3697    mount: function mount() {
3698      bind();
3699      init(); // The word "size" means width for a horizontal slider and height for a vertical slider.
3700
3701      this.totalSize = isVertical ? this.totalHeight : this.totalWidth;
3702      this.slideSize = isVertical ? this.slideHeight : this.slideWidth;
3703    },
3704
3705    /**
3706     * Destroy the component.
3707     */
3708    destroy: function destroy() {
3709      removeAttribute([Elements.list, Elements.track], 'style');
3710    },
3711
3712    /**
3713     * Return the slider height on the vertical mode or width on the horizontal mode.
3714     *
3715     * @return {number}
3716     */
3717    get size() {
3718      return isVertical ? this.height : this.width;
3719    }
3720
3721  }, isVertical ? vertical(Splide, Components) : horizontal(Splide, Components));
3722  /**
3723   * Init slider styles according to options.
3724   */
3725
3726  function init() {
3727    Layout.init();
3728    applyStyle(Splide.root, {
3729      maxWidth: unit(Splide.options.width)
3730    });
3731    Elements.each(function (Slide) {
3732      Slide.slide.style[Layout.margin] = unit(Layout.gap);
3733    });
3734    resize();
3735  }
3736  /**
3737   * Listen the resize native event with throttle.
3738   * Initialize when the component is mounted or options are updated.
3739   */
3740
3741
3742  function bind() {
3743    Splide.on('resize load', throttle(function () {
3744      Splide.emit('resize');
3745    }, Splide.options.throttle), window).on('resize', resize).on('updated refresh', init);
3746  }
3747  /**
3748   * Resize the track and slide elements.
3749   */
3750
3751
3752  function resize() {
3753    var options = Splide.options;
3754    Layout.resize();
3755    applyStyle(Elements.track, {
3756      height: unit(Layout.height)
3757    });
3758    var slideHeight = options.autoHeight ? null : unit(Layout.slideHeight());
3759    Elements.each(function (Slide) {
3760      applyStyle(Slide.container, {
3761        height: slideHeight
3762      });
3763      applyStyle(Slide.slide, {
3764        width: options.autoWidth ? null : unit(Layout.slideWidth(Slide.index)),
3765        height: Slide.container ? null : slideHeight
3766      });
3767    });
3768    Splide.emit('resized');
3769  }
3770
3771  return Layout;
3772});
3773;// CONCATENATED MODULE: ./src/js/components/drag/index.js
3774/**
3775 * The component for supporting mouse drag and swipe.
3776 *
3777 * @author    Naotoshi Fujita
3778 * @copyright Naotoshi Fujita. All rights reserved.
3779 */
3780
3781
3782
3783
3784
3785var drag_abs = Math.abs;
3786/**
3787 * If the absolute velocity is greater thant this value,
3788 * a slider always goes to a different slide after drag, not allowed to stay on a current slide.
3789 */
3790
3791var MIN_VELOCITY = 0.1;
3792/**
3793 * Adjust how much the track can be pulled on the first or last page.
3794 * The larger number this is, the farther the track moves.
3795 * This should be around 5 - 9.
3796 *
3797 * @type {number}
3798 */
3799
3800var FRICTION_REDUCER = 7;
3801/**
3802 * The component supporting mouse drag and swipe.
3803 *
3804 * @param {Splide} Splide     - A Splide instance.
3805 * @param {Object} Components - An object containing components.
3806 *
3807 * @return {Object} - The component object.
3808 */
3809
3810/* harmony default export */ var drag = (function (Splide, Components) {
3811  /**
3812   * Store the Move component.
3813   *
3814   * @type {Object}
3815   */
3816  var Track = Components.Track;
3817  /**
3818   * Store the Controller component.
3819   *
3820   * @type {Object}
3821   */
3822
3823  var Controller = Components.Controller;
3824  /**
3825   * Coordinate of the track on starting drag.
3826   *
3827   * @type {Object}
3828   */
3829
3830  var startCoord;
3831  /**
3832   * Analyzed info on starting drag.
3833   *
3834   * @type {Object|null}
3835   */
3836
3837  var startInfo;
3838  /**
3839   * Analyzed info being updated while dragging/swiping.
3840   *
3841   * @type {Object}
3842   */
3843
3844  var currentInfo;
3845  /**
3846   * Determine whether slides are being dragged or not.
3847   *
3848   * @type {boolean}
3849   */
3850
3851  var isDragging;
3852  /**
3853   * Whether the slider direction is vertical or not.
3854   *
3855   * @type {boolean}
3856   */
3857
3858  var isVertical = Splide.options.direction === TTB;
3859  /**
3860   * Axis for the direction.
3861   *
3862   * @type {string}
3863   */
3864
3865  var axis = isVertical ? 'y' : 'x';
3866  /**
3867   * Drag component object.
3868   *
3869   * @type {Object}
3870   */
3871
3872  var Drag = {
3873    /**
3874     * Whether dragging is disabled or not.
3875     *
3876     * @type {boolean}
3877     */
3878    disabled: false,
3879
3880    /**
3881     * Called when the component is mounted.
3882     */
3883    mount: function mount() {
3884      var _this = this;
3885
3886      var Elements = Components.Elements;
3887      var track = Elements.track;
3888      Splide.on('touchstart mousedown', start, track).on('touchmove mousemove', move, track, {
3889        passive: false
3890      }).on('touchend touchcancel mouseleave mouseup dragend', end, track).on('mounted refresh', function () {
3891        // Prevent dragging an image or anchor itself.
3892        each(Elements.list.querySelectorAll('img, a'), function (elm) {
3893          Splide.off('dragstart', elm).on('dragstart', function (e) {
3894            e.preventDefault();
3895          }, elm, {
3896            passive: false
3897          });
3898        });
3899      }).on('mounted updated', function () {
3900        _this.disabled = !Splide.options.drag;
3901      });
3902    }
3903  };
3904  /**
3905   * Called when the track starts to be dragged.
3906   *
3907   * @param {TouchEvent|MouseEvent} e - TouchEvent or MouseEvent object.
3908   */
3909
3910  function start(e) {
3911    if (!Drag.disabled && !isDragging) {
3912      // These prams are used to evaluate whether the slider should start moving.
3913      init(e);
3914    }
3915  }
3916  /**
3917   * Initialize parameters.
3918   *
3919   * @param {TouchEvent|MouseEvent} e - TouchEvent or MouseEvent object.
3920   */
3921
3922
3923  function init(e) {
3924    startCoord = Track.toCoord(Track.position);
3925    startInfo = analyze(e, {});
3926    currentInfo = startInfo;
3927  }
3928  /**
3929   * Called while the track being dragged.
3930   *
3931   * @param {TouchEvent|MouseEvent} e - TouchEvent or MouseEvent object.
3932   */
3933
3934
3935  function move(e) {
3936    if (startInfo) {
3937      currentInfo = analyze(e, startInfo);
3938
3939      if (isDragging) {
3940        if (e.cancelable) {
3941          e.preventDefault();
3942        }
3943
3944        if (!Splide.is(FADE)) {
3945          var position = startCoord[axis] + currentInfo.offset[axis];
3946          Track.translate(resist(position));
3947        }
3948      } else {
3949        if (shouldMove(currentInfo)) {
3950          Splide.emit('drag', startInfo);
3951          isDragging = true;
3952          Track.cancel(); // These params are actual drag data.
3953
3954          init(e);
3955        }
3956      }
3957    }
3958  }
3959  /**
3960   * Determine whether to start moving the track or not by drag angle.
3961   *
3962   * @param {Object} info - An information object.
3963   *
3964   * @return {boolean} - True if the track should be moved or false if not.
3965   */
3966
3967
3968  function shouldMove(_ref) {
3969    var offset = _ref.offset;
3970
3971    if (Splide.State.is(MOVING) && Splide.options.waitForTransition) {
3972      return false;
3973    }
3974
3975    var angle = Math.atan(drag_abs(offset.y) / drag_abs(offset.x)) * 180 / Math.PI;
3976
3977    if (isVertical) {
3978      angle = 90 - angle;
3979    }
3980
3981    return angle < Splide.options.dragAngleThreshold;
3982  }
3983  /**
3984   * Resist dragging the track on the first/last page because there is no more.
3985   *
3986   * @param {number} position - A position being applied to the track.
3987   *
3988   * @return {Object} - Adjusted position.
3989   */
3990
3991
3992  function resist(position) {
3993    if (Splide.is(SLIDE)) {
3994      var sign = Track.sign;
3995
3996      var _start = sign * Track.trim(Track.toPosition(0));
3997
3998      var _end = sign * Track.trim(Track.toPosition(Controller.edgeIndex));
3999
4000      position *= sign;
4001
4002      if (position < _start) {
4003        position = _start - FRICTION_REDUCER * Math.log(_start - position);
4004      } else if (position > _end) {
4005        position = _end + FRICTION_REDUCER * Math.log(position - _end);
4006      }
4007
4008      position *= sign;
4009    }
4010
4011    return position;
4012  }
4013  /**
4014   * Called when dragging ends.
4015   */
4016
4017
4018  function end() {
4019    startInfo = null;
4020
4021    if (isDragging) {
4022      Splide.emit('dragged', currentInfo);
4023      go(currentInfo);
4024      isDragging = false;
4025    }
4026  }
4027  /**
4028   * Go to the slide determined by the analyzed data.
4029   *
4030   * @param {Object} info - An info object.
4031   */
4032
4033
4034  function go(info) {
4035    var velocity = info.velocity[axis];
4036    var absV = drag_abs(velocity);
4037
4038    if (absV > 0) {
4039      var options = Splide.options;
4040      var index = Splide.index;
4041      var sign = velocity < 0 ? -1 : 1;
4042      var destIndex = index;
4043
4044      if (!Splide.is(FADE)) {
4045        var destination = Track.position;
4046
4047        if (absV > options.flickVelocityThreshold && drag_abs(info.offset[axis]) < options.swipeDistanceThreshold) {
4048          destination += sign * Math.min(absV * options.flickPower, Components.Layout.size * (options.flickMaxPages || 1));
4049        }
4050
4051        destIndex = Track.toIndex(destination);
4052      }
4053      /*
4054       * Do not allow the track to go to a previous position if there is enough velocity.
4055       * Always use the adjacent index for the fade mode.
4056       */
4057
4058
4059      if (destIndex === index && absV > MIN_VELOCITY) {
4060        destIndex = index + sign * Track.sign;
4061      }
4062
4063      if (Splide.is(SLIDE)) {
4064        destIndex = between(destIndex, 0, Controller.edgeIndex);
4065      }
4066
4067      Controller.go(destIndex, options.isNavigation);
4068    }
4069  }
4070  /**
4071   * Analyze the given event object and return important information for handling swipe behavior.
4072   *
4073   * @param {Event}   e          - Touch or Mouse event object.
4074   * @param {Object}  startInfo  - Information analyzed on start for calculating difference from the current one.
4075   *
4076   * @return {Object}
4076 - An object containing analyzed information, such as offset, velocity, etc.
4077   */
4078
4079
4080  function analyze(e, startInfo) {
4081    var timeStamp = e.timeStamp,
4082        touches = e.touches;
4083
4084    var _ref2 = touches ? touches[0] : e,
4085        clientX = _ref2.clientX,
4086        clientY = _ref2.clientY;
4087
4088    var _ref3 = startInfo.to || {},
4089        _ref3$x = _ref3.x,
4090        fromX = _ref3$x === void 0 ? clientX : _ref3$x,
4091        _ref3$y = _ref3.y,
4092        fromY = _ref3$y === void 0 ? clientY : _ref3$y;
4093
4094    var startTime = startInfo.time || 0;
4095    var offset = {
4096      x: clientX - fromX,
4097      y: clientY - fromY
4098    };
4099    var duration = timeStamp - startTime;
4100    var velocity = {
4101      x: offset.x / duration,
4102      y: offset.y / duration
4103    };
4104    return {
4105      to: {
4106        x: clientX,
4107        y: clientY
4108      },
4109      offset: offset,
4110      time: timeStamp,
4111      velocity: velocity
4112    };
4113  }
4114
4115  return Drag;
4116});
4117;// CONCATENATED MODULE: ./src/js/components/click/index.js
4118/**
4119 * The component for handling a click event.
4120 *
4121 * @author    Naotoshi Fujita
4122 * @copyright Naotoshi Fujita. All rights reserved.
4123 */
4124
4125/**
4126 * The component for handling a click event.
4127 * Click should be disabled during drag/swipe.
4128 *
4129 * @param {Splide} Splide     - A Splide instance.
4130 * @param {Object} Components - An object containing components.
4131 *
4132 * @return {Object} - The component object.
4133 */
4134/* harmony default export */ var click = (function (Splide, Components) {
4135  /**
4136   * Whether click is disabled or not.
4137   *
4138   * @type {boolean}
4139   */
4140  var disabled = false;
4141  /**
4142   * Click component object.
4143   *
4144   * @type {Object}
4145   */
4146
4147  var Click = {
4148    /**
4149     * Mount only when the drag is activated and the slide type is not "fade".
4150     *
4151     * @type {boolean}
4152     */
4153    required: Splide.options.drag,
4154
4155    /**
4156     * Called when the component is mounted.
4157     */
4158    mount: function mount() {
4159      Splide.on('click', onClick, Components.Elements.track, {
4160        capture: true
4161      }).on('drag', function () {
4162        disabled = true;
4163      }).on('dragged', function () {
4164        // Make sure the flag is released after the click event is fired.
4165        setTimeout(function () {
4166          disabled = false;
4167        });
4168      });
4169    }
4170  };
4171  /**
4172   * Called when a track element is clicked.
4173   *
4174   * @param {Event} e - A click event.
4175   */
4176
4177  function onClick(e) {
4178    if (disabled) {
4179      e.preventDefault();
4180      e.stopPropagation();
4181      e.stopImmediatePropagation();
4182    }
4183  }
4184
4185  return Click;
4186});
4187;// CONCATENATED MODULE: ./src/js/components/autoplay/index.js
4188/**
4189 * The component for playing slides automatically.
4190 *
4191 * @author    Naotoshi Fujita
4192 * @copyright Naotoshi Fujita. All rights reserved.
4193 */
4194
4195
4196/**
4197 * Set of pause flags.
4198 */
4199
4200var PAUSE_FLAGS = {
4201  HOVER: 1,
4202  FOCUS: 2,
4203  MANUAL: 3
4204};
4205/**
4206 * The component for playing slides automatically.
4207 *
4208 * @param {Splide} Splide     - A Splide instance.
4209 * @param {Object} Components - An object containing components.
4210 * @param {string} name       - A component name as a lowercase string.
4211 *
4212 * @return {Object} - The component object.
4213 */
4214
4215/* harmony default export */ var autoplay = (function (Splide, Components, name) {
4216  /**
4217   * Store pause flags.
4218   *
4219   * @type {Array}
4220   */
4221  var flags = [];
4222  /**
4223   * Store an interval object.
4224   *
4225   * @type {Object};
4226   */
4227
4228  var interval;
4229  /**
4230   * Keep the Elements component.
4231   *
4232   * @type {string}
4233   */
4234
4235  var Elements = Components.Elements;
4236  /**
4237   * Autoplay component object.
4238   *
4239   * @type {Object}
4240   */
4241
4242  var Autoplay = {
4243    /**
4244     * Required only when the autoplay option is true.
4245     *
4246     * @type {boolean}
4247     */
4248    required: Splide.options.autoplay,
4249
4250    /**
4251     * Called when the component is mounted.
4252     * Note that autoplay starts only if there are slides over perPage number.
4253     */
4254    mount: function mount() {
4255      var options = Splide.options;
4256
4257      if (Elements.slides.length > options.perPage) {
4258        interval = createInterval(function () {
4259          Splide.go('>');
4260        }, options.interval, function (rate) {
4261          Splide.emit(name + ":playing", rate);
4262
4263          if (Elements.bar) {
4264            applyStyle(Elements.bar, {
4265              width: rate * 100 + "%"
4266            });
4267          }
4268        });
4269        bind();
4270        this.play();
4271      }
4272    },
4273
4274    /**
4275     * Start autoplay.
4276     *
4277     * @param {number} flag - A pause flag to be removed.
4278     */
4279    play: function play(flag) {
4280      if (flag === void 0) {
4281        flag = 0;
4282      }
4283
4284      flags = flags.filter(function (f) {
4285        return f !== flag;
4286      });
4287
4288      if (!flags.length) {
4289        Splide.emit(name + ":play");
4290        interval.play(Splide.options.resetProgress);
4291      }
4292    },
4293
4294    /**
4295     * Pause autoplay.
4296     * Note that Array.includes is not supported by IE.
4297     *
4298     * @param {number} flag - A pause flag to be added.
4299     */
4300    pause: function pause(flag) {
4301      if (flag === void 0) {
4302        flag = 0;
4303      }
4304
4305      interval.pause();
4306
4307      if (flags.indexOf(flag) === -1) {
4308        flags.push(flag);
4309      }
4310
4311      if (flags.length === 1) {
4312        Splide.emit(name + ":pause");
4313      }
4314    }
4315  };
4316  /**
4317   * Listen some events.
4318   */
4319
4320  function bind() {
4321    var options = Splide.options;
4322    var sibling = Splide.sibling;
4323    var elms = [Splide.root, sibling ? sibling.root : null];
4324
4325    if (options.pauseOnHover) {
4326      switchOn(elms, 'mouseleave', PAUSE_FLAGS.HOVER, true);
4327      switchOn(elms, 'mouseenter', PAUSE_FLAGS.HOVER, false);
4328    }
4329
4330    if (options.pauseOnFocus) {
4331      switchOn(elms, 'focusout', PAUSE_FLAGS.FOCUS, true);
4332      switchOn(elms, 'focusin', PAUSE_FLAGS.FOCUS, false);
4333    }
4334
4335    if (Elements.play) {
4336      Splide.on('click', function () {
4337        // Need to be removed a focus flag at first.
4338        Autoplay.play(PAUSE_FLAGS.FOCUS);
4339        Autoplay.play(PAUSE_FLAGS.MANUAL);
4340      }, Elements.play);
4341    }
4342
4343    if (Elements.pause) {
4344      switchOn([Elements.pause], 'click', PAUSE_FLAGS.MANUAL, false);
4345    }
4346
4347    Splide.on('move refresh', function () {
4348      Autoplay.play();
4349    }) // Rewind the timer.
4350    .on('destroy', function () {
4351      Autoplay.pause();
4352    });
4353  }
4354  /**
4355   * Play or pause on the given event.
4356   *
4357   * @param {Element[]} elms  - Elements.
4358   * @param {string}    event - An event name or names.
4359   * @param {number}    flag  - A pause flag defined on the top.
4360   * @param {boolean}   play  - Determine whether to play or pause.
4361   */
4362
4363
4364  function switchOn(elms, event, flag, play) {
4365    elms.forEach(function (elm) {
4366      Splide.on(event, function () {
4367        Autoplay[play ? 'play' : 'pause'](flag);
4368      }, elm);
4369    });
4370  }
4371
4372  return Autoplay;
4373});
4374;// CONCATENATED MODULE: ./src/js/components/cover/index.js
4375/**
4376 * The component for change an img element to background image of its wrapper.
4377 *
4378 * @author    Naotoshi Fujita
4379 * @copyright Naotoshi Fujita. All rights reserved.
4380 */
4381
4382/**
4383 * The component for change an img element to background image of its wrapper.
4384 *
4385 * @param {Splide} Splide     - A Splide instance.
4386 * @param {Object} Components - An object containing components.
4387 *
4388 * @return {Object} - The component object.
4389 */
4390
4391/* harmony default export */ var cover = (function (Splide, Components) {
4392  /**
4393   * Hold options.
4394   *
4395   * @type {Object}
4396   */
4397  var options = Splide.options;
4398  /**
4399   * Cover component object.
4400   *
4401   * @type {Object}
4402   */
4403
4404  var Cover = {
4405    /**
4406     * Required only when "cover" option is true.
4407     *
4408     * @type {boolean}
4409     */
4410    required: options.cover,
4411
4412    /**
4413     * Called when the component is mounted.
4414     */
4415    mount: function mount() {
4416      Splide.on('lazyload:loaded', function (img) {
4417        cover(img, false);
4418      });
4419      Splide.on('mounted updated refresh', function () {
4420        return apply(false);
4421      });
4422    },
4423
4424    /**
4425     * Destroy.
4426     */
4427    destroy: function destroy() {
4428      apply(true);
4429    }
4430  };
4431  /**
4432   * Apply "cover" to all slides.
4433   *
4434   * @param {boolean} uncover - If true, "cover" will be clear.
4435   */
4436
4437  function apply(uncover) {
4438    Components.Elements.each(function (Slide) {
4439      var img = child(Slide.slide, 'IMG') || child(Slide.container, 'IMG');
4440
4441      if (img && img.src) {
4442        cover(img, uncover);
4443      }
4444    });
4445  }
4446  /**
4447   * Set background image of the parent element, using source of the given image element.
4448   *
4449   * @param {Element} img     - An image element.
4450   * @param {boolean} uncover - Reset "cover".
4451   */
4452
4453
4454  function cover(img, uncover) {
4455    applyStyle(img.parentElement, {
4456      background: uncover ? '' : "center/cover no-repeat url(\"" + img.src + "\")"
4457    });
4458    applyStyle(img, {
4459      display: uncover ? '' : 'none'
4460    });
4461  }
4462
4463  return Cover;
4464});
4465;// CONCATENATED MODULE: ./src/js/components/arrows/path.js
4466/**
4467 * Export vector path for an arrow.
4468 *
4469 * @author    Naotoshi Fujita
4470 * @copyright Naotoshi Fujita. All rights reserved.
4471 */
4472
4473/**
4474 * Namespace definition for SVG element.
4475 *
4476 * @type {string}
4477 */
4478var XML_NAME_SPACE = 'http://www.w3.org/2000/svg';
4479/**
4480 * The arrow vector path.
4481 *
4482 * @type {number}
4483 */
4484
4485var 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';
4486/**
4487 * SVG width and height.
4488 *
4489 * @type {number}
4490 */
4491
4492var SIZE = 40;
4493;
4493// CONCATENATED MODULE: ./src/js/components/arrows/index.js
4494/**
4495 * The component for appending prev/next arrows.
4496 *
4497 * @author    Naotoshi Fujita
4498 * @copyright Naotoshi Fujita. All rights reserved.
4499 */
4500
4501
4502
4503/**
4504 * The component for appending prev/next arrows.
4505 *
4506 * @param {Splide} Splide     - A Splide instance.
4507 * @param {Object} Components - An object containing components.
4508 * @param {string} name       - A component name as a lowercase string.
4509 *
4510 * @return {Object} - The component object.
4511 */
4512
4513/* harmony default export */ var arrows = (function (Splide, Components, name) {
4514  /**
4515   * Previous arrow element.
4516   *
4517   * @type {Element|undefined}
4518   */
4519  var prev;
4520  /**
4521   * Next arrow element.
4522   *
4523   * @type {Element|undefined}
4524   */
4525
4526  var next;
4527  /**
4528   * Store the class list.
4529   *
4530   * @type {Object}
4531   */
4532
4533  var classes = Splide.classes;
4534  /**
4535   * Hold the root element.
4536   *
4537   * @type {Element}
4538   */
4539
4540  var root = Splide.root;
4541  /**
4542   * Whether arrows are created programmatically or not.
4543   *
4544   * @type {boolean}
4545   */
4546
4547  var created;
4548  /**
4549   * Hold the Elements component.
4550   *
4551   * @type {Object}
4552   */
4553
4554  var Elements = Components.Elements;
4555  /**
4556   * Arrows component object.
4557   *
4558   * @type {Object}
4559   */
4560
4561  var Arrows = {
4562    /**
4563     * Required when the arrows option is true.
4564     *
4565     * @type {boolean}
4566     */
4567    required: Splide.options.arrows,
4568
4569    /**
4570     * Called when the component is mounted.
4571     */
4572    mount: function mount() {
4573      // Attempt to get arrows from HTML source.
4574      prev = Elements.arrows.prev;
4575      next = Elements.arrows.next; // If arrows were not found in HTML, let's generate them.
4576
4577      if ((!prev || !next) && Splide.options.arrows) {
4578        prev = createArrow(true);
4579        next = createArrow(false);
4580        created = true;
4581        appendArrows();
4582      }
4583
4584      if (prev && next) {
4585        bind();
4586      }
4587
4588      this.arrows = {
4589        prev: prev,
4590        next: next
4591      };
4592    },
4593
4594    /**
4595     * Called after all components are mounted.
4596     */
4597    mounted: function mounted() {
4598      Splide.emit(name + ":mounted", prev, next);
4599    },
4600
4601    /**
4602     * Destroy.
4603     */
4604    destroy: function destroy() {
4605      removeAttribute([prev, next], 'disabled');
4606
4607      if (created) {
4608        dom_remove(prev.parentElement);
4609      }
4610    }
4611  };
4612  /**
4613   * Listen to native and custom events.
4614   */
4615
4616  function bind() {
4617    Splide.on('click', function () {
4618      Splide.go('<');
4619    }, prev).on('click', function () {
4620      Splide.go('>');
4621    }, next).on('mounted move updated refresh', updateDisabled);
4622  }
4623  /**
4624   * Update a disabled attribute.
4625   */
4626
4627
4628  function updateDisabled() {
4629    var _Components$Controlle = Components.Controller,
4630        prevIndex = _Components$Controlle.prevIndex,
4631        nextIndex = _Components$Controlle.nextIndex;
4632    var isEnough = Splide.length > Splide.options.perPage || Splide.is(LOOP);
4633    prev.disabled = prevIndex < 0 || !isEnough;
4634    next.disabled = nextIndex < 0 || !isEnough;
4635    Splide.emit(name + ":updated", prev, next, prevIndex, nextIndex);
4636  }
4637  /**
4638   * Create a wrapper element and append arrows.
4639   */
4640
4641
4642  function appendArrows() {
4643    var wrapper = create('div', {
4644      "class": classes.arrows
4645    });
4646    append(wrapper, prev);
4647    append(wrapper, next);
4648    var slider = Elements.slider;
4649    var parent = Splide.options.arrows === 'slider' && slider ? slider : root;
4650    before(wrapper, parent.firstElementChild);
4651  }
4652  /**
4653   * Create an arrow element.
4654   *
4655   * @param {boolean} prev - Determine to create a prev arrow or next arrow.
4656   *
4657   * @return {Element} - A created arrow element.
4658   */
4659
4660
4661  function createArrow(prev) {
4662    var arrow = "<button class=\"" + classes.arrow + " " + (prev ? classes.prev : classes.next) + "\" type=\"button\">" + ("<svg xmlns=\"" + XML_NAME_SPACE + "\"\tviewBox=\"0 0 " + SIZE + " " + SIZE + "\"\twidth=\"" + SIZE + "\"\theight=\"" + SIZE + "\">") + ("<path d=\"" + (Splide.options.arrowPath || PATH) + "\" />");
4663    return domify(arrow);
4664  }
4665
4666  return Arrows;
4667});
4668;// CONCATENATED MODULE: ./src/js/components/pagination/index.js
4669/**
4670 * The component for handling pagination
4671 *
4672 * @author    Naotoshi Fujita
4673 * @copyright Naotoshi Fujita. All rights reserved.
4674 */
4675
4676
4677/**
4678 * The event name for updating some attributes of pagination nodes.
4679 *
4680 * @type {string}
4681 */
4682
4683var ATTRIBUTES_UPDATE_EVENT = 'move.page';
4684/**
4685 * The event name for recreating pagination.
4686 *
4687 * @type {string}
4688 */
4689
4690var UPDATE_EVENT = 'updated.page refresh.page';
4691/**
4692 * The component for handling pagination
4693 *
4694 * @param {Splide} Splide     - A Splide instance.
4695 * @param {Object}
4695 Components - An object containing components.
4696 * @param {string} name       - A component name as a lowercase string.
4697 *
4698 * @return {Object} - The component object.
4699 */
4700
4701/* harmony default export */ var pagination = (function (Splide, Components, name) {
4702  /**
4703   * Store all data for pagination.
4704   * - list: A list element.
4705   * - items: An array that contains objects(li, button, index, page).
4706   *
4707   * @type {Object}
4708   */
4709  var data = {};
4710  /**
4711   * Hold the Elements component.
4712   *
4713   * @type {Object}
4714   */
4715
4716  var Elements = Components.Elements;
4717  /**
4718   * Pagination component object.
4719   *
4720   * @type {Object}
4721   */
4722
4723  var Pagination = {
4724    /**
4725     * Called when the component is mounted.
4726     */
4727    mount: function mount() {
4728      var pagination = Splide.options.pagination;
4729
4730      if (pagination) {
4731        data = createPagination();
4732        var slider = Elements.slider;
4733        var parent = pagination === 'slider' && slider ? slider : Splide.root;
4734        append(parent, data.list);
4735        Splide.on(ATTRIBUTES_UPDATE_EVENT, updateAttributes);
4736      }
4737
4738      Splide.off(UPDATE_EVENT).on(UPDATE_EVENT, function () {
4739        Pagination.destroy();
4740
4741        if (Splide.options.pagination) {
4742          Pagination.mount();
4743          Pagination.mounted();
4744        }
4745      });
4746    },
4747
4748    /**
4749     * Called after all components are mounted.
4750     */
4751    mounted: function mounted() {
4752      if (Splide.options.pagination) {
4753        var index = Splide.index;
4754        Splide.emit(name + ":mounted", data, this.getItem(index));
4755        updateAttributes(index, -1);
4756      }
4757    },
4758
4759    /**
4760     * Destroy the pagination.
4761     * Be aware that node.remove() is not supported by IE.
4762     */
4763    destroy: function destroy() {
4764      dom_remove(data.list);
4765
4766      if (data.items) {
4767        data.items.forEach(function (item) {
4768          Splide.off('click', item.button);
4769        });
4770      } // Do not remove UPDATE_EVENT to recreate pagination if needed.
4771
4772
4773      Splide.off(ATTRIBUTES_UPDATE_EVENT);
4774      data = {};
4775    },
4776
4777    /**
4778     * Return an item by index.
4779     *
4780     * @param {number} index - A slide index.
4781     *
4782     * @return {Object|undefined} - An item object on success or undefined on failure.
4783     */
4784    getItem: function getItem(index) {
4785      return data.items[Components.Controller.toPage(index)];
4786    },
4787
4788    /**
4789     * Return object containing pagination data.
4790     *
4791     * @return {Object} - Pagination data including list and items.
4792     */
4793    get data() {
4794      return data;
4795    }
4796
4797  };
4798  /**
4799   * Update attributes.
4800   *
4801   * @param {number} index     - Active index.
4802   * @param {number} prevIndex - Prev index.
4803   */
4804
4805  function updateAttributes(index, prevIndex) {
4806    var prev = Pagination.getItem(prevIndex);
4807    var curr = Pagination.getItem(index);
4808    var active = STATUS_CLASSES.active;
4809
4810    if (prev) {
4811      removeClass(prev.button, active);
4812    }
4813
4814    if (curr) {
4815      addClass(curr.button, active);
4816    }
4817
4818    Splide.emit(name + ":updated", data, prev, curr);
4819  }
4820  /**
4821   * Create a wrapper and button elements.
4822   *
4823   * @return {Object} - An object contains all data.
4824   */
4825
4826
4827  function createPagination() {
4828    var options = Splide.options;
4829    var classes = Splide.classes;
4830    var list = create('ul', {
4831      "class": classes.pagination
4832    });
4833    var items = Elements.getSlides(false).filter(function (Slide) {
4834      return options.focus !== false || Slide.index % options.perPage === 0;
4835    }).map(function (Slide, page) {
4836      var li = create('li', {});
4837      var button = create('button', {
4838        "class": classes.page,
4839        type: 'button'
4840      });
4841      append(li, button);
4842      append(list, li);
4843      Splide.on('click', function () {
4844        Splide.go(">" + page);
4845      }, button);
4846      return {
4847        li: li,
4848        button: button,
4849        page: page,
4850        Slides: Elements.getSlidesByPage(page)
4851      };
4852    });
4853    return {
4854      list: list,
4855      items: items
4856    };
4857  }
4858
4859  return Pagination;
4860});
4861;// CONCATENATED MODULE: ./src/js/components/lazyload/index.js
4862/**
4863 * The component for loading slider images lazily.
4864 *
4865 * @author    Naotoshi Fujita
4866 * @copyright Naotoshi Fujita. All rights reserved.
4867 */
4868
4869
4870
4871/**
4872 * The name for a data attribute of src.
4873 *
4874 * @type {string}
4875 */
4876
4877var SRC_DATA_NAME = 'data-splide-lazy';
4878/**
4879 * The name for a data attribute of srcset.
4880 *
4881 * @type {string}
4882 */
4883
4884var SRCSET_DATA_NAME = 'data-splide-lazy-srcset';
4885/**
4886 * The component for loading slider images lazily.
4887 *
4888 * @param {Splide} Splide     - A Splide instance.
4889 * @param {Object}
4889 Components - An object containing components.
4890 * @param {string} name       - A component name as a lowercase string.
4891 *
4892 * @return {Object} - The component object.
4893 */
4894
4895/* harmony default export */ var lazyload = (function (Splide, Components, name) {
4896  /**
4897   * Next index for sequential loading.
4898   *
4899   * @type {number}
4900   */
4901  var nextIndex;
4902  /**
4903   * Store objects containing an img element and a Slide object.
4904   *
4905   * @type {Object[]}
4906   */
4907
4908  var images;
4909  /**
4910   * Store the options.
4911   *
4912   * @type {Object}
4913   */
4914
4915  var options = Splide.options;
4916  /**
4917   * Whether to load images sequentially or not.
4918   *
4919   * @type {boolean}
4920   */
4921
4922  var isSequential = options.lazyLoad === 'sequential';
4923  /**
4924   * Lazyload component object.
4925   *
4926   * @type {Object}
4927   */
4928
4929  var Lazyload = {
4930    /**
4931     * Mount only when the lazyload option is provided.
4932     *
4933     * @type {boolean}
4934     */
4935    required: options.lazyLoad,
4936
4937    /**
4938     * Called when the component is mounted.
4939     */
4940    mount: function mount() {
4941      Splide.on('mounted refresh', function () {
4942        init();
4943        Components.Elements.each(function (Slide) {
4944          each(Slide.slide.querySelectorAll("[" + SRC_DATA_NAME + "], [" + SRCSET_DATA_NAME + "]"), function (img) {
4945            if (!img.src && !img.srcset) {
4946              images.push({
4947                img: img,
4948                Slide: Slide
4949              });
4950              applyStyle(img, {
4951                display: 'none'
4952              });
4953            }
4954          });
4955        });
4956
4957        if (isSequential) {
4958          loadNext();
4959        }
4960      });
4961
4962      if (!isSequential) {
4963        Splide.on("mounted refresh moved." + name, check);
4964      }
4965    },
4966
4967    /**
4968     * Destroy.
4969     */
4970    destroy: init
4971  };
4972  /**
4973   * Initialize parameters.
4974   */
4975
4976  function init() {
4977    images = [];
4978    nextIndex = 0;
4979  }
4980  /**
4981   * Check how close each image is from the active slide and
4982   * determine whether to start loading or not, according to the distance.
4983   *
4984   * @param {number} index - Current index.
4985   */
4986
4987
4988  function check(index) {
4989    index = isNaN(index) ? Splide.index : index;
4990    images = images.filter(function (image) {
4991      if (image.Slide.isWithin(index, options.perPage * (options.preloadPages + 1))) {
4992        load(image.img, image.Slide);
4993        return false;
4994      }
4995
4996      return true;
4997    }); // Unbind if all images are loaded.
4998
4999    if (!images[0]) {
5000      Splide.off("moved." + name);
5001    }
5002  }
5003  /**
5004   * Start loading an image.
5005   * Creating a clone of the image element since setting src attribute directly to it
5006   * often occurs 'hitch', blocking some other processes of a browser.
5007   *
5008   * @param {Element} img   - An image element.
5009   * @param {Object}  Slide - A Slide object.
5010   */
5011
5012
5013  function load(img, Slide) {
5014    addClass(Slide.slide, STATUS_CLASSES.loading);
5015    var spinner = create('span', {
5016      "class": Splide.classes.spinner
5017    });
5018    append(img.parentElement, spinner);
5019
5020    img.onload = function () {
5021      loaded(img, spinner, Slide, false);
5022    };
5023
5024    img.onerror = function () {
5025      loaded(img, spinner, Slide, true);
5026    };
5027
5028    setAttribute(img, 'srcset', getAttribute(img, SRCSET_DATA_NAME) || '');
5029    setAttribute(img, 'src', getAttribute(img, SRC_DATA_NAME) || '');
5030  }
5031  /**
5032   * Start loading a next image in images array.
5033   */
5034
5035
5036  function loadNext() {
5037    if (nextIndex < images.length) {
5038      var image = images[nextIndex];
5039      load(image.img, image.Slide);
5040    }
5041
5042    nextIndex++;
5043  }
5044  /**
5045   * Called just after the image was loaded or loading was aborted by some error.
5046   *
5047   * @param {Element} img     - An image element.
5048   * @param {Element} spinner - A spinner element.
5049   * @param {Object}  Slide   - A Slide object.
5050   * @param {boolean} error   - True if the image was loaded successfully or false on error.
5051   */
5052
5053
5054  function loaded(img, spinner, Slide, error) {
5055    removeClass(Slide.slide, STATUS_CLASSES.loading);
5056
5057    if (!error) {
5058      dom_remove(spinner);
5059      applyStyle(img, {
5060        display: ''
5061      });
5062      Splide.emit(name + ":loaded", img).emit('resize');
5063    }
5064
5065    if (isSequential) {
5066      loadNext();
5067    }
5068  }
5069
5070  return Lazyload;
5071});
5072;// CONCATENATED MODULE: ./src/js/constants/a11y.js
5073/**
5074 * Export aria attribute names.
5075 *
5076 * @author    Naotoshi Fujita
5077 * @copyright Naotoshi Fujita. All rights reserved.
5078 */
5079
5080/**
5081 * Attribute name for aria-current.
5082 *
5083 * @type {string}
5084 */
5085var ARIA_CURRENRT = 'aria-current';
5086/**
5087 * Attribute name for aria-control.
5088 *
5089 * @type {string}
5090 */
5091
5092var ARIA_CONTROLS = 'aria-controls';
5093/**
5094 * Attribute name for aria-control.
5095 *
5096 * @type {string}
5097 */
5098
5099var ARIA_LABEL = 'aria-label';
5100/**
5101 * Attribute name for aria-labelledby.
5102 *
5103 * @type {string}
5104 */
5105
5106var ARIA_LABELLEDBY = 'aria-labelledby';
5107/**
5108 * Attribute name for aria-hidden.
5109 *
5110 * @type {string}
5111 */
5112
5113var ARIA_HIDDEN = 'aria-hidden';
5114/**
5115 * Attribute name for tab-index.
5116 *
5117 * @type {string}
5118 */
5119
5120var TAB_INDEX = 'tabindex';
5121;// CONCATENATED MODULE: ./src/js/components/keyboard/index.js
5122/**
5123 * The component for controlling slides via keyboard.
5124 *
5125 * @author    Naotoshi Fujita
5126 * @copyright Naotoshi Fujita. All rights reserved.
5127 */
5128
5129
5130/**
5131 * Map a key to a slide control.
5132 *
5133 * @type {Object}
5134 */
5135
5136var KEY_MAP = {
5137  ltr: {
5138    ArrowLeft: '<',
5139    ArrowRight: '>',
5140    // For IE.
5141    Left: '<',
5142    Right: '>'
5143  },
5144  rtl: {
5145    ArrowLeft: '>',
5146    ArrowRight: '<',
5147    // For IE.
5148    Left: '>',
5149    Right: '<'
5150  },
5151  ttb: {
5152    ArrowUp: '<',
5153    ArrowDown: '>',
5154    // For IE.
5155    Up: '<',
5156    Down: '>'
5157  }
5158};
5159/**
5160 * The component for controlling slides via keyboard.
5161 *
5162 * @param {Splide} Splide - A Splide instance.
5163 *
5164 * @return {Object} - The component object.
5165 */
5166
5167/* harmony default export */ var keyboard = (function (Splide) {
5168  /**
5169   * Hold the target element.
5170   *
5171   * @type {Element|Document|undefined}
5172   */
5173  var target;
5174  return {
5175    /**
5176     * Called when the component is mounted.
5177     */
5178    mount: function mount() {
5179      Splide.on('mounted updated', function () {
5180        var options = Splide.options;
5181        var root = Splide.root;
5182        var map = KEY_MAP[options.direction];
5183        var keyboard = options.keyboard;
5184
5185        if (target) {
5186          Splide.off('keydown', target);
5187          removeAttribute(root, TAB_INDEX);
5188        }
5189
5190        if (keyboard) {
5191          if (keyboard === 'focused') {
5192            target = root;
5193            setAttribute(root, TAB_INDEX, 0);
5194          } else {
5195            target = document;
5196          }
5197
5198          Splide.on('keydown', function (e) {
5199            if (map[e.key]) {
5200              Splide.go(map[e.key]);
5201            }
5202          }, target);
5203        }
5204      });
5205    }
5206  };
5207});
5208;// CONCATENATED MODULE: ./src/js/components/a11y/index.js
5209/**
5210 * The component for enhancing accessibility.
5211 *
5212 * @author    Naotoshi Fujita
5213 * @copyright Naotoshi Fujita. All rights reserved.
5214 */
5215
5216
5217
5218/**
5219 * The component for enhancing accessibility.
5220 *
5221 * @param {Splide} Splide     - A Splide instance.
5222 * @param {Object} Components - An object containing components.
5223 *
5224 * @return {Object} - The component object.
5225 */
5226
5227/* harmony default export */ var a11y = (function (Splide, Components) {
5228  /**
5229   * Hold a i18n object.
5230   *
5231   * @type {Object}
5232   */
5233  var i18n = Splide.i18n;
5234  /**
5235   * Hold the Elements component.
5236   *
5237   * @type {Object}
5238   */
5239
5240  var Elements = Components.Elements;
5241  /**
5242   * All attributes related with A11y.
5243   *
5244   * @type {string[]}
5245   */
5246
5247  var allAttributes = [ARIA_HIDDEN, TAB_INDEX, ARIA_CONTROLS, ARIA_LABEL, ARIA_CURRENRT, 'role'];
5248  /**
5249   * A11y component object.
5250   *
5251   * @type {Object}
5252   */
5253
5254  var A11y = {
5255    /**
5256     * Required only when the accessibility option is true.
5257     *
5258     * @type {boolean}
5259     */
5260    required: Splide.options.accessibility,
5261
5262    /**
5263     * Called when the component is mounted.
5264     */
5265    mount: function mount() {
5266      Splide.on('visible', function (Slide) {
5267        updateSlide(Slide.slide, true);
5268      }).on('hidden', function (Slide) {
5269        updateSlide(Slide.slide, false);
5270      }).on('arrows:mounted', initArrows).on('arrows:updated', updateArrows).on('pagination:mounted', initPagination).on('pagination:updated', updatePagination).on('refresh', function () {
5271        removeAttribute(Components.Clones.clones, allAttributes);
5272      });
5273
5274      if (Splide.options.isNavigation) {
5275        Splide.on('navigation:mounted navigation:updated', initNavigation).on('active', function (Slide) {
5276          updateNavigation(Slide, true);
5277        }).on('inactive', function (Slide) {
5278          updateNavigation(Slide, false);
5279        });
5280      }
5281
5282      initAutoplay();
5283    },
5284
5285    /**
5286     * Destroy.
5287     */
5288    destroy: function destroy() {
5289      var Arrows = Components.Arrows;
5290      var arrows = Arrows ? Arrows.arrows : {};
5291      removeAttribute(Elements.slides.concat([arrows.prev, arrows.next, Elements.play, Elements.pause]), allAttributes);
5292    }
5293  };
5294  /**
5295   * Update slide attributes when it gets visible or hidden.
5296   *
5297   * @param {Element} slide   - A slide element.
5298   * @param {Boolean} visible - True when the slide gets visible, or false when hidden.
5299   */
5300
5301  function updateSlide(slide, visible) {
5302    setAttribute(slide, ARIA_HIDDEN, !visible);
5303
5304    if (Splide.options.slideFocus) {
5305      setAttribute(slide, TAB_INDEX, visible ? 0 : -1);
5306    }
5307  }
5308  /**
5309   * Initialize arrows if they are available.
5310   * Append screen reader elements and add aria-controls attribute.
5311   *
5312   * @param {Element} prev - Previous arrow element.
5313   * @param {Element} next - Next arrow element.
5314   */
5315
5316
5317  function initArrows(prev, next) {
5318    var controls = Elements.track.id;
5319    setAttribute(prev, ARIA_CONTROLS, controls);
5320    setAttribute(next, ARIA_CONTROLS, controls);
5321  }
5322  /**
5323   * Update arrow attributes.
5324   *
5325   * @param {Element} prev      - Previous arrow element.
5326   * @param {Element} next      - Next arrow element.
5327   * @param {number}  prevIndex - Previous slide index or -1 when there is no precede slide.
5328   * @param {number}  nextIndex - Next slide index or -1 when there is no next slide.
5329   */
5330
5331
5332  function updateArrows(prev, next, prevIndex, nextIndex) {
5333    var index = Splide.index;
5334    var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev;
5335    var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next;
5336    setAttribute(prev, ARIA_LABEL, prevLabel);
5337    setAttribute(next, ARIA_LABEL, nextLabel);
5338  }
5339  /**
5340   * Initialize pagination if it's available.
5341   * Append a screen reader element and add aria-controls/label attribute to each item.
5342   *
5343   * @param {Object}
5343 data       - Data object containing all items.
5344   * @param {Object} activeItem - An initial active item.
5345   */
5346
5347
5348  function initPagination(data, activeItem) {
5349    if (activeItem) {
5350      setAttribute(activeItem.button, ARIA_CURRENRT, true);
5351    }
5352
5353    data.items.forEach(function (item) {
5354      var options = Splide.options;
5355      var text = options.focus === false && options.perPage > 1 ? i18n.pageX : i18n.slideX;
5356      var label = sprintf(text, item.page + 1);
5357      var button = item.button;
5358      var controls = item.Slides.map(function (Slide) {
5359        return Slide.slide.id;
5360      });
5361      setAttribute(button, ARIA_CONTROLS, controls.join(' '));
5362      setAttribute(button, ARIA_LABEL, label);
5363    });
5364  }
5365  /**
5366   * Update pagination attributes.
5367   *
5368   * @param {Object}  data - Data object containing all items.
5369   * @param {Element} prev - A previous active element.
5370   * @param {Element} curr - A current active element.
5371   */
5372
5373
5374  function updatePagination(data, prev, curr) {
5375    if (prev) {
5376      removeAttribute(prev.button, ARIA_CURRENRT);
5377    }
5378
5379    if (curr) {
5380      setAttribute(curr.button, ARIA_CURRENRT, true);
5381    }
5382  }
5383  /**
5384   * Initialize autoplay buttons.
5385   */
5386
5387
5388  function initAutoplay() {
5389    ['play', 'pause'].forEach(function (name) {
5390      var elm = Elements[name];
5391
5392      if (elm) {
5393        if (!isButton(elm)) {
5394          setAttribute(elm, 'role', 'button');
5395        }
5396
5397        setAttribute(elm, ARIA_CONTROLS, Elements.track.id);
5398        setAttribute(elm, ARIA_LABEL, i18n[name]);
5399      }
5400    });
5401  }
5402  /**
5403   * Initialize navigation slider.
5404   * Add button role, aria-label, aria-controls to slide elements and append screen reader text to them.
5405   *
5406   * @param {Splide} main - A main Splide instance.
5407   */
5408
5409
5410  function initNavigation(main) {
5411    Elements.each(function (Slide) {
5412      var slide = Slide.slide;
5413      var realIndex = Slide.realIndex;
5414
5415      if (!isButton(slide)) {
5416        setAttribute(slide, 'role', 'button');
5417      }
5418
5419      var slideIndex = realIndex > -1 ? realIndex : Slide.index;
5420      var label = sprintf(i18n.slideX, slideIndex + 1);
5421      var mainSlide = main.Components.Elements.getSlide(slideIndex);
5422      setAttribute(slide, ARIA_LABEL, label);
5423
5424      if (mainSlide) {
5425        setAttribute(slide, ARIA_CONTROLS, mainSlide.slide.id);
5426      }
5427    });
5428  }
5429  /**
5430   * Update navigation attributes.
5431   *
5432   * @param {Object}  Slide  - A target Slide object.
5433   * @param {boolean} active - True if the slide is active or false if inactive.
5434   */
5435
5436
5437  function updateNavigation(_ref, active) {
5438    var slide = _ref.slide;
5439
5440    if (active) {
5441      setAttribute(slide, ARIA_CURRENRT, true);
5442    } else {
5443      removeAttribute(slide, ARIA_CURRENRT);
5444    }
5445  }
5446  /**
5447   * Check if the given element is button or not.
5448   *
5449   * @param {Element} elm - An element to be checked.
5450   *
5451   * @return {boolean} - True if the given element is button.
5452   */
5453
5454
5455  function isButton(elm) {
5456    return elm.tagName === 'BUTTON';
5457  }
5458
5459  return A11y;
5460});
5461;// CONCATENATED MODULE: ./src/js/components/sync/index.js
5462/**
5463 * The component for synchronizing a slider with another.
5464 *
5465 * @author    Naotoshi Fujita
5466 * @copyright Naotoshi Fujita. All rights reserved.
5467 */
5468
5469
5470/**
5471 * The event name for sync.
5472 *
5473 * @type {string}
5474 */
5475
5476var SYNC_EVENT = 'move.sync';
5477/**
5478 * The event names for click navigation.
5479 * @type {string}
5480 */
5481
5482var CLICK_EVENTS = 'mouseup touchend';
5483/**
5484 * The keys for triggering the navigation button.
5485 *
5486 * @type {String[]}
5487 */
5488
5489var TRIGGER_KEYS = [' ', 'Enter', 'Spacebar'];
5490/**
5491 * The component for synchronizing a slider with another.
5492 *
5493 * @param {Splide} Splide - A Splide instance.
5494 *
5495 * @return {Object} - The component object.
5496 */
5497
5498/* harmony default export */ var sync = (function (Splide) {
5499  /**
5500   * Keep the sibling Splide instance.
5501   *
5502   * @type {Splide}
5503   */
5504  var sibling = Splide.sibling;
5505  /**
5506   * Whether the sibling slider is navigation or not.
5507   *
5508   * @type {Splide|boolean}
5509   */
5510
5511  var isNavigation = sibling && sibling.options.isNavigation;
5512  /**
5513   * Layout component object.
5514   *
5515   * @type {Object}
5516   */
5517
5518  var Sync = {
5519    /**
5520     * Required only when the sub slider is available.
5521     *
5522     * @type {boolean}
5523     */
5524    required: !!sibling,
5525
5526    /**
5527     * Called when the component is mounted.
5528     */
5529    mount: function mount() {
5530      syncMain();
5531      syncSibling();
5532
5533      if (isNavigation) {
5534        bind();
5535        Splide.on('refresh', function () {
5536          setTimeout(function () {
5537            bind();
5538            sibling.emit('navigation:updated', Splide);
5539          });
5540        });
5541      }
5542    },
5543
5544    /**
5545     * Called after all components are mounted.
5546     */
5547    mounted: function mounted() {
5548      if (isNavigation) {
5549        sibling.emit('navigation:mounted', Splide);
5550      }
5551    }
5552  };
5553  /**
5554   * Listen the primary slider event to move secondary one.
5555   * Must unbind a handler at first to avoid infinite loop.
5556   */
5557
5558  function syncMain() {
5559    Splide.on(SYNC_EVENT, function (newIndex, prevIndex, destIndex) {
5560      sibling.off(SYNC_EVENT).go(sibling.is(LOOP) ? destIndex : newIndex, false);
5561      syncSibling();
5562    });
5563  }
5564  /**
5565   * Listen the secondary slider event to move primary one.
5566   * Must unbind a handler at first to avoid infinite loop.
5567   */
5568
5569
5570  function syncSibling() {
5571    sibling.on(SYNC_EVENT, function (newIndex, prevIndex, destIndex) {
5572      Splide.off(SYNC_EVENT).go(Splide.is(LOOP) ? destIndex : newIndex, false);
5573      syncMain();
5574    });
5575  }
5576  /**
5577   * Listen some events on each slide.
5578   */
5579
5580
5581  function bind() {
5582    sibling.Components.Elements.each(function (_ref) {
5583      var slide = _ref.slide,
5584          index = _ref.index;
5585
5586      /*
5587       * Listen mouseup and touchend events to handle click.
5588       */
5589      Splide.off(CLICK_EVENTS, slide).on(CLICK_EVENTS, function (e) {
5590        // Ignore a middle or right click.
5591        if (!e.button || e.button === 0) {
5592          moveSibling(index);
5593        }
5594      }, slide);
5595      /*
5596       * Subscribe keyup to handle Enter and Space key.
5597       * Note that Array.includes is not supported by IE.
5598       */
5599
5600      Splide.off('keyup', slide).on('keyup', function (e) {
5601        if (TRIGGER_KEYS.indexOf(e.key) > -1) {
5602          e.preventDefault();
5603          moveSibling(index);
5604        }
5605      }, slide, {
5606        passive: false
5607      });
5608    });
5609  }
5610  /**
5611   * Move the sibling to the given index.
5612   * Need to check "IDLE" status because slides can be moving by Drag component.
5613   *
5614   * @param {number} index - Target index.
5615   */
5616
5617
5618  function moveSibling(index) {
5619    if (Splide.State.is(IDLE)) {
5620      sibling.go(index);
5621    }
5622  }
5623
5624  return Sync;
5625});
5626;// CONCATENATED MODULE: ./src/js/components/breakpoints/index.js
5627/**
5628 * The component for updating options according to a current window width.
5629 *
5630 * @author    Naotoshi Fujita
5631 * @copyright Naotoshi Fujita. All rights reserved.
5632 */
5633
5634
5635/**
5636 * Interval time for throttle.
5637 *
5638 * @type {number}
5639 */
5640
5641var THROTTLE = 50;
5642/**
5643 * The component for updating options according to a current window width.
5644 *
5645 * @param {Splide} Splide - A Splide instance.
5646 *
5647 * @return {Object} - The component object.
5648 */
5649
5650/* harmony default export */ var breakpoints = (function (Splide) {
5651  /**
5652   * Store breakpoints.
5653   *
5654   * @type {Object|boolean}
5655   */
5656  var breakpoints = Splide.options.breakpoints;
5657  /**
5658   * The check function whose frequency of call is reduced.
5659   *
5660   * @type {Function}
5661   */
5662
5663  var throttledCheck = throttle(check, THROTTLE);
5664  /**
5665   * Keep initial options.
5666   *
5667   * @type {Object}
5668   */
5669
5670  var initialOptions;
5671  /**
5672   * An array containing objects of point and MediaQueryList.
5673   *
5674   * @type {Object[]}
5675   */
5676
5677  var map = [];
5678  /**
5679   * Hold the previous breakpoint.
5680   *
5681   * @type {number|undefined}
5682   */
5683
5684  var prevPoint;
5685  /**
5686   * Breakpoints component object.
5687   *
5688   * @type {Object}
5689   */
5690
5691  var Breakpoints = {
5692    /**
5693     * Required only when the breakpoints definition is provided and browser supports matchMedia.
5694     *
5695     * @type {boolean}
5696     */
5697    required: breakpoints && matchMedia,
5698
5699    /**
5700     * Called when the component is mounted.
5701     */
5702    mount: function mount() {
5703      map = Object.keys(breakpoints).sort(function (n, m) {
5704        return +n - +m;
5705      }).map(function (point) {
5706        return {
5707          point: point,
5708          mql: matchMedia("(max-width:" + point + "px)")
5709        };
5710      });
5711      /*
5712       * To keep monitoring resize event after destruction without "completely",
5713       * use native addEventListener instead of Splide.on.
5714       */
5715
5716      this.destroy(true);
5717      addEventListener('resize', throttledCheck); // Keep initial options to apply them when no breakpoint matches.
5718
5719      initialOptions = Splide.options;
5720      check();
5721    },
5722
5723    /**
5724     * Destroy.
5725     *
5726     * @param {boolean} completely - Whether to destroy Splide completely.
5727     */
5728    destroy: function destroy(completely) {
5729      if (completely) {
5730        removeEventListener('resize', throttledCheck);
5731      }
5732    }
5733  };
5734  /**
5735   * Check the breakpoint.
5736   */
5737
5738  function check() {
5739    var point = getPoint();
5740
5741    if (point !== prevPoint) {
5742      prevPoint = point;
5743      var State = Splide.State;
5744      var options = breakpoints[point] || initialOptions;
5745      var destroy = options.destroy;
5746
5747      if (destroy) {
5748        Splide.options = initialOptions;
5749        Splide.destroy(destroy === 'completely');
5750      } else {
5751        if (State.is(DESTROYED)) {
5752          Splide.mount();
5753        }
5754
5755        Splide.options = options;
5756      }
5757    }
5758  }
5759  /**
5760   * Return the breakpoint matching current window width.
5761   * Note that Array.prototype.find is not supported by IE.
5762   *
5763   * @return {number|string} - A breakpoint as number or string. -1 if no point matches.
5764   */
5765
5766
5767  function getPoint() {
5768    var item = map.filter(function (item) {
5769      return item.mql.matches;
5770    })[0];
5771    return item ? item.point : -1;
5772  }
5773
5774  return Breakpoints;
5775});
5776;// CONCATENATED MODULE: ./src/js/components/index.js
5777/**
5778 * Export components.
5779 *
5780 * @author    Naotoshi Fujita
5781 * @copyright Naotoshi Fujita. All rights reserved.
5782 */
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800var COMPLETE = {
5801  Options: options,
5802  Breakpoints: breakpoints,
5803  Controller: controller,
5804  Elements: components_elements,
5805  Track: track,
5806  Clones: clones,
5807  Layout: layout,
5808  Drag: drag,
5809  Click: click,
5810  Autoplay: autoplay,
5811  Cover: cover,
5812  Arrows: arrows,
5813  Pagination: pagination,
5814  LazyLoad: lazyload,
5815  Keyboard: keyboard,
5816  Sync: sync,
5817  A11y: a11y
5818};
5819var LIGHT = {
5820  Options: options,
5821  Controller: controller,
5822  Elements: components_elements,
5823  Track: track,
5824  Clones: clones,
5825  Layout: layout,
5826  Drag: drag,
5827  Click: click,
5828  Arrows: arrows,
5829  Pagination: pagination,
5830  A11y: a11y
5831};
5832;// CONCATENATED MODULE: ./build/complete/complete.js
5833function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
5834
5835/**
5836 * Export "Splide" class for frontend with full components.
5837 *
5838 * @author    Naotoshi Fujita
5839 * @copyright Naotoshi Fujita. All rights reserved.
5840 */
5841
5842
5843/**
5844 * Export Splide with all components.
5845 */
5846
5847var complete_Splide = /*#__PURE__*/function (_Core) {
5848  _inheritsLoose(Splide, _Core);
5849
5850  function Splide(root, options) {
5851    return _Core.call(this, root, options, COMPLETE) || this;
5852  }
5853
5854  return Splide;
5855}(Splide); // Register the class as a global variable for non-ES6 environment.
5856
5857window.Splide = complete_Splide;
5858/******/ })()
5859;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.