function _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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /*! * Splide.js * Version : 3.0.0 * License : MIT * Copyright: 2021 Naotoshi Fujita */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Splide = factory()); })(this, function () { 'use strict'; var PROJECT_CODE = "splide"; var DATA_ATTRIBUTE = "data-" + PROJECT_CODE; var CREATED = 1; var MOUNTED = 2; var IDLE = 3; var MOVING = 4; var DESTROYED = 5; var STATES = { CREATED: CREATED, MOUNTED: MOUNTED, IDLE: IDLE, MOVING: MOVING, DESTROYED: DESTROYED }; var DEFAULT_EVENT_PRIORITY = 10; var DEFAULT_USER_EVENT_PRIORITY = 20; function empty(array) { array.length = 0; } function isObject(subject) { return !isNull(subject) && typeof subject === "object"; } function isArray(subject) { return Array.isArray(subject); } function isFunction(subject) { return typeof subject === "function"; } function isString(subject) { return typeof subject === "string"; } function isUndefined(subject) { return typeof subject === "undefined"; } function isNull(subject) { return subject === null; } function isHTMLElement(subject) { return subject instanceof HTMLElement; } function isHTMLButtonElement(subject) { return subject instanceof HTMLButtonElement; } function toArray(value) { return isArray(value) ? value : [value]; } function forEach(values, iteratee) { toArray(values).forEach(iteratee); } function includes(array, value) { return array.indexOf(value) > -1; } function push(array, items) { array.push.apply(array, toArray(items)); return array; } var arrayProto = Array.prototype; function slice(arrayLike, start, end) { return arrayProto.slice.call(arrayLike, start, end); } function find(arrayLike, predicate) { return slice(arrayLike).filter(predicate)[0]; } function toggleClass(elm, classes, add) { if (elm) { forEach(classes, function (name) { if (name) { elm.classList[add ? "add" : "remove"](name); } }); } } function addClass(elm, classes) { toggleClass(elm, classes, true); } function append(parent, children) { forEach(children, parent.appendChild.bind(parent)); } function before(nodes, ref) { forEach(nodes, function (node) { var parent = ref.parentNode; if (parent) { parent.insertBefore(node, ref); } }); } function matches(elm, selector) { return (elm["msMatchesSelector"] || elm.matches).call(elm, selector); } function children(parent, selector) { return parent ? slice(parent.children).filter(function (child) { return matches(child, selector); }) : []; } function child(parent, selector) { return selector ? children(parent, selector)[0] : parent.firstElementChild; } function forOwn(object, iteratee) { if (object) { var keys = Object.keys(object); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key !== "__proto__") { if (iteratee(object[key], key) === false) { break; } } } } return object; } function assign(object) { for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { sources[_key - 1] = arguments[_key]; } sources.forEach(function (source) { forOwn(source, function (value, key) { object[key] = source[key]; }); }); return object; } function merge(object, source) { forOwn(source, function (value, key) { if (isArray(value)) { object[key] = value.slice(); } else if (isObject(value)) { object[key] = merge(isObject(object[key]) ? object[key] : {}, value); } else { object[key] = value; } }); return object; } function removeAttribute(elm, attrs) { if (elm) { forEach(attrs, function (attr) { elm.removeAttribute(attr); }); } } function setAttribute(elm, attrs, value) { if (isObject(attrs)) { forOwn(attrs, function (value2, name) { setAttribute(elm, name, value2); }); } else { isNull(value) ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value)); } } function create(tag, attrs, parent) { var elm = document.createElement(tag); if (attrs) { if (isString(attrs) || isArray(attrs)) { addClass(elm, attrs); } else { setAttribute(elm, attrs); } } if (parent) { append(parent, elm); } return elm; } function style(elms, styles) { if (isString(styles)) { return isArray(elms) ? null : getComputedStyle(elms)[styles]; } forOwn(styles, function (value, key) { if (!isNull(value)) { forEach(elms, function (elm) { if (elm) { elm.style[key] = "" + value; } }); } }); } function display(elm, display2) { style(elm, { display: display2 }); } function getAttribute(elm, attr) { return elm.getAttribute(attr); } function hasClass(elm, className) { return elm && elm.classList.contains(className); } function parseHtml(html) { return child(new DOMParser().parseFromString(html, "text/html").body); } function prevent(e, stopPropagation) { e.preventDefault(); if (stopPropagation) { e.stopPropagation(); e.stopImmediatePropagation(); } } function query(parent, selector) { return parent && parent.querySelector(selector); } function queryAll(parent, selector) { return slice(parent.querySelectorAll(selector)); } function rect(target) { return target.getBoundingClientRect(); } function remove(nodes) { forEach(nodes, function (node) { if (node && node.parentNode) { node.parentNode.removeChild(node); } }); } function removeClass(elm, classes) { toggleClass(elm, classes, false); } function unit(value) { return isString(value) ? value : value ? value + "px" : ""; } function assert(condition, message) { if (message === void 0) { message = ""; } if (!condition) { throw new Error("[" + PROJECT_CODE + "] " + message); } } function nextTick(callback) { setTimeout(callback); } var noop = function noop() {}; function raf(func) { return requestAnimationFrame(func); } function approximatelyEqual(x, y, epsilon) { return Math.abs(x - y) < epsilon; } function between(number, minOrMax, maxOrMin, exclusive) { var min = Math.min(minOrMax, maxOrMin); var max = Math.max(minOrMax, maxOrMin); return exclusive ? min < number && number < max : min <= number && number <= max; } var max$1 = Math.max, min$1 = Math.min; function clamp(number, x, y) { var minimum = min$1(x, y); var maximum = max$1(x, y); return min$1(max$1(minimum, number), maximum); } function sign(x) { return +(x > 0) - +(x < 0); } var min = Math.min, max = Math.max, floor = Math.floor, ceil = Math.ceil, abs = Math.abs, round = Math.round; function format(string, replacements) { forEach(replacements, function (replacement) { string = string.replace("%s", "" + replacement); }); return string; } function pad(number) { return number < 10 ? "0" + number : "" + number; } var ids = {}; function uniqueId(prefix) { return "" + prefix + pad(ids[prefix] = (ids[prefix] || 0) + 1); } function EventBus() { var handlers = {}; function on(events, callback, key, priority) { if (priority === void 0) { priority = DEFAULT_EVENT_PRIORITY; } forEachEvent(events, function (event, namespace) { handlers[event] = handlers[event] || []; push(handlers[event], { _event: event, _callback: callback, _namespace: namespace, _priority: priority, _key: key }).sort(function (handler1, handler2) { return handler1._priority - handler2._priority; }); }); } function off(events, key) { forEachEvent(events, function (event, namespace) { var eventHandlers = handlers[event]; handlers[event] = eventHandlers && eventHandlers.filter(function (handler) { return handler._key ? handler._key !== key : handler._namespace !== namespace; }); }); } function offBy(key) { forOwn(handlers, function (eventHandlers, event) { off(event, key); }); } function emit(event) { var _arguments = arguments; (handlers[event] || []).forEach(function (handler) { handler._callback.apply(handler, slice(_arguments, 1)); }); } function destroy() { handlers = {}; } function forEachEvent(events, iteratee) { toArray(events).join(" ").split(" ").forEach(function (eventNS) { var fragments = eventNS.split("."); iteratee(fragments[0], fragments[1]); }); } return { on: on, off: off, offBy: offBy, emit: emit, destroy: destroy }; } var EVENT_MOUNTED = "mounted"; var EVENT_READY = "ready"; var EVENT_MOVE = "move"; var EVENT_MOVED = "moved"; var EVENT_CLICK = "click"; var EVENT_ACTIVE = "active"; var EVENT_INACTIVE = "inactive"; var EVENT_VISIBLE = "visible"; var EVENT_HIDDEN = "hidden"; var EVENT_SLIDE_KEYDOWN = "slide:keydown"; var EVENT_REFRESH = "refresh"; var EVENT_UPDATED = "undated"; var EVENT_RESIZE = "resize"; var EVENT_RESIZED = "resized"; var EVENT_DRAG = "drag"; var EVENT_DRAGGING = "dragging"; var EVENT_DRAGGED = "dragged"; var EVENT_SCROLL = "scroll"; var EVENT_SCROLLED = "scrolled"; var EVENT_DESTROY = "destroy"; var EVENT_ARROWS_MOUNTED = "arrows:mounted"; var EVENT_ARROWS_UPDATED = "arrows:updated"; var EVENT_PAGINATION_MOUNTED = "pagination:mounted"; var EVENT_PAGINATION_PAGE = "pagination:page"; var EVENT_PAGINATION_UPDATED = "pagination:updated"; var EVENT_NAVIGATION_MOUNTED = "navigation:mounted"; var EVENT_AUTOPLAY_PLAY = "autoplay:play"; var EVENT_AUTOPLAY_PLAYING = "autoplay:playing"; var EVENT_AUTOPLAY_PAUSE = "autoplay:pause"; var EVENT_LAZYLOAD_LOADED = "lazyload:loaded"; function EventInterface(Splide2) { var event = Splide2.event; var key = {}; var listeners = []; function on(events, callback, priority) { event.on(events, callback, key, priority); } function off(events) { event.off(events, key); } function bind(targets, events, callback, options) { forEachEvent(targets, events, function (target, event2) { listeners.push([target, event2, callback, options]); target.addEventListener(event2, callback, options); }); } function unbind(targets, events) { forEachEvent(targets, events, function (target, event2) { listeners = listeners.filter(function (listener) { if (listener[0] === target && listener[1] === event2) { target.removeEventListener(event2, listener[2], listener[3]); return false; } return true; }); }); } function forEachEvent(targets, events, iteratee) { forEach(targets, function (target) { if (target) { events.split(" ").forEach(iteratee.bind(null, target)); } }); } function destroy() { listeners = listeners.filter(function (data) { return unbind(data[0], data[1]); }); event.offBy(key); } event.on(EVENT_DESTROY, destroy, key); return { on: on, off: off, emit: event.emit, bind: bind, unbind: unbind, destroy: destroy }; } function RequestInterval(interval, onInterval, onUpdate, limit) { var now = Date.now; var startTime; var rate = 0; var id; var paused = true; var count = 0; function update() { if (!paused) { var elapsed = now() - startTime; if (elapsed >= interval) { rate = 1; startTime = now(); } else { rate = elapsed / interval; } if (onUpdate) { onUpdate(rate); } if (rate === 1) { onInterval(); if (limit && ++count >= limit) { pause(); return; } } raf(update); } } function start(resume) { !resume && cancel(); startTime = now() - (resume ? rate * interval : 0); paused = false; raf(update); } function pause() { paused = true; } function rewind() { startTime = now(); rate = 0; if (onUpdate) { onUpdate(rate); } } function cancel() { cancelAnimationFrame(id); rate = 0; id = 0; paused = true; } function isPaused() { return paused; } return { start: start, rewind: rewind, pause: pause, cancel: cancel, isPaused: isPaused }; } function State(initialState) { var state = initialState; function set(value) { state = value; } function is(states) { return includes(toArray(states), state); } return { set: set, is: is }; } function Throttle(func, duration) { var interval; function throttled() { var _arguments2 = arguments, _this = this; if (!interval) { interval = RequestInterval(duration || 0, function () { func.apply(_this, _arguments2); interval = null; }, null, 1); interval.start(); } } return throttled; } function Options(Splide2, Components2, options) { var throttledObserve = Throttle(observe); var initialOptions; var points; var currPoint; function setup() { try { merge(options, JSON.parse(getAttribute(Splide2.root, DATA_ATTRIBUTE))); } catch (e) { assert(false, e.message); } initialOptions = merge({}, options); } function mount() { var breakpoints = options.breakpoints; if (breakpoints) { points = Object.keys(breakpoints).sort(function (n, m) { return +n - +m; }).map(function (point) { return [point, matchMedia("(" + (options.mediaQuery || "max") + "-width:" + point + "px)")]; }); addEventListener("resize", throttledObserve); observe(); } } function destroy(completely) { if (completely) { removeEventListener("resize", throttledObserve); } } function observe() { var item = find(points, function (item2) { return item2[1].matches; }) || []; if (item[0] !== currPoint) { onMatch(currPoint = item[0]); } } function onMatch(point) { var newOptions = options.breakpoints[point] || initialOptions; if (newOptions.destroy) { Splide2.options = initialOptions; Splide2.destroy(newOptions.destroy === "completely"); } else { if (Splide2.state.is(DESTROYED)) { destroy(true); Splide2.mount(); } Splide2.options = newOptions; } } return { setup: setup, mount: mount, destroy: destroy }; } var RTL = "rtl"; var TTB = "ttb"; var ORIENTATION_MAP = { marginRight: ["marginBottom", "marginLeft"], width: ["height"], autoWidth: ["autoHeight"], fixedWidth: ["fixedHeight"], paddingLeft: ["paddingTop", "paddingRight"], paddingRight: ["paddingBottom", "paddingLeft"], left: ["top", "right"], right: ["bottom", "left"], x: ["y"], X: ["Y"], Y: ["X"], ArrowLeft: ["ArrowUp", "ArrowRight"], ArrowRight: ["ArrowDown", "ArrowLeft"] }; function Direction(Splide2, Components2, options) { function resolve(prop, axisOnly) { var direction = options.direction; var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1; return ORIENTATION_MAP[prop][index] || prop; } function orient(value) { return value * (options.direction === RTL ? 1 : -1); } return { resolve: resolve, orient: orient }; } var CLASS_ROOT = PROJECT_CODE; var CLASS_SLIDER = PROJECT_CODE + "__slider"; var CLASS_TRACK = PROJECT_CODE + "__track"; var CLASS_LIST = PROJECT_CODE + "__list"; var CLASS_SLIDE = PROJECT_CODE + "__slide"; var CLASS_CLONE = CLASS_SLIDE + "--clone"; var CLASS_CONTAINER = CLASS_SLIDE + "__container"; var CLASS_ARROWS = PROJECT_CODE + "__arrows"; var CLASS_ARROW = PROJECT_CODE + "__arrow"; var CLASS_ARROW_PREV = CLASS_ARROW + "--prev"; var CLASS_ARROW_NEXT = CLASS_ARROW + "--next"; var CLASS_PAGINATION = PROJECT_CODE + "__pagination"; var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page"; var CLASS_PROGRESS = PROJECT_CODE + "__progress"; var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar"; var CLASS_AUTOPLAY = PROJECT_CODE + "__autoplay"; var CLASS_PLAY = PROJECT_CODE + "__play"; var CLASS_PAUSE = PROJECT_CODE + "__pause"; var CLASS_SPINNER = PROJECT_CODE + "__spinner"; var CLASS_INITIALIZED = "is-initialized"; var CLASS_ACTIVE = "is-active"; var CLASS_PREV = "is-prev"; var CLASS_NEXT = "is-next"; var CLASS_VISIBLE = "is-visible"; var CLASS_LOADING = "is-loading"; var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING]; var CLASSES = { slide: CLASS_SLIDE, clone: CLASS_CLONE, arrows: CLASS_ARROWS, arrow: CLASS_ARROW, prev: CLASS_ARROW_PREV, next: CLASS_ARROW_NEXT, pagination: CLASS_PAGINATION, page: CLASS_PAGINATION_PAGE, spinner: CLASS_SPINNER }; function Elements(Splide2, Components2, options) { var _EventInterface = EventInterface(Splide2), on = _EventInterface.on; var root = Splide2.root; var elements = {}; var slides = []; var classes; var slider; var track; var list; function setup() { collect(); identify(); addClass(root, classes = getClasses()); } function mount() { on(EVENT_REFRESH, refresh); on(EVENT_UPDATED, update); } function destroy() { empty(slides); removeClass(root, classes); } function refresh() { destroy(); setup(); } function update() { removeClass(root, classes); addClass(root, classes = getClasses()); } function collect() { slider = child(root, "." + CLASS_SLIDER); track = query(root, "." + CLASS_TRACK); list = child(track, "." + CLASS_LIST); assert(track && list, "Missing a track/list element."); push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")")); var autoplay = find("." + CLASS_AUTOPLAY); var arrows = find("." + CLASS_ARROWS); assign(elements, { root: root, slider: slider, track: track, list: list, slides: slides, arrows: arrows, prev: query(arrows, "." + CLASS_ARROW_PREV), next: query(arrows, "." + CLASS_ARROW_NEXT), bar: query(find("." + CLASS_PROGRESS), "." + CLASS_PROGRESS_BAR), play: query(autoplay, "." + CLASS_PLAY), pause: query(autoplay, "." + CLASS_PAUSE) }); } function identify() { var id = root.id || uniqueId(PROJECT_CODE); root.id = id; track.id = track.id || id + "-track"; list.id = list.id || id + "-list"; } function find(selector) { return child(root, selector) || child(slider, selector); } function getClasses() { return [CLASS_ROOT + "--" + options.type, CLASS_ROOT + "--" + options.direction, options.drag && CLASS_ROOT + "--draggable", options.isNavigation && CLASS_ROOT + "--nav", CLASS_ACTIVE]; } return assign(elements, { setup: setup, mount: mount, destroy: destroy }); } function Style() { var style; var sheet; function mount() { style = create("style", {}, document.head); sheet = style.sheet; } function destroy() { remove(style); sheet = null; } function rule(selector, prop, value) { var _sheet = sheet, cssRules = _sheet.cssRules; var cssRule = find(cssRules, function (cssRule2) { return isCSSStyleRule(cssRule2) && cssRule2.selectorText === selector; }) || cssRules[sheet.insertRule(selector + "{}", 0)]; if (isCSSStyleRule(cssRule)) { cssRule.style[prop] = "" + value; } } function ruleBy(target, prop, value) { rule("#" + (isHTMLElement(target) ? target.id : target), prop, value); } function isCSSStyleRule(cssRule) { return cssRule instanceof CSSStyleRule; } return { mount: mount, destroy: destroy, rule: rule, ruleBy: ruleBy }; } var ROLE = "role"; var ARIA_CONTROLS = "aria-controls"; var ARIA_CURRENT = "aria-current"; var ARIA_LABEL = "aria-label"; var ARIA_HIDDEN = "aria-hidden"; var TAB_INDEX = "tabindex"; var DISABLED = "disabled"; var ALL_ATTRIBUTES = [ROLE, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_HIDDEN, TAB_INDEX, DISABLED]; var SLIDE = "slide"; var LOOP = "loop"; var FADE = "fade"; function Slide$1(Splide2, index, slideIndex, slide) { var _EventInterface2 = EventInterface(Splide2), on = _EventInterface2.on, emit = _EventInterface2.emit, bind = _EventInterface2.bind, destroyEvents = _EventInterface2.destroy; var Components = Splide2.Components, root = Splide2.root, options = Splide2.options; var isNavigation = options.isNavigation, updateOnMove = options.updateOnMove; var resolve = Components.Direction.resolve; var isClone = slideIndex > -1; var container = child(slide, "." + CLASS_CONTAINER); var destroyed; function mount() { var _this2 = this; init(); bind(slide, "click keydown", function (e) { emit(e.type === "click" ? EVENT_CLICK : EVENT_SLIDE_KEYDOWN, _this2, e); }); on([EVENT_RESIZED, EVENT_MOVED, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED], update.bind(this)); if (updateOnMove) { on(EVENT_MOVE, onMove.bind(this)); } update.call(this); } function init() { if (!isClone) { slide.id = root.id + "-slide" + pad(index + 1); } if (isNavigation) { if (!isHTMLButtonElement(slide)) { setAttribute(slide, ROLE, "button"); } var idx = isClone ? slideIndex : index; var label = format(options.i18n.slideX, idx + 1); var controls = Splide2.splides.map(function (splide) { return splide.root.id; }).join(" "); setAttribute(slide, ARIA_LABEL, label); setAttribute(slide, ARIA_CONTROLS, controls); } } function destroy() { destroyed = true; destroyEvents(); removeClass(slide, STATUS_CLASSES); removeAttribute(slide, ALL_ATTRIBUTES); } function onMove(next, prev, dest) { if (!destroyed) { if (dest === index) { updateActivity.call(this, true); } update.call(this); } } function update() { if (!destroyed) { var currIndex = Splide2.index; updateActivity.call(this, isActive()); updateVisibility.call(this, isVisible()); toggleClass(slide, CLASS_PREV, index === currIndex - 1); toggleClass(slide, CLASS_NEXT, index === currIndex + 1); } } function updateActivity(active) { if (active !== hasClass(slide, CLASS_ACTIVE)) { toggleClass(slide, CLASS_ACTIVE, active); if (isNavigation) { setAttribute(slide, ARIA_CURRENT, active || null); } emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, this); } } function updateVisibility(visible) { var ariaHidden = !visible && !isActive(); setAttribute(slide, ARIA_HIDDEN, ariaHidden || null); setAttribute(slide, TAB_INDEX, !ariaHidden && options.slideFocus ? 0 : null); if (visible !== hasClass(slide, CLASS_VISIBLE)) { toggleClass(slide, CLASS_VISIBLE, visible); emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, this); } } function rule(prop, value, useContainer) { var selector = "#" + slide.id + (container && useContainer ? " > ." + CLASS_CONTAINER : ""); Components.Style.rule(selector, prop, value); } function isActive() { return Splide2.index === index; } function isVisible() { if (Splide2.is(FADE)) { return isActive(); } var trackRect = rect(Components.Elements.track); var slideRect = rect(slide); var left = resolve("left"); var right = resolve("right"); return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]); } function isWithin(from, distance) { var diff = abs(from - index); if (!Splide2.is(SLIDE) && !isClone) { diff = min(diff, Splide2.length - diff); } return diff <= distance; } return { index: index, slideIndex: slideIndex, slide: slide, container: container, isClone: isClone, mount: mount, destroy: destroy, rule: rule, isWithin: isWithin }; } function Slides(Splide2, Components2, options) { var _EventInterface3 = EventInterface(Splide2), on = _EventInterface3.on, emit = _EventInterface3.emit, bind = _EventInterface3.bind; var _Components2$Elements = Components2.Elements, slides = _Components2$Elements.slides, list = _Components2$Elements.list; var Slides2 = []; function mount() { init(); on(EVENT_REFRESH, refresh); } function init() { slides.forEach(function (slide, index) { register(slide, index, -1); }); } function destroy() { forEach$1(function (Slide2) { Slide2.destroy(); }); empty(Slides2); } function refresh() { destroy(); init(); } function register(slide, index, slideIndex) { var object = Slide$1(Splide2, index, slideIndex, slide); object.mount(); Slides2.push(object); } function get(excludeClones) { return excludeClones ? filter(function (Slide2) { return !Slide2.isClone; }) : Slides2; } function getIn(page) { var Controller = Components2.Controller; var index = Controller.toIndex(page); var max = Controller.hasFocus() ? 1 : options.perPage; return filter(function (Slide2) { return between(Slide2.index, index, index + max - 1); }); } function getAt(index) { return filter(index)[0]; } function add(items, index) { forEach(items, function (slide) { if (isString(slide)) { slide = parseHtml(slide); } if (isHTMLElement(slide)) { var ref = slides[index]; ref ? before(slide, ref) : append(list, slide); addClass(slide, options.classes.slide); observeImages(slide, emit.bind(null, EVENT_RESIZE)); } }); emit(EVENT_REFRESH); } function remove$1(matcher) { remove(filter(matcher).map(function (Slide2) { return Slide2.slide; })); emit(EVENT_REFRESH); } function forEach$1(iteratee, excludeClones) { get(excludeClones).forEach(iteratee); } function filter(matcher) { return Slides2.filter(isFunction(matcher) ? matcher : function (Slide2) { return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index); }); } function rule(prop, value, useContainer) { forEach$1(function (Slide2) { Slide2.rule(prop, value, useContainer); }); } function observeImages(elm, callback) { var images = queryAll(elm, "img"); var length = images.length; if (length) { images.forEach(function (img) { bind(img, "load error", function () { if (! --length) { callback(); } }); }); } else { callback(); } } function getLength(excludeClones) { return excludeClones ? slides.length : Slides2.length; } function isEnough() { return Slides2.length > options.perPage; } return { mount: mount, destroy: destroy, register: register, get: get, getIn: getIn, getAt: getAt, add: add, remove: remove$1, forEach: forEach$1, filter: filter, rule: rule, getLength: getLength, isEnough: isEnough }; } function Clones(Splide2, Components2, options) { var _EventInterface4 = EventInterface(Splide2), on = _EventInterface4.on, emit = _EventInterface4.emit; var Elements = Components2.Elements, Slides = Components2.Slides; var resolve = Components2.Direction.resolve; var clones = []; var cloneCount; function mount() { init(); on(EVENT_REFRESH, refresh); on([EVENT_UPDATED, EVENT_RESIZE], observe); } function init() { if (cloneCount = computeCloneCount()) { generate(cloneCount); } } function destroy() { remove(clones); empty(clones); } function refresh() { destroy(); init(); } function observe() { if (cloneCount !== computeCloneCount()) { emit(EVENT_REFRESH); } } function generate(count) { var slides = Slides.get().slice(); var length = slides.length; if (length) { while (slides.length < count) { push(slides, slides); } push(slides.slice(-count), slides.slice(0, count)).forEach(function (Slide, index) { var isHead = index < count; var clone = cloneDeep(Slide.slide, index); isHead ? before(clone, slides[0].slide) : append(Elements.list, clone); push(clones, clone); Slides.register(clone, index - count + (isHead ? 0 : length), Slide.index); }); } } function cloneDeep(elm, index) { var clone = elm.cloneNode(true); addClass(clone, options.classes.clone); clone.id = Splide2.root.id + "-clone" + pad(index + 1); return clone; } function computeCloneCount() { var clones2 = options.clones; if (!Splide2.is(LOOP)) { clones2 = 0; } else if (!clones2) { var fixedSize = options[resolve("fixedWidth")]; var fixedCount = fixedSize && ceil(rect(Elements.track)[resolve("width")] / fixedSize); var baseCount = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage; clones2 = baseCount * (options.drag ? (options.flickMaxPages || 1) + 1 : 2); } return clones2; } return { mount: mount, destroy: destroy }; } function Layout(Splide2, Components2, options) { var _EventInterface5 = EventInterface(Splide2), on = _EventInterface5.on, bind = _EventInterface5.bind, emit = _EventInterface5.emit; var Slides = Components2.Slides; var ruleBy = Components2.Style.ruleBy; var resolve = Components2.Direction.resolve; var _Components2$Elements2 = Components2.Elements, track = _Components2$Elements2.track, list = _Components2$Elements2.list; var getAt = Slides.getAt; var vertical = options.direction === TTB; function mount() { init(); bind(window, "resize load", Throttle(emit.bind(this, EVENT_RESIZE))); on([EVENT_UPDATED, EVENT_REFRESH], init); on(EVENT_RESIZE, resize); } function init() { ruleBy(Splide2.root, "maxWidth", unit(options.width)); ruleBy(track, resolve("paddingLeft"), cssPadding(false)); ruleBy(track, resolve("paddingRight"), cssPadding(true)); Slides.rule(resolve("marginRight"), unit(options.gap)); Slides.rule("width", cssSlideWidth()); setSlidesHeight(); resize(); } function resize() { ruleBy(track, "height", cssTrackHeight()); options.heightRatio && setSlidesHeight(); emit(EVENT_RESIZED); } function setSlidesHeight() { Slides.rule("height", cssSlideHeight(), true); } function cssPadding(right) { var padding = options.padding; var prop = resolve(right ? "right" : "left", true); return padding ? unit(padding[prop] || (isObject(padding) ? "0" : padding)) : ""; } function cssTrackHeight() { var height = ""; if (vertical) { height = cssHeight(); assert(height, '"height" or "heightRatio" is missing.'); var paddingTop = cssPadding(false); var paddingBottom = cssPadding(true); if (paddingTop || paddingBottom) { height = "calc(" + height; height += "" + (paddingTop ? " - " + paddingTop : "") + (paddingBottom ? " - " + paddingBottom : "") + ")"; } } return height; } function cssHeight() { return unit(options.height || rect(list).width * options.heightRatio); } function cssSlideWidth() { return options.autoWidth ? "" : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize()); } function cssSlideHeight() { return unit(options.fixedHeight) || (vertical ? options.autoHeight ? "" : cssSlideSize() : cssHeight()); } function cssSlideSize() { var gap = unit(options.gap); return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")"; } function listSize() { return rect(list)[resolve("width")]; } function slideSize(index, withoutGap) { var Slide = getAt(index || 0); return Slide ? rect(Slide.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0; } function totalSize(index, withoutGap) { var Slide = getAt(index); if (Slide) { var right = rect(Slide.slide)[resolve("right")]; var left = rect(list)[resolve("left")]; return abs(right - left) + (withoutGap ? 0 : getGap()); } return 0; } function sliderSize() { return totalSize(Splide2.length - 1, true) - totalSize(-1, true); } function getGap() { var Slide = getAt(0); return Slide && parseFloat(style(Slide.slide, resolve("marginRight"))) || 0; } function getPadding(right) { return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left"), true))) || 0; } return { mount: mount, listSize: listSize, slideSize: slideSize, sliderSize: sliderSize, totalSize: totalSize, getPadding: getPadding }; } var SNAP_THRESHOLD = 10; function Move(Splide2, Components2, options) { var _EventInterface6 = EventInterface(Splide2), on = _EventInterface6.on, emit = _EventInterface6.emit; var _Components2$Layout = Components2.Layout, slideSize = _Components2$Layout.slideSize, getPadding = _Components2$Layout.getPadding, totalSize = _Components2$Layout.totalSize, listSize = _Components2$Layout.listSize, sliderSize = _Components2$Layout.sliderSize; var _Components2$Directio = Components2.Direction, resolve = _Components2$Directio.resolve, orient = _Components2$Directio.orient; var _Components2$Elements3 = Components2.Elements, list = _Components2$Elements3.list, track = _Components2$Elements3.track; var waiting; var shouldSnap = true; function mount() { on([EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition, DEFAULT_EVENT_PRIORITY - 1); } function reposition() { if (exceededLimit(true)) { translate(getLimit(true)); } else if (shouldSnap || (shouldSnap = canSnap())) { jump(Splide2.index); } } function move(dest, index, prev) { if (!isBusy()) { var set = Splide2.state.set; var position = getPosition(); var looping = dest !== index; waiting = looping || options.waitForTransition; set(MOVING); emit(EVENT_MOVE, index, prev, dest); Components2.Transition.start(dest, function () { looping && jump(index); waiting = false; set(IDLE); emit(EVENT_MOVED, index, prev, dest); if (options.trimSpace === "move" && dest !== prev && position === getPosition()) { Components2.Controller.go(dest > prev ? ">" : "<"); } }); } } function jump(index) { waiting = false; Components2.Transition.cancel(); translate(toPosition(index, true)); } function translate(position) { position = loop(position); shouldSnap = canSnap(position); Components2.Style.ruleBy(list, "transform", "translate" + resolve("X") + "(" + 100 * position / listSize() + "%)"); } function loop(position) { if (!waiting && Splide2.is(LOOP)) { var diff = position - getPosition(); var exceededMin = exceededLimit(false, position); var exceededMax = exceededLimit(true, position); if (exceededMin && diff > 0 || exceededMax && diff < 0) { position += orient(sliderSize() * (exceededMin ? 1 : -1)); } } return position; } function cancel() { translate(getPosition()); Components2.Transition.cancel(); } function toIndex(position) { var Slides = Components2.Slides.get(); var index = 0; var minDistance = Infinity; for (var i = 0; i < Slides.length; i++) { var slideIndex = Slides[i].index; var distance = abs(toPosition(slideIndex, true) - position); if (distance < minDistance) { minDistance = distance; index = slideIndex; } else { break; } } return index; } function toPosition(index, trimming) { var position = orient(totalSize(index - 1) - offset(index)); return trimming ? trim(position) : position; } function getPosition() { var left = resolve("left"); return rect(list)[left] - rect(track)[left] + orient(getPadding(false)); } function trim(position) { if (options.trimSpace && Splide2.is(SLIDE)) { position = clamp(position, 0, orient(sliderSize() - listSize())); } return position; } function offset(index) { var focus = options.focus; return focus === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus * slideSize(index) || 0; } function getLimit(max) { return toPosition(max ? Components2.Controller.getEnd() : 0, !!options.trimSpace); } function canSnap(position) { position = isUndefined(position) ? getPosition() : position; return abs(position - toPosition(toIndex(position), true)) < SNAP_THRESHOLD; } function isBusy() { return waiting; } function exceededLimit(max, position) { position = isUndefined(position) ? getPosition() : position; var exceededMin = max !== true && orient(position) < orient(getLimit(false)); var exceededMax = max !== false && orient(position) > orient(getLimit(true)); return exceededMin || exceededMax; } return { mount: mount, move: move, jump: jump, translate: translate, cancel: cancel, toIndex: toIndex, toPosition: toPosition, getPosition: getPosition, getLimit: getLimit, isBusy: isBusy, exceededLimit: exceededLimit }; } function Controller(Splide2, Components2, options) { var _EventInterface7 = EventInterface(Splide2), on = _EventInterface7.on; var Move = Components2.Move; var _Components2$Slides = Components2.Slides, isEnough = _Components2$Slides.isEnough, getLength = _Components2$Slides.getLength; var isLoop = Splide2.is(LOOP); var currIndex = options.start || 0; var prevIndex = currIndex; var slideCount; var perMove; var perPage; function mount() { init(); Move.jump(currIndex); on([EVENT_UPDATED, EVENT_REFRESH], init); on(EVENT_SCROLLED, reindex, 0); } function init() { slideCount = getLength(true); perMove = options.perMove; perPage = options.perPage; if (currIndex >= slideCount) { Move.jump(currIndex = slideCount - 1); } } function reindex() { setIndex(Move.toIndex(Move.getPosition())); } function go(control, allowSameIndex) { var dest = parse(control); var index = loop(dest); if (index > -1 && !Move.isBusy() && (allowSameIndex || index !== currIndex)) { setIndex(index); Move.move(dest, index, prevIndex); } } function parse(control) { var index = currIndex; if (isString(control)) { var _ref = control.match(/([+\-<>])(\d+)?/) || [], indicator = _ref[1], number = _ref[2]; if (indicator === "+" || indicator === "-") { index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex, true); } else if (indicator === ">") { index = number ? toIndex(+number) : getNext(true); } else if (indicator === "<") { index = getPrev(true); } } else { if (isLoop) { index = clamp(control, -perPage, slideCount + perPage - 1); } else { index = clamp(control, 0, getEnd()); } } return index; } function getNext(destination) { return getAdjacent(false, destination); } function getPrev(destination) { return getAdjacent(true, destination); } function getAdjacent(prev, destination) { var number = perMove || hasFocus() ? 1 : perPage; var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex); if (dest === -1 && Splide2.is(SLIDE)) { var position = Move.getPosition(); if (prev) { if (!approximatelyEqual(position, 0, 1)) { return 0; } } else { if (!approximatelyEqual(position, Move.getLimit(true), 1)) { return getEnd(); } } } return destination ? dest : loop(dest); } function computeDestIndex(dest, from, incremental) { if (isEnough()) { var end = getEnd(); if (dest < 0 || dest > end) { if (between(0, dest, from, true) || between(end, from, dest, true)) { dest = toIndex(toPage(dest)); } else { if (isLoop) { dest = perMove ? dest : dest < 0 ? -(slideCount % perPage || perPage) : slideCount; } else if (options.rewind) { dest = dest < 0 ? end : 0; } else { dest = -1; } } } else { if (!isLoop && !incremental && dest !== from) { dest = toIndex(toPage(from) + (dest < from ? -1 : 1)); } } } else { dest = -1; } return dest; } function getEnd() { var end = slideCount - perPage; if (hasFocus() || isLoop && perMove) { end = slideCount - 1; } return max(end, 0); } function loop(index) { if (isLoop) { return isEnough() ? index % slideCount + (index < 0 ? slideCount : 0) : -1; } return index; } function toIndex(page) { return clamp(hasFocus() ? page : perPage * page, 0, getEnd()); } function toPage(index) { if (!hasFocus()) { index = between(index, slideCount - perPage, slideCount - 1) ? slideCount - 1 : index; index = floor(index / perPage); } return index; } function setIndex(index) { if (index !== currIndex) { prevIndex = currIndex; currIndex = index; } } function getIndex(prev) { return prev ? prevIndex : currIndex; } function hasFocus() { return !isUndefined(options.focus) || options.isNavigation; } return { mount: mount, go: go, getNext: getNext, getPrev: getPrev, getEnd: getEnd, setIndex: setIndex, getIndex: getIndex, toIndex: toIndex, toPage: toPage, hasFocus: hasFocus }; } var XML_NAME_SPACE = "http://www.w3.org/2000/svg"; var 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"; var SIZE = 40; function Arrows(Splide2, Components2, options) { var _EventInterface8 = EventInterface(Splide2), on = _EventInterface8.on, bind = _EventInterface8.bind, emit = _EventInterface8.emit; var classes = options.classes, i18n = options.i18n; var Elements = Components2.Elements, Controller = Components2.Controller; var wrapper = Elements.arrows; var prev = Elements.prev; var next = Elements.next; var created; var arrows = {}; function mount() { init(); on(EVENT_UPDATED, init); } function init() { if (options.arrows) { if (!prev || !next) { createArrows(); } } if (prev && next) { if (!arrows.prev) { var id = Elements.track.id; setAttribute(prev, ARIA_CONTROLS, id); setAttribute(next, ARIA_CONTROLS, id); arrows.prev = prev; arrows.next = next; listen(); emit(EVENT_ARROWS_MOUNTED, prev, next); } else { display(wrapper, options.arrows === false ? "none" : ""); } } } function destroy() { if (created) { remove(wrapper); } else { removeAttribute(prev, ALL_ATTRIBUTES); removeAttribute(next, ALL_ATTRIBUTES); } } function listen() { var go = Controller.go; on([EVENT_MOUNTED, EVENT_MOVE, EVENT_MOVED, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED], update); bind(next, "click", function () { go(">", true); }); bind(prev, "click", function () { go("<", true); }); } function createArrows() { wrapper = create("div", classes.arrows); prev = createArrow(true); next = createArrow(false); created = true; append(wrapper, [prev, next]); before(wrapper, child(options.arrows === "slider" && Elements.slider || Splide2.root)); } function createArrow(prev2) { var arrow = "