vendor: 27,150 bytes, lines 1-733
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ 764: 5/***/ (function(module) { 6 7/*! 8* sweetalert2 v11.4.13 9* Released under the MIT License. 10*/ 11(function (global, factory) { 12 true ? module.exports = factory() : 13 0; 14}(this, function () { 'use strict'; 15 16 const consolePrefix = 'SweetAlert2:'; 17 /** 18 * Filter the unique values into a new array 19 * @param arr 20 */ 21 22 const uniqueArray = arr => { 23 const result = []; 24 25 for (let i = 0; i < arr.length; i++) { 26 if (result.indexOf(arr[i]) === -1) { 27 result.push(arr[i]); 28 } 29 } 30 31 return result; 32 }; 33 /** 34 * Capitalize the first letter of a string 35 * @param {string} str 36 * @returns {string} 37 */ 38 39 const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1); 40 /** 41 * @param {NodeList | HTMLCollection | NamedNodeMap} nodeList 42 * @returns {array} 43 */ 44 45 const toArray = nodeList => Array.prototype.slice.call(nodeList); 46 /** 47 * Standardize console warnings 48 * @param {string | array} message 49 */ 50 51 const warn = message => { 52 console.warn("".concat(consolePrefix, " ").concat(typeof message === 'object' ? message.join(' ') : message)); 53 }; 54 /** 55 * Standardize console errors 56 * @param {string} message 57 */ 58 59 const error = message => { 60 console.error("".concat(consolePrefix, " ").concat(message)); 61 }; 62 /** 63 * Private global state for `warnOnce` 64 * @type {Array} 65 * @private 66 */ 67 68 const previousWarnOnceMessages = []; 69 /** 70 * Show a console warning, but only if it hasn't already been shown 71 * @param {string} message 72 */ 73 74 const warnOnce = message => { 75 if (!previousWarnOnceMessages.includes(message)) { 76 previousWarnOnceMessages.push(message); 77 warn(message); 78 } 79 }; 80 /** 81 * Show a one-time console warning about deprecated params/methods 82 */ 83 84 const warnAboutDeprecation = (deprecatedParam, useInstead) => { 85 warnOnce("\"".concat(deprecatedParam, "\" is deprecated and will be removed in the next major release. Please use \"").concat(useInstead, "\" instead.")); 86 }; 87 /** 88 * If `arg` is a function, call it (with no arguments or context) and return the result. 89 * Otherwise, just pass the value through 90 * @param arg 91 */ 92 93 const callIfFunction = arg => typeof arg === 'function' ? arg() : arg; 94 const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function'; 95 const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg); 96 const isPromise = arg => arg && Promise.resolve(arg) === arg; 97 const getRandomElement = arr => arr[Math.floor(Math.random() * arr.length)]; 98 99 const defaultParams = { 100 title: '', 101 titleText: '', 102 text: '', 103 html: '', 104 footer: '', 105 icon: undefined, 106 iconColor: undefined, 107 iconHtml: undefined, 108 template: undefined, 109 toast: false, 110 showClass: { 111 popup: 'swal2-show', 112 backdrop: 'swal2-backdrop-show', 113 icon: 'swal2-icon-show' 114 }, 115 hideClass: { 116 popup: 'swal2-hide', 117 backdrop: 'swal2-backdrop-hide', 118 icon: 'swal2-icon-hide' 119 }, 120 customClass: {}, 121 target: 'body', 122 color: undefined, 123 backdrop: true, 124 heightAuto: true, 125 allowOutsideClick: true, 126 allowEscapeKey: true, 127 allowEnterKey: true, 128 stopKeydownPropagation: true, 129 keydownListenerCapture: false, 130 showConfirmButton: true, 131 showDenyButton: false, 132 showCancelButton: false, 133 preConfirm: undefined, 134 preDeny: undefined, 135 confirmButtonText: 'OK', 136 confirmButtonAriaLabel: '', 137 confirmButtonColor: undefined, 138 denyButtonText: 'No', 139 denyButtonAriaLabel: '', 140 denyButtonColor: undefined, 141 cancelButtonText: 'Cancel', 142 cancelButtonAriaLabel: '', 143 cancelButtonColor: undefined, 144 buttonsStyling: true, 145 reverseButtons: false, 146 focusConfirm: true, 147 focusDeny: false, 148 focusCancel: false, 149 returnFocus: true, 150 showCloseButton: false, 151 closeButtonHtml: '×', 152 closeButtonAriaLabel: 'Close this dialog', 153 loaderHtml: '', 154 showLoaderOnConfirm: false, 155 showLoaderOnDeny: false, 156 imageUrl: undefined, 157 imageWidth: undefined, 158 imageHeight: undefined, 159 imageAlt: '', 160 timer: undefined, 161 timerProgressBar: false, 162 width: undefined, 163 padding: undefined, 164 background: undefined, 165 input: undefined, 166 inputPlaceholder: '', 167 inputLabel: '', 168 inputValue: '', 169 inputOptions: {}, 170 inputAutoTrim: true, 171 inputAttributes: {}, 172 inputValidator: undefined, 173 returnInputValueOnDeny: false, 174 validationMessage: undefined, 175 grow: false, 176 position: 'center', 177 progressSteps: [], 178 currentProgressStep: undefined, 179 progressStepsDistance: undefined, 180 willOpen: undefined, 181 didOpen: undefined, 182 didRender: undefined, 183 willClose: undefined, 184 didClose: undefined, 185 didDestroy: undefined, 186 scrollbarPadding: true 187 }; 188 const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose']; 189 const deprecatedParams = {}; 190 const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture']; 191 /** 192 * Is valid parameter 193 * @param {string} paramName 194 */ 195 196 const isValidParameter = paramName => { 197 return Object.prototype.hasOwnProperty.call(defaultParams, paramName); 198 }; 199 /** 200 * Is valid parameter for Swal.update() method 201 * @param {string} paramName 202 */ 203 204 const isUpdatableParameter = paramName => { 205 return updatableParams.indexOf(paramName) !== -1; 206 }; 207 /** 208 * Is deprecated parameter 209 * @param {string} paramName 210 */ 211 212 const isDeprecatedParameter = paramName => { 213 return deprecatedParams[paramName]; 214 }; 215 216 const checkIfParamIsValid = param => { 217 if (!isValidParameter(param)) { 218 warn("Unknown parameter \"".concat(param, "\"")); 219 } 220 }; 221 222 const checkIfToastParamIsValid = param => { 223 if (toastIncompatibleParams.includes(param)) { 224 warn("The parameter \"".concat(param, "\" is incompatible with toasts")); 225 } 226 }; 227 228 const checkIfParamIsDeprecated = param => { 229 if (isDeprecatedParameter(param)) { 230 warnAboutDeprecation(param, isDeprecatedParameter(param)); 231 } 232 }; 233 /** 234 * Show relevant warnings for given params 235 * 236 * @param params 237 */ 238 239 240 const showWarningsForParams = params => { 241 if (!params.backdrop && params.allowOutsideClick) { 242 warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'); 243 } 244 245 for (const param in params) { 246 checkIfParamIsValid(param); 247 248 if (params.toast) { 249 checkIfToastParamIsValid(param); 250 } 251 252 checkIfParamIsDeprecated(param); 253 } 254 }; 255 256 const swalPrefix = 'swal2-'; 257 const prefix = items => { 258 const result = {}; 259 260 for (const i in items) { 261 result[items[i]] = swalPrefix + items[i]; 262 } 263 264 return result; 265 }; 266 const swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error', 'no-war']); 267 const iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']); 268 269 /** 270 * Gets the popup container which contains the backdrop and the popup itself. 271 * 272 * @returns {HTMLElement | null} 273 */ 274 275 const getContainer = () => document.body.querySelector(".".concat(swalClasses.container)); 276 const elementBySelector = selectorString => { 277 const container = getContainer(); 278 return container ? container.querySelector(selectorString) : null; 279 }; 280 281 const elementByClass = className => { 282 return elementBySelector(".".concat(className)); 283 }; 284 285 const getPopup = () => elementByClass(swalClasses.popup); 286 const getIcon = () => elementByClass(swalClasses.icon); 287 const getTitle = () => elementByClass(swalClasses.title); 288 const getHtmlContainer = () => elementByClass(swalClasses['html-container']); 289 const getImage = () => elementByClass(swalClasses.image); 290 const getProgressSteps = () => elementByClass(swalClasses['progress-steps']); 291 const getValidationMessage = () => elementByClass(swalClasses['validation-message']); 292 const getConfirmButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.confirm)); 293 const getDenyButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.deny)); 294 const getInputLabel = () => elementByClass(swalClasses['input-label']); 295 const getLoader = () => elementBySelector(".".concat(swalClasses.loader)); 296 const getCancelButton = () => elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.cancel)); 297 const getActions = () => elementByClass(swalClasses.actions); 298 const getFooter = () => elementByClass(swalClasses.footer); 299 const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']); 300 const getCloseButton = () => elementByClass(swalClasses.close); // https://github.com/jkup/focusable/blob/master/index.js 301 302 const focusable = "\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex=\"0\"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n"; 303 const getFocusableElements = () => { 304 const focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')) // sort according to tabindex 305 .sort((a, b) => { 306 const tabindexA = parseInt(a.getAttribute('tabindex')); 307 const tabindexB = parseInt(b.getAttribute('tabindex')); 308 309 if (tabindexA > tabindexB) { 310 return 1; 311 } else if (tabindexA < tabindexB) { 312 return -1; 313 } 314 315 return 0; 316 }); 317 const otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(el => el.getAttribute('tabindex') !== '-1'); 318 return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(el => isVisible(el)); 319 }; 320 const isModal = () => { 321 return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']); 322 }; 323 const isToast = () => { 324 return getPopup() && hasClass(getPopup(), swalClasses.toast); 325 }; 326 const isLoading = () => { 327 return getPopup().hasAttribute('data-loading'); 328 }; 329 330 const states = { 331 previousBodyPadding: null 332 }; 333 /** 334 * Securely set innerHTML of an element 335 * https://github.com/sweetalert2/sweetalert2/issues/1926 336 * 337 * @param {HTMLElement} elem 338 * @param {string} html 339 */ 340 341 const setInnerHtml = (elem, html) => { 342 elem.textContent = ''; 343 344 if (html) { 345 const parser = new DOMParser(); 346 const parsed = parser.parseFromString(html, "text/html"); 347 toArray(parsed.querySelector('head').childNodes).forEach(child => { 348 elem.appendChild(child); 349 }); 350 toArray(parsed.querySelector('body').childNodes).forEach(child => { 351 elem.appendChild(child); 352 }); 353 } 354 }; 355 /** 356 * @param {HTMLElement} elem 357 * @param {string} className 358 * @returns {boolean} 359 */ 360 361 const hasClass = (elem, className) => { 362 if (!className) { 363 return false; 364 } 365 366 const classList = className.split(/\s+/); 367 368 for (let i = 0; i < classList.length; i++) { 369 if (!elem.classList.contains(classList[i])) { 370 return false; 371 } 372 } 373 374 return true; 375 }; 376 377 const removeCustomClasses = (elem, params) => { 378 toArray(elem.classList).forEach(className => { 379 if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass).includes(className)) { 380 elem.classList.remove(className); 381 } 382 }); 383 }; 384 385 const applyCustomClass = (elem, params, className) => { 386 removeCustomClasses(elem, params); 387 388 if (params.customClass && params.customClass[className]) { 389 if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) { 390 return warn("Invalid type of customClass.".concat(className, "! Expected string or iterable object, got \"").concat(typeof params.customClass[className], "\"")); 391 } 392 393 addClass(elem, params.customClass[className]); 394 } 395 }; 396 /** 397 * @param {HTMLElement} popup 398 * @param {import('./renderers/renderInput').InputClass} inputClass 399 * @returns {HTMLInputElement | null} 400 */ 401 402 const getInput = (popup, inputClass) => { 403 if (!inputClass) { 404 return null; 405 } 406 407 switch (inputClass) { 408 case 'select': 409 case 'textarea': 410 case 'file': 411 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses[inputClass])); 412 413 case 'checkbox': 414 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.checkbox, " input")); 415 416 case 'radio': 417 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.radio, " input:checked")) || popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.radio, " input:first-child")); 418 419 case 'range': 420 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.range, " input")); 421 422 default: 423 return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.input)); 424 } 425 }; 426 /** 427 * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input 428 */ 429 430 const focusInput = input => { 431 input.focus(); // place cursor at end of text in text input 432 433 if (input.type !== 'file') { 434 // http://stackoverflow.com/a/2345915 435 const val = input.value; 436 input.value = ''; 437 input.value = val; 438 } 439 }; 440 /** 441 * @param {HTMLElement | HTMLElement[] | null} target 442 * @param {string | string[] | readonly string[]} classList 443 * @param {boolean} condition 444 */ 445 446 const toggleClass = (target, classList, condition) => { 447 if (!target || !classList) { 448 return; 449 } 450 451 if (typeof classList === 'string') { 452 classList = classList.split(/\s+/).filter(Boolean); 453 } 454 455 classList.forEach(className => { 456 if (Array.isArray(target)) { 457 target.forEach(elem => { 458 condition ? elem.classList.add(className) : elem.classList.remove(className); 459 }); 460 } else { 461 condition ? target.classList.add(className) : target.classList.remove(className); 462 } 463 }); 464 }; 465 /** 466 * @param {HTMLElement | HTMLElement[] | null} target 467 * @param {string | string[] | readonly string[]} classList 468 */ 469 470 const addClass = (target, classList) => { 471 toggleClass(target, classList, true); 472 }; 473 /** 474 * @param {HTMLElement | HTMLElement[] | null} target 475 * @param {string | string[] | readonly string[]} classList 476 */ 477 478 const removeClass = (target, classList) => { 479 toggleClass(target, classList, false); 480 }; 481 /** 482 * Get direct child of an element by class name 483 * 484 * @param {HTMLElement} elem 485 * @param {string} className 486 * @returns {HTMLElement | null} 487 */ 488 489 const getDirectChildByClass = (elem, className) => { 490 const childNodes = toArray(elem.childNodes); 491 492 for (let i = 0; i < childNodes.length; i++) { 493 if (hasClass(childNodes[i], className)) { 494 return childNodes[i]; 495 } 496 } 497 }; 498 /** 499 * @param {HTMLElement} elem 500 * @param {string} property 501 * @param {*} value 502 */ 503 504 const applyNumericalStyle = (elem, property, value) => { 505 if (value === "".concat(parseInt(value))) { 506 value = parseInt(value); 507 } 508 509 if (value || parseInt(value) === 0) { 510 elem.style[property] = typeof value === 'number' ? "".concat(value, "px") : value; 511 } else { 512 elem.style.removeProperty(property); 513 } 514 }; 515 /** 516 * @param {HTMLElement} elem 517 * @param {string} display 518 */ 519 520 const show = function (elem) { 521 let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex'; 522 elem.style.display = display; 523 }; 524 /** 525 * @param {HTMLElement} elem 526 */ 527 528 const hide = elem => { 529 elem.style.display = 'none'; 530 }; 531 const setStyle = (parent, selector, property, value) => { 532 const el = parent.querySelector(selector); 533 534 if (el) { 535 el.style[property] = value; 536 } 537 }; 538 const toggle = (elem, condition, display) => { 539 condition ? show(elem, display) : hide(elem); 540 }; // borrowed from jquery $(elem).is(':visible') implementation 541 542 const isVisible = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)); 543 const allButtonsAreHidden = () => !isVisible(getConfirmButton()) && !isVisible(getDenyButton()) && !isVisible(getCancelButton()); 544 const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight); // borrowed from https://stackoverflow.com/a/46352119 545 546 const hasCssAnimation = elem => { 547 const style = window.getComputedStyle(elem); 548 const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0'); 549 const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0'); 550 return animDuration > 0 || transDuration > 0; 551 }; 552 const animateTimerProgressBar = function (timer) { 553 let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 554 const timerProgressBar = getTimerProgressBar(); 555 556 if (isVisible(timerProgressBar)) { 557 if (reset) { 558 timerProgressBar.style.transition = 'none'; 559 timerProgressBar.style.width = '100%'; 560 } 561 562 setTimeout(() => { 563 timerProgressBar.style.transition = "width ".concat(timer / 1000, "s linear"); 564 timerProgressBar.style.width = '0%'; 565 }, 10); 566 } 567 }; 568 const stopTimerProgressBar = () => { 569 const timerProgressBar = getTimerProgressBar(); 570 const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width); 571 timerProgressBar.style.removeProperty('transition'); 572 timerProgressBar.style.width = '100%'; 573 const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width); 574 const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100; 575 timerProgressBar.style.removeProperty('transition'); 576 timerProgressBar.style.width = "".concat(timerProgressBarPercent, "%"); 577 }; 578 579 /** 580 * Detect Node env 581 * 582 * @returns {boolean} 583 */ 584 const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined'; 585 586 const RESTORE_FOCUS_TIMEOUT = 100; 587 588 const globalState = {}; 589 590 const focusPreviousActiveElement = () => { 591 if (globalState.previousActiveElement && globalState.previousActiveElement.focus) { 592 globalState.previousActiveElement.focus(); 593 globalState.previousActiveElement = null; 594 } else if (document.body) { 595 document.body.focus(); 596 } 597 }; // Restore previous active (focused) element 598 599 600 const restoreActiveElement = returnFocus => { 601 return new Promise(resolve => { 602 if (!returnFocus) { 603 return resolve(); 604 } 605 606 const x = window.scrollX; 607 const y = window.scrollY; 608 globalState.restoreFocusTimeout = setTimeout(() => { 609 focusPreviousActiveElement(); 610 resolve(); 611 }, RESTORE_FOCUS_TIMEOUT); // issues/900 612 613 window.scrollTo(x, y); 614 }); 615 }; 616 617 const sweetHTML = "\n <div aria-labelledby=\"".concat(swalClasses.title, "\" aria-describedby=\"").concat(swalClasses['html-container'], "\" class=\"").concat(swalClasses.popup, "\" tabindex=\"-1\">\n <button type=\"button\" class=\"").concat(swalClasses.close, "\"></button>\n <ul class=\"").concat(swalClasses['progress-steps'], "\"></ul>\n <div class=\"").concat(swalClasses.icon, "\"></div>\n <img class=\"").concat(swalClasses.image, "\" />\n <h2 class=\"").concat(swalClasses.title, "\" id=\"").concat(swalClasses.title, "\"></h2>\n <div class=\"").concat(swalClasses['html-container'], "\" id=\"").concat(swalClasses['html-container'], "\"></div>\n <input class=\"").concat(swalClasses.input, "\" />\n <input type=\"file\" class=\"").concat(swalClasses.file, "\" />\n <div class=\"").concat(swalClasses.range, "\">\n <input type=\"range\" />\n <output></output>\n </div>\n <select class=\"").concat(swalClasses.select, "\"></select>\n <div class=\"").concat(swalClasses.radio, "\"></div>\n <label for=\"").concat(swalClasses.checkbox, "\" class=\"").concat(swalClasses.checkbox, "\">\n <input type=\"checkbox\" />\n <span class=\"").concat(swalClasses.label, "\"></span>\n </label>\n <textarea class=\"").concat(swalClasses.textarea, "\"></textarea>\n <div class=\"").concat(swalClasses['validation-message'], "\" id=\"").concat(swalClasses['validation-message'], "\"></div>\n <div class=\"").concat(swalClasses.actions, "\">\n <div class=\"").concat(swalClasses.loader, "\"></div>\n <button type=\"button\" class=\"").concat(swalClasses.confirm, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.deny, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.cancel, "\"></button>\n </div>\n <div class=\"").concat(swalClasses.footer, "\"></div>\n <div class=\"").concat(swalClasses['timer-progress-bar-container'], "\">\n <div class=\"").concat(swalClasses['timer-progress-bar'], "\"></div>\n </div>\n </div>\n").replace(/(^|\n)\s*/g, ''); 618 619 const resetOldContainer = () => { 620 const oldContainer = getContainer(); 621 622 if (!oldContainer) { 623 return false; 624 } 625 626 oldContainer.remove(); 627 removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]); 628 return true; 629 }; 630 631 const resetValidationMessage = () => { 632 globalState.currentInstance.resetValidationMessage(); 633 }; 634 635 const addInputChangeListeners = () => { 636 const popup = getPopup(); 637 const input = getDirectChildByClass(popup, swalClasses.input); 638 const file = getDirectChildByClass(popup, swalClasses.file); 639 const range = popup.querySelector(".".concat(swalClasses.range, " input")); 640 const rangeOutput = popup.querySelector(".".concat(swalClasses.range, " output")); 641 const select = getDirectChildByClass(popup, swalClasses.select); 642 const checkbox = popup.querySelector(".".concat(swalClasses.checkbox, " input")); 643 const textarea = getDirectChildByClass(popup, swalClasses.textarea); 644 input.oninput = resetValidationMessage; 645 file.onchange = resetValidationMessage; 646 select.onchange = resetValidationMessage; 647 checkbox.onchange = resetValidationMessage; 648 textarea.oninput = resetValidationMessage; 649 650 range.oninput = () => { 651 resetValidationMessage(); 652 rangeOutput.value = range.value; 653 }; 654 655 range.onchange = () => { 656 resetValidationMessage(); 657 range.nextSibling.value = range.value; 658 }; 659 }; 660 661 const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target; 662 663 const setupAccessibility = params => { 664 const popup = getPopup(); 665 popup.setAttribute('role', params.toast ? 'alert' : 'dialog'); 666 popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); 667 668 if (!params.toast) { 669 popup.setAttribute('aria-modal', 'true'); 670 } 671 }; 672 673 const setupRTL = targetElement => { 674 if (window.getComputedStyle(targetElement).direction === 'rtl') { 675 addClass(getContainer(), swalClasses.rtl); 676 } 677 }; 678 /* 679 * Add modal + backdrop + no-war message for Russians to DOM 680 */ 681 682 683 const init = params => { 684 // Clean up the old popup container if it exists 685 const oldContainerExisted = resetOldContainer(); 686 /* istanbul ignore if */ 687 688 if (isNodeEnv()) { 689 error('SweetAlert2 requires document to initialize'); 690 return; 691 } 692 693 const container = document.createElement('div'); 694 container.className = swalClasses.container; 695 696 if (oldContainerExisted) { 697 addClass(container, swalClasses['no-transition']); 698 } 699 700 setInnerHtml(container, sweetHTML); 701 const targetElement = getTarget(params.target); 702 targetElement.appendChild(container); 703 setupAccessibility(params); 704 setupRTL(targetElement); 705 addInputChangeListeners(); 706 noWarMessageForRussians(container, params); 707 }; 708 709 const noWarMessageForRussians = (container, params) => { 710 if (params.toast) { 711 return; 712 } // This message is targeted at people who are corrupted by propaganda, everybody else 713 // is already against war either silently or actively. 714 // 715 // The point is to wrap the truth-bomb into a patriotic title so they will actually click it 716 // and listen to the uncomfortable truth about the war from the people they love or respect. 717 718 719 const message = getRandomElement([{ 720 text: 'ШÐÐРЦÐÐÐÐÐÐРобÑаÑилÑÑ <br> к РУССÐÐÐУ ÐÐÐ ÐÐУ о войне', 721 // Arnold is loved in Russia by all people including those who are for this war 722 // His speech might change the mind of those who are brainwashed by propaganda 723 youtubeId: 'fWClXZd9c78' 724 }, { 725 text: 'РУССÐÐÐ ÐÐТРÐÐТ <br> оÑкÑÑл главнÑÑ ÑÐ°Ð¹Ð½Ñ ÑпеÑопеÑаÑии', 726 // In this video one of the most famous Russian nationalist leaders, Dmitry Demushkin, 727 // explains that this war has no sense and produces the exact opposite result of what 728 // it was intended to do. 729 youtubeId: '_RjBNkn88yA' 730 }, { 731 text: 'ÐÐÐ ÐÐ ÐÐÐÐÐ ÐССÐРСТРÐÐÐÐÐ <br> дал оÑÐµÐ½ÐºÑ Ñ Ð¾Ð´Ñ ÑпеÑопеÑаÑии', 732 // In this video Igor Girkin, who played a key role in the annexation of Crimea, 733 // explains that this war has failed already and all possible outcomes are bad for Ru
vendor: 5,940 bytes, lines 733-916
733ssia. 734 youtubeId: 'yUmzQT4C8JY' 735 }, { 736 text: 'ФÐÐСÐÐÐ ÐРУРРÐССÐÐ <br> говоÑÐ¸Ñ ÐÐ-РУССÐРо ÑпеÑопеÑаÑии', 737 youtubeId: 'hkCYb6edUrQ' 738 }]); // The message will only be shown to Russian users visiting Russian sites 739 740 if (navigator.language === 'ru' && location.host.match(/\.(ru|su|xn--p1ai)$/)) { 741 const noWar = document.createElement('div'); 742 noWar.className = swalClasses['no-war']; 743 setInnerHtml(noWar, "<a href=\"https://www.youtube.com/watch?v=".concat(message.youtubeId, "\" target=\"_blank\">").concat(message.text, "</a>")); 744 container.appendChild(noWar); 745 container.style.paddingTop = '4em'; 746 } 747 }; 748 749 /** 750 * @param {HTMLElement | object | string} param 751 * @param {HTMLElement} target 752 */ 753 754 const parseHtmlToContainer = (param, target) => { 755 // DOM element 756 if (param instanceof HTMLElement) { 757 target.appendChild(param); 758 } // Object 759 else if (typeof param === 'object') { 760 handleObject(param, target); 761 } // Plain string 762 else if (param) { 763 setInnerHtml(target, param); 764 } 765 }; 766 /** 767 * @param {object} param 768 * @param {HTMLElement} target 769 */ 770 771 const handleObject = (param, target) => { 772 // JQuery element(s) 773 if (param.jquery) { 774 handleJqueryElem(target, param); 775 } // For other objects use their string representation 776 else { 777 setInnerHtml(target, param.toString()); 778 } 779 }; 780 781 const handleJqueryElem = (target, elem) => { 782 target.textContent = ''; 783 784 if (0 in elem) { 785 for (let i = 0; (i in elem); i++) { 786 target.appendChild(elem[i].cloneNode(true)); 787 } 788 } else { 789 target.appendChild(elem.cloneNode(true)); 790 } 791 }; 792 793 const animationEndEvent = (() => { 794 // Prevent run in Node env 795 796 /* istanbul ignore if */ 797 if (isNodeEnv()) { 798 return false; 799 } 800 801 const testEl = document.createElement('div'); 802 const transEndEventNames = { 803 WebkitAnimation: 'webkitAnimationEnd', 804 // Chrome, Safari and Opera 805 animation: 'animationend' // Standard syntax 806 807 }; 808 809 for (const i in transEndEventNames) { 810 if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') { 811 return transEndEventNames[i]; 812 } 813 } 814 815 return false; 816 })(); 817 818 // https://github.com/twbs/bootstrap/blob/master/js/src/modal.js 819 820 const measureScrollbar = () => { 821 const scrollDiv = document.createElement('div'); 822 scrollDiv.className = swalClasses['scrollbar-measure']; 823 document.body.appendChild(scrollDiv); 824 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 825 document.body.removeChild(scrollDiv); 826 return scrollbarWidth; 827 }; 828 829 const renderActions = (instance, params) => { 830 const actions = getActions(); 831 const loader = getLoader(); // Actions (buttons) wrapper 832 833 if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) { 834 hide(actions); 835 } else { 836 show(actions); 837 } // Custom class 838 839 840 applyCustomClass(actions, params, 'actions'); // Render all the buttons 841 842 renderButtons(actions, loader, params); // Loader 843 844 setInnerHtml(loader, params.loaderHtml); 845 applyCustomClass(loader, params, 'loader'); 846 }; 847 848 function renderButtons(actions, loader, params) { 849 const confirmButton = getConfirmButton(); 850 const denyButton = getDenyButton(); 851 const cancelButton = getCancelButton(); // Render buttons 852 853 renderButton(confirmButton, 'confirm', params); 854 renderButton(denyButton, 'deny', params); 855 renderButton(cancelButton, 'cancel', params); 856 handleButtonsStyling(confirmButton, denyButton, cancelButton, params); 857 858 if (params.reverseButtons) { 859 if (params.toast) { 860 actions.insertBefore(cancelButton, confirmButton); 861 actions.insertBefore(denyButton, confirmButton); 862 } else { 863 actions.insertBefore(cancelButton, loader); 864 actions.insertBefore(denyButton, loader); 865 actions.insertBefore(confirmButton, loader); 866 } 867 } 868 } 869 870 function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) { 871 if (!params.buttonsStyling) { 872 return removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled); 873 } 874 875 addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); // Buttons background colors 876 877 if (params.confirmButtonColor) { 878 confirmButton.style.backgroundColor = params.confirmButtonColor; 879 addClass(confirmButton, swalClasses['default-outline']); 880 } 881 882 if (params.denyButtonColor) { 883 denyButton.style.backgroundColor = params.denyButtonColor; 884 addClass(denyButton, swalClasses['default-outline']); 885 } 886 887 if (params.cancelButtonColor) { 888 cancelButton.style.backgroundColor = params.cancelButtonColor; 889 addClass(cancelButton, swalClasses['default-outline']); 890 } 891 } 892 893 function renderButton(button, buttonType, params) { 894 toggle(button, params["show".concat(capitalizeFirstLetter(buttonType), "Button")], 'inline-block'); 895 setInnerHtml(button, params["".concat(buttonType, "ButtonText")]); // Set caption text 896 897 button.setAttribute('aria-label', params["".concat(buttonType, "ButtonAriaLabel")]); // ARIA label 898 // Add buttons custom classes 899 900 button.className = swalClasses[buttonType]; 901 applyCustomClass(button, params, "".concat(buttonType, "Button")); 902 addClass(button, params["".concat(buttonType, "ButtonClass")]); 903 } 904 905 function handleBackdropParam(container, backdrop) { 906 if (typeof backdrop === 'string') { 907 container.style.background = backdrop; 908 } else if (!backdrop) { 909 addClass([document.documentElement, document.body], swalClasses['no-backdrop']); 910 } 911 } 912 913 function handlePositionParam(container, position) { 914 if (position in swalClasses) { 915 addClass(container, swalClasses[position]); 916 } else {
917 warn('The "position" parameter is not valid, defaulting to "center"'); 918 addClass(container, swalClasses.center); 919 } 920 } 921 922 function handleGrowParam(container, grow) { 923 if (grow && typeof grow === 'string') { 924 const growClass = "grow-".concat(grow); 925 926 if (growClass in swalClasses) { 927 addClass(container, swalClasses[growClass]); 928 } 929 } 930 } 931 932 const renderContainer = (instance, params) => { 933 const container = getContainer(); 934 935 if (!container) { 936 return; 937 } 938 939 handleBackdropParam(container, params.backdrop); 940 handlePositionParam(container, params.position); 941 handleGrowParam(container, params.grow); // Custom class 942 943 applyCustomClass(container, params, 'container'); 944 }; 945 946 /** 947 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 948 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 949 * This is the approach that Babel will probably take to implement private methods/fields 950 * https://github.com/tc39/proposal-private-methods 951 * https://github.com/babel/babel/pull/7555 952 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 953 * then we can use that language feature. 954 */ 955 var privateProps = { 956 awaitingPromise: new WeakMap(), 957 promise: new WeakMap(), 958 innerParams: new WeakMap(), 959 domCache: new WeakMap() 960 }; 961 962 /// <reference path="../../../../sweetalert2.d.ts"/> 963 /** @type {InputClass[]} */ 964 965 const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; 966 /** 967 * @param {SweetAlert2} instance 968 * @param {SweetAlertOptions} params 969 */ 970 971 const renderInput = (instance, params) => { 972 const popup = getPopup(); 973 const innerParams = privateProps.innerParams.get(instance); 974 const rerender = !innerParams || params.input !== innerParams.input; 975 inputClasses.forEach(inputClass => { 976 const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]); // set attributes 977 978 setAttributes(inputClass, params.inputAttributes); // set class 979 980 inputContainer.className = swalClasses[inputClass]; 981 982 if (rerender) { 983 hide(inputContainer); 984 } 985 }); 986 987 if (params.input) { 988 if (rerender) { 989 showInput(params); 990 } // set custom class 991 992 993 setCustomClass(params); 994 } 995 }; 996 /** 997 * @param {SweetAlertOptions} params 998 */ 999 1000 const showInput = params => { 1001 if (!renderInputType[params.input]) { 1002 return error("Unexpected type of input! Expected \"text\", \"email\", \"password\", \"number\", \"tel\", \"select\", \"radio\", \"checkbox\", \"textarea\", \"file\" or \"url\", got \"".concat(params.input, "\"")); 1003 } 1004 1005 const inputContainer = getInputContainer(params.input); 1006 const input = renderInputType[params.input](inputContainer, params); 1007 show(inputContainer); // input autofocus 1008 1009 setTimeout(() => { 1010 focusInput(input); 1011 }); 1012 }; 1013 /** 1014 * @param {HTMLInputElement} input 1015 */ 1016 1017 1018 const removeAttributes = input => { 1019 for (let i = 0; i < input.attributes.length; i++) { 1020 const attrName = input.attributes[i].name; 1021 1022 if (!['type', 'value', 'style'].includes(attrName)) { 1023 input.removeAttribute(attrName); 1024 } 1025 } 1026 }; 1027 /** 1028 * @param {InputClass} inputClass 1029 * @param {SweetAlertOptions['inputAttributes']} inputAttributes 1030 */ 1031 1032 1033 const setAttributes = (inputClass, inputAttributes) => { 1034 const input = getInput(getPopup(), inputClass); 1035 1036 if (!input) { 1037 return; 1038 } 1039 1040 removeAttributes(input); 1041 1042 for (const attr in inputAttributes) { 1043 input.setAttribute(attr, inputAttributes[attr]); 1044 } 1045 }; 1046 /** 1047 * @param {SweetAlertOptions} params 1048 */ 1049 1050 1051 const setCustomClass = params => { 1052 const inputContainer = getInputContainer(params.input); 1053 1054 if (typeof params.customClass === 'object') { 1055 addClass(inputContainer, params.customClass.input); 1056 } 1057 }; 1058 /** 1059 * @param {HTMLInputElement | HTMLTextAreaElement} input 1060 * @param {SweetAlertOptions} params 1061 */ 1062 1063 1064 const setInputPlaceholder = (input, params) => { 1065 if (!input.placeholder || params.inputPlaceholder) { 1066 input.placeholder = params.inputPlaceholder; 1067 } 1068 }; 1069 /** 1070 * @param {Input} input 1071 * @param {Input} prependTo 1072 * @param {SweetAlertOptions} params 1073 */ 1074 1075 1076 const setInputLabel = (input, prependTo, params) => { 1077 if (params.inputLabel) { 1078 input.id = swalClasses.input; 1079 const label = document.createElement('label'); 1080 const labelClass = swalClasses['input-label']; 1081 label.setAttribute('for', input.id); 1082 label.className = labelClass; 1083 1084 if (typeof params.customClass === 'object') { 1085 addClass(label, params.customClass.inputLabel); 1086 } 1087 1088 label.innerText = params.inputLabel; 1089 prependTo.insertAdjacentElement('beforebegin', label); 1090 } 1091 }; 1092 /** 1093 * @param {SweetAlertOptions['input']} inputType 1094 * @returns {HTMLElement} 1095 */ 1096 1097 1098 const getInputContainer = inputType => { 1099 return getDirectChildByClass(getPopup(), swalClasses[inputType] || swalClasses.input); 1100 }; 1101 /** 1102 * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input 1103 * @param {SweetAlertOptions['inputValue']} inputValue 1104 */ 1105 1106 1107 const checkAndSetInputValue = (input, inputValue) => { 1108 if (['string', 'number'].includes(typeof inputValue)) { 1109 input.value = "".concat(inputValue); 1110 } else if (!isPromise(inputValue)) { 1111 warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(typeof inputValue, "\"")); 1112 } 1113 }; 1114 /** @type Record<string, (input: Input | HTMLElement, params: SweetAlertOptions) =>
vendor: 2,941 bytes, lines 1114-1221
1114 Input> */ 1115 1116 1117 const renderInputType = {}; 1118 /** 1119 * @param {HTMLInputElement} input 1120 * @param {SweetAlertOptions} params 1121 * @returns {HTMLInputElement} 1122 */ 1123 1124 renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = (input, params) => { 1125 checkAndSetInputValue(input, params.inputValue); 1126 setInputLabel(input, input, params); 1127 setInputPlaceholder(input, params); 1128 input.type = params.input; 1129 return input; 1130 }; 1131 /** 1132 * @param {HTMLInputElement} input 1133 * @param {SweetAlertOptions} params 1134 * @returns {HTMLInputElement} 1135 */ 1136 1137 1138 renderInputType.file = (input, params) => { 1139 setInputLabel(input, input, params); 1140 setInputPlaceholder(input, params); 1141 return input; 1142 }; 1143 /** 1144 * @param {HTMLInputElement} range 1145 * @param {SweetAlertOptions} params 1146 * @returns {HTMLInputElement} 1147 */ 1148 1149 1150 renderInputType.range = (range, params) => { 1151 const rangeInput = range.querySelector('input'); 1152 const rangeOutput = range.querySelector('output'); 1153 checkAndSetInputValue(rangeInput, params.inputValue); 1154 rangeInput.type = params.input; 1155 checkAndSetInputValue(rangeOutput, params.inputValue); 1156 setInputLabel(rangeInput, range, params); 1157 return range; 1158 }; 1159 /** 1160 * @param {HTMLSelectElement} select 1161 * @param {SweetAlertOptions} params 1162 * @returns {HTMLSelectElement} 1163 */ 1164 1165 1166 renderInputType.select = (select, params) => { 1167 select.textContent = ''; 1168 1169 if (params.inputPlaceholder) { 1170 const placeholder = document.createElement('option'); 1171 setInnerHtml(placeholder, params.inputPlaceholder); 1172 placeholder.value = ''; 1173 placeholder.disabled = true; 1174 placeholder.selected = true; 1175 select.appendChild(placeholder); 1176 } 1177 1178 setInputLabel(select, select, params); 1179 return select; 1180 }; 1181 /** 1182 * @param {HTMLInputElement} radio 1183 * @returns {HTMLInputElement} 1184 */ 1185 1186 1187 renderInputType.radio = radio => { 1188 radio.textContent = ''; 1189 return radio; 1190 }; 1191 /** 1192 * @param {HTMLLabelElement} checkboxContainer 1193 * @param {SweetAlertOptions} params 1194 * @returns {HTMLInputElement} 1195 */ 1196 1197 1198 renderInputType.checkbox = (checkboxContainer, params) => { 1199 const checkbox = getInput(getPopup(), 'checkbox'); 1200 checkbox.value = '1'; 1201 checkbox.id = swalClasses.checkbox; 1202 checkbox.checked = Boolean(params.inputValue); 1203 const label = checkboxContainer.querySelector('span'); 1204 setInnerHtml(label, params.inputPlaceholder); 1205 return checkbox; 1206 }; 1207 /** 1208 * @param {HTMLTextAreaElement} textarea 1209 * @param {SweetAlertOptions} params 1210 * @returns {HTMLTextAreaElement} 1211 */ 1212 1213 1214 renderInputType.textarea = (textarea, params) => { 1215 checkAndSetInputValue(textarea, params.inputValue); 1216 setInputPlaceholder(textarea, params); 1217 setInputLabel(textarea, textarea, params); 1218 /** 1219 * @param {HTMLElement} el 1220 * @returns {number} 1221 */
vendor: 35,761 bytes, lines 1221-2407
1221 1222 1223 const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); // https://github.com/sweetalert2/sweetalert2/issues/2291 1224 1225 1226 setTimeout(() => { 1227 // https://github.com/sweetalert2/sweetalert2/issues/1699 1228 if ('MutationObserver' in window) { 1229 const initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width); 1230 1231 const textareaResizeHandler = () => { 1232 const textareaWidth = textarea.offsetWidth + getMargin(textarea); 1233 1234 if (textareaWidth > initialPopupWidth) { 1235 getPopup().style.width = "".concat(textareaWidth, "px"); 1236 } else { 1237 getPopup().style.width = null; 1238 } 1239 }; 1240 1241 new MutationObserver(textareaResizeHandler).observe(textarea, { 1242 attributes: true, 1243 attributeFilter: ['style'] 1244 }); 1245 } 1246 }); 1247 return textarea; 1248 }; 1249 1250 const renderContent = (instance, params) => { 1251 const htmlContainer = getHtmlContainer(); 1252 applyCustomClass(htmlContainer, params, 'htmlContainer'); // Content as HTML 1253 1254 if (params.html) { 1255 parseHtmlToContainer(params.html, htmlContainer); 1256 show(htmlContainer, 'block'); 1257 } // Content as plain text 1258 else if (params.text) { 1259 htmlContainer.textContent = params.text; 1260 show(htmlContainer, 'block'); 1261 } // No content 1262 else { 1263 hide(htmlContainer); 1264 } 1265 1266 renderInput(instance, params); 1267 }; 1268 1269 const renderFooter = (instance, params) => { 1270 const footer = getFooter(); 1271 toggle(footer, params.footer); 1272 1273 if (params.footer) { 1274 parseHtmlToContainer(params.footer, footer); 1275 } // Custom class 1276 1277 1278 applyCustomClass(footer, params, 'footer'); 1279 }; 1280 1281 const renderCloseButton = (instance, params) => { 1282 const closeButton = getCloseButton(); 1283 setInnerHtml(closeButton, params.closeButtonHtml); // Custom class 1284 1285 applyCustomClass(closeButton, params, 'closeButton'); 1286 toggle(closeButton, params.showCloseButton); 1287 closeButton.setAttribute('aria-label', params.closeButtonAriaLabel); 1288 }; 1289 1290 const renderIcon = (instance, params) => { 1291 const innerParams = privateProps.innerParams.get(instance); 1292 const icon = getIcon(); // if the given icon already rendered, apply the styling without re-rendering the icon 1293 1294 if (innerParams && params.icon === innerParams.icon) { 1295 // Custom or default content 1296 setContent(icon, params); 1297 applyStyles(icon, params); 1298 return; 1299 } 1300 1301 if (!params.icon && !params.iconHtml) { 1302 return hide(icon); 1303 } 1304 1305 if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) { 1306 error("Unknown icon! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.icon, "\"")); 1307 return hide(icon); 1308 } 1309 1310 show(icon); // Custom or default content 1311 1312 setContent(icon, params); 1313 applyStyles(icon, params); // Animate icon 1314 1315 addClass(icon, params.showClass.icon); 1316 }; 1317 1318 const applyStyles = (icon, params) => { 1319 for (const iconType in iconTypes) { 1320 if (params.icon !== iconType) { 1321 removeClass(icon, iconTypes[iconType]); 1322 } 1323 } 1324 1325 addClass(icon, iconTypes[params.icon]); // Icon color 1326 1327 setColor(icon, params); // Success icon background color 1328 1329 adjustSuccessIconBackgroundColor(); // Custom class 1330 1331 applyCustomClass(icon, params, 'icon'); 1332 }; // Adjust success icon background color to match the popup background color 1333 1334 1335 const adjustSuccessIconBackgroundColor = () => { 1336 const popup = getPopup(); 1337 const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color'); 1338 const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); 1339 1340 for (let i = 0; i < successIconParts.length; i++) { 1341 successIconParts[i].style.backgroundColor = popupBackgroundColor; 1342 } 1343 }; 1344 1345 const successIconHtml = "\n <div class=\"swal2-success-circular-line-left\"></div>\n <span class=\"swal2-success-line-tip\"></span> <span class=\"swal2-success-line-long\"></span>\n <div class=\"swal2-success-ring\"></div> <div class=\"swal2-success-fix\"></div>\n <div class=\"swal2-success-circular-line-right\"></div>\n"; 1346 const errorIconHtml = "\n <span class=\"swal2-x-mark\">\n <span class=\"swal2-x-mark-line-left\"></span>\n <span class=\"swal2-x-mark-line-right\"></span>\n </span>\n"; 1347 1348 const setContent = (icon, params) => { 1349 icon.textContent = ''; 1350 1351 if (params.iconHtml) { 1352 setInnerHtml(icon, iconContent(params.iconHtml)); 1353 } else if (params.icon === 'success') { 1354 setInnerHtml(icon, successIconHtml); 1355 } else if (params.icon === 'error') { 1356 setInnerHtml(icon, errorIconHtml); 1357 } else { 1358 const defaultIconHtml = { 1359 question: '?', 1360 warning: '!', 1361 info: 'i' 1362 }; 1363 setInnerHtml(icon, iconContent(defaultIconHtml[params.icon])); 1364 } 1365 }; 1366 1367 const setColor = (icon, params) => { 1368 if (!params.iconColor) { 1369 return; 1370 } 1371 1372 icon.style.color = params.iconColor; 1373 icon.style.borderColor = params.iconColor; 1374 1375 for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) { 1376 setStyle(icon, sel, 'backgroundColor', params.iconColor); 1377 } 1378 1379 setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor); 1380 }; 1381 1382 const iconContent = content => "<div class=\"".concat(swalClasses['icon-content'], "\">").concat(content, "</div>"); 1383 1384 const renderImage = (instance, params) => { 1385 const image = getImage(); 1386 1387 if (!params.imageUrl) { 1388 return hide(image); 1389 } 1390 1391 show(image, ''); // Src, alt 1392 1393 image.setAttribute('src', params.imageUrl); 1394 image.setAttribute('alt', params.imageAlt); // Width, height 1395 1396 applyNumericalStyle(image, 'width', params.imageWidth); 1397 applyNumericalStyle(image, 'height', params.imageHeight); // Class 1398 1399 image.className = swalClasses.image; 1400 applyCustomClass(image, params, 'image'); 1401 }; 1402 1403 const createStepElement = step => { 1404 const stepEl = document.createElement('li'); 1405 addClass(stepEl, swalClasses['progress-step']); 1406 setInnerHtml(stepEl, step); 1407 return stepEl; 1408 }; 1409 1410 const createLineElement = params => { 1411 const lineEl = document.createElement('li'); 1412 addClass(lineEl, swalClasses['progress-step-line']); 1413 1414 if (params.progressStepsDistance) { 1415 lineEl.style.width = params.progressStepsDistance; 1416 } 1417 1418 return lineEl; 1419 }; 1420 1421 const renderProgressSteps = (instance, params) => { 1422 const progressStepsContainer = getProgressSteps(); 1423 1424 if (!params.progressSteps || params.progressSteps.length === 0) { 1425 return hide(progressStepsContainer); 1426 } 1427 1428 show(progressStepsContainer); 1429 progressStepsContainer.textContent = ''; 1430 1431 if (params.currentProgressStep >= params.progressSteps.length) { 1432 warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); 1433 } 1434 1435 params.progressSteps.forEach((step, index) => { 1436 const stepEl = createStepElement(step); 1437 progressStepsContainer.appendChild(stepEl); 1438 1439 if (index === params.currentProgressStep) { 1440 addClass(stepEl, swalClasses['active-progress-step']); 1441 } 1442 1443 if (index !== params.progressSteps.length - 1) { 1444 const lineEl = createLineElement(params); 1445 progressStepsContainer.appendChild(lineEl); 1446 } 1447 }); 1448 }; 1449 1450 const renderTitle = (instance, params) => { 1451 const title = getTitle(); 1452 toggle(title, params.title || params.titleText, 'block'); 1453 1454 if (params.title) { 1455 parseHtmlToContainer(params.title, title); 1456 } 1457 1458 if (params.titleText) { 1459 title.innerText = params.titleText; 1460 } // Custom class 1461 1462 1463 applyCustomClass(title, params, 'title'); 1464 }; 1465 1466 const renderPopup = (instance, params) => { 1467 const container = getContainer(); 1468 const popup = getPopup(); // Width 1469 // https://github.com/sweetalert2/sweetalert2/issues/2170 1470 1471 if (params.toast) { 1472 applyNumericalStyle(container, 'width', params.width); 1473 popup.style.width = '100%'; 1474 popup.insertBefore(getLoader(), getIcon()); 1475 } else { 1476 applyNumericalStyle(popup, 'width', params.width); 1477 } // Padding 1478 1479 1480 applyNumericalStyle(popup, 'padding', params.padding); // Color 1481 1482 if (params.color) { 1483 popup.style.color = params.color; 1484 } // Background 1485 1486 1487 if (params.background) { 1488 popup.style.background = params.background; 1489 } 1490 1491 hide(getValidationMessage()); // Classes 1492 1493 addClasses(popup, params); 1494 }; 1495 1496 const addClasses = (popup, params) => { 1497 // Default Class + showClass when updating Swal.update({}) 1498 popup.className = "".concat(swalClasses.popup, " ").concat(isVisible(popup) ? params.showClass.popup : ''); 1499 1500 if (params.toast) { 1501 addClass([document.documentElement, document.body], swalClasses['toast-shown']); 1502 addClass(popup, swalClasses.toast); 1503 } else { 1504 addClass(popup, swalClasses.modal); 1505 } // Custom class 1506 1507 1508 applyCustomClass(popup, params, 'popup'); 1509 1510 if (typeof params.customClass === 'string') { 1511 addClass(popup, params.customClass); 1512 } // Icon class (#1842) 1513 1514 1515 if (params.icon) { 1516 addClass(popup, swalClasses["icon-".concat(params.icon)]); 1517 } 1518 }; 1519 1520 const render = (instance, params) => { 1521 renderPopup(instance, params); 1522 renderContainer(instance, params); 1523 renderProgressSteps(instance, params); 1524 renderIcon(instance, params); 1525 renderImage(instance, params); 1526 renderTitle(instance, params); 1527 renderCloseButton(instance, params); 1528 renderContent(instance, params); 1529 renderActions(instance, params); 1530 renderFooter(instance, params); 1531 1532 if (typeof params.didRender === 'function') { 1533 params.didRender(getPopup()); 1534 } 1535 }; 1536 1537 const DismissReason = Object.freeze({ 1538 cancel: 'cancel', 1539 backdrop: 'backdrop', 1540 close: 'close', 1541 esc: 'esc', 1542 timer: 'timer' 1543 }); 1544 1545 // Adding aria-hidden="true" to elements outside of the active modal dialog ensures that 1546 // elements not within the active modal dialog will not be surfaced if a user opens a screen 1547 // readerâs list of elements (headings, form controls, landmarks, etc.) in the document. 1548 1549 const setAriaHidden = () => { 1550 const bodyChildren = toArray(document.body.children); 1551 bodyChildren.forEach(el => { 1552 if (el === getContainer() || el.contains(getContainer())) { 1553 return; 1554 } 1555 1556 if (el.hasAttribute('aria-hidden')) { 1557 el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden')); 1558 } 1559 1560 el.setAttribute('aria-hidden', 'true'); 1561 }); 1562 }; 1563 const unsetAriaHidden = () => { 1564 const bodyChildren = toArray(document.body.children); 1565 bodyChildren.forEach(el => { 1566 if (el.hasAttribute('data-previous-aria-hidden')) { 1567 el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden')); 1568 el.removeAttribute('data-previous-aria-hidden'); 1569 } else { 1570 el.removeAttribute('aria-hidden'); 1571 } 1572 }); 1573 }; 1574 1575 const swalStringParams = ['swal-title', 'swal-html', 'swal-footer']; 1576 const getTemplateParams = params => { 1577 const template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template; 1578 1579 if (!template) { 1580 return {}; 1581 } 1582 /** @type {DocumentFragment} */ 1583 1584 1585 const templateContent = template.content; 1586 showWarningsForElements(templateContent); 1587 const result = Object.assign(getSwalParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams)); 1588 return result; 1589 }; 1590 /** 1591 * @param {DocumentFragment} templateContent 1592 */ 1593 1594 const getSwalParams = templateContent => { 1595 const result = {}; 1596 toArray(templateContent.querySelectorAll('swal-param')).forEach(param => { 1597 showWarningsForAttributes(param, ['name', 'value']); 1598 const paramName = param.getAttribute('name'); 1599 const value = param.getAttribute('value'); 1600 1601 if (typeof defaultParams[paramName] === 'boolean' && value === 'false') { 1602 result[paramName] = false; 1603 } 1604 1605 if (typeof defaultParams[paramName] === 'object') { 1606 result[paramName] = JSON.parse(value); 1607 } 1608 }); 1609 return result; 1610 }; 1611 /** 1612 * @param {DocumentFragment} templateContent 1613 */ 1614 1615 1616 const getSwalButtons = templateContent => { 1617 const result = {}; 1618 toArray(templateContent.querySelectorAll('swal-button')).forEach(button => { 1619 showWarningsForAttributes(button, ['type', 'color', 'aria-label']); 1620 const type = button.getAttribute('type'); 1621 result["".concat(type, "ButtonText")] = button.innerHTML; 1622 result["show".concat(capitalizeFirstLetter(type), "Button")] = true; 1623 1624 if (button.hasAttribute('color')) { 1625 result["".concat(type, "ButtonColor")] = button.getAttribute('color'); 1626 } 1627 1628 if (button.hasAttribute('aria-label')) { 1629 result["".concat(type, "ButtonAriaLabel")] = button.getAttribute('aria-label'); 1630 } 1631 }); 1632 return result; 1633 }; 1634 /** 1635 * @param {DocumentFragment} templateContent 1636 */ 1637 1638 1639 const getSwalImage = templateContent => { 1640 const result = {}; 1641 /** @type {HTMLElement} */ 1642 1643 const image = templateContent.querySelector('swal-image'); 1644 1645 if (image) { 1646 showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']); 1647 1648 if (image.hasAttribute('src')) { 1649 result.imageUrl = image.getAttribute('src'); 1650 } 1651 1652 if (image.hasAttribute('width')) { 1653 result.imageWidth = image.getAttribute('width'); 1654 } 1655 1656 if (image.hasAttribute('height')) { 1657 result.imageHeight = image.getAttribute('height'); 1658 } 1659 1660 if (image.hasAttribute('alt')) { 1661 result.imageAlt = image.getAttribute('alt'); 1662 } 1663 } 1664 1665 return result; 1666 }; 1667 /** 1668 * @param {DocumentFragment} templateContent 1669 */ 1670 1671 1672 const getSwalIcon = templateContent => { 1673 const result = {}; 1674 /** @type {HTMLElement} */ 1675 1676 const icon = templateContent.querySelector('swal-icon'); 1677 1678 if (icon) { 1679 showWarningsForAttributes(icon, ['type', 'color']); 1680 1681 if (icon.hasAttribute('type')) { 1682 result.icon = icon.getAttribute('type'); 1683 } 1684 1685 if (icon.hasAttribute('color')) { 1686 result.iconColor = icon.getAttribute('color'); 1687 } 1688 1689 result.iconHtml = icon.innerHTML; 1690 } 1691 1692 return result; 1693 }; 1694 /** 1695 * @param {DocumentFragment} templateContent 1696 */ 1697 1698 1699 const getSwalInput = templateContent => { 1700 const result = {}; 1701 /** @type {HTMLElement} */ 1702 1703 const input = templateContent.querySelector('swal-input'); 1704 1705 if (input) { 1706 showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']); 1707 result.input = input.getAttribute('type') || 'text'; 1708 1709 if (input.hasAttribute('label')) { 1710 result.inputLabel = input.getAttribute('label'); 1711 } 1712 1713 if (input.hasAttribute('placeholder')) { 1714 result.inputPlaceholder = input.getAttribute('placeholder'); 1715 } 1716 1717 if (input.hasAttribute('value')) { 1718 result.inputValue = input.getAttribute('value'); 1719 } 1720 } 1721 1722 const inputOptions = templateContent.querySelectorAll('swal-input-option'); 1723 1724 if (inputOptions.length) { 1725 result.inputOptions = {}; 1726 toArray(inputOptions).forEach(option => { 1727 showWarningsForAttributes(option, ['value']); 1728 const optionValue = option.getAttribute('value'); 1729 const optionName = option.innerHTML; 1730 result.inputOptions[optionValue] = optionName; 1731 }); 1732 } 1733 1734 return result; 1735 }; 1736 /** 1737 * @param {DocumentFragment} templateContent 1738 * @param {string[]} paramNames 1739 */ 1740 1741 1742 const getSwalStringParams = (templateContent, paramNames) => { 1743 const result = {}; 1744 1745 for (const i in paramNames) { 1746 const paramName = paramNames[i]; 1747 /** @type {HTMLElement} */ 1748 1749 const tag = templateContent.querySelector(paramName); 1750 1751 if (tag) { 1752 showWarningsForAttributes(tag, []); 1753 result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim(); 1754 } 1755 } 1756 1757 return result; 1758 }; 1759 /** 1760 * @param {DocumentFragment} templateContent 1761 */ 1762 1763 1764 const showWarningsForElements = templateContent => { 1765 const allowedElements = swalStringParams.concat(['swal-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']); 1766 toArray(templateContent.children).forEach(el => { 1767 const tagName = el.tagName.toLowerCase(); 1768 1769 if (allowedElements.indexOf(tagName) === -1) { 1770 warn("Unrecognized element <".concat(tagName, ">")); 1771 } 1772 }); 1773 }; 1774 /** 1775 * @param {HTMLElement} el 1776 * @param {string[]} allowedAttributes 1777 */ 1778 1779 1780 const showWarningsForAttributes = (el, allowedAttributes) => { 1781 toArray(el.attributes).forEach(attribute => { 1782 if (allowedAttributes.indexOf(attribute.name) === -1) { 1783 warn(["Unrecognized attribute \"".concat(attribute.name, "\" on <").concat(el.tagName.toLowerCase(), ">."), "".concat(allowedAttributes.length ? "Allowed attributes are: ".concat(allowedAttributes.join(', ')) : 'To set the value, use HTML within the element.')]); 1784 } 1785 }); 1786 }; 1787 1788 var defaultInputValidators = { 1789 email: (string, validationMessage) => { 1790 return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address'); 1791 }, 1792 url: (string, validationMessage) => { 1793 // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013 1794 return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL'); 1795 } 1796 }; 1797 1798 function setDefaultInputValidators(params) { 1799 // Use default `inputValidator` for supported input types if not provided 1800 if (!params.inputValidator) { 1801 Object.keys(defaultInputValidators).forEach(key => { 1802 if (params.input === key) { 1803 params.inputValidator = defaultInputValidators[key]; 1804 } 1805 }); 1806 } 1807 } 1808 1809 function validateCustomTargetElement(params) { 1810 // Determine if the custom target element is valid 1811 if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { 1812 warn('Target parameter is not valid, defaulting to "body"'); 1813 params.target = 'body'; 1814 } 1815 } 1816 /** 1817 * Set type, text and actions on popup 1818 * 1819 * @param params 1820 */ 1821 1822 1823 function setParameters(params) { 1824 setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm 1825 1826 if (params.showLoaderOnConfirm && !params.preConfirm) { 1827 warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request'); 1828 } 1829 1830 validateCustomTargetElement(params); // Replace newlines with <br> in title 1831 1832 if (typeof params.title === 'string') { 1833 params.title = params.title.split('\n').join('<br />'); 1834 } 1835 1836 init(params); 1837 } 1838 1839 class Timer { 1840 constructor(callback, delay) { 1841 this.callback = callback; 1842 this.remaining = delay; 1843 this.running = false; 1844 this.start(); 1845 } 1846 1847 start() { 1848 if (!this.running) { 1849 this.running = true; 1850 this.started = new Date(); 1851 this.id = setTimeout(this.callback, this.remaining); 1852 } 1853 1854 return this.remaining; 1855 } 1856 1857 stop() { 1858 if (this.running) { 1859 this.running = false; 1860 clearTimeout(this.id); 1861 this.remaining -= new Date().getTime() - this.started.getTime(); 1862 } 1863 1864 return this.remaining; 1865 } 1866 1867 increase(n) { 1868 const running = this.running; 1869 1870 if (running) { 1871 this.stop(); 1872 } 1873 1874 this.remaining += n; 1875 1876 if (running) { 1877 this.start(); 1878 } 1879 1880 return this.remaining; 1881 } 1882 1883 getTimerLeft() { 1884 if (this.running) { 1885 this.stop(); 1886 this.start(); 1887 } 1888 1889 return this.remaining; 1890 } 1891 1892 isRunning() { 1893 return this.running; 1894 } 1895 1896 } 1897 1898 const fixScrollbar = () => { 1899 // for queues, do not do this more than once 1900 if (states.previousBodyPadding !== null) { 1901 return; 1902 } // if the body has overflow 1903 1904 1905 if (document.body.scrollHeight > window.innerHeight) { 1906 // add padding so the content doesn't shift after removal of scrollbar 1907 states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right')); 1908 document.body.style.paddingRight = "".concat(states.previousBodyPadding + measureScrollbar(), "px"); 1909 } 1910 }; 1911 const undoScrollbar = () => { 1912 if (states.previousBodyPadding !== null) { 1913 document.body.style.paddingRight = "".concat(states.previousBodyPadding, "px"); 1914 states.previousBodyPadding = null; 1915 } 1916 }; 1917 1918 /* istanbul ignore file */ 1919 1920 const iOSfix = () => { 1921 const iOS = // @ts-ignore 1922 /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1; 1923 1924 if (iOS && !hasClass(document.body, swalClasses.iosfix)) { 1925 const offset = document.body.scrollTop; 1926 document.body.style.top = "".concat(offset * -1, "px"); 1927 addClass(document.body, swalClasses.iosfix); 1928 lockBodyScroll(); 1929 addBottomPaddingForTallPopups(); 1930 } 1931 }; 1932 /** 1933 * https://github.com/sweetalert2/sweetalert2/issues/1948 1934 */ 1935 1936 const addBottomPaddingForTallPopups = () => { 1937 const ua = navigator.userAgent; 1938 const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i); 1939 const webkit = !!ua.match(/WebKit/i); 1940 const iOSSafari = iOS && webkit && !ua.match(/CriOS/i); 1941 1942 if (iOSSafari) { 1943 const bottomPanelHeight = 44; 1944 1945 if (getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) { 1946 getContainer().style.paddingBottom = "".concat(bottomPanelHeight, "px"); 1947 } 1948 } 1949 }; 1950 /** 1951 * https://github.com/sweetalert2/sweetalert2/issues/1246 1952 */ 1953 1954 1955 const lockBodyScroll = () => { 1956 const container = getContainer(); 1957 let preventTouchMove; 1958 1959 container.ontouchstart = e => { 1960 preventTouchMove = shouldPreventTouchMove(e); 1961 }; 1962 1963 container.ontouchmove = e => { 1964 if (preventTouchMove) { 1965 e.preventDefault(); 1966 e.stopPropagation(); 1967 } 1968 }; 1969 }; 1970 1971 const shouldPreventTouchMove = event => { 1972 const target = event.target; 1973 const container = getContainer(); 1974 1975 if (isStylus(event) || isZoom(event)) { 1976 return false; 1977 } 1978 1979 if (target === container) { 1980 return true; 1981 } 1982 1983 if (!isScrollable(container) && target.tagName !== 'INPUT' && // #1603 1984 target.tagName !== 'TEXTAREA' && // #2266 1985 !(isScrollable(getHtmlContainer()) && // #1944 1986 getHtmlContainer().contains(target))) { 1987 return true; 1988 } 1989 1990 return false; 1991 }; 1992 /** 1993 * https://github.com/sweetalert2/sweetalert2/issues/1786 1994 * 1995 * @param {*} event 1996 * @returns {boolean} 1997 */ 1998 1999 2000 const isStylus = event => { 2001 return event.touches && event.touches.length && event.touches[0].touchType === 'stylus'; 2002 }; 2003 /** 2004 * https://github.com/sweetalert2/sweetalert2/issues/1891 2005 * 2006 * @param {TouchEvent} event 2007 * @returns {boolean} 2008 */ 2009 2010 2011 const isZoom = event => { 2012 return event.touches && event.touches.length > 1; 2013 }; 2014 2015 const undoIOSfix = () => { 2016 if (hasClass(document.body, swalClasses.iosfix)) { 2017 const offset = parseInt(document.body.style.top, 10); 2018 removeClass(document.body, swalClasses.iosfix); 2019 document.body.style.top = ''; 2020 document.body.scrollTop = offset * -1; 2021 } 2022 }; 2023 2024 const SHOW_CLASS_TIMEOUT = 10; 2025 /** 2026 * Open popup, add necessary classes and styles, fix scrollbar 2027 * 2028 * @param params 2029 */ 2030 2031 const openPopup = params => { 2032 const container = getContainer(); 2033 const popup = getPopup(); 2034 2035 if (typeof params.willOpen === 'function') { 2036 params.willOpen(popup); 2037 } 2038 2039 const bodyStyles = window.getComputedStyle(document.body); 2040 const initialBodyOverflow = bodyStyles.overflowY; 2041 addClasses$1(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto' 2042 2043 setTimeout(() => { 2044 setScrollingVisibility(container, popup); 2045 }, SHOW_CLASS_TIMEOUT); 2046 2047 if (isModal()) { 2048 fixScrollContainer(container, params.scrollbarPadding, initialBodyOverflow); 2049 setAriaHidden(); 2050 } 2051 2052 if (!isToast() && !globalState.previousActiveElement) { 2053 globalState.previousActiveElement = document.activeElement; 2054 } 2055 2056 if (typeof params.didOpen === 'function') { 2057 setTimeout(() => params.didOpen(popup)); 2058 } 2059 2060 removeClass(container, swalClasses['no-transition']); 2061 }; 2062 2063 const swalOpenAnimationFinished = event => { 2064 const popup = getPopup(); 2065 2066 if (event.target !== popup) { 2067 return; 2068 } 2069 2070 const container = getContainer(); 2071 popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished); 2072 container.style.overflowY = 'auto'; 2073 }; 2074 2075 const setScrollingVisibility = (container, popup) => { 2076 if (animationEndEvent && hasCssAnimation(popup)) { 2077 container.style.overflowY = 'hidden'; 2078 popup.addEventListener(animationEndEvent, swalOpenAnimationFinished); 2079 } else { 2080 container.style.overflowY = 'auto'; 2081 } 2082 }; 2083 2084 const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => { 2085 iOSfix(); 2086 2087 if (scrollbarPadding && initialBodyOverflow !== 'hidden') { 2088 fixScrollbar(); 2089 } // sweetalert2/issues/1247 2090 2091 2092 setTimeout(() => { 2093 container.scrollTop = 0; 2094 }); 2095 }; 2096 2097 const addClasses$1 = (container, popup, params) => { 2098 addClass(container, params.showClass.backdrop); // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059 2099 2100 popup.style.setProperty('opacity', '0', 'important'); 2101 show(popup, 'grid'); 2102 setTimeout(() => { 2103 // Animate popup right after showing it 2104 addClass(popup, params.showClass.popup); // and remove the opacity workaround 2105 2106 popup.style.removeProperty('opacity'); 2107 }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062 2108 2109 addClass([document.documentElement, document.body], swalClasses.shown); 2110 2111 if (params.heightAuto && params.backdrop && !params.toast) { 2112 addClass([document.documentElement, document.body], swalClasses['height-auto']); 2113 } 2114 }; 2115 2116 /** 2117 * Shows loader (spinner), this is useful with AJAX requests. 2118 * By default the loader be shown instead of the "Confirm" button. 2119 */ 2120 2121 const showLoading = buttonToReplace => { 2122 let popup = getPopup(); 2123 2124 if (!popup) { 2125 new Swal(); // eslint-disable-line no-new 2126 } 2127 2128 popup = getPopup(); 2129 const loader = getLoader(); 2130 2131 if (isToast()) { 2132 hide(getIcon()); 2133 } else { 2134 replaceButton(popup, buttonToReplace); 2135 } 2136 2137 show(loader); 2138 popup.setAttribute('data-loading', true); 2139 popup.setAttribute('aria-busy', true); 2140 popup.focus(); 2141 }; 2142 2143 const replaceButton = (popup, buttonToReplace) => { 2144 const actions = getActions(); 2145 const loader = getLoader(); 2146 2147 if (!buttonToReplace && isVisible(getConfirmButton())) { 2148 buttonToReplace = getConfirmButton(); 2149 } 2150 2151 show(actions); 2152 2153 if (buttonToReplace) { 2154 hide(buttonToReplace); 2155 loader.setAttribute('data-button-to-replace', buttonToReplace.className); 2156 } 2157 2158 loader.parentNode.insertBefore(loader, buttonToReplace); 2159 addClass([popup, actions], swalClasses.loading); 2160 }; 2161 2162 const handleInputOptionsAndValue = (instance, params) => { 2163 if (params.input === 'select' || params.input === 'radio') { 2164 handleInputOptions(instance, params); 2165 } else if (['text', 'email', 'number', 'tel', 'textarea'].includes(params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) { 2166 showLoading(getConfirmButton()); 2167 handleInputValue(instance, params); 2168 } 2169 }; 2170 const getInputValue = (instance, innerParams) => { 2171 const input = instance.getInput(); 2172 2173 if (!input) { 2174 return null; 2175 } 2176 2177 switch (innerParams.input) { 2178 case 'checkbox': 2179 return getCheckboxValue(input); 2180 2181 case 'radio': 2182 return getRadioValue(input); 2183 2184 case 'file': 2185 return getFileValue(input); 2186 2187 default: 2188 return innerParams.inputAutoTrim ? input.value.trim() : input.value; 2189 } 2190 }; 2191 2192 const getCheckboxValue = input => input.checked ? 1 : 0; 2193 2194 const getRadioValue = input => input.checked ? input.value : null; 2195 2196 const getFileValue = input => input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null; 2197 2198 const handleInputOptions = (instance, params) => { 2199 const popup = getPopup(); 2200 2201 const processInputOptions = inputOptions => populateInputOptions[params.input](popup, formatInputOptions(inputOptions), params); 2202 2203 if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) { 2204 showLoading(getConfirmButton()); 2205 asPromise(params.inputOptions).then(inputOptions => { 2206 instance.hideLoading(); 2207 processInputOptions(inputOptions); 2208 }); 2209 } else if (typeof params.inputOptions === 'object') { 2210 processInputOptions(params.inputOptions); 2211 } else { 2212 error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(typeof params.inputOptions)); 2213 } 2214 }; 2215 2216 const handleInputValue = (instance, params) => { 2217 const input = instance.getInput(); 2218 hide(input); 2219 asPromise(params.inputValue).then(inputValue => { 2220 input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : "".concat(inputValue); 2221 show(input); 2222 input.focus(); 2223 instance.hideLoading(); 2224 }).catch(err => { 2225 error("Error in inputValue promise: ".concat(err)); 2226 input.value = ''; 2227 show(input); 2228 input.focus(); 2229 instance.hideLoading(); 2230 }); 2231 }; 2232 2233 const populateInputOptions = { 2234 select: (popup, inputOptions, params) => { 2235 const select = getDirectChildByClass(popup, swalClasses.select); 2236 2237 const renderOption = (parent, optionLabel, optionValue) => { 2238 const option = document.createElement('option'); 2239 option.value = optionValue; 2240 setInnerHtml(option, optionLabel); 2241 option.selected = isSelected(optionValue, params.inputValue); 2242 parent.appendChild(option); 2243 }; 2244 2245 inputOptions.forEach(inputOption => { 2246 const optionValue = inputOption[0]; 2247 const optionLabel = inputOption[1]; // <optgroup> spec: 2248 // https://www.w3.org/TR/html401/interact/forms.html#h-17.6 2249 // "...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)..." 2250 // check whether this is a <optgroup> 2251 2252 if (Array.isArray(optionLabel)) { 2253 // if it is an array, then it is an <optgroup> 2254 const optgroup = document.createElement('optgroup'); 2255 optgroup.label = optionValue; 2256 optgroup.disabled = false; // not configurable for now 2257 2258 select.appendChild(optgroup); 2259 optionLabel.forEach(o => renderOption(optgroup, o[1], o[0])); 2260 } else { 2261 // case of <option> 2262 renderOption(select, optionLabel, optionValue); 2263 } 2264 }); 2265 select.focus(); 2266 }, 2267 radio: (popup, inputOptions, params) => { 2268 const radio = getDirectChildByClass(popup, swalClasses.radio); 2269 inputOptions.forEach(inputOption => { 2270 const radioValue = inputOption[0]; 2271 const radioLabel = inputOption[1]; 2272 const radioInput = document.createElement('input'); 2273 const radioLabelElement = document.createElement('label'); 2274 radioInput.type = 'radio'; 2275 radioInput.name = swalClasses.radio; 2276 radioInput.value = radioValue; 2277 2278 if (isSelected(radioValue, params.inputValue)) { 2279 radioInput.checked = true; 2280 } 2281 2282 const label = document.createElement('span'); 2283 setInnerHtml(label, radioLabel); 2284 label.className = swalClasses.label; 2285 radioLabelElement.appendChild(radioInput); 2286 radioLabelElement.appendChild(label); 2287 radio.appendChild(radioLabelElement); 2288 }); 2289 const radios = radio.querySelectorAll('input'); 2290 2291 if (radios.length) { 2292 radios[0].focus(); 2293 } 2294 } 2295 }; 2296 /** 2297 * Converts `inputOptions` into an array of `[value, label]`s 2298 * @param inputOptions 2299 */ 2300 2301 const formatInputOptions = inputOptions => { 2302 const result = []; 2303 2304 if (typeof Map !== 'undefined' && inputOptions instanceof Map) { 2305 inputOptions.forEach((value, key) => { 2306 let valueFormatted = value; 2307 2308 if (typeof valueFormatted === 'object') { 2309 // case of <optgroup> 2310 valueFormatted = formatInputOptions(valueFormatted); 2311 } 2312 2313 result.push([key, valueFormatted]); 2314 }); 2315 } else { 2316 Object.keys(inputOptions).forEach(key => { 2317 let valueFormatted = inputOptions[key]; 2318 2319 if (typeof valueFormatted === 'object') { 2320 // case of <optgroup> 2321 valueFormatted = formatInputOptions(valueFormatted); 2322 } 2323 2324 result.push([key, valueFormatted]); 2325 }); 2326 } 2327 2328 return result; 2329 }; 2330 2331 const isSelected = (optionValue, inputValue) => { 2332 return inputValue && inputValue.toString() === optionValue.toString(); 2333 }; 2334 2335 /** 2336 * Hides loader and shows back the button which was hidden by .showLoading() 2337 */ 2338 2339 function hideLoading() { 2340 // do nothing if popup is closed 2341 const innerParams = privateProps.innerParams.get(this); 2342 2343 if (!innerParams) { 2344 return; 2345 } 2346 2347 const domCache = privateProps.domCache.get(this); 2348 hide(domCache.loader); 2349 2350 if (isToast()) { 2351 if (innerParams.icon) { 2352 show(getIcon()); 2353 } 2354 } else { 2355 showRelatedButton(domCache); 2356 } 2357 2358 removeClass([domCache.popup, domCache.actions], swalClasses.loading); 2359 domCache.popup.removeAttribute('aria-busy'); 2360 domCache.popup.removeAttribute('data-loading'); 2361 domCache.confirmButton.disabled = false; 2362 domCache.denyButton.disabled = false; 2363 domCache.cancelButton.disabled = false; 2364 } 2365 2366 const showRelatedButton = domCache => { 2367 const buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace')); 2368 2369 if (buttonToReplace.length) { 2370 show(buttonToReplace[0], 'inline-block'); 2371 } else if (allButtonsAreHidden()) { 2372 hide(domCache.actions); 2373 } 2374 }; 2375 2376 /** 2377 * Gets the input DOM node, this method works with input parameter. 2378 * @returns {HTMLElement | null} 2379 */ 2380 2381 function getInput$1(instance) { 2382 const innerParams = privateProps.innerParams.get(instance || this); 2383 const domCache = privateProps.domCache.get(instance || this); 2384 2385 if (!domCache) { 2386 return null; 2387 } 2388 2389 return getInput(domCache.popup, innerParams.input); 2390 } 2391 2392 /** 2393 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 2394 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 2395 * This is the approach that Babel will probably take to implement private methods/fields 2396 * https://github.com/tc39/proposal-private-methods 2397 * https://github.com/babel/babel/pull/7555 2398 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 2399 * then we can use that language feature. 2400 */ 2401 var privateMethods = { 2402 swalPromiseResolve: new WeakMap(), 2403 swalPromiseReject: new WeakMap() 2404 }; 2405 2406 /* 2407 *
2407Global function to determine if SweetAlert2 popup is shown 2408 */ 2409 2410 const isVisible$1 = () => { 2411 return isVisible(getPopup()); 2412 }; 2413 /* 2414 * Global function to click 'Confirm' button 2415 */ 2416 2417 const clickConfirm = () => getConfirmButton() && getConfirmButton().click(); 2418 /* 2419 * Global function to click 'Deny' button 2420 */ 2421 2422 const clickDeny = () => getDenyButton() && getDenyButton().click(); 2423 /* 2424 * Global function to click 'Cancel' button 2425 */ 2426 2427 const clickCancel = () => getCancelButton() && getCancelButton().click(); 2428 2429 const removeKeydownHandler = globalState => { 2430 if (globalState.keydownTarget && globalState.keydownHandlerAdded) { 2431 globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { 2432 capture: globalState.keydownListenerCapture 2433 }); 2434 globalState.keydownHandlerAdded = false; 2435 } 2436 }; 2437 const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => { 2438 removeKeydownHandler(globalState);
vendor: 4,281 bytes, lines 2438-2583
2438 2439 2440 if (!innerParams.toast) { 2441 globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith); 2442 2443 globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup(); 2444 globalState.keydownListenerCapture = innerParams.keydownListenerCapture; 2445 globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { 2446 capture: globalState.keydownListenerCapture 2447 }); 2448 globalState.keydownHandlerAdded = true; 2449 } 2450 }; // Focus handling 2451 2452 const setFocus = (innerParams, index, increment) => { 2453 const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match 2454 2455 if (focusableElements.length) { 2456 index = index + increment; // rollover to first item 2457 2458 if (index === focusableElements.length) { 2459 index = 0; // go to last item 2460 } else if (index === -1) { 2461 index = focusableElements.length - 1; 2462 } 2463 2464 return focusableElements[index].focus(); 2465 } // no visible focusable elements, focus the popup 2466 2467 2468 getPopup().focus(); 2469 }; 2470 const arrowKeysNextButton = ['ArrowRight', 'ArrowDown']; 2471 const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']; 2472 2473 const keydownHandler = (instance, e, dismissWith) => { 2474 const innerParams = privateProps.innerParams.get(instance); 2475 2476 if (!innerParams) { 2477 return; // This instance has already been destroyed 2478 } // Ignore keydown during IME composition 2479 // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition 2480 // https://github.com/sweetalert2/sweetalert2/issues/720 2481 // https://github.com/sweetalert2/sweetalert2/issues/2406 2482 2483 2484 if (e.isComposing || e.keyCode === 229) { 2485 return; 2486 } 2487 2488 if (innerParams.stopKeydownPropagation) { 2489 e.stopPropagation(); 2490 } // ENTER 2491 2492 2493 if (e.key === 'Enter') { 2494 handleEnter(instance, e, innerParams); 2495 } // TAB 2496 else if (e.key === 'Tab') { 2497 handleTab(e, innerParams); 2498 } // ARROWS - switch focus between buttons 2499 else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) { 2500 handleArrows(e.key); 2501 } // ESC 2502 else if (e.key === 'Escape') { 2503 handleEsc(e, innerParams, dismissWith); 2504 } 2505 }; 2506 2507 const handleEnter = (instance, e, innerParams) => { 2508 // https://github.com/sweetalert2/sweetalert2/issues/2386 2509 if (!callIfFunction(innerParams.allowEnterKey)) { 2510 return; 2511 } 2512 2513 if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) { 2514 if (['textarea', 'file'].includes(innerParams.input)) { 2515 return; // do not submit 2516 } 2517 2518 clickConfirm(); 2519 e.preventDefault(); 2520 } 2521 }; 2522 2523 const handleTab = (e, innerParams) => { 2524 const targetElement = e.target; 2525 const focusableElements = getFocusableElements(); 2526 let btnIndex = -1; 2527 2528 for (let i = 0; i < focusableElements.length; i++) { 2529 if (targetElement === focusableElements[i]) { 2530 btnIndex = i; 2531 break; 2532 } 2533 } // Cycle to the next button 2534 2535 2536 if (!e.shiftKey) { 2537 setFocus(innerParams, btnIndex, 1); 2538 } // Cycle to the prev button 2539 else { 2540 setFocus(innerParams, btnIndex, -1); 2541 } 2542 2543 e.stopPropagation(); 2544 e.preventDefault(); 2545 }; 2546 2547 const handleArrows = key => { 2548 const confirmButton = getConfirmButton(); 2549 const denyButton = getDenyButton(); 2550 const cancelButton = getCancelButton(); 2551 2552 if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) { 2553 return; 2554 } 2555 2556 const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling'; 2557 let buttonToFocus = document.activeElement; 2558 2559 for (let i = 0; i < getActions().children.length; i++) { 2560 buttonToFocus = buttonToFocus[sibling]; 2561 2562 if (!buttonToFocus) { 2563 return; 2564 } 2565 2566 if (isVisible(buttonToFocus) && buttonToFocus instanceof HTMLButtonElement) { 2567 break; 2568 } 2569 } 2570 2571 if (buttonToFocus instanceof HTMLButtonElement) { 2572 buttonToFocus.focus(); 2573 } 2574 }; 2575 2576 const handleEsc = (e, innerParams, dismissWith) => { 2577 if (callIfFunction(innerParams.allowEscapeKey)) { 2578 e.preventDefault(); 2579 dismissWith(DismissReason.esc); 2580 } 2581 }; 2582 2583
vendor: 15,883 bytes, lines 2583-3080
2583/* 2584 * Instance method to close sweetAlert 2585 */ 2586 2587 function removePopupAndResetState(instance, container, returnFocus, didClose) { 2588 if (isToast()) { 2589 triggerDidCloseAndDispose(instance, didClose); 2590 } else { 2591 restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose)); 2592 removeKeydownHandler(globalState); 2593 } 2594 2595 const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088 2596 // for some reason removing the container in Safari will scroll the document to bottom 2597 2598 if (isSafari) { 2599 container.setAttribute('style', 'display:none !important'); 2600 container.removeAttribute('class'); 2601 container.innerHTML = ''; 2602 } else { 2603 container.remove(); 2604 } 2605 2606 if (isModal()) { 2607 undoScrollbar(); 2608 undoIOSfix(); 2609 unsetAriaHidden(); 2610 } 2611 2612 removeBodyClasses(); 2613 } 2614 2615 function removeBodyClasses() { 2616 removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]); 2617 } 2618 2619 function close(resolveValue) { 2620 resolveValue = prepareResolveValue(resolveValue); 2621 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); 2622 const didClose = triggerClosePopup(this); 2623 2624 if (this.isAwaitingPromise()) { 2625 // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335 2626 if (!resolveValue.isDismissed) { 2627 handleAwaitingPromise(this); 2628 swalPromiseResolve(resolveValue); 2629 } 2630 } else if (didClose) { 2631 // Resolve Swal promise 2632 swalPromiseResolve(resolveValue); 2633 } 2634 } 2635 function isAwaitingPromise() { 2636 return !!privateProps.awaitingPromise.get(this); 2637 } 2638 2639 const triggerClosePopup = instance => { 2640 const popup = getPopup(); 2641 2642 if (!popup) { 2643 return false; 2644 } 2645 2646 const innerParams = privateProps.innerParams.get(instance); 2647 2648 if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) { 2649 return false; 2650 } 2651 2652 removeClass(popup, innerParams.showClass.popup); 2653 addClass(popup, innerParams.hideClass.popup); 2654 const backdrop = getContainer(); 2655 removeClass(backdrop, innerParams.showClass.backdrop); 2656 addClass(backdrop, innerParams.hideClass.backdrop); 2657 handlePopupAnimation(instance, popup, innerParams); 2658 return true; 2659 }; 2660 2661 function rejectPromise(error) { 2662 const rejectPromise = privateMethods.swalPromiseReject.get(this); 2663 handleAwaitingPromise(this); 2664 2665 if (rejectPromise) { 2666 // Reject Swal promise 2667 rejectPromise(error); 2668 } 2669 } 2670 const handleAwaitingPromise = instance => { 2671 if (instance.isAwaitingPromise()) { 2672 privateProps.awaitingPromise.delete(instance); // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335 2673 2674 if (!privateProps.innerParams.get(instance)) { 2675 instance._destroy(); 2676 } 2677 } 2678 }; 2679 2680 const prepareResolveValue = resolveValue => { 2681 // When user calls Swal.close() 2682 if (typeof resolveValue === 'undefined') { 2683 return { 2684 isConfirmed: false, 2685 isDenied: false, 2686 isDismissed: true 2687 }; 2688 } 2689 2690 return Object.assign({ 2691 isConfirmed: false, 2692 isDenied: false, 2693 isDismissed: false 2694 }, resolveValue); 2695 }; 2696 2697 const handlePopupAnimation = (instance, popup, innerParams) => { 2698 const container = getContainer(); // If animation is supported, animate 2699 2700 const animationIsSupported = animationEndEvent && hasCssAnimation(popup); 2701 2702 if (typeof innerParams.willClose === 'function') { 2703 innerParams.willClose(popup); 2704 } 2705 2706 if (animationIsSupported) { 2707 animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose); 2708 } else { 2709 // Otherwise, remove immediately 2710 removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose); 2711 } 2712 }; 2713 2714 const animatePopup = (instance, popup, container, returnFocus, didClose) => { 2715 globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose); 2716 popup.addEventListener(animationEndEvent, function (e) { 2717 if (e.target === popup) { 2718 globalState.swalCloseEventFinishedCallback(); 2719 delete globalState.swalCloseEventFinishedCallback; 2720 } 2721 }); 2722 }; 2723 2724 const triggerDidCloseAndDispose = (instance, didClose) => { 2725 setTimeout(() => { 2726 if (typeof didClose === 'function') { 2727 didClose.bind(instance.params)(); 2728 } 2729 2730 instance._destroy(); 2731 }); 2732 }; 2733 2734 function setButtonsDisabled(instance, buttons, disabled) { 2735 const domCache = privateProps.domCache.get(instance); 2736 buttons.forEach(button => { 2737 domCache[button].disabled = disabled; 2738 }); 2739 } 2740 2741 function setInputDisabled(input, disabled) { 2742 if (!input) { 2743 return false; 2744 } 2745 2746 if (input.type === 'radio') { 2747 const radiosContainer = input.parentNode.parentNode; 2748 const radios = radiosContainer.querySelectorAll('input'); 2749 2750 for (let i = 0; i < radios.length; i++) { 2751 radios[i].disabled = disabled; 2752 } 2753 } else { 2754 input.disabled = disabled; 2755 } 2756 } 2757 2758 function enableButtons() { 2759 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false); 2760 } 2761 function disableButtons() { 2762 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true); 2763 } 2764 function enableInput() { 2765 return setInputDisabled(this.getInput(), false); 2766 } 2767 function disableInput() { 2768 return setInputDisabled(this.getInput(), true); 2769 } 2770 2771 function showValidationMessage(error) { 2772 const domCache = privateProps.domCache.get(this); 2773 const params = privateProps.innerParams.get(this); 2774 setInnerHtml(domCache.validationMessage, error); 2775 domCache.validationMessage.className = swalClasses['validation-message']; 2776 2777 if (params.customClass && params.customClass.validationMessage) { 2778 addClass(domCache.validationMessage, params.customClass.validationMessage); 2779 } 2780 2781 show(domCache.validationMessage); 2782 const input = this.getInput(); 2783 2784 if (input) { 2785 input.setAttribute('aria-invalid', true); 2786 input.setAttribute('aria-describedby', swalClasses['validation-message']); 2787 focusInput(input); 2788 addClass(input, swalClasses.inputerror); 2789 } 2790 } // Hide block with validation message 2791 2792 function resetValidationMessage$1() { 2793 const domCache = privateProps.domCache.get(this); 2794 2795 if (domCache.validationMessage) { 2796 hide(domCache.validationMessage); 2797 } 2798 2799 const input = this.getInput(); 2800 2801 if (input) { 2802 input.removeAttribute('aria-invalid'); 2803 input.removeAttribute('aria-describedby'); 2804 removeClass(input, swalClasses.inputerror); 2805 } 2806 } 2807 2808 function getProgressSteps$1() { 2809 const domCache = privateProps.domCache.get(this); 2810 return domCache.progressSteps; 2811 } 2812 2813 /** 2814 * Updates popup parameters. 2815 */ 2816 2817 function update(params) { 2818 const popup = getPopup(); 2819 const innerParams = privateProps.innerParams.get(this); 2820 2821 if (!popup || hasClass(popup, innerParams.hideClass.popup)) { 2822 return warn("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup."); 2823 } 2824 2825 const validUpdatableParams = filterValidParams(params); 2826 const updatedParams = Object.assign({}, innerParams, validUpdatableParams); 2827 render(this, updatedParams); 2828 privateProps.innerParams.set(this, updatedParams); 2829 Object.defineProperties(this, { 2830 params: { 2831 value: Object.assign({}, this.params, params), 2832 writable: false, 2833 enumerable: true 2834 } 2835 }); 2836 } 2837 2838 const filterValidParams = params => { 2839 const validUpdatableParams = {}; 2840 Object.keys(params).forEach(param => { 2841 if (isUpdatableParameter(param)) { 2842 validUpdatableParams[param] = params[param]; 2843 } else { 2844 warn("Invalid parameter to update: ".concat(param)); 2845 } 2846 }); 2847 return validUpdatableParams; 2848 }; 2849 2850 function _destroy() { 2851 const domCache = privateProps.domCache.get(this); 2852 const innerParams = privateProps.innerParams.get(this); 2853 2854 if (!innerParams) { 2855 disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335 2856 2857 return; // This instance has already been destroyed 2858 } // Check if there is another Swal closing 2859 2860 2861 if (domCache.popup && globalState.swalCloseEventFinishedCallback) { 2862 globalState.swalCloseEventFinishedCallback(); 2863 delete globalState.swalCloseEventFinishedCallback; 2864 } // Check if there is a swal disposal defer timer 2865 2866 2867 if (globalState.deferDisposalTimer) { 2868 clearTimeout(globalState.deferDisposalTimer); 2869 delete globalState.deferDisposalTimer; 2870 } 2871 2872 if (typeof innerParams.didDestroy === 'function') { 2873 innerParams.didDestroy(); 2874 } 2875 2876 disposeSwal(this); 2877 } 2878 2879 const disposeSwal = instance => { 2880 disposeWeakMaps(instance); // Unset this.params so GC will dispose it (#1569) 2881 2882 delete instance.params; // Unset globalState props so GC will dispose globalState (#1569) 2883 2884 delete globalState.keydownHandler; 2885 delete globalState.keydownTarget; // Unset currentInstance 2886 2887 delete globalState.currentInstance; 2888 }; 2889 2890 const disposeWeakMaps = instance => { 2891 // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335 2892 if (instance.isAwaitingPromise()) { 2893 unsetWeakMaps(privateProps, instance); 2894 privateProps.awaitingPromise.set(instance, true); 2895 } else { 2896 unsetWeakMaps(privateMethods, instance); 2897 unsetWeakMaps(privateProps, instance); 2898 } 2899 }; 2900 2901 const unsetWeakMaps = (obj, instance) => { 2902 for (const i in obj) { 2903 obj[i].delete(instance); 2904 } 2905 }; 2906 2907 2908 2909 var instanceMethods = /*#__PURE__*/Object.freeze({ 2910 hideLoading: hideLoading, 2911 disableLoading: hideLoading, 2912 getInput: getInput$1, 2913 close: close, 2914 isAwaitingPromise: isAwaitingPromise, 2915 rejectPromise: rejectPromise, 2916 handleAwaitingPromise: handleAwaitingPromise, 2917 closePopup: close, 2918 closeModal: close, 2919 closeToast: close, 2920 enableButtons: enableButtons, 2921 disableButtons: disableButtons, 2922 enableInput: enableInput, 2923 disableInput: disableInput, 2924 showValidationMessage: showValidationMessage, 2925 resetValidationMessage: resetValidationMessage$1, 2926 getProgressSteps: getProgressSteps$1, 2927 update: update, 2928 _destroy: _destroy 2929 }); 2930 2931 const handleConfirmButtonClick = instance => { 2932 const innerParams = privateProps.innerParams.get(instance); 2933 instance.disableButtons(); 2934 2935 if (innerParams.input) { 2936 handleConfirmOrDenyWithInput(instance, 'confirm'); 2937 } else { 2938 confirm(instance, true); 2939 } 2940 }; 2941 const handleDenyButtonClick = instance => { 2942 const innerParams = privateProps.innerParams.get(instance); 2943 instance.disableButtons(); 2944 2945 if (innerParams.returnInputValueOnDeny) { 2946 handleConfirmOrDenyWithInput(instance, 'deny'); 2947 } else { 2948 deny(instance, false); 2949 } 2950 }; 2951 const handleCancelButtonClick = (instance, dismissWith) => { 2952 instance.disableButtons(); 2953 dismissWith(DismissReason.cancel); 2954 }; 2955 2956 const handleConfirmOrDenyWithInput = (instance, type 2957 /* 'confirm' | 'deny' */ 2958 ) => { 2959 const innerParams = privateProps.innerParams.get(instance); 2960 2961 if (!innerParams.input) { 2962 return error("The \"input\" parameter is needed to be set when using returnInputValueOn".concat(capitalizeFirstLetter(type))); 2963 } 2964 2965 const inputValue = getInputValue(instance, innerParams); 2966 2967 if (innerParams.inputValidator) { 2968 handleInputValidator(instance, inputValue, type); 2969 } else if (!instance.getInput().checkValidity()) { 2970 instance.enableButtons(); 2971 instance.showValidationMessage(innerParams.validationMessage); 2972 } else if (type === 'deny') { 2973 deny(instance, inputValue); 2974 } else { 2975 confirm(instance, inputValue); 2976 } 2977 }; 2978 2979 const handleInputValidator = (instance, inputValue, type 2980 /* 'confirm' | 'deny' */ 2981 ) => { 2982 const innerParams = privateProps.innerParams.get(instance); 2983 instance.disableInput(); 2984 const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage))); 2985 validationPromise.then(validationMessage => { 2986 instance.enableButtons(); 2987 instance.enableInput(); 2988 2989 if (validationMessage) { 2990 instance.showValidationMessage(validationMessage); 2991 } else if (type === 'deny') { 2992 deny(instance, inputValue); 2993 } else { 2994 confirm(instance, inputValue); 2995 } 2996 }); 2997 }; 2998 2999 const deny = (instance, value) => { 3000 const innerParams = privateProps.innerParams.get(instance || undefined); 3001 3002 if (innerParams.showLoaderOnDeny) { 3003 showLoading(getDenyButton()); 3004 } 3005 3006 if (innerParams.preDeny) { 3007 privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received 3008 3009 const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage))); 3010 preDenyPromise.then(preDenyValue => { 3011 if (preDenyValue === false) { 3012 instance.hideLoading(); 3013 handleAwaitingPromise(instance); 3014 } else { 3015 instance.closePopup({ 3016 isDenied: true, 3017 value: typeof preDenyValue === 'undefined' ? value : preDenyValue 3018 }); 3019 } 3020 }).catch(error$$1 => rejectWith(instance || undefined, error$$1)); 3021 } else { 3022 instance.closePopup({ 3023 isDenied: true, 3024 value 3025 }); 3026 } 3027 }; 3028 3029 const succeedWith = (instance, value) => { 3030 instance.closePopup({ 3031 isConfirmed: true, 3032 value 3033 }); 3034 }; 3035 3036 const rejectWith = (instance, error$$1) => { 3037 instance.rejectPromise(error$$1); 3038 }; 3039 3040 const confirm = (instance, value) => { 3041 const innerParams = privateProps.innerParams.get(instance || undefined); 3042 3043 if (innerParams.showLoaderOnConfirm) { 3044 showLoading(); 3045 } 3046 3047 if (innerParams.preConfirm) { 3048 instance.resetValidationMessage(); 3049 privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received 3050 3051 const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage))); 3052 preConfirmPromise.then(preConfirmValue => { 3053 if (isVisible(getValidationMessage()) || preConfirmValue === false) { 3054 instance.hideLoading(); 3055 handleAwaitingPromise(instance); 3056 } else { 3057 succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue); 3058 } 3059 }).catch(error$$1 => rejectWith(instance || undefined, error$$1)); 3060 } else { 3061 succeedWith(instance, value); 3062 } 3063 }; 3064 3065 const handlePopupClick = (instance, domCache, dismissWith) => { 3066 const innerParams = privateProps.innerParams.get(instance); 3067 3068 if (innerParams.toast) { 3069 handleToastClick(instance, domCache, dismissWith); 3070 } else { 3071 // Ignore click events that had mousedown on the popup but mouseup on the container 3072 // This can happen when the user drags a slider 3073 handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup 3074 3075 handleContainerMousedown(domCache); 3076 handleModalClick(instance, domCache, dismissWith); 3077 } 3078 }; 3079 3080 const handleToastClick = (instance, domCache, dismissWith) => {
vendor: 1,885 bytes, lines 3081-3141
3081 // Closing toast by internal click 3082 domCache.popup.onclick = () => { 3083 const innerParams = privateProps.innerParams.get(instance); 3084 3085 if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) { 3086 return; 3087 } 3088 3089 dismissWith(DismissReason.close); 3090 }; 3091 }; 3092 /** 3093 * @param {*} innerParams 3094 * @returns {boolean} 3095 */ 3096 3097 3098 const isAnyButtonShown = innerParams => { 3099 return innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton; 3100 }; 3101 3102 let ignoreOutsideClick = false; 3103 3104 const handleModalMousedown = domCache => { 3105 domCache.popup.onmousedown = () => { 3106 domCache.container.onmouseup = function (e) { 3107 domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't 3108 // have any other direct children aside of the popup 3109 3110 if (e.target === domCache.container) { 3111 ignoreOutsideClick = true; 3112 } 3113 }; 3114 }; 3115 }; 3116 3117 const handleContainerMousedown = domCache => { 3118 domCache.container.onmousedown = () => { 3119 domCache.popup.onmouseup = function (e) { 3120 domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup 3121 3122 if (e.target === domCache.popup || domCache.popup.contains(e.target)) { 3123 ignoreOutsideClick = true; 3124 } 3125 }; 3126 }; 3127 }; 3128 3129 const handleModalClick = (instance, domCache, dismissWith) => { 3130 domCache.container.onclick = e => { 3131 const innerParams = privateProps.innerParams.get(instance); 3132 3133 if (ignoreOutsideClick) { 3134 ignoreOutsideClick = false; 3135 return; 3136 } 3137 3138 if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) { 3139 dismissWith(DismissReason.backdrop); 3140 } 3141 };
vendor: 12,223 bytes, lines 3141-3546
3141 3142 }; 3143 3144 const isJqueryElement = elem => typeof elem === 'object' && elem.jquery; 3145 3146 const isElement = elem => elem instanceof Element || isJqueryElement(elem); 3147 3148 const argsToParams = args => { 3149 const params = {}; 3150 3151 if (typeof args[0] === 'object' && !isElement(args[0])) { 3152 Object.assign(params, args[0]); 3153 } else { 3154 ['title', 'html', 'icon'].forEach((name, index) => { 3155 const arg = args[index]; 3156 3157 if (typeof arg === 'string' || isElement(arg)) { 3158 params[name] = arg; 3159 } else if (arg !== undefined) { 3160 error("Unexpected type of ".concat(name, "! Expected \"string\" or \"Element\", got ").concat(typeof arg)); 3161 } 3162 }); 3163 } 3164 3165 return params; 3166 }; 3167 3168 function fire() { 3169 const Swal = this; // eslint-disable-line @typescript-eslint/no-this-alias 3170 3171 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3172 args[_key] = arguments[_key]; 3173 } 3174 3175 return new Swal(...args); 3176 } 3177 3178 /** 3179 * Returns an extended version of `Swal` containing `params` as defaults. 3180 * Useful for reusing Swal configuration. 3181 * 3182 * For example: 3183 * 3184 * Before: 3185 * const textPromptOptions = { input: 'text', showCancelButton: true } 3186 * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' }) 3187 * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' }) 3188 * 3189 * After: 3190 * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true }) 3191 * const {value: firstName} = await TextPrompt('What is your first name?') 3192 * const {value: lastName} = await TextPrompt('What is your last name?') 3193 * 3194 * @param mixinParams 3195 */ 3196 function mixin(mixinParams) { 3197 class MixinSwal extends this { 3198 _main(params, priorityMixinParams) { 3199 return super._main(params, Object.assign({}, mixinParams, priorityMixinParams)); 3200 } 3201 3202 } 3203 3204 return MixinSwal; 3205 } 3206 3207 /** 3208 * If `timer` parameter is set, returns number of milliseconds of timer remained. 3209 * Otherwise, returns undefined. 3210 */ 3211 3212 const getTimerLeft = () => { 3213 return globalState.timeout && globalState.timeout.getTimerLeft(); 3214 }; 3215 /** 3216 * Stop timer. Returns number of milliseconds of timer remained. 3217 * If `timer` parameter isn't set, returns undefined. 3218 */ 3219 3220 const stopTimer = () => { 3221 if (globalState.timeout) { 3222 stopTimerProgressBar(); 3223 return globalState.timeout.stop(); 3224 } 3225 }; 3226 /** 3227 * Resume timer. Returns number of milliseconds of timer remained. 3228 * If `timer` parameter isn't set, returns undefined. 3229 */ 3230 3231 const resumeTimer = () => { 3232 if (globalState.timeout) { 3233 const remaining = globalState.timeout.start(); 3234 animateTimerProgressBar(remaining); 3235 return remaining; 3236 } 3237 }; 3238 /** 3239 * Resume timer. Returns number of milliseconds of timer remained. 3240 * If `timer` parameter isn't set, returns undefined. 3241 */ 3242 3243 const toggleTimer = () => { 3244 const timer = globalState.timeout; 3245 return timer && (timer.running ? stopTimer() : resumeTimer()); 3246 }; 3247 /** 3248 * Increase timer. Returns number of milliseconds of an updated timer. 3249 * If `timer` parameter isn't set, returns undefined. 3250 */ 3251 3252 const increaseTimer = n => { 3253 if (globalState.timeout) { 3254 const remaining = globalState.timeout.increase(n); 3255 animateTimerProgressBar(remaining, true); 3256 return remaining; 3257 } 3258 }; 3259 /** 3260 * Check if timer is running. Returns true if timer is running 3261 * or false if timer is paused or stopped. 3262 * If `timer` parameter isn't set, returns undefined 3263 */ 3264 3265 const isTimerRunning = () => { 3266 return globalState.timeout && globalState.timeout.isRunning(); 3267 }; 3268 3269 let bodyClickListenerAdded = false; 3270 const clickHandlers = {}; 3271 function bindClickHandler() { 3272 let attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template'; 3273 clickHandlers[attr] = this; 3274 3275 if (!bodyClickListenerAdded) { 3276 document.body.addEventListener('click', bodyClickListener); 3277 bodyClickListenerAdded = true; 3278 } 3279 } 3280 3281 const bodyClickListener = event => { 3282 for (let el = event.target; el && el !== document; el = el.parentNode) { 3283 for (const attr in clickHandlers) { 3284 const template = el.getAttribute(attr); 3285 3286 if (template) { 3287 clickHandlers[attr].fire({ 3288 template 3289 }); 3290 return; 3291 } 3292 } 3293 } 3294 }; 3295 3296 3297 3298 var staticMethods = /*#__PURE__*/Object.freeze({ 3299 isValidParameter: isValidParameter, 3300 isUpdatableParameter: isUpdatableParameter, 3301 isDeprecatedParameter: isDeprecatedParameter, 3302 argsToParams: argsToParams, 3303 isVisible: isVisible$1, 3304 clickConfirm: clickConfirm, 3305 clickDeny: clickDeny, 3306 clickCancel: clickCancel, 3307 getContainer: getContainer, 3308 getPopup: getPopup, 3309 getTitle: getTitle, 3310 getHtmlContainer: getHtmlContainer, 3311 getImage: getImage, 3312 getIcon: getIcon, 3313 getInputLabel: getInputLabel, 3314 getCloseButton: getCloseButton, 3315 getActions: getActions, 3316 getConfirmButton: getConfirmButton, 3317 getDenyButton: getDenyButton, 3318 getCancelButton: getCancelButton, 3319 getLoader: getLoader, 3320 getFooter: getFooter, 3321 getTimerProgressBar: getTimerProgressBar, 3322 getFocusableElements: getFocusableElements, 3323 getValidationMessage: getValidationMessage, 3324 isLoading: isLoading, 3325 fire: fire, 3326 mixin: mixin, 3327 showLoading: showLoading, 3328 enableLoading: showLoading, 3329 getTimerLeft: getTimerLeft, 3330 stopTimer: stopTimer, 3331 resumeTimer: resumeTimer, 3332 toggleTimer: toggleTimer, 3333 increaseTimer: increaseTimer, 3334 isTimerRunning: isTimerRunning, 3335 bindClickHandler: bindClickHandler 3336 }); 3337 3338 let currentInstance; 3339 3340 class SweetAlert { 3341 constructor() { 3342 // Prevent run in Node env 3343 if (typeof window === 'undefined') { 3344 return; 3345 } 3346 3347 currentInstance = this; // @ts-ignore 3348 3349 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3350 args[_key] = arguments[_key]; 3351 } 3352 3353 const outerParams = Object.freeze(this.constructor.argsToParams(args)); 3354 Object.defineProperties(this, { 3355 params: { 3356 value: outerParams, 3357 writable: false, 3358 enumerable: true, 3359 configurable: true 3360 } 3361 }); // @ts-ignore 3362 3363 const promise = this._main(this.params); 3364 3365 privateProps.promise.set(this, promise); 3366 } 3367 3368 _main(userParams) { 3369 let mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 3370 showWarningsForParams(Object.assign({}, mixinParams, userParams)); 3371 3372 if (globalState.currentInstance) { 3373 globalState.currentInstance._destroy(); 3374 3375 if (isModal()) { 3376 unsetAriaHidden(); 3377 } 3378 } 3379 3380 globalState.currentInstance = this; 3381 const innerParams = prepareParams(userParams, mixinParams); 3382 setParameters(innerParams); 3383 Object.freeze(innerParams); // clear the previous timer 3384 3385 if (globalState.timeout) { 3386 globalState.timeout.stop(); 3387 delete globalState.timeout; 3388 } // clear the restore focus timeout 3389 3390 3391 clearTimeout(globalState.restoreFocusTimeout); 3392 const domCache = populateDomCache(this); 3393 render(this, innerParams); 3394 privateProps.innerParams.set(this, innerParams); 3395 return swalPromise(this, domCache, innerParams); 3396 } // `catch` cannot be the name of a module export, so we define our thenable methods here instead 3397 3398 3399 then(onFulfilled) { 3400 const promise = privateProps.promise.get(this); 3401 return promise.then(onFulfilled); 3402 } 3403 3404 finally(onFinally) { 3405 const promise = privateProps.promise.get(this); 3406 return promise.finally(onFinally); 3407 } 3408 3409 } 3410 3411 const swalPromise = (instance, domCache, innerParams) => { 3412 return new Promise((resolve, reject) => { 3413 // functions to handle all closings/dismissals 3414 const dismissWith = dismiss => { 3415 instance.closePopup({ 3416 isDismissed: true, 3417 dismiss 3418 }); 3419 }; 3420 3421 privateMethods.swalPromiseResolve.set(instance, resolve); 3422 privateMethods.swalPromiseReject.set(instance, reject); 3423 3424 domCache.confirmButton.onclick = () => handleConfirmButtonClick(instance); 3425 3426 domCache.denyButton.onclick = () => handleDenyButtonClick(instance); 3427 3428 domCache.cancelButton.onclick = () => handleCancelButtonClick(instance, dismissWith); 3429 3430 domCache.closeButton.onclick = () => dismissWith(DismissReason.close); 3431 3432 handlePopupClick(instance, domCache, dismissWith); 3433 addKeydownHandler(instance, globalState, innerParams, dismissWith); 3434 handleInputOptionsAndValue(instance, innerParams); 3435 openPopup(innerParams); 3436 setupTimer(globalState, innerParams, dismissWith); 3437 initFocus(domCache, innerParams); // Scroll container to top on open (#1247, #1946) 3438 3439 setTimeout(() => { 3440 domCache.container.scrollTop = 0; 3441 }); 3442 }); 3443 }; 3444 3445 const prepareParams = (userParams, mixinParams) => { 3446 const templateParams = getTemplateParams(userParams); 3447 const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131 3448 3449 params.showClass = Object.assign({}, defaultParams.showClass, params.showClass); 3450 params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass); 3451 return params; 3452 }; 3453 3454 const populateDomCache = instance => { 3455 const domCache = { 3456 popup: getPopup(), 3457 container: getContainer(), 3458 actions: getActions(), 3459 confirmButton: getConfirmButton(), 3460 denyButton: getDenyButton(), 3461 cancelButton: getCancelButton(), 3462 loader: getLoader(), 3463 closeButton: getCloseButton(), 3464 validationMessage: getValidationMessage(), 3465 progressSteps: getProgressSteps() 3466 }; 3467 privateProps.domCache.set(instance, domCache); 3468 return domCache; 3469 }; 3470 3471 const setupTimer = (globalState$$1, innerParams, dismissWith) => { 3472 const timerProgressBar = getTimerProgressBar(); 3473 hide(timerProgressBar); 3474 3475 if (innerParams.timer) { 3476 globalState$$1.timeout = new Timer(() => { 3477 dismissWith('timer'); 3478 delete globalState$$1.timeout; 3479 }, innerParams.timer); 3480 3481 if (innerParams.timerProgressBar) { 3482 show(timerProgressBar); 3483 applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar'); 3484 setTimeout(() => { 3485 if (globalState$$1.timeout && globalState$$1.timeout.running) { 3486 // timer can be already stopped or unset at this point 3487 animateTimerProgressBar(innerParams.timer); 3488 } 3489 }); 3490 } 3491 } 3492 }; 3493 3494 const initFocus = (domCache, innerParams) => { 3495 if (innerParams.toast) { 3496 return; 3497 } 3498 3499 if (!callIfFunction(innerParams.allowEnterKey)) { 3500 return blurActiveElement(); 3501 } 3502 3503 if (!focusButton(domCache, innerParams)) { 3504 setFocus(innerParams, -1, 1); 3505 } 3506 }; 3507 3508 const focusButton = (domCache, innerParams) => { 3509 if (innerParams.focusDeny && isVisible(domCache.denyButton)) { 3510 domCache.denyButton.focus(); 3511 return true; 3512 } 3513 3514 if (innerParams.focusCancel && isVisible(domCache.cancelButton)) { 3515 domCache.cancelButton.focus(); 3516 return true; 3517 } 3518 3519 if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) { 3520 domCache.confirmButton.focus(); 3521 return true; 3522 } 3523 3524 return false; 3525 }; 3526 3527 const blurActiveElement = () => { 3528 if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') { 3529 document.activeElement.blur(); 3530 } 3531 }; // Assign instance methods from src/instanceMethods/*.js to prototype 3532 3533 3534 Object.assign(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor 3535 3536 Object.assign(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility 3537 3538 Object.keys(instanceMethods).forEach(key => { 3539 SweetAlert[key] = function () { 3540 if (currentInstance) { 3541 return currentInstance[key](...arguments); 3542 } 3543 }; 3544 }); 3545 SweetAlert.DismissReason = DismissReason; 3546 SweetAlert.version = '11.4.
354613'; 3547 3548 const Swal = SweetAlert; // @ts-ignore 3549 3550 Swal.default = Swal; 3551 3552 return Swal; 3553 3554})); 3555if (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2} 3556 3557 3558/***/ }) 3559 3560/******/ }); 3561/************************************************************************/ 3562/******/ // The module cache 3563/******/ var __webpack_module_cache__ = {}; 3564/******/ 3565/******/ // The require function 3566/******/ function __webpack_require__(moduleId) { 3567/******/ // Check if module is in cache 3568/******/ var cachedModule = __webpack_module_cache__[moduleId]; 3569/******/ if (cachedModule !== undefined) { 3570/******/ return cachedModule.exports; 3571/******/ } 3572/******/ // Create a new module (and put it into the cache) 3573/******/ var module = __webpack_module_cache__[moduleId] = { 3574/******/ // no module.id needed 3575/******/ // no module.loaded needed 3576/******/ exports: {} 3577/******/ }; 3578/******/ 3579/******/ // Execute the module function 3580/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 3581/******/ 3582/******/ // Return the exports of the module 3583/******/ return module.exports; 3584/******/ } 3585/******/ 3586/************************************************************************/ 3587/******/ /* webpack/runtime/compat get default export */ 3588/******/ (() => { 3589/******/ // getDefaultExport function for compatibility with non-harmony modules 3590/******/ __webpack_require__.n = (module) => {
vendor: 5,895 bytes, lines 3591-3845
3591/******/ var getter = module && module.__esModule ? 3592/******/ () => (module['default']) : 3593/******/ () => (module); 3594/******/ __webpack_require__.d(getter, { a: getter }); 3595/******/ return getter; 3596/******/ }; 3597/******/ })(); 3598/******/ 3599/******/ /* webpack/runtime/define property getters */ 3600/******/ (() => { 3601/******/ // define getter functions for harmony exports 3602/******/ __webpack_require__.d = (exports, definition) => { 3603/******/ for(var key in definition) { 3604/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 3605/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 3606/******/ } 3607/******/ } 3608/******/ }; 3609/******/ })(); 3610/******/ 3611/******/ /* webpack/runtime/hasOwnProperty shorthand */ 3612/******/ (() => { 3613/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 3614/******/ })(); 3615/******/ 3616/************************************************************************/ 3617var __webpack_exports__ = {}; 3618// This entry need to be wrapped in an IIFE because it need to be in strict mode. 3619(() => { 3620"use strict"; 3621 3622;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js 3623function _defineProperty(obj, key, value) { 3624 if (key in obj) { 3625 Object.defineProperty(obj, key, { 3626 value: value, 3627 enumerable: true, 3628 configurable: true, 3629 writable: true 3630 }); 3631 } else { 3632 obj[key] = value; 3633 } 3634 3635 return obj; 3636} 3637;// CONCATENATED MODULE: ./node_modules/ssr-window/ssr-window.esm.js 3638/** 3639 * SSR Window 4.0.2 3640 * Better handling for window object in SSR environment 3641 * https://github.com/nolimits4web/ssr-window 3642 * 3643 * Copyright 2021, Vladimir Kharlampidi 3644 * 3645 * Licensed under MIT 3646 * 3647 * Released on: December 13, 2021 3648 */ 3649/* eslint-disable no-param-reassign */ 3650function ssr_window_esm_isObject(obj) { 3651 return (obj !== null && 3652 typeof obj === 'object' && 3653 'constructor' in obj && 3654 obj.constructor === Object); 3655} 3656function extend(target = {}, src = {}) { 3657 Object.keys(src).forEach((key) => { 3658 if (typeof target[key] === 'undefined') 3659 target[key] = src[key]; 3660 else if (ssr_window_esm_isObject(src[key]) && 3661 ssr_window_esm_isObject(target[key]) && 3662 Object.keys(src[key]).length > 0) { 3663 extend(target[key], src[key]); 3664 } 3665 }); 3666} 3667 3668const ssrDocument = { 3669 body: {}, 3670 addEventListener() { }, 3671 removeEventListener() { }, 3672 activeElement: { 3673 blur() { }, 3674 nodeName: '', 3675 }, 3676 querySelector() { 3677 return null; 3678 }, 3679 querySelectorAll() { 3680 return []; 3681 }, 3682 getElementById() { 3683 return null; 3684 }, 3685 createEvent() { 3686 return { 3687 initEvent() { }, 3688 }; 3689 }, 3690 createElement() { 3691 return { 3692 children: [], 3693 childNodes: [], 3694 style: {}, 3695 setAttribute() { }, 3696 getElementsByTagName() { 3697 return []; 3698 }, 3699 }; 3700 }, 3701 createElementNS() { 3702 return {}; 3703 }, 3704 importNode() { 3705 return null; 3706 }, 3707 location: { 3708 hash: '', 3709 host: '', 3710 hostname: '', 3711 href: '', 3712 origin: '', 3713 pathname: '', 3714 protocol: '', 3715 search: '', 3716 }, 3717}; 3718function ssr_window_esm_getDocument() { 3719 const doc = typeof document !== 'undefined' ? document : {}; 3720 extend(doc, ssrDocument); 3721 return doc; 3722} 3723 3724const ssrWindow = { 3725 document: ssrDocument, 3726 navigator: { 3727 userAgent: '', 3728 }, 3729 location: { 3730 hash: '', 3731 host: '', 3732 hostname: '', 3733 href: '', 3734 origin: '', 3735 pathname: '', 3736 protocol: '', 3737 search: '', 3738 }, 3739 history: { 3740 replaceState() { }, 3741 pushState() { }, 3742 go() { }, 3743 back() { }, 3744 }, 3745 CustomEvent: function CustomEvent() { 3746 return this; 3747 }, 3748 addEventListener() { }, 3749 removeEventListener() { }, 3750 getComputedStyle() { 3751 return { 3752 getPropertyValue() { 3753 return ''; 3754 }, 3755 }; 3756 }, 3757 Image() { }, 3758 Date() { }, 3759 screen: {}, 3760 setTimeout() { }, 3761 clearTimeout() { }, 3762 matchMedia() { 3763 return {}; 3764 }, 3765 requestAnimationFrame(callback) { 3766 if (typeof setTimeout === 'undefined') { 3767 callback(); 3768 return null; 3769 } 3770 return setTimeout(callback, 0); 3771 }, 3772 cancelAnimationFrame(id) { 3773 if (typeof setTimeout === 'undefined') { 3774 return; 3775 } 3776 clearTimeout(id); 3777 }, 3778}; 3779function ssr_window_esm_getWindow() { 3780 const win = typeof window !== 'undefined' ? window : {}; 3781 extend(win, ssrWindow); 3782 return win; 3783} 3784 3785 3786 3787;// CONCATENATED MODULE: ./node_modules/dom7/dom7.esm.js 3788/** 3789 * Dom7 4.0.4 3790 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API 3791 * https://framework7.io/docs/dom7.html 3792 * 3793 * Copyright 2022, Vladimir Kharlampidi 3794 * 3795 * Licensed under MIT 3796 * 3797 * Released on: January 11, 2022 3798 */ 3799 3800 3801/* eslint-disable no-proto */ 3802function makeReactive(obj) { 3803 const proto = obj.__proto__; 3804 Object.defineProperty(obj, '__proto__', { 3805 get() { 3806 return proto; 3807 }, 3808 3809 set(value) { 3810 proto.__proto__ = value; 3811 } 3812 3813 }); 3814} 3815 3816class Dom7 extends Array { 3817 constructor(items) { 3818 if (typeof items === 'number') { 3819 super(items); 3820 } else { 3821 super(...(items || [])); 3822 makeReactive(this); 3823 } 3824 } 3825 3826} 3827 3828function arrayFlat(arr = []) { 3829 const res = []; 3830 arr.forEach(el => { 3831 if (Array.isArray(el)) { 3832 res.push(...arrayFlat(el)); 3833 } else { 3834 res.push(el); 3835 } 3836 }); 3837 return res; 3838} 3839function arrayFilter(arr, callback) { 3840 return Array.prototype.filter.call(arr, callback); 3841} 3842function arrayUnique(arr) { 3843 const uniqueArray = []; 3844 3845 for (let i = 0; i < arr.length; i += 1) {
vendor: 34,866 bytes, lines 3846-5310
3846 if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]); 3847 } 3848 3849 return uniqueArray; 3850} 3851function toCamelCase(string) { 3852 return string.toLowerCase().replace(/-(.)/g, (match, group) => group.toUpperCase()); 3853} 3854 3855// eslint-disable-next-line 3856 3857function qsa(selector, context) { 3858 if (typeof selector !== 'string') { 3859 return [selector]; 3860 } 3861 3862 const a = []; 3863 const res = context.querySelectorAll(selector); 3864 3865 for (let i = 0; i < res.length; i += 1) { 3866 a.push(res[i]); 3867 } 3868 3869 return a; 3870} 3871 3872function dom7_esm_$(selector, context) { 3873 const window = ssr_window_esm_getWindow(); 3874 const document = ssr_window_esm_getDocument(); 3875 let arr = []; 3876 3877 if (!context && selector instanceof Dom7) { 3878 return selector; 3879 } 3880 3881 if (!selector) { 3882 return new Dom7(arr); 3883 } 3884 3885 if (typeof selector === 'string') { 3886 const html = selector.trim(); 3887 3888 if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) { 3889 let toCreate = 'div'; 3890 if (html.indexOf('<li') === 0) toCreate = 'ul'; 3891 if (html.indexOf('<tr') === 0) toCreate = 'tbody'; 3892 if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr'; 3893 if (html.indexOf('<tbody') === 0) toCreate = 'table'; 3894 if (html.indexOf('<option') === 0) toCreate = 'select'; 3895 const tempParent = document.createElement(toCreate); 3896 tempParent.innerHTML = html; 3897 3898 for (let i = 0; i < tempParent.childNodes.length; i += 1) { 3899 arr.push(tempParent.childNodes[i]); 3900 } 3901 } else { 3902 arr = qsa(selector.trim(), context || document); 3903 } // arr = qsa(selector, document); 3904 3905 } else if (selector.nodeType || selector === window || selector === document) { 3906 arr.push(selector); 3907 } else if (Array.isArray(selector)) { 3908 if (selector instanceof Dom7) return selector; 3909 arr = selector; 3910 } 3911 3912 return new Dom7(arrayUnique(arr)); 3913} 3914 3915dom7_esm_$.fn = Dom7.prototype; 3916 3917// eslint-disable-next-line 3918 3919function addClass(...classes) { 3920 const classNames = arrayFlat(classes.map(c => c.split(' '))); 3921 this.forEach(el => { 3922 el.classList.add(...classNames); 3923 }); 3924 return this; 3925} 3926 3927function removeClass(...classes) { 3928 const classNames = arrayFlat(classes.map(c => c.split(' '))); 3929 this.forEach(el => { 3930 el.classList.remove(...classNames); 3931 }); 3932 return this; 3933} 3934 3935function toggleClass(...classes) { 3936 const classNames = arrayFlat(classes.map(c => c.split(' '))); 3937 this.forEach(el => { 3938 classNames.forEach(className => { 3939 el.classList.toggle(className); 3940 }); 3941 }); 3942} 3943 3944function hasClass(...classes) { 3945 const classNames = arrayFlat(classes.map(c => c.split(' '))); 3946 return arrayFilter(this, el => { 3947 return classNames.filter(className => el.classList.contains(className)).length > 0; 3948 }).length > 0; 3949} 3950 3951function attr(attrs, value) { 3952 if (arguments.length === 1 && typeof attrs === 'string') { 3953 // Get attr 3954 if (this[0]) return this[0].getAttribute(attrs); 3955 return undefined; 3956 } // Set attrs 3957 3958 3959 for (let i = 0; i < this.length; i += 1) { 3960 if (arguments.length === 2) { 3961 // String 3962 this[i].setAttribute(attrs, value); 3963 } else { 3964 // Object 3965 for (const attrName in attrs) { 3966 this[i][attrName] = attrs[attrName]; 3967 this[i].setAttribute(attrName, attrs[attrName]); 3968 } 3969 } 3970 } 3971 3972 return this; 3973} 3974 3975function removeAttr(attr) { 3976 for (let i = 0; i < this.length; i += 1) { 3977 this[i].removeAttribute(attr); 3978 } 3979 3980 return this; 3981} 3982 3983function prop(props, value) { 3984 if (arguments.length === 1 && typeof props === 'string') { 3985 // Get prop 3986 if (this[0]) return this[0][props]; 3987 } else { 3988 // Set props 3989 for (let i = 0; i < this.length; i += 1) { 3990 if (arguments.length === 2) { 3991 // String 3992 this[i][props] = value; 3993 } else { 3994 // Object 3995 for (const propName in props) { 3996 this[i][propName] = props[propName]; 3997 } 3998 } 3999 } 4000 4001 return this; 4002 } 4003 4004 return this; 4005} 4006 4007function data(key, value) { 4008 let el; 4009 4010 if (typeof value === 'undefined') { 4011 el = this[0]; 4012 if (!el) return undefined; // Get value 4013 4014 if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) { 4015 return el.dom7ElementDataStorage[key]; 4016 } 4017 4018 const dataKey = el.getAttribute(`data-${key}`); 4019 4020 if (dataKey) { 4021 return dataKey; 4022 } 4023 4024 return undefined; 4025 } // Set value 4026 4027 4028 for (let i = 0; i < this.length; i += 1) { 4029 el = this[i]; 4030 if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {}; 4031 el.dom7ElementDataStorage[key] = value; 4032 } 4033 4034 return this; 4035} 4036 4037function removeData(key) { 4038 for (let i = 0; i < this.length; i += 1) { 4039 const el = this[i]; 4040 4041 if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) { 4042 el.dom7ElementDataStorage[key] = null; 4043 delete el.dom7ElementDataStorage[key]; 4044 } 4045 } 4046} 4047 4048function dataset() { 4049 const el = this[0]; 4050 if (!el) return undefined; 4051 const dataset = {}; // eslint-disable-line 4052 4053 if (el.dataset) { 4054 for (const dataKey in el.dataset) { 4055 dataset[dataKey] = el.dataset[dataKey]; 4056 } 4057 } else { 4058 for (let i = 0; i < el.attributes.length; i += 1) { 4059 const attr = el.attributes[i]; 4060 4061 if (attr.name.indexOf('data-') >= 0) { 4062 dataset[toCamelCase(attr.name.split('data-')[1])] = attr.value; 4063 } 4064 } 4065 } 4066 4067 for (const key in dataset) { 4068 if (dataset[key] === 'false') dataset[key] = false;else if (dataset[key] === 'true') dataset[key] = true;else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1; 4069 } 4070 4071 return dataset; 4072} 4073 4074function val(value) { 4075 if (typeof value === 'undefined') { 4076 // get value 4077 const el = this[0]; 4078 if (!el) return undefined; 4079 4080 if (el.multiple && el.nodeName.toLowerCase() === 'select') { 4081 const values = []; 4082 4083 for (let i = 0; i < el.selectedOptions.length; i += 1) { 4084 values.push(el.selectedOptions[i].value); 4085 } 4086 4087 return values; 4088 } 4089 4090 return el.value; 4091 } // set value 4092 4093 4094 for (let i = 0; i < this.length; i += 1) { 4095 const el = this[i]; 4096 4097 if (Array.isArray(value) && el.multiple && el.nodeName.toLowerCase() === 'select') { 4098 for (let j = 0; j < el.options.length; j += 1) { 4099 el.options[j].selected = value.indexOf(el.options[j].value) >= 0; 4100 } 4101 } else { 4102 el.value = value; 4103 } 4104 } 4105 4106 return this; 4107} 4108 4109function value(value) { 4110 return this.val(value); 4111} 4112 4113function transform(transform) { 4114 for (let i = 0; i < this.length; i += 1) { 4115 this[i].style.transform = transform; 4116 } 4117 4118 return this; 4119} 4120 4121function transition(duration) { 4122 for (let i = 0; i < this.length; i += 1) { 4123 this[i].style.transitionDuration = typeof duration !== 'string' ? `${duration}ms` : duration; 4124 } 4125 4126 return this; 4127} 4128 4129function on(...args) { 4130 let [eventType, targetSelector, listener, capture] = args; 4131 4132 if (typeof args[1] === 'function') { 4133 [eventType, listener, capture] = args; 4134 targetSelector = undefined; 4135 } 4136 4137 if (!capture) capture = false; 4138 4139 function handleLiveEvent(e) { 4140 const target = e.target; 4141 if (!target) return; 4142 const eventData = e.target.dom7EventData || []; 4143 4144 if (eventData.indexOf(e) < 0) { 4145 eventData.unshift(e); 4146 } 4147 4148 if (dom7_esm_$(target).is(targetSelector)) listener.apply(target, eventData);else { 4149 const parents = dom7_esm_$(target).parents(); // eslint-disable-line 4150 4151 for (let k = 0; k < parents.length; k += 1) { 4152 if (dom7_esm_$(parents[k]).is(targetSelector)) listener.apply(parents[k], eventData); 4153 } 4154 } 4155 } 4156 4157 function handleEvent(e) { 4158 const eventData = e && e.target ? e.target.dom7EventData || [] : []; 4159 4160 if (eventData.indexOf(e) < 0) { 4161 eventData.unshift(e); 4162 } 4163 4164 listener.apply(this, eventData); 4165 } 4166 4167 const events = eventType.split(' '); 4168 let j; 4169 4170 for (let i = 0; i < this.length; i += 1) { 4171 const el = this[i]; 4172 4173 if (!targetSelector) { 4174 for (j = 0; j < events.length; j += 1) { 4175 const event = events[j]; 4176 if (!el.dom7Listeners) el.dom7Listeners = {}; 4177 if (!el.dom7Listeners[event]) el.dom7Listeners[event] = []; 4178 el.dom7Listeners[event].push({ 4179 listener, 4180 proxyListener: handleEvent 4181 }); 4182 el.addEventListener(event, handleEvent, capture); 4183 } 4184 } else { 4185 // Live events 4186 for (j = 0; j < events.length; j += 1) { 4187 const event = events[j]; 4188 if (!el.dom7LiveListeners) el.dom7LiveListeners = {}; 4189 if (!el.dom7LiveListeners[event]) el.dom7LiveListeners[event] = []; 4190 el.dom7LiveListeners[event].push({ 4191 listener, 4192 proxyListener: handleLiveEvent 4193 }); 4194 el.addEventListener(event, handleLiveEvent, capture); 4195 } 4196 } 4197 } 4198 4199 return this; 4200} 4201 4202function off(...args) { 4203 let [eventType, targetSelector, listener, capture] = args; 4204 4205 if (typeof args[1] === 'function') { 4206 [eventType, listener, capture] = args; 4207 targetSelector = undefined; 4208 } 4209 4210 if (!capture) capture = false; 4211 const events = eventType.split(' '); 4212 4213 for (let i = 0; i < events.length; i += 1) { 4214 const event = events[i]; 4215 4216 for (let j = 0; j < this.length; j += 1) { 4217 const el = this[j]; 4218 let handlers; 4219 4220 if (!targetSelector && el.dom7Listeners) { 4221 handlers = el.dom7Listeners[event]; 4222 } else if (targetSelector && el.dom7LiveListeners) { 4223 handlers = el.dom7LiveListeners[event]; 4224 } 4225 4226 if (handlers && handlers.length) { 4227 for (let k = handlers.length - 1; k >= 0; k -= 1) { 4228 const handler = handlers[k]; 4229 4230 if (listener && handler.listener === listener) { 4231 el.removeEventListener(event, handler.proxyListener, capture); 4232 handlers.splice(k, 1); 4233 } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) { 4234 el.removeEventListener(event, handler.proxyListener, capture); 4235 handlers.splice(k, 1); 4236 } else if (!listener) { 4237 el.removeEventListener(event, handler.proxyListener, capture); 4238 handlers.splice(k, 1); 4239 } 4240 } 4241 } 4242 } 4243 } 4244 4245 return this; 4246} 4247 4248function once(...args) { 4249 const dom = this; 4250 let [eventName, targetSelector, listener, capture] = args; 4251 4252 if (typeof args[1] === 'function') { 4253 [eventName, listener, capture] = args; 4254 targetSelector = undefined; 4255 } 4256 4257 function onceHandler(...eventArgs) { 4258 listener.apply(this, eventArgs); 4259 dom.off(eventName, targetSelector, onceHandler, capture); 4260 4261 if (onceHandler.dom7proxy) { 4262 delete onceHandler.dom7proxy; 4263 } 4264 } 4265 4266 onceHandler.dom7proxy = listener; 4267 return dom.on(eventName, targetSelector, onceHandler, capture); 4268} 4269 4270function trigger(...args) { 4271 const window = ssr_window_esm_getWindow(); 4272 const events = args[0].split(' '); 4273 const eventData = args[1]; 4274 4275 for (let i = 0; i < events.length; i += 1) { 4276 const event = events[i]; 4277 4278 for (let j = 0; j < this.length; j += 1) { 4279 const el = this[j]; 4280 4281 if (window.CustomEvent) { 4282 const evt = new window.CustomEvent(event, { 4283 detail: eventData, 4284 bubbles: true, 4285 cancelable: true 4286 }); 4287 el.dom7EventData = args.filter((data, dataIndex) => dataIndex > 0); 4288 el.dispatchEvent(evt); 4289 el.dom7EventData = []; 4290 delete el.dom7EventData; 4291 } 4292 } 4293 } 4294 4295 return this; 4296} 4297 4298function transitionEnd(callback) { 4299 const dom = this; 4300 4301 function fireCallBack(e) { 4302 if (e.target !== this) return; 4303 callback.call(this, e); 4304 dom.off('transitionend', fireCallBack); 4305 } 4306 4307 if (callback) { 4308 dom.on('transitionend', fireCallBack); 4309 } 4310 4311 return this; 4312} 4313 4314function animationEnd(callback) { 4315 const dom = this; 4316 4317 function fireCallBack(e) { 4318 if (e.target !== this) return; 4319 callback.call(this, e); 4320 dom.off('animationend', fireCallBack); 4321 } 4322 4323 if (callback) { 4324 dom.on('animationend', fireCallBack); 4325 } 4326 4327 return this; 4328} 4329 4330function width() { 4331 const window = getWindow(); 4332 4333 if (this[0] === window) { 4334 return window.innerWidth; 4335 } 4336 4337 if (this.length > 0) { 4338 return parseFloat(this.css('width')); 4339 } 4340 4341 return null; 4342} 4343 4344function dom7_esm_outerWidth(includeMargins) { 4345 if (this.length > 0) { 4346 if (includeMargins) { 4347 const styles = this.styles(); 4348 return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left')); 4349 } 4350 4351 return this[0].offsetWidth; 4352 } 4353 4354 return null; 4355} 4356 4357function height() { 4358 const window = getWindow(); 4359 4360 if (this[0] === window) { 4361 return window.innerHeight; 4362 } 4363 4364 if (this.length > 0) { 4365 return parseFloat(this.css('height')); 4366 } 4367 4368 return null; 4369} 4370 4371function dom7_esm_outerHeight(includeMargins) { 4372 if (this.length > 0) { 4373 if (includeMargins) { 4374 const styles = this.styles(); 4375 return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom')); 4376 } 4377 4378 return this[0].offsetHeight; 4379 } 4380 4381 return null; 4382} 4383 4384function offset() { 4385 if (this.length > 0) { 4386 const window = ssr_window_esm_getWindow(); 4387 const document = ssr_window_esm_getDocument(); 4388 const el = this[0]; 4389 const box = el.getBoundingClientRect(); 4390 const body = document.body; 4391 const clientTop = el.clientTop || body.clientTop || 0; 4392 const clientLeft = el.clientLeft || body.clientLeft || 0; 4393 const scrollTop = el === window ? window.scrollY : el.scrollTop; 4394 const scrollLeft = el === window ? window.scrollX : el.scrollLeft; 4395 return { 4396 top: box.top + scrollTop - clientTop, 4397 left: box.left + scrollLeft - clientLeft 4398 }; 4399 } 4400 4401 return null; 4402} 4403 4404function hide() { 4405 for (let i = 0; i < this.length; i += 1) { 4406 this[i].style.display = 'none'; 4407 } 4408 4409 return this; 4410} 4411 4412function show() { 4413 const window = getWindow(); 4414 4415 for (let i = 0; i < this.length; i += 1) { 4416 const el = this[i]; 4417 4418 if (el.style.display === 'none') { 4419 el.style.display = ''; 4420 } 4421 4422 if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') { 4423 // Still not visible 4424 el.style.display = 'block'; 4425 } 4426 } 4427 4428 return this; 4429} 4430 4431function styles() { 4432 const window = ssr_window_esm_getWindow(); 4433 if (this[0]) return window.getComputedStyle(this[0], null); 4434 return {}; 4435} 4436 4437function css(props, value) { 4438 const window = ssr_window_esm_getWindow(); 4439 let i; 4440 4441 if (arguments.length === 1) { 4442 if (typeof props === 'string') { 4443 // .css('width') 4444 if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props); 4445 } else { 4446 // .css({ width: '100px' }) 4447 for (i = 0; i < this.length; i += 1) { 4448 for (const prop in props) { 4449 this[i].style[prop] = props[prop]; 4450 } 4451 } 4452 4453 return this; 4454 } 4455 } 4456 4457 if (arguments.length === 2 && typeof props === 'string') { 4458 // .css('width', '100px') 4459 for (i = 0; i < this.length; i += 1) { 4460 this[i].style[props] = value; 4461 } 4462 4463 return this; 4464 } 4465 4466 return this; 4467} 4468 4469function each(callback) { 4470 if (!callback) return this; 4471 this.forEach((el, index) => { 4472 callback.apply(el, [el, index]); 4473 }); 4474 return this; 4475} 4476 4477function filter(callback) { 4478 const result = arrayFilter(this, callback); 4479 return dom7_esm_$(result); 4480} 4481 4482function html(html) { 4483 if (typeof html === 'undefined') { 4484 return this[0] ? this[0].innerHTML : null; 4485 } 4486 4487 for (let i = 0; i < this.length; i += 1) { 4488 this[i].innerHTML = html; 4489 } 4490 4491 return this; 4492} 4493 4494function dom7_esm_text(text) { 4495 if (typeof text === 'undefined') { 4496 return this[0] ? this[0].textContent.trim() : null; 4497 } 4498 4499 for (let i = 0; i < this.length; i += 1) { 4500 this[i].textContent = text; 4501 } 4502 4503 return this; 4504} 4505 4506function is(selector) { 4507 const window = ssr_window_esm_getWindow(); 4508 const document = ssr_window_esm_getDocument(); 4509 const el = this[0]; 4510 let compareWith; 4511 let i; 4512 if (!el || typeof selector === 'undefined') return false; 4513 4514 if (typeof selector === 'string') { 4515 if (el.matches) return el.matches(selector); 4516 if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector); 4517 if (el.msMatchesSelector) return el.msMatchesSelector(selector); 4518 compareWith = dom7_esm_$(selector); 4519 4520 for (i = 0; i < compareWith.length; i += 1) { 4521 if (compareWith[i] === el) return true; 4522 } 4523 4524 return false; 4525 } 4526 4527 if (selector === document) { 4528 return el === document; 4529 } 4530 4531 if (selector === window) { 4532 return el === window; 4533 } 4534 4535 if (selector.nodeType || selector instanceof Dom7) { 4536 compareWith = selector.nodeType ? [selector] : selector; 4537 4538 for (i = 0; i < compareWith.length; i += 1) { 4539 if (compareWith[i] === el) return true; 4540 } 4541 4542 return false; 4543 } 4544 4545 return false; 4546} 4547 4548function index() { 4549 let child = this[0]; 4550 let i; 4551 4552 if (child) { 4553 i = 0; // eslint-disable-next-line 4554 4555 while ((child = child.previousSibling) !== null) { 4556 if (child.nodeType === 1) i += 1; 4557 } 4558 4559 return i; 4560 } 4561 4562 return undefined; 4563} 4564 4565function eq(index) { 4566 if (typeof index === 'undefined') return this; 4567 const length = this.length; 4568 4569 if (index > length - 1) { 4570 return dom7_esm_$([]); 4571 } 4572 4573 if (index < 0) { 4574 const returnIndex = length + index; 4575 if (returnIndex < 0) return dom7_esm_$([]); 4576 return dom7_esm_$([this[returnIndex]]); 4577 } 4578 4579 return dom7_esm_$([this[index]]); 4580} 4581 4582function append(...els) { 4583 let newChild; 4584 const document = ssr_window_esm_getDocument(); 4585 4586 for (let k = 0; k < els.length; k += 1) { 4587 newChild = els[k]; 4588 4589 for (let i = 0; i < this.length; i += 1) { 4590 if (typeof newChild === 'string') { 4591 const tempDiv = document.createElement('div'); 4592 tempDiv.innerHTML = newChild; 4593 4594 while (tempDiv.firstChild) { 4595 this[i].appendChild(tempDiv.firstChild); 4596 } 4597 } else if (newChild instanceof Dom7) { 4598 for (let j = 0; j < newChild.length; j += 1) { 4599 this[i].appendChild(newChild[j]); 4600 } 4601 } else { 4602 this[i].appendChild(newChild); 4603 } 4604 } 4605 } 4606 4607 return this; 4608} 4609 4610function appendTo(parent) { 4611 dom7_esm_$(parent).append(this); 4612 return this; 4613} 4614 4615function prepend(newChild) { 4616 const document = ssr_window_esm_getDocument(); 4617 let i; 4618 let j; 4619 4620 for (i = 0; i < this.length; i += 1) { 4621 if (typeof newChild === 'string') { 4622 const tempDiv = document.createElement('div'); 4623 tempDiv.innerHTML = newChild; 4624 4625 for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) { 4626 this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]); 4627 } 4628 } else if (newChild instanceof Dom7) { 4629 for (j = 0; j < newChild.length; j += 1) { 4630 this[i].insertBefore(newChild[j], this[i].childNodes[0]); 4631 } 4632 } else { 4633 this[i].insertBefore(newChild, this[i].childNodes[0]); 4634 } 4635 } 4636 4637 return this; 4638} 4639 4640function prependTo(parent) { 4641 dom7_esm_$(parent).prepend(this); 4642 return this; 4643} 4644 4645function insertBefore(selector) { 4646 const before = dom7_esm_$(selector); 4647 4648 for (let i = 0; i < this.length; i += 1) { 4649 if (before.length === 1) { 4650 before[0].parentNode.insertBefore(this[i], before[0]); 4651 } else if (before.length > 1) { 4652 for (let j = 0; j < before.length; j += 1) { 4653 before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]); 4654 } 4655 } 4656 } 4657} 4658 4659function insertAfter(selector) { 4660 const after = dom7_esm_$(selector); 4661 4662 for (let i = 0; i < this.length; i += 1) { 4663 if (after.length === 1) { 4664 after[0].parentNode.insertBefore(this[i], after[0].nextSibling); 4665 } else if (after.length > 1) { 4666 for (let j = 0; j < after.length; j += 1) { 4667 after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling); 4668 } 4669 } 4670 } 4671} 4672 4673function next(selector) { 4674 if (this.length > 0) { 4675 if (selector) { 4676 if (this[0].nextElementSibling && dom7_esm_$(this[0].nextElementSibling).is(selector)) { 4677 return dom7_esm_$([this[0].nextElementSibling]); 4678 } 4679 4680 return dom7_esm_$([]); 4681 } 4682 4683 if (this[0].nextElementSibling) return dom7_esm_$([this[0].nextElementSibling]); 4684 return dom7_esm_$([]); 4685 } 4686 4687 return dom7_esm_$([]); 4688} 4689 4690function nextAll(selector) { 4691 const nextEls = []; 4692 let el = this[0]; 4693 if (!el) return dom7_esm_$([]); 4694 4695 while (el.nextElementSibling) { 4696 const next = el.nextElementSibling; // eslint-disable-line 4697 4698 if (selector) { 4699 if (dom7_esm_$(next).is(selector)) nextEls.push(next); 4700 } else nextEls.push(next); 4701 4702 el = next; 4703 } 4704 4705 return dom7_esm_$(nextEls); 4706} 4707 4708function prev(selector) { 4709 if (this.length > 0) { 4710 const el = this[0]; 4711 4712 if (selector) { 4713 if (el.previousElementSibling && dom7_esm_$(el.previousElementSibling).is(selector)) { 4714 return dom7_esm_$([el.previousElementSibling]); 4715 } 4716 4717 return dom7_esm_$([]); 4718 } 4719 4720 if (el.previousElementSibling) return dom7_esm_$([el.previousElementSibling]); 4721 return dom7_esm_$([]); 4722 } 4723 4724 return dom7_esm_$([]); 4725} 4726 4727function prevAll(selector) { 4728 const prevEls = []; 4729 let el = this[0]; 4730 if (!el) return dom7_esm_$([]); 4731 4732 while (el.previousElementSibling) { 4733 const prev = el.previousElementSibling; // eslint-disable-line 4734 4735 if (selector) { 4736 if (dom7_esm_$(prev).is(selector)) prevEls.push(prev); 4737 } else prevEls.push(prev); 4738 4739 el = prev; 4740 } 4741 4742 return dom7_esm_$(prevEls); 4743} 4744 4745function siblings(selector) { 4746 return this.nextAll(selector).add(this.prevAll(selector)); 4747} 4748 4749function dom7_esm_parent(selector) { 4750 const parents = []; // eslint-disable-line 4751 4752 for (let i = 0; i < this.length; i += 1) { 4753 if (this[i].parentNode !== null) { 4754 if (selector) { 4755 if (dom7_esm_$(this[i].parentNode).is(selector)) parents.push(this[i].parentNode); 4756 } else { 4757 parents.push(this[i].parentNode); 4758 } 4759 } 4760 } 4761 4762 return dom7_esm_$(parents); 4763} 4764 4765function parents(selector) { 4766 const parents = []; // eslint-disable-line 4767 4768 for (let i = 0; i < this.length; i += 1) { 4769 let parent = this[i].parentNode; // eslint-disable-line 4770 4771 while (parent) { 4772 if (selector) { 4773 if (dom7_esm_$(parent).is(selector)) parents.push(parent); 4774 } else { 4775 parents.push(parent); 4776 } 4777 4778 parent = parent.parentNode; 4779 } 4780 } 4781 4782 return dom7_esm_$(parents); 4783} 4784 4785function closest(selector) { 4786 let closest = this; // eslint-disable-line 4787 4788 if (typeof selector === 'undefined') { 4789 return dom7_esm_$([]); 4790 } 4791 4792 if (!closest.is(selector)) { 4793 closest = closest.parents(selector).eq(0); 4794 } 4795 4796 return closest; 4797} 4798 4799function find(selector) { 4800 const foundElements = []; 4801 4802 for (let i = 0; i < this.length; i += 1) { 4803 const found = this[i].querySelectorAll(selector); 4804 4805 for (let j = 0; j < found.length; j += 1) { 4806 foundElements.push(found[j]); 4807 } 4808 } 4809 4810 return dom7_esm_$(foundElements); 4811} 4812 4813function children(selector) { 4814 const children = []; // eslint-disable-line 4815 4816 for (let i = 0; i < this.length; i += 1) { 4817 const childNodes = this[i].children; 4818 4819 for (let j = 0; j < childNodes.length; j += 1) { 4820 if (!selector || dom7_esm_$(childNodes[j]).is(selector)) { 4821 children.push(childNodes[j]); 4822 } 4823 } 4824 } 4825 4826 return dom7_esm_$(children); 4827} 4828 4829function remove() { 4830 for (let i = 0; i < this.length; i += 1) { 4831 if (this[i].parentNode) this[i].parentNode.removeChild(this[i]); 4832 } 4833 4834 return this; 4835} 4836 4837function detach() { 4838 return this.remove(); 4839} 4840 4841function add(...els) { 4842 const dom = this; 4843 let i; 4844 let j; 4845 4846 for (i = 0; i < els.length; i += 1) { 4847 const toAdd = dom7_esm_$(els[i]); 4848 4849 for (j = 0; j < toAdd.length; j += 1) { 4850 dom.push(toAdd[j]); 4851 } 4852 } 4853 4854 return dom; 4855} 4856 4857function empty() { 4858 for (let i = 0; i < this.length; i += 1) { 4859 const el = this[i]; 4860 4861 if (el.nodeType === 1) { 4862 for (let j = 0; j < el.childNodes.length; j += 1) { 4863 if (el.childNodes[j].parentNode) { 4864 el.childNodes[j].parentNode.removeChild(el.childNodes[j]); 4865 } 4866 } 4867 4868 el.textContent = ''; 4869 } 4870 } 4871 4872 return this; 4873} 4874 4875// eslint-disable-next-line 4876 4877function scrollTo(...args) { 4878 const window = getWindow(); 4879 let [left, top, duration, easing, callback] = args; 4880 4881 if (args.length === 4 && typeof easing === 'function') { 4882 callback = easing; 4883 [left, top, duration, callback, easing] = args; 4884 } 4885 4886 if (typeof easing === 'undefined') easing = 'swing'; 4887 return this.each(function animate() { 4888 const el = this; 4889 let currentTop; 4890 let currentLeft; 4891 let maxTop; 4892 let maxLeft; 4893 let newTop; 4894 let newLeft; 4895 let scrollTop; // eslint-disable-line 4896 4897 let scrollLeft; // eslint-disable-line 4898 4899 let animateTop = top > 0 || top === 0; 4900 let animateLeft = left > 0 || left === 0; 4901 4902 if (typeof easing === 'undefined') { 4903 easing = 'swing'; 4904 } 4905 4906 if (animateTop) { 4907 currentTop = el.scrollTop; 4908 4909 if (!duration) { 4910 el.scrollTop = top; 4911 } 4912 } 4913 4914 if (animateLeft) { 4915 currentLeft = el.scrollLeft; 4916 4917 if (!duration) { 4918 el.scrollLeft = left; 4919 } 4920 } 4921 4922 if (!duration) return; 4923 4924 if (animateTop) { 4925 maxTop = el.scrollHeight - el.offsetHeight; 4926 newTop = Math.max(Math.min(top, maxTop), 0); 4927 } 4928 4929 if (animateLeft) { 4930 maxLeft = el.scrollWidth - el.offsetWidth; 4931 newLeft = Math.max(Math.min(left, maxLeft), 0); 4932 } 4933 4934 let startTime = null; 4935 if (animateTop && newTop === currentTop) animateTop = false; 4936 if (animateLeft && newLeft === currentLeft) animateLeft = false; 4937 4938 function render(time = new Date().getTime()) { 4939 if (startTime === null) { 4940 startTime = time; 4941 } 4942 4943 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 4944 const easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2; 4945 let done; 4946 if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop); 4947 if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft); 4948 4949 if (animateTop && newTop > currentTop && scrollTop >= newTop) { 4950 el.scrollTop = newTop; 4951 done = true; 4952 } 4953 4954 if (animateTop && newTop < currentTop && scrollTop <= newTop) { 4955 el.scrollTop = newTop; 4956 done = true; 4957 } 4958 4959 if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) { 4960 el.scrollLeft = newLeft; 4961 done = true; 4962 } 4963 4964 if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) { 4965 el.scrollLeft = newLeft; 4966 done = true; 4967 } 4968 4969 if (done) { 4970 if (callback) callback(); 4971 return; 4972 } 4973 4974 if (animateTop) el.scrollTop = scrollTop; 4975 if (animateLeft) el.scrollLeft = scrollLeft; 4976 window.requestAnimationFrame(render); 4977 } 4978 4979 window.requestAnimationFrame(render); 4980 }); 4981} // scrollTop(top, duration, easing, callback) { 4982 4983 4984function scrollTop(...args) { 4985 let [top, duration, easing, callback] = args; 4986 4987 if (args.length === 3 && typeof easing === 'function') { 4988 [top, duration, callback, easing] = args; 4989 } 4990 4991 const dom = this; 4992 4993 if (typeof top === 'undefined') { 4994 if (dom.length > 0) return dom[0].scrollTop; 4995 return null; 4996 } 4997 4998 return dom.scrollTo(undefined, top, duration, easing, callback); 4999} 5000 5001function scrollLeft(...args) { 5002 let [left, duration, easing, callback] = args; 5003 5004 if (args.length === 3 && typeof easing === 'function') { 5005 [left, duration, callback, easing] = args; 5006 } 5007 5008 const dom = this; 5009 5010 if (typeof left === 'undefined') { 5011 if (dom.length > 0) return dom[0].scrollLeft; 5012 return null; 5013 } 5014 5015 return dom.scrollTo(left, undefined, duration, easing, callback); 5016} 5017 5018// eslint-disable-next-line 5019 5020function animate(initialProps, initialParams) { 5021 const window = getWindow(); 5022 const els = this; 5023 const a = { 5024 props: Object.assign({}, initialProps), 5025 params: Object.assign({ 5026 duration: 300, 5027 easing: 'swing' // or 'linear' 5028 5029 /* Callbacks 5030 begin(elements) 5031 complete(elements) 5032 progress(elements, complete, remaining, start, tweenValue) 5033 */ 5034 5035 }, initialParams), 5036 elements: els, 5037 animating: false, 5038 que: [], 5039 5040 easingProgress(easing, progress) { 5041 if (easing === 'swing') { 5042 return 0.5 - Math.cos(progress * Math.PI) / 2; 5043 } 5044 5045 if (typeof easing === 'function') { 5046 return easing(progress); 5047 } 5048 5049 return progress; 5050 }, 5051 5052 stop() { 5053 if (a.frameId) { 5054 window.cancelAnimationFrame(a.frameId); 5055 } 5056 5057 a.animating = false; 5058 a.elements.each(el => { 5059 const element = el; 5060 delete element.dom7AnimateInstance; 5061 }); 5062 a.que = []; 5063 }, 5064 5065 done(complete) { 5066 a.animating = false; 5067 a.elements.each(el => { 5068 const element = el; 5069 delete element.dom7AnimateInstance; 5070 }); 5071 if (complete) complete(els); 5072 5073 if (a.que.length > 0) { 5074 const que = a.que.shift(); 5075 a.animate(que[0], que[1]); 5076 } 5077 }, 5078 5079 animate(props, params) { 5080 if (a.animating) { 5081 a.que.push([props, params]); 5082 return a; 5083 } 5084 5085 const elements = []; // Define & Cache Initials & Units 5086 5087 a.elements.each((el, index) => { 5088 let initialFullValue; 5089 let initialValue; 5090 let unit; 5091 let finalValue; 5092 let finalFullValue; 5093 if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a; 5094 elements[index] = { 5095 container: el 5096 }; 5097 Object.keys(props).forEach(prop => { 5098 initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.'); 5099 initialValue = parseFloat(initialFullValue); 5100 unit = initialFullValue.replace(initialValue, ''); 5101 finalValue = parseFloat(props[prop]); 5102 finalFullValue = props[prop] + unit; 5103 elements[index][prop] = { 5104 initialFullValue, 5105 initialValue, 5106 unit, 5107 finalValue, 5108 finalFullValue, 5109 currentValue: initialValue 5110 }; 5111 }); 5112 }); 5113 let startTime = null; 5114 let time; 5115 let elementsDone = 0; 5116 let propsDone = 0; 5117 let done; 5118 let began = false; 5119 a.animating = true; 5120 5121 function render() { 5122 time = new Date().getTime(); 5123 let progress; 5124 let easeProgress; // let el; 5125 5126 if (!began) { 5127 began = true; 5128 if (params.begin) params.begin(els); 5129 } 5130 5131 if (startTime === null) { 5132 startTime = time; 5133 } 5134 5135 if (params.progress) { 5136 // eslint-disable-next-line 5137 params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime); 5138 } 5139 5140 elements.forEach(element => { 5141 const el = element; 5142 if (done || el.done) return; 5143 Object.keys(props).forEach(prop => { 5144 if (done || el.done) return; 5145 progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0); 5146 easeProgress = a.easingProgress(params.easing, progress); 5147 const { 5148 initialValue, 5149 finalValue, 5150 unit 5151 } = el[prop]; 5152 el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue); 5153 const currentValue = el[prop].currentValue; 5154 5155 if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) { 5156 el.container.style[prop] = finalValue + unit; 5157 propsDone += 1; 5158 5159 if (propsDone === Object.keys(props).length) { 5160 el.done = true; 5161 elementsDone += 1; 5162 } 5163 5164 if (elementsDone === elements.length) { 5165 done = true; 5166 } 5167 } 5168 5169 if (done) { 5170 a.done(params.complete); 5171 return; 5172 } 5173 5174 el.container.style[prop] = currentValue + unit; 5175 }); 5176 }); 5177 if (done) return; // Then call 5178 5179 a.frameId = window.requestAnimationFrame(render); 5180 } 5181 5182 a.frameId = window.requestAnimationFrame(render); 5183 return a; 5184 } 5185 5186 }; 5187 5188 if (a.elements.length === 0) { 5189 return els; 5190 } 5191 5192 let animateInstance; 5193 5194 for (let i = 0; i < a.elements.length; i += 1) { 5195 if (a.elements[i].dom7AnimateInstance) { 5196 animateInstance = a.elements[i].dom7AnimateInstance; 5197 } else a.elements[i].dom7AnimateInstance = a; 5198 } 5199 5200 if (!animateInstance) { 5201 animateInstance = a; 5202 } 5203 5204 if (initialProps === 'stop') { 5205 animateInstance.stop(); 5206 } else { 5207 animateInstance.animate(a.props, a.params); 5208 } 5209 5210 return els; 5211} 5212 5213function stop() { 5214 const els = this; 5215 5216 for (let i = 0; i < els.length; i += 1) { 5217 if (els[i].dom7AnimateInstance) { 5218 els[i].dom7AnimateInstance.stop(); 5219 } 5220 } 5221} 5222 5223const noTrigger = 'resize scroll'.split(' '); 5224 5225function shortcut(name) { 5226 function eventHandler(...args) { 5227 if (typeof args[0] === 'undefined') { 5228 for (let i = 0; i < this.length; i += 1) { 5229 if (noTrigger.indexOf(name) < 0) { 5230 if (name in this[i]) this[i][name]();else { 5231 dom7_esm_$(this[i]).trigger(name); 5232 } 5233 } 5234 } 5235 5236 return this; 5237 } 5238 5239 return this.on(name, ...args); 5240 } 5241 5242 return eventHandler; 5243} 5244 5245const click = shortcut('click'); 5246const dom7_esm_blur = shortcut('blur'); 5247const dom7_esm_focus = shortcut('focus'); 5248const focusin = shortcut('focusin'); 5249const focusout = shortcut('focusout'); 5250const keyup = shortcut('keyup'); 5251const keydown = shortcut('keydown'); 5252const keypress = shortcut('keypress'); 5253const dom7_esm_submit = shortcut('submit'); 5254const change = shortcut('change'); 5255const mousedown = shortcut('mousedown'); 5256const mousemove = shortcut('mousemove'); 5257const mouseup = shortcut('mouseup'); 5258const mouseenter = shortcut('mouseenter'); 5259const mouseleave = shortcut('mouseleave'); 5260const mouseout = shortcut('mouseout'); 5261const mouseover = shortcut('mouseover'); 5262const touchstart = shortcut('touchstart'); 5263const touchend = shortcut('touchend'); 5264const touchmove = shortcut('touchmove'); 5265const resize = shortcut('resize'); 5266const dom7_esm_scroll = shortcut('scroll'); 5267 5268/* harmony default export */ const dom7_esm = ((/* unused pure expression or super */ null && (dom7_esm_$))); 5269 5270 5271;// CONCATENATED MODULE: ./node_modules/swiper/shared/dom.js 5272 5273const Methods = { 5274 addClass: addClass, 5275 removeClass: removeClass, 5276 hasClass: hasClass, 5277 toggleClass: toggleClass, 5278 attr: attr, 5279 removeAttr: removeAttr, 5280 transform: transform, 5281 transition: transition, 5282 on: on, 5283 off: off, 5284 trigger: trigger, 5285 transitionEnd: transitionEnd, 5286 outerWidth: dom7_esm_outerWidth, 5287 outerHeight: dom7_esm_outerHeight, 5288 styles: styles, 5289 offset: offset, 5290 css: css, 5291 each: each, 5292 html: html, 5293 text: dom7_esm_text, 5294 is: is, 5295 index: index, 5296 eq: eq, 5297 append: append, 5298 prepend: prepend, 5299 next: next, 5300 nextAll: nextAll, 5301 prev: prev, 5302 prevAll: prevAll, 5303 parent: dom7_esm_parent, 5304 parents: parents, 5305 closest: closest, 5306 find: find, 5307 children: children, 5308 filter: filter, 5309 remove: remove 5310};
vendor: 19,593 bytes, lines 5311-6013
5311Object.keys(Methods).forEach(methodName => { 5312 Object.defineProperty(dom7_esm_$.fn, methodName, { 5313 value: Methods[methodName], 5314 writable: true 5315 }); 5316}); 5317/* harmony default export */ const dom = (dom7_esm_$); 5318;// CONCATENATED MODULE: ./node_modules/swiper/shared/utils.js 5319 5320 5321function deleteProps(obj) { 5322 const object = obj; 5323 Object.keys(object).forEach(key => { 5324 try { 5325 object[key] = null; 5326 } catch (e) {// no getter for object 5327 } 5328 5329 try { 5330 delete object[key]; 5331 } catch (e) {// something got wrong 5332 } 5333 }); 5334} 5335 5336function utils_nextTick(callback, delay = 0) { 5337 return setTimeout(callback, delay); 5338} 5339 5340function utils_now() { 5341 return Date.now(); 5342} 5343 5344function utils_getComputedStyle(el) { 5345 const window = ssr_window_esm_getWindow(); 5346 let style; 5347 5348 if (window.getComputedStyle) { 5349 style = window.getComputedStyle(el, null); 5350 } 5351 5352 if (!style && el.currentStyle) { 5353 style = el.currentStyle; 5354 } 5355 5356 if (!style) { 5357 style = el.style; 5358 } 5359 5360 return style; 5361} 5362 5363function utils_getTranslate(el, axis = 'x') { 5364 const window = ssr_window_esm_getWindow(); 5365 let matrix; 5366 let curTransform; 5367 let transformMatrix; 5368 const curStyle = utils_getComputedStyle(el, null); 5369 5370 if (window.WebKitCSSMatrix) { 5371 curTransform = curStyle.transform || curStyle.webkitTransform; 5372 5373 if (curTransform.split(',').length > 6) { 5374 curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); 5375 } // Some old versions of Webkit choke when 'none' is passed; pass 5376 // empty string instead in this case 5377 5378 5379 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 5380 } else { 5381 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 5382 matrix = transformMatrix.toString().split(','); 5383 } 5384 5385 if (axis === 'x') { 5386 // Latest Chrome and webkits Fix 5387 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix 5388 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers 5389 else curTransform = parseFloat(matrix[4]); 5390 } 5391 5392 if (axis === 'y') { 5393 // Latest Chrome and webkits Fix 5394 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix 5395 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers 5396 else curTransform = parseFloat(matrix[5]); 5397 } 5398 5399 return curTransform || 0; 5400} 5401 5402function utils_isObject(o) { 5403 return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; 5404} 5405 5406function isNode(node) { 5407 // eslint-disable-next-line 5408 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { 5409 return node instanceof HTMLElement; 5410 } 5411 5412 return node && (node.nodeType === 1 || node.nodeType === 11); 5413} 5414 5415function utils_extend(...args) { 5416 const to = Object(args[0]); 5417 const noExtend = ['__proto__', 'constructor', 'prototype']; 5418 5419 for (let i = 1; i < args.length; i += 1) { 5420 const nextSource = args[i]; 5421 5422 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 5423 const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0); 5424 5425 for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 5426 const nextKey = keysArray[nextIndex]; 5427 const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 5428 5429 if (desc !== undefined && desc.enumerable) { 5430 if (utils_isObject(to[nextKey]) && utils_isObject(nextSource[nextKey])) { 5431 if (nextSource[nextKey].__swiper__) { 5432 to[nextKey] = nextSource[nextKey]; 5433 } else { 5434 utils_extend(to[nextKey], nextSource[nextKey]); 5435 } 5436 } else if (!utils_isObject(to[nextKey]) && utils_isObject(nextSource[nextKey])) { 5437 to[nextKey] = {}; 5438 5439 if (nextSource[nextKey].__swiper__) { 5440 to[nextKey] = nextSource[nextKey]; 5441 } else { 5442 utils_extend(to[nextKey], nextSource[nextKey]); 5443 } 5444 } else { 5445 to[nextKey] = nextSource[nextKey]; 5446 } 5447 } 5448 } 5449 } 5450 } 5451 5452 return to; 5453} 5454 5455function utils_setCSSProperty(el, varName, varValue) { 5456 el.style.setProperty(varName, varValue); 5457} 5458 5459function animateCSSModeScroll({ 5460 swiper, 5461 targetPosition, 5462 side 5463}) { 5464 const window = ssr_window_esm_getWindow(); 5465 const startPosition = -swiper.translate; 5466 let startTime = null; 5467 let time; 5468 const duration = swiper.params.speed; 5469 swiper.wrapperEl.style.scrollSnapType = 'none'; 5470 window.cancelAnimationFrame(swiper.cssModeFrameID); 5471 const dir = targetPosition > startPosition ? 'next' : 'prev'; 5472 5473 const isOutOfBound = (current, target) => { 5474 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 5475 }; 5476 5477 const animate = () => { 5478 time = new Date().getTime(); 5479 5480 if (startTime === null) { 5481 startTime = time; 5482 } 5483 5484 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 5485 const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; 5486 let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 5487 5488 if (isOutOfBound(currentPosition, targetPosition)) { 5489 currentPosition = targetPosition; 5490 } 5491 5492 swiper.wrapperEl.scrollTo({ 5493 [side]: currentPosition 5494 }); 5495 5496 if (isOutOfBound(currentPosition, targetPosition)) { 5497 swiper.wrapperEl.style.overflow = 'hidden'; 5498 swiper.wrapperEl.style.scrollSnapType = ''; 5499 setTimeout(() => { 5500 swiper.wrapperEl.style.overflow = ''; 5501 swiper.wrapperEl.scrollTo({ 5502 [side]: currentPosition 5503 }); 5504 }); 5505 window.cancelAnimationFrame(swiper.cssModeFrameID); 5506 return; 5507 } 5508 5509 swiper.cssModeFrameID = window.requestAnimationFrame(animate); 5510 }; 5511 5512 animate(); 5513} 5514 5515 5516;// CONCATENATED MODULE: ./node_modules/swiper/shared/get-support.js 5517 5518let support; 5519 5520function calcSupport() { 5521 const window = ssr_window_esm_getWindow(); 5522 const document = ssr_window_esm_getDocument(); 5523 return { 5524 smoothScroll: document.documentElement && 'scrollBehavior' in document.documentElement.style, 5525 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch), 5526 passiveListener: function checkPassiveListener() { 5527 let supportsPassive = false; 5528 5529 try { 5530 const opts = Object.defineProperty({}, 'passive', { 5531 // eslint-disable-next-line 5532 get() { 5533 supportsPassive = true; 5534 } 5535 5536 }); 5537 window.addEventListener('testPassiveListener', null, opts); 5538 } catch (e) {// No support 5539 } 5540 5541 return supportsPassive; 5542 }(), 5543 gestures: function checkGestures() { 5544 return 'ongesturestart' in window; 5545 }() 5546 }; 5547} 5548 5549function getSupport() { 5550 if (!support) { 5551 support = calcSupport(); 5552 } 5553 5554 return support; 5555} 5556 5557 5558;// CONCATENATED MODULE: ./node_modules/swiper/shared/get-device.js 5559 5560 5561let deviceCached; 5562 5563function calcDevice({ 5564 userAgent 5565} = {}) { 5566 const support = getSupport(); 5567 const window = ssr_window_esm_getWindow(); 5568 const platform = window.navigator.platform; 5569 const ua = userAgent || window.navigator.userAgent; 5570 const device = { 5571 ios: false, 5572 android: false 5573 }; 5574 const screenWidth = window.screen.width; 5575 const screenHeight = window.screen.height; 5576 const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 5577 5578 let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 5579 const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 5580 const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 5581 const windows = platform === 'Win32'; 5582 let macos = platform === 'MacIntel'; // iPadOs 13 fix 5583 5584 const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; 5585 5586 if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { 5587 ipad = ua.match(/(Version)\/([\d.]+)/); 5588 if (!ipad) ipad = [0, 1, '13_0_0']; 5589 macos = false; 5590 } // Android 5591 5592 5593 if (android && !windows) { 5594 device.os = 'android'; 5595 device.android = true; 5596 } 5597 5598 if (ipad || iphone || ipod) { 5599 device.os = 'ios'; 5600 device.ios = true; 5601 } // Export object 5602 5603 5604 return device; 5605} 5606 5607function getDevice(overrides = {}) { 5608 if (!deviceCached) { 5609 deviceCached = calcDevice(overrides); 5610 } 5611 5612 return deviceCached; 5613} 5614 5615 5616;// CONCATENATED MODULE: ./node_modules/swiper/shared/get-browser.js 5617 5618let browser; 5619 5620function calcBrowser() { 5621 const window = ssr_window_esm_getWindow(); 5622 5623 function isSafari() { 5624 const ua = window.navigator.userAgent.toLowerCase(); 5625 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 5626 } 5627 5628 return { 5629 isSafari: isSafari(), 5630 isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent) 5631 }; 5632} 5633 5634function getBrowser() { 5635 if (!browser) { 5636 browser = calcBrowser(); 5637 } 5638 5639 return browser; 5640} 5641 5642 5643;// CONCATENATED MODULE: ./node_modules/swiper/core/modules/resize/resize.js 5644 5645function Resize({ 5646 swiper, 5647 on, 5648 emit 5649}) { 5650 const window = ssr_window_esm_getWindow(); 5651 let observer = null; 5652 5653 const resizeHandler = () => { 5654 if (!swiper || swiper.destroyed || !swiper.initialized) return; 5655 emit('beforeResize'); 5656 emit('resize'); 5657 }; 5658 5659 const createObserver = () => { 5660 if (!swiper || swiper.destroyed || !swiper.initialized) return; 5661 observer = new ResizeObserver(entries => { 5662 const { 5663 width, 5664 height 5665 } = swiper; 5666 let newWidth = width; 5667 let newHeight = height; 5668 entries.forEach(({ 5669 contentBoxSize, 5670 contentRect, 5671 target 5672 }) => { 5673 if (target && target !== swiper.el) return; 5674 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 5675 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 5676 }); 5677 5678 if (newWidth !== width || newHeight !== height) { 5679 resizeHandler(); 5680 } 5681 }); 5682 observer.observe(swiper.el); 5683 }; 5684 5685 const removeObserver = () => { 5686 if (observer && observer.unobserve && swiper.el) { 5687 observer.unobserve(swiper.el); 5688 observer = null; 5689 } 5690 }; 5691 5692 const orientationChangeHandler = () => { 5693 if (!swiper || swiper.destroyed || !swiper.initialized) return; 5694 emit('orientationchange'); 5695 }; 5696 5697 on('init', () => { 5698 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { 5699 createObserver(); 5700 return; 5701 } 5702 5703 window.addEventListener('resize', resizeHandler); 5704 window.addEventListener('orientationchange', orientationChangeHandler); 5705 }); 5706 on('destroy', () => { 5707 removeObserver(); 5708 window.removeEventListener('resize', resizeHandler); 5709 window.removeEventListener('orientationchange', orientationChangeHandler); 5710 }); 5711} 5712;// CONCATENATED MODULE: ./node_modules/swiper/core/modules/observer/observer.js 5713 5714function Observer({ 5715 swiper, 5716 extendParams, 5717 on, 5718 emit 5719}) { 5720 const observers = []; 5721 const window = ssr_window_esm_getWindow(); 5722 5723 const attach = (target, options = {}) => { 5724 const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; 5725 const observer = new ObserverFunc(mutations => { 5726 // The observerUpdate event should only be triggered 5727 // once despite the number of mutations. Additional 5728 // triggers are redundant and are very costly 5729 if (mutations.length === 1) { 5730 emit('observerUpdate', mutations[0]); 5731 return; 5732 } 5733 5734 const observerUpdate = function observerUpdate() { 5735 emit('observerUpdate', mutations[0]); 5736 }; 5737 5738 if (window.requestAnimationFrame) { 5739 window.requestAnimationFrame(observerUpdate); 5740 } else { 5741 window.setTimeout(observerUpdate, 0); 5742 } 5743 }); 5744 observer.observe(target, { 5745 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 5746 childList: typeof options.childList === 'undefined' ? true : options.childList, 5747 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 5748 }); 5749 observers.push(observer); 5750 }; 5751 5752 const init = () => { 5753 if (!swiper.params.observer) return; 5754 5755 if (swiper.params.observeParents) { 5756 const containerParents = swiper.$el.parents(); 5757 5758 for (let i = 0; i < containerParents.length; i += 1) { 5759 attach(containerParents[i]); 5760 } 5761 } // Observe container 5762 5763 5764 attach(swiper.$el[0], { 5765 childList: swiper.params.observeSlideChildren 5766 }); // Observe wrapper 5767 5768 attach(swiper.$wrapperEl[0], { 5769 attributes: false 5770 }); 5771 }; 5772 5773 const destroy = () => { 5774 observers.forEach(observer => { 5775 observer.disconnect(); 5776 }); 5777 observers.splice(0, observers.length); 5778 }; 5779 5780 extendParams({ 5781 observer: false, 5782 observeParents: false, 5783 observeSlideChildren: false 5784 }); 5785 on('init', init); 5786 on('destroy', destroy); 5787} 5788;// CONCATENATED MODULE: ./node_modules/swiper/core/events-emitter.js 5789/* eslint-disable no-underscore-dangle */ 5790/* harmony default export */ const events_emitter = ({ 5791 on(events, handler, priority) { 5792 const self = this; 5793 if (typeof handler !== 'function') return self; 5794 const method = priority ? 'unshift' : 'push'; 5795 events.split(' ').forEach(event => { 5796 if (!self.eventsListeners[event]) self.eventsListeners[event] = []; 5797 self.eventsListeners[event][method](handler); 5798 }); 5799 return self; 5800 }, 5801 5802 once(events, handler, priority) { 5803 const self = this; 5804 if (typeof handler !== 'function') return self; 5805 5806 function onceHandler(...args) { 5807 self.off(events, onceHandler); 5808 5809 if (onceHandler.__emitterProxy) { 5810 delete onceHandler.__emitterProxy; 5811 } 5812 5813 handler.apply(self, args); 5814 } 5815 5816 onceHandler.__emitterProxy = handler; 5817 return self.on(events, onceHandler, priority); 5818 }, 5819 5820 onAny(handler, priority) { 5821 const self = this; 5822 if (typeof handler !== 'function') return self; 5823 const method = priority ? 'unshift' : 'push'; 5824 5825 if (self.eventsAnyListeners.indexOf(handler) < 0) { 5826 self.eventsAnyListeners[method](handler); 5827 } 5828 5829 return self; 5830 }, 5831 5832 offAny(handler) { 5833 const self = this; 5834 if (!self.eventsAnyListeners) return self; 5835 const index = self.eventsAnyListeners.indexOf(handler); 5836 5837 if (index >= 0) { 5838 self.eventsAnyListeners.splice(index, 1); 5839 } 5840 5841 return self; 5842 }, 5843 5844 off(events, handler) { 5845 const self = this; 5846 if (!self.eventsListeners) return self; 5847 events.split(' ').forEach(event => { 5848 if (typeof handler === 'undefined') { 5849 self.eventsListeners[event] = []; 5850 } else if (self.eventsListeners[event]) { 5851 self.eventsListeners[event].forEach((eventHandler, index) => { 5852 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { 5853 self.eventsListeners[event].splice(index, 1); 5854 } 5855 }); 5856 } 5857 }); 5858 return self; 5859 }, 5860 5861 emit(...args) { 5862 const self = this; 5863 if (!self.eventsListeners) return self; 5864 let events; 5865 let data; 5866 let context; 5867 5868 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 5869 events = args[0]; 5870 data = args.slice(1, args.length); 5871 context = self; 5872 } else { 5873 events = args[0].events; 5874 data = args[0].data; 5875 context = args[0].context || self; 5876 } 5877 5878 data.unshift(context); 5879 const eventsArray = Array.isArray(events) ? events : events.split(' '); 5880 eventsArray.forEach(event => { 5881 if (self.eventsAnyListeners && self.eventsAnyListeners.length) { 5882 self.eventsAnyListeners.forEach(eventHandler => { 5883 eventHandler.apply(context, [event, ...data]); 5884 }); 5885 } 5886 5887 if (self.eventsListeners && self.eventsListeners[event]) { 5888 self.eventsListeners[event].forEach(eventHandler => { 5889 eventHandler.apply(context, data); 5890 }); 5891 } 5892 }); 5893 return self; 5894 } 5895 5896}); 5897;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateSize.js 5898function updateSize() { 5899 const swiper = this; 5900 let width; 5901 let height; 5902 const $el = swiper.$el; 5903 5904 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { 5905 width = swiper.params.width; 5906 } else { 5907 width = $el[0].clientWidth; 5908 } 5909 5910 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { 5911 height = swiper.params.height; 5912 } else { 5913 height = $el[0].clientHeight; 5914 } 5915 5916 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { 5917 return; 5918 } // Subtract paddings 5919 5920 5921 width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10); 5922 height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10); 5923 if (Number.isNaN(width)) width = 0; 5924 if (Number.isNaN(height)) height = 0; 5925 Object.assign(swiper, { 5926 width, 5927 height, 5928 size: swiper.isHorizontal() ? width : height 5929 }); 5930} 5931;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateSlides.js 5932 5933function updateSlides() { 5934 const swiper = this; 5935 5936 function getDirectionLabel(property) { 5937 if (swiper.isHorizontal()) { 5938 return property; 5939 } // prettier-ignore 5940 5941 5942 return { 5943 'width': 'height', 5944 'margin-top': 'margin-left', 5945 'margin-bottom ': 'margin-right', 5946 'margin-left': 'margin-top', 5947 'margin-right': 'margin-bottom', 5948 'padding-left': 'padding-top', 5949 'padding-right': 'padding-bottom', 5950 'marginRight': 'marginBottom' 5951 }[property]; 5952 } 5953 5954 function getDirectionPropertyValue(node, label) { 5955 return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0); 5956 } 5957 5958 const params = swiper.params; 5959 const { 5960 $wrapperEl, 5961 size: swiperSize, 5962 rtlTranslate: rtl, 5963 wrongRTL 5964 } = swiper; 5965 const isVirtual = swiper.virtual && params.virtual.enabled; 5966 const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 5967 const slides = $wrapperEl.children(`.${swiper.params.slideClass}`); 5968 const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 5969 let snapGrid = []; 5970 const slidesGrid = []; 5971 const slidesSizesGrid = []; 5972 let offsetBefore = params.slidesOffsetBefore; 5973 5974 if (typeof offsetBefore === 'function') { 5975 offsetBefore = params.slidesOffsetBefore.call(swiper); 5976 } 5977 5978 let offsetAfter = params.slidesOffsetAfter; 5979 5980 if (typeof offsetAfter === 'function') { 5981 offsetAfter = params.slidesOffsetAfter.call(swiper); 5982 } 5983 5984 const previousSnapGridLength = swiper.snapGrid.length; 5985 const previousSlidesGridLength = swiper.slidesGrid.length; 5986 let spaceBetween = params.spaceBetween; 5987 let slidePosition = -offsetBefore; 5988 let prevSlideSize = 0; 5989 let index = 0; 5990 5991 if (typeof swiperSize === 'undefined') { 5992 return; 5993 } 5994 5995 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 5996 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 5997 } 5998 5999 swiper.virtualSize = -spaceBetween; // reset margins 6000 6001 if (rtl) slides.css({ 6002 marginLeft: '', 6003 marginBottom: '', 6004 marginTop: '' 6005 });else slides.css({ 6006 marginRight: '', 6007 marginBottom: '', 6008 marginTop: '' 6009 }); // reset cssMode offsets 6010 6011 if (params.centeredSlides && params.cssMode) { 6012 utils_setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', ''); 6013 utils_
vendor: 6,724 bytes, lines 6013-6216
6013setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', ''); 6014 } 6015 6016 const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 6017 6018 if (gridEnabled) { 6019 swiper.grid.initSlides(slidesLength); 6020 } // Calc slides 6021 6022 6023 let slideSize; 6024 const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => { 6025 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 6026 }).length > 0; 6027 6028 for (let i = 0; i < slidesLength; i += 1) { 6029 slideSize = 0; 6030 const slide = slides.eq(i); 6031 6032 if (gridEnabled) { 6033 swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel); 6034 } 6035 6036 if (slide.css('display') === 'none') continue; // eslint-disable-line 6037 6038 if (params.slidesPerView === 'auto') { 6039 if (shouldResetSlideSize) { 6040 slides[i].style[getDirectionLabel('width')] = ``; 6041 } 6042 6043 const slideStyles = getComputedStyle(slide[0]); 6044 const currentTransform = slide[0].style.transform; 6045 const currentWebKitTransform = slide[0].style.webkitTransform; 6046 6047 if (currentTransform) { 6048 slide[0].style.transform = 'none'; 6049 } 6050 6051 if (currentWebKitTransform) { 6052 slide[0].style.webkitTransform = 'none'; 6053 } 6054 6055 if (params.roundLengths) { 6056 slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true); 6057 } else { 6058 // eslint-disable-next-line 6059 const width = getDirectionPropertyValue(slideStyles, 'width'); 6060 const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 6061 const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 6062 const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 6063 const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 6064 const boxSizing = slideStyles.getPropertyValue('box-sizing'); 6065 6066 if (boxSizing && boxSizing === 'border-box') { 6067 slideSize = width + marginLeft + marginRight; 6068 } else { 6069 const { 6070 clientWidth, 6071 offsetWidth 6072 } = slide[0]; 6073 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 6074 } 6075 } 6076 6077 if (currentTransform) { 6078 slide[0].style.transform = currentTransform; 6079 } 6080 6081 if (currentWebKitTransform) { 6082 slide[0].style.webkitTransform = currentWebKitTransform; 6083 } 6084 6085 if (params.roundLengths) slideSize = Math.floor(slideSize); 6086 } else { 6087 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 6088 if (params.roundLengths) slideSize = Math.floor(slideSize); 6089 6090 if (slides[i]) { 6091 slides[i].style[getDirectionLabel('width')] = `${slideSize}px`; 6092 } 6093 } 6094 6095 if (slides[i]) { 6096 slides[i].swiperSlideSize = slideSize; 6097 } 6098 6099 slidesSizesGrid.push(slideSize); 6100 6101 if (params.centeredSlides) { 6102 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 6103 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 6104 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 6105 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; 6106 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 6107 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 6108 slidesGrid.push(slidePosition); 6109 } else { 6110 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 6111 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 6112 slidesGrid.push(slidePosition); 6113 slidePosition = slidePosition + slideSize + spaceBetween; 6114 } 6115 6116 swiper.virtualSize += slideSize + spaceBetween; 6117 prevSlideSize = slideSize; 6118 index += 1; 6119 } 6120 6121 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 6122 6123 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 6124 $wrapperEl.css({ 6125 width: `${swiper.virtualSize + params.spaceBetween}px` 6126 }); 6127 } 6128 6129 if (params.setWrapperSize) { 6130 $wrapperEl.css({ 6131 [getDirectionLabel('width')]: `${swiper.virtualSize + params.spaceBetween}px` 6132 }); 6133 } 6134 6135 if (gridEnabled) { 6136 swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel); 6137 } // Remove last grid elements depending on width 6138 6139 6140 if (!params.centeredSlides) { 6141 const newSlidesGrid = []; 6142 6143 for (let i = 0; i < snapGrid.length; i += 1) { 6144 let slidesGridItem = snapGrid[i]; 6145 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); 6146 6147 if (snapGrid[i] <= swiper.virtualSize - swiperSize) { 6148 newSlidesGrid.push(slidesGridItem); 6149 } 6150 } 6151 6152 snapGrid = newSlidesGrid; 6153 6154 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 6155 snapGrid.push(swiper.virtualSize - swiperSize); 6156 } 6157 } 6158 6159 if (snapGrid.length === 0) snapGrid = [0]; 6160 6161 if (params.spaceBetween !== 0) { 6162 const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight'); 6163 slides.filter((_, slideIndex) => { 6164 if (!params.cssMode) return true; 6165 6166 if (slideIndex === slides.length - 1) { 6167 return false; 6168 } 6169 6170 return true; 6171 }).css({ 6172 [key]: `${spaceBetween}px` 6173 }); 6174 } 6175 6176 if (params.centeredSlides && params.centeredSlidesBounds) { 6177 let allSlidesSize = 0; 6178 slidesSizesGrid.forEach(slideSizeValue => { 6179 allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); 6180 }); 6181 allSlidesSize -= params.spaceBetween; 6182 const maxSnap = allSlidesSize - swiperSize; 6183 snapGrid = snapGrid.map(snap => { 6184 if (snap < 0) return -offsetBefore; 6185 if (snap > maxSnap) return maxSnap + offsetAfter; 6186 return snap; 6187 }); 6188 } 6189 6190 if (params.centerInsufficientSlides) { 6191 let allSlidesSize = 0; 6192 slidesSizesGrid.forEach(slideSizeValue => { 6193 allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); 6194 }); 6195 allSlidesSize -= params.spaceBetween; 6196 6197 if (allSlidesSize < swiperSize) { 6198 const allSlidesOffset = (swiperSize - allSlidesSize) / 2; 6199 snapGrid.forEach((snap, snapIndex) => { 6200 snapGrid[snapIndex] = snap - allSlidesOffset; 6201 }); 6202 slidesGrid.forEach((snap, snapIndex) => { 6203 slidesGrid[snapIndex] = snap + allSlidesOffset; 6204 }); 6205 } 6206 } 6207 6208 Object.assign(swiper, { 6209 slides, 6210 snapGrid, 6211 slidesGrid, 6212 slidesSizesGrid 6213 }); 6214 6215 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 6216
vendor: 8,964 bytes, lines 6216-6464
6216utils_setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); 6217 utils_setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); 6218 const addToSnapGrid = -swiper.snapGrid[0]; 6219 const addToSlidesGrid = -swiper.slidesGrid[0]; 6220 swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid); 6221 swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid); 6222 } 6223 6224 if (slidesLength !== previousSlidesLength) { 6225 swiper.emit('slidesLengthChange'); 6226 } 6227 6228 if (snapGrid.length !== previousSnapGridLength) { 6229 if (swiper.params.watchOverflow) swiper.checkOverflow(); 6230 swiper.emit('snapGridLengthChange'); 6231 } 6232 6233 if (slidesGrid.length !== previousSlidesGridLength) { 6234 swiper.emit('slidesGridLengthChange'); 6235 } 6236 6237 if (params.watchSlidesProgress) { 6238 swiper.updateSlidesOffset(); 6239 } 6240} 6241;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateAutoHeight.js 6242function updateAutoHeight(speed) { 6243 const swiper = this; 6244 const activeSlides = []; 6245 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 6246 let newHeight = 0; 6247 let i; 6248 6249 if (typeof speed === 'number') { 6250 swiper.setTransition(speed); 6251 } else if (speed === true) { 6252 swiper.setTransition(swiper.params.speed); 6253 } 6254 6255 const getSlideByIndex = index => { 6256 if (isVirtual) { 6257 return swiper.slides.filter(el => parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index)[0]; 6258 } 6259 6260 return swiper.slides.eq(index)[0]; 6261 }; // Find slides currently in view 6262 6263 6264 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 6265 if (swiper.params.centeredSlides) { 6266 swiper.visibleSlides.each(slide => { 6267 activeSlides.push(slide); 6268 }); 6269 } else { 6270 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { 6271 const index = swiper.activeIndex + i; 6272 if (index > swiper.slides.length && !isVirtual) break; 6273 activeSlides.push(getSlideByIndex(index)); 6274 } 6275 } 6276 } else { 6277 activeSlides.push(getSlideByIndex(swiper.activeIndex)); 6278 } // Find new height from highest slide in view 6279 6280 6281 for (i = 0; i < activeSlides.length; i += 1) { 6282 if (typeof activeSlides[i] !== 'undefined') { 6283 const height = activeSlides[i].offsetHeight; 6284 newHeight = height > newHeight ? height : newHeight; 6285 } 6286 } // Update Height 6287 6288 6289 if (newHeight || newHeight === 0) swiper.$wrapperEl.css('height', `${newHeight}px`); 6290} 6291;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateSlidesOffset.js 6292function updateSlidesOffset() { 6293 const swiper = this; 6294 const slides = swiper.slides; 6295 6296 for (let i = 0; i < slides.length; i += 1) { 6297 slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop; 6298 } 6299} 6300;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateSlidesProgress.js 6301 6302function updateSlidesProgress(translate = this && this.translate || 0) { 6303 const swiper = this; 6304 const params = swiper.params; 6305 const { 6306 slides, 6307 rtlTranslate: rtl, 6308 snapGrid 6309 } = swiper; 6310 if (slides.length === 0) return; 6311 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 6312 let offsetCenter = -translate; 6313 if (rtl) offsetCenter = translate; // Visible Slides 6314 6315 slides.removeClass(params.slideVisibleClass); 6316 swiper.visibleSlidesIndexes = []; 6317 swiper.visibleSlides = []; 6318 6319 for (let i = 0; i < slides.length; i += 1) { 6320 const slide = slides[i]; 6321 let slideOffset = slide.swiperSlideOffset; 6322 6323 if (params.cssMode && params.centeredSlides) { 6324 slideOffset -= slides[0].swiperSlideOffset; 6325 } 6326 6327 const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween); 6328 const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween); 6329 const slideBefore = -(offsetCenter - slideOffset); 6330 const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 6331 const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 6332 6333 if (isVisible) { 6334 swiper.visibleSlides.push(slide); 6335 swiper.visibleSlidesIndexes.push(i); 6336 slides.eq(i).addClass(params.slideVisibleClass); 6337 } 6338 6339 slide.progress = rtl ? -slideProgress : slideProgress; 6340 slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 6341 } 6342 6343 swiper.visibleSlides = dom(swiper.visibleSlides); 6344} 6345;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateProgress.js 6346function updateProgress(translate) { 6347 const swiper = this; 6348 6349 if (typeof translate === 'undefined') { 6350 const multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line 6351 6352 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 6353 } 6354 6355 const params = swiper.params; 6356 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 6357 let { 6358 progress, 6359 isBeginning, 6360 isEnd 6361 } = swiper; 6362 const wasBeginning = isBeginning; 6363 const wasEnd = isEnd; 6364 6365 if (translatesDiff === 0) { 6366 progress = 0; 6367 isBeginning = true; 6368 isEnd = true; 6369 } else { 6370 progress = (translate - swiper.minTranslate()) / translatesDiff; 6371 isBeginning = progress <= 0; 6372 isEnd = progress >= 1; 6373 } 6374 6375 Object.assign(swiper, { 6376 progress, 6377 isBeginning, 6378 isEnd 6379 }); 6380 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 6381 6382 if (isBeginning && !wasBeginning) { 6383 swiper.emit('reachBeginning toEdge'); 6384 } 6385 6386 if (isEnd && !wasEnd) { 6387 swiper.emit('reachEnd toEdge'); 6388 } 6389 6390 if (wasBeginning && !isBeginning || wasEnd && !isEnd) { 6391 swiper.emit('fromEdge'); 6392 } 6393 6394 swiper.emit('progress', progress); 6395} 6396;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateSlidesClasses.js 6397function updateSlidesClasses() { 6398 const swiper = this; 6399 const { 6400 slides, 6401 params, 6402 $wrapperEl, 6403 activeIndex, 6404 realIndex 6405 } = swiper; 6406 const isVirtual = swiper.virtual && params.virtual.enabled; 6407 slides.removeClass(`${params.slideActiveClass} ${params.slideNextClass} ${params.slidePrevClass} ${params.slideDuplicateActiveClass} ${params.slideDuplicateNextClass} ${params.slideDuplicatePrevClass}`); 6408 let activeSlide; 6409 6410 if (isVirtual) { 6411 activeSlide = swiper.$wrapperEl.find(`.${params.slideClass}[data-swiper-slide-index="${activeIndex}"]`); 6412 } else { 6413 activeSlide = slides.eq(activeIndex); 6414 } // Active classes 6415 6416 6417 activeSlide.addClass(params.slideActiveClass); 6418 6419 if (params.loop) { 6420 // Duplicate to all looped slides 6421 if (activeSlide.hasClass(params.slideDuplicateClass)) { 6422 $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); 6423 } else { 6424 $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); 6425 } 6426 } // Next Slide 6427 6428 6429 let nextSlide = activeSlide.nextAll(`.${params.slideClass}`).eq(0).addClass(params.slideNextClass); 6430 6431 if (params.loop && nextSlide.length === 0) { 6432 nextSlide = slides.eq(0); 6433 nextSlide.addClass(params.slideNextClass); 6434 } // Prev Slide 6435 6436 6437 let prevSlide = activeSlide.prevAll(`.${params.slideClass}`).eq(0).addClass(params.slidePrevClass); 6438 6439 if (params.loop && prevSlide.length === 0) { 6440 prevSlide = slides.eq(-1); 6441 prevSlide.addClass(params.slidePrevClass); 6442 } 6443 6444 if (params.loop) { 6445 // Duplicate to all looped slides 6446 if (nextSlide.hasClass(params.slideDuplicateClass)) { 6447 $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); 6448 } else { 6449 $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); 6450 } 6451 6452 if (prevSlide.hasClass(params.slideDuplicateClass)) { 6453 $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); 6454 } else { 6455 $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); 6456 } 6457 } 6458 6459 swiper.emitSlidesClasses(); 6460} 6461;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateActiveIndex.js 6462function updateActiveIndex(newActiveIndex) { 6463 const swiper = this; 6464 const translate = swiper.rtlTranslate ? swiper.translate : -swi
vendor: 76,186 bytes, lines 6464-9127
6464per.translate; 6465 const { 6466 slidesGrid, 6467 snapGrid, 6468 params, 6469 activeIndex: previousIndex, 6470 realIndex: previousRealIndex, 6471 snapIndex: previousSnapIndex 6472 } = swiper; 6473 let activeIndex = newActiveIndex; 6474 let snapIndex; 6475 6476 if (typeof activeIndex === 'undefined') { 6477 for (let i = 0; i < slidesGrid.length; i += 1) { 6478 if (typeof slidesGrid[i + 1] !== 'undefined') { 6479 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { 6480 activeIndex = i; 6481 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { 6482 activeIndex = i + 1; 6483 } 6484 } else if (translate >= slidesGrid[i]) { 6485 activeIndex = i; 6486 } 6487 } // Normalize slideIndex 6488 6489 6490 if (params.normalizeSlideIndex) { 6491 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 6492 } 6493 } 6494 6495 if (snapGrid.indexOf(translate) >= 0) { 6496 snapIndex = snapGrid.indexOf(translate); 6497 } else { 6498 const skip = Math.min(params.slidesPerGroupSkip, activeIndex); 6499 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 6500 } 6501 6502 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 6503 6504 if (activeIndex === previousIndex) { 6505 if (snapIndex !== previousSnapIndex) { 6506 swiper.snapIndex = snapIndex; 6507 swiper.emit('snapIndexChange'); 6508 } 6509 6510 return; 6511 } // Get real index 6512 6513 6514 const realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10); 6515 Object.assign(swiper, { 6516 snapIndex, 6517 realIndex, 6518 previousIndex, 6519 activeIndex 6520 }); 6521 swiper.emit('activeIndexChange'); 6522 swiper.emit('snapIndexChange'); 6523 6524 if (previousRealIndex !== realIndex) { 6525 swiper.emit('realIndexChange'); 6526 } 6527 6528 if (swiper.initialized || swiper.params.runCallbacksOnInit) { 6529 swiper.emit('slideChange'); 6530 } 6531} 6532;// CONCATENATED MODULE: ./node_modules/swiper/core/update/updateClickedSlide.js 6533 6534function updateClickedSlide(e) { 6535 const swiper = this; 6536 const params = swiper.params; 6537 const slide = dom(e).closest(`.${params.slideClass}`)[0]; 6538 let slideFound = false; 6539 let slideIndex; 6540 6541 if (slide) { 6542 for (let i = 0; i < swiper.slides.length; i += 1) { 6543 if (swiper.slides[i] === slide) { 6544 slideFound = true; 6545 slideIndex = i; 6546 break; 6547 } 6548 } 6549 } 6550 6551 if (slide && slideFound) { 6552 swiper.clickedSlide = slide; 6553 6554 if (swiper.virtual && swiper.params.virtual.enabled) { 6555 swiper.clickedIndex = parseInt(dom(slide).attr('data-swiper-slide-index'), 10); 6556 } else { 6557 swiper.clickedIndex = slideIndex; 6558 } 6559 } else { 6560 swiper.clickedSlide = undefined; 6561 swiper.clickedIndex = undefined; 6562 return; 6563 } 6564 6565 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 6566 swiper.slideToClickedSlide(); 6567 } 6568} 6569;// CONCATENATED MODULE: ./node_modules/swiper/core/update/index.js 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579/* harmony default export */ const update = ({ 6580 updateSize: updateSize, 6581 updateSlides: updateSlides, 6582 updateAutoHeight: updateAutoHeight, 6583 updateSlidesOffset: updateSlidesOffset, 6584 updateSlidesProgress: updateSlidesProgress, 6585 updateProgress: updateProgress, 6586 updateSlidesClasses: updateSlidesClasses, 6587 updateActiveIndex: updateActiveIndex, 6588 updateClickedSlide: updateClickedSlide 6589}); 6590;// CONCATENATED MODULE: ./node_modules/swiper/core/translate/getTranslate.js 6591 6592function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y') { 6593 const swiper = this; 6594 const { 6595 params, 6596 rtlTranslate: rtl, 6597 translate, 6598 $wrapperEl 6599 } = swiper; 6600 6601 if (params.virtualTranslate) { 6602 return rtl ? -translate : translate; 6603 } 6604 6605 if (params.cssMode) { 6606 return translate; 6607 } 6608 6609 let currentTranslate = utils_getTranslate($wrapperEl[0], axis); 6610 if (rtl) currentTranslate = -currentTranslate; 6611 return currentTranslate || 0; 6612} 6613;// CONCATENATED MODULE: ./node_modules/swiper/core/translate/setTranslate.js 6614function setTranslate(translate, byController) { 6615 const swiper = this; 6616 const { 6617 rtlTranslate: rtl, 6618 params, 6619 $wrapperEl, 6620 wrapperEl, 6621 progress 6622 } = swiper; 6623 let x = 0; 6624 let y = 0; 6625 const z = 0; 6626 6627 if (swiper.isHorizontal()) { 6628 x = rtl ? -translate : translate; 6629 } else { 6630 y = translate; 6631 } 6632 6633 if (params.roundLengths) { 6634 x = Math.floor(x); 6635 y = Math.floor(y); 6636 } 6637 6638 if (params.cssMode) { 6639 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 6640 } else if (!params.virtualTranslate) { 6641 $wrapperEl.transform(`translate3d(${x}px, ${y}px, ${z}px)`); 6642 } 6643 6644 swiper.previousTranslate = swiper.translate; 6645 swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress 6646 6647 let newProgress; 6648 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 6649 6650 if (translatesDiff === 0) { 6651 newProgress = 0; 6652 } else { 6653 newProgress = (translate - swiper.minTranslate()) / translatesDiff; 6654 } 6655 6656 if (newProgress !== progress) { 6657 swiper.updateProgress(translate); 6658 } 6659 6660 swiper.emit('setTranslate', swiper.translate, byController); 6661} 6662;// CONCATENATED MODULE: ./node_modules/swiper/core/translate/minTranslate.js 6663function minTranslate() { 6664 return -this.snapGrid[0]; 6665} 6666;// CONCATENATED MODULE: ./node_modules/swiper/core/translate/maxTranslate.js 6667function maxTranslate() { 6668 return -this.snapGrid[this.snapGrid.length - 1]; 6669} 6670;// CONCATENATED MODULE: ./node_modules/swiper/core/translate/translateTo.js 6671 6672function translateTo(translate = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) { 6673 const swiper = this; 6674 const { 6675 params, 6676 wrapperEl 6677 } = swiper; 6678 6679 if (swiper.animating && params.preventInteractionOnTransition) { 6680 return false; 6681 } 6682 6683 const minTranslate = swiper.minTranslate(); 6684 const maxTranslate = swiper.maxTranslate(); 6685 let newTranslate; 6686 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress 6687 6688 swiper.updateProgress(newTranslate); 6689 6690 if (params.cssMode) { 6691 const isH = swiper.isHorizontal(); 6692 6693 if (speed === 0) { 6694 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 6695 } else { 6696 if (!swiper.support.smoothScroll) { 6697 animateCSSModeScroll({ 6698 swiper, 6699 targetPosition: -newTranslate, 6700 side: isH ? 'left' : 'top' 6701 }); 6702 return true; 6703 } 6704 6705 wrapperEl.scrollTo({ 6706 [isH ? 'left' : 'top']: -newTranslate, 6707 behavior: 'smooth' 6708 }); 6709 } 6710 6711 return true; 6712 } 6713 6714 if (speed === 0) { 6715 swiper.setTransition(0); 6716 swiper.setTranslate(newTranslate); 6717 6718 if (runCallbacks) { 6719 swiper.emit('beforeTransitionStart', speed, internal); 6720 swiper.emit('transitionEnd'); 6721 } 6722 } else { 6723 swiper.setTransition(speed); 6724 swiper.setTranslate(newTranslate); 6725 6726 if (runCallbacks) { 6727 swiper.emit('beforeTransitionStart', speed, internal); 6728 swiper.emit('transitionStart'); 6729 } 6730 6731 if (!swiper.animating) { 6732 swiper.animating = true; 6733 6734 if (!swiper.onTranslateToWrapperTransitionEnd) { 6735 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 6736 if (!swiper || swiper.destroyed) return; 6737 if (e.target !== this) return; 6738 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 6739 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); 6740 swiper.onTranslateToWrapperTransitionEnd = null; 6741 delete swiper.onTranslateToWrapperTransitionEnd; 6742 6743 if (runCallbacks) { 6744 swiper.emit('transitionEnd'); 6745 } 6746 }; 6747 } 6748 6749 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 6750 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); 6751 } 6752 } 6753 6754 return true; 6755} 6756;// CONCATENATED MODULE: ./node_modules/swiper/core/translate/index.js 6757 6758 6759 6760 6761 6762/* harmony default export */ const translate = ({ 6763 getTranslate: getSwiperTranslate, 6764 setTranslate: setTranslate, 6765 minTranslate: minTranslate, 6766 maxTranslate: maxTranslate, 6767 translateTo: translateTo 6768}); 6769;// CONCATENATED MODULE: ./node_modules/swiper/core/transition/setTransition.js 6770function setTransition(duration, byController) { 6771 const swiper = this; 6772 6773 if (!swiper.params.cssMode) { 6774 swiper.$wrapperEl.transition(duration); 6775 } 6776 6777 swiper.emit('setTransition', duration, byController); 6778} 6779;// CONCATENATED MODULE: ./node_modules/swiper/core/transition/transitionEmit.js 6780function transitionEmit({ 6781 swiper, 6782 runCallbacks, 6783 direction, 6784 step 6785}) { 6786 const { 6787 activeIndex, 6788 previousIndex 6789 } = swiper; 6790 let dir = direction; 6791 6792 if (!dir) { 6793 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; 6794 } 6795 6796 swiper.emit(`transition${step}`); 6797 6798 if (runCallbacks && activeIndex !== previousIndex) { 6799 if (dir === 'reset') { 6800 swiper.emit(`slideResetTransition${step}`); 6801 return; 6802 } 6803 6804 swiper.emit(`slideChangeTransition${step}`); 6805 6806 if (dir === 'next') { 6807 swiper.emit(`slideNextTransition${step}`); 6808 } else { 6809 swiper.emit(`slidePrevTransition${step}`); 6810 } 6811 } 6812} 6813;// CONCATENATED MODULE: ./node_modules/swiper/core/transition/transitionStart.js 6814 6815function transitionStart(runCallbacks = true, direction) { 6816 const swiper = this; 6817 const { 6818 params 6819 } = swiper; 6820 if (params.cssMode) return; 6821 6822 if (params.autoHeight) { 6823 swiper.updateAutoHeight(); 6824 } 6825 6826 transitionEmit({ 6827 swiper, 6828 runCallbacks, 6829 direction, 6830 step: 'Start' 6831 }); 6832} 6833;// CONCATENATED MODULE: ./node_modules/swiper/core/transition/transitionEnd.js 6834 6835function transitionEnd_transitionEnd(runCallbacks = true, direction) { 6836 const swiper = this; 6837 const { 6838 params 6839 } = swiper; 6840 swiper.animating = false; 6841 if (params.cssMode) return; 6842 swiper.setTransition(0); 6843 transitionEmit({ 6844 swiper, 6845 runCallbacks, 6846 direction, 6847 step: 'End' 6848 }); 6849} 6850;// CONCATENATED MODULE: ./node_modules/swiper/core/transition/index.js 6851 6852 6853 6854/* harmony default export */ const core_transition = ({ 6855 setTransition: setTransition, 6856 transitionStart: transitionStart, 6857 transitionEnd: transitionEnd_transitionEnd 6858}); 6859;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/slideTo.js 6860 6861function slideTo(index = 0, speed = this.params.speed, runCallbacks = true, internal, initial) { 6862 if (typeof index !== 'number' && typeof index !== 'string') { 6863 throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof index}] given.`); 6864 } 6865 6866 if (typeof index === 'string') { 6867 /** 6868 * The `index` argument converted from `string` to `number`. 6869 * @type {number} 6870 */ 6871 const indexAsNumber = parseInt(index, 10); 6872 /** 6873 * Determines whether the `index` argument is a valid `number` 6874 * after being converted from the `string` type. 6875 * @type {boolean} 6876 */ 6877 6878 const isValidNumber = isFinite(indexAsNumber); 6879 6880 if (!isValidNumber) { 6881 throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`); 6882 } // Knowing that the converted `index` is a valid number, 6883 // we can update the original argument's value. 6884 6885 6886 index = indexAsNumber; 6887 } 6888 6889 const swiper = this; 6890 let slideIndex = index; 6891 if (slideIndex < 0) slideIndex = 0; 6892 const { 6893 params, 6894 snapGrid, 6895 slidesGrid, 6896 previousIndex, 6897 activeIndex, 6898 rtlTranslate: rtl, 6899 wrapperEl, 6900 enabled 6901 } = swiper; 6902 6903 if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) { 6904 return false; 6905 } 6906 6907 const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 6908 let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 6909 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 6910 6911 if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) { 6912 swiper.emit('beforeSlideChangeStart'); 6913 } 6914 6915 const translate = -snapGrid[snapIndex]; // Update progress 6916 6917 swiper.updateProgress(translate); // Normalize slideIndex 6918 6919 if (params.normalizeSlideIndex) { 6920 for (let i = 0; i < slidesGrid.length; i += 1) { 6921 const normalizedTranslate = -Math.floor(translate * 100); 6922 const normalizedGrid = Math.floor(slidesGrid[i] * 100); 6923 const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); 6924 6925 if (typeof slidesGrid[i + 1] !== 'undefined') { 6926 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { 6927 slideIndex = i; 6928 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { 6929 slideIndex = i + 1; 6930 } 6931 } else if (normalizedTranslate >= normalizedGrid) { 6932 slideIndex = i; 6933 } 6934 } 6935 } // Directions locks 6936 6937 6938 if (swiper.initialized && slideIndex !== activeIndex) { 6939 if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) { 6940 return false; 6941 } 6942 6943 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 6944 if ((activeIndex || 0) !== slideIndex) return false; 6945 } 6946 } 6947 6948 let direction; 6949 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index 6950 6951 if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) { 6952 swiper.updateActiveIndex(slideIndex); // Update Height 6953 6954 if (params.autoHeight) { 6955 swiper.updateAutoHeight(); 6956 } 6957 6958 swiper.updateSlidesClasses(); 6959 6960 if (params.effect !== 'slide') { 6961 swiper.setTranslate(translate); 6962 } 6963 6964 if (direction !== 'reset') { 6965 swiper.transitionStart(runCallbacks, direction); 6966 swiper.transitionEnd(runCallbacks, direction); 6967 } 6968 6969 return false; 6970 } 6971 6972 if (params.cssMode) { 6973 const isH = swiper.isHorizontal(); 6974 const t = rtl ? translate : -translate; 6975 6976 if (speed === 0) { 6977 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 6978 6979 if (isVirtual) { 6980 swiper.wrapperEl.style.scrollSnapType = 'none'; 6981 swiper._immediateVirtual = true; 6982 } 6983 6984 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 6985 6986 if (isVirtual) { 6987 requestAnimationFrame(() => { 6988 swiper.wrapperEl.style.scrollSnapType = ''; 6989 swiper._swiperImmediateVirtual = false; 6990 }); 6991 } 6992 } else { 6993 if (!swiper.support.smoothScroll) { 6994 animateCSSModeScroll({ 6995 swiper, 6996 targetPosition: t, 6997 side: isH ? 'left' : 'top' 6998 }); 6999 return true; 7000 } 7001 7002 wrapperEl.scrollTo({ 7003 [isH ? 'left' : 'top']: t, 7004 behavior: 'smooth' 7005 }); 7006 } 7007 7008 return true; 7009 } 7010 7011 swiper.setTransition(speed); 7012 swiper.setTranslate(translate); 7013 swiper.updateActiveIndex(slideIndex); 7014 swiper.updateSlidesClasses(); 7015 swiper.emit('beforeTransitionStart', speed, internal); 7016 swiper.transitionStart(runCallbacks, direction); 7017 7018 if (speed === 0) { 7019 swiper.transitionEnd(runCallbacks, direction); 7020 } else if (!swiper.animating) { 7021 swiper.animating = true; 7022 7023 if (!swiper.onSlideToWrapperTransitionEnd) { 7024 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 7025 if (!swiper || swiper.destroyed) return; 7026 if (e.target !== this) return; 7027 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 7028 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); 7029 swiper.onSlideToWrapperTransitionEnd = null; 7030 delete swiper.onSlideToWrapperTransitionEnd; 7031 swiper.transitionEnd(runCallbacks, direction); 7032 }; 7033 } 7034 7035 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 7036 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); 7037 } 7038 7039 return true; 7040} 7041;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/slideToLoop.js 7042function slideToLoop(index = 0, speed = this.params.speed, runCallbacks = true, internal) { 7043 const swiper = this; 7044 let newIndex = index; 7045 7046 if (swiper.params.loop) { 7047 newIndex += swiper.loopedSlides; 7048 } 7049 7050 return swiper.slideTo(newIndex, speed, runCallbacks, internal); 7051} 7052;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/slideNext.js 7053/* eslint no-unused-vars: "off" */ 7054function slideNext(speed = this.params.speed, runCallbacks = true, internal) { 7055 const swiper = this; 7056 const { 7057 animating, 7058 enabled, 7059 params 7060 } = swiper; 7061 if (!enabled) return swiper; 7062 let perGroup = params.slidesPerGroup; 7063 7064 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 7065 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 7066 } 7067 7068 const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 7069 7070 if (params.loop) { 7071 if (animating && params.loopPreventsSlide) return false; 7072 swiper.loopFix(); // eslint-disable-next-line 7073 7074 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 7075 } 7076 7077 if (params.rewind && swiper.isEnd) { 7078 return swiper.slideTo(0, speed, runCallbacks, internal); 7079 } 7080 7081 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 7082} 7083;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/slidePrev.js 7084/* eslint no-unused-vars: "off" */ 7085function slidePrev(speed = this.params.speed, runCallbacks = true, internal) { 7086 const swiper = this; 7087 const { 7088 params, 7089 animating, 7090 snapGrid, 7091 slidesGrid, 7092 rtlTranslate, 7093 enabled 7094 } = swiper; 7095 if (!enabled) return swiper; 7096 7097 if (params.loop) { 7098 if (animating && params.loopPreventsSlide) return false; 7099 swiper.loopFix(); // eslint-disable-next-line 7100 7101 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 7102 } 7103 7104 const translate = rtlTranslate ? swiper.translate : -swiper.translate; 7105 7106 function normalize(val) { 7107 if (val < 0) return -Math.floor(Math.abs(val)); 7108 return Math.floor(val); 7109 } 7110 7111 const normalizedTranslate = normalize(translate); 7112 const normalizedSnapGrid = snapGrid.map(val => normalize(val)); 7113 let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 7114 7115 if (typeof prevSnap === 'undefined' && params.cssMode) { 7116 let prevSnapIndex; 7117 snapGrid.forEach((snap, snapIndex) => { 7118 if (normalizedTranslate >= snap) { 7119 // prevSnap = snap; 7120 prevSnapIndex = snapIndex; 7121 } 7122 }); 7123 7124 if (typeof prevSnapIndex !== 'undefined') { 7125 prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 7126 } 7127 } 7128 7129 let prevIndex = 0; 7130 7131 if (typeof prevSnap !== 'undefined') { 7132 prevIndex = slidesGrid.indexOf(prevSnap); 7133 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 7134 7135 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 7136 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 7137 prevIndex = Math.max(prevIndex, 0); 7138 } 7139 } 7140 7141 if (params.rewind && swiper.isBeginning) { 7142 return swiper.slideTo(swiper.slides.length - 1, speed, runCallbacks, internal); 7143 } 7144 7145 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 7146} 7147;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/slideReset.js 7148/* eslint no-unused-vars: "off" */ 7149function slideReset(speed = this.params.speed, runCallbacks = true, internal) { 7150 const swiper = this; 7151 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 7152} 7153;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/slideToClosest.js 7154/* eslint no-unused-vars: "off" */ 7155function slideToClosest(speed = this.params.speed, runCallbacks = true, internal, threshold = 0.5) { 7156 const swiper = this; 7157 let index = swiper.activeIndex; 7158 const skip = Math.min(swiper.params.slidesPerGroupSkip, index); 7159 const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); 7160 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 7161 7162 if (translate >= swiper.snapGrid[snapIndex]) { 7163 // The current translate is on or after the current snap index, so the choice 7164 // is between the current index and the one after it. 7165 const currentSnap = swiper.snapGrid[snapIndex]; 7166 const nextSnap = swiper.snapGrid[snapIndex + 1]; 7167 7168 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { 7169 index += swiper.params.slidesPerGroup; 7170 } 7171 } else { 7172 // The current translate is before the current snap index, so the choice 7173 // is between the current index and the one before it. 7174 const prevSnap = swiper.snapGrid[snapIndex - 1]; 7175 const currentSnap = swiper.snapGrid[snapIndex]; 7176 7177 if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) { 7178 index -= swiper.params.slidesPerGroup; 7179 } 7180 } 7181 7182 index = Math.max(index, 0); 7183 index = Math.min(index, swiper.slidesGrid.length - 1); 7184 return swiper.slideTo(index, speed, runCallbacks, internal); 7185} 7186;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/slideToClickedSlide.js 7187 7188 7189function slideToClickedSlide() { 7190 const swiper = this; 7191 const { 7192 params, 7193 $wrapperEl 7194 } = swiper; 7195 const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 7196 let slideToIndex = swiper.clickedIndex; 7197 let realIndex; 7198 7199 if (params.loop) { 7200 if (swiper.animating) return; 7201 realIndex = parseInt(dom(swiper.clickedSlide).attr('data-swiper-slide-index'), 10); 7202 7203 if (params.centeredSlides) { 7204 if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) { 7205 swiper.loopFix(); 7206 slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); 7207 utils_nextTick(() => { 7208 swiper.slideTo(slideToIndex); 7209 }); 7210 } else { 7211 swiper.slideTo(slideToIndex); 7212 } 7213 } else if (slideToIndex > swiper.slides.length - slidesPerView) { 7214 swiper.loopFix(); 7215 slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); 7216 utils_nextTick(() => { 7217 swiper.slideTo(slideToIndex); 7218 }); 7219 } else { 7220 swiper.slideTo(slideToIndex); 7221 } 7222 } else { 7223 swiper.slideTo(slideToIndex); 7224 } 7225} 7226;// CONCATENATED MODULE: ./node_modules/swiper/core/slide/index.js 7227 7228 7229 7230 7231 7232 7233 7234/* harmony default export */ const slide = ({ 7235 slideTo: slideTo, 7236 slideToLoop: slideToLoop, 7237 slideNext: slideNext, 7238 slidePrev: slidePrev, 7239 slideReset: slideReset, 7240 slideToClosest: slideToClosest, 7241 slideToClickedSlide: slideToClickedSlide 7242}); 7243;// CONCATENATED MODULE: ./node_modules/swiper/core/loop/loopCreate.js 7244 7245 7246function loopCreate() { 7247 const swiper = this; 7248 const document = ssr_window_esm_getDocument(); 7249 const { 7250 params, 7251 $wrapperEl 7252 } = swiper; // Remove duplicated slides 7253 7254 const $selector = $wrapperEl.children().length > 0 ? dom($wrapperEl.children()[0].parentNode) : $wrapperEl; 7255 $selector.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove(); 7256 let slides = $selector.children(`.${params.slideClass}`); 7257 7258 if (params.loopFillGroupWithBlank) { 7259 const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup; 7260 7261 if (blankSlidesNum !== params.slidesPerGroup) { 7262 for (let i = 0; i < blankSlidesNum; i += 1) { 7263 const blankNode = dom(document.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`); 7264 $selector.append(blankNode); 7265 } 7266 7267 slides = $selector.children(`.${params.slideClass}`); 7268 } 7269 } 7270 7271 if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length; 7272 swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10)); 7273 swiper.loopedSlides += params.loopAdditionalSlides; 7274 7275 if (swiper.loopedSlides > slides.length) { 7276 swiper.loopedSlides = slides.length; 7277 } 7278 7279 const prependSlides = []; 7280 const appendSlides = []; 7281 slides.each((el, index) => { 7282 const slide = dom(el); 7283 7284 if (index < swiper.loopedSlides) { 7285 appendSlides.push(el); 7286 } 7287 7288 if (index < slides.length && index >= slides.length - swiper.loopedSlides) { 7289 prependSlides.push(el); 7290 } 7291 7292 slide.attr('data-swiper-slide-index', index); 7293 }); 7294 7295 for (let i = 0; i < appendSlides.length; i += 1) { 7296 $selector.append(dom(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); 7297 } 7298 7299 for (let i = prependSlides.length - 1; i >= 0; i -= 1) { 7300 $selector.prepend(dom(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); 7301 } 7302} 7303;// CONCATENATED MODULE: ./node_modules/swiper/core/loop/loopFix.js 7304function loopFix() { 7305 const swiper = this; 7306 swiper.emit('beforeLoopFix'); 7307 const { 7308 activeIndex, 7309 slides, 7310 loopedSlides, 7311 allowSlidePrev, 7312 allowSlideNext, 7313 snapGrid, 7314 rtlTranslate: rtl 7315 } = swiper; 7316 let newIndex; 7317 swiper.allowSlidePrev = true; 7318 swiper.allowSlideNext = true; 7319 const snapTranslate = -snapGrid[activeIndex]; 7320 const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding 7321 7322 if (activeIndex < loopedSlides) { 7323 newIndex = slides.length - loopedSlides * 3 + activeIndex; 7324 newIndex += loopedSlides; 7325 const slideChanged = swiper.slideTo(newIndex, 0, false, true); 7326 7327 if (slideChanged && diff !== 0) { 7328 swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); 7329 } 7330 } else if (activeIndex >= slides.length - loopedSlides) { 7331 // Fix For Positive Oversliding 7332 newIndex = -slides.length + activeIndex + loopedSlides; 7333 newIndex += loopedSlides; 7334 const slideChanged = swiper.slideTo(newIndex, 0, false, true); 7335 7336 if (slideChanged && diff !== 0) { 7337 swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); 7338 } 7339 } 7340 7341 swiper.allowSlidePrev = allowSlidePrev; 7342 swiper.allowSlideNext = allowSlideNext; 7343 swiper.emit('loopFix'); 7344} 7345;// CONCATENATED MODULE: ./node_modules/swiper/core/loop/loopDestroy.js 7346function loopDestroy() { 7347 const swiper = this; 7348 const { 7349 $wrapperEl, 7350 params, 7351 slides 7352 } = swiper; 7353 $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove(); 7354 slides.removeAttr('data-swiper-slide-index'); 7355} 7356;// CONCATENATED MODULE: ./node_modules/swiper/core/loop/index.js 7357 7358 7359 7360/* harmony default export */ const loop = ({ 7361 loopCreate: loopCreate, 7362 loopFix: loopFix, 7363 loopDestroy: loopDestroy 7364}); 7365;// CONCATENATED MODULE: ./node_modules/swiper/core/grab-cursor/setGrabCursor.js 7366function setGrabCursor(moving) { 7367 const swiper = this; 7368 if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 7369 const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 7370 el.style.cursor = 'move'; 7371 el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab'; 7372 el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab'; 7373 el.style.cursor = moving ? 'grabbing' : 'grab'; 7374} 7375;// CONCATENATED MODULE: ./node_modules/swiper/core/grab-cursor/unsetGrabCursor.js 7376function unsetGrabCursor() { 7377 const swiper = this; 7378 7379 if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { 7380 return; 7381 } 7382 7383 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 7384} 7385;// CONCATENATED MODULE: ./node_modules/swiper/core/grab-cursor/index.js 7386 7387 7388/* harmony default export */ const grab_cursor = ({ 7389 setGrabCursor: setGrabCursor, 7390 unsetGrabCursor: unsetGrabCursor 7391}); 7392;// CONCATENATED MODULE: ./node_modules/swiper/core/events/onTouchStart.js 7393 7394 7395 // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd 7396 7397function closestElement(selector, base = this) { 7398 function __closestFrom(el) { 7399 if (!el || el === ssr_window_esm_getDocument() || el === ssr_window_esm_getWindow()) return null; 7400 if (el.assignedSlot) el = el.assignedSlot; 7401 const found = el.closest(selector); 7402 return found || __closestFrom(el.getRootNode().host); 7403 } 7404 7405 return __closestFrom(base); 7406} 7407 7408function onTouchStart(event) { 7409 const swiper = this; 7410 const document = ssr_window_esm_getDocument(); 7411 const window = ssr_window_esm_getWindow(); 7412 const data = swiper.touchEventsData; 7413 const { 7414 params, 7415 touches, 7416 enabled 7417 } = swiper; 7418 if (!enabled) return; 7419 7420 if (swiper.animating && params.preventInteractionOnTransition) { 7421 return; 7422 } 7423 7424 if (!swiper.animating && params.cssMode && params.loop) { 7425 swiper.loopFix(); 7426 } 7427 7428 let e = event; 7429 if (e.originalEvent) e = e.originalEvent; 7430 let $targetEl = dom(e.target); 7431 7432 if (params.touchEventsTarget === 'wrapper') { 7433 if (!$targetEl.closest(swiper.wrapperEl).length) return; 7434 } 7435 7436 data.isTouchEvent = e.type === 'touchstart'; 7437 if (!data.isTouchEvent && 'which' in e && e.which === 3) return; 7438 if (!data.isTouchEvent && 'button' in e && e.button > 0) return; 7439 if (data.isTouched && data.isMoved) return; // change target el for shadow root component 7440 7441 const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; 7442 7443 if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) { 7444 $targetEl = dom(event.path[0]); 7445 } 7446 7447 const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; 7448 const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element 7449 7450 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, e.target) : $targetEl.closest(noSwipingSelector)[0])) { 7451 swiper.allowClick = true; 7452 return; 7453 } 7454 7455 if (params.swipeHandler) { 7456 if (!$targetEl.closest(params.swipeHandler)[0]) return; 7457 } 7458 7459 touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; 7460 touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; 7461 const startX = touches.currentX; 7462 const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 7463 7464 const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection; 7465 const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold; 7466 7467 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { 7468 if (edgeSwipeDetection === 'prevent') { 7469 event.preventDefault(); 7470 } else { 7471 return; 7472 } 7473 } 7474 7475 Object.assign(data, { 7476 isTouched: true, 7477 isMoved: false, 7478 allowTouchCallbacks: true, 7479 isScrolling: undefined, 7480 startMoving: undefined 7481 }); 7482 touches.startX = startX; 7483 touches.startY = startY; 7484 data.touchStartTime = utils_now(); 7485 swiper.allowClick = true; 7486 swiper.updateSize(); 7487 swiper.swipeDirection = undefined; 7488 if (params.threshold > 0) data.allowThresholdMove = false; 7489 7490 if (e.type !== 'touchstart') { 7491 let preventDefault = true; 7492 if ($targetEl.is(data.focusableElements)) preventDefault = false; 7493 7494 if (document.activeElement && dom(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) { 7495 document.activeElement.blur(); 7496 } 7497 7498 const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 7499 7500 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) { 7501 e.preventDefault(); 7502 } 7503 } 7504 7505 swiper.emit('touchStart', e); 7506} 7507;// CONCATENATED MODULE: ./node_modules/swiper/core/events/onTouchMove.js 7508 7509 7510 7511function onTouchMove(event) { 7512 const document = ssr_window_esm_getDocument(); 7513 const swiper = this; 7514 const data = swiper.touchEventsData; 7515 const { 7516 params, 7517 touches, 7518 rtlTranslate: rtl, 7519 enabled 7520 } = swiper; 7521 if (!enabled) return; 7522 let e = event; 7523 if (e.originalEvent) e = e.originalEvent; 7524 7525 if (!data.isTouched) { 7526 if (data.startMoving && data.isScrolling) { 7527 swiper.emit('touchMoveOpposite', e); 7528 } 7529 7530 return; 7531 } 7532 7533 if (data.isTouchEvent && e.type !== 'touchmove') return; 7534 const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]); 7535 const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX; 7536 const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY; 7537 7538 if (e.preventedByNestedSwiper) { 7539 touches.startX = pageX; 7540 touches.startY = pageY; 7541 return; 7542 } 7543 7544 if (!swiper.allowTouchMove) { 7545 // isMoved = true; 7546 swiper.allowClick = false; 7547 7548 if (data.isTouched) { 7549 Object.assign(touches, { 7550 startX: pageX, 7551 startY: pageY, 7552 currentX: pageX, 7553 currentY: pageY 7554 }); 7555 data.touchStartTime = utils_now(); 7556 } 7557 7558 return; 7559 } 7560 7561 if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) { 7562 if (swiper.isVertical()) { 7563 // Vertical 7564 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 7565 data.isTouched = false; 7566 data.isMoved = false; 7567 return; 7568 } 7569 } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) { 7570 return; 7571 } 7572 } 7573 7574 if (data.isTouchEvent && document.activeElement) { 7575 if (e.target === document.activeElement && dom(e.target).is(data.focusableElements)) { 7576 data.isMoved = true; 7577 swiper.allowClick = false; 7578 return; 7579 } 7580 } 7581 7582 if (data.allowTouchCallbacks) { 7583 swiper.emit('touchMove', e); 7584 } 7585 7586 if (e.targetTouches && e.targetTouches.length > 1) return; 7587 touches.currentX = pageX; 7588 touches.currentY = pageY; 7589 const diffX = touches.currentX - touches.startX; 7590 const diffY = touches.currentY - touches.startY; 7591 if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; 7592 7593 if (typeof data.isScrolling === 'undefined') { 7594 let touchAngle; 7595 7596 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { 7597 data.isScrolling = false; 7598 } else { 7599 // eslint-disable-next-line 7600 if (diffX * diffX + diffY * diffY >= 25) { 7601 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 7602 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 7603 } 7604 } 7605 } 7606 7607 if (data.isScrolling) { 7608 swiper.emit('touchMoveOpposite', e); 7609 } 7610 7611 if (typeof data.startMoving === 'undefined') { 7612 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 7613 data.startMoving = true; 7614 } 7615 } 7616 7617 if (data.isScrolling) { 7618 data.isTouched = false; 7619 return; 7620 } 7621 7622 if (!data.startMoving) { 7623 return; 7624 } 7625 7626 swiper.allowClick = false; 7627 7628 if (!params.cssMode && e.cancelable) { 7629 e.preventDefault(); 7630 } 7631 7632 if (params.touchMoveStopPropagation && !params.nested) { 7633 e.stopPropagation(); 7634 } 7635 7636 if (!data.isMoved) { 7637 if (params.loop && !params.cssMode) { 7638 swiper.loopFix(); 7639 } 7640 7641 data.startTranslate = swiper.getTranslate(); 7642 swiper.setTransition(0); 7643 7644 if (swiper.animating) { 7645 swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend'); 7646 } 7647 7648 data.allowMomentumBounce = false; // Grab Cursor 7649 7650 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 7651 swiper.setGrabCursor(true); 7652 } 7653 7654 swiper.emit('sliderFirstMove', e); 7655 } 7656 7657 swiper.emit('sliderMove', e); 7658 data.isMoved = true; 7659 let diff = swiper.isHorizontal() ? diffX : diffY; 7660 touches.diff = diff; 7661 diff *= params.touchRatio; 7662 if (rtl) diff = -diff; 7663 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 7664 data.currentTranslate = diff + data.startTranslate; 7665 let disableParentSwiper = true; 7666 let resistanceRatio = params.resistanceRatio; 7667 7668 if (params.touchReleaseOnEdges) { 7669 resistanceRatio = 0; 7670 } 7671 7672 if (diff > 0 && data.currentTranslate > swiper.minTranslate()) { 7673 disableParentSwiper = false; 7674 if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; 7675 } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) { 7676 disableParentSwiper = false; 7677 if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; 7678 } 7679 7680 if (disableParentSwiper) { 7681 e.preventedByNestedSwiper = true; 7682 } // Directions locks 7683 7684 7685 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 7686 data.currentTranslate = data.startTranslate; 7687 } 7688 7689 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 7690 data.currentTranslate = data.startTranslate; 7691 } 7692 7693 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { 7694 data.currentTranslate = data.startTranslate; 7695 } // Threshold 7696 7697 7698 if (params.threshold > 0) { 7699 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 7700 if (!data.allowThresholdMove) { 7701 data.allowThresholdMove = true; 7702 touches.startX = touches.currentX; 7703 touches.startY = touches.currentY; 7704 data.currentTranslate = data.startTranslate; 7705 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 7706 return; 7707 } 7708 } else { 7709 data.currentTranslate = data.startTranslate; 7710 return; 7711 } 7712 } 7713 7714 if (!params.followFinger || params.cssMode) return; // Update active index in free mode 7715 7716 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 7717 swiper.updateActiveIndex(); 7718 swiper.updateSlidesClasses(); 7719 } 7720 7721 if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) { 7722 swiper.freeMode.onTouchMove(); 7723 } // Update progress 7724 7725 7726 swiper.updateProgress(data.currentTranslate); // Update translate 7727 7728 swiper.setTranslate(data.currentTranslate); 7729} 7730;// CONCATENATED MODULE: ./node_modules/swiper/core/events/onTouchEnd.js 7731 7732function onTouchEnd(event) { 7733 const swiper = this; 7734 const data = swiper.touchEventsData; 7735 const { 7736 params, 7737 touches, 7738 rtlTranslate: rtl, 7739 slidesGrid, 7740 enabled 7741 } = swiper; 7742 if (!enabled) return; 7743 let e = event; 7744 if (e.originalEvent) e = e.originalEvent; 7745 7746 if (data.allowTouchCallbacks) { 7747 swiper.emit('touchEnd', e); 7748 } 7749 7750 data.allowTouchCallbacks = false; 7751 7752 if (!data.isTouched) { 7753 if (data.isMoved && params.grabCursor) { 7754 swiper.setGrabCursor(false); 7755 } 7756 7757 data.isMoved = false; 7758 data.startMoving = false; 7759 return; 7760 } // Return Grab Cursor 7761 7762 7763 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 7764 swiper.setGrabCursor(false); 7765 } // Time diff 7766 7767 7768 const touchEndTime = utils_now(); 7769 const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click 7770 7771 if (swiper.allowClick) { 7772 const pathTree = e.path || e.composedPath && e.composedPath(); 7773 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target); 7774 swiper.emit('tap click', e); 7775 7776 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { 7777 swiper.emit('doubleTap doubleClick', e); 7778 } 7779 } 7780 7781 data.lastClickTime = utils_now(); 7782 utils_nextTick(() => { 7783 if (!swiper.destroyed) swiper.allowClick = true; 7784 }); 7785 7786 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) { 7787 data.isTouched = false; 7788 data.isMoved = false; 7789 data.startMoving = false; 7790 return; 7791 } 7792 7793 data.isTouched = false; 7794 data.isMoved = false; 7795 data.startMoving = false; 7796 let currentPos; 7797 7798 if (params.followFinger) { 7799 currentPos = rtl ? swiper.translate : -swiper.translate; 7800 } else { 7801 currentPos = -data.currentTranslate; 7802 } 7803 7804 if (params.cssMode) { 7805 return; 7806 } 7807 7808 if (swiper.params.freeMode && params.freeMode.enabled) { 7809 swiper.freeMode.onTouchEnd({ 7810 currentPos 7811 }); 7812 return; 7813 } // Find current slide 7814 7815 7816 let stopIndex = 0; 7817 let groupSize = swiper.slidesSizesGrid[0]; 7818 7819 for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { 7820 const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 7821 7822 if (typeof slidesGrid[i + increment] !== 'undefined') { 7823 if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { 7824 stopIndex = i; 7825 groupSize = slidesGrid[i + increment] - slidesGrid[i]; 7826 } 7827 } else if (currentPos >= slidesGrid[i]) { 7828 stopIndex = i; 7829 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 7830 } 7831 } // Find current slide size 7832 7833 7834 const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 7835 const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 7836 7837 if (timeDiff > params.longSwipesMs) { 7838 // Long touches 7839 if (!params.longSwipes) { 7840 swiper.slideTo(swiper.activeIndex); 7841 return; 7842 } 7843 7844 if (swiper.swipeDirection === 'next') { 7845 if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex); 7846 } 7847 7848 if (swiper.swipeDirection === 'prev') { 7849 if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex); 7850 } 7851 } else { 7852 // Short swipes 7853 if (!params.shortSwipes) { 7854 swiper.slideTo(swiper.activeIndex); 7855 return; 7856 } 7857 7858 const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 7859 7860 if (!isNavButtonTarget) { 7861 if (swiper.swipeDirection === 'next') { 7862 swiper.slideTo(stopIndex + increment); 7863 } 7864 7865 if (swiper.swipeDirection === 'prev') { 7866 swiper.slideTo(stopIndex); 7867 } 7868 } else if (e.target === swiper.navigation.nextEl) { 7869 swiper.slideTo(stopIndex + increment); 7870 } else { 7871 swiper.slideTo(stopIndex); 7872 } 7873 } 7874} 7875;// CONCATENATED MODULE: ./node_modules/swiper/core/events/onResize.js 7876function onResize() { 7877 const swiper = this; 7878 const { 7879 params, 7880 el 7881 } = swiper; 7882 if (el && el.offsetWidth === 0) return; // Breakpoints 7883 7884 if (params.breakpoints) { 7885 swiper.setBreakpoint(); 7886 } // Save locks 7887 7888 7889 const { 7890 allowSlideNext, 7891 allowSlidePrev, 7892 snapGrid 7893 } = swiper; // Disable locks on resize 7894 7895 swiper.allowSlideNext = true; 7896 swiper.allowSlidePrev = true; 7897 swiper.updateSize(); 7898 swiper.updateSlides(); 7899 swiper.updateSlidesClasses(); 7900 7901 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) { 7902 swiper.slideTo(swiper.slides.length - 1, 0, false, true); 7903 } else { 7904 swiper.slideTo(swiper.activeIndex, 0, false, true); 7905 } 7906 7907 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 7908 swiper.autoplay.run(); 7909 } // Return locks after resize 7910 7911 7912 swiper.allowSlidePrev = allowSlidePrev; 7913 swiper.allowSlideNext = allowSlideNext; 7914 7915 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 7916 swiper.checkOverflow(); 7917 } 7918} 7919;// CONCATENATED MODULE: ./node_modules/swiper/core/events/onClick.js 7920function onClick(e) { 7921 const swiper = this; 7922 if (!swiper.enabled) return; 7923 7924 if (!swiper.allowClick) { 7925 if (swiper.params.preventClicks) e.preventDefault(); 7926 7927 if (swiper.params.preventClicksPropagation && swiper.animating) { 7928 e.stopPropagation(); 7929 e.stopImmediatePropagation(); 7930 } 7931 } 7932} 7933;// CONCATENATED MODULE: ./node_modules/swiper/core/events/onScroll.js 7934function onScroll() { 7935 const swiper = this; 7936 const { 7937 wrapperEl, 7938 rtlTranslate, 7939 enabled 7940 } = swiper; 7941 if (!enabled) return; 7942 swiper.previousTranslate = swiper.translate; 7943 7944 if (swiper.isHorizontal()) { 7945 swiper.translate = -wrapperEl.scrollLeft; 7946 } else { 7947 swiper.translate = -wrapperEl.scrollTop; 7948 } // eslint-disable-next-line 7949 7950 7951 if (swiper.translate === -0) swiper.translate = 0; 7952 swiper.updateActiveIndex(); 7953 swiper.updateSlidesClasses(); 7954 let newProgress; 7955 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 7956 7957 if (translatesDiff === 0) { 7958 newProgress = 0; 7959 } else { 7960 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 7961 } 7962 7963 if (newProgress !== swiper.progress) { 7964 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 7965 } 7966 7967 swiper.emit('setTranslate', swiper.translate, false); 7968} 7969;// CONCATENATED MODULE: ./node_modules/swiper/core/events/index.js 7970 7971 7972 7973 7974 7975 7976 7977let dummyEventAttached = false; 7978 7979function dummyEventListener() {} 7980 7981const events = (swiper, method) => { 7982 const document = ssr_window_esm_getDocument(); 7983 const { 7984 params, 7985 touchEvents, 7986 el, 7987 wrapperEl, 7988 device, 7989 support 7990 } = swiper; 7991 const capture = !!params.nested; 7992 const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 7993 const swiperMethod = method; // Touch Events 7994 7995 if (!support.touch) { 7996 el[domMethod](touchEvents.start, swiper.onTouchStart, false); 7997 document[domMethod](touchEvents.move, swiper.onTouchMove, capture); 7998 document[domMethod](touchEvents.end, swiper.onTouchEnd, false); 7999 } else { 8000 const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? { 8001 passive: true, 8002 capture: false 8003 } : false; 8004 el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener); 8005 el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? { 8006 passive: false, 8007 capture 8008 } : capture); 8009 el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener); 8010 8011 if (touchEvents.cancel) { 8012 el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener); 8013 } 8014 } // Prevent Links Clicks 8015 8016 8017 if (params.preventClicks || params.preventClicksPropagation) { 8018 el[domMethod]('click', swiper.onClick, true); 8019 } 8020 8021 if (params.cssMode) { 8022 wrapperEl[domMethod]('scroll', swiper.onScroll); 8023 } // Resize handler 8024 8025 8026 if (params.updateOnWindowResize) { 8027 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 8028 } else { 8029 swiper[swiperMethod]('observerUpdate', onResize, true); 8030 } 8031}; 8032 8033function attachEvents() { 8034 const swiper = this; 8035 const document = ssr_window_esm_getDocument(); 8036 const { 8037 params, 8038 support 8039 } = swiper; 8040 swiper.onTouchStart = onTouchStart.bind(swiper); 8041 swiper.onTouchMove = onTouchMove.bind(swiper); 8042 swiper.onTouchEnd = onTouchEnd.bind(swiper); 8043 8044 if (params.cssMode) { 8045 swiper.onScroll = onScroll.bind(swiper); 8046 } 8047 8048 swiper.onClick = onClick.bind(swiper); 8049 8050 if (support.touch && !dummyEventAttached) { 8051 document.addEventListener('touchstart', dummyEventListener); 8052 dummyEventAttached = true; 8053 } 8054 8055 events(swiper, 'on'); 8056} 8057 8058function detachEvents() { 8059 const swiper = this; 8060 events(swiper, 'off'); 8061} 8062 8063/* harmony default export */ const core_events = ({ 8064 attachEvents, 8065 detachEvents 8066}); 8067;// CONCATENATED MODULE: ./node_modules/swiper/core/breakpoints/setBreakpoint.js 8068 8069 8070const isGridEnabled = (swiper, params) => { 8071 return swiper.grid && params.grid && params.grid.rows > 1; 8072}; 8073 8074function setBreakpoint() { 8075 const swiper = this; 8076 const { 8077 activeIndex, 8078 initialized, 8079 loopedSlides = 0, 8080 params, 8081 $el 8082 } = swiper; 8083 const breakpoints = params.breakpoints; 8084 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters 8085 8086 const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el); 8087 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 8088 const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 8089 const breakpointParams = breakpointOnlyParams || swiper.originalParams; 8090 const wasMultiRow = isGridEnabled(swiper, params); 8091 const isMultiRow = isGridEnabled(swiper, breakpointParams); 8092 const wasEnabled = params.enabled; 8093 8094 if (wasMultiRow && !isMultiRow) { 8095 $el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`); 8096 swiper.emitContainerClasses(); 8097 } else if (!wasMultiRow && isMultiRow) { 8098 $el.addClass(`${params.containerModifierClass}grid`); 8099 8100 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { 8101 $el.addClass(`${params.containerModifierClass}grid-column`); 8102 } 8103 8104 swiper.emitContainerClasses(); 8105 } 8106 8107 const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 8108 const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 8109 8110 if (directionChanged && initialized) { 8111 swiper.changeDirection(); 8112 } 8113 8114 utils_extend(swiper.params, breakpointParams); 8115 const isEnabled = swiper.params.enabled; 8116 Object.assign(swiper, { 8117 allowTouchMove: swiper.params.allowTouchMove, 8118 allowSlideNext: swiper.params.allowSlideNext, 8119 allowSlidePrev: swiper.params.allowSlidePrev 8120 }); 8121 8122 if (wasEnabled && !isEnabled) { 8123 swiper.disable(); 8124 } else if (!wasEnabled && isEnabled) { 8125 swiper.enable(); 8126 } 8127 8128 swiper.currentBreakpoint = breakpoint; 8129 swiper.emit('_beforeBreakpoint', breakpointParams); 8130 8131 if (needsReLoop && initialized) { 8132 swiper.loopDestroy(); 8133 swiper.loopCreate(); 8134 swiper.updateSlides(); 8135 swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false); 8136 } 8137 8138 swiper.emit('breakpoint', breakpointParams); 8139} 8140;// CONCATENATED MODULE: ./node_modules/swiper/core/breakpoints/getBreakpoint.js 8141 8142function getBreakpoint(breakpoints, base = 'window', containerEl) { 8143 if (!breakpoints || base === 'container' && !containerEl) return undefined; 8144 let breakpoint = false; 8145 const window = ssr_window_esm_getWindow(); 8146 const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; 8147 const points = Object.keys(breakpoints).map(point => { 8148 if (typeof point === 'string' && point.indexOf('@') === 0) { 8149 const minRatio = parseFloat(point.substr(1)); 8150 const value = currentHeight * minRatio; 8151 return { 8152 value, 8153 point 8154 }; 8155 } 8156 8157 return { 8158 value: point, 8159 point 8160 }; 8161 }); 8162 points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); 8163 8164 for (let i = 0; i < points.length; i += 1) { 8165 const { 8166 point, 8167 value 8168 } = points[i]; 8169 8170 if (base === 'window') { 8171 if (window.matchMedia(`(min-width: ${value}px)`).matches) { 8172 breakpoint = point; 8173 } 8174 } else if (value <= containerEl.clientWidth) { 8175 breakpoint = point; 8176 } 8177 } 8178 8179 return breakpoint || 'max'; 8180} 8181;// CONCATENATED MODULE: ./node_modules/swiper/core/breakpoints/index.js 8182 8183 8184/* harmony default export */ const breakpoints = ({ 8185 setBreakpoint: setBreakpoint, 8186 getBreakpoint: getBreakpoint 8187}); 8188;// CONCATENATED MODULE: ./node_modules/swiper/core/classes/addClasses.js 8189function prepareClasses(entries, prefix) { 8190 const resultClasses = []; 8191 entries.forEach(item => { 8192 if (typeof item === 'object') { 8193 Object.keys(item).forEach(classNames => { 8194 if (item[classNames]) { 8195 resultClasses.push(prefix + classNames); 8196 } 8197 }); 8198 } else if (typeof item === 'string') { 8199 resultClasses.push(prefix + item); 8200 } 8201 }); 8202 return resultClasses; 8203} 8204 8205function addClasses() { 8206 const swiper = this; 8207 const { 8208 classNames, 8209 params, 8210 rtl, 8211 $el, 8212 device, 8213 support 8214 } = swiper; // prettier-ignore 8215 8216 const suffixes = prepareClasses(['initialized', params.direction, { 8217 'pointer-events': !support.touch 8218 }, { 8219 'free-mode': swiper.params.freeMode && params.freeMode.enabled 8220 }, { 8221 'autoheight': params.autoHeight 8222 }, { 8223 'rtl': rtl 8224 }, { 8225 'grid': params.grid && params.grid.rows > 1 8226 }, { 8227 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 8228 }, { 8229 'android': device.android 8230 }, { 8231 'ios': device.ios 8232 }, { 8233 'css-mode': params.cssMode 8234 }, { 8235 'centered': params.cssMode && params.centeredSlides 8236 }], params.containerModifierClass); 8237 classNames.push(...suffixes); 8238 $el.addClass([...classNames].join(' ')); 8239 swiper.emitContainerClasses(); 8240} 8241;// CONCATENATED MODULE: ./node_modules/swiper/core/classes/removeClasses.js 8242function removeClasses() { 8243 const swiper = this; 8244 const { 8245 $el, 8246 classNames 8247 } = swiper; 8248 $el.removeClass(classNames.join(' ')); 8249 swiper.emitContainerClasses(); 8250} 8251;// CONCATENATED MODULE: ./node_modules/swiper/core/classes/index.js 8252 8253 8254/* harmony default export */ const classes = ({ 8255 addClasses: addClasses, 8256 removeClasses: removeClasses 8257}); 8258;// CONCATENATED MODULE: ./node_modules/swiper/core/images/loadImage.js 8259 8260 8261function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) { 8262 const window = ssr_window_esm_getWindow(); 8263 let image; 8264 8265 function onReady() { 8266 if (callback) callback(); 8267 } 8268 8269 const isPicture = dom(imageEl).parent('picture')[0]; 8270 8271 if (!isPicture && (!imageEl.complete || !checkForComplete)) { 8272 if (src) { 8273 image = new window.Image(); 8274 image.onload = onReady; 8275 image.onerror = onReady; 8276 8277 if (sizes) { 8278 image.sizes = sizes; 8279 } 8280 8281 if (srcset) { 8282 image.srcset = srcset; 8283 } 8284 8285 if (src) { 8286 image.src = src; 8287 } 8288 } else { 8289 onReady(); 8290 } 8291 } else { 8292 // image already loaded... 8293 onReady(); 8294 } 8295} 8296;// CONCATENATED MODULE: ./node_modules/swiper/core/images/preloadImages.js 8297function preloadImages() { 8298 const swiper = this; 8299 swiper.imagesToLoad = swiper.$el.find('img'); 8300 8301 function onReady() { 8302 if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return; 8303 if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1; 8304 8305 if (swiper.imagesLoaded === swiper.imagesToLoad.length) { 8306 if (swiper.params.updateOnImagesReady) swiper.update(); 8307 swiper.emit('imagesReady'); 8308 } 8309 } 8310 8311 for (let i = 0; i < swiper.imagesToLoad.length; i += 1) { 8312 const imageEl = swiper.imagesToLoad[i]; 8313 swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady); 8314 } 8315} 8316;// CONCATENATED MODULE: ./node_modules/swiper/core/images/index.js 8317 8318 8319/* harmony default export */ const core_images = ({ 8320 loadImage: loadImage, 8321 preloadImages: preloadImages 8322}); 8323;// CONCATENATED MODULE: ./node_modules/swiper/core/check-overflow/index.js 8324function checkOverflow() { 8325 const swiper = this; 8326 const { 8327 isLocked: wasLocked, 8328 params 8329 } = swiper; 8330 const { 8331 slidesOffsetBefore 8332 } = params; 8333 8334 if (slidesOffsetBefore) { 8335 const lastSlideIndex = swiper.slides.length - 1; 8336 const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 8337 swiper.isLocked = swiper.size > lastSlideRightEdge; 8338 } else { 8339 swiper.isLocked = swiper.snapGrid.length === 1; 8340 } 8341 8342 if (params.allowSlideNext === true) { 8343 swiper.allowSlideNext = !swiper.isLocked; 8344 } 8345 8346 if (params.allowSlidePrev === true) { 8347 swiper.allowSlidePrev = !swiper.isLocked; 8348 } 8349 8350 if (wasLocked && wasLocked !== swiper.isLocked) { 8351 swiper.isEnd = false; 8352 } 8353 8354 if (wasLocked !== swiper.isLocked) { 8355 swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 8356 } 8357} 8358 8359/* harmony default export */ const check_overflow = ({ 8360 checkOverflow 8361}); 8362;// CONCATENATED MODULE: ./node_modules/swiper/core/defaults.js 8363/* harmony default export */ const defaults = ({ 8364 init: true, 8365 direction: 'horizontal', 8366 touchEventsTarget: 'wrapper', 8367 initialSlide: 0, 8368 speed: 300, 8369 cssMode: false, 8370 updateOnWindowResize: true, 8371 resizeObserver: true, 8372 nested: false, 8373 createElements: false, 8374 enabled: true, 8375 focusableElements: 'input, select, option, textarea, button, video, label', 8376 // Overrides 8377 width: null, 8378 height: null, 8379 // 8380 preventInteractionOnTransition: false, 8381 // ssr 8382 userAgent: null, 8383 url: null, 8384 // To support iOS's swipe-to-go-back gesture (when being used in-app). 8385 edgeSwipeDetection: false, 8386 edgeSwipeThreshold: 20, 8387 // Autoheight 8388 autoHeight: false, 8389 // Set wrapper width 8390 setWrapperSize: false, 8391 // Virtual Translate 8392 virtualTranslate: false, 8393 // Effects 8394 effect: 'slide', 8395 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 8396 // Breakpoints 8397 breakpoints: undefined, 8398 breakpointsBase: 'window', 8399 // Slides grid 8400 spaceBetween: 0, 8401 slidesPerView: 1, 8402 slidesPerGroup: 1, 8403 slidesPerGroupSkip: 0, 8404 slidesPerGroupAuto: false, 8405 centeredSlides: false, 8406 centeredSlidesBounds: false, 8407 slidesOffsetBefore: 0, 8408 // in px 8409 slidesOffsetAfter: 0, 8410 // in px 8411 normalizeSlideIndex: true, 8412 centerInsufficientSlides: false, 8413 // Disable swiper and hide navigation when container not overflow 8414 watchOverflow: true, 8415 // Round length 8416 roundLengths: false, 8417 // Touches 8418 touchRatio: 1, 8419 touchAngle: 45, 8420 simulateTouch: true, 8421 shortSwipes: true, 8422 longSwipes: true, 8423 longSwipesRatio: 0.5, 8424 longSwipesMs: 300, 8425 followFinger: true, 8426 allowTouchMove: true, 8427 threshold: 0, 8428 touchMoveStopPropagation: false, 8429 touchStartPreventDefault: true, 8430 touchStartForcePreventDefault: false, 8431 touchReleaseOnEdges: false, 8432 // Unique Navigation Elements 8433 uniqueNavElements: true, 8434 // Resistance 8435 resistance: true, 8436 resistanceRatio: 0.85, 8437 // Progress 8438 watchSlidesProgress: false, 8439 // Cursor 8440 grabCursor: false, 8441 // Clicks 8442 preventClicks: true, 8443 preventClicksPropagation: true, 8444 slideToClickedSlide: false, 8445 // Images 8446 preloadImages: true, 8447 updateOnImagesReady: true, 8448 // loop 8449 loop: false, 8450 loopAdditionalSlides: 0, 8451 loopedSlides: null, 8452 loopFillGroupWithBlank: false, 8453 loopPreventsSlide: true, 8454 // rewind 8455 rewind: false, 8456 // Swiping/no swiping 8457 allowSlidePrev: true, 8458 allowSlideNext: true, 8459 swipeHandler: null, 8460 // '.swipe-handler', 8461 noSwiping: true, 8462 noSwipingClass: 'swiper-no-swiping', 8463 noSwipingSelector: null, 8464 // Passive Listeners 8465 passiveListeners: true, 8466 // NS 8467 containerModifierClass: 'swiper-', 8468 // NEW 8469 slideClass: 'swiper-slide', 8470 slideBlankClass: 'swiper-slide-invisible-blank', 8471 slideActiveClass: 'swiper-slide-active', 8472 slideDuplicateActiveClass: 'swiper-slide-duplicate-active', 8473 slideVisibleClass: 'swiper-slide-visible', 8474 slideDuplicateClass: 'swiper-slide-duplicate', 8475 slideNextClass: 'swiper-slide-next', 8476 slideDuplicateNextClass: 'swiper-slide-duplicate-next', 8477 slidePrevClass: 'swiper-slide-prev', 8478 slideDuplicatePrevClass: 'swiper-slide-duplicate-prev', 8479 wrapperClass: 'swiper-wrapper', 8480 // Callbacks 8481 runCallbacksOnInit: true, 8482 // Internals 8483 _emitClasses: false 8484}); 8485;// CONCATENATED MODULE: ./node_modules/swiper/core/moduleExtendParams.js 8486 8487function moduleExtendParams(params, allModulesParams) { 8488 return function extendParams(obj = {}) { 8489 const moduleParamName = Object.keys(obj)[0]; 8490 const moduleParams = obj[moduleParamName]; 8491 8492 if (typeof moduleParams !== 'object' || moduleParams === null) { 8493 utils_extend(allModulesParams, obj); 8494 return; 8495 } 8496 8497 if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) { 8498 params[moduleParamName] = { 8499 auto: true 8500 }; 8501 } 8502 8503 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 8504 utils_extend(allModulesParams, obj); 8505 return; 8506 } 8507 8508 if (params[moduleParamName] === true) { 8509 params[moduleParamName] = { 8510 enabled: true 8511 }; 8512 } 8513 8514 if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { 8515 params[moduleParamName].enabled = true; 8516 } 8517 8518 if (!params[moduleParamName]) params[moduleParamName] = { 8519 enabled: false 8520 }; 8521 utils_extend(allModulesParams, obj); 8522 }; 8523} 8524;// CONCATENATED MODULE: ./node_modules/swiper/core/core.js 8525/* eslint no-param-reassign: "off" */ 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548const prototypes = { 8549 eventsEmitter: events_emitter, 8550 update: update, 8551 translate: translate, 8552 transition: core_transition, 8553 slide: slide, 8554 loop: loop, 8555 grabCursor: grab_cursor, 8556 events: core_events, 8557 breakpoints: breakpoints, 8558 checkOverflow: check_overflow, 8559 classes: classes, 8560 images: core_images 8561}; 8562const extendedDefaults = {}; 8563 8564class core_Swiper { 8565 constructor(...args) { 8566 let el; 8567 let params; 8568 8569 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { 8570 params = args[0]; 8571 } else { 8572 [el, params] = args; 8573 } 8574 8575 if (!params) params = {}; 8576 params = utils_extend({}, params); 8577 if (el && !params.el) params.el = el; 8578 8579 if (params.el && dom(params.el).length > 1) { 8580 const swipers = []; 8581 dom(params.el).each(containerEl => { 8582 const newParams = utils_extend({}, params, { 8583 el: containerEl 8584 }); 8585 swipers.push(new core_Swiper(newParams)); 8586 }); 8587 return swipers; 8588 } // Swiper Instance 8589 8590 8591 const swiper = this; 8592 swiper.__swiper__ = true; 8593 swiper.support = getSupport(); 8594 swiper.device = getDevice({ 8595 userAgent: params.userAgent 8596 }); 8597 swiper.browser = getBrowser(); 8598 swiper.eventsListeners = {}; 8599 swiper.eventsAnyListeners = []; 8600 swiper.modules = [...swiper.__modules__]; 8601 8602 if (params.modules && Array.isArray(params.modules)) { 8603 swiper.modules.push(...params.modules); 8604 } 8605 8606 const allModulesParams = {}; 8607 swiper.modules.forEach(mod => { 8608 mod({ 8609 swiper, 8610 extendParams: moduleExtendParams(params, allModulesParams), 8611 on: swiper.on.bind(swiper), 8612 once: swiper.once.bind(swiper), 8613 off: swiper.off.bind(swiper), 8614 emit: swiper.emit.bind(swiper) 8615 }); 8616 }); // Extend defaults with modules params 8617 8618 const swiperParams = utils_extend({}, defaults, allModulesParams); // Extend defaults with passed params 8619 8620 swiper.params = utils_extend({}, swiperParams, extendedDefaults, params); 8621 swiper.originalParams = utils_extend({}, swiper.params); 8622 swiper.passedParams = utils_extend({}, params); // add event listeners 8623 8624 if (swiper.params && swiper.params.on) { 8625 Object.keys(swiper.params.on).forEach(eventName => { 8626 swiper.on(eventName, swiper.params.on[eventName]); 8627 }); 8628 } 8629 8630 if (swiper.params && swiper.params.onAny) { 8631 swiper.onAny(swiper.params.onAny); 8632 } // Save Dom lib 8633 8634 8635 swiper.$ = dom; // Extend Swiper 8636 8637 Object.assign(swiper, { 8638 enabled: swiper.params.enabled, 8639 el, 8640 // Classes 8641 classNames: [], 8642 // Slides 8643 slides: dom(), 8644 slidesGrid: [], 8645 snapGrid: [], 8646 slidesSizesGrid: [], 8647 8648 // isDirection 8649 isHorizontal() { 8650 return swiper.params.direction === 'horizontal'; 8651 }, 8652 8653 isVertical() { 8654 return swiper.params.direction === 'vertical'; 8655 }, 8656 8657 // Indexes 8658 activeIndex: 0, 8659 realIndex: 0, 8660 // 8661 isBeginning: true, 8662 isEnd: false, 8663 // Props 8664 translate: 0, 8665 previousTranslate: 0, 8666 progress: 0, 8667 velocity: 0, 8668 animating: false, 8669 // Locks 8670 allowSlideNext: swiper.params.allowSlideNext, 8671 allowSlidePrev: swiper.params.allowSlidePrev, 8672 // Touch Events 8673 touchEvents: function touchEvents() { 8674 const touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel']; 8675 const desktop = ['pointerdown', 'pointermove', 'pointerup']; 8676 swiper.touchEventsTouch = { 8677 start: touch[0], 8678 move: touch[1], 8679 end: touch[2], 8680 cancel: touch[3] 8681 }; 8682 swiper.touchEventsDesktop = { 8683 start: desktop[0], 8684 move: desktop[1], 8685 end: desktop[2] 8686 }; 8687 return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop; 8688 }(), 8689 touchEventsData: { 8690 isTouched: undefined, 8691 isMoved: undefined, 8692 allowTouchCallbacks: undefined, 8693 touchStartTime: undefined, 8694 isScrolling: undefined, 8695 currentTranslate: undefined, 8696 startTranslate: undefined, 8697 allowThresholdMove: undefined, 8698 // Form elements to match 8699 focusableElements: swiper.params.focusableElements, 8700 // Last click time 8701 lastClickTime: utils_now(), 8702 clickTimeout: undefined, 8703 // Velocities 8704 velocities: [], 8705 allowMomentumBounce: undefined, 8706 isTouchEvent: undefined, 8707 startMoving: undefined 8708 }, 8709 // Clicks 8710 allowClick: true, 8711 // Touches 8712 allowTouchMove: swiper.params.allowTouchMove, 8713 touches: { 8714 startX: 0, 8715 startY: 0, 8716 currentX: 0, 8717 currentY: 0, 8718 diff: 0 8719 }, 8720 // Images 8721 imagesToLoad: [], 8722 imagesLoaded: 0 8723 }); 8724 swiper.emit('_swiper'); // Init 8725 8726 if (swiper.params.init) { 8727 swiper.init(); 8728 } // Return app instance 8729 8730 8731 return swiper; 8732 } 8733 8734 enable() { 8735 const swiper = this; 8736 if (swiper.enabled) return; 8737 swiper.enabled = true; 8738 8739 if (swiper.params.grabCursor) { 8740 swiper.setGrabCursor(); 8741 } 8742 8743 swiper.emit('enable'); 8744 } 8745 8746 disable() { 8747 const swiper = this; 8748 if (!swiper.enabled) return; 8749 swiper.enabled = false; 8750 8751 if (swiper.params.grabCursor) { 8752 swiper.unsetGrabCursor(); 8753 } 8754 8755 swiper.emit('disable'); 8756 } 8757 8758 setProgress(progress, speed) { 8759 const swiper = this; 8760 progress = Math.min(Math.max(progress, 0), 1); 8761 const min = swiper.minTranslate(); 8762 const max = swiper.maxTranslate(); 8763 const current = (max - min) * progress + min; 8764 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 8765 swiper.updateActiveIndex(); 8766 swiper.updateSlidesClasses(); 8767 } 8768 8769 emitContainerClasses() { 8770 const swiper = this; 8771 if (!swiper.params._emitClasses || !swiper.el) return; 8772 const cls = swiper.el.className.split(' ').filter(className => { 8773 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 8774 }); 8775 swiper.emit('_containerClasses', cls.join(' ')); 8776 } 8777 8778 getSlideClasses(slideEl) { 8779 const swiper = this; 8780 return slideEl.className.split(' ').filter(className => { 8781 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 8782 }).join(' '); 8783 } 8784 8785 emitSlidesClasses() { 8786 const swiper = this; 8787 if (!swiper.params._emitClasses || !swiper.el) return; 8788 const updates = []; 8789 swiper.slides.each(slideEl => { 8790 const classNames = swiper.getSlideClasses(slideEl); 8791 updates.push({ 8792 slideEl, 8793 classNames 8794 }); 8795 swiper.emit('_slideClass', slideEl, classNames); 8796 }); 8797 swiper.emit('_slideClasses', updates); 8798 } 8799 8800 slidesPerViewDynamic(view = 'current', exact = false) { 8801 const swiper = this; 8802 const { 8803 params, 8804 slides, 8805 slidesGrid, 8806 slidesSizesGrid, 8807 size: swiperSize, 8808 activeIndex 8809 } = swiper; 8810 let spv = 1; 8811 8812 if (params.centeredSlides) { 8813 let slideSize = slides[activeIndex].swiperSlideSize; 8814 let breakLoop; 8815 8816 for (let i = activeIndex + 1; i < slides.length; i += 1) { 8817 if (slides[i] && !breakLoop) { 8818 slideSize += slides[i].swiperSlideSize; 8819 spv += 1; 8820 if (slideSize > swiperSize) breakLoop = true; 8821 } 8822 } 8823 8824 for (let i = activeIndex - 1; i >= 0; i -= 1) { 8825 if (slides[i] && !breakLoop) { 8826 slideSize += slides[i].swiperSlideSize; 8827 spv += 1; 8828 if (slideSize > swiperSize) breakLoop = true; 8829 } 8830 } 8831 } else { 8832 // eslint-disable-next-line 8833 if (view === 'current') { 8834 for (let i = activeIndex + 1; i < slides.length; i += 1) { 8835 const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; 8836 8837 if (slideInView) { 8838 spv += 1; 8839 } 8840 } 8841 } else { 8842 // previous 8843 for (let i = activeIndex - 1; i >= 0; i -= 1) { 8844 const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; 8845 8846 if (slideInView) { 8847 spv += 1; 8848 } 8849 } 8850 } 8851 } 8852 8853 return spv; 8854 } 8855 8856 update() { 8857 const swiper = this; 8858 if (!swiper || swiper.destroyed) return; 8859 const { 8860 snapGrid, 8861 params 8862 } = swiper; // Breakpoints 8863 8864 if (params.breakpoints) { 8865 swiper.setBreakpoint(); 8866 } 8867 8868 swiper.updateSize(); 8869 swiper.updateSlides(); 8870 swiper.updateProgress(); 8871 swiper.updateSlidesClasses(); 8872 8873 function setTranslate() { 8874 const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 8875 const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 8876 swiper.setTranslate(newTranslate); 8877 swiper.updateActiveIndex(); 8878 swiper.updateSlidesClasses(); 8879 } 8880 8881 let translated; 8882 8883 if (swiper.params.freeMode && swiper.params.freeMode.enabled) { 8884 setTranslate(); 8885 8886 if (swiper.params.autoHeight) { 8887 swiper.updateAutoHeight(); 8888 } 8889 } else { 8890 if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) { 8891 translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true); 8892 } else { 8893 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 8894 } 8895 8896 if (!translated) { 8897 setTranslate(); 8898 } 8899 } 8900 8901 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 8902 swiper.checkOverflow(); 8903 } 8904 8905 swiper.emit('update'); 8906 } 8907 8908 changeDirection(newDirection, needUpdate = true) { 8909 const swiper = this; 8910 const currentDirection = swiper.params.direction; 8911 8912 if (!newDirection) { 8913 // eslint-disable-next-line 8914 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 8915 } 8916 8917 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { 8918 return swiper; 8919 } 8920 8921 swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`); 8922 swiper.emitContainerClasses(); 8923 swiper.params.direction = newDirection; 8924 swiper.slides.each(slideEl => { 8925 if (newDirection === 'vertical') { 8926 slideEl.style.width = ''; 8927 } else { 8928 slideEl.style.height = ''; 8929 } 8930 }); 8931 swiper.emit('changeDirection'); 8932 if (needUpdate) swiper.update(); 8933 return swiper; 8934 } 8935 8936 mount(el) { 8937 const swiper = this; 8938 if (swiper.mounted) return true; // Find el 8939 8940 const $el = dom(el || swiper.params.el); 8941 el = $el[0]; 8942 8943 if (!el) { 8944 return false; 8945 } 8946 8947 el.swiper = swiper; 8948 8949 const getWrapperSelector = () => { 8950 return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; 8951 }; 8952 8953 const getWrapper = () => { 8954 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 8955 const res = dom(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items 8956 8957 res.children = options => $el.children(options); 8958 8959 return res; 8960 } 8961 8962 return $el.children(getWrapperSelector()); 8963 }; // Find Wrapper 8964 8965 8966 let $wrapperEl = getWrapper(); 8967 8968 if ($wrapperEl.length === 0 && swiper.params.createElements) { 8969 const document = ssr_window_esm_getDocument(); 8970 const wrapper = document.createElement('div'); 8971 $wrapperEl = dom(wrapper); 8972 wrapper.className = swiper.params.wrapperClass; 8973 $el.append(wrapper); 8974 $el.children(`.${swiper.params.slideClass}`).each(slideEl => { 8975 $wrapperEl.append(slideEl); 8976 }); 8977 } 8978 8979 Object.assign(swiper, { 8980 $el, 8981 el, 8982 $wrapperEl, 8983 wrapperEl: $wrapperEl[0], 8984 mounted: true, 8985 // RTL 8986 rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl', 8987 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'), 8988 wrongRTL: $wrapperEl.css('display') === '-webkit-box' 8989 }); 8990 return true; 8991 } 8992 8993 init(el) { 8994 const swiper = this; 8995 if (swiper.initialized) return swiper; 8996 const mounted = swiper.mount(el); 8997 if (mounted === false) return swiper; 8998 swiper.emit('beforeInit'); // Set breakpoint 8999 9000 if (swiper.params.breakpoints) { 9001 swiper.setBreakpoint(); 9002 } // Add Classes 9003 9004 9005 swiper.addClasses(); // Create loop 9006 9007 if (swiper.params.loop) { 9008 swiper.loopCreate(); 9009 } // Update size 9010 9011 9012 swiper.updateSize(); // Update slides 9013 9014 swiper.updateSlides(); 9015 9016 if (swiper.params.watchOverflow) { 9017 swiper.checkOverflow(); 9018 } // Set Grab Cursor 9019 9020 9021 if (swiper.params.grabCursor && swiper.enabled) { 9022 swiper.setGrabCursor(); 9023 } 9024 9025 if (swiper.params.preloadImages) { 9026 swiper.preloadImages(); 9027 } // Slide To Initial Slide 9028 9029 9030 if (swiper.params.loop) { 9031 swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true); 9032 } else { 9033 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 9034 } // Attach events 9035 9036 9037 swiper.attachEvents(); // Init Flag 9038 9039 swiper.initialized = true; // Emit 9040 9041 swiper.emit('init'); 9042 swiper.emit('afterInit'); 9043 return swiper; 9044 } 9045 9046 destroy(deleteInstance = true, cleanStyles = true) { 9047 const swiper = this; 9048 const { 9049 params, 9050 $el, 9051 $wrapperEl, 9052 slides 9053 } = swiper; 9054 9055 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 9056 return null; 9057 } 9058 9059 swiper.emit('beforeDestroy'); // Init Flag 9060 9061 swiper.initialized = false; // Detach events 9062 9063 swiper.detachEvents(); // Destroy loop 9064 9065 if (params.loop) { 9066 swiper.loopDestroy(); 9067 } // Cleanup styles 9068 9069 9070 if (cleanStyles) { 9071 swiper.removeClasses(); 9072 $el.removeAttr('style'); 9073 $wrapperEl.removeAttr('style'); 9074 9075 if (slides && slides.length) { 9076 slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index'); 9077 } 9078 } 9079 9080 swiper.emit('destroy'); // Detach emitter events 9081 9082 Object.keys(swiper.eventsListeners).forEach(eventName => { 9083 swiper.off(eventName); 9084 }); 9085 9086 if (deleteInstance !== false) { 9087 swiper.$el[0].swiper = null; 9088 deleteProps(swiper); 9089 } 9090 9091 swiper.destroyed = true; 9092 return null; 9093 } 9094 9095 static extendDefaults(newDefaults) { 9096 utils_extend(extendedDefaults, newDefaults); 9097 } 9098 9099 static get extendedDefaults() { 9100 return extendedDefaults; 9101 } 9102 9103 static get defaults() { 9104 return defaults; 9105 } 9106 9107 static installModule(mod) { 9108 if (!core_Swiper.prototype.__modules__) core_Swiper.prototype.__modules__ = []; 9109 const modules = core_Swiper.prototype.__modules__; 9110 9111 if (typeof mod === 'function' && modules.indexOf(mod) < 0) { 9112 modules.push(mod); 9113 } 9114 } 9115 9116 static use(module) { 9117 if (Array.isArray(module)) { 9118 module.forEach(m => core_Swiper.installModule(m)); 9119 return core_Swiper; 9120 } 9121 9122 core_Swiper.installModule(module); 9123 return core_Swiper; 9124 } 9125 9126} 9127
9128Object.keys(prototypes).forEach(prototypeGroup => { 9129 Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => { 9130 core_Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 9131 }); 9132}); 9133core_Swiper.use([Resize, Observer]); 9134/* harmony default export */ const core = (core_Swiper); 9135;// CONCATENATED MODULE: ./node_modules/swiper/modules/virtual/virtual.js 9136 9137 9138function Virtual({ 9139 swiper, 9140 extendParams, 9141 on 9142}) { 9143 extendParams({ 9144 virtual: { 9145 enabled: false, 9146 slides: [], 9147 cache: true, 9148 renderSlide: null, 9149 renderExternal: null, 9150 renderExternalUpdate: true, 9151 addSlidesBefore: 0, 9152 addSlidesAfter: 0 9153 } 9154 }); 9155 let cssModeTimeout; 9156 swiper.virtual = { 9157 cache: {}, 9158 from: undefined, 9159 to: undefined, 9160 slides: [], 9161 offset: 0, 9162 slidesGrid: [] 9163 }; 9164 9165 function renderSlide(slide, index) { 9166 const params = swiper.params.virtual; 9167 9168 if (params.cache && swiper.virtual.cache[index]) { 9169 return swiper.virtual.cache[index]; 9170 } 9171 9172 const $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $(`<div class="${swiper.params.slideClass}" data-swiper-slide-index="${index}">${slide}</div>`); 9173 if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index); 9174 if (params.cache) swiper.virtual.cache[index] = $slideEl; 9175 return $slideEl; 9176 } 9177 9178 function update(force) { 9179 const { 9180 slidesPerView, 9181 slidesPerGroup, 9182 centeredSlides 9183 } = swiper.params; 9184 const { 9185 addSlidesBefore, 9186 addSlidesAfter 9187 } = swiper.params.virtual; 9188 const { 9189 from: previousFrom, 9190 to: previousTo, 9191 slides, 9192 slidesGrid: previousSlidesGrid, 9193 offset: previousOffset 9194 } = swiper.virtual; 9195 9196 if (!swiper.params.cssMode) { 9197 swiper.updateActiveIndex(); 9198 } 9199 9200 const activeIndex = swiper.activeIndex || 0; 9201 let offsetProp; 9202 if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; 9203 let slidesAfter; 9204 let slidesBefore; 9205 9206 if (centeredSlides) { 9207 slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; 9208 slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; 9209 } else { 9210 slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; 9211 slidesBefore = slidesPerGroup + addSlidesBefore; 9212 } 9213 9214 const from = Math.max((activeIndex || 0) - slidesBefore, 0); 9215 const to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1); 9216 const offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); 9217 Object.assign(swiper.virtual, { 9218 from, 9219 to, 9220 offset, 9221 slidesGrid: swiper.slidesGrid 9222 }); 9223 9224 function onRendered() { 9225 swiper.updateSlides(); 9226 swiper.updateProgress(); 9227 swiper.updateSlidesClasses(); 9228 9229 if (swiper.lazy && swiper.params.lazy.enabled) { 9230 swiper.lazy.load(); 9231 } 9232 } 9233 9234 if (previousFrom === from && previousTo === to && !force) { 9235 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { 9236 swiper.slides.css(offsetProp, `${offset}px`); 9237 } 9238 9239 swiper.updateProgress(); 9240 return; 9241 } 9242 9243 if (swiper.params.virtual.renderExternal) { 9244 swiper.params.virtual.renderExternal.call(swiper, { 9245 offset, 9246 from, 9247 to, 9248 slides: function getSlides() { 9249 const slidesToRender = []; 9250 9251 for (let i = from; i <= to; i += 1) { 9252 slidesToRender.push(slides[i]); 9253 } 9254 9255 return slidesToRender; 9256 }() 9257 }); 9258 9259 if (swiper.params.virtual.renderExternalUpdate) { 9260 onRendered(); 9261 } 9262 9263 return; 9264 } 9265 9266 const prependIndexes = []; 9267 const appendIndexes = []; 9268 9269 if (force) { 9270 swiper.$wrapperEl.find(`.${swiper.params.slideClass}`).remove(); 9271 } else { 9272 for (let i = previousFrom; i <= previousTo; i += 1) { 9273 if (i < from || i > to) { 9274 swiper.$wrapperEl.find(`.${swiper.params.slideClass}[data-swiper-slide-index="${i}"]`).remove(); 9275 } 9276 } 9277 } 9278 9279 for (let i = 0; i < slides.length; i += 1) { 9280 if (i >= from && i <= to) { 9281 if (typeof previousTo === 'undefined' || force) { 9282 appendIndexes.push(i); 9283 } else { 9284 if (i > previousTo) appendIndexes.push(i);
vendor: 4,520 bytes, lines 9285-9457
9285 if (i < previousFrom) prependIndexes.push(i); 9286 } 9287 } 9288 } 9289 9290 appendIndexes.forEach(index => { 9291 swiper.$wrapperEl.append(renderSlide(slides[index], index)); 9292 }); 9293 prependIndexes.sort((a, b) => b - a).forEach(index => { 9294 swiper.$wrapperEl.prepend(renderSlide(slides[index], index)); 9295 }); 9296 swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, `${offset}px`); 9297 onRendered(); 9298 } 9299 9300 function appendSlide(slides) { 9301 if (typeof slides === 'object' && 'length' in slides) { 9302 for (let i = 0; i < slides.length; i += 1) { 9303 if (slides[i]) swiper.virtual.slides.push(slides[i]); 9304 } 9305 } else { 9306 swiper.virtual.slides.push(slides); 9307 } 9308 9309 update(true); 9310 } 9311 9312 function prependSlide(slides) { 9313 const activeIndex = swiper.activeIndex; 9314 let newActiveIndex = activeIndex + 1; 9315 let numberOfNewSlides = 1; 9316 9317 if (Array.isArray(slides)) { 9318 for (let i = 0; i < slides.length; i += 1) { 9319 if (slides[i]) swiper.virtual.slides.unshift(slides[i]); 9320 } 9321 9322 newActiveIndex = activeIndex + slides.length; 9323 numberOfNewSlides = slides.length; 9324 } else { 9325 swiper.virtual.slides.unshift(slides); 9326 } 9327 9328 if (swiper.params.virtual.cache) { 9329 const cache = swiper.virtual.cache; 9330 const newCache = {}; 9331 Object.keys(cache).forEach(cachedIndex => { 9332 const $cachedEl = cache[cachedIndex]; 9333 const cachedElIndex = $cachedEl.attr('data-swiper-slide-index'); 9334 9335 if (cachedElIndex) { 9336 $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); 9337 } 9338 9339 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl; 9340 }); 9341 swiper.virtual.cache = newCache; 9342 } 9343 9344 update(true); 9345 swiper.slideTo(newActiveIndex, 0); 9346 } 9347 9348 function removeSlide(slidesIndexes) { 9349 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; 9350 let activeIndex = swiper.activeIndex; 9351 9352 if (Array.isArray(slidesIndexes)) { 9353 for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { 9354 swiper.virtual.slides.splice(slidesIndexes[i], 1); 9355 9356 if (swiper.params.virtual.cache) { 9357 delete swiper.virtual.cache[slidesIndexes[i]]; 9358 } 9359 9360 if (slidesIndexes[i] < activeIndex) activeIndex -= 1; 9361 activeIndex = Math.max(activeIndex, 0); 9362 } 9363 } else { 9364 swiper.virtual.slides.splice(slidesIndexes, 1); 9365 9366 if (swiper.params.virtual.cache) { 9367 delete swiper.virtual.cache[slidesIndexes]; 9368 } 9369 9370 if (slidesIndexes < activeIndex) activeIndex -= 1; 9371 activeIndex = Math.max(activeIndex, 0); 9372 } 9373 9374 update(true); 9375 swiper.slideTo(activeIndex, 0); 9376 } 9377 9378 function removeAllSlides() { 9379 swiper.virtual.slides = []; 9380 9381 if (swiper.params.virtual.cache) { 9382 swiper.virtual.cache = {}; 9383 } 9384 9385 update(true); 9386 swiper.slideTo(0, 0); 9387 } 9388 9389 on('beforeInit', () => { 9390 if (!swiper.params.virtual.enabled) return; 9391 swiper.virtual.slides = swiper.params.virtual.slides; 9392 swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); 9393 swiper.params.watchSlidesProgress = true; 9394 swiper.originalParams.watchSlidesProgress = true; 9395 9396 if (!swiper.params.initialSlide) { 9397 update(); 9398 } 9399 }); 9400 on('setTranslate', () => { 9401 if (!swiper.params.virtual.enabled) return; 9402 9403 if (swiper.params.cssMode && !swiper._immediateVirtual) { 9404 clearTimeout(cssModeTimeout); 9405 cssModeTimeout = setTimeout(() => { 9406 update(); 9407 }, 100); 9408 } else { 9409 update(); 9410 } 9411 }); 9412 on('init update resize', () => { 9413 if (!swiper.params.virtual.enabled) return; 9414 9415 if (swiper.params.cssMode) { 9416 setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); 9417 } 9418 }); 9419 Object.assign(swiper.virtual, { 9420 appendSlide, 9421 prependSlide, 9422 removeSlide, 9423 removeAllSlides, 9424 update 9425 }); 9426} 9427;// CONCATENATED MODULE: ./node_modules/swiper/modules/keyboard/keyboard.js 9428/* eslint-disable consistent-return */ 9429 9430 9431function Keyboard({ 9432 swiper, 9433 extendParams, 9434 on, 9435 emit 9436}) { 9437 const document = getDocument(); 9438 const window = getWindow(); 9439 swiper.keyboard = { 9440 enabled: false 9441 }; 9442 extendParams({ 9443 keyboard: { 9444 enabled: false, 9445 onlyInViewport: true, 9446 pageUpDown: true 9447 } 9448 }); 9449 9450 function handle(event) { 9451 if (!swiper.enabled) return; 9452 const { 9453 rtlTranslate: rtl 9454 } = swiper; 9455 let e = event; 9456 if (e.originalEvent) e = e.originalEvent; // jquery fix 9457
vendor: 3,910 bytes, lines 9458-9575
9458 const kc = e.keyCode || e.charCode; 9459 const pageUpDown = swiper.params.keyboard.pageUpDown; 9460 const isPageUp = pageUpDown && kc === 33; 9461 const isPageDown = pageUpDown && kc === 34; 9462 const isArrowLeft = kc === 37; 9463 const isArrowRight = kc === 39; 9464 const isArrowUp = kc === 38; 9465 const isArrowDown = kc === 40; // Directions locks 9466 9467 if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { 9468 return false; 9469 } 9470 9471 if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { 9472 return false; 9473 } 9474 9475 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { 9476 return undefined; 9477 } 9478 9479 if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { 9480 return undefined; 9481 } 9482 9483 if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { 9484 let inView = false; // Check that swiper should be inside of visible area of window 9485 9486 if (swiper.$el.parents(`.${swiper.params.slideClass}`).length > 0 && swiper.$el.parents(`.${swiper.params.slideActiveClass}`).length === 0) { 9487 return undefined; 9488 } 9489 9490 const $el = swiper.$el; 9491 const swiperWidth = $el[0].clientWidth; 9492 const swiperHeight = $el[0].clientHeight; 9493 const windowWidth = window.innerWidth; 9494 const windowHeight = window.innerHeight; 9495 const swiperOffset = swiper.$el.offset(); 9496 if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; 9497 const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; 9498 9499 for (let i = 0; i < swiperCoord.length; i += 1) { 9500 const point = swiperCoord[i]; 9501 9502 if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { 9503 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 9504 9505 inView = true; 9506 } 9507 } 9508 9509 if (!inView) return undefined; 9510 } 9511 9512 if (swiper.isHorizontal()) { 9513 if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { 9514 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 9515 } 9516 9517 if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); 9518 if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); 9519 } else { 9520 if (isPageUp || isPageDown || isArrowUp || isArrowDown) { 9521 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 9522 } 9523 9524 if (isPageDown || isArrowDown) swiper.slideNext(); 9525 if (isPageUp || isArrowUp) swiper.slidePrev(); 9526 } 9527 9528 emit('keyPress', kc); 9529 return undefined; 9530 } 9531 9532 function enable() { 9533 if (swiper.keyboard.enabled) return; 9534 $(document).on('keydown', handle); 9535 swiper.keyboard.enabled = true; 9536 } 9537 9538 function disable() { 9539 if (!swiper.keyboard.enabled) return; 9540 $(document).off('keydown', handle); 9541 swiper.keyboard.enabled = false; 9542 } 9543 9544 on('init', () => { 9545 if (swiper.params.keyboard.enabled) { 9546 enable(); 9547 } 9548 }); 9549 on('destroy', () => { 9550 if (swiper.keyboard.enabled) { 9551 disable(); 9552 } 9553 }); 9554 Object.assign(swiper.keyboard, { 9555 enable, 9556 disable 9557 }); 9558} 9559;// CONCATENATED MODULE: ./node_modules/swiper/modules/mousewheel/mousewheel.js 9560/* eslint-disable consistent-return */ 9561 9562 9563 9564function Mousewheel({ 9565 swiper, 9566 extendParams, 9567 on, 9568 emit 9569}) { 9570 const window = getWindow(); 9571 extendParams({ 9572 mousewheel: { 9573 enabled: false, 9574 releaseOnEdges: false, 9575 invert: false,
vendor: 13,312 bytes, lines 9576-9957
9576 forceToAxis: false, 9577 sensitivity: 1, 9578 eventsTarget: 'container', 9579 thresholdDelta: null, 9580 thresholdTime: null 9581 } 9582 }); 9583 swiper.mousewheel = { 9584 enabled: false 9585 }; 9586 let timeout; 9587 let lastScrollTime = now(); 9588 let lastEventBeforeSnap; 9589 const recentWheelEvents = []; 9590 9591 function normalize(e) { 9592 // Reasonable defaults 9593 const PIXEL_STEP = 10; 9594 const LINE_HEIGHT = 40; 9595 const PAGE_HEIGHT = 800; 9596 let sX = 0; 9597 let sY = 0; // spinX, spinY 9598 9599 let pX = 0; 9600 let pY = 0; // pixelX, pixelY 9601 // Legacy 9602 9603 if ('detail' in e) { 9604 sY = e.detail; 9605 } 9606 9607 if ('wheelDelta' in e) { 9608 sY = -e.wheelDelta / 120; 9609 } 9610 9611 if ('wheelDeltaY' in e) { 9612 sY = -e.wheelDeltaY / 120; 9613 } 9614 9615 if ('wheelDeltaX' in e) { 9616 sX = -e.wheelDeltaX / 120; 9617 } // side scrolling on FF with DOMMouseScroll 9618 9619 9620 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { 9621 sX = sY; 9622 sY = 0; 9623 } 9624 9625 pX = sX * PIXEL_STEP; 9626 pY = sY * PIXEL_STEP; 9627 9628 if ('deltaY' in e) { 9629 pY = e.deltaY; 9630 } 9631 9632 if ('deltaX' in e) { 9633 pX = e.deltaX; 9634 } 9635 9636 if (e.shiftKey && !pX) { 9637 // if user scrolls with shift he wants horizontal scroll 9638 pX = pY; 9639 pY = 0; 9640 } 9641 9642 if ((pX || pY) && e.deltaMode) { 9643 if (e.deltaMode === 1) { 9644 // delta in LINE units 9645 pX *= LINE_HEIGHT; 9646 pY *= LINE_HEIGHT; 9647 } else { 9648 // delta in PAGE units 9649 pX *= PAGE_HEIGHT; 9650 pY *= PAGE_HEIGHT; 9651 } 9652 } // Fall-back if spin cannot be determined 9653 9654 9655 if (pX && !sX) { 9656 sX = pX < 1 ? -1 : 1; 9657 } 9658 9659 if (pY && !sY) { 9660 sY = pY < 1 ? -1 : 1; 9661 } 9662 9663 return { 9664 spinX: sX, 9665 spinY: sY, 9666 pixelX: pX, 9667 pixelY: pY 9668 }; 9669 } 9670 9671 function handleMouseEnter() { 9672 if (!swiper.enabled) return; 9673 swiper.mouseEntered = true; 9674 } 9675 9676 function handleMouseLeave() { 9677 if (!swiper.enabled) return; 9678 swiper.mouseEntered = false; 9679 } 9680 9681 function animateSlider(newEvent) { 9682 if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { 9683 // Prevent if delta of wheel scroll delta is below configured threshold 9684 return false; 9685 } 9686 9687 if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { 9688 // Prevent if time between scrolls is below configured threshold 9689 return false; 9690 } // If the movement is NOT big enough and 9691 // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): 9692 // Don't go any further (avoid insignificant scroll movement). 9693 9694 9695 if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { 9696 // Return false as a default 9697 return true; 9698 } // If user is scrolling towards the end: 9699 // If the slider hasn't hit the latest slide or 9700 // if the slider is a loop and 9701 // if the slider isn't moving right now: 9702 // Go to next slide and 9703 // emit a scroll event. 9704 // Else (the user is scrolling towards the beginning) and 9705 // if the slider hasn't hit the first slide or 9706 // if the slider is a loop and 9707 // if the slider isn't moving right now: 9708 // Go to prev slide and 9709 // emit a scroll event. 9710 9711 9712 if (newEvent.direction < 0) { 9713 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { 9714 swiper.slideNext(); 9715 emit('scroll', newEvent.raw); 9716 } 9717 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { 9718 swiper.slidePrev(); 9719 emit('scroll', newEvent.raw); 9720 } // If you got here is because an animation has been triggered so store the current time 9721 9722 9723 lastScrollTime = new window.Date().getTime(); // Return false as a default 9724 9725 return false; 9726 } 9727 9728 function releaseScroll(newEvent) { 9729 const params = swiper.params.mousewheel; 9730 9731 if (newEvent.direction < 0) { 9732 if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { 9733 // Return true to animate scroll on edges 9734 return true; 9735 } 9736 } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { 9737 // Return true to animate scroll on edges 9738 return true; 9739 } 9740 9741 return false; 9742 } 9743 9744 function handle(event) { 9745 let e = event; 9746 let disableParentSwiper = true; 9747 if (!swiper.enabled) return; 9748 const params = swiper.params.mousewheel; 9749 9750 if (swiper.params.cssMode) { 9751 e.preventDefault(); 9752 } 9753 9754 let target = swiper.$el; 9755 9756 if (swiper.params.mousewheel.eventsTarget !== 'container') { 9757 target = $(swiper.params.mousewheel.eventsTarget); 9758 } 9759 9760 if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true; 9761 if (e.originalEvent) e = e.originalEvent; // jquery fix 9762 9763 let delta = 0; 9764 const rtlFactor = swiper.rtlTranslate ? -1 : 1; 9765 const data = normalize(e); 9766 9767 if (params.forceToAxis) { 9768 if (swiper.isHorizontal()) { 9769 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; 9770 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; 9771 } else { 9772 delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; 9773 } 9774 9775 if (delta === 0) return true; 9776 if (params.invert) delta = -delta; // Get the scroll positions 9777 9778 let positions = swiper.getTranslate() + delta * params.sensitivity; 9779 if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); 9780 if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); // When loop is true: 9781 // the disableParentSwiper will be true. 9782 // When loop is false: 9783 // if the scroll positions is not on edge, 9784 // then the disableParentSwiper will be true. 9785 // if the scroll on edge positions, 9786 // then the disableParentSwiper will be false. 9787 9788 disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); 9789 if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); 9790 9791 if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { 9792 // Register the new event in a variable which stores the relevant data 9793 const newEvent = { 9794 time: now(), 9795 delta: Math.abs(delta), 9796 direction: Math.sign(delta), 9797 raw: event 9798 }; // Keep the most recent events 9799 9800 if (recentWheelEvents.length >= 2) { 9801 recentWheelEvents.shift(); // only store the last N events 9802 } 9803 9804 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 9805 recentWheelEvents.push(newEvent); // If there is at least one previous recorded event: 9806 // If direction has changed or 9807 // if the scroll is quicker than the previous one: 9808 // Animate the slider. 9809 // Else (this is the first time the wheel is moved): 9810 // Animate the slider. 9811 9812 if (prevEvent) { 9813 if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { 9814 animateSlider(newEvent); 9815 } 9816 } else { 9817 animateSlider(newEvent); 9818 } // If it's time to release the scroll: 9819 // Return now so you don't hit the preventDefault. 9820 9821 9822 if (releaseScroll(newEvent)) { 9823 return true; 9824 } 9825 } else { 9826 // Freemode or scrollContainer: 9827 // If we recently snapped after a momentum scroll, then ignore wheel events 9828 // to give time for the deceleration to finish. Stop ignoring after 500 msecs 9829 // or if it's a new scroll (larger delta or inverse sign as last event before 9830 // an end-of-momentum snap). 9831 const newEvent = { 9832 time: now(), 9833 delta: Math.abs(delta), 9834 direction: Math.sign(delta) 9835 }; 9836 const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; 9837 9838 if (!ignoreWheelEvents) { 9839 lastEventBeforeSnap = undefined; 9840 9841 if (swiper.params.loop) { 9842 swiper.loopFix(); 9843 } 9844 9845 let position = swiper.getTranslate() + delta * params.sensitivity; 9846 const wasBeginning = swiper.isBeginning; 9847 const wasEnd = swiper.isEnd; 9848 if (position >= swiper.minTranslate()) position = swiper.minTranslate(); 9849 if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); 9850 swiper.setTransition(0); 9851 swiper.setTranslate(position); 9852 swiper.updateProgress(); 9853 swiper.updateActiveIndex(); 9854 swiper.updateSlidesClasses(); 9855 9856 if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { 9857 swiper.updateSlidesClasses(); 9858 } 9859 9860 if (swiper.params.freeMode.sticky) { 9861 // When wheel scrolling starts with sticky (aka snap) enabled, then detect 9862 // the end of a momentum scroll by storing recent (N=15?) wheel events. 9863 // 1. do all N events have decreasing or same (absolute value) delta? 9864 // 2. did all N events arrive in the last M (M=500?) msecs? 9865 // 3. does the earliest event have an (absolute value) delta that's 9866 // at least P (P=1?) larger than the most recent event's delta? 9867 // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? 9868 // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. 9869 // Snap immediately and ignore remaining wheel events in this scroll. 9870 // See comment above for "remaining wheel events in this scroll" determination. 9871 // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. 9872 clearTimeout(timeout); 9873 timeout = undefined; 9874 9875 if (recentWheelEvents.length >= 15) { 9876 recentWheelEvents.shift(); // only store the last N events 9877 } 9878 9879 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 9880 const firstEvent = recentWheelEvents[0]; 9881 recentWheelEvents.push(newEvent); 9882 9883 if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { 9884 // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. 9885 recentWheelEvents.splice(0); 9886 } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { 9887 // We're at the end of the deceleration of a momentum scroll, so there's no need 9888 // to wait for more events. Snap ASAP on the next tick. 9889 // Also, because there's some remaining momentum we'll bias the snap in the 9890 // direction of the ongoing scroll because it's better UX for the scroll to snap 9891 // in the same direction as the scroll instead of reversing to snap. Therefore, 9892 // if it's already scrolled more than 20% in the current direction, keep going. 9893 const snapToThreshold = delta > 0 ? 0.8 : 0.2; 9894 lastEventBeforeSnap = newEvent; 9895 recentWheelEvents.splice(0); 9896 timeout = nextTick(() => { 9897 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 9898 }, 0); // no delay; move on next tick 9899 } 9900 9901 if (!timeout) { 9902 // if we get here, then we haven't detected the end of a momentum scroll, so 9903 // we'll consider a scroll "complete" when there haven't been any wheel events 9904 // for 500ms. 9905 timeout = nextTick(() => { 9906 const snapToThreshold = 0.5; 9907 lastEventBeforeSnap = newEvent; 9908 recentWheelEvents.splice(0); 9909 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 9910 }, 500); 9911 } 9912 } // Emit event 9913 9914 9915 if (!ignoreWheelEvents) emit('scroll', e); // Stop autoplay 9916 9917 if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions 9918 9919 if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true; 9920 } 9921 } 9922 9923 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 9924 return false; 9925 } 9926 9927 function events(method) { 9928 let target = swiper.$el; 9929 9930 if (swiper.params.mousewheel.eventsTarget !== 'container') { 9931 target = $(swiper.params.mousewheel.eventsTarget); 9932 } 9933 9934 target[method]('mouseenter', handleMouseEnter); 9935 target[method]('mouseleave', handleMouseLeave); 9936 target[method]('wheel', handle); 9937 } 9938 9939 function enable() { 9940 if (swiper.params.cssMode) { 9941 swiper.wrapperEl.removeEventListener('wheel', handle); 9942 return true; 9943 } 9944 9945 if (swiper.mousewheel.enabled) return false; 9946 events('on'); 9947 swiper.mousewheel.enabled = true; 9948 return true; 9949 } 9950 9951 function disable() { 9952 if (swiper.params.cssMode) { 9953 swiper.wrapperEl.addEventListener(event, handle); 9954 return true; 9955 } 9956 9957 if (!swiper.mousewheel.enabled) return false;
9958 events('off'); 9959 swiper.mousewheel.enabled = false; 9960 return true; 9961 } 9962 9963 on('init', () => { 9964 if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { 9965 disable(); 9966 } 9967 9968 if (swiper.params.mousewheel.enabled) enable(); 9969 }); 9970 on('destroy', () => { 9971 if (swiper.params.cssMode) { 9972 enable(); 9973 } 9974 9975 if (swiper.mousewheel.enabled) disable(); 9976 }); 9977 Object.assign(swiper.mousewheel, { 9978 enable, 9979 disable 9980 }); 9981} 9982;// CONCATENATED MODULE: ./node_modules/swiper/shared/create-element-if-not-defined.js 9983 9984function create_element_if_not_defined_createElementIfNotDefined(swiper, originalParams, params, checkProps) { 9985 const document = ssr_window_esm_getDocument(); 9986 9987 if (swiper.params.createElements) { 9988 Object.keys(checkProps).forEach(key => { 9989 if (!params[key] && params.auto === true) { 9990 let element = swiper.$el.children(`.${checkProps[key]}`)[0]; 9991 9992 if (!element) { 9993 element = document.createElement('div'); 9994 element.className = checkProps[key]; 9995 swiper.$el.append(element); 9996 } 9997 9998 params[key] = element; 9999 originalParams[key] = element; 10000 } 10001 }); 10002 } 10003 10004 return params; 10005} 10006;// CONCATENATED MODULE: ./node_modules/swiper/modules/navigation/navigation.js 10007 10008 10009function Navigation({ 10010 swiper, 10011 extendParams, 10012 on, 10013 emit 10014}) { 10015 extendParams({ 10016 navigation: { 10017 nextEl: null, 10018 prevEl: null, 10019 hideOnClick: false, 10020 disabledClass: 'swiper-button-disabled', 10021 hiddenClass: 'swiper-button-hidden', 10022 lockClass: 'swiper-button-lock' 10023 } 10024 }); 10025 swiper.navigation = { 10026 nextEl: null, 10027 $nextEl: null, 10028 prevEl: null, 10029 $prevEl: null 10030 }; 10031 10032 function getEl(el) { 10033 let $el; 10034 10035 if (el) { 10036 $el = dom(el); 10037 10038 if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) { 10039 $el = swiper.$el.find(el); 10040 } 10041 } 10042 10043 return $el; 10044 } 10045 10046 function toggleEl($el, disabled) { 10047 const params = swiper.params.navigation; 10048 10049 if ($el && $el.length > 0) { 10050 $el[disabled ? 'addClass' : 'removeClass'](params.disabledClass); 10051 if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled; 10052 10053 if (swiper.params.watchOverflow && swiper.enabled) { 10054 $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); 10055 } 10056 } 10057 } 10058 10059 function update() { 10060 // Update Navigation Buttons 10061 if (swiper.params.loop) return; 10062 const { 10063 $nextEl, 10064 $prevEl 10065 } = swiper.navigation; 10066 toggleEl($prevEl, swiper.isBeginning && !swiper.params.rewind); 10067 toggleEl($nextEl, swiper.isEnd && !swiper.params.rewind); 10068 } 10069 10070 function onPrevClick(e) { 10071 e.preventDefault(); 10072 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; 10073 swiper.slidePrev(); 10074 } 10075 10076 function onNextClick(e) { 10077 e.preventDefault(); 10078 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; 10079 swiper.slideNext(); 10080 } 10081 10082 function init() { 10083 const params = swiper.params.navigation; 10084 swiper.params.navigation = create_element_if_not_defined_createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { 10085 nextEl: 'swiper-button-next', 10086 prevEl: 'swiper-button-prev' 10087 }); 10088 if (!(params.nextEl || params.prevEl)) return; 10089 const $nextEl = getEl(params.nextEl); 10090 const $prevEl = getEl(params.prevEl); 10091 10092 if ($nextEl && $nextEl.length > 0) { 10093 $nextEl.on('click', onNextClick); 10094 } 10095 10096 if ($prevEl && $prevEl.length > 0) { 10097 $prevEl.on('click', onPrevClick); 10098 } 10099 10100 Object.assign(swiper.navigation, { 10101 $nextEl, 10102 nextEl: $nextEl && $nextEl[0], 10103 $prevEl, 10104 prevEl: $prevEl && $prevEl[0] 10105 }); 10106 10107 if (!swiper.enabled) { 10108 if ($nextEl) $nextEl.addClass(params.lockClass); 10109 if ($prevEl) $prevEl.addClass(params.lockClass); 10110 } 10111 } 10112 10113 function destroy() { 10114 const { 10115 $nextEl, 10116 $prevEl 10117 } = swiper.navigation; 10118 10119 if ($nextEl && $nextEl.length) { 10120 $nextEl.off('click', onNextClick); 10121 $nextEl.removeClass(swiper.params.navigation.disabledClass); 10122 } 10123 10124 if ($prevEl && $prevEl.length) { 10125 $prevEl.off('click', onPrevClick); 10126 $prevEl.removeClass(swiper.params.navigation.disabledClass); 10127 } 10128 } 10129 10130 on('init', () => { 10131 init(); 10132 update(); 10133 }); 10134 on('toEdge fromEdge lock unlock', () => { 10135 update(); 10136 }); 10137 on('destroy', () => { 10138 destroy(); 10139 }); 10140 on('enable disable', () => { 10141 const { 10142 $nextEl, 10143 $prevEl 10144 } = swiper.navigation; 10145 10146 if ($nextEl) { 10147 $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); 10148 } 10149 10150 if ($prevEl) { 10151 $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); 10152 } 10153 }); 10154 on('click', (_s, e) => { 10155 const { 10156 $nextEl, 10157 $prevEl 10158 } = swiper.navigation; 10159 const targetEl = e.target; 10160 10161 if (swiper.params.navigation.hideOnClick && !dom(targetEl).is($prevEl) && !dom(targetEl).is($nextEl)) { 10162 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; 10163 let isHidden; 10164 10165 if ($nextEl) { 10166 isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass); 10167 } else if ($prevEl) { 10168 isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass); 10169 } 10170 10171 if (isHidden === true) { 10172 emit('navigationShow'); 10173 } else { 10174 emit('navigationHide'); 10175 } 10176 10177 if ($nextEl) { 10178 $nextEl.toggleClass(swiper.params.navigation.hiddenClass); 10179 } 10180 10181 if ($prevEl) { 10182 $prevEl.toggleClass(swiper.params.navigation.hiddenClass); 10183 } 10184 } 10185 }); 10186 Object.assign(swiper.navigation, { 10187 update, 10188 init, 10189 destroy 10190 }); 10191} 10192;// CONCATENATED MODULE: ./node_modules/swiper/shared/classes-to-selector.js 10193function classes_to_selector_classesToSelector(classes = '') { 10194 return `.${classes.trim().replace(/([\.:!\/])/g, '\\$1') // eslint-disable-line 10195 .replace(/ /g, '.')}`; 10196} 10197;// CONCATENATED MODULE: ./node_modules/swiper/modules/pagination/pagination.js 10198 10199 10200 10201function Pagination({ 10202 swiper, 10203 extendParams, 10204 on, 10205 emit 10206}) { 10207 const pfx = 'swiper-pagination'; 10208 extendParams({ 10209 pagination: { 10210 el: null, 10211 bulletElement: 'span', 10212 clickable: false, 10213 hideOnClick: false, 10214 renderBullet: null, 10215 renderProgressbar: null, 10216 renderFraction: null, 10217 renderCustom: null, 10218 progressbarOpposite: false, 10219 type: 'bullets', 10220 // 'bullets' or 'progressbar' or 'fraction' or 'custom' 10221 dynamicBullets: false, 10222 dynamicMainBullets: 1, 10223 formatFractionCurrent: number => number, 10224 formatFractionTotal: number => number, 10225 bulletClass: `${pfx}-bullet`, 10226 bulletActiveClass: `${pfx}-bullet-active`, 10227 modifierClass: `${pfx}-`, 10228 currentClass: `${pfx}-current`, 10229 totalClass: `${pfx}-total`, 10230 hiddenClass: `${pfx}-hidden`, 10231 progressbarFillClass: `${pfx}-progressbar-fill`, 10232 progressbarOppositeClass: `${pfx}-progressbar-opposite`, 10233 clickableClass: `${pfx}-clickable`, 10234 lockClass: `${pfx}-lock`, 10235 horizontalClass: `${pfx}-horizontal`, 10236 verticalClass: `${pfx}-vertical` 10237 } 10238 }); 10239 swiper.pagination = { 10240 el: null, 10241 $el: null, 10242 bullets: [] 10243 }; 10244 let bulletSize; 10245 let dynamicBulletIndex = 0; 10246 10247 function isPaginationDisabled() { 10248 return !swiper.params.pagination.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0; 10249 } 10250 10251 function setSideBullets($bulletEl, position) { 10252 const { 10253 bulletActiveClass 10254 } = swiper.params.pagination; 10255 $bulletEl[position]().addClass(`${bulletActiveClass}-${position}`)[position]().addClass(`${bulletActiveClass}-${position}-${position}`); 10256 } 10257
vendor: 21,980 bytes, lines 10258-11009
10258 function update() { 10259 // Render || Update Pagination bullets/items 10260 const rtl = swiper.rtl; 10261 const params = swiper.params.pagination; 10262 if (isPaginationDisabled()) return; 10263 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 10264 const $el = swiper.pagination.$el; // Current/Total 10265 10266 let current; 10267 const total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 10268 10269 if (swiper.params.loop) { 10270 current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup); 10271 10272 if (current > slidesLength - 1 - swiper.loopedSlides * 2) { 10273 current -= slidesLength - swiper.loopedSlides * 2; 10274 } 10275 10276 if (current > total - 1) current -= total; 10277 if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current; 10278 } else if (typeof swiper.snapIndex !== 'undefined') { 10279 current = swiper.snapIndex; 10280 } else { 10281 current = swiper.activeIndex || 0; 10282 } // Types 10283 10284 10285 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 10286 const bullets = swiper.pagination.bullets; 10287 let firstIndex; 10288 let lastIndex; 10289 let midIndex; 10290 10291 if (params.dynamicBullets) { 10292 bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true); 10293 $el.css(swiper.isHorizontal() ? 'width' : 'height', `${bulletSize * (params.dynamicMainBullets + 4)}px`); 10294 10295 if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) { 10296 dynamicBulletIndex += current - (swiper.previousIndex - swiper.loopedSlides || 0); 10297 10298 if (dynamicBulletIndex > params.dynamicMainBullets - 1) { 10299 dynamicBulletIndex = params.dynamicMainBullets - 1; 10300 } else if (dynamicBulletIndex < 0) { 10301 dynamicBulletIndex = 0; 10302 } 10303 } 10304 10305 firstIndex = Math.max(current - dynamicBulletIndex, 0); 10306 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 10307 midIndex = (lastIndex + firstIndex) / 2; 10308 } 10309 10310 bullets.removeClass(['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`).join(' ')); 10311 10312 if ($el.length > 1) { 10313 bullets.each(bullet => { 10314 const $bullet = dom(bullet); 10315 const bulletIndex = $bullet.index(); 10316 10317 if (bulletIndex === current) { 10318 $bullet.addClass(params.bulletActiveClass); 10319 } 10320 10321 if (params.dynamicBullets) { 10322 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { 10323 $bullet.addClass(`${params.bulletActiveClass}-main`); 10324 } 10325 10326 if (bulletIndex === firstIndex) { 10327 setSideBullets($bullet, 'prev'); 10328 } 10329 10330 if (bulletIndex === lastIndex) { 10331 setSideBullets($bullet, 'next'); 10332 } 10333 } 10334 }); 10335 } else { 10336 const $bullet = bullets.eq(current); 10337 const bulletIndex = $bullet.index(); 10338 $bullet.addClass(params.bulletActiveClass); 10339 10340 if (params.dynamicBullets) { 10341 const $firstDisplayedBullet = bullets.eq(firstIndex); 10342 const $lastDisplayedBullet = bullets.eq(lastIndex); 10343 10344 for (let i = firstIndex; i <= lastIndex; i += 1) { 10345 bullets.eq(i).addClass(`${params.bulletActiveClass}-main`); 10346 } 10347 10348 if (swiper.params.loop) { 10349 if (bulletIndex >= bullets.length) { 10350 for (let i = params.dynamicMainBullets; i >= 0; i -= 1) { 10351 bullets.eq(bullets.length - i).addClass(`${params.bulletActiveClass}-main`); 10352 } 10353 10354 bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(`${params.bulletActiveClass}-prev`); 10355 } else { 10356 setSideBullets($firstDisplayedBullet, 'prev'); 10357 setSideBullets($lastDisplayedBullet, 'next'); 10358 } 10359 } else { 10360 setSideBullets($firstDisplayedBullet, 'prev'); 10361 setSideBullets($lastDisplayedBullet, 'next'); 10362 } 10363 } 10364 } 10365 10366 if (params.dynamicBullets) { 10367 const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 10368 const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; 10369 const offsetProp = rtl ? 'right' : 'left'; 10370 bullets.css(swiper.isHorizontal() ? offsetProp : 'top', `${bulletsOffset}px`); 10371 } 10372 } 10373 10374 if (params.type === 'fraction') { 10375 $el.find(classes_to_selector_classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1)); 10376 $el.find(classes_to_selector_classesToSelector(params.totalClass)).text(params.formatFractionTotal(total)); 10377 } 10378 10379 if (params.type === 'progressbar') { 10380 let progressbarDirection; 10381 10382 if (params.progressbarOpposite) { 10383 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 10384 } else { 10385 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 10386 } 10387 10388 const scale = (current + 1) / total; 10389 let scaleX = 1; 10390 let scaleY = 1; 10391 10392 if (progressbarDirection === 'horizontal') { 10393 scaleX = scale; 10394 } else { 10395 scaleY = scale; 10396 } 10397 10398 $el.find(classes_to_selector_classesToSelector(params.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`).transition(swiper.params.speed); 10399 } 10400 10401 if (params.type === 'custom' && params.renderCustom) { 10402 $el.html(params.renderCustom(swiper, current + 1, total)); 10403 emit('paginationRender', $el[0]); 10404 } else { 10405 emit('paginationUpdate', $el[0]); 10406 } 10407 10408 if (swiper.params.watchOverflow && swiper.enabled) { 10409 $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); 10410 } 10411 } 10412 10413 function render() { 10414 // Render Container 10415 const params = swiper.params.pagination; 10416 if (isPaginationDisabled()) return; 10417 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 10418 const $el = swiper.pagination.$el; 10419 let paginationHTML = ''; 10420 10421 if (params.type === 'bullets') { 10422 let numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 10423 10424 if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.loop && numberOfBullets > slidesLength) { 10425 numberOfBullets = slidesLength; 10426 } 10427 10428 for (let i = 0; i < numberOfBullets; i += 1) { 10429 if (params.renderBullet) { 10430 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); 10431 } else { 10432 paginationHTML += `<${params.bulletElement} class="${params.bulletClass}"></${params.bulletElement}>`; 10433 } 10434 } 10435 10436 $el.html(paginationHTML); 10437 swiper.pagination.bullets = $el.find(classes_to_selector_classesToSelector(params.bulletClass)); 10438 } 10439 10440 if (params.type === 'fraction') { 10441 if (params.renderFraction) { 10442 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 10443 } else { 10444 paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; 10445 } 10446 10447 $el.html(paginationHTML); 10448 } 10449 10450 if (params.type === 'progressbar') { 10451 if (params.renderProgressbar) { 10452 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 10453 } else { 10454 paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; 10455 } 10456 10457 $el.html(paginationHTML); 10458 } 10459 10460 if (params.type !== 'custom') { 10461 emit('paginationRender', swiper.pagination.$el[0]); 10462 } 10463 } 10464 10465 function init() { 10466 swiper.params.pagination = create_element_if_not_defined_createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { 10467 el: 'swiper-pagination' 10468 }); 10469 const params = swiper.params.pagination; 10470 if (!params.el) return; 10471 let $el = dom(params.el); 10472 if ($el.length === 0) return; 10473 10474 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) { 10475 $el = swiper.$el.find(params.el); // check if it belongs to another nested Swiper 10476 10477 if ($el.length > 1) { 10478 $el = $el.filter(el => { 10479 if (dom(el).parents('.swiper')[0] !== swiper.el) return false; 10480 return true; 10481 }); 10482 } 10483 } 10484 10485 if (params.type === 'bullets' && params.clickable) { 10486 $el.addClass(params.clickableClass); 10487 } 10488 10489 $el.addClass(params.modifierClass + params.type); 10490 $el.addClass(params.modifierClass + swiper.params.direction); 10491 10492 if (params.type === 'bullets' && params.dynamicBullets) { 10493 $el.addClass(`${params.modifierClass}${params.type}-dynamic`); 10494 dynamicBulletIndex = 0; 10495 10496 if (params.dynamicMainBullets < 1) { 10497 params.dynamicMainBullets = 1; 10498 } 10499 } 10500 10501 if (params.type === 'progressbar' && params.progressbarOpposite) { 10502 $el.addClass(params.progressbarOppositeClass); 10503 } 10504 10505 if (params.clickable) { 10506 $el.on('click', classes_to_selector_classesToSelector(params.bulletClass), function onClick(e) { 10507 e.preventDefault(); 10508 let index = dom(this).index() * swiper.params.slidesPerGroup; 10509 if (swiper.params.loop) index += swiper.loopedSlides; 10510 swiper.slideTo(index); 10511 }); 10512 } 10513 10514 Object.assign(swiper.pagination, { 10515 $el, 10516 el: $el[0] 10517 }); 10518 10519 if (!swiper.enabled) { 10520 $el.addClass(params.lockClass); 10521 } 10522 } 10523 10524 function destroy() { 10525 const params = swiper.params.pagination; 10526 if (isPaginationDisabled()) return; 10527 const $el = swiper.pagination.$el; 10528 $el.removeClass(params.hiddenClass); 10529 $el.removeClass(params.modifierClass + params.type); 10530 $el.removeClass(params.modifierClass + swiper.params.direction); 10531 if (swiper.pagination.bullets && swiper.pagination.bullets.removeClass) swiper.pagination.bullets.removeClass(params.bulletActiveClass); 10532 10533 if (params.clickable) { 10534 $el.off('click', classes_to_selector_classesToSelector(params.bulletClass)); 10535 } 10536 } 10537 10538 on('init', () => { 10539 init(); 10540 render(); 10541 update(); 10542 }); 10543 on('activeIndexChange', () => { 10544 if (swiper.params.loop) { 10545 update(); 10546 } else if (typeof swiper.snapIndex === 'undefined') { 10547 update(); 10548 } 10549 }); 10550 on('snapIndexChange', () => { 10551 if (!swiper.params.loop) { 10552 update(); 10553 } 10554 }); 10555 on('slidesLengthChange', () => { 10556 if (swiper.params.loop) { 10557 render(); 10558 update(); 10559 } 10560 }); 10561 on('snapGridLengthChange', () => { 10562 if (!swiper.params.loop) { 10563 render(); 10564 update(); 10565 } 10566 }); 10567 on('destroy', () => { 10568 destroy(); 10569 }); 10570 on('enable disable', () => { 10571 const { 10572 $el 10573 } = swiper.pagination; 10574 10575 if ($el) { 10576 $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass); 10577 } 10578 }); 10579 on('lock unlock', () => { 10580 update(); 10581 }); 10582 on('click', (_s, e) => { 10583 const targetEl = e.target; 10584 const { 10585 $el 10586 } = swiper.pagination; 10587 10588 if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && $el.length > 0 && !dom(targetEl).hasClass(swiper.params.pagination.bulletClass)) { 10589 if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; 10590 const isHidden = $el.hasClass(swiper.params.pagination.hiddenClass); 10591 10592 if (isHidden === true) { 10593 emit('paginationShow'); 10594 } else { 10595 emit('paginationHide'); 10596 } 10597 10598 $el.toggleClass(swiper.params.pagination.hiddenClass); 10599 } 10600 }); 10601 Object.assign(swiper.pagination, { 10602 render, 10603 update, 10604 init, 10605 destroy 10606 }); 10607} 10608;// CONCATENATED MODULE: ./node_modules/swiper/modules/scrollbar/scrollbar.js 10609 10610 10611 10612 10613function Scrollbar({ 10614 swiper, 10615 extendParams, 10616 on, 10617 emit 10618}) { 10619 const document = getDocument(); 10620 let isTouched = false; 10621 let timeout = null; 10622 let dragTimeout = null; 10623 let dragStartPos; 10624 let dragSize; 10625 let trackSize; 10626 let divider; 10627 extendParams({ 10628 scrollbar: { 10629 el: null, 10630 dragSize: 'auto', 10631 hide: false, 10632 draggable: false, 10633 snapOnRelease: true, 10634 lockClass: 'swiper-scrollbar-lock', 10635 dragClass: 'swiper-scrollbar-drag' 10636 } 10637 }); 10638 swiper.scrollbar = { 10639 el: null, 10640 dragEl: null, 10641 $el: null, 10642 $dragEl: null 10643 }; 10644 10645 function setTranslate() { 10646 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10647 const { 10648 scrollbar, 10649 rtlTranslate: rtl, 10650 progress 10651 } = swiper; 10652 const { 10653 $dragEl, 10654 $el 10655 } = scrollbar; 10656 const params = swiper.params.scrollbar; 10657 let newSize = dragSize; 10658 let newPos = (trackSize - dragSize) * progress; 10659 10660 if (rtl) { 10661 newPos = -newPos; 10662 10663 if (newPos > 0) { 10664 newSize = dragSize - newPos; 10665 newPos = 0; 10666 } else if (-newPos + dragSize > trackSize) { 10667 newSize = trackSize + newPos; 10668 } 10669 } else if (newPos < 0) { 10670 newSize = dragSize + newPos; 10671 newPos = 0; 10672 } else if (newPos + dragSize > trackSize) { 10673 newSize = trackSize - newPos; 10674 } 10675 10676 if (swiper.isHorizontal()) { 10677 $dragEl.transform(`translate3d(${newPos}px, 0, 0)`); 10678 $dragEl[0].style.width = `${newSize}px`; 10679 } else { 10680 $dragEl.transform(`translate3d(0px, ${newPos}px, 0)`); 10681 $dragEl[0].style.height = `${newSize}px`; 10682 } 10683 10684 if (params.hide) { 10685 clearTimeout(timeout); 10686 $el[0].style.opacity = 1; 10687 timeout = setTimeout(() => { 10688 $el[0].style.opacity = 0; 10689 $el.transition(400); 10690 }, 1000); 10691 } 10692 } 10693 10694 function setTransition(duration) { 10695 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10696 swiper.scrollbar.$dragEl.transition(duration); 10697 } 10698 10699 function updateSize() { 10700 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10701 const { 10702 scrollbar 10703 } = swiper; 10704 const { 10705 $dragEl, 10706 $el 10707 } = scrollbar; 10708 $dragEl[0].style.width = ''; 10709 $dragEl[0].style.height = ''; 10710 trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; 10711 divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); 10712 10713 if (swiper.params.scrollbar.dragSize === 'auto') { 10714 dragSize = trackSize * divider; 10715 } else { 10716 dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); 10717 } 10718 10719 if (swiper.isHorizontal()) { 10720 $dragEl[0].style.width = `${dragSize}px`; 10721 } else { 10722 $dragEl[0].style.height = `${dragSize}px`; 10723 } 10724 10725 if (divider >= 1) { 10726 $el[0].style.display = 'none'; 10727 } else { 10728 $el[0].style.display = ''; 10729 } 10730 10731 if (swiper.params.scrollbar.hide) { 10732 $el[0].style.opacity = 0; 10733 } 10734 10735 if (swiper.params.watchOverflow && swiper.enabled) { 10736 scrollbar.$el[swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass); 10737 } 10738 } 10739 10740 function getPointerPosition(e) { 10741 if (swiper.isHorizontal()) { 10742 return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX; 10743 } 10744 10745 return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY; 10746 } 10747 10748 function setDragPosition(e) { 10749 const { 10750 scrollbar, 10751 rtlTranslate: rtl 10752 } = swiper; 10753 const { 10754 $el 10755 } = scrollbar; 10756 let positionRatio; 10757 positionRatio = (getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); 10758 positionRatio = Math.max(Math.min(positionRatio, 1), 0); 10759 10760 if (rtl) { 10761 positionRatio = 1 - positionRatio; 10762 } 10763 10764 const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; 10765 swiper.updateProgress(position); 10766 swiper.setTranslate(position); 10767 swiper.updateActiveIndex(); 10768 swiper.updateSlidesClasses(); 10769 } 10770 10771 function onDragStart(e) { 10772 const params = swiper.params.scrollbar; 10773 const { 10774 scrollbar, 10775 $wrapperEl 10776 } = swiper; 10777 const { 10778 $el, 10779 $dragEl 10780 } = scrollbar; 10781 isTouched = true; 10782 dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; 10783 e.preventDefault(); 10784 e.stopPropagation(); 10785 $wrapperEl.transition(100); 10786 $dragEl.transition(100); 10787 setDragPosition(e); 10788 clearTimeout(dragTimeout); 10789 $el.transition(0); 10790 10791 if (params.hide) { 10792 $el.css('opacity', 1); 10793 } 10794 10795 if (swiper.params.cssMode) { 10796 swiper.$wrapperEl.css('scroll-snap-type', 'none'); 10797 } 10798 10799 emit('scrollbarDragStart', e); 10800 } 10801 10802 function onDragMove(e) { 10803 const { 10804 scrollbar, 10805 $wrapperEl 10806 } = swiper; 10807 const { 10808 $el, 10809 $dragEl 10810 } = scrollbar; 10811 if (!isTouched) return; 10812 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 10813 setDragPosition(e); 10814 $wrapperEl.transition(0); 10815 $el.transition(0); 10816 $dragEl.transition(0); 10817 emit('scrollbarDragMove', e); 10818 } 10819 10820 function onDragEnd(e) { 10821 const params = swiper.params.scrollbar; 10822 const { 10823 scrollbar, 10824 $wrapperEl 10825 } = swiper; 10826 const { 10827 $el 10828 } = scrollbar; 10829 if (!isTouched) return; 10830 isTouched = false; 10831 10832 if (swiper.params.cssMode) { 10833 swiper.$wrapperEl.css('scroll-snap-type', ''); 10834 $wrapperEl.transition(''); 10835 } 10836 10837 if (params.hide) { 10838 clearTimeout(dragTimeout); 10839 dragTimeout = nextTick(() => { 10840 $el.css('opacity', 0); 10841 $el.transition(400); 10842 }, 1000); 10843 } 10844 10845 emit('scrollbarDragEnd', e); 10846 10847 if (params.snapOnRelease) { 10848 swiper.slideToClosest(); 10849 } 10850 } 10851 10852 function events(method) { 10853 const { 10854 scrollbar, 10855 touchEventsTouch, 10856 touchEventsDesktop, 10857 params, 10858 support 10859 } = swiper; 10860 const $el = scrollbar.$el; 10861 const target = $el[0]; 10862 const activeListener = support.passiveListener && params.passiveListeners ? { 10863 passive: false, 10864 capture: false 10865 } : false; 10866 const passiveListener = support.passiveListener && params.passiveListeners ? { 10867 passive: true, 10868 capture: false 10869 } : false; 10870 if (!target) return; 10871 const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 10872 10873 if (!support.touch) { 10874 target[eventMethod](touchEventsDesktop.start, onDragStart, activeListener); 10875 document[eventMethod](touchEventsDesktop.move, onDragMove, activeListener); 10876 document[eventMethod](touchEventsDesktop.end, onDragEnd, passiveListener); 10877 } else { 10878 target[eventMethod](touchEventsTouch.start, onDragStart, activeListener); 10879 target[eventMethod](touchEventsTouch.move, onDragMove, activeListener); 10880 target[eventMethod](touchEventsTouch.end, onDragEnd, passiveListener); 10881 } 10882 } 10883 10884 function enableDraggable() { 10885 if (!swiper.params.scrollbar.el) return; 10886 events('on'); 10887 } 10888 10889 function disableDraggable() { 10890 if (!swiper.params.scrollbar.el) return; 10891 events('off'); 10892 } 10893 10894 function init() { 10895 const { 10896 scrollbar, 10897 $el: $swiperEl 10898 } = swiper; 10899 swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { 10900 el: 'swiper-scrollbar' 10901 }); 10902 const params = swiper.params.scrollbar; 10903 if (!params.el) return; 10904 let $el = $(params.el); 10905 10906 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) { 10907 $el = $swiperEl.find(params.el); 10908 } 10909 10910 let $dragEl = $el.find(`.${swiper.params.scrollbar.dragClass}`); 10911 10912 if ($dragEl.length === 0) { 10913 $dragEl = $(`<div class="${swiper.params.scrollbar.dragClass}"></div>`); 10914 $el.append($dragEl); 10915 } 10916 10917 Object.assign(scrollbar, { 10918 $el, 10919 el: $el[0], 10920 $dragEl, 10921 dragEl: $dragEl[0] 10922 }); 10923 10924 if (params.draggable) { 10925 enableDraggable(); 10926 } 10927 10928 if ($el) { 10929 $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); 10930 } 10931 } 10932 10933 function destroy() { 10934 disableDraggable(); 10935 } 10936 10937 on('init', () => { 10938 init(); 10939 updateSize(); 10940 setTranslate(); 10941 }); 10942 on('update resize observerUpdate lock unlock', () => { 10943 updateSize(); 10944 }); 10945 on('setTranslate', () => { 10946 setTranslate(); 10947 }); 10948 on('setTransition', (_s, duration) => { 10949 setTransition(duration); 10950 }); 10951 on('enable disable', () => { 10952 const { 10953 $el 10954 } = swiper.scrollbar; 10955 10956 if ($el) { 10957 $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); 10958 } 10959 }); 10960 on('destroy', () => { 10961 destroy(); 10962 }); 10963 Object.assign(swiper.scrollbar, { 10964 updateSize, 10965 setTranslate, 10966 init, 10967 destroy 10968 }); 10969} 10970;// CONCATENATED MODULE: ./node_modules/swiper/modules/parallax/parallax.js 10971 10972function Parallax({ 10973 swiper, 10974 extendParams, 10975 on 10976}) { 10977 extendParams({ 10978 parallax: { 10979 enabled: false 10980 } 10981 }); 10982 10983 const setTransform = (el, progress) => { 10984 const { 10985 rtl 10986 } = swiper; 10987 const $el = $(el); 10988 const rtlFactor = rtl ? -1 : 1; 10989 const p = $el.attr('data-swiper-parallax') || '0'; 10990 let x = $el.attr('data-swiper-parallax-x'); 10991 let y = $el.attr('data-swiper-parallax-y'); 10992 const scale = $el.attr('data-swiper-parallax-scale'); 10993 const opacity = $el.attr('data-swiper-parallax-opacity'); 10994 10995 if (x || y) { 10996 x = x || '0'; 10997 y = y || '0'; 10998 } else if (swiper.isHorizontal()) { 10999 x = p; 11000 y = '0'; 11001 } else { 11002 y = p; 11003 x = '0'; 11004 } 11005 11006 if (x.indexOf('%') >= 0) { 11007 x = `${parseInt(x, 10) * progress * rtlFactor}%`; 11008 } else { 11009 x = `${x * progress * rtlFactor}px`;
11010 } 11011 11012 if (y.indexOf('%') >= 0) { 11013 y = `${parseInt(y, 10) * progress}%`; 11014 } else { 11015 y = `${y * progress}px`; 11016 } 11017 11018 if (typeof opacity !== 'undefined' && opacity !== null) { 11019 const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); 11020 $el[0].style.opacity = currentOpacity; 11021 } 11022 11023 if (typeof scale === 'undefined' || scale === null) { 11024 $el.transform(`translate3d(${x}, ${y}, 0px)`); 11025 } else { 11026 const currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); 11027 $el.transform(`translate3d(${x}, ${y}, 0px) scale(${currentScale})`); 11028 } 11029 }; 11030 11031 const setTranslate = () => { 11032 const { 11033 $el, 11034 slides, 11035 progress, 11036 snapGrid 11037 } = swiper; 11038 $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => { 11039 setTransform(el, progress); 11040 }); 11041 slides.each((slideEl, slideIndex) => { 11042 let slideProgress = slideEl.progress; 11043 11044 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { 11045 slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); 11046 } 11047 11048 slideProgress = Math.min(Math.max(slideProgress, -1), 1); 11049 $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => { 11050 setTransform(el, slideProgress); 11051 }); 11052 }); 11053 }; 11054 11055 const setTransition = (duration = swiper.params.speed) => { 11056 const { 11057 $el 11058 } = swiper; 11059 $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(parallaxEl => { 11060 const $parallaxEl = $(parallaxEl); 11061 let parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration; 11062 if (duration === 0) parallaxDuration = 0; 11063 $parallaxEl.transition(parallaxDuration); 11064 }); 11065 }; 11066 11067 on('beforeInit', () => { 11068 if (!swiper.params.parallax.enabled) return; 11069 swiper.params.watchSlidesProgress = true; 11070 swiper.originalParams.watchSlidesProgress = true; 11071 }); 11072 on('init', () => { 11073 if (!swiper.params.parallax.enabled) return; 11074 setTranslate(); 11075 }); 11076 on('setTranslate', () => { 11077 if (!swiper.params.parallax.enabled) return; 11078 setTranslate(); 11079 }); 11080 on('setTransition', (_swiper, duration) => { 11081 if (!swiper.params.parallax.enabled) return; 11082 setTransition(duration); 11083 }); 11084} 11085;// CONCATENATED MODULE: ./node_modules/swiper/modules/zoom/zoom.js 11086 11087 11088 11089function Zoom({ 11090 swiper, 11091 extendParams, 11092 on, 11093 emit 11094}) { 11095 const window = getWindow(); 11096 extendParams({ 11097 zoom: { 11098 enabled: false, 11099 maxRatio: 3, 11100 minRatio: 1, 11101 toggle: true, 11102 containerClass: 'swiper-zoom-container', 11103 zoomedSlideClass: 'swiper-slide-zoomed' 11104 } 11105 }); 11106 swiper.zoom = { 11107 enabled: false 11108 }; 11109 let currentScale = 1; 11110 let isScaling = false; 11111 let gesturesEnabled; 11112 let fakeGestureTouched; 11113 let fakeGestureMoved; 11114 const gesture = { 11115 $slideEl: undefined, 11116 slideWidth: undefined, 11117 slideHeight: undefined, 11118 $imageEl: undefined, 11119 $imageWrapEl: undefined, 11120 maxRatio: 3 11121 }; 11122 const image = { 11123 isTouched: undefined, 11124 isMoved: undefined, 11125 currentX: undefined, 11126 currentY: undefined, 11127 minX: undefined, 11128 minY: undefined, 11129 maxX: undefined, 11130 maxY: undefined, 11131 width: undefined, 11132 height: undefined, 11133 startX: undefined, 11134 startY: undefined, 11135 touchesStart: {}, 11136 touchesCurrent: {} 11137 }; 11138 const velocity = { 11139 x: undefined, 11140 y: undefined, 11141 prevPositionX: undefined, 11142 prevPositionY: undefined, 11143 prevTime: undefined 11144 }; 11145 let scale = 1; 11146 Object.defineProperty(swiper.zoom, 'scale', { 11147 get() { 11148 return scale; 11149 }, 11150 11151 set(value) { 11152 if (scale !== value) { 11153 const imageEl = gesture.$imageEl ? gesture.$imageEl[0] : undefined; 11154 const slideEl = gesture.$slideEl ? gesture.$slideEl[0] : undefined; 11155 emit('zoomChange', value, imageEl, slideEl); 11156 } 11157 11158 scale = value; 11159 } 11160 11161 }); 11162 11163 function getDistanceBetweenTouches(e) { 11164 if (e.targetTouches.length < 2) return 1; 11165 const x1 = e.targetTouches[0].pageX; 11166 const y1 = e.targetTouches[0].pageY; 11167 const x2 = e.targetTouches[1].pageX; 11168 const y2 = e.targetTouches[1].pageY; 11169 const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2); 11170 return distance; 11171 } // Events 11172 11173 11174 function onGestureStart(e) { 11175 const support = swiper.support; 11176 const params = swiper.params.zoom; 11177 fakeGestureTouched = false;
vendor: 18,929 bytes, lines 11178-11722
11178 fakeGestureMoved = false; 11179 11180 if (!support.gestures) { 11181 if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) { 11182 return; 11183 } 11184 11185 fakeGestureTouched = true; 11186 gesture.scaleStart = getDistanceBetweenTouches(e); 11187 } 11188 11189 if (!gesture.$slideEl || !gesture.$slideEl.length) { 11190 gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); 11191 if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); 11192 gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); 11193 gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); 11194 gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 11195 11196 if (gesture.$imageWrapEl.length === 0) { 11197 gesture.$imageEl = undefined; 11198 return; 11199 } 11200 } 11201 11202 if (gesture.$imageEl) { 11203 gesture.$imageEl.transition(0); 11204 } 11205 11206 isScaling = true; 11207 } 11208 11209 function onGestureChange(e) { 11210 const support = swiper.support; 11211 const params = swiper.params.zoom; 11212 const zoom = swiper.zoom; 11213 11214 if (!support.gestures) { 11215 if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) { 11216 return; 11217 } 11218 11219 fakeGestureMoved = true; 11220 gesture.scaleMove = getDistanceBetweenTouches(e); 11221 } 11222 11223 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { 11224 if (e.type === 'gesturechange') onGestureStart(e); 11225 return; 11226 } 11227 11228 if (support.gestures) { 11229 zoom.scale = e.scale * currentScale; 11230 } else { 11231 zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; 11232 } 11233 11234 if (zoom.scale > gesture.maxRatio) { 11235 zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5; 11236 } 11237 11238 if (zoom.scale < params.minRatio) { 11239 zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5; 11240 } 11241 11242 gesture.$imageEl.transform(`translate3d(0,0,0) scale(${zoom.scale})`); 11243 } 11244 11245 function onGestureEnd(e) { 11246 const device = swiper.device; 11247 const support = swiper.support; 11248 const params = swiper.params.zoom; 11249 const zoom = swiper.zoom; 11250 11251 if (!support.gestures) { 11252 if (!fakeGestureTouched || !fakeGestureMoved) { 11253 return; 11254 } 11255 11256 if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2 && !device.android) { 11257 return; 11258 } 11259 11260 fakeGestureTouched = false; 11261 fakeGestureMoved = false; 11262 } 11263 11264 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 11265 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); 11266 gesture.$imageEl.transition(swiper.params.speed).transform(`translate3d(0,0,0) scale(${zoom.scale})`); 11267 currentScale = zoom.scale; 11268 isScaling = false; 11269 if (zoom.scale === 1) gesture.$slideEl = undefined; 11270 } 11271 11272 function onTouchStart(e) { 11273 const device = swiper.device; 11274 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 11275 if (image.isTouched) return; 11276 if (device.android && e.cancelable) e.preventDefault(); 11277 image.isTouched = true; 11278 image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; 11279 image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; 11280 } 11281 11282 function onTouchMove(e) { 11283 const zoom = swiper.zoom; 11284 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 11285 swiper.allowClick = false; 11286 if (!image.isTouched || !gesture.$slideEl) return; 11287 11288 if (!image.isMoved) { 11289 image.width = gesture.$imageEl[0].offsetWidth; 11290 image.height = gesture.$imageEl[0].offsetHeight; 11291 image.startX = getTranslate(gesture.$imageWrapEl[0], 'x') || 0; 11292 image.startY = getTranslate(gesture.$imageWrapEl[0], 'y') || 0; 11293 gesture.slideWidth = gesture.$slideEl[0].offsetWidth; 11294 gesture.slideHeight = gesture.$slideEl[0].offsetHeight; 11295 gesture.$imageWrapEl.transition(0); 11296 } // Define if we need image drag 11297 11298 11299 const scaledWidth = image.width * zoom.scale; 11300 const scaledHeight = image.height * zoom.scale; 11301 if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return; 11302 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 11303 image.maxX = -image.minX; 11304 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 11305 image.maxY = -image.minY; 11306 image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; 11307 image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; 11308 11309 if (!image.isMoved && !isScaling) { 11310 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)) { 11311 image.isTouched = false; 11312 return; 11313 } 11314 11315 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)) { 11316 image.isTouched = false; 11317 return; 11318 } 11319 } 11320 11321 if (e.cancelable) { 11322 e.preventDefault(); 11323 } 11324 11325 e.stopPropagation(); 11326 image.isMoved = true; 11327 image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX; 11328 image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY; 11329 11330 if (image.currentX < image.minX) { 11331 image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8; 11332 } 11333 11334 if (image.currentX > image.maxX) { 11335 image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8; 11336 } 11337 11338 if (image.currentY < image.minY) { 11339 image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8; 11340 } 11341 11342 if (image.currentY > image.maxY) { 11343 image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8; 11344 } // Velocity 11345 11346 11347 if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; 11348 if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; 11349 if (!velocity.prevTime) velocity.prevTime = Date.now(); 11350 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; 11351 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; 11352 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; 11353 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; 11354 velocity.prevPositionX = image.touchesCurrent.x; 11355 velocity.prevPositionY = image.touchesCurrent.y; 11356 velocity.prevTime = Date.now(); 11357 gesture.$imageWrapEl.transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); 11358 } 11359 11360 function onTouchEnd() { 11361 const zoom = swiper.zoom; 11362 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 11363 11364 if (!image.isTouched || !image.isMoved) { 11365 image.isTouched = false; 11366 image.isMoved = false; 11367 return; 11368 } 11369 11370 image.isTouched = false; 11371 image.isMoved = false; 11372 let momentumDurationX = 300; 11373 let momentumDurationY = 300; 11374 const momentumDistanceX = velocity.x * momentumDurationX; 11375 const newPositionX = image.currentX + momentumDistanceX; 11376 const momentumDistanceY = velocity.y * momentumDurationY; 11377 const newPositionY = image.currentY + momentumDistanceY; // Fix duration 11378 11379 if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); 11380 if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); 11381 const momentumDuration = Math.max(momentumDurationX, momentumDurationY); 11382 image.currentX = newPositionX; 11383 image.currentY = newPositionY; // Define if we need image drag 11384 11385 const scaledWidth = image.width * zoom.scale; 11386 const scaledHeight = image.height * zoom.scale; 11387 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 11388 image.maxX = -image.minX; 11389 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 11390 image.maxY = -image.minY; 11391 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); 11392 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); 11393 gesture.$imageWrapEl.transition(momentumDuration).transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); 11394 } 11395 11396 function onTransitionEnd() { 11397 const zoom = swiper.zoom; 11398 11399 if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) { 11400 if (gesture.$imageEl) { 11401 gesture.$imageEl.transform('translate3d(0,0,0) scale(1)'); 11402 } 11403 11404 if (gesture.$imageWrapEl) { 11405 gesture.$imageWrapEl.transform('translate3d(0,0,0)'); 11406 } 11407 11408 zoom.scale = 1; 11409 currentScale = 1; 11410 gesture.$slideEl = undefined; 11411 gesture.$imageEl = undefined; 11412 gesture.$imageWrapEl = undefined; 11413 } 11414 } 11415 11416 function zoomIn(e) { 11417 const zoom = swiper.zoom; 11418 const params = swiper.params.zoom; 11419 11420 if (!gesture.$slideEl) { 11421 if (e && e.target) { 11422 gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); 11423 } 11424 11425 if (!gesture.$slideEl) { 11426 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 11427 gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); 11428 } else { 11429 gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); 11430 } 11431 } 11432 11433 gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); 11434 gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); 11435 } 11436 11437 if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; 11438 11439 if (swiper.params.cssMode) { 11440 swiper.wrapperEl.style.overflow = 'hidden'; 11441 swiper.wrapperEl.style.touchAction = 'none'; 11442 } 11443 11444 gesture.$slideEl.addClass(`${params.zoomedSlideClass}`); 11445 let touchX; 11446 let touchY; 11447 let offsetX; 11448 let offsetY; 11449 let diffX; 11450 let diffY; 11451 let translateX; 11452 let translateY; 11453 let imageWidth; 11454 let imageHeight; 11455 let scaledWidth; 11456 let scaledHeight; 11457 let translateMinX; 11458 let translateMinY; 11459 let translateMaxX; 11460 let translateMaxY; 11461 let slideWidth; 11462 let slideHeight; 11463 11464 if (typeof image.touchesStart.x === 'undefined' && e) { 11465 touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX; 11466 touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY; 11467 } else { 11468 touchX = image.touchesStart.x; 11469 touchY = image.touchesStart.y; 11470 } 11471 11472 zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 11473 currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 11474 11475 if (e) { 11476 slideWidth = gesture.$slideEl[0].offsetWidth; 11477 slideHeight = gesture.$slideEl[0].offsetHeight; 11478 offsetX = gesture.$slideEl.offset().left + window.scrollX; 11479 offsetY = gesture.$slideEl.offset().top + window.scrollY; 11480 diffX = offsetX + slideWidth / 2 - touchX; 11481 diffY = offsetY + slideHeight / 2 - touchY; 11482 imageWidth = gesture.$imageEl[0].offsetWidth; 11483 imageHeight = gesture.$imageEl[0].offsetHeight; 11484 scaledWidth = imageWidth * zoom.scale; 11485 scaledHeight = imageHeight * zoom.scale; 11486 translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 11487 translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 11488 translateMaxX = -translateMinX; 11489 translateMaxY = -translateMinY; 11490 translateX = diffX * zoom.scale; 11491 translateY = diffY * zoom.scale; 11492 11493 if (translateX < translateMinX) { 11494 translateX = translateMinX; 11495 } 11496 11497 if (translateX > translateMaxX) { 11498 translateX = translateMaxX; 11499 } 11500 11501 if (translateY < translateMinY) { 11502 translateY = translateMinY; 11503 } 11504 11505 if (translateY > translateMaxY) { 11506 translateY = translateMaxY; 11507 } 11508 } else { 11509 translateX = 0; 11510 translateY = 0; 11511 } 11512 11513 gesture.$imageWrapEl.transition(300).transform(`translate3d(${translateX}px, ${translateY}px,0)`); 11514 gesture.$imageEl.transition(300).transform(`translate3d(0,0,0) scale(${zoom.scale})`); 11515 } 11516 11517 function zoomOut() { 11518 const zoom = swiper.zoom; 11519 const params = swiper.params.zoom; 11520 11521 if (!gesture.$slideEl) { 11522 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 11523 gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); 11524 } else { 11525 gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); 11526 } 11527 11528 gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); 11529 gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); 11530 } 11531 11532 if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; 11533 11534 if (swiper.params.cssMode) { 11535 swiper.wrapperEl.style.overflow = ''; 11536 swiper.wrapperEl.style.touchAction = ''; 11537 } 11538 11539 zoom.scale = 1; 11540 currentScale = 1; 11541 gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)'); 11542 gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)'); 11543 gesture.$slideEl.removeClass(`${params.zoomedSlideClass}`); 11544 gesture.$slideEl = undefined; 11545 } // Toggle Zoom 11546 11547 11548 function zoomToggle(e) { 11549 const zoom = swiper.zoom; 11550 11551 if (zoom.scale && zoom.scale !== 1) { 11552 // Zoom Out 11553 zoomOut(); 11554 } else { 11555 // Zoom In 11556 zoomIn(e); 11557 } 11558 } 11559 11560 function getListeners() { 11561 const support = swiper.support; 11562 const passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? { 11563 passive: true, 11564 capture: false 11565 } : false; 11566 const activeListenerWithCapture = support.passiveListener ? { 11567 passive: false, 11568 capture: true 11569 } : true; 11570 return { 11571 passiveListener, 11572 activeListenerWithCapture 11573 }; 11574 } 11575 11576 function getSlideSelector() { 11577 return `.${swiper.params.slideClass}`; 11578 } 11579 11580 function toggleGestures(method) { 11581 const { 11582 passiveListener 11583 } = getListeners(); 11584 const slideSelector = getSlideSelector(); 11585 swiper.$wrapperEl[method]('gesturestart', slideSelector, onGestureStart, passiveListener); 11586 swiper.$wrapperEl[method]('gesturechange', slideSelector, onGestureChange, passiveListener); 11587 swiper.$wrapperEl[method]('gestureend', slideSelector, onGestureEnd, passiveListener); 11588 } 11589 11590 function enableGestures() { 11591 if (gesturesEnabled) return; 11592 gesturesEnabled = true; 11593 toggleGestures('on'); 11594 } 11595 11596 function disableGestures() { 11597 if (!gesturesEnabled) return; 11598 gesturesEnabled = false; 11599 toggleGestures('off'); 11600 } // Attach/Detach Events 11601 11602 11603 function enable() { 11604 const zoom = swiper.zoom; 11605 if (zoom.enabled) return; 11606 zoom.enabled = true; 11607 const support = swiper.support; 11608 const { 11609 passiveListener, 11610 activeListenerWithCapture 11611 } = getListeners(); 11612 const slideSelector = getSlideSelector(); // Scale image 11613 11614 if (support.gestures) { 11615 swiper.$wrapperEl.on(swiper.touchEvents.start, enableGestures, passiveListener); 11616 swiper.$wrapperEl.on(swiper.touchEvents.end, disableGestures, passiveListener); 11617 } else if (swiper.touchEvents.start === 'touchstart') { 11618 swiper.$wrapperEl.on(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); 11619 swiper.$wrapperEl.on(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); 11620 swiper.$wrapperEl.on(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); 11621 11622 if (swiper.touchEvents.cancel) { 11623 swiper.$wrapperEl.on(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); 11624 } 11625 } // Move image 11626 11627 11628 swiper.$wrapperEl.on(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); 11629 } 11630 11631 function disable() { 11632 const zoom = swiper.zoom; 11633 if (!zoom.enabled) return; 11634 const support = swiper.support; 11635 zoom.enabled = false; 11636 const { 11637 passiveListener, 11638 activeListenerWithCapture 11639 } = getListeners(); 11640 const slideSelector = getSlideSelector(); // Scale image 11641 11642 if (support.gestures) { 11643 swiper.$wrapperEl.off(swiper.touchEvents.start, enableGestures, passiveListener); 11644 swiper.$wrapperEl.off(swiper.touchEvents.end, disableGestures, passiveListener); 11645 } else if (swiper.touchEvents.start === 'touchstart') { 11646 swiper.$wrapperEl.off(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); 11647 swiper.$wrapperEl.off(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); 11648 swiper.$wrapperEl.off(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); 11649 11650 if (swiper.touchEvents.cancel) { 11651 swiper.$wrapperEl.off(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); 11652 } 11653 } // Move image 11654 11655 11656 swiper.$wrapperEl.off(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); 11657 } 11658 11659 on('init', () => { 11660 if (swiper.params.zoom.enabled) { 11661 enable(); 11662 } 11663 }); 11664 on('destroy', () => { 11665 disable(); 11666 }); 11667 on('touchStart', (_s, e) => { 11668 if (!swiper.zoom.enabled) return; 11669 onTouchStart(e); 11670 }); 11671 on('touchEnd', (_s, e) => { 11672 if (!swiper.zoom.enabled) return; 11673 onTouchEnd(e); 11674 }); 11675 on('doubleTap', (_s, e) => { 11676 if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { 11677 zoomToggle(e); 11678 } 11679 }); 11680 on('transitionEnd', () => { 11681 if (swiper.zoom.enabled && swiper.params.zoom.enabled) { 11682 onTransitionEnd(); 11683 } 11684 }); 11685 on('slideChange', () => { 11686 if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { 11687 onTransitionEnd(); 11688 } 11689 }); 11690 Object.assign(swiper.zoom, { 11691 enable, 11692 disable, 11693 in: zoomIn, 11694 out: zoomOut, 11695 toggle: zoomToggle 11696 }); 11697} 11698;// CONCATENATED MODULE: ./node_modules/swiper/modules/lazy/lazy.js 11699 11700 11701function Lazy({ 11702 swiper, 11703 extendParams, 11704 on, 11705 emit 11706}) { 11707 extendParams({ 11708 lazy: { 11709 checkInView: false, 11710 enabled: false, 11711 loadPrevNext: false, 11712 loadPrevNextAmount: 1, 11713 loadOnTransitionStart: false, 11714 scrollingElement: '', 11715 elementClass: 'swiper-lazy', 11716 loadingClass: 'swiper-lazy-loading', 11717 loadedClass: 'swiper-lazy-loaded', 11718 preloaderClass: 'swiper-lazy-preloader' 11719 } 11720 }); 11721 swiper.lazy = {}; 11722 let scrollHandlerAttached = false;
11723 let initialImageLoaded = false; 11724 11725 function loadInSlide(index, loadInDuplicate = true) { 11726 const params = swiper.params.lazy; 11727 if (typeof index === 'undefined') return; 11728 if (swiper.slides.length === 0) return; 11729 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 11730 const $slideEl = isVirtual ? swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-swiper-slide-index="${index}"]`) : swiper.slides.eq(index); 11731 const $images = $slideEl.find(`.${params.elementClass}:not(.${params.loadedClass}):not(.${params.loadingClass})`); 11732 11733 if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) { 11734 $images.push($slideEl[0]); 11735 } 11736 11737 if ($images.length === 0) return; 11738 $images.each(imageEl => { 11739 const $imageEl = $(imageEl); 11740 $imageEl.addClass(params.loadingClass); 11741 const background = $imageEl.attr('data-background'); 11742 const src = $imageEl.attr('data-src'); 11743 const srcset = $imageEl.attr('data-srcset'); 11744 const sizes = $imageEl.attr('data-sizes'); 11745 const $pictureEl = $imageEl.parent('picture'); 11746 swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, () => { 11747 if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return; 11748 11749 if (background) { 11750 $imageEl.css('background-image', `url("${background}")`); 11751 $imageEl.removeAttr('data-background'); 11752 } else { 11753 if (srcset) { 11754 $imageEl.attr('srcset', srcset); 11755 $imageEl.removeAttr('data-srcset'); 11756 } 11757 11758 if (sizes) { 11759 $imageEl.attr('sizes', sizes); 11760 $imageEl.removeAttr('data-sizes'); 11761 } 11762 11763 if ($pictureEl.length) { 11764 $pictureEl.children('source').each(sourceEl => { 11765 const $source = $(sourceEl); 11766 11767 if ($source.attr('data-srcset')) { 11768 $source.attr('srcset', $source.attr('data-srcset')); 11769 $source.removeAttr('data-srcset'); 11770 } 11771 }); 11772 } 11773 11774 if (src) { 11775 $imageEl.attr('src', src); 11776 $imageEl.removeAttr('data-src'); 11777 } 11778 } 11779 11780 $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass); 11781 $slideEl.find(`.${params.preloaderClass}`).remove(); 11782 11783 if (swiper.params.loop && loadInDuplicate) { 11784 const slideOriginalIndex = $slideEl.attr('data-swiper-slide-index'); 11785 11786 if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) { 11787 const originalSlide = swiper.$wrapperEl.children(`[data-swiper-slide-index="${slideOriginalIndex}"]:not(.${swiper.params.slideDuplicateClass})`); 11788 loadInSlide(originalSlide.index(), false); 11789 } else { 11790 const duplicatedSlide = swiper.$wrapperEl.children(`.${swiper.params.slideDuplicateClass}[data-swiper-slide-index="${slideOriginalIndex}"]`); 11791 loadInSlide(duplicatedSlide.index(), false); 11792 } 11793 } 11794 11795 emit('lazyImageReady', $slideEl[0], $imageEl[0]); 11796 11797 if (swiper.params.autoHeight) { 11798 swiper.updateAutoHeight(); 11799 } 11800 }); 11801 emit('lazyImageLoad', $slideEl[0], $imageEl[0]); 11802 }); 11803 } 11804 11805 function load() { 11806 const { 11807 $wrapperEl, 11808 params: swiperParams, 11809 slides, 11810 activeIndex 11811 } = swiper; 11812 const isVirtual = swiper.virtual && swiperParams.virtual.enabled; 11813 const params = swiperParams.lazy; 11814 let slidesPerView = swiperParams.slidesPerView; 11815 11816 if (slidesPerView === 'auto') { 11817 slidesPerView = 0; 11818 } 11819 11820 function slideExist(index) { 11821 if (isVirtual) { 11822 if ($wrapperEl.children(`.${swiperParams.slideClass}[data-swiper-slide-index="${index}"]`).length) { 11823 return true; 11824 } 11825 } else if (slides[index]) return true; 11826 11827 return false; 11828 } 11829 11830 function slideIndex(slideEl) { 11831 if (isVirtual) { 11832 return $(slideEl).attr('data-swiper-slide-index'); 11833 } 11834 11835 return $(slideEl).index(); 11836 } 11837 11838 if (!initialImageLoaded) initialImageLoaded = true; 11839 11840 if (swiper.params.watchSlidesProgress) { 11841 $wrapperEl.children(`.${swiperParams.slideVisibleClass}`).each(slideEl => { 11842 const index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index(); 11843 loadInSlide(index); 11844 }); 11845 } else if (slidesPerView > 1) { 11846 for (let i = activeIndex; i < activeIndex + slidesPerView; i += 1) { 11847 if (slideExist(i)) loadInSlide(i); 11848 } 11849 } else { 11850 loadInSlide(activeIndex); 11851 } 11852 11853 if (params.loadPrevNext) { 11854 if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) { 11855 const amount = params.loadPrevNextAmount; 11856 const spv = slidesPerView; 11857 const maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length); 11858 const minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides 11859 11860 for (let i = activeIndex + slidesPerView; i < maxIndex; i += 1) { 11861 if (slideExist(i)) loadInSlide(i); 11862 } // Prev Slides 11863 11864 11865 for (let i = minIndex; i < activeIndex; i += 1) { 11866 if (slideExist(i)) loadInSlide(i); 11867 } 11868 } else { 11869 const nextSlide = $wrapperEl.children(`.${swiperParams.slideNextClass}`); 11870 if (nextSlide.length > 0) loadInSlide(slideIndex(nextSlide)); 11871 const prevSlide = $wrapperEl.children(`.${swiperParams.slidePrevClass}`); 11872 if (prevSlide.length > 0) loadInSlide(slideIndex(prevSlide)); 11873 } 11874 } 11875 } 11876 11877 function checkInViewOnLoad() { 11878 const window = getWindow(); 11879 if (!swiper || swiper.destroyed) return; 11880 const $scrollElement = swiper.params.lazy.scrollingElement ? $(swiper.params.lazy.scrollingElement) : $(window); 11881 const isWindow = $scrollElement[0] === window; 11882 const scrollElementWidth = isWindow ? window.innerWidth : $scrollElement[0].offsetWidth; 11883 const scrollElementHeight = isWindow ? window.innerHeight : $scrollElement[0].offsetHeight; 11884 const swiperOffset = swiper.$el.offset(); 11885 const { 11886 rtlTranslate: rtl 11887 } = swiper; 11888 let inView = false;
11889 if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; 11890 const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]]; 11891 11892 for (let i = 0; i < swiperCoord.length; i += 1) { 11893 const point = swiperCoord[i]; 11894 11895 if (point[0] >= 0 && point[0] <= scrollElementWidth && point[1] >= 0 && point[1] <= scrollElementHeight) { 11896 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 11897 11898 inView = true; 11899 } 11900 } 11901 11902 const passiveListener = swiper.touchEvents.start === 'touchstart' && swiper.support.passiveListener && swiper.params.passiveListeners ? { 11903 passive: true, 11904 capture: false 11905 } : false; 11906 11907 if (inView) { 11908 load(); 11909 $scrollElement.off('scroll', checkInViewOnLoad, passiveListener); 11910 } else if (!scrollHandlerAttached) { 11911 scrollHandlerAttached = true; 11912 $scrollElement.on('scroll', checkInViewOnLoad, passiveListener); 11913 } 11914 } 11915 11916 on('beforeInit', () => { 11917 if (swiper.params.lazy.enabled && swiper.params.preloadImages) { 11918 swiper.params.preloadImages = false; 11919 } 11920 }); 11921 on('init', () => { 11922 if (swiper.params.lazy.enabled) { 11923 if (swiper.params.lazy.checkInView) { 11924 checkInViewOnLoad(); 11925 } else { 11926 load(); 11927 } 11928 } 11929 }); 11930 on('scroll', () => { 11931 if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.freeMode.sticky) { 11932 load(); 11933 } 11934 }); 11935 on('scrollbarDragMove resize _freeModeNoMomentumRelease', () => { 11936 if (swiper.params.lazy.enabled) { 11937 if (swiper.params.lazy.checkInView) { 11938 checkInViewOnLoad(); 11939 } else { 11940 load(); 11941 } 11942 } 11943 }); 11944 on('transitionStart', () => { 11945 if (swiper.params.lazy.enabled) { 11946 if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !initialImageLoaded) { 11947 if (swiper.params.lazy.checkInView) { 11948 checkInViewOnLoad(); 11949 } else { 11950 load(); 11951 } 11952 } 11953 } 11954 }); 11955 on('transitionEnd', () => { 11956 if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) { 11957 if (swiper.params.lazy.checkInView) { 11958 checkInViewOnLoad(); 11959 } else { 11960 load(); 11961 } 11962 } 11963 }); 11964 on('slideChange', () => { 11965 const { 11966 lazy, 11967 cssMode, 11968 watchSlidesProgress, 11969 touchReleaseOnEdges, 11970 resistanceRatio 11971 } = swiper.params; 11972 11973 if (lazy.enabled && (cssMode || watchSlidesProgress && (touchReleaseOnEdges || resistanceRatio === 0))) { 11974 load(); 11975 } 11976 }); 11977 Object.assign(swiper.lazy, { 11978 load, 11979 loadInSlide 11980 }); 11981} 11982;// CONCATENATED MODULE: ./node_modules/swiper/modules/controller/controller.js 11983/* eslint no-bitwise: ["error", { "allow": [">>"] }] */ 11984 11985function Controller({ 11986 swiper, 11987 extendParams, 11988 on 11989}) { 11990 extendParams({ 11991 controller: { 11992 control: undefined, 11993 inverse: false, 11994 by: 'slide' // or 'container' 11995 11996 } 11997 }); 11998 swiper.controller = { 11999 control: undefined 12000 }; 12001 12002 function LinearSpline(x, y) { 12003 const binarySearch = function search() { 12004 let maxIndex; 12005 let minIndex; 12006 let guess; 12007 return (array, val) => { 12008 minIndex = -1; 12009 maxIndex = array.length; 12010 12011 while (maxIndex - minIndex > 1) { 12012 guess = maxIndex + minIndex >> 1; 12013 12014 if (array[guess] <= val) { 12015 minIndex = guess; 12016 } else { 12017 maxIndex = guess; 12018 } 12019 } 12020 12021 return maxIndex; 12022 }; 12023 }(); 12024 12025 this.x = x; 12026 this.y = y; 12027 this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value: 12028 // (x1,y1) is the known point before given value, 12029 // (x3,y3) is the known point after given value. 12030 12031 let i1; 12032 let i3; 12033 12034 this.interpolate = function interpolate(x2) { 12035 if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2): 12036 12037 i3 = binarySearch(this.x, x2); 12038 i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already: 12039 // y2 := ((x2âx1) à (y3ây1)) ÷ (x3âx1) + y1 12040 12041 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; 12042 }; 12043 12044 return this; 12045 } // xxx: for now i will just save one spline function to to 12046 12047 12048 function getInterpolateFunction(c) { 12049 if (!swiper.controller.spline) { 12050 swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); 12051 } 12052 } 12053 12054 function setTranslate(_t, byController) { 12055 const controlled = swiper.controller.control; 12056 let multiplier;
12057 let controlledTranslate; 12058 const Swiper = swiper.constructor; 12059 12060 function setControlledTranslate(c) { 12061 // this will create an Interpolate function based on the snapGrids 12062 // x is the Grid of the scrolled scroller and y will be the controlled scroller 12063 // it makes sense to create this only once and recall it for the interpolation 12064 // the function does a lot of value caching for performance 12065 const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; 12066 12067 if (swiper.params.controller.by === 'slide') { 12068 getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid 12069 // but it did not work out 12070 12071 controlledTranslate = -swiper.controller.spline.interpolate(-translate); 12072 } 12073 12074 if (!controlledTranslate || swiper.params.controller.by === 'container') { 12075 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); 12076 controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); 12077 } 12078 12079 if (swiper.params.controller.inverse) { 12080 controlledTranslate = c.maxTranslate() - controlledTranslate; 12081 } 12082 12083 c.updateProgress(controlledTranslate); 12084 c.setTranslate(controlledTranslate, swiper); 12085 c.updateActiveIndex(); 12086 c.updateSlidesClasses(); 12087 } 12088 12089 if (Array.isArray(controlled)) { 12090 for (let i = 0; i < controlled.length; i += 1) { 12091 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 12092 setControlledTranslate(controlled[i]); 12093 } 12094 } 12095 } else if (controlled instanceof Swiper && byController !== controlled) { 12096 setControlledTranslate(controlled); 12097 } 12098 } 12099 12100 function setTransition(duration, byController) { 12101 const Swiper = swiper.constructor; 12102 const controlled = swiper.controller.control; 12103 let i; 12104 12105 function setControlledTransition(c) { 12106 c.setTransition(duration, swiper); 12107 12108 if (duration !== 0) { 12109 c.transitionStart(); 12110 12111 if (c.params.autoHeight) { 12112 nextTick(() => { 12113 c.updateAutoHeight(); 12114 }); 12115 } 12116 12117 c.$wrapperEl.transitionEnd(() => { 12118 if (!controlled) return; 12119 12120 if (c.params.loop && swiper.params.controller.by === 'slide') { 12121 c.loopFix(); 12122 } 12123 12124 c.transitionEnd(); 12125 }); 12126 } 12127 } 12128 12129 if (Array.isArray(controlled)) { 12130 for (i = 0; i < controlled.length; i += 1) { 12131 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 12132 setControlledTransition(controlled[i]); 12133 } 12134 } 12135 } else if (controlled instanceof Swiper && byController !== controlled) { 12136 setControlledTransition(controlled); 12137 } 12138 } 12139 12140 function removeSpline() { 12141 if (!swiper.controller.control) return; 12142 12143 if (swiper.controller.spline) { 12144 swiper.controller.spline = undefined; 12145 delete swiper.controller.spline; 12146 } 12147 } 12148 12149 on('beforeInit', () => { 12150 swiper.controller.control = swiper.params.controller.control; 12151 }); 12152 on('update', () => { 12153 removeSpline(); 12154 }); 12155 on('resize', () => { 12156 removeSpline(); 12157 }); 12158 on('observerUpdate', () => { 12159 removeSpline(); 12160 }); 12161 on('setTranslate', (_s, translate, byController) => { 12162 if (!swiper.controller.control) return; 12163 swiper.controller.setTranslate(translate, byController); 12164 }); 12165 on('setTransition', (_s, duration, byController) => { 12166 if (!swiper.controller.control) return; 12167 swiper.controller.setTransition(duration, byController); 12168 }); 12169 Object.assign(swiper.controller, { 12170 setTranslate, 12171 setTransition 12172 }); 12173} 12174;// CONCATENATED MODULE: ./node_modules/swiper/modules/a11y/a11y.js 12175 12176 12177function A11y({ 12178 swiper, 12179 extendParams, 12180 on 12181}) { 12182 extendParams({ 12183 a11y: { 12184 enabled: true, 12185 notificationClass: 'swiper-notification', 12186 prevSlideMessage: 'Previous slide', 12187 nextSlideMessage: 'Next slide', 12188 firstSlideMessage: 'This is the first slide', 12189 lastSlideMessage: 'This is the last slide', 12190 paginationBulletMessage: 'Go to slide {{index}}', 12191 slideLabelMessage: '{{index}} / {{slidesLength}}', 12192 containerMessage: null, 12193 containerRoleDescriptionMessage: null, 12194 itemRoleDescriptionMessage: null, 12195 slideRole: 'group' 12196 } 12197 }); 12198 let liveRegion = null; 12199 12200 function notify(message) { 12201 const notification = liveRegion; 12202 if (notification.length === 0) return; 12203 notification.html(''); 12204 notification.html(message); 12205 } 12206 12207 function getRandomNumber(size = 16) { 12208 const randomChar = () => Math.round(16 * Math.random()).toString(16); 12209 12210 return 'x'.repeat(size).replace(/x/g, randomChar); 12211 } 12212 12213 function makeElFocusable($el) { 12214 $el.attr('tabIndex', '0'); 12215 } 12216 12217 function makeElNotFocusable($el) { 12218 $el.attr('tabIndex', '-1'); 12219 } 12220 12221 function addElRole($el, role) { 12222 $el.attr('role', role); 12223 } 12224 12225 function addElRoleDescription($el, description) { 12226 $el.attr('aria-roledescription', description); 12227 } 12228 12229 function addElControls($el, controls) { 12230 $el.attr('aria-controls', controls); 12231 } 12232 12233 function addElLabel($el, label) { 12234 $el.attr('aria-label', label); 12235 } 12236 12237 function addElId($el, id) { 12238 $el.attr('id', id); 12239 } 12240 12241 function addElLive($el, live) { 12242 $el.attr('aria-live', live); 12243 } 12244 12245 function disableEl($el) { 12246 $el.attr('aria-disabled', true); 12247 } 12248 12249 function enableEl($el) { 12250 $el.attr('aria-disabled', false); 12251 } 12252 12253 function onEnterOrSpaceKey(e) { 12254 if (e.keyCode !== 13 && e.keyCode !== 32) return; 12255 const params = swiper.params.a11y; 12256 const $targetEl = $(e.target); 12257 12258 if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) { 12259 if (!(swiper.isEnd && !swiper.params.loop)) { 12260 swiper.slideNext(); 12261 } 12262 12263 if (swiper.isEnd) { 12264 notify(params.lastSlideMessage); 12265 } else { 12266 notify(params.nextSlideMessage); 12267 } 12268 } 12269 12270 if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) { 12271 if (!(swiper.isBeginning && !swiper.params.loop)) { 12272 swiper.slidePrev(); 12273 } 12274 12275 if (swiper.isBeginning) { 12276 notify(params.firstSlideMessage); 12277 } else { 12278 notify(params.prevSlideMessage); 12279 } 12280 } 12281
12282 if (swiper.pagination && $targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))) { 12283 $targetEl[0].click(); 12284 } 12285 } 12286 12287 function updateNavigation() { 12288 if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; 12289 const { 12290 $nextEl, 12291 $prevEl 12292 } = swiper.navigation; 12293 12294 if ($prevEl && $prevEl.length > 0) { 12295 if (swiper.isBeginning) { 12296 disableEl($prevEl); 12297 makeElNotFocusable($prevEl); 12298 } else { 12299 enableEl($prevEl); 12300 makeElFocusable($prevEl); 12301 } 12302 } 12303 12304 if ($nextEl && $nextEl.length > 0) { 12305 if (swiper.isEnd) { 12306 disableEl($nextEl); 12307 makeElNotFocusable($nextEl); 12308 } else { 12309 enableEl($nextEl); 12310 makeElFocusable($nextEl); 12311 } 12312 } 12313 } 12314 12315 function hasPagination() { 12316 return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length; 12317 } 12318 12319 function hasClickablePagination() { 12320 return hasPagination() && swiper.params.pagination.clickable; 12321 } 12322 12323 function updatePagination() { 12324 const params = swiper.params.a11y; 12325 if (!hasPagination()) return; 12326 swiper.pagination.bullets.each(bulletEl => { 12327 const $bulletEl = $(bulletEl); 12328 12329 if (swiper.params.pagination.clickable) { 12330 makeElFocusable($bulletEl); 12331 12332 if (!swiper.params.pagination.renderBullet) { 12333 addElRole($bulletEl, 'button'); 12334 addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1)); 12335 } 12336 } 12337 12338 if ($bulletEl.is(`.${swiper.params.pagination.bulletActiveClass}`)) { 12339 $bulletEl.attr('aria-current', 'true'); 12340 } else { 12341 $bulletEl.removeAttr('aria-current'); 12342 } 12343 }); 12344 } 12345 12346 const initNavEl = ($el, wrapperId, message) => { 12347 makeElFocusable($el); 12348 12349 if ($el[0].tagName !== 'BUTTON') { 12350 addElRole($el, 'button'); 12351 $el.on('keydown', onEnterOrSpaceKey); 12352 } 12353 12354 addElLabel($el, message); 12355 addElControls($el, wrapperId); 12356 }; 12357 12358 function init() { 12359 const params = swiper.params.a11y; 12360 swiper.$el.append(liveRegion); // Container 12361 12362 const $containerEl = swiper.$el; 12363 12364 if (params.containerRoleDescriptionMessage) { 12365 addElRoleDescription($containerEl, params.containerRoleDescriptionMessage); 12366 } 12367 12368 if (params.containerMessage) { 12369 addElLabel($containerEl, params.containerMessage); 12370 } // Wrapper 12371 12372 12373 const $wrapperEl = swiper.$wrapperEl; 12374 const wrapperId = $wrapperEl.attr('id') || `swiper-wrapper-${getRandomNumber(16)}`; 12375 const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; 12376 addElId($wrapperEl, wrapperId); 12377 addElLive($wrapperEl, live); // Slide 12378 12379 if (params.itemRoleDescriptionMessage) { 12380 addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage); 12381 } 12382 12383 addElRole($(swiper.slides), params.slideRole); 12384 const slidesLength = swiper.params.loop ? swiper.slides.filter(el => !el.classList.contains(swiper.params.slideDuplicateClass)).length : swiper.slides.length; 12385 swiper.slides.each((slideEl, index) => { 12386 const $slideEl = $(slideEl); 12387 const slideIndex = swiper.params.loop ? parseInt($slideEl.attr('data-swiper-slide-index'), 10) : index; 12388 const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); 12389 addElLabel($slideEl, ariaLabelMessage); 12390 }); // Navigation 12391 12392 let $nextEl; 12393 let $prevEl; 12394 12395 if (swiper.navigation && swiper.navigation.$nextEl) { 12396 $nextEl = swiper.navigation.$nextEl; 12397 } 12398 12399 if (swiper.navigation && swiper.navigation.$prevEl) { 12400 $prevEl = swiper.navigation.$prevEl; 12401 } 12402 12403 if ($nextEl && $nextEl.length) { 12404 initNavEl($nextEl, wrapperId, params.nextSlideMessage); 12405 } 12406 12407 if ($prevEl && $prevEl.length) { 12408 initNavEl($prevEl, wrapperId, params.prevSlideMessage); 12409 } // Pagination 12410 12411 12412 if (hasClickablePagination()) { 12413 swiper.pagination.$el.on('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); 12414 } 12415 } 12416 12417 function destroy() { 12418 if (liveRegion && liveRegion.length > 0) liveRegion.remove(); 12419 let $nextEl; 12420 let $prevEl; 12421 12422 if (swiper.navigation && swiper.navigation.$nextEl) { 12423 $nextEl = swiper.navigation.$nextEl; 12424 } 12425 12426 if (swiper.navigation && swiper.navigation.$prevEl) { 12427 $prevEl = swiper.navigation.$prevEl; 12428 } 12429 12430 if ($nextEl) { 12431 $nextEl.off('keydown', onEnterOrSpaceKey); 12432 } 12433 12434 if ($prevEl) { 12435 $prevEl.off('keydown', onEnterOrSpaceKey); 12436 } // Pagination 12437 12438 12439 if (hasClickablePagination()) { 12440 swiper.pagination.$el.off('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); 12441 } 12442 } 12443 12444 on('beforeInit', () => { 12445 liveRegion = $(`<span class="${swiper.params.a11y.notificationClass}
vendor: 4,658 bytes, lines 12445-12629
12445" aria-live="assertive" aria-atomic="true"></span>`); 12446 }); 12447 on('afterInit', () => { 12448 if (!swiper.params.a11y.enabled) return; 12449 init(); 12450 updateNavigation(); 12451 }); 12452 on('toEdge', () => { 12453 if (!swiper.params.a11y.enabled) return; 12454 updateNavigation(); 12455 }); 12456 on('fromEdge', () => { 12457 if (!swiper.params.a11y.enabled) return; 12458 updateNavigation(); 12459 }); 12460 on('paginationUpdate', () => { 12461 if (!swiper.params.a11y.enabled) return; 12462 updatePagination(); 12463 }); 12464 on('destroy', () => { 12465 if (!swiper.params.a11y.enabled) return; 12466 destroy(); 12467 }); 12468} 12469;// CONCATENATED MODULE: ./node_modules/swiper/modules/history/history.js 12470 12471function History({ 12472 swiper, 12473 extendParams, 12474 on 12475}) { 12476 extendParams({ 12477 history: { 12478 enabled: false, 12479 root: '', 12480 replaceState: false, 12481 key: 'slides' 12482 } 12483 }); 12484 let initialized = false; 12485 let paths = {}; 12486 12487 const slugify = text => { 12488 return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); 12489 }; 12490 12491 const getPathValues = urlOverride => { 12492 const window = getWindow(); 12493 let location; 12494 12495 if (urlOverride) { 12496 location = new URL(urlOverride); 12497 } else { 12498 location = window.location; 12499 } 12500 12501 const pathArray = location.pathname.slice(1).split('/').filter(part => part !== ''); 12502 const total = pathArray.length; 12503 const key = pathArray[total - 2]; 12504 const value = pathArray[total - 1]; 12505 return { 12506 key, 12507 value 12508 }; 12509 }; 12510 12511 const setHistory = (key, index) => { 12512 const window = getWindow(); 12513 if (!initialized || !swiper.params.history.enabled) return; 12514 let location; 12515 12516 if (swiper.params.url) { 12517 location = new URL(swiper.params.url); 12518 } else { 12519 location = window.location; 12520 } 12521 12522 const slide = swiper.slides.eq(index); 12523 let value = slugify(slide.attr('data-history')); 12524 12525 if (swiper.params.history.root.length > 0) { 12526 let root = swiper.params.history.root; 12527 if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); 12528 value = `${root}/${key}/${value}`; 12529 } else if (!location.pathname.includes(key)) { 12530 value = `${key}/${value}`; 12531 } 12532 12533 const currentState = window.history.state; 12534 12535 if (currentState && currentState.value === value) { 12536 return; 12537 } 12538 12539 if (swiper.params.history.replaceState) { 12540 window.history.replaceState({ 12541 value 12542 }, null, value); 12543 } else { 12544 window.history.pushState({ 12545 value 12546 }, null, value); 12547 } 12548 }; 12549 12550 const scrollToSlide = (speed, value, runCallbacks) => { 12551 if (value) { 12552 for (let i = 0, length = swiper.slides.length; i < length; i += 1) { 12553 const slide = swiper.slides.eq(i); 12554 const slideHistory = slugify(slide.attr('data-history')); 12555 12556 if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) { 12557 const index = slide.index(); 12558 swiper.slideTo(index, speed, runCallbacks); 12559 } 12560 } 12561 } else { 12562 swiper.slideTo(0, speed, runCallbacks); 12563 } 12564 }; 12565 12566 const setHistoryPopState = () => { 12567 paths = getPathValues(swiper.params.url); 12568 scrollToSlide(swiper.params.speed, swiper.paths.value, false); 12569 }; 12570 12571 const init = () => { 12572 const window = getWindow(); 12573 if (!swiper.params.history) return; 12574 12575 if (!window.history || !window.history.pushState) { 12576 swiper.params.history.enabled = false; 12577 swiper.params.hashNavigation.enabled = true; 12578 return; 12579 } 12580 12581 initialized = true; 12582 paths = getPathValues(swiper.params.url); 12583 if (!paths.key && !paths.value) return; 12584 scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); 12585 12586 if (!swiper.params.history.replaceState) { 12587 window.addEventListener('popstate', setHistoryPopState); 12588 } 12589 }; 12590 12591 const destroy = () => { 12592 const window = getWindow(); 12593 12594 if (!swiper.params.history.replaceState) { 12595 window.removeEventListener('popstate', setHistoryPopState); 12596 } 12597 }; 12598 12599 on('init', () => { 12600 if (swiper.params.history.enabled) { 12601 init(); 12602 } 12603 }); 12604 on('destroy', () => { 12605 if (swiper.params.history.enabled) { 12606 destroy(); 12607 } 12608 }); 12609 on('transitionEnd _freeModeNoMomentumRelease', () => { 12610 if (initialized) { 12611 setHistory(swiper.params.history.key, swiper.activeIndex); 12612 } 12613 }); 12614 on('slideChange', () => { 12615 if (initialized && swiper.params.cssMode) { 12616 setHistory(swiper.params.history.key, swiper.activeIndex); 12617 } 12618 }); 12619} 12620;// CONCATENATED MODULE: ./node_modules/swiper/modules/hash-navigation/hash-navigation.js 12621 12622 12623function HashNavigation({ 12624 swiper, 12625 extendParams, 12626 emit, 12627 on 12628}) { 12629 let initialized = false;
12630 const document = getDocument(); 12631 const window = getWindow(); 12632 extendParams({ 12633 hashNavigation: { 12634 enabled: false, 12635 replaceState: false, 12636 watchState: false 12637 } 12638 }); 12639 12640 const onHashChange = () => { 12641 emit('hashChange'); 12642 const newHash = document.location.hash.replace('#', ''); 12643 const activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash'); 12644 12645 if (newHash !== activeSlideHash) { 12646 const newIndex = swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-hash="${newHash}"]`).index(); 12647 if (typeof newIndex === 'undefined') return; 12648 swiper.slideTo(newIndex); 12649 } 12650 }; 12651 12652 const setHash = () => { 12653 if (!initialized || !swiper.params.hashNavigation.enabled) return; 12654 12655 if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { 12656 window.history.replaceState(null, null, `#${swiper.slides.eq(swiper.activeIndex).attr('data-hash')}` || ''); 12657 emit('hashSet'); 12658 } else { 12659 const slide = swiper.slides.eq(swiper.activeIndex); 12660 const hash = slide.attr('data-hash') || slide.attr('data-history'); 12661 document.location.hash = hash || ''; 12662 emit('hashSet'); 12663 } 12664 }; 12665 12666 const init = () => { 12667 if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; 12668 initialized = true; 12669 const hash = document.location.hash.replace('#', ''); 12670 12671 if (hash) { 12672 const speed = 0; 12673 12674 for (let i = 0, length = swiper.slides.length; i < length; i += 1) { 12675 const slide = swiper.slides.eq(i); 12676 const slideHash = slide.attr('data-hash') || slide.attr('data-history'); 12677 12678 if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) { 12679 const index = slide.index(); 12680 swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true); 12681 } 12682 } 12683 } 12684 12685 if (swiper.params.hashNavigation.watchState) { 12686 $(window).on('hashchange', onHashChange); 12687 } 12688 }; 12689 12690 const destroy = () => { 12691 if (swiper.params.hashNavigation.watchState) { 12692 $(window).off('hashchange', onHashChange); 12693 } 12694 }; 12695 12696 on('init', () => { 12697 if (swiper.params.hashNavigation.enabled) { 12698 init(); 12699 } 12700 }); 12701 on('destroy', () => { 12702 if (swiper.params.hashNavigation.enabled) { 12703 destroy(); 12704 } 12705 }); 12706 on('transitionEnd _freeModeNoMomentumRelease', () => { 12707 if (initialized) { 12708 setHash(); 12709 } 12710 }); 12711 on('slideChange', () => { 12712 if (initialized && swiper.params.cssMode) { 12713 setHash(); 12714 } 12715 }); 12716} 12717;// CONCATENATED MODULE: ./node_modules/swiper/modules/autoplay/autoplay.js 12718/* eslint no-underscore-dangle: "off" */ 12719 12720/* eslint no-use-before-define: "off" */ 12721 12722 12723function Autoplay({ 12724 swiper, 12725 extendParams, 12726 on, 12727 emit 12728}) { 12729 let timeout; 12730 swiper.autoplay = { 12731 running: false, 12732 paused: false 12733 }; 12734 extendParams({ 12735 autoplay: { 12736 enabled: false, 12737 delay: 3000, 12738 waitForTransition: true, 12739 disableOnInteraction: true, 12740 stopOnLastSlide: false, 12741 reverseDirection: false, 12742 pauseOnMouseEnter: false 12743 } 12744 }); 12745 12746 function run() { 12747 const $activeSlideEl = swiper.slides.eq(swiper.activeIndex); 12748 let delay = swiper.params.autoplay.delay; 12749 12750 if ($activeSlideEl.attr('data-swiper-autoplay')) { 12751 delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay; 12752 } 12753 12754 clearTimeout(timeout); 12755 timeout = utils_nextTick(() => { 12756 let autoplayResult; 12757 12758 if (swiper.params.autoplay.reverseDirection) { 12759 if (swiper.params.loop) { 12760 swiper.loopFix(); 12761 autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); 12762 emit('autoplay'); 12763 } else if (!swiper.isBeginning) { 12764 autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); 12765 emit('autoplay'); 12766 } else if (!swiper.params.autoplay.stopOnLastSlide) { 12767 autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true); 12768 emit('autoplay'); 12769 } else { 12770 stop(); 12771 } 12772 } else if (swiper.params.loop) { 12773 swiper.loopFix(); 12774 autoplayResult = swiper.slideNext(swiper.params.speed, true, true); 12775 emit('autoplay'); 12776 } else if (!swiper.isEnd) { 12777 autoplayResult = swiper.slideNext(swiper.params.speed, true, true); 12778 emit('autoplay'); 12779 } else if (!swiper.params.autoplay.stopOnLastSlide) { 12780 autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true); 12781 emit('autoplay'); 12782 } else { 12783 stop(); 12784 } 12785 12786 if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) { 12787 run(); 12788 } 12789 }, delay); 12790 } 12791 12792 function start() { 12793 if (typeof timeout !== 'undefined') return false;
vendor: 4,237 bytes, lines 12794-12967
12794 if (swiper.autoplay.running) return false; 12795 swiper.autoplay.running = true; 12796 emit('autoplayStart'); 12797 run(); 12798 return true; 12799 } 12800 12801 function stop() { 12802 if (!swiper.autoplay.running) return false; 12803 if (typeof timeout === 'undefined') return false; 12804 12805 if (timeout) { 12806 clearTimeout(timeout); 12807 timeout = undefined; 12808 } 12809 12810 swiper.autoplay.running = false; 12811 emit('autoplayStop'); 12812 return true; 12813 } 12814 12815 function pause(speed) { 12816 if (!swiper.autoplay.running) return; 12817 if (swiper.autoplay.paused) return; 12818 if (timeout) clearTimeout(timeout); 12819 swiper.autoplay.paused = true; 12820 12821 if (speed === 0 || !swiper.params.autoplay.waitForTransition) { 12822 swiper.autoplay.paused = false; 12823 run(); 12824 } else { 12825 ['transitionend', 'webkitTransitionEnd'].forEach(event => { 12826 swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd); 12827 }); 12828 } 12829 } 12830 12831 function onVisibilityChange() { 12832 const document = ssr_window_esm_getDocument(); 12833 12834 if (document.visibilityState === 'hidden' && swiper.autoplay.running) { 12835 pause(); 12836 } 12837 12838 if (document.visibilityState === 'visible' && swiper.autoplay.paused) { 12839 run(); 12840 swiper.autoplay.paused = false; 12841 } 12842 } 12843 12844 function onTransitionEnd(e) { 12845 if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return; 12846 if (e.target !== swiper.$wrapperEl[0]) return; 12847 ['transitionend', 'webkitTransitionEnd'].forEach(event => { 12848 swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd); 12849 }); 12850 swiper.autoplay.paused = false; 12851 12852 if (!swiper.autoplay.running) { 12853 stop(); 12854 } else { 12855 run(); 12856 } 12857 } 12858 12859 function onMouseEnter() { 12860 if (swiper.params.autoplay.disableOnInteraction) { 12861 stop(); 12862 } else { 12863 pause(); 12864 } 12865 12866 ['transitionend', 'webkitTransitionEnd'].forEach(event => { 12867 swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd); 12868 }); 12869 } 12870 12871 function onMouseLeave() { 12872 if (swiper.params.autoplay.disableOnInteraction) { 12873 return; 12874 } 12875 12876 swiper.autoplay.paused = false; 12877 run(); 12878 } 12879 12880 function attachMouseEvents() { 12881 if (swiper.params.autoplay.pauseOnMouseEnter) { 12882 swiper.$el.on('mouseenter', onMouseEnter); 12883 swiper.$el.on('mouseleave', onMouseLeave); 12884 } 12885 } 12886 12887 function detachMouseEvents() { 12888 swiper.$el.off('mouseenter', onMouseEnter); 12889 swiper.$el.off('mouseleave', onMouseLeave); 12890 } 12891 12892 on('init', () => { 12893 if (swiper.params.autoplay.enabled) { 12894 start(); 12895 const document = ssr_window_esm_getDocument(); 12896 document.addEventListener('visibilitychange', onVisibilityChange); 12897 attachMouseEvents(); 12898 } 12899 }); 12900 on('beforeTransitionStart', (_s, speed, internal) => { 12901 if (swiper.autoplay.running) { 12902 if (internal || !swiper.params.autoplay.disableOnInteraction) { 12903 swiper.autoplay.pause(speed); 12904 } else { 12905 stop(); 12906 } 12907 } 12908 }); 12909 on('sliderFirstMove', () => { 12910 if (swiper.autoplay.running) { 12911 if (swiper.params.autoplay.disableOnInteraction) { 12912 stop(); 12913 } else { 12914 pause(); 12915 } 12916 } 12917 }); 12918 on('touchEnd', () => { 12919 if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) { 12920 run(); 12921 } 12922 }); 12923 on('destroy', () => { 12924 detachMouseEvents(); 12925 12926 if (swiper.autoplay.running) { 12927 stop(); 12928 } 12929 12930 const document = ssr_window_esm_getDocument(); 12931 document.removeEventListener('visibilitychange', onVisibilityChange); 12932 }); 12933 Object.assign(swiper.autoplay, { 12934 pause, 12935 run, 12936 start, 12937 stop 12938 }); 12939} 12940;// CONCATENATED MODULE: ./node_modules/swiper/modules/thumbs/thumbs.js 12941 12942 12943function Thumb({ 12944 swiper, 12945 extendParams, 12946 on 12947}) { 12948 extendParams({ 12949 thumbs: { 12950 swiper: null, 12951 multipleActiveThumbs: true, 12952 autoScrollOffset: 0, 12953 slideThumbActiveClass: 'swiper-slide-thumb-active', 12954 thumbsContainerClass: 'swiper-thumbs' 12955 } 12956 }); 12957 let initialized = false; 12958 let swiperCreated = false; 12959 swiper.thumbs = { 12960 swiper: null 12961 }; 12962 12963 function onThumbClick() { 12964 const thumbsSwiper = swiper.thumbs.swiper; 12965 if (!thumbsSwiper) return; 12966 const clickedIndex = thumbsSwiper.clickedIndex; 12967 const clickedSlide = thumbsSwiper.clickedSlide;
12968 if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return; 12969 if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; 12970 let slideToIndex; 12971 12972 if (thumbsSwiper.params.loop) { 12973 slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10); 12974 } else { 12975 slideToIndex = clickedIndex; 12976 } 12977 12978 if (swiper.params.loop) { 12979 let currentIndex = swiper.activeIndex; 12980 12981 if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) { 12982 swiper.loopFix(); // eslint-disable-next-line 12983 12984 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 12985 currentIndex = swiper.activeIndex; 12986 } 12987 12988 const prevIndex = swiper.slides.eq(currentIndex).prevAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); 12989 const nextIndex = swiper.slides.eq(currentIndex).nextAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); 12990 if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex; 12991 } 12992 12993 swiper.slideTo(slideToIndex); 12994 } 12995 12996 function init() { 12997 const { 12998 thumbs: thumbsParams 12999 } = swiper.params; 13000 if (initialized) return false; 13001 initialized = true; 13002 const SwiperClass = swiper.constructor; 13003 13004 if (thumbsParams.swiper instanceof SwiperClass) { 13005 swiper.thumbs.swiper = thumbsParams.swiper; 13006 Object.assign(swiper.thumbs.swiper.originalParams, { 13007 watchSlidesProgress: true, 13008 slideToClickedSlide: false 13009 }); 13010 Object.assign(swiper.thumbs.swiper.params, { 13011 watchSlidesProgress: true, 13012 slideToClickedSlide: false 13013 }); 13014 } else if (isObject(thumbsParams.swiper)) { 13015 const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper); 13016 Object.assign(thumbsSwiperParams, { 13017 watchSlidesProgress: true, 13018 slideToClickedSlide: false 13019 }); 13020 swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); 13021 swiperCreated = true; 13022 } 13023 13024 swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass); 13025 swiper.thumbs.swiper.on('tap', onThumbClick); 13026 return true; 13027 } 13028 13029 function update(initial) { 13030 const thumbsSwiper = swiper.thumbs.swiper; 13031 if (!thumbsSwiper) return; 13032 const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; 13033 const autoScrollOffset = swiper.params.thumbs.autoScrollOffset; 13034 const useOffset = autoScrollOffset && !thumbsSwiper.params.loop; 13035 13036 if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { 13037 let currentThumbsIndex = thumbsSwiper.activeIndex; 13038 let newThumbsIndex; 13039 let direction; 13040 13041 if (thumbsSwiper.params.loop) { 13042 if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) { 13043 thumbsSwiper.loopFix(); // eslint-disable-next-line 13044 13045 thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft; 13046 currentThumbsIndex = thumbsSwiper.activeIndex; 13047 } // Find actual thumbs index to slide to 13048 13049 13050 const prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); 13051 const nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); 13052 13053 if (typeof prevThumbsIndex === 'undefined') { 13054 newThumbsIndex = nextThumbsIndex; 13055 } else if (typeof nextThumbsIndex === 'undefined') { 13056 newThumbsIndex = prevThumbsIndex; 13057 } else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) { 13058 newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex; 13059 } else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) { 13060 newThumbsIndex = nextThumbsIndex; 13061 } else { 13062 newThumbsIndex = prevThumbsIndex; 13063 } 13064 13065 direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; 13066 } else { 13067 newThumbsIndex = swiper.realIndex; 13068 direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; 13069 } 13070 13071 if (useOffset) { 13072 newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; 13073 } 13074 13075 if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { 13076 if (thumbsSwiper.params.centeredSlides) { 13077 if (newThumbsIndex > currentThumbsIndex) { 13078 newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; 13079 } else { 13080 newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; 13081 } 13082 } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) {// newThumbsIndex = newThumbsIndex - slidesPerView + 1; 13083 } 13084 13085 thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); 13086 } 13087 } // Activate thumbs 13088 13089 13090 let thumbsToActivate = 1; 13091 const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; 13092 13093 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { 13094 thumbsToActivate = swiper.params.slidesPerView; 13095 } 13096
13097 if (!swiper.params.thumbs.multipleActiveThumbs) { 13098 thumbsToActivate = 1; 13099 } 13100 13101 thumbsToActivate = Math.floor(thumbsToActivate); 13102 thumbsSwiper.slides.removeClass(thumbActiveClass); 13103 13104 if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) { 13105 for (let i = 0; i < thumbsToActivate; i += 1) { 13106 thumbsSwiper.$wrapperEl.children(`[data-swiper-slide-index="${swiper.realIndex + i}"]`).addClass(thumbActiveClass); 13107 } 13108 } else { 13109 for (let i = 0; i < thumbsToActivate; i += 1) { 13110 thumbsSwiper.slides.eq(swiper.realIndex + i).addClass(thumbActiveClass); 13111 } 13112 } 13113 } 13114 13115 on('beforeInit', () => { 13116 const { 13117 thumbs 13118 } = swiper.params; 13119 if (!thumbs || !thumbs.swiper) return; 13120 init(); 13121 update(true); 13122 }); 13123 on('slideChange update resize observerUpdate', () => { 13124 if (!swiper.thumbs.swiper) return; 13125 update(); 13126 }); 13127 on('setTransition', (_s, duration) => { 13128 const thumbsSwiper = swiper.thumbs.swiper; 13129 if (!thumbsSwiper) return; 13130 thumbsSwiper.setTransition(duration); 13131 }); 13132 on('beforeDestroy', () => { 13133 const thumbsSwiper = swiper.thumbs.swiper; 13134 if (!thumbsSwiper) return; 13135 13136 if (swiperCreated && thumbsSwiper) { 13137 thumbsSwiper.destroy(); 13138 } 13139 }); 13140 Object.assign(swiper.thumbs, { 13141 init, 13142 update 13143 }); 13144} 13145;// CONCATENATED MODULE: ./node_modules/swiper/modules/free-mode/free-mode.js 13146 13147function freeMode({ 13148 swiper, 13149 extendParams, 13150 emit, 13151 once 13152}) { 13153 extendParams({ 13154 freeMode: { 13155 enabled: false, 13156 momentum: true, 13157 momentumRatio: 1, 13158 momentumBounce: true, 13159 momentumBounceRatio: 1, 13160 momentumVelocityRatio: 1, 13161 sticky: false, 13162 minimumVelocity: 0.02 13163 } 13164 }); 13165 13166 function onTouchMove() { 13167 const { 13168 touchEventsData: data, 13169 touches 13170 } = swiper; // Velocity 13171 13172 if (data.velocities.length === 0) { 13173 data.velocities.push({ 13174 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], 13175 time: data.touchStartTime 13176 }); 13177 } 13178 13179 data.velocities.push({ 13180 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], 13181 time: now() 13182 }); 13183 } 13184 13185 function onTouchEnd({ 13186 currentPos 13187 }) { 13188 const { 13189 params, 13190 $wrapperEl, 13191 rtlTranslate: rtl, 13192 snapGrid, 13193 touchEventsData: data 13194 } = swiper; // Time diff 13195 13196 const touchEndTime = now(); 13197 const timeDiff = touchEndTime - data.touchStartTime; 13198
vendor: 21,746 bytes, lines 13199-13860
13199 if (currentPos < -swiper.minTranslate()) { 13200 swiper.slideTo(swiper.activeIndex); 13201 return; 13202 } 13203 13204 if (currentPos > -swiper.maxTranslate()) { 13205 if (swiper.slides.length < snapGrid.length) { 13206 swiper.slideTo(snapGrid.length - 1); 13207 } else { 13208 swiper.slideTo(swiper.slides.length - 1); 13209 } 13210 13211 return; 13212 } 13213 13214 if (params.freeMode.momentum) { 13215 if (data.velocities.length > 1) { 13216 const lastMoveEvent = data.velocities.pop(); 13217 const velocityEvent = data.velocities.pop(); 13218 const distance = lastMoveEvent.position - velocityEvent.position; 13219 const time = lastMoveEvent.time - velocityEvent.time; 13220 swiper.velocity = distance / time; 13221 swiper.velocity /= 2; 13222 13223 if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) { 13224 swiper.velocity = 0; 13225 } // this implies that the user stopped moving a finger then released. 13226 // There would be no events with distance zero, so the last event is stale. 13227 13228 13229 if (time > 150 || now() - lastMoveEvent.time > 300) { 13230 swiper.velocity = 0; 13231 } 13232 } else { 13233 swiper.velocity = 0; 13234 } 13235 13236 swiper.velocity *= params.freeMode.momentumVelocityRatio; 13237 data.velocities.length = 0; 13238 let momentumDuration = 1000 * params.freeMode.momentumRatio; 13239 const momentumDistance = swiper.velocity * momentumDuration; 13240 let newPosition = swiper.translate + momentumDistance; 13241 if (rtl) newPosition = -newPosition; 13242 let doBounce = false; 13243 let afterBouncePosition; 13244 const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; 13245 let needsLoopFix; 13246 13247 if (newPosition < swiper.maxTranslate()) { 13248 if (params.freeMode.momentumBounce) { 13249 if (newPosition + swiper.maxTranslate() < -bounceAmount) { 13250 newPosition = swiper.maxTranslate() - bounceAmount; 13251 } 13252 13253 afterBouncePosition = swiper.maxTranslate(); 13254 doBounce = true; 13255 data.allowMomentumBounce = true; 13256 } else { 13257 newPosition = swiper.maxTranslate(); 13258 } 13259 13260 if (params.loop && params.centeredSlides) needsLoopFix = true; 13261 } else if (newPosition > swiper.minTranslate()) { 13262 if (params.freeMode.momentumBounce) { 13263 if (newPosition - swiper.minTranslate() > bounceAmount) { 13264 newPosition = swiper.minTranslate() + bounceAmount; 13265 } 13266 13267 afterBouncePosition = swiper.minTranslate(); 13268 doBounce = true; 13269 data.allowMomentumBounce = true; 13270 } else { 13271 newPosition = swiper.minTranslate(); 13272 } 13273 13274 if (params.loop && params.centeredSlides) needsLoopFix = true; 13275 } else if (params.freeMode.sticky) { 13276 let nextSlide; 13277 13278 for (let j = 0; j < snapGrid.length; j += 1) { 13279 if (snapGrid[j] > -newPosition) { 13280 nextSlide = j; 13281 break; 13282 } 13283 } 13284 13285 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { 13286 newPosition = snapGrid[nextSlide]; 13287 } else { 13288 newPosition = snapGrid[nextSlide - 1]; 13289 } 13290 13291 newPosition = -newPosition; 13292 } 13293 13294 if (needsLoopFix) { 13295 once('transitionEnd', () => { 13296 swiper.loopFix(); 13297 }); 13298 } // Fix duration 13299 13300 13301 if (swiper.velocity !== 0) { 13302 if (rtl) { 13303 momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); 13304 } else { 13305 momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); 13306 } 13307 13308 if (params.freeMode.sticky) { 13309 // If freeMode.sticky is active and the user ends a swipe with a slow-velocity 13310 // event, then durations can be 20+ seconds to slide one (or zero!) slides. 13311 // It's easy to see this when simulating touch with mouse events. To fix this, 13312 // limit single-slide swipes to the default slide duration. This also has the 13313 // nice side effect of matching slide speed if the user stopped moving before 13314 // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. 13315 // For faster swipes, also apply limits (albeit higher ones). 13316 const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); 13317 const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; 13318 13319 if (moveDistance < currentSlideSize) { 13320 momentumDuration = params.speed; 13321 } else if (moveDistance < 2 * currentSlideSize) { 13322 momentumDuration = params.speed * 1.5; 13323 } else { 13324 momentumDuration = params.speed * 2.5; 13325 } 13326 } 13327 } else if (params.freeMode.sticky) { 13328 swiper.slideToClosest(); 13329 return; 13330 } 13331 13332 if (params.freeMode.momentumBounce && doBounce) { 13333 swiper.updateProgress(afterBouncePosition); 13334 swiper.setTransition(momentumDuration); 13335 swiper.setTranslate(newPosition); 13336 swiper.transitionStart(true, swiper.swipeDirection); 13337 swiper.animating = true; 13338 $wrapperEl.transitionEnd(() => { 13339 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; 13340 emit('momentumBounce'); 13341 swiper.setTransition(params.speed); 13342 setTimeout(() => { 13343 swiper.setTranslate(afterBouncePosition); 13344 $wrapperEl.transitionEnd(() => { 13345 if (!swiper || swiper.destroyed) return; 13346 swiper.transitionEnd(); 13347 }); 13348 }, 0); 13349 }); 13350 } else if (swiper.velocity) { 13351 emit('_freeModeNoMomentumRelease'); 13352 swiper.updateProgress(newPosition); 13353 swiper.setTransition(momentumDuration); 13354 swiper.setTranslate(newPosition); 13355 swiper.transitionStart(true, swiper.swipeDirection); 13356 13357 if (!swiper.animating) { 13358 swiper.animating = true; 13359 $wrapperEl.transitionEnd(() => { 13360 if (!swiper || swiper.destroyed) return; 13361 swiper.transitionEnd(); 13362 }); 13363 } 13364 } else { 13365 swiper.updateProgress(newPosition); 13366 } 13367 13368 swiper.updateActiveIndex(); 13369 swiper.updateSlidesClasses(); 13370 } else if (params.freeMode.sticky) { 13371 swiper.slideToClosest(); 13372 return; 13373 } else if (params.freeMode) { 13374 emit('_freeModeNoMomentumRelease'); 13375 } 13376 13377 if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { 13378 swiper.updateProgress(); 13379 swiper.updateActiveIndex(); 13380 swiper.updateSlidesClasses(); 13381 } 13382 } 13383 13384 Object.assign(swiper, { 13385 freeMode: { 13386 onTouchMove, 13387 onTouchEnd 13388 } 13389 }); 13390} 13391;// CONCATENATED MODULE: ./node_modules/swiper/modules/effect-cube/effect-cube.js 13392 13393 13394function EffectCube({ 13395 swiper, 13396 extendParams, 13397 on 13398}) { 13399 extendParams({ 13400 cubeEffect: { 13401 slideShadows: true, 13402 shadow: true, 13403 shadowOffset: 20, 13404 shadowScale: 0.94 13405 } 13406 }); 13407 13408 const setTranslate = () => { 13409 const { 13410 $el, 13411 $wrapperEl, 13412 slides, 13413 width: swiperWidth, 13414 height: swiperHeight, 13415 rtlTranslate: rtl, 13416 size: swiperSize, 13417 browser 13418 } = swiper; 13419 const params = swiper.params.cubeEffect; 13420 const isHorizontal = swiper.isHorizontal(); 13421 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 13422 let wrapperRotate = 0; 13423 let $cubeShadowEl; 13424 13425 if (params.shadow) { 13426 if (isHorizontal) { 13427 $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow'); 13428 13429 if ($cubeShadowEl.length === 0) { 13430 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>'); 13431 $wrapperEl.append($cubeShadowEl); 13432 } 13433 13434 $cubeShadowEl.css({ 13435 height: `${swiperWidth}px` 13436 }); 13437 } else { 13438 $cubeShadowEl = $el.find('.swiper-cube-shadow'); 13439 13440 if ($cubeShadowEl.length === 0) { 13441 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>'); 13442 $el.append($cubeShadowEl); 13443 } 13444 } 13445 } 13446 13447 for (let i = 0; i < slides.length; i += 1) { 13448 const $slideEl = slides.eq(i); 13449 let slideIndex = i; 13450 13451 if (isVirtual) { 13452 slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10); 13453 } 13454 13455 let slideAngle = slideIndex * 90; 13456 let round = Math.floor(slideAngle / 360); 13457 13458 if (rtl) { 13459 slideAngle = -slideAngle; 13460 round = Math.floor(-slideAngle / 360); 13461 } 13462 13463 const progress = Math.max(Math.min($slideEl[0].progress, 1), -1); 13464 let tx = 0; 13465 let ty = 0; 13466 let tz = 0; 13467 13468 if (slideIndex % 4 === 0) { 13469 tx = -round * 4 * swiperSize; 13470 tz = 0; 13471 } else if ((slideIndex - 1) % 4 === 0) { 13472 tx = 0; 13473 tz = -round * 4 * swiperSize; 13474 } else if ((slideIndex - 2) % 4 === 0) { 13475 tx = swiperSize + round * 4 * swiperSize; 13476 tz = swiperSize; 13477 } else if ((slideIndex - 3) % 4 === 0) { 13478 tx = -swiperSize; 13479 tz = 3 * swiperSize + swiperSize * 4 * round; 13480 } 13481 13482 if (rtl) { 13483 tx = -tx; 13484 } 13485 13486 if (!isHorizontal) { 13487 ty = tx; 13488 tx = 0; 13489 } 13490 13491 const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`; 13492 13493 if (progress <= 1 && progress > -1) { 13494 wrapperRotate = slideIndex * 90 + progress * 90; 13495 if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; 13496 } 13497 13498 $slideEl.transform(transform); 13499 13500 if (params.slideShadows) { 13501 // Set shadows 13502 let shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 13503 let shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 13504 13505 if (shadowBefore.length === 0) { 13506 shadowBefore = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}"></div>`); 13507 $slideEl.append(shadowBefore); 13508 } 13509 13510 if (shadowAfter.length === 0) { 13511 shadowAfter = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}"></div>`); 13512 $slideEl.append(shadowAfter); 13513 } 13514 13515 if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); 13516 if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); 13517 } 13518 } 13519 13520 $wrapperEl.css({ 13521 '-webkit-transform-origin': `50% 50% -${swiperSize / 2}px`, 13522 'transform-origin': `50% 50% -${swiperSize / 2}px` 13523 }); 13524 13525 if (params.shadow) { 13526 if (isHorizontal) { 13527 $cubeShadowEl.transform(`translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`); 13528 } else { 13529 const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; 13530 const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); 13531 const scale1 = params.shadowScale; 13532 const scale2 = params.shadowScale / multiplier; 13533 const offset = params.shadowOffset; 13534 $cubeShadowEl.transform(`scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`); 13535 } 13536 } 13537 13538 const zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0; 13539 $wrapperEl.transform(`translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`); 13540 }; 13541 13542 const setTransition = duration => { 13543 const { 13544 $el, 13545 slides 13546 } = swiper; 13547 slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); 13548 13549 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { 13550 $el.find('.swiper-cube-shadow').transition(duration); 13551 } 13552 }; 13553 13554 effectInit({ 13555 effect: 'cube', 13556 swiper, 13557 on, 13558 setTranslate, 13559 setTransition, 13560 perspective: () => true, 13561 overwriteParams: () => ({ 13562 slidesPerView: 1, 13563 slidesPerGroup: 1, 13564 watchSlidesProgress: true, 13565 resistanceRatio: 0, 13566 spaceBetween: 0, 13567 centeredSlides: false, 13568 virtualTranslate: true 13569 }) 13570 }); 13571} 13572;// CONCATENATED MODULE: ./node_modules/swiper/shared/create-shadow.js 13573 13574function create_shadow_createShadow(params, $slideEl, side) { 13575 const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}`; 13576 const $shadowContainer = params.transformEl ? $slideEl.find(params.transformEl) : $slideEl; 13577 let $shadowEl = $shadowContainer.children(`.${shadowClass}`); 13578 13579 if (!$shadowEl.length) { 13580 $shadowEl = $(`<div class="swiper-slide-shadow${side ? `-${side}` : ''}"></div>`); 13581 $shadowContainer.append($shadowEl); 13582 } 13583 13584 return $shadowEl; 13585} 13586;// CONCATENATED MODULE: ./node_modules/swiper/modules/effect-flip/effect-flip.js 13587 13588 13589 13590 13591function EffectFlip({ 13592 swiper, 13593 extendParams, 13594 on 13595}) { 13596 extendParams({ 13597 flipEffect: { 13598 slideShadows: true, 13599 limitRotation: true, 13600 transformEl: null 13601 } 13602 }); 13603 13604 const setTranslate = () => { 13605 const { 13606 slides, 13607 rtlTranslate: rtl 13608 } = swiper; 13609 const params = swiper.params.flipEffect; 13610 13611 for (let i = 0; i < slides.length; i += 1) { 13612 const $slideEl = slides.eq(i); 13613 let progress = $slideEl[0].progress; 13614 13615 if (swiper.params.flipEffect.limitRotation) { 13616 progress = Math.max(Math.min($slideEl[0].progress, 1), -1); 13617 } 13618 13619 const offset = $slideEl[0].swiperSlideOffset; 13620 const rotate = -180 * progress; 13621 let rotateY = rotate; 13622 let rotateX = 0; 13623 let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; 13624 let ty = 0; 13625 13626 if (!swiper.isHorizontal()) { 13627 ty = tx; 13628 tx = 0; 13629 rotateX = -rotateY; 13630 rotateY = 0; 13631 } else if (rtl) { 13632 rotateY = -rotateY; 13633 } 13634 13635 $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length; 13636 13637 if (params.slideShadows) { 13638 // Set shadows 13639 let shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 13640 let shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 13641 13642 if (shadowBefore.length === 0) { 13643 shadowBefore = createShadow(params, $slideEl, swiper.isHorizontal() ? 'left' : 'top'); 13644 } 13645 13646 if (shadowAfter.length === 0) { 13647 shadowAfter = createShadow(params, $slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); 13648 } 13649 13650 if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); 13651 if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); 13652 } 13653 13654 const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`; 13655 const $targetEl = effectTarget(params, $slideEl); 13656 $targetEl.transform(transform); 13657 } 13658 }; 13659 13660 const setTransition = duration => { 13661 const { 13662 transformEl 13663 } = swiper.params.flipEffect; 13664 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 13665 $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); 13666 effectVirtualTransitionEnd({ 13667 swiper, 13668 duration, 13669 transformEl 13670 }); 13671 }; 13672 13673 effectInit({ 13674 effect: 'flip', 13675 swiper, 13676 on, 13677 setTranslate, 13678 setTransition, 13679 perspective: () => true, 13680 overwriteParams: () => ({ 13681 slidesPerView: 1, 13682 slidesPerGroup: 1, 13683 watchSlidesProgress: true, 13684 spaceBetween: 0, 13685 virtualTranslate: !swiper.params.cssMode 13686 }) 13687 }); 13688} 13689;// CONCATENATED MODULE: ./node_modules/swiper/modules/effect-coverflow/effect-coverflow.js 13690 13691 13692 13693function EffectCoverflow({ 13694 swiper, 13695 extendParams, 13696 on 13697}) { 13698 extendParams({ 13699 coverflowEffect: { 13700 rotate: 50, 13701 stretch: 0, 13702 depth: 100, 13703 scale: 1, 13704 modifier: 1, 13705 slideShadows: true, 13706 transformEl: null 13707 } 13708 }); 13709 13710 const setTranslate = () => { 13711 const { 13712 width: swiperWidth, 13713 height: swiperHeight, 13714 slides, 13715 slidesSizesGrid 13716 } = swiper; 13717 const params = swiper.params.coverflowEffect; 13718 const isHorizontal = swiper.isHorizontal(); 13719 const transform = swiper.translate; 13720 const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; 13721 const rotate = isHorizontal ? params.rotate : -params.rotate; 13722 const translate = params.depth; // Each slide offset from center 13723 13724 for (let i = 0, length = slides.length; i < length; i += 1) { 13725 const $slideEl = slides.eq(i); 13726 const slideSize = slidesSizesGrid[i]; 13727 const slideOffset = $slideEl[0].swiperSlideOffset; 13728 const offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * params.modifier; 13729 let rotateY = isHorizontal ? rotate * offsetMultiplier : 0; 13730 let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0 13731 13732 let translateZ = -translate * Math.abs(offsetMultiplier); 13733 let stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders 13734 13735 if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) { 13736 stretch = parseFloat(params.stretch) / 100 * slideSize; 13737 } 13738 13739 let translateY = isHorizontal ? 0 : stretch * offsetMultiplier; 13740 let translateX = isHorizontal ? stretch * offsetMultiplier : 0; 13741 let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values 13742 13743 if (Math.abs(translateX) < 0.001) translateX = 0; 13744 if (Math.abs(translateY) < 0.001) translateY = 0; 13745 if (Math.abs(translateZ) < 0.001) translateZ = 0; 13746 if (Math.abs(rotateY) < 0.001) rotateY = 0; 13747 if (Math.abs(rotateX) < 0.001) rotateX = 0; 13748 if (Math.abs(scale) < 0.001) scale = 0; 13749 const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`; 13750 const $targetEl = effectTarget(params, $slideEl); 13751 $targetEl.transform(slideTransform); 13752 $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; 13753 13754 if (params.slideShadows) { 13755 // Set shadows 13756 let $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 13757 let $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 13758 13759 if ($shadowBeforeEl.length === 0) { 13760 $shadowBeforeEl = createShadow(params, $slideEl, isHorizontal ? 'left' : 'top'); 13761 } 13762 13763 if ($shadowAfterEl.length === 0) { 13764 $shadowAfterEl = createShadow(params, $slideEl, isHorizontal ? 'right' : 'bottom'); 13765 } 13766 13767 if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; 13768 if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; 13769 } 13770 } 13771 }; 13772 13773 const setTransition = duration => { 13774 const { 13775 transformEl 13776 } = swiper.params.coverflowEffect; 13777 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 13778 $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); 13779 }; 13780 13781 effectInit({ 13782 effect: 'coverflow', 13783 swiper, 13784 on, 13785 setTranslate, 13786 setTransition, 13787 perspective: () => true, 13788 overwriteParams: () => ({ 13789 watchSlidesProgress: true 13790 }) 13791 }); 13792} 13793;// CONCATENATED MODULE: ./node_modules/swiper/modules/effect-creative/effect-creative.js 13794 13795 13796 13797 13798function EffectCreative({ 13799 swiper, 13800 extendParams, 13801 on 13802}) { 13803 extendParams({ 13804 creativeEffect: { 13805 transformEl: null, 13806 limitProgress: 1, 13807 shadowPerProgress: false, 13808 progressMultiplier: 1, 13809 perspective: true, 13810 prev: { 13811 translate: [0, 0, 0], 13812 rotate: [0, 0, 0], 13813 opacity: 1, 13814 scale: 1 13815 }, 13816 next: { 13817 translate: [0, 0, 0], 13818 rotate: [0, 0, 0], 13819 opacity: 1, 13820 scale: 1 13821 } 13822 } 13823 }); 13824 13825 const getTranslateValue = value => { 13826 if (typeof value === 'string') return value; 13827 return `${value}px`; 13828 }; 13829 13830 const setTranslate = () => { 13831 const { 13832 slides, 13833 $wrapperEl, 13834 slidesSizesGrid 13835 } = swiper; 13836 const params = swiper.params.creativeEffect; 13837 const { 13838 progressMultiplier: multiplier 13839 } = params; 13840 const isCenteredSlides = swiper.params.centeredSlides; 13841 13842 if (isCenteredSlides) { 13843 const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0; 13844 $wrapperEl.transform(`translateX(calc(50% - ${margin}px))`); 13845 } 13846 13847 for (let i = 0; i < slides.length; i += 1) { 13848 const $slideEl = slides.eq(i); 13849 const slideProgress = $slideEl[0].progress; 13850 const progress = Math.min(Math.max($slideEl[0].progress, -params.limitProgress), params.limitProgress); 13851 let originalProgress = progress; 13852 13853 if (!isCenteredSlides) { 13854 originalProgress = Math.min(Math.max($slideEl[0].originalProgress, -params.limitProgress), params.limitProgress); 13855 } 13856 13857 const offset = $slideEl[0].swiperSlideOffset; 13858 const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0]; 13859 const r = [0, 0, 0]; 13860 let custom = false;
13861 13862 if (!swiper.isHorizontal()) { 13863 t[1] = t[0]; 13864 t[0] = 0; 13865 } 13866 13867 let data = { 13868 translate: [0, 0, 0], 13869 rotate: [0, 0, 0], 13870 scale: 1, 13871 opacity: 1 13872 }; 13873 13874 if (progress < 0) { 13875 data = params.next; 13876 custom = true; 13877 } else if (progress > 0) { 13878 data = params.prev; 13879 custom = true; 13880 } // set translate 13881 13882 13883 t.forEach((value, index) => { 13884 t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`; 13885 }); // set rotates 13886 13887 r.forEach((value, index) => { 13888 r[index] = data.rotate[index] * Math.abs(progress * multiplier); 13889 }); 13890 $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 13891 const translateString = t.join(', '); 13892 const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`; 13893 const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`; 13894 const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier; 13895 const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; // Set shadows 13896 13897 if (custom && data.shadow || !custom) { 13898 let $shadowEl = $slideEl.children('.swiper-slide-shadow'); 13899 13900 if ($shadowEl.length === 0 && data.shadow) { 13901 $shadowEl = createShadow(params, $slideEl); 13902 } 13903 13904 if ($shadowEl.length) { 13905 const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; 13906 $shadowEl[0].style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); 13907 } 13908 } 13909 13910 const $targetEl = effectTarget(params, $slideEl); 13911 $targetEl.transform(transform).css({ 13912 opacity: opacityString 13913 }); 13914 13915 if (data.origin) { 13916 $targetEl.css('transform-origin', data.origin); 13917 } 13918 } 13919 }; 13920 13921 const setTransition = duration => { 13922 const { 13923 transformEl 13924 } = swiper.params.creativeEffect; 13925 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 13926 $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); 13927 effectVirtualTransitionEnd({ 13928 swiper, 13929 duration, 13930 transformEl, 13931 allSlides: true 13932 }); 13933 }; 13934 13935 effectInit({ 13936 effect: 'creative', 13937 swiper, 13938 on, 13939 setTranslate, 13940 setTransition, 13941 perspective: () => swiper.params.creativeEffect.perspective, 13942 overwriteParams: () => ({ 13943 watchSlidesProgress: true, 13944 virtualTranslate: !swiper.params.cssMode 13945 }) 13946 }); 13947} 13948;// CONCATENATED MODULE: ./node_modules/swiper/modules/effect-cards/effect-cards.js 13949 13950 13951 13952 13953function EffectCards({ 13954 swiper, 13955 extendParams, 13956 on 13957}) { 13958 extendParams({ 13959 cardsEffect: { 13960 slideShadows: true, 13961 transformEl: null 13962 } 13963 }); 13964 13965 const setTranslate = () => { 13966 const { 13967 slides, 13968 activeIndex 13969 } = swiper; 13970 const params = swiper.params.cardsEffect; 13971 const { 13972 startTranslate, 13973 isTouched 13974 } = swiper.touchEventsData; 13975 const currentTranslate = swiper.translate; 13976 13977 for (let i = 0; i < slides.length; i += 1) { 13978 const $slideEl = slides.eq(i); 13979 const slideProgress = $slideEl[0].progress; 13980 const progress = Math.min(Math.max(slideProgress, -4), 4); 13981 let offset = $slideEl[0].swiperSlideOffset; 13982 13983 if (swiper.params.centeredSlides && !swiper.params.cssMode) { 13984 swiper.$wrapperEl.transform(`translateX(${swiper.minTranslate()}px)`); 13985 } 13986 13987 if (swiper.params.centeredSlides && swiper.params.cssMode) { 13988 offset -= slides[0].swiperSlideOffset; 13989 } 13990 13991 let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; 13992 let tY = 0; 13993 const tZ = -100 * Math.abs(progress); 13994 let scale = 1; 13995 let rotate = -2 * progress; 13996 let tXAdd = 8 - Math.abs(progress) * 0.75; 13997 const isSwipeToNext = (i === activeIndex || i === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; 13998 const isSwipeToPrev = (i === activeIndex || i === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; 13999 14000 if (isSwipeToNext || isSwipeToPrev) { 14001 const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5; 14002 rotate += -28 * progress * subProgress; 14003 scale += -0.5 * subProgress; 14004 tXAdd += 96 * subProgress; 14005 tY = `${-25 * subProgress * Math.abs(progress)}%`; 14006 } 14007 14008 if (progress < 0) { 14009 // next 14010 tX = `calc(${tX}px + (${tXAdd * Math.abs(progress)}%))`;
14011 } else if (progress > 0) { 14012 // prev 14013 tX = `calc(${tX}px + (-${tXAdd * Math.abs(progress)}%))`; 14014 } else { 14015 tX = `${tX}px`; 14016 } 14017 14018 if (!swiper.isHorizontal()) { 14019 const prevY = tY; 14020 tY = tX; 14021 tX = prevY; 14022 } 14023 14024 const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`; 14025 const transform = ` 14026 translate3d(${tX}, ${tY}, ${tZ}px) 14027 rotateZ(${rotate}deg) 14028 scale(${scaleString}) 14029 `; 14030 14031 if (params.slideShadows) { 14032 // Set shadows 14033 let $shadowEl = $slideEl.find('.swiper-slide-shadow'); 14034 14035 if ($shadowEl.length === 0) { 14036 $shadowEl = createShadow(params, $slideEl); 14037 } 14038 14039 if ($shadowEl.length) $shadowEl[0].style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); 14040 } 14041 14042 $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 14043 const $targetEl = effectTarget(params, $slideEl); 14044 $targetEl.transform(transform); 14045 } 14046 }; 14047 14048 const setTransition = duration => { 14049 const { 14050 transformEl 14051 } = swiper.params.cardsEffect; 14052 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 14053 $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); 14054 effectVirtualTransitionEnd({ 14055 swiper, 14056 duration, 14057 transformEl 14058 }); 14059 }; 14060 14061 effectInit({ 14062 effect: 'cards', 14063 swiper, 14064 on, 14065 setTranslate, 14066 setTransition, 14067 perspective: () => true, 14068 overwriteParams: () => ({ 14069 watchSlidesProgress: true, 14070 virtualTranslate: !swiper.params.cssMode 14071 }) 14072 }); 14073} 14074;// CONCATENATED MODULE: ./node_modules/swiper/swiper.esm.js 14075/** 14076 * Swiper 7.4.1 14077 * Most modern mobile touch slider and framework with hardware accelerated transitions 14078 * https://swiperjs.com 14079 * 14080 * Copyright 2014-2021 Vladimir Kharlampidi 14081 * 14082 * Released under the MIT License 14083 * 14084 * Released on: December 24, 2021 14085 */ 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112;// CONCATENATED MODULE: ./src/js/modules/slider.js 14113function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);enumerableOnly && (symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;})), keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = null != arguments[i] ? arguments[i] : {};i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {_defineProperty(target, key, source[key]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}return target;} 14114 14115 14116core.use([Navigation, Pagination, Autoplay]); 14117 14118function initHeroSlider(parentEl, container, options) { 14119 var swiper = new core(container, _objectSpread({}, options)); 14120 var parent = document.querySelector(parentEl); 14121 var swiperSlides = document.querySelectorAll("".concat(container, " .swiper-slide")); 14122 swiper.on('activeIndexChange', function () { 14123 setHeroBg(); 14124 }); 14125 14126 function setHeroBg() { 14127 var path = swiperSlides[swiper.activeIndex].dataset.bg; 14128 parent.style.backgroundImage = "url(\"".concat(path, "\")"); 14129 } 14130 setHeroBg(); 14131} 14132 14133// basic swiper initialization 14134function initSwiperSlider(container, options) { 14135 var swiper = new Swiper(container, _objectSpread({}, options)); 14136} 14137// EXTERNAL MODULE: ./node_modules/sweetalert2/dist/sweetalert2.js 14138var sweetalert2 = __webpack_require__(764); 14139var sweetalert2_default = /*#__PURE__*/__webpack_require__.n(sweetalert2); 14140;// CONCATENATED MODULE: ./src/js/modules/notification.js 14141function notification_ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);enumerableOnly && (symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;})), keys.push.apply(keys, symbols);}return keys;}function notification_objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = null != arguments[i] ? arguments[i] : {};
14141i % 2 ? notification_ownKeys(Object(source), !0).forEach(function (key) {_defineProperty(target, key, source[key]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : notification_ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}return target;} 14142 14143 14144 14145function drawNotification(settings, alertText) { 14146 sweetalert2_default().fire(notification_objectSpread({ 14147 showClass: { 14148 popup: 'fadeIn' }, 14149 14150 hideClass: { 14151 popup: 'fadeOut' }, 14152 14153 showConfirmButton: false, 14154 showCloseButton: true, 14155 closeButtonHtml: "\n <i class=\"icon-close\"></i>\n ", 14156 14157 14158 html: "\n <p class=\"main\">".concat( 14159 alertText ? alertText : '', "</p>") }, 14160 settings)); 14161 14162} 14163 14164/* harmony default export */ const notification = (drawNotification); 14165;// CONCATENATED MODULE: ./src/js/index.js 14166 14167 14168 14169 14170 14171var isShown = false; 14172 14173document.addEventListener('DOMContentLoaded', function () { 14174 14175 window.addEventListener('scroll', openPromoModal); 14176 14177 initHeroSlider('.hero', '.hero_slider', { 14178 direction: 'horizontal', 14179 loop: true, 14180 speed: 1000, 14181 slidesPerView: 1, 14182 pagination: { 14183 el: '.swiper-pagination', 14184 type: "progressbar" }, 14185 14186 navigation: { 14187 nextEl: '.hero_slider-control--next', 14188 prevEl: '.hero_slider-control--prev' }, 14189 14190 autoplay: { 14191 delay: 5000 } }); 14192 14193 14194 14195}); 14196 14197function openPromoModal() { 14198 if (window.pageYOffset > 1000 && !isShown) { 14199 notification({ 14200 title: 'Try 3 Classes for Free!', 14201 showCloseButton: true, 14202 closeButtonHtml: "\n <i class=\"icon-close\"></i>\n ", 14203 14204 14205 html: "\n <p>\n </p>\n <a class=\"btn theme-element\" href=\"https://bfitcrossfit.com/getting-started\">Click Here to Sign Up</a>\n ", 14206 14207 14208 14209 14210 14211 customClass: { 14212 popup: 'promo_popup', 14213 title: 'promo_popup-title', 14214 htmlContainer: 'promo_popup-content', 14215 closeButton: 'promo_popup-close', 14216 container: 'promo_popup-container' } }); 14217 14218 14219 isShown = true; 14220 } 14221} 14222})(); 14223 14224/******/ })() 14225;
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.