PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.4.14
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.4.14
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / public / assets / js / swiper.js

swiper.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.4.14, at public/assets/js/swiper.js

8,125 lines 273.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Swiper 4.5.0
3 * Most modern mobile touch slider and framework with hardware accelerated transitions
4 * http://www.idangero.us/swiper/
5 *
6 * Copyright 2014-2019 Vladimir Kharlampidi
7 *
8 * Released under the MIT License
9 *
10 * Released on: February 22, 2019
11 */
12
13 (function (global, factory) {
14 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
15 typeof define === 'function' && define.amd ? define(factory) :
16 (global = global || self, global.Swiper = factory());
17 }(this, function () { 'use strict';
18
19 /**
20 * SSR Window 1.0.1
21 * Better handling for window object in SSR environment
22 * https://github.com/nolimits4web/ssr-window
23 *
24 * Copyright 2018, Vladimir Kharlampidi
25 *
26 * Licensed under MIT
27 *
28 * Released on: July 18, 2018
29 */
30 var doc = (typeof document === 'undefined') ? {
31 body: {},
32 addEventListener: function addEventListener() {},
33 removeEventListener: function removeEventListener() {},
34 activeElement: {
35 blur: function blur() {},
36 nodeName: '',
37 },
38 querySelector: function querySelector() {
39 return null;
40 },
41 querySelectorAll: function querySelectorAll() {
42 return [];
43 },
44 getElementById: function getElementById() {
45 return null;
46 },
47 createEvent: function createEvent() {
48 return {
49 initEvent: function initEvent() {},
50 };
51 },
52 createElement: function createElement() {
53 return {
54 children: [],
55 childNodes: [],
56 style: {},
57 setAttribute: function setAttribute() {},
58 getElementsByTagName: function getElementsByTagName() {
59 return [];
60 },
61 };
62 },
63 location: { hash: '' },
64 } : document; // eslint-disable-line
65
66 var win = (typeof window === 'undefined') ? {
67 document: doc,
68 navigator: {
69 userAgent: '',
70 },
71 location: {},
72 history: {},
73 CustomEvent: function CustomEvent() {
74 return this;
75 },
76 addEventListener: function addEventListener() {},
77 removeEventListener: function removeEventListener() {},
78 getComputedStyle: function getComputedStyle() {
79 return {
80 getPropertyValue: function getPropertyValue() {
81 return '';
82 },
83 };
84 },
85 Image: function Image() {},
86 Date: function Date() {},
87 screen: {},
88 setTimeout: function setTimeout() {},
89 clearTimeout: function clearTimeout() {},
90 } : window; // eslint-disable-line
91
92 /**
93 * Dom7 2.1.3
94 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
95 * http://framework7.io/docs/dom.html
96 *
97 * Copyright 2019, Vladimir Kharlampidi
98 * The iDangero.us
99 * http://www.idangero.us/
100 *
101 * Licensed under MIT
102 *
103 * Released on: February 11, 2019
104 */
105
106 var Dom7 = function Dom7(arr) {
107 var self = this;
108 // Create array-like object
109 for (var i = 0; i < arr.length; i += 1) {
110 self[i] = arr[i];
111 }
112 self.length = arr.length;
113 // Return collection with methods
114 return this;
115 };
116
117 function $(selector, context) {
118 var arr = [];
119 var i = 0;
120 if (selector && !context) {
121 if (selector instanceof Dom7) {
122 return selector;
123 }
124 }
125 if (selector) {
126 // String
127 if (typeof selector === 'string') {
128 var els;
129 var tempParent;
130 var html = selector.trim();
131 if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
132 var toCreate = 'div';
133 if (html.indexOf('<li') === 0) { toCreate = 'ul'; }
134 if (html.indexOf('<tr') === 0) { toCreate = 'tbody'; }
135 if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) { toCreate = 'tr'; }
136 if (html.indexOf('<tbody') === 0) { toCreate = 'table'; }
137 if (html.indexOf('<option') === 0) { toCreate = 'select'; }
138 tempParent = doc.createElement(toCreate);
139 tempParent.innerHTML = html;
140 for (i = 0; i < tempParent.childNodes.length; i += 1) {
141 arr.push(tempParent.childNodes[i]);
142 }
143 } else {
144 if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
145 // Pure ID selector
146 els = [doc.getElementById(selector.trim().split('#')[1])];
147 } else {
148 // Other selectors
149 els = (context || doc).querySelectorAll(selector.trim());
150 }
151 for (i = 0; i < els.length; i += 1) {
152 if (els[i]) { arr.push(els[i]); }
153 }
154 }
155 } else if (selector.nodeType || selector === win || selector === doc) {
156 // Node/element
157 arr.push(selector);
158 } else if (selector.length > 0 && selector[0].nodeType) {
159 // Array of elements or instance of Dom
160 for (i = 0; i < selector.length; i += 1) {
161 arr.push(selector[i]);
162 }
163 }
164 }
165 return new Dom7(arr);
166 }
167
168 $.fn = Dom7.prototype;
169 $.Class = Dom7;
170 $.Dom7 = Dom7;
171
172 function unique(arr) {
173 var uniqueArray = [];
174 for (var i = 0; i < arr.length; i += 1) {
175 if (uniqueArray.indexOf(arr[i]) === -1) { uniqueArray.push(arr[i]); }
176 }
177 return uniqueArray;
178 }
179
180 // Classes and attributes
181 function addClass(className) {
182 if (typeof className === 'undefined') {
183 return this;
184 }
185 var classes = className.split(' ');
186 for (var i = 0; i < classes.length; i += 1) {
187 for (var j = 0; j < this.length; j += 1) {
188 if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') { this[j].classList.add(classes[i]); }
189 }
190 }
191 return this;
192 }
193 function removeClass(className) {
194 var classes = className.split(' ');
195 for (var i = 0; i < classes.length; i += 1) {
196 for (var j = 0; j < this.length; j += 1) {
197 if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') { this[j].classList.remove(classes[i]); }
198 }
199 }
200 return this;
201 }
202 function hasClass(className) {
203 if (!this[0]) { return false; }
204 return this[0].classList.contains(className);
205 }
206 function toggleClass(className) {
207 var classes = className.split(' ');
208 for (var i = 0; i < classes.length; i += 1) {
209 for (var j = 0; j < this.length; j += 1) {
210 if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') { this[j].classList.toggle(classes[i]); }
211 }
212 }
213 return this;
214 }
215 function attr(attrs, value) {
216 var arguments$1 = arguments;
217
218 if (arguments.length === 1 && typeof attrs === 'string') {
219 // Get attr
220 if (this[0]) { return this[0].getAttribute(attrs); }
221 return undefined;
222 }
223
224 // Set attrs
225 for (var i = 0; i < this.length; i += 1) {
226 if (arguments$1.length === 2) {
227 // String
228 this[i].setAttribute(attrs, value);
229 } else {
230 // Object
231 // eslint-disable-next-line
232 for (var attrName in attrs) {
233 this[i][attrName] = attrs[attrName];
234 this[i].setAttribute(attrName, attrs[attrName]);
235 }
236 }
237 }
238 return this;
239 }
240 // eslint-disable-next-line
241 function removeAttr(attr) {
242 for (var i = 0; i < this.length; i += 1) {
243 this[i].removeAttribute(attr);
244 }
245 return this;
246 }
247 function data(key, value) {
248 var el;
249 if (typeof value === 'undefined') {
250 el = this[0];
251 // Get value
252 if (el) {
253 if (el.dom7ElementDataStorage && (key in el.dom7ElementDataStorage)) {
254 return el.dom7ElementDataStorage[key];
255 }
256
257 var dataKey = el.getAttribute(("data-" + key));
258 if (dataKey) {
259 return dataKey;
260 }
261 return undefined;
262 }
263 return undefined;
264 }
265
266 // Set value
267 for (var i = 0; i < this.length; i += 1) {
268 el = this[i];
269 if (!el.dom7ElementDataStorage) { el.dom7ElementDataStorage = {}; }
270 el.dom7ElementDataStorage[key] = value;
271 }
272 return this;
273 }
274 // Transforms
275 // eslint-disable-next-line
276 function transform(transform) {
277 for (var i = 0; i < this.length; i += 1) {
278 var elStyle = this[i].style;
279 elStyle.webkitTransform = transform;
280 elStyle.transform = transform;
281 }
282 return this;
283 }
284 function transition(duration) {
285 if (typeof duration !== 'string') {
286 duration = duration + "ms"; // eslint-disable-line
287 }
288 for (var i = 0; i < this.length; i += 1) {
289 var elStyle = this[i].style;
290 elStyle.webkitTransitionDuration = duration;
291 elStyle.transitionDuration = duration;
292 }
293 return this;
294 }
295 // Events
296 function on() {
297 var assign;
298
299 var args = [], len = arguments.length;
300 while ( len-- ) args[ len ] = arguments[ len ];
301 var eventType = args[0];
302 var targetSelector = args[1];
303 var listener = args[2];
304 var capture = args[3];
305 if (typeof args[1] === 'function') {
306 (assign = args, eventType = assign[0], listener = assign[1], capture = assign[2]);
307 targetSelector = undefined;
308 }
309 if (!capture) { capture = false; }
310
311 function handleLiveEvent(e) {
312 var target = e.target;
313 if (!target) { return; }
314 var eventData = e.target.dom7EventData || [];
315 if (eventData.indexOf(e) < 0) {
316 eventData.unshift(e);
317 }
318 if ($(target).is(targetSelector)) { listener.apply(target, eventData); }
319 else {
320 var parents = $(target).parents(); // eslint-disable-line
321 for (var k = 0; k < parents.length; k += 1) {
322 if ($(parents[k]).is(targetSelector)) { listener.apply(parents[k], eventData); }
323 }
324 }
325 }
326 function handleEvent(e) {
327 var eventData = e && e.target ? e.target.dom7EventData || [] : [];
328 if (eventData.indexOf(e) < 0) {
329 eventData.unshift(e);
330 }
331 listener.apply(this, eventData);
332 }
333 var events = eventType.split(' ');
334 var j;
335 for (var i = 0; i < this.length; i += 1) {
336 var el = this[i];
337 if (!targetSelector) {
338 for (j = 0; j < events.length; j += 1) {
339 var event = events[j];
340 if (!el.dom7Listeners) { el.dom7Listeners = {}; }
341 if (!el.dom7Listeners[event]) { el.dom7Listeners[event] = []; }
342 el.dom7Listeners[event].push({
343 listener: listener,
344 proxyListener: handleEvent,
345 });
346 el.addEventListener(event, handleEvent, capture);
347 }
348 } else {
349 // Live events
350 for (j = 0; j < events.length; j += 1) {
351 var event$1 = events[j];
352 if (!el.dom7LiveListeners) { el.dom7LiveListeners = {}; }
353 if (!el.dom7LiveListeners[event$1]) { el.dom7LiveListeners[event$1] = []; }
354 el.dom7LiveListeners[event$1].push({
355 listener: listener,
356 proxyListener: handleLiveEvent,
357 });
358 el.addEventListener(event$1, handleLiveEvent, capture);
359 }
360 }
361 }
362 return this;
363 }
364 function off() {
365 var assign;
366
367 var args = [], len = arguments.length;
368 while ( len-- ) args[ len ] = arguments[ len ];
369 var eventType = args[0];
370 var targetSelector = args[1];
371 var listener = args[2];
372 var capture = args[3];
373 if (typeof args[1] === 'function') {
374 (assign = args, eventType = assign[0], listener = assign[1], capture = assign[2]);
375 targetSelector = undefined;
376 }
377 if (!capture) { capture = false; }
378
379 var events = eventType.split(' ');
380 for (var i = 0; i < events.length; i += 1) {
381 var event = events[i];
382 for (var j = 0; j < this.length; j += 1) {
383 var el = this[j];
384 var handlers = (void 0);
385 if (!targetSelector && el.dom7Listeners) {
386 handlers = el.dom7Listeners[event];
387 } else if (targetSelector && el.dom7LiveListeners) {
388 handlers = el.dom7LiveListeners[event];
389 }
390 if (handlers && handlers.length) {
391 for (var k = handlers.length - 1; k >= 0; k -= 1) {
392 var handler = handlers[k];
393 if (listener && handler.listener === listener) {
394 el.removeEventListener(event, handler.proxyListener, capture);
395 handlers.splice(k, 1);
396 } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
397 el.removeEventListener(event, handler.proxyListener, capture);
398 handlers.splice(k, 1);
399 } else if (!listener) {
400 el.removeEventListener(event, handler.proxyListener, capture);
401 handlers.splice(k, 1);
402 }
403 }
404 }
405 }
406 }
407 return this;
408 }
409 function trigger() {
410 var args = [], len = arguments.length;
411 while ( len-- ) args[ len ] = arguments[ len ];
412
413 var events = args[0].split(' ');
414 var eventData = args[1];
415 for (var i = 0; i < events.length; i += 1) {
416 var event = events[i];
417 for (var j = 0; j < this.length; j += 1) {
418 var el = this[j];
419 var evt = (void 0);
420 try {
421 evt = new win.CustomEvent(event, {
422 detail: eventData,
423 bubbles: true,
424 cancelable: true,
425 });
426 } catch (e) {
427 evt = doc.createEvent('Event');
428 evt.initEvent(event, true, true);
429 evt.detail = eventData;
430 }
431 // eslint-disable-next-line
432 el.dom7EventData = args.filter(function (data, dataIndex) { return dataIndex > 0; });
433 el.dispatchEvent(evt);
434 el.dom7EventData = [];
435 delete el.dom7EventData;
436 }
437 }
438 return this;
439 }
440 function transitionEnd(callback) {
441 var events = ['webkitTransitionEnd', 'transitionend'];
442 var dom = this;
443 var i;
444 function fireCallBack(e) {
445 /* jshint validthis:true */
446 if (e.target !== this) { return; }
447 callback.call(this, e);
448 for (i = 0; i < events.length; i += 1) {
449 dom.off(events[i], fireCallBack);
450 }
451 }
452 if (callback) {
453 for (i = 0; i < events.length; i += 1) {
454 dom.on(events[i], fireCallBack);
455 }
456 }
457 return this;
458 }
459 function outerWidth(includeMargins) {
460 if (this.length > 0) {
461 if (includeMargins) {
462 // eslint-disable-next-line
463 var styles = this.styles();
464 return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left'));
465 }
466 return this[0].offsetWidth;
467 }
468 return null;
469 }
470 function outerHeight(includeMargins) {
471 if (this.length > 0) {
472 if (includeMargins) {
473 // eslint-disable-next-line
474 var styles = this.styles();
475 return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom'));
476 }
477 return this[0].offsetHeight;
478 }
479 return null;
480 }
481 function offset() {
482 if (this.length > 0) {
483 var el = this[0];
484 var box = el.getBoundingClientRect();
485 var body = doc.body;
486 var clientTop = el.clientTop || body.clientTop || 0;
487 var clientLeft = el.clientLeft || body.clientLeft || 0;
488 var scrollTop = el === win ? win.scrollY : el.scrollTop;
489 var scrollLeft = el === win ? win.scrollX : el.scrollLeft;
490 return {
491 top: (box.top + scrollTop) - clientTop,
492 left: (box.left + scrollLeft) - clientLeft,
493 };
494 }
495
496 return null;
497 }
498 function styles() {
499 if (this[0]) { return win.getComputedStyle(this[0], null); }
500 return {};
501 }
502 function css(props, value) {
503 var i;
504 if (arguments.length === 1) {
505 if (typeof props === 'string') {
506 if (this[0]) { return win.getComputedStyle(this[0], null).getPropertyValue(props); }
507 } else {
508 for (i = 0; i < this.length; i += 1) {
509 // eslint-disable-next-line
510 for (var prop in props) {
511 this[i].style[prop] = props[prop];
512 }
513 }
514 return this;
515 }
516 }
517 if (arguments.length === 2 && typeof props === 'string') {
518 for (i = 0; i < this.length; i += 1) {
519 this[i].style[props] = value;
520 }
521 return this;
522 }
523 return this;
524 }
525 // Iterate over the collection passing elements to `callback`
526 function each(callback) {
527 // Don't bother continuing without a callback
528 if (!callback) { return this; }
529 // Iterate over the current collection
530 for (var i = 0; i < this.length; i += 1) {
531 // If the callback returns false
532 if (callback.call(this[i], i, this[i]) === false) {
533 // End the loop early
534 return this;
535 }
536 }
537 // Return `this` to allow chained DOM operations
538 return this;
539 }
540 // eslint-disable-next-line
541 function html(html) {
542 if (typeof html === 'undefined') {
543 return this[0] ? this[0].innerHTML : undefined;
544 }
545
546 for (var i = 0; i < this.length; i += 1) {
547 this[i].innerHTML = html;
548 }
549 return this;
550 }
551 // eslint-disable-next-line
552 function text(text) {
553 if (typeof text === 'undefined') {
554 if (this[0]) {
555 return this[0].textContent.trim();
556 }
557 return null;
558 }
559
560 for (var i = 0; i < this.length; i += 1) {
561 this[i].textContent = text;
562 }
563 return this;
564 }
565 function is(selector) {
566 var el = this[0];
567 var compareWith;
568 var i;
569 if (!el || typeof selector === 'undefined') { return false; }
570 if (typeof selector === 'string') {
571 if (el.matches) { return el.matches(selector); }
572 else if (el.webkitMatchesSelector) { return el.webkitMatchesSelector(selector); }
573 else if (el.msMatchesSelector) { return el.msMatchesSelector(selector); }
574
575 compareWith = $(selector);
576 for (i = 0; i < compareWith.length; i += 1) {
577 if (compareWith[i] === el) { return true; }
578 }
579 return false;
580 } else if (selector === doc) { return el === doc; }
581 else if (selector === win) { return el === win; }
582
583 if (selector.nodeType || selector instanceof Dom7) {
584 compareWith = selector.nodeType ? [selector] : selector;
585 for (i = 0; i < compareWith.length; i += 1) {
586 if (compareWith[i] === el) { return true; }
587 }
588 return false;
589 }
590 return false;
591 }
592 function index() {
593 var child = this[0];
594 var i;
595 if (child) {
596 i = 0;
597 // eslint-disable-next-line
598 while ((child = child.previousSibling) !== null) {
599 if (child.nodeType === 1) { i += 1; }
600 }
601 return i;
602 }
603 return undefined;
604 }
605 // eslint-disable-next-line
606 function eq(index) {
607 if (typeof index === 'undefined') { return this; }
608 var length = this.length;
609 var returnIndex;
610 if (index > length - 1) {
611 return new Dom7([]);
612 }
613 if (index < 0) {
614 returnIndex = length + index;
615 if (returnIndex < 0) { return new Dom7([]); }
616 return new Dom7([this[returnIndex]]);
617 }
618 return new Dom7([this[index]]);
619 }
620 function append() {
621 var args = [], len = arguments.length;
622 while ( len-- ) args[ len ] = arguments[ len ];
623
624 var newChild;
625
626 for (var k = 0; k < args.length; k += 1) {
627 newChild = args[k];
628 for (var i = 0; i < this.length; i += 1) {
629 if (typeof newChild === 'string') {
630 var tempDiv = doc.createElement('div');
631 tempDiv.innerHTML = newChild;
632 while (tempDiv.firstChild) {
633 this[i].appendChild(tempDiv.firstChild);
634 }
635 } else if (newChild instanceof Dom7) {
636 for (var j = 0; j < newChild.length; j += 1) {
637 this[i].appendChild(newChild[j]);
638 }
639 } else {
640 this[i].appendChild(newChild);
641 }
642 }
643 }
644
645 return this;
646 }
647 function prepend(newChild) {
648 var i;
649 var j;
650 for (i = 0; i < this.length; i += 1) {
651 if (typeof newChild === 'string') {
652 var tempDiv = doc.createElement('div');
653 tempDiv.innerHTML = newChild;
654 for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
655 this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
656 }
657 } else if (newChild instanceof Dom7) {
658 for (j = 0; j < newChild.length; j += 1) {
659 this[i].insertBefore(newChild[j], this[i].childNodes[0]);
660 }
661 } else {
662 this[i].insertBefore(newChild, this[i].childNodes[0]);
663 }
664 }
665 return this;
666 }
667 function next(selector) {
668 if (this.length > 0) {
669 if (selector) {
670 if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
671 return new Dom7([this[0].nextElementSibling]);
672 }
673 return new Dom7([]);
674 }
675
676 if (this[0].nextElementSibling) { return new Dom7([this[0].nextElementSibling]); }
677 return new Dom7([]);
678 }
679 return new Dom7([]);
680 }
681 function nextAll(selector) {
682 var nextEls = [];
683 var el = this[0];
684 if (!el) { return new Dom7([]); }
685 while (el.nextElementSibling) {
686 var next = el.nextElementSibling; // eslint-disable-line
687 if (selector) {
688 if ($(next).is(selector)) { nextEls.push(next); }
689 } else { nextEls.push(next); }
690 el = next;
691 }
692 return new Dom7(nextEls);
693 }
694 function prev(selector) {
695 if (this.length > 0) {
696 var el = this[0];
697 if (selector) {
698 if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
699 return new Dom7([el.previousElementSibling]);
700 }
701 return new Dom7([]);
702 }
703
704 if (el.previousElementSibling) { return new Dom7([el.previousElementSibling]); }
705 return new Dom7([]);
706 }
707 return new Dom7([]);
708 }
709 function prevAll(selector) {
710 var prevEls = [];
711 var el = this[0];
712 if (!el) { return new Dom7([]); }
713 while (el.previousElementSibling) {
714 var prev = el.previousElementSibling; // eslint-disable-line
715 if (selector) {
716 if ($(prev).is(selector)) { prevEls.push(prev); }
717 } else { prevEls.push(prev); }
718 el = prev;
719 }
720 return new Dom7(prevEls);
721 }
722 function parent(selector) {
723 var parents = []; // eslint-disable-line
724 for (var i = 0; i < this.length; i += 1) {
725 if (this[i].parentNode !== null) {
726 if (selector) {
727 if ($(this[i].parentNode).is(selector)) { parents.push(this[i].parentNode); }
728 } else {
729 parents.push(this[i].parentNode);
730 }
731 }
732 }
733 return $(unique(parents));
734 }
735 function parents(selector) {
736 var parents = []; // eslint-disable-line
737 for (var i = 0; i < this.length; i += 1) {
738 var parent = this[i].parentNode; // eslint-disable-line
739 while (parent) {
740 if (selector) {
741 if ($(parent).is(selector)) { parents.push(parent); }
742 } else {
743 parents.push(parent);
744 }
745 parent = parent.parentNode;
746 }
747 }
748 return $(unique(parents));
749 }
750 function closest(selector) {
751 var closest = this; // eslint-disable-line
752 if (typeof selector === 'undefined') {
753 return new Dom7([]);
754 }
755 if (!closest.is(selector)) {
756 closest = closest.parents(selector).eq(0);
757 }
758 return closest;
759 }
760 function find(selector) {
761 var foundElements = [];
762 for (var i = 0; i < this.length; i += 1) {
763 var found = this[i].querySelectorAll(selector);
764 for (var j = 0; j < found.length; j += 1) {
765 foundElements.push(found[j]);
766 }
767 }
768 return new Dom7(foundElements);
769 }
770 function children(selector) {
771 var children = []; // eslint-disable-line
772 for (var i = 0; i < this.length; i += 1) {
773 var childNodes = this[i].childNodes;
774
775 for (var j = 0; j < childNodes.length; j += 1) {
776 if (!selector) {
777 if (childNodes[j].nodeType === 1) { children.push(childNodes[j]); }
778 } else if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) {
779 children.push(childNodes[j]);
780 }
781 }
782 }
783 return new Dom7(unique(children));
784 }
785 function remove() {
786 for (var i = 0; i < this.length; i += 1) {
787 if (this[i].parentNode) { this[i].parentNode.removeChild(this[i]); }
788 }
789 return this;
790 }
791 function add() {
792 var args = [], len = arguments.length;
793 while ( len-- ) args[ len ] = arguments[ len ];
794
795 var dom = this;
796 var i;
797 var j;
798 for (i = 0; i < args.length; i += 1) {
799 var toAdd = $(args[i]);
800 for (j = 0; j < toAdd.length; j += 1) {
801 dom[dom.length] = toAdd[j];
802 dom.length += 1;
803 }
804 }
805 return dom;
806 }
807
808 var Methods = {
809 addClass: addClass,
810 removeClass: removeClass,
811 hasClass: hasClass,
812 toggleClass: toggleClass,
813 attr: attr,
814 removeAttr: removeAttr,
815 data: data,
816 transform: transform,
817 transition: transition,
818 on: on,
819 off: off,
820 trigger: trigger,
821 transitionEnd: transitionEnd,
822 outerWidth: outerWidth,
823 outerHeight: outerHeight,
824 offset: offset,
825 css: css,
826 each: each,
827 html: html,
828 text: text,
829 is: is,
830 index: index,
831 eq: eq,
832 append: append,
833 prepend: prepend,
834 next: next,
835 nextAll: nextAll,
836 prev: prev,
837 prevAll: prevAll,
838 parent: parent,
839 parents: parents,
840 closest: closest,
841 find: find,
842 children: children,
843 remove: remove,
844 add: add,
845 styles: styles,
846 };
847
848 Object.keys(Methods).forEach(function (methodName) {
849 $.fn[methodName] = Methods[methodName];
850 });
851
852 var Utils = {
853 deleteProps: function deleteProps(obj) {
854 var object = obj;
855 Object.keys(object).forEach(function (key) {
856 try {
857 object[key] = null;
858 } catch (e) {
859 // no getter for object
860 }
861 try {
862 delete object[key];
863 } catch (e) {
864 // something got wrong
865 }
866 });
867 },
868 nextTick: function nextTick(callback, delay) {
869 if ( delay === void 0 ) delay = 0;
870
871 return setTimeout(callback, delay);
872 },
873 now: function now() {
874 return Date.now();
875 },
876 getTranslate: function getTranslate(el, axis) {
877 if ( axis === void 0 ) axis = 'x';
878
879 var matrix;
880 var curTransform;
881 var transformMatrix;
882
883 var curStyle = win.getComputedStyle(el, null);
884
885 if (win.WebKitCSSMatrix) {
886 curTransform = curStyle.transform || curStyle.webkitTransform;
887 if (curTransform.split(',').length > 6) {
888 curTransform = curTransform.split(', ').map(function (a) { return a.replace(',', '.'); }).join(', ');
889 }
890 // Some old versions of Webkit choke when 'none' is passed; pass
891 // empty string instead in this case
892 transformMatrix = new win.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
893 } else {
894 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
895 matrix = transformMatrix.toString().split(',');
896 }
897
898 if (axis === 'x') {
899 // Latest Chrome and webkits Fix
900 if (win.WebKitCSSMatrix) { curTransform = transformMatrix.m41; }
901 // Crazy IE10 Matrix
902 else if (matrix.length === 16) { curTransform = parseFloat(matrix[12]); }
903 // Normal Browsers
904 else { curTransform = parseFloat(matrix[4]); }
905 }
906 if (axis === 'y') {
907 // Latest Chrome and webkits Fix
908 if (win.WebKitCSSMatrix) { curTransform = transformMatrix.m42; }
909 // Crazy IE10 Matrix
910 else if (matrix.length === 16) { curTransform = parseFloat(matrix[13]); }
911 // Normal Browsers
912 else { curTransform = parseFloat(matrix[5]); }
913 }
914 return curTransform || 0;
915 },
916 parseUrlQuery: function parseUrlQuery(url) {
917 var query = {};
918 var urlToParse = url || win.location.href;
919 var i;
920 var params;
921 var param;
922 var length;
923 if (typeof urlToParse === 'string' && urlToParse.length) {
924 urlToParse = urlToParse.indexOf('?') > -1 ? urlToParse.replace(/\S*\?/, '') : '';
925 params = urlToParse.split('&').filter(function (paramsPart) { return paramsPart !== ''; });
926 length = params.length;
927
928 for (i = 0; i < length; i += 1) {
929 param = params[i].replace(/#\S+/g, '').split('=');
930 query[decodeURIComponent(param[0])] = typeof param[1] === 'undefined' ? undefined : decodeURIComponent(param[1]) || '';
931 }
932 }
933 return query;
934 },
935 isObject: function isObject(o) {
936 return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object;
937 },
938 extend: function extend() {
939 var args = [], len$1 = arguments.length;
940 while ( len$1-- ) args[ len$1 ] = arguments[ len$1 ];
941
942 var to = Object(args[0]);
943 for (var i = 1; i < args.length; i += 1) {
944 var nextSource = args[i];
945 if (nextSource !== undefined && nextSource !== null) {
946 var keysArray = Object.keys(Object(nextSource));
947 for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
948 var nextKey = keysArray[nextIndex];
949 var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
950 if (desc !== undefined && desc.enumerable) {
951 if (Utils.isObject(to[nextKey]) && Utils.isObject(nextSource[nextKey])) {
952 Utils.extend(to[nextKey], nextSource[nextKey]);
953 } else if (!Utils.isObject(to[nextKey]) && Utils.isObject(nextSource[nextKey])) {
954 to[nextKey] = {};
955 Utils.extend(to[nextKey], nextSource[nextKey]);
956 } else {
957 to[nextKey] = nextSource[nextKey];
958 }
959 }
960 }
961 }
962 }
963 return to;
964 },
965 };
966
967 var Support = (function Support() {
968 var testDiv = doc.createElement('div');
969 return {
970 touch: (win.Modernizr && win.Modernizr.touch === true) || (function checkTouch() {
971 return !!((win.navigator.maxTouchPoints > 0) || ('ontouchstart' in win) || (win.DocumentTouch && doc instanceof win.DocumentTouch));
972 }()),
973
974 pointerEvents: !!(win.navigator.pointerEnabled || win.PointerEvent || ('maxTouchPoints' in win.navigator && win.navigator.maxTouchPoints > 0)),
975 prefixedPointerEvents: !!win.navigator.msPointerEnabled,
976
977 transition: (function checkTransition() {
978 var style = testDiv.style;
979 return ('transition' in style || 'webkitTransition' in style || 'MozTransition' in style);
980 }()),
981 transforms3d: (win.Modernizr && win.Modernizr.csstransforms3d === true) || (function checkTransforms3d() {
982 var style = testDiv.style;
983 return ('webkitPerspective' in style || 'MozPerspective' in style || 'OPerspective' in style || 'MsPerspective' in style || 'perspective' in style);
984 }()),
985
986 flexbox: (function checkFlexbox() {
987 var style = testDiv.style;
988 var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' ');
989 for (var i = 0; i < styles.length; i += 1) {
990 if (styles[i] in style) { return true; }
991 }
992 return false;
993 }()),
994
995 observer: (function checkObserver() {
996 return ('MutationObserver' in win || 'WebkitMutationObserver' in win);
997 }()),
998
999 passiveListener: (function checkPassiveListener() {
1000 var supportsPassive = false;
1001 try {
1002 var opts = Object.defineProperty({}, 'passive', {
1003 // eslint-disable-next-line
1004 get: function get() {
1005 supportsPassive = true;
1006 },
1007 });
1008 win.addEventListener('testPassiveListener', null, opts);
1009 } catch (e) {
1010 // No support
1011 }
1012 return supportsPassive;
1013 }()),
1014
1015 gestures: (function checkGestures() {
1016 return 'ongesturestart' in win;
1017 }()),
1018 };
1019 }());
1020
1021 var Browser = (function Browser() {
1022 function isSafari() {
1023 var ua = win.navigator.userAgent.toLowerCase();
1024 return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);
1025 }
1026 return {
1027 isIE: !!win.navigator.userAgent.match(/Trident/g) || !!win.navigator.userAgent.match(/MSIE/g),
1028 isEdge: !!win.navigator.userAgent.match(/Edge/g),
1029 isSafari: isSafari(),
1030 isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(win.navigator.userAgent),
1031 };
1032 }());
1033
1034 var SwiperClass = function SwiperClass(params) {
1035 if ( params === void 0 ) params = {};
1036
1037 var self = this;
1038 self.params = params;
1039
1040 // Events
1041 self.eventsListeners = {};
1042
1043 if (self.params && self.params.on) {
1044 Object.keys(self.params.on).forEach(function (eventName) {
1045 self.on(eventName, self.params.on[eventName]);
1046 });
1047 }
1048 };
1049
1050 var staticAccessors = { components: { configurable: true } };
1051
1052 SwiperClass.prototype.on = function on (events, handler, priority) {
1053 var self = this;
1054 if (typeof handler !== 'function') { return self; }
1055 var method = priority ? 'unshift' : 'push';
1056 events.split(' ').forEach(function (event) {
1057 if (!self.eventsListeners[event]) { self.eventsListeners[event] = []; }
1058 self.eventsListeners[event][method](handler);
1059 });
1060 return self;
1061 };
1062
1063 SwiperClass.prototype.once = function once (events, handler, priority) {
1064 var self = this;
1065 if (typeof handler !== 'function') { return self; }
1066 function onceHandler() {
1067 var args = [], len = arguments.length;
1068 while ( len-- ) args[ len ] = arguments[ len ];
1069
1070 handler.apply(self, args);
1071 self.off(events, onceHandler);
1072 if (onceHandler.f7proxy) {
1073 delete onceHandler.f7proxy;
1074 }
1075 }
1076 onceHandler.f7proxy = handler;
1077 return self.on(events, onceHandler, priority);
1078 };
1079
1080 SwiperClass.prototype.off = function off (events, handler) {
1081 var self = this;
1082 if (!self.eventsListeners) { return self; }
1083 events.split(' ').forEach(function (event) {
1084 if (typeof handler === 'undefined') {
1085 self.eventsListeners[event] = [];
1086 } else if (self.eventsListeners[event] && self.eventsListeners[event].length) {
1087 self.eventsListeners[event].forEach(function (eventHandler, index) {
1088 if (eventHandler === handler || (eventHandler.f7proxy && eventHandler.f7proxy === handler)) {
1089 self.eventsListeners[event].splice(index, 1);
1090 }
1091 });
1092 }
1093 });
1094 return self;
1095 };
1096
1097 SwiperClass.prototype.emit = function emit () {
1098 var args = [], len = arguments.length;
1099 while ( len-- ) args[ len ] = arguments[ len ];
1100
1101 var self = this;
1102 if (!self.eventsListeners) { return self; }
1103 var events;
1104 var data;
1105 var context;
1106 if (typeof args[0] === 'string' || Array.isArray(args[0])) {
1107 events = args[0];
1108 data = args.slice(1, args.length);
1109 context = self;
1110 } else {
1111 events = args[0].events;
1112 data = args[0].data;
1113 context = args[0].context || self;
1114 }
1115 var eventsArray = Array.isArray(events) ? events : events.split(' ');
1116 eventsArray.forEach(function (event) {
1117 if (self.eventsListeners && self.eventsListeners[event]) {
1118 var handlers = [];
1119 self.eventsListeners[event].forEach(function (eventHandler) {
1120 handlers.push(eventHandler);
1121 });
1122 handlers.forEach(function (eventHandler) {
1123 eventHandler.apply(context, data);
1124 });
1125 }
1126 });
1127 return self;
1128 };
1129
1130 SwiperClass.prototype.useModulesParams = function useModulesParams (instanceParams) {
1131 var instance = this;
1132 if (!instance.modules) { return; }
1133 Object.keys(instance.modules).forEach(function (moduleName) {
1134 var module = instance.modules[moduleName];
1135 // Extend params
1136 if (module.params) {
1137 Utils.extend(instanceParams, module.params);
1138 }
1139 });
1140 };
1141
1142 SwiperClass.prototype.useModules = function useModules (modulesParams) {
1143 if ( modulesParams === void 0 ) modulesParams = {};
1144
1145 var instance = this;
1146 if (!instance.modules) { return; }
1147 Object.keys(instance.modules).forEach(function (moduleName) {
1148 var module = instance.modules[moduleName];
1149 var moduleParams = modulesParams[moduleName] || {};
1150 // Extend instance methods and props
1151 if (module.instance) {
1152 Object.keys(module.instance).forEach(function (modulePropName) {
1153 var moduleProp = module.instance[modulePropName];
1154 if (typeof moduleProp === 'function') {
1155 instance[modulePropName] = moduleProp.bind(instance);
1156 } else {
1157 instance[modulePropName] = moduleProp;
1158 }
1159 });
1160 }
1161 // Add event listeners
1162 if (module.on && instance.on) {
1163 Object.keys(module.on).forEach(function (moduleEventName) {
1164 instance.on(moduleEventName, module.on[moduleEventName]);
1165 });
1166 }
1167
1168 // Module create callback
1169 if (module.create) {
1170 module.create.bind(instance)(moduleParams);
1171 }
1172 });
1173 };
1174
1175 staticAccessors.components.set = function (components) {
1176 var Class = this;
1177 if (!Class.use) { return; }
1178 Class.use(components);
1179 };
1180
1181 SwiperClass.installModule = function installModule (module) {
1182 var params = [], len = arguments.length - 1;
1183 while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ];
1184
1185 var Class = this;
1186 if (!Class.prototype.modules) { Class.prototype.modules = {}; }
1187 var name = module.name || (((Object.keys(Class.prototype.modules).length) + "_" + (Utils.now())));
1188 Class.prototype.modules[name] = module;
1189 // Prototype
1190 if (module.proto) {
1191 Object.keys(module.proto).forEach(function (key) {
1192 Class.prototype[key] = module.proto[key];
1193 });
1194 }
1195 // Class
1196 if (module.static) {
1197 Object.keys(module.static).forEach(function (key) {
1198 Class[key] = module.static[key];
1199 });
1200 }
1201 // Callback
1202 if (module.install) {
1203 module.install.apply(Class, params);
1204 }
1205 return Class;
1206 };
1207
1208 SwiperClass.use = function use (module) {
1209 var params = [], len = arguments.length - 1;
1210 while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ];
1211
1212 var Class = this;
1213 if (Array.isArray(module)) {
1214 module.forEach(function (m) { return Class.installModule(m); });
1215 return Class;
1216 }
1217 return Class.installModule.apply(Class, [ module ].concat( params ));
1218 };
1219
1220 Object.defineProperties( SwiperClass, staticAccessors );
1221
1222 function updateSize () {
1223 var swiper = this;
1224 var width;
1225 var height;
1226 var $el = swiper.$el;
1227 if (typeof swiper.params.width !== 'undefined') {
1228 width = swiper.params.width;
1229 } else {
1230 width = $el[0].clientWidth;
1231 }
1232 if (typeof swiper.params.height !== 'undefined') {
1233 height = swiper.params.height;
1234 } else {
1235 height = $el[0].clientHeight;
1236 }
1237 if ((width === 0 && swiper.isHorizontal()) || (height === 0 && swiper.isVertical())) {
1238 return;
1239 }
1240
1241 // Subtract paddings
1242 width = width - parseInt($el.css('padding-left'), 10) - parseInt($el.css('padding-right'), 10);
1243 height = height - parseInt($el.css('padding-top'), 10) - parseInt($el.css('padding-bottom'), 10);
1244
1245 Utils.extend(swiper, {
1246 width: width,
1247 height: height,
1248 size: swiper.isHorizontal() ? width : height,
1249 });
1250 }
1251
1252 function updateSlides () {
1253 var swiper = this;
1254 var params = swiper.params;
1255
1256 var $wrapperEl = swiper.$wrapperEl;
1257 var swiperSize = swiper.size;
1258 var rtl = swiper.rtlTranslate;
1259 var wrongRTL = swiper.wrongRTL;
1260 var isVirtual = swiper.virtual && params.virtual.enabled;
1261 var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
1262 var slides = $wrapperEl.children(("." + (swiper.params.slideClass)));
1263 var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
1264 var snapGrid = [];
1265 var slidesGrid = [];
1266 var slidesSizesGrid = [];
1267
1268 var offsetBefore = params.slidesOffsetBefore;
1269 if (typeof offsetBefore === 'function') {
1270 offsetBefore = params.slidesOffsetBefore.call(swiper);
1271 }
1272
1273 var offsetAfter = params.slidesOffsetAfter;
1274 if (typeof offsetAfter === 'function') {
1275 offsetAfter = params.slidesOffsetAfter.call(swiper);
1276 }
1277
1278 var previousSnapGridLength = swiper.snapGrid.length;
1279 var previousSlidesGridLength = swiper.snapGrid.length;
1280
1281 var spaceBetween = params.spaceBetween;
1282 var slidePosition = -offsetBefore;
1283 var prevSlideSize = 0;
1284 var index = 0;
1285 if (typeof swiperSize === 'undefined') {
1286 return;
1287 }
1288 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
1289 spaceBetween = (parseFloat(spaceBetween.replace('%', '')) / 100) * swiperSize;
1290 }
1291
1292 swiper.virtualSize = -spaceBetween;
1293
1294 // reset margins
1295 if (rtl) { slides.css({ marginLeft: '', marginTop: '' }); }
1296 else { slides.css({ marginRight: '', marginBottom: '' }); }
1297
1298 var slidesNumberEvenToRows;
1299 if (params.slidesPerColumn > 1) {
1300 if (Math.floor(slidesLength / params.slidesPerColumn) === slidesLength / swiper.params.slidesPerColumn) {
1301 slidesNumberEvenToRows = slidesLength;
1302 } else {
1303 slidesNumberEvenToRows = Math.ceil(slidesLength / params.slidesPerColumn) * params.slidesPerColumn;
1304 }
1305 if (params.slidesPerView !== 'auto' && params.slidesPerColumnFill === 'row') {
1306 slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, params.slidesPerView * params.slidesPerColumn);
1307 }
1308 }
1309
1310 // Calc slides
1311 var slideSize;
1312 var slidesPerColumn = params.slidesPerColumn;
1313 var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
1314 var numFullColumns = Math.floor(slidesLength / params.slidesPerColumn);
1315 for (var i = 0; i < slidesLength; i += 1) {
1316 slideSize = 0;
1317 var slide = slides.eq(i);
1318 if (params.slidesPerColumn > 1) {
1319 // Set slides order
1320 var newSlideOrderIndex = (void 0);
1321 var column = (void 0);
1322 var row = (void 0);
1323 if (params.slidesPerColumnFill === 'column') {
1324 column = Math.floor(i / slidesPerColumn);
1325 row = i - (column * slidesPerColumn);
1326 if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn - 1)) {
1327 row += 1;
1328 if (row >= slidesPerColumn) {
1329 row = 0;
1330 column += 1;
1331 }
1332 }
1333 newSlideOrderIndex = column + ((row * slidesNumberEvenToRows) / slidesPerColumn);
1334 slide
1335 .css({
1336 '-webkit-box-ordinal-group': newSlideOrderIndex,
1337 '-moz-box-ordinal-group': newSlideOrderIndex,
1338 '-ms-flex-order': newSlideOrderIndex,
1339 '-webkit-order': newSlideOrderIndex,
1340 order: newSlideOrderIndex,
1341 });
1342 } else {
1343 row = Math.floor(i / slidesPerRow);
1344 column = i - (row * slidesPerRow);
1345 }
1346 slide
1347 .css(
1348 ("margin-" + (swiper.isHorizontal() ? 'top' : 'left')),
1349 (row !== 0 && params.spaceBetween) && (((params.spaceBetween) + "px"))
1350 )
1351 .attr('data-swiper-column', column)
1352 .attr('data-swiper-row', row);
1353 }
1354 if (slide.css('display') === 'none') { continue; } // eslint-disable-line
1355
1356 if (params.slidesPerView === 'auto') {
1357 var slideStyles = win.getComputedStyle(slide[0], null);
1358 var currentTransform = slide[0].style.transform;
1359 var currentWebKitTransform = slide[0].style.webkitTransform;
1360 if (currentTransform) {
1361 slide[0].style.transform = 'none';
1362 }
1363 if (currentWebKitTransform) {
1364 slide[0].style.webkitTransform = 'none';
1365 }
1366 if (params.roundLengths) {
1367 slideSize = swiper.isHorizontal()
1368 ? slide.outerWidth(true)
1369 : slide.outerHeight(true);
1370 } else {
1371 // eslint-disable-next-line
1372 if (swiper.isHorizontal()) {
1373 var width = parseFloat(slideStyles.getPropertyValue('width'));
1374 var paddingLeft = parseFloat(slideStyles.getPropertyValue('padding-left'));
1375 var paddingRight = parseFloat(slideStyles.getPropertyValue('padding-right'));
1376 var marginLeft = parseFloat(slideStyles.getPropertyValue('margin-left'));
1377 var marginRight = parseFloat(slideStyles.getPropertyValue('margin-right'));
1378 var boxSizing = slideStyles.getPropertyValue('box-sizing');
1379 if (boxSizing && boxSizing === 'border-box') {
1380 slideSize = width + marginLeft + marginRight;
1381 } else {
1382 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight;
1383 }
1384 } else {
1385 var height = parseFloat(slideStyles.getPropertyValue('height'));
1386 var paddingTop = parseFloat(slideStyles.getPropertyValue('padding-top'));
1387 var paddingBottom = parseFloat(slideStyles.getPropertyValue('padding-bottom'));
1388 var marginTop = parseFloat(slideStyles.getPropertyValue('margin-top'));
1389 var marginBottom = parseFloat(slideStyles.getPropertyValue('margin-bottom'));
1390 var boxSizing$1 = slideStyles.getPropertyValue('box-sizing');
1391 if (boxSizing$1 && boxSizing$1 === 'border-box') {
1392 slideSize = height + marginTop + marginBottom;
1393 } else {
1394 slideSize = height + paddingTop + paddingBottom + marginTop + marginBottom;
1395 }
1396 }
1397 }
1398 if (currentTransform) {
1399 slide[0].style.transform = currentTransform;
1400 }
1401 if (currentWebKitTransform) {
1402 slide[0].style.webkitTransform = currentWebKitTransform;
1403 }
1404 if (params.roundLengths) { slideSize = Math.floor(slideSize); }
1405 } else {
1406 slideSize = (swiperSize - ((params.slidesPerView - 1) * spaceBetween)) / params.slidesPerView;
1407 if (params.roundLengths) { slideSize = Math.floor(slideSize); }
1408
1409 if (slides[i]) {
1410 if (swiper.isHorizontal()) {
1411 slides[i].style.width = slideSize + "px";
1412 } else {
1413 slides[i].style.height = slideSize + "px";
1414 }
1415 }
1416 }
1417 if (slides[i]) {
1418 slides[i].swiperSlideSize = slideSize;
1419 }
1420 slidesSizesGrid.push(slideSize);
1421
1422
1423 if (params.centeredSlides) {
1424 slidePosition = slidePosition + (slideSize / 2) + (prevSlideSize / 2) + spaceBetween;
1425 if (prevSlideSize === 0 && i !== 0) { slidePosition = slidePosition - (swiperSize / 2) - spaceBetween; }
1426 if (i === 0) { slidePosition = slidePosition - (swiperSize / 2) - spaceBetween; }
1427 if (Math.abs(slidePosition) < 1 / 1000) { slidePosition = 0; }
1428 if (params.roundLengths) { slidePosition = Math.floor(slidePosition); }
1429 if ((index) % params.slidesPerGroup === 0) { snapGrid.push(slidePosition); }
1430 slidesGrid.push(slidePosition);
1431 } else {
1432 if (params.roundLengths) { slidePosition = Math.floor(slidePosition); }
1433 if ((index) % params.slidesPerGroup === 0) { snapGrid.push(slidePosition); }
1434 slidesGrid.push(slidePosition);
1435 slidePosition = slidePosition + slideSize + spaceBetween;
1436 }
1437
1438 swiper.virtualSize += slideSize + spaceBetween;
1439
1440 prevSlideSize = slideSize;
1441
1442 index += 1;
1443 }
1444 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
1445 var newSlidesGrid;
1446
1447 if (
1448 rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
1449 $wrapperEl.css({ width: ((swiper.virtualSize + params.spaceBetween) + "px") });
1450 }
1451 if (!Support.flexbox || params.setWrapperSize) {
1452 if (swiper.isHorizontal()) { $wrapperEl.css({ width: ((swiper.virtualSize + params.spaceBetween) + "px") }); }
1453 else { $wrapperEl.css({ height: ((swiper.virtualSize + params.spaceBetween) + "px") }); }
1454 }
1455
1456 if (params.slidesPerColumn > 1) {
1457 swiper.virtualSize = (slideSize + params.spaceBetween) * slidesNumberEvenToRows;
1458 swiper.virtualSize = Math.ceil(swiper.virtualSize / params.slidesPerColumn) - params.spaceBetween;
1459 if (swiper.isHorizontal()) { $wrapperEl.css({ width: ((swiper.virtualSize + params.spaceBetween) + "px") }); }
1460 else { $wrapperEl.css({ height: ((swiper.virtualSize + params.spaceBetween) + "px") }); }
1461 if (params.centeredSlides) {
1462 newSlidesGrid = [];
1463 for (var i$1 = 0; i$1 < snapGrid.length; i$1 += 1) {
1464 var slidesGridItem = snapGrid[i$1];
1465 if (params.roundLengths) { slidesGridItem = Math.floor(slidesGridItem); }
1466 if (snapGrid[i$1] < swiper.virtualSize + snapGrid[0]) { newSlidesGrid.push(slidesGridItem); }
1467 }
1468 snapGrid = newSlidesGrid;
1469 }
1470 }
1471
1472 // Remove last grid elements depending on width
1473 if (!params.centeredSlides) {
1474 newSlidesGrid = [];
1475 for (var i$2 = 0; i$2 < snapGrid.length; i$2 += 1) {
1476 var slidesGridItem$1 = snapGrid[i$2];
1477 if (params.roundLengths) { slidesGridItem$1 = Math.floor(slidesGridItem$1); }
1478 if (snapGrid[i$2] <= swiper.virtualSize - swiperSize) {
1479 newSlidesGrid.push(slidesGridItem$1);
1480 }
1481 }
1482 snapGrid = newSlidesGrid;
1483 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
1484 snapGrid.push(swiper.virtualSize - swiperSize);
1485 }
1486 }
1487 if (snapGrid.length === 0) { snapGrid = [0]; }
1488
1489 if (params.spaceBetween !== 0) {
1490 if (swiper.isHorizontal()) {
1491 if (rtl) { slides.css({ marginLeft: (spaceBetween + "px") }); }
1492 else { slides.css({ marginRight: (spaceBetween + "px") }); }
1493 } else { slides.css({ marginBottom: (spaceBetween + "px") }); }
1494 }
1495
1496 if (params.centerInsufficientSlides) {
1497 var allSlidesSize = 0;
1498 slidesSizesGrid.forEach(function (slideSizeValue) {
1499 allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
1500 });
1501 allSlidesSize -= params.spaceBetween;
1502 if (allSlidesSize < swiperSize) {
1503 var allSlidesOffset = (swiperSize - allSlidesSize) / 2;
1504 snapGrid.forEach(function (snap, snapIndex) {
1505 snapGrid[snapIndex] = snap - allSlidesOffset;
1506 });
1507 slidesGrid.forEach(function (snap, snapIndex) {
1508 slidesGrid[snapIndex] = snap + allSlidesOffset;
1509 });
1510 }
1511 }
1512
1513 Utils.extend(swiper, {
1514 slides: slides,
1515 snapGrid: snapGrid,
1516 slidesGrid: slidesGrid,
1517 slidesSizesGrid: slidesSizesGrid,
1518 });
1519
1520 if (slidesLength !== previousSlidesLength) {
1521 swiper.emit('slidesLengthChange');
1522 }
1523 if (snapGrid.length !== previousSnapGridLength) {
1524 if (swiper.params.watchOverflow) { swiper.checkOverflow(); }
1525 swiper.emit('snapGridLengthChange');
1526 }
1527 if (slidesGrid.length !== previousSlidesGridLength) {
1528 swiper.emit('slidesGridLengthChange');
1529 }
1530
1531 if (params.watchSlidesProgress || params.watchSlidesVisibility) {
1532 swiper.updateSlidesOffset();
1533 }
1534 }
1535
1536 function updateAutoHeight (speed) {
1537 var swiper = this;
1538 var activeSlides = [];
1539 var newHeight = 0;
1540 var i;
1541 if (typeof speed === 'number') {
1542 swiper.setTransition(speed);
1543 } else if (speed === true) {
1544 swiper.setTransition(swiper.params.speed);
1545 }
1546 // Find slides currently in view
1547 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
1548 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
1549 var index = swiper.activeIndex + i;
1550 if (index > swiper.slides.length) { break; }
1551 activeSlides.push(swiper.slides.eq(index)[0]);
1552 }
1553 } else {
1554 activeSlides.push(swiper.slides.eq(swiper.activeIndex)[0]);
1555 }
1556
1557 // Find new height from highest slide in view
1558 for (i = 0; i < activeSlides.length; i += 1) {
1559 if (typeof activeSlides[i] !== 'undefined') {
1560 var height = activeSlides[i].offsetHeight;
1561 newHeight = height > newHeight ? height : newHeight;
1562 }
1563 }
1564
1565 // Update Height
1566 if (newHeight) { swiper.$wrapperEl.css('height', (newHeight + "px")); }
1567 }
1568
1569 function updateSlidesOffset () {
1570 var swiper = this;
1571 var slides = swiper.slides;
1572 for (var i = 0; i < slides.length; i += 1) {
1573 slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
1574 }
1575 }
1576
1577 function updateSlidesProgress (translate) {
1578 if ( translate === void 0 ) translate = (this && this.translate) || 0;
1579
1580 var swiper = this;
1581 var params = swiper.params;
1582
1583 var slides = swiper.slides;
1584 var rtl = swiper.rtlTranslate;
1585
1586 if (slides.length === 0) { return; }
1587 if (typeof slides[0].swiperSlideOffset === 'undefined') { swiper.updateSlidesOffset(); }
1588
1589 var offsetCenter = -translate;
1590 if (rtl) { offsetCenter = translate; }
1591
1592 // Visible Slides
1593 slides.removeClass(params.slideVisibleClass);
1594
1595 swiper.visibleSlidesIndexes = [];
1596 swiper.visibleSlides = [];
1597
1598 for (var i = 0; i < slides.length; i += 1) {
1599 var slide = slides[i];
1600 var slideProgress = (
1601 (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0)) - slide.swiperSlideOffset
1602 ) / (slide.swiperSlideSize + params.spaceBetween);
1603 if (params.watchSlidesVisibility) {
1604 var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
1605 var slideAfter = slideBefore + swiper.slidesSizesGrid[i];
1606 var isVisible = (slideBefore >= 0 && slideBefore < swiper.size)
1607 || (slideAfter > 0 && slideAfter <= swiper.size)
1608 || (slideBefore <= 0 && slideAfter >= swiper.size);
1609 if (isVisible) {
1610 swiper.visibleSlides.push(slide);
1611 swiper.visibleSlidesIndexes.push(i);
1612 slides.eq(i).addClass(params.slideVisibleClass);
1613 }
1614 }
1615 slide.progress = rtl ? -slideProgress : slideProgress;
1616 }
1617 swiper.visibleSlides = $(swiper.visibleSlides);
1618 }
1619
1620 function updateProgress (translate) {
1621 if ( translate === void 0 ) translate = (this && this.translate) || 0;
1622
1623 var swiper = this;
1624 var params = swiper.params;
1625
1626 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
1627 var progress = swiper.progress;
1628 var isBeginning = swiper.isBeginning;
1629 var isEnd = swiper.isEnd;
1630 var wasBeginning = isBeginning;
1631 var wasEnd = isEnd;
1632 if (translatesDiff === 0) {
1633 progress = 0;
1634 isBeginning = true;
1635 isEnd = true;
1636 } else {
1637 progress = (translate - swiper.minTranslate()) / (translatesDiff);
1638 isBeginning = progress <= 0;
1639 isEnd = progress >= 1;
1640 }
1641 Utils.extend(swiper, {
1642 progress: progress,
1643 isBeginning: isBeginning,
1644 isEnd: isEnd,
1645 });
1646
1647 if (params.watchSlidesProgress || params.watchSlidesVisibility) { swiper.updateSlidesProgress(translate); }
1648
1649 if (isBeginning && !wasBeginning) {
1650 swiper.emit('reachBeginning toEdge');
1651 }
1652 if (isEnd && !wasEnd) {
1653 swiper.emit('reachEnd toEdge');
1654 }
1655 if ((wasBeginning && !isBeginning) || (wasEnd && !isEnd)) {
1656 swiper.emit('fromEdge');
1657 }
1658
1659 swiper.emit('progress', progress);
1660 }
1661
1662 function updateSlidesClasses () {
1663 var swiper = this;
1664
1665 var slides = swiper.slides;
1666 var params = swiper.params;
1667 var $wrapperEl = swiper.$wrapperEl;
1668 var activeIndex = swiper.activeIndex;
1669 var realIndex = swiper.realIndex;
1670 var isVirtual = swiper.virtual && params.virtual.enabled;
1671
1672 slides.removeClass(((params.slideActiveClass) + " " + (params.slideNextClass) + " " + (params.slidePrevClass) + " " + (params.slideDuplicateActiveClass) + " " + (params.slideDuplicateNextClass) + " " + (params.slideDuplicatePrevClass)));
1673
1674 var activeSlide;
1675 if (isVirtual) {
1676 activeSlide = swiper.$wrapperEl.find(("." + (params.slideClass) + "[data-swiper-slide-index=\"" + activeIndex + "\"]"));
1677 } else {
1678 activeSlide = slides.eq(activeIndex);
1679 }
1680
1681 // Active classes
1682 activeSlide.addClass(params.slideActiveClass);
1683
1684 if (params.loop) {
1685 // Duplicate to all looped slides
1686 if (activeSlide.hasClass(params.slideDuplicateClass)) {
1687 $wrapperEl
1688 .children(("." + (params.slideClass) + ":not(." + (params.slideDuplicateClass) + ")[data-swiper-slide-index=\"" + realIndex + "\"]"))
1689 .addClass(params.slideDuplicateActiveClass);
1690 } else {
1691 $wrapperEl
1692 .children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + realIndex + "\"]"))
1693 .addClass(params.slideDuplicateActiveClass);
1694 }
1695 }
1696 // Next Slide
1697 var nextSlide = activeSlide.nextAll(("." + (params.slideClass))).eq(0).addClass(params.slideNextClass);
1698 if (params.loop && nextSlide.length === 0) {
1699 nextSlide = slides.eq(0);
1700 nextSlide.addClass(params.slideNextClass);
1701 }
1702 // Prev Slide
1703 var prevSlide = activeSlide.prevAll(("." + (params.slideClass))).eq(0).addClass(params.slidePrevClass);
1704 if (params.loop && prevSlide.length === 0) {
1705 prevSlide = slides.eq(-1);
1706 prevSlide.addClass(params.slidePrevClass);
1707 }
1708 if (params.loop) {
1709 // Duplicate to all looped slides
1710 if (nextSlide.hasClass(params.slideDuplicateClass)) {
1711 $wrapperEl
1712 .children(("." + (params.slideClass) + ":not(." + (params.slideDuplicateClass) + ")[data-swiper-slide-index=\"" + (nextSlide.attr('data-swiper-slide-index')) + "\"]"))
1713 .addClass(params.slideDuplicateNextClass);
1714 } else {
1715 $wrapperEl
1716 .children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + (nextSlide.attr('data-swiper-slide-index')) + "\"]"))
1717 .addClass(params.slideDuplicateNextClass);
1718 }
1719 if (prevSlide.hasClass(params.slideDuplicateClass)) {
1720 $wrapperEl
1721 .children(("." + (params.slideClass) + ":not(." + (params.slideDuplicateClass) + ")[data-swiper-slide-index=\"" + (prevSlide.attr('data-swiper-slide-index')) + "\"]"))
1722 .addClass(params.slideDuplicatePrevClass);
1723 } else {
1724 $wrapperEl
1725 .children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + (prevSlide.attr('data-swiper-slide-index')) + "\"]"))
1726 .addClass(params.slideDuplicatePrevClass);
1727 }
1728 }
1729 }
1730
1731 function updateActiveIndex (newActiveIndex) {
1732 var swiper = this;
1733 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
1734 var slidesGrid = swiper.slidesGrid;
1735 var snapGrid = swiper.snapGrid;
1736 var params = swiper.params;
1737 var previousIndex = swiper.activeIndex;
1738 var previousRealIndex = swiper.realIndex;
1739 var previousSnapIndex = swiper.snapIndex;
1740 var activeIndex = newActiveIndex;
1741 var snapIndex;
1742 if (typeof activeIndex === 'undefined') {
1743 for (var i = 0; i < slidesGrid.length; i += 1) {
1744 if (typeof slidesGrid[i + 1] !== 'undefined') {
1745 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - ((slidesGrid[i + 1] - slidesGrid[i]) / 2)) {
1746 activeIndex = i;
1747 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
1748 activeIndex = i + 1;
1749 }
1750 } else if (translate >= slidesGrid[i]) {
1751 activeIndex = i;
1752 }
1753 }
1754 // Normalize slideIndex
1755 if (params.normalizeSlideIndex) {
1756 if (activeIndex < 0 || typeof activeIndex === 'undefined') { activeIndex = 0; }
1757 }
1758 }
1759 if (snapGrid.indexOf(translate) >= 0) {
1760 snapIndex = snapGrid.indexOf(translate);
1761 } else {
1762 snapIndex = Math.floor(activeIndex / params.slidesPerGroup);
1763 }
1764 if (snapIndex >= snapGrid.length) { snapIndex = snapGrid.length - 1; }
1765 if (activeIndex === previousIndex) {
1766 if (snapIndex !== previousSnapIndex) {
1767 swiper.snapIndex = snapIndex;
1768 swiper.emit('snapIndexChange');
1769 }
1770 return;
1771 }
1772
1773 // Get real index
1774 var realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
1775
1776 Utils.extend(swiper, {
1777 snapIndex: snapIndex,
1778 realIndex: realIndex,
1779 previousIndex: previousIndex,
1780 activeIndex: activeIndex,
1781 });
1782 swiper.emit('activeIndexChange');
1783 swiper.emit('snapIndexChange');
1784 if (previousRealIndex !== realIndex) {
1785 swiper.emit('realIndexChange');
1786 }
1787 swiper.emit('slideChange');
1788 }
1789
1790 function updateClickedSlide (e) {
1791 var swiper = this;
1792 var params = swiper.params;
1793 var slide = $(e.target).closest(("." + (params.slideClass)))[0];
1794 var slideFound = false;
1795 if (slide) {
1796 for (var i = 0; i < swiper.slides.length; i += 1) {
1797 if (swiper.slides[i] === slide) { slideFound = true; }
1798 }
1799 }
1800
1801 if (slide && slideFound) {
1802 swiper.clickedSlide = slide;
1803 if (swiper.virtual && swiper.params.virtual.enabled) {
1804 swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10);
1805 } else {
1806 swiper.clickedIndex = $(slide).index();
1807 }
1808 } else {
1809 swiper.clickedSlide = undefined;
1810 swiper.clickedIndex = undefined;
1811 return;
1812 }
1813 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
1814 swiper.slideToClickedSlide();
1815 }
1816 }
1817
1818 var update = {
1819 updateSize: updateSize,
1820 updateSlides: updateSlides,
1821 updateAutoHeight: updateAutoHeight,
1822 updateSlidesOffset: updateSlidesOffset,
1823 updateSlidesProgress: updateSlidesProgress,
1824 updateProgress: updateProgress,
1825 updateSlidesClasses: updateSlidesClasses,
1826 updateActiveIndex: updateActiveIndex,
1827 updateClickedSlide: updateClickedSlide,
1828 };
1829
1830 function getTranslate (axis) {
1831 if ( axis === void 0 ) axis = this.isHorizontal() ? 'x' : 'y';
1832
1833 var swiper = this;
1834
1835 var params = swiper.params;
1836 var rtl = swiper.rtlTranslate;
1837 var translate = swiper.translate;
1838 var $wrapperEl = swiper.$wrapperEl;
1839
1840 if (params.virtualTranslate) {
1841 return rtl ? -translate : translate;
1842 }
1843
1844 var currentTranslate = Utils.getTranslate($wrapperEl[0], axis);
1845 if (rtl) { currentTranslate = -currentTranslate; }
1846
1847 return currentTranslate || 0;
1848 }
1849
1850 function setTranslate (translate, byController) {
1851 var swiper = this;
1852 var rtl = swiper.rtlTranslate;
1853 var params = swiper.params;
1854 var $wrapperEl = swiper.$wrapperEl;
1855 var progress = swiper.progress;
1856 var x = 0;
1857 var y = 0;
1858 var z = 0;
1859
1860 if (swiper.isHorizontal()) {
1861 x = rtl ? -translate : translate;
1862 } else {
1863 y = translate;
1864 }
1865
1866 if (params.roundLengths) {
1867 x = Math.floor(x);
1868 y = Math.floor(y);
1869 }
1870
1871 if (!params.virtualTranslate) {
1872 if (Support.transforms3d) { $wrapperEl.transform(("translate3d(" + x + "px, " + y + "px, " + z + "px)")); }
1873 else { $wrapperEl.transform(("translate(" + x + "px, " + y + "px)")); }
1874 }
1875 swiper.previousTranslate = swiper.translate;
1876 swiper.translate = swiper.isHorizontal() ? x : y;
1877
1878 // Check if we need to update progress
1879 var newProgress;
1880 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
1881 if (translatesDiff === 0) {
1882 newProgress = 0;
1883 } else {
1884 newProgress = (translate - swiper.minTranslate()) / (translatesDiff);
1885 }
1886 if (newProgress !== progress) {
1887 swiper.updateProgress(translate);
1888 }
1889
1890 swiper.emit('setTranslate', swiper.translate, byController);
1891 }
1892
1893 function minTranslate () {
1894 return (-this.snapGrid[0]);
1895 }
1896
1897 function maxTranslate () {
1898 return (-this.snapGrid[this.snapGrid.length - 1]);
1899 }
1900
1901 var translate = {
1902 getTranslate: getTranslate,
1903 setTranslate: setTranslate,
1904 minTranslate: minTranslate,
1905 maxTranslate: maxTranslate,
1906 };
1907
1908 function setTransition (duration, byController) {
1909 var swiper = this;
1910
1911 swiper.$wrapperEl.transition(duration);
1912
1913 swiper.emit('setTransition', duration, byController);
1914 }
1915
1916 function transitionStart (runCallbacks, direction) {
1917 if ( runCallbacks === void 0 ) runCallbacks = true;
1918
1919 var swiper = this;
1920 var activeIndex = swiper.activeIndex;
1921 var params = swiper.params;
1922 var previousIndex = swiper.previousIndex;
1923 if (params.autoHeight) {
1924 swiper.updateAutoHeight();
1925 }
1926
1927 var dir = direction;
1928 if (!dir) {
1929 if (activeIndex > previousIndex) { dir = 'next'; }
1930 else if (activeIndex < previousIndex) { dir = 'prev'; }
1931 else { dir = 'reset'; }
1932 }
1933
1934 swiper.emit('transitionStart');
1935
1936 if (runCallbacks && activeIndex !== previousIndex) {
1937 if (dir === 'reset') {
1938 swiper.emit('slideResetTransitionStart');
1939 return;
1940 }
1941 swiper.emit('slideChangeTransitionStart');
1942 if (dir === 'next') {
1943 swiper.emit('slideNextTransitionStart');
1944 } else {
1945 swiper.emit('slidePrevTransitionStart');
1946 }
1947 }
1948 }
1949
1950 function transitionEnd$1 (runCallbacks, direction) {
1951 if ( runCallbacks === void 0 ) runCallbacks = true;
1952
1953 var swiper = this;
1954 var activeIndex = swiper.activeIndex;
1955 var previousIndex = swiper.previousIndex;
1956 swiper.animating = false;
1957 swiper.setTransition(0);
1958
1959 var dir = direction;
1960 if (!dir) {
1961 if (activeIndex > previousIndex) { dir = 'next'; }
1962 else if (activeIndex < previousIndex) { dir = 'prev'; }
1963 else { dir = 'reset'; }
1964 }
1965
1966 swiper.emit('transitionEnd');
1967
1968 if (runCallbacks && activeIndex !== previousIndex) {
1969 if (dir === 'reset') {
1970 swiper.emit('slideResetTransitionEnd');
1971 return;
1972 }
1973 swiper.emit('slideChangeTransitionEnd');
1974 if (dir === 'next') {
1975 swiper.emit('slideNextTransitionEnd');
1976 } else {
1977 swiper.emit('slidePrevTransitionEnd');
1978 }
1979 }
1980 }
1981
1982 var transition$1 = {
1983 setTransition: setTransition,
1984 transitionStart: transitionStart,
1985 transitionEnd: transitionEnd$1,
1986 };
1987
1988 function slideTo (index, speed, runCallbacks, internal) {
1989 if ( index === void 0 ) index = 0;
1990 if ( speed === void 0 ) speed = this.params.speed;
1991 if ( runCallbacks === void 0 ) runCallbacks = true;
1992
1993 var swiper = this;
1994 var slideIndex = index;
1995 if (slideIndex < 0) { slideIndex = 0; }
1996
1997 var params = swiper.params;
1998 var snapGrid = swiper.snapGrid;
1999 var slidesGrid = swiper.slidesGrid;
2000 var previousIndex = swiper.previousIndex;
2001 var activeIndex = swiper.activeIndex;
2002 var rtl = swiper.rtlTranslate;
2003 if (swiper.animating && params.preventInteractionOnTransition) {
2004 return false;
2005 }
2006
2007 var snapIndex = Math.floor(slideIndex / params.slidesPerGroup);
2008 if (snapIndex >= snapGrid.length) { snapIndex = snapGrid.length - 1; }
2009
2010 if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {
2011 swiper.emit('beforeSlideChangeStart');
2012 }
2013
2014 var translate = -snapGrid[snapIndex];
2015
2016 // Update progress
2017 swiper.updateProgress(translate);
2018
2019 // Normalize slideIndex
2020 if (params.normalizeSlideIndex) {
2021 for (var i = 0; i < slidesGrid.length; i += 1) {
2022 if (-Math.floor(translate * 100) >= Math.floor(slidesGrid[i] * 100)) {
2023 slideIndex = i;
2024 }
2025 }
2026 }
2027 // Directions locks
2028 if (swiper.initialized && slideIndex !== activeIndex) {
2029 if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
2030 return false;
2031 }
2032 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
2033 if ((activeIndex || 0) !== slideIndex) { return false; }
2034 }
2035 }
2036
2037 var direction;
2038 if (slideIndex > activeIndex) { direction = 'next'; }
2039 else if (slideIndex < activeIndex) { direction = 'prev'; }
2040 else { direction = 'reset'; }
2041
2042
2043 // Update Index
2044 if ((rtl && -translate === swiper.translate) || (!rtl && translate === swiper.translate)) {
2045 swiper.updateActiveIndex(slideIndex);
2046 // Update Height
2047 if (params.autoHeight) {
2048 swiper.updateAutoHeight();
2049 }
2050 swiper.updateSlidesClasses();
2051 if (params.effect !== 'slide') {
2052 swiper.setTranslate(translate);
2053 }
2054 if (direction !== 'reset') {
2055 swiper.transitionStart(runCallbacks, direction);
2056 swiper.transitionEnd(runCallbacks, direction);
2057 }
2058 return false;
2059 }
2060
2061 if (speed === 0 || !Support.transition) {
2062 swiper.setTransition(0);
2063 swiper.setTranslate(translate);
2064 swiper.updateActiveIndex(slideIndex);
2065 swiper.updateSlidesClasses();
2066 swiper.emit('beforeTransitionStart', speed, internal);
2067 swiper.transitionStart(runCallbacks, direction);
2068 swiper.transitionEnd(runCallbacks, direction);
2069 } else {
2070 swiper.setTransition(speed);
2071 swiper.setTranslate(translate);
2072 swiper.updateActiveIndex(slideIndex);
2073 swiper.updateSlidesClasses();
2074 swiper.emit('beforeTransitionStart', speed, internal);
2075 swiper.transitionStart(runCallbacks, direction);
2076 if (!swiper.animating) {
2077 swiper.animating = true;
2078 if (!swiper.onSlideToWrapperTransitionEnd) {
2079 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
2080 if (!swiper || swiper.destroyed) { return; }
2081 if (e.target !== this) { return; }
2082 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
2083 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
2084 swiper.onSlideToWrapperTransitionEnd = null;
2085 delete swiper.onSlideToWrapperTransitionEnd;
2086 swiper.transitionEnd(runCallbacks, direction);
2087 };
2088 }
2089 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
2090 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
2091 }
2092 }
2093
2094 return true;
2095 }
2096
2097 function slideToLoop (index, speed, runCallbacks, internal) {
2098 if ( index === void 0 ) index = 0;
2099 if ( speed === void 0 ) speed = this.params.speed;
2100 if ( runCallbacks === void 0 ) runCallbacks = true;
2101
2102 var swiper = this;
2103 var newIndex = index;
2104 if (swiper.params.loop) {
2105 newIndex += swiper.loopedSlides;
2106 }
2107
2108 return swiper.slideTo(newIndex, speed, runCallbacks, internal);
2109 }
2110
2111 /* eslint no-unused-vars: "off" */
2112 function slideNext (speed, runCallbacks, internal) {
2113 if ( speed === void 0 ) speed = this.params.speed;
2114 if ( runCallbacks === void 0 ) runCallbacks = true;
2115
2116 var swiper = this;
2117 var params = swiper.params;
2118 var animating = swiper.animating;
2119 if (params.loop) {
2120 if (animating) { return false; }
2121 swiper.loopFix();
2122 // eslint-disable-next-line
2123 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
2124 return swiper.slideTo(swiper.activeIndex + params.slidesPerGroup, speed, runCallbacks, internal);
2125 }
2126 return swiper.slideTo(swiper.activeIndex + params.slidesPerGroup, speed, runCallbacks, internal);
2127 }
2128
2129 /* eslint no-unused-vars: "off" */
2130 function slidePrev (speed, runCallbacks, internal) {
2131 if ( speed === void 0 ) speed = this.params.speed;
2132 if ( runCallbacks === void 0 ) runCallbacks = true;
2133
2134 var swiper = this;
2135 var params = swiper.params;
2136 var animating = swiper.animating;
2137 var snapGrid = swiper.snapGrid;
2138 var slidesGrid = swiper.slidesGrid;
2139 var rtlTranslate = swiper.rtlTranslate;
2140
2141 if (params.loop) {
2142 if (animating) { return false; }
2143 swiper.loopFix();
2144 // eslint-disable-next-line
2145 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
2146 }
2147 var translate = rtlTranslate ? swiper.translate : -swiper.translate;
2148 function normalize(val) {
2149 if (val < 0) { return -Math.floor(Math.abs(val)); }
2150 return Math.floor(val);
2151 }
2152 var normalizedTranslate = normalize(translate);
2153 var normalizedSnapGrid = snapGrid.map(function (val) { return normalize(val); });
2154 var normalizedSlidesGrid = slidesGrid.map(function (val) { return normalize(val); });
2155
2156 var currentSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate)];
2157 var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
2158 var prevIndex;
2159 if (typeof prevSnap !== 'undefined') {
2160 prevIndex = slidesGrid.indexOf(prevSnap);
2161 if (prevIndex < 0) { prevIndex = swiper.activeIndex - 1; }
2162 }
2163 return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
2164 }
2165
2166 /* eslint no-unused-vars: "off" */
2167 function slideReset (speed, runCallbacks, internal) {
2168 if ( speed === void 0 ) speed = this.params.speed;
2169 if ( runCallbacks === void 0 ) runCallbacks = true;
2170
2171 var swiper = this;
2172 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
2173 }
2174
2175 /* eslint no-unused-vars: "off" */
2176 function slideToClosest (speed, runCallbacks, internal) {
2177 if ( speed === void 0 ) speed = this.params.speed;
2178 if ( runCallbacks === void 0 ) runCallbacks = true;
2179
2180 var swiper = this;
2181 var index = swiper.activeIndex;
2182 var snapIndex = Math.floor(index / swiper.params.slidesPerGroup);
2183
2184 if (snapIndex < swiper.snapGrid.length - 1) {
2185 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
2186
2187 var currentSnap = swiper.snapGrid[snapIndex];
2188 var nextSnap = swiper.snapGrid[snapIndex + 1];
2189
2190 if ((translate - currentSnap) > (nextSnap - currentSnap) / 2) {
2191 index = swiper.params.slidesPerGroup;
2192 }
2193 }
2194
2195 return swiper.slideTo(index, speed, runCallbacks, internal);
2196 }
2197
2198 function slideToClickedSlide () {
2199 var swiper = this;
2200 var params = swiper.params;
2201 var $wrapperEl = swiper.$wrapperEl;
2202
2203 var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
2204 var slideToIndex = swiper.clickedIndex;
2205 var realIndex;
2206 if (params.loop) {
2207 if (swiper.animating) { return; }
2208 realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
2209 if (params.centeredSlides) {
2210 if (
2211 (slideToIndex < swiper.loopedSlides - (slidesPerView / 2))
2212 || (slideToIndex > (swiper.slides.length - swiper.loopedSlides) + (slidesPerView / 2))
2213 ) {
2214 swiper.loopFix();
2215 slideToIndex = $wrapperEl
2216 .children(("." + (params.slideClass) + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + (params.slideDuplicateClass) + ")"))
2217 .eq(0)
2218 .index();
2219
2220 Utils.nextTick(function () {
2221 swiper.slideTo(slideToIndex);
2222 });
2223 } else {
2224 swiper.slideTo(slideToIndex);
2225 }
2226 } else if (slideToIndex > swiper.slides.length - slidesPerView) {
2227 swiper.loopFix();
2228 slideToIndex = $wrapperEl
2229 .children(("." + (params.slideClass) + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + (params.slideDuplicateClass) + ")"))
2230 .eq(0)
2231 .index();
2232
2233 Utils.nextTick(function () {
2234 swiper.slideTo(slideToIndex);
2235 });
2236 } else {
2237 swiper.slideTo(slideToIndex);
2238 }
2239 } else {
2240 swiper.slideTo(slideToIndex);
2241 }
2242 }
2243
2244 var slide = {
2245 slideTo: slideTo,
2246 slideToLoop: slideToLoop,
2247 slideNext: slideNext,
2248 slidePrev: slidePrev,
2249 slideReset: slideReset,
2250 slideToClosest: slideToClosest,
2251 slideToClickedSlide: slideToClickedSlide,
2252 };
2253
2254 function loopCreate () {
2255 var swiper = this;
2256 var params = swiper.params;
2257 var $wrapperEl = swiper.$wrapperEl;
2258 // Remove duplicated slides
2259 $wrapperEl.children(("." + (params.slideClass) + "." + (params.slideDuplicateClass))).remove();
2260
2261 var slides = $wrapperEl.children(("." + (params.slideClass)));
2262
2263 if (params.loopFillGroupWithBlank) {
2264 var blankSlidesNum = params.slidesPerGroup - (slides.length % params.slidesPerGroup);
2265 if (blankSlidesNum !== params.slidesPerGroup) {
2266 for (var i = 0; i < blankSlidesNum; i += 1) {
2267 var blankNode = $(doc.createElement('div')).addClass(((params.slideClass) + " " + (params.slideBlankClass)));
2268 $wrapperEl.append(blankNode);
2269 }
2270 slides = $wrapperEl.children(("." + (params.slideClass)));
2271 }
2272 }
2273
2274 if (params.slidesPerView === 'auto' && !params.loopedSlides) { params.loopedSlides = slides.length; }
2275
2276 swiper.loopedSlides = parseInt(params.loopedSlides || params.slidesPerView, 10);
2277 swiper.loopedSlides += params.loopAdditionalSlides;
2278 if (swiper.loopedSlides > slides.length) {
2279 swiper.loopedSlides = slides.length;
2280 }
2281
2282 var prependSlides = [];
2283 var appendSlides = [];
2284 slides.each(function (index, el) {
2285 var slide = $(el);
2286 if (index < swiper.loopedSlides) { appendSlides.push(el); }
2287 if (index < slides.length && index >= slides.length - swiper.loopedSlides) { prependSlides.push(el); }
2288 slide.attr('data-swiper-slide-index', index);
2289 });
2290 for (var i$1 = 0; i$1 < appendSlides.length; i$1 += 1) {
2291 $wrapperEl.append($(appendSlides[i$1].cloneNode(true)).addClass(params.slideDuplicateClass));
2292 }
2293 for (var i$2 = prependSlides.length - 1; i$2 >= 0; i$2 -= 1) {
2294 $wrapperEl.prepend($(prependSlides[i$2].cloneNode(true)).addClass(params.slideDuplicateClass));
2295 }
2296 }
2297
2298 function loopFix () {
2299 var swiper = this;
2300 var params = swiper.params;
2301 var activeIndex = swiper.activeIndex;
2302 var slides = swiper.slides;
2303 var loopedSlides = swiper.loopedSlides;
2304 var allowSlidePrev = swiper.allowSlidePrev;
2305 var allowSlideNext = swiper.allowSlideNext;
2306 var snapGrid = swiper.snapGrid;
2307 var rtl = swiper.rtlTranslate;
2308 var newIndex;
2309 swiper.allowSlidePrev = true;
2310 swiper.allowSlideNext = true;
2311
2312 var snapTranslate = -snapGrid[activeIndex];
2313 var diff = snapTranslate - swiper.getTranslate();
2314
2315
2316 // Fix For Negative Oversliding
2317 if (activeIndex < loopedSlides) {
2318 newIndex = (slides.length - (loopedSlides * 3)) + activeIndex;
2319 newIndex += loopedSlides;
2320 var slideChanged = swiper.slideTo(newIndex, 0, false, true);
2321 if (slideChanged && diff !== 0) {
2322 swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
2323 }
2324 } else if ((params.slidesPerView === 'auto' && activeIndex >= loopedSlides * 2) || (activeIndex >= slides.length - loopedSlides)) {
2325 // Fix For Positive Oversliding
2326 newIndex = -slides.length + activeIndex + loopedSlides;
2327 newIndex += loopedSlides;
2328 var slideChanged$1 = swiper.slideTo(newIndex, 0, false, true);
2329 if (slideChanged$1 && diff !== 0) {
2330 swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
2331 }
2332 }
2333 swiper.allowSlidePrev = allowSlidePrev;
2334 swiper.allowSlideNext = allowSlideNext;
2335 }
2336
2337 function loopDestroy () {
2338 var swiper = this;
2339 var $wrapperEl = swiper.$wrapperEl;
2340 var params = swiper.params;
2341 var slides = swiper.slides;
2342 $wrapperEl.children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + ",." + (params.slideClass) + "." + (params.slideBlankClass))).remove();
2343 slides.removeAttr('data-swiper-slide-index');
2344 }
2345
2346 var loop = {
2347 loopCreate: loopCreate,
2348 loopFix: loopFix,
2349 loopDestroy: loopDestroy,
2350 };
2351
2352 function setGrabCursor (moving) {
2353 var swiper = this;
2354 if (Support.touch || !swiper.params.simulateTouch || (swiper.params.watchOverflow && swiper.isLocked)) { return; }
2355 var el = swiper.el;
2356 el.style.cursor = 'move';
2357 el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
2358 el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
2359 el.style.cursor = moving ? 'grabbing' : 'grab';
2360 }
2361
2362 function unsetGrabCursor () {
2363 var swiper = this;
2364 if (Support.touch || (swiper.params.watchOverflow && swiper.isLocked)) { return; }
2365 swiper.el.style.cursor = '';
2366 }
2367
2368 var grabCursor = {
2369 setGrabCursor: setGrabCursor,
2370 unsetGrabCursor: unsetGrabCursor,
2371 };
2372
2373 function appendSlide (slides) {
2374 var swiper = this;
2375 var $wrapperEl = swiper.$wrapperEl;
2376 var params = swiper.params;
2377 if (params.loop) {
2378 swiper.loopDestroy();
2379 }
2380 if (typeof slides === 'object' && 'length' in slides) {
2381 for (var i = 0; i < slides.length; i += 1) {
2382 if (slides[i]) { $wrapperEl.append(slides[i]); }
2383 }
2384 } else {
2385 $wrapperEl.append(slides);
2386 }
2387 if (params.loop) {
2388 swiper.loopCreate();
2389 }
2390 if (!(params.observer && Support.observer)) {
2391 swiper.update();
2392 }
2393 }
2394
2395 function prependSlide (slides) {
2396 var swiper = this;
2397 var params = swiper.params;
2398 var $wrapperEl = swiper.$wrapperEl;
2399 var activeIndex = swiper.activeIndex;
2400
2401 if (params.loop) {
2402 swiper.loopDestroy();
2403 }
2404 var newActiveIndex = activeIndex + 1;
2405 if (typeof slides === 'object' && 'length' in slides) {
2406 for (var i = 0; i < slides.length; i += 1) {
2407 if (slides[i]) { $wrapperEl.prepend(slides[i]); }
2408 }
2409 newActiveIndex = activeIndex + slides.length;
2410 } else {
2411 $wrapperEl.prepend(slides);
2412 }
2413 if (params.loop) {
2414 swiper.loopCreate();
2415 }
2416 if (!(params.observer && Support.observer)) {
2417 swiper.update();
2418 }
2419 swiper.slideTo(newActiveIndex, 0, false);
2420 }
2421
2422 function addSlide (index, slides) {
2423 var swiper = this;
2424 var $wrapperEl = swiper.$wrapperEl;
2425 var params = swiper.params;
2426 var activeIndex = swiper.activeIndex;
2427 var activeIndexBuffer = activeIndex;
2428 if (params.loop) {
2429 activeIndexBuffer -= swiper.loopedSlides;
2430 swiper.loopDestroy();
2431 swiper.slides = $wrapperEl.children(("." + (params.slideClass)));
2432 }
2433 var baseLength = swiper.slides.length;
2434 if (index <= 0) {
2435 swiper.prependSlide(slides);
2436 return;
2437 }
2438 if (index >= baseLength) {
2439 swiper.appendSlide(slides);
2440 return;
2441 }
2442 var newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;
2443
2444 var slidesBuffer = [];
2445 for (var i = baseLength - 1; i >= index; i -= 1) {
2446 var currentSlide = swiper.slides.eq(i);
2447 currentSlide.remove();
2448 slidesBuffer.unshift(currentSlide);
2449 }
2450
2451 if (typeof slides === 'object' && 'length' in slides) {
2452 for (var i$1 = 0; i$1 < slides.length; i$1 += 1) {
2453 if (slides[i$1]) { $wrapperEl.append(slides[i$1]); }
2454 }
2455 newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;
2456 } else {
2457 $wrapperEl.append(slides);
2458 }
2459
2460 for (var i$2 = 0; i$2 < slidesBuffer.length; i$2 += 1) {
2461 $wrapperEl.append(slidesBuffer[i$2]);
2462 }
2463
2464 if (params.loop) {
2465 swiper.loopCreate();
2466 }
2467 if (!(params.observer && Support.observer)) {
2468 swiper.update();
2469 }
2470 if (params.loop) {
2471 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
2472 } else {
2473 swiper.slideTo(newActiveIndex, 0, false);
2474 }
2475 }
2476
2477 function removeSlide (slidesIndexes) {
2478 var swiper = this;
2479 var params = swiper.params;
2480 var $wrapperEl = swiper.$wrapperEl;
2481 var activeIndex = swiper.activeIndex;
2482
2483 var activeIndexBuffer = activeIndex;
2484 if (params.loop) {
2485 activeIndexBuffer -= swiper.loopedSlides;
2486 swiper.loopDestroy();
2487 swiper.slides = $wrapperEl.children(("." + (params.slideClass)));
2488 }
2489 var newActiveIndex = activeIndexBuffer;
2490 var indexToRemove;
2491
2492 if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {
2493 for (var i = 0; i < slidesIndexes.length; i += 1) {
2494 indexToRemove = slidesIndexes[i];
2495 if (swiper.slides[indexToRemove]) { swiper.slides.eq(indexToRemove).remove(); }
2496 if (indexToRemove < newActiveIndex) { newActiveIndex -= 1; }
2497 }
2498 newActiveIndex = Math.max(newActiveIndex, 0);
2499 } else {
2500 indexToRemove = slidesIndexes;
2501 if (swiper.slides[indexToRemove]) { swiper.slides.eq(indexToRemove).remove(); }
2502 if (indexToRemove < newActiveIndex) { newActiveIndex -= 1; }
2503 newActiveIndex = Math.max(newActiveIndex, 0);
2504 }
2505
2506 if (params.loop) {
2507 swiper.loopCreate();
2508 }
2509
2510 if (!(params.observer && Support.observer)) {
2511 swiper.update();
2512 }
2513 if (params.loop) {
2514 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
2515 } else {
2516 swiper.slideTo(newActiveIndex, 0, false);
2517 }
2518 }
2519
2520 function removeAllSlides () {
2521 var swiper = this;
2522
2523 var slidesIndexes = [];
2524 for (var i = 0; i < swiper.slides.length; i += 1) {
2525 slidesIndexes.push(i);
2526 }
2527 swiper.removeSlide(slidesIndexes);
2528 }
2529
2530 var manipulation = {
2531 appendSlide: appendSlide,
2532 prependSlide: prependSlide,
2533 addSlide: addSlide,
2534 removeSlide: removeSlide,
2535 removeAllSlides: removeAllSlides,
2536 };
2537
2538 var Device = (function Device() {
2539 var ua = win.navigator.userAgent;
2540
2541 var device = {
2542 ios: false,
2543 android: false,
2544 androidChrome: false,
2545 desktop: false,
2546 windows: false,
2547 iphone: false,
2548 ipod: false,
2549 ipad: false,
2550 cordova: win.cordova || win.phonegap,
2551 phonegap: win.cordova || win.phonegap,
2552 };
2553
2554 var windows = ua.match(/(Windows Phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
2555 var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
2556 var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
2557 var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
2558 var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
2559
2560
2561 // Windows
2562 if (windows) {
2563 device.os = 'windows';
2564 device.osVersion = windows[2];
2565 device.windows = true;
2566 }
2567 // Android
2568 if (android && !windows) {
2569 device.os = 'android';
2570 device.osVersion = android[2];
2571 device.android = true;
2572 device.androidChrome = ua.toLowerCase().indexOf('chrome') >= 0;
2573 }
2574 if (ipad || iphone || ipod) {
2575 device.os = 'ios';
2576 device.ios = true;
2577 }
2578 // iOS
2579 if (iphone && !ipod) {
2580 device.osVersion = iphone[2].replace(/_/g, '.');
2581 device.iphone = true;
2582 }
2583 if (ipad) {
2584 device.osVersion = ipad[2].replace(/_/g, '.');
2585 device.ipad = true;
2586 }
2587 if (ipod) {
2588 device.osVersion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
2589 device.iphone = true;
2590 }
2591 // iOS 8+ changed UA
2592 if (device.ios && device.osVersion && ua.indexOf('Version/') >= 0) {
2593 if (device.osVersion.split('.')[0] === '10') {
2594 device.osVersion = ua.toLowerCase().split('version/')[1].split(' ')[0];
2595 }
2596 }
2597
2598 // Desktop
2599 device.desktop = !(device.os || device.android || device.webView);
2600
2601 // Webview
2602 device.webView = (iphone || ipad || ipod) && ua.match(/.*AppleWebKit(?!.*Safari)/i);
2603
2604 // Minimal UI
2605 if (device.os && device.os === 'ios') {
2606 var osVersionArr = device.osVersion.split('.');
2607 var metaViewport = doc.querySelector('meta[name="viewport"]');
2608 device.minimalUi = !device.webView
2609 && (ipod || iphone)
2610 && (osVersionArr[0] * 1 === 7 ? osVersionArr[1] * 1 >= 1 : osVersionArr[0] * 1 > 7)
2611 && metaViewport && metaViewport.getAttribute('content').indexOf('minimal-ui') >= 0;
2612 }
2613
2614 // Pixel Ratio
2615 device.pixelRatio = win.devicePixelRatio || 1;
2616
2617 // Export object
2618 return device;
2619 }());
2620
2621 function onTouchStart (event) {
2622 var swiper = this;
2623 var data = swiper.touchEventsData;
2624 var params = swiper.params;
2625 var touches = swiper.touches;
2626 if (swiper.animating && params.preventInteractionOnTransition) {
2627 return;
2628 }
2629 var e = event;
2630 if (e.originalEvent) { e = e.originalEvent; }
2631 data.isTouchEvent = e.type === 'touchstart';
2632 if (!data.isTouchEvent && 'which' in e && e.which === 3) { return; }
2633 if (!data.isTouchEvent && 'button' in e && e.button > 0) { return; }
2634 if (data.isTouched && data.isMoved) { return; }
2635 if (params.noSwiping && $(e.target).closest(params.noSwipingSelector ? params.noSwipingSelector : ("." + (params.noSwipingClass)))[0]) {
2636 swiper.allowClick = true;
2637 return;
2638 }
2639 if (params.swipeHandler) {
2640 if (!$(e).closest(params.swipeHandler)[0]) { return; }
2641 }
2642
2643 touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
2644 touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
2645 var startX = touches.currentX;
2646 var startY = touches.currentY;
2647
2648 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
2649
2650 var edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
2651 var edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
2652 if (
2653 edgeSwipeDetection
2654 && ((startX <= edgeSwipeThreshold)
2655 || (startX >= win.screen.width - edgeSwipeThreshold))
2656 ) {
2657 return;
2658 }
2659
2660 Utils.extend(data, {
2661 isTouched: true,
2662 isMoved: false,
2663 allowTouchCallbacks: true,
2664 isScrolling: undefined,
2665 startMoving: undefined,
2666 });
2667
2668 touches.startX = startX;
2669 touches.startY = startY;
2670 data.touchStartTime = Utils.now();
2671 swiper.allowClick = true;
2672 swiper.updateSize();
2673 swiper.swipeDirection = undefined;
2674 if (params.threshold > 0) { data.allowThresholdMove = false; }
2675 if (e.type !== 'touchstart') {
2676 var preventDefault = true;
2677 if ($(e.target).is(data.formElements)) { preventDefault = false; }
2678 if (
2679 doc.activeElement
2680 && $(doc.activeElement).is(data.formElements)
2681 && doc.activeElement !== e.target
2682 ) {
2683 doc.activeElement.blur();
2684 }
2685
2686 var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
2687 if (params.touchStartForcePreventDefault || shouldPreventDefault) {
2688 e.preventDefault();
2689 }
2690 }
2691 swiper.emit('touchStart', e);
2692 }
2693
2694 function onTouchMove (event) {
2695 var swiper = this;
2696 var data = swiper.touchEventsData;
2697 var params = swiper.params;
2698 var touches = swiper.touches;
2699 var rtl = swiper.rtlTranslate;
2700 var e = event;
2701 if (e.originalEvent) { e = e.originalEvent; }
2702 if (!data.isTouched) {
2703 if (data.startMoving && data.isScrolling) {
2704 swiper.emit('touchMoveOpposite', e);
2705 }
2706 return;
2707 }
2708 if (data.isTouchEvent && e.type === 'mousemove') { return; }
2709 var pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
2710 var pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
2711 if (e.preventedByNestedSwiper) {
2712 touches.startX = pageX;
2713 touches.startY = pageY;
2714 return;
2715 }
2716 if (!swiper.allowTouchMove) {
2717 // isMoved = true;
2718 swiper.allowClick = false;
2719 if (data.isTouched) {
2720 Utils.extend(touches, {
2721 startX: pageX,
2722 startY: pageY,
2723 currentX: pageX,
2724 currentY: pageY,
2725 });
2726 data.touchStartTime = Utils.now();
2727 }
2728 return;
2729 }
2730 if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
2731 if (swiper.isVertical()) {
2732 // Vertical
2733 if (
2734 (pageY < touches.startY && swiper.translate <= swiper.maxTranslate())
2735 || (pageY > touches.startY && swiper.translate >= swiper.minTranslate())
2736 ) {
2737 data.isTouched = false;
2738 data.isMoved = false;
2739 return;
2740 }
2741 } else if (
2742 (pageX < touches.startX && swiper.translate <= swiper.maxTranslate())
2743 || (pageX > touches.startX && swiper.translate >= swiper.minTranslate())
2744 ) {
2745 return;
2746 }
2747 }
2748 if (data.isTouchEvent && doc.activeElement) {
2749 if (e.target === doc.activeElement && $(e.target).is(data.formElements)) {
2750 data.isMoved = true;
2751 swiper.allowClick = false;
2752 return;
2753 }
2754 }
2755 if (data.allowTouchCallbacks) {
2756 swiper.emit('touchMove', e);
2757 }
2758 if (e.targetTouches && e.targetTouches.length > 1) { return; }
2759
2760 touches.currentX = pageX;
2761 touches.currentY = pageY;
2762
2763 var diffX = touches.currentX - touches.startX;
2764 var diffY = touches.currentY - touches.startY;
2765 if (swiper.params.threshold && Math.sqrt((Math.pow( diffX, 2 )) + (Math.pow( diffY, 2 ))) < swiper.params.threshold) { return; }
2766
2767 if (typeof data.isScrolling === 'undefined') {
2768 var touchAngle;
2769 if ((swiper.isHorizontal() && touches.currentY === touches.startY) || (swiper.isVertical() && touches.currentX === touches.startX)) {
2770 data.isScrolling = false;
2771 } else {
2772 // eslint-disable-next-line
2773 if ((diffX * diffX) + (diffY * diffY) >= 25) {
2774 touchAngle = (Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180) / Math.PI;
2775 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : (90 - touchAngle > params.touchAngle);
2776 }
2777 }
2778 }
2779 if (data.isScrolling) {
2780 swiper.emit('touchMoveOpposite', e);
2781 }
2782 if (typeof data.startMoving === 'undefined') {
2783 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
2784 data.startMoving = true;
2785 }
2786 }
2787 if (data.isScrolling) {
2788 data.isTouched = false;
2789 return;
2790 }
2791 if (!data.startMoving) {
2792 return;
2793 }
2794 swiper.allowClick = false;
2795 e.preventDefault();
2796 if (params.touchMoveStopPropagation && !params.nested) {
2797 e.stopPropagation();
2798 }
2799
2800 if (!data.isMoved) {
2801 if (params.loop) {
2802 swiper.loopFix();
2803 }
2804 data.startTranslate = swiper.getTranslate();
2805 swiper.setTransition(0);
2806 if (swiper.animating) {
2807 swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
2808 }
2809 data.allowMomentumBounce = false;
2810 // Grab Cursor
2811 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
2812 swiper.setGrabCursor(true);
2813 }
2814 swiper.emit('sliderFirstMove', e);
2815 }
2816 swiper.emit('sliderMove', e);
2817 data.isMoved = true;
2818
2819 var diff = swiper.isHorizontal() ? diffX : diffY;
2820 touches.diff = diff;
2821
2822 diff *= params.touchRatio;
2823 if (rtl) { diff = -diff; }
2824
2825 swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
2826 data.currentTranslate = diff + data.startTranslate;
2827
2828 var disableParentSwiper = true;
2829 var resistanceRatio = params.resistanceRatio;
2830 if (params.touchReleaseOnEdges) {
2831 resistanceRatio = 0;
2832 }
2833 if ((diff > 0 && data.currentTranslate > swiper.minTranslate())) {
2834 disableParentSwiper = false;
2835 if (params.resistance) { data.currentTranslate = (swiper.minTranslate() - 1) + (Math.pow( (-swiper.minTranslate() + data.startTranslate + diff), resistanceRatio )); }
2836 } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
2837 disableParentSwiper = false;
2838 if (params.resistance) { data.currentTranslate = (swiper.maxTranslate() + 1) - (Math.pow( (swiper.maxTranslate() - data.startTranslate - diff), resistanceRatio )); }
2839 }
2840
2841 if (disableParentSwiper) {
2842 e.preventedByNestedSwiper = true;
2843 }
2844
2845 // Directions locks
2846 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
2847 data.currentTranslate = data.startTranslate;
2848 }
2849 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
2850 data.currentTranslate = data.startTranslate;
2851 }
2852
2853
2854 // Threshold
2855 if (params.threshold > 0) {
2856 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
2857 if (!data.allowThresholdMove) {
2858 data.allowThresholdMove = true;
2859 touches.startX = touches.currentX;
2860 touches.startY = touches.currentY;
2861 data.currentTranslate = data.startTranslate;
2862 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
2863 return;
2864 }
2865 } else {
2866 data.currentTranslate = data.startTranslate;
2867 return;
2868 }
2869 }
2870
2871 if (!params.followFinger) { return; }
2872
2873 // Update active index in free mode
2874 if (params.freeMode || params.watchSlidesProgress || params.watchSlidesVisibility) {
2875 swiper.updateActiveIndex();
2876 swiper.updateSlidesClasses();
2877 }
2878 if (params.freeMode) {
2879 // Velocity
2880 if (data.velocities.length === 0) {
2881 data.velocities.push({
2882 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
2883 time: data.touchStartTime,
2884 });
2885 }
2886 data.velocities.push({
2887 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
2888 time: Utils.now(),
2889 });
2890 }
2891 // Update progress
2892 swiper.updateProgress(data.currentTranslate);
2893 // Update translate
2894 swiper.setTranslate(data.currentTranslate);
2895 }
2896
2897 function onTouchEnd (event) {
2898 var swiper = this;
2899 var data = swiper.touchEventsData;
2900
2901 var params = swiper.params;
2902 var touches = swiper.touches;
2903 var rtl = swiper.rtlTranslate;
2904 var $wrapperEl = swiper.$wrapperEl;
2905 var slidesGrid = swiper.slidesGrid;
2906 var snapGrid = swiper.snapGrid;
2907 var e = event;
2908 if (e.originalEvent) { e = e.originalEvent; }
2909 if (data.allowTouchCallbacks) {
2910 swiper.emit('touchEnd', e);
2911 }
2912 data.allowTouchCallbacks = false;
2913 if (!data.isTouched) {
2914 if (data.isMoved && params.grabCursor) {
2915 swiper.setGrabCursor(false);
2916 }
2917 data.isMoved = false;
2918 data.startMoving = false;
2919 return;
2920 }
2921 // Return Grab Cursor
2922 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
2923 swiper.setGrabCursor(false);
2924 }
2925
2926 // Time diff
2927 var touchEndTime = Utils.now();
2928 var timeDiff = touchEndTime - data.touchStartTime;
2929
2930 // Tap, doubleTap, Click
2931 if (swiper.allowClick) {
2932 swiper.updateClickedSlide(e);
2933 swiper.emit('tap', e);
2934 if (timeDiff < 300 && (touchEndTime - data.lastClickTime) > 300) {
2935 if (data.clickTimeout) { clearTimeout(data.clickTimeout); }
2936 data.clickTimeout = Utils.nextTick(function () {
2937 if (!swiper || swiper.destroyed) { return; }
2938 swiper.emit('click', e);
2939 }, 300);
2940 }
2941 if (timeDiff < 300 && (touchEndTime - data.lastClickTime) < 300) {
2942 if (data.clickTimeout) { clearTimeout(data.clickTimeout); }
2943 swiper.emit('doubleTap', e);
2944 }
2945 }
2946
2947 data.lastClickTime = Utils.now();
2948 Utils.nextTick(function () {
2949 if (!swiper.destroyed) { swiper.allowClick = true; }
2950 });
2951
2952 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
2953 data.isTouched = false;
2954 data.isMoved = false;
2955 data.startMoving = false;
2956 return;
2957 }
2958 data.isTouched = false;
2959 data.isMoved = false;
2960 data.startMoving = false;
2961
2962 var currentPos;
2963 if (params.followFinger) {
2964 currentPos = rtl ? swiper.translate : -swiper.translate;
2965 } else {
2966 currentPos = -data.currentTranslate;
2967 }
2968
2969 if (params.freeMode) {
2970 if (currentPos < -swiper.minTranslate()) {
2971 swiper.slideTo(swiper.activeIndex);
2972 return;
2973 }
2974 if (currentPos > -swiper.maxTranslate()) {
2975 if (swiper.slides.length < snapGrid.length) {
2976 swiper.slideTo(snapGrid.length - 1);
2977 } else {
2978 swiper.slideTo(swiper.slides.length - 1);
2979 }
2980 return;
2981 }
2982
2983 if (params.freeModeMomentum) {
2984 if (data.velocities.length > 1) {
2985 var lastMoveEvent = data.velocities.pop();
2986 var velocityEvent = data.velocities.pop();
2987
2988 var distance = lastMoveEvent.position - velocityEvent.position;
2989 var time = lastMoveEvent.time - velocityEvent.time;
2990 swiper.velocity = distance / time;
2991 swiper.velocity /= 2;
2992 if (Math.abs(swiper.velocity) < params.freeModeMinimumVelocity) {
2993 swiper.velocity = 0;
2994 }
2995 // this implies that the user stopped moving a finger then released.
2996 // There would be no events with distance zero, so the last event is stale.
2997 if (time > 150 || (Utils.now() - lastMoveEvent.time) > 300) {
2998 swiper.velocity = 0;
2999 }
3000 } else {
3001 swiper.velocity = 0;
3002 }
3003 swiper.velocity *= params.freeModeMomentumVelocityRatio;
3004
3005 data.velocities.length = 0;
3006 var momentumDuration = 1000 * params.freeModeMomentumRatio;
3007 var momentumDistance = swiper.velocity * momentumDuration;
3008
3009 var newPosition = swiper.translate + momentumDistance;
3010 if (rtl) { newPosition = -newPosition; }
3011
3012 var doBounce = false;
3013 var afterBouncePosition;
3014 var bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeModeMomentumBounceRatio;
3015 var needsLoopFix;
3016 if (newPosition < swiper.maxTranslate()) {
3017 if (params.freeModeMomentumBounce) {
3018 if (newPosition + swiper.maxTranslate() < -bounceAmount) {
3019 newPosition = swiper.maxTranslate() - bounceAmount;
3020 }
3021 afterBouncePosition = swiper.maxTranslate();
3022 doBounce = true;
3023 data.allowMomentumBounce = true;
3024 } else {
3025 newPosition = swiper.maxTranslate();
3026 }
3027 if (params.loop && params.centeredSlides) { needsLoopFix = true; }
3028 } else if (newPosition > swiper.minTranslate()) {
3029 if (params.freeModeMomentumBounce) {
3030 if (newPosition - swiper.minTranslate() > bounceAmount) {
3031 newPosition = swiper.minTranslate() + bounceAmount;
3032 }
3033 afterBouncePosition = swiper.minTranslate();
3034 doBounce = true;
3035 data.allowMomentumBounce = true;
3036 } else {
3037 newPosition = swiper.minTranslate();
3038 }
3039 if (params.loop && params.centeredSlides) { needsLoopFix = true; }
3040 } else if (params.freeModeSticky) {
3041 var nextSlide;
3042 for (var j = 0; j < snapGrid.length; j += 1) {
3043 if (snapGrid[j] > -newPosition) {
3044 nextSlide = j;
3045 break;
3046 }
3047 }
3048
3049 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
3050 newPosition = snapGrid[nextSlide];
3051 } else {
3052 newPosition = snapGrid[nextSlide - 1];
3053 }
3054 newPosition = -newPosition;
3055 }
3056 if (needsLoopFix) {
3057 swiper.once('transitionEnd', function () {
3058 swiper.loopFix();
3059 });
3060 }
3061 // Fix duration
3062 if (swiper.velocity !== 0) {
3063 if (rtl) {
3064 momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
3065 } else {
3066 momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
3067 }
3068 } else if (params.freeModeSticky) {
3069 swiper.slideToClosest();
3070 return;
3071 }
3072
3073 if (params.freeModeMomentumBounce && doBounce) {
3074 swiper.updateProgress(afterBouncePosition);
3075 swiper.setTransition(momentumDuration);
3076 swiper.setTranslate(newPosition);
3077 swiper.transitionStart(true, swiper.swipeDirection);
3078 swiper.animating = true;
3079 $wrapperEl.transitionEnd(function () {
3080 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) { return; }
3081 swiper.emit('momentumBounce');
3082
3083 swiper.setTransition(params.speed);
3084 swiper.setTranslate(afterBouncePosition);
3085 $wrapperEl.transitionEnd(function () {
3086 if (!swiper || swiper.destroyed) { return; }
3087 swiper.transitionEnd();
3088 });
3089 });
3090 } else if (swiper.velocity) {
3091 swiper.updateProgress(newPosition);
3092 swiper.setTransition(momentumDuration);
3093 swiper.setTranslate(newPosition);
3094 swiper.transitionStart(true, swiper.swipeDirection);
3095 if (!swiper.animating) {
3096 swiper.animating = true;
3097 $wrapperEl.transitionEnd(function () {
3098 if (!swiper || swiper.destroyed) { return; }
3099 swiper.transitionEnd();
3100 });
3101 }
3102 } else {
3103 swiper.updateProgress(newPosition);
3104 }
3105
3106 swiper.updateActiveIndex();
3107 swiper.updateSlidesClasses();
3108 } else if (params.freeModeSticky) {
3109 swiper.slideToClosest();
3110 return;
3111 }
3112
3113 if (!params.freeModeMomentum || timeDiff >= params.longSwipesMs) {
3114 swiper.updateProgress();
3115 swiper.updateActiveIndex();
3116 swiper.updateSlidesClasses();
3117 }
3118 return;
3119 }
3120
3121 // Find current slide
3122 var stopIndex = 0;
3123 var groupSize = swiper.slidesSizesGrid[0];
3124 for (var i = 0; i < slidesGrid.length; i += params.slidesPerGroup) {
3125 if (typeof slidesGrid[i + params.slidesPerGroup] !== 'undefined') {
3126 if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + params.slidesPerGroup]) {
3127 stopIndex = i;
3128 groupSize = slidesGrid[i + params.slidesPerGroup] - slidesGrid[i];
3129 }
3130 } else if (currentPos >= slidesGrid[i]) {
3131 stopIndex = i;
3132 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
3133 }
3134 }
3135
3136 // Find current slide size
3137 var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
3138
3139 if (timeDiff > params.longSwipesMs) {
3140 // Long touches
3141 if (!params.longSwipes) {
3142 swiper.slideTo(swiper.activeIndex);
3143 return;
3144 }
3145 if (swiper.swipeDirection === 'next') {
3146 if (ratio >= params.longSwipesRatio) { swiper.slideTo(stopIndex + params.slidesPerGroup); }
3147 else { swiper.slideTo(stopIndex); }
3148 }
3149 if (swiper.swipeDirection === 'prev') {
3150 if (ratio > (1 - params.longSwipesRatio)) { swiper.slideTo(stopIndex + params.slidesPerGroup); }
3151 else { swiper.slideTo(stopIndex); }
3152 }
3153 } else {
3154 // Short swipes
3155 if (!params.shortSwipes) {
3156 swiper.slideTo(swiper.activeIndex);
3157 return;
3158 }
3159 if (swiper.swipeDirection === 'next') {
3160 swiper.slideTo(stopIndex + params.slidesPerGroup);
3161 }
3162 if (swiper.swipeDirection === 'prev') {
3163 swiper.slideTo(stopIndex);
3164 }
3165 }
3166 }
3167
3168 function onResize () {
3169 var swiper = this;
3170
3171 var params = swiper.params;
3172 var el = swiper.el;
3173
3174 if (el && el.offsetWidth === 0) { return; }
3175
3176 // Breakpoints
3177 if (params.breakpoints) {
3178 swiper.setBreakpoint();
3179 }
3180
3181 // Save locks
3182 var allowSlideNext = swiper.allowSlideNext;
3183 var allowSlidePrev = swiper.allowSlidePrev;
3184 var snapGrid = swiper.snapGrid;
3185
3186 // Disable locks on resize
3187 swiper.allowSlideNext = true;
3188 swiper.allowSlidePrev = true;
3189
3190 swiper.updateSize();
3191 swiper.updateSlides();
3192
3193 if (params.freeMode) {
3194 var newTranslate = Math.min(Math.max(swiper.translate, swiper.maxTranslate()), swiper.minTranslate());
3195 swiper.setTranslate(newTranslate);
3196 swiper.updateActiveIndex();
3197 swiper.updateSlidesClasses();
3198
3199 if (params.autoHeight) {
3200 swiper.updateAutoHeight();
3201 }
3202 } else {
3203 swiper.updateSlidesClasses();
3204 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
3205 swiper.slideTo(swiper.slides.length - 1, 0, false, true);
3206 } else {
3207 swiper.slideTo(swiper.activeIndex, 0, false, true);
3208 }
3209 }
3210 // Return locks after resize
3211 swiper.allowSlidePrev = allowSlidePrev;
3212 swiper.allowSlideNext = allowSlideNext;
3213
3214 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
3215 swiper.checkOverflow();
3216 }
3217 }
3218
3219 function onClick (e) {
3220 var swiper = this;
3221 if (!swiper.allowClick) {
3222 if (swiper.params.preventClicks) { e.preventDefault(); }
3223 if (swiper.params.preventClicksPropagation && swiper.animating) {
3224 e.stopPropagation();
3225 e.stopImmediatePropagation();
3226 }
3227 }
3228 }
3229
3230 function attachEvents() {
3231 var swiper = this;
3232 var params = swiper.params;
3233 var touchEvents = swiper.touchEvents;
3234 var el = swiper.el;
3235 var wrapperEl = swiper.wrapperEl;
3236
3237 {
3238 swiper.onTouchStart = onTouchStart.bind(swiper);
3239 swiper.onTouchMove = onTouchMove.bind(swiper);
3240 swiper.onTouchEnd = onTouchEnd.bind(swiper);
3241 }
3242
3243 swiper.onClick = onClick.bind(swiper);
3244
3245 var target = params.touchEventsTarget === 'container' ? el : wrapperEl;
3246 var capture = !!params.nested;
3247
3248 // Touch Events
3249 {
3250 if (!Support.touch && (Support.pointerEvents || Support.prefixedPointerEvents)) {
3251 target.addEventListener(touchEvents.start, swiper.onTouchStart, false);
3252 doc.addEventListener(touchEvents.move, swiper.onTouchMove, capture);
3253 doc.addEventListener(touchEvents.end, swiper.onTouchEnd, false);
3254 } else {
3255 if (Support.touch) {
3256 var passiveListener = touchEvents.start === 'touchstart' && Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false;
3257 target.addEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
3258 target.addEventListener(touchEvents.move, swiper.onTouchMove, Support.passiveListener ? { passive: false, capture: capture } : capture);
3259 target.addEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
3260 }
3261 if ((params.simulateTouch && !Device.ios && !Device.android) || (params.simulateTouch && !Support.touch && Device.ios)) {
3262 target.addEventListener('mousedown', swiper.onTouchStart, false);
3263 doc.addEventListener('mousemove', swiper.onTouchMove, capture);
3264 doc.addEventListener('mouseup', swiper.onTouchEnd, false);
3265 }
3266 }
3267 // Prevent Links Clicks
3268 if (params.preventClicks || params.preventClicksPropagation) {
3269 target.addEventListener('click', swiper.onClick, true);
3270 }
3271 }
3272
3273 // Resize handler
3274 swiper.on((Device.ios || Device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate'), onResize, true);
3275 }
3276
3277 function detachEvents() {
3278 var swiper = this;
3279
3280 var params = swiper.params;
3281 var touchEvents = swiper.touchEvents;
3282 var el = swiper.el;
3283 var wrapperEl = swiper.wrapperEl;
3284
3285 var target = params.touchEventsTarget === 'container' ? el : wrapperEl;
3286 var capture = !!params.nested;
3287
3288 // Touch Events
3289 {
3290 if (!Support.touch && (Support.pointerEvents || Support.prefixedPointerEvents)) {
3291 target.removeEventListener(touchEvents.start, swiper.onTouchStart, false);
3292 doc.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
3293 doc.removeEventListener(touchEvents.end, swiper.onTouchEnd, false);
3294 } else {
3295 if (Support.touch) {
3296 var passiveListener = touchEvents.start === 'onTouchStart' && Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false;
3297 target.removeEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
3298 target.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
3299 target.removeEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
3300 }
3301 if ((params.simulateTouch && !Device.ios && !Device.android) || (params.simulateTouch && !Support.touch && Device.ios)) {
3302 target.removeEventListener('mousedown', swiper.onTouchStart, false);
3303 doc.removeEventListener('mousemove', swiper.onTouchMove, capture);
3304 doc.removeEventListener('mouseup', swiper.onTouchEnd, false);
3305 }
3306 }
3307 // Prevent Links Clicks
3308 if (params.preventClicks || params.preventClicksPropagation) {
3309 target.removeEventListener('click', swiper.onClick, true);
3310 }
3311 }
3312
3313 // Resize handler
3314 swiper.off((Device.ios || Device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate'), onResize);
3315 }
3316
3317 var events = {
3318 attachEvents: attachEvents,
3319 detachEvents: detachEvents,
3320 };
3321
3322 function setBreakpoint () {
3323 var swiper = this;
3324 var activeIndex = swiper.activeIndex;
3325 var initialized = swiper.initialized;
3326 var loopedSlides = swiper.loopedSlides; if ( loopedSlides === void 0 ) loopedSlides = 0;
3327 var params = swiper.params;
3328 var breakpoints = params.breakpoints;
3329 if (!breakpoints || (breakpoints && Object.keys(breakpoints).length === 0)) { return; }
3330
3331 // Set breakpoint for window width and update parameters
3332 var breakpoint = swiper.getBreakpoint(breakpoints);
3333
3334 if (breakpoint && swiper.currentBreakpoint !== breakpoint) {
3335 var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
3336 if (breakpointOnlyParams) {
3337 ['slidesPerView', 'spaceBetween', 'slidesPerGroup'].forEach(function (param) {
3338 var paramValue = breakpointOnlyParams[param];
3339 if (typeof paramValue === 'undefined') { return; }
3340 if (param === 'slidesPerView' && (paramValue === 'AUTO' || paramValue === 'auto')) {
3341 breakpointOnlyParams[param] = 'auto';
3342 } else if (param === 'slidesPerView') {
3343 breakpointOnlyParams[param] = parseFloat(paramValue);
3344 } else {
3345 breakpointOnlyParams[param] = parseInt(paramValue, 10);
3346 }
3347 });
3348 }
3349
3350 var breakpointParams = breakpointOnlyParams || swiper.originalParams;
3351 var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
3352 var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
3353
3354 if (directionChanged && initialized) {
3355 swiper.changeDirection();
3356 }
3357
3358 Utils.extend(swiper.params, breakpointParams);
3359
3360 Utils.extend(swiper, {
3361 allowTouchMove: swiper.params.allowTouchMove,
3362 allowSlideNext: swiper.params.allowSlideNext,
3363 allowSlidePrev: swiper.params.allowSlidePrev,
3364 });
3365
3366 swiper.currentBreakpoint = breakpoint;
3367
3368 if (needsReLoop && initialized) {
3369 swiper.loopDestroy();
3370 swiper.loopCreate();
3371 swiper.updateSlides();
3372 swiper.slideTo((activeIndex - loopedSlides) + swiper.loopedSlides, 0, false);
3373 }
3374
3375 swiper.emit('breakpoint', breakpointParams);
3376 }
3377 }
3378
3379 function getBreakpoint (breakpoints) {
3380 var swiper = this;
3381 // Get breakpoint for window width
3382 if (!breakpoints) { return undefined; }
3383 var breakpoint = false;
3384 var points = [];
3385 Object.keys(breakpoints).forEach(function (point) {
3386 points.push(point);
3387 });
3388 points.sort(function (a, b) { return parseInt(a, 10) - parseInt(b, 10); });
3389 for (var i = 0; i < points.length; i += 1) {
3390 var point = points[i];
3391 if (swiper.params.breakpointsInverse) {
3392 if (point <= win.innerWidth) {
3393 breakpoint = point;
3394 }
3395 } else if (point >= win.innerWidth && !breakpoint) {
3396 breakpoint = point;
3397 }
3398 }
3399 return breakpoint || 'max';
3400 }
3401
3402 var breakpoints = { setBreakpoint: setBreakpoint, getBreakpoint: getBreakpoint };
3403
3404 function addClasses () {
3405 var swiper = this;
3406 var classNames = swiper.classNames;
3407 var params = swiper.params;
3408 var rtl = swiper.rtl;
3409 var $el = swiper.$el;
3410 var suffixes = [];
3411
3412 suffixes.push('initialized');
3413 suffixes.push(params.direction);
3414
3415 if (params.freeMode) {
3416 suffixes.push('free-mode');
3417 }
3418 if (!Support.flexbox) {
3419 suffixes.push('no-flexbox');
3420 }
3421 if (params.autoHeight) {
3422 suffixes.push('autoheight');
3423 }
3424 if (rtl) {
3425 suffixes.push('rtl');
3426 }
3427 if (params.slidesPerColumn > 1) {
3428 suffixes.push('multirow');
3429 }
3430 if (Device.android) {
3431 suffixes.push('android');
3432 }
3433 if (Device.ios) {
3434 suffixes.push('ios');
3435 }
3436 // WP8 Touch Events Fix
3437 if ((Browser.isIE || Browser.isEdge) && (Support.pointerEvents || Support.prefixedPointerEvents)) {
3438 suffixes.push(("wp8-" + (params.direction)));
3439 }
3440
3441 suffixes.forEach(function (suffix) {
3442 classNames.push(params.containerModifierClass + suffix);
3443 });
3444
3445 $el.addClass(classNames.join(' '));
3446 }
3447
3448 function removeClasses () {
3449 var swiper = this;
3450 var $el = swiper.$el;
3451 var classNames = swiper.classNames;
3452
3453 $el.removeClass(classNames.join(' '));
3454 }
3455
3456 var classes = { addClasses: addClasses, removeClasses: removeClasses };
3457
3458 function loadImage (imageEl, src, srcset, sizes, checkForComplete, callback) {
3459 var image;
3460 function onReady() {
3461 if (callback) { callback(); }
3462 }
3463 if (!imageEl.complete || !checkForComplete) {
3464 if (src) {
3465 image = new win.Image();
3466 image.onload = onReady;
3467 image.onerror = onReady;
3468 if (sizes) {
3469 image.sizes = sizes;
3470 }
3471 if (srcset) {
3472 image.srcset = srcset;
3473 }
3474 if (src) {
3475 image.src = src;
3476 }
3477 } else {
3478 onReady();
3479 }
3480 } else {
3481 // image already loaded...
3482 onReady();
3483 }
3484 }
3485
3486 function preloadImages () {
3487 var swiper = this;
3488 swiper.imagesToLoad = swiper.$el.find('img');
3489 function onReady() {
3490 if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) { return; }
3491 if (swiper.imagesLoaded !== undefined) { swiper.imagesLoaded += 1; }
3492 if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
3493 if (swiper.params.updateOnImagesReady) { swiper.update(); }
3494 swiper.emit('imagesReady');
3495 }
3496 }
3497 for (var i = 0; i < swiper.imagesToLoad.length; i += 1) {
3498 var imageEl = swiper.imagesToLoad[i];
3499 swiper.loadImage(
3500 imageEl,
3501 imageEl.currentSrc || imageEl.getAttribute('src'),
3502 imageEl.srcset || imageEl.getAttribute('srcset'),
3503 imageEl.sizes || imageEl.getAttribute('sizes'),
3504 true,
3505 onReady
3506 );
3507 }
3508 }
3509
3510 var images = {
3511 loadImage: loadImage,
3512 preloadImages: preloadImages,
3513 };
3514
3515 function checkOverflow() {
3516 var swiper = this;
3517 var wasLocked = swiper.isLocked;
3518
3519 swiper.isLocked = swiper.snapGrid.length === 1;
3520 swiper.allowSlideNext = !swiper.isLocked;
3521 swiper.allowSlidePrev = !swiper.isLocked;
3522
3523 // events
3524 if (wasLocked !== swiper.isLocked) { swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); }
3525
3526 if (wasLocked && wasLocked !== swiper.isLocked) {
3527 swiper.isEnd = false;
3528 swiper.navigation.update();
3529 }
3530 }
3531
3532 var checkOverflow$1 = { checkOverflow: checkOverflow };
3533
3534 var defaults = {
3535 init: true,
3536 direction: 'horizontal',
3537 touchEventsTarget: 'container',
3538 initialSlide: 0,
3539 speed: 300,
3540 //
3541 preventInteractionOnTransition: false,
3542
3543 // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
3544 edgeSwipeDetection: false,
3545 edgeSwipeThreshold: 20,
3546
3547 // Free mode
3548 freeMode: false,
3549 freeModeMomentum: true,
3550 freeModeMomentumRatio: 1,
3551 freeModeMomentumBounce: true,
3552 freeModeMomentumBounceRatio: 1,
3553 freeModeMomentumVelocityRatio: 1,
3554 freeModeSticky: false,
3555 freeModeMinimumVelocity: 0.02,
3556
3557 // Autoheight
3558 autoHeight: false,
3559
3560 // Set wrapper width
3561 setWrapperSize: false,
3562
3563 // Virtual Translate
3564 virtualTranslate: false,
3565
3566 // Effects
3567 effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
3568
3569 // Breakpoints
3570 breakpoints: undefined,
3571 breakpointsInverse: false,
3572
3573 // Slides grid
3574 spaceBetween: 0,
3575 slidesPerView: 1,
3576 slidesPerColumn: 1,
3577 slidesPerColumnFill: 'column',
3578 slidesPerGroup: 1,
3579 centeredSlides: false,
3580 slidesOffsetBefore: 0, // in px
3581 slidesOffsetAfter: 0, // in px
3582 normalizeSlideIndex: true,
3583 centerInsufficientSlides: false,
3584
3585 // Disable swiper and hide navigation when container not overflow
3586 watchOverflow: false,
3587
3588 // Round length
3589 roundLengths: false,
3590
3591 // Touches
3592 touchRatio: 1,
3593 touchAngle: 45,
3594 simulateTouch: true,
3595 shortSwipes: true,
3596 longSwipes: true,
3597 longSwipesRatio: 0.5,
3598 longSwipesMs: 300,
3599 followFinger: true,
3600 allowTouchMove: true,
3601 threshold: 0,
3602 touchMoveStopPropagation: true,
3603 touchStartPreventDefault: true,
3604 touchStartForcePreventDefault: false,
3605 touchReleaseOnEdges: false,
3606
3607 // Unique Navigation Elements
3608 uniqueNavElements: true,
3609
3610 // Resistance
3611 resistance: true,
3612 resistanceRatio: 0.85,
3613
3614 // Progress
3615 watchSlidesProgress: false,
3616 watchSlidesVisibility: false,
3617
3618 // Cursor
3619 grabCursor: false,
3620
3621 // Clicks
3622 preventClicks: true,
3623 preventClicksPropagation: true,
3624 slideToClickedSlide: false,
3625
3626 // Images
3627 preloadImages: true,
3628 updateOnImagesReady: true,
3629
3630 // loop
3631 loop: false,
3632 loopAdditionalSlides: 0,
3633 loopedSlides: null,
3634 loopFillGroupWithBlank: false,
3635
3636 // Swiping/no swiping
3637 allowSlidePrev: true,
3638 allowSlideNext: true,
3639 swipeHandler: null, // '.swipe-handler',
3640 noSwiping: true,
3641 noSwipingClass: 'swiper-no-swiping',
3642 noSwipingSelector: null,
3643
3644 // Passive Listeners
3645 passiveListeners: true,
3646
3647 // NS
3648 containerModifierClass: 'swiper-container-', // NEW
3649 slideClass: 'swiper-slide',
3650 slideBlankClass: 'swiper-slide-invisible-blank',
3651 slideActiveClass: 'swiper-slide-active',
3652 slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
3653 slideVisibleClass: 'swiper-slide-visible',
3654 slideDuplicateClass: 'swiper-slide-duplicate',
3655 slideNextClass: 'swiper-slide-next',
3656 slideDuplicateNextClass: 'swiper-slide-duplicate-next',
3657 slidePrevClass: 'swiper-slide-prev',
3658 slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
3659 wrapperClass: 'swiper-wrapper',
3660
3661 // Callbacks
3662 runCallbacksOnInit: true,
3663 };
3664
3665 /* eslint no-param-reassign: "off" */
3666
3667 var prototypes = {
3668 update: update,
3669 translate: translate,
3670 transition: transition$1,
3671 slide: slide,
3672 loop: loop,
3673 grabCursor: grabCursor,
3674 manipulation: manipulation,
3675 events: events,
3676 breakpoints: breakpoints,
3677 checkOverflow: checkOverflow$1,
3678 classes: classes,
3679 images: images,
3680 };
3681
3682 var extendedDefaults = {};
3683
3684 var Swiper = /*@__PURE__*/(function (SwiperClass) {
3685 function Swiper() {
3686 var assign;
3687
3688 var args = [], len = arguments.length;
3689 while ( len-- ) args[ len ] = arguments[ len ];
3690 var el;
3691 var params;
3692 if (args.length === 1 && args[0].constructor && args[0].constructor === Object) {
3693 params = args[0];
3694 } else {
3695 (assign = args, el = assign[0], params = assign[1]);
3696 }
3697 if (!params) { params = {}; }
3698
3699 params = Utils.extend({}, params);
3700 if (el && !params.el) { params.el = el; }
3701
3702 SwiperClass.call(this, params);
3703
3704 Object.keys(prototypes).forEach(function (prototypeGroup) {
3705 Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) {
3706 if (!Swiper.prototype[protoMethod]) {
3707 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
3708 }
3709 });
3710 });
3711
3712 // Swiper Instance
3713 var swiper = this;
3714 if (typeof swiper.modules === 'undefined') {
3715 swiper.modules = {};
3716 }
3717 Object.keys(swiper.modules).forEach(function (moduleName) {
3718 var module = swiper.modules[moduleName];
3719 if (module.params) {
3720 var moduleParamName = Object.keys(module.params)[0];
3721 var moduleParams = module.params[moduleParamName];
3722 if (typeof moduleParams !== 'object' || moduleParams === null) { return; }
3723 if (!(moduleParamName in params && 'enabled' in moduleParams)) { return; }
3724 if (params[moduleParamName] === true) {
3725 params[moduleParamName] = { enabled: true };
3726 }
3727 if (
3728 typeof params[moduleParamName] === 'object'
3729 && !('enabled' in params[moduleParamName])
3730 ) {
3731 params[moduleParamName].enabled = true;
3732 }
3733 if (!params[moduleParamName]) { params[moduleParamName] = { enabled: false }; }
3734 }
3735 });
3736
3737 // Extend defaults with modules params
3738 var swiperParams = Utils.extend({}, defaults);
3739 swiper.useModulesParams(swiperParams);
3740
3741 // Extend defaults with passed params
3742 swiper.params = Utils.extend({}, swiperParams, extendedDefaults, params);
3743 swiper.originalParams = Utils.extend({}, swiper.params);
3744 swiper.passedParams = Utils.extend({}, params);
3745
3746 // Save Dom lib
3747 swiper.$ = $;
3748
3749 // Find el
3750 var $el = $(swiper.params.el);
3751 el = $el[0];
3752
3753 if (!el) {
3754 return undefined;
3755 }
3756
3757 if ($el.length > 1) {
3758 var swipers = [];
3759 $el.each(function (index, containerEl) {
3760 var newParams = Utils.extend({}, params, { el: containerEl });
3761 swipers.push(new Swiper(newParams));
3762 });
3763 return swipers;
3764 }
3765
3766 el.swiper = swiper;
3767 $el.data('swiper', swiper);
3768
3769 // Find Wrapper
3770 var $wrapperEl = $el.children(("." + (swiper.params.wrapperClass)));
3771
3772 // Extend Swiper
3773 Utils.extend(swiper, {
3774 $el: $el,
3775 el: el,
3776 $wrapperEl: $wrapperEl,
3777 wrapperEl: $wrapperEl[0],
3778
3779 // Classes
3780 classNames: [],
3781
3782 // Slides
3783 slides: $(),
3784 slidesGrid: [],
3785 snapGrid: [],
3786 slidesSizesGrid: [],
3787
3788 // isDirection
3789 isHorizontal: function isHorizontal() {
3790 return swiper.params.direction === 'horizontal';
3791 },
3792 isVertical: function isVertical() {
3793 return swiper.params.direction === 'vertical';
3794 },
3795 // RTL
3796 rtl: (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
3797 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
3798 wrongRTL: $wrapperEl.css('display') === '-webkit-box',
3799
3800 // Indexes
3801 activeIndex: 0,
3802 realIndex: 0,
3803
3804 //
3805 isBeginning: true,
3806 isEnd: false,
3807
3808 // Props
3809 translate: 0,
3810 previousTranslate: 0,
3811 progress: 0,
3812 velocity: 0,
3813 animating: false,
3814
3815 // Locks
3816 allowSlideNext: swiper.params.allowSlideNext,
3817 allowSlidePrev: swiper.params.allowSlidePrev,
3818
3819 // Touch Events
3820 touchEvents: (function touchEvents() {
3821 var touch = ['touchstart', 'touchmove', 'touchend'];
3822 var desktop = ['mousedown', 'mousemove', 'mouseup'];
3823 if (Support.pointerEvents) {
3824 desktop = ['pointerdown', 'pointermove', 'pointerup'];
3825 } else if (Support.prefixedPointerEvents) {
3826 desktop = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp'];
3827 }
3828 swiper.touchEventsTouch = {
3829 start: touch[0],
3830 move: touch[1],
3831 end: touch[2],
3832 };
3833 swiper.touchEventsDesktop = {
3834 start: desktop[0],
3835 move: desktop[1],
3836 end: desktop[2],
3837 };
3838 return Support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
3839 }()),
3840 touchEventsData: {
3841 isTouched: undefined,
3842 isMoved: undefined,
3843 allowTouchCallbacks: undefined,
3844 touchStartTime: undefined,
3845 isScrolling: undefined,
3846 currentTranslate: undefined,
3847 startTranslate: undefined,
3848 allowThresholdMove: undefined,
3849 // Form elements to match
3850 formElements: 'input, select, option, textarea, button, video',
3851 // Last click time
3852 lastClickTime: Utils.now(),
3853 clickTimeout: undefined,
3854 // Velocities
3855 velocities: [],
3856 allowMomentumBounce: undefined,
3857 isTouchEvent: undefined,
3858 startMoving: undefined,
3859 },
3860
3861 // Clicks
3862 allowClick: true,
3863
3864 // Touches
3865 allowTouchMove: swiper.params.allowTouchMove,
3866
3867 touches: {
3868 startX: 0,
3869 startY: 0,
3870 currentX: 0,
3871 currentY: 0,
3872 diff: 0,
3873 },
3874
3875 // Images
3876 imagesToLoad: [],
3877 imagesLoaded: 0,
3878
3879 });
3880
3881 // Install Modules
3882 swiper.useModules();
3883
3884 // Init
3885 if (swiper.params.init) {
3886 swiper.init();
3887 }
3888
3889 // Return app instance
3890 return swiper;
3891 }
3892
3893 if ( SwiperClass ) Swiper.__proto__ = SwiperClass;
3894 Swiper.prototype = Object.create( SwiperClass && SwiperClass.prototype );
3895 Swiper.prototype.constructor = Swiper;
3896
3897 var staticAccessors = { extendedDefaults: { configurable: true },defaults: { configurable: true },Class: { configurable: true },$: { configurable: true } };
3898
3899 Swiper.prototype.slidesPerViewDynamic = function slidesPerViewDynamic () {
3900 var swiper = this;
3901 var params = swiper.params;
3902 var slides = swiper.slides;
3903 var slidesGrid = swiper.slidesGrid;
3904 var swiperSize = swiper.size;
3905 var activeIndex = swiper.activeIndex;
3906 var spv = 1;
3907 if (params.centeredSlides) {
3908 var slideSize = slides[activeIndex].swiperSlideSize;
3909 var breakLoop;
3910 for (var i = activeIndex + 1; i < slides.length; i += 1) {
3911 if (slides[i] && !breakLoop) {
3912 slideSize += slides[i].swiperSlideSize;
3913 spv += 1;
3914 if (slideSize > swiperSize) { breakLoop = true; }
3915 }
3916 }
3917 for (var i$1 = activeIndex - 1; i$1 >= 0; i$1 -= 1) {
3918 if (slides[i$1] && !breakLoop) {
3919 slideSize += slides[i$1].swiperSlideSize;
3920 spv += 1;
3921 if (slideSize > swiperSize) { breakLoop = true; }
3922 }
3923 }
3924 } else {
3925 for (var i$2 = activeIndex + 1; i$2 < slides.length; i$2 += 1) {
3926 if (slidesGrid[i$2] - slidesGrid[activeIndex] < swiperSize) {
3927 spv += 1;
3928 }
3929 }
3930 }
3931 return spv;
3932 };
3933
3934 Swiper.prototype.update = function update () {
3935 var swiper = this;
3936 if (!swiper || swiper.destroyed) { return; }
3937 var snapGrid = swiper.snapGrid;
3938 var params = swiper.params;
3939 // Breakpoints
3940 if (params.breakpoints) {
3941 swiper.setBreakpoint();
3942 }
3943 swiper.updateSize();
3944 swiper.updateSlides();
3945 swiper.updateProgress();
3946 swiper.updateSlidesClasses();
3947
3948 function setTranslate() {
3949 var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
3950 var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
3951 swiper.setTranslate(newTranslate);
3952 swiper.updateActiveIndex();
3953 swiper.updateSlidesClasses();
3954 }
3955 var translated;
3956 if (swiper.params.freeMode) {
3957 setTranslate();
3958 if (swiper.params.autoHeight) {
3959 swiper.updateAutoHeight();
3960 }
3961 } else {
3962 if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
3963 translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
3964 } else {
3965 translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
3966 }
3967 if (!translated) {
3968 setTranslate();
3969 }
3970 }
3971 if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
3972 swiper.checkOverflow();
3973 }
3974 swiper.emit('update');
3975 };
3976
3977 Swiper.prototype.changeDirection = function changeDirection (newDirection, needUpdate) {
3978 if ( needUpdate === void 0 ) needUpdate = true;
3979
3980 var swiper = this;
3981 var currentDirection = swiper.params.direction;
3982 if (!newDirection) {
3983 // eslint-disable-next-line
3984 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
3985 }
3986 if ((newDirection === currentDirection) || (newDirection !== 'horizontal' && newDirection !== 'vertical')) {
3987 return swiper;
3988 }
3989
3990 if (currentDirection === 'vertical') {
3991 swiper.$el
3992 .removeClass(((swiper.params.containerModifierClass) + "vertical wp8-vertical"))
3993 .addClass(("" + (swiper.params.containerModifierClass) + newDirection));
3994
3995 if ((Browser.isIE || Browser.isEdge) && (Support.pointerEvents || Support.prefixedPointerEvents)) {
3996 swiper.$el.addClass(((swiper.params.containerModifierClass) + "wp8-" + newDirection));
3997 }
3998 }
3999 if (currentDirection === 'horizontal') {
4000 swiper.$el
4001 .removeClass(((swiper.params.containerModifierClass) + "horizontal wp8-horizontal"))
4002 .addClass(("" + (swiper.params.containerModifierClass) + newDirection));
4003
4004 if ((Browser.isIE || Browser.isEdge) && (Support.pointerEvents || Support.prefixedPointerEvents)) {
4005 swiper.$el.addClass(((swiper.params.containerModifierClass) + "wp8-" + newDirection));
4006 }
4007 }
4008
4009 swiper.params.direction = newDirection;
4010
4011 swiper.slides.each(function (slideIndex, slideEl) {
4012 if (newDirection === 'vertical') {
4013 slideEl.style.width = '';
4014 } else {
4015 slideEl.style.height = '';
4016 }
4017 });
4018
4019 swiper.emit('changeDirection');
4020 if (needUpdate) { swiper.update(); }
4021
4022 return swiper;
4023 };
4024
4025 Swiper.prototype.init = function init () {
4026 var swiper = this;
4027 if (swiper.initialized) { return; }
4028
4029 swiper.emit('beforeInit');
4030
4031 // Set breakpoint
4032 if (swiper.params.breakpoints) {
4033 swiper.setBreakpoint();
4034 }
4035
4036 // Add Classes
4037 swiper.addClasses();
4038
4039 // Create loop
4040 if (swiper.params.loop) {
4041 swiper.loopCreate();
4042 }
4043
4044 // Update size
4045 swiper.updateSize();
4046
4047 // Update slides
4048 swiper.updateSlides();
4049
4050 if (swiper.params.watchOverflow) {
4051 swiper.checkOverflow();
4052 }
4053
4054 // Set Grab Cursor
4055 if (swiper.params.grabCursor) {
4056 swiper.setGrabCursor();
4057 }
4058
4059 if (swiper.params.preloadImages) {
4060 swiper.preloadImages();
4061 }
4062
4063 // Slide To Initial Slide
4064 if (swiper.params.loop) {
4065 swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit);
4066 } else {
4067 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit);
4068 }
4069
4070 // Attach events
4071 swiper.attachEvents();
4072
4073 // Init Flag
4074 swiper.initialized = true;
4075
4076 // Emit
4077 swiper.emit('init');
4078 };
4079
4080 Swiper.prototype.destroy = function destroy (deleteInstance, cleanStyles) {
4081 if ( deleteInstance === void 0 ) deleteInstance = true;
4082 if ( cleanStyles === void 0 ) cleanStyles = true;
4083
4084 var swiper = this;
4085 var params = swiper.params;
4086 var $el = swiper.$el;
4087 var $wrapperEl = swiper.$wrapperEl;
4088 var slides = swiper.slides;
4089
4090 if (typeof swiper.params === 'undefined' || swiper.destroyed) {
4091 return null;
4092 }
4093
4094 swiper.emit('beforeDestroy');
4095
4096 // Init Flag
4097 swiper.initialized = false;
4098
4099 // Detach events
4100 swiper.detachEvents();
4101
4102 // Destroy loop
4103 if (params.loop) {
4104 swiper.loopDestroy();
4105 }
4106
4107 // Cleanup styles
4108 if (cleanStyles) {
4109 swiper.removeClasses();
4110 $el.removeAttr('style');
4111 $wrapperEl.removeAttr('style');
4112 if (slides && slides.length) {
4113 slides
4114 .removeClass([
4115 params.slideVisibleClass,
4116 params.slideActiveClass,
4117 params.slideNextClass,
4118 params.slidePrevClass ].join(' '))
4119 .removeAttr('style')
4120 .removeAttr('data-swiper-slide-index')
4121 .removeAttr('data-swiper-column')
4122 .removeAttr('data-swiper-row');
4123 }
4124 }
4125
4126 swiper.emit('destroy');
4127
4128 // Detach emitter events
4129 Object.keys(swiper.eventsListeners).forEach(function (eventName) {
4130 swiper.off(eventName);
4131 });
4132
4133 if (deleteInstance !== false) {
4134 swiper.$el[0].swiper = null;
4135 swiper.$el.data('swiper', null);
4136 Utils.deleteProps(swiper);
4137 }
4138 swiper.destroyed = true;
4139
4140 return null;
4141 };
4142
4143 Swiper.extendDefaults = function extendDefaults (newDefaults) {
4144 Utils.extend(extendedDefaults, newDefaults);
4145 };
4146
4147 staticAccessors.extendedDefaults.get = function () {
4148 return extendedDefaults;
4149 };
4150
4151 staticAccessors.defaults.get = function () {
4152 return defaults;
4153 };
4154
4155 staticAccessors.Class.get = function () {
4156 return SwiperClass;
4157 };
4158
4159 staticAccessors.$.get = function () {
4160 return $;
4161 };
4162
4163 Object.defineProperties( Swiper, staticAccessors );
4164
4165 return Swiper;
4166 }(SwiperClass));
4167
4168 var Device$1 = {
4169 name: 'device',
4170 proto: {
4171 device: Device,
4172 },
4173 static: {
4174 device: Device,
4175 },
4176 };
4177
4178 var Support$1 = {
4179 name: 'support',
4180 proto: {
4181 support: Support,
4182 },
4183 static: {
4184 support: Support,
4185 },
4186 };
4187
4188 var Browser$1 = {
4189 name: 'browser',
4190 proto: {
4191 browser: Browser,
4192 },
4193 static: {
4194 browser: Browser,
4195 },
4196 };
4197
4198 var Resize = {
4199 name: 'resize',
4200 create: function create() {
4201 var swiper = this;
4202 Utils.extend(swiper, {
4203 resize: {
4204 resizeHandler: function resizeHandler() {
4205 if (!swiper || swiper.destroyed || !swiper.initialized) { return; }
4206 swiper.emit('beforeResize');
4207 swiper.emit('resize');
4208 },
4209 orientationChangeHandler: function orientationChangeHandler() {
4210 if (!swiper || swiper.destroyed || !swiper.initialized) { return; }
4211 swiper.emit('orientationchange');
4212 },
4213 },
4214 });
4215 },
4216 on: {
4217 init: function init() {
4218 var swiper = this;
4219 // Emit resize
4220 win.addEventListener('resize', swiper.resize.resizeHandler);
4221
4222 // Emit orientationchange
4223 win.addEventListener('orientationchange', swiper.resize.orientationChangeHandler);
4224 },
4225 destroy: function destroy() {
4226 var swiper = this;
4227 win.removeEventListener('resize', swiper.resize.resizeHandler);
4228 win.removeEventListener('orientationchange', swiper.resize.orientationChangeHandler);
4229 },
4230 },
4231 };
4232
4233 var Observer = {
4234 func: win.MutationObserver || win.WebkitMutationObserver,
4235 attach: function attach(target, options) {
4236 if ( options === void 0 ) options = {};
4237
4238 var swiper = this;
4239
4240 var ObserverFunc = Observer.func;
4241 var observer = new ObserverFunc(function (mutations) {
4242 // The observerUpdate event should only be triggered
4243 // once despite the number of mutations. Additional
4244 // triggers are redundant and are very costly
4245 if (mutations.length === 1) {
4246 swiper.emit('observerUpdate', mutations[0]);
4247 return;
4248 }
4249 var observerUpdate = function observerUpdate() {
4250 swiper.emit('observerUpdate', mutations[0]);
4251 };
4252
4253 if (win.requestAnimationFrame) {
4254 win.requestAnimationFrame(observerUpdate);
4255 } else {
4256 win.setTimeout(observerUpdate, 0);
4257 }
4258 });
4259
4260 observer.observe(target, {
4261 attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
4262 childList: typeof options.childList === 'undefined' ? true : options.childList,
4263 characterData: typeof options.characterData === 'undefined' ? true : options.characterData,
4264 });
4265
4266 swiper.observer.observers.push(observer);
4267 },
4268 init: function init() {
4269 var swiper = this;
4270 if (!Support.observer || !swiper.params.observer) { return; }
4271 if (swiper.params.observeParents) {
4272 var containerParents = swiper.$el.parents();
4273 for (var i = 0; i < containerParents.length; i += 1) {
4274 swiper.observer.attach(containerParents[i]);
4275 }
4276 }
4277 // Observe container
4278 swiper.observer.attach(swiper.$el[0], { childList: swiper.params.observeSlideChildren });
4279
4280 // Observe wrapper
4281 swiper.observer.attach(swiper.$wrapperEl[0], { attributes: false });
4282 },
4283 destroy: function destroy() {
4284 var swiper = this;
4285 swiper.observer.observers.forEach(function (observer) {
4286 observer.disconnect();
4287 });
4288 swiper.observer.observers = [];
4289 },
4290 };
4291
4292 var Observer$1 = {
4293 name: 'observer',
4294 params: {
4295 observer: false,
4296 observeParents: false,
4297 observeSlideChildren: false,
4298 },
4299 create: function create() {
4300 var swiper = this;
4301 Utils.extend(swiper, {
4302 observer: {
4303 init: Observer.init.bind(swiper),
4304 attach: Observer.attach.bind(swiper),
4305 destroy: Observer.destroy.bind(swiper),
4306 observers: [],
4307 },
4308 });
4309 },
4310 on: {
4311 init: function init() {
4312 var swiper = this;
4313 swiper.observer.init();
4314 },
4315 destroy: function destroy() {
4316 var swiper = this;
4317 swiper.observer.destroy();
4318 },
4319 },
4320 };
4321
4322 var Virtual = {
4323 update: function update(force) {
4324 var swiper = this;
4325 var ref = swiper.params;
4326 var slidesPerView = ref.slidesPerView;
4327 var slidesPerGroup = ref.slidesPerGroup;
4328 var centeredSlides = ref.centeredSlides;
4329 var ref$1 = swiper.params.virtual;
4330 var addSlidesBefore = ref$1.addSlidesBefore;
4331 var addSlidesAfter = ref$1.addSlidesAfter;
4332 var ref$2 = swiper.virtual;
4333 var previousFrom = ref$2.from;
4334 var previousTo = ref$2.to;
4335 var slides = ref$2.slides;
4336 var previousSlidesGrid = ref$2.slidesGrid;
4337 var renderSlide = ref$2.renderSlide;
4338 var previousOffset = ref$2.offset;
4339 swiper.updateActiveIndex();
4340 var activeIndex = swiper.activeIndex || 0;
4341
4342 var offsetProp;
4343 if (swiper.rtlTranslate) { offsetProp = 'right'; }
4344 else { offsetProp = swiper.isHorizontal() ? 'left' : 'top'; }
4345
4346 var slidesAfter;
4347 var slidesBefore;
4348 if (centeredSlides) {
4349 slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore;
4350 slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter;
4351 } else {
4352 slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesBefore;
4353 slidesBefore = slidesPerGroup + addSlidesAfter;
4354 }
4355 var from = Math.max((activeIndex || 0) - slidesBefore, 0);
4356 var to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1);
4357 var offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0);
4358
4359 Utils.extend(swiper.virtual, {
4360 from: from,
4361 to: to,
4362 offset: offset,
4363 slidesGrid: swiper.slidesGrid,
4364 });
4365
4366 function onRendered() {
4367 swiper.updateSlides();
4368 swiper.updateProgress();
4369 swiper.updateSlidesClasses();
4370 if (swiper.lazy && swiper.params.lazy.enabled) {
4371 swiper.lazy.load();
4372 }
4373 }
4374
4375 if (previousFrom === from && previousTo === to && !force) {
4376 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {
4377 swiper.slides.css(offsetProp, (offset + "px"));
4378 }
4379 swiper.updateProgress();
4380 return;
4381 }
4382 if (swiper.params.virtual.renderExternal) {
4383 swiper.params.virtual.renderExternal.call(swiper, {
4384 offset: offset,
4385 from: from,
4386 to: to,
4387 slides: (function getSlides() {
4388 var slidesToRender = [];
4389 for (var i = from; i <= to; i += 1) {
4390 slidesToRender.push(slides[i]);
4391 }
4392 return slidesToRender;
4393 }()),
4394 });
4395 onRendered();
4396 return;
4397 }
4398 var prependIndexes = [];
4399 var appendIndexes = [];
4400 if (force) {
4401 swiper.$wrapperEl.find(("." + (swiper.params.slideClass))).remove();
4402 } else {
4403 for (var i = previousFrom; i <= previousTo; i += 1) {
4404 if (i < from || i > to) {
4405 swiper.$wrapperEl.find(("." + (swiper.params.slideClass) + "[data-swiper-slide-index=\"" + i + "\"]")).remove();
4406 }
4407 }
4408 }
4409 for (var i$1 = 0; i$1 < slides.length; i$1 += 1) {
4410 if (i$1 >= from && i$1 <= to) {
4411 if (typeof previousTo === 'undefined' || force) {
4412 appendIndexes.push(i$1);
4413 } else {
4414 if (i$1 > previousTo) { appendIndexes.push(i$1); }
4415 if (i$1 < previousFrom) { prependIndexes.push(i$1); }
4416 }
4417 }
4418 }
4419 appendIndexes.forEach(function (index) {
4420 swiper.$wrapperEl.append(renderSlide(slides[index], index));
4421 });
4422 prependIndexes.sort(function (a, b) { return b - a; }).forEach(function (index) {
4423 swiper.$wrapperEl.prepend(renderSlide(slides[index], index));
4424 });
4425 swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, (offset + "px"));
4426 onRendered();
4427 },
4428 renderSlide: function renderSlide(slide, index) {
4429 var swiper = this;
4430 var params = swiper.params.virtual;
4431 if (params.cache && swiper.virtual.cache[index]) {
4432 return swiper.virtual.cache[index];
4433 }
4434 var $slideEl = params.renderSlide
4435 ? $(params.renderSlide.call(swiper, slide, index))
4436 : $(("<div class=\"" + (swiper.params.slideClass) + "\" data-swiper-slide-index=\"" + index + "\">" + slide + "</div>"));
4437 if (!$slideEl.attr('data-swiper-slide-index')) { $slideEl.attr('data-swiper-slide-index', index); }
4438 if (params.cache) { swiper.virtual.cache[index] = $slideEl; }
4439 return $slideEl;
4440 },
4441 appendSlide: function appendSlide(slides) {
4442 var swiper = this;
4443 if (typeof slides === 'object' && 'length' in slides) {
4444 for (var i = 0; i < slides.length; i += 1) {
4445 if (slides[i]) { swiper.virtual.slides.push(slides[i]); }
4446 }
4447 } else {
4448 swiper.virtual.slides.push(slides);
4449 }
4450 swiper.virtual.update(true);
4451 },
4452 prependSlide: function prependSlide(slides) {
4453 var swiper = this;
4454 var activeIndex = swiper.activeIndex;
4455 var newActiveIndex = activeIndex + 1;
4456 var numberOfNewSlides = 1;
4457
4458 if (Array.isArray(slides)) {
4459 for (var i = 0; i < slides.length; i += 1) {
4460 if (slides[i]) { swiper.virtual.slides.unshift(slides[i]); }
4461 }
4462 newActiveIndex = activeIndex + slides.length;
4463 numberOfNewSlides = slides.length;
4464 } else {
4465 swiper.virtual.slides.unshift(slides);
4466 }
4467 if (swiper.params.virtual.cache) {
4468 var cache = swiper.virtual.cache;
4469 var newCache = {};
4470 Object.keys(cache).forEach(function (cachedIndex) {
4471 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = cache[cachedIndex];
4472 });
4473 swiper.virtual.cache = newCache;
4474 }
4475 swiper.virtual.update(true);
4476 swiper.slideTo(newActiveIndex, 0);
4477 },
4478 removeSlide: function removeSlide(slidesIndexes) {
4479 var swiper = this;
4480 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) { return; }
4481 var activeIndex = swiper.activeIndex;
4482 if (Array.isArray(slidesIndexes)) {
4483 for (var i = slidesIndexes.length - 1; i >= 0; i -= 1) {
4484 swiper.virtual.slides.splice(slidesIndexes[i], 1);
4485 if (swiper.params.virtual.cache) {
4486 delete swiper.virtual.cache[slidesIndexes[i]];
4487 }
4488 if (slidesIndexes[i] < activeIndex) { activeIndex -= 1; }
4489 activeIndex = Math.max(activeIndex, 0);
4490 }
4491 } else {
4492 swiper.virtual.slides.splice(slidesIndexes, 1);
4493 if (swiper.params.virtual.cache) {
4494 delete swiper.virtual.cache[slidesIndexes];
4495 }
4496 if (slidesIndexes < activeIndex) { activeIndex -= 1; }
4497 activeIndex = Math.max(activeIndex, 0);
4498 }
4499 swiper.virtual.update(true);
4500 swiper.slideTo(activeIndex, 0);
4501 },
4502 removeAllSlides: function removeAllSlides() {
4503 var swiper = this;
4504 swiper.virtual.slides = [];
4505 if (swiper.params.virtual.cache) {
4506 swiper.virtual.cache = {};
4507 }
4508 swiper.virtual.update(true);
4509 swiper.slideTo(0, 0);
4510 },
4511 };
4512
4513 var Virtual$1 = {
4514 name: 'virtual',
4515 params: {
4516 virtual: {
4517 enabled: false,
4518 slides: [],
4519 cache: true,
4520 renderSlide: null,
4521 renderExternal: null,
4522 addSlidesBefore: 0,
4523 addSlidesAfter: 0,
4524 },
4525 },
4526 create: function create() {
4527 var swiper = this;
4528 Utils.extend(swiper, {
4529 virtual: {
4530 update: Virtual.update.bind(swiper),
4531 appendSlide: Virtual.appendSlide.bind(swiper),
4532 prependSlide: Virtual.prependSlide.bind(swiper),
4533 removeSlide: Virtual.removeSlide.bind(swiper),
4534 removeAllSlides: Virtual.removeAllSlides.bind(swiper),
4535 renderSlide: Virtual.renderSlide.bind(swiper),
4536 slides: swiper.params.virtual.slides,
4537 cache: {},
4538 },
4539 });
4540 },
4541 on: {
4542 beforeInit: function beforeInit() {
4543 var swiper = this;
4544 if (!swiper.params.virtual.enabled) { return; }
4545 swiper.classNames.push(((swiper.params.containerModifierClass) + "virtual"));
4546 var overwriteParams = {
4547 watchSlidesProgress: true,
4548 };
4549 Utils.extend(swiper.params, overwriteParams);
4550 Utils.extend(swiper.originalParams, overwriteParams);
4551
4552 if (!swiper.params.initialSlide) {
4553 swiper.virtual.update();
4554 }
4555 },
4556 setTranslate: function setTranslate() {
4557 var swiper = this;
4558 if (!swiper.params.virtual.enabled) { return; }
4559 swiper.virtual.update();
4560 },
4561 },
4562 };
4563
4564 var Keyboard = {
4565 handle: function handle(event) {
4566 var swiper = this;
4567 var rtl = swiper.rtlTranslate;
4568 var e = event;
4569 if (e.originalEvent) { e = e.originalEvent; } // jquery fix
4570 var kc = e.keyCode || e.charCode;
4571 // Directions locks
4572 if (!swiper.allowSlideNext && ((swiper.isHorizontal() && kc === 39) || (swiper.isVertical() && kc === 40))) {
4573 return false;
4574 }
4575 if (!swiper.allowSlidePrev && ((swiper.isHorizontal() && kc === 37) || (swiper.isVertical() && kc === 38))) {
4576 return false;
4577 }
4578 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
4579 return undefined;
4580 }
4581 if (doc.activeElement && doc.activeElement.nodeName && (doc.activeElement.nodeName.toLowerCase() === 'input' || doc.activeElement.nodeName.toLowerCase() === 'textarea')) {
4582 return undefined;
4583 }
4584 if (swiper.params.keyboard.onlyInViewport && (kc === 37 || kc === 39 || kc === 38 || kc === 40)) {
4585 var inView = false;
4586 // Check that swiper should be inside of visible area of window
4587 if (swiper.$el.parents(("." + (swiper.params.slideClass))).length > 0 && swiper.$el.parents(("." + (swiper.params.slideActiveClass))).length === 0) {
4588 return undefined;
4589 }
4590 var windowWidth = win.innerWidth;
4591 var windowHeight = win.innerHeight;
4592 var swiperOffset = swiper.$el.offset();
4593 if (rtl) { swiperOffset.left -= swiper.$el[0].scrollLeft; }
4594 var swiperCoord = [
4595 [swiperOffset.left, swiperOffset.top],
4596 [swiperOffset.left + swiper.width, swiperOffset.top],
4597 [swiperOffset.left, swiperOffset.top + swiper.height],
4598 [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height] ];
4599 for (var i = 0; i < swiperCoord.length; i += 1) {
4600 var point = swiperCoord[i];
4601 if (
4602 point[0] >= 0 && point[0] <= windowWidth
4603 && point[1] >= 0 && point[1] <= windowHeight
4604 ) {
4605 inView = true;
4606 }
4607 }
4608 if (!inView) { return undefined; }
4609 }
4610 if (swiper.isHorizontal()) {
4611 if (kc === 37 || kc === 39) {
4612 if (e.preventDefault) { e.preventDefault(); }
4613 else { e.returnValue = false; }
4614 }
4615 if ((kc === 39 && !rtl) || (kc === 37 && rtl)) { swiper.slideNext(); }
4616 if ((kc === 37 && !rtl) || (kc === 39 && rtl)) { swiper.slidePrev(); }
4617 } else {
4618 if (kc === 38 || kc === 40) {
4619 if (e.preventDefault) { e.preventDefault(); }
4620 else { e.returnValue = false; }
4621 }
4622 if (kc === 40) { swiper.slideNext(); }
4623 if (kc === 38) { swiper.slidePrev(); }
4624 }
4625 swiper.emit('keyPress', kc);
4626 return undefined;
4627 },
4628 enable: function enable() {
4629 var swiper = this;
4630 if (swiper.keyboard.enabled) { return; }
4631 $(doc).on('keydown', swiper.keyboard.handle);
4632 swiper.keyboard.enabled = true;
4633 },
4634 disable: function disable() {
4635 var swiper = this;
4636 if (!swiper.keyboard.enabled) { return; }
4637 $(doc).off('keydown', swiper.keyboard.handle);
4638 swiper.keyboard.enabled = false;
4639 },
4640 };
4641
4642 var Keyboard$1 = {
4643 name: 'keyboard',
4644 params: {
4645 keyboard: {
4646 enabled: false,
4647 onlyInViewport: true,
4648 },
4649 },
4650 create: function create() {
4651 var swiper = this;
4652 Utils.extend(swiper, {
4653 keyboard: {
4654 enabled: false,
4655 enable: Keyboard.enable.bind(swiper),
4656 disable: Keyboard.disable.bind(swiper),
4657 handle: Keyboard.handle.bind(swiper),
4658 },
4659 });
4660 },
4661 on: {
4662 init: function init() {
4663 var swiper = this;
4664 if (swiper.params.keyboard.enabled) {
4665 swiper.keyboard.enable();
4666 }
4667 },
4668 destroy: function destroy() {
4669 var swiper = this;
4670 if (swiper.keyboard.enabled) {
4671 swiper.keyboard.disable();
4672 }
4673 },
4674 },
4675 };
4676
4677 function isEventSupported() {
4678 var eventName = 'onwheel';
4679 var isSupported = eventName in doc;
4680
4681 if (!isSupported) {
4682 var element = doc.createElement('div');
4683 element.setAttribute(eventName, 'return;');
4684 isSupported = typeof element[eventName] === 'function';
4685 }
4686
4687 if (!isSupported
4688 && doc.implementation
4689 && doc.implementation.hasFeature
4690 // always returns true in newer browsers as per the standard.
4691 // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
4692 && doc.implementation.hasFeature('', '') !== true
4693 ) {
4694 // This is the only way to test support for the `wheel` event in IE9+.
4695 isSupported = doc.implementation.hasFeature('Events.wheel', '3.0');
4696 }
4697
4698 return isSupported;
4699 }
4700 var Mousewheel = {
4701 lastScrollTime: Utils.now(),
4702 event: (function getEvent() {
4703 if (win.navigator.userAgent.indexOf('firefox') > -1) { return 'DOMMouseScroll'; }
4704 return isEventSupported() ? 'wheel' : 'mousewheel';
4705 }()),
4706 normalize: function normalize(e) {
4707 // Reasonable defaults
4708 var PIXEL_STEP = 10;
4709 var LINE_HEIGHT = 40;
4710 var PAGE_HEIGHT = 800;
4711
4712 var sX = 0;
4713 var sY = 0; // spinX, spinY
4714 var pX = 0;
4715 var pY = 0; // pixelX, pixelY
4716
4717 // Legacy
4718 if ('detail' in e) {
4719 sY = e.detail;
4720 }
4721 if ('wheelDelta' in e) {
4722 sY = -e.wheelDelta / 120;
4723 }
4724 if ('wheelDeltaY' in e) {
4725 sY = -e.wheelDeltaY / 120;
4726 }
4727 if ('wheelDeltaX' in e) {
4728 sX = -e.wheelDeltaX / 120;
4729 }
4730
4731 // side scrolling on FF with DOMMouseScroll
4732 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) {
4733 sX = sY;
4734 sY = 0;
4735 }
4736
4737 pX = sX * PIXEL_STEP;
4738 pY = sY * PIXEL_STEP;
4739
4740 if ('deltaY' in e) {
4741 pY = e.deltaY;
4742 }
4743 if ('deltaX' in e) {
4744 pX = e.deltaX;
4745 }
4746
4747 if ((pX || pY) && e.deltaMode) {
4748 if (e.deltaMode === 1) { // delta in LINE units
4749 pX *= LINE_HEIGHT;
4750 pY *= LINE_HEIGHT;
4751 } else { // delta in PAGE units
4752 pX *= PAGE_HEIGHT;
4753 pY *= PAGE_HEIGHT;
4754 }
4755 }
4756
4757 // Fall-back if spin cannot be determined
4758 if (pX && !sX) {
4759 sX = (pX < 1) ? -1 : 1;
4760 }
4761 if (pY && !sY) {
4762 sY = (pY < 1) ? -1 : 1;
4763 }
4764
4765 return {
4766 spinX: sX,
4767 spinY: sY,
4768 pixelX: pX,
4769 pixelY: pY,
4770 };
4771 },
4772 handleMouseEnter: function handleMouseEnter() {
4773 var swiper = this;
4774 swiper.mouseEntered = true;
4775 },
4776 handleMouseLeave: function handleMouseLeave() {
4777 var swiper = this;
4778 swiper.mouseEntered = false;
4779 },
4780 handle: function handle(event) {
4781 var e = event;
4782 var swiper = this;
4783 var params = swiper.params.mousewheel;
4784
4785 if (!swiper.mouseEntered && !params.releaseOnEdges) { return true; }
4786
4787 if (e.originalEvent) { e = e.originalEvent; } // jquery fix
4788 var delta = 0;
4789 var rtlFactor = swiper.rtlTranslate ? -1 : 1;
4790
4791 var data = Mousewheel.normalize(e);
4792
4793 if (params.forceToAxis) {
4794 if (swiper.isHorizontal()) {
4795 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) { delta = data.pixelX * rtlFactor; }
4796 else { return true; }
4797 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) { delta = data.pixelY; }
4798 else { return true; }
4799 } else {
4800 delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
4801 }
4802
4803 if (delta === 0) { return true; }
4804
4805 if (params.invert) { delta = -delta; }
4806
4807 if (!swiper.params.freeMode) {
4808 if (Utils.now() - swiper.mousewheel.lastScrollTime > 60) {
4809 if (delta < 0) {
4810 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) {
4811 swiper.slideNext();
4812 swiper.emit('scroll', e);
4813 } else if (params.releaseOnEdges) { return true; }
4814 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) {
4815 swiper.slidePrev();
4816 swiper.emit('scroll', e);
4817 } else if (params.releaseOnEdges) { return true; }
4818 }
4819 swiper.mousewheel.lastScrollTime = (new win.Date()).getTime();
4820 } else {
4821 // Freemode or scrollContainer:
4822 if (swiper.params.loop) {
4823 swiper.loopFix();
4824 }
4825 var position = swiper.getTranslate() + (delta * params.sensitivity);
4826 var wasBeginning = swiper.isBeginning;
4827 var wasEnd = swiper.isEnd;
4828
4829 if (position >= swiper.minTranslate()) { position = swiper.minTranslate(); }
4830 if (position <= swiper.maxTranslate()) { position = swiper.maxTranslate(); }
4831
4832 swiper.setTransition(0);
4833 swiper.setTranslate(position);
4834 swiper.updateProgress();
4835 swiper.updateActiveIndex();
4836 swiper.updateSlidesClasses();
4837
4838 if ((!wasBeginning && swiper.isBeginning) || (!wasEnd && swiper.isEnd)) {
4839 swiper.updateSlidesClasses();
4840 }
4841
4842 if (swiper.params.freeModeSticky) {
4843 clearTimeout(swiper.mousewheel.timeout);
4844 swiper.mousewheel.timeout = Utils.nextTick(function () {
4845 swiper.slideToClosest();
4846 }, 300);
4847 }
4848 // Emit event
4849 swiper.emit('scroll', e);
4850
4851 // Stop autoplay
4852 if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) { swiper.autoplay.stop(); }
4853 // Return page scroll on edge positions
4854 if (position === swiper.minTranslate() || position === swiper.maxTranslate()) { return true; }
4855 }
4856
4857 if (e.preventDefault) { e.preventDefault(); }
4858 else { e.returnValue = false; }
4859 return false;
4860 },
4861 enable: function enable() {
4862 var swiper = this;
4863 if (!Mousewheel.event) { return false; }
4864 if (swiper.mousewheel.enabled) { return false; }
4865 var target = swiper.$el;
4866 if (swiper.params.mousewheel.eventsTarged !== 'container') {
4867 target = $(swiper.params.mousewheel.eventsTarged);
4868 }
4869 target.on('mouseenter', swiper.mousewheel.handleMouseEnter);
4870 target.on('mouseleave', swiper.mousewheel.handleMouseLeave);
4871 target.on(Mousewheel.event, swiper.mousewheel.handle);
4872 swiper.mousewheel.enabled = true;
4873 return true;
4874 },
4875 disable: function disable() {
4876 var swiper = this;
4877 if (!Mousewheel.event) { return false; }
4878 if (!swiper.mousewheel.enabled) { return false; }
4879 var target = swiper.$el;
4880 if (swiper.params.mousewheel.eventsTarged !== 'container') {
4881 target = $(swiper.params.mousewheel.eventsTarged);
4882 }
4883 target.off(Mousewheel.event, swiper.mousewheel.handle);
4884 swiper.mousewheel.enabled = false;
4885 return true;
4886 },
4887 };
4888
4889 var Mousewheel$1 = {
4890 name: 'mousewheel',
4891 params: {
4892 mousewheel: {
4893 enabled: false,
4894 releaseOnEdges: false,
4895 invert: false,
4896 forceToAxis: false,
4897 sensitivity: 1,
4898 eventsTarged: 'container',
4899 },
4900 },
4901 create: function create() {
4902 var swiper = this;
4903 Utils.extend(swiper, {
4904 mousewheel: {
4905 enabled: false,
4906 enable: Mousewheel.enable.bind(swiper),
4907 disable: Mousewheel.disable.bind(swiper),
4908 handle: Mousewheel.handle.bind(swiper),
4909 handleMouseEnter: Mousewheel.handleMouseEnter.bind(swiper),
4910 handleMouseLeave: Mousewheel.handleMouseLeave.bind(swiper),
4911 lastScrollTime: Utils.now(),
4912 },
4913 });
4914 },
4915 on: {
4916 init: function init() {
4917 var swiper = this;
4918 if (swiper.params.mousewheel.enabled) { swiper.mousewheel.enable(); }
4919 },
4920 destroy: function destroy() {
4921 var swiper = this;
4922 if (swiper.mousewheel.enabled) { swiper.mousewheel.disable(); }
4923 },
4924 },
4925 };
4926
4927 var Navigation = {
4928 update: function update() {
4929 // Update Navigation Buttons
4930 var swiper = this;
4931 var params = swiper.params.navigation;
4932
4933 if (swiper.params.loop) { return; }
4934 var ref = swiper.navigation;
4935 var $nextEl = ref.$nextEl;
4936 var $prevEl = ref.$prevEl;
4937
4938 if ($prevEl && $prevEl.length > 0) {
4939 if (swiper.isBeginning) {
4940 $prevEl.addClass(params.disabledClass);
4941 } else {
4942 $prevEl.removeClass(params.disabledClass);
4943 }
4944 $prevEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
4945 }
4946 if ($nextEl && $nextEl.length > 0) {
4947 if (swiper.isEnd) {
4948 $nextEl.addClass(params.disabledClass);
4949 } else {
4950 $nextEl.removeClass(params.disabledClass);
4951 }
4952 $nextEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
4953 }
4954 },
4955 onPrevClick: function onPrevClick(e) {
4956 var swiper = this;
4957 e.preventDefault();
4958 if (swiper.isBeginning && !swiper.params.loop) { return; }
4959 swiper.slidePrev();
4960 },
4961 onNextClick: function onNextClick(e) {
4962 var swiper = this;
4963 e.preventDefault();
4964 if (swiper.isEnd && !swiper.params.loop) { return; }
4965 swiper.slideNext();
4966 },
4967 init: function init() {
4968 var swiper = this;
4969 var params = swiper.params.navigation;
4970 if (!(params.nextEl || params.prevEl)) { return; }
4971
4972 var $nextEl;
4973 var $prevEl;
4974 if (params.nextEl) {
4975 $nextEl = $(params.nextEl);
4976 if (
4977 swiper.params.uniqueNavElements
4978 && typeof params.nextEl === 'string'
4979 && $nextEl.length > 1
4980 && swiper.$el.find(params.nextEl).length === 1
4981 ) {
4982 $nextEl = swiper.$el.find(params.nextEl);
4983 }
4984 }
4985 if (params.prevEl) {
4986 $prevEl = $(params.prevEl);
4987 if (
4988 swiper.params.uniqueNavElements
4989 && typeof params.prevEl === 'string'
4990 && $prevEl.length > 1
4991 && swiper.$el.find(params.prevEl).length === 1
4992 ) {
4993 $prevEl = swiper.$el.find(params.prevEl);
4994 }
4995 }
4996
4997 if ($nextEl && $nextEl.length > 0) {
4998 $nextEl.on('click', swiper.navigation.onNextClick);
4999 }
5000 if ($prevEl && $prevEl.length > 0) {
5001 $prevEl.on('click', swiper.navigation.onPrevClick);
5002 }
5003
5004 Utils.extend(swiper.navigation, {
5005 $nextEl: $nextEl,
5006 nextEl: $nextEl && $nextEl[0],
5007 $prevEl: $prevEl,
5008 prevEl: $prevEl && $prevEl[0],
5009 });
5010 },
5011 destroy: function destroy() {
5012 var swiper = this;
5013 var ref = swiper.navigation;
5014 var $nextEl = ref.$nextEl;
5015 var $prevEl = ref.$prevEl;
5016 if ($nextEl && $nextEl.length) {
5017 $nextEl.off('click', swiper.navigation.onNextClick);
5018 $nextEl.removeClass(swiper.params.navigation.disabledClass);
5019 }
5020 if ($prevEl && $prevEl.length) {
5021 $prevEl.off('click', swiper.navigation.onPrevClick);
5022 $prevEl.removeClass(swiper.params.navigation.disabledClass);
5023 }
5024 },
5025 };
5026
5027 var Navigation$1 = {
5028 name: 'navigation',
5029 params: {
5030 navigation: {
5031 nextEl: null,
5032 prevEl: null,
5033
5034 hideOnClick: false,
5035 disabledClass: 'swiper-button-disabled',
5036 hiddenClass: 'swiper-button-hidden',
5037 lockClass: 'swiper-button-lock',
5038 },
5039 },
5040 create: function create() {
5041 var swiper = this;
5042 Utils.extend(swiper, {
5043 navigation: {
5044 init: Navigation.init.bind(swiper),
5045 update: Navigation.update.bind(swiper),
5046 destroy: Navigation.destroy.bind(swiper),
5047 onNextClick: Navigation.onNextClick.bind(swiper),
5048 onPrevClick: Navigation.onPrevClick.bind(swiper),
5049 },
5050 });
5051 },
5052 on: {
5053 init: function init() {
5054 var swiper = this;
5055 swiper.navigation.init();
5056 swiper.navigation.update();
5057 },
5058 toEdge: function toEdge() {
5059 var swiper = this;
5060 swiper.navigation.update();
5061 },
5062 fromEdge: function fromEdge() {
5063 var swiper = this;
5064 swiper.navigation.update();
5065 },
5066 destroy: function destroy() {
5067 var swiper = this;
5068 swiper.navigation.destroy();
5069 },
5070 click: function click(e) {
5071 var swiper = this;
5072 var ref = swiper.navigation;
5073 var $nextEl = ref.$nextEl;
5074 var $prevEl = ref.$prevEl;
5075 if (
5076 swiper.params.navigation.hideOnClick
5077 && !$(e.target).is($prevEl)
5078 && !$(e.target).is($nextEl)
5079 ) {
5080 var isHidden;
5081 if ($nextEl) {
5082 isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
5083 } else if ($prevEl) {
5084 isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
5085 }
5086 if (isHidden === true) {
5087 swiper.emit('navigationShow', swiper);
5088 } else {
5089 swiper.emit('navigationHide', swiper);
5090 }
5091 if ($nextEl) {
5092 $nextEl.toggleClass(swiper.params.navigation.hiddenClass);
5093 }
5094 if ($prevEl) {
5095 $prevEl.toggleClass(swiper.params.navigation.hiddenClass);
5096 }
5097 }
5098 },
5099 },
5100 };
5101
5102 var Pagination = {
5103 update: function update() {
5104 // Render || Update Pagination bullets/items
5105 var swiper = this;
5106 var rtl = swiper.rtl;
5107 var params = swiper.params.pagination;
5108 if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; }
5109 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
5110 var $el = swiper.pagination.$el;
5111 // Current/Total
5112 var current;
5113 var total = swiper.params.loop ? Math.ceil((slidesLength - (swiper.loopedSlides * 2)) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
5114 if (swiper.params.loop) {
5115 current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup);
5116 if (current > slidesLength - 1 - (swiper.loopedSlides * 2)) {
5117 current -= (slidesLength - (swiper.loopedSlides * 2));
5118 }
5119 if (current > total - 1) { current -= total; }
5120 if (current < 0 && swiper.params.paginationType !== 'bullets') { current = total + current; }
5121 } else if (typeof swiper.snapIndex !== 'undefined') {
5122 current = swiper.snapIndex;
5123 } else {
5124 current = swiper.activeIndex || 0;
5125 }
5126 // Types
5127 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
5128 var bullets = swiper.pagination.bullets;
5129 var firstIndex;
5130 var lastIndex;
5131 var midIndex;
5132 if (params.dynamicBullets) {
5133 swiper.pagination.bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true);
5134 $el.css(swiper.isHorizontal() ? 'width' : 'height', ((swiper.pagination.bulletSize * (params.dynamicMainBullets + 4)) + "px"));
5135 if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) {
5136 swiper.pagination.dynamicBulletIndex += (current - swiper.previousIndex);
5137 if (swiper.pagination.dynamicBulletIndex > (params.dynamicMainBullets - 1)) {
5138 swiper.pagination.dynamicBulletIndex = params.dynamicMainBullets - 1;
5139 } else if (swiper.pagination.dynamicBulletIndex < 0) {
5140 swiper.pagination.dynamicBulletIndex = 0;
5141 }
5142 }
5143 firstIndex = current - swiper.pagination.dynamicBulletIndex;
5144 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
5145 midIndex = (lastIndex + firstIndex) / 2;
5146 }
5147 bullets.removeClass(((params.bulletActiveClass) + " " + (params.bulletActiveClass) + "-next " + (params.bulletActiveClass) + "-next-next " + (params.bulletActiveClass) + "-prev " + (params.bulletActiveClass) + "-prev-prev " + (params.bulletActiveClass) + "-main"));
5148 if ($el.length > 1) {
5149 bullets.each(function (index, bullet) {
5150 var $bullet = $(bullet);
5151 var bulletIndex = $bullet.index();
5152 if (bulletIndex === current) {
5153 $bullet.addClass(params.bulletActiveClass);
5154 }
5155 if (params.dynamicBullets) {
5156 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
5157 $bullet.addClass(((params.bulletActiveClass) + "-main"));
5158 }
5159 if (bulletIndex === firstIndex) {
5160 $bullet
5161 .prev()
5162 .addClass(((params.bulletActiveClass) + "-prev"))
5163 .prev()
5164 .addClass(((params.bulletActiveClass) + "-prev-prev"));
5165 }
5166 if (bulletIndex === lastIndex) {
5167 $bullet
5168 .next()
5169 .addClass(((params.bulletActiveClass) + "-next"))
5170 .next()
5171 .addClass(((params.bulletActiveClass) + "-next-next"));
5172 }
5173 }
5174 });
5175 } else {
5176 var $bullet = bullets.eq(current);
5177 $bullet.addClass(params.bulletActiveClass);
5178 if (params.dynamicBullets) {
5179 var $firstDisplayedBullet = bullets.eq(firstIndex);
5180 var $lastDisplayedBullet = bullets.eq(lastIndex);
5181 for (var i = firstIndex; i <= lastIndex; i += 1) {
5182 bullets.eq(i).addClass(((params.bulletActiveClass) + "-main"));
5183 }
5184 $firstDisplayedBullet
5185 .prev()
5186 .addClass(((params.bulletActiveClass) + "-prev"))
5187 .prev()
5188 .addClass(((params.bulletActiveClass) + "-prev-prev"));
5189 $lastDisplayedBullet
5190 .next()
5191 .addClass(((params.bulletActiveClass) + "-next"))
5192 .next()
5193 .addClass(((params.bulletActiveClass) + "-next-next"));
5194 }
5195 }
5196 if (params.dynamicBullets) {
5197 var dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
5198 var bulletsOffset = (((swiper.pagination.bulletSize * dynamicBulletsLength) - (swiper.pagination.bulletSize)) / 2) - (midIndex * swiper.pagination.bulletSize);
5199 var offsetProp = rtl ? 'right' : 'left';
5200 bullets.css(swiper.isHorizontal() ? offsetProp : 'top', (bulletsOffset + "px"));
5201 }
5202 }
5203 if (params.type === 'fraction') {
5204 $el.find(("." + (params.currentClass))).text(params.formatFractionCurrent(current + 1));
5205 $el.find(("." + (params.totalClass))).text(params.formatFractionTotal(total));
5206 }
5207 if (params.type === 'progressbar') {
5208 var progressbarDirection;
5209 if (params.progressbarOpposite) {
5210 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
5211 } else {
5212 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
5213 }
5214 var scale = (current + 1) / total;
5215 var scaleX = 1;
5216 var scaleY = 1;
5217 if (progressbarDirection === 'horizontal') {
5218 scaleX = scale;
5219 } else {
5220 scaleY = scale;
5221 }
5222 $el.find(("." + (params.progressbarFillClass))).transform(("translate3d(0,0,0) scaleX(" + scaleX + ") scaleY(" + scaleY + ")")).transition(swiper.params.speed);
5223 }
5224 if (params.type === 'custom' && params.renderCustom) {
5225 $el.html(params.renderCustom(swiper, current + 1, total));
5226 swiper.emit('paginationRender', swiper, $el[0]);
5227 } else {
5228 swiper.emit('paginationUpdate', swiper, $el[0]);
5229 }
5230 $el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
5231 },
5232 render: function render() {
5233 // Render Container
5234 var swiper = this;
5235 var params = swiper.params.pagination;
5236 if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; }
5237 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
5238
5239 var $el = swiper.pagination.$el;
5240 var paginationHTML = '';
5241 if (params.type === 'bullets') {
5242 var numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - (swiper.loopedSlides * 2)) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
5243 for (var i = 0; i < numberOfBullets; i += 1) {
5244 if (params.renderBullet) {
5245 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
5246 } else {
5247 paginationHTML += "<" + (params.bulletElement) + " class=\"" + (params.bulletClass) + "\"></" + (params.bulletElement) + ">";
5248 }
5249 }
5250 $el.html(paginationHTML);
5251 swiper.pagination.bullets = $el.find(("." + (params.bulletClass)));
5252 }
5253 if (params.type === 'fraction') {
5254 if (params.renderFraction) {
5255 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
5256 } else {
5257 paginationHTML = "<span class=\"" + (params.currentClass) + "\"></span>"
5258 + ' / '
5259 + "<span class=\"" + (params.totalClass) + "\"></span>";
5260 }
5261 $el.html(paginationHTML);
5262 }
5263 if (params.type === 'progressbar') {
5264 if (params.renderProgressbar) {
5265 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
5266 } else {
5267 paginationHTML = "<span class=\"" + (params.progressbarFillClass) + "\"></span>";
5268 }
5269 $el.html(paginationHTML);
5270 }
5271 if (params.type !== 'custom') {
5272 swiper.emit('paginationRender', swiper.pagination.$el[0]);
5273 }
5274 },
5275 init: function init() {
5276 var swiper = this;
5277 var params = swiper.params.pagination;
5278 if (!params.el) { return; }
5279
5280 var $el = $(params.el);
5281 if ($el.length === 0) { return; }
5282
5283 if (
5284 swiper.params.uniqueNavElements
5285 && typeof params.el === 'string'
5286 && $el.length > 1
5287 && swiper.$el.find(params.el).length === 1
5288 ) {
5289 $el = swiper.$el.find(params.el);
5290 }
5291
5292 if (params.type === 'bullets' && params.clickable) {
5293 $el.addClass(params.clickableClass);
5294 }
5295
5296 $el.addClass(params.modifierClass + params.type);
5297
5298 if (params.type === 'bullets' && params.dynamicBullets) {
5299 $el.addClass(("" + (params.modifierClass) + (params.type) + "-dynamic"));
5300 swiper.pagination.dynamicBulletIndex = 0;
5301 if (params.dynamicMainBullets < 1) {
5302 params.dynamicMainBullets = 1;
5303 }
5304 }
5305 if (params.type === 'progressbar' && params.progressbarOpposite) {
5306 $el.addClass(params.progressbarOppositeClass);
5307 }
5308
5309 if (params.clickable) {
5310 $el.on('click', ("." + (params.bulletClass)), function onClick(e) {
5311 e.preventDefault();
5312 var index = $(this).index() * swiper.params.slidesPerGroup;
5313 if (swiper.params.loop) { index += swiper.loopedSlides; }
5314 swiper.slideTo(index);
5315 });
5316 }
5317
5318 Utils.extend(swiper.pagination, {
5319 $el: $el,
5320 el: $el[0],
5321 });
5322 },
5323 destroy: function destroy() {
5324 var swiper = this;
5325 var params = swiper.params.pagination;
5326 if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; }
5327 var $el = swiper.pagination.$el;
5328
5329 $el.removeClass(params.hiddenClass);
5330 $el.removeClass(params.modifierClass + params.type);
5331 if (swiper.pagination.bullets) { swiper.pagination.bullets.removeClass(params.bulletActiveClass); }
5332 if (params.clickable) {
5333 $el.off('click', ("." + (params.bulletClass)));
5334 }
5335 },
5336 };
5337
5338 var Pagination$1 = {
5339 name: 'pagination',
5340 params: {
5341 pagination: {
5342 el: null,
5343 bulletElement: 'span',
5344 clickable: false,
5345 hideOnClick: false,
5346 renderBullet: null,
5347 renderProgressbar: null,
5348 renderFraction: null,
5349 renderCustom: null,
5350 progressbarOpposite: false,
5351 type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom'
5352 dynamicBullets: false,
5353 dynamicMainBullets: 1,
5354 formatFractionCurrent: function (number) { return number; },
5355 formatFractionTotal: function (number) { return number; },
5356 bulletClass: 'swiper-pagination-bullet',
5357 bulletActiveClass: 'swiper-pagination-bullet-active',
5358 modifierClass: 'swiper-pagination-', // NEW
5359 currentClass: 'swiper-pagination-current',
5360 totalClass: 'swiper-pagination-total',
5361 hiddenClass: 'swiper-pagination-hidden',
5362 progressbarFillClass: 'swiper-pagination-progressbar-fill',
5363 progressbarOppositeClass: 'swiper-pagination-progressbar-opposite',
5364 clickableClass: 'swiper-pagination-clickable', // NEW
5365 lockClass: 'swiper-pagination-lock',
5366 },
5367 },
5368 create: function create() {
5369 var swiper = this;
5370 Utils.extend(swiper, {
5371 pagination: {
5372 init: Pagination.init.bind(swiper),
5373 render: Pagination.render.bind(swiper),
5374 update: Pagination.update.bind(swiper),
5375 destroy: Pagination.destroy.bind(swiper),
5376 dynamicBulletIndex: 0,
5377 },
5378 });
5379 },
5380 on: {
5381 init: function init() {
5382 var swiper = this;
5383 swiper.pagination.init();
5384 swiper.pagination.render();
5385 swiper.pagination.update();
5386 },
5387 activeIndexChange: function activeIndexChange() {
5388 var swiper = this;
5389 if (swiper.params.loop) {
5390 swiper.pagination.update();
5391 } else if (typeof swiper.snapIndex === 'undefined') {
5392 swiper.pagination.update();
5393 }
5394 },
5395 snapIndexChange: function snapIndexChange() {
5396 var swiper = this;
5397 if (!swiper.params.loop) {
5398 swiper.pagination.update();
5399 }
5400 },
5401 slidesLengthChange: function slidesLengthChange() {
5402 var swiper = this;
5403 if (swiper.params.loop) {
5404 swiper.pagination.render();
5405 swiper.pagination.update();
5406 }
5407 },
5408 snapGridLengthChange: function snapGridLengthChange() {
5409 var swiper = this;
5410 if (!swiper.params.loop) {
5411 swiper.pagination.render();
5412 swiper.pagination.update();
5413 }
5414 },
5415 destroy: function destroy() {
5416 var swiper = this;
5417 swiper.pagination.destroy();
5418 },
5419 click: function click(e) {
5420 var swiper = this;
5421 if (
5422 swiper.params.pagination.el
5423 && swiper.params.pagination.hideOnClick
5424 && swiper.pagination.$el.length > 0
5425 && !$(e.target).hasClass(swiper.params.pagination.bulletClass)
5426 ) {
5427 var isHidden = swiper.pagination.$el.hasClass(swiper.params.pagination.hiddenClass);
5428 if (isHidden === true) {
5429 swiper.emit('paginationShow', swiper);
5430 } else {
5431 swiper.emit('paginationHide', swiper);
5432 }
5433 swiper.pagination.$el.toggleClass(swiper.params.pagination.hiddenClass);
5434 }
5435 },
5436 },
5437 };
5438
5439 var Scrollbar = {
5440 setTranslate: function setTranslate() {
5441 var swiper = this;
5442 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; }
5443 var scrollbar = swiper.scrollbar;
5444 var rtl = swiper.rtlTranslate;
5445 var progress = swiper.progress;
5446 var dragSize = scrollbar.dragSize;
5447 var trackSize = scrollbar.trackSize;
5448 var $dragEl = scrollbar.$dragEl;
5449 var $el = scrollbar.$el;
5450 var params = swiper.params.scrollbar;
5451
5452 var newSize = dragSize;
5453 var newPos = (trackSize - dragSize) * progress;
5454 if (rtl) {
5455 newPos = -newPos;
5456 if (newPos > 0) {
5457 newSize = dragSize - newPos;
5458 newPos = 0;
5459 } else if (-newPos + dragSize > trackSize) {
5460 newSize = trackSize + newPos;
5461 }
5462 } else if (newPos < 0) {
5463 newSize = dragSize + newPos;
5464 newPos = 0;
5465 } else if (newPos + dragSize > trackSize) {
5466 newSize = trackSize - newPos;
5467 }
5468 if (swiper.isHorizontal()) {
5469 if (Support.transforms3d) {
5470 $dragEl.transform(("translate3d(" + newPos + "px, 0, 0)"));
5471 } else {
5472 $dragEl.transform(("translateX(" + newPos + "px)"));
5473 }
5474 $dragEl[0].style.width = newSize + "px";
5475 } else {
5476 if (Support.transforms3d) {
5477 $dragEl.transform(("translate3d(0px, " + newPos + "px, 0)"));
5478 } else {
5479 $dragEl.transform(("translateY(" + newPos + "px)"));
5480 }
5481 $dragEl[0].style.height = newSize + "px";
5482 }
5483 if (params.hide) {
5484 clearTimeout(swiper.scrollbar.timeout);
5485 $el[0].style.opacity = 1;
5486 swiper.scrollbar.timeout = setTimeout(function () {
5487 $el[0].style.opacity = 0;
5488 $el.transition(400);
5489 }, 1000);
5490 }
5491 },
5492 setTransition: function setTransition(duration) {
5493 var swiper = this;
5494 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; }
5495 swiper.scrollbar.$dragEl.transition(duration);
5496 },
5497 updateSize: function updateSize() {
5498 var swiper = this;
5499 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; }
5500
5501 var scrollbar = swiper.scrollbar;
5502 var $dragEl = scrollbar.$dragEl;
5503 var $el = scrollbar.$el;
5504
5505 $dragEl[0].style.width = '';
5506 $dragEl[0].style.height = '';
5507 var trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight;
5508
5509 var divider = swiper.size / swiper.virtualSize;
5510 var moveDivider = divider * (trackSize / swiper.size);
5511 var dragSize;
5512 if (swiper.params.scrollbar.dragSize === 'auto') {
5513 dragSize = trackSize * divider;
5514 } else {
5515 dragSize = parseInt(swiper.params.scrollbar.dragSize, 10);
5516 }
5517
5518 if (swiper.isHorizontal()) {
5519 $dragEl[0].style.width = dragSize + "px";
5520 } else {
5521 $dragEl[0].style.height = dragSize + "px";
5522 }
5523
5524 if (divider >= 1) {
5525 $el[0].style.display = 'none';
5526 } else {
5527 $el[0].style.display = '';
5528 }
5529 if (swiper.params.scrollbar.hide) {
5530 $el[0].style.opacity = 0;
5531 }
5532 Utils.extend(scrollbar, {
5533 trackSize: trackSize,
5534 divider: divider,
5535 moveDivider: moveDivider,
5536 dragSize: dragSize,
5537 });
5538 scrollbar.$el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass);
5539 },
5540 setDragPosition: function setDragPosition(e) {
5541 var swiper = this;
5542 var scrollbar = swiper.scrollbar;
5543 var rtl = swiper.rtlTranslate;
5544 var $el = scrollbar.$el;
5545 var dragSize = scrollbar.dragSize;
5546 var trackSize = scrollbar.trackSize;
5547
5548 var pointerPosition;
5549 if (swiper.isHorizontal()) {
5550 pointerPosition = ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageX : e.pageX || e.clientX);
5551 } else {
5552 pointerPosition = ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageY : e.pageY || e.clientY);
5553 }
5554 var positionRatio;
5555 positionRatio = ((pointerPosition) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragSize / 2)) / (trackSize - dragSize);
5556 positionRatio = Math.max(Math.min(positionRatio, 1), 0);
5557 if (rtl) {
5558 positionRatio = 1 - positionRatio;
5559 }
5560
5561 var position = swiper.minTranslate() + ((swiper.maxTranslate() - swiper.minTranslate()) * positionRatio);
5562
5563 swiper.updateProgress(position);
5564 swiper.setTranslate(position);
5565 swiper.updateActiveIndex();
5566 swiper.updateSlidesClasses();
5567 },
5568 onDragStart: function onDragStart(e) {
5569 var swiper = this;
5570 var params = swiper.params.scrollbar;
5571 var scrollbar = swiper.scrollbar;
5572 var $wrapperEl = swiper.$wrapperEl;
5573 var $el = scrollbar.$el;
5574 var $dragEl = scrollbar.$dragEl;
5575 swiper.scrollbar.isTouched = true;
5576 e.preventDefault();
5577 e.stopPropagation();
5578
5579 $wrapperEl.transition(100);
5580 $dragEl.transition(100);
5581 scrollbar.setDragPosition(e);
5582
5583 clearTimeout(swiper.scrollbar.dragTimeout);
5584
5585 $el.transition(0);
5586 if (params.hide) {
5587 $el.css('opacity', 1);
5588 }
5589 swiper.emit('scrollbarDragStart', e);
5590 },
5591 onDragMove: function onDragMove(e) {
5592 var swiper = this;
5593 var scrollbar = swiper.scrollbar;
5594 var $wrapperEl = swiper.$wrapperEl;
5595 var $el = scrollbar.$el;
5596 var $dragEl = scrollbar.$dragEl;
5597
5598 if (!swiper.scrollbar.isTouched) { return; }
5599 if (e.preventDefault) { e.preventDefault(); }
5600 else { e.returnValue = false; }
5601 scrollbar.setDragPosition(e);
5602 $wrapperEl.transition(0);
5603 $el.transition(0);
5604 $dragEl.transition(0);
5605 swiper.emit('scrollbarDragMove', e);
5606 },
5607 onDragEnd: function onDragEnd(e) {
5608 var swiper = this;
5609
5610 var params = swiper.params.scrollbar;
5611 var scrollbar = swiper.scrollbar;
5612 var $el = scrollbar.$el;
5613
5614 if (!swiper.scrollbar.isTouched) { return; }
5615 swiper.scrollbar.isTouched = false;
5616 if (params.hide) {
5617 clearTimeout(swiper.scrollbar.dragTimeout);
5618 swiper.scrollbar.dragTimeout = Utils.nextTick(function () {
5619 $el.css('opacity', 0);
5620 $el.transition(400);
5621 }, 1000);
5622 }
5623 swiper.emit('scrollbarDragEnd', e);
5624 if (params.snapOnRelease) {
5625 swiper.slideToClosest();
5626 }
5627 },
5628 enableDraggable: function enableDraggable() {
5629 var swiper = this;
5630 if (!swiper.params.scrollbar.el) { return; }
5631 var scrollbar = swiper.scrollbar;
5632 var touchEventsTouch = swiper.touchEventsTouch;
5633 var touchEventsDesktop = swiper.touchEventsDesktop;
5634 var params = swiper.params;
5635 var $el = scrollbar.$el;
5636 var target = $el[0];
5637 var activeListener = Support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false;
5638 var passiveListener = Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false;
5639 if (!Support.touch) {
5640 target.addEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
5641 doc.addEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
5642 doc.addEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
5643 } else {
5644 target.addEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
5645 target.addEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
5646 target.addEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
5647 }
5648 },
5649 disableDraggable: function disableDraggable() {
5650 var swiper = this;
5651 if (!swiper.params.scrollbar.el) { return; }
5652 var scrollbar = swiper.scrollbar;
5653 var touchEventsTouch = swiper.touchEventsTouch;
5654 var touchEventsDesktop = swiper.touchEventsDesktop;
5655 var params = swiper.params;
5656 var $el = scrollbar.$el;
5657 var target = $el[0];
5658 var activeListener = Support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false;
5659 var passiveListener = Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false;
5660 if (!Support.touch) {
5661 target.removeEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
5662 doc.removeEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
5663 doc.removeEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
5664 } else {
5665 target.removeEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
5666 target.removeEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
5667 target.removeEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
5668 }
5669 },
5670 init: function init() {
5671 var swiper = this;
5672 if (!swiper.params.scrollbar.el) { return; }
5673 var scrollbar = swiper.scrollbar;
5674 var $swiperEl = swiper.$el;
5675 var params = swiper.params.scrollbar;
5676
5677 var $el = $(params.el);
5678 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) {
5679 $el = $swiperEl.find(params.el);
5680 }
5681
5682 var $dragEl = $el.find(("." + (swiper.params.scrollbar.dragClass)));
5683 if ($dragEl.length === 0) {
5684 $dragEl = $(("<div class=\"" + (swiper.params.scrollbar.dragClass) + "\"></div>"));
5685 $el.append($dragEl);
5686 }
5687
5688 Utils.extend(scrollbar, {
5689 $el: $el,
5690 el: $el[0],
5691 $dragEl: $dragEl,
5692 dragEl: $dragEl[0],
5693 });
5694
5695 if (params.draggable) {
5696 scrollbar.enableDraggable();
5697 }
5698 },
5699 destroy: function destroy() {
5700 var swiper = this;
5701 swiper.scrollbar.disableDraggable();
5702 },
5703 };
5704
5705 var Scrollbar$1 = {
5706 name: 'scrollbar',
5707 params: {
5708 scrollbar: {
5709 el: null,
5710 dragSize: 'auto',
5711 hide: false,
5712 draggable: false,
5713 snapOnRelease: true,
5714 lockClass: 'swiper-scrollbar-lock',
5715 dragClass: 'swiper-scrollbar-drag',
5716 },
5717 },
5718 create: function create() {
5719 var swiper = this;
5720 Utils.extend(swiper, {
5721 scrollbar: {
5722 init: Scrollbar.init.bind(swiper),
5723 destroy: Scrollbar.destroy.bind(swiper),
5724 updateSize: Scrollbar.updateSize.bind(swiper),
5725 setTranslate: Scrollbar.setTranslate.bind(swiper),
5726 setTransition: Scrollbar.setTransition.bind(swiper),
5727 enableDraggable: Scrollbar.enableDraggable.bind(swiper),
5728 disableDraggable: Scrollbar.disableDraggable.bind(swiper),
5729 setDragPosition: Scrollbar.setDragPosition.bind(swiper),
5730 onDragStart: Scrollbar.onDragStart.bind(swiper),
5731 onDragMove: Scrollbar.onDragMove.bind(swiper),
5732 onDragEnd: Scrollbar.onDragEnd.bind(swiper),
5733 isTouched: false,
5734 timeout: null,
5735 dragTimeout: null,
5736 },
5737 });
5738 },
5739 on: {
5740 init: function init() {
5741 var swiper = this;
5742 swiper.scrollbar.init();
5743 swiper.scrollbar.updateSize();
5744 swiper.scrollbar.setTranslate();
5745 },
5746 update: function update() {
5747 var swiper = this;
5748 swiper.scrollbar.updateSize();
5749 },
5750 resize: function resize() {
5751 var swiper = this;
5752 swiper.scrollbar.updateSize();
5753 },
5754 observerUpdate: function observerUpdate() {
5755 var swiper = this;
5756 swiper.scrollbar.updateSize();
5757 },
5758 setTranslate: function setTranslate() {
5759 var swiper = this;
5760 swiper.scrollbar.setTranslate();
5761 },
5762 setTransition: function setTransition(duration) {
5763 var swiper = this;
5764 swiper.scrollbar.setTransition(duration);
5765 },
5766 destroy: function destroy() {
5767 var swiper = this;
5768 swiper.scrollbar.destroy();
5769 },
5770 },
5771 };
5772
5773 var Parallax = {
5774 setTransform: function setTransform(el, progress) {
5775 var swiper = this;
5776 var rtl = swiper.rtl;
5777
5778 var $el = $(el);
5779 var rtlFactor = rtl ? -1 : 1;
5780
5781 var p = $el.attr('data-swiper-parallax') || '0';
5782 var x = $el.attr('data-swiper-parallax-x');
5783 var y = $el.attr('data-swiper-parallax-y');
5784 var scale = $el.attr('data-swiper-parallax-scale');
5785 var opacity = $el.attr('data-swiper-parallax-opacity');
5786
5787 if (x || y) {
5788 x = x || '0';
5789 y = y || '0';
5790 } else if (swiper.isHorizontal()) {
5791 x = p;
5792 y = '0';
5793 } else {
5794 y = p;
5795 x = '0';
5796 }
5797
5798 if ((x).indexOf('%') >= 0) {
5799 x = (parseInt(x, 10) * progress * rtlFactor) + "%";
5800 } else {
5801 x = (x * progress * rtlFactor) + "px";
5802 }
5803 if ((y).indexOf('%') >= 0) {
5804 y = (parseInt(y, 10) * progress) + "%";
5805 } else {
5806 y = (y * progress) + "px";
5807 }
5808
5809 if (typeof opacity !== 'undefined' && opacity !== null) {
5810 var currentOpacity = opacity - ((opacity - 1) * (1 - Math.abs(progress)));
5811 $el[0].style.opacity = currentOpacity;
5812 }
5813 if (typeof scale === 'undefined' || scale === null) {
5814 $el.transform(("translate3d(" + x + ", " + y + ", 0px)"));
5815 } else {
5816 var currentScale = scale - ((scale - 1) * (1 - Math.abs(progress)));
5817 $el.transform(("translate3d(" + x + ", " + y + ", 0px) scale(" + currentScale + ")"));
5818 }
5819 },
5820 setTranslate: function setTranslate() {
5821 var swiper = this;
5822 var $el = swiper.$el;
5823 var slides = swiper.slides;
5824 var progress = swiper.progress;
5825 var snapGrid = swiper.snapGrid;
5826 $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]')
5827 .each(function (index, el) {
5828 swiper.parallax.setTransform(el, progress);
5829 });
5830 slides.each(function (slideIndex, slideEl) {
5831 var slideProgress = slideEl.progress;
5832 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') {
5833 slideProgress += Math.ceil(slideIndex / 2) - (progress * (snapGrid.length - 1));
5834 }
5835 slideProgress = Math.min(Math.max(slideProgress, -1), 1);
5836 $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]')
5837 .each(function (index, el) {
5838 swiper.parallax.setTransform(el, slideProgress);
5839 });
5840 });
5841 },
5842 setTransition: function setTransition(duration) {
5843 if ( duration === void 0 ) duration = this.params.speed;
5844
5845 var swiper = this;
5846 var $el = swiper.$el;
5847 $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]')
5848 .each(function (index, parallaxEl) {
5849 var $parallaxEl = $(parallaxEl);
5850 var parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration;
5851 if (duration === 0) { parallaxDuration = 0; }
5852 $parallaxEl.transition(parallaxDuration);
5853 });
5854 },
5855 };
5856
5857 var Parallax$1 = {
5858 name: 'parallax',
5859 params: {
5860 parallax: {
5861 enabled: false,
5862 },
5863 },
5864 create: function create() {
5865 var swiper = this;
5866 Utils.extend(swiper, {
5867 parallax: {
5868 setTransform: Parallax.setTransform.bind(swiper),
5869 setTranslate: Parallax.setTranslate.bind(swiper),
5870 setTransition: Parallax.setTransition.bind(swiper),
5871 },
5872 });
5873 },
5874 on: {
5875 beforeInit: function beforeInit() {
5876 var swiper = this;
5877 if (!swiper.params.parallax.enabled) { return; }
5878 swiper.params.watchSlidesProgress = true;
5879 swiper.originalParams.watchSlidesProgress = true;
5880 },
5881 init: function init() {
5882 var swiper = this;
5883 if (!swiper.params.parallax.enabled) { return; }
5884 swiper.parallax.setTranslate();
5885 },
5886 setTranslate: function setTranslate() {
5887 var swiper = this;
5888 if (!swiper.params.parallax.enabled) { return; }
5889 swiper.parallax.setTranslate();
5890 },
5891 setTransition: function setTransition(duration) {
5892 var swiper = this;
5893 if (!swiper.params.parallax.enabled) { return; }
5894 swiper.parallax.setTransition(duration);
5895 },
5896 },
5897 };
5898
5899 var Zoom = {
5900 // Calc Scale From Multi-touches
5901 getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
5902 if (e.targetTouches.length < 2) { return 1; }
5903 var x1 = e.targetTouches[0].pageX;
5904 var y1 = e.targetTouches[0].pageY;
5905 var x2 = e.targetTouches[1].pageX;
5906 var y2 = e.targetTouches[1].pageY;
5907 var distance = Math.sqrt((Math.pow( (x2 - x1), 2 )) + (Math.pow( (y2 - y1), 2 )));
5908 return distance;
5909 },
5910 // Events
5911 onGestureStart: function onGestureStart(e) {
5912 var swiper = this;
5913 var params = swiper.params.zoom;
5914 var zoom = swiper.zoom;
5915 var gesture = zoom.gesture;
5916 zoom.fakeGestureTouched = false;
5917 zoom.fakeGestureMoved = false;
5918 if (!Support.gestures) {
5919 if (e.type !== 'touchstart' || (e.type === 'touchstart' && e.targetTouches.length < 2)) {
5920 return;
5921 }
5922 zoom.fakeGestureTouched = true;
5923 gesture.scaleStart = Zoom.getDistanceBetweenTouches(e);
5924 }
5925 if (!gesture.$slideEl || !gesture.$slideEl.length) {
5926 gesture.$slideEl = $(e.target).closest('.swiper-slide');
5927 if (gesture.$slideEl.length === 0) { gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); }
5928 gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas');
5929 gesture.$imageWrapEl = gesture.$imageEl.parent(("." + (params.containerClass)));
5930 gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
5931 if (gesture.$imageWrapEl.length === 0) {
5932 gesture.$imageEl = undefined;
5933 return;
5934 }
5935 }
5936 gesture.$imageEl.transition(0);
5937 swiper.zoom.isScaling = true;
5938 },
5939 onGestureChange: function onGestureChange(e) {
5940 var swiper = this;
5941 var params = swiper.params.zoom;
5942 var zoom = swiper.zoom;
5943 var gesture = zoom.gesture;
5944 if (!Support.gestures) {
5945 if (e.type !== 'touchmove' || (e.type === 'touchmove' && e.targetTouches.length < 2)) {
5946 return;
5947 }
5948 zoom.fakeGestureMoved = true;
5949 gesture.scaleMove = Zoom.getDistanceBetweenTouches(e);
5950 }
5951 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; }
5952 if (Support.gestures) {
5953 zoom.scale = e.scale * zoom.currentScale;
5954 } else {
5955 zoom.scale = (gesture.scaleMove / gesture.scaleStart) * zoom.currentScale;
5956 }
5957 if (zoom.scale > gesture.maxRatio) {
5958 zoom.scale = (gesture.maxRatio - 1) + (Math.pow( ((zoom.scale - gesture.maxRatio) + 1), 0.5 ));
5959 }
5960 if (zoom.scale < params.minRatio) {
5961 zoom.scale = (params.minRatio + 1) - (Math.pow( ((params.minRatio - zoom.scale) + 1), 0.5 ));
5962 }
5963 gesture.$imageEl.transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
5964 },
5965 onGestureEnd: function onGestureEnd(e) {
5966 var swiper = this;
5967 var params = swiper.params.zoom;
5968 var zoom = swiper.zoom;
5969 var gesture = zoom.gesture;
5970 if (!Support.gestures) {
5971 if (!zoom.fakeGestureTouched || !zoom.fakeGestureMoved) {
5972 return;
5973 }
5974 if (e.type !== 'touchend' || (e.type === 'touchend' && e.changedTouches.length < 2 && !Device.android)) {
5975 return;
5976 }
5977 zoom.fakeGestureTouched = false;
5978 zoom.fakeGestureMoved = false;
5979 }
5980 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; }
5981 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio);
5982 gesture.$imageEl.transition(swiper.params.speed).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
5983 zoom.currentScale = zoom.scale;
5984 zoom.isScaling = false;
5985 if (zoom.scale === 1) { gesture.$slideEl = undefined; }
5986 },
5987 onTouchStart: function onTouchStart(e) {
5988 var swiper = this;
5989 var zoom = swiper.zoom;
5990 var gesture = zoom.gesture;
5991 var image = zoom.image;
5992 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; }
5993 if (image.isTouched) { return; }
5994 if (Device.android) { e.preventDefault(); }
5995 image.isTouched = true;
5996 image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
5997 image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
5998 },
5999 onTouchMove: function onTouchMove(e) {
6000 var swiper = this;
6001 var zoom = swiper.zoom;
6002 var gesture = zoom.gesture;
6003 var image = zoom.image;
6004 var velocity = zoom.velocity;
6005 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; }
6006 swiper.allowClick = false;
6007 if (!image.isTouched || !gesture.$slideEl) { return; }
6008
6009 if (!image.isMoved) {
6010 image.width = gesture.$imageEl[0].offsetWidth;
6011 image.height = gesture.$imageEl[0].offsetHeight;
6012 image.startX = Utils.getTranslate(gesture.$imageWrapEl[0], 'x') || 0;
6013 image.startY = Utils.getTranslate(gesture.$imageWrapEl[0], 'y') || 0;
6014 gesture.slideWidth = gesture.$slideEl[0].offsetWidth;
6015 gesture.slideHeight = gesture.$slideEl[0].offsetHeight;
6016 gesture.$imageWrapEl.transition(0);
6017 if (swiper.rtl) {
6018 image.startX = -image.startX;
6019 image.startY = -image.startY;
6020 }
6021 }
6022 // Define if we need image drag
6023 var scaledWidth = image.width * zoom.scale;
6024 var scaledHeight = image.height * zoom.scale;
6025
6026 if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) { return; }
6027
6028 image.minX = Math.min(((gesture.slideWidth / 2) - (scaledWidth / 2)), 0);
6029 image.maxX = -image.minX;
6030 image.minY = Math.min(((gesture.slideHeight / 2) - (scaledHeight / 2)), 0);
6031 image.maxY = -image.minY;
6032
6033 image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
6034 image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
6035
6036 if (!image.isMoved && !zoom.isScaling) {
6037 if (
6038 swiper.isHorizontal()
6039 && (
6040 (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x)
6041 || (Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)
6042 )
6043 ) {
6044 image.isTouched = false;
6045 return;
6046 } if (
6047 !swiper.isHorizontal()
6048 && (
6049 (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y)
6050 || (Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)
6051 )
6052 ) {
6053 image.isTouched = false;
6054 return;
6055 }
6056 }
6057 e.preventDefault();
6058 e.stopPropagation();
6059
6060 image.isMoved = true;
6061 image.currentX = (image.touchesCurrent.x - image.touchesStart.x) + image.startX;
6062 image.currentY = (image.touchesCurrent.y - image.touchesStart.y) + image.startY;
6063
6064 if (image.currentX < image.minX) {
6065 image.currentX = (image.minX + 1) - (Math.pow( ((image.minX - image.currentX) + 1), 0.8 ));
6066 }
6067 if (image.currentX > image.maxX) {
6068 image.currentX = (image.maxX - 1) + (Math.pow( ((image.currentX - image.maxX) + 1), 0.8 ));
6069 }
6070
6071 if (image.currentY < image.minY) {
6072 image.currentY = (image.minY + 1) - (Math.pow( ((image.minY - image.currentY) + 1), 0.8 ));
6073 }
6074 if (image.currentY > image.maxY) {
6075 image.currentY = (image.maxY - 1) + (Math.pow( ((image.currentY - image.maxY) + 1), 0.8 ));
6076 }
6077
6078 // Velocity
6079 if (!velocity.prevPositionX) { velocity.prevPositionX = image.touchesCurrent.x; }
6080 if (!velocity.prevPositionY) { velocity.prevPositionY = image.touchesCurrent.y; }
6081 if (!velocity.prevTime) { velocity.prevTime = Date.now(); }
6082 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2;
6083 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2;
6084 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) { velocity.x = 0; }
6085 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) { velocity.y = 0; }
6086 velocity.prevPositionX = image.touchesCurrent.x;
6087 velocity.prevPositionY = image.touchesCurrent.y;
6088 velocity.prevTime = Date.now();
6089
6090 gesture.$imageWrapEl.transform(("translate3d(" + (image.currentX) + "px, " + (image.currentY) + "px,0)"));
6091 },
6092 onTouchEnd: function onTouchEnd() {
6093 var swiper = this;
6094 var zoom = swiper.zoom;
6095 var gesture = zoom.gesture;
6096 var image = zoom.image;
6097 var velocity = zoom.velocity;
6098 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; }
6099 if (!image.isTouched || !image.isMoved) {
6100 image.isTouched = false;
6101 image.isMoved = false;
6102 return;
6103 }
6104 image.isTouched = false;
6105 image.isMoved = false;
6106 var momentumDurationX = 300;
6107 var momentumDurationY = 300;
6108 var momentumDistanceX = velocity.x * momentumDurationX;
6109 var newPositionX = image.currentX + momentumDistanceX;
6110 var momentumDistanceY = velocity.y * momentumDurationY;
6111 var newPositionY = image.currentY + momentumDistanceY;
6112
6113 // Fix duration
6114 if (velocity.x !== 0) { momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); }
6115 if (velocity.y !== 0) { momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); }
6116 var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
6117
6118 image.currentX = newPositionX;
6119 image.currentY = newPositionY;
6120
6121 // Define if we need image drag
6122 var scaledWidth = image.width * zoom.scale;
6123 var scaledHeight = image.height * zoom.scale;
6124 image.minX = Math.min(((gesture.slideWidth / 2) - (scaledWidth / 2)), 0);
6125 image.maxX = -image.minX;
6126 image.minY = Math.min(((gesture.slideHeight / 2) - (scaledHeight / 2)), 0);
6127 image.maxY = -image.minY;
6128 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX);
6129 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY);
6130
6131 gesture.$imageWrapEl.transition(momentumDuration).transform(("translate3d(" + (image.currentX) + "px, " + (image.currentY) + "px,0)"));
6132 },
6133 onTransitionEnd: function onTransitionEnd() {
6134 var swiper = this;
6135 var zoom = swiper.zoom;
6136 var gesture = zoom.gesture;
6137 if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) {
6138 gesture.$imageEl.transform('translate3d(0,0,0) scale(1)');
6139 gesture.$imageWrapEl.transform('translate3d(0,0,0)');
6140
6141 zoom.scale = 1;
6142 zoom.currentScale = 1;
6143
6144 gesture.$slideEl = undefined;
6145 gesture.$imageEl = undefined;
6146 gesture.$imageWrapEl = undefined;
6147 }
6148 },
6149 // Toggle Zoom
6150 toggle: function toggle(e) {
6151 var swiper = this;
6152 var zoom = swiper.zoom;
6153
6154 if (zoom.scale && zoom.scale !== 1) {
6155 // Zoom Out
6156 zoom.out();
6157 } else {
6158 // Zoom In
6159 zoom.in(e);
6160 }
6161 },
6162 in: function in$1(e) {
6163 var swiper = this;
6164
6165 var zoom = swiper.zoom;
6166 var params = swiper.params.zoom;
6167 var gesture = zoom.gesture;
6168 var image = zoom.image;
6169
6170 if (!gesture.$slideEl) {
6171 gesture.$slideEl = swiper.clickedSlide ? $(swiper.clickedSlide) : swiper.slides.eq(swiper.activeIndex);
6172 gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas');
6173 gesture.$imageWrapEl = gesture.$imageEl.parent(("." + (params.containerClass)));
6174 }
6175 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; }
6176
6177 gesture.$slideEl.addClass(("" + (params.zoomedSlideClass)));
6178
6179 var touchX;
6180 var touchY;
6181 var offsetX;
6182 var offsetY;
6183 var diffX;
6184 var diffY;
6185 var translateX;
6186 var translateY;
6187 var imageWidth;
6188 var imageHeight;
6189 var scaledWidth;
6190 var scaledHeight;
6191 var translateMinX;
6192 var translateMinY;
6193 var translateMaxX;
6194 var translateMaxY;
6195 var slideWidth;
6196 var slideHeight;
6197
6198 if (typeof image.touchesStart.x === 'undefined' && e) {
6199 touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
6200 touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
6201 } else {
6202 touchX = image.touchesStart.x;
6203 touchY = image.touchesStart.y;
6204 }
6205
6206 zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
6207 zoom.currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
6208 if (e) {
6209 slideWidth = gesture.$slideEl[0].offsetWidth;
6210 slideHeight = gesture.$slideEl[0].offsetHeight;
6211 offsetX = gesture.$slideEl.offset().left;
6212 offsetY = gesture.$slideEl.offset().top;
6213 diffX = (offsetX + (slideWidth / 2)) - touchX;
6214 diffY = (offsetY + (slideHeight / 2)) - touchY;
6215
6216 imageWidth = gesture.$imageEl[0].offsetWidth;
6217 imageHeight = gesture.$imageEl[0].offsetHeight;
6218 scaledWidth = imageWidth * zoom.scale;
6219 scaledHeight = imageHeight * zoom.scale;
6220
6221 translateMinX = Math.min(((slideWidth / 2) - (scaledWidth / 2)), 0);
6222 translateMinY = Math.min(((slideHeight / 2) - (scaledHeight / 2)), 0);
6223 translateMaxX = -translateMinX;
6224 translateMaxY = -translateMinY;
6225
6226 translateX = diffX * zoom.scale;
6227 translateY = diffY * zoom.scale;
6228
6229 if (translateX < translateMinX) {
6230 translateX = translateMinX;
6231 }
6232 if (translateX > translateMaxX) {
6233 translateX = translateMaxX;
6234 }
6235
6236 if (translateY < translateMinY) {
6237 translateY = translateMinY;
6238 }
6239 if (translateY > translateMaxY) {
6240 translateY = translateMaxY;
6241 }
6242 } else {
6243 translateX = 0;
6244 translateY = 0;
6245 }
6246 gesture.$imageWrapEl.transition(300).transform(("translate3d(" + translateX + "px, " + translateY + "px,0)"));
6247 gesture.$imageEl.transition(300).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
6248 },
6249 out: function out() {
6250 var swiper = this;
6251
6252 var zoom = swiper.zoom;
6253 var params = swiper.params.zoom;
6254 var gesture = zoom.gesture;
6255
6256 if (!gesture.$slideEl) {
6257 gesture.$slideEl = swiper.clickedSlide ? $(swiper.clickedSlide) : swiper.slides.eq(swiper.activeIndex);
6258 gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas');
6259 gesture.$imageWrapEl = gesture.$imageEl.parent(("." + (params.containerClass)));
6260 }
6261 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; }
6262
6263 zoom.scale = 1;
6264 zoom.currentScale = 1;
6265 gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)');
6266 gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)');
6267 gesture.$slideEl.removeClass(("" + (params.zoomedSlideClass)));
6268 gesture.$slideEl = undefined;
6269 },
6270 // Attach/Detach Events
6271 enable: function enable() {
6272 var swiper = this;
6273 var zoom = swiper.zoom;
6274 if (zoom.enabled) { return; }
6275 zoom.enabled = true;
6276
6277 var passiveListener = swiper.touchEvents.start === 'touchstart' && Support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false;
6278
6279 // Scale image
6280 if (Support.gestures) {
6281 swiper.$wrapperEl.on('gesturestart', '.swiper-slide', zoom.onGestureStart, passiveListener);
6282 swiper.$wrapperEl.on('gesturechange', '.swiper-slide', zoom.onGestureChange, passiveListener);
6283 swiper.$wrapperEl.on('gestureend', '.swiper-slide', zoom.onGestureEnd, passiveListener);
6284 } else if (swiper.touchEvents.start === 'touchstart') {
6285 swiper.$wrapperEl.on(swiper.touchEvents.start, '.swiper-slide', zoom.onGestureStart, passiveListener);
6286 swiper.$wrapperEl.on(swiper.touchEvents.move, '.swiper-slide', zoom.onGestureChange, passiveListener);
6287 swiper.$wrapperEl.on(swiper.touchEvents.end, '.swiper-slide', zoom.onGestureEnd, passiveListener);
6288 }
6289
6290 // Move image
6291 swiper.$wrapperEl.on(swiper.touchEvents.move, ("." + (swiper.params.zoom.containerClass)), zoom.onTouchMove);
6292 },
6293 disable: function disable() {
6294 var swiper = this;
6295 var zoom = swiper.zoom;
6296 if (!zoom.enabled) { return; }
6297
6298 swiper.zoom.enabled = false;
6299
6300 var passiveListener = swiper.touchEvents.start === 'touchstart' && Support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false;
6301
6302 // Scale image
6303 if (Support.gestures) {
6304 swiper.$wrapperEl.off('gesturestart', '.swiper-slide', zoom.onGestureStart, passiveListener);
6305 swiper.$wrapperEl.off('gesturechange', '.swiper-slide', zoom.onGestureChange, passiveListener);
6306 swiper.$wrapperEl.off('gestureend', '.swiper-slide', zoom.onGestureEnd, passiveListener);
6307 } else if (swiper.touchEvents.start === 'touchstart') {
6308 swiper.$wrapperEl.off(swiper.touchEvents.start, '.swiper-slide', zoom.onGestureStart, passiveListener);
6309 swiper.$wrapperEl.off(swiper.touchEvents.move, '.swiper-slide', zoom.onGestureChange, passiveListener);
6310 swiper.$wrapperEl.off(swiper.touchEvents.end, '.swiper-slide', zoom.onGestureEnd, passiveListener);
6311 }
6312
6313 // Move image
6314 swiper.$wrapperEl.off(swiper.touchEvents.move, ("." + (swiper.params.zoom.containerClass)), zoom.onTouchMove);
6315 },
6316 };
6317
6318 var Zoom$1 = {
6319 name: 'zoom',
6320 params: {
6321 zoom: {
6322 enabled: false,
6323 maxRatio: 3,
6324 minRatio: 1,
6325 toggle: true,
6326 containerClass: 'swiper-zoom-container',
6327 zoomedSlideClass: 'swiper-slide-zoomed',
6328 },
6329 },
6330 create: function create() {
6331 var swiper = this;
6332 var zoom = {
6333 enabled: false,
6334 scale: 1,
6335 currentScale: 1,
6336 isScaling: false,
6337 gesture: {
6338 $slideEl: undefined,
6339 slideWidth: undefined,
6340 slideHeight: undefined,
6341 $imageEl: undefined,
6342 $imageWrapEl: undefined,
6343 maxRatio: 3,
6344 },
6345 image: {
6346 isTouched: undefined,
6347 isMoved: undefined,
6348 currentX: undefined,
6349 currentY: undefined,
6350 minX: undefined,
6351 minY: undefined,
6352 maxX: undefined,
6353 maxY: undefined,
6354 width: undefined,
6355 height: undefined,
6356 startX: undefined,
6357 startY: undefined,
6358 touchesStart: {},
6359 touchesCurrent: {},
6360 },
6361 velocity: {
6362 x: undefined,
6363 y: undefined,
6364 prevPositionX: undefined,
6365 prevPositionY: undefined,
6366 prevTime: undefined,
6367 },
6368 };
6369
6370 ('onGestureStart onGestureChange onGestureEnd onTouchStart onTouchMove onTouchEnd onTransitionEnd toggle enable disable in out').split(' ').forEach(function (methodName) {
6371 zoom[methodName] = Zoom[methodName].bind(swiper);
6372 });
6373 Utils.extend(swiper, {
6374 zoom: zoom,
6375 });
6376
6377 var scale = 1;
6378 Object.defineProperty(swiper.zoom, 'scale', {
6379 get: function get() {
6380 return scale;
6381 },
6382 set: function set(value) {
6383 if (scale !== value) {
6384 var imageEl = swiper.zoom.gesture.$imageEl ? swiper.zoom.gesture.$imageEl[0] : undefined;
6385 var slideEl = swiper.zoom.gesture.$slideEl ? swiper.zoom.gesture.$slideEl[0] : undefined;
6386 swiper.emit('zoomChange', value, imageEl, slideEl);
6387 }
6388 scale = value;
6389 },
6390 });
6391 },
6392 on: {
6393 init: function init() {
6394 var swiper = this;
6395 if (swiper.params.zoom.enabled) {
6396 swiper.zoom.enable();
6397 }
6398 },
6399 destroy: function destroy() {
6400 var swiper = this;
6401 swiper.zoom.disable();
6402 },
6403 touchStart: function touchStart(e) {
6404 var swiper = this;
6405 if (!swiper.zoom.enabled) { return; }
6406 swiper.zoom.onTouchStart(e);
6407 },
6408 touchEnd: function touchEnd(e) {
6409 var swiper = this;
6410 if (!swiper.zoom.enabled) { return; }
6411 swiper.zoom.onTouchEnd(e);
6412 },
6413 doubleTap: function doubleTap(e) {
6414 var swiper = this;
6415 if (swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
6416 swiper.zoom.toggle(e);
6417 }
6418 },
6419 transitionEnd: function transitionEnd() {
6420 var swiper = this;
6421 if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
6422 swiper.zoom.onTransitionEnd();
6423 }
6424 },
6425 },
6426 };
6427
6428 var Lazy = {
6429 loadInSlide: function loadInSlide(index, loadInDuplicate) {
6430 if ( loadInDuplicate === void 0 ) loadInDuplicate = true;
6431
6432 var swiper = this;
6433 var params = swiper.params.lazy;
6434 if (typeof index === 'undefined') { return; }
6435 if (swiper.slides.length === 0) { return; }
6436 var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
6437
6438 var $slideEl = isVirtual
6439 ? swiper.$wrapperEl.children(("." + (swiper.params.slideClass) + "[data-swiper-slide-index=\"" + index + "\"]"))
6440 : swiper.slides.eq(index);
6441
6442 var $images = $slideEl.find(("." + (params.elementClass) + ":not(." + (params.loadedClass) + "):not(." + (params.loadingClass) + ")"));
6443 if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) {
6444 $images = $images.add($slideEl[0]);
6445 }
6446 if ($images.length === 0) { return; }
6447
6448 $images.each(function (imageIndex, imageEl) {
6449 var $imageEl = $(imageEl);
6450 $imageEl.addClass(params.loadingClass);
6451
6452 var background = $imageEl.attr('data-background');
6453 var src = $imageEl.attr('data-src');
6454 var srcset = $imageEl.attr('data-srcset');
6455 var sizes = $imageEl.attr('data-sizes');
6456
6457 swiper.loadImage($imageEl[0], (src || background), srcset, sizes, false, function () {
6458 if (typeof swiper === 'undefined' || swiper === null || !swiper || (swiper && !swiper.params) || swiper.destroyed) { return; }
6459 if (background) {
6460 $imageEl.css('background-image', ("url(\"" + background + "\")"));
6461 $imageEl.removeAttr('data-background');
6462 } else {
6463 if (srcset) {
6464 $imageEl.attr('srcset', srcset);
6465 $imageEl.removeAttr('data-srcset');
6466 }
6467 if (sizes) {
6468 $imageEl.attr('sizes', sizes);
6469 $imageEl.removeAttr('data-sizes');
6470 }
6471 if (src) {
6472 $imageEl.attr('src', src);
6473 $imageEl.removeAttr('data-src');
6474 }
6475 }
6476
6477 $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass);
6478 $slideEl.find(("." + (params.preloaderClass))).remove();
6479 if (swiper.params.loop && loadInDuplicate) {
6480 var slideOriginalIndex = $slideEl.attr('data-swiper-slide-index');
6481 if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) {
6482 var originalSlide = swiper.$wrapperEl.children(("[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]:not(." + (swiper.params.slideDuplicateClass) + ")"));
6483 swiper.lazy.loadInSlide(originalSlide.index(), false);
6484 } else {
6485 var duplicatedSlide = swiper.$wrapperEl.children(("." + (swiper.params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]"));
6486 swiper.lazy.loadInSlide(duplicatedSlide.index(), false);
6487 }
6488 }
6489 swiper.emit('lazyImageReady', $slideEl[0], $imageEl[0]);
6490 });
6491
6492 swiper.emit('lazyImageLoad', $slideEl[0], $imageEl[0]);
6493 });
6494 },
6495 load: function load() {
6496 var swiper = this;
6497 var $wrapperEl = swiper.$wrapperEl;
6498 var swiperParams = swiper.params;
6499 var slides = swiper.slides;
6500 var activeIndex = swiper.activeIndex;
6501 var isVirtual = swiper.virtual && swiperParams.virtual.enabled;
6502 var params = swiperParams.lazy;
6503
6504 var slidesPerView = swiperParams.slidesPerView;
6505 if (slidesPerView === 'auto') {
6506 slidesPerView = 0;
6507 }
6508
6509 function slideExist(index) {
6510 if (isVirtual) {
6511 if ($wrapperEl.children(("." + (swiperParams.slideClass) + "[data-swiper-slide-index=\"" + index + "\"]")).length) {
6512 return true;
6513 }
6514 } else if (slides[index]) { return true; }
6515 return false;
6516 }
6517 function slideIndex(slideEl) {
6518 if (isVirtual) {
6519 return $(slideEl).attr('data-swiper-slide-index');
6520 }
6521 return $(slideEl).index();
6522 }
6523
6524 if (!swiper.lazy.initialImageLoaded) { swiper.lazy.initialImageLoaded = true; }
6525 if (swiper.params.watchSlidesVisibility) {
6526 $wrapperEl.children(("." + (swiperParams.slideVisibleClass))).each(function (elIndex, slideEl) {
6527 var index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index();
6528 swiper.lazy.loadInSlide(index);
6529 });
6530 } else if (slidesPerView > 1) {
6531 for (var i = activeIndex; i < activeIndex + slidesPerView; i += 1) {
6532 if (slideExist(i)) { swiper.lazy.loadInSlide(i); }
6533 }
6534 } else {
6535 swiper.lazy.loadInSlide(activeIndex);
6536 }
6537 if (params.loadPrevNext) {
6538 if (slidesPerView > 1 || (params.loadPrevNextAmount && params.loadPrevNextAmount > 1)) {
6539 var amount = params.loadPrevNextAmount;
6540 var spv = slidesPerView;
6541 var maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length);
6542 var minIndex = Math.max(activeIndex - Math.max(spv, amount), 0);
6543 // Next Slides
6544 for (var i$1 = activeIndex + slidesPerView; i$1 < maxIndex; i$1 += 1) {
6545 if (slideExist(i$1)) { swiper.lazy.loadInSlide(i$1); }
6546 }
6547 // Prev Slides
6548 for (var i$2 = minIndex; i$2 < activeIndex; i$2 += 1) {
6549 if (slideExist(i$2)) { swiper.lazy.loadInSlide(i$2); }
6550 }
6551 } else {
6552 var nextSlide = $wrapperEl.children(("." + (swiperParams.slideNextClass)));
6553 if (nextSlide.length > 0) { swiper.lazy.loadInSlide(slideIndex(nextSlide)); }
6554
6555 var prevSlide = $wrapperEl.children(("." + (swiperParams.slidePrevClass)));
6556 if (prevSlide.length > 0) { swiper.lazy.loadInSlide(slideIndex(prevSlide)); }
6557 }
6558 }
6559 },
6560 };
6561
6562 var Lazy$1 = {
6563 name: 'lazy',
6564 params: {
6565 lazy: {
6566 enabled: false,
6567 loadPrevNext: false,
6568 loadPrevNextAmount: 1,
6569 loadOnTransitionStart: false,
6570
6571 elementClass: 'swiper-lazy',
6572 loadingClass: 'swiper-lazy-loading',
6573 loadedClass: 'swiper-lazy-loaded',
6574 preloaderClass: 'swiper-lazy-preloader',
6575 },
6576 },
6577 create: function create() {
6578 var swiper = this;
6579 Utils.extend(swiper, {
6580 lazy: {
6581 initialImageLoaded: false,
6582 load: Lazy.load.bind(swiper),
6583 loadInSlide: Lazy.loadInSlide.bind(swiper),
6584 },
6585 });
6586 },
6587 on: {
6588 beforeInit: function beforeInit() {
6589 var swiper = this;
6590 if (swiper.params.lazy.enabled && swiper.params.preloadImages) {
6591 swiper.params.preloadImages = false;
6592 }
6593 },
6594 init: function init() {
6595 var swiper = this;
6596 if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialSlide === 0) {
6597 swiper.lazy.load();
6598 }
6599 },
6600 scroll: function scroll() {
6601 var swiper = this;
6602 if (swiper.params.freeMode && !swiper.params.freeModeSticky) {
6603 swiper.lazy.load();
6604 }
6605 },
6606 resize: function resize() {
6607 var swiper = this;
6608 if (swiper.params.lazy.enabled) {
6609 swiper.lazy.load();
6610 }
6611 },
6612 scrollbarDragMove: function scrollbarDragMove() {
6613 var swiper = this;
6614 if (swiper.params.lazy.enabled) {
6615 swiper.lazy.load();
6616 }
6617 },
6618 transitionStart: function transitionStart() {
6619 var swiper = this;
6620 if (swiper.params.lazy.enabled) {
6621 if (swiper.params.lazy.loadOnTransitionStart || (!swiper.params.lazy.loadOnTransitionStart && !swiper.lazy.initialImageLoaded)) {
6622 swiper.lazy.load();
6623 }
6624 }
6625 },
6626 transitionEnd: function transitionEnd() {
6627 var swiper = this;
6628 if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) {
6629 swiper.lazy.load();
6630 }
6631 },
6632 },
6633 };
6634
6635 /* eslint no-bitwise: ["error", { "allow": [">>"] }] */
6636
6637 var Controller = {
6638 LinearSpline: function LinearSpline(x, y) {
6639 var binarySearch = (function search() {
6640 var maxIndex;
6641 var minIndex;
6642 var guess;
6643 return function (array, val) {
6644 minIndex = -1;
6645 maxIndex = array.length;
6646 while (maxIndex - minIndex > 1) {
6647 guess = maxIndex + minIndex >> 1;
6648 if (array[guess] <= val) {
6649 minIndex = guess;
6650 } else {
6651 maxIndex = guess;
6652 }
6653 }
6654 return maxIndex;
6655 };
6656 }());
6657 this.x = x;
6658 this.y = y;
6659 this.lastIndex = x.length - 1;
6660 // Given an x value (x2), return the expected y2 value:
6661 // (x1,y1) is the known point before given value,
6662 // (x3,y3) is the known point after given value.
6663 var i1;
6664 var i3;
6665
6666 this.interpolate = function interpolate(x2) {
6667 if (!x2) { return 0; }
6668
6669 // Get the indexes of x1 and x3 (the array indexes before and after given x2):
6670 i3 = binarySearch(this.x, x2);
6671 i1 = i3 - 1;
6672
6673 // We have our indexes i1 & i3, so we can calculate already:
6674 // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
6675 return (((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1])) + this.y[i1];
6676 };
6677 return this;
6678 },
6679 // xxx: for now i will just save one spline function to to
6680 getInterpolateFunction: function getInterpolateFunction(c) {
6681 var swiper = this;
6682 if (!swiper.controller.spline) {
6683 swiper.controller.spline = swiper.params.loop
6684 ? new Controller.LinearSpline(swiper.slidesGrid, c.slidesGrid)
6685 : new Controller.LinearSpline(swiper.snapGrid, c.snapGrid);
6686 }
6687 },
6688 setTranslate: function setTranslate(setTranslate$1, byController) {
6689 var swiper = this;
6690 var controlled = swiper.controller.control;
6691 var multiplier;
6692 var controlledTranslate;
6693 function setControlledTranslate(c) {
6694 // this will create an Interpolate function based on the snapGrids
6695 // x is the Grid of the scrolled scroller and y will be the controlled scroller
6696 // it makes sense to create this only once and recall it for the interpolation
6697 // the function does a lot of value caching for performance
6698 var translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;
6699 if (swiper.params.controller.by === 'slide') {
6700 swiper.controller.getInterpolateFunction(c);
6701 // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
6702 // but it did not work out
6703 controlledTranslate = -swiper.controller.spline.interpolate(-translate);
6704 }
6705
6706 if (!controlledTranslate || swiper.params.controller.by === 'container') {
6707 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
6708 controlledTranslate = ((translate - swiper.minTranslate()) * multiplier) + c.minTranslate();
6709 }
6710
6711 if (swiper.params.controller.inverse) {
6712 controlledTranslate = c.maxTranslate() - controlledTranslate;
6713 }
6714 c.updateProgress(controlledTranslate);
6715 c.setTranslate(controlledTranslate, swiper);
6716 c.updateActiveIndex();
6717 c.updateSlidesClasses();
6718 }
6719 if (Array.isArray(controlled)) {
6720 for (var i = 0; i < controlled.length; i += 1) {
6721 if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
6722 setControlledTranslate(controlled[i]);
6723 }
6724 }
6725 } else if (controlled instanceof Swiper && byController !== controlled) {
6726 setControlledTranslate(controlled);
6727 }
6728 },
6729 setTransition: function setTransition(duration, byController) {
6730 var swiper = this;
6731 var controlled = swiper.controller.control;
6732 var i;
6733 function setControlledTransition(c) {
6734 c.setTransition(duration, swiper);
6735 if (duration !== 0) {
6736 c.transitionStart();
6737 if (c.params.autoHeight) {
6738 Utils.nextTick(function () {
6739 c.updateAutoHeight();
6740 });
6741 }
6742 c.$wrapperEl.transitionEnd(function () {
6743 if (!controlled) { return; }
6744 if (c.params.loop && swiper.params.controller.by === 'slide') {
6745 c.loopFix();
6746 }
6747 c.transitionEnd();
6748 });
6749 }
6750 }
6751 if (Array.isArray(controlled)) {
6752 for (i = 0; i < controlled.length; i += 1) {
6753 if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
6754 setControlledTransition(controlled[i]);
6755 }
6756 }
6757 } else if (controlled instanceof Swiper && byController !== controlled) {
6758 setControlledTransition(controlled);
6759 }
6760 },
6761 };
6762 var Controller$1 = {
6763 name: 'controller',
6764 params: {
6765 controller: {
6766 control: undefined,
6767 inverse: false,
6768 by: 'slide', // or 'container'
6769 },
6770 },
6771 create: function create() {
6772 var swiper = this;
6773 Utils.extend(swiper, {
6774 controller: {
6775 control: swiper.params.controller.control,
6776 getInterpolateFunction: Controller.getInterpolateFunction.bind(swiper),
6777 setTranslate: Controller.setTranslate.bind(swiper),
6778 setTransition: Controller.setTransition.bind(swiper),
6779 },
6780 });
6781 },
6782 on: {
6783 update: function update() {
6784 var swiper = this;
6785 if (!swiper.controller.control) { return; }
6786 if (swiper.controller.spline) {
6787 swiper.controller.spline = undefined;
6788 delete swiper.controller.spline;
6789 }
6790 },
6791 resize: function resize() {
6792 var swiper = this;
6793 if (!swiper.controller.control) { return; }
6794 if (swiper.controller.spline) {
6795 swiper.controller.spline = undefined;
6796 delete swiper.controller.spline;
6797 }
6798 },
6799 observerUpdate: function observerUpdate() {
6800 var swiper = this;
6801 if (!swiper.controller.control) { return; }
6802 if (swiper.controller.spline) {
6803 swiper.controller.spline = undefined;
6804 delete swiper.controller.spline;
6805 }
6806 },
6807 setTranslate: function setTranslate(translate, byController) {
6808 var swiper = this;
6809 if (!swiper.controller.control) { return; }
6810 swiper.controller.setTranslate(translate, byController);
6811 },
6812 setTransition: function setTransition(duration, byController) {
6813 var swiper = this;
6814 if (!swiper.controller.control) { return; }
6815 swiper.controller.setTransition(duration, byController);
6816 },
6817 },
6818 };
6819
6820 var a11y = {
6821 makeElFocusable: function makeElFocusable($el) {
6822 $el.attr('tabIndex', '0');
6823 return $el;
6824 },
6825 addElRole: function addElRole($el, role) {
6826 $el.attr('role', role);
6827 return $el;
6828 },
6829 addElLabel: function addElLabel($el, label) {
6830 $el.attr('aria-label', label);
6831 return $el;
6832 },
6833 disableEl: function disableEl($el) {
6834 $el.attr('aria-disabled', true);
6835 return $el;
6836 },
6837 enableEl: function enableEl($el) {
6838 $el.attr('aria-disabled', false);
6839 return $el;
6840 },
6841 onEnterKey: function onEnterKey(e) {
6842 var swiper = this;
6843 var params = swiper.params.a11y;
6844 if (e.keyCode !== 13) { return; }
6845 var $targetEl = $(e.target);
6846 if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) {
6847 if (!(swiper.isEnd && !swiper.params.loop)) {
6848 swiper.slideNext();
6849 }
6850 if (swiper.isEnd) {
6851 swiper.a11y.notify(params.lastSlideMessage);
6852 } else {
6853 swiper.a11y.notify(params.nextSlideMessage);
6854 }
6855 }
6856 if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) {
6857 if (!(swiper.isBeginning && !swiper.params.loop)) {
6858 swiper.slidePrev();
6859 }
6860 if (swiper.isBeginning) {
6861 swiper.a11y.notify(params.firstSlideMessage);
6862 } else {
6863 swiper.a11y.notify(params.prevSlideMessage);
6864 }
6865 }
6866 if (swiper.pagination && $targetEl.is(("." + (swiper.params.pagination.bulletClass)))) {
6867 $targetEl[0].click();
6868 }
6869 },
6870 notify: function notify(message) {
6871 var swiper = this;
6872 var notification = swiper.a11y.liveRegion;
6873 if (notification.length === 0) { return; }
6874 notification.html('');
6875 notification.html(message);
6876 },
6877 updateNavigation: function updateNavigation() {
6878 var swiper = this;
6879
6880 if (swiper.params.loop) { return; }
6881 var ref = swiper.navigation;
6882 var $nextEl = ref.$nextEl;
6883 var $prevEl = ref.$prevEl;
6884
6885 if ($prevEl && $prevEl.length > 0) {
6886 if (swiper.isBeginning) {
6887 swiper.a11y.disableEl($prevEl);
6888 } else {
6889 swiper.a11y.enableEl($prevEl);
6890 }
6891 }
6892 if ($nextEl && $nextEl.length > 0) {
6893 if (swiper.isEnd) {
6894 swiper.a11y.disableEl($nextEl);
6895 } else {
6896 swiper.a11y.enableEl($nextEl);
6897 }
6898 }
6899 },
6900 updatePagination: function updatePagination() {
6901 var swiper = this;
6902 var params = swiper.params.a11y;
6903 if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
6904 swiper.pagination.bullets.each(function (bulletIndex, bulletEl) {
6905 var $bulletEl = $(bulletEl);
6906 swiper.a11y.makeElFocusable($bulletEl);
6907 swiper.a11y.addElRole($bulletEl, 'button');
6908 swiper.a11y.addElLabel($bulletEl, params.paginationBulletMessage.replace(/{{index}}/, $bulletEl.index() + 1));
6909 });
6910 }
6911 },
6912 init: function init() {
6913 var swiper = this;
6914
6915 swiper.$el.append(swiper.a11y.liveRegion);
6916
6917 // Navigation
6918 var params = swiper.params.a11y;
6919 var $nextEl;
6920 var $prevEl;
6921 if (swiper.navigation && swiper.navigation.$nextEl) {
6922 $nextEl = swiper.navigation.$nextEl;
6923 }
6924 if (swiper.navigation && swiper.navigation.$prevEl) {
6925 $prevEl = swiper.navigation.$prevEl;
6926 }
6927 if ($nextEl) {
6928 swiper.a11y.makeElFocusable($nextEl);
6929 swiper.a11y.addElRole($nextEl, 'button');
6930 swiper.a11y.addElLabel($nextEl, params.nextSlideMessage);
6931 $nextEl.on('keydown', swiper.a11y.onEnterKey);
6932 }
6933 if ($prevEl) {
6934 swiper.a11y.makeElFocusable($prevEl);
6935 swiper.a11y.addElRole($prevEl, 'button');
6936 swiper.a11y.addElLabel($prevEl, params.prevSlideMessage);
6937 $prevEl.on('keydown', swiper.a11y.onEnterKey);
6938 }
6939
6940 // Pagination
6941 if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
6942 swiper.pagination.$el.on('keydown', ("." + (swiper.params.pagination.bulletClass)), swiper.a11y.onEnterKey);
6943 }
6944 },
6945 destroy: function destroy() {
6946 var swiper = this;
6947 if (swiper.a11y.liveRegion && swiper.a11y.liveRegion.length > 0) { swiper.a11y.liveRegion.remove(); }
6948
6949 var $nextEl;
6950 var $prevEl;
6951 if (swiper.navigation && swiper.navigation.$nextEl) {
6952 $nextEl = swiper.navigation.$nextEl;
6953 }
6954 if (swiper.navigation && swiper.navigation.$prevEl) {
6955 $prevEl = swiper.navigation.$prevEl;
6956 }
6957 if ($nextEl) {
6958 $nextEl.off('keydown', swiper.a11y.onEnterKey);
6959 }
6960 if ($prevEl) {
6961 $prevEl.off('keydown', swiper.a11y.onEnterKey);
6962 }
6963
6964 // Pagination
6965 if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
6966 swiper.pagination.$el.off('keydown', ("." + (swiper.params.pagination.bulletClass)), swiper.a11y.onEnterKey);
6967 }
6968 },
6969 };
6970 var A11y = {
6971 name: 'a11y',
6972 params: {
6973 a11y: {
6974 enabled: true,
6975 notificationClass: 'swiper-notification',
6976 prevSlideMessage: 'Previous slide',
6977 nextSlideMessage: 'Next slide',
6978 firstSlideMessage: 'This is the first slide',
6979 lastSlideMessage: 'This is the last slide',
6980 paginationBulletMessage: 'Go to slide {{index}}',
6981 },
6982 },
6983 create: function create() {
6984 var swiper = this;
6985 Utils.extend(swiper, {
6986 a11y: {
6987 liveRegion: $(("<span class=\"" + (swiper.params.a11y.notificationClass) + "\" aria-live=\"assertive\" aria-atomic=\"true\"></span>")),
6988 },
6989 });
6990 Object.keys(a11y).forEach(function (methodName) {
6991 swiper.a11y[methodName] = a11y[methodName].bind(swiper);
6992 });
6993 },
6994 on: {
6995 init: function init() {
6996 var swiper = this;
6997 if (!swiper.params.a11y.enabled) { return; }
6998 swiper.a11y.init();
6999 swiper.a11y.updateNavigation();
7000 },
7001 toEdge: function toEdge() {
7002 var swiper = this;
7003 if (!swiper.params.a11y.enabled) { return; }
7004 swiper.a11y.updateNavigation();
7005 },
7006 fromEdge: function fromEdge() {
7007 var swiper = this;
7008 if (!swiper.params.a11y.enabled) { return; }
7009 swiper.a11y.updateNavigation();
7010 },
7011 paginationUpdate: function paginationUpdate() {
7012 var swiper = this;
7013 if (!swiper.params.a11y.enabled) { return; }
7014 swiper.a11y.updatePagination();
7015 },
7016 destroy: function destroy() {
7017 var swiper = this;
7018 if (!swiper.params.a11y.enabled) { return; }
7019 swiper.a11y.destroy();
7020 },
7021 },
7022 };
7023
7024 var History = {
7025 init: function init() {
7026 var swiper = this;
7027 if (!swiper.params.history) { return; }
7028 if (!win.history || !win.history.pushState) {
7029 swiper.params.history.enabled = false;
7030 swiper.params.hashNavigation.enabled = true;
7031 return;
7032 }
7033 var history = swiper.history;
7034 history.initialized = true;
7035 history.paths = History.getPathValues();
7036 if (!history.paths.key && !history.paths.value) { return; }
7037 history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit);
7038 if (!swiper.params.history.replaceState) {
7039 win.addEventListener('popstate', swiper.history.setHistoryPopState);
7040 }
7041 },
7042 destroy: function destroy() {
7043 var swiper = this;
7044 if (!swiper.params.history.replaceState) {
7045 win.removeEventListener('popstate', swiper.history.setHistoryPopState);
7046 }
7047 },
7048 setHistoryPopState: function setHistoryPopState() {
7049 var swiper = this;
7050 swiper.history.paths = History.getPathValues();
7051 swiper.history.scrollToSlide(swiper.params.speed, swiper.history.paths.value, false);
7052 },
7053 getPathValues: function getPathValues() {
7054 var pathArray = win.location.pathname.slice(1).split('/').filter(function (part) { return part !== ''; });
7055 var total = pathArray.length;
7056 var key = pathArray[total - 2];
7057 var value = pathArray[total - 1];
7058 return { key: key, value: value };
7059 },
7060 setHistory: function setHistory(key, index) {
7061 var swiper = this;
7062 if (!swiper.history.initialized || !swiper.params.history.enabled) { return; }
7063 var slide = swiper.slides.eq(index);
7064 var value = History.slugify(slide.attr('data-history'));
7065 if (!win.location.pathname.includes(key)) {
7066 value = key + "/" + value;
7067 }
7068 var currentState = win.history.state;
7069 if (currentState && currentState.value === value) {
7070 return;
7071 }
7072 if (swiper.params.history.replaceState) {
7073 win.history.replaceState({ value: value }, null, value);
7074 } else {
7075 win.history.pushState({ value: value }, null, value);
7076 }
7077 },
7078 slugify: function slugify(text) {
7079 return text.toString()
7080 .replace(/\s+/g, '-')
7081 .replace(/[^\w-]+/g, '')
7082 .replace(/--+/g, '-')
7083 .replace(/^-+/, '')
7084 .replace(/-+$/, '');
7085 },
7086 scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
7087 var swiper = this;
7088 if (value) {
7089 for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
7090 var slide = swiper.slides.eq(i);
7091 var slideHistory = History.slugify(slide.attr('data-history'));
7092 if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) {
7093 var index = slide.index();
7094 swiper.slideTo(index, speed, runCallbacks);
7095 }
7096 }
7097 } else {
7098 swiper.slideTo(0, speed, runCallbacks);
7099 }
7100 },
7101 };
7102
7103 var History$1 = {
7104 name: 'history',
7105 params: {
7106 history: {
7107 enabled: false,
7108 replaceState: false,
7109 key: 'slides',
7110 },
7111 },
7112 create: function create() {
7113 var swiper = this;
7114 Utils.extend(swiper, {
7115 history: {
7116 init: History.init.bind(swiper),
7117 setHistory: History.setHistory.bind(swiper),
7118 setHistoryPopState: History.setHistoryPopState.bind(swiper),
7119 scrollToSlide: History.scrollToSlide.bind(swiper),
7120 destroy: History.destroy.bind(swiper),
7121 },
7122 });
7123 },
7124 on: {
7125 init: function init() {
7126 var swiper = this;
7127 if (swiper.params.history.enabled) {
7128 swiper.history.init();
7129 }
7130 },
7131 destroy: function destroy() {
7132 var swiper = this;
7133 if (swiper.params.history.enabled) {
7134 swiper.history.destroy();
7135 }
7136 },
7137 transitionEnd: function transitionEnd() {
7138 var swiper = this;
7139 if (swiper.history.initialized) {
7140 swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex);
7141 }
7142 },
7143 },
7144 };
7145
7146 var HashNavigation = {
7147 onHashCange: function onHashCange() {
7148 var swiper = this;
7149 var newHash = doc.location.hash.replace('#', '');
7150 var activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash');
7151 if (newHash !== activeSlideHash) {
7152 var newIndex = swiper.$wrapperEl.children(("." + (swiper.params.slideClass) + "[data-hash=\"" + newHash + "\"]")).index();
7153 if (typeof newIndex === 'undefined') { return; }
7154 swiper.slideTo(newIndex);
7155 }
7156 },
7157 setHash: function setHash() {
7158 var swiper = this;
7159 if (!swiper.hashNavigation.initialized || !swiper.params.hashNavigation.enabled) { return; }
7160 if (swiper.params.hashNavigation.replaceState && win.history && win.history.replaceState) {
7161 win.history.replaceState(null, null, (("#" + (swiper.slides.eq(swiper.activeIndex).attr('data-hash'))) || ''));
7162 } else {
7163 var slide = swiper.slides.eq(swiper.activeIndex);
7164 var hash = slide.attr('data-hash') || slide.attr('data-history');
7165 doc.location.hash = hash || '';
7166 }
7167 },
7168 init: function init() {
7169 var swiper = this;
7170 if (!swiper.params.hashNavigation.enabled || (swiper.params.history && swiper.params.history.enabled)) { return; }
7171 swiper.hashNavigation.initialized = true;
7172 var hash = doc.location.hash.replace('#', '');
7173 if (hash) {
7174 var speed = 0;
7175 for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
7176 var slide = swiper.slides.eq(i);
7177 var slideHash = slide.attr('data-hash') || slide.attr('data-history');
7178 if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) {
7179 var index = slide.index();
7180 swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true);
7181 }
7182 }
7183 }
7184 if (swiper.params.hashNavigation.watchState) {
7185 $(win).on('hashchange', swiper.hashNavigation.onHashCange);
7186 }
7187 },
7188 destroy: function destroy() {
7189 var swiper = this;
7190 if (swiper.params.hashNavigation.watchState) {
7191 $(win).off('hashchange', swiper.hashNavigation.onHashCange);
7192 }
7193 },
7194 };
7195 var HashNavigation$1 = {
7196 name: 'hash-navigation',
7197 params: {
7198 hashNavigation: {
7199 enabled: false,
7200 replaceState: false,
7201 watchState: false,
7202 },
7203 },
7204 create: function create() {
7205 var swiper = this;
7206 Utils.extend(swiper, {
7207 hashNavigation: {
7208 initialized: false,
7209 init: HashNavigation.init.bind(swiper),
7210 destroy: HashNavigation.destroy.bind(swiper),
7211 setHash: HashNavigation.setHash.bind(swiper),
7212 onHashCange: HashNavigation.onHashCange.bind(swiper),
7213 },
7214 });
7215 },
7216 on: {
7217 init: function init() {
7218 var swiper = this;
7219 if (swiper.params.hashNavigation.enabled) {
7220 swiper.hashNavigation.init();
7221 }
7222 },
7223 destroy: function destroy() {
7224 var swiper = this;
7225 if (swiper.params.hashNavigation.enabled) {
7226 swiper.hashNavigation.destroy();
7227 }
7228 },
7229 transitionEnd: function transitionEnd() {
7230 var swiper = this;
7231 if (swiper.hashNavigation.initialized) {
7232 swiper.hashNavigation.setHash();
7233 }
7234 },
7235 },
7236 };
7237
7238 /* eslint no-underscore-dangle: "off" */
7239
7240 var Autoplay = {
7241 run: function run() {
7242 var swiper = this;
7243 var $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
7244 var delay = swiper.params.autoplay.delay;
7245 if ($activeSlideEl.attr('data-swiper-autoplay')) {
7246 delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
7247 }
7248 swiper.autoplay.timeout = Utils.nextTick(function () {
7249 if (swiper.params.autoplay.reverseDirection) {
7250 if (swiper.params.loop) {
7251 swiper.loopFix();
7252 swiper.slidePrev(swiper.params.speed, true, true);
7253 swiper.emit('autoplay');
7254 } else if (!swiper.isBeginning) {
7255 swiper.slidePrev(swiper.params.speed, true, true);
7256 swiper.emit('autoplay');
7257 } else if (!swiper.params.autoplay.stopOnLastSlide) {
7258 swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
7259 swiper.emit('autoplay');
7260 } else {
7261 swiper.autoplay.stop();
7262 }
7263 } else if (swiper.params.loop) {
7264 swiper.loopFix();
7265 swiper.slideNext(swiper.params.speed, true, true);
7266 swiper.emit('autoplay');
7267 } else if (!swiper.isEnd) {
7268 swiper.slideNext(swiper.params.speed, true, true);
7269 swiper.emit('autoplay');
7270 } else if (!swiper.params.autoplay.stopOnLastSlide) {
7271 swiper.slideTo(0, swiper.params.speed, true, true);
7272 swiper.emit('autoplay');
7273 } else {
7274 swiper.autoplay.stop();
7275 }
7276 }, delay);
7277 },
7278 start: function start() {
7279 var swiper = this;
7280 if (typeof swiper.autoplay.timeout !== 'undefined') { return false; }
7281 if (swiper.autoplay.running) { return false; }
7282 swiper.autoplay.running = true;
7283 swiper.emit('autoplayStart');
7284 swiper.autoplay.run();
7285 return true;
7286 },
7287 stop: function stop() {
7288 var swiper = this;
7289 if (!swiper.autoplay.running) { return false; }
7290 if (typeof swiper.autoplay.timeout === 'undefined') { return false; }
7291
7292 if (swiper.autoplay.timeout) {
7293 clearTimeout(swiper.autoplay.timeout);
7294 swiper.autoplay.timeout = undefined;
7295 }
7296 swiper.autoplay.running = false;
7297 swiper.emit('autoplayStop');
7298 return true;
7299 },
7300 pause: function pause(speed) {
7301 var swiper = this;
7302 if (!swiper.autoplay.running) { return; }
7303 if (swiper.autoplay.paused) { return; }
7304 if (swiper.autoplay.timeout) { clearTimeout(swiper.autoplay.timeout); }
7305 swiper.autoplay.paused = true;
7306 if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
7307 swiper.autoplay.paused = false;
7308 swiper.autoplay.run();
7309 } else {
7310 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.autoplay.onTransitionEnd);
7311 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd);
7312 }
7313 },
7314 };
7315
7316 var Autoplay$1 = {
7317 name: 'autoplay',
7318 params: {
7319 autoplay: {
7320 enabled: false,
7321 delay: 3000,
7322 waitForTransition: true,
7323 disableOnInteraction: true,
7324 stopOnLastSlide: false,
7325 reverseDirection: false,
7326 },
7327 },
7328 create: function create() {
7329 var swiper = this;
7330 Utils.extend(swiper, {
7331 autoplay: {
7332 running: false,
7333 paused: false,
7334 run: Autoplay.run.bind(swiper),
7335 start: Autoplay.start.bind(swiper),
7336 stop: Autoplay.stop.bind(swiper),
7337 pause: Autoplay.pause.bind(swiper),
7338 onTransitionEnd: function onTransitionEnd(e) {
7339 if (!swiper || swiper.destroyed || !swiper.$wrapperEl) { return; }
7340 if (e.target !== this) { return; }
7341 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.autoplay.onTransitionEnd);
7342 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd);
7343 swiper.autoplay.paused = false;
7344 if (!swiper.autoplay.running) {
7345 swiper.autoplay.stop();
7346 } else {
7347 swiper.autoplay.run();
7348 }
7349 },
7350 },
7351 });
7352 },
7353 on: {
7354 init: function init() {
7355 var swiper = this;
7356 if (swiper.params.autoplay.enabled) {
7357 swiper.autoplay.start();
7358 }
7359 },
7360 beforeTransitionStart: function beforeTransitionStart(speed, internal) {
7361 var swiper = this;
7362 if (swiper.autoplay.running) {
7363 if (internal || !swiper.params.autoplay.disableOnInteraction) {
7364 swiper.autoplay.pause(speed);
7365 } else {
7366 swiper.autoplay.stop();
7367 }
7368 }
7369 },
7370 sliderFirstMove: function sliderFirstMove() {
7371 var swiper = this;
7372 if (swiper.autoplay.running) {
7373 if (swiper.params.autoplay.disableOnInteraction) {
7374 swiper.autoplay.stop();
7375 } else {
7376 swiper.autoplay.pause();
7377 }
7378 }
7379 },
7380 destroy: function destroy() {
7381 var swiper = this;
7382 if (swiper.autoplay.running) {
7383 swiper.autoplay.stop();
7384 }
7385 },
7386 },
7387 };
7388
7389 var Fade = {
7390 setTranslate: function setTranslate() {
7391 var swiper = this;
7392 var slides = swiper.slides;
7393 for (var i = 0; i < slides.length; i += 1) {
7394 var $slideEl = swiper.slides.eq(i);
7395 var offset = $slideEl[0].swiperSlideOffset;
7396 var tx = -offset;
7397 if (!swiper.params.virtualTranslate) { tx -= swiper.translate; }
7398 var ty = 0;
7399 if (!swiper.isHorizontal()) {
7400 ty = tx;
7401 tx = 0;
7402 }
7403 var slideOpacity = swiper.params.fadeEffect.crossFade
7404 ? Math.max(1 - Math.abs($slideEl[0].progress), 0)
7405 : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0);
7406 $slideEl
7407 .css({
7408 opacity: slideOpacity,
7409 })
7410 .transform(("translate3d(" + tx + "px, " + ty + "px, 0px)"));
7411 }
7412 },
7413 setTransition: function setTransition(duration) {
7414 var swiper = this;
7415 var slides = swiper.slides;
7416 var $wrapperEl = swiper.$wrapperEl;
7417 slides.transition(duration);
7418 if (swiper.params.virtualTranslate && duration !== 0) {
7419 var eventTriggered = false;
7420 slides.transitionEnd(function () {
7421 if (eventTriggered) { return; }
7422 if (!swiper || swiper.destroyed) { return; }
7423 eventTriggered = true;
7424 swiper.animating = false;
7425 var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
7426 for (var i = 0; i < triggerEvents.length; i += 1) {
7427 $wrapperEl.trigger(triggerEvents[i]);
7428 }
7429 });
7430 }
7431 },
7432 };
7433
7434 var EffectFade = {
7435 name: 'effect-fade',
7436 params: {
7437 fadeEffect: {
7438 crossFade: false,
7439 },
7440 },
7441 create: function create() {
7442 var swiper = this;
7443 Utils.extend(swiper, {
7444 fadeEffect: {
7445 setTranslate: Fade.setTranslate.bind(swiper),
7446 setTransition: Fade.setTransition.bind(swiper),
7447 },
7448 });
7449 },
7450 on: {
7451 beforeInit: function beforeInit() {
7452 var swiper = this;
7453 if (swiper.params.effect !== 'fade') { return; }
7454 swiper.classNames.push(((swiper.params.containerModifierClass) + "fade"));
7455 var overwriteParams = {
7456 slidesPerView: 1,
7457 slidesPerColumn: 1,
7458 slidesPerGroup: 1,
7459 watchSlidesProgress: true,
7460 spaceBetween: 0,
7461 virtualTranslate: true,
7462 };
7463 Utils.extend(swiper.params, overwriteParams);
7464 Utils.extend(swiper.originalParams, overwriteParams);
7465 },
7466 setTranslate: function setTranslate() {
7467 var swiper = this;
7468 if (swiper.params.effect !== 'fade') { return; }
7469 swiper.fadeEffect.setTranslate();
7470 },
7471 setTransition: function setTransition(duration) {
7472 var swiper = this;
7473 if (swiper.params.effect !== 'fade') { return; }
7474 swiper.fadeEffect.setTransition(duration);
7475 },
7476 },
7477 };
7478
7479 var Cube = {
7480 setTranslate: function setTranslate() {
7481 var swiper = this;
7482 var $el = swiper.$el;
7483 var $wrapperEl = swiper.$wrapperEl;
7484 var slides = swiper.slides;
7485 var swiperWidth = swiper.width;
7486 var swiperHeight = swiper.height;
7487 var rtl = swiper.rtlTranslate;
7488 var swiperSize = swiper.size;
7489 var params = swiper.params.cubeEffect;
7490 var isHorizontal = swiper.isHorizontal();
7491 var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
7492 var wrapperRotate = 0;
7493 var $cubeShadowEl;
7494 if (params.shadow) {
7495 if (isHorizontal) {
7496 $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow');
7497 if ($cubeShadowEl.length === 0) {
7498 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
7499 $wrapperEl.append($cubeShadowEl);
7500 }
7501 $cubeShadowEl.css({ height: (swiperWidth + "px") });
7502 } else {
7503 $cubeShadowEl = $el.find('.swiper-cube-shadow');
7504 if ($cubeShadowEl.length === 0) {
7505 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
7506 $el.append($cubeShadowEl);
7507 }
7508 }
7509 }
7510 for (var i = 0; i < slides.length; i += 1) {
7511 var $slideEl = slides.eq(i);
7512 var slideIndex = i;
7513 if (isVirtual) {
7514 slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10);
7515 }
7516 var slideAngle = slideIndex * 90;
7517 var round = Math.floor(slideAngle / 360);
7518 if (rtl) {
7519 slideAngle = -slideAngle;
7520 round = Math.floor(-slideAngle / 360);
7521 }
7522 var progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
7523 var tx = 0;
7524 var ty = 0;
7525 var tz = 0;
7526 if (slideIndex % 4 === 0) {
7527 tx = -round * 4 * swiperSize;
7528 tz = 0;
7529 } else if ((slideIndex - 1) % 4 === 0) {
7530 tx = 0;
7531 tz = -round * 4 * swiperSize;
7532 } else if ((slideIndex - 2) % 4 === 0) {
7533 tx = swiperSize + (round * 4 * swiperSize);
7534 tz = swiperSize;
7535 } else if ((slideIndex - 3) % 4 === 0) {
7536 tx = -swiperSize;
7537 tz = (3 * swiperSize) + (swiperSize * 4 * round);
7538 }
7539 if (rtl) {
7540 tx = -tx;
7541 }
7542
7543 if (!isHorizontal) {
7544 ty = tx;
7545 tx = 0;
7546 }
7547
7548 var transform = "rotateX(" + (isHorizontal ? 0 : -slideAngle) + "deg) rotateY(" + (isHorizontal ? slideAngle : 0) + "deg) translate3d(" + tx + "px, " + ty + "px, " + tz + "px)";
7549 if (progress <= 1 && progress > -1) {
7550 wrapperRotate = (slideIndex * 90) + (progress * 90);
7551 if (rtl) { wrapperRotate = (-slideIndex * 90) - (progress * 90); }
7552 }
7553 $slideEl.transform(transform);
7554 if (params.slideShadows) {
7555 // Set shadows
7556 var shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
7557 var shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
7558 if (shadowBefore.length === 0) {
7559 shadowBefore = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>"));
7560 $slideEl.append(shadowBefore);
7561 }
7562 if (shadowAfter.length === 0) {
7563 shadowAfter = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>"));
7564 $slideEl.append(shadowAfter);
7565 }
7566 if (shadowBefore.length) { shadowBefore[0].style.opacity = Math.max(-progress, 0); }
7567 if (shadowAfter.length) { shadowAfter[0].style.opacity = Math.max(progress, 0); }
7568 }
7569 }
7570 $wrapperEl.css({
7571 '-webkit-transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"),
7572 '-moz-transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"),
7573 '-ms-transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"),
7574 'transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"),
7575 });
7576
7577 if (params.shadow) {
7578 if (isHorizontal) {
7579 $cubeShadowEl.transform(("translate3d(0px, " + ((swiperWidth / 2) + params.shadowOffset) + "px, " + (-swiperWidth / 2) + "px) rotateX(90deg) rotateZ(0deg) scale(" + (params.shadowScale) + ")"));
7580 } else {
7581 var shadowAngle = Math.abs(wrapperRotate) - (Math.floor(Math.abs(wrapperRotate) / 90) * 90);
7582 var multiplier = 1.5 - (
7583 (Math.sin((shadowAngle * 2 * Math.PI) / 360) / 2)
7584 + (Math.cos((shadowAngle * 2 * Math.PI) / 360) / 2)
7585 );
7586 var scale1 = params.shadowScale;
7587 var scale2 = params.shadowScale / multiplier;
7588 var offset = params.shadowOffset;
7589 $cubeShadowEl.transform(("scale3d(" + scale1 + ", 1, " + scale2 + ") translate3d(0px, " + ((swiperHeight / 2) + offset) + "px, " + (-swiperHeight / 2 / scale2) + "px) rotateX(-90deg)"));
7590 }
7591 }
7592 var zFactor = (Browser.isSafari || Browser.isUiWebView) ? (-swiperSize / 2) : 0;
7593 $wrapperEl
7594 .transform(("translate3d(0px,0," + zFactor + "px) rotateX(" + (swiper.isHorizontal() ? 0 : wrapperRotate) + "deg) rotateY(" + (swiper.isHorizontal() ? -wrapperRotate : 0) + "deg)"));
7595 },
7596 setTransition: function setTransition(duration) {
7597 var swiper = this;
7598 var $el = swiper.$el;
7599 var slides = swiper.slides;
7600 slides
7601 .transition(duration)
7602 .find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
7603 .transition(duration);
7604 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
7605 $el.find('.swiper-cube-shadow').transition(duration);
7606 }
7607 },
7608 };
7609
7610 var EffectCube = {
7611 name: 'effect-cube',
7612 params: {
7613 cubeEffect: {
7614 slideShadows: true,
7615 shadow: true,
7616 shadowOffset: 20,
7617 shadowScale: 0.94,
7618 },
7619 },
7620 create: function create() {
7621 var swiper = this;
7622 Utils.extend(swiper, {
7623 cubeEffect: {
7624 setTranslate: Cube.setTranslate.bind(swiper),
7625 setTransition: Cube.setTransition.bind(swiper),
7626 },
7627 });
7628 },
7629 on: {
7630 beforeInit: function beforeInit() {
7631 var swiper = this;
7632 if (swiper.params.effect !== 'cube') { return; }
7633 swiper.classNames.push(((swiper.params.containerModifierClass) + "cube"));
7634 swiper.classNames.push(((swiper.params.containerModifierClass) + "3d"));
7635 var overwriteParams = {
7636 slidesPerView: 1,
7637 slidesPerColumn: 1,
7638 slidesPerGroup: 1,
7639 watchSlidesProgress: true,
7640 resistanceRatio: 0,
7641 spaceBetween: 0,
7642 centeredSlides: false,
7643 virtualTranslate: true,
7644 };
7645 Utils.extend(swiper.params, overwriteParams);
7646 Utils.extend(swiper.originalParams, overwriteParams);
7647 },
7648 setTranslate: function setTranslate() {
7649 var swiper = this;
7650 if (swiper.params.effect !== 'cube') { return; }
7651 swiper.cubeEffect.setTranslate();
7652 },
7653 setTransition: function setTransition(duration) {
7654 var swiper = this;
7655 if (swiper.params.effect !== 'cube') { return; }
7656 swiper.cubeEffect.setTransition(duration);
7657 },
7658 },
7659 };
7660
7661 var Flip = {
7662 setTranslate: function setTranslate() {
7663 var swiper = this;
7664 var slides = swiper.slides;
7665 var rtl = swiper.rtlTranslate;
7666 for (var i = 0; i < slides.length; i += 1) {
7667 var $slideEl = slides.eq(i);
7668 var progress = $slideEl[0].progress;
7669 if (swiper.params.flipEffect.limitRotation) {
7670 progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
7671 }
7672 var offset = $slideEl[0].swiperSlideOffset;
7673 var rotate = -180 * progress;
7674 var rotateY = rotate;
7675 var rotateX = 0;
7676 var tx = -offset;
7677 var ty = 0;
7678 if (!swiper.isHorizontal()) {
7679 ty = tx;
7680 tx = 0;
7681 rotateX = -rotateY;
7682 rotateY = 0;
7683 } else if (rtl) {
7684 rotateY = -rotateY;
7685 }
7686
7687 $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
7688
7689 if (swiper.params.flipEffect.slideShadows) {
7690 // Set shadows
7691 var shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
7692 var shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
7693 if (shadowBefore.length === 0) {
7694 shadowBefore = $(("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'left' : 'top') + "\"></div>"));
7695 $slideEl.append(shadowBefore);
7696 }
7697 if (shadowAfter.length === 0) {
7698 shadowAfter = $(("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'right' : 'bottom') + "\"></div>"));
7699 $slideEl.append(shadowAfter);
7700 }
7701 if (shadowBefore.length) { shadowBefore[0].style.opacity = Math.max(-progress, 0); }
7702 if (shadowAfter.length) { shadowAfter[0].style.opacity = Math.max(progress, 0); }
7703 }
7704 $slideEl
7705 .transform(("translate3d(" + tx + "px, " + ty + "px, 0px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg)"));
7706 }
7707 },
7708 setTransition: function setTransition(duration) {
7709 var swiper = this;
7710 var slides = swiper.slides;
7711 var activeIndex = swiper.activeIndex;
7712 var $wrapperEl = swiper.$wrapperEl;
7713 slides
7714 .transition(duration)
7715 .find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
7716 .transition(duration);
7717 if (swiper.params.virtualTranslate && duration !== 0) {
7718 var eventTriggered = false;
7719 // eslint-disable-next-line
7720 slides.eq(activeIndex).transitionEnd(function onTransitionEnd() {
7721 if (eventTriggered) { return; }
7722 if (!swiper || swiper.destroyed) { return; }
7723 // if (!$(this).hasClass(swiper.params.slideActiveClass)) return;
7724 eventTriggered = true;
7725 swiper.animating = false;
7726 var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
7727 for (var i = 0; i < triggerEvents.length; i += 1) {
7728 $wrapperEl.trigger(triggerEvents[i]);
7729 }
7730 });
7731 }
7732 },
7733 };
7734
7735 var EffectFlip = {
7736 name: 'effect-flip',
7737 params: {
7738 flipEffect: {
7739 slideShadows: true,
7740 limitRotation: true,
7741 },
7742 },
7743 create: function create() {
7744 var swiper = this;
7745 Utils.extend(swiper, {
7746 flipEffect: {
7747 setTranslate: Flip.setTranslate.bind(swiper),
7748 setTransition: Flip.setTransition.bind(swiper),
7749 },
7750 });
7751 },
7752 on: {
7753 beforeInit: function beforeInit() {
7754 var swiper = this;
7755 if (swiper.params.effect !== 'flip') { return; }
7756 swiper.classNames.push(((swiper.params.containerModifierClass) + "flip"));
7757 swiper.classNames.push(((swiper.params.containerModifierClass) + "3d"));
7758 var overwriteParams = {
7759 slidesPerView: 1,
7760 slidesPerColumn: 1,
7761 slidesPerGroup: 1,
7762 watchSlidesProgress: true,
7763 spaceBetween: 0,
7764 virtualTranslate: true,
7765 };
7766 Utils.extend(swiper.params, overwriteParams);
7767 Utils.extend(swiper.originalParams, overwriteParams);
7768 },
7769 setTranslate: function setTranslate() {
7770 var swiper = this;
7771 if (swiper.params.effect !== 'flip') { return; }
7772 swiper.flipEffect.setTranslate();
7773 },
7774 setTransition: function setTransition(duration) {
7775 var swiper = this;
7776 if (swiper.params.effect !== 'flip') { return; }
7777 swiper.flipEffect.setTransition(duration);
7778 },
7779 },
7780 };
7781
7782 var Coverflow = {
7783 setTranslate: function setTranslate() {
7784 var swiper = this;
7785 var swiperWidth = swiper.width;
7786 var swiperHeight = swiper.height;
7787 var slides = swiper.slides;
7788 var $wrapperEl = swiper.$wrapperEl;
7789 var slidesSizesGrid = swiper.slidesSizesGrid;
7790 var params = swiper.params.coverflowEffect;
7791 var isHorizontal = swiper.isHorizontal();
7792 var transform = swiper.translate;
7793 var center = isHorizontal ? -transform + (swiperWidth / 2) : -transform + (swiperHeight / 2);
7794 var rotate = isHorizontal ? params.rotate : -params.rotate;
7795 var translate = params.depth;
7796 // Each slide offset from center
7797 for (var i = 0, length = slides.length; i < length; i += 1) {
7798 var $slideEl = slides.eq(i);
7799 var slideSize = slidesSizesGrid[i];
7800 var slideOffset = $slideEl[0].swiperSlideOffset;
7801 var offsetMultiplier = ((center - slideOffset - (slideSize / 2)) / slideSize) * params.modifier;
7802
7803 var rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
7804 var rotateX = isHorizontal ? 0 : rotate * offsetMultiplier;
7805 // var rotateZ = 0
7806 var translateZ = -translate * Math.abs(offsetMultiplier);
7807
7808 var translateY = isHorizontal ? 0 : params.stretch * (offsetMultiplier);
7809 var translateX = isHorizontal ? params.stretch * (offsetMultiplier) : 0;
7810
7811 // Fix for ultra small values
7812 if (Math.abs(translateX) < 0.001) { translateX = 0; }
7813 if (Math.abs(translateY) < 0.001) { translateY = 0; }
7814 if (Math.abs(translateZ) < 0.001) { translateZ = 0; }
7815 if (Math.abs(rotateY) < 0.001) { rotateY = 0; }
7816 if (Math.abs(rotateX) < 0.001) { rotateX = 0; }
7817
7818 var slideTransform = "translate3d(" + translateX + "px," + translateY + "px," + translateZ + "px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg)";
7819
7820 $slideEl.transform(slideTransform);
7821 $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
7822 if (params.slideShadows) {
7823 // Set shadows
7824 var $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
7825 var $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
7826 if ($shadowBeforeEl.length === 0) {
7827 $shadowBeforeEl = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>"));
7828 $slideEl.append($shadowBeforeEl);
7829 }
7830 if ($shadowAfterEl.length === 0) {
7831 $shadowAfterEl = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>"));
7832 $slideEl.append($shadowAfterEl);
7833 }
7834 if ($shadowBeforeEl.length) { $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; }
7835 if ($shadowAfterEl.length) { $shadowAfterEl[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0; }
7836 }
7837 }
7838
7839 // Set correct perspective for IE10
7840 if (Support.pointerEvents || Support.prefixedPointerEvents) {
7841 var ws = $wrapperEl[0].style;
7842 ws.perspectiveOrigin = center + "px 50%";
7843 }
7844 },
7845 setTransition: function setTransition(duration) {
7846 var swiper = this;
7847 swiper.slides
7848 .transition(duration)
7849 .find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
7850 .transition(duration);
7851 },
7852 };
7853
7854 var EffectCoverflow = {
7855 name: 'effect-coverflow',
7856 params: {
7857 coverflowEffect: {
7858 rotate: 50,
7859 stretch: 0,
7860 depth: 100,
7861 modifier: 1,
7862 slideShadows: true,
7863 },
7864 },
7865 create: function create() {
7866 var swiper = this;
7867 Utils.extend(swiper, {
7868 coverflowEffect: {
7869 setTranslate: Coverflow.setTranslate.bind(swiper),
7870 setTransition: Coverflow.setTransition.bind(swiper),
7871 },
7872 });
7873 },
7874 on: {
7875 beforeInit: function beforeInit() {
7876 var swiper = this;
7877 if (swiper.params.effect !== 'coverflow') { return; }
7878
7879 swiper.classNames.push(((swiper.params.containerModifierClass) + "coverflow"));
7880 swiper.classNames.push(((swiper.params.containerModifierClass) + "3d"));
7881
7882 swiper.params.watchSlidesProgress = true;
7883 swiper.originalParams.watchSlidesProgress = true;
7884 },
7885 setTranslate: function setTranslate() {
7886 var swiper = this;
7887 if (swiper.params.effect !== 'coverflow') { return; }
7888 swiper.coverflowEffect.setTranslate();
7889 },
7890 setTransition: function setTransition(duration) {
7891 var swiper = this;
7892 if (swiper.params.effect !== 'coverflow') { return; }
7893 swiper.coverflowEffect.setTransition(duration);
7894 },
7895 },
7896 };
7897
7898 var Thumbs = {
7899 init: function init() {
7900 var swiper = this;
7901 var ref = swiper.params;
7902 var thumbsParams = ref.thumbs;
7903 var SwiperClass = swiper.constructor;
7904 if (thumbsParams.swiper instanceof SwiperClass) {
7905 swiper.thumbs.swiper = thumbsParams.swiper;
7906 Utils.extend(swiper.thumbs.swiper.originalParams, {
7907 watchSlidesProgress: true,
7908 slideToClickedSlide: false,
7909 });
7910 Utils.extend(swiper.thumbs.swiper.params, {
7911 watchSlidesProgress: true,
7912 slideToClickedSlide: false,
7913 });
7914 } else if (Utils.isObject(thumbsParams.swiper)) {
7915 swiper.thumbs.swiper = new SwiperClass(Utils.extend({}, thumbsParams.swiper, {
7916 watchSlidesVisibility: true,
7917 watchSlidesProgress: true,
7918 slideToClickedSlide: false,
7919 }));
7920 swiper.thumbs.swiperCreated = true;
7921 }
7922 swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass);
7923 swiper.thumbs.swiper.on('tap', swiper.thumbs.onThumbClick);
7924 },
7925 onThumbClick: function onThumbClick() {
7926 var swiper = this;
7927 var thumbsSwiper = swiper.thumbs.swiper;
7928 if (!thumbsSwiper) { return; }
7929 var clickedIndex = thumbsSwiper.clickedIndex;
7930 var clickedSlide = thumbsSwiper.clickedSlide;
7931 if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) { return; }
7932 if (typeof clickedIndex === 'undefined' || clickedIndex === null) { return; }
7933 var slideToIndex;
7934 if (thumbsSwiper.params.loop) {
7935 slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10);
7936 } else {
7937 slideToIndex = clickedIndex;
7938 }
7939 if (swiper.params.loop) {
7940 var currentIndex = swiper.activeIndex;
7941 if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) {
7942 swiper.loopFix();
7943 // eslint-disable-next-line
7944 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
7945 currentIndex = swiper.activeIndex;
7946 }
7947 var prevIndex = swiper.slides.eq(currentIndex).prevAll(("[data-swiper-slide-index=\"" + slideToIndex + "\"]")).eq(0).index();
7948 var nextIndex = swiper.slides.eq(currentIndex).nextAll(("[data-swiper-slide-index=\"" + slideToIndex + "\"]")).eq(0).index();
7949 if (typeof prevIndex === 'undefined') { slideToIndex = nextIndex; }
7950 else if (typeof nextIndex === 'undefined') { slideToIndex = prevIndex; }
7951 else if (nextIndex - currentIndex < currentIndex - prevIndex) { slideToIndex = nextIndex; }
7952 else { slideToIndex = prevIndex; }
7953 }
7954 swiper.slideTo(slideToIndex);
7955 },
7956 update: function update(initial) {
7957 var swiper = this;
7958 var thumbsSwiper = swiper.thumbs.swiper;
7959 if (!thumbsSwiper) { return; }
7960
7961 var slidesPerView = thumbsSwiper.params.slidesPerView === 'auto'
7962 ? thumbsSwiper.slidesPerViewDynamic()
7963 : thumbsSwiper.params.slidesPerView;
7964
7965 if (swiper.realIndex !== thumbsSwiper.realIndex) {
7966 var currentThumbsIndex = thumbsSwiper.activeIndex;
7967 var newThumbsIndex;
7968 if (thumbsSwiper.params.loop) {
7969 if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) {
7970 thumbsSwiper.loopFix();
7971 // eslint-disable-next-line
7972 thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft;
7973 currentThumbsIndex = thumbsSwiper.activeIndex;
7974 }
7975 // Find actual thumbs index to slide to
7976 var prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(("[data-swiper-slide-index=\"" + (swiper.realIndex) + "\"]")).eq(0).index();
7977 var nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(("[data-swiper-slide-index=\"" + (swiper.realIndex) + "\"]")).eq(0).index();
7978 if (typeof prevThumbsIndex === 'undefined') { newThumbsIndex = nextThumbsIndex; }
7979 else if (typeof nextThumbsIndex === 'undefined') { newThumbsIndex = prevThumbsIndex; }
7980 else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = currentThumbsIndex; }
7981 else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = nextThumbsIndex; }
7982 else { newThumbsIndex = prevThumbsIndex; }
7983 } else {
7984 newThumbsIndex = swiper.realIndex;
7985 }
7986 if (thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
7987 if (thumbsSwiper.params.centeredSlides) {
7988 if (newThumbsIndex > currentThumbsIndex) {
7989 newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
7990 } else {
7991 newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
7992 }
7993 } else if (newThumbsIndex > currentThumbsIndex) {
7994 newThumbsIndex = newThumbsIndex - slidesPerView + 1;
7995 }
7996 thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
7997 }
7998 }
7999
8000 // Activate thumbs
8001 var thumbsToActivate = 1;
8002 var thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
8003
8004 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
8005 thumbsToActivate = swiper.params.slidesPerView;
8006 }
8007
8008 thumbsSwiper.slides.removeClass(thumbActiveClass);
8009 if (thumbsSwiper.params.loop) {
8010 for (var i = 0; i < thumbsToActivate; i += 1) {
8011 thumbsSwiper.$wrapperEl.children(("[data-swiper-slide-index=\"" + (swiper.realIndex + i) + "\"]")).addClass(thumbActiveClass);
8012 }
8013 } else {
8014 for (var i$1 = 0; i$1 < thumbsToActivate; i$1 += 1) {
8015 thumbsSwiper.slides.eq(swiper.realIndex + i$1).addClass(thumbActiveClass);
8016 }
8017 }
8018 },
8019 };
8020 var Thumbs$1 = {
8021 name: 'thumbs',
8022 params: {
8023 thumbs: {
8024 swiper: null,
8025 slideThumbActiveClass: 'swiper-slide-thumb-active',
8026 thumbsContainerClass: 'swiper-container-thumbs',
8027 },
8028 },
8029 create: function create() {
8030 var swiper = this;
8031 Utils.extend(swiper, {
8032 thumbs: {
8033 swiper: null,
8034 init: Thumbs.init.bind(swiper),
8035 update: Thumbs.update.bind(swiper),
8036 onThumbClick: Thumbs.onThumbClick.bind(swiper),
8037 },
8038 });
8039 },
8040 on: {
8041 beforeInit: function beforeInit() {
8042 var swiper = this;
8043 var ref = swiper.params;
8044 var thumbs = ref.thumbs;
8045 if (!thumbs || !thumbs.swiper) { return; }
8046 swiper.thumbs.init();
8047 swiper.thumbs.update(true);
8048 },
8049 slideChange: function slideChange() {
8050 var swiper = this;
8051 if (!swiper.thumbs.swiper) { return; }
8052 swiper.thumbs.update();
8053 },
8054 update: function update() {
8055 var swiper = this;
8056 if (!swiper.thumbs.swiper) { return; }
8057 swiper.thumbs.update();
8058 },
8059 resize: function resize() {
8060 var swiper = this;
8061 if (!swiper.thumbs.swiper) { return; }
8062 swiper.thumbs.update();
8063 },
8064 observerUpdate: function observerUpdate() {
8065 var swiper = this;
8066 if (!swiper.thumbs.swiper) { return; }
8067 swiper.thumbs.update();
8068 },
8069 setTransition: function setTransition(duration) {
8070 var swiper = this;
8071 var thumbsSwiper = swiper.thumbs.swiper;
8072 if (!thumbsSwiper) { return; }
8073 thumbsSwiper.setTransition(duration);
8074 },
8075 beforeDestroy: function beforeDestroy() {
8076 var swiper = this;
8077 var thumbsSwiper = swiper.thumbs.swiper;
8078 if (!thumbsSwiper) { return; }
8079 if (swiper.thumbs.swiperCreated && thumbsSwiper) {
8080 thumbsSwiper.destroy();
8081 }
8082 },
8083 },
8084 };
8085
8086 // Swiper Class
8087
8088 var components = [
8089 Device$1,
8090 Support$1,
8091 Browser$1,
8092 Resize,
8093 Observer$1,
8094 Virtual$1,
8095 Keyboard$1,
8096 Mousewheel$1,
8097 Navigation$1,
8098 Pagination$1,
8099 Scrollbar$1,
8100 Parallax$1,
8101 Zoom$1,
8102 Lazy$1,
8103 Controller$1,
8104 A11y,
8105 History$1,
8106 HashNavigation$1,
8107 Autoplay$1,
8108 EffectFade,
8109 EffectCube,
8110 EffectFlip,
8111 EffectCoverflow,
8112 Thumbs$1
8113 ];
8114
8115 if (typeof Swiper.use === 'undefined') {
8116 Swiper.use = Swiper.Class.use;
8117 Swiper.installModule = Swiper.Class.installModule;
8118 }
8119
8120 Swiper.use(components);
8121
8122 return Swiper;
8123
8124 }));
8125