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