1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3var __webpack_exports__ = {}; 4 5;// CONCATENATED MODULE: ./node_modules/@drupal/once/src/once.js 6/** 7 * Mark DOM elements as processed to prevent multiple initializations. 8 * 9 * @module @drupal/once 10 * 11 * @example <!-- Use as a module --> 12 * <script type="module"> 13 * import once from 'https://unpkg.com/@drupal/once/src/once.js'; 14 * const elements = once('my-once-id', 'div'); 15 * // Initialize elements. 16 * elements.forEach(el => el.innerHTML = 'processed'); 17 * </script> 18 * 19 * @example <!-- Use as a regular script --> 20 * <script src="https://unpkg.com/@drupal/once"></script> 21 * <script> 22 * const elements = once('my-once-id', 'div'); 23 * // Initialize elements. 24 * elements.forEach(el => el.innerHTML = 'processed'); 25 * </script> 26 * @example <!-- Using a single element as input--> 27 * <script src="https://unpkg.com/@drupal/once"></script> 28 * <script> 29 * // once methods always return an array, to simplify the use with a single 30 * // element use destructuring or the shift method. 31 * const [myElement] = once('my-once-id', document.body); 32 * const myElement = once('my-once-id', document.body).shift(); 33 * </script> 34 */ 35 36/** 37 * Illegal spaces in ids. 38 * 39 * @private 40 * 41 * @type {RegExp} 42 */ 43const wsRE = /[\11\12\14\15\40]+/; 44 45/** 46 * Name of the HTML attribute containing an element's once ids. 47 * 48 * @private 49 * 50 * @type {string} 51 */ 52const attrName = 'data-once'; 53 54/** 55 * Shortcut to access the html element. 56 * 57 * @private 58 * 59 * @type {HTMLElement} 60 */ 61const doc = document; 62 63/** 64 * Helper to access element attributes. 65 * 66 * @private 67 * 68 * @param {Element} element 69 * The Element to access the data-once attribute from. 70 * @param {string} op 71 * The action to take on the element. 72 * @param {string} [value] 73 * Optional value for setAttribute. 74 * 75 * @return {string|undefined|null|boolean} 76 * Result of the attribute method. 77 */ 78function attr(element, op, value) { 79 return element[`${op}Attribute`](attrName, value); 80} 81 82/** 83 * Return the attribute selector. 84 * 85 * @private 86 * 87 * @param {string} id 88 * The id passed by a call to a once() function. 89 * 90 * @return {string} 91 * The full CSS attribute selector. 92 * 93 * @throws {TypeError|RangeError} 94 */ 95function attrSelector(id) { 96 // Verify the validity of the once id. 97 if (typeof id !== 'string') { 98 throw new TypeError('once ID must be a string'); 99 } 100 if (id === '' || wsRE.test(id)) { 101 throw new RangeError('once ID must not be empty or contain spaces'); 102 } 103 // The id is valid, return the full CSS selector. 104 return `[${attrName}~="${id}"]`; 105} 106 107/** 108 * Verifies that an item is an instance of Element. 109 * 110 * This function is used during filtering to ensure only DOM elements are 111 * processed. once() makes use of get/setAttribute, which are methods 112 * inherited from the Element object, so only of Element can be used. 113 * 114 * @private 115 * 116 * @param {*} itemToCheck 117 * The item to check. 118 * 119 * @return {boolean} 120 * True if the item is an instance of Element 121 * 122 * @throws {TypeError} 123 */ 124function checkElement(itemToCheck) { 125 if (!(itemToCheck instanceof Element)) { 126 throw new TypeError('The element must be an instance of Element'); 127 } 128 return true; 129} 130 131/** 132 * Process arguments, query the DOM if necessary. 133 * 134 * @private 135 * 136 * @param {NodeList|Array.<Element>|Element|string} selector 137 * A NodeList or array of elements. 138 * @param {Document|Element} [context=document] 139 * An element to use as context for querySelectorAll. 140 * 141 * @return {Array.<Element>} 142 * An array with the processed Id and the list of elements to process. 143 */ 144function getElements(selector, context = doc) { 145 // Assume selector is an array-like value. 146 let elements = selector; 147 148 // If selector is null it is most likely because of a call to querySelector 149 // that didn't return a result. 150 if (selector === null) { 151 elements = []; 152 } 153 // The selector is undefined, error out. 154 else if (!selector) { 155 throw new TypeError('Selector must not be empty'); 156 } 157 // This is a selector, query the elements. 158 else if ( 159 typeof selector === 'string' && 160 (context === doc || checkElement(context)) 161 ) { 162 elements = context.querySelectorAll(selector); 163 } 164 // This is a single element. 165 else if (selector instanceof Element) { 166 elements = [selector]; 167 } 168 169 // Make sure an array is returned and not a NodeList or an Array-like object. 170 return Array.prototype.slice.call(elements); 171} 172 173/** 174 * A helper for applying DOM changes to a filtered set of elements. 175 * 176 * This makes it possible to filter items that are not instances of Element, 177 * then modify their DOM attributes in a single array traversal. 178 * 179 * @private 180 * 181 * @param {string} selector 182 * A CSS selector to check against to each element in the array. 183 * @param {Array.<Element>} elements 184 * A NodeList or array of elements passed by a call to a once() function. 185 * @param {function} [apply] 186 * An optional function to apply on all matched elements. 187 * 188 * @return {Array.<Element>} 189 * The array of elements that match the CSS selector. 190 */ 191function filterAndModify(selector, elements, apply) { 192 return elements.filter((element) => { 193 const selected = checkElement(element) && element.matches(selector); 194 if (selected && apply) { 195 apply(element); 196 } 197 return selected; 198 }); 199} 200 201/** 202 * Add or remove an item from a list of once values. 203 * 204 * This function removes duplicates while adding or removing a once id in a 205 * single array traversal. 206 * 207 * @private 208 * 209 * @param {Element} element 210 * A space separated string of once ids from a data-drupal-once attribute. 211 * @param {string} [add] 212 * The once id to add to the list of values. 213 * @param {string} [remove] 214 * The once id to remove from the list of values. 215 * 216 * @return {undefined} 217 * Nothing to return this is a callback in a foreach. 218 */ 219function updateAttribute(element, { add, remove }) { 220 const result = []; 221 if (attr(element, 'has')) { 222 attr(element, 'get') 223 .trim() 224 .split(wsRE) 225 .forEach((item) => { 226 if (result.indexOf(item) < 0 && item !== remove) { 227 result.push(item); 228 } 229 }); 230 } 231 if (add) { 232 result.push(add); 233 } 234 const attribute = result.join(' '); 235 attr(element, attribute === '' ? 'remove' : 'set', attribute); 236} 237 238/** 239 * Ensures a JavaScript callback is only executed once on a set of elements. 240 * 241 * Filters a NodeList or array of elements, removing those already processed 242 * by a callback with a given id. 243 * This method adds a `data-once` attribute on DOM elements. The value of 244 * this attribute identifies if a given callback has been executed on that 245 * element. 246 * 247 * @global 248 * 249 * @example <caption>Basic usage</caption> 250 * const elements = once('my-once-id', '[data-myelement]'); 251 * @example <caption>Input parameters accepted</caption> 252 * // NodeList. 253 * once('my-once-id', document.querySelectorAll('[data-myelement]')); 254 * // Array or Array-like of Element. 255 * once('my-once-id', jQuery('[data-myelement]')); 256 * // A CSS selector without a context. 257 * once('my-once-id', '[data-myelement]'); 258 * // A CSS selector with a context. 259 * once('my-once-id', '[data-myelement]', document.head); 260 * // Single Element. 261 * once('my-once-id', document.querySelector('#some-id')); 262 * @example <caption>Using a single element</caption> 263 * // Once always returns an array, even when passing a single element. Some 264 * // forms that can be used to keep code readable. 265 * // Destructuring: 266 * const [myElement] = once('my-once-id', document.body); 267 * // By changing the resulting array, es5 compatible. 268 * const myElement = once('my-once-id', document.body).shift(); 269 * 270 * @param {string} id 271 * The id of the once call. 272 * @param {NodeList|Array.<Element>|Element|string} selector 273 * A NodeList or array of elements. 274 * @param {Document|Element} [context=document] 275 * An element to use as context for querySelectorAll. 276 * 277 * @return {Array.<Element>} 278 * An array of elements that have not yet been processed by a once call 279 * with a given id. 280 */ 281function once(id, selector, context) { 282 return filterAndModify( 283 `:not(${attrSelector(id)})`, 284 getElements(selector, context), 285 (element) => updateAttribute(element, { add: id }), 286 ); 287} 288 289/** 290 * Removes a once id from an element's data-drupal-once attribute value. 291 * 292 * If a once id is removed from an element's data-drupal-once attribute value, 293 * the JavaScript callback associated with that id can be executed on that 294 * element again. 295 * 296 * @method once.remove 297 * 298 * @example <caption>Basic usage</caption> 299 * const elements = once.remove('my-once-id', '[data-myelement]'); 300 * @example <caption>Input parameters accepted</caption> 301 * // NodeList. 302 * once.remove('my-once-id', document.querySelectorAll('[data-myelement]')); 303 * // Array or Array-like of Element. 304 * once.remove('my-once-id', jQuery('[data-myelement]')); 305 * // A CSS selector without a context. 306 * once.remove('my-once-id', '[data-myelement]'); 307 * // A CSS selector with a context. 308 * once.remove('my-once-id', '[data-myelement]', document.head); 309 * // Single Element. 310 * once.remove('my-once-id', document.querySelector('#some-id')); 311 * 312 * @param {string} id 313 * The id of a once call. 314 * @param {NodeList|Array.<Element>|Element|string} selector 315 * A NodeList or array of elements to remove the once id from. 316 * @param {Document|Element} [context=document] 317 * An element to use as context for querySelectorAll. 318 * 319 * @return {Array.<Element>} 320 * A filtered array of elements that had been processed by the provided id, 321 * and are now able to be processed again. 322 */ 323once.remove = (id, selector, context) => { 324 return filterAndModify( 325 attrSelector(id), 326 getElements(selector, context), 327 (element) => updateAttribute(element, { remove: id }), 328 ); 329}; 330 331/** 332 * Finds elements that have been processed by a given once id. 333 * 334 * Behaves like {@link once} and {@link once.remove} without changing the DOM. 335 * To select all DOM nodes processed by a given id, use {@link once.find}. 336 * 337 * @method once.filter 338 * 339 * @example <caption>Basic usage</caption> 340 * const filteredElements = once.filter('my-once-id', '[data-myelement]'); 341 * @example <caption>Input parameters accepted</caption> 342 * // NodeList. 343 * once.filter('my-once-id', document.querySelectorAll('[data-myelement]')); 344 * // Array or Array-like of Element. 345 * once.filter('my-once-id', jQuery('[data-myelement]')); 346 * // A CSS selector without a context. 347 * once.filter('my-once-id', '[data-myelement]'); 348 * // A CSS selector with a context. 349 * once.filter('my-once-id', '[data-myelement]', document.head); 350 * // Single Element. 351 * once.filter('my-once-id', document.querySelector('#some-id')); 352 * 353 * @param {string} id 354 * The id of the once call. 355 * @param {NodeList|Array.<Element>|Element|string} selector 356 * A NodeList or array of elements to remove the once id from. 357 * @param {Document|Element} [context=document] 358 * An element to use as context for querySelectorAll. 359 * 360 * @return {Array.<Element>} 361 * A filtered array of elements that have already been processed by the 362 * provided once id. 363 */ 364once.filter = (id, selector, context) => 365 filterAndModify(attrSelector(id), getElements(selector, context)); 366 367/** 368 * Finds elements that have been processed by a given once id. 369 * 370 * Query the 'context' element for elements that already have the 371 * corresponding once id value. 372 * 373 * @method once.find 374 * 375 * @example <caption>Basic usage</caption> 376 * const oncedElements = once.find('my-once-id'); 377 * @example <caption>Input parameters accepted</caption> 378 * // Call without parameters, return all elements with a `data-once` attribute. 379 * once.find(); 380 * // Call without a context. 381 * once.find('my-once-id'); 382 * // Call with a context. 383 * once.find('my-once-id', document.head); 384 * 385 * @param {string} [id] 386 * The id of the once call. 387 * @param {Document|Element} [context=document] 388 * Scope of the search for matching elements. 389 * 390 * @return {Array.<Element>} 391 * A filtered array of elements that have already been processed by the 392 * provided once id. 393 */ 394once.find = (id, context) => 395 getElements(!id ? `[${attrName}]` : attrSelector(id), context); 396 397/* harmony default export */ const src_once = (once); 398 399;// CONCATENATED MODULE: ./node_modules/@splidejs/splide/dist/js/splide.esm.js 400function _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); } } 401 402function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 403 404/*! 405 * Splide.js 406 * Version : 4.1.4 407 * License : MIT 408 * Copyright: 2022 Naotoshi Fujita 409 */ 410var MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)"; 411var CREATED = 1; 412var MOUNTED = 2; 413var IDLE = 3; 414var MOVING = 4; 415var SCROLLING = 5; 416var DRAGGING = 6; 417var DESTROYED = 7; 418var STATES = { 419 CREATED: CREATED, 420 MOUNTED: MOUNTED, 421 IDLE: IDLE, 422 MOVING: MOVING, 423 SCROLLING: SCROLLING, 424 DRAGGING: DRAGGING, 425 DESTROYED: DESTROYED 426}; 427 428function empty(array) { 429 array.length = 0; 430} 431 432function slice(arrayLike, start, end) { 433 return Array.prototype.slice.call(arrayLike, start, end); 434} 435 436function apply(func) { 437 return func.bind.apply(func, [null].concat(slice(arguments, 1))); 438} 439 440var nextTick = setTimeout; 441 442var noop = function noop() {}; 443 444function raf(func) { 445 return requestAnimationFrame(func); 446} 447 448function typeOf(type, subject) { 449 return typeof subject === type; 450} 451 452function isObject(subject) { 453 return !isNull(subject) && typeOf("object", subject); 454} 455 456var isArray = Array.isArray; 457var isFunction = apply(typeOf, "function"); 458var isString = apply(typeOf, "string"); 459var isUndefined = apply(typeOf, "undefined"); 460 461function isNull(subject) { 462 return subject === null; 463} 464 465function isHTMLElement(subject) { 466 try { 467 return subject instanceof (subject.ownerDocument.defaultView || window).HTMLElement; 468 } catch (e) { 469 return false;
vendor: 9,229 bytes, lines 470-855
470 } 471} 472 473function toArray(value) { 474 return isArray(value) ? value : [value]; 475} 476 477function forEach(values, iteratee) { 478 toArray(values).forEach(iteratee); 479} 480 481function includes(array, value) { 482 return array.indexOf(value) > -1; 483} 484 485function push(array, items) { 486 array.push.apply(array, toArray(items)); 487 return array; 488} 489 490function toggleClass(elm, classes, add) { 491 if (elm) { 492 forEach(classes, function (name) { 493 if (name) { 494 elm.classList[add ? "add" : "remove"](name); 495 } 496 }); 497 } 498} 499 500function addClass(elm, classes) { 501 toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true); 502} 503 504function append(parent, children) { 505 forEach(children, parent.appendChild.bind(parent)); 506} 507 508function before(nodes, ref) { 509 forEach(nodes, function (node) { 510 var parent = (ref || node).parentNode; 511 512 if (parent) { 513 parent.insertBefore(node, ref); 514 } 515 }); 516} 517 518function matches(elm, selector) { 519 return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector); 520} 521 522function children(parent, selector) { 523 var children2 = parent ? slice(parent.children) : []; 524 return selector ? children2.filter(function (child) { 525 return matches(child, selector); 526 }) : children2; 527} 528 529function child(parent, selector) { 530 return selector ? children(parent, selector)[0] : parent.firstElementChild; 531} 532 533var ownKeys = Object.keys; 534 535function forOwn(object, iteratee, right) { 536 if (object) { 537 (right ? ownKeys(object).reverse() : ownKeys(object)).forEach(function (key) { 538 key !== "__proto__" && iteratee(object[key], key); 539 }); 540 } 541 542 return object; 543} 544 545function splide_esm_assign(object) { 546 slice(arguments, 1).forEach(function (source) { 547 forOwn(source, function (value, key) { 548 object[key] = source[key]; 549 }); 550 }); 551 return object; 552} 553 554function merge(object) { 555 slice(arguments, 1).forEach(function (source) { 556 forOwn(source, function (value, key) { 557 if (isArray(value)) { 558 object[key] = value.slice(); 559 } else if (isObject(value)) { 560 object[key] = merge({}, isObject(object[key]) ? object[key] : {}, value); 561 } else { 562 object[key] = value; 563 } 564 }); 565 }); 566 return object; 567} 568 569function omit(object, keys) { 570 forEach(keys || ownKeys(object), function (key) { 571 delete object[key]; 572 }); 573} 574 575function removeAttribute(elms, attrs) { 576 forEach(elms, function (elm) { 577 forEach(attrs, function (attr) { 578 elm && elm.removeAttribute(attr); 579 }); 580 }); 581} 582 583function setAttribute(elms, attrs, value) { 584 if (isObject(attrs)) { 585 forOwn(attrs, function (value2, name) { 586 setAttribute(elms, name, value2); 587 }); 588 } else { 589 forEach(elms, function (elm) { 590 isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value)); 591 }); 592 } 593} 594 595function create(tag, attrs, parent) { 596 var elm = document.createElement(tag); 597 598 if (attrs) { 599 isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs); 600 } 601 602 parent && append(parent, elm); 603 return elm; 604} 605 606function style(elm, prop, value) { 607 if (isUndefined(value)) { 608 return getComputedStyle(elm)[prop]; 609 } 610 611 if (!isNull(value)) { 612 elm.style[prop] = "" + value; 613 } 614} 615 616function display(elm, display2) { 617 style(elm, "display", display2); 618} 619 620function splide_esm_focus(elm) { 621 elm["setActive"] && elm["setActive"]() || elm.focus({ 622 preventScroll: true 623 }); 624} 625 626function getAttribute(elm, attr) { 627 return elm.getAttribute(attr); 628} 629 630function hasClass(elm, className) { 631 return elm && elm.classList.contains(className); 632} 633 634function rect(target) { 635 return target.getBoundingClientRect(); 636} 637 638function remove(nodes) { 639 forEach(nodes, function (node) { 640 if (node && node.parentNode) { 641 node.parentNode.removeChild(node); 642 } 643 }); 644} 645 646function parseHtml(html) { 647 return child(new DOMParser().parseFromString(html, "text/html").body); 648} 649 650function prevent(e, stopPropagation) { 651 e.preventDefault(); 652 653 if (stopPropagation) { 654 e.stopPropagation(); 655 e.stopImmediatePropagation(); 656 } 657} 658 659function query(parent, selector) { 660 return parent && parent.querySelector(selector); 661} 662 663function queryAll(parent, selector) { 664 return selector ? slice(parent.querySelectorAll(selector)) : []; 665} 666 667function removeClass(elm, classes) { 668 toggleClass(elm, classes, false); 669} 670 671function timeOf(e) { 672 return e.timeStamp; 673} 674 675function unit(value) { 676 return isString(value) ? value : value ? value + "px" : ""; 677} 678 679var PROJECT_CODE = "splide"; 680var DATA_ATTRIBUTE = "data-" + PROJECT_CODE; 681 682function assert(condition, message) { 683 if (!condition) { 684 throw new Error("[" + PROJECT_CODE + "] " + (message || "")); 685 } 686} 687 688var min = Math.min, 689 max = Math.max, 690 floor = Math.floor, 691 ceil = Math.ceil, 692 abs = Math.abs; 693 694function approximatelyEqual(x, y, epsilon) { 695 return abs(x - y) < epsilon; 696} 697 698function between(number, x, y, exclusive) { 699 var minimum = min(x, y); 700 var maximum = max(x, y); 701 return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum; 702} 703 704function clamp(number, x, y) { 705 var minimum = min(x, y); 706 var maximum = max(x, y); 707 return min(max(minimum, number), maximum); 708} 709 710function sign(x) { 711 return +(x > 0) - +(x < 0); 712} 713 714function camelToKebab(string) { 715 return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(); 716} 717 718function format(string, replacements) { 719 forEach(replacements, function (replacement) { 720 string = string.replace("%s", "" + replacement); 721 }); 722 return string; 723} 724 725function pad(number) { 726 return number < 10 ? "0" + number : "" + number; 727} 728 729var ids = {}; 730 731function uniqueId(prefix) { 732 return "" + prefix + pad(ids[prefix] = (ids[prefix] || 0) + 1); 733} 734 735function EventBinder() { 736 var listeners = []; 737 738 function bind(targets, events, callback, options) { 739 forEachEvent(targets, events, function (target, event, namespace) { 740 var isEventTarget = ("addEventListener" in target); 741 var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback); 742 isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback); 743 listeners.push([target, event, namespace, callback, remover]); 744 }); 745 } 746 747 function unbind(targets, events, callback) { 748 forEachEvent(targets, events, function (target, event, namespace) { 749 listeners = listeners.filter(function (listener) { 750 if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) { 751 listener[4](); 752 return false; 753 } 754 755 return true; 756 }); 757 }); 758 } 759 760 function dispatch(target, type, detail) { 761 var e; 762 var bubbles = true; 763 764 if (typeof CustomEvent === "function") { 765 e = new CustomEvent(type, { 766 bubbles: bubbles, 767 detail: detail 768 }); 769 } else { 770 e = document.createEvent("CustomEvent"); 771 e.initCustomEvent(type, bubbles, false, detail); 772 } 773 774 target.dispatchEvent(e); 775 return e; 776 } 777 778 function forEachEvent(targets, events, iteratee) { 779 forEach(targets, function (target) { 780 target && forEach(events, function (events2) { 781 events2.split(" ").forEach(function (eventNS) { 782 var fragment = eventNS.split("."); 783 iteratee(target, fragment[0], fragment[1]); 784 }); 785 }); 786 }); 787 } 788 789 function destroy() { 790 listeners.forEach(function (data) { 791 data[4](); 792 }); 793 empty(listeners); 794 } 795 796 return { 797 bind: bind, 798 unbind: unbind, 799 dispatch: dispatch, 800 destroy: destroy 801 }; 802} 803 804var EVENT_MOUNTED = "mounted"; 805var EVENT_READY = "ready"; 806var EVENT_MOVE = "move"; 807var EVENT_MOVED = "moved"; 808var EVENT_CLICK = "click"; 809var EVENT_ACTIVE = "active"; 810var EVENT_INACTIVE = "inactive"; 811var EVENT_VISIBLE = "visible"; 812var EVENT_HIDDEN = "hidden"; 813var EVENT_REFRESH = "refresh"; 814var EVENT_UPDATED = "updated"; 815var EVENT_RESIZE = "resize"; 816var EVENT_RESIZED = "resized"; 817var EVENT_DRAG = "drag"; 818var EVENT_DRAGGING = "dragging"; 819var EVENT_DRAGGED = "dragged"; 820var EVENT_SCROLL = "scroll"; 821var EVENT_SCROLLED = "scrolled"; 822var EVENT_OVERFLOW = "overflow"; 823var EVENT_DESTROY = "destroy"; 824var EVENT_ARROWS_MOUNTED = "arrows:mounted"; 825var EVENT_ARROWS_UPDATED = "arrows:updated"; 826var EVENT_PAGINATION_MOUNTED = "pagination:mounted"; 827var EVENT_PAGINATION_UPDATED = "pagination:updated"; 828var EVENT_NAVIGATION_MOUNTED = "navigation:mounted"; 829var EVENT_AUTOPLAY_PLAY = "autoplay:play"; 830var EVENT_AUTOPLAY_PLAYING = "autoplay:playing"; 831var EVENT_AUTOPLAY_PAUSE = "autoplay:pause"; 832var EVENT_LAZYLOAD_LOADED = "lazyload:loaded"; 833var EVENT_SLIDE_KEYDOWN = "sk"; 834var EVENT_SHIFTED = "sh"; 835var EVENT_END_INDEX_CHANGED = "ei"; 836 837function EventInterface(Splide2) { 838 var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment(); 839 var binder = EventBinder(); 840 841 function on(events, callback) { 842 binder.bind(bus, toArray(events).join(" "), function (e) { 843 callback.apply(callback, isArray(e.detail) ? e.detail : []); 844 }); 845 } 846 847 function emit(event) { 848 binder.dispatch(bus, event, slice(arguments, 1)); 849 } 850 851 if (Splide2) { 852 Splide2.event.on(EVENT_DESTROY, binder.destroy); 853 } 854 855 return splide_esm_
vendor: 9,598 bytes, lines 855-1221
855assign(binder, { 856 bus: bus, 857 on: on, 858 off: apply(binder.unbind, bus), 859 emit: emit 860 }); 861} 862 863function RequestInterval(interval, onInterval, onUpdate, limit) { 864 var now = Date.now; 865 var startTime; 866 var rate = 0; 867 var id; 868 var paused = true; 869 var count = 0; 870 871 function update() { 872 if (!paused) { 873 rate = interval ? min((now() - startTime) / interval, 1) : 1; 874 onUpdate && onUpdate(rate); 875 876 if (rate >= 1) { 877 onInterval(); 878 startTime = now(); 879 880 if (limit && ++count >= limit) { 881 return pause(); 882 } 883 } 884 885 id = raf(update); 886 } 887 } 888 889 function start(resume) { 890 resume || cancel(); 891 startTime = now() - (resume ? rate * interval : 0); 892 paused = false; 893 id = raf(update); 894 } 895 896 function pause() { 897 paused = true; 898 } 899 900 function rewind() { 901 startTime = now(); 902 rate = 0; 903 904 if (onUpdate) { 905 onUpdate(rate); 906 } 907 } 908 909 function cancel() { 910 id && cancelAnimationFrame(id); 911 rate = 0; 912 id = 0; 913 paused = true; 914 } 915 916 function set(time) { 917 interval = time; 918 } 919 920 function isPaused() { 921 return paused; 922 } 923 924 return { 925 start: start, 926 rewind: rewind, 927 pause: pause, 928 cancel: cancel, 929 set: set, 930 isPaused: isPaused 931 }; 932} 933 934function State(initialState) { 935 var state = initialState; 936 937 function set(value) { 938 state = value; 939 } 940 941 function is(states) { 942 return includes(toArray(states), state); 943 } 944 945 return { 946 set: set, 947 is: is 948 }; 949} 950 951function Throttle(func, duration) { 952 var interval = RequestInterval(duration || 0, func, null, 1); 953 return function () { 954 interval.isPaused() && interval.start(); 955 }; 956} 957 958function Media(Splide2, Components2, options) { 959 var state = Splide2.state; 960 var breakpoints = options.breakpoints || {}; 961 var reducedMotion = options.reducedMotion || {}; 962 var binder = EventBinder(); 963 var queries = []; 964 965 function setup() { 966 var isMin = options.mediaQuery === "min"; 967 ownKeys(breakpoints).sort(function (n, m) { 968 return isMin ? +n - +m : +m - +n; 969 }).forEach(function (key) { 970 register(breakpoints[key], "(" + (isMin ? "min" : "max") + "-width:" + key + "px)"); 971 }); 972 register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION); 973 update(); 974 } 975 976 function destroy(completely) { 977 if (completely) { 978 binder.destroy(); 979 } 980 } 981 982 function register(options2, query) { 983 var queryList = matchMedia(query); 984 binder.bind(queryList, "change", update); 985 queries.push([options2, queryList]); 986 } 987 988 function update() { 989 var destroyed = state.is(DESTROYED); 990 var direction = options.direction; 991 var merged = queries.reduce(function (merged2, entry) { 992 return merge(merged2, entry[1].matches ? entry[0] : {}); 993 }, {}); 994 omit(options); 995 set(merged); 996 997 if (options.destroy) { 998 Splide2.destroy(options.destroy === "completely"); 999 } else if (destroyed) { 1000 destroy(true); 1001 Splide2.mount(); 1002 } else { 1003 direction !== options.direction && Splide2.refresh(); 1004 } 1005 } 1006 1007 function reduce(enable) { 1008 if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) { 1009 enable ? merge(options, reducedMotion) : omit(options, ownKeys(reducedMotion)); 1010 } 1011 } 1012 1013 function set(opts, base, notify) { 1014 merge(options, opts); 1015 base && merge(Object.getPrototypeOf(options), opts); 1016 1017 if (notify || !state.is(CREATED)) { 1018 Splide2.emit(EVENT_UPDATED, options); 1019 } 1020 } 1021 1022 return { 1023 setup: setup, 1024 destroy: destroy, 1025 reduce: reduce, 1026 set: set 1027 }; 1028} 1029 1030var ARROW = "Arrow"; 1031var ARROW_LEFT = ARROW + "Left"; 1032var ARROW_RIGHT = ARROW + "Right"; 1033var ARROW_UP = ARROW + "Up"; 1034var ARROW_DOWN = ARROW + "Down"; 1035var LTR = "ltr"; 1036var RTL = "rtl"; 1037var TTB = "ttb"; 1038var ORIENTATION_MAP = { 1039 width: ["height"], 1040 left: ["top", "right"], 1041 right: ["bottom", "left"], 1042 x: ["y"], 1043 X: ["Y"], 1044 Y: ["X"], 1045 ArrowLeft: [ARROW_UP, ARROW_RIGHT], 1046 ArrowRight: [ARROW_DOWN, ARROW_LEFT] 1047}; 1048 1049function Direction(Splide2, Components2, options) { 1050 function resolve(prop, axisOnly, direction) { 1051 direction = direction || options.direction; 1052 var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1; 1053 return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, function (match, offset) { 1054 var replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match; 1055 return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement; 1056 }); 1057 } 1058 1059 function orient(value) { 1060 return value * (options.direction === RTL ? 1 : -1); 1061 } 1062 1063 return { 1064 resolve: resolve, 1065 orient: orient 1066 }; 1067} 1068 1069var ROLE = "role"; 1070var TAB_INDEX = "tabindex"; 1071var DISABLED = "disabled"; 1072var ARIA_PREFIX = "aria-"; 1073var ARIA_CONTROLS = ARIA_PREFIX + "controls"; 1074var ARIA_CURRENT = ARIA_PREFIX + "current"; 1075var ARIA_SELECTED = ARIA_PREFIX + "selected"; 1076var ARIA_LABEL = ARIA_PREFIX + "label"; 1077var ARIA_LABELLEDBY = ARIA_PREFIX + "labelledby"; 1078var ARIA_HIDDEN = ARIA_PREFIX + "hidden"; 1079var ARIA_ORIENTATION = ARIA_PREFIX + "orientation"; 1080var ARIA_ROLEDESCRIPTION = ARIA_PREFIX + "roledescription"; 1081var ARIA_LIVE = ARIA_PREFIX + "live"; 1082var ARIA_BUSY = ARIA_PREFIX + "busy"; 1083var ARIA_ATOMIC = ARIA_PREFIX + "atomic"; 1084var ALL_ATTRIBUTES = [ROLE, TAB_INDEX, DISABLED, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_LABELLEDBY, ARIA_HIDDEN, ARIA_ORIENTATION, ARIA_ROLEDESCRIPTION]; 1085var CLASS_PREFIX = PROJECT_CODE + "__"; 1086var STATUS_CLASS_PREFIX = "is-"; 1087var CLASS_ROOT = PROJECT_CODE; 1088var CLASS_TRACK = CLASS_PREFIX + "track"; 1089var CLASS_LIST = CLASS_PREFIX + "list"; 1090var CLASS_SLIDE = CLASS_PREFIX + "slide"; 1091var CLASS_CLONE = CLASS_SLIDE + "--clone"; 1092var CLASS_CONTAINER = CLASS_SLIDE + "__container"; 1093var CLASS_ARROWS = CLASS_PREFIX + "arrows"; 1094var CLASS_ARROW = CLASS_PREFIX + "arrow"; 1095var CLASS_ARROW_PREV = CLASS_ARROW + "--prev"; 1096var CLASS_ARROW_NEXT = CLASS_ARROW + "--next"; 1097var CLASS_PAGINATION = CLASS_PREFIX + "pagination"; 1098var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page"; 1099var CLASS_PROGRESS = CLASS_PREFIX + "progress"; 1100var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar"; 1101var CLASS_TOGGLE = CLASS_PREFIX + "toggle"; 1102var CLASS_TOGGLE_PLAY = CLASS_TOGGLE + "__play"; 1103var CLASS_TOGGLE_PAUSE = CLASS_TOGGLE + "__pause"; 1104var CLASS_SPINNER = CLASS_PREFIX + "spinner"; 1105var CLASS_SR = CLASS_PREFIX + "sr"; 1106var CLASS_INITIALIZED = STATUS_CLASS_PREFIX + "initialized"; 1107var CLASS_ACTIVE = STATUS_CLASS_PREFIX + "active"; 1108var CLASS_PREV = STATUS_CLASS_PREFIX + "prev"; 1109var CLASS_NEXT = STATUS_CLASS_PREFIX + "next"; 1110var CLASS_VISIBLE = STATUS_CLASS_PREFIX + "visible"; 1111var CLASS_LOADING = STATUS_CLASS_PREFIX + "loading"; 1112var CLASS_FOCUS_IN = STATUS_CLASS_PREFIX + "focus-in"; 1113var CLASS_OVERFLOW = STATUS_CLASS_PREFIX + "overflow"; 1114var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING, CLASS_FOCUS_IN, CLASS_OVERFLOW]; 1115var CLASSES = { 1116 slide: CLASS_SLIDE, 1117 clone: CLASS_CLONE, 1118 arrows: CLASS_ARROWS, 1119 arrow: CLASS_ARROW, 1120 prev: CLASS_ARROW_PREV, 1121 next: CLASS_ARROW_NEXT, 1122 pagination: CLASS_PAGINATION, 1123 page: CLASS_PAGINATION_PAGE, 1124 spinner: CLASS_SPINNER 1125}; 1126 1127function closest(from, selector) { 1128 if (isFunction(from.closest)) { 1129 return from.closest(selector); 1130 } 1131 1132 var elm = from; 1133 1134 while (elm && elm.nodeType === 1) { 1135 if (matches(elm, selector)) { 1136 break; 1137 } 1138 1139 elm = elm.parentElement; 1140 } 1141 1142 return elm; 1143} 1144 1145var FRICTION = 5; 1146var LOG_INTERVAL = 200; 1147var POINTER_DOWN_EVENTS = "touchstart mousedown"; 1148var POINTER_MOVE_EVENTS = "touchmove mousemove"; 1149var POINTER_UP_EVENTS = "touchend touchcancel mouseup click"; 1150 1151function Elements(Splide2, Components2, options) { 1152 var _EventInterface = EventInterface(Splide2), 1153 on = _EventInterface.on, 1154 bind = _EventInterface.bind; 1155 1156 var root = Splide2.root; 1157 var i18n = options.i18n; 1158 var elements = {}; 1159 var slides = []; 1160 var rootClasses = []; 1161 var trackClasses = []; 1162 var track; 1163 var list; 1164 var isUsingKey; 1165 1166 function setup() { 1167 collect(); 1168 init(); 1169 update(); 1170 } 1171 1172 function mount() { 1173 on(EVENT_REFRESH, destroy); 1174 on(EVENT_REFRESH, setup); 1175 on(EVENT_UPDATED, update); 1176 bind(document, POINTER_DOWN_EVENTS + " keydown", function (e) { 1177 isUsingKey = e.type === "keydown"; 1178 }, { 1179 capture: true 1180 }); 1181 bind(root, "focusin", function () { 1182 toggleClass(root, CLASS_FOCUS_IN, !!isUsingKey); 1183 }); 1184 } 1185 1186 function destroy(completely) { 1187 var attrs = ALL_ATTRIBUTES.concat("style"); 1188 empty(slides); 1189 removeClass(root, rootClasses); 1190 removeClass(track, trackClasses); 1191 removeAttribute([track, list], attrs); 1192 removeAttribute(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]); 1193 } 1194 1195 function update() { 1196 removeClass(root, rootClasses); 1197 removeClass(track, trackClasses); 1198 rootClasses = getClasses(CLASS_ROOT); 1199 trackClasses = getClasses(CLASS_TRACK); 1200 addClass(root, rootClasses); 1201 addClass(track, trackClasses); 1202 setAttribute(root, ARIA_LABEL, options.label); 1203 setAttribute(root, ARIA_LABELLEDBY, options.labelledby); 1204 } 1205 1206 function collect() { 1207 track = find("." + CLASS_TRACK); 1208 list = child(track, "." + CLASS_LIST); 1209 assert(track && list, "A track/list element is missing."); 1210 push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")")); 1211 forOwn({ 1212 arrows: CLASS_ARROWS, 1213 pagination: CLASS_PAGINATION, 1214 prev: CLASS_ARROW_PREV, 1215 next: CLASS_ARROW_NEXT, 1216 bar: CLASS_PROGRESS_BAR, 1217 toggle: CLASS_TOGGLE 1218 }, function (className, key) { 1219 elements[key] = find("." + className); 1220 }); 1221
vendor: 4,537 bytes, lines 1221-1373
1221splide_esm_assign(elements, { 1222 root: root, 1223 track: track, 1224 list: list, 1225 slides: slides 1226 }); 1227 } 1228 1229 function init() { 1230 var id = root.id || uniqueId(PROJECT_CODE); 1231 var role = options.role; 1232 root.id = id; 1233 track.id = track.id || id + "-track"; 1234 list.id = list.id || id + "-list"; 1235 1236 if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) { 1237 setAttribute(root, ROLE, role); 1238 } 1239 1240 setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel); 1241 setAttribute(list, ROLE, "presentation"); 1242 } 1243 1244 function find(selector) { 1245 var elm = query(root, selector); 1246 return elm && closest(elm, "." + CLASS_ROOT) === root ? elm : void 0; 1247 } 1248 1249 function getClasses(base) { 1250 return [base + "--" + options.type, base + "--" + options.direction, options.drag && base + "--draggable", options.isNavigation && base + "--nav", base === CLASS_ROOT && CLASS_ACTIVE]; 1251 } 1252 1253 return splide_esm_assign(elements, { 1254 setup: setup, 1255 mount: mount, 1256 destroy: destroy 1257 }); 1258} 1259 1260var SLIDE = "slide"; 1261var LOOP = "loop"; 1262var FADE = "fade"; 1263 1264function Slide$1(Splide2, index, slideIndex, slide) { 1265 var event = EventInterface(Splide2); 1266 var on = event.on, 1267 emit = event.emit, 1268 bind = event.bind; 1269 var Components = Splide2.Components, 1270 root = Splide2.root, 1271 options = Splide2.options; 1272 var isNavigation = options.isNavigation, 1273 updateOnMove = options.updateOnMove, 1274 i18n = options.i18n, 1275 pagination = options.pagination, 1276 slideFocus = options.slideFocus; 1277 var resolve = Components.Direction.resolve; 1278 var styles = getAttribute(slide, "style"); 1279 var label = getAttribute(slide, ARIA_LABEL); 1280 var isClone = slideIndex > -1; 1281 var container = child(slide, "." + CLASS_CONTAINER); 1282 var destroyed; 1283 1284 function mount() { 1285 if (!isClone) { 1286 slide.id = root.id + "-slide" + pad(index + 1); 1287 setAttribute(slide, ROLE, pagination ? "tabpanel" : "group"); 1288 setAttribute(slide, ARIA_ROLEDESCRIPTION, i18n.slide); 1289 setAttribute(slide, ARIA_LABEL, label || format(i18n.slideLabel, [index + 1, Splide2.length])); 1290 } 1291 1292 listen(); 1293 } 1294 1295 function listen() { 1296 bind(slide, "click", apply(emit, EVENT_CLICK, self)); 1297 bind(slide, "keydown", apply(emit, EVENT_SLIDE_KEYDOWN, self)); 1298 on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update); 1299 on(EVENT_NAVIGATION_MOUNTED, initNavigation); 1300 1301 if (updateOnMove) { 1302 on(EVENT_MOVE, onMove); 1303 } 1304 } 1305 1306 function destroy() { 1307 destroyed = true; 1308 event.destroy(); 1309 removeClass(slide, STATUS_CLASSES); 1310 removeAttribute(slide, ALL_ATTRIBUTES); 1311 setAttribute(slide, "style", styles); 1312 setAttribute(slide, ARIA_LABEL, label || ""); 1313 } 1314 1315 function initNavigation() { 1316 var controls = Splide2.splides.map(function (target) { 1317 var Slide2 = target.splide.Components.Slides.getAt(index); 1318 return Slide2 ? Slide2.slide.id : ""; 1319 }).join(" "); 1320 setAttribute(slide, ARIA_LABEL, format(i18n.slideX, (isClone ? slideIndex : index) + 1)); 1321 setAttribute(slide, ARIA_CONTROLS, controls); 1322 setAttribute(slide, ROLE, slideFocus ? "button" : ""); 1323 slideFocus && removeAttribute(slide, ARIA_ROLEDESCRIPTION); 1324 } 1325 1326 function onMove() { 1327 if (!destroyed) { 1328 update(); 1329 } 1330 } 1331 1332 function update() { 1333 if (!destroyed) { 1334 var curr = Splide2.index; 1335 updateActivity(); 1336 updateVisibility(); 1337 toggleClass(slide, CLASS_PREV, index === curr - 1); 1338 toggleClass(slide, CLASS_NEXT, index === curr + 1); 1339 } 1340 } 1341 1342 function updateActivity() { 1343 var active = isActive(); 1344 1345 if (active !== hasClass(slide, CLASS_ACTIVE)) { 1346 toggleClass(slide, CLASS_ACTIVE, active); 1347 setAttribute(slide, ARIA_CURRENT, isNavigation && active || ""); 1348 emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self); 1349 } 1350 } 1351 1352 function updateVisibility() { 1353 var visible = isVisible(); 1354 var hidden = !visible && (!isActive() || isClone); 1355 1356 if (!Splide2.state.is([MOVING, SCROLLING])) { 1357 setAttribute(slide, ARIA_HIDDEN, hidden || ""); 1358 } 1359 1360 setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : ""); 1361 1362 if (slideFocus) { 1363 setAttribute(slide, TAB_INDEX, hidden ? -1 : 0); 1364 } 1365 1366 if (visible !== hasClass(slide, CLASS_VISIBLE)) { 1367 toggleClass(slide, CLASS_VISIBLE, visible); 1368 emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self); 1369 } 1370 1371 if (!visible && document.activeElement === slide) { 1372 var Slide2 = Components.Slides.getAt(Splide2.index); 1373 Slide2 && splide_esm_
vendor: 21,720 bytes, lines 1373-2211
1373focus(Slide2.slide); 1374 } 1375 } 1376 1377 function style$1(prop, value, useContainer) { 1378 style(useContainer && container || slide, prop, value); 1379 } 1380 1381 function isActive() { 1382 var curr = Splide2.index; 1383 return curr === index || options.cloneStatus && curr === slideIndex; 1384 } 1385 1386 function isVisible() { 1387 if (Splide2.is(FADE)) { 1388 return isActive(); 1389 } 1390 1391 var trackRect = rect(Components.Elements.track); 1392 var slideRect = rect(slide); 1393 var left = resolve("left", true); 1394 var right = resolve("right", true); 1395 return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]); 1396 } 1397 1398 function isWithin(from, distance) { 1399 var diff = abs(from - index); 1400 1401 if (!isClone && (options.rewind || Splide2.is(LOOP))) { 1402 diff = min(diff, Splide2.length - diff); 1403 } 1404 1405 return diff <= distance; 1406 } 1407 1408 var self = { 1409 index: index, 1410 slideIndex: slideIndex, 1411 slide: slide, 1412 container: container, 1413 isClone: isClone, 1414 mount: mount, 1415 destroy: destroy, 1416 update: update, 1417 style: style$1, 1418 isWithin: isWithin 1419 }; 1420 return self; 1421} 1422 1423function Slides(Splide2, Components2, options) { 1424 var _EventInterface2 = EventInterface(Splide2), 1425 on = _EventInterface2.on, 1426 emit = _EventInterface2.emit, 1427 bind = _EventInterface2.bind; 1428 1429 var _Components2$Elements = Components2.Elements, 1430 slides = _Components2$Elements.slides, 1431 list = _Components2$Elements.list; 1432 var Slides2 = []; 1433 1434 function mount() { 1435 init(); 1436 on(EVENT_REFRESH, destroy); 1437 on(EVENT_REFRESH, init); 1438 } 1439 1440 function init() { 1441 slides.forEach(function (slide, index) { 1442 register(slide, index, -1); 1443 }); 1444 } 1445 1446 function destroy() { 1447 forEach$1(function (Slide2) { 1448 Slide2.destroy(); 1449 }); 1450 empty(Slides2); 1451 } 1452 1453 function update() { 1454 forEach$1(function (Slide2) { 1455 Slide2.update(); 1456 }); 1457 } 1458 1459 function register(slide, index, slideIndex) { 1460 var object = Slide$1(Splide2, index, slideIndex, slide); 1461 object.mount(); 1462 Slides2.push(object); 1463 Slides2.sort(function (Slide1, Slide2) { 1464 return Slide1.index - Slide2.index; 1465 }); 1466 } 1467 1468 function get(excludeClones) { 1469 return excludeClones ? filter(function (Slide2) { 1470 return !Slide2.isClone; 1471 }) : Slides2; 1472 } 1473 1474 function getIn(page) { 1475 var Controller = Components2.Controller; 1476 var index = Controller.toIndex(page); 1477 var max = Controller.hasFocus() ? 1 : options.perPage; 1478 return filter(function (Slide2) { 1479 return between(Slide2.index, index, index + max - 1); 1480 }); 1481 } 1482 1483 function getAt(index) { 1484 return filter(index)[0]; 1485 } 1486 1487 function add(items, index) { 1488 forEach(items, function (slide) { 1489 if (isString(slide)) { 1490 slide = parseHtml(slide); 1491 } 1492 1493 if (isHTMLElement(slide)) { 1494 var ref = slides[index]; 1495 ref ? before(slide, ref) : append(list, slide); 1496 addClass(slide, options.classes.slide); 1497 observeImages(slide, apply(emit, EVENT_RESIZE)); 1498 } 1499 }); 1500 emit(EVENT_REFRESH); 1501 } 1502 1503 function remove$1(matcher) { 1504 remove(filter(matcher).map(function (Slide2) { 1505 return Slide2.slide; 1506 })); 1507 emit(EVENT_REFRESH); 1508 } 1509 1510 function forEach$1(iteratee, excludeClones) { 1511 get(excludeClones).forEach(iteratee); 1512 } 1513 1514 function filter(matcher) { 1515 return Slides2.filter(isFunction(matcher) ? matcher : function (Slide2) { 1516 return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index); 1517 }); 1518 } 1519 1520 function style(prop, value, useContainer) { 1521 forEach$1(function (Slide2) { 1522 Slide2.style(prop, value, useContainer); 1523 }); 1524 } 1525 1526 function observeImages(elm, callback) { 1527 var images = queryAll(elm, "img"); 1528 var length = images.length; 1529 1530 if (length) { 1531 images.forEach(function (img) { 1532 bind(img, "load error", function () { 1533 if (! --length) { 1534 callback(); 1535 } 1536 }); 1537 }); 1538 } else { 1539 callback(); 1540 } 1541 } 1542 1543 function getLength(excludeClones) { 1544 return excludeClones ? slides.length : Slides2.length; 1545 } 1546 1547 function isEnough() { 1548 return Slides2.length > options.perPage; 1549 } 1550 1551 return { 1552 mount: mount, 1553 destroy: destroy, 1554 update: update, 1555 register: register, 1556 get: get, 1557 getIn: getIn, 1558 getAt: getAt, 1559 add: add, 1560 remove: remove$1, 1561 forEach: forEach$1, 1562 filter: filter, 1563 style: style, 1564 getLength: getLength, 1565 isEnough: isEnough 1566 }; 1567} 1568 1569function Layout(Splide2, Components2, options) { 1570 var _EventInterface3 = EventInterface(Splide2), 1571 on = _EventInterface3.on, 1572 bind = _EventInterface3.bind, 1573 emit = _EventInterface3.emit; 1574 1575 var Slides = Components2.Slides; 1576 var resolve = Components2.Direction.resolve; 1577 var _Components2$Elements2 = Components2.Elements, 1578 root = _Components2$Elements2.root, 1579 track = _Components2$Elements2.track, 1580 list = _Components2$Elements2.list; 1581 var getAt = Slides.getAt, 1582 styleSlides = Slides.style; 1583 var vertical; 1584 var rootRect; 1585 var overflow; 1586 1587 function mount() { 1588 init(); 1589 bind(window, "resize load", Throttle(apply(emit, EVENT_RESIZE))); 1590 on([EVENT_UPDATED, EVENT_REFRESH], init); 1591 on(EVENT_RESIZE, resize); 1592 } 1593 1594 function init() { 1595 vertical = options.direction === TTB; 1596 style(root, "maxWidth", unit(options.width)); 1597 style(track, resolve("paddingLeft"), cssPadding(false)); 1598 style(track, resolve("paddingRight"), cssPadding(true)); 1599 resize(true); 1600 } 1601 1602 function resize(force) { 1603 var newRect = rect(root); 1604 1605 if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) { 1606 style(track, "height", cssTrackHeight()); 1607 styleSlides(resolve("marginRight"), unit(options.gap)); 1608 styleSlides("width", cssSlideWidth()); 1609 styleSlides("height", cssSlideHeight(), true); 1610 rootRect = newRect; 1611 emit(EVENT_RESIZED); 1612 1613 if (overflow !== (overflow = isOverflow())) { 1614 toggleClass(root, CLASS_OVERFLOW, overflow); 1615 emit(EVENT_OVERFLOW, overflow); 1616 } 1617 } 1618 } 1619 1620 function cssPadding(right) { 1621 var padding = options.padding; 1622 var prop = resolve(right ? "right" : "left"); 1623 return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px"; 1624 } 1625 1626 function cssTrackHeight() { 1627 var height = ""; 1628 1629 if (vertical) { 1630 height = cssHeight(); 1631 assert(height, "height or heightRatio is missing."); 1632 height = "calc(" + height + " - " + cssPadding(false) + " - " + cssPadding(true) + ")"; 1633 } 1634 1635 return height; 1636 } 1637 1638 function cssHeight() { 1639 return unit(options.height || rect(list).width * options.heightRatio); 1640 } 1641 1642 function cssSlideWidth() { 1643 return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize()); 1644 } 1645 1646 function cssSlideHeight() { 1647 return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight()); 1648 } 1649 1650 function cssSlideSize() { 1651 var gap = unit(options.gap); 1652 return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")"; 1653 } 1654 1655 function listSize() { 1656 return rect(list)[resolve("width")]; 1657 } 1658 1659 function slideSize(index, withoutGap) { 1660 var Slide = getAt(index || 0); 1661 return Slide ? rect(Slide.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0; 1662 } 1663 1664 function totalSize(index, withoutGap) { 1665 var Slide = getAt(index); 1666 1667 if (Slide) { 1668 var right = rect(Slide.slide)[resolve("right")]; 1669 var left = rect(list)[resolve("left")]; 1670 return abs(right - left) + (withoutGap ? 0 : getGap()); 1671 } 1672 1673 return 0; 1674 } 1675 1676 function sliderSize(withoutGap) { 1677 return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap); 1678 } 1679 1680 function getGap() { 1681 var Slide = getAt(0); 1682 return Slide && parseFloat(style(Slide.slide, resolve("marginRight"))) || 0; 1683 } 1684 1685 function getPadding(right) { 1686 return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left")))) || 0; 1687 } 1688 1689 function isOverflow() { 1690 return Splide2.is(FADE) || sliderSize(true) > listSize(); 1691 } 1692 1693 return { 1694 mount: mount, 1695 resize: resize, 1696 listSize: listSize, 1697 slideSize: slideSize, 1698 sliderSize: sliderSize, 1699 totalSize: totalSize, 1700 getPadding: getPadding, 1701 isOverflow: isOverflow 1702 }; 1703} 1704 1705var MULTIPLIER = 2; 1706 1707function Clones(Splide2, Components2, options) { 1708 var event = EventInterface(Splide2); 1709 var on = event.on; 1710 var Elements = Components2.Elements, 1711 Slides = Components2.Slides; 1712 var resolve = Components2.Direction.resolve; 1713 var clones = []; 1714 var cloneCount; 1715 1716 function mount() { 1717 on(EVENT_REFRESH, remount); 1718 on([EVENT_UPDATED, EVENT_RESIZE], observe); 1719 1720 if (cloneCount = computeCloneCount()) { 1721 generate(cloneCount); 1722 Components2.Layout.resize(true); 1723 } 1724 } 1725 1726 function remount() { 1727 destroy(); 1728 mount(); 1729 } 1730 1731 function destroy() { 1732 remove(clones); 1733 empty(clones); 1734 event.destroy(); 1735 } 1736 1737 function observe() { 1738 var count = computeCloneCount(); 1739 1740 if (cloneCount !== count) { 1741 if (cloneCount < count || !count) { 1742 event.emit(EVENT_REFRESH); 1743 } 1744 } 1745 } 1746 1747 function generate(count) { 1748 var slides = Slides.get().slice(); 1749 var length = slides.length; 1750 1751 if (length) { 1752 while (slides.length < count) { 1753 push(slides, slides); 1754 } 1755 1756 push(slides.slice(-count), slides.slice(0, count)).forEach(function (Slide, index) { 1757 var isHead = index < count; 1758 var clone = cloneDeep(Slide.slide, index); 1759 isHead ? before(clone, slides[0].slide) : append(Elements.list, clone); 1760 push(clones, clone); 1761 Slides.register(clone, index - count + (isHead ? 0 : length), Slide.index); 1762 }); 1763 } 1764 } 1765 1766 function cloneDeep(elm, index) { 1767 var clone = elm.cloneNode(true); 1768 addClass(clone, options.classes.clone); 1769 clone.id = Splide2.root.id + "-clone" + pad(index + 1); 1770 return clone; 1771 } 1772 1773 function computeCloneCount() { 1774 var clones2 = options.clones; 1775 1776 if (!Splide2.is(LOOP)) { 1777 clones2 = 0; 1778 } else if (isUndefined(clones2)) { 1779 var fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0); 1780 var fixedCount = fixedSize && ceil(rect(Elements.track)[resolve("width")] / fixedSize); 1781 clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER; 1782 } 1783 1784 return clones2; 1785 } 1786 1787 return { 1788 mount: mount, 1789 destroy: destroy 1790 }; 1791} 1792 1793function Move(Splide2, Components2, options) { 1794 var _EventInterface4 = EventInterface(Splide2), 1795 on = _EventInterface4.on, 1796 emit = _EventInterface4.emit; 1797 1798 var set = Splide2.state.set; 1799 var _Components2$Layout = Components2.Layout, 1800 slideSize = _Components2$Layout.slideSize, 1801 getPadding = _Components2$Layout.getPadding, 1802 totalSize = _Components2$Layout.totalSize, 1803 listSize = _Components2$Layout.listSize, 1804 sliderSize = _Components2$Layout.sliderSize; 1805 var _Components2$Directio = Components2.Direction, 1806 resolve = _Components2$Directio.resolve, 1807 orient = _Components2$Directio.orient; 1808 var _Components2$Elements3 = Components2.Elements, 1809 list = _Components2$Elements3.list, 1810 track = _Components2$Elements3.track; 1811 var Transition; 1812 1813 function mount() { 1814 Transition = Components2.Transition; 1815 on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition); 1816 } 1817 1818 function reposition() { 1819 if (!Components2.Controller.isBusy()) { 1820 Components2.Scroll.cancel(); 1821 jump(Splide2.index); 1822 Components2.Slides.update(); 1823 } 1824 } 1825 1826 function move(dest, index, prev, callback) { 1827 if (dest !== index && canShift(dest > prev)) { 1828 cancel(); 1829 translate(shift(getPosition(), dest > prev), true); 1830 } 1831 1832 set(MOVING); 1833 emit(EVENT_MOVE, index, prev, dest); 1834 Transition.start(index, function () { 1835 set(IDLE); 1836 emit(EVENT_MOVED, index, prev, dest); 1837 callback && callback(); 1838 }); 1839 } 1840 1841 function jump(index) { 1842 translate(toPosition(index, true)); 1843 } 1844 1845 function translate(position, preventLoop) { 1846 if (!Splide2.is(FADE)) { 1847 var destination = preventLoop ? position : loop(position); 1848 style(list, "transform", "translate" + resolve("X") + "(" + destination + "px)"); 1849 position !== destination && emit(EVENT_SHIFTED); 1850 } 1851 } 1852 1853 function loop(position) { 1854 if (Splide2.is(LOOP)) { 1855 var index = toIndex(position); 1856 var exceededMax = index > Components2.Controller.getEnd(); 1857 var exceededMin = index < 0; 1858 1859 if (exceededMin || exceededMax) { 1860 position = shift(position, exceededMax); 1861 } 1862 } 1863 1864 return position; 1865 } 1866 1867 function shift(position, backwards) { 1868 var excess = position - getLimit(backwards); 1869 var size = sliderSize(); 1870 position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1); 1871 return position; 1872 } 1873 1874 function cancel() { 1875 translate(getPosition(), true); 1876 Transition.cancel(); 1877 } 1878 1879 function toIndex(position) { 1880 var Slides = Components2.Slides.get(); 1881 var index = 0; 1882 var minDistance = Infinity; 1883 1884 for (var i = 0; i < Slides.length; i++) { 1885 var slideIndex = Slides[i].index; 1886 var distance = abs(toPosition(slideIndex, true) - position); 1887 1888 if (distance <= minDistance) { 1889 minDistance = distance; 1890 index = slideIndex; 1891 } else { 1892 break; 1893 } 1894 } 1895 1896 return index; 1897 } 1898 1899 function toPosition(index, trimming) { 1900 var position = orient(totalSize(index - 1) - offset(index)); 1901 return trimming ? trim(position) : position; 1902 } 1903 1904 function getPosition() { 1905 var left = resolve("left"); 1906 return rect(list)[left] - rect(track)[left] + orient(getPadding(false)); 1907 } 1908 1909 function trim(position) { 1910 if (options.trimSpace && Splide2.is(SLIDE)) { 1911 position = clamp(position, 0, orient(sliderSize(true) - listSize())); 1912 } 1913 1914 return position; 1915 } 1916 1917 function offset(index) { 1918 var focus = options.focus; 1919 return focus === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus * slideSize(index) || 0; 1920 } 1921 1922 function getLimit(max) { 1923 return toPosition(max ? Components2.Controller.getEnd() : 0, !!options.trimSpace); 1924 } 1925 1926 function canShift(backwards) { 1927 var shifted = orient(shift(getPosition(), backwards)); 1928 return backwards ? shifted >= 0 : shifted <= list[resolve("scrollWidth")] - rect(track)[resolve("width")]; 1929 } 1930 1931 function exceededLimit(max, position) { 1932 position = isUndefined(position) ? getPosition() : position; 1933 var exceededMin = max !== true && orient(position) < orient(getLimit(false)); 1934 var exceededMax = max !== false && orient(position) > orient(getLimit(true)); 1935 return exceededMin || exceededMax; 1936 } 1937 1938 return { 1939 mount: mount, 1940 move: move, 1941 jump: jump, 1942 translate: translate, 1943 shift: shift, 1944 cancel: cancel, 1945 toIndex: toIndex, 1946 toPosition: toPosition, 1947 getPosition: getPosition, 1948 getLimit: getLimit, 1949 exceededLimit: exceededLimit, 1950 reposition: reposition 1951 }; 1952} 1953 1954function Controller(Splide2, Components2, options) { 1955 var _EventInterface5 = EventInterface(Splide2), 1956 on = _EventInterface5.on, 1957 emit = _EventInterface5.emit; 1958 1959 var Move = Components2.Move; 1960 var getPosition = Move.getPosition, 1961 getLimit = Move.getLimit, 1962 toPosition = Move.toPosition; 1963 var _Components2$Slides = Components2.Slides, 1964 isEnough = _Components2$Slides.isEnough, 1965 getLength = _Components2$Slides.getLength; 1966 var omitEnd = options.omitEnd; 1967 var isLoop = Splide2.is(LOOP); 1968 var isSlide = Splide2.is(SLIDE); 1969 var getNext = apply(getAdjacent, false); 1970 var getPrev = apply(getAdjacent, true); 1971 var currIndex = options.start || 0; 1972 var endIndex; 1973 var prevIndex = currIndex; 1974 var slideCount; 1975 var perMove; 1976 var perPage; 1977 1978 function mount() { 1979 init(); 1980 on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init); 1981 on(EVENT_RESIZED, onResized); 1982 } 1983 1984 function init() { 1985 slideCount = getLength(true); 1986 perMove = options.perMove; 1987 perPage = options.perPage; 1988 endIndex = getEnd(); 1989 var index = clamp(currIndex, 0, omitEnd ? endIndex : slideCount - 1); 1990 1991 if (index !== currIndex) { 1992 currIndex = index; 1993 Move.reposition(); 1994 } 1995 } 1996 1997 function onResized() { 1998 if (endIndex !== getEnd()) { 1999 emit(EVENT_END_INDEX_CHANGED); 2000 } 2001 } 2002 2003 function go(control, allowSameIndex, callback) { 2004 if (!isBusy()) { 2005 var dest = parse(control); 2006 var index = loop(dest); 2007 2008 if (index > -1 && (allowSameIndex || index !== currIndex)) { 2009 setIndex(index); 2010 Move.move(dest, index, prevIndex, callback); 2011 } 2012 } 2013 } 2014 2015 function scroll(destination, duration, snap, callback) { 2016 Components2.Scroll.scroll(destination, duration, snap, function () { 2017 var index = loop(Move.toIndex(getPosition())); 2018 setIndex(omitEnd ? min(index, endIndex) : index); 2019 callback && callback(); 2020 }); 2021 } 2022 2023 function parse(control) { 2024 var index = currIndex; 2025 2026 if (isString(control)) { 2027 var _ref = control.match(/([+\-<>])(\d+)?/) || [], 2028 indicator = _ref[1], 2029 number = _ref[2]; 2030 2031 if (indicator === "+" || indicator === "-") { 2032 index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex); 2033 } else if (indicator === ">") { 2034 index = number ? toIndex(+number) : getNext(true); 2035 } else if (indicator === "<") { 2036 index = getPrev(true); 2037 } 2038 } else { 2039 index = isLoop ? control : clamp(control, 0, endIndex); 2040 } 2041 2042 return index; 2043 } 2044 2045 function getAdjacent(prev, destination) { 2046 var number = perMove || (hasFocus() ? 1 : perPage); 2047 var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus())); 2048 2049 if (dest === -1 && isSlide) { 2050 if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) { 2051 return prev ? 0 : endIndex; 2052 } 2053 } 2054 2055 return destination ? dest : loop(dest); 2056 } 2057 2058 function computeDestIndex(dest, from, snapPage) { 2059 if (isEnough() || hasFocus()) { 2060 var index = computeMovableDestIndex(dest); 2061 2062 if (index !== dest) { 2063 from = dest; 2064 dest = index; 2065 snapPage = false; 2066 } 2067 2068 if (dest < 0 || dest > endIndex) { 2069 if (!perMove && (between(0, dest, from, true) || between(endIndex, from, dest, true))) { 2070 dest = toIndex(toPage(dest)); 2071 } else { 2072 if (isLoop) { 2073 dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest; 2074 } else if (options.rewind) { 2075 dest = dest < 0 ? endIndex : 0; 2076 } else { 2077 dest = -1; 2078 } 2079 } 2080 } else { 2081 if (snapPage && dest !== from) { 2082 dest = toIndex(toPage(from) + (dest < from ? -1 : 1)); 2083 } 2084 } 2085 } else { 2086 dest = -1; 2087 } 2088 2089 return dest; 2090 } 2091 2092 function computeMovableDestIndex(dest) { 2093 if (isSlide && options.trimSpace === "move" && dest !== currIndex) { 2094 var position = getPosition(); 2095 2096 while (position === toPosition(dest, true) && between(dest, 0, Splide2.length - 1, !options.rewind)) { 2097 dest < currIndex ? --dest : ++dest; 2098 } 2099 } 2100 2101 return dest; 2102 } 2103 2104 function loop(index) { 2105 return isLoop ? (index + slideCount) % slideCount || 0 : index; 2106 } 2107 2108 function getEnd() { 2109 var end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage); 2110 2111 while (omitEnd && end-- > 0) { 2112 if (toPosition(slideCount - 1, true) !== toPosition(end, true)) { 2113 end++; 2114 break; 2115 } 2116 } 2117 2118 return clamp(end, 0, slideCount - 1); 2119 } 2120 2121 function toIndex(page) { 2122 return clamp(hasFocus() ? page : perPage * page, 0, endIndex); 2123 } 2124 2125 function toPage(index) { 2126 return hasFocus() ? min(index, endIndex) : floor((index >= endIndex ? slideCount - 1 : index) / perPage); 2127 } 2128 2129 function toDest(destination) { 2130 var closest = Move.toIndex(destination); 2131 return isSlide ? clamp(closest, 0, endIndex) : closest; 2132 } 2133 2134 function setIndex(index) { 2135 if (index !== currIndex) { 2136 prevIndex = currIndex; 2137 currIndex = index; 2138 } 2139 } 2140 2141 function getIndex(prev) { 2142 return prev ? prevIndex : currIndex; 2143 } 2144 2145 function hasFocus() { 2146 return !isUndefined(options.focus) || options.isNavigation; 2147 } 2148 2149 function isBusy() { 2150 return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition; 2151 } 2152 2153 return { 2154 mount: mount, 2155 go: go, 2156 scroll: scroll, 2157 getNext: getNext, 2158 getPrev: getPrev, 2159 getAdjacent: getAdjacent, 2160 getEnd: getEnd, 2161 setIndex: setIndex, 2162 getIndex: getIndex, 2163 toIndex: toIndex, 2164 toPage: toPage, 2165 toDest: toDest, 2166 hasFocus: hasFocus, 2167 isBusy: isBusy 2168 }; 2169} 2170 2171var XML_NAME_SPACE = "http://www.w3.org/2000/svg"; 2172var 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"; 2173var SIZE = 40; 2174 2175function Arrows(Splide2, Components2, options) { 2176 var event = EventInterface(Splide2); 2177 var on = event.on, 2178 bind = event.bind, 2179 emit = event.emit; 2180 var classes = options.classes, 2181 i18n = options.i18n; 2182 var Elements = Components2.Elements, 2183 Controller = Components2.Controller; 2184 var placeholder = Elements.arrows, 2185 track = Elements.track; 2186 var wrapper = placeholder; 2187 var prev = Elements.prev; 2188 var next = Elements.next; 2189 var created; 2190 var wrapperClasses; 2191 var arrows = {}; 2192 2193 function mount() { 2194 init(); 2195 on(EVENT_UPDATED, remount); 2196 } 2197 2198 function remount() { 2199 destroy(); 2200 mount(); 2201 } 2202 2203 function init() { 2204 var enabled = options.arrows; 2205 2206 if (enabled && !(prev && next)) { 2207 createArrows(); 2208 } 2209 2210 if (prev && next) { 2211
2211splide_esm_
vendor: 21,092 bytes, lines 2211-3021
2211assign(arrows, { 2212 prev: prev, 2213 next: next 2214 }); 2215 display(wrapper, enabled ? "" : "none"); 2216 addClass(wrapper, wrapperClasses = CLASS_ARROWS + "--" + options.direction); 2217 2218 if (enabled) { 2219 listen(); 2220 update(); 2221 setAttribute([prev, next], ARIA_CONTROLS, track.id); 2222 emit(EVENT_ARROWS_MOUNTED, prev, next); 2223 } 2224 } 2225 } 2226 2227 function destroy() { 2228 event.destroy(); 2229 removeClass(wrapper, wrapperClasses); 2230 2231 if (created) { 2232 remove(placeholder ? [prev, next] : wrapper); 2233 prev = next = null; 2234 } else { 2235 removeAttribute([prev, next], ALL_ATTRIBUTES); 2236 } 2237 } 2238 2239 function listen() { 2240 on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update); 2241 bind(next, "click", apply(go, ">")); 2242 bind(prev, "click", apply(go, "<")); 2243 } 2244 2245 function go(control) { 2246 Controller.go(control, true); 2247 } 2248 2249 function createArrows() { 2250 wrapper = placeholder || create("div", classes.arrows); 2251 prev = createArrow(true); 2252 next = createArrow(false); 2253 created = true; 2254 append(wrapper, [prev, next]); 2255 !placeholder && before(wrapper, track); 2256 } 2257 2258 function createArrow(prev2) { 2259 var arrow = "<button class=\"" + classes.arrow + " " + (prev2 ? classes.prev : classes.next) + "\" type=\"button\"><svg xmlns=\"" + XML_NAME_SPACE + "\" viewBox=\"0 0 " + SIZE + " " + SIZE + "\" width=\"" + SIZE + "\" height=\"" + SIZE + "\" focusable=\"false\"><path d=\"" + (options.arrowPath || PATH) + "\" />"; 2260 return parseHtml(arrow); 2261 } 2262 2263 function update() { 2264 if (prev && next) { 2265 var index = Splide2.index; 2266 var prevIndex = Controller.getPrev(); 2267 var nextIndex = Controller.getNext(); 2268 var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev; 2269 var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next; 2270 prev.disabled = prevIndex < 0; 2271 next.disabled = nextIndex < 0; 2272 setAttribute(prev, ARIA_LABEL, prevLabel); 2273 setAttribute(next, ARIA_LABEL, nextLabel); 2274 emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex); 2275 } 2276 } 2277 2278 return { 2279 arrows: arrows, 2280 mount: mount, 2281 destroy: destroy, 2282 update: update 2283 }; 2284} 2285 2286var INTERVAL_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-interval"; 2287 2288function Autoplay(Splide2, Components2, options) { 2289 var _EventInterface6 = EventInterface(Splide2), 2290 on = _EventInterface6.on, 2291 bind = _EventInterface6.bind, 2292 emit = _EventInterface6.emit; 2293 2294 var interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame); 2295 var isPaused = interval.isPaused; 2296 var Elements = Components2.Elements, 2297 _Components2$Elements4 = Components2.Elements, 2298 root = _Components2$Elements4.root, 2299 toggle = _Components2$Elements4.toggle; 2300 var autoplay = options.autoplay; 2301 var hovered; 2302 var focused; 2303 var stopped = autoplay === "pause"; 2304 2305 function mount() { 2306 if (autoplay) { 2307 listen(); 2308 toggle && setAttribute(toggle, ARIA_CONTROLS, Elements.track.id); 2309 stopped || play(); 2310 update(); 2311 } 2312 } 2313 2314 function listen() { 2315 if (options.pauseOnHover) { 2316 bind(root, "mouseenter mouseleave", function (e) { 2317 hovered = e.type === "mouseenter"; 2318 autoToggle(); 2319 }); 2320 } 2321 2322 if (options.pauseOnFocus) { 2323 bind(root, "focusin focusout", function (e) { 2324 focused = e.type === "focusin"; 2325 autoToggle(); 2326 }); 2327 } 2328 2329 if (toggle) { 2330 bind(toggle, "click", function () { 2331 stopped ? play() : pause(true); 2332 }); 2333 } 2334 2335 on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind); 2336 on(EVENT_MOVE, onMove); 2337 } 2338 2339 function play() { 2340 if (isPaused() && Components2.Slides.isEnough()) { 2341 interval.start(!options.resetProgress); 2342 focused = hovered = stopped = false; 2343 update(); 2344 emit(EVENT_AUTOPLAY_PLAY); 2345 } 2346 } 2347 2348 function pause(stop) { 2349 if (stop === void 0) { 2350 stop = true; 2351 } 2352 2353 stopped = !!stop; 2354 update(); 2355 2356 if (!isPaused()) { 2357 interval.pause(); 2358 emit(EVENT_AUTOPLAY_PAUSE); 2359 } 2360 } 2361 2362 function autoToggle() { 2363 if (!stopped) { 2364 hovered || focused ? pause(false) : play(); 2365 } 2366 } 2367 2368 function update() { 2369 if (toggle) { 2370 toggleClass(toggle, CLASS_ACTIVE, !stopped); 2371 setAttribute(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]); 2372 } 2373 } 2374 2375 function onAnimationFrame(rate) { 2376 var bar = Elements.bar; 2377 bar && style(bar, "width", rate * 100 + "%"); 2378 emit(EVENT_AUTOPLAY_PLAYING, rate); 2379 } 2380 2381 function onMove(index) { 2382 var Slide = Components2.Slides.getAt(index); 2383 interval.set(Slide && +getAttribute(Slide.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval); 2384 } 2385 2386 return { 2387 mount: mount, 2388 destroy: interval.cancel, 2389 play: play, 2390 pause: pause, 2391 isPaused: isPaused 2392 }; 2393} 2394 2395function Cover(Splide2, Components2, options) { 2396 var _EventInterface7 = EventInterface(Splide2), 2397 on = _EventInterface7.on; 2398 2399 function mount() { 2400 if (options.cover) { 2401 on(EVENT_LAZYLOAD_LOADED, apply(toggle, true)); 2402 on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply(cover, true)); 2403 } 2404 } 2405 2406 function cover(cover2) { 2407 Components2.Slides.forEach(function (Slide) { 2408 var img = child(Slide.container || Slide.slide, "img"); 2409 2410 if (img && img.src) { 2411 toggle(cover2, img, Slide); 2412 } 2413 }); 2414 } 2415 2416 function toggle(cover2, img, Slide) { 2417 Slide.style("background", cover2 ? "center/cover no-repeat url(\"" + img.src + "\")" : "", true); 2418 display(img, cover2 ? "none" : ""); 2419 } 2420 2421 return { 2422 mount: mount, 2423 destroy: apply(cover, false) 2424 }; 2425} 2426 2427var BOUNCE_DIFF_THRESHOLD = 10; 2428var BOUNCE_DURATION = 600; 2429var FRICTION_FACTOR = 0.6; 2430var BASE_VELOCITY = 1.5; 2431var MIN_DURATION = 800; 2432 2433function Scroll(Splide2, Components2, options) { 2434 var _EventInterface8 = EventInterface(Splide2), 2435 on = _EventInterface8.on, 2436 emit = _EventInterface8.emit; 2437 2438 var set = Splide2.state.set; 2439 var Move = Components2.Move; 2440 var getPosition = Move.getPosition, 2441 getLimit = Move.getLimit, 2442 exceededLimit = Move.exceededLimit, 2443 translate = Move.translate; 2444 var isSlide = Splide2.is(SLIDE); 2445 var interval; 2446 var callback; 2447 var friction = 1; 2448 2449 function mount() { 2450 on(EVENT_MOVE, clear); 2451 on([EVENT_UPDATED, EVENT_REFRESH], cancel); 2452 } 2453 2454 function scroll(destination, duration, snap, onScrolled, noConstrain) { 2455 var from = getPosition(); 2456 clear(); 2457 2458 if (snap && (!isSlide || !exceededLimit())) { 2459 var size = Components2.Layout.sliderSize(); 2460 var offset = sign(destination) * size * floor(abs(destination) / size) || 0; 2461 destination = Move.toPosition(Components2.Controller.toDest(destination % size)) + offset; 2462 } 2463 2464 var noDistance = approximatelyEqual(from, destination, 1); 2465 friction = 1; 2466 duration = noDistance ? 0 : duration || max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION); 2467 callback = onScrolled; 2468 interval = RequestInterval(duration, onEnd, apply(update, from, destination, noConstrain), 1); 2469 set(SCROLLING); 2470 emit(EVENT_SCROLL); 2471 interval.start(); 2472 } 2473 2474 function onEnd() { 2475 set(IDLE); 2476 callback && callback(); 2477 emit(EVENT_SCROLLED); 2478 } 2479 2480 function update(from, to, noConstrain, rate) { 2481 var position = getPosition(); 2482 var target = from + (to - from) * easing(rate); 2483 var diff = (target - position) * friction; 2484 translate(position + diff); 2485 2486 if (isSlide && !noConstrain && exceededLimit()) { 2487 friction *= FRICTION_FACTOR; 2488 2489 if (abs(diff) < BOUNCE_DIFF_THRESHOLD) { 2490 scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true); 2491 } 2492 } 2493 } 2494 2495 function clear() { 2496 if (interval) { 2497 interval.cancel(); 2498 } 2499 } 2500 2501 function cancel() { 2502 if (interval && !interval.isPaused()) { 2503 clear(); 2504 onEnd(); 2505 } 2506 } 2507 2508 function easing(t) { 2509 var easingFunc = options.easingFunc; 2510 return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4); 2511 } 2512 2513 return { 2514 mount: mount, 2515 destroy: clear, 2516 scroll: scroll, 2517 cancel: cancel 2518 }; 2519} 2520 2521var SCROLL_LISTENER_OPTIONS = { 2522 passive: false, 2523 capture: true 2524}; 2525 2526function Drag(Splide2, Components2, options) { 2527 var _EventInterface9 = EventInterface(Splide2), 2528 on = _EventInterface9.on, 2529 emit = _EventInterface9.emit, 2530 bind = _EventInterface9.bind, 2531 unbind = _EventInterface9.unbind; 2532 2533 var state = Splide2.state; 2534 var Move = Components2.Move, 2535 Scroll = Components2.Scroll, 2536 Controller = Components2.Controller, 2537 track = Components2.Elements.track, 2538 reduce = Components2.Media.reduce; 2539 var _Components2$Directio2 = Components2.Direction, 2540 resolve = _Components2$Directio2.resolve, 2541 orient = _Components2$Directio2.orient; 2542 var getPosition = Move.getPosition, 2543 exceededLimit = Move.exceededLimit; 2544 var basePosition; 2545 var baseEvent; 2546 var prevBaseEvent; 2547 var isFree; 2548 var dragging; 2549 var exceeded = false; 2550 var clickPrevented; 2551 var disabled; 2552 var target; 2553 2554 function mount() { 2555 bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 2556 bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 2557 bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS); 2558 bind(track, "click", onClick, { 2559 capture: true 2560 }); 2561 bind(track, "dragstart", prevent); 2562 on([EVENT_MOUNTED, EVENT_UPDATED], init); 2563 } 2564 2565 function init() { 2566 var drag = options.drag; 2567 disable(!drag); 2568 isFree = drag === "free"; 2569 } 2570 2571 function onPointerDown(e) { 2572 clickPrevented = false; 2573 2574 if (!disabled) { 2575 var isTouch = isTouchEvent(e); 2576 2577 if (isDraggable(e.target) && (isTouch || !e.button)) { 2578 if (!Controller.isBusy()) { 2579 target = isTouch ? track : window; 2580 dragging = state.is([MOVING, SCROLLING]); 2581 prevBaseEvent = null; 2582 bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS); 2583 bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS); 2584 Move.cancel(); 2585 Scroll.cancel(); 2586 save(e); 2587 } else { 2588 prevent(e, true); 2589 } 2590 } 2591 } 2592 } 2593 2594 function onPointerMove(e) { 2595 if (!state.is(DRAGGING)) { 2596 state.set(DRAGGING); 2597 emit(EVENT_DRAG); 2598 } 2599 2600 if (e.cancelable) { 2601 if (dragging) { 2602 Move.translate(basePosition + constrain(diffCoord(e))); 2603 var expired = diffTime(e) > LOG_INTERVAL; 2604 var hasExceeded = exceeded !== (exceeded = exceededLimit()); 2605 2606 if (expired || hasExceeded) { 2607 save(e); 2608 } 2609 2610 clickPrevented = true; 2611 emit(EVENT_DRAGGING); 2612 prevent(e); 2613 } else if (isSliderDirection(e)) { 2614 dragging = shouldStart(e); 2615 prevent(e); 2616 } 2617 } 2618 } 2619 2620 function onPointerUp(e) { 2621 if (state.is(DRAGGING)) { 2622 state.set(IDLE); 2623 emit(EVENT_DRAGGED); 2624 } 2625 2626 if (dragging) { 2627 move(e); 2628 prevent(e); 2629 } 2630 2631 unbind(target, POINTER_MOVE_EVENTS, onPointerMove); 2632 unbind(target, POINTER_UP_EVENTS, onPointerUp); 2633 dragging = false; 2634 } 2635 2636 function onClick(e) { 2637 if (!disabled && clickPrevented) { 2638 prevent(e, true); 2639 } 2640 } 2641 2642 function save(e) { 2643 prevBaseEvent = baseEvent; 2644 baseEvent = e; 2645 basePosition = getPosition(); 2646 } 2647 2648 function move(e) { 2649 var velocity = computeVelocity(e); 2650 var destination = computeDestination(velocity); 2651 var rewind = options.rewind && options.rewindByDrag; 2652 reduce(false); 2653 2654 if (isFree) { 2655 Controller.scroll(destination, 0, options.snap); 2656 } else if (Splide2.is(FADE)) { 2657 Controller.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+"); 2658 } else if (Splide2.is(SLIDE) && exceeded && rewind) { 2659 Controller.go(exceededLimit(true) ? ">" : "<"); 2660 } else { 2661 Controller.go(Controller.toDest(destination), true); 2662 } 2663 2664 reduce(true); 2665 } 2666 2667 function shouldStart(e) { 2668 var thresholds = options.dragMinThreshold; 2669 var isObj = isObject(thresholds); 2670 var mouse = isObj && thresholds.mouse || 0; 2671 var touch = (isObj ? thresholds.touch : +thresholds) || 10; 2672 return abs(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse); 2673 } 2674 2675 function isSliderDirection(e) { 2676 return abs(diffCoord(e)) > abs(diffCoord(e, true)); 2677 } 2678 2679 function computeVelocity(e) { 2680 if (Splide2.is(LOOP) || !exceeded) { 2681 var time = diffTime(e); 2682 2683 if (time && time < LOG_INTERVAL) { 2684 return diffCoord(e) / time; 2685 } 2686 } 2687 2688 return 0; 2689 } 2690 2691 function computeDestination(velocity) { 2692 return getPosition() + sign(velocity) * min(abs(velocity) * (options.flickPower || 600), isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1)); 2693 } 2694 2695 function diffCoord(e, orthogonal) { 2696 return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal); 2697 } 2698 2699 function diffTime(e) { 2700 return timeOf(e) - timeOf(getBaseEvent(e)); 2701 } 2702 2703 function getBaseEvent(e) { 2704 return baseEvent === e && prevBaseEvent || baseEvent; 2705 } 2706 2707 function coordOf(e, orthogonal) { 2708 return (isTouchEvent(e) ? e.changedTouches[0] : e)["page" + resolve(orthogonal ? "Y" : "X")]; 2709 } 2710 2711 function constrain(diff) { 2712 return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1); 2713 } 2714 2715 function isDraggable(target2) { 2716 var noDrag = options.noDrag; 2717 return !matches(target2, "." + CLASS_PAGINATION_PAGE + ", ." + CLASS_ARROW) && (!noDrag || !matches(target2, noDrag)); 2718 } 2719 2720 function isTouchEvent(e) { 2721 return typeof TouchEvent !== "undefined" && e instanceof TouchEvent; 2722 } 2723 2724 function isDragging() { 2725 return dragging; 2726 } 2727 2728 function disable(value) { 2729 disabled = value; 2730 } 2731 2732 return { 2733 mount: mount, 2734 disable: disable, 2735 isDragging: isDragging 2736 }; 2737} 2738 2739var NORMALIZATION_MAP = { 2740 Spacebar: " ", 2741 Right: ARROW_RIGHT, 2742 Left: ARROW_LEFT, 2743 Up: ARROW_UP, 2744 Down: ARROW_DOWN 2745}; 2746 2747function normalizeKey(key) { 2748 key = isString(key) ? key : key.key; 2749 return NORMALIZATION_MAP[key] || key; 2750} 2751 2752var KEYBOARD_EVENT = "keydown"; 2753 2754function Keyboard(Splide2, Components2, options) { 2755 var _EventInterface10 = EventInterface(Splide2), 2756 on = _EventInterface10.on, 2757 bind = _EventInterface10.bind, 2758 unbind = _EventInterface10.unbind; 2759 2760 var root = Splide2.root; 2761 var resolve = Components2.Direction.resolve; 2762 var target; 2763 var disabled; 2764 2765 function mount() { 2766 init(); 2767 on(EVENT_UPDATED, destroy); 2768 on(EVENT_UPDATED, init); 2769 on(EVENT_MOVE, onMove); 2770 } 2771 2772 function init() { 2773 var keyboard = options.keyboard; 2774 2775 if (keyboard) { 2776 target = keyboard === "global" ? window : root; 2777 bind(target, KEYBOARD_EVENT, onKeydown); 2778 } 2779 } 2780 2781 function destroy() { 2782 unbind(target, KEYBOARD_EVENT); 2783 } 2784 2785 function disable(value) { 2786 disabled = value; 2787 } 2788 2789 function onMove() { 2790 var _disabled = disabled; 2791 disabled = true; 2792 nextTick(function () { 2793 disabled = _disabled; 2794 }); 2795 } 2796 2797 function onKeydown(e) { 2798 if (!disabled) { 2799 var key = normalizeKey(e); 2800 2801 if (key === resolve(ARROW_LEFT)) { 2802 Splide2.go("<"); 2803 } else if (key === resolve(ARROW_RIGHT)) { 2804 Splide2.go(">"); 2805 } 2806 } 2807 } 2808 2809 return { 2810 mount: mount, 2811 destroy: destroy, 2812 disable: disable 2813 }; 2814} 2815 2816var SRC_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-lazy"; 2817var SRCSET_DATA_ATTRIBUTE = SRC_DATA_ATTRIBUTE + "-srcset"; 2818var IMAGE_SELECTOR = "[" + SRC_DATA_ATTRIBUTE + "], [" + SRCSET_DATA_ATTRIBUTE + "]"; 2819 2820function LazyLoad(Splide2, Components2, options) { 2821 var _EventInterface11 = EventInterface(Splide2), 2822 on = _EventInterface11.on, 2823 off = _EventInterface11.off, 2824 bind = _EventInterface11.bind, 2825 emit = _EventInterface11.emit; 2826 2827 var isSequential = options.lazyLoad === "sequential"; 2828 var events = [EVENT_MOVED, EVENT_SCROLLED]; 2829 var entries = []; 2830 2831 function mount() { 2832 if (options.lazyLoad) { 2833 init(); 2834 on(EVENT_REFRESH, init); 2835 } 2836 } 2837 2838 function init() { 2839 empty(entries); 2840 register(); 2841 2842 if (isSequential) { 2843 loadNext(); 2844 } else { 2845 off(events); 2846 on(events, check); 2847 check(); 2848 } 2849 } 2850 2851 function register() { 2852 Components2.Slides.forEach(function (Slide) { 2853 queryAll(Slide.slide, IMAGE_SELECTOR).forEach(function (img) { 2854 var src = getAttribute(img, SRC_DATA_ATTRIBUTE); 2855 var srcset = getAttribute(img, SRCSET_DATA_ATTRIBUTE); 2856 2857 if (src !== img.src || srcset !== img.srcset) { 2858 var className = options.classes.spinner; 2859 var parent = img.parentElement; 2860 var spinner = child(parent, "." + className) || create("span", className, parent); 2861 entries.push([img, Slide, spinner]); 2862 img.src || display(img, "none"); 2863 } 2864 }); 2865 }); 2866 } 2867 2868 function check() { 2869 entries = entries.filter(function (data) { 2870 var distance = options.perPage * ((options.preloadPages || 1) + 1) - 1; 2871 return data[1].isWithin(Splide2.index, distance) ? load(data) : true; 2872 }); 2873 entries.length || off(events); 2874 } 2875 2876 function load(data) { 2877 var img = data[0]; 2878 addClass(data[1].slide, CLASS_LOADING); 2879 bind(img, "load error", apply(onLoad, data)); 2880 setAttribute(img, "src", getAttribute(img, SRC_DATA_ATTRIBUTE)); 2881 setAttribute(img, "srcset", getAttribute(img, SRCSET_DATA_ATTRIBUTE)); 2882 removeAttribute(img, SRC_DATA_ATTRIBUTE); 2883 removeAttribute(img, SRCSET_DATA_ATTRIBUTE); 2884 } 2885 2886 function onLoad(data, e) { 2887 var img = data[0], 2888 Slide = data[1]; 2889 removeClass(Slide.slide, CLASS_LOADING); 2890 2891 if (e.type !== "error") { 2892 remove(data[2]); 2893 display(img, ""); 2894 emit(EVENT_LAZYLOAD_LOADED, img, Slide); 2895 emit(EVENT_RESIZE); 2896 } 2897 2898 isSequential && loadNext(); 2899 } 2900 2901 function loadNext() { 2902 entries.length && load(entries.shift()); 2903 } 2904 2905 return { 2906 mount: mount, 2907 destroy: apply(empty, entries), 2908 check: check 2909 }; 2910} 2911 2912function Pagination(Splide2, Components2, options) { 2913 var event = EventInterface(Splide2); 2914 var on = event.on, 2915 emit = event.emit, 2916 bind = event.bind; 2917 var Slides = Components2.Slides, 2918 Elements = Components2.Elements, 2919 Controller = Components2.Controller; 2920 var hasFocus = Controller.hasFocus, 2921 getIndex = Controller.getIndex, 2922 go = Controller.go; 2923 var resolve = Components2.Direction.resolve; 2924 var placeholder = Elements.pagination; 2925 var items = []; 2926 var list; 2927 var paginationClasses; 2928 2929 function mount() { 2930 destroy(); 2931 on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount); 2932 var enabled = options.pagination; 2933 placeholder && display(placeholder, enabled ? "" : "none"); 2934 2935 if (enabled) { 2936 on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update); 2937 createPagination(); 2938 update(); 2939 emit(EVENT_PAGINATION_MOUNTED, { 2940 list: list, 2941 items: items 2942 }, getAt(Splide2.index)); 2943 } 2944 } 2945 2946 function destroy() { 2947 if (list) { 2948 remove(placeholder ? slice(list.children) : list); 2949 removeClass(list, paginationClasses); 2950 empty(items); 2951 list = null; 2952 } 2953 2954 event.destroy(); 2955 } 2956 2957 function createPagination() { 2958 var length = Splide2.length; 2959 var classes = options.classes, 2960 i18n = options.i18n, 2961 perPage = options.perPage; 2962 var max = hasFocus() ? Controller.getEnd() + 1 : ceil(length / perPage); 2963 list = placeholder || create("ul", classes.pagination, Elements.track.parentElement); 2964 addClass(list, paginationClasses = CLASS_PAGINATION + "--" + getDirection()); 2965 setAttribute(list, ROLE, "tablist"); 2966 setAttribute(list, ARIA_LABEL, i18n.select); 2967 setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : ""); 2968 2969 for (var i = 0; i < max; i++) { 2970 var li = create("li", null, list); 2971 var button = create("button", { 2972 class: classes.page, 2973 type: "button" 2974 }, li); 2975 var controls = Slides.getIn(i).map(function (Slide) { 2976 return Slide.slide.id; 2977 }); 2978 var text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX; 2979 bind(button, "click", apply(onClick, i)); 2980 2981 if (options.paginationKeyboard) { 2982 bind(button, "keydown", apply(onKeydown, i)); 2983 } 2984 2985 setAttribute(li, ROLE, "presentation"); 2986 setAttribute(button, ROLE, "tab"); 2987 setAttribute(button, ARIA_CONTROLS, controls.join(" ")); 2988 setAttribute(button, ARIA_LABEL, format(text, i + 1)); 2989 setAttribute(button, TAB_INDEX, -1); 2990 items.push({ 2991 li: li, 2992 button: button, 2993 page: i 2994 }); 2995 } 2996 } 2997 2998 function onClick(page) { 2999 go(">" + page, true); 3000 } 3001 3002 function onKeydown(page, e) { 3003 var length = items.length; 3004 var key = normalizeKey(e); 3005 var dir = getDirection(); 3006 var nextPage = -1; 3007 3008 if (key === resolve(ARROW_RIGHT, false, dir)) { 3009 nextPage = ++page % length; 3010 } else if (key === resolve(ARROW_LEFT, false, dir)) { 3011 nextPage = (--page + length) % length; 3012 } else if (key === "Home") { 3013 nextPage = 0; 3014 } else if (key === "End") { 3015 nextPage = length - 1; 3016 } 3017 3018 var item = items[nextPage]; 3019 3020 if (item) { 3021
3021splide_esm_
vendor: 9,262 bytes, lines 3021-3424
3021focus(item.button); 3022 go(">" + nextPage); 3023 prevent(e, true); 3024 } 3025 } 3026 3027 function getDirection() { 3028 return options.paginationDirection || options.direction; 3029 } 3030 3031 function getAt(index) { 3032 return items[Controller.toPage(index)]; 3033 } 3034 3035 function update() { 3036 var prev = getAt(getIndex(true)); 3037 var curr = getAt(getIndex()); 3038 3039 if (prev) { 3040 var button = prev.button; 3041 removeClass(button, CLASS_ACTIVE); 3042 removeAttribute(button, ARIA_SELECTED); 3043 setAttribute(button, TAB_INDEX, -1); 3044 } 3045 3046 if (curr) { 3047 var _button = curr.button; 3048 addClass(_button, CLASS_ACTIVE); 3049 setAttribute(_button, ARIA_SELECTED, true); 3050 setAttribute(_button, TAB_INDEX, ""); 3051 } 3052 3053 emit(EVENT_PAGINATION_UPDATED, { 3054 list: list, 3055 items: items 3056 }, prev, curr); 3057 } 3058 3059 return { 3060 items: items, 3061 mount: mount, 3062 destroy: destroy, 3063 getAt: getAt, 3064 update: update 3065 }; 3066} 3067 3068var TRIGGER_KEYS = [" ", "Enter"]; 3069 3070function Sync(Splide2, Components2, options) { 3071 var isNavigation = options.isNavigation, 3072 slideFocus = options.slideFocus; 3073 var events = []; 3074 3075 function mount() { 3076 Splide2.splides.forEach(function (target) { 3077 if (!target.isParent) { 3078 sync(Splide2, target.splide); 3079 sync(target.splide, Splide2); 3080 } 3081 }); 3082 3083 if (isNavigation) { 3084 navigate(); 3085 } 3086 } 3087 3088 function destroy() { 3089 events.forEach(function (event) { 3090 event.destroy(); 3091 }); 3092 empty(events); 3093 } 3094 3095 function remount() { 3096 destroy(); 3097 mount(); 3098 } 3099 3100 function sync(splide, target) { 3101 var event = EventInterface(splide); 3102 event.on(EVENT_MOVE, function (index, prev, dest) { 3103 target.go(target.is(LOOP) ? dest : index); 3104 }); 3105 events.push(event); 3106 } 3107 3108 function navigate() { 3109 var event = EventInterface(Splide2); 3110 var on = event.on; 3111 on(EVENT_CLICK, onClick); 3112 on(EVENT_SLIDE_KEYDOWN, onKeydown); 3113 on([EVENT_MOUNTED, EVENT_UPDATED], update); 3114 events.push(event); 3115 event.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides); 3116 } 3117 3118 function update() { 3119 setAttribute(Components2.Elements.list, ARIA_ORIENTATION, options.direction === TTB ? "vertical" : ""); 3120 } 3121 3122 function onClick(Slide) { 3123 Splide2.go(Slide.index); 3124 } 3125 3126 function onKeydown(Slide, e) { 3127 if (includes(TRIGGER_KEYS, normalizeKey(e))) { 3128 onClick(Slide); 3129 prevent(e); 3130 } 3131 } 3132 3133 return { 3134 setup: apply(Components2.Media.set, { 3135 slideFocus: isUndefined(slideFocus) ? isNavigation : slideFocus 3136 }, true), 3137 mount: mount, 3138 destroy: destroy, 3139 remount: remount 3140 }; 3141} 3142 3143function Wheel(Splide2, Components2, options) { 3144 var _EventInterface12 = EventInterface(Splide2), 3145 bind = _EventInterface12.bind; 3146 3147 var lastTime = 0; 3148 3149 function mount() { 3150 if (options.wheel) { 3151 bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS); 3152 } 3153 } 3154 3155 function onWheel(e) { 3156 if (e.cancelable) { 3157 var deltaY = e.deltaY; 3158 var backwards = deltaY < 0; 3159 var timeStamp = timeOf(e); 3160 3161 var _min = options.wheelMinThreshold || 0; 3162 3163 var sleep = options.wheelSleep || 0; 3164 3165 if (abs(deltaY) > _min && timeStamp - lastTime > sleep) { 3166 Splide2.go(backwards ? "<" : ">"); 3167 lastTime = timeStamp; 3168 } 3169 3170 shouldPrevent(backwards) && prevent(e); 3171 } 3172 } 3173 3174 function shouldPrevent(backwards) { 3175 return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1; 3176 } 3177 3178 return { 3179 mount: mount 3180 }; 3181} 3182 3183var SR_REMOVAL_DELAY = 90; 3184 3185function Live(Splide2, Components2, options) { 3186 var _EventInterface13 = EventInterface(Splide2), 3187 on = _EventInterface13.on; 3188 3189 var track = Components2.Elements.track; 3190 var enabled = options.live && !options.isNavigation; 3191 var sr = create("span", CLASS_SR); 3192 var interval = RequestInterval(SR_REMOVAL_DELAY, apply(toggle, false)); 3193 3194 function mount() { 3195 if (enabled) { 3196 disable(!Components2.Autoplay.isPaused()); 3197 setAttribute(track, ARIA_ATOMIC, true); 3198 sr.textContent = "\u2026"; 3199 on(EVENT_AUTOPLAY_PLAY, apply(disable, true)); 3200 on(EVENT_AUTOPLAY_PAUSE, apply(disable, false)); 3201 on([EVENT_MOVED, EVENT_SCROLLED], apply(toggle, true)); 3202 } 3203 } 3204 3205 function toggle(active) { 3206 setAttribute(track, ARIA_BUSY, active); 3207 3208 if (active) { 3209 append(track, sr); 3210 interval.start(); 3211 } else { 3212 remove(sr); 3213 interval.cancel(); 3214 } 3215 } 3216 3217 function destroy() { 3218 removeAttribute(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]); 3219 remove(sr); 3220 } 3221 3222 function disable(disabled) { 3223 if (enabled) { 3224 setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite"); 3225 } 3226 } 3227 3228 return { 3229 mount: mount, 3230 disable: disable, 3231 destroy: destroy 3232 }; 3233} 3234 3235var ComponentConstructors = /*#__PURE__*/Object.freeze({ 3236 __proto__: null, 3237 Media: Media, 3238 Direction: Direction, 3239 Elements: Elements, 3240 Slides: Slides, 3241 Layout: Layout, 3242 Clones: Clones, 3243 Move: Move, 3244 Controller: Controller, 3245 Arrows: Arrows, 3246 Autoplay: Autoplay, 3247 Cover: Cover, 3248 Scroll: Scroll, 3249 Drag: Drag, 3250 Keyboard: Keyboard, 3251 LazyLoad: LazyLoad, 3252 Pagination: Pagination, 3253 Sync: Sync, 3254 Wheel: Wheel, 3255 Live: Live 3256}); 3257var I18N = { 3258 prev: "Previous slide", 3259 next: "Next slide", 3260 first: "Go to first slide", 3261 last: "Go to last slide", 3262 slideX: "Go to slide %s", 3263 pageX: "Go to page %s", 3264 play: "Start autoplay", 3265 pause: "Pause autoplay", 3266 carousel: "carousel", 3267 slide: "slide", 3268 select: "Select a slide to show", 3269 slideLabel: "%s of %s" 3270}; 3271var DEFAULTS = { 3272 type: "slide", 3273 role: "region", 3274 speed: 400, 3275 perPage: 1, 3276 cloneStatus: true, 3277 arrows: true, 3278 pagination: true, 3279 paginationKeyboard: true, 3280 interval: 5e3, 3281 pauseOnHover: true, 3282 pauseOnFocus: true, 3283 resetProgress: true, 3284 easing: "cubic-bezier(0.25, 1, 0.5, 1)", 3285 drag: true, 3286 direction: "ltr", 3287 trimSpace: true, 3288 focusableNodes: "a, button, textarea, input, select, iframe", 3289 live: true, 3290 classes: CLASSES, 3291 i18n: I18N, 3292 reducedMotion: { 3293 speed: 0, 3294 rewindSpeed: 0, 3295 autoplay: "pause" 3296 } 3297}; 3298 3299function Fade(Splide2, Components2, options) { 3300 var Slides = Components2.Slides; 3301 3302 function mount() { 3303 EventInterface(Splide2).on([EVENT_MOUNTED, EVENT_REFRESH], init); 3304 } 3305 3306 function init() { 3307 Slides.forEach(function (Slide) { 3308 Slide.style("transform", "translateX(-" + 100 * Slide.index + "%)"); 3309 }); 3310 } 3311 3312 function start(index, done) { 3313 Slides.style("transition", "opacity " + options.speed + "ms " + options.easing); 3314 nextTick(done); 3315 } 3316 3317 return { 3318 mount: mount, 3319 start: start, 3320 cancel: noop 3321 }; 3322} 3323 3324function Slide(Splide2, Components2, options) { 3325 var Move = Components2.Move, 3326 Controller = Components2.Controller, 3327 Scroll = Components2.Scroll; 3328 var list = Components2.Elements.list; 3329 var transition = apply(style, list, "transition"); 3330 var endCallback; 3331 3332 function mount() { 3333 EventInterface(Splide2).bind(list, "transitionend", function (e) { 3334 if (e.target === list && endCallback) { 3335 cancel(); 3336 endCallback(); 3337 } 3338 }); 3339 } 3340 3341 function start(index, done) { 3342 var destination = Move.toPosition(index, true); 3343 var position = Move.getPosition(); 3344 var speed = getSpeed(index); 3345 3346 if (abs(destination - position) >= 1 && speed >= 1) { 3347 if (options.useScroll) { 3348 Scroll.scroll(destination, speed, false, done); 3349 } else { 3350 transition("transform " + speed + "ms " + options.easing); 3351 Move.translate(destination, true); 3352 endCallback = done; 3353 } 3354 } else { 3355 Move.jump(index); 3356 done(); 3357 } 3358 } 3359 3360 function cancel() { 3361 transition(""); 3362 Scroll.cancel(); 3363 } 3364 3365 function getSpeed(index) { 3366 var rewindSpeed = options.rewindSpeed; 3367 3368 if (Splide2.is(SLIDE) && rewindSpeed) { 3369 var prev = Controller.getIndex(true); 3370 var end = Controller.getEnd(); 3371 3372 if (prev === 0 && index >= end || prev >= end && index === 0) { 3373 return rewindSpeed; 3374 } 3375 } 3376 3377 return options.speed; 3378 } 3379 3380 return { 3381 mount: mount, 3382 start: start, 3383 cancel: cancel 3384 }; 3385} 3386 3387var _Splide = /*#__PURE__*/function () { 3388 function _Splide(target, options) { 3389 this.event = EventInterface(); 3390 this.Components = {}; 3391 this.state = State(CREATED); 3392 this.splides = []; 3393 this._o = {}; 3394 this._E = {}; 3395 var root = isString(target) ? query(document, target) : target; 3396 assert(root, root + " is invalid."); 3397 this.root = root; 3398 options = merge({ 3399 label: getAttribute(root, ARIA_LABEL) || "", 3400 labelledby: getAttribute(root, ARIA_LABELLEDBY) || "" 3401 }, DEFAULTS, _Splide.defaults, options || {}); 3402 3403 try { 3404 merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE))); 3405 } catch (e) { 3406 assert(false, "Invalid JSON"); 3407 } 3408 3409 this._o = Object.create(merge({}, options)); 3410 } 3411 3412 var _proto = _Splide.prototype; 3413 3414 _proto.mount = function mount(Extensions, Transition) { 3415 var _this = this; 3416 3417 var state = this.state, 3418 Components2 = this.Components; 3419 assert(state.is([CREATED, DESTROYED]), "Already mounted!"); 3420 state.set(CREATED); 3421 this._C = Components2; 3422 this._T = Transition || this._T || (this.is(FADE) ? Fade : Slide); 3423 this._E = Extensions || this._E; 3424 var Constructors =
vendor: 6,119 bytes, lines 3424-3669
3424splide_esm_assign({}, ComponentConstructors, this._E, { 3425 Transition: this._T 3426 }); 3427 forOwn(Constructors, function (Component, key) { 3428 var component = Component(_this, Components2, _this._o); 3429 Components2[key] = component; 3430 component.setup && component.setup(); 3431 }); 3432 forOwn(Components2, function (component) { 3433 component.mount && component.mount(); 3434 }); 3435 this.emit(EVENT_MOUNTED); 3436 addClass(this.root, CLASS_INITIALIZED); 3437 state.set(IDLE); 3438 this.emit(EVENT_READY); 3439 return this; 3440 }; 3441 3442 _proto.sync = function sync(splide) { 3443 this.splides.push({ 3444 splide: splide 3445 }); 3446 splide.splides.push({ 3447 splide: this, 3448 isParent: true 3449 }); 3450 3451 if (this.state.is(IDLE)) { 3452 this._C.Sync.remount(); 3453 3454 splide.Components.Sync.remount(); 3455 } 3456 3457 return this; 3458 }; 3459 3460 _proto.go = function go(control) { 3461 this._C.Controller.go(control); 3462 3463 return this; 3464 }; 3465 3466 _proto.on = function on(events, callback) { 3467 this.event.on(events, callback); 3468 return this; 3469 }; 3470 3471 _proto.off = function off(events) { 3472 this.event.off(events); 3473 return this; 3474 }; 3475 3476 _proto.emit = function emit(event) { 3477 var _this$event; 3478 3479 (_this$event = this.event).emit.apply(_this$event, [event].concat(slice(arguments, 1))); 3480 3481 return this; 3482 }; 3483 3484 _proto.add = function add(slides, index) { 3485 this._C.Slides.add(slides, index); 3486 3487 return this; 3488 }; 3489 3490 _proto.remove = function remove(matcher) { 3491 this._C.Slides.remove(matcher); 3492 3493 return this; 3494 }; 3495 3496 _proto.is = function is(type) { 3497 return this._o.type === type; 3498 }; 3499 3500 _proto.refresh = function refresh() { 3501 this.emit(EVENT_REFRESH); 3502 return this; 3503 }; 3504 3505 _proto.destroy = function destroy(completely) { 3506 if (completely === void 0) { 3507 completely = true; 3508 } 3509 3510 var event = this.event, 3511 state = this.state; 3512 3513 if (state.is(CREATED)) { 3514 EventInterface(this).on(EVENT_READY, this.destroy.bind(this, completely)); 3515 } else { 3516 forOwn(this._C, function (component) { 3517 component.destroy && component.destroy(completely); 3518 }, true); 3519 event.emit(EVENT_DESTROY); 3520 event.destroy(); 3521 completely && empty(this.splides); 3522 state.set(DESTROYED); 3523 } 3524 3525 return this; 3526 }; 3527 3528 _createClass(_Splide, [{ 3529 key: "options", 3530 get: function get() { 3531 return this._o; 3532 }, 3533 set: function set(options) { 3534 this._C.Media.set(options, true, true); 3535 } 3536 }, { 3537 key: "length", 3538 get: function get() { 3539 return this._C.Slides.getLength(true); 3540 } 3541 }, { 3542 key: "index", 3543 get: function get() { 3544 return this._C.Controller.getIndex(); 3545 } 3546 }]); 3547 3548 return _Splide; 3549}(); 3550 3551var Splide = _Splide; 3552Splide.defaults = {}; 3553Splide.STATES = STATES; 3554var CLASS_RENDERED = "is-rendered"; 3555var RENDERER_DEFAULT_CONFIG = { 3556 listTag: "ul", 3557 slideTag: "li" 3558}; 3559 3560var Style = /*#__PURE__*/(/* unused pure expression or super */ null && (function () { 3561 function Style(id, options) { 3562 this.styles = {}; 3563 this.id = id; 3564 this.options = options; 3565 } 3566 3567 var _proto2 = Style.prototype; 3568 3569 _proto2.rule = function rule(selector, prop, value, breakpoint) { 3570 breakpoint = breakpoint || "default"; 3571 var selectors = this.styles[breakpoint] = this.styles[breakpoint] || {}; 3572 var styles = selectors[selector] = selectors[selector] || {}; 3573 styles[prop] = value; 3574 }; 3575 3576 _proto2.build = function build() { 3577 var _this2 = this; 3578 3579 var css = ""; 3580 3581 if (this.styles.default) { 3582 css += this.buildSelectors(this.styles.default); 3583 } 3584 3585 Object.keys(this.styles).sort(function (n, m) { 3586 return _this2.options.mediaQuery === "min" ? +n - +m : +m - +n; 3587 }).forEach(function (breakpoint) { 3588 if (breakpoint !== "default") { 3589 css += "@media screen and (max-width: " + breakpoint + "px) {"; 3590 css += _this2.buildSelectors(_this2.styles[breakpoint]); 3591 css += "}"; 3592 } 3593 }); 3594 return css; 3595 }; 3596 3597 _proto2.buildSelectors = function buildSelectors(selectors) { 3598 var _this3 = this; 3599 3600 var css = ""; 3601 forOwn(selectors, function (styles, selector) { 3602 selector = ("#" + _this3.id + " " + selector).trim(); 3603 css += selector + " {"; 3604 forOwn(styles, function (value, prop) { 3605 if (value || value === 0) { 3606 css += prop + ": " + value + ";"; 3607 } 3608 }); 3609 css += "}"; 3610 }); 3611 return css; 3612 }; 3613 3614 return Style; 3615}())); 3616 3617var SplideRenderer = /*#__PURE__*/(/* unused pure expression or super */ null && (function () { 3618 function SplideRenderer(contents, options, config, defaults) { 3619 this.slides = []; 3620 this.options = {}; 3621 this.breakpoints = []; 3622 merge(DEFAULTS, defaults || {}); 3623 merge(merge(this.options, DEFAULTS), options || {}); 3624 this.contents = contents; 3625 this.config = splide_esm_assign({}, RENDERER_DEFAULT_CONFIG, config || {}); 3626 this.id = this.config.id || uniqueId("splide"); 3627 this.Style = new Style(this.id, this.options); 3628 this.Direction = Direction(null, null, this.options); 3629 assert(this.contents.length, "Provide at least 1 content."); 3630 this.init(); 3631 } 3632 3633 SplideRenderer.clean = function clean(splide) { 3634 var _EventInterface14 = EventInterface(splide), 3635 on = _EventInterface14.on; 3636 3637 var root = splide.root; 3638 var clones = queryAll(root, "." + CLASS_CLONE); 3639 on(EVENT_MOUNTED, function () { 3640 remove(child(root, "style")); 3641 }); 3642 remove(clones); 3643 }; 3644 3645 var _proto3 = SplideRenderer.prototype; 3646 3647 _proto3.init = function init() { 3648 this.parseBreakpoints(); 3649 this.initSlides(); 3650 this.registerRootStyles(); 3651 this.registerTrackStyles(); 3652 this.registerSlideStyles(); 3653 this.registerListStyles(); 3654 }; 3655 3656 _proto3.initSlides = function initSlides() { 3657 var _this4 = this; 3658 3659 push(this.slides, this.contents.map(function (content, index) { 3660 content = isString(content) ? { 3661 html: content 3662 } : content; 3663 content.styles = content.styles || {}; 3664 content.attrs = content.attrs || {}; 3665 3666 _this4.cover(content); 3667 3668 var classes = _this4.options.classes.slide + " " + (index === 0 ? CLASS_ACTIVE : ""); 3669 splide_esm_
vendor: 9,827 bytes, lines 3669-3982
3669assign(content.attrs, { 3670 class: (classes + " " + (content.attrs.class || "")).trim(), 3671 style: _this4.buildStyles(content.styles) 3672 }); 3673 return content; 3674 })); 3675 3676 if (this.isLoop()) { 3677 this.generateClones(this.slides); 3678 } 3679 }; 3680 3681 _proto3.registerRootStyles = function registerRootStyles() { 3682 var _this5 = this; 3683 3684 this.breakpoints.forEach(function (_ref2) { 3685 var width = _ref2[0], 3686 options = _ref2[1]; 3687 3688 _this5.Style.rule(" ", "max-width", unit(options.width), width); 3689 }); 3690 }; 3691 3692 _proto3.registerTrackStyles = function registerTrackStyles() { 3693 var _this6 = this; 3694 3695 var Style2 = this.Style; 3696 var selector = "." + CLASS_TRACK; 3697 this.breakpoints.forEach(function (_ref3) { 3698 var width = _ref3[0], 3699 options = _ref3[1]; 3700 Style2.rule(selector, _this6.resolve("paddingLeft"), _this6.cssPadding(options, false), width); 3701 Style2.rule(selector, _this6.resolve("paddingRight"), _this6.cssPadding(options, true), width); 3702 Style2.rule(selector, "height", _this6.cssTrackHeight(options), width); 3703 }); 3704 }; 3705 3706 _proto3.registerListStyles = function registerListStyles() { 3707 var _this7 = this; 3708 3709 var Style2 = this.Style; 3710 var selector = "." + CLASS_LIST; 3711 this.breakpoints.forEach(function (_ref4) { 3712 var width = _ref4[0], 3713 options = _ref4[1]; 3714 Style2.rule(selector, "transform", _this7.buildTranslate(options), width); 3715 3716 if (!_this7.cssSlideHeight(options)) { 3717 Style2.rule(selector, "aspect-ratio", _this7.cssAspectRatio(options), width); 3718 } 3719 }); 3720 }; 3721 3722 _proto3.registerSlideStyles = function registerSlideStyles() { 3723 var _this8 = this; 3724 3725 var Style2 = this.Style; 3726 var selector = "." + CLASS_SLIDE; 3727 this.breakpoints.forEach(function (_ref5) { 3728 var width = _ref5[0], 3729 options = _ref5[1]; 3730 Style2.rule(selector, "width", _this8.cssSlideWidth(options), width); 3731 Style2.rule(selector, "height", _this8.cssSlideHeight(options) || "100%", width); 3732 Style2.rule(selector, _this8.resolve("marginRight"), unit(options.gap) || "0px", width); 3733 Style2.rule(selector + " > img", "display", options.cover ? "none" : "inline", width); 3734 }); 3735 }; 3736 3737 _proto3.buildTranslate = function buildTranslate(options) { 3738 var _this$Direction = this.Direction, 3739 resolve = _this$Direction.resolve, 3740 orient = _this$Direction.orient; 3741 var values = []; 3742 values.push(this.cssOffsetClones(options)); 3743 values.push(this.cssOffsetGaps(options)); 3744 3745 if (this.isCenter(options)) { 3746 values.push(this.buildCssValue(orient(-50), "%")); 3747 values.push.apply(values, this.cssOffsetCenter(options)); 3748 } 3749 3750 return values.filter(Boolean).map(function (value) { 3751 return "translate" + resolve("X") + "(" + value + ")"; 3752 }).join(" "); 3753 }; 3754 3755 _proto3.cssOffsetClones = function cssOffsetClones(options) { 3756 var _this$Direction2 = this.Direction, 3757 resolve = _this$Direction2.resolve, 3758 orient = _this$Direction2.orient; 3759 var cloneCount = this.getCloneCount(); 3760 3761 if (this.isFixedWidth(options)) { 3762 var _this$parseCssValue = this.parseCssValue(options[resolve("fixedWidth")]), 3763 value = _this$parseCssValue.value, 3764 unit2 = _this$parseCssValue.unit; 3765 3766 return this.buildCssValue(orient(value) * cloneCount, unit2); 3767 } 3768 3769 var percent = 100 * cloneCount / options.perPage; 3770 return orient(percent) + "%"; 3771 }; 3772 3773 _proto3.cssOffsetCenter = function cssOffsetCenter(options) { 3774 var _this$Direction3 = this.Direction, 3775 resolve = _this$Direction3.resolve, 3776 orient = _this$Direction3.orient; 3777 3778 if (this.isFixedWidth(options)) { 3779 var _this$parseCssValue2 = this.parseCssValue(options[resolve("fixedWidth")]), 3780 value = _this$parseCssValue2.value, 3781 unit2 = _this$parseCssValue2.unit; 3782 3783 return [this.buildCssValue(orient(value / 2), unit2)]; 3784 } 3785 3786 var values = []; 3787 var perPage = options.perPage, 3788 gap = options.gap; 3789 values.push(orient(50 / perPage) + "%"); 3790 3791 if (gap) { 3792 var _this$parseCssValue3 = this.parseCssValue(gap), 3793 _value = _this$parseCssValue3.value, 3794 _unit = _this$parseCssValue3.unit; 3795 3796 var gapOffset = (_value / perPage - _value) / 2; 3797 values.push(this.buildCssValue(orient(gapOffset), _unit)); 3798 } 3799 3800 return values; 3801 }; 3802 3803 _proto3.cssOffsetGaps = function cssOffsetGaps(options) { 3804 var cloneCount = this.getCloneCount(); 3805 3806 if (cloneCount && options.gap) { 3807 var orient = this.Direction.orient; 3808 3809 var _this$parseCssValue4 = this.parseCssValue(options.gap), 3810 value = _this$parseCssValue4.value, 3811 unit2 = _this$parseCssValue4.unit; 3812 3813 if (this.isFixedWidth(options)) { 3814 return this.buildCssValue(orient(value * cloneCount), unit2); 3815 } 3816 3817 var perPage = options.perPage; 3818 var gaps = cloneCount / perPage; 3819 return this.buildCssValue(orient(gaps * value), unit2); 3820 } 3821 3822 return ""; 3823 }; 3824 3825 _proto3.resolve = function resolve(prop) { 3826 return camelToKebab(this.Direction.resolve(prop)); 3827 }; 3828 3829 _proto3.cssPadding = function cssPadding(options, right) { 3830 var padding = options.padding; 3831 var prop = this.Direction.resolve(right ? "right" : "left", true); 3832 return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px"; 3833 }; 3834 3835 _proto3.cssTrackHeight = function cssTrackHeight(options) { 3836 var height = ""; 3837 3838 if (this.isVertical()) { 3839 height = this.cssHeight(options); 3840 assert(height, '"height" is missing.'); 3841 height = "calc(" + height + " - " + this.cssPadding(options, false) + " - " + this.cssPadding(options, true) + ")"; 3842 } 3843 3844 return height; 3845 }; 3846 3847 _proto3.cssHeight = function cssHeight(options) { 3848 return unit(options.height); 3849 }; 3850 3851 _proto3.cssSlideWidth = function cssSlideWidth(options) { 3852 return options.autoWidth ? "" : unit(options.fixedWidth) || (this.isVertical() ? "" : this.cssSlideSize(options)); 3853 }; 3854 3855 _proto3.cssSlideHeight = function cssSlideHeight(options) { 3856 return unit(options.fixedHeight) || (this.isVertical() ? options.autoHeight ? "" : this.cssSlideSize(options) : this.cssHeight(options)); 3857 }; 3858 3859 _proto3.cssSlideSize = function cssSlideSize(options) { 3860 var gap = unit(options.gap); 3861 return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")"; 3862 }; 3863 3864 _proto3.cssAspectRatio = function cssAspectRatio(options) { 3865 var heightRatio = options.heightRatio; 3866 return heightRatio ? "" + 1 / heightRatio : ""; 3867 }; 3868 3869 _proto3.buildCssValue = function buildCssValue(value, unit2) { 3870 return "" + value + unit2; 3871 }; 3872 3873 _proto3.parseCssValue = function parseCssValue(value) { 3874 if (isString(value)) { 3875 var number = parseFloat(value) || 0; 3876 var unit2 = value.replace(/\d*(\.\d*)?/, "") || "px"; 3877 return { 3878 value: number, 3879 unit: unit2 3880 }; 3881 } 3882 3883 return { 3884 value: value, 3885 unit: "px" 3886 }; 3887 }; 3888 3889 _proto3.parseBreakpoints = function parseBreakpoints() { 3890 var _this9 = this; 3891 3892 var breakpoints = this.options.breakpoints; 3893 this.breakpoints.push(["default", this.options]); 3894 3895 if (breakpoints) { 3896 forOwn(breakpoints, function (options, width) { 3897 _this9.breakpoints.push([width, merge(merge({}, _this9.options), options)]); 3898 }); 3899 } 3900 }; 3901 3902 _proto3.isFixedWidth = function isFixedWidth(options) { 3903 return !!options[this.Direction.resolve("fixedWidth")]; 3904 }; 3905 3906 _proto3.isLoop = function isLoop() { 3907 return this.options.type === LOOP; 3908 }; 3909 3910 _proto3.isCenter = function isCenter(options) { 3911 if (options.focus === "center") { 3912 if (this.isLoop()) { 3913 return true; 3914 } 3915 3916 if (this.options.type === SLIDE) { 3917 return !this.options.trimSpace; 3918 } 3919 } 3920 3921 return false; 3922 }; 3923 3924 _proto3.isVertical = function isVertical() { 3925 return this.options.direction === TTB; 3926 }; 3927 3928 _proto3.buildClasses = function buildClasses() { 3929 var options = this.options; 3930 return [CLASS_ROOT, CLASS_ROOT + "--" + options.type, CLASS_ROOT + "--" + options.direction, options.drag && CLASS_ROOT + "--draggable", options.isNavigation && CLASS_ROOT + "--nav", CLASS_ACTIVE, !this.config.hidden && CLASS_RENDERED].filter(Boolean).join(" "); 3931 }; 3932 3933 _proto3.buildAttrs = function buildAttrs(attrs) { 3934 var attr = ""; 3935 forOwn(attrs, function (value, key) { 3936 attr += value ? " " + camelToKebab(key) + "=\"" + value + "\"" : ""; 3937 }); 3938 return attr.trim(); 3939 }; 3940 3941 _proto3.buildStyles = function buildStyles(styles) { 3942 var style = ""; 3943 forOwn(styles, function (value, key) { 3944 style += " " + camelToKebab(key) + ":" + value + ";"; 3945 }); 3946 return style.trim(); 3947 }; 3948 3949 _proto3.renderSlides = function renderSlides() { 3950 var _this10 = this; 3951 3952 var tag = this.config.slideTag; 3953 return this.slides.map(function (content) { 3954 return "<" + tag + " " + _this10.buildAttrs(content.attrs) + ">" + (content.html || "") + "</" + tag + ">"; 3955 }).join(""); 3956 }; 3957 3958 _proto3.cover = function cover(content) { 3959 var styles = content.styles, 3960 _content$html = content.html, 3961 html = _content$html === void 0 ? "" : _content$html; 3962 3963 if (this.options.cover && !this.options.lazyLoad) { 3964 var src = html.match(/<img.*?src\s*=\s*(['"])(.+?)\1.*?>/); 3965 3966 if (src && src[2]) { 3967 styles.background = "center/cover no-repeat url('" + src[2] + "')"; 3968 } 3969 } 3970 }; 3971 3972 _proto3.generateClones = function generateClones(contents) { 3973 var classes = this.options.classes; 3974 var count = this.getCloneCount(); 3975 var slides = contents.slice(); 3976 3977 while (slides.length < count) { 3978 push(slides, slides); 3979 } 3980 3981 push(slides.slice(-count).reverse(), slides.slice(0, count)).forEach(function (content, index) { 3982 var attrs =
vendor: 2,920 bytes, lines 3982-4082
3982splide_esm_assign({}, content.attrs, { 3983 class: content.attrs.class + " " + classes.clone 3984 }); 3985 var clone = splide_esm_assign({}, content, { 3986 attrs: attrs 3987 }); 3988 index < count ? contents.unshift(clone) : contents.push(clone); 3989 }); 3990 }; 3991 3992 _proto3.getCloneCount = function getCloneCount() { 3993 if (this.isLoop()) { 3994 var options = this.options; 3995 3996 if (options.clones) { 3997 return options.clones; 3998 } 3999 4000 var perPage = max.apply(void 0, this.breakpoints.map(function (_ref6) { 4001 var options2 = _ref6[1]; 4002 return options2.perPage; 4003 })); 4004 return perPage * ((options.flickMaxPages || 1) + 1); 4005 } 4006 4007 return 0; 4008 }; 4009 4010 _proto3.renderArrows = function renderArrows() { 4011 var html = ""; 4012 html += "<div class=\"" + this.options.classes.arrows + "\">"; 4013 html += this.renderArrow(true); 4014 html += this.renderArrow(false); 4015 html += "</div>"; 4016 return html; 4017 }; 4018 4019 _proto3.renderArrow = function renderArrow(prev) { 4020 var _this$options = this.options, 4021 classes = _this$options.classes, 4022 i18n = _this$options.i18n; 4023 var attrs = { 4024 class: classes.arrow + " " + (prev ? classes.prev : classes.next), 4025 type: "button", 4026 ariaLabel: prev ? i18n.prev : i18n.next 4027 }; 4028 return "<button " + this.buildAttrs(attrs) + "><svg xmlns=\"" + XML_NAME_SPACE + "\" viewBox=\"0 0 " + SIZE + " " + SIZE + "\" width=\"" + SIZE + "\" height=\"" + SIZE + "\"><path d=\"" + (this.options.arrowPath || PATH) + "\" /></svg></button>"; 4029 }; 4030 4031 _proto3.html = function html() { 4032 var _this$config = this.config, 4033 rootClass = _this$config.rootClass, 4034 listTag = _this$config.listTag, 4035 arrows = _this$config.arrows, 4036 beforeTrack = _this$config.beforeTrack, 4037 afterTrack = _this$config.afterTrack, 4038 slider = _this$config.slider, 4039 beforeSlider = _this$config.beforeSlider, 4040 afterSlider = _this$config.afterSlider; 4041 var html = ""; 4042 html += "<div id=\"" + this.id + "\" class=\"" + this.buildClasses() + " " + (rootClass || "") + "\">"; 4043 html += "<style>" + this.Style.build() + "</style>"; 4044 4045 if (slider) { 4046 html += beforeSlider || ""; 4047 html += "<div class=\"splide__slider\">"; 4048 } 4049 4050 html += beforeTrack || ""; 4051 4052 if (arrows) { 4053 html += this.renderArrows(); 4054 } 4055 4056 html += "<div class=\"splide__track\">"; 4057 html += "<" + listTag + " class=\"splide__list\">"; 4058 html += this.renderSlides(); 4059 html += "</" + listTag + ">"; 4060 html += "</div>"; 4061 html += afterTrack || ""; 4062 4063 if (slider) { 4064 html += "</div>"; 4065 html += afterSlider || ""; 4066 } 4067 4068 html += "</div>"; 4069 return html; 4070 }; 4071 4072 return SplideRenderer; 4073}())); 4074 4075 4076 4077;// CONCATENATED MODULE: ./source/default/patterns/03-organisms/slider/slider.behavior.js 4078 4079 4080Drupal.behaviors.slider = { 4081 attach() { 4082 const sliders = src_once('splide-slider', '.splide');
4083 sliders.forEach(slider => { 4084 const autoplay = slider.attributes['data-autoplay'].value; 4085 const slidesPerView = slider.attributes['data-slides-per-view'].value; 4086 const pagination = slider.attributes['data-pagination'].value; 4087 const splide = new Splide(slider, { 4088 type: 'slide', 4089 arrows: true, 4090 pagination: pagination === '1', 4091 perPage: slidesPerView, 4092 perMove: slidesPerView, 4093 autoplay: autoplay === '1', 4094 interval: 5000, 4095 rewind: autoplay === '1', 4096 gap: 30, 4097 breakpoints: { 4098 640: { 4099 perPage: 1, 4100 perMove: 1 4101 }, 4102 768: { 4103 perPage: slidesPerView === '4' ? 2 : 1, 4104 perMove: slidesPerView === '4' ? 2 : 1 4105 }, 4106 1024: { 4107 perPage: slidesPerView === '6' ? 4 : 1, 4108 perMove: slidesPerView === '4' ? 2 : 1 4109 } 4110 } 4111 }); 4112 splide.mount(); 4113 slider.classList.add('splide--processed'); 4114 }); 4115 } 4116}; 4117/******/ })() 4118; 4119//# sourceMappingURL=slider.js.map
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.