vendor: 4,246 bytes, lines 1-193
1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 4(() => { 5// extracted by mini-css-extract-plugin 6 7})(); 8 9// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 10(() => { 11 12 13document.querySelectorAll('.themes__item').forEach(asset => { 14 const video = asset.querySelector('video'); 15 const button = asset.querySelector('.moviebutton'); 16 if (video && button) { 17 const text = button.querySelector('span'); 18 const icon = button.querySelector('iconify-icon'); 19 button.addEventListener('click', () => { 20 if (video.paused) { 21 video.dataset.playing = '1'; 22 video.play(); 23 } else { 24 video.dataset.playing = '0'; 25 video.pause(); 26 } 27 }); 28 video.addEventListener('play', () => { 29 text.innerText = button.dataset.textPause || ''; 30 icon.setAttribute('icon', button.dataset.iconPause || ''); 31 }); 32 video.addEventListener('pause', () => { 33 text.innerText = button.dataset.textPlay || ''; 34 icon.setAttribute('icon', button.dataset.iconPlay || ''); 35 }); 36 } 37}); 38})(); 39 40// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 41(() => { 42 43;// ./node_modules/swiper/shared/ssr-window.esm.mjs 44/** 45 * SSR Window 5.0.0 46 * Better handling for window object in SSR environment 47 * https://github.com/nolimits4web/ssr-window 48 * 49 * Copyright 2025, Vladimir Kharlampidi 50 * 51 * Licensed under MIT 52 * 53 * Released on: February 12, 2025 54 */ 55/* eslint-disable no-param-reassign */ 56function isObject(obj) { 57 return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; 58} 59function extend(target, src) { 60 if (target === void 0) { 61 target = {}; 62 } 63 if (src === void 0) { 64 src = {}; 65 } 66 const noExtend = ['__proto__', 'constructor', 'prototype']; 67 Object.keys(src).filter(key => noExtend.indexOf(key) < 0).forEach(key => { 68 if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { 69 extend(target[key], src[key]); 70 } 71 }); 72} 73const ssrDocument = { 74 body: {}, 75 addEventListener() {}, 76 removeEventListener() {}, 77 activeElement: { 78 blur() {}, 79 nodeName: '' 80 }, 81 querySelector() { 82 return null; 83 }, 84 querySelectorAll() { 85 return []; 86 }, 87 getElementById() { 88 return null; 89 }, 90 createEvent() { 91 return { 92 initEvent() {} 93 }; 94 }, 95 createElement() { 96 return { 97 children: [], 98 childNodes: [], 99 style: {}, 100 setAttribute() {}, 101 getElementsByTagName() { 102 return []; 103 } 104 }; 105 }, 106 createElementNS() { 107 return {}; 108 }, 109 importNode() { 110 return null; 111 }, 112 location: { 113 hash: '', 114 host: '', 115 hostname: '', 116 href: '', 117 origin: '', 118 pathname: '', 119 protocol: '', 120 search: '' 121 } 122}; 123function getDocument() { 124 const doc = typeof document !== 'undefined' ? document : {}; 125 extend(doc, ssrDocument); 126 return doc; 127} 128const ssrWindow = { 129 document: ssrDocument, 130 navigator: { 131 userAgent: '' 132 }, 133 location: { 134 hash: '', 135 host: '', 136 hostname: '', 137 href: '', 138 origin: '', 139 pathname: '', 140 protocol: '', 141 search: '' 142 }, 143 history: { 144 replaceState() {}, 145 pushState() {}, 146 go() {}, 147 back() {} 148 }, 149 CustomEvent: function CustomEvent() { 150 return this; 151 }, 152 addEventListener() {}, 153 removeEventListener() {}, 154 getComputedStyle() { 155 return { 156 getPropertyValue() { 157 return ''; 158 } 159 }; 160 }, 161 Image() {}, 162 Date() {}, 163 screen: {}, 164 setTimeout() {}, 165 clearTimeout() {}, 166 matchMedia() { 167 return {}; 168 }, 169 requestAnimationFrame(callback) { 170 if (typeof setTimeout === 'undefined') { 171 callback(); 172 return null; 173 } 174 return setTimeout(callback, 0); 175 }, 176 cancelAnimationFrame(id) { 177 if (typeof setTimeout === 'undefined') { 178 return; 179 } 180 clearTimeout(id); 181 } 182}; 183function getWindow() { 184 const win = typeof window !== 'undefined' ? window : {}; 185 extend(win, ssrWindow); 186 return win; 187} 188 189 190 191;// ./node_modules/swiper/shared/utils.mjs 192 193
vendor: 5,226 bytes, lines 194-347
194function classesToTokens(classes) { 195 if (classes === void 0) { 196 classes = ''; 197 } 198 return classes.trim().split(' ').filter(c => !!c.trim()); 199} 200 201function deleteProps(obj) { 202 const object = obj; 203 Object.keys(object).forEach(key => { 204 try { 205 object[key] = null; 206 } catch (e) { 207 // no getter for object 208 } 209 try { 210 delete object[key]; 211 } catch (e) { 212 // something got wrong 213 } 214 }); 215} 216function nextTick(callback, delay) { 217 if (delay === void 0) { 218 delay = 0; 219 } 220 return setTimeout(callback, delay); 221} 222function now() { 223 return Date.now(); 224} 225function utils_getComputedStyle(el) { 226 const window = getWindow(); 227 let style; 228 if (window.getComputedStyle) { 229 style = window.getComputedStyle(el, null); 230 } 231 if (!style && el.currentStyle) { 232 style = el.currentStyle; 233 } 234 if (!style) { 235 style = el.style; 236 } 237 return style; 238} 239function getTranslate(el, axis) { 240 if (axis === void 0) { 241 axis = 'x'; 242 } 243 const window = getWindow(); 244 let matrix; 245 let curTransform; 246 let transformMatrix; 247 const curStyle = utils_getComputedStyle(el); 248 if (window.WebKitCSSMatrix) { 249 curTransform = curStyle.transform || curStyle.webkitTransform; 250 if (curTransform.split(',').length > 6) { 251 curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); 252 } 253 // Some old versions of Webkit choke when 'none' is passed; pass 254 // empty string instead in this case 255 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 256 } else { 257 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 258 matrix = transformMatrix.toString().split(','); 259 } 260 if (axis === 'x') { 261 // Latest Chrome and webkits Fix 262 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; 263 // Crazy IE10 Matrix 264 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); 265 // Normal Browsers 266 else curTransform = parseFloat(matrix[4]); 267 } 268 if (axis === 'y') { 269 // Latest Chrome and webkits Fix 270 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; 271 // Crazy IE10 Matrix 272 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); 273 // Normal Browsers 274 else curTransform = parseFloat(matrix[5]); 275 } 276 return curTransform || 0; 277} 278function utils_isObject(o) { 279 return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; 280} 281function isNode(node) { 282 // eslint-disable-next-line 283 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { 284 return node instanceof HTMLElement; 285 } 286 return node && (node.nodeType === 1 || node.nodeType === 11); 287} 288function utils_extend() { 289 const to = Object(arguments.length <= 0 ? undefined : arguments[0]); 290 const noExtend = ['__proto__', 'constructor', 'prototype']; 291 for (let i = 1; i < arguments.length; i += 1) { 292 const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; 293 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 294 const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0); 295 for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 296 const nextKey = keysArray[nextIndex]; 297 const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 298 if (desc !== undefined && desc.enumerable) { 299 if (utils_isObject(to[nextKey]) && utils_isObject(nextSource[nextKey])) { 300 if (nextSource[nextKey].__swiper__) { 301 to[nextKey] = nextSource[nextKey]; 302 } else { 303 utils_extend(to[nextKey], nextSource[nextKey]); 304 } 305 } else if (!utils_isObject(to[nextKey]) && utils_isObject(nextSource[nextKey])) { 306 to[nextKey] = {}; 307 if (nextSource[nextKey].__swiper__) { 308 to[nextKey] = nextSource[nextKey]; 309 } else { 310 utils_extend(to[nextKey], nextSource[nextKey]); 311 } 312 } else { 313 to[nextKey] = nextSource[nextKey]; 314 } 315 } 316 } 317 } 318 } 319 return to; 320} 321function setCSSProperty(el, varName, varValue) { 322 el.style.setProperty(varName, varValue); 323} 324function animateCSSModeScroll(_ref) { 325 let { 326 swiper, 327 targetPosition, 328 side 329 } = _ref; 330 const window = getWindow(); 331 const startPosition = -swiper.translate; 332 let startTime = null; 333 let time; 334 const duration = swiper.params.speed; 335 swiper.wrapperEl.style.scrollSnapType = 'none'; 336 window.cancelAnimationFrame(swiper.cssModeFrameID); 337 const dir = targetPosition > startPosition ? 'next' : 'prev'; 338 const isOutOfBound = (current, target) => { 339 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 340 }; 341 const animate = () => { 342 time = new Date().getTime(); 343 if (startTime === null) { 344 startTime = time; 345 } 346 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 347 const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
vendor: 5,798 bytes, lines 348-536
348 let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 349 if (isOutOfBound(currentPosition, targetPosition)) { 350 currentPosition = targetPosition; 351 } 352 swiper.wrapperEl.scrollTo({ 353 [side]: currentPosition 354 }); 355 if (isOutOfBound(currentPosition, targetPosition)) { 356 swiper.wrapperEl.style.overflow = 'hidden'; 357 swiper.wrapperEl.style.scrollSnapType = ''; 358 setTimeout(() => { 359 swiper.wrapperEl.style.overflow = ''; 360 swiper.wrapperEl.scrollTo({ 361 [side]: currentPosition 362 }); 363 }); 364 window.cancelAnimationFrame(swiper.cssModeFrameID); 365 return; 366 } 367 swiper.cssModeFrameID = window.requestAnimationFrame(animate); 368 }; 369 animate(); 370} 371function getSlideTransformEl(slideEl) { 372 return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl; 373} 374function elementChildren(element, selector) { 375 if (selector === void 0) { 376 selector = ''; 377 } 378 const window = getWindow(); 379 const children = [...element.children]; 380 if (window.HTMLSlotElement && element instanceof HTMLSlotElement) { 381 children.push(...element.assignedElements()); 382 } 383 if (!selector) { 384 return children; 385 } 386 return children.filter(el => el.matches(selector)); 387} 388function elementIsChildOfSlot(el, slot) { 389 // Breadth-first search through all parent's children and assigned elements 390 const elementsQueue = [slot]; 391 while (elementsQueue.length > 0) { 392 const elementToCheck = elementsQueue.shift(); 393 if (el === elementToCheck) { 394 return true; 395 } 396 elementsQueue.push(...elementToCheck.children, ...(elementToCheck.shadowRoot?.children || []), ...(elementToCheck.assignedElements?.() || [])); 397 } 398} 399function elementIsChildOf(el, parent) { 400 const window = getWindow(); 401 let isChild = parent.contains(el); 402 if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) { 403 const children = [...parent.assignedElements()]; 404 isChild = children.includes(el); 405 if (!isChild) { 406 isChild = elementIsChildOfSlot(el, parent); 407 } 408 } 409 return isChild; 410} 411function showWarning(text) { 412 try { 413 console.warn(text); 414 return; 415 } catch (err) { 416 // err 417 } 418} 419function createElement(tag, classes) { 420 if (classes === void 0) { 421 classes = []; 422 } 423 const el = document.createElement(tag); 424 el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes))); 425 return el; 426} 427function elementOffset(el) { 428 const window = getWindow(); 429 const document = getDocument(); 430 const box = el.getBoundingClientRect(); 431 const body = document.body; 432 const clientTop = el.clientTop || body.clientTop || 0; 433 const clientLeft = el.clientLeft || body.clientLeft || 0; 434 const scrollTop = el === window ? window.scrollY : el.scrollTop; 435 const scrollLeft = el === window ? window.scrollX : el.scrollLeft; 436 return { 437 top: box.top + scrollTop - clientTop, 438 left: box.left + scrollLeft - clientLeft 439 }; 440} 441function elementPrevAll(el, selector) { 442 const prevEls = []; 443 while (el.previousElementSibling) { 444 const prev = el.previousElementSibling; // eslint-disable-line 445 if (selector) { 446 if (prev.matches(selector)) prevEls.push(prev); 447 } else prevEls.push(prev); 448 el = prev; 449 } 450 return prevEls; 451} 452function elementNextAll(el, selector) { 453 const nextEls = []; 454 while (el.nextElementSibling) { 455 const next = el.nextElementSibling; // eslint-disable-line 456 if (selector) { 457 if (next.matches(selector)) nextEls.push(next); 458 } else nextEls.push(next); 459 el = next; 460 } 461 return nextEls; 462} 463function elementStyle(el, prop) { 464 const window = getWindow(); 465 return window.getComputedStyle(el, null).getPropertyValue(prop); 466} 467function elementIndex(el) { 468 let child = el; 469 let i; 470 if (child) { 471 i = 0; 472 // eslint-disable-next-line 473 while ((child = child.previousSibling) !== null) { 474 if (child.nodeType === 1) i += 1; 475 } 476 return i; 477 } 478 return undefined; 479} 480function elementParents(el, selector) { 481 const parents = []; // eslint-disable-line 482 let parent = el.parentElement; // eslint-disable-line 483 while (parent) { 484 if (selector) { 485 if (parent.matches(selector)) parents.push(parent); 486 } else { 487 parents.push(parent); 488 } 489 parent = parent.parentElement; 490 } 491 return parents; 492} 493function elementTransitionEnd(el, callback) { 494 function fireCallBack(e) { 495 if (e.target !== el) return; 496 callback.call(el, e); 497 el.removeEventListener('transitionend', fireCallBack); 498 } 499 if (callback) { 500 el.addEventListener('transitionend', fireCallBack); 501 } 502} 503function elementOuterSize(el, size, includeMargins) { 504 const window = getWindow(); 505 if (includeMargins) { 506 return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom')); 507 } 508 return el.offsetWidth; 509} 510function makeElementsArray(el) { 511 return (Array.isArray(el) ? el : [el]).filter(e => !!e); 512} 513function getRotateFix(swiper) { 514 return v => { 515 if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) { 516 return v + 0.001; 517 } 518 return v; 519 }; 520} 521 522 523 524;// ./node_modules/swiper/shared/swiper-core.mjs 525 526 527 528let support; 529function calcSupport() { 530 const window = getWindow(); 531 const document = getDocument(); 532 return { 533 smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style, 534 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch) 535 }; 536}
vendor: 4,892 bytes, lines 537-707
537function getSupport() { 538 if (!support) { 539 support = calcSupport(); 540 } 541 return support; 542} 543 544let deviceCached; 545function calcDevice(_temp) { 546 let { 547 userAgent 548 } = _temp === void 0 ? {} : _temp; 549 const support = getSupport(); 550 const window = getWindow(); 551 const platform = window.navigator.platform; 552 const ua = userAgent || window.navigator.userAgent; 553 const device = { 554 ios: false, 555 android: false 556 }; 557 const screenWidth = window.screen.width; 558 const screenHeight = window.screen.height; 559 const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 560 let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 561 const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 562 const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 563 const windows = platform === 'Win32'; 564 let macos = platform === 'MacIntel'; 565 566 // iPadOs 13 fix 567 const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; 568 if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { 569 ipad = ua.match(/(Version)\/([\d.]+)/); 570 if (!ipad) ipad = [0, 1, '13_0_0']; 571 macos = false; 572 } 573 574 // Android 575 if (android && !windows) { 576 device.os = 'android'; 577 device.android = true; 578 } 579 if (ipad || iphone || ipod) { 580 device.os = 'ios'; 581 device.ios = true; 582 } 583 584 // Export object 585 return device; 586} 587function getDevice(overrides) { 588 if (overrides === void 0) { 589 overrides = {}; 590 } 591 if (!deviceCached) { 592 deviceCached = calcDevice(overrides); 593 } 594 return deviceCached; 595} 596 597let browser; 598function calcBrowser() { 599 const window = getWindow(); 600 const device = getDevice(); 601 let needPerspectiveFix = false; 602 function isSafari() { 603 const ua = window.navigator.userAgent.toLowerCase(); 604 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 605 } 606 if (isSafari()) { 607 const ua = String(window.navigator.userAgent); 608 if (ua.includes('Version/')) { 609 const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num)); 610 needPerspectiveFix = major < 16 || major === 16 && minor < 2; 611 } 612 } 613 const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent); 614 const isSafariBrowser = isSafari(); 615 const need3dFix = isSafariBrowser || isWebView && device.ios; 616 return { 617 isSafari: needPerspectiveFix || isSafariBrowser, 618 needPerspectiveFix, 619 need3dFix, 620 isWebView 621 }; 622} 623function getBrowser() { 624 if (!browser) { 625 browser = calcBrowser(); 626 } 627 return browser; 628} 629 630function Resize(_ref) { 631 let { 632 swiper, 633 on, 634 emit 635 } = _ref; 636 const window = getWindow(); 637 let observer = null; 638 let animationFrame = null; 639 const resizeHandler = () => { 640 if (!swiper || swiper.destroyed || !swiper.initialized) return; 641 emit('beforeResize'); 642 emit('resize'); 643 }; 644 const createObserver = () => { 645 if (!swiper || swiper.destroyed || !swiper.initialized) return; 646 observer = new ResizeObserver(entries => { 647 animationFrame = window.requestAnimationFrame(() => { 648 const { 649 width, 650 height 651 } = swiper; 652 let newWidth = width; 653 let newHeight = height; 654 entries.forEach(_ref2 => { 655 let { 656 contentBoxSize, 657 contentRect, 658 target 659 } = _ref2; 660 if (target && target !== swiper.el) return; 661 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 662 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 663 }); 664 if (newWidth !== width || newHeight !== height) { 665 resizeHandler(); 666 } 667 }); 668 }); 669 observer.observe(swiper.el); 670 }; 671 const removeObserver = () => { 672 if (animationFrame) { 673 window.cancelAnimationFrame(animationFrame); 674 } 675 if (observer && observer.unobserve && swiper.el) { 676 observer.unobserve(swiper.el); 677 observer = null; 678 } 679 }; 680 const orientationChangeHandler = () => { 681 if (!swiper || swiper.destroyed || !swiper.initialized) return; 682 emit('orientationchange'); 683 }; 684 on('init', () => { 685 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { 686 createObserver(); 687 return; 688 } 689 window.addEventListener('resize', resizeHandler); 690 window.addEventListener('orientationchange', orientationChangeHandler); 691 }); 692 on('destroy', () => { 693 removeObserver(); 694 window.removeEventListener('resize', resizeHandler); 695 window.removeEventListener('orientationchange', orientationChangeHandler); 696 }); 697} 698 699function Observer(_ref) { 700 let { 701 swiper, 702 extendParams, 703 on, 704 emit 705 } = _ref; 706 const observers = []; 707 const window = getWindow
vendor: 8,509 bytes, lines 707-964
707(); 708 const attach = function (target, options) { 709 if (options === void 0) { 710 options = {}; 711 } 712 const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; 713 const observer = new ObserverFunc(mutations => { 714 // The observerUpdate event should only be triggered 715 // once despite the number of mutations. Additional 716 // triggers are redundant and are very costly 717 if (swiper.__preventObserver__) return; 718 if (mutations.length === 1) { 719 emit('observerUpdate', mutations[0]); 720 return; 721 } 722 const observerUpdate = function observerUpdate() { 723 emit('observerUpdate', mutations[0]); 724 }; 725 if (window.requestAnimationFrame) { 726 window.requestAnimationFrame(observerUpdate); 727 } else { 728 window.setTimeout(observerUpdate, 0); 729 } 730 }); 731 observer.observe(target, { 732 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 733 childList: swiper.isElement || (typeof options.childList === 'undefined' ? true : options).childList, 734 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 735 }); 736 observers.push(observer); 737 }; 738 const init = () => { 739 if (!swiper.params.observer) return; 740 if (swiper.params.observeParents) { 741 const containerParents = elementParents(swiper.hostEl); 742 for (let i = 0; i < containerParents.length; i += 1) { 743 attach(containerParents[i]); 744 } 745 } 746 // Observe container 747 attach(swiper.hostEl, { 748 childList: swiper.params.observeSlideChildren 749 }); 750 751 // Observe wrapper 752 attach(swiper.wrapperEl, { 753 attributes: false 754 }); 755 }; 756 const destroy = () => { 757 observers.forEach(observer => { 758 observer.disconnect(); 759 }); 760 observers.splice(0, observers.length); 761 }; 762 extendParams({ 763 observer: false, 764 observeParents: false, 765 observeSlideChildren: false 766 }); 767 on('init', init); 768 on('destroy', destroy); 769} 770 771/* eslint-disable no-underscore-dangle */ 772 773var eventsEmitter = { 774 on(events, handler, priority) { 775 const self = this; 776 if (!self.eventsListeners || self.destroyed) return self; 777 if (typeof handler !== 'function') return self; 778 const method = priority ? 'unshift' : 'push'; 779 events.split(' ').forEach(event => { 780 if (!self.eventsListeners[event]) self.eventsListeners[event] = []; 781 self.eventsListeners[event][method](handler); 782 }); 783 return self; 784 }, 785 once(events, handler, priority) { 786 const self = this; 787 if (!self.eventsListeners || self.destroyed) return self; 788 if (typeof handler !== 'function') return self; 789 function onceHandler() { 790 self.off(events, onceHandler); 791 if (onceHandler.__emitterProxy) { 792 delete onceHandler.__emitterProxy; 793 } 794 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 795 args[_key] = arguments[_key]; 796 } 797 handler.apply(self, args); 798 } 799 onceHandler.__emitterProxy = handler; 800 return self.on(events, onceHandler, priority); 801 }, 802 onAny(handler, priority) { 803 const self = this; 804 if (!self.eventsListeners || self.destroyed) return self; 805 if (typeof handler !== 'function') return self; 806 const method = priority ? 'unshift' : 'push'; 807 if (self.eventsAnyListeners.indexOf(handler) < 0) { 808 self.eventsAnyListeners[method](handler); 809 } 810 return self; 811 }, 812 offAny(handler) { 813 const self = this; 814 if (!self.eventsListeners || self.destroyed) return self; 815 if (!self.eventsAnyListeners) return self; 816 const index = self.eventsAnyListeners.indexOf(handler); 817 if (index >= 0) { 818 self.eventsAnyListeners.splice(index, 1); 819 } 820 return self; 821 }, 822 off(events, handler) { 823 const self = this; 824 if (!self.eventsListeners || self.destroyed) return self; 825 if (!self.eventsListeners) return self; 826 events.split(' ').forEach(event => { 827 if (typeof handler === 'undefined') { 828 self.eventsListeners[event] = []; 829 } else if (self.eventsListeners[event]) { 830 self.eventsListeners[event].forEach((eventHandler, index) => { 831 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { 832 self.eventsListeners[event].splice(index, 1); 833 } 834 }); 835 } 836 }); 837 return self; 838 }, 839 emit() { 840 const self = this; 841 if (!self.eventsListeners || self.destroyed) return self; 842 if (!self.eventsListeners) return self; 843 let events; 844 let data; 845 let context; 846 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 847 args[_key2] = arguments[_key2]; 848 } 849 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 850 events = args[0]; 851 data = args.slice(1, args.length); 852 context = self; 853 } else { 854 events = args[0].events; 855 data = args[0].data; 856 context = args[0].context || self; 857 } 858 data.unshift(context); 859 const eventsArray = Array.isArray(events) ? events : events.split(' '); 860 eventsArray.forEach(event => { 861 if (self.eventsAnyListeners && self.eventsAnyListeners.length) { 862 self.eventsAnyListeners.forEach(eventHandler => { 863 eventHandler.apply(context, [event, ...data]); 864 }); 865 } 866 if (self.eventsListeners && self.eventsListeners[event]) { 867 self.eventsListeners[event].forEach(eventHandler => { 868 eventHandler.apply(context, data); 869 }); 870 } 871 }); 872 return self; 873 } 874}; 875 876function updateSize() { 877 const swiper = this; 878 let width; 879 let height; 880 const el = swiper.el; 881 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { 882 width = swiper.params.width; 883 } else { 884 width = el.clientWidth; 885 } 886 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { 887 height = swiper.params.height; 888 } else { 889 height = el.clientHeight; 890 } 891 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { 892 return; 893 } 894 895 // Subtract paddings 896 width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10); 897 height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10); 898 if (Number.isNaN(width)) width = 0; 899 if (Number.isNaN(height)) height = 0; 900 Object.assign(swiper, { 901 width, 902 height, 903 size: swiper.isHorizontal() ? width : height 904 }); 905} 906 907function updateSlides() { 908 const swiper = this; 909 function getDirectionPropertyValue(node, label) { 910 return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0); 911 } 912 const params = swiper.params; 913 const { 914 wrapperEl, 915 slidesEl, 916 size: swiperSize, 917 rtlTranslate: rtl, 918 wrongRTL 919 } = swiper; 920 const isVirtual = swiper.virtual && params.virtual.enabled; 921 const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 922 const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`); 923 const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 924 let snapGrid = []; 925 const slidesGrid = []; 926 const slidesSizesGrid = []; 927 let offsetBefore = params.slidesOffsetBefore; 928 if (typeof offsetBefore === 'function') { 929 offsetBefore = params.slidesOffsetBefore.call(swiper); 930 } 931 let offsetAfter = params.slidesOffsetAfter; 932 if (typeof offsetAfter === 'function') { 933 offsetAfter = params.slidesOffsetAfter.call(swiper); 934 } 935 const previousSnapGridLength = swiper.snapGrid.length; 936 const previousSlidesGridLength = swiper.slidesGrid.length; 937 let spaceBetween = params.spaceBetween; 938 let slidePosition = -offsetBefore; 939 let prevSlideSize = 0; 940 let index = 0; 941 if (typeof swiperSize === 'undefined') { 942 return; 943 } 944 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 945 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 946 } else if (typeof spaceBetween === 'string') { 947 spaceBetween = parseFloat(spaceBetween); 948 } 949 swiper.virtualSize = -spaceBetween; 950 951 // reset margins 952 slides.forEach(slideEl => { 953 if (rtl) { 954 slideEl.style.marginLeft = ''; 955 } else { 956 slideEl.style.marginRight = ''; 957 } 958 slideEl.style.marginBottom = ''; 959 slideEl.style.marginTop = ''; 960 }); 961 962 // reset cssMode offsets 963 if (params.centeredSlides && params.cssMode) { 964 setCSSProperty
964(wrapperEl, '--swiper-centered-offset-before', ''); 965 setCSSProperty
vendor: 7,579 bytes, lines 965-1150
965(wrapperEl, '--swiper-centered-offset-after', ''); 966 } 967 const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 968 if (gridEnabled) { 969 swiper.grid.initSlides(slides); 970 } else if (swiper.grid) { 971 swiper.grid.unsetSlides(); 972 } 973 974 // Calc slides 975 let slideSize; 976 const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => { 977 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 978 }).length > 0; 979 for (let i = 0; i < slidesLength; i += 1) { 980 slideSize = 0; 981 let slide; 982 if (slides[i]) slide = slides[i]; 983 if (gridEnabled) { 984 swiper.grid.updateSlide(i, slide, slides); 985 } 986 if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line 987 988 if (params.slidesPerView === 'auto') { 989 if (shouldResetSlideSize) { 990 slides[i].style[swiper.getDirectionLabel('width')] = ``; 991 } 992 const slideStyles = getComputedStyle(slide); 993 const currentTransform = slide.style.transform; 994 const currentWebKitTransform = slide.style.webkitTransform; 995 if (currentTransform) { 996 slide.style.transform = 'none'; 997 } 998 if (currentWebKitTransform) { 999 slide.style.webkitTransform = 'none'; 1000 } 1001 if (params.roundLengths) { 1002 slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true); 1003 } else { 1004 // eslint-disable-next-line 1005 const width = getDirectionPropertyValue(slideStyles, 'width'); 1006 const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 1007 const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 1008 const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 1009 const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 1010 const boxSizing = slideStyles.getPropertyValue('box-sizing'); 1011 if (boxSizing && boxSizing === 'border-box') { 1012 slideSize = width + marginLeft + marginRight; 1013 } else { 1014 const { 1015 clientWidth, 1016 offsetWidth 1017 } = slide; 1018 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 1019 } 1020 } 1021 if (currentTransform) { 1022 slide.style.transform = currentTransform; 1023 } 1024 if (currentWebKitTransform) { 1025 slide.style.webkitTransform = currentWebKitTransform; 1026 } 1027 if (params.roundLengths) slideSize = Math.floor(slideSize); 1028 } else { 1029 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 1030 if (params.roundLengths) slideSize = Math.floor(slideSize); 1031 if (slides[i]) { 1032 slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`; 1033 } 1034 } 1035 if (slides[i]) { 1036 slides[i].swiperSlideSize = slideSize; 1037 } 1038 slidesSizesGrid.push(slideSize); 1039 if (params.centeredSlides) { 1040 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 1041 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 1042 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 1043 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; 1044 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 1045 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 1046 slidesGrid.push(slidePosition); 1047 } else { 1048 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 1049 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 1050 slidesGrid.push(slidePosition); 1051 slidePosition = slidePosition + slideSize + spaceBetween; 1052 } 1053 swiper.virtualSize += slideSize + spaceBetween; 1054 prevSlideSize = slideSize; 1055 index += 1; 1056 } 1057 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 1058 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 1059 wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`; 1060 } 1061 if (params.setWrapperSize) { 1062 wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`; 1063 } 1064 if (gridEnabled) { 1065 swiper.grid.updateWrapperSize(slideSize, snapGrid); 1066 } 1067 1068 // Remove last grid elements depending on width 1069 if (!params.centeredSlides) { 1070 const newSlidesGrid = []; 1071 for (let i = 0; i < snapGrid.length; i += 1) { 1072 let slidesGridItem = snapGrid[i]; 1073 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); 1074 if (snapGrid[i] <= swiper.virtualSize - swiperSize) { 1075 newSlidesGrid.push(slidesGridItem); 1076 } 1077 } 1078 snapGrid = newSlidesGrid; 1079 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 1080 snapGrid.push(swiper.virtualSize - swiperSize); 1081 } 1082 } 1083 if (isVirtual && params.loop) { 1084 const size = slidesSizesGrid[0] + spaceBetween; 1085 if (params.slidesPerGroup > 1) { 1086 const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup); 1087 const groupSize = size * params.slidesPerGroup; 1088 for (let i = 0; i < groups; i += 1) { 1089 snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize); 1090 } 1091 } 1092 for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) { 1093 if (params.slidesPerGroup === 1) { 1094 snapGrid.push(snapGrid[snapGrid.length - 1] + size); 1095 } 1096 slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size); 1097 swiper.virtualSize += size; 1098 } 1099 } 1100 if (snapGrid.length === 0) snapGrid = [0]; 1101 if (spaceBetween !== 0) { 1102 const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight'); 1103 slides.filter((_, slideIndex) => { 1104 if (!params.cssMode || params.loop) return true; 1105 if (slideIndex === slides.length - 1) { 1106 return false; 1107 } 1108 return true; 1109 }).forEach(slideEl => { 1110 slideEl.style[key] = `${spaceBetween}px`; 1111 }); 1112 } 1113 if (params.centeredSlides && params.centeredSlidesBounds) { 1114 let allSlidesSize = 0; 1115 slidesSizesGrid.forEach(slideSizeValue => { 1116 allSlidesSize += slideSizeValue + (spaceBetween || 0); 1117 }); 1118 allSlidesSize -= spaceBetween; 1119 const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0; 1120 snapGrid = snapGrid.map(snap => { 1121 if (snap <= 0) return -offsetBefore; 1122 if (snap > maxSnap) return maxSnap + offsetAfter; 1123 return snap; 1124 }); 1125 } 1126 if (params.centerInsufficientSlides) { 1127 let allSlidesSize = 0; 1128 slidesSizesGrid.forEach(slideSizeValue => { 1129 allSlidesSize += slideSizeValue + (spaceBetween || 0); 1130 }); 1131 allSlidesSize -= spaceBetween; 1132 const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0); 1133 if (allSlidesSize + offsetSize < swiperSize) { 1134 const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2; 1135 snapGrid.forEach((snap, snapIndex) => { 1136 snapGrid[snapIndex] = snap - allSlidesOffset; 1137 }); 1138 slidesGrid.forEach((snap, snapIndex) => { 1139 slidesGrid[snapIndex] = snap + allSlidesOffset; 1140 }); 1141 } 1142 } 1143 Object.assign(swiper, { 1144 slides, 1145 snapGrid, 1146 slidesGrid, 1147 slidesSizesGrid 1148 }); 1149 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 1150 setCSSProperty
1150(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); 1151 setCSSProperty
vendor: 23,179 bytes, lines 1151-1837
1151(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); 1152 const addToSnapGrid = -swiper.snapGrid[0]; 1153 const addToSlidesGrid = -swiper.slidesGrid[0]; 1154 swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid); 1155 swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid); 1156 } 1157 if (slidesLength !== previousSlidesLength) { 1158 swiper.emit('slidesLengthChange'); 1159 } 1160 if (snapGrid.length !== previousSnapGridLength) { 1161 if (swiper.params.watchOverflow) swiper.checkOverflow(); 1162 swiper.emit('snapGridLengthChange'); 1163 } 1164 if (slidesGrid.length !== previousSlidesGridLength) { 1165 swiper.emit('slidesGridLengthChange'); 1166 } 1167 if (params.watchSlidesProgress) { 1168 swiper.updateSlidesOffset(); 1169 } 1170 swiper.emit('slidesUpdated'); 1171 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { 1172 const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`; 1173 const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass); 1174 if (slidesLength <= params.maxBackfaceHiddenSlides) { 1175 if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass); 1176 } else if (hasClassBackfaceClassAdded) { 1177 swiper.el.classList.remove(backFaceHiddenClass); 1178 } 1179 } 1180} 1181 1182function updateAutoHeight(speed) { 1183 const swiper = this; 1184 const activeSlides = []; 1185 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 1186 let newHeight = 0; 1187 let i; 1188 if (typeof speed === 'number') { 1189 swiper.setTransition(speed); 1190 } else if (speed === true) { 1191 swiper.setTransition(swiper.params.speed); 1192 } 1193 const getSlideByIndex = index => { 1194 if (isVirtual) { 1195 return swiper.slides[swiper.getSlideIndexByData(index)]; 1196 } 1197 return swiper.slides[index]; 1198 }; 1199 // Find slides currently in view 1200 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 1201 if (swiper.params.centeredSlides) { 1202 (swiper.visibleSlides || []).forEach(slide => { 1203 activeSlides.push(slide); 1204 }); 1205 } else { 1206 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { 1207 const index = swiper.activeIndex + i; 1208 if (index > swiper.slides.length && !isVirtual) break; 1209 activeSlides.push(getSlideByIndex(index)); 1210 } 1211 } 1212 } else { 1213 activeSlides.push(getSlideByIndex(swiper.activeIndex)); 1214 } 1215 1216 // Find new height from highest slide in view 1217 for (i = 0; i < activeSlides.length; i += 1) { 1218 if (typeof activeSlides[i] !== 'undefined') { 1219 const height = activeSlides[i].offsetHeight; 1220 newHeight = height > newHeight ? height : newHeight; 1221 } 1222 } 1223 1224 // Update Height 1225 if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`; 1226} 1227 1228function updateSlidesOffset() { 1229 const swiper = this; 1230 const slides = swiper.slides; 1231 // eslint-disable-next-line 1232 const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0; 1233 for (let i = 0; i < slides.length; i += 1) { 1234 slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment(); 1235 } 1236} 1237 1238const toggleSlideClasses$1 = (slideEl, condition, className) => { 1239 if (condition && !slideEl.classList.contains(className)) { 1240 slideEl.classList.add(className); 1241 } else if (!condition && slideEl.classList.contains(className)) { 1242 slideEl.classList.remove(className); 1243 } 1244}; 1245function updateSlidesProgress(translate) { 1246 if (translate === void 0) { 1247 translate = this && this.translate || 0; 1248 } 1249 const swiper = this; 1250 const params = swiper.params; 1251 const { 1252 slides, 1253 rtlTranslate: rtl, 1254 snapGrid 1255 } = swiper; 1256 if (slides.length === 0) return; 1257 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 1258 let offsetCenter = -translate; 1259 if (rtl) offsetCenter = translate; 1260 swiper.visibleSlidesIndexes = []; 1261 swiper.visibleSlides = []; 1262 let spaceBetween = params.spaceBetween; 1263 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 1264 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 1265 } else if (typeof spaceBetween === 'string') { 1266 spaceBetween = parseFloat(spaceBetween); 1267 } 1268 for (let i = 0; i < slides.length; i += 1) { 1269 const slide = slides[i]; 1270 let slideOffset = slide.swiperSlideOffset; 1271 if (params.cssMode && params.centeredSlides) { 1272 slideOffset -= slides[0].swiperSlideOffset; 1273 } 1274 const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 1275 const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 1276 const slideBefore = -(offsetCenter - slideOffset); 1277 const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 1278 const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i]; 1279 const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 1280 if (isVisible) { 1281 swiper.visibleSlides.push(slide); 1282 swiper.visibleSlidesIndexes.push(i); 1283 } 1284 toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass); 1285 toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass); 1286 slide.progress = rtl ? -slideProgress : slideProgress; 1287 slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 1288 } 1289} 1290 1291function updateProgress(translate) { 1292 const swiper = this; 1293 if (typeof translate === 'undefined') { 1294 const multiplier = swiper.rtlTranslate ? -1 : 1; 1295 // eslint-disable-next-line 1296 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 1297 } 1298 const params = swiper.params; 1299 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1300 let { 1301 progress, 1302 isBeginning, 1303 isEnd, 1304 progressLoop 1305 } = swiper; 1306 const wasBeginning = isBeginning; 1307 const wasEnd = isEnd; 1308 if (translatesDiff === 0) { 1309 progress = 0; 1310 isBeginning = true; 1311 isEnd = true; 1312 } else { 1313 progress = (translate - swiper.minTranslate()) / translatesDiff; 1314 const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1; 1315 const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1; 1316 isBeginning = isBeginningRounded || progress <= 0; 1317 isEnd = isEndRounded || progress >= 1; 1318 if (isBeginningRounded) progress = 0; 1319 if (isEndRounded) progress = 1; 1320 } 1321 if (params.loop) { 1322 const firstSlideIndex = swiper.getSlideIndexByData(0); 1323 const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1); 1324 const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex]; 1325 const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex]; 1326 const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1]; 1327 const translateAbs = Math.abs(translate); 1328 if (translateAbs >= firstSlideTranslate) { 1329 progressLoop = (translateAbs - firstSlideTranslate) / translateMax; 1330 } else { 1331 progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax; 1332 } 1333 if (progressLoop > 1) progressLoop -= 1; 1334 } 1335 Object.assign(swiper, { 1336 progress, 1337 progressLoop, 1338 isBeginning, 1339 isEnd 1340 }); 1341 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 1342 if (isBeginning && !wasBeginning) { 1343 swiper.emit('reachBeginning toEdge'); 1344 } 1345 if (isEnd && !wasEnd) { 1346 swiper.emit('reachEnd toEdge'); 1347 } 1348 if (wasBeginning && !isBeginning || wasEnd && !isEnd) { 1349 swiper.emit('fromEdge'); 1350 } 1351 swiper.emit('progress', progress); 1352} 1353 1354const toggleSlideClasses = (slideEl, condition, className) => { 1355 if (condition && !slideEl.classList.contains(className)) { 1356 slideEl.classList.add(className); 1357 } else if (!condition && slideEl.classList.contains(className)) { 1358 slideEl.classList.remove(className); 1359 } 1360}; 1361function updateSlidesClasses() { 1362 const swiper = this; 1363 const { 1364 slides, 1365 params, 1366 slidesEl, 1367 activeIndex 1368 } = swiper; 1369 const isVirtual = swiper.virtual && params.virtual.enabled; 1370 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 1371 const getFilteredSlide = selector => { 1372 return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0]; 1373 }; 1374 let activeSlide; 1375 let prevSlide; 1376 let nextSlide; 1377 if (isVirtual) { 1378 if (params.loop) { 1379 let slideIndex = activeIndex - swiper.virtual.slidesBefore; 1380 if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex; 1381 if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length; 1382 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`); 1383 } else { 1384 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`); 1385 } 1386 } else { 1387 if (gridEnabled) { 1388 activeSlide = slides.find(slideEl => slideEl.column === activeIndex); 1389 nextSlide = slides.find(slideEl => slideEl.column === activeIndex + 1); 1390 prevSlide = slides.find(slideEl => slideEl.column === activeIndex - 1); 1391 } else { 1392 activeSlide = slides[activeIndex]; 1393 } 1394 } 1395 if (activeSlide) { 1396 if (!gridEnabled) { 1397 // Next Slide 1398 nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 1399 if (params.loop && !nextSlide) { 1400 nextSlide = slides[0]; 1401 } 1402 1403 // Prev Slide 1404 prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 1405 if (params.loop && !prevSlide === 0) { 1406 prevSlide = slides[slides.length - 1]; 1407 } 1408 } 1409 } 1410 slides.forEach(slideEl => { 1411 toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass); 1412 toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass); 1413 toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass); 1414 }); 1415 swiper.emitSlidesClasses(); 1416} 1417 1418const processLazyPreloader = (swiper, imageEl) => { 1419 if (!swiper || swiper.destroyed || !swiper.params) return; 1420 const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`; 1421 const slideEl = imageEl.closest(slideSelector()); 1422 if (slideEl) { 1423 let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`); 1424 if (!lazyEl && swiper.isElement) { 1425 if (slideEl.shadowRoot) { 1426 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 1427 } else { 1428 // init later 1429 requestAnimationFrame(() => { 1430 if (slideEl.shadowRoot) { 1431 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 1432 if (lazyEl) lazyEl.remove(); 1433 } 1434 }); 1435 } 1436 } 1437 if (lazyEl) lazyEl.remove(); 1438 } 1439}; 1440const unlazy = (swiper, index) => { 1441 if (!swiper.slides[index]) return; 1442 const imageEl = swiper.slides[index].querySelector('[loading="lazy"]'); 1443 if (imageEl) imageEl.removeAttribute('loading'); 1444}; 1445const preload = swiper => { 1446 if (!swiper || swiper.destroyed || !swiper.params) return; 1447 let amount = swiper.params.lazyPreloadPrevNext; 1448 const len = swiper.slides.length; 1449 if (!len || !amount || amount < 0) return; 1450 amount = Math.min(amount, len); 1451 const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView); 1452 const activeIndex = swiper.activeIndex; 1453 if (swiper.params.grid && swiper.params.grid.rows > 1) { 1454 const activeColumn = activeIndex; 1455 const preloadColumns = [activeColumn - amount]; 1456 preloadColumns.push(...Array.from({ 1457 length: amount 1458 }).map((_, i) => { 1459 return activeColumn + slidesPerView + i; 1460 })); 1461 swiper.slides.forEach((slideEl, i) => { 1462 if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i); 1463 }); 1464 return; 1465 } 1466 const slideIndexLastInView = activeIndex + slidesPerView - 1; 1467 if (swiper.params.rewind || swiper.params.loop) { 1468 for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) { 1469 const realIndex = (i % len + len) % len; 1470 if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex); 1471 } 1472 } else { 1473 for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) { 1474 if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) { 1475 unlazy(swiper, i); 1476 } 1477 } 1478 } 1479}; 1480 1481function getActiveIndexByTranslate(swiper) { 1482 const { 1483 slidesGrid, 1484 params 1485 } = swiper; 1486 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 1487 let activeIndex; 1488 for (let i = 0; i < slidesGrid.length; i += 1) { 1489 if (typeof slidesGrid[i + 1] !== 'undefined') { 1490 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { 1491 activeIndex = i; 1492 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { 1493 activeIndex = i + 1; 1494 } 1495 } else if (translate >= slidesGrid[i]) { 1496 activeIndex = i; 1497 } 1498 } 1499 // Normalize slideIndex 1500 if (params.normalizeSlideIndex) { 1501 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 1502 } 1503 return activeIndex; 1504} 1505function updateActiveIndex(newActiveIndex) { 1506 const swiper = this; 1507 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 1508 const { 1509 snapGrid, 1510 params, 1511 activeIndex: previousIndex, 1512 realIndex: previousRealIndex, 1513 snapIndex: previousSnapIndex 1514 } = swiper; 1515 let activeIndex = newActiveIndex; 1516 let snapIndex; 1517 const getVirtualRealIndex = aIndex => { 1518 let realIndex = aIndex - swiper.virtual.slidesBefore; 1519 if (realIndex < 0) { 1520 realIndex = swiper.virtual.slides.length + realIndex; 1521 } 1522 if (realIndex >= swiper.virtual.slides.length) { 1523 realIndex -= swiper.virtual.slides.length; 1524 } 1525 return realIndex; 1526 }; 1527 if (typeof activeIndex === 'undefined') { 1528 activeIndex = getActiveIndexByTranslate(swiper); 1529 } 1530 if (snapGrid.indexOf(translate) >= 0) { 1531 snapIndex = snapGrid.indexOf(translate); 1532 } else { 1533 const skip = Math.min(params.slidesPerGroupSkip, activeIndex); 1534 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 1535 } 1536 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 1537 if (activeIndex === previousIndex && !swiper.params.loop) { 1538 if (snapIndex !== previousSnapIndex) { 1539 swiper.snapIndex = snapIndex; 1540 swiper.emit('snapIndexChange'); 1541 } 1542 return; 1543 } 1544 if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 1545 swiper.realIndex = getVirtualRealIndex(activeIndex); 1546 return; 1547 } 1548 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 1549 1550 // Get real index 1551 let realIndex; 1552 if (swiper.virtual && params.virtual.enabled && params.loop) { 1553 realIndex = getVirtualRealIndex(activeIndex); 1554 } else if (gridEnabled) { 1555 const firstSlideInColumn = swiper.slides.find(slideEl => slideEl.column === activeIndex); 1556 let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10); 1557 if (Number.isNaN(activeSlideIndex)) { 1558 activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0); 1559 } 1560 realIndex = Math.floor(activeSlideIndex / params.grid.rows); 1561 } else if (swiper.slides[activeIndex]) { 1562 const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index'); 1563 if (slideIndex) { 1564 realIndex = parseInt(slideIndex, 10); 1565 } else { 1566 realIndex = activeIndex; 1567 } 1568 } else { 1569 realIndex = activeIndex; 1570 } 1571 Object.assign(swiper, { 1572 previousSnapIndex, 1573 snapIndex, 1574 previousRealIndex, 1575 realIndex, 1576 previousIndex, 1577 activeIndex 1578 }); 1579 if (swiper.initialized) { 1580 preload(swiper); 1581 } 1582 swiper.emit('activeIndexChange'); 1583 swiper.emit('snapIndexChange'); 1584 if (swiper.initialized || swiper.params.runCallbacksOnInit) { 1585 if (previousRealIndex !== realIndex) { 1586 swiper.emit('realIndexChange'); 1587 } 1588 swiper.emit('slideChange'); 1589 } 1590} 1591 1592function updateClickedSlide(el, path) { 1593 const swiper = this; 1594 const params = swiper.params; 1595 let slide = el.closest(`.${params.slideClass}, swiper-slide`); 1596 if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) { 1597 [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => { 1598 if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) { 1599 slide = pathEl; 1600 } 1601 }); 1602 } 1603 let slideFound = false; 1604 let slideIndex; 1605 if (slide) { 1606 for (let i = 0; i < swiper.slides.length; i += 1) { 1607 if (swiper.slides[i] === slide) { 1608 slideFound = true; 1609 slideIndex = i; 1610 break; 1611 } 1612 } 1613 } 1614 if (slide && slideFound) { 1615 swiper.clickedSlide = slide; 1616 if (swiper.virtual && swiper.params.virtual.enabled) { 1617 swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10); 1618 } else { 1619 swiper.clickedIndex = slideIndex; 1620 } 1621 } else { 1622 swiper.clickedSlide = undefined; 1623 swiper.clickedIndex = undefined; 1624 return; 1625 } 1626 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 1627 swiper.slideToClickedSlide(); 1628 } 1629} 1630 1631var update = { 1632 updateSize, 1633 updateSlides, 1634 updateAutoHeight, 1635 updateSlidesOffset, 1636 updateSlidesProgress, 1637 updateProgress, 1638 updateSlidesClasses, 1639 updateActiveIndex, 1640 updateClickedSlide 1641}; 1642 1643function getSwiperTranslate(axis) { 1644 if (axis === void 0) { 1645 axis = this.isHorizontal() ? 'x' : 'y'; 1646 } 1647 const swiper = this; 1648 const { 1649 params, 1650 rtlTranslate: rtl, 1651 translate, 1652 wrapperEl 1653 } = swiper; 1654 if (params.virtualTranslate) { 1655 return rtl ? -translate : translate; 1656 } 1657 if (params.cssMode) { 1658 return translate; 1659 } 1660 let currentTranslate = getTranslate(wrapperEl, axis); 1661 currentTranslate += swiper.cssOverflowAdjustment(); 1662 if (rtl) currentTranslate = -currentTranslate; 1663 return currentTranslate || 0; 1664} 1665 1666function setTranslate(translate, byController) { 1667 const swiper = this; 1668 const { 1669 rtlTranslate: rtl, 1670 params, 1671 wrapperEl, 1672 progress 1673 } = swiper; 1674 let x = 0; 1675 let y = 0; 1676 const z = 0; 1677 if (swiper.isHorizontal()) { 1678 x = rtl ? -translate : translate; 1679 } else { 1680 y = translate; 1681 } 1682 if (params.roundLengths) { 1683 x = Math.floor(x); 1684 y = Math.floor(y); 1685 } 1686 swiper.previousTranslate = swiper.translate; 1687 swiper.translate = swiper.isHorizontal() ? x : y; 1688 if (params.cssMode) { 1689 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 1690 } else if (!params.virtualTranslate) { 1691 if (swiper.isHorizontal()) { 1692 x -= swiper.cssOverflowAdjustment(); 1693 } else { 1694 y -= swiper.cssOverflowAdjustment(); 1695 } 1696 wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`; 1697 } 1698 1699 // Check if we need to update progress 1700 let newProgress; 1701 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1702 if (translatesDiff === 0) { 1703 newProgress = 0; 1704 } else { 1705 newProgress = (translate - swiper.minTranslate()) / translatesDiff; 1706 } 1707 if (newProgress !== progress) { 1708 swiper.updateProgress(translate); 1709 } 1710 swiper.emit('setTranslate', swiper.translate, byController); 1711} 1712 1713function minTranslate() { 1714 return -this.snapGrid[0]; 1715} 1716 1717function maxTranslate() { 1718 return -this.snapGrid[this.snapGrid.length - 1]; 1719} 1720 1721function translateTo(translate, speed, runCallbacks, translateBounds, internal) { 1722 if (translate === void 0) { 1723 translate = 0; 1724 } 1725 if (speed === void 0) { 1726 speed = this.params.speed; 1727 } 1728 if (runCallbacks === void 0) { 1729 runCallbacks = true; 1730 } 1731 if (translateBounds === void 0) { 1732 translateBounds = true; 1733 } 1734 const swiper = this; 1735 const { 1736 params, 1737 wrapperEl 1738 } = swiper; 1739 if (swiper.animating && params.preventInteractionOnTransition) { 1740 return false; 1741 } 1742 const minTranslate = swiper.minTranslate(); 1743 const maxTranslate = swiper.maxTranslate(); 1744 let newTranslate; 1745 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; 1746 1747 // Update progress 1748 swiper.updateProgress(newTranslate); 1749 if (params.cssMode) { 1750 const isH = swiper.isHorizontal(); 1751 if (speed === 0) { 1752 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 1753 } else { 1754 if (!swiper.support.smoothScroll) { 1755 animateCSSModeScroll({ 1756 swiper, 1757 targetPosition: -newTranslate, 1758 side: isH ? 'left' : 'top' 1759 }); 1760 return true; 1761 } 1762 wrapperEl.scrollTo({ 1763 [isH ? 'left' : 'top']: -newTranslate, 1764 behavior: 'smooth' 1765 }); 1766 } 1767 return true; 1768 } 1769 if (speed === 0) { 1770 swiper.setTransition(0); 1771 swiper.setTranslate(newTranslate); 1772 if (runCallbacks) { 1773 swiper.emit('beforeTransitionStart', speed, internal); 1774 swiper.emit('transitionEnd'); 1775 } 1776 } else { 1777 swiper.setTransition(speed); 1778 swiper.setTranslate(newTranslate); 1779 if (runCallbacks) { 1780 swiper.emit('beforeTransitionStart', speed, internal); 1781 swiper.emit('transitionStart'); 1782 } 1783 if (!swiper.animating) { 1784 swiper.animating = true; 1785 if (!swiper.onTranslateToWrapperTransitionEnd) { 1786 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 1787 if (!swiper || swiper.destroyed) return; 1788 if (e.target !== this) return; 1789 swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1790 swiper.onTranslateToWrapperTransitionEnd = null; 1791 delete swiper.onTranslateToWrapperTransitionEnd; 1792 swiper.animating = false; 1793 if (runCallbacks) { 1794 swiper.emit('transitionEnd'); 1795 } 1796 }; 1797 } 1798 swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1799 } 1800 } 1801 return true; 1802} 1803 1804var translate = { 1805 getTranslate: getSwiperTranslate, 1806 setTranslate, 1807 minTranslate, 1808 maxTranslate, 1809 translateTo 1810}; 1811 1812function setTransition(duration, byController) { 1813 const swiper = this; 1814 if (!swiper.params.cssMode) { 1815 swiper.wrapperEl.style.transitionDuration = `${duration}ms`; 1816 swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : ''; 1817 } 1818 swiper.emit('setTransition', duration, byController); 1819} 1820 1821function transitionEmit(_ref) { 1822 let { 1823 swiper, 1824 runCallbacks, 1825 direction, 1826 step 1827 } = _ref; 1828 const { 1829 activeIndex, 1830 previousIndex 1831 } = swiper; 1832 let dir = direction; 1833 if (!dir) { 1834 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; 1835 } 1836 swiper.emit(`transition${step}`); 1837 if (runCallbacks &&
1837activeIndex !== previousIndex) { 1838 if (dir === 'reset') { 1839 swiper.emit(`slideResetTransition${step}`); 1840 return; 1841 }
vendor: 15,449 bytes, lines 1841-2297
1841 1842 swiper.emit(`slideChangeTransition${step}`); 1843 if (dir === 'next') { 1844 swiper.emit(`slideNextTransition${step}`); 1845 } else { 1846 swiper.emit(`slidePrevTransition${step}`); 1847 } 1848 } 1849} 1850 1851function transitionStart(runCallbacks, direction) { 1852 if (runCallbacks === void 0) { 1853 runCallbacks = true; 1854 } 1855 const swiper = this; 1856 const { 1857 params 1858 } = swiper; 1859 if (params.cssMode) return; 1860 if (params.autoHeight) { 1861 swiper.updateAutoHeight(); 1862 } 1863 transitionEmit({ 1864 swiper, 1865 runCallbacks, 1866 direction, 1867 step: 'Start' 1868 }); 1869} 1870 1871function transitionEnd(runCallbacks, direction) { 1872 if (runCallbacks === void 0) { 1873 runCallbacks = true; 1874 } 1875 const swiper = this; 1876 const { 1877 params 1878 } = swiper; 1879 swiper.animating = false; 1880 if (params.cssMode) return; 1881 swiper.setTransition(0); 1882 transitionEmit({ 1883 swiper, 1884 runCallbacks, 1885 direction, 1886 step: 'End' 1887 }); 1888} 1889 1890var transition = { 1891 setTransition, 1892 transitionStart, 1893 transitionEnd 1894}; 1895 1896function slideTo(index, speed, runCallbacks, internal, initial) { 1897 if (index === void 0) { 1898 index = 0; 1899 } 1900 if (runCallbacks === void 0) { 1901 runCallbacks = true; 1902 } 1903 if (typeof index === 'string') { 1904 index = parseInt(index, 10); 1905 } 1906 const swiper = this; 1907 let slideIndex = index; 1908 if (slideIndex < 0) slideIndex = 0; 1909 const { 1910 params, 1911 snapGrid, 1912 slidesGrid, 1913 previousIndex, 1914 activeIndex, 1915 rtlTranslate: rtl, 1916 wrapperEl, 1917 enabled 1918 } = swiper; 1919 if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) { 1920 return false; 1921 } 1922 if (typeof speed === 'undefined') { 1923 speed = swiper.params.speed; 1924 } 1925 const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 1926 let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 1927 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 1928 const translate = -snapGrid[snapIndex]; 1929 // Normalize slideIndex 1930 if (params.normalizeSlideIndex) { 1931 for (let i = 0; i < slidesGrid.length; i += 1) { 1932 const normalizedTranslate = -Math.floor(translate * 100); 1933 const normalizedGrid = Math.floor(slidesGrid[i] * 100); 1934 const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); 1935 if (typeof slidesGrid[i + 1] !== 'undefined') { 1936 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { 1937 slideIndex = i; 1938 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { 1939 slideIndex = i + 1; 1940 } 1941 } else if (normalizedTranslate >= normalizedGrid) { 1942 slideIndex = i; 1943 } 1944 } 1945 } 1946 // Directions locks 1947 if (swiper.initialized && slideIndex !== activeIndex) { 1948 if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) { 1949 return false; 1950 } 1951 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 1952 if ((activeIndex || 0) !== slideIndex) { 1953 return false; 1954 } 1955 } 1956 } 1957 if (slideIndex !== (previousIndex || 0) && runCallbacks) { 1958 swiper.emit('beforeSlideChangeStart'); 1959 } 1960 1961 // Update progress 1962 swiper.updateProgress(translate); 1963 let direction; 1964 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; 1965 1966 // initial virtual 1967 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 1968 const isInitialVirtual = isVirtual && initial; 1969 // Update Index 1970 if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) { 1971 swiper.updateActiveIndex(slideIndex); 1972 // Update Height 1973 if (params.autoHeight) { 1974 swiper.updateAutoHeight(); 1975 } 1976 swiper.updateSlidesClasses(); 1977 if (params.effect !== 'slide') { 1978 swiper.setTranslate(translate); 1979 } 1980 if (direction !== 'reset') { 1981 swiper.transitionStart(runCallbacks, direction); 1982 swiper.transitionEnd(runCallbacks, direction); 1983 } 1984 return false; 1985 } 1986 if (params.cssMode) { 1987 const isH = swiper.isHorizontal(); 1988 const t = rtl ? translate : -translate; 1989 if (speed === 0) { 1990 if (isVirtual) { 1991 swiper.wrapperEl.style.scrollSnapType = 'none'; 1992 swiper._immediateVirtual = true; 1993 } 1994 if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) { 1995 swiper._cssModeVirtualInitialSet = true; 1996 requestAnimationFrame(() => { 1997 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 1998 }); 1999 } else { 2000 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 2001 } 2002 if (isVirtual) { 2003 requestAnimationFrame(() => { 2004 swiper.wrapperEl.style.scrollSnapType = ''; 2005 swiper._immediateVirtual = false; 2006 }); 2007 } 2008 } else { 2009 if (!swiper.support.smoothScroll) { 2010 animateCSSModeScroll({ 2011 swiper, 2012 targetPosition: t, 2013 side: isH ? 'left' : 'top' 2014 }); 2015 return true; 2016 } 2017 wrapperEl.scrollTo({ 2018 [isH ? 'left' : 'top']: t, 2019 behavior: 'smooth' 2020 }); 2021 } 2022 return true; 2023 } 2024 const browser = getBrowser(); 2025 const isSafari = browser.isSafari; 2026 if (isVirtual && !initial && isSafari && swiper.isElement) { 2027 swiper.virtual.update(false, false, slideIndex); 2028 } 2029 swiper.setTransition(speed); 2030 swiper.setTranslate(translate); 2031 swiper.updateActiveIndex(slideIndex); 2032 swiper.updateSlidesClasses(); 2033 swiper.emit('beforeTransitionStart', speed, internal); 2034 swiper.transitionStart(runCallbacks, direction); 2035 if (speed === 0) { 2036 swiper.transitionEnd(runCallbacks, direction); 2037 } else if (!swiper.animating) { 2038 swiper.animating = true; 2039 if (!swiper.onSlideToWrapperTransitionEnd) { 2040 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 2041 if (!swiper || swiper.destroyed) return; 2042 if (e.target !== this) return; 2043 swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 2044 swiper.onSlideToWrapperTransitionEnd = null; 2045 delete swiper.onSlideToWrapperTransitionEnd; 2046 swiper.transitionEnd(runCallbacks, direction); 2047 }; 2048 } 2049 swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 2050 } 2051 return true; 2052} 2053 2054function slideToLoop(index, speed, runCallbacks, internal) { 2055 if (index === void 0) { 2056 index = 0; 2057 } 2058 if (runCallbacks === void 0) { 2059 runCallbacks = true; 2060 } 2061 if (typeof index === 'string') { 2062 const indexAsNumber = parseInt(index, 10); 2063 index = indexAsNumber; 2064 } 2065 const swiper = this; 2066 if (swiper.destroyed) return; 2067 if (typeof speed === 'undefined') { 2068 speed = swiper.params.speed; 2069 } 2070 const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 2071 let newIndex = index; 2072 if (swiper.params.loop) { 2073 if (swiper.virtual && swiper.params.virtual.enabled) { 2074 // eslint-disable-next-line 2075 newIndex = newIndex + swiper.virtual.slidesBefore; 2076 } else { 2077 let targetSlideIndex; 2078 if (gridEnabled) { 2079 const slideIndex = newIndex * swiper.params.grid.rows; 2080 targetSlideIndex = swiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex).column; 2081 } else { 2082 targetSlideIndex = swiper.getSlideIndexByData(newIndex); 2083 } 2084 const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length; 2085 const { 2086 centeredSlides 2087 } = swiper.params; 2088 let slidesPerView = swiper.params.slidesPerView; 2089 if (slidesPerView === 'auto') { 2090 slidesPerView = swiper.slidesPerViewDynamic(); 2091 } else { 2092 slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10)); 2093 if (centeredSlides && slidesPerView % 2 === 0) { 2094 slidesPerView = slidesPerView + 1; 2095 } 2096 } 2097 let needLoopFix = cols - targetSlideIndex < slidesPerView; 2098 if (centeredSlides) { 2099 needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2); 2100 } 2101 if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) { 2102 needLoopFix = false; 2103 } 2104 if (needLoopFix) { 2105 const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev'; 2106 swiper.loopFix({ 2107 direction, 2108 slideTo: true, 2109 activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1, 2110 slideRealIndex: direction === 'next' ? swiper.realIndex : undefined 2111 }); 2112 } 2113 if (gridEnabled) { 2114 const slideIndex = newIndex * swiper.params.grid.rows; 2115 newIndex = swiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex).column; 2116 } else { 2117 newIndex = swiper.getSlideIndexByData(newIndex); 2118 } 2119 } 2120 } 2121 requestAnimationFrame(() => { 2122 swiper.slideTo(newIndex, speed, runCallbacks, internal); 2123 }); 2124 return swiper; 2125} 2126 2127/* eslint no-unused-vars: "off" */ 2128function slideNext(speed, runCallbacks, internal) { 2129 if (runCallbacks === void 0) { 2130 runCallbacks = true; 2131 } 2132 const swiper = this; 2133 const { 2134 enabled, 2135 params, 2136 animating 2137 } = swiper; 2138 if (!enabled || swiper.destroyed) return swiper; 2139 if (typeof speed === 'undefined') { 2140 speed = swiper.params.speed; 2141 } 2142 let perGroup = params.slidesPerGroup; 2143 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 2144 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 2145 } 2146 const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 2147 const isVirtual = swiper.virtual && params.virtual.enabled; 2148 if (params.loop) { 2149 if (animating && !isVirtual && params.loopPreventsSliding) return false; 2150 swiper.loopFix({ 2151 direction: 'next' 2152 }); 2153 // eslint-disable-next-line 2154 swiper._clientLeft = swiper.wrapperEl.clientLeft; 2155 if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) { 2156 requestAnimationFrame(() => { 2157 swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 2158 }); 2159 return true; 2160 } 2161 } 2162 if (params.rewind && swiper.isEnd) { 2163 return swiper.slideTo(0, speed, runCallbacks, internal); 2164 } 2165 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 2166} 2167 2168/* eslint no-unused-vars: "off" */ 2169function slidePrev(speed, runCallbacks, internal) { 2170 if (runCallbacks === void 0) { 2171 runCallbacks = true; 2172 } 2173 const swiper = this; 2174 const { 2175 params, 2176 snapGrid, 2177 slidesGrid, 2178 rtlTranslate, 2179 enabled, 2180 animating 2181 } = swiper; 2182 if (!enabled || swiper.destroyed) return swiper; 2183 if (typeof speed === 'undefined') { 2184 speed = swiper.params.speed; 2185 } 2186 const isVirtual = swiper.virtual && params.virtual.enabled; 2187 if (params.loop) { 2188 if (animating && !isVirtual && params.loopPreventsSliding) return false; 2189 swiper.loopFix({ 2190 direction: 'prev' 2191 }); 2192 // eslint-disable-next-line 2193 swiper._clientLeft = swiper.wrapperEl.clientLeft; 2194 } 2195 const translate = rtlTranslate ? swiper.translate : -swiper.translate; 2196 function normalize(val) { 2197 if (val < 0) return -Math.floor(Math.abs(val)); 2198 return Math.floor(val); 2199 } 2200 const normalizedTranslate = normalize(translate); 2201 const normalizedSnapGrid = snapGrid.map(val => normalize(val)); 2202 const isFreeMode = params.freeMode && params.freeMode.enabled; 2203 let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 2204 if (typeof prevSnap === 'undefined' && (params.cssMode || isFreeMode)) { 2205 let prevSnapIndex; 2206 snapGrid.forEach((snap, snapIndex) => { 2207 if (normalizedTranslate >= snap) { 2208 // prevSnap = snap; 2209 prevSnapIndex = snapIndex; 2210 } 2211 }); 2212 if (typeof prevSnapIndex !== 'undefined') { 2213 prevSnap = isFreeMode ? snapGrid[prevSnapIndex] : snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 2214 } 2215 } 2216 let prevIndex = 0; 2217 if (typeof prevSnap !== 'undefined') { 2218 prevIndex = slidesGrid.indexOf(prevSnap); 2219 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 2220 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 2221 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 2222 prevIndex = Math.max(prevIndex, 0); 2223 } 2224 } 2225 if (params.rewind && swiper.isBeginning) { 2226 const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 2227 return swiper.slideTo(lastIndex, speed, runCallbacks, internal); 2228 } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) { 2229 requestAnimationFrame(() => { 2230 swiper.slideTo(prevIndex, speed, runCallbacks, internal); 2231 }); 2232 return true; 2233 } 2234 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 2235} 2236 2237/* eslint no-unused-vars: "off" */ 2238function slideReset(speed, runCallbacks, internal) { 2239 if (runCallbacks === void 0) { 2240 runCallbacks = true; 2241 } 2242 const swiper = this; 2243 if (swiper.destroyed) return; 2244 if (typeof speed === 'undefined') { 2245 speed = swiper.params.speed; 2246 } 2247 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 2248} 2249 2250/* eslint no-unused-vars: "off" */ 2251function slideToClosest(speed, runCallbacks, internal, threshold) { 2252 if (runCallbacks === void 0) { 2253 runCallbacks = true; 2254 } 2255 if (threshold === void 0) { 2256 threshold = 0.5; 2257 } 2258 const swiper = this; 2259 if (swiper.destroyed) return; 2260 if (typeof speed === 'undefined') { 2261 speed = swiper.params.speed; 2262 } 2263 let index = swiper.activeIndex; 2264 const skip = Math.min(swiper.params.slidesPerGroupSkip, index); 2265 const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); 2266 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 2267 if (translate >= swiper.snapGrid[snapIndex]) { 2268 // The current translate is on or after the current snap index, so the choice 2269 // is between the current index and the one after it. 2270 const currentSnap = swiper.snapGrid[snapIndex]; 2271 const nextSnap = swiper.snapGrid[snapIndex + 1]; 2272 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { 2273 index += swiper.params.slidesPerGroup; 2274 } 2275 } else { 2276 // The current translate is before the current snap index, so the choice 2277 // is between the current index and the one before it. 2278 const prevSnap = swiper.snapGrid[snapIndex - 1]; 2279 const currentSnap = swiper.snapGrid[snapIndex]; 2280 if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) { 2281 index -= swiper.params.slidesPerGroup; 2282 } 2283 } 2284 index = Math.max(index, 0); 2285 index = Math.min(index, swiper.slidesGrid.length - 1); 2286 return swiper.slideTo(index, speed, runCallbacks, internal); 2287} 2288 2289function slideToClickedSlide() { 2290 const swiper = this; 2291 if (swiper.destroyed) return; 2292 const { 2293 params, 2294 slidesEl 2295 } = swiper; 2296 const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 2297 let slideToIndex = swiper.
vendor: 6,784 bytes, lines 2297-2469
2297clickedIndex; 2298 let realIndex; 2299 const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`; 2300 if (params.loop) { 2301 if (swiper.animating) return; 2302 realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 2303 if (params.centeredSlides) { 2304 if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) { 2305 swiper.loopFix(); 2306 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); 2307 nextTick(() => { 2308 swiper.slideTo(slideToIndex); 2309 }); 2310 } else { 2311 swiper.slideTo(slideToIndex); 2312 } 2313 } else if (slideToIndex > swiper.slides.length - slidesPerView) { 2314 swiper.loopFix(); 2315 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); 2316 nextTick(() => { 2317 swiper.slideTo(slideToIndex); 2318 }); 2319 } else { 2320 swiper.slideTo(slideToIndex); 2321 } 2322 } else { 2323 swiper.slideTo(slideToIndex); 2324 } 2325} 2326 2327var slide = { 2328 slideTo, 2329 slideToLoop, 2330 slideNext, 2331 slidePrev, 2332 slideReset, 2333 slideToClosest, 2334 slideToClickedSlide 2335}; 2336 2337function loopCreate(slideRealIndex) { 2338 const swiper = this; 2339 const { 2340 params, 2341 slidesEl 2342 } = swiper; 2343 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 2344 const initSlides = () => { 2345 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 2346 slides.forEach((el, index) => { 2347 el.setAttribute('data-swiper-slide-index', index); 2348 }); 2349 }; 2350 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2351 const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1); 2352 const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0; 2353 const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0; 2354 const addBlankSlides = amountOfSlides => { 2355 for (let i = 0; i < amountOfSlides; i += 1) { 2356 const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]); 2357 swiper.slidesEl.append(slideEl); 2358 } 2359 }; 2360 if (shouldFillGroup) { 2361 if (params.loopAddBlankSlides) { 2362 const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup; 2363 addBlankSlides(slidesToAdd); 2364 swiper.recalcSlides(); 2365 swiper.updateSlides(); 2366 } else { 2367 showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)'); 2368 } 2369 initSlides(); 2370 } else if (shouldFillGrid) { 2371 if (params.loopAddBlankSlides) { 2372 const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows; 2373 addBlankSlides(slidesToAdd); 2374 swiper.recalcSlides(); 2375 swiper.updateSlides(); 2376 } else { 2377 showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)'); 2378 } 2379 initSlides(); 2380 } else { 2381 initSlides(); 2382 } 2383 swiper.loopFix({ 2384 slideRealIndex, 2385 direction: params.centeredSlides ? undefined : 'next' 2386 }); 2387} 2388 2389function loopFix(_temp) { 2390 let { 2391 slideRealIndex, 2392 slideTo = true, 2393 direction, 2394 setTranslate, 2395 activeSlideIndex, 2396 byController, 2397 byMousewheel 2398 } = _temp === void 0 ? {} : _temp; 2399 const swiper = this; 2400 if (!swiper.params.loop) return; 2401 swiper.emit('beforeLoopFix'); 2402 const { 2403 slides, 2404 allowSlidePrev, 2405 allowSlideNext, 2406 slidesEl, 2407 params 2408 } = swiper; 2409 const { 2410 centeredSlides 2411 } = params; 2412 swiper.allowSlidePrev = true; 2413 swiper.allowSlideNext = true; 2414 if (swiper.virtual && params.virtual.enabled) { 2415 if (slideTo) { 2416 if (!params.centeredSlides && swiper.snapIndex === 0) { 2417 swiper.slideTo(swiper.virtual.slides.length, 0, false, true); 2418 } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) { 2419 swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true); 2420 } else if (swiper.snapIndex === swiper.snapGrid.length - 1) { 2421 swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true); 2422 } 2423 } 2424 swiper.allowSlidePrev = allowSlidePrev; 2425 swiper.allowSlideNext = allowSlideNext; 2426 swiper.emit('loopFix'); 2427 return; 2428 } 2429 let slidesPerView = params.slidesPerView; 2430 if (slidesPerView === 'auto') { 2431 slidesPerView = swiper.slidesPerViewDynamic(); 2432 } else { 2433 slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10)); 2434 if (centeredSlides && slidesPerView % 2 === 0) { 2435 slidesPerView = slidesPerView + 1; 2436 } 2437 } 2438 const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup; 2439 let loopedSlides = slidesPerGroup; 2440 if (loopedSlides % slidesPerGroup !== 0) { 2441 loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup; 2442 } 2443 loopedSlides += params.loopAdditionalSlides; 2444 swiper.loopedSlides = loopedSlides; 2445 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2446 if (slides.length < slidesPerView + loopedSlides) { 2447 showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters'); 2448 } else if (gridEnabled && params.grid.fill === 'row') { 2449 showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`'); 2450 } 2451 const prependSlidesIndexes = []; 2452 const appendSlidesIndexes = []; 2453 let activeIndex = swiper.activeIndex; 2454 if (typeof activeSlideIndex === 'undefined') { 2455 activeSlideIndex = swiper.getSlideIndex(slides.find(el => el.classList.contains(params.slideActiveClass))); 2456 } else { 2457 activeIndex = activeSlideIndex; 2458 } 2459 const isNext = direction === 'next' || !direction; 2460 const isPrev = direction === 'prev' || !direction; 2461 let slidesPrepended = 0; 2462 let slidesAppended = 0; 2463 const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length; 2464 const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex; 2465 const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0); 2466 // prepend last slides before start 2467 if (activeColIndexWithShift < loopedSlides) { 2468 slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup); 2469 for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
vendor: 5,179 bytes, lines 2470-2602
2470 const index = i - Math.floor(i / cols) * cols; 2471 if (gridEnabled) { 2472 const colIndexToPrepend = cols - index - 1; 2473 for (let i = slides.length - 1; i >= 0; i -= 1) { 2474 if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i); 2475 } 2476 // slides.forEach((slide, slideIndex) => { 2477 // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex); 2478 // }); 2479 } else { 2480 prependSlidesIndexes.push(cols - index - 1); 2481 } 2482 } 2483 } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { 2484 slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); 2485 for (let i = 0; i < slidesAppended; i += 1) { 2486 const index = i - Math.floor(i / cols) * cols; 2487 if (gridEnabled) { 2488 slides.forEach((slide, slideIndex) => { 2489 if (slide.column === index) appendSlidesIndexes.push(slideIndex); 2490 }); 2491 } else { 2492 appendSlidesIndexes.push(index); 2493 } 2494 } 2495 } 2496 swiper.__preventObserver__ = true; 2497 requestAnimationFrame(() => { 2498 swiper.__preventObserver__ = false; 2499 }); 2500 if (isPrev) { 2501 prependSlidesIndexes.forEach(index => { 2502 slides[index].swiperLoopMoveDOM = true; 2503 slidesEl.prepend(slides[index]); 2504 slides[index].swiperLoopMoveDOM = false; 2505 }); 2506 } 2507 if (isNext) { 2508 appendSlidesIndexes.forEach(index => { 2509 slides[index].swiperLoopMoveDOM = true; 2510 slidesEl.append(slides[index]); 2511 slides[index].swiperLoopMoveDOM = false; 2512 }); 2513 } 2514 swiper.recalcSlides(); 2515 if (params.slidesPerView === 'auto') { 2516 swiper.updateSlides(); 2517 } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) { 2518 swiper.slides.forEach((slide, slideIndex) => { 2519 swiper.grid.updateSlide(slideIndex, slide, swiper.slides); 2520 }); 2521 } 2522 if (params.watchSlidesProgress) { 2523 swiper.updateSlidesOffset(); 2524 } 2525 if (slideTo) { 2526 if (prependSlidesIndexes.length > 0 && isPrev) { 2527 if (typeof slideRealIndex === 'undefined') { 2528 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 2529 const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended]; 2530 const diff = newSlideTranslate - currentSlideTranslate; 2531 if (byMousewheel) { 2532 swiper.setTranslate(swiper.translate - diff); 2533 } else { 2534 swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true); 2535 if (setTranslate) { 2536 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 2537 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 2538 } 2539 } 2540 } else { 2541 if (setTranslate) { 2542 const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length; 2543 swiper.slideTo(swiper.activeIndex + shift, 0, false, true); 2544 swiper.touchEventsData.currentTranslate = swiper.translate; 2545 } 2546 } 2547 } else if (appendSlidesIndexes.length > 0 && isNext) { 2548 if (typeof slideRealIndex === 'undefined') { 2549 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 2550 const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended]; 2551 const diff = newSlideTranslate - currentSlideTranslate; 2552 if (byMousewheel) { 2553 swiper.setTranslate(swiper.translate - diff); 2554 } else { 2555 swiper.slideTo(activeIndex - slidesAppended, 0, false, true); 2556 if (setTranslate) { 2557 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 2558 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 2559 } 2560 } 2561 } else { 2562 const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length; 2563 swiper.slideTo(swiper.activeIndex - shift, 0, false, true); 2564 } 2565 } 2566 } 2567 swiper.allowSlidePrev = allowSlidePrev; 2568 swiper.allowSlideNext = allowSlideNext; 2569 if (swiper.controller && swiper.controller.control && !byController) { 2570 const loopParams = { 2571 slideRealIndex, 2572 direction, 2573 setTranslate, 2574 activeSlideIndex, 2575 byController: true 2576 }; 2577 if (Array.isArray(swiper.controller.control)) { 2578 swiper.controller.control.forEach(c => { 2579 if (!c.destroyed && c.params.loop) c.loopFix({ 2580 ...loopParams, 2581 slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false 2582 }); 2583 }); 2584 } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) { 2585 swiper.controller.control.loopFix({ 2586 ...loopParams, 2587 slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false 2588 }); 2589 } 2590 } 2591 swiper.emit('loopFix'); 2592} 2593 2594function loopDestroy() { 2595 const swiper = this; 2596 const { 2597 params, 2598 slidesEl 2599 } = swiper; 2600 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 2601 swiper.recalcSlides(); 2602 const newSlidesOrder = [];
vendor: 5,200 bytes, lines 2603-2768
2603 swiper.slides.forEach(slideEl => { 2604 const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex; 2605 newSlidesOrder[index] = slideEl; 2606 }); 2607 swiper.slides.forEach(slideEl => { 2608 slideEl.removeAttribute('data-swiper-slide-index'); 2609 }); 2610 newSlidesOrder.forEach(slideEl => { 2611 slidesEl.append(slideEl); 2612 }); 2613 swiper.recalcSlides(); 2614 swiper.slideTo(swiper.realIndex, 0); 2615} 2616 2617var loop = { 2618 loopCreate, 2619 loopFix, 2620 loopDestroy 2621}; 2622 2623function setGrabCursor(moving) { 2624 const swiper = this; 2625 if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 2626 const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 2627 if (swiper.isElement) { 2628 swiper.__preventObserver__ = true; 2629 } 2630 el.style.cursor = 'move'; 2631 el.style.cursor = moving ? 'grabbing' : 'grab'; 2632 if (swiper.isElement) { 2633 requestAnimationFrame(() => { 2634 swiper.__preventObserver__ = false; 2635 }); 2636 } 2637} 2638 2639function unsetGrabCursor() { 2640 const swiper = this; 2641 if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { 2642 return; 2643 } 2644 if (swiper.isElement) { 2645 swiper.__preventObserver__ = true; 2646 } 2647 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 2648 if (swiper.isElement) { 2649 requestAnimationFrame(() => { 2650 swiper.__preventObserver__ = false; 2651 }); 2652 } 2653} 2654 2655var grabCursor = { 2656 setGrabCursor, 2657 unsetGrabCursor 2658}; 2659 2660// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd 2661function closestElement(selector, base) { 2662 if (base === void 0) { 2663 base = this; 2664 } 2665 function __closestFrom(el) { 2666 if (!el || el === getDocument() || el === getWindow()) return null; 2667 if (el.assignedSlot) el = el.assignedSlot; 2668 const found = el.closest(selector); 2669 if (!found && !el.getRootNode) { 2670 return null; 2671 } 2672 return found || __closestFrom(el.getRootNode().host); 2673 } 2674 return __closestFrom(base); 2675} 2676function preventEdgeSwipe(swiper, event, startX) { 2677 const window = getWindow(); 2678 const { 2679 params 2680 } = swiper; 2681 const edgeSwipeDetection = params.edgeSwipeDetection; 2682 const edgeSwipeThreshold = params.edgeSwipeThreshold; 2683 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { 2684 if (edgeSwipeDetection === 'prevent') { 2685 event.preventDefault(); 2686 return true; 2687 } 2688 return false; 2689 } 2690 return true; 2691} 2692function onTouchStart(event) { 2693 const swiper = this; 2694 const document = getDocument(); 2695 let e = event; 2696 if (e.originalEvent) e = e.originalEvent; 2697 const data = swiper.touchEventsData; 2698 if (e.type === 'pointerdown') { 2699 if (data.pointerId !== null && data.pointerId !== e.pointerId) { 2700 return; 2701 } 2702 data.pointerId = e.pointerId; 2703 } else if (e.type === 'touchstart' && e.targetTouches.length === 1) { 2704 data.touchId = e.targetTouches[0].identifier; 2705 } 2706 if (e.type === 'touchstart') { 2707 // don't proceed touch event 2708 preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX); 2709 return; 2710 } 2711 const { 2712 params, 2713 touches, 2714 enabled 2715 } = swiper; 2716 if (!enabled) return; 2717 if (!params.simulateTouch && e.pointerType === 'mouse') return; 2718 if (swiper.animating && params.preventInteractionOnTransition) { 2719 return; 2720 } 2721 if (!swiper.animating && params.cssMode && params.loop) { 2722 swiper.loopFix(); 2723 } 2724 let targetEl = e.target; 2725 if (params.touchEventsTarget === 'wrapper') { 2726 if (!elementIsChildOf(targetEl, swiper.wrapperEl)) return; 2727 } 2728 if ('which' in e && e.which === 3) return; 2729 if ('button' in e && e.button > 0) return; 2730 if (data.isTouched && data.isMoved) return; 2731 2732 // change target el for shadow root component 2733 const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; 2734 // eslint-disable-next-line 2735 const eventPath = e.composedPath ? e.composedPath() : e.path; 2736 if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) { 2737 targetEl = eventPath[0]; 2738 } 2739 const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; 2740 const isTargetShadow = !!(e.target && e.target.shadowRoot); 2741 2742 // use closestElement for shadow root element to get the actual closest for nested shadow root element 2743 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) { 2744 swiper.allowClick = true; 2745 return; 2746 } 2747 if (params.swipeHandler) { 2748 if (!targetEl.closest(params.swipeHandler)) return; 2749 } 2750 touches.currentX = e.pageX; 2751 touches.currentY = e.pageY; 2752 const startX = touches.currentX; 2753 const startY = touches.currentY; 2754 2755 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 2756 2757 if (!preventEdgeSwipe(swiper, e, startX)) { 2758 return; 2759 } 2760 Object.assign(data, { 2761 isTouched: true, 2762 isMoved: false, 2763 allowTouchCallbacks: true, 2764 isScrolling: undefined, 2765 startMoving: undefined 2766 }); 2767 touches.startX = startX; 2768 touches.startY = startY;
vendor: 3,004 bytes, lines 2769-2856
2769 data.touchStartTime = now(); 2770 swiper.allowClick = true; 2771 swiper.updateSize(); 2772 swiper.swipeDirection = undefined; 2773 if (params.threshold > 0) data.allowThresholdMove = false; 2774 let preventDefault = true; 2775 if (targetEl.matches(data.focusableElements)) { 2776 preventDefault = false; 2777 if (targetEl.nodeName === 'SELECT') { 2778 data.isTouched = false; 2779 } 2780 } 2781 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl && (e.pointerType === 'mouse' || e.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements))) { 2782 document.activeElement.blur(); 2783 } 2784 const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 2785 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) { 2786 e.preventDefault(); 2787 } 2788 if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { 2789 swiper.freeMode.onTouchStart(); 2790 } 2791 swiper.emit('touchStart', e); 2792} 2793 2794function onTouchMove(event) { 2795 const document = getDocument(); 2796 const swiper = this; 2797 const data = swiper.touchEventsData; 2798 const { 2799 params, 2800 touches, 2801 rtlTranslate: rtl, 2802 enabled 2803 } = swiper; 2804 if (!enabled) return; 2805 if (!params.simulateTouch && event.pointerType === 'mouse') return; 2806 let e = event; 2807 if (e.originalEvent) e = e.originalEvent; 2808 if (e.type === 'pointermove') { 2809 if (data.touchId !== null) return; // return from pointer if we use touch 2810 const id = e.pointerId; 2811 if (id !== data.pointerId) return; 2812 } 2813 let targetTouch; 2814 if (e.type === 'touchmove') { 2815 targetTouch = [...e.changedTouches].find(t => t.identifier === data.touchId); 2816 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 2817 } else { 2818 targetTouch = e; 2819 } 2820 if (!data.isTouched) { 2821 if (data.startMoving && data.isScrolling) { 2822 swiper.emit('touchMoveOpposite', e); 2823 } 2824 return; 2825 } 2826 const pageX = targetTouch.pageX; 2827 const pageY = targetTouch.pageY; 2828 if (e.preventedByNestedSwiper) { 2829 touches.startX = pageX; 2830 touches.startY = pageY; 2831 return; 2832 } 2833 if (!swiper.allowTouchMove) { 2834 if (!e.target.matches(data.focusableElements)) { 2835 swiper.allowClick = false; 2836 } 2837 if (data.isTouched) { 2838 Object.assign(touches, { 2839 startX: pageX, 2840 startY: pageY, 2841 currentX: pageX, 2842 currentY: pageY 2843 }); 2844 data.touchStartTime = now(); 2845 } 2846 return; 2847 } 2848 if (params.touchReleaseOnEdges && !params.loop) { 2849 if (swiper.isVertical()) { 2850 // Vertical 2851 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 2852 data.isTouched = false; 2853 data.isMoved = false; 2854 return; 2855 } 2856 } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate(
vendor: 13,442 bytes, lines 2856-3221
2856)) { 2857 return; 2858 } 2859 } 2860 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== e.target && e.pointerType !== 'mouse') { 2861 document.activeElement.blur(); 2862 } 2863 if (document.activeElement) { 2864 if (e.target === document.activeElement && e.target.matches(data.focusableElements)) { 2865 data.isMoved = true; 2866 swiper.allowClick = false; 2867 return; 2868 } 2869 } 2870 if (data.allowTouchCallbacks) { 2871 swiper.emit('touchMove', e); 2872 } 2873 touches.previousX = touches.currentX; 2874 touches.previousY = touches.currentY; 2875 touches.currentX = pageX; 2876 touches.currentY = pageY; 2877 const diffX = touches.currentX - touches.startX; 2878 const diffY = touches.currentY - touches.startY; 2879 if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; 2880 if (typeof data.isScrolling === 'undefined') { 2881 let touchAngle; 2882 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { 2883 data.isScrolling = false; 2884 } else { 2885 // eslint-disable-next-line 2886 if (diffX * diffX + diffY * diffY >= 25) { 2887 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 2888 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 2889 } 2890 } 2891 } 2892 if (data.isScrolling) { 2893 swiper.emit('touchMoveOpposite', e); 2894 } 2895 if (typeof data.startMoving === 'undefined') { 2896 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 2897 data.startMoving = true; 2898 } 2899 } 2900 if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) { 2901 data.isTouched = false; 2902 return; 2903 } 2904 if (!data.startMoving) { 2905 return; 2906 } 2907 swiper.allowClick = false; 2908 if (!params.cssMode && e.cancelable) { 2909 e.preventDefault(); 2910 } 2911 if (params.touchMoveStopPropagation && !params.nested) { 2912 e.stopPropagation(); 2913 } 2914 let diff = swiper.isHorizontal() ? diffX : diffY; 2915 let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY; 2916 if (params.oneWayMovement) { 2917 diff = Math.abs(diff) * (rtl ? 1 : -1); 2918 touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1); 2919 } 2920 touches.diff = diff; 2921 diff *= params.touchRatio; 2922 if (rtl) { 2923 diff = -diff; 2924 touchesDiff = -touchesDiff; 2925 } 2926 const prevTouchesDirection = swiper.touchesDirection; 2927 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 2928 swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next'; 2929 const isLoop = swiper.params.loop && !params.cssMode; 2930 const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev; 2931 if (!data.isMoved) { 2932 if (isLoop && allowLoopFix) { 2933 swiper.loopFix({ 2934 direction: swiper.swipeDirection 2935 }); 2936 } 2937 data.startTranslate = swiper.getTranslate(); 2938 swiper.setTransition(0); 2939 if (swiper.animating) { 2940 const evt = new window.CustomEvent('transitionend', { 2941 bubbles: true, 2942 cancelable: true, 2943 detail: { 2944 bySwiperTouchMove: true 2945 } 2946 }); 2947 swiper.wrapperEl.dispatchEvent(evt); 2948 } 2949 data.allowMomentumBounce = false; 2950 // Grab Cursor 2951 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 2952 swiper.setGrabCursor(true); 2953 } 2954 swiper.emit('sliderFirstMove', e); 2955 } 2956 let loopFixed; 2957 new Date().getTime(); 2958 if (params._loopSwapReset !== false && data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) { 2959 Object.assign(touches, { 2960 startX: pageX, 2961 startY: pageY, 2962 currentX: pageX, 2963 currentY: pageY, 2964 startTranslate: data.currentTranslate 2965 }); 2966 data.loopSwapReset = true; 2967 data.startTranslate = data.currentTranslate; 2968 return; 2969 } 2970 swiper.emit('sliderMove', e); 2971 data.isMoved = true; 2972 data.currentTranslate = diff + data.startTranslate; 2973 let disableParentSwiper = true; 2974 let resistanceRatio = params.resistanceRatio; 2975 if (params.touchReleaseOnEdges) { 2976 resistanceRatio = 0; 2977 } 2978 if (diff > 0) { 2979 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] - (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween : 0) - swiper.params.spaceBetween : swiper.minTranslate())) { 2980 swiper.loopFix({ 2981 direction: 'prev', 2982 setTranslate: true, 2983 activeSlideIndex: 0 2984 }); 2985 } 2986 if (data.currentTranslate > swiper.minTranslate()) { 2987 disableParentSwiper = false; 2988 if (params.resistance) { 2989 data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; 2990 } 2991 } 2992 } else if (diff < 0) { 2993 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween + (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween : 0) : swiper.maxTranslate())) { 2994 swiper.loopFix({ 2995 direction: 'next', 2996 setTranslate: true, 2997 activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10))) 2998 }); 2999 } 3000 if (data.currentTranslate < swiper.maxTranslate()) { 3001 disableParentSwiper = false; 3002 if (params.resistance) { 3003 data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; 3004 } 3005 } 3006 } 3007 if (disableParentSwiper) { 3008 e.preventedByNestedSwiper = true; 3009 } 3010 3011 // Directions locks 3012 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 3013 data.currentTranslate = data.startTranslate; 3014 } 3015 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 3016 data.currentTranslate = data.startTranslate; 3017 } 3018 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { 3019 data.currentTranslate = data.startTranslate; 3020 } 3021 3022 // Threshold 3023 if (params.threshold > 0) { 3024 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 3025 if (!data.allowThresholdMove) { 3026 data.allowThresholdMove = true; 3027 touches.startX = touches.currentX; 3028 touches.startY = touches.currentY; 3029 data.currentTranslate = data.startTranslate; 3030 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 3031 return; 3032 } 3033 } else { 3034 data.currentTranslate = data.startTranslate; 3035 return; 3036 } 3037 } 3038 if (!params.followFinger || params.cssMode) return; 3039 3040 // Update active index in free mode 3041 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 3042 swiper.updateActiveIndex(); 3043 swiper.updateSlidesClasses(); 3044 } 3045 if (params.freeMode && params.freeMode.enabled && swiper.freeMode) { 3046 swiper.freeMode.onTouchMove(); 3047 } 3048 // Update progress 3049 swiper.updateProgress(data.currentTranslate); 3050 // Update translate 3051 swiper.setTranslate(data.currentTranslate); 3052} 3053 3054function onTouchEnd(event) { 3055 const swiper = this; 3056 const data = swiper.touchEventsData; 3057 let e = event; 3058 if (e.originalEvent) e = e.originalEvent; 3059 let targetTouch; 3060 const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel'; 3061 if (!isTouchEvent) { 3062 if (data.touchId !== null) return; // return from pointer if we use touch 3063 if (e.pointerId !== data.pointerId) return; 3064 targetTouch = e; 3065 } else { 3066 targetTouch = [...e.changedTouches].find(t => t.identifier === data.touchId); 3067 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 3068 } 3069 if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) { 3070 const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView); 3071 if (!proceed) { 3072 return; 3073 } 3074 } 3075 data.pointerId = null; 3076 data.touchId = null; 3077 const { 3078 params, 3079 touches, 3080 rtlTranslate: rtl, 3081 slidesGrid, 3082 enabled 3083 } = swiper; 3084 if (!enabled) return; 3085 if (!params.simulateTouch && e.pointerType === 'mouse') return; 3086 if (data.allowTouchCallbacks) { 3087 swiper.emit('touchEnd', e); 3088 } 3089 data.allowTouchCallbacks = false; 3090 if (!data.isTouched) { 3091 if (data.isMoved && params.grabCursor) { 3092 swiper.setGrabCursor(false); 3093 } 3094 data.isMoved = false; 3095 data.startMoving = false; 3096 return; 3097 } 3098 3099 // Return Grab Cursor 3100 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 3101 swiper.setGrabCursor(false); 3102 } 3103 3104 // Time diff 3105 const touchEndTime = now(); 3106 const timeDiff = touchEndTime - data.touchStartTime; 3107 3108 // Tap, doubleTap, Click 3109 if (swiper.allowClick) { 3110 const pathTree = e.path || e.composedPath && e.composedPath(); 3111 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree); 3112 swiper.emit('tap click', e); 3113 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { 3114 swiper.emit('doubleTap doubleClick', e); 3115 } 3116 } 3117 data.lastClickTime = now(); 3118 nextTick(() => { 3119 if (!swiper.destroyed) swiper.allowClick = true; 3120 }); 3121 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) { 3122 data.isTouched = false; 3123 data.isMoved = false; 3124 data.startMoving = false; 3125 return; 3126 } 3127 data.isTouched = false; 3128 data.isMoved = false; 3129 data.startMoving = false; 3130 let currentPos; 3131 if (params.followFinger) { 3132 currentPos = rtl ? swiper.translate : -swiper.translate; 3133 } else { 3134 currentPos = -data.currentTranslate; 3135 } 3136 if (params.cssMode) { 3137 return; 3138 } 3139 if (params.freeMode && params.freeMode.enabled) { 3140 swiper.freeMode.onTouchEnd({ 3141 currentPos 3142 }); 3143 return; 3144 } 3145 3146 // Find current slide 3147 const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop; 3148 let stopIndex = 0; 3149 let groupSize = swiper.slidesSizesGrid[0]; 3150 for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { 3151 const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 3152 if (typeof slidesGrid[i + increment] !== 'undefined') { 3153 if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { 3154 stopIndex = i; 3155 groupSize = slidesGrid[i + increment] - slidesGrid[i]; 3156 } 3157 } else if (swipeToLast || currentPos >= slidesGrid[i]) { 3158 stopIndex = i; 3159 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 3160 } 3161 } 3162 let rewindFirstIndex = null; 3163 let rewindLastIndex = null; 3164 if (params.rewind) { 3165 if (swiper.isBeginning) { 3166 rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 3167 } else if (swiper.isEnd) { 3168 rewindFirstIndex = 0; 3169 } 3170 } 3171 // Find current slide size 3172 const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 3173 const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 3174 if (timeDiff > params.longSwipesMs) { 3175 // Long touches 3176 if (!params.longSwipes) { 3177 swiper.slideTo(swiper.activeIndex); 3178 return; 3179 } 3180 if (swiper.swipeDirection === 'next') { 3181 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex); 3182 } 3183 if (swiper.swipeDirection === 'prev') { 3184 if (ratio > 1 - params.longSwipesRatio) { 3185 swiper.slideTo(stopIndex + increment); 3186 } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { 3187 swiper.slideTo(rewindLastIndex); 3188 } else { 3189 swiper.slideTo(stopIndex); 3190 } 3191 } 3192 } else { 3193 // Short swipes 3194 if (!params.shortSwipes) { 3195 swiper.slideTo(swiper.activeIndex); 3196 return; 3197 } 3198 const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 3199 if (!isNavButtonTarget) { 3200 if (swiper.swipeDirection === 'next') { 3201 swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); 3202 } 3203 if (swiper.swipeDirection === 'prev') { 3204 swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); 3205 } 3206 } else if (e.target === swiper.navigation.nextEl) { 3207 swiper.slideTo(stopIndex + increment); 3208 } else { 3209 swiper.slideTo(stopIndex); 3210 } 3211 } 3212} 3213 3214function onResize() { 3215 const swiper = this; 3216 const { 3217 params, 3218 el 3219 } = swiper; 3220 if (el && el.offsetWidth === 0) return; 3221
vendor: 8,547 bytes, lines 3222-3488
3222 // Breakpoints 3223 if (params.breakpoints) { 3224 swiper.setBreakpoint(); 3225 } 3226 3227 // Save locks 3228 const { 3229 allowSlideNext, 3230 allowSlidePrev, 3231 snapGrid 3232 } = swiper; 3233 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 3234 3235 // Disable locks on resize 3236 swiper.allowSlideNext = true; 3237 swiper.allowSlidePrev = true; 3238 swiper.updateSize(); 3239 swiper.updateSlides(); 3240 swiper.updateSlidesClasses(); 3241 const isVirtualLoop = isVirtual && params.loop; 3242 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) { 3243 swiper.slideTo(swiper.slides.length - 1, 0, false, true); 3244 } else { 3245 if (swiper.params.loop && !isVirtual) { 3246 swiper.slideToLoop(swiper.realIndex, 0, false, true); 3247 } else { 3248 swiper.slideTo(swiper.activeIndex, 0, false, true); 3249 } 3250 } 3251 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 3252 clearTimeout(swiper.autoplay.resizeTimeout); 3253 swiper.autoplay.resizeTimeout = setTimeout(() => { 3254 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 3255 swiper.autoplay.resume(); 3256 } 3257 }, 500); 3258 } 3259 // Return locks after resize 3260 swiper.allowSlidePrev = allowSlidePrev; 3261 swiper.allowSlideNext = allowSlideNext; 3262 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 3263 swiper.checkOverflow(); 3264 } 3265} 3266 3267function onClick(e) { 3268 const swiper = this; 3269 if (!swiper.enabled) return; 3270 if (!swiper.allowClick) { 3271 if (swiper.params.preventClicks) e.preventDefault(); 3272 if (swiper.params.preventClicksPropagation && swiper.animating) { 3273 e.stopPropagation(); 3274 e.stopImmediatePropagation(); 3275 } 3276 } 3277} 3278 3279function onScroll() { 3280 const swiper = this; 3281 const { 3282 wrapperEl, 3283 rtlTranslate, 3284 enabled 3285 } = swiper; 3286 if (!enabled) return; 3287 swiper.previousTranslate = swiper.translate; 3288 if (swiper.isHorizontal()) { 3289 swiper.translate = -wrapperEl.scrollLeft; 3290 } else { 3291 swiper.translate = -wrapperEl.scrollTop; 3292 } 3293 // eslint-disable-next-line 3294 if (swiper.translate === 0) swiper.translate = 0; 3295 swiper.updateActiveIndex(); 3296 swiper.updateSlidesClasses(); 3297 let newProgress; 3298 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 3299 if (translatesDiff === 0) { 3300 newProgress = 0; 3301 } else { 3302 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 3303 } 3304 if (newProgress !== swiper.progress) { 3305 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 3306 } 3307 swiper.emit('setTranslate', swiper.translate, false); 3308} 3309 3310function onLoad(e) { 3311 const swiper = this; 3312 processLazyPreloader(swiper, e.target); 3313 if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) { 3314 return; 3315 } 3316 swiper.update(); 3317} 3318 3319function onDocumentTouchStart() { 3320 const swiper = this; 3321 if (swiper.documentTouchHandlerProceeded) return; 3322 swiper.documentTouchHandlerProceeded = true; 3323 if (swiper.params.touchReleaseOnEdges) { 3324 swiper.el.style.touchAction = 'auto'; 3325 } 3326} 3327 3328const events = (swiper, method) => { 3329 const document = getDocument(); 3330 const { 3331 params, 3332 el, 3333 wrapperEl, 3334 device 3335 } = swiper; 3336 const capture = !!params.nested; 3337 const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 3338 const swiperMethod = method; 3339 if (!el || typeof el === 'string') return; 3340 3341 // Touch Events 3342 document[domMethod]('touchstart', swiper.onDocumentTouchStart, { 3343 passive: false, 3344 capture 3345 }); 3346 el[domMethod]('touchstart', swiper.onTouchStart, { 3347 passive: false 3348 }); 3349 el[domMethod]('pointerdown', swiper.onTouchStart, { 3350 passive: false 3351 }); 3352 document[domMethod]('touchmove', swiper.onTouchMove, { 3353 passive: false, 3354 capture 3355 }); 3356 document[domMethod]('pointermove', swiper.onTouchMove, { 3357 passive: false, 3358 capture 3359 }); 3360 document[domMethod]('touchend', swiper.onTouchEnd, { 3361 passive: true 3362 }); 3363 document[domMethod]('pointerup', swiper.onTouchEnd, { 3364 passive: true 3365 }); 3366 document[domMethod]('pointercancel', swiper.onTouchEnd, { 3367 passive: true 3368 }); 3369 document[domMethod]('touchcancel', swiper.onTouchEnd, { 3370 passive: true 3371 }); 3372 document[domMethod]('pointerout', swiper.onTouchEnd, { 3373 passive: true 3374 }); 3375 document[domMethod]('pointerleave', swiper.onTouchEnd, { 3376 passive: true 3377 }); 3378 document[domMethod]('contextmenu', swiper.onTouchEnd, { 3379 passive: true 3380 }); 3381 3382 // Prevent Links Clicks 3383 if (params.preventClicks || params.preventClicksPropagation) { 3384 el[domMethod]('click', swiper.onClick, true); 3385 } 3386 if (params.cssMode) { 3387 wrapperEl[domMethod]('scroll', swiper.onScroll); 3388 } 3389 3390 // Resize handler 3391 if (params.updateOnWindowResize) { 3392 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 3393 } else { 3394 swiper[swiperMethod]('observerUpdate', onResize, true); 3395 } 3396 3397 // Images loader 3398 el[domMethod]('load', swiper.onLoad, { 3399 capture: true 3400 }); 3401}; 3402function attachEvents() { 3403 const swiper = this; 3404 const { 3405 params 3406 } = swiper; 3407 swiper.onTouchStart = onTouchStart.bind(swiper); 3408 swiper.onTouchMove = onTouchMove.bind(swiper); 3409 swiper.onTouchEnd = onTouchEnd.bind(swiper); 3410 swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper); 3411 if (params.cssMode) { 3412 swiper.onScroll = onScroll.bind(swiper); 3413 } 3414 swiper.onClick = onClick.bind(swiper); 3415 swiper.onLoad = onLoad.bind(swiper); 3416 events(swiper, 'on'); 3417} 3418function detachEvents() { 3419 const swiper = this; 3420 events(swiper, 'off'); 3421} 3422var events$1 = { 3423 attachEvents, 3424 detachEvents 3425}; 3426 3427const isGridEnabled = (swiper, params) => { 3428 return swiper.grid && params.grid && params.grid.rows > 1; 3429}; 3430function setBreakpoint() { 3431 const swiper = this; 3432 const { 3433 realIndex, 3434 initialized, 3435 params, 3436 el 3437 } = swiper; 3438 const breakpoints = params.breakpoints; 3439 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; 3440 const document = getDocument(); 3441 3442 // Get breakpoint for window/container width and update parameters 3443 const breakpointsBase = params.breakpointsBase === 'window' || !params.breakpointsBase ? params.breakpointsBase : 'container'; 3444 const breakpointContainer = ['window', 'container'].includes(params.breakpointsBase) || !params.breakpointsBase ? swiper.el : document.querySelector(params.breakpointsBase); 3445 const breakpoint = swiper.getBreakpoint(breakpoints, breakpointsBase, breakpointContainer); 3446 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 3447 const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 3448 const breakpointParams = breakpointOnlyParams || swiper.originalParams; 3449 const wasMultiRow = isGridEnabled(swiper, params); 3450 const isMultiRow = isGridEnabled(swiper, breakpointParams); 3451 const wasGrabCursor = swiper.params.grabCursor; 3452 const isGrabCursor = breakpointParams.grabCursor; 3453 const wasEnabled = params.enabled; 3454 if (wasMultiRow && !isMultiRow) { 3455 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); 3456 swiper.emitContainerClasses(); 3457 } else if (!wasMultiRow && isMultiRow) { 3458 el.classList.add(`${params.containerModifierClass}grid`); 3459 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { 3460 el.classList.add(`${params.containerModifierClass}grid-column`); 3461 } 3462 swiper.emitContainerClasses(); 3463 } 3464 if (wasGrabCursor && !isGrabCursor) { 3465 swiper.unsetGrabCursor(); 3466 } else if (!wasGrabCursor && isGrabCursor) { 3467 swiper.setGrabCursor(); 3468 } 3469 3470 // Toggle navigation, pagination, scrollbar 3471 ['navigation', 'pagination', 'scrollbar'].forEach(prop => { 3472 if (typeof breakpointParams[prop] === 'undefined') return; 3473 const wasModuleEnabled = params[prop] && params[prop].enabled; 3474 const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; 3475 if (wasModuleEnabled && !isModuleEnabled) { 3476 swiper[prop].disable(); 3477 } 3478 if (!wasModuleEnabled && isModuleEnabled) { 3479 swiper[prop].enable(); 3480 } 3481 }); 3482 const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 3483 const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 3484 const wasLoop = params.loop; 3485 if (directionChanged && initialized) { 3486 swiper.changeDirection(); 3487 } 3488
vendor: 9,328 bytes, lines 3488-3842
3488utils_extend(swiper.params, breakpointParams); 3489 const isEnabled = swiper.params.enabled; 3490 const hasLoop = swiper.params.loop; 3491 Object.assign(swiper, { 3492 allowTouchMove: swiper.params.allowTouchMove, 3493 allowSlideNext: swiper.params.allowSlideNext, 3494 allowSlidePrev: swiper.params.allowSlidePrev 3495 }); 3496 if (wasEnabled && !isEnabled) { 3497 swiper.disable(); 3498 } else if (!wasEnabled && isEnabled) { 3499 swiper.enable(); 3500 } 3501 swiper.currentBreakpoint = breakpoint; 3502 swiper.emit('_beforeBreakpoint', breakpointParams); 3503 if (initialized) { 3504 if (needsReLoop) { 3505 swiper.loopDestroy(); 3506 swiper.loopCreate(realIndex); 3507 swiper.updateSlides(); 3508 } else if (!wasLoop && hasLoop) { 3509 swiper.loopCreate(realIndex); 3510 swiper.updateSlides(); 3511 } else if (wasLoop && !hasLoop) { 3512 swiper.loopDestroy(); 3513 } 3514 } 3515 swiper.emit('breakpoint', breakpointParams); 3516} 3517 3518function getBreakpoint(breakpoints, base, containerEl) { 3519 if (base === void 0) { 3520 base = 'window'; 3521 } 3522 if (!breakpoints || base === 'container' && !containerEl) return undefined; 3523 let breakpoint = false; 3524 const window = getWindow(); 3525 const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; 3526 const points = Object.keys(breakpoints).map(point => { 3527 if (typeof point === 'string' && point.indexOf('@') === 0) { 3528 const minRatio = parseFloat(point.substr(1)); 3529 const value = currentHeight * minRatio; 3530 return { 3531 value, 3532 point 3533 }; 3534 } 3535 return { 3536 value: point, 3537 point 3538 }; 3539 }); 3540 points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); 3541 for (let i = 0; i < points.length; i += 1) { 3542 const { 3543 point, 3544 value 3545 } = points[i]; 3546 if (base === 'window') { 3547 if (window.matchMedia(`(min-width: ${value}px)`).matches) { 3548 breakpoint = point; 3549 } 3550 } else if (value <= containerEl.clientWidth) { 3551 breakpoint = point; 3552 } 3553 } 3554 return breakpoint || 'max'; 3555} 3556 3557var breakpoints = { 3558 setBreakpoint, 3559 getBreakpoint 3560}; 3561 3562function prepareClasses(entries, prefix) { 3563 const resultClasses = []; 3564 entries.forEach(item => { 3565 if (typeof item === 'object') { 3566 Object.keys(item).forEach(classNames => { 3567 if (item[classNames]) { 3568 resultClasses.push(prefix + classNames); 3569 } 3570 }); 3571 } else if (typeof item === 'string') { 3572 resultClasses.push(prefix + item); 3573 } 3574 }); 3575 return resultClasses; 3576} 3577function addClasses() { 3578 const swiper = this; 3579 const { 3580 classNames, 3581 params, 3582 rtl, 3583 el, 3584 device 3585 } = swiper; 3586 // prettier-ignore 3587 const suffixes = prepareClasses(['initialized', params.direction, { 3588 'free-mode': swiper.params.freeMode && params.freeMode.enabled 3589 }, { 3590 'autoheight': params.autoHeight 3591 }, { 3592 'rtl': rtl 3593 }, { 3594 'grid': params.grid && params.grid.rows > 1 3595 }, { 3596 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 3597 }, { 3598 'android': device.android 3599 }, { 3600 'ios': device.ios 3601 }, { 3602 'css-mode': params.cssMode 3603 }, { 3604 'centered': params.cssMode && params.centeredSlides 3605 }, { 3606 'watch-progress': params.watchSlidesProgress 3607 }], params.containerModifierClass); 3608 classNames.push(...suffixes); 3609 el.classList.add(...classNames); 3610 swiper.emitContainerClasses(); 3611} 3612 3613function removeClasses() { 3614 const swiper = this; 3615 const { 3616 el, 3617 classNames 3618 } = swiper; 3619 if (!el || typeof el === 'string') return; 3620 el.classList.remove(...classNames); 3621 swiper.emitContainerClasses(); 3622} 3623 3624var classes = { 3625 addClasses, 3626 removeClasses 3627}; 3628 3629function checkOverflow() { 3630 const swiper = this; 3631 const { 3632 isLocked: wasLocked, 3633 params 3634 } = swiper; 3635 const { 3636 slidesOffsetBefore 3637 } = params; 3638 if (slidesOffsetBefore) { 3639 const lastSlideIndex = swiper.slides.length - 1; 3640 const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 3641 swiper.isLocked = swiper.size > lastSlideRightEdge; 3642 } else { 3643 swiper.isLocked = swiper.snapGrid.length === 1; 3644 } 3645 if (params.allowSlideNext === true) { 3646 swiper.allowSlideNext = !swiper.isLocked; 3647 } 3648 if (params.allowSlidePrev === true) { 3649 swiper.allowSlidePrev = !swiper.isLocked; 3650 } 3651 if (wasLocked && wasLocked !== swiper.isLocked) { 3652 swiper.isEnd = false; 3653 } 3654 if (wasLocked !== swiper.isLocked) { 3655 swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 3656 } 3657} 3658var checkOverflow$1 = { 3659 checkOverflow 3660}; 3661 3662var defaults = { 3663 init: true, 3664 direction: 'horizontal', 3665 oneWayMovement: false, 3666 swiperElementNodeName: 'SWIPER-CONTAINER', 3667 touchEventsTarget: 'wrapper', 3668 initialSlide: 0, 3669 speed: 300, 3670 cssMode: false, 3671 updateOnWindowResize: true, 3672 resizeObserver: true, 3673 nested: false, 3674 createElements: false, 3675 eventsPrefix: 'swiper', 3676 enabled: true, 3677 focusableElements: 'input, select, option, textarea, button, video, label', 3678 // Overrides 3679 width: null, 3680 height: null, 3681 // 3682 preventInteractionOnTransition: false, 3683 // ssr 3684 userAgent: null, 3685 url: null, 3686 // To support iOS's swipe-to-go-back gesture (when being used in-app). 3687 edgeSwipeDetection: false, 3688 edgeSwipeThreshold: 20, 3689 // Autoheight 3690 autoHeight: false, 3691 // Set wrapper width 3692 setWrapperSize: false, 3693 // Virtual Translate 3694 virtualTranslate: false, 3695 // Effects 3696 effect: 'slide', 3697 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 3698 3699 // Breakpoints 3700 breakpoints: undefined, 3701 breakpointsBase: 'window', 3702 // Slides grid 3703 spaceBetween: 0, 3704 slidesPerView: 1, 3705 slidesPerGroup: 1, 3706 slidesPerGroupSkip: 0, 3707 slidesPerGroupAuto: false, 3708 centeredSlides: false, 3709 centeredSlidesBounds: false, 3710 slidesOffsetBefore: 0, 3711 // in px 3712 slidesOffsetAfter: 0, 3713 // in px 3714 normalizeSlideIndex: true, 3715 centerInsufficientSlides: false, 3716 // Disable swiper and hide navigation when container not overflow 3717 watchOverflow: true, 3718 // Round length 3719 roundLengths: false, 3720 // Touches 3721 touchRatio: 1, 3722 touchAngle: 45, 3723 simulateTouch: true, 3724 shortSwipes: true, 3725 longSwipes: true, 3726 longSwipesRatio: 0.5, 3727 longSwipesMs: 300, 3728 followFinger: true, 3729 allowTouchMove: true, 3730 threshold: 5, 3731 touchMoveStopPropagation: false, 3732 touchStartPreventDefault: true, 3733 touchStartForcePreventDefault: false, 3734 touchReleaseOnEdges: false, 3735 // Unique Navigation Elements 3736 uniqueNavElements: true, 3737 // Resistance 3738 resistance: true, 3739 resistanceRatio: 0.85, 3740 // Progress 3741 watchSlidesProgress: false, 3742 // Cursor 3743 grabCursor: false, 3744 // Clicks 3745 preventClicks: true, 3746 preventClicksPropagation: true, 3747 slideToClickedSlide: false, 3748 // loop 3749 loop: false, 3750 loopAddBlankSlides: true, 3751 loopAdditionalSlides: 0, 3752 loopPreventsSliding: true, 3753 // rewind 3754 rewind: false, 3755 // Swiping/no swiping 3756 allowSlidePrev: true, 3757 allowSlideNext: true, 3758 swipeHandler: null, 3759 // '.swipe-handler', 3760 noSwiping: true, 3761 noSwipingClass: 'swiper-no-swiping', 3762 noSwipingSelector: null, 3763 // Passive Listeners 3764 passiveListeners: true, 3765 maxBackfaceHiddenSlides: 10, 3766 // NS 3767 containerModifierClass: 'swiper-', 3768 // NEW 3769 slideClass: 'swiper-slide', 3770 slideBlankClass: 'swiper-slide-blank', 3771 slideActiveClass: 'swiper-slide-active', 3772 slideVisibleClass: 'swiper-slide-visible', 3773 slideFullyVisibleClass: 'swiper-slide-fully-visible', 3774 slideNextClass: 'swiper-slide-next', 3775 slidePrevClass: 'swiper-slide-prev', 3776 wrapperClass: 'swiper-wrapper', 3777 lazyPreloaderClass: 'swiper-lazy-preloader', 3778 lazyPreloadPrevNext: 0, 3779 // Callbacks 3780 runCallbacksOnInit: true, 3781 // Internals 3782 _emitClasses: false 3783}; 3784 3785function moduleExtendParams(params, allModulesParams) { 3786 return function extendParams(obj) { 3787 if (obj === void 0) { 3788 obj = {}; 3789 } 3790 const moduleParamName = Object.keys(obj)[0]; 3791 const moduleParams = obj[moduleParamName]; 3792 if (typeof moduleParams !== 'object' || moduleParams === null) { 3793 utils_extend(allModulesParams, obj); 3794 return; 3795 } 3796 if (params[moduleParamName] === true) { 3797 params[moduleParamName] = { 3798 enabled: true 3799 }; 3800 } 3801 if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) { 3802 params[moduleParamName].auto = true; 3803 } 3804 if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) { 3805 params[moduleParamName].auto = true; 3806 } 3807 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 3808 utils_extend(allModulesParams, obj); 3809 return; 3810 } 3811 if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { 3812 params[moduleParamName].enabled = true; 3813 } 3814 if (!params[moduleParamName]) params[moduleParamName] = { 3815 enabled: false 3816 }; 3817 utils_extend(allModulesParams, obj); 3818 }; 3819} 3820 3821/* eslint no-param-reassign: "off" */ 3822const prototypes = { 3823 eventsEmitter, 3824 update, 3825 translate, 3826 transition, 3827 slide, 3828 loop, 3829 grabCursor, 3830 events: events$1, 3831 breakpoints, 3832 checkOverflow: checkOverflow$1, 3833 classes 3834}; 3835const extendedDefaults = {}; 3836class Swiper { 3837 constructor() { 3838 let el; 3839 let params; 3840 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3841 args[_key] = arguments[_key]; 3842 }
vendor: 1,990 bytes, lines 3843-3900
3843 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { 3844 params = args[0]; 3845 } else { 3846 [el, params] = args; 3847 } 3848 if (!params) params = {}; 3849 params = utils_extend({}, params); 3850 if (el && !params.el) params.el = el; 3851 const document = getDocument(); 3852 if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) { 3853 const swipers = []; 3854 document.querySelectorAll(params.el).forEach(containerEl => { 3855 const newParams = utils_extend({}, params, { 3856 el: containerEl 3857 }); 3858 swipers.push(new Swiper(newParams)); 3859 }); 3860 // eslint-disable-next-line no-constructor-return 3861 return swipers; 3862 } 3863 3864 // Swiper Instance 3865 const swiper = this; 3866 swiper.__swiper__ = true; 3867 swiper.support = getSupport(); 3868 swiper.device = getDevice({ 3869 userAgent: params.userAgent 3870 }); 3871 swiper.browser = getBrowser(); 3872 swiper.eventsListeners = {}; 3873 swiper.eventsAnyListeners = []; 3874 swiper.modules = [...swiper.__modules__]; 3875 if (params.modules && Array.isArray(params.modules)) { 3876 swiper.modules.push(...params.modules); 3877 } 3878 const allModulesParams = {}; 3879 swiper.modules.forEach(mod => { 3880 mod({ 3881 params, 3882 swiper, 3883 extendParams: moduleExtendParams(params, allModulesParams), 3884 on: swiper.on.bind(swiper), 3885 once: swiper.once.bind(swiper), 3886 off: swiper.off.bind(swiper), 3887 emit: swiper.emit.bind(swiper) 3888 }); 3889 }); 3890 3891 // Extend defaults with modules params 3892 const swiperParams = utils_extend({}, defaults, allModulesParams); 3893 3894 // Extend defaults with passed params 3895 swiper.params = utils_extend({}, swiperParams, extendedDefaults, params); 3896 swiper.originalParams = utils_extend({}, swiper.params); 3897 swiper.passedParams = utils_extend({}, params); 3898 3899 // add event listeners 3900 if (swiper.params && swiper.params.on) {
vendor: 3,290 bytes, lines 3901-4021
3901 Object.keys(swiper.params.on).forEach(eventName => { 3902 swiper.on(eventName, swiper.params.on[eventName]); 3903 }); 3904 } 3905 if (swiper.params && swiper.params.onAny) { 3906 swiper.onAny(swiper.params.onAny); 3907 } 3908 3909 // Extend Swiper 3910 Object.assign(swiper, { 3911 enabled: swiper.params.enabled, 3912 el, 3913 // Classes 3914 classNames: [], 3915 // Slides 3916 slides: [], 3917 slidesGrid: [], 3918 snapGrid: [], 3919 slidesSizesGrid: [], 3920 // isDirection 3921 isHorizontal() { 3922 return swiper.params.direction === 'horizontal'; 3923 }, 3924 isVertical() { 3925 return swiper.params.direction === 'vertical'; 3926 }, 3927 // Indexes 3928 activeIndex: 0, 3929 realIndex: 0, 3930 // 3931 isBeginning: true, 3932 isEnd: false, 3933 // Props 3934 translate: 0, 3935 previousTranslate: 0, 3936 progress: 0, 3937 velocity: 0, 3938 animating: false, 3939 cssOverflowAdjustment() { 3940 // Returns 0 unless `translate` is > 2**23 3941 // Should be subtracted from css values to prevent overflow 3942 return Math.trunc(this.translate / 2 ** 23) * 2 ** 23; 3943 }, 3944 // Locks 3945 allowSlideNext: swiper.params.allowSlideNext, 3946 allowSlidePrev: swiper.params.allowSlidePrev, 3947 // Touch Events 3948 touchEventsData: { 3949 isTouched: undefined, 3950 isMoved: undefined, 3951 allowTouchCallbacks: undefined, 3952 touchStartTime: undefined, 3953 isScrolling: undefined, 3954 currentTranslate: undefined, 3955 startTranslate: undefined, 3956 allowThresholdMove: undefined, 3957 // Form elements to match 3958 focusableElements: swiper.params.focusableElements, 3959 // Last click time 3960 lastClickTime: 0, 3961 clickTimeout: undefined, 3962 // Velocities 3963 velocities: [], 3964 allowMomentumBounce: undefined, 3965 startMoving: undefined, 3966 pointerId: null, 3967 touchId: null 3968 }, 3969 // Clicks 3970 allowClick: true, 3971 // Touches 3972 allowTouchMove: swiper.params.allowTouchMove, 3973 touches: { 3974 startX: 0, 3975 startY: 0, 3976 currentX: 0, 3977 currentY: 0, 3978 diff: 0 3979 }, 3980 // Images 3981 imagesToLoad: [], 3982 imagesLoaded: 0 3983 }); 3984 swiper.emit('_swiper'); 3985 3986 // Init 3987 if (swiper.params.init) { 3988 swiper.init(); 3989 } 3990 3991 // Return app instance 3992 // eslint-disable-next-line no-constructor-return 3993 return swiper; 3994 } 3995 getDirectionLabel(property) { 3996 if (this.isHorizontal()) { 3997 return property; 3998 } 3999 // prettier-ignore 4000 return { 4001 'width': 'height', 4002 'margin-top': 'margin-left', 4003 'margin-bottom ': 'margin-right', 4004 'margin-left': 'margin-top', 4005 'margin-right': 'margin-bottom', 4006 'padding-left': 'padding-top', 4007 'padding-right': 'padding-bottom', 4008 'marginRight': 'marginBottom' 4009 }[property]; 4010 } 4011 getSlideIndex(slideEl) { 4012 const { 4013 slidesEl, 4014 params 4015 } = this; 4016 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 4017 const firstSlideIndex = elementIndex(slides[0]); 4018 return elementIndex(slideEl) - firstSlideIndex; 4019 } 4020 getSlideIndexByData(index) { 4021 return this.getSlideIndex(this.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index))
vendor: 6,135 bytes, lines 4021-4209
4021; 4022 } 4023 recalcSlides() { 4024 const swiper = this; 4025 const { 4026 slidesEl, 4027 params 4028 } = swiper; 4029 swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 4030 } 4031 enable() { 4032 const swiper = this; 4033 if (swiper.enabled) return; 4034 swiper.enabled = true; 4035 if (swiper.params.grabCursor) { 4036 swiper.setGrabCursor(); 4037 } 4038 swiper.emit('enable'); 4039 } 4040 disable() { 4041 const swiper = this; 4042 if (!swiper.enabled) return; 4043 swiper.enabled = false; 4044 if (swiper.params.grabCursor) { 4045 swiper.unsetGrabCursor(); 4046 } 4047 swiper.emit('disable'); 4048 } 4049 setProgress(progress, speed) { 4050 const swiper = this; 4051 progress = Math.min(Math.max(progress, 0), 1); 4052 const min = swiper.minTranslate(); 4053 const max = swiper.maxTranslate(); 4054 const current = (max - min) * progress + min; 4055 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 4056 swiper.updateActiveIndex(); 4057 swiper.updateSlidesClasses(); 4058 } 4059 emitContainerClasses() { 4060 const swiper = this; 4061 if (!swiper.params._emitClasses || !swiper.el) return; 4062 const cls = swiper.el.className.split(' ').filter(className => { 4063 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 4064 }); 4065 swiper.emit('_containerClasses', cls.join(' ')); 4066 } 4067 getSlideClasses(slideEl) { 4068 const swiper = this; 4069 if (swiper.destroyed) return ''; 4070 return slideEl.className.split(' ').filter(className => { 4071 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 4072 }).join(' '); 4073 } 4074 emitSlidesClasses() { 4075 const swiper = this; 4076 if (!swiper.params._emitClasses || !swiper.el) return; 4077 const updates = []; 4078 swiper.slides.forEach(slideEl => { 4079 const classNames = swiper.getSlideClasses(slideEl); 4080 updates.push({ 4081 slideEl, 4082 classNames 4083 }); 4084 swiper.emit('_slideClass', slideEl, classNames); 4085 }); 4086 swiper.emit('_slideClasses', updates); 4087 } 4088 slidesPerViewDynamic(view, exact) { 4089 if (view === void 0) { 4090 view = 'current'; 4091 } 4092 if (exact === void 0) { 4093 exact = false; 4094 } 4095 const swiper = this; 4096 const { 4097 params, 4098 slides, 4099 slidesGrid, 4100 slidesSizesGrid, 4101 size: swiperSize, 4102 activeIndex 4103 } = swiper; 4104 let spv = 1; 4105 if (typeof params.slidesPerView === 'number') return params.slidesPerView; 4106 if (params.centeredSlides) { 4107 let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0; 4108 let breakLoop; 4109 for (let i = activeIndex + 1; i < slides.length; i += 1) { 4110 if (slides[i] && !breakLoop) { 4111 slideSize += Math.ceil(slides[i].swiperSlideSize); 4112 spv += 1; 4113 if (slideSize > swiperSize) breakLoop = true; 4114 } 4115 } 4116 for (let i = activeIndex - 1; i >= 0; i -= 1) { 4117 if (slides[i] && !breakLoop) { 4118 slideSize += slides[i].swiperSlideSize; 4119 spv += 1; 4120 if (slideSize > swiperSize) breakLoop = true; 4121 } 4122 } 4123 } else { 4124 // eslint-disable-next-line 4125 if (view === 'current') { 4126 for (let i = activeIndex + 1; i < slides.length; i += 1) { 4127 const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; 4128 if (slideInView) { 4129 spv += 1; 4130 } 4131 } 4132 } else { 4133 // previous 4134 for (let i = activeIndex - 1; i >= 0; i -= 1) { 4135 const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; 4136 if (slideInView) { 4137 spv += 1; 4138 } 4139 } 4140 } 4141 } 4142 return spv; 4143 } 4144 update() { 4145 const swiper = this; 4146 if (!swiper || swiper.destroyed) return; 4147 const { 4148 snapGrid, 4149 params 4150 } = swiper; 4151 // Breakpoints 4152 if (params.breakpoints) { 4153 swiper.setBreakpoint(); 4154 } 4155 [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => { 4156 if (imageEl.complete) { 4157 processLazyPreloader(swiper, imageEl); 4158 } 4159 }); 4160 swiper.updateSize(); 4161 swiper.updateSlides(); 4162 swiper.updateProgress(); 4163 swiper.updateSlidesClasses(); 4164 function setTranslate() { 4165 const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 4166 const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 4167 swiper.setTranslate(newTranslate); 4168 swiper.updateActiveIndex(); 4169 swiper.updateSlidesClasses(); 4170 } 4171 let translated; 4172 if (params.freeMode && params.freeMode.enabled && !params.cssMode) { 4173 setTranslate(); 4174 if (params.autoHeight) { 4175 swiper.updateAutoHeight(); 4176 } 4177 } else { 4178 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) { 4179 const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides; 4180 translated = swiper.slideTo(slides.length - 1, 0, false, true); 4181 } else { 4182 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 4183 } 4184 if (!translated) { 4185 setTranslate(); 4186 } 4187 } 4188 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 4189 swiper.checkOverflow(); 4190 } 4191 swiper.emit('update'); 4192 } 4193 changeDirection(newDirection, needUpdate) { 4194 if (needUpdate === void 0) { 4195 needUpdate = true; 4196 } 4197 const swiper = this; 4198 const currentDirection = swiper.params.direction; 4199 if (!newDirection) { 4200 // eslint-disable-next-line 4201 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 4202 } 4203 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { 4204 return swiper; 4205 } 4206 swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`); 4207 swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`); 4208 swiper.emitContainerClasses(); 4209 swiper.params.direction = newDirection;
vendor: 3,676 bytes, lines 4210-4322
4210 swiper.slides.forEach(slideEl => { 4211 if (newDirection === 'vertical') { 4212 slideEl.style.width = ''; 4213 } else { 4214 slideEl.style.height = ''; 4215 } 4216 }); 4217 swiper.emit('changeDirection'); 4218 if (needUpdate) swiper.update(); 4219 return swiper; 4220 } 4221 changeLanguageDirection(direction) { 4222 const swiper = this; 4223 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; 4224 swiper.rtl = direction === 'rtl'; 4225 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; 4226 if (swiper.rtl) { 4227 swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`); 4228 swiper.el.dir = 'rtl'; 4229 } else { 4230 swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`); 4231 swiper.el.dir = 'ltr'; 4232 } 4233 swiper.update(); 4234 } 4235 mount(element) { 4236 const swiper = this; 4237 if (swiper.mounted) return true; 4238 4239 // Find el 4240 let el = element || swiper.params.el; 4241 if (typeof el === 'string') { 4242 el = document.querySelector(el); 4243 } 4244 if (!el) { 4245 return false; 4246 } 4247 el.swiper = swiper; 4248 if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) { 4249 swiper.isElement = true; 4250 } 4251 const getWrapperSelector = () => { 4252 return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; 4253 }; 4254 const getWrapper = () => { 4255 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 4256 const res = el.shadowRoot.querySelector(getWrapperSelector()); 4257 // Children needs to return slot items 4258 return res; 4259 } 4260 return elementChildren(el, getWrapperSelector())[0]; 4261 }; 4262 // Find Wrapper 4263 let wrapperEl = getWrapper(); 4264 if (!wrapperEl && swiper.params.createElements) { 4265 wrapperEl = createElement('div', swiper.params.wrapperClass); 4266 el.append(wrapperEl); 4267 elementChildren(el, `.${swiper.params.slideClass}`).forEach(slideEl => { 4268 wrapperEl.append(slideEl); 4269 }); 4270 } 4271 Object.assign(swiper, { 4272 el, 4273 wrapperEl, 4274 slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl, 4275 hostEl: swiper.isElement ? el.parentNode.host : el, 4276 mounted: true, 4277 // RTL 4278 rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl', 4279 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'), 4280 wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box' 4281 }); 4282 return true; 4283 } 4284 init(el) { 4285 const swiper = this; 4286 if (swiper.initialized) return swiper; 4287 const mounted = swiper.mount(el); 4288 if (mounted === false) return swiper; 4289 swiper.emit('beforeInit'); 4290 4291 // Set breakpoint 4292 if (swiper.params.breakpoints) { 4293 swiper.setBreakpoint(); 4294 } 4295 4296 // Add Classes 4297 swiper.addClasses(); 4298 4299 // Update size 4300 swiper.updateSize(); 4301 4302 // Update slides 4303 swiper.updateSlides(); 4304 if (swiper.params.watchOverflow) { 4305 swiper.checkOverflow(); 4306 } 4307 4308 // Set Grab Cursor 4309 if (swiper.params.grabCursor && swiper.enabled) { 4310 swiper.setGrabCursor(); 4311 } 4312 4313 // Slide To Initial Slide 4314 if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 4315 swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true); 4316 } else { 4317 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 4318 } 4319 4320 // Create loop 4321 if (swiper.params.loop) { 4322 swiper.loopCreate(
vendor: 1,553 bytes, lines 4322-4390
4322); 4323 } 4324 4325 // Attach events 4326 swiper.attachEvents(); 4327 const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')]; 4328 if (swiper.isElement) { 4329 lazyElements.push(...swiper.hostEl.querySelectorAll('[loading="lazy"]')); 4330 } 4331 lazyElements.forEach(imageEl => { 4332 if (imageEl.complete) { 4333 processLazyPreloader(swiper, imageEl); 4334 } else { 4335 imageEl.addEventListener('load', e => { 4336 processLazyPreloader(swiper, e.target); 4337 }); 4338 } 4339 }); 4340 preload(swiper); 4341 4342 // Init Flag 4343 swiper.initialized = true; 4344 preload(swiper); 4345 4346 // Emit 4347 swiper.emit('init'); 4348 swiper.emit('afterInit'); 4349 return swiper; 4350 } 4351 destroy(deleteInstance, cleanStyles) { 4352 if (deleteInstance === void 0) { 4353 deleteInstance = true; 4354 } 4355 if (cleanStyles === void 0) { 4356 cleanStyles = true; 4357 } 4358 const swiper = this; 4359 const { 4360 params, 4361 el, 4362 wrapperEl, 4363 slides 4364 } = swiper; 4365 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 4366 return null; 4367 } 4368 swiper.emit('beforeDestroy'); 4369 4370 // Init Flag 4371 swiper.initialized = false; 4372 4373 // Detach events 4374 swiper.detachEvents(); 4375 4376 // Destroy loop 4377 if (params.loop) { 4378 swiper.loopDestroy(); 4379 } 4380 4381 // Cleanup styles 4382 if (cleanStyles) { 4383 swiper.removeClasses(); 4384 if (el && typeof el !== 'string') { 4385 el.removeAttribute('style'); 4386 } 4387 if (wrapperEl) { 4388 wrapperEl.removeAttribute('style'); 4389 } 4390 if (slides && slides.length) {
vendor: 4,273 bytes, lines 4391-4543
4391 slides.forEach(slideEl => { 4392 slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass); 4393 slideEl.removeAttribute('style'); 4394 slideEl.removeAttribute('data-swiper-slide-index'); 4395 }); 4396 } 4397 } 4398 swiper.emit('destroy'); 4399 4400 // Detach emitter events 4401 Object.keys(swiper.eventsListeners).forEach(eventName => { 4402 swiper.off(eventName); 4403 }); 4404 if (deleteInstance !== false) { 4405 if (swiper.el && typeof swiper.el !== 'string') { 4406 swiper.el.swiper = null; 4407 } 4408 deleteProps(swiper); 4409 } 4410 swiper.destroyed = true; 4411 return null; 4412 } 4413 static extendDefaults(newDefaults) { 4414 utils_extend(extendedDefaults, newDefaults); 4415 } 4416 static get extendedDefaults() { 4417 return extendedDefaults; 4418 } 4419 static get defaults() { 4420 return defaults; 4421 } 4422 static installModule(mod) { 4423 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; 4424 const modules = Swiper.prototype.__modules__; 4425 if (typeof mod === 'function' && modules.indexOf(mod) < 0) { 4426 modules.push(mod); 4427 } 4428 } 4429 static use(module) { 4430 if (Array.isArray(module)) { 4431 module.forEach(m => Swiper.installModule(m)); 4432 return Swiper; 4433 } 4434 Swiper.installModule(module); 4435 return Swiper; 4436 } 4437} 4438Object.keys(prototypes).forEach(prototypeGroup => { 4439 Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => { 4440 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 4441 }); 4442}); 4443Swiper.use([Resize, Observer]); 4444 4445 4446 4447;// ./node_modules/swiper/modules/virtual.mjs 4448 4449 4450 4451function Virtual(_ref) { 4452 let { 4453 swiper, 4454 extendParams, 4455 on, 4456 emit 4457 } = _ref; 4458 extendParams({ 4459 virtual: { 4460 enabled: false, 4461 slides: [], 4462 cache: true, 4463 renderSlide: null, 4464 renderExternal: null, 4465 renderExternalUpdate: true, 4466 addSlidesBefore: 0, 4467 addSlidesAfter: 0 4468 } 4469 }); 4470 let cssModeTimeout; 4471 const document = getDocument(); 4472 swiper.virtual = { 4473 cache: {}, 4474 from: undefined, 4475 to: undefined, 4476 slides: [], 4477 offset: 0, 4478 slidesGrid: [] 4479 }; 4480 const tempDOM = document.createElement('div'); 4481 function renderSlide(slide, index) { 4482 const params = swiper.params.virtual; 4483 if (params.cache && swiper.virtual.cache[index]) { 4484 return swiper.virtual.cache[index]; 4485 } 4486 // eslint-disable-next-line 4487 let slideEl; 4488 if (params.renderSlide) { 4489 slideEl = params.renderSlide.call(swiper, slide, index); 4490 if (typeof slideEl === 'string') { 4491 tempDOM.innerHTML = slideEl; 4492 slideEl = tempDOM.children[0]; 4493 } 4494 } else if (swiper.isElement) { 4495 slideEl = createElement('swiper-slide'); 4496 } else { 4497 slideEl = createElement('div', swiper.params.slideClass); 4498 } 4499 slideEl.setAttribute('data-swiper-slide-index', index); 4500 if (!params.renderSlide) { 4501 slideEl.innerHTML = slide; 4502 } 4503 if (params.cache) { 4504 swiper.virtual.cache[index] = slideEl; 4505 } 4506 return slideEl; 4507 } 4508 function update(force, beforeInit, forceActiveIndex) { 4509 const { 4510 slidesPerView, 4511 slidesPerGroup, 4512 centeredSlides, 4513 loop: isLoop, 4514 initialSlide 4515 } = swiper.params; 4516 if (beforeInit && !isLoop && initialSlide > 0) { 4517 return; 4518 } 4519 const { 4520 addSlidesBefore, 4521 addSlidesAfter 4522 } = swiper.params.virtual; 4523 const { 4524 from: previousFrom, 4525 to: previousTo, 4526 slides, 4527 slidesGrid: previousSlidesGrid, 4528 offset: previousOffset 4529 } = swiper.virtual; 4530 if (!swiper.params.cssMode) { 4531 swiper.updateActiveIndex(); 4532 } 4533 const activeIndex = typeof forceActiveIndex === 'undefined' ? swiper.activeIndex || 0 : forceActiveIndex; 4534 let offsetProp; 4535 if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; 4536 let slidesAfter; 4537 let slidesBefore; 4538 if (centeredSlides) { 4539 slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; 4540 slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; 4541 } else { 4542 slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; 4543 slidesBefore = (isLoop ? slidesPerView
vendor: 3,781 bytes, lines 4543-4656
4543 : slidesPerGroup) + addSlidesBefore; 4544 } 4545 let from = activeIndex - slidesBefore; 4546 let to = activeIndex + slidesAfter; 4547 if (!isLoop) { 4548 from = Math.max(from, 0); 4549 to = Math.min(to, slides.length - 1); 4550 } 4551 let offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); 4552 if (isLoop && activeIndex >= slidesBefore) { 4553 from -= slidesBefore; 4554 if (!centeredSlides) offset += swiper.slidesGrid[0]; 4555 } else if (isLoop && activeIndex < slidesBefore) { 4556 from = -slidesBefore; 4557 if (centeredSlides) offset += swiper.slidesGrid[0]; 4558 } 4559 Object.assign(swiper.virtual, { 4560 from, 4561 to, 4562 offset, 4563 slidesGrid: swiper.slidesGrid, 4564 slidesBefore, 4565 slidesAfter 4566 }); 4567 function onRendered() { 4568 swiper.updateSlides(); 4569 swiper.updateProgress(); 4570 swiper.updateSlidesClasses(); 4571 emit('virtualUpdate'); 4572 } 4573 if (previousFrom === from && previousTo === to && !force) { 4574 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { 4575 swiper.slides.forEach(slideEl => { 4576 slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`; 4577 }); 4578 } 4579 swiper.updateProgress(); 4580 emit('virtualUpdate'); 4581 return; 4582 } 4583 if (swiper.params.virtual.renderExternal) { 4584 swiper.params.virtual.renderExternal.call(swiper, { 4585 offset, 4586 from, 4587 to, 4588 slides: function getSlides() { 4589 const slidesToRender = []; 4590 for (let i = from; i <= to; i += 1) { 4591 slidesToRender.push(slides[i]); 4592 } 4593 return slidesToRender; 4594 }() 4595 }); 4596 if (swiper.params.virtual.renderExternalUpdate) { 4597 onRendered(); 4598 } else { 4599 emit('virtualUpdate'); 4600 } 4601 return; 4602 } 4603 const prependIndexes = []; 4604 const appendIndexes = []; 4605 const getSlideIndex = index => { 4606 let slideIndex = index; 4607 if (index < 0) { 4608 slideIndex = slides.length + index; 4609 } else if (slideIndex >= slides.length) { 4610 // eslint-disable-next-line 4611 slideIndex = slideIndex - slides.length; 4612 } 4613 return slideIndex; 4614 }; 4615 if (force) { 4616 swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`)).forEach(slideEl => { 4617 slideEl.remove(); 4618 }); 4619 } else { 4620 for (let i = previousFrom; i <= previousTo; i += 1) { 4621 if (i < from || i > to) { 4622 const slideIndex = getSlideIndex(i); 4623 swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}[data-swiper-slide-index="${slideIndex}"], swiper-slide[data-swiper-slide-index="${slideIndex}"]`)).forEach(slideEl => { 4624 slideEl.remove(); 4625 }); 4626 } 4627 } 4628 } 4629 const loopFrom = isLoop ? -slides.length : 0; 4630 const loopTo = isLoop ? slides.length * 2 : slides.length; 4631 for (let i = loopFrom; i < loopTo; i += 1) { 4632 if (i >= from && i <= to) { 4633 const slideIndex = getSlideIndex(i); 4634 if (typeof previousTo === 'undefined' || force) { 4635 appendIndexes.push(slideIndex); 4636 } else { 4637 if (i > previousTo) appendIndexes.push(slideIndex); 4638 if (i < previousFrom) prependIndexes.push(slideIndex); 4639 } 4640 } 4641 } 4642 appendIndexes.forEach(index => { 4643 swiper.slidesEl.append(renderSlide(slides[index], index)); 4644 }); 4645 if (isLoop) { 4646 for (let i = prependIndexes.length - 1; i >= 0; i -= 1) { 4647 const index = prependIndexes[i]; 4648 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 4649 } 4650 } else { 4651 prependIndexes.sort((a, b) => b - a); 4652 prependIndexes.forEach(index => { 4653 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 4654 }); 4655 } 4656
4656elementChildren(swiper.slidesEl, '.swiper-slide, swiper-slide').forEach(sli
vendor: 5,514 bytes, lines 4656-4828
4656deEl => { 4657 slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`; 4658 }); 4659 onRendered(); 4660 } 4661 function appendSlide(slides) { 4662 if (typeof slides === 'object' && 'length' in slides) { 4663 for (let i = 0; i < slides.length; i += 1) { 4664 if (slides[i]) swiper.virtual.slides.push(slides[i]); 4665 } 4666 } else { 4667 swiper.virtual.slides.push(slides); 4668 } 4669 update(true); 4670 } 4671 function prependSlide(slides) { 4672 const activeIndex = swiper.activeIndex; 4673 let newActiveIndex = activeIndex + 1; 4674 let numberOfNewSlides = 1; 4675 if (Array.isArray(slides)) { 4676 for (let i = 0; i < slides.length; i += 1) { 4677 if (slides[i]) swiper.virtual.slides.unshift(slides[i]); 4678 } 4679 newActiveIndex = activeIndex + slides.length; 4680 numberOfNewSlides = slides.length; 4681 } else { 4682 swiper.virtual.slides.unshift(slides); 4683 } 4684 if (swiper.params.virtual.cache) { 4685 const cache = swiper.virtual.cache; 4686 const newCache = {}; 4687 Object.keys(cache).forEach(cachedIndex => { 4688 const cachedEl = cache[cachedIndex]; 4689 const cachedElIndex = cachedEl.getAttribute('data-swiper-slide-index'); 4690 if (cachedElIndex) { 4691 cachedEl.setAttribute('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); 4692 } 4693 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = cachedEl; 4694 }); 4695 swiper.virtual.cache = newCache; 4696 } 4697 update(true); 4698 swiper.slideTo(newActiveIndex, 0); 4699 } 4700 function removeSlide(slidesIndexes) { 4701 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; 4702 let activeIndex = swiper.activeIndex; 4703 if (Array.isArray(slidesIndexes)) { 4704 for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { 4705 if (swiper.params.virtual.cache) { 4706 delete swiper.virtual.cache[slidesIndexes[i]]; 4707 // shift cache indexes 4708 Object.keys(swiper.virtual.cache).forEach(key => { 4709 if (key > slidesIndexes) { 4710 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 4711 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 4712 delete swiper.virtual.cache[key]; 4713 } 4714 }); 4715 } 4716 swiper.virtual.slides.splice(slidesIndexes[i], 1); 4717 if (slidesIndexes[i] < activeIndex) activeIndex -= 1; 4718 activeIndex = Math.max(activeIndex, 0); 4719 } 4720 } else { 4721 if (swiper.params.virtual.cache) { 4722 delete swiper.virtual.cache[slidesIndexes]; 4723 // shift cache indexes 4724 Object.keys(swiper.virtual.cache).forEach(key => { 4725 if (key > slidesIndexes) { 4726 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 4727 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 4728 delete swiper.virtual.cache[key]; 4729 } 4730 }); 4731 } 4732 swiper.virtual.slides.splice(slidesIndexes, 1); 4733 if (slidesIndexes < activeIndex) activeIndex -= 1; 4734 activeIndex = Math.max(activeIndex, 0); 4735 } 4736 update(true); 4737 swiper.slideTo(activeIndex, 0); 4738 } 4739 function removeAllSlides() { 4740 swiper.virtual.slides = []; 4741 if (swiper.params.virtual.cache) { 4742 swiper.virtual.cache = {}; 4743 } 4744 update(true); 4745 swiper.slideTo(0, 0); 4746 } 4747 on('beforeInit', () => { 4748 if (!swiper.params.virtual.enabled) return; 4749 let domSlidesAssigned; 4750 if (typeof swiper.passedParams.virtual.slides === 'undefined') { 4751 const slides = [...swiper.slidesEl.children].filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`)); 4752 if (slides && slides.length) { 4753 swiper.virtual.slides = [...slides]; 4754 domSlidesAssigned = true; 4755 slides.forEach((slideEl, slideIndex) => { 4756 slideEl.setAttribute('data-swiper-slide-index', slideIndex); 4757 swiper.virtual.cache[slideIndex] = slideEl; 4758 slideEl.remove(); 4759 }); 4760 } 4761 } 4762 if (!domSlidesAssigned) { 4763 swiper.virtual.slides = swiper.params.virtual.slides; 4764 } 4765 swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); 4766 swiper.params.watchSlidesProgress = true; 4767 swiper.originalParams.watchSlidesProgress = true; 4768 update(false, true); 4769 }); 4770 on('setTranslate', () => { 4771 if (!swiper.params.virtual.enabled) return; 4772 if (swiper.params.cssMode && !swiper._immediateVirtual) { 4773 clearTimeout(cssModeTimeout); 4774 cssModeTimeout = setTimeout(() => { 4775 update(); 4776 }, 100); 4777 } else { 4778 update(); 4779 } 4780 }); 4781 on('init update resize', () => { 4782 if (!swiper.params.virtual.enabled) return; 4783 if (swiper.params.cssMode) { 4784 setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); 4785 } 4786 }); 4787 Object.assign(swiper.virtual, { 4788 appendSlide, 4789 prependSlide, 4790 removeSlide, 4791 removeAllSlides, 4792 update 4793 }); 4794} 4795 4796 4797 4798;// ./node_modules/swiper/modules/keyboard.mjs 4799 4800 4801 4802/* eslint-disable consistent-return */ 4803function Keyboard(_ref) { 4804 let { 4805 swiper, 4806 extendParams, 4807 on, 4808 emit 4809 } = _ref; 4810 const document = getDocument(); 4811 const window = getWindow(); 4812 swiper.keyboard = { 4813 enabled: false 4814 }; 4815 extendParams({ 4816 keyboard: { 4817 enabled: false, 4818 onlyInViewport: true, 4819 pageUpDown: true 4820 } 4821 }); 4822 function handle(event) { 4823 if (!swiper.enabled) return; 4824 const { 4825 rtlTranslate: rtl 4826 } = swiper; 4827 let e = event; 4828 if (e.originalEvent) e = e.originalEvent; // jquery fix
vendor: 3,932 bytes, lines 4829-4934
4829 const kc = e.keyCode || e.charCode; 4830 const pageUpDown = swiper.params.keyboard.pageUpDown; 4831 const isPageUp = pageUpDown && kc === 33; 4832 const isPageDown = pageUpDown && kc === 34; 4833 const isArrowLeft = kc === 37; 4834 const isArrowRight = kc === 39; 4835 const isArrowUp = kc === 38; 4836 const isArrowDown = kc === 40; 4837 // Directions locks 4838 if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { 4839 return false; 4840 } 4841 if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { 4842 return false; 4843 } 4844 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { 4845 return undefined; 4846 } 4847 if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { 4848 return undefined; 4849 } 4850 if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { 4851 let inView = false; 4852 // Check that swiper should be inside of visible area of window 4853 if (elementParents(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && elementParents(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) { 4854 return undefined; 4855 } 4856 const el = swiper.el; 4857 const swiperWidth = el.clientWidth; 4858 const swiperHeight = el.clientHeight; 4859 const windowWidth = window.innerWidth; 4860 const windowHeight = window.innerHeight; 4861 const swiperOffset = elementOffset(el); 4862 if (rtl) swiperOffset.left -= el.scrollLeft; 4863 const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; 4864 for (let i = 0; i < swiperCoord.length; i += 1) { 4865 const point = swiperCoord[i]; 4866 if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { 4867 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 4868 inView = true; 4869 } 4870 } 4871 if (!inView) return undefined; 4872 } 4873 if (swiper.isHorizontal()) { 4874 if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { 4875 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 4876 } 4877 if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); 4878 if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); 4879 } else { 4880 if (isPageUp || isPageDown || isArrowUp || isArrowDown) { 4881 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 4882 } 4883 if (isPageDown || isArrowDown) swiper.slideNext(); 4884 if (isPageUp || isArrowUp) swiper.slidePrev(); 4885 } 4886 emit('keyPress', kc); 4887 return undefined; 4888 } 4889 function enable() { 4890 if (swiper.keyboard.enabled) return; 4891 document.addEventListener('keydown', handle); 4892 swiper.keyboard.enabled = true; 4893 } 4894 function disable() { 4895 if (!swiper.keyboard.enabled) return; 4896 document.removeEventListener('keydown', handle); 4897 swiper.keyboard.enabled = false; 4898 } 4899 on('init', () => { 4900 if (swiper.params.keyboard.enabled) { 4901 enable(); 4902 } 4903 }); 4904 on('destroy', () => { 4905 if (swiper.keyboard.enabled) { 4906 disable(); 4907 } 4908 }); 4909 Object.assign(swiper.keyboard, { 4910 enable, 4911 disable 4912 }); 4913} 4914 4915 4916 4917;// ./node_modules/swiper/modules/mousewheel.mjs 4918 4919 4920 4921/* eslint-disable consistent-return */ 4922function Mousewheel(_ref) { 4923 let { 4924 swiper, 4925 extendParams, 4926 on, 4927 emit 4928 } = _ref; 4929 const window = getWindow(); 4930 extendParams({ 4931 mousewheel: { 4932 enabled: false, 4933 releaseOnEdges: false, 4934 invert: false,
vendor: 17,915 bytes, lines 4935-5428
4935 forceToAxis: false, 4936 sensitivity: 1, 4937 eventsTarget: 'container', 4938 thresholdDelta: null, 4939 thresholdTime: null, 4940 noMousewheelClass: 'swiper-no-mousewheel' 4941 } 4942 }); 4943 swiper.mousewheel = { 4944 enabled: false 4945 }; 4946 let timeout; 4947 let lastScrollTime = now(); 4948 let lastEventBeforeSnap; 4949 const recentWheelEvents = []; 4950 function normalize(e) { 4951 // Reasonable defaults 4952 const PIXEL_STEP = 10; 4953 const LINE_HEIGHT = 40; 4954 const PAGE_HEIGHT = 800; 4955 let sX = 0; 4956 let sY = 0; // spinX, spinY 4957 let pX = 0; 4958 let pY = 0; // pixelX, pixelY 4959 4960 // Legacy 4961 if ('detail' in e) { 4962 sY = e.detail; 4963 } 4964 if ('wheelDelta' in e) { 4965 sY = -e.wheelDelta / 120; 4966 } 4967 if ('wheelDeltaY' in e) { 4968 sY = -e.wheelDeltaY / 120; 4969 } 4970 if ('wheelDeltaX' in e) { 4971 sX = -e.wheelDeltaX / 120; 4972 } 4973 4974 // side scrolling on FF with DOMMouseScroll 4975 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { 4976 sX = sY; 4977 sY = 0; 4978 } 4979 pX = sX * PIXEL_STEP; 4980 pY = sY * PIXEL_STEP; 4981 if ('deltaY' in e) { 4982 pY = e.deltaY; 4983 } 4984 if ('deltaX' in e) { 4985 pX = e.deltaX; 4986 } 4987 if (e.shiftKey && !pX) { 4988 // if user scrolls with shift he wants horizontal scroll 4989 pX = pY; 4990 pY = 0; 4991 } 4992 if ((pX || pY) && e.deltaMode) { 4993 if (e.deltaMode === 1) { 4994 // delta in LINE units 4995 pX *= LINE_HEIGHT; 4996 pY *= LINE_HEIGHT; 4997 } else { 4998 // delta in PAGE units 4999 pX *= PAGE_HEIGHT; 5000 pY *= PAGE_HEIGHT; 5001 } 5002 } 5003 5004 // Fall-back if spin cannot be determined 5005 if (pX && !sX) { 5006 sX = pX < 1 ? -1 : 1; 5007 } 5008 if (pY && !sY) { 5009 sY = pY < 1 ? -1 : 1; 5010 } 5011 return { 5012 spinX: sX, 5013 spinY: sY, 5014 pixelX: pX, 5015 pixelY: pY 5016 }; 5017 } 5018 function handleMouseEnter() { 5019 if (!swiper.enabled) return; 5020 swiper.mouseEntered = true; 5021 } 5022 function handleMouseLeave() { 5023 if (!swiper.enabled) return; 5024 swiper.mouseEntered = false; 5025 } 5026 function animateSlider(newEvent) { 5027 if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { 5028 // Prevent if delta of wheel scroll delta is below configured threshold 5029 return false; 5030 } 5031 if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { 5032 // Prevent if time between scrolls is below configured threshold 5033 return false; 5034 } 5035 5036 // If the movement is NOT big enough and 5037 // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): 5038 // Don't go any further (avoid insignificant scroll movement). 5039 if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { 5040 // Return false as a default 5041 return true; 5042 } 5043 // If user is scrolling towards the end: 5044 // If the slider hasn't hit the latest slide or 5045 // if the slider is a loop and 5046 // if the slider isn't moving right now: 5047 // Go to next slide and 5048 // emit a scroll event. 5049 // Else (the user is scrolling towards the beginning) and 5050 // if the slider hasn't hit the first slide or 5051 // if the slider is a loop and 5052 // if the slider isn't moving right now: 5053 // Go to prev slide and 5054 // emit a scroll event. 5055 if (newEvent.direction < 0) { 5056 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { 5057 swiper.slideNext(); 5058 emit('scroll', newEvent.raw); 5059 } 5060 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { 5061 swiper.slidePrev(); 5062 emit('scroll', newEvent.raw); 5063 } 5064 // If you got here is because an animation has been triggered so store the current time 5065 lastScrollTime = new window.Date().getTime(); 5066 // Return false as a default 5067 return false; 5068 } 5069 function releaseScroll(newEvent) { 5070 const params = swiper.params.mousewheel; 5071 if (newEvent.direction < 0) { 5072 if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { 5073 // Return true to animate scroll on edges 5074 return true; 5075 } 5076 } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { 5077 // Return true to animate scroll on edges 5078 return true; 5079 } 5080 return false; 5081 } 5082 function handle(event) { 5083 let e = event; 5084 let disableParentSwiper = true; 5085 if (!swiper.enabled) return; 5086 5087 // Ignore event if the target or its parents have the swiper-no-mousewheel class 5088 if (event.target.closest(`.${swiper.params.mousewheel.noMousewheelClass}`)) return; 5089 const params = swiper.params.mousewheel; 5090 if (swiper.params.cssMode) { 5091 e.preventDefault(); 5092 } 5093 let targetEl = swiper.el; 5094 if (swiper.params.mousewheel.eventsTarget !== 'container') { 5095 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 5096 } 5097 const targetElContainsTarget = targetEl && targetEl.contains(e.target); 5098 if (!swiper.mouseEntered && !targetElContainsTarget && !params.releaseOnEdges) return true; 5099 if (e.originalEvent) e = e.originalEvent; // jquery fix 5100 let delta = 0; 5101 const rtlFactor = swiper.rtlTranslate ? -1 : 1; 5102 const data = normalize(e); 5103 if (params.forceToAxis) { 5104 if (swiper.isHorizontal()) { 5105 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; 5106 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; 5107 } else { 5108 delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; 5109 } 5110 if (delta === 0) return true; 5111 if (params.invert) delta = -delta; 5112 5113 // Get the scroll positions 5114 let positions = swiper.getTranslate() + delta * params.sensitivity; 5115 if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); 5116 if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); 5117 5118 // When loop is true: 5119 // the disableParentSwiper will be true. 5120 // When loop is false: 5121 // if the scroll positions is not on edge, 5122 // then the disableParentSwiper will be true. 5123 // if the scroll on edge positions, 5124 // then the disableParentSwiper will be false. 5125 disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); 5126 if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); 5127 if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { 5128 // Register the new event in a variable which stores the relevant data 5129 const newEvent = { 5130 time: now(), 5131 delta: Math.abs(delta), 5132 direction: Math.sign(delta), 5133 raw: event 5134 }; 5135 5136 // Keep the most recent events 5137 if (recentWheelEvents.length >= 2) { 5138 recentWheelEvents.shift(); // only store the last N events 5139 } 5140 5141 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 5142 recentWheelEvents.push(newEvent); 5143 5144 // If there is at least one previous recorded event: 5145 // If direction has changed or 5146 // if the scroll is quicker than the previous one: 5147 // Animate the slider. 5148 // Else (this is the first time the wheel is moved): 5149 // Animate the slider. 5150 if (prevEvent) { 5151 if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { 5152 animateSlider(newEvent); 5153 } 5154 } else { 5155 animateSlider(newEvent); 5156 } 5157 5158 // If it's time to release the scroll: 5159 // Return now so you don't hit the preventDefault. 5160 if (releaseScroll(newEvent)) { 5161 return true; 5162 } 5163 } else { 5164 // Freemode or scrollContainer: 5165 5166 // If we recently snapped after a momentum scroll, then ignore wheel events 5167 // to give time for the deceleration to finish. Stop ignoring after 500 msecs 5168 // or if it's a new scroll (larger delta or inverse sign as last event before 5169 // an end-of-momentum snap). 5170 const newEvent = { 5171 time: now(), 5172 delta: Math.abs(delta), 5173 direction: Math.sign(delta) 5174 }; 5175 const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; 5176 if (!ignoreWheelEvents) { 5177 lastEventBeforeSnap = undefined; 5178 let position = swiper.getTranslate() + delta * params.sensitivity; 5179 const wasBeginning = swiper.isBeginning; 5180 const wasEnd = swiper.isEnd; 5181 if (position >= swiper.minTranslate()) position = swiper.minTranslate(); 5182 if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); 5183 swiper.setTransition(0); 5184 swiper.setTranslate(position); 5185 swiper.updateProgress(); 5186 swiper.updateActiveIndex(); 5187 swiper.updateSlidesClasses(); 5188 if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { 5189 swiper.updateSlidesClasses(); 5190 } 5191 if (swiper.params.loop) { 5192 swiper.loopFix({ 5193 direction: newEvent.direction < 0 ? 'next' : 'prev', 5194 byMousewheel: true 5195 }); 5196 } 5197 if (swiper.params.freeMode.sticky) { 5198 // When wheel scrolling starts with sticky (aka snap) enabled, then detect 5199 // the end of a momentum scroll by storing recent (N=15?) wheel events. 5200 // 1. do all N events have decreasing or same (absolute value) delta? 5201 // 2. did all N events arrive in the last M (M=500?) msecs? 5202 // 3. does the earliest event have an (absolute value) delta that's 5203 // at least P (P=1?) larger than the most recent event's delta? 5204 // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? 5205 // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. 5206 // Snap immediately and ignore remaining wheel events in this scroll. 5207 // See comment above for "remaining wheel events in this scroll" determination. 5208 // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. 5209 clearTimeout(timeout); 5210 timeout = undefined; 5211 if (recentWheelEvents.length >= 15) { 5212 recentWheelEvents.shift(); // only store the last N events 5213 } 5214 5215 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 5216 const firstEvent = recentWheelEvents[0]; 5217 recentWheelEvents.push(newEvent); 5218 if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { 5219 // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. 5220 recentWheelEvents.splice(0); 5221 } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { 5222 // We're at the end of the deceleration of a momentum scroll, so there's no need 5223 // to wait for more events. Snap ASAP on the next tick. 5224 // Also, because there's some remaining momentum we'll bias the snap in the 5225 // direction of the ongoing scroll because it's better UX for the scroll to snap 5226 // in the same direction as the scroll instead of reversing to snap. Therefore, 5227 // if it's already scrolled more than 20% in the current direction, keep going. 5228 const snapToThreshold = delta > 0 ? 0.8 : 0.2; 5229 lastEventBeforeSnap = newEvent; 5230 recentWheelEvents.splice(0); 5231 timeout = nextTick(() => { 5232 if (swiper.destroyed || !swiper.params) return; 5233 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 5234 }, 0); // no delay; move on next tick 5235 } 5236 5237 if (!timeout) { 5238 // if we get here, then we haven't detected the end of a momentum scroll, so 5239 // we'll consider a scroll "complete" when there haven't been any wheel events 5240 // for 500ms. 5241 timeout = nextTick(() => { 5242 if (swiper.destroyed || !swiper.params) return; 5243 const snapToThreshold = 0.5; 5244 lastEventBeforeSnap = newEvent; 5245 recentWheelEvents.splice(0); 5246 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 5247 }, 500); 5248 } 5249 } 5250 5251 // Emit event 5252 if (!ignoreWheelEvents) emit('scroll', e); 5253 5254 // Stop autoplay 5255 if (swiper.params.autoplay && swiper.params.autoplay.disableOnInteraction) swiper.autoplay.stop(); 5256 // Return page scroll on edge positions 5257 if (params.releaseOnEdges && (position === swiper.minTranslate() || position === swiper.maxTranslate())) { 5258 return true; 5259 } 5260 } 5261 } 5262 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 5263 return false; 5264 } 5265 function events(method) { 5266 let targetEl = swiper.el; 5267 if (swiper.params.mousewheel.eventsTarget !== 'container') { 5268 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 5269 } 5270 targetEl[method]('mouseenter', handleMouseEnter); 5271 targetEl[method]('mouseleave', handleMouseLeave); 5272 targetEl[method]('wheel', handle); 5273 } 5274 function enable() { 5275 if (swiper.params.cssMode) { 5276 swiper.wrapperEl.removeEventListener('wheel', handle); 5277 return true; 5278 } 5279 if (swiper.mousewheel.enabled) return false; 5280 events('addEventListener'); 5281 swiper.mousewheel.enabled = true; 5282 return true; 5283 } 5284 function disable() { 5285 if (swiper.params.cssMode) { 5286 swiper.wrapperEl.addEventListener(event, handle); 5287 return true; 5288 } 5289 if (!swiper.mousewheel.enabled) return false; 5290 events('removeEventListener'); 5291 swiper.mousewheel.enabled = false; 5292 return true; 5293 } 5294 on('init', () => { 5295 if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { 5296 disable(); 5297 } 5298 if (swiper.params.mousewheel.enabled) enable(); 5299 }); 5300 on('destroy', () => { 5301 if (swiper.params.cssMode) { 5302 enable(); 5303 } 5304 if (swiper.mousewheel.enabled) disable(); 5305 }); 5306 Object.assign(swiper.mousewheel, { 5307 enable, 5308 disable 5309 }); 5310} 5311 5312 5313 5314;// ./node_modules/swiper/shared/create-element-if-not-defined.mjs 5315 5316 5317function createElementIfNotDefined(swiper, originalParams, params, checkProps) { 5318 if (swiper.params.createElements) { 5319 Object.keys(checkProps).forEach(key => { 5320 if (!params[key] && params.auto === true) { 5321 let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0]; 5322 if (!element) { 5323 element = createElement('div', checkProps[key]); 5324 element.className = checkProps[key]; 5325 swiper.el.append(element); 5326 } 5327 params[key] = element; 5328 originalParams[key] = element; 5329 } 5330 }); 5331 } 5332 return params; 5333} 5334 5335 5336 5337;// ./node_modules/swiper/modules/navigation.mjs 5338 5339 5340 5341function Navigation(_ref) { 5342 let { 5343 swiper, 5344 extendParams, 5345 on, 5346 emit 5347 } = _ref; 5348 extendParams({ 5349 navigation: { 5350 nextEl: null, 5351 prevEl: null, 5352 hideOnClick: false, 5353 disabledClass: 'swiper-button-disabled', 5354 hiddenClass: 'swiper-button-hidden', 5355 lockClass: 'swiper-button-lock', 5356 navigationDisabledClass: 'swiper-navigation-disabled' 5357 } 5358 }); 5359 swiper.navigation = { 5360 nextEl: null, 5361 prevEl: null 5362 }; 5363 function getEl(el) { 5364 let res; 5365 if (el && typeof el === 'string' && swiper.isElement) { 5366 res = swiper.el.querySelector(el) || swiper.hostEl.querySelector(el); 5367 if (res) return res; 5368 } 5369 if (el) { 5370 if (typeof el === 'string') res = [...document.querySelectorAll(el)]; 5371 if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) { 5372 res = swiper.el.querySelector(el); 5373 } else if (res && res.length === 1) { 5374 res = res[0]; 5375 } 5376 } 5377 if (el && !res) return el; 5378 // if (Array.isArray(res) && res.length === 1) res = res[0]; 5379 return res; 5380 } 5381 function toggleEl(el, disabled) { 5382 const params = swiper.params.navigation; 5383 el = makeElementsArray(el); 5384 el.forEach(subEl => { 5385 if (subEl) { 5386 subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' ')); 5387 if (subEl.tagName === 'BUTTON') subEl.disabled = disabled; 5388 if (swiper.params.watchOverflow && swiper.enabled) { 5389 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 5390 } 5391 } 5392 }); 5393 } 5394 function update() { 5395 // Update Navigation Buttons 5396 const { 5397 nextEl, 5398 prevEl 5399 } = swiper.navigation; 5400 if (swiper.params.loop) { 5401 toggleEl(prevEl, false); 5402 toggleEl(nextEl, false); 5403 return; 5404 } 5405 toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind); 5406 toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind); 5407 } 5408 function onPrevClick(e) { 5409 e.preventDefault(); 5410 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; 5411 swiper.slidePrev(); 5412 emit('navigationPrev'); 5413 } 5414 function onNextClick(e) { 5415 e.preventDefault(); 5416 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; 5417 swiper.slideNext(); 5418 emit('navigationNext'); 5419 } 5420 function init() { 5421 const params = swiper.params.navigation; 5422 swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { 5423 nextEl: 'swiper-button-next', 5424 prevEl: 'swiper-button-prev' 5425 }); 5426 if (!(params.nextEl || params.prevEl)) return; 5427 let nextEl = getEl(params.nextEl); 5428 let prevEl = getEl(params.prevEl);
vendor: 3,742 bytes, lines 5429-5561
5429 Object.assign(swiper.navigation, { 5430 nextEl, 5431 prevEl 5432 }); 5433 nextEl = makeElementsArray(nextEl); 5434 prevEl = makeElementsArray(prevEl); 5435 const initButton = (el, dir) => { 5436 if (el) { 5437 el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 5438 } 5439 if (!swiper.enabled && el) { 5440 el.classList.add(...params.lockClass.split(' ')); 5441 } 5442 }; 5443 nextEl.forEach(el => initButton(el, 'next')); 5444 prevEl.forEach(el => initButton(el, 'prev')); 5445 } 5446 function destroy() { 5447 let { 5448 nextEl, 5449 prevEl 5450 } = swiper.navigation; 5451 nextEl = makeElementsArray(nextEl); 5452 prevEl = makeElementsArray(prevEl); 5453 const destroyButton = (el, dir) => { 5454 el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 5455 el.classList.remove(...swiper.params.navigation.disabledClass.split(' ')); 5456 }; 5457 nextEl.forEach(el => destroyButton(el, 'next')); 5458 prevEl.forEach(el => destroyButton(el, 'prev')); 5459 } 5460 on('init', () => { 5461 if (swiper.params.navigation.enabled === false) { 5462 // eslint-disable-next-line 5463 disable(); 5464 } else { 5465 init(); 5466 update(); 5467 } 5468 }); 5469 on('toEdge fromEdge lock unlock', () => { 5470 update(); 5471 }); 5472 on('destroy', () => { 5473 destroy(); 5474 }); 5475 on('enable disable', () => { 5476 let { 5477 nextEl, 5478 prevEl 5479 } = swiper.navigation; 5480 nextEl = makeElementsArray(nextEl); 5481 prevEl = makeElementsArray(prevEl); 5482 if (swiper.enabled) { 5483 update(); 5484 return; 5485 } 5486 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass)); 5487 }); 5488 on('click', (_s, e) => { 5489 let { 5490 nextEl, 5491 prevEl 5492 } = swiper.navigation; 5493 nextEl = makeElementsArray(nextEl); 5494 prevEl = makeElementsArray(prevEl); 5495 const targetEl = e.target; 5496 let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl); 5497 if (swiper.isElement && !targetIsButton) { 5498 const path = e.path || e.composedPath && e.composedPath(); 5499 if (path) { 5500 targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl)); 5501 } 5502 } 5503 if (swiper.params.navigation.hideOnClick && !targetIsButton) { 5504 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; 5505 let isHidden; 5506 if (nextEl.length) { 5507 isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass); 5508 } else if (prevEl.length) { 5509 isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass); 5510 } 5511 if (isHidden === true) { 5512 emit('navigationShow'); 5513 } else { 5514 emit('navigationHide'); 5515 } 5516 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass)); 5517 } 5518 }); 5519 const enable = () => { 5520 swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' ')); 5521 init(); 5522 update(); 5523 }; 5524 const disable = () => { 5525 swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' ')); 5526 destroy(); 5527 }; 5528 Object.assign(swiper.navigation, { 5529 enable, 5530 disable, 5531 update, 5532 init, 5533 destroy 5534 }); 5535} 5536 5537 5538 5539;// ./node_modules/swiper/shared/classes-to-selector.mjs 5540function classesToSelector(classes) { 5541 if (classes === void 0) { 5542 classes = ''; 5543 } 5544 return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line 5545 .replace(/ /g, '.')}`; 5546} 5547 5548 5549 5550;// ./node_modules/swiper/modules/pagination.mjs 5551 5552 5553 5554 5555function Pagination(_ref) { 5556 let { 5557 swiper, 5558 extendParams, 5559 on, 5560 emit 5561 } = _ref;
vendor: 8,796 bytes, lines 5561-5779
5561 5562 const pfx = 'swiper-pagination'; 5563 extendParams({ 5564 pagination: { 5565 el: null, 5566 bulletElement: 'span', 5567 clickable: false, 5568 hideOnClick: false, 5569 renderBullet: null, 5570 renderProgressbar: null, 5571 renderFraction: null, 5572 renderCustom: null, 5573 progressbarOpposite: false, 5574 type: 'bullets', 5575 // 'bullets' or 'progressbar' or 'fraction' or 'custom' 5576 dynamicBullets: false, 5577 dynamicMainBullets: 1, 5578 formatFractionCurrent: number => number, 5579 formatFractionTotal: number => number, 5580 bulletClass: `${pfx}-bullet`, 5581 bulletActiveClass: `${pfx}-bullet-active`, 5582 modifierClass: `${pfx}-`, 5583 currentClass: `${pfx}-current`, 5584 totalClass: `${pfx}-total`, 5585 hiddenClass: `${pfx}-hidden`, 5586 progressbarFillClass: `${pfx}-progressbar-fill`, 5587 progressbarOppositeClass: `${pfx}-progressbar-opposite`, 5588 clickableClass: `${pfx}-clickable`, 5589 lockClass: `${pfx}-lock`, 5590 horizontalClass: `${pfx}-horizontal`, 5591 verticalClass: `${pfx}-vertical`, 5592 paginationDisabledClass: `${pfx}-disabled` 5593 } 5594 }); 5595 swiper.pagination = { 5596 el: null, 5597 bullets: [] 5598 }; 5599 let bulletSize; 5600 let dynamicBulletIndex = 0; 5601 function isPaginationDisabled() { 5602 return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0; 5603 } 5604 function setSideBullets(bulletEl, position) { 5605 const { 5606 bulletActiveClass 5607 } = swiper.params.pagination; 5608 if (!bulletEl) return; 5609 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 5610 if (bulletEl) { 5611 bulletEl.classList.add(`${bulletActiveClass}-${position}`); 5612 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 5613 if (bulletEl) { 5614 bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`); 5615 } 5616 } 5617 } 5618 function getMoveDirection(prevIndex, nextIndex, length) { 5619 prevIndex = prevIndex % length; 5620 nextIndex = nextIndex % length; 5621 if (nextIndex === prevIndex + 1) { 5622 return 'next'; 5623 } else if (nextIndex === prevIndex - 1) { 5624 return 'previous'; 5625 } 5626 return; 5627 } 5628 function onBulletClick(e) { 5629 const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass)); 5630 if (!bulletEl) { 5631 return; 5632 } 5633 e.preventDefault(); 5634 const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup; 5635 if (swiper.params.loop) { 5636 if (swiper.realIndex === index) return; 5637 const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length); 5638 if (moveDirection === 'next') { 5639 swiper.slideNext(); 5640 } else if (moveDirection === 'previous') { 5641 swiper.slidePrev(); 5642 } else { 5643 swiper.slideToLoop(index); 5644 } 5645 } else { 5646 swiper.slideTo(index); 5647 } 5648 } 5649 function update() { 5650 // Render || Update Pagination bullets/items 5651 const rtl = swiper.rtl; 5652 const params = swiper.params.pagination; 5653 if (isPaginationDisabled()) return; 5654 let el = swiper.pagination.el; 5655 el = makeElementsArray(el); 5656 // Current/Total 5657 let current; 5658 let previousIndex; 5659 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 5660 const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5661 if (swiper.params.loop) { 5662 previousIndex = swiper.previousRealIndex || 0; 5663 current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex; 5664 } else if (typeof swiper.snapIndex !== 'undefined') { 5665 current = swiper.snapIndex; 5666 previousIndex = swiper.previousSnapIndex; 5667 } else { 5668 previousIndex = swiper.previousIndex || 0; 5669 current = swiper.activeIndex || 0; 5670 } 5671 // Types 5672 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 5673 const bullets = swiper.pagination.bullets; 5674 let firstIndex; 5675 let lastIndex; 5676 let midIndex; 5677 if (params.dynamicBullets) { 5678 bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true); 5679 el.forEach(subEl => { 5680 subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`; 5681 }); 5682 if (params.dynamicMainBullets > 1 && previousIndex !== undefined) { 5683 dynamicBulletIndex += current - (previousIndex || 0); 5684 if (dynamicBulletIndex > params.dynamicMainBullets - 1) { 5685 dynamicBulletIndex = params.dynamicMainBullets - 1; 5686 } else if (dynamicBulletIndex < 0) { 5687 dynamicBulletIndex = 0; 5688 } 5689 } 5690 firstIndex = Math.max(current - dynamicBulletIndex, 0); 5691 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 5692 midIndex = (lastIndex + firstIndex) / 2; 5693 } 5694 bullets.forEach(bulletEl => { 5695 const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat(); 5696 bulletEl.classList.remove(...classesToRemove); 5697 }); 5698 if (el.length > 1) { 5699 bullets.forEach(bullet => { 5700 const bulletIndex = elementIndex(bullet); 5701 if (bulletIndex === current) { 5702 bullet.classList.add(...params.bulletActiveClass.split(' ')); 5703 } else if (swiper.isElement) { 5704 bullet.setAttribute('part', 'bullet'); 5705 } 5706 if (params.dynamicBullets) { 5707 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { 5708 bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 5709 } 5710 if (bulletIndex === firstIndex) { 5711 setSideBullets(bullet, 'prev'); 5712 } 5713 if (bulletIndex === lastIndex) { 5714 setSideBullets(bullet, 'next'); 5715 } 5716 } 5717 }); 5718 } else { 5719 const bullet = bullets[current]; 5720 if (bullet) { 5721 bullet.classList.add(...params.bulletActiveClass.split(' ')); 5722 } 5723 if (swiper.isElement) { 5724 bullets.forEach((bulletEl, bulletIndex) => { 5725 bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet'); 5726 }); 5727 } 5728 if (params.dynamicBullets) { 5729 const firstDisplayedBullet = bullets[firstIndex]; 5730 const lastDisplayedBullet = bullets[lastIndex]; 5731 for (let i = firstIndex; i <= lastIndex; i += 1) { 5732 if (bullets[i]) { 5733 bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 5734 } 5735 } 5736 setSideBullets(firstDisplayedBullet, 'prev'); 5737 setSideBullets(lastDisplayedBullet, 'next'); 5738 } 5739 } 5740 if (params.dynamicBullets) { 5741 const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 5742 const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; 5743 const offsetProp = rtl ? 'right' : 'left'; 5744 bullets.forEach(bullet => { 5745 bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`; 5746 }); 5747 } 5748 } 5749 el.forEach((subEl, subElIndex) => { 5750 if (params.type === 'fraction') { 5751 subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => { 5752 fractionEl.textContent = params.formatFractionCurrent(current + 1); 5753 }); 5754 subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => { 5755 totalEl.textContent = params.formatFractionTotal(total); 5756 }); 5757 } 5758 if (params.type === 'progressbar') { 5759 let progressbarDirection; 5760 if (params.progressbarOpposite) { 5761 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 5762 } else { 5763 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 5764 } 5765 const scale = (current + 1) / total; 5766 let scaleX = 1; 5767 let scaleY = 1; 5768 if (progressbarDirection === 'horizontal') { 5769 scaleX = scale; 5770 } else { 5771 scaleY = scale; 5772 } 5773 subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => { 5774 progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`; 5775 progressEl.style.transitionDuration = `${swiper.params.speed}ms`; 5776 }); 5777 } 5778 if (params.type === 'custom' && params.renderCustom) { 5779 s
vendor: 8,442 bytes, lines 5779-6026
5779ubEl.innerHTML = params.renderCustom(swiper, current + 1, total); 5780 if (subElIndex === 0) emit('paginationRender', subEl); 5781 } else { 5782 if (subElIndex === 0) emit('paginationRender', subEl); 5783 emit('paginationUpdate', subEl); 5784 } 5785 if (swiper.params.watchOverflow && swiper.enabled) { 5786 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 5787 } 5788 }); 5789 } 5790 function render() { 5791 // Render Container 5792 const params = swiper.params.pagination; 5793 if (isPaginationDisabled()) return; 5794 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length; 5795 let el = swiper.pagination.el; 5796 el = makeElementsArray(el); 5797 let paginationHTML = ''; 5798 if (params.type === 'bullets') { 5799 let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5800 if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) { 5801 numberOfBullets = slidesLength; 5802 } 5803 for (let i = 0; i < numberOfBullets; i += 1) { 5804 if (params.renderBullet) { 5805 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); 5806 } else { 5807 // prettier-ignore 5808 paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`; 5809 } 5810 } 5811 } 5812 if (params.type === 'fraction') { 5813 if (params.renderFraction) { 5814 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 5815 } else { 5816 paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; 5817 } 5818 } 5819 if (params.type === 'progressbar') { 5820 if (params.renderProgressbar) { 5821 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 5822 } else { 5823 paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; 5824 } 5825 } 5826 swiper.pagination.bullets = []; 5827 el.forEach(subEl => { 5828 if (params.type !== 'custom') { 5829 subEl.innerHTML = paginationHTML || ''; 5830 } 5831 if (params.type === 'bullets') { 5832 swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass))); 5833 } 5834 }); 5835 if (params.type !== 'custom') { 5836 emit('paginationRender', el[0]); 5837 } 5838 } 5839 function init() { 5840 swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { 5841 el: 'swiper-pagination' 5842 }); 5843 const params = swiper.params.pagination; 5844 if (!params.el) return; 5845 let el; 5846 if (typeof params.el === 'string' && swiper.isElement) { 5847 el = swiper.el.querySelector(params.el); 5848 } 5849 if (!el && typeof params.el === 'string') { 5850 el = [...document.querySelectorAll(params.el)]; 5851 } 5852 if (!el) { 5853 el = params.el; 5854 } 5855 if (!el || el.length === 0) return; 5856 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) { 5857 el = [...swiper.el.querySelectorAll(params.el)]; 5858 // check if it belongs to another nested Swiper 5859 if (el.length > 1) { 5860 el = el.find(subEl => { 5861 if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false; 5862 return true; 5863 }); 5864 } 5865 } 5866 if (Array.isArray(el) && el.length === 1) el = el[0]; 5867 Object.assign(swiper.pagination, { 5868 el 5869 }); 5870 el = makeElementsArray(el); 5871 el.forEach(subEl => { 5872 if (params.type === 'bullets' && params.clickable) { 5873 subEl.classList.add(...(params.clickableClass || '').split(' ')); 5874 } 5875 subEl.classList.add(params.modifierClass + params.type); 5876 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5877 if (params.type === 'bullets' && params.dynamicBullets) { 5878 subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`); 5879 dynamicBulletIndex = 0; 5880 if (params.dynamicMainBullets < 1) { 5881 params.dynamicMainBullets = 1; 5882 } 5883 } 5884 if (params.type === 'progressbar' && params.progressbarOpposite) { 5885 subEl.classList.add(params.progressbarOppositeClass); 5886 } 5887 if (params.clickable) { 5888 subEl.addEventListener('click', onBulletClick); 5889 } 5890 if (!swiper.enabled) { 5891 subEl.classList.add(params.lockClass); 5892 } 5893 }); 5894 } 5895 function destroy() { 5896 const params = swiper.params.pagination; 5897 if (isPaginationDisabled()) return; 5898 let el = swiper.pagination.el; 5899 if (el) { 5900 el = makeElementsArray(el); 5901 el.forEach(subEl => { 5902 subEl.classList.remove(params.hiddenClass); 5903 subEl.classList.remove(params.modifierClass + params.type); 5904 subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5905 if (params.clickable) { 5906 subEl.classList.remove(...(params.clickableClass || '').split(' ')); 5907 subEl.removeEventListener('click', onBulletClick); 5908 } 5909 }); 5910 } 5911 if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' '))); 5912 } 5913 on('changeDirection', () => { 5914 if (!swiper.pagination || !swiper.pagination.el) return; 5915 const params = swiper.params.pagination; 5916 let { 5917 el 5918 } = swiper.pagination; 5919 el = makeElementsArray(el); 5920 el.forEach(subEl => { 5921 subEl.classList.remove(params.horizontalClass, params.verticalClass); 5922 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5923 }); 5924 }); 5925 on('init', () => { 5926 if (swiper.params.pagination.enabled === false) { 5927 // eslint-disable-next-line 5928 disable(); 5929 } else { 5930 init(); 5931 render(); 5932 update(); 5933 } 5934 }); 5935 on('activeIndexChange', () => { 5936 if (typeof swiper.snapIndex === 'undefined') { 5937 update(); 5938 } 5939 }); 5940 on('snapIndexChange', () => { 5941 update(); 5942 }); 5943 on('snapGridLengthChange', () => { 5944 render(); 5945 update(); 5946 }); 5947 on('destroy', () => { 5948 destroy(); 5949 }); 5950 on('enable disable', () => { 5951 let { 5952 el 5953 } = swiper.pagination; 5954 if (el) { 5955 el = makeElementsArray(el); 5956 el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass)); 5957 } 5958 }); 5959 on('lock unlock', () => { 5960 update(); 5961 }); 5962 on('click', (_s, e) => { 5963 const targetEl = e.target; 5964 const el = makeElementsArray(swiper.pagination.el); 5965 if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) { 5966 if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; 5967 const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass); 5968 if (isHidden === true) { 5969 emit('paginationShow'); 5970 } else { 5971 emit('paginationHide'); 5972 } 5973 el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass)); 5974 } 5975 }); 5976 const enable = () => { 5977 swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass); 5978 let { 5979 el 5980 } = swiper.pagination; 5981 if (el) { 5982 el = makeElementsArray(el); 5983 el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass)); 5984 } 5985 init(); 5986 render(); 5987 update(); 5988 }; 5989 const disable = () => { 5990 swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass); 5991 let { 5992 el 5993 } = swiper.pagination; 5994 if (el) { 5995 el = makeElementsArray(el); 5996 el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass)); 5997 } 5998 destroy(); 5999 }; 6000 Object.assign(swiper.pagination, { 6001 enable, 6002 disable, 6003 render, 6004 update, 6005 init, 6006 destroy 6007 }); 6008} 6009 6010 6011 6012;// ./node_modules/swiper/modules/scrollbar.mjs 6013 6014 6015 6016 6017 6018function Scrollbar(_ref) { 6019 let { 6020 swiper, 6021 extendParams, 6022 on, 6023 emit 6024 } = _ref; 6025 const document = getDocument(); 6026 let isTouched = false;
vendor: 4,705 bytes, lines 6027-6179
6027 let timeout = null; 6028 let dragTimeout = null; 6029 let dragStartPos; 6030 let dragSize; 6031 let trackSize; 6032 let divider; 6033 extendParams({ 6034 scrollbar: { 6035 el: null, 6036 dragSize: 'auto', 6037 hide: false, 6038 draggable: false, 6039 snapOnRelease: true, 6040 lockClass: 'swiper-scrollbar-lock', 6041 dragClass: 'swiper-scrollbar-drag', 6042 scrollbarDisabledClass: 'swiper-scrollbar-disabled', 6043 horizontalClass: `swiper-scrollbar-horizontal`, 6044 verticalClass: `swiper-scrollbar-vertical` 6045 } 6046 }); 6047 swiper.scrollbar = { 6048 el: null, 6049 dragEl: null 6050 }; 6051 function setTranslate() { 6052 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6053 const { 6054 scrollbar, 6055 rtlTranslate: rtl 6056 } = swiper; 6057 const { 6058 dragEl, 6059 el 6060 } = scrollbar; 6061 const params = swiper.params.scrollbar; 6062 const progress = swiper.params.loop ? swiper.progressLoop : swiper.progress; 6063 let newSize = dragSize; 6064 let newPos = (trackSize - dragSize) * progress; 6065 if (rtl) { 6066 newPos = -newPos; 6067 if (newPos > 0) { 6068 newSize = dragSize - newPos; 6069 newPos = 0; 6070 } else if (-newPos + dragSize > trackSize) { 6071 newSize = trackSize + newPos; 6072 } 6073 } else if (newPos < 0) { 6074 newSize = dragSize + newPos; 6075 newPos = 0; 6076 } else if (newPos + dragSize > trackSize) { 6077 newSize = trackSize - newPos; 6078 } 6079 if (swiper.isHorizontal()) { 6080 dragEl.style.transform = `translate3d(${newPos}px, 0, 0)`; 6081 dragEl.style.width = `${newSize}px`; 6082 } else { 6083 dragEl.style.transform = `translate3d(0px, ${newPos}px, 0)`; 6084 dragEl.style.height = `${newSize}px`; 6085 } 6086 if (params.hide) { 6087 clearTimeout(timeout); 6088 el.style.opacity = 1; 6089 timeout = setTimeout(() => { 6090 el.style.opacity = 0; 6091 el.style.transitionDuration = '400ms'; 6092 }, 1000); 6093 } 6094 } 6095 function setTransition(duration) { 6096 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6097 swiper.scrollbar.dragEl.style.transitionDuration = `${duration}ms`; 6098 } 6099 function updateSize() { 6100 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6101 const { 6102 scrollbar 6103 } = swiper; 6104 const { 6105 dragEl, 6106 el 6107 } = scrollbar; 6108 dragEl.style.width = ''; 6109 dragEl.style.height = ''; 6110 trackSize = swiper.isHorizontal() ? el.offsetWidth : el.offsetHeight; 6111 divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); 6112 if (swiper.params.scrollbar.dragSize === 'auto') { 6113 dragSize = trackSize * divider; 6114 } else { 6115 dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); 6116 } 6117 if (swiper.isHorizontal()) { 6118 dragEl.style.width = `${dragSize}px`; 6119 } else { 6120 dragEl.style.height = `${dragSize}px`; 6121 } 6122 if (divider >= 1) { 6123 el.style.display = 'none'; 6124 } else { 6125 el.style.display = ''; 6126 } 6127 if (swiper.params.scrollbar.hide) { 6128 el.style.opacity = 0; 6129 } 6130 if (swiper.params.watchOverflow && swiper.enabled) { 6131 scrollbar.el.classList[swiper.isLocked ? 'add' : 'remove'](swiper.params.scrollbar.lockClass); 6132 } 6133 } 6134 function getPointerPosition(e) { 6135 return swiper.isHorizontal() ? e.clientX : e.clientY; 6136 } 6137 function setDragPosition(e) { 6138 const { 6139 scrollbar, 6140 rtlTranslate: rtl 6141 } = swiper; 6142 const { 6143 el 6144 } = scrollbar; 6145 let positionRatio; 6146 positionRatio = (getPointerPosition(e) - elementOffset(el)[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); 6147 positionRatio = Math.max(Math.min(positionRatio, 1), 0); 6148 if (rtl) { 6149 positionRatio = 1 - positionRatio; 6150 } 6151 const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; 6152 swiper.updateProgress(position); 6153 swiper.setTranslate(position); 6154 swiper.updateActiveIndex(); 6155 swiper.updateSlidesClasses(); 6156 } 6157 function onDragStart(e) { 6158 const params = swiper.params.scrollbar; 6159 const { 6160 scrollbar, 6161 wrapperEl 6162 } = swiper; 6163 const { 6164 el, 6165 dragEl 6166 } = scrollbar; 6167 isTouched = true; 6168 dragStartPos = e.target === dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; 6169 e.preventDefault(); 6170 e.stopPropagation(); 6171 wrapperEl.style.transitionDuration = '100ms'; 6172 dragEl.style.transitionDuration = '100ms'; 6173 setDragPosition(e); 6174 clearTimeout(dragTimeout); 6175 el.style.transitionDuration = '0ms'; 6176 if (params.hide) { 6177 el.style.opacity = 1; 6178 } 6179 if (swiper.params.cssMode) {
vendor: 62,590 bytes, lines 6180-8066
6180 swiper.wrapperEl.style['scroll-snap-type'] = 'none'; 6181 } 6182 emit('scrollbarDragStart', e); 6183 } 6184 function onDragMove(e) { 6185 const { 6186 scrollbar, 6187 wrapperEl 6188 } = swiper; 6189 const { 6190 el, 6191 dragEl 6192 } = scrollbar; 6193 if (!isTouched) return; 6194 if (e.preventDefault && e.cancelable) e.preventDefault();else e.returnValue = false; 6195 setDragPosition(e); 6196 wrapperEl.style.transitionDuration = '0ms'; 6197 el.style.transitionDuration = '0ms'; 6198 dragEl.style.transitionDuration = '0ms'; 6199 emit('scrollbarDragMove', e); 6200 } 6201 function onDragEnd(e) { 6202 const params = swiper.params.scrollbar; 6203 const { 6204 scrollbar, 6205 wrapperEl 6206 } = swiper; 6207 const { 6208 el 6209 } = scrollbar; 6210 if (!isTouched) return; 6211 isTouched = false; 6212 if (swiper.params.cssMode) { 6213 swiper.wrapperEl.style['scroll-snap-type'] = ''; 6214 wrapperEl.style.transitionDuration = ''; 6215 } 6216 if (params.hide) { 6217 clearTimeout(dragTimeout); 6218 dragTimeout = nextTick(() => { 6219 el.style.opacity = 0; 6220 el.style.transitionDuration = '400ms'; 6221 }, 1000); 6222 } 6223 emit('scrollbarDragEnd', e); 6224 if (params.snapOnRelease) { 6225 swiper.slideToClosest(); 6226 } 6227 } 6228 function events(method) { 6229 const { 6230 scrollbar, 6231 params 6232 } = swiper; 6233 const el = scrollbar.el; 6234 if (!el) return; 6235 const target = el; 6236 const activeListener = params.passiveListeners ? { 6237 passive: false, 6238 capture: false 6239 } : false; 6240 const passiveListener = params.passiveListeners ? { 6241 passive: true, 6242 capture: false 6243 } : false; 6244 if (!target) return; 6245 const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 6246 target[eventMethod]('pointerdown', onDragStart, activeListener); 6247 document[eventMethod]('pointermove', onDragMove, activeListener); 6248 document[eventMethod]('pointerup', onDragEnd, passiveListener); 6249 } 6250 function enableDraggable() { 6251 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6252 events('on'); 6253 } 6254 function disableDraggable() { 6255 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6256 events('off'); 6257 } 6258 function init() { 6259 const { 6260 scrollbar, 6261 el: swiperEl 6262 } = swiper; 6263 swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { 6264 el: 'swiper-scrollbar' 6265 }); 6266 const params = swiper.params.scrollbar; 6267 if (!params.el) return; 6268 let el; 6269 if (typeof params.el === 'string' && swiper.isElement) { 6270 el = swiper.el.querySelector(params.el); 6271 } 6272 if (!el && typeof params.el === 'string') { 6273 el = document.querySelectorAll(params.el); 6274 if (!el.length) return; 6275 } else if (!el) { 6276 el = params.el; 6277 } 6278 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && el.length > 1 && swiperEl.querySelectorAll(params.el).length === 1) { 6279 el = swiperEl.querySelector(params.el); 6280 } 6281 if (el.length > 0) el = el[0]; 6282 el.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 6283 let dragEl; 6284 if (el) { 6285 dragEl = el.querySelector(classesToSelector(swiper.params.scrollbar.dragClass)); 6286 if (!dragEl) { 6287 dragEl = createElement('div', swiper.params.scrollbar.dragClass); 6288 el.append(dragEl); 6289 } 6290 } 6291 Object.assign(scrollbar, { 6292 el, 6293 dragEl 6294 }); 6295 if (params.draggable) { 6296 enableDraggable(); 6297 } 6298 if (el) { 6299 el.classList[swiper.enabled ? 'remove' : 'add'](...classesToTokens(swiper.params.scrollbar.lockClass)); 6300 } 6301 } 6302 function destroy() { 6303 const params = swiper.params.scrollbar; 6304 const el = swiper.scrollbar.el; 6305 if (el) { 6306 el.classList.remove(...classesToTokens(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass)); 6307 } 6308 disableDraggable(); 6309 } 6310 on('changeDirection', () => { 6311 if (!swiper.scrollbar || !swiper.scrollbar.el) return; 6312 const params = swiper.params.scrollbar; 6313 let { 6314 el 6315 } = swiper.scrollbar; 6316 el = makeElementsArray(el); 6317 el.forEach(subEl => { 6318 subEl.classList.remove(params.horizontalClass, params.verticalClass); 6319 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 6320 }); 6321 }); 6322 on('init', () => { 6323 if (swiper.params.scrollbar.enabled === false) { 6324 // eslint-disable-next-line 6325 disable(); 6326 } else { 6327 init(); 6328 updateSize(); 6329 setTranslate(); 6330 } 6331 }); 6332 on('update resize observerUpdate lock unlock changeDirection', () => { 6333 updateSize(); 6334 }); 6335 on('setTranslate', () => { 6336 setTranslate(); 6337 }); 6338 on('setTransition', (_s, duration) => { 6339 setTransition(duration); 6340 }); 6341 on('enable disable', () => { 6342 const { 6343 el 6344 } = swiper.scrollbar; 6345 if (el) { 6346 el.classList[swiper.enabled ? 'remove' : 'add'](...classesToTokens(swiper.params.scrollbar.lockClass)); 6347 } 6348 }); 6349 on('destroy', () => { 6350 destroy(); 6351 }); 6352 const enable = () => { 6353 swiper.el.classList.remove(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6354 if (swiper.scrollbar.el) { 6355 swiper.scrollbar.el.classList.remove(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6356 } 6357 init(); 6358 updateSize(); 6359 setTranslate(); 6360 }; 6361 const disable = () => { 6362 swiper.el.classList.add(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6363 if (swiper.scrollbar.el) { 6364 swiper.scrollbar.el.classList.add(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6365 } 6366 destroy(); 6367 }; 6368 Object.assign(swiper.scrollbar, { 6369 enable, 6370 disable, 6371 updateSize, 6372 setTranslate, 6373 init, 6374 destroy 6375 }); 6376} 6377 6378 6379 6380;// ./node_modules/swiper/modules/parallax.mjs 6381 6382 6383function Parallax(_ref) { 6384 let { 6385 swiper, 6386 extendParams, 6387 on 6388 } = _ref; 6389 extendParams({ 6390 parallax: { 6391 enabled: false 6392 } 6393 }); 6394 const elementsSelector = '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]'; 6395 const setTransform = (el, progress) => { 6396 const { 6397 rtl 6398 } = swiper; 6399 const rtlFactor = rtl ? -1 : 1; 6400 const p = el.getAttribute('data-swiper-parallax') || '0'; 6401 let x = el.getAttribute('data-swiper-parallax-x'); 6402 let y = el.getAttribute('data-swiper-parallax-y'); 6403 const scale = el.getAttribute('data-swiper-parallax-scale'); 6404 const opacity = el.getAttribute('data-swiper-parallax-opacity'); 6405 const rotate = el.getAttribute('data-swiper-parallax-rotate'); 6406 if (x || y) { 6407 x = x || '0'; 6408 y = y || '0'; 6409 } else if (swiper.isHorizontal()) { 6410 x = p; 6411 y = '0'; 6412 } else { 6413 y = p; 6414 x = '0'; 6415 } 6416 if (x.indexOf('%') >= 0) { 6417 x = `${parseInt(x, 10) * progress * rtlFactor}%`; 6418 } else { 6419 x = `${x * progress * rtlFactor}px`; 6420 } 6421 if (y.indexOf('%') >= 0) { 6422 y = `${parseInt(y, 10) * progress}%`; 6423 } else { 6424 y = `${y * progress}px`; 6425 } 6426 if (typeof opacity !== 'undefined' && opacity !== null) { 6427 const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); 6428 el.style.opacity = currentOpacity; 6429 } 6430 let transform = `translate3d(${x}, ${y}, 0px)`; 6431 if (typeof scale !== 'undefined' && scale !== null) { 6432 const currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); 6433 transform += ` scale(${currentScale})`; 6434 } 6435 if (rotate && typeof rotate !== 'undefined' && rotate !== null) { 6436 const currentRotate = rotate * progress * -1; 6437 transform += ` rotate(${currentRotate}deg)`; 6438 } 6439 el.style.transform = transform; 6440 }; 6441 const setTranslate = () => { 6442 const { 6443 el, 6444 slides, 6445 progress, 6446 snapGrid, 6447 isElement 6448 } = swiper; 6449 const elements = elementChildren(el, elementsSelector); 6450 if (swiper.isElement) { 6451 elements.push(...elementChildren(swiper.hostEl, elementsSelector)); 6452 } 6453 elements.forEach(subEl => { 6454 setTransform(subEl, progress); 6455 }); 6456 slides.forEach((slideEl, slideIndex) => { 6457 let slideProgress = slideEl.progress; 6458 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { 6459 slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); 6460 } 6461 slideProgress = Math.min(Math.max(slideProgress, -1), 1); 6462 slideEl.querySelectorAll(`${elementsSelector}, [data-swiper-parallax-rotate]`).forEach(subEl => { 6463 setTransform(subEl, slideProgress); 6464 }); 6465 }); 6466 }; 6467 const setTransition = function (duration) { 6468 if (duration === void 0) { 6469 duration = swiper.params.speed; 6470 } 6471 const { 6472 el, 6473 hostEl 6474 } = swiper; 6475 const elements = [...el.querySelectorAll(elementsSelector)]; 6476 if (swiper.isElement) { 6477 elements.push(...hostEl.querySelectorAll(elementsSelector)); 6478 } 6479 elements.forEach(parallaxEl => { 6480 let parallaxDuration = parseInt(parallaxEl.getAttribute('data-swiper-parallax-duration'), 10) || duration; 6481 if (duration === 0) parallaxDuration = 0; 6482 parallaxEl.style.transitionDuration = `${parallaxDuration}ms`; 6483 }); 6484 }; 6485 on('beforeInit', () => { 6486 if (!swiper.params.parallax.enabled) return; 6487 swiper.params.watchSlidesProgress = true; 6488 swiper.originalParams.watchSlidesProgress = true; 6489 }); 6490 on('init', () => { 6491 if (!swiper.params.parallax.enabled) return; 6492 setTranslate(); 6493 }); 6494 on('setTranslate', () => { 6495 if (!swiper.params.parallax.enabled) return; 6496 setTranslate(); 6497 }); 6498 on('setTransition', (_swiper, duration) => { 6499 if (!swiper.params.parallax.enabled) return; 6500 setTransition(duration); 6501 }); 6502} 6503 6504 6505 6506;// ./node_modules/swiper/modules/zoom.mjs 6507 6508 6509 6510function Zoom(_ref) { 6511 let { 6512 swiper, 6513 extendParams, 6514 on, 6515 emit 6516 } = _ref; 6517 const window = getWindow(); 6518 extendParams({ 6519 zoom: { 6520 enabled: false, 6521 limitToOriginalSize: false, 6522 maxRatio: 3, 6523 minRatio: 1, 6524 panOnMouseMove: false, 6525 toggle: true, 6526 containerClass: 'swiper-zoom-container', 6527 zoomedSlideClass: 'swiper-slide-zoomed' 6528 } 6529 }); 6530 swiper.zoom = { 6531 enabled: false 6532 }; 6533 let currentScale = 1; 6534 let isScaling = false; 6535 let isPanningWithMouse = false; 6536 let mousePanStart = { 6537 x: 0, 6538 y: 0 6539 }; 6540 const mousePanSensitivity = -3; // Negative to invert pan direction 6541 let fakeGestureTouched; 6542 let fakeGestureMoved; 6543 const evCache = []; 6544 const gesture = { 6545 originX: 0, 6546 originY: 0, 6547 slideEl: undefined, 6548 slideWidth: undefined, 6549 slideHeight: undefined, 6550 imageEl: undefined, 6551 imageWrapEl: undefined, 6552 maxRatio: 3 6553 }; 6554 const image = { 6555 isTouched: undefined, 6556 isMoved: undefined, 6557 currentX: undefined, 6558 currentY: undefined, 6559 minX: undefined, 6560 minY: undefined, 6561 maxX: undefined, 6562 maxY: undefined, 6563 width: undefined, 6564 height: undefined, 6565 startX: undefined, 6566 startY: undefined, 6567 touchesStart: {}, 6568 touchesCurrent: {} 6569 }; 6570 const velocity = { 6571 x: undefined, 6572 y: undefined, 6573 prevPositionX: undefined, 6574 prevPositionY: undefined, 6575 prevTime: undefined 6576 }; 6577 let scale = 1; 6578 Object.defineProperty(swiper.zoom, 'scale', { 6579 get() { 6580 return scale; 6581 }, 6582 set(value) { 6583 if (scale !== value) { 6584 const imageEl = gesture.imageEl; 6585 const slideEl = gesture.slideEl; 6586 emit('zoomChange', value, imageEl, slideEl); 6587 } 6588 scale = value; 6589 } 6590 }); 6591 function getDistanceBetweenTouches() { 6592 if (evCache.length < 2) return 1; 6593 const x1 = evCache[0].pageX; 6594 const y1 = evCache[0].pageY; 6595 const x2 = evCache[1].pageX; 6596 const y2 = evCache[1].pageY; 6597 const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2); 6598 return distance; 6599 } 6600 function getMaxRatio() { 6601 const params = swiper.params.zoom; 6602 const maxRatio = gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio; 6603 if (params.limitToOriginalSize && gesture.imageEl && gesture.imageEl.naturalWidth) { 6604 const imageMaxRatio = gesture.imageEl.naturalWidth / gesture.imageEl.offsetWidth; 6605 return Math.min(imageMaxRatio, maxRatio); 6606 } 6607 return maxRatio; 6608 } 6609 function getScaleOrigin() { 6610 if (evCache.length < 2) return { 6611 x: null, 6612 y: null 6613 }; 6614 const box = gesture.imageEl.getBoundingClientRect(); 6615 return [(evCache[0].pageX + (evCache[1].pageX - evCache[0].pageX) / 2 - box.x - window.scrollX) / currentScale, (evCache[0].pageY + (evCache[1].pageY - evCache[0].pageY) / 2 - box.y - window.scrollY) / currentScale]; 6616 } 6617 function getSlideSelector() { 6618 return swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`; 6619 } 6620 function eventWithinSlide(e) { 6621 const slideSelector = getSlideSelector(); 6622 if (e.target.matches(slideSelector)) return true; 6623 if (swiper.slides.filter(slideEl => slideEl.contains(e.target)).length > 0) return true; 6624 return false; 6625 } 6626 function eventWithinZoomContainer(e) { 6627 const selector = `.${swiper.params.zoom.containerClass}`; 6628 if (e.target.matches(selector)) return true; 6629 if ([...swiper.hostEl.querySelectorAll(selector)].filter(containerEl => containerEl.contains(e.target)).length > 0) return true; 6630 return false; 6631 } 6632 6633 // Events 6634 function onGestureStart(e) { 6635 if (e.pointerType === 'mouse') { 6636 evCache.splice(0, evCache.length); 6637 } 6638 if (!eventWithinSlide(e)) return; 6639 const params = swiper.params.zoom; 6640 fakeGestureTouched = false; 6641 fakeGestureMoved = false; 6642 evCache.push(e); 6643 if (evCache.length < 2) { 6644 return; 6645 } 6646 fakeGestureTouched = true; 6647 gesture.scaleStart = getDistanceBetweenTouches(); 6648 if (!gesture.slideEl) { 6649 gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 6650 if (!gesture.slideEl) gesture.slideEl = swiper.slides[swiper.activeIndex]; 6651 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 6652 if (imageEl) { 6653 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 6654 } 6655 gesture.imageEl = imageEl; 6656 if (imageEl) { 6657 gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0]; 6658 } else { 6659 gesture.imageWrapEl = undefined; 6660 } 6661 if (!gesture.imageWrapEl) { 6662 gesture.imageEl = undefined; 6663 return; 6664 } 6665 gesture.maxRatio = getMaxRatio(); 6666 } 6667 if (gesture.imageEl) { 6668 const [originX, originY] = getScaleOrigin(); 6669 gesture.originX = originX; 6670 gesture.originY = originY; 6671 gesture.imageEl.style.transitionDuration = '0ms'; 6672 } 6673 isScaling = true; 6674 } 6675 function onGestureChange(e) { 6676 if (!eventWithinSlide(e)) return; 6677 const params = swiper.params.zoom; 6678 const zoom = swiper.zoom; 6679 const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId); 6680 if (pointerIndex >= 0) evCache[pointerIndex] = e; 6681 if (evCache.length < 2) { 6682 return; 6683 } 6684 fakeGestureMoved = true; 6685 gesture.scaleMove = getDistanceBetweenTouches(); 6686 if (!gesture.imageEl) { 6687 return; 6688 } 6689 zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; 6690 if (zoom.scale > gesture.maxRatio) { 6691 zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5; 6692 } 6693 if (zoom.scale < params.minRatio) { 6694 zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5; 6695 } 6696 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 6697 } 6698 function onGestureEnd(e) { 6699 if (!eventWithinSlide(e)) return; 6700 if (e.pointerType === 'mouse' && e.type === 'pointerout') return; 6701 const params = swiper.params.zoom; 6702 const zoom = swiper.zoom; 6703 const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId); 6704 if (pointerIndex >= 0) evCache.splice(pointerIndex, 1); 6705 if (!fakeGestureTouched || !fakeGestureMoved) { 6706 return; 6707 } 6708 fakeGestureTouched = false; 6709 fakeGestureMoved = false; 6710 if (!gesture.imageEl) return; 6711 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); 6712 gesture.imageEl.style.transitionDuration = `${swiper.params.speed}ms`; 6713 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 6714 currentScale = zoom.scale; 6715 isScaling = false; 6716 if (zoom.scale > 1 && gesture.slideEl) { 6717 gesture.slideEl.classList.add(`${params.zoomedSlideClass}`); 6718 } else if (zoom.scale <= 1 && gesture.slideEl) { 6719 gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`); 6720 } 6721 if (zoom.scale === 1) { 6722 gesture.originX = 0; 6723 gesture.originY = 0; 6724 gesture.slideEl = undefined; 6725 } 6726 } 6727 let allowTouchMoveTimeout; 6728 function allowTouchMove() { 6729 swiper.touchEventsData.preventTouchMoveFromPointerMove = false; 6730 } 6731 function preventTouchMove() { 6732 clearTimeout(allowTouchMoveTimeout); 6733 swiper.touchEventsData.preventTouchMoveFromPointerMove = true; 6734 allowTouchMoveTimeout = setTimeout(() => { 6735 if (swiper.destroyed) return; 6736 allowTouchMove(); 6737 }); 6738 } 6739 function onTouchStart(e) { 6740 const device = swiper.device; 6741 if (!gesture.imageEl) return; 6742 if (image.isTouched) return; 6743 if (device.android && e.cancelable) e.preventDefault(); 6744 image.isTouched = true; 6745 const event = evCache.length > 0 ? evCache[0] : e; 6746 image.touchesStart.x = event.pageX; 6747 image.touchesStart.y = event.pageY; 6748 } 6749 function onTouchMove(e) { 6750 const isMouseEvent = e.pointerType === 'mouse'; 6751 const isMousePan = isMouseEvent && swiper.params.zoom.panOnMouseMove; 6752 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) { 6753 return; 6754 } 6755 const zoom = swiper.zoom; 6756 if (!gesture.imageEl) { 6757 return; 6758 } 6759 if (!image.isTouched || !gesture.slideEl) { 6760 if (isMousePan) onMouseMove(e); 6761 return; 6762 } 6763 if (isMousePan) { 6764 onMouseMove(e); 6765 return; 6766 } 6767 if (!image.isMoved) { 6768 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 6769 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 6770 image.startX = getTranslate(gesture.imageWrapEl, 'x') || 0; 6771 image.startY = getTranslate(gesture.imageWrapEl, 'y') || 0; 6772 gesture.slideWidth = gesture.slideEl.offsetWidth; 6773 gesture.slideHeight = gesture.slideEl.offsetHeight; 6774 gesture.imageWrapEl.style.transitionDuration = '0ms'; 6775 } 6776 // Define if we need image drag 6777 const scaledWidth = image.width * zoom.scale; 6778 const scaledHeight = image.height * zoom.scale; 6779 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 6780 image.maxX = -image.minX; 6781 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 6782 image.maxY = -image.minY; 6783 image.touchesCurrent.x = evCache.length > 0 ? evCache[0].pageX : e.pageX; 6784 image.touchesCurrent.y = evCache.length > 0 ? evCache[0].pageY : e.pageY; 6785 const touchesDiff = Math.max(Math.abs(image.touchesCurrent.x - image.touchesStart.x), Math.abs(image.touchesCurrent.y - image.touchesStart.y)); 6786 if (touchesDiff > 5) { 6787 swiper.allowClick = false; 6788 } 6789 if (!image.isMoved && !isScaling) { 6790 if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) { 6791 image.isTouched = false; 6792 allowTouchMove(); 6793 return; 6794 } 6795 if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) { 6796 image.isTouched = false; 6797 allowTouchMove(); 6798 return; 6799 } 6800 } 6801 if (e.cancelable) { 6802 e.preventDefault(); 6803 } 6804 e.stopPropagation(); 6805 preventTouchMove(); 6806 image.isMoved = true; 6807 const scaleRatio = (zoom.scale - currentScale) / (gesture.maxRatio - swiper.params.zoom.minRatio); 6808 const { 6809 originX, 6810 originY 6811 } = gesture; 6812 image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX + scaleRatio * (image.width - originX * 2); 6813 image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY + scaleRatio * (image.height - originY * 2); 6814 if (image.currentX < image.minX) { 6815 image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8; 6816 } 6817 if (image.currentX > image.maxX) { 6818 image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8; 6819 } 6820 if (image.currentY < image.minY) { 6821 image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8; 6822 } 6823 if (image.currentY > image.maxY) { 6824 image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8; 6825 } 6826 6827 // Velocity 6828 if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; 6829 if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; 6830 if (!velocity.prevTime) velocity.prevTime = Date.now(); 6831 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; 6832 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; 6833 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; 6834 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; 6835 velocity.prevPositionX = image.touchesCurrent.x; 6836 velocity.prevPositionY = image.touchesCurrent.y; 6837 velocity.prevTime = Date.now(); 6838 gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`; 6839 } 6840 function onTouchEnd() { 6841 const zoom = swiper.zoom; 6842 evCache.length = 0; 6843 if (!gesture.imageEl) return; 6844 if (!image.isTouched || !image.isMoved) { 6845 image.isTouched = false; 6846 image.isMoved = false; 6847 return; 6848 } 6849 image.isTouched = false; 6850 image.isMoved = false; 6851 let momentumDurationX = 300; 6852 let momentumDurationY = 300; 6853 const momentumDistanceX = velocity.x * momentumDurationX; 6854 const newPositionX = image.currentX + momentumDistanceX; 6855 const momentumDistanceY = velocity.y * momentumDurationY; 6856 const newPositionY = image.currentY + momentumDistanceY; 6857 6858 // Fix duration 6859 if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); 6860 if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); 6861 const momentumDuration = Math.max(momentumDurationX, momentumDurationY); 6862 image.currentX = newPositionX; 6863 image.currentY = newPositionY; 6864 // Define if we need image drag 6865 const scaledWidth = image.width * zoom.scale; 6866 const scaledHeight = image.height * zoom.scale; 6867 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 6868 image.maxX = -image.minX; 6869 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 6870 image.maxY = -image.minY; 6871 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); 6872 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); 6873 gesture.imageWrapEl.style.transitionDuration = `${momentumDuration}ms`; 6874 gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`; 6875 } 6876 function onTransitionEnd() { 6877 const zoom = swiper.zoom; 6878 if (gesture.slideEl && swiper.activeIndex !== swiper.slides.indexOf(gesture.slideEl)) { 6879 if (gesture.imageEl) { 6880 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 6881 } 6882 if (gesture.imageWrapEl) { 6883 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 6884 } 6885 gesture.slideEl.classList.remove(`${swiper.params.zoom.zoomedSlideClass}`); 6886 zoom.scale = 1; 6887 currentScale = 1; 6888 gesture.slideEl = undefined; 6889 gesture.imageEl = undefined; 6890 gesture.imageWrapEl = undefined; 6891 gesture.originX = 0; 6892 gesture.originY = 0; 6893 } 6894 } 6895 function onMouseMove(e) { 6896 // Only pan if zoomed in and mouse panning is enabled 6897 if (currentScale <= 1 || !gesture.imageWrapEl) return; 6898 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) return; 6899 const currentTransform = window.getComputedStyle(gesture.imageWrapEl).transform; 6900 const matrix = new window.DOMMatrix(currentTransform); 6901 if (!isPanningWithMouse) { 6902 isPanningWithMouse = true; 6903 mousePanStart.x = e.clientX; 6904 mousePanStart.y = e.clientY; 6905 image.startX = matrix.e; 6906 image.startY = matrix.f; 6907 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 6908 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 6909 gesture.slideWidth = gesture.slideEl.offsetWidth; 6910 gesture.slideHeight = gesture.slideEl.offsetHeight; 6911 return; 6912 } 6913 const deltaX = (e.clientX - mousePanStart.x) * mousePanSensitivity; 6914 const deltaY = (e.clientY - mousePanStart.y) * mousePanSensitivity; 6915 const scaledWidth = image.width * currentScale; 6916 const scaledHeight = image.height * currentScale; 6917 const slideWidth = gesture.slideWidth; 6918 const slideHeight = gesture.slideHeight; 6919 const minX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 6920 const maxX = -minX; 6921 const minY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 6922 const maxY = -minY; 6923 const newX = Math.max(Math.min(image.startX + deltaX, maxX), minX); 6924 const newY = Math.max(Math.min(image.startY + deltaY, maxY), minY); 6925 gesture.imageWrapEl.style.transitionDuration = '0ms'; 6926 gesture.imageWrapEl.style.transform = `translate3d(${newX}px, ${newY}px, 0)`; 6927 mousePanStart.x = e.clientX; 6928 mousePanStart.y = e.clientY; 6929 image.startX = newX; 6930 image.startY = newY; 6931 } 6932 function zoomIn(e) { 6933 const zoom = swiper.zoom; 6934 const params = swiper.params.zoom; 6935 if (!gesture.slideEl) { 6936 if (e && e.target) { 6937 gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 6938 } 6939 if (!gesture.slideEl) { 6940 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 6941 gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0]; 6942 } else { 6943 gesture.slideEl = swiper.slides[swiper.activeIndex]; 6944 } 6945 } 6946 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 6947 if (imageEl) { 6948 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 6949 } 6950 gesture.imageEl = imageEl; 6951 if (imageEl) { 6952 gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0]; 6953 } else { 6954 gesture.imageWrapEl = undefined; 6955 } 6956 } 6957 if (!gesture.imageEl || !gesture.imageWrapEl) return; 6958 if (swiper.params.cssMode) { 6959 swiper.wrapperEl.style.overflow = 'hidden'; 6960 swiper.wrapperEl.style.touchAction = 'none'; 6961 } 6962 gesture.slideEl.classList.add(`${params.zoomedSlideClass}`); 6963 let touchX; 6964 let touchY; 6965 let offsetX; 6966 let offsetY; 6967 let diffX; 6968 let diffY; 6969 let translateX; 6970 let translateY; 6971 let imageWidth; 6972 let imageHeight; 6973 let scaledWidth; 6974 let scaledHeight; 6975 let translateMinX; 6976 let translateMinY; 6977 let translateMaxX; 6978 let translateMaxY; 6979 let slideWidth; 6980 let slideHeight; 6981 if (typeof image.touchesStart.x === 'undefined' && e) { 6982 touchX = e.pageX; 6983 touchY = e.pageY; 6984 } else { 6985 touchX = image.touchesStart.x; 6986 touchY = image.touchesStart.y; 6987 } 6988 const forceZoomRatio = typeof e === 'number' ? e : null; 6989 if (currentScale === 1 && forceZoomRatio) { 6990 touchX = undefined; 6991 touchY = undefined; 6992 image.touchesStart.x = undefined; 6993 image.touchesStart.y = undefined; 6994 } 6995 const maxRatio = getMaxRatio(); 6996 zoom.scale = forceZoomRatio || maxRatio; 6997 currentScale = forceZoomRatio || maxRatio; 6998 if (e && !(currentScale === 1 && forceZoomRatio)) { 6999 slideWidth = gesture.slideEl.offsetWidth; 7000 slideHeight = gesture.slideEl.offsetHeight; 7001 offsetX = elementOffset(gesture.slideEl).left + window.scrollX; 7002 offsetY = elementOffset(gesture.slideEl).top + window.scrollY; 7003 diffX = offsetX + slideWidth / 2 - touchX; 7004 diffY = offsetY + slideHeight / 2 - touchY; 7005 imageWidth = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 7006 imageHeight = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 7007 scaledWidth = imageWidth * zoom.scale; 7008 scaledHeight = imageHeight * zoom.scale; 7009 translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 7010 translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 7011 translateMaxX = -translateMinX; 7012 translateMaxY = -translateMinY; 7013 translateX = diffX * zoom.scale; 7014 translateY = diffY * zoom.scale; 7015 if (translateX < translateMinX) { 7016 translateX = translateMinX; 7017 } 7018 if (translateX > translateMaxX) { 7019 translateX = translateMaxX; 7020 } 7021 if (translateY < translateMinY) { 7022 translateY = translateMinY; 7023 } 7024 if (translateY > translateMaxY) { 7025 translateY = translateMaxY; 7026 } 7027 } else { 7028 translateX = 0; 7029 translateY = 0; 7030 } 7031 if (forceZoomRatio && zoom.scale === 1) { 7032 gesture.originX = 0; 7033 gesture.originY = 0; 7034 } 7035 gesture.imageWrapEl.style.transitionDuration = '300ms'; 7036 gesture.imageWrapEl.style.transform = `translate3d(${translateX}px, ${translateY}px,0)`; 7037 gesture.imageEl.style.transitionDuration = '300ms'; 7038 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 7039 } 7040 function zoomOut() { 7041 const zoom = swiper.zoom; 7042 const params = swiper.params.zoom; 7043 if (!gesture.slideEl) { 7044 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 7045 gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0]; 7046 } else { 7047 gesture.slideEl = swiper.slides[swiper.activeIndex]; 7048 } 7049 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 7050 if (imageEl) { 7051 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 7052 } 7053 gesture.imageEl = imageEl; 7054 if (imageEl) { 7055 gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0]; 7056 } else { 7057 gesture.imageWrapEl = undefined; 7058 } 7059 } 7060 if (!gesture.imageEl || !gesture.imageWrapEl) return; 7061 if (swiper.params.cssMode) { 7062 swiper.wrapperEl.style.overflow = ''; 7063 swiper.wrapperEl.style.touchAction = ''; 7064 } 7065 zoom.scale = 1; 7066 currentScale = 1; 7067 image.touchesStart.x = undefined; 7068 image.touchesStart.y = undefined; 7069 gesture.imageWrapEl.style.transitionDuration = '300ms'; 7070 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 7071 gesture.imageEl.style.transitionDuration = '300ms'; 7072 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 7073 gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`); 7074 gesture.slideEl = undefined; 7075 gesture.originX = 0; 7076 gesture.originY = 0; 7077 if (swiper.params.zoom.panOnMouseMove) { 7078 mousePanStart = { 7079 x: 0, 7080 y: 0 7081 }; 7082 if (isPanningWithMouse) { 7083 isPanningWithMouse = false; 7084 image.startX = 0; 7085 image.startY = 0; 7086 } 7087 } 7088 } 7089 7090 // Toggle Zoom 7091 function zoomToggle(e) { 7092 const zoom = swiper.zoom; 7093 if (zoom.scale && zoom.scale !== 1) { 7094 // Zoom Out 7095 zoomOut(); 7096 } else { 7097 // Zoom In 7098 zoomIn(e); 7099 } 7100 } 7101 function getListeners() { 7102 const passiveListener = swiper.params.passiveListeners ? { 7103 passive: true, 7104 capture: false 7105 } : false; 7106 const activeListenerWithCapture = swiper.params.passiveListeners ? { 7107 passive: false, 7108 capture: true 7109 } : true; 7110 return { 7111 passiveListener, 7112 activeListenerWithCapture 7113 }; 7114 } 7115 7116 // Attach/Detach Events 7117 function enable() { 7118 const zoom = swiper.zoom; 7119 if (zoom.enabled) return; 7120 zoom.enabled = true; 7121 const { 7122 passiveListener, 7123 activeListenerWithCapture 7124 } = getListeners(); 7125 7126 // Scale image 7127 swiper.wrapperEl.addEventListener('pointerdown', onGestureStart, passiveListener); 7128 swiper.wrapperEl.addEventListener('pointermove', onGestureChange, activeListenerWithCapture); 7129 ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => { 7130 swiper.wrapperEl.addEventListener(eventName, onGestureEnd, passiveListener); 7131 }); 7132 7133 // Move image 7134 swiper.wrapperEl.addEventListener('pointermove', onTouchMove, activeListenerWithCapture); 7135 } 7136 function disable() { 7137 const zoom = swiper.zoom; 7138 if (!zoom.enabled) return; 7139 zoom.enabled = false; 7140 const { 7141 passiveListener, 7142 activeListenerWithCapture 7143 } = getListeners(); 7144 7145 // Scale image 7146 swiper.wrapperEl.removeEventListener('pointerdown', onGestureStart, passiveListener); 7147 swiper.wrapperEl.removeEventListener('pointermove', onGestureChange, activeListenerWithCapture); 7148 ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => { 7149 swiper.wrapperEl.removeEventListener(eventName, onGestureEnd, passiveListener); 7150 }); 7151 7152 // Move image 7153 swiper.wrapperEl.removeEventListener('pointermove', onTouchMove, activeListenerWithCapture); 7154 } 7155 on('init', () => { 7156 if (swiper.params.zoom.enabled) { 7157 enable(); 7158 } 7159 }); 7160 on('destroy', () => { 7161 disable(); 7162 }); 7163 on('touchStart', (_s, e) => { 7164 if (!swiper.zoom.enabled) return; 7165 onTouchStart(e); 7166 }); 7167 on('touchEnd', (_s, e) => { 7168 if (!swiper.zoom.enabled) return; 7169 onTouchEnd(); 7170 }); 7171 on('doubleTap', (_s, e) => { 7172 if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { 7173 zoomToggle(e); 7174 } 7175 }); 7176 on('transitionEnd', () => { 7177 if (swiper.zoom.enabled && swiper.params.zoom.enabled) { 7178 onTransitionEnd(); 7179 } 7180 }); 7181 on('slideChange', () => { 7182 if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { 7183 onTransitionEnd(); 7184 } 7185 }); 7186 Object.assign(swiper.zoom, { 7187 enable, 7188 disable, 7189 in: zoomIn, 7190 out: zoomOut, 7191 toggle: zoomToggle 7192 }); 7193} 7194 7195 7196 7197;// ./node_modules/swiper/modules/controller.mjs 7198 7199 7200/* eslint no-bitwise: ["error", { "allow": [">>"] }] */ 7201function Controller(_ref) { 7202 let { 7203 swiper, 7204 extendParams, 7205 on 7206 } = _ref; 7207 extendParams({ 7208 controller: { 7209 control: undefined, 7210 inverse: false, 7211 by: 'slide' // or 'container' 7212 } 7213 }); 7214 7215 swiper.controller = { 7216 control: undefined 7217 }; 7218 function LinearSpline(x, y) { 7219 const binarySearch = function search() { 7220 let maxIndex; 7221 let minIndex; 7222 let guess; 7223 return (array, val) => { 7224 minIndex = -1; 7225 maxIndex = array.length; 7226 while (maxIndex - minIndex > 1) { 7227 guess = maxIndex + minIndex >> 1; 7228 if (array[guess] <= val) { 7229 minIndex = guess; 7230 } else { 7231 maxIndex = guess; 7232 } 7233 } 7234 return maxIndex; 7235 }; 7236 }(); 7237 this.x = x; 7238 this.y = y; 7239 this.lastIndex = x.length - 1; 7240 // Given an x value (x2), return the expected y2 value: 7241 // (x1,y1) is the known point before given value, 7242 // (x3,y3) is the known point after given value. 7243 let i1; 7244 let i3; 7245 this.interpolate = function interpolate(x2) { 7246 if (!x2) return 0; 7247 7248 // Get the indexes of x1 and x3 (the array indexes before and after given x2): 7249 i3 = binarySearch(this.x, x2); 7250 i1 = i3 - 1; 7251 7252 // We have our indexes i1 & i3, so we can calculate already: 7253 // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 7254 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; 7255 }; 7256 return this; 7257 } 7258 function getInterpolateFunction(c) { 7259 swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); 7260 } 7261 function setTranslate(_t, byController) { 7262 const controlled = swiper.controller.control; 7263 let multiplier; 7264 let controlledTranslate; 7265 const Swiper = swiper.constructor; 7266 function setControlledTranslate(c) { 7267 if (c.destroyed) return; 7268 7269 // this will create an Interpolate function based on the snapGrids 7270 // x is the Grid of the scrolled scroller and y will be the controlled scroller 7271 // it makes sense to create this only once and recall it for the interpolation 7272 // the function does a lot of value caching for performance 7273 const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; 7274 if (swiper.params.controller.by === 'slide') { 7275 getInterpolateFunction(c); 7276 // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid 7277 // but it did not work out 7278 controlledTranslate = -swiper.controller.spline.interpolate(-translate); 7279 } 7280 if (!controlledTranslate || swiper.params.controller.by === 'container') { 7281 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); 7282 if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) { 7283 multiplier = 1; 7284 } 7285 controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); 7286 } 7287 if (swiper.params.controller.inverse) { 7288 controlledTranslate = c.maxTranslate() - controlledTranslate; 7289 } 7290 c.updateProgress(controlledTranslate); 7291 c.setTranslate(controlledTranslate, swiper); 7292 c.updateActiveIndex(); 7293 c.updateSlidesClasses(); 7294 } 7295 if (Array.isArray(controlled)) { 7296 for (let i = 0; i < controlled.length; i += 1) { 7297 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7298 setControlledTranslate(controlled[i]); 7299 } 7300 } 7301 } else if (controlled instanceof Swiper && byController !== controlled) { 7302 setControlledTranslate(controlled); 7303 } 7304 } 7305 function setTransition(duration, byController) { 7306 const Swiper = swiper.constructor; 7307 const controlled = swiper.controller.control; 7308 let i; 7309 function setControlledTransition(c) { 7310 if (c.destroyed) return; 7311 c.setTransition(duration, swiper); 7312 if (duration !== 0) { 7313 c.transitionStart(); 7314 if (c.params.autoHeight) { 7315 nextTick(() => { 7316 c.updateAutoHeight(); 7317 }); 7318 } 7319 elementTransitionEnd(c.wrapperEl, () => { 7320 if (!controlled) return; 7321 c.transitionEnd(); 7322 }); 7323 } 7324 } 7325 if (Array.isArray(controlled)) { 7326 for (i = 0; i < controlled.length; i += 1) { 7327 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7328 setControlledTransition(controlled[i]); 7329 } 7330 } 7331 } else if (controlled instanceof Swiper && byController !== controlled) { 7332 setControlledTransition(controlled); 7333 } 7334 } 7335 function removeSpline() { 7336 if (!swiper.controller.control) return; 7337 if (swiper.controller.spline) { 7338 swiper.controller.spline = undefined; 7339 delete swiper.controller.spline; 7340 } 7341 } 7342 on('beforeInit', () => { 7343 if (typeof window !== 'undefined' && ( 7344 // eslint-disable-line 7345 typeof swiper.params.controller.control === 'string' || swiper.params.controller.control instanceof HTMLElement)) { 7346 const controlElements = typeof swiper.params.controller.control === 'string' ? [...document.querySelectorAll(swiper.params.controller.control)] : [swiper.params.controller.control]; 7347 controlElements.forEach(controlElement => { 7348 if (!swiper.controller.control) swiper.controller.control = []; 7349 if (controlElement && controlElement.swiper) { 7350 swiper.controller.control.push(controlElement.swiper); 7351 } else if (controlElement) { 7352 const eventName = `${swiper.params.eventsPrefix}init`; 7353 const onControllerSwiper = e => { 7354 swiper.controller.control.push(e.detail[0]); 7355 swiper.update(); 7356 controlElement.removeEventListener(eventName, onControllerSwiper); 7357 }; 7358 controlElement.addEventListener(eventName, onControllerSwiper); 7359 } 7360 }); 7361 return; 7362 } 7363 swiper.controller.control = swiper.params.controller.control; 7364 }); 7365 on('update', () => { 7366 removeSpline(); 7367 }); 7368 on('resize', () => { 7369 removeSpline(); 7370 }); 7371 on('observerUpdate', () => { 7372 removeSpline(); 7373 }); 7374 on('setTranslate', (_s, translate, byController) => { 7375 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 7376 swiper.controller.setTranslate(translate, byController); 7377 }); 7378 on('setTransition', (_s, duration, byController) => { 7379 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 7380 swiper.controller.setTransition(duration, byController); 7381 }); 7382 Object.assign(swiper.controller, { 7383 setTranslate, 7384 setTransition 7385 }); 7386} 7387 7388 7389 7390;// ./node_modules/swiper/modules/a11y.mjs 7391 7392 7393 7394 7395function A11y(_ref) { 7396 let { 7397 swiper, 7398 extendParams, 7399 on 7400 } = _ref; 7401 extendParams({ 7402 a11y: { 7403 enabled: true, 7404 notificationClass: 'swiper-notification', 7405 prevSlideMessage: 'Previous slide', 7406 nextSlideMessage: 'Next slide', 7407 firstSlideMessage: 'This is the first slide', 7408 lastSlideMessage: 'This is the last slide', 7409 paginationBulletMessage: 'Go to slide {{index}}', 7410 slideLabelMessage: '{{index}} / {{slidesLength}}', 7411 containerMessage: null, 7412 containerRoleDescriptionMessage: null, 7413 containerRole: null, 7414 itemRoleDescriptionMessage: null, 7415 slideRole: 'group', 7416 id: null, 7417 scrollOnFocus: true 7418 } 7419 }); 7420 swiper.a11y = { 7421 clicked: false 7422 }; 7423 let liveRegion = null; 7424 let preventFocusHandler; 7425 let focusTargetSlideEl; 7426 let visibilityChangedTimestamp = new Date().getTime(); 7427 function notify(message) { 7428 const notification = liveRegion; 7429 if (notification.length === 0) return; 7430 notification.innerHTML = ''; 7431 notification.innerHTML = message; 7432 } 7433 function getRandomNumber(size) { 7434 if (size === void 0) { 7435 size = 16; 7436 } 7437 const randomChar = () => Math.round(16 * Math.random()).toString(16); 7438 return 'x'.repeat(size).replace(/x/g, randomChar); 7439 } 7440 function makeElFocusable(el) { 7441 el = makeElementsArray(el); 7442 el.forEach(subEl => { 7443 subEl.setAttribute('tabIndex', '0'); 7444 }); 7445 } 7446 function makeElNotFocusable(el) { 7447 el = makeElementsArray(el); 7448 el.forEach(subEl => { 7449 subEl.setAttribute('tabIndex', '-1'); 7450 }); 7451 } 7452 function addElRole(el, role) { 7453 el = makeElementsArray(el); 7454 el.forEach(subEl => { 7455 subEl.setAttribute('role', role); 7456 }); 7457 } 7458 function addElRoleDescription(el, description) { 7459 el = makeElementsArray(el); 7460 el.forEach(subEl => { 7461 subEl.setAttribute('aria-roledescription', description); 7462 }); 7463 } 7464 function addElControls(el, controls) { 7465 el = makeElementsArray(el); 7466 el.forEach(subEl => { 7467 subEl.setAttribute('aria-controls', controls); 7468 }); 7469 } 7470 function addElLabel(el, label) { 7471 el = makeElementsArray(el); 7472 el.forEach(subEl => { 7473 subEl.setAttribute('aria-label', label); 7474 }); 7475 } 7476 function addElId(el, id) { 7477 el = makeElementsArray(el); 7478 el.forEach(subEl => { 7479 subEl.setAttribute('id', id); 7480 }); 7481 } 7482 function addElLive(el, live) { 7483 el = makeElementsArray(el); 7484 el.forEach(subEl => { 7485 subEl.setAttribute('aria-live', live); 7486 }); 7487 } 7488 function disableEl(el) { 7489 el = makeElementsArray(el); 7490 el.forEach(subEl => { 7491 subEl.setAttribute('aria-disabled', true); 7492 }); 7493 } 7494 function enableEl(el) { 7495 el = makeElementsArray(el); 7496 el.forEach(subEl => { 7497 subEl.setAttribute('aria-disabled', false); 7498 }); 7499 } 7500 function onEnterOrSpaceKey(e) { 7501 if (e.keyCode !== 13 && e.keyCode !== 32) return; 7502 const params = swiper.params.a11y; 7503 const targetEl = e.target; 7504 if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) { 7505 if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return; 7506 } 7507 if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) { 7508 const prevEls = makeElementsArray(swiper.navigation.prevEl); 7509 const nextEls = makeElementsArray(swiper.navigation.nextEl); 7510 if (nextEls.includes(targetEl)) { 7511 if (!(swiper.isEnd && !swiper.params.loop)) { 7512 swiper.slideNext(); 7513 } 7514 if (swiper.isEnd) { 7515 notify(params.lastSlideMessage); 7516 } else { 7517 notify(params.nextSlideMessage); 7518 } 7519 } 7520 if (prevEls.includes(targetEl)) { 7521 if (!(swiper.isBeginning && !swiper.params.loop)) { 7522 swiper.slidePrev(); 7523 } 7524 if (swiper.isBeginning) { 7525 notify(params.firstSlideMessage); 7526 } else { 7527 notify(params.prevSlideMessage); 7528 } 7529 } 7530 } 7531 if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) { 7532 targetEl.click(); 7533 } 7534 } 7535 function updateNavigation() { 7536 if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; 7537 const { 7538 nextEl, 7539 prevEl 7540 } = swiper.navigation; 7541 if (prevEl) { 7542 if (swiper.isBeginning) { 7543 disableEl(prevEl); 7544 makeElNotFocusable(prevEl); 7545 } else { 7546 enableEl(prevEl); 7547 makeElFocusable(prevEl); 7548 } 7549 } 7550 if (nextEl) { 7551 if (swiper.isEnd) { 7552 disableEl(nextEl); 7553 makeElNotFocusable(nextEl); 7554 } else { 7555 enableEl(nextEl); 7556 makeElFocusable(nextEl); 7557 } 7558 } 7559 } 7560 function hasPagination() { 7561 return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length; 7562 } 7563 function hasClickablePagination() { 7564 return hasPagination() && swiper.params.pagination.clickable; 7565 } 7566 function updatePagination() { 7567 const params = swiper.params.a11y; 7568 if (!hasPagination()) return; 7569 swiper.pagination.bullets.forEach(bulletEl => { 7570 if (swiper.params.pagination.clickable) { 7571 makeElFocusable(bulletEl); 7572 if (!swiper.params.pagination.renderBullet) { 7573 addElRole(bulletEl, 'button'); 7574 addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, elementIndex(bulletEl) + 1)); 7575 } 7576 } 7577 if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) { 7578 bulletEl.setAttribute('aria-current', 'true'); 7579 } else { 7580 bulletEl.removeAttribute('aria-current'); 7581 } 7582 }); 7583 } 7584 const initNavEl = (el, wrapperId, message) => { 7585 makeElFocusable(el); 7586 if (el.tagName !== 'BUTTON') { 7587 addElRole(el, 'button'); 7588 el.addEventListener('keydown', onEnterOrSpaceKey); 7589 } 7590 addElLabel(el, message); 7591 addElControls(el, wrapperId); 7592 }; 7593 const handlePointerDown = e => { 7594 if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) { 7595 preventFocusHandler = true; 7596 } 7597 swiper.a11y.clicked = true; 7598 }; 7599 const handlePointerUp = () => { 7600 preventFocusHandler = false; 7601 requestAnimationFrame(() => { 7602 requestAnimationFrame(() => { 7603 if (!swiper.destroyed) { 7604 swiper.a11y.clicked = false; 7605 } 7606 }); 7607 }); 7608 }; 7609 const onVisibilityChange = e => { 7610 visibilityChangedTimestamp = new Date().getTime(); 7611 }; 7612 const handleFocus = e => { 7613 if (swiper.a11y.clicked || !swiper.params.a11y.scrollOnFocus) return; 7614 if (new Date().getTime() - visibilityChangedTimestamp < 100) return; 7615 const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 7616 if (!slideEl || !swiper.slides.includes(slideEl)) return; 7617 focusTargetSlideEl = slideEl; 7618 const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex; 7619 const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl); 7620 if (isActive || isVisible) return; 7621 if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return; 7622 if (swiper.isHorizontal()) { 7623 swiper.el.scrollLeft = 0; 7624 } else { 7625 swiper.el.scrollTop = 0; 7626 } 7627 requestAnimationFrame(() => { 7628 if (preventFocusHandler) return; 7629 if (swiper.params.loop) { 7630 swiper.slideToLoop(parseInt(slideEl.getAttribute('data-swiper-slide-index')), 0); 7631 } else { 7632 swiper.slideTo(swiper.slides.indexOf(slideEl), 0); 7633 } 7634 preventFocusHandler = false; 7635 }); 7636 }; 7637 const initSlides = () => { 7638 const params = swiper.params.a11y; 7639 if (params.itemRoleDescriptionMessage) { 7640 addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage); 7641 } 7642 if (params.slideRole) { 7643 addElRole(swiper.slides, params.slideRole); 7644 } 7645 const slidesLength = swiper.slides.length; 7646 if (params.slideLabelMessage) { 7647 swiper.slides.forEach((slideEl, index) => { 7648 const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index; 7649 const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); 7650 addElLabel(slideEl, ariaLabelMessage); 7651 }); 7652 } 7653 }; 7654 const init = () => { 7655 const params = swiper.params.a11y; 7656 swiper.el.append(liveRegion); 7657 7658 // Container 7659 const containerEl = swiper.el; 7660 if (params.containerRoleDescriptionMessage) { 7661 addElRoleDescription(containerEl, params.containerRoleDescriptionMessage); 7662 } 7663 if (params.containerMessage) { 7664 addElLabel(containerEl, params.containerMessage); 7665 } 7666 if (params.containerRole) { 7667 addElRole(containerEl, params.containerRole); 7668 } 7669 7670 // Wrapper 7671 const wrapperEl = swiper.wrapperEl; 7672 const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`; 7673 const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; 7674 addElId(wrapperEl, wrapperId); 7675 addElLive(wrapperEl, live); 7676 7677 // Slide 7678 initSlides(); 7679 7680 // Navigation 7681 let { 7682 nextEl, 7683 prevEl 7684 } = swiper.navigation ? swiper.navigation : {}; 7685 nextEl = makeElementsArray(nextEl); 7686 prevEl = makeElementsArray(prevEl); 7687 if (nextEl) { 7688 nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage)); 7689 } 7690 if (prevEl) { 7691 prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage)); 7692 } 7693 7694 // Pagination 7695 if (hasClickablePagination()) { 7696 const paginationEl = makeElementsArray(swiper.pagination.el); 7697 paginationEl.forEach(el => { 7698 el.addEventListener('keydown', onEnterOrSpaceKey); 7699 }); 7700 } 7701 7702 // Tab focus 7703 const document = getDocument(); 7704 document.addEventListener('visibilitychange', onVisibilityChange); 7705 swiper.el.addEventListener('focus', handleFocus, true); 7706 swiper.el.addEventListener('focus', handleFocus, true); 7707 swiper.el.addEventListener('pointerdown', handlePointerDown, true); 7708 swiper.el.addEventListener('pointerup', handlePointerUp, true); 7709 }; 7710 function destroy() { 7711 if (liveRegion) liveRegion.remove(); 7712 let { 7713 nextEl, 7714 prevEl 7715 } = swiper.navigation ? swiper.navigation : {}; 7716 nextEl = makeElementsArray(nextEl); 7717 prevEl = makeElementsArray(prevEl); 7718 if (nextEl) { 7719 nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey)); 7720 } 7721 if (prevEl) { 7722 prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey)); 7723 } 7724 7725 // Pagination 7726 if (hasClickablePagination()) { 7727 const paginationEl = makeElementsArray(swiper.pagination.el); 7728 paginationEl.forEach(el => { 7729 el.removeEventListener('keydown', onEnterOrSpaceKey); 7730 }); 7731 } 7732 const document = getDocument(); 7733 document.removeEventListener('visibilitychange', onVisibilityChange); 7734 // Tab focus 7735 if (swiper.el && typeof swiper.el !== 'string') { 7736 swiper.el.removeEventListener('focus', handleFocus, true); 7737 swiper.el.removeEventListener('pointerdown', handlePointerDown, true); 7738 swiper.el.removeEventListener('pointerup', handlePointerUp, true); 7739 } 7740 } 7741 on('beforeInit', () => { 7742 liveRegion = createElement('span', swiper.params.a11y.notificationClass); 7743 liveRegion.setAttribute('aria-live', 'assertive'); 7744 liveRegion.setAttribute('aria-atomic', 'true'); 7745 }); 7746 on('afterInit', () => { 7747 if (!swiper.params.a11y.enabled) return; 7748 init(); 7749 }); 7750 on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => { 7751 if (!swiper.params.a11y.enabled) return; 7752 initSlides(); 7753 }); 7754 on('fromEdge toEdge afterInit lock unlock', () => { 7755 if (!swiper.params.a11y.enabled) return; 7756 updateNavigation(); 7757 }); 7758 on('paginationUpdate', () => { 7759 if (!swiper.params.a11y.enabled) return; 7760 updatePagination(); 7761 }); 7762 on('destroy', () => { 7763 if (!swiper.params.a11y.enabled) return; 7764 destroy(); 7765 }); 7766} 7767 7768 7769 7770;// ./node_modules/swiper/modules/history.mjs 7771 7772 7773function History(_ref) { 7774 let { 7775 swiper, 7776 extendParams, 7777 on 7778 } = _ref; 7779 extendParams({ 7780 history: { 7781 enabled: false, 7782 root: '', 7783 replaceState: false, 7784 key: 'slides', 7785 keepQuery: false 7786 } 7787 }); 7788 let initialized = false; 7789 let paths = {}; 7790 const slugify = text => { 7791 return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); 7792 }; 7793 const getPathValues = urlOverride => { 7794 const window = getWindow(); 7795 let location; 7796 if (urlOverride) { 7797 location = new URL(urlOverride); 7798 } else { 7799 location = window.location; 7800 } 7801 const pathArray = location.pathname.slice(1).split('/').filter(part => part !== ''); 7802 const total = pathArray.length; 7803 const key = pathArray[total - 2]; 7804 const value = pathArray[total - 1]; 7805 return { 7806 key, 7807 value 7808 }; 7809 }; 7810 const setHistory = (key, index) => { 7811 const window = getWindow(); 7812 if (!initialized || !swiper.params.history.enabled) return; 7813 let location; 7814 if (swiper.params.url) { 7815 location = new URL(swiper.params.url); 7816 } else { 7817 location = window.location; 7818 } 7819 const slide = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${index}"]`) : swiper.slides[index]; 7820 let value = slugify(slide.getAttribute('data-history')); 7821 if (swiper.params.history.root.length > 0) { 7822 let root = swiper.params.history.root; 7823 if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); 7824 value = `${root}/${key ? `${key}/` : ''}${value}`; 7825 } else if (!location.pathname.includes(key)) { 7826 value = `${key ? `${key}/` : ''}${value}`; 7827 } 7828 if (swiper.params.history.keepQuery) { 7829 value += location.search; 7830 } 7831 const currentState = window.history.state; 7832 if (currentState && currentState.value === value) { 7833 return; 7834 } 7835 if (swiper.params.history.replaceState) { 7836 window.history.replaceState({ 7837 value 7838 }, null, value); 7839 } else { 7840 window.history.pushState({ 7841 value 7842 }, null, value); 7843 } 7844 }; 7845 const scrollToSlide = (speed, value, runCallbacks) => { 7846 if (value) { 7847 for (let i = 0, length = swiper.slides.length; i < length; i += 1) { 7848 const slide = swiper.slides[i]; 7849 const slideHistory = slugify(slide.getAttribute('data-history')); 7850 if (slideHistory === value) { 7851 const index = swiper.getSlideIndex(slide); 7852 swiper.slideTo(index, speed, runCallbacks); 7853 } 7854 } 7855 } else { 7856 swiper.slideTo(0, speed, runCallbacks); 7857 } 7858 }; 7859 const setHistoryPopState = () => { 7860 paths = getPathValues(swiper.params.url); 7861 scrollToSlide(swiper.params.speed, paths.value, false); 7862 }; 7863 const init = () => { 7864 const window = getWindow(); 7865 if (!swiper.params.history) return; 7866 if (!window.history || !window.history.pushState) { 7867 swiper.params.history.enabled = false; 7868 swiper.params.hashNavigation.enabled = true; 7869 return; 7870 } 7871 initialized = true; 7872 paths = getPathValues(swiper.params.url); 7873 if (!paths.key && !paths.value) { 7874 if (!swiper.params.history.replaceState) { 7875 window.addEventListener('popstate', setHistoryPopState); 7876 } 7877 return; 7878 } 7879 scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); 7880 if (!swiper.params.history.replaceState) { 7881 window.addEventListener('popstate', setHistoryPopState); 7882 } 7883 }; 7884 const destroy = () => { 7885 const window = getWindow(); 7886 if (!swiper.params.history.replaceState) { 7887 window.removeEventListener('popstate', setHistoryPopState); 7888 } 7889 }; 7890 on('init', () => { 7891 if (swiper.params.history.enabled) { 7892 init(); 7893 } 7894 }); 7895 on('destroy', () => { 7896 if (swiper.params.history.enabled) { 7897 destroy(); 7898 } 7899 }); 7900 on('transitionEnd _freeModeNoMomentumRelease', () => { 7901 if (initialized) { 7902 setHistory(swiper.params.history.key, swiper.activeIndex); 7903 } 7904 }); 7905 on('slideChange', () => { 7906 if (initialized && swiper.params.cssMode) { 7907 setHistory(swiper.params.history.key, swiper.activeIndex); 7908 } 7909 }); 7910} 7911 7912 7913 7914;// ./node_modules/swiper/modules/hash-navigation.mjs 7915 7916 7917 7918function HashNavigation(_ref) { 7919 let { 7920 swiper, 7921 extendParams, 7922 emit, 7923 on 7924 } = _ref; 7925 let initialized = false; 7926 const document = getDocument(); 7927 const window = getWindow(); 7928 extendParams({ 7929 hashNavigation: { 7930 enabled: false, 7931 replaceState: false, 7932 watchState: false, 7933 getSlideIndex(_s, hash) { 7934 if (swiper.virtual && swiper.params.virtual.enabled) { 7935 const slideWithHash = swiper.slides.find(slideEl => slideEl.getAttribute('data-hash') === hash); 7936 if (!slideWithHash) return 0; 7937 const index = parseInt(slideWithHash.getAttribute('data-swiper-slide-index'), 10); 7938 return index; 7939 } 7940 return swiper.getSlideIndex(elementChildren(swiper.slidesEl, `.${swiper.params.slideClass}[data-hash="${hash}"], swiper-slide[data-hash="${hash}"]`)[0]); 7941 } 7942 } 7943 }); 7944 const onHashChange = () => { 7945 emit('hashChange'); 7946 const newHash = document.location.hash.replace('#', ''); 7947 const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex]; 7948 const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') : ''; 7949 if (newHash !== activeSlideHash) { 7950 const newIndex = swiper.params.hashNavigation.getSlideIndex(swiper, newHash); 7951 if (typeof newIndex === 'undefined' || Number.isNaN(newIndex)) return; 7952 swiper.slideTo(newIndex); 7953 } 7954 }; 7955 const setHash = () => { 7956 if (!initialized || !swiper.params.hashNavigation.enabled) return; 7957 const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex]; 7958 const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') || activeSlideEl.getAttribute('data-history') : ''; 7959 if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { 7960 window.history.replaceState(null, null, `#${activeSlideHash}` || ''); 7961 emit('hashSet'); 7962 } else { 7963 document.location.hash = activeSlideHash || ''; 7964 emit('hashSet'); 7965 } 7966 }; 7967 const init = () => { 7968 if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; 7969 initialized = true; 7970 const hash = document.location.hash.replace('#', ''); 7971 if (hash) { 7972 const speed = 0; 7973 const index = swiper.params.hashNavigation.getSlideIndex(swiper, hash); 7974 swiper.slideTo(index || 0, speed, swiper.params.runCallbacksOnInit, true); 7975 } 7976 if (swiper.params.hashNavigation.watchState) { 7977 window.addEventListener('hashchange', onHashChange); 7978 } 7979 }; 7980 const destroy = () => { 7981 if (swiper.params.hashNavigation.watchState) { 7982 window.removeEventListener('hashchange', onHashChange); 7983 } 7984 }; 7985 on('init', () => { 7986 if (swiper.params.hashNavigation.enabled) { 7987 init(); 7988 } 7989 }); 7990 on('destroy', () => { 7991 if (swiper.params.hashNavigation.enabled) { 7992 destroy(); 7993 } 7994 }); 7995 on('transitionEnd _freeModeNoMomentumRelease', () => { 7996 if (initialized) { 7997 setHash(); 7998 } 7999 }); 8000 on('slideChange', () => { 8001 if (initialized && swiper.params.cssMode) { 8002 setHash(); 8003 } 8004 }); 8005} 8006 8007 8008 8009;// ./node_modules/swiper/modules/autoplay.mjs 8010 8011 8012/* eslint no-underscore-dangle: "off" */ 8013/* eslint no-use-before-define: "off" */ 8014function Autoplay(_ref) { 8015 let { 8016 swiper, 8017 extendParams, 8018 on, 8019 emit, 8020 params 8021 } = _ref; 8022 swiper.autoplay = { 8023 running: false, 8024 paused: false, 8025 timeLeft: 0 8026 }; 8027 extendParams({ 8028 autoplay: { 8029 enabled: false, 8030 delay: 3000, 8031 waitForTransition: true, 8032 disableOnInteraction: false, 8033 stopOnLastSlide: false, 8034 reverseDirection: false, 8035 pauseOnMouseEnter: false 8036 } 8037 }); 8038 let timeout; 8039 let raf; 8040 let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000; 8041 let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000; 8042 let autoplayTimeLeft; 8043 let autoplayStartTime = new Date().getTime(); 8044 let wasPaused; 8045 let isTouched; 8046 let pausedByTouch; 8047 let touchStartTimeout; 8048 let slideChanged; 8049 let pausedByInteraction; 8050 let pausedByPointerEnter; 8051 function onTransitionEnd(e) { 8052 if (!swiper || swiper.destroyed || !swiper.wrapperEl) return; 8053 if (e.target !== swiper.wrapperEl) return; 8054 swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd); 8055 if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) { 8056 return; 8057 } 8058 resume(); 8059 } 8060 const calcTimeLeft = () => { 8061 if (swiper.destroyed || !swiper.autoplay.running) return; 8062 if (swiper.autoplay.paused) { 8063 wasPaused = true; 8064 } else if (wasPaused) { 8065 autoplayDelayCurrent = autoplayTimeLeft; 8066 wasPaused = false;
vendor: 4,184 bytes, lines 8067-8186
8067 } 8068 const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime(); 8069 swiper.autoplay.timeLeft = timeLeft; 8070 emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal); 8071 raf = requestAnimationFrame(() => { 8072 calcTimeLeft(); 8073 }); 8074 }; 8075 const getSlideDelay = () => { 8076 let activeSlideEl; 8077 if (swiper.virtual && swiper.params.virtual.enabled) { 8078 activeSlideEl = swiper.slides.find(slideEl => slideEl.classList.contains('swiper-slide-active')); 8079 } else { 8080 activeSlideEl = swiper.slides[swiper.activeIndex]; 8081 } 8082 if (!activeSlideEl) return undefined; 8083 const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10); 8084 return currentSlideDelay; 8085 }; 8086 const run = delayForce => { 8087 if (swiper.destroyed || !swiper.autoplay.running) return; 8088 cancelAnimationFrame(raf); 8089 calcTimeLeft(); 8090 let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce; 8091 autoplayDelayTotal = swiper.params.autoplay.delay; 8092 autoplayDelayCurrent = swiper.params.autoplay.delay; 8093 const currentSlideDelay = getSlideDelay(); 8094 if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') { 8095 delay = currentSlideDelay; 8096 autoplayDelayTotal = currentSlideDelay; 8097 autoplayDelayCurrent = currentSlideDelay; 8098 } 8099 autoplayTimeLeft = delay; 8100 const speed = swiper.params.speed; 8101 const proceed = () => { 8102 if (!swiper || swiper.destroyed) return; 8103 if (swiper.params.autoplay.reverseDirection) { 8104 if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) { 8105 swiper.slidePrev(speed, true, true); 8106 emit('autoplay'); 8107 } else if (!swiper.params.autoplay.stopOnLastSlide) { 8108 swiper.slideTo(swiper.slides.length - 1, speed, true, true); 8109 emit('autoplay'); 8110 } 8111 } else { 8112 if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) { 8113 swiper.slideNext(speed, true, true); 8114 emit('autoplay'); 8115 } else if (!swiper.params.autoplay.stopOnLastSlide) { 8116 swiper.slideTo(0, speed, true, true); 8117 emit('autoplay'); 8118 } 8119 } 8120 if (swiper.params.cssMode) { 8121 autoplayStartTime = new Date().getTime(); 8122 requestAnimationFrame(() => { 8123 run(); 8124 }); 8125 } 8126 }; 8127 if (delay > 0) { 8128 clearTimeout(timeout); 8129 timeout = setTimeout(() => { 8130 proceed(); 8131 }, delay); 8132 } else { 8133 requestAnimationFrame(() => { 8134 proceed(); 8135 }); 8136 } 8137 8138 // eslint-disable-next-line 8139 return delay; 8140 }; 8141 const start = () => { 8142 autoplayStartTime = new Date().getTime(); 8143 swiper.autoplay.running = true; 8144 run(); 8145 emit('autoplayStart'); 8146 }; 8147 const stop = () => { 8148 swiper.autoplay.running = false; 8149 clearTimeout(timeout); 8150 cancelAnimationFrame(raf); 8151 emit('autoplayStop'); 8152 }; 8153 const pause = (internal, reset) => { 8154 if (swiper.destroyed || !swiper.autoplay.running) return; 8155 clearTimeout(timeout); 8156 if (!internal) { 8157 pausedByInteraction = true; 8158 } 8159 const proceed = () => { 8160 emit('autoplayPause'); 8161 if (swiper.params.autoplay.waitForTransition) { 8162 swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd); 8163 } else { 8164 resume(); 8165 } 8166 }; 8167 swiper.autoplay.paused = true; 8168 if (reset) { 8169 if (slideChanged) { 8170 autoplayTimeLeft = swiper.params.autoplay.delay; 8171 } 8172 slideChanged = false; 8173 proceed(); 8174 return; 8175 } 8176 const delay = autoplayTimeLeft || swiper.params.autoplay.delay; 8177 autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime); 8178 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return; 8179 if (autoplayTimeLeft < 0) autoplayTimeLeft = 0; 8180 proceed(); 8181 }; 8182 const resume = () => { 8183 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return; 8184 autoplayStartTime = new Date().getTime(); 8185 if (pausedByInteraction) { 8186 pausedByInteraction = false;
vendor: 19,125 bytes, lines 8187-8761
8187 run(autoplayTimeLeft); 8188 } else { 8189 run(); 8190 } 8191 swiper.autoplay.paused = false; 8192 emit('autoplayResume'); 8193 }; 8194 const onVisibilityChange = () => { 8195 if (swiper.destroyed || !swiper.autoplay.running) return; 8196 const document = getDocument(); 8197 if (document.visibilityState === 'hidden') { 8198 pausedByInteraction = true; 8199 pause(true); 8200 } 8201 if (document.visibilityState === 'visible') { 8202 resume(); 8203 } 8204 }; 8205 const onPointerEnter = e => { 8206 if (e.pointerType !== 'mouse') return; 8207 pausedByInteraction = true; 8208 pausedByPointerEnter = true; 8209 if (swiper.animating || swiper.autoplay.paused) return; 8210 pause(true); 8211 }; 8212 const onPointerLeave = e => { 8213 if (e.pointerType !== 'mouse') return; 8214 pausedByPointerEnter = false; 8215 if (swiper.autoplay.paused) { 8216 resume(); 8217 } 8218 }; 8219 const attachMouseEvents = () => { 8220 if (swiper.params.autoplay.pauseOnMouseEnter) { 8221 swiper.el.addEventListener('pointerenter', onPointerEnter); 8222 swiper.el.addEventListener('pointerleave', onPointerLeave); 8223 } 8224 }; 8225 const detachMouseEvents = () => { 8226 if (swiper.el && typeof swiper.el !== 'string') { 8227 swiper.el.removeEventListener('pointerenter', onPointerEnter); 8228 swiper.el.removeEventListener('pointerleave', onPointerLeave); 8229 } 8230 }; 8231 const attachDocumentEvents = () => { 8232 const document = getDocument(); 8233 document.addEventListener('visibilitychange', onVisibilityChange); 8234 }; 8235 const detachDocumentEvents = () => { 8236 const document = getDocument(); 8237 document.removeEventListener('visibilitychange', onVisibilityChange); 8238 }; 8239 on('init', () => { 8240 if (swiper.params.autoplay.enabled) { 8241 attachMouseEvents(); 8242 attachDocumentEvents(); 8243 start(); 8244 } 8245 }); 8246 on('destroy', () => { 8247 detachMouseEvents(); 8248 detachDocumentEvents(); 8249 if (swiper.autoplay.running) { 8250 stop(); 8251 } 8252 }); 8253 on('_freeModeStaticRelease', () => { 8254 if (pausedByTouch || pausedByInteraction) { 8255 resume(); 8256 } 8257 }); 8258 on('_freeModeNoMomentumRelease', () => { 8259 if (!swiper.params.autoplay.disableOnInteraction) { 8260 pause(true, true); 8261 } else { 8262 stop(); 8263 } 8264 }); 8265 on('beforeTransitionStart', (_s, speed, internal) => { 8266 if (swiper.destroyed || !swiper.autoplay.running) return; 8267 if (internal || !swiper.params.autoplay.disableOnInteraction) { 8268 pause(true, true); 8269 } else { 8270 stop(); 8271 } 8272 }); 8273 on('sliderFirstMove', () => { 8274 if (swiper.destroyed || !swiper.autoplay.running) return; 8275 if (swiper.params.autoplay.disableOnInteraction) { 8276 stop(); 8277 return; 8278 } 8279 isTouched = true; 8280 pausedByTouch = false; 8281 pausedByInteraction = false; 8282 touchStartTimeout = setTimeout(() => { 8283 pausedByInteraction = true; 8284 pausedByTouch = true; 8285 pause(true); 8286 }, 200); 8287 }); 8288 on('touchEnd', () => { 8289 if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return; 8290 clearTimeout(touchStartTimeout); 8291 clearTimeout(timeout); 8292 if (swiper.params.autoplay.disableOnInteraction) { 8293 pausedByTouch = false; 8294 isTouched = false; 8295 return; 8296 } 8297 if (pausedByTouch && swiper.params.cssMode) resume(); 8298 pausedByTouch = false; 8299 isTouched = false; 8300 }); 8301 on('slideChange', () => { 8302 if (swiper.destroyed || !swiper.autoplay.running) return; 8303 slideChanged = true; 8304 }); 8305 Object.assign(swiper.autoplay, { 8306 start, 8307 stop, 8308 pause, 8309 resume 8310 }); 8311} 8312 8313 8314 8315;// ./node_modules/swiper/modules/thumbs.mjs 8316 8317 8318 8319function Thumb(_ref) { 8320 let { 8321 swiper, 8322 extendParams, 8323 on 8324 } = _ref; 8325 extendParams({ 8326 thumbs: { 8327 swiper: null, 8328 multipleActiveThumbs: true, 8329 autoScrollOffset: 0, 8330 slideThumbActiveClass: 'swiper-slide-thumb-active', 8331 thumbsContainerClass: 'swiper-thumbs' 8332 } 8333 }); 8334 let initialized = false; 8335 let swiperCreated = false; 8336 swiper.thumbs = { 8337 swiper: null 8338 }; 8339 function onThumbClick() { 8340 const thumbsSwiper = swiper.thumbs.swiper; 8341 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8342 const clickedIndex = thumbsSwiper.clickedIndex; 8343 const clickedSlide = thumbsSwiper.clickedSlide; 8344 if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return; 8345 if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; 8346 let slideToIndex; 8347 if (thumbsSwiper.params.loop) { 8348 slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 8349 } else { 8350 slideToIndex = clickedIndex; 8351 } 8352 if (swiper.params.loop) { 8353 swiper.slideToLoop(slideToIndex); 8354 } else { 8355 swiper.slideTo(slideToIndex); 8356 } 8357 } 8358 function init() { 8359 const { 8360 thumbs: thumbsParams 8361 } = swiper.params; 8362 if (initialized) return false; 8363 initialized = true; 8364 const SwiperClass = swiper.constructor; 8365 if (thumbsParams.swiper instanceof SwiperClass) { 8366 swiper.thumbs.swiper = thumbsParams.swiper; 8367 Object.assign(swiper.thumbs.swiper.originalParams, { 8368 watchSlidesProgress: true, 8369 slideToClickedSlide: false 8370 }); 8371 Object.assign(swiper.thumbs.swiper.params, { 8372 watchSlidesProgress: true, 8373 slideToClickedSlide: false 8374 }); 8375 swiper.thumbs.swiper.update(); 8376 } else if (utils_isObject(thumbsParams.swiper)) { 8377 const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper); 8378 Object.assign(thumbsSwiperParams, { 8379 watchSlidesProgress: true, 8380 slideToClickedSlide: false 8381 }); 8382 swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); 8383 swiperCreated = true; 8384 } 8385 swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass); 8386 swiper.thumbs.swiper.on('tap', onThumbClick); 8387 return true; 8388 } 8389 function update(initial) { 8390 const thumbsSwiper = swiper.thumbs.swiper; 8391 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8392 const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; 8393 8394 // Activate thumbs 8395 let thumbsToActivate = 1; 8396 const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; 8397 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { 8398 thumbsToActivate = swiper.params.slidesPerView; 8399 } 8400 if (!swiper.params.thumbs.multipleActiveThumbs) { 8401 thumbsToActivate = 1; 8402 } 8403 thumbsToActivate = Math.floor(thumbsToActivate); 8404 thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass)); 8405 if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) { 8406 for (let i = 0; i < thumbsToActivate; i += 1) { 8407 elementChildren(thumbsSwiper.slidesEl, `[data-swiper-slide-index="${swiper.realIndex + i}"]`).forEach(slideEl => { 8408 slideEl.classList.add(thumbActiveClass); 8409 }); 8410 } 8411 } else { 8412 for (let i = 0; i < thumbsToActivate; i += 1) { 8413 if (thumbsSwiper.slides[swiper.realIndex + i]) { 8414 thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass); 8415 } 8416 } 8417 } 8418 const autoScrollOffset = swiper.params.thumbs.autoScrollOffset; 8419 const useOffset = autoScrollOffset && !thumbsSwiper.params.loop; 8420 if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { 8421 const currentThumbsIndex = thumbsSwiper.activeIndex; 8422 let newThumbsIndex; 8423 let direction; 8424 if (thumbsSwiper.params.loop) { 8425 const newThumbsSlide = thumbsSwiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`); 8426 newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide); 8427 direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; 8428 } else { 8429 newThumbsIndex = swiper.realIndex; 8430 direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; 8431 } 8432 if (useOffset) { 8433 newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; 8434 } 8435 if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { 8436 if (thumbsSwiper.params.centeredSlides) { 8437 if (newThumbsIndex > currentThumbsIndex) { 8438 newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; 8439 } else { 8440 newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; 8441 } 8442 } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ; 8443 thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); 8444 } 8445 } 8446 } 8447 on('beforeInit', () => { 8448 const { 8449 thumbs 8450 } = swiper.params; 8451 if (!thumbs || !thumbs.swiper) return; 8452 if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) { 8453 const document = getDocument(); 8454 const getThumbsElementAndInit = () => { 8455 const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper; 8456 if (thumbsElement && thumbsElement.swiper) { 8457 thumbs.swiper = thumbsElement.swiper; 8458 init(); 8459 update(true); 8460 } else if (thumbsElement) { 8461 const eventName = `${swiper.params.eventsPrefix}init`; 8462 const onThumbsSwiper = e => { 8463 thumbs.swiper = e.detail[0]; 8464 thumbsElement.removeEventListener(eventName, onThumbsSwiper); 8465 init(); 8466 update(true); 8467 thumbs.swiper.update(); 8468 swiper.update(); 8469 }; 8470 thumbsElement.addEventListener(eventName, onThumbsSwiper); 8471 } 8472 return thumbsElement; 8473 }; 8474 const watchForThumbsToAppear = () => { 8475 if (swiper.destroyed) return; 8476 const thumbsElement = getThumbsElementAndInit(); 8477 if (!thumbsElement) { 8478 requestAnimationFrame(watchForThumbsToAppear); 8479 } 8480 }; 8481 requestAnimationFrame(watchForThumbsToAppear); 8482 } else { 8483 init(); 8484 update(true); 8485 } 8486 }); 8487 on('slideChange update resize observerUpdate', () => { 8488 update(); 8489 }); 8490 on('setTransition', (_s, duration) => { 8491 const thumbsSwiper = swiper.thumbs.swiper; 8492 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8493 thumbsSwiper.setTransition(duration); 8494 }); 8495 on('beforeDestroy', () => { 8496 const thumbsSwiper = swiper.thumbs.swiper; 8497 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8498 if (swiperCreated) { 8499 thumbsSwiper.destroy(); 8500 } 8501 }); 8502 Object.assign(swiper.thumbs, { 8503 init, 8504 update 8505 }); 8506} 8507 8508 8509 8510;// ./node_modules/swiper/modules/free-mode.mjs 8511 8512 8513function freeMode(_ref) { 8514 let { 8515 swiper, 8516 extendParams, 8517 emit, 8518 once 8519 } = _ref; 8520 extendParams({ 8521 freeMode: { 8522 enabled: false, 8523 momentum: true, 8524 momentumRatio: 1, 8525 momentumBounce: true, 8526 momentumBounceRatio: 1, 8527 momentumVelocityRatio: 1, 8528 sticky: false, 8529 minimumVelocity: 0.02 8530 } 8531 }); 8532 function onTouchStart() { 8533 if (swiper.params.cssMode) return; 8534 const translate = swiper.getTranslate(); 8535 swiper.setTranslate(translate); 8536 swiper.setTransition(0); 8537 swiper.touchEventsData.velocities.length = 0; 8538 swiper.freeMode.onTouchEnd({ 8539 currentPos: swiper.rtl ? swiper.translate : -swiper.translate 8540 }); 8541 } 8542 function onTouchMove() { 8543 if (swiper.params.cssMode) return; 8544 const { 8545 touchEventsData: data, 8546 touches 8547 } = swiper; 8548 // Velocity 8549 if (data.velocities.length === 0) { 8550 data.velocities.push({ 8551 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], 8552 time: data.touchStartTime 8553 }); 8554 } 8555 data.velocities.push({ 8556 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], 8557 time: now() 8558 }); 8559 } 8560 function onTouchEnd(_ref2) { 8561 let { 8562 currentPos 8563 } = _ref2; 8564 if (swiper.params.cssMode) return; 8565 const { 8566 params, 8567 wrapperEl, 8568 rtlTranslate: rtl, 8569 snapGrid, 8570 touchEventsData: data 8571 } = swiper; 8572 // Time diff 8573 const touchEndTime = now(); 8574 const timeDiff = touchEndTime - data.touchStartTime; 8575 if (currentPos < -swiper.minTranslate()) { 8576 swiper.slideTo(swiper.activeIndex); 8577 return; 8578 } 8579 if (currentPos > -swiper.maxTranslate()) { 8580 if (swiper.slides.length < snapGrid.length) { 8581 swiper.slideTo(snapGrid.length - 1); 8582 } else { 8583 swiper.slideTo(swiper.slides.length - 1); 8584 } 8585 return; 8586 } 8587 if (params.freeMode.momentum) { 8588 if (data.velocities.length > 1) { 8589 const lastMoveEvent = data.velocities.pop(); 8590 const velocityEvent = data.velocities.pop(); 8591 const distance = lastMoveEvent.position - velocityEvent.position; 8592 const time = lastMoveEvent.time - velocityEvent.time; 8593 swiper.velocity = distance / time; 8594 swiper.velocity /= 2; 8595 if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) { 8596 swiper.velocity = 0; 8597 } 8598 // this implies that the user stopped moving a finger then released. 8599 // There would be no events with distance zero, so the last event is stale. 8600 if (time > 150 || now() - lastMoveEvent.time > 300) { 8601 swiper.velocity = 0; 8602 } 8603 } else { 8604 swiper.velocity = 0; 8605 } 8606 swiper.velocity *= params.freeMode.momentumVelocityRatio; 8607 data.velocities.length = 0; 8608 let momentumDuration = 1000 * params.freeMode.momentumRatio; 8609 const momentumDistance = swiper.velocity * momentumDuration; 8610 let newPosition = swiper.translate + momentumDistance; 8611 if (rtl) newPosition = -newPosition; 8612 let doBounce = false; 8613 let afterBouncePosition; 8614 const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; 8615 let needsLoopFix; 8616 if (newPosition < swiper.maxTranslate()) { 8617 if (params.freeMode.momentumBounce) { 8618 if (newPosition + swiper.maxTranslate() < -bounceAmount) { 8619 newPosition = swiper.maxTranslate() - bounceAmount; 8620 } 8621 afterBouncePosition = swiper.maxTranslate(); 8622 doBounce = true; 8623 data.allowMomentumBounce = true; 8624 } else { 8625 newPosition = swiper.maxTranslate(); 8626 } 8627 if (params.loop && params.centeredSlides) needsLoopFix = true; 8628 } else if (newPosition > swiper.minTranslate()) { 8629 if (params.freeMode.momentumBounce) { 8630 if (newPosition - swiper.minTranslate() > bounceAmount) { 8631 newPosition = swiper.minTranslate() + bounceAmount; 8632 } 8633 afterBouncePosition = swiper.minTranslate(); 8634 doBounce = true; 8635 data.allowMomentumBounce = true; 8636 } else { 8637 newPosition = swiper.minTranslate(); 8638 } 8639 if (params.loop && params.centeredSlides) needsLoopFix = true; 8640 } else if (params.freeMode.sticky) { 8641 let nextSlide; 8642 for (let j = 0; j < snapGrid.length; j += 1) { 8643 if (snapGrid[j] > -newPosition) { 8644 nextSlide = j; 8645 break; 8646 } 8647 } 8648 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { 8649 newPosition = snapGrid[nextSlide]; 8650 } else { 8651 newPosition = snapGrid[nextSlide - 1]; 8652 } 8653 newPosition = -newPosition; 8654 } 8655 if (needsLoopFix) { 8656 once('transitionEnd', () => { 8657 swiper.loopFix(); 8658 }); 8659 } 8660 // Fix duration 8661 if (swiper.velocity !== 0) { 8662 if (rtl) { 8663 momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); 8664 } else { 8665 momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); 8666 } 8667 if (params.freeMode.sticky) { 8668 // If freeMode.sticky is active and the user ends a swipe with a slow-velocity 8669 // event, then durations can be 20+ seconds to slide one (or zero!) slides. 8670 // It's easy to see this when simulating touch with mouse events. To fix this, 8671 // limit single-slide swipes to the default slide duration. This also has the 8672 // nice side effect of matching slide speed if the user stopped moving before 8673 // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. 8674 // For faster swipes, also apply limits (albeit higher ones). 8675 const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); 8676 const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; 8677 if (moveDistance < currentSlideSize) { 8678 momentumDuration = params.speed; 8679 } else if (moveDistance < 2 * currentSlideSize) { 8680 momentumDuration = params.speed * 1.5; 8681 } else { 8682 momentumDuration = params.speed * 2.5; 8683 } 8684 } 8685 } else if (params.freeMode.sticky) { 8686 swiper.slideToClosest(); 8687 return; 8688 } 8689 if (params.freeMode.momentumBounce && doBounce) { 8690 swiper.updateProgress(afterBouncePosition); 8691 swiper.setTransition(momentumDuration); 8692 swiper.setTranslate(newPosition); 8693 swiper.transitionStart(true, swiper.swipeDirection); 8694 swiper.animating = true; 8695 elementTransitionEnd(wrapperEl, () => { 8696 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; 8697 emit('momentumBounce'); 8698 swiper.setTransition(params.speed); 8699 setTimeout(() => { 8700 swiper.setTranslate(afterBouncePosition); 8701 elementTransitionEnd(wrapperEl, () => { 8702 if (!swiper || swiper.destroyed) return; 8703 swiper.transitionEnd(); 8704 }); 8705 }, 0); 8706 }); 8707 } else if (swiper.velocity) { 8708 emit('_freeModeNoMomentumRelease'); 8709 swiper.updateProgress(newPosition); 8710 swiper.setTransition(momentumDuration); 8711 swiper.setTranslate(newPosition); 8712 swiper.transitionStart(true, swiper.swipeDirection); 8713 if (!swiper.animating) { 8714 swiper.animating = true; 8715 elementTransitionEnd(wrapperEl, () => { 8716 if (!swiper || swiper.destroyed) return; 8717 swiper.transitionEnd(); 8718 }); 8719 } 8720 } else { 8721 swiper.updateProgress(newPosition); 8722 } 8723 swiper.updateActiveIndex(); 8724 swiper.updateSlidesClasses(); 8725 } else if (params.freeMode.sticky) { 8726 swiper.slideToClosest(); 8727 return; 8728 } else if (params.freeMode) { 8729 emit('_freeModeNoMomentumRelease'); 8730 } 8731 if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { 8732 emit('_freeModeStaticRelease'); 8733 swiper.updateProgress(); 8734 swiper.updateActiveIndex(); 8735 swiper.updateSlidesClasses(); 8736 } 8737 } 8738 Object.assign(swiper, { 8739 freeMode: { 8740 onTouchStart, 8741 onTouchMove, 8742 onTouchEnd 8743 } 8744 }); 8745} 8746 8747 8748 8749;// ./node_modules/swiper/modules/grid.mjs 8750function Grid(_ref) { 8751 let { 8752 swiper, 8753 extendParams, 8754 on 8755 } = _ref; 8756 extendParams({ 8757 grid: { 8758 rows: 1, 8759 fill: 'column' 8760 } 8761 });
vendor: 1,256 bytes, lines 8762-8796
8762 let slidesNumberEvenToRows; 8763 let slidesPerRow; 8764 let numFullColumns; 8765 let wasMultiRow; 8766 const getSpaceBetween = () => { 8767 let spaceBetween = swiper.params.spaceBetween; 8768 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 8769 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 8770 } else if (typeof spaceBetween === 'string') { 8771 spaceBetween = parseFloat(spaceBetween); 8772 } 8773 return spaceBetween; 8774 }; 8775 const initSlides = slides => { 8776 const { 8777 slidesPerView 8778 } = swiper.params; 8779 const { 8780 rows, 8781 fill 8782 } = swiper.params.grid; 8783 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 8784 numFullColumns = Math.floor(slidesLength / rows); 8785 if (Math.floor(slidesLength / rows) === slidesLength / rows) { 8786 slidesNumberEvenToRows = slidesLength; 8787 } else { 8788 slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows; 8789 } 8790 if (slidesPerView !== 'auto' && fill === 'row') { 8791 slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows); 8792 } 8793 slidesPerRow = slidesNumberEvenToRows / rows; 8794 }; 8795 const unsetSlides = () => { 8796 if (swiper.slides) {
vendor: 37,086 bytes, lines 8797-9948
8797 swiper.slides.forEach(slide => { 8798 if (slide.swiperSlideGridSet) { 8799 slide.style.height = ''; 8800 slide.style[swiper.getDirectionLabel('margin-top')] = ''; 8801 } 8802 }); 8803 } 8804 }; 8805 const updateSlide = (i, slide, slides) => { 8806 const { 8807 slidesPerGroup 8808 } = swiper.params; 8809 const spaceBetween = getSpaceBetween(); 8810 const { 8811 rows, 8812 fill 8813 } = swiper.params.grid; 8814 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 8815 // Set slides order 8816 let newSlideOrderIndex; 8817 let column; 8818 let row; 8819 if (fill === 'row' && slidesPerGroup > 1) { 8820 const groupIndex = Math.floor(i / (slidesPerGroup * rows)); 8821 const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex; 8822 const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup); 8823 row = Math.floor(slideIndexInGroup / columnsInGroup); 8824 column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup; 8825 newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows; 8826 slide.style.order = newSlideOrderIndex; 8827 } else if (fill === 'column') { 8828 column = Math.floor(i / rows); 8829 row = i - column * rows; 8830 if (column > numFullColumns || column === numFullColumns && row === rows - 1) { 8831 row += 1; 8832 if (row >= rows) { 8833 row = 0; 8834 column += 1; 8835 } 8836 } 8837 } else { 8838 row = Math.floor(i / slidesPerRow); 8839 column = i - row * slidesPerRow; 8840 } 8841 slide.row = row; 8842 slide.column = column; 8843 slide.style.height = `calc((100% - ${(rows - 1) * spaceBetween}px) / ${rows})`; 8844 slide.style[swiper.getDirectionLabel('margin-top')] = row !== 0 ? spaceBetween && `${spaceBetween}px` : ''; 8845 slide.swiperSlideGridSet = true; 8846 }; 8847 const updateWrapperSize = (slideSize, snapGrid) => { 8848 const { 8849 centeredSlides, 8850 roundLengths 8851 } = swiper.params; 8852 const spaceBetween = getSpaceBetween(); 8853 const { 8854 rows 8855 } = swiper.params.grid; 8856 swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows; 8857 swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween; 8858 if (!swiper.params.cssMode) { 8859 swiper.wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`; 8860 } 8861 if (centeredSlides) { 8862 const newSlidesGrid = []; 8863 for (let i = 0; i < snapGrid.length; i += 1) { 8864 let slidesGridItem = snapGrid[i]; 8865 if (roundLengths) slidesGridItem = Math.floor(slidesGridItem); 8866 if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem); 8867 } 8868 snapGrid.splice(0, snapGrid.length); 8869 snapGrid.push(...newSlidesGrid); 8870 } 8871 }; 8872 const onInit = () => { 8873 wasMultiRow = swiper.params.grid && swiper.params.grid.rows > 1; 8874 }; 8875 const onUpdate = () => { 8876 const { 8877 params, 8878 el 8879 } = swiper; 8880 const isMultiRow = params.grid && params.grid.rows > 1; 8881 if (wasMultiRow && !isMultiRow) { 8882 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); 8883 numFullColumns = 1; 8884 swiper.emitContainerClasses(); 8885 } else if (!wasMultiRow && isMultiRow) { 8886 el.classList.add(`${params.containerModifierClass}grid`); 8887 if (params.grid.fill === 'column') { 8888 el.classList.add(`${params.containerModifierClass}grid-column`); 8889 } 8890 swiper.emitContainerClasses(); 8891 } 8892 wasMultiRow = isMultiRow; 8893 }; 8894 on('init', onInit); 8895 on('update', onUpdate); 8896 swiper.grid = { 8897 initSlides, 8898 unsetSlides, 8899 updateSlide, 8900 updateWrapperSize 8901 }; 8902} 8903 8904 8905 8906;// ./node_modules/swiper/modules/manipulation.mjs 8907function appendSlide(slides) { 8908 const swiper = this; 8909 const { 8910 params, 8911 slidesEl 8912 } = swiper; 8913 if (params.loop) { 8914 swiper.loopDestroy(); 8915 } 8916 const appendElement = slideEl => { 8917 if (typeof slideEl === 'string') { 8918 const tempDOM = document.createElement('div'); 8919 tempDOM.innerHTML = slideEl; 8920 slidesEl.append(tempDOM.children[0]); 8921 tempDOM.innerHTML = ''; 8922 } else { 8923 slidesEl.append(slideEl); 8924 } 8925 }; 8926 if (typeof slides === 'object' && 'length' in slides) { 8927 for (let i = 0; i < slides.length; i += 1) { 8928 if (slides[i]) appendElement(slides[i]); 8929 } 8930 } else { 8931 appendElement(slides); 8932 } 8933 swiper.recalcSlides(); 8934 if (params.loop) { 8935 swiper.loopCreate(); 8936 } 8937 if (!params.observer || swiper.isElement) { 8938 swiper.update(); 8939 } 8940} 8941 8942function prependSlide(slides) { 8943 const swiper = this; 8944 const { 8945 params, 8946 activeIndex, 8947 slidesEl 8948 } = swiper; 8949 if (params.loop) { 8950 swiper.loopDestroy(); 8951 } 8952 let newActiveIndex = activeIndex + 1; 8953 const prependElement = slideEl => { 8954 if (typeof slideEl === 'string') { 8955 const tempDOM = document.createElement('div'); 8956 tempDOM.innerHTML = slideEl; 8957 slidesEl.prepend(tempDOM.children[0]); 8958 tempDOM.innerHTML = ''; 8959 } else { 8960 slidesEl.prepend(slideEl); 8961 } 8962 }; 8963 if (typeof slides === 'object' && 'length' in slides) { 8964 for (let i = 0; i < slides.length; i += 1) { 8965 if (slides[i]) prependElement(slides[i]); 8966 } 8967 newActiveIndex = activeIndex + slides.length; 8968 } else { 8969 prependElement(slides); 8970 } 8971 swiper.recalcSlides(); 8972 if (params.loop) { 8973 swiper.loopCreate(); 8974 } 8975 if (!params.observer || swiper.isElement) { 8976 swiper.update(); 8977 } 8978 swiper.slideTo(newActiveIndex, 0, false); 8979} 8980 8981function addSlide(index, slides) { 8982 const swiper = this; 8983 const { 8984 params, 8985 activeIndex, 8986 slidesEl 8987 } = swiper; 8988 let activeIndexBuffer = activeIndex; 8989 if (params.loop) { 8990 activeIndexBuffer -= swiper.loopedSlides; 8991 swiper.loopDestroy(); 8992 swiper.recalcSlides(); 8993 } 8994 const baseLength = swiper.slides.length; 8995 if (index <= 0) { 8996 swiper.prependSlide(slides); 8997 return; 8998 } 8999 if (index >= baseLength) { 9000 swiper.appendSlide(slides); 9001 return; 9002 } 9003 let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; 9004 const slidesBuffer = []; 9005 for (let i = baseLength - 1; i >= index; i -= 1) { 9006 const currentSlide = swiper.slides[i]; 9007 currentSlide.remove(); 9008 slidesBuffer.unshift(currentSlide); 9009 } 9010 if (typeof slides === 'object' && 'length' in slides) { 9011 for (let i = 0; i < slides.length; i += 1) { 9012 if (slides[i]) slidesEl.append(slides[i]); 9013 } 9014 newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; 9015 } else { 9016 slidesEl.append(slides); 9017 } 9018 for (let i = 0; i < slidesBuffer.length; i += 1) { 9019 slidesEl.append(slidesBuffer[i]); 9020 } 9021 swiper.recalcSlides(); 9022 if (params.loop) { 9023 swiper.loopCreate(); 9024 } 9025 if (!params.observer || swiper.isElement) { 9026 swiper.update(); 9027 } 9028 if (params.loop) { 9029 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 9030 } else { 9031 swiper.slideTo(newActiveIndex, 0, false); 9032 } 9033} 9034 9035function removeSlide(slidesIndexes) { 9036 const swiper = this; 9037 const { 9038 params, 9039 activeIndex 9040 } = swiper; 9041 let activeIndexBuffer = activeIndex; 9042 if (params.loop) { 9043 activeIndexBuffer -= swiper.loopedSlides; 9044 swiper.loopDestroy(); 9045 } 9046 let newActiveIndex = activeIndexBuffer; 9047 let indexToRemove; 9048 if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) { 9049 for (let i = 0; i < slidesIndexes.length; i += 1) { 9050 indexToRemove = slidesIndexes[i]; 9051 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 9052 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 9053 } 9054 newActiveIndex = Math.max(newActiveIndex, 0); 9055 } else { 9056 indexToRemove = slidesIndexes; 9057 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 9058 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 9059 newActiveIndex = Math.max(newActiveIndex, 0); 9060 } 9061 swiper.recalcSlides(); 9062 if (params.loop) { 9063 swiper.loopCreate(); 9064 } 9065 if (!params.observer || swiper.isElement) { 9066 swiper.update(); 9067 } 9068 if (params.loop) { 9069 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 9070 } else { 9071 swiper.slideTo(newActiveIndex, 0, false); 9072 } 9073} 9074 9075function removeAllSlides() { 9076 const swiper = this; 9077 const slidesIndexes = []; 9078 for (let i = 0; i < swiper.slides.length; i += 1) { 9079 slidesIndexes.push(i); 9080 } 9081 swiper.removeSlide(slidesIndexes); 9082} 9083 9084function Manipulation(_ref) { 9085 let { 9086 swiper 9087 } = _ref; 9088 Object.assign(swiper, { 9089 appendSlide: appendSlide.bind(swiper), 9090 prependSlide: prependSlide.bind(swiper), 9091 addSlide: addSlide.bind(swiper), 9092 removeSlide: removeSlide.bind(swiper), 9093 removeAllSlides: removeAllSlides.bind(swiper) 9094 }); 9095} 9096 9097 9098 9099;// ./node_modules/swiper/shared/effect-init.mjs 9100function effectInit(params) { 9101 const { 9102 effect, 9103 swiper, 9104 on, 9105 setTranslate, 9106 setTransition, 9107 overwriteParams, 9108 perspective, 9109 recreateShadows, 9110 getEffectParams 9111 } = params; 9112 on('beforeInit', () => { 9113 if (swiper.params.effect !== effect) return; 9114 swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`); 9115 if (perspective && perspective()) { 9116 swiper.classNames.push(`${swiper.params.containerModifierClass}3d`); 9117 } 9118 const overwriteParamsResult = overwriteParams ? overwriteParams() : {}; 9119 Object.assign(swiper.params, overwriteParamsResult); 9120 Object.assign(swiper.originalParams, overwriteParamsResult); 9121 }); 9122 on('setTranslate', () => { 9123 if (swiper.params.effect !== effect) return; 9124 setTranslate(); 9125 }); 9126 on('setTransition', (_s, duration) => { 9127 if (swiper.params.effect !== effect) return; 9128 setTransition(duration); 9129 }); 9130 on('transitionEnd', () => { 9131 if (swiper.params.effect !== effect) return; 9132 if (recreateShadows) { 9133 if (!getEffectParams || !getEffectParams().slideShadows) return; 9134 // remove shadows 9135 swiper.slides.forEach(slideEl => { 9136 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => shadowEl.remove()); 9137 }); 9138 // create new one 9139 recreateShadows(); 9140 } 9141 }); 9142 let requireUpdateOnVirtual; 9143 on('virtualUpdate', () => { 9144 if (swiper.params.effect !== effect) return; 9145 if (!swiper.slides.length) { 9146 requireUpdateOnVirtual = true; 9147 } 9148 requestAnimationFrame(() => { 9149 if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) { 9150 setTranslate(); 9151 requireUpdateOnVirtual = false; 9152 } 9153 }); 9154 }); 9155} 9156 9157 9158 9159;// ./node_modules/swiper/shared/effect-target.mjs 9160 9161 9162function effectTarget(effectParams, slideEl) { 9163 const transformEl = getSlideTransformEl(slideEl); 9164 if (transformEl !== slideEl) { 9165 transformEl.style.backfaceVisibility = 'hidden'; 9166 transformEl.style['-webkit-backface-visibility'] = 'hidden'; 9167 } 9168 return transformEl; 9169} 9170 9171 9172 9173;// ./node_modules/swiper/shared/effect-virtual-transition-end.mjs 9174 9175 9176function effectVirtualTransitionEnd(_ref) { 9177 let { 9178 swiper, 9179 duration, 9180 transformElements, 9181 allSlides 9182 } = _ref; 9183 const { 9184 activeIndex 9185 } = swiper; 9186 const getSlide = el => { 9187 if (!el.parentElement) { 9188 // assume shadow root 9189 const slide = swiper.slides.find(slideEl => slideEl.shadowRoot && slideEl.shadowRoot === el.parentNode); 9190 return slide; 9191 } 9192 return el.parentElement; 9193 }; 9194 if (swiper.params.virtualTranslate && duration !== 0) { 9195 let eventTriggered = false; 9196 let transitionEndTarget; 9197 if (allSlides) { 9198 transitionEndTarget = transformElements; 9199 } else { 9200 transitionEndTarget = transformElements.filter(transformEl => { 9201 const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl; 9202 return swiper.getSlideIndex(el) === activeIndex; 9203 }); 9204 } 9205 transitionEndTarget.forEach(el => { 9206 elementTransitionEnd(el, () => { 9207 if (eventTriggered) return; 9208 if (!swiper || swiper.destroyed) return; 9209 eventTriggered = true; 9210 swiper.animating = false; 9211 const evt = new window.CustomEvent('transitionend', { 9212 bubbles: true, 9213 cancelable: true 9214 }); 9215 swiper.wrapperEl.dispatchEvent(evt); 9216 }); 9217 }); 9218 } 9219} 9220 9221 9222 9223;// ./node_modules/swiper/modules/effect-fade.mjs 9224 9225 9226 9227 9228 9229function EffectFade(_ref) { 9230 let { 9231 swiper, 9232 extendParams, 9233 on 9234 } = _ref; 9235 extendParams({ 9236 fadeEffect: { 9237 crossFade: false 9238 } 9239 }); 9240 const setTranslate = () => { 9241 const { 9242 slides 9243 } = swiper; 9244 const params = swiper.params.fadeEffect; 9245 for (let i = 0; i < slides.length; i += 1) { 9246 const slideEl = swiper.slides[i]; 9247 const offset = slideEl.swiperSlideOffset; 9248 let tx = -offset; 9249 if (!swiper.params.virtualTranslate) tx -= swiper.translate; 9250 let ty = 0; 9251 if (!swiper.isHorizontal()) { 9252 ty = tx; 9253 tx = 0; 9254 } 9255 const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(slideEl.progress), 0) : 1 + Math.min(Math.max(slideEl.progress, -1), 0); 9256 const targetEl = effectTarget(params, slideEl); 9257 targetEl.style.opacity = slideOpacity; 9258 targetEl.style.transform = `translate3d(${tx}px, ${ty}px, 0px)`; 9259 } 9260 }; 9261 const setTransition = duration => { 9262 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9263 transformElements.forEach(el => { 9264 el.style.transitionDuration = `${duration}ms`; 9265 }); 9266 effectVirtualTransitionEnd({ 9267 swiper, 9268 duration, 9269 transformElements, 9270 allSlides: true 9271 }); 9272 }; 9273 effectInit({ 9274 effect: 'fade', 9275 swiper, 9276 on, 9277 setTranslate, 9278 setTransition, 9279 overwriteParams: () => ({ 9280 slidesPerView: 1, 9281 slidesPerGroup: 1, 9282 watchSlidesProgress: true, 9283 spaceBetween: 0, 9284 virtualTranslate: !swiper.params.cssMode 9285 }) 9286 }); 9287} 9288 9289 9290 9291;// ./node_modules/swiper/modules/effect-cube.mjs 9292 9293 9294 9295function EffectCube(_ref) { 9296 let { 9297 swiper, 9298 extendParams, 9299 on 9300 } = _ref; 9301 extendParams({ 9302 cubeEffect: { 9303 slideShadows: true, 9304 shadow: true, 9305 shadowOffset: 20, 9306 shadowScale: 0.94 9307 } 9308 }); 9309 const createSlideShadows = (slideEl, progress, isHorizontal) => { 9310 let shadowBefore = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 9311 let shadowAfter = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 9312 if (!shadowBefore) { 9313 shadowBefore = createElement('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}`.split(' ')); 9314 slideEl.append(shadowBefore); 9315 } 9316 if (!shadowAfter) { 9317 shadowAfter = createElement('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}`.split(' ')); 9318 slideEl.append(shadowAfter); 9319 } 9320 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 9321 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 9322 }; 9323 const recreateShadows = () => { 9324 // create new ones 9325 const isHorizontal = swiper.isHorizontal(); 9326 swiper.slides.forEach(slideEl => { 9327 const progress = Math.max(Math.min(slideEl.progress, 1), -1); 9328 createSlideShadows(slideEl, progress, isHorizontal); 9329 }); 9330 }; 9331 const setTranslate = () => { 9332 const { 9333 el, 9334 wrapperEl, 9335 slides, 9336 width: swiperWidth, 9337 height: swiperHeight, 9338 rtlTranslate: rtl, 9339 size: swiperSize, 9340 browser 9341 } = swiper; 9342 const r = getRotateFix(swiper); 9343 const params = swiper.params.cubeEffect; 9344 const isHorizontal = swiper.isHorizontal(); 9345 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 9346 let wrapperRotate = 0; 9347 let cubeShadowEl; 9348 if (params.shadow) { 9349 if (isHorizontal) { 9350 cubeShadowEl = swiper.wrapperEl.querySelector('.swiper-cube-shadow'); 9351 if (!cubeShadowEl) { 9352 cubeShadowEl = createElement('div', 'swiper-cube-shadow'); 9353 swiper.wrapperEl.append(cubeShadowEl); 9354 } 9355 cubeShadowEl.style.height = `${swiperWidth}px`; 9356 } else { 9357 cubeShadowEl = el.querySelector('.swiper-cube-shadow'); 9358 if (!cubeShadowEl) { 9359 cubeShadowEl = createElement('div', 'swiper-cube-shadow'); 9360 el.append(cubeShadowEl); 9361 } 9362 } 9363 } 9364 for (let i = 0; i < slides.length; i += 1) { 9365 const slideEl = slides[i]; 9366 let slideIndex = i; 9367 if (isVirtual) { 9368 slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10); 9369 } 9370 let slideAngle = slideIndex * 90; 9371 let round = Math.floor(slideAngle / 360); 9372 if (rtl) { 9373 slideAngle = -slideAngle; 9374 round = Math.floor(-slideAngle / 360); 9375 } 9376 const progress = Math.max(Math.min(slideEl.progress, 1), -1); 9377 let tx = 0; 9378 let ty = 0; 9379 let tz = 0; 9380 if (slideIndex % 4 === 0) { 9381 tx = -round * 4 * swiperSize; 9382 tz = 0; 9383 } else if ((slideIndex - 1) % 4 === 0) { 9384 tx = 0; 9385 tz = -round * 4 * swiperSize; 9386 } else if ((slideIndex - 2) % 4 === 0) { 9387 tx = swiperSize + round * 4 * swiperSize; 9388 tz = swiperSize; 9389 } else if ((slideIndex - 3) % 4 === 0) { 9390 tx = -swiperSize; 9391 tz = 3 * swiperSize + swiperSize * 4 * round; 9392 } 9393 if (rtl) { 9394 tx = -tx; 9395 } 9396 if (!isHorizontal) { 9397 ty = tx; 9398 tx = 0; 9399 } 9400 const transform = `rotateX(${r(isHorizontal ? 0 : -slideAngle)}deg) rotateY(${r(isHorizontal ? slideAngle : 0)}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`; 9401 if (progress <= 1 && progress > -1) { 9402 wrapperRotate = slideIndex * 90 + progress * 90; 9403 if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; 9404 } 9405 slideEl.style.transform = transform; 9406 if (params.slideShadows) { 9407 createSlideShadows(slideEl, progress, isHorizontal); 9408 } 9409 } 9410 wrapperEl.style.transformOrigin = `50% 50% -${swiperSize / 2}px`; 9411 wrapperEl.style['-webkit-transform-origin'] = `50% 50% -${swiperSize / 2}px`; 9412 if (params.shadow) { 9413 if (isHorizontal) { 9414 cubeShadowEl.style.transform = `translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(89.99deg) rotateZ(0deg) scale(${params.shadowScale})`; 9415 } else { 9416 const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; 9417 const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); 9418 const scale1 = params.shadowScale; 9419 const scale2 = params.shadowScale / multiplier; 9420 const offset = params.shadowOffset; 9421 cubeShadowEl.style.transform = `scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-89.99deg)`; 9422 } 9423 } 9424 const zFactor = (browser.isSafari || browser.isWebView) && browser.needPerspectiveFix ? -swiperSize / 2 : 0; 9425 wrapperEl.style.transform = `translate3d(0px,0,${zFactor}px) rotateX(${r(swiper.isHorizontal() ? 0 : wrapperRotate)}deg) rotateY(${r(swiper.isHorizontal() ? -wrapperRotate : 0)}deg)`; 9426 wrapperEl.style.setProperty('--swiper-cube-translate-z', `${zFactor}px`); 9427 }; 9428 const setTransition = duration => { 9429 const { 9430 el, 9431 slides 9432 } = swiper; 9433 slides.forEach(slideEl => { 9434 slideEl.style.transitionDuration = `${duration}ms`; 9435 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(subEl => { 9436 subEl.style.transitionDuration = `${duration}ms`; 9437 }); 9438 }); 9439 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { 9440 const shadowEl = el.querySelector('.swiper-cube-shadow'); 9441 if (shadowEl) shadowEl.style.transitionDuration = `${duration}ms`; 9442 } 9443 }; 9444 effectInit({ 9445 effect: 'cube', 9446 swiper, 9447 on, 9448 setTranslate, 9449 setTransition, 9450 recreateShadows, 9451 getEffectParams: () => swiper.params.cubeEffect, 9452 perspective: () => true, 9453 overwriteParams: () => ({ 9454 slidesPerView: 1, 9455 slidesPerGroup: 1, 9456 watchSlidesProgress: true, 9457 resistanceRatio: 0, 9458 spaceBetween: 0, 9459 centeredSlides: false, 9460 virtualTranslate: true 9461 }) 9462 }); 9463} 9464 9465 9466 9467;// ./node_modules/swiper/shared/create-shadow.mjs 9468 9469 9470function createShadow(suffix, slideEl, side) { 9471 const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}${suffix ? ` swiper-slide-shadow-${suffix}` : ''}`; 9472 const shadowContainer = getSlideTransformEl(slideEl); 9473 let shadowEl = shadowContainer.querySelector(`.${shadowClass.split(' ').join('.')}`); 9474 if (!shadowEl) { 9475 shadowEl = createElement('div', shadowClass.split(' ')); 9476 shadowContainer.append(shadowEl); 9477 } 9478 return shadowEl; 9479} 9480 9481 9482 9483;// ./node_modules/swiper/modules/effect-flip.mjs 9484 9485 9486 9487 9488 9489 9490function EffectFlip(_ref) { 9491 let { 9492 swiper, 9493 extendParams, 9494 on 9495 } = _ref; 9496 extendParams({ 9497 flipEffect: { 9498 slideShadows: true, 9499 limitRotation: true 9500 } 9501 }); 9502 const createSlideShadows = (slideEl, progress) => { 9503 let shadowBefore = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 9504 let shadowAfter = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 9505 if (!shadowBefore) { 9506 shadowBefore = createShadow('flip', slideEl, swiper.isHorizontal() ? 'left' : 'top'); 9507 } 9508 if (!shadowAfter) { 9509 shadowAfter = createShadow('flip', slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); 9510 } 9511 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 9512 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 9513 }; 9514 const recreateShadows = () => { 9515 // Set shadows 9516 swiper.params.flipEffect; 9517 swiper.slides.forEach(slideEl => { 9518 let progress = slideEl.progress; 9519 if (swiper.params.flipEffect.limitRotation) { 9520 progress = Math.max(Math.min(slideEl.progress, 1), -1); 9521 } 9522 createSlideShadows(slideEl, progress); 9523 }); 9524 }; 9525 const setTranslate = () => { 9526 const { 9527 slides, 9528 rtlTranslate: rtl 9529 } = swiper; 9530 const params = swiper.params.flipEffect; 9531 const rotateFix = getRotateFix(swiper); 9532 for (let i = 0; i < slides.length; i += 1) { 9533 const slideEl = slides[i]; 9534 let progress = slideEl.progress; 9535 if (swiper.params.flipEffect.limitRotation) { 9536 progress = Math.max(Math.min(slideEl.progress, 1), -1); 9537 } 9538 const offset = slideEl.swiperSlideOffset; 9539 const rotate = -180 * progress; 9540 let rotateY = rotate; 9541 let rotateX = 0; 9542 let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; 9543 let ty = 0; 9544 if (!swiper.isHorizontal()) { 9545 ty = tx; 9546 tx = 0; 9547 rotateX = -rotateY; 9548 rotateY = 0; 9549 } else if (rtl) { 9550 rotateY = -rotateY; 9551 } 9552 slideEl.style.zIndex = -Math.abs(Math.round(progress)) + slides.length; 9553 if (params.slideShadows) { 9554 createSlideShadows(slideEl, progress); 9555 } 9556 const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateFix(rotateX)}deg) rotateY(${rotateFix(rotateY)}deg)`; 9557 const targetEl = effectTarget(params, slideEl); 9558 targetEl.style.transform = transform; 9559 } 9560 }; 9561 const setTransition = duration => { 9562 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9563 transformElements.forEach(el => { 9564 el.style.transitionDuration = `${duration}ms`; 9565 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => { 9566 shadowEl.style.transitionDuration = `${duration}ms`; 9567 }); 9568 }); 9569 effectVirtualTransitionEnd({ 9570 swiper, 9571 duration, 9572 transformElements 9573 }); 9574 }; 9575 effectInit({ 9576 effect: 'flip', 9577 swiper, 9578 on, 9579 setTranslate, 9580 setTransition, 9581 recreateShadows, 9582 getEffectParams: () => swiper.params.flipEffect, 9583 perspective: () => true, 9584 overwriteParams: () => ({ 9585 slidesPerView: 1, 9586 slidesPerGroup: 1, 9587 watchSlidesProgress: true, 9588 spaceBetween: 0, 9589 virtualTranslate: !swiper.params.cssMode 9590 }) 9591 }); 9592} 9593 9594 9595 9596;// ./node_modules/swiper/modules/effect-coverflow.mjs 9597 9598 9599 9600 9601 9602function EffectCoverflow(_ref) { 9603 let { 9604 swiper, 9605 extendParams, 9606 on 9607 } = _ref; 9608 extendParams({ 9609 coverflowEffect: { 9610 rotate: 50, 9611 stretch: 0, 9612 depth: 100, 9613 scale: 1, 9614 modifier: 1, 9615 slideShadows: true 9616 } 9617 }); 9618 const setTranslate = () => { 9619 const { 9620 width: swiperWidth, 9621 height: swiperHeight, 9622 slides, 9623 slidesSizesGrid 9624 } = swiper; 9625 const params = swiper.params.coverflowEffect; 9626 const isHorizontal = swiper.isHorizontal(); 9627 const transform = swiper.translate; 9628 const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; 9629 const rotate = isHorizontal ? params.rotate : -params.rotate; 9630 const translate = params.depth; 9631 const r = getRotateFix(swiper); 9632 // Each slide offset from center 9633 for (let i = 0, length = slides.length; i < length; i += 1) { 9634 const slideEl = slides[i]; 9635 const slideSize = slidesSizesGrid[i]; 9636 const slideOffset = slideEl.swiperSlideOffset; 9637 const centerOffset = (center - slideOffset - slideSize / 2) / slideSize; 9638 const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier; 9639 let rotateY = isHorizontal ? rotate * offsetMultiplier : 0; 9640 let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; 9641 // var rotateZ = 0 9642 let translateZ = -translate * Math.abs(offsetMultiplier); 9643 let stretch = params.stretch; 9644 // Allow percentage to make a relative stretch for responsive sliders 9645 if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) { 9646 stretch = parseFloat(params.stretch) / 100 * slideSize; 9647 } 9648 let translateY = isHorizontal ? 0 : stretch * offsetMultiplier; 9649 let translateX = isHorizontal ? stretch * offsetMultiplier : 0; 9650 let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); 9651 9652 // Fix for ultra small values 9653 if (Math.abs(translateX) < 0.001) translateX = 0; 9654 if (Math.abs(translateY) < 0.001) translateY = 0; 9655 if (Math.abs(translateZ) < 0.001) translateZ = 0; 9656 if (Math.abs(rotateY) < 0.001) rotateY = 0; 9657 if (Math.abs(rotateX) < 0.001) rotateX = 0; 9658 if (Math.abs(scale) < 0.001) scale = 0; 9659 const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${r(rotateX)}deg) rotateY(${r(rotateY)}deg) scale(${scale})`; 9660 const targetEl = effectTarget(params, slideEl); 9661 targetEl.style.transform = slideTransform; 9662 slideEl.style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; 9663 if (params.slideShadows) { 9664 // Set shadows 9665 let shadowBeforeEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 9666 let shadowAfterEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 9667 if (!shadowBeforeEl) { 9668 shadowBeforeEl = createShadow('coverflow', slideEl, isHorizontal ? 'left' : 'top'); 9669 } 9670 if (!shadowAfterEl) { 9671 shadowAfterEl = createShadow('coverflow', slideEl, isHorizontal ? 'right' : 'bottom'); 9672 } 9673 if (shadowBeforeEl) shadowBeforeEl.style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; 9674 if (shadowAfterEl) shadowAfterEl.style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; 9675 } 9676 } 9677 }; 9678 const setTransition = duration => { 9679 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9680 transformElements.forEach(el => { 9681 el.style.transitionDuration = `${duration}ms`; 9682 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => { 9683 shadowEl.style.transitionDuration = `${duration}ms`; 9684 }); 9685 }); 9686 }; 9687 effectInit({ 9688 effect: 'coverflow', 9689 swiper, 9690 on, 9691 setTranslate, 9692 setTransition, 9693 perspective: () => true, 9694 overwriteParams: () => ({ 9695 watchSlidesProgress: true 9696 }) 9697 }); 9698} 9699 9700 9701 9702;// ./node_modules/swiper/modules/effect-creative.mjs 9703 9704 9705 9706 9707 9708 9709function EffectCreative(_ref) { 9710 let { 9711 swiper, 9712 extendParams, 9713 on 9714 } = _ref; 9715 extendParams({ 9716 creativeEffect: { 9717 limitProgress: 1, 9718 shadowPerProgress: false, 9719 progressMultiplier: 1, 9720 perspective: true, 9721 prev: { 9722 translate: [0, 0, 0], 9723 rotate: [0, 0, 0], 9724 opacity: 1, 9725 scale: 1 9726 }, 9727 next: { 9728 translate: [0, 0, 0], 9729 rotate: [0, 0, 0], 9730 opacity: 1, 9731 scale: 1 9732 } 9733 } 9734 }); 9735 const getTranslateValue = value => { 9736 if (typeof value === 'string') return value; 9737 return `${value}px`; 9738 }; 9739 const setTranslate = () => { 9740 const { 9741 slides, 9742 wrapperEl, 9743 slidesSizesGrid 9744 } = swiper; 9745 const params = swiper.params.creativeEffect; 9746 const { 9747 progressMultiplier: multiplier 9748 } = params; 9749 const isCenteredSlides = swiper.params.centeredSlides; 9750 const rotateFix = getRotateFix(swiper); 9751 if (isCenteredSlides) { 9752 const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0; 9753 wrapperEl.style.transform = `translateX(calc(50% - ${margin}px))`; 9754 } 9755 for (let i = 0; i < slides.length; i += 1) { 9756 const slideEl = slides[i]; 9757 const slideProgress = slideEl.progress; 9758 const progress = Math.min(Math.max(slideEl.progress, -params.limitProgress), params.limitProgress); 9759 let originalProgress = progress; 9760 if (!isCenteredSlides) { 9761 originalProgress = Math.min(Math.max(slideEl.originalProgress, -params.limitProgress), params.limitProgress); 9762 } 9763 const offset = slideEl.swiperSlideOffset; 9764 const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0]; 9765 const r = [0, 0, 0]; 9766 let custom = false; 9767 if (!swiper.isHorizontal()) { 9768 t[1] = t[0]; 9769 t[0] = 0; 9770 } 9771 let data = { 9772 translate: [0, 0, 0], 9773 rotate: [0, 0, 0], 9774 scale: 1, 9775 opacity: 1 9776 }; 9777 if (progress < 0) { 9778 data = params.next; 9779 custom = true; 9780 } else if (progress > 0) { 9781 data = params.prev; 9782 custom = true; 9783 } 9784 // set translate 9785 t.forEach((value, index) => { 9786 t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`; 9787 }); 9788 // set rotates 9789 r.forEach((value, index) => { 9790 let val = data.rotate[index] * Math.abs(progress * multiplier); 9791 r[index] = val; 9792 }); 9793 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 9794 const translateString = t.join(', '); 9795 const rotateString = `rotateX(${rotateFix(r[0])}deg) rotateY(${rotateFix(r[1])}deg) rotateZ(${rotateFix(r[2])}deg)`; 9796 const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`; 9797 const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier; 9798 const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; 9799 9800 // Set shadows 9801 if (custom && data.shadow || !custom) { 9802 let shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 9803 if (!shadowEl && data.shadow) { 9804 shadowEl = createShadow('creative', slideEl); 9805 } 9806 if (shadowEl) { 9807 const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; 9808 shadowEl.style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); 9809 } 9810 } 9811 const targetEl = effectTarget(params, slideEl); 9812 targetEl.style.transform = transform; 9813 targetEl.style.opacity = opacityString; 9814 if (data.origin) { 9815 targetEl.style.transformOrigin = data.origin; 9816 } 9817 } 9818 }; 9819 const setTransition = duration => { 9820 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9821 transformElements.forEach(el => { 9822 el.style.transitionDuration = `${duration}ms`; 9823 el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => { 9824 shadowEl.style.transitionDuration = `${duration}ms`; 9825 }); 9826 }); 9827 effectVirtualTransitionEnd({ 9828 swiper, 9829 duration, 9830 transformElements, 9831 allSlides: true 9832 }); 9833 }; 9834 effectInit({ 9835 effect: 'creative', 9836 swiper, 9837 on, 9838 setTranslate, 9839 setTransition, 9840 perspective: () => swiper.params.creativeEffect.perspective, 9841 overwriteParams: () => ({ 9842 watchSlidesProgress: true, 9843 virtualTranslate: !swiper.params.cssMode 9844 }) 9845 }); 9846} 9847 9848 9849 9850;// ./node_modules/swiper/modules/effect-cards.mjs 9851 9852 9853 9854 9855 9856 9857function EffectCards(_ref) { 9858 let { 9859 swiper, 9860 extendParams, 9861 on 9862 } = _ref; 9863 extendParams({ 9864 cardsEffect: { 9865 slideShadows: true, 9866 rotate: true, 9867 perSlideRotate: 2, 9868 perSlideOffset: 8 9869 } 9870 }); 9871 const setTranslate = () => { 9872 const { 9873 slides, 9874 activeIndex, 9875 rtlTranslate: rtl 9876 } = swiper; 9877 const params = swiper.params.cardsEffect; 9878 const { 9879 startTranslate, 9880 isTouched 9881 } = swiper.touchEventsData; 9882 const currentTranslate = rtl ? -swiper.translate : swiper.translate; 9883 for (let i = 0; i < slides.length; i += 1) { 9884 const slideEl = slides[i]; 9885 const slideProgress = slideEl.progress; 9886 const progress = Math.min(Math.max(slideProgress, -4), 4); 9887 let offset = slideEl.swiperSlideOffset; 9888 if (swiper.params.centeredSlides && !swiper.params.cssMode) { 9889 swiper.wrapperEl.style.transform = `translateX(${swiper.minTranslate()}px)`; 9890 } 9891 if (swiper.params.centeredSlides && swiper.params.cssMode) { 9892 offset -= slides[0].swiperSlideOffset; 9893 } 9894 let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; 9895 let tY = 0; 9896 const tZ = -100 * Math.abs(progress); 9897 let scale = 1; 9898 let rotate = -params.perSlideRotate * progress; 9899 let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75; 9900 const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i; 9901 const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; 9902 const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; 9903 if (isSwipeToNext || isSwipeToPrev) { 9904 const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5; 9905 rotate += -28 * progress * subProgress; 9906 scale += -0.5 * subProgress; 9907 tXAdd += 96 * subProgress; 9908 tY = `${-25 * subProgress * Math.abs(progress)}%`; 9909 } 9910 if (progress < 0) { 9911 // next 9912 tX = `calc(${tX}px ${rtl ? '-' : '+'} (${tXAdd * Math.abs(progress)}%))`; 9913 } else if (progress > 0) { 9914 // prev 9915 tX = `calc(${tX}px ${rtl ? '-' : '+'} (-${tXAdd * Math.abs(progress)}%))`; 9916 } else { 9917 tX = `${tX}px`; 9918 } 9919 if (!swiper.isHorizontal()) { 9920 const prevY = tY; 9921 tY = tX; 9922 tX = prevY; 9923 } 9924 const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`; 9925 9926 /* eslint-disable */ 9927 const transform = ` 9928 translate3d(${tX}, ${tY}, ${tZ}px) 9929 rotateZ(${params.rotate ? rtl ? -rotate : rotate : 0}deg) 9930 scale(${scaleString}) 9931 `; 9932 /* eslint-enable */ 9933 9934 if (params.slideShadows) { 9935 // Set shadows 9936 let shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 9937 if (!shadowEl) { 9938 shadowEl = createShadow('cards', slideEl); 9939 } 9940 if (shadowEl) shadowEl.style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); 9941 } 9942 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 9943 const targetEl = effectTarget(params, slideEl); 9944 targetEl.style.transform = transform; 9945 } 9946 }; 9947 const setTransition = duration => { 9948 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));
9949 transformElements.forEach(el => { 9950 el.style.transitionDuration = `${duration}ms`; 9951 el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => { 9952 shadowEl.style.transitionDuration = `${duration}ms`; 9953 }); 9954 }); 9955 effectVirtualTransitionEnd({ 9956 swiper, 9957 duration, 9958 transformElements 9959 }); 9960 }; 9961 effectInit({ 9962 effect: 'cards', 9963 swiper, 9964 on, 9965 setTranslate, 9966 setTransition, 9967 perspective: () => true, 9968 overwriteParams: () => ({ 9969 _loopSwapReset: false, 9970 watchSlidesProgress: true, 9971 loopAdditionalSlides: 3, 9972 centeredSlides: true, 9973 virtualTranslate: !swiper.params.cssMode 9974 }) 9975 }); 9976} 9977 9978 9979 9980;// ./node_modules/swiper/swiper-bundle.mjs 9981/** 9982 * Swiper 11.2.3 9983 * Most modern mobile touch slider and framework with hardware accelerated transitions 9984 * https://swiperjs.com 9985 * 9986 * Copyright 2014-2025 Vladimir Kharlampidi 9987 * 9988 * Released under the MIT License 9989 * 9990 * Released on: February 12, 2025 9991 */ 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018// Swiper Class 10019const modules = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Controller, A11y, History, HashNavigation, Autoplay, Thumb, freeMode, Grid, Manipulation, EffectFade, EffectCube, EffectFlip, EffectCoverflow, EffectCreative, EffectCards]; 10020Swiper.use(modules); 10021 10022 10023 10024;// ./packages/portal/Resources/Private/Components/Structures/Hero/Components/Teasers/Scripts/swiper/_init.ts 10025 10026function updateAccessibility(pagination, nextEl, prevEl) { 10027 const bullets = pagination.querySelectorAll('.swiper-pagination-bullet'); 10028 bullets.forEach(bullet => { 10029 bullet.setAttribute('aria-hidden', 'true'); 10030 bullet.setAttribute('tabindex', '-1'); 10031 }); 10032 nextEl?.setAttribute('tabindex', '-1'); 10033 prevEl?.setAttribute('tabindex', '-1'); 10034} 10035function handleVideosInSlides(activeIndex, slides) { 10036 slides.forEach((slide, index) => { 10037 const video = slide.querySelector('video'); 10038 if (video && video.dataset.visible === '1' && video.dataset.playing === '1') { 10039 activeIndex === index ? video.play() : video.pause(); 10040 } 10041 }); 10042} 10043document.querySelectorAll('.themes').forEach(themes => { 10044 const items = themes.querySelectorAll('.themes__item'); 10045 const pagination = themes.querySelector('.swiper-pagination'); 10046 const nextEl = themes.querySelector('.swiper-button-next'); 10047 const prevEl = themes.querySelector('.swiper-button-prev'); 10048 if (items.length >= 1) { 10049 const swiper = new Swiper(themes, { 10050 speed: 800, 10051 slidesPerView: 'auto', 10052 centeredSlides: true, 10053 pagination: { 10054 el: pagination, 10055 clickable: true 10056 }, 10057 navigation: { 10058 nextEl: nextEl, 10059 prevEl: prevEl 10060 }, 10061 keyboard: { 10062 enabled: true 10063 }, 10064 a11y: { 10065 enabled: true, 10066 slideRole: '' 10067 }, 10068 on: { 10069 slideChange: function () { 10070 updateAccessibility(pagination, nextEl, prevEl); 10071 } 10072 } 10073 }); 10074 updateAccessibility(pagination, nextEl, prevEl); 10075 const observer = new IntersectionObserver(entries => { 10076 entries.forEach(entry => { 10077 const video = entry.target.querySelector('video'); 10078 if (video) { 10079 video.dataset.visible = entry.isIntersecting ? '1' : '0'; 10080 if (entry.isIntersecting && video.dataset.playing === '1' && video.closest('.swiper-slide-active')) { 10081 video.play(); 10082 } else { 10083 video.pause(); 10084 } 10085 } 10086 }); 10087 });
10088 swiper.slides.forEach(slide => observer.observe(slide)); 10089 swiper.on('activeIndexChange', event => handleVideosInSlides(event.activeIndex, event.slides)); 10090 handleVideosInSlides(swiper.activeIndex, swiper.slides); 10091 } 10092}); 10093})(); 10094 10095// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 10096(() => { 10097 10098 10099document.querySelectorAll('[data-hero-container]').forEach(container => { 10100 const target = container.querySelector('[data-hero-target]'); 10101 const blurs = container.querySelectorAll('[data-hero-blur]'); 10102 const hides = container.querySelectorAll('[data-hero-hide]'); 10103 const playbacks = container.querySelectorAll('video[data-hero-playback]'); 10104 function callback(entries, observer) { 10105 const entry = entries[0]; 10106 let factor = entry.intersectionRatio; 10107 if (window.scrollY >= entry.target.offsetTop) { 10108 factor = 1; 10109 } 10110 hides.forEach(hide => { 10111 hide.style.opacity = `${1 - factor}`; 10112 }); 10113 blurs.forEach(blur => { 10114 blur.style.filter = `blur(${factor * 20}px)`; 10115 blur.style.transform = `scale(${1 + factor * 0.1})`; 10116 }); 10117 playbacks.forEach(playback => { 10118 try { 10119 if (factor >= 0.9) { 10120 playback.pause(); 10121 } else { 10122 playback.play(); 10123 playback.playbackRate = 1 - factor; 10124 } 10125 } catch (e) {} 10126 }); 10127 } 10128 new IntersectionObserver(callback, { 10129 threshold: Array.from(Array(101).keys()).map(i => i / 100) 10130 }).observe(target); 10131}); 10132})(); 10133 10134/******/ })() 10135;
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.