@salla.sa/twilight-components 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/cjs/Helper-8ae6a805.js +28 -0
  2. package/dist/cjs/arrow-right-3d137e4c.js +13 -0
  3. package/dist/cjs/cancel-ae668d91.js +13 -0
  4. package/dist/cjs/check-circle2-1aac98d1.js +13 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/mail-2db058ee.js +13 -0
  7. package/dist/cjs/salla-add-product-button_13.cjs.entry.js +2870 -0
  8. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +93 -0
  9. package/dist/cjs/salla-list-tile_2.cjs.entry.js +80 -0
  10. package/dist/cjs/salla-loyalty.cjs.entry.js +229 -0
  11. package/dist/cjs/salla-product-size-guide.cjs.entry.js +52 -0
  12. package/dist/cjs/salla-quantity-input.cjs.entry.js +101 -0
  13. package/dist/cjs/salla-rating-modal.cjs.entry.js +169 -0
  14. package/dist/cjs/salla-social-share.cjs.entry.js +1447 -0
  15. package/dist/cjs/salla-swiper.cjs.entry.js +5023 -0
  16. package/dist/cjs/salla-tab-content_3.cjs.entry.js +159 -0
  17. package/dist/cjs/star2-8288e6e1.js +13 -0
  18. package/dist/cjs/twilight-components.cjs.js +1 -1
  19. package/dist/collection/components/salla-login-modal/salla-login-modal.js +4 -3
  20. package/dist/components/salla-login-modal.js +4 -3
  21. package/dist/esm/Helper-e1d414a5.js +26 -0
  22. package/dist/esm/arrow-right-1c3e04f2.js +11 -0
  23. package/dist/esm/cancel-41a92070.js +11 -0
  24. package/dist/esm/check-circle2-f6e5f685.js +11 -0
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/mail-9d5204c6.js +11 -0
  27. package/dist/esm/salla-add-product-button_13.entry.js +2854 -0
  28. package/dist/esm/salla-infinite-scroll.entry.js +89 -0
  29. package/dist/esm/salla-list-tile_2.entry.js +75 -0
  30. package/dist/esm/salla-loyalty.entry.js +225 -0
  31. package/dist/esm/salla-product-size-guide.entry.js +48 -0
  32. package/dist/esm/salla-quantity-input.entry.js +97 -0
  33. package/dist/esm/salla-rating-modal.entry.js +165 -0
  34. package/dist/esm/salla-social-share.entry.js +1443 -0
  35. package/dist/esm/salla-swiper.entry.js +5019 -0
  36. package/dist/esm/salla-tab-content_3.entry.js +153 -0
  37. package/dist/esm/star2-b134fc74.js +11 -0
  38. package/dist/esm/twilight-components.js +1 -1
  39. package/dist/twilight-components/p-14f0ff17.entry.js +4 -0
  40. package/dist/twilight-components/p-2749c9d3.entry.js +4 -0
  41. package/dist/twilight-components/p-335abbbb.entry.js +4 -0
  42. package/dist/twilight-components/p-4cafb11b.entry.js +4 -0
  43. package/dist/twilight-components/p-5e63e308.entry.js +4 -0
  44. package/dist/twilight-components/p-648e74e5.entry.js +4 -0
  45. package/dist/twilight-components/p-897b2018.js +4 -0
  46. package/dist/twilight-components/p-93708e1e.js +4 -0
  47. package/dist/twilight-components/p-9d236cf4.entry.js +4 -0
  48. package/dist/twilight-components/p-9d2ca9c8.js +4 -0
  49. package/dist/twilight-components/p-af7d5660.js +4 -0
  50. package/dist/twilight-components/p-bdbd2386.entry.js +4 -0
  51. package/dist/twilight-components/p-cac3db69.entry.js +4 -0
  52. package/dist/twilight-components/p-d914a212.js +4 -0
  53. package/dist/twilight-components/p-dace8e6d.js +4 -0
  54. package/dist/twilight-components/p-f9253fda.entry.js +4 -0
  55. package/dist/twilight-components/twilight-components.esm.js +1 -1
  56. package/package.json +2 -2
  57. package/dist/cjs/salla-add-product-button.cjs.entry.js +0 -104
  58. package/dist/cjs/salla-button_24.cjs.entry.js +0 -10087
  59. package/dist/esm/salla-add-product-button.entry.js +0 -100
  60. package/dist/esm/salla-button_24.entry.js +0 -10060
  61. package/dist/twilight-components/p-30b2c5b0.entry.js +0 -4
  62. package/dist/twilight-components/p-76cb2574.entry.js +0 -4
@@ -0,0 +1,5023 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index$1 = require('./index-0d0167d5.js');
9
+ const arrowRight = require('./arrow-right-3d137e4c.js');
10
+
11
+ /**
12
+ * SSR Window 4.0.2
13
+ * Better handling for window object in SSR environment
14
+ * https://github.com/nolimits4web/ssr-window
15
+ *
16
+ * Copyright 2021, Vladimir Kharlampidi
17
+ *
18
+ * Licensed under MIT
19
+ *
20
+ * Released on: December 13, 2021
21
+ */
22
+ /* eslint-disable no-param-reassign */
23
+ function isObject$1(obj) {
24
+ return (obj !== null &&
25
+ typeof obj === 'object' &&
26
+ 'constructor' in obj &&
27
+ obj.constructor === Object);
28
+ }
29
+ function extend$1(target = {}, src = {}) {
30
+ Object.keys(src).forEach((key) => {
31
+ if (typeof target[key] === 'undefined')
32
+ target[key] = src[key];
33
+ else if (isObject$1(src[key]) &&
34
+ isObject$1(target[key]) &&
35
+ Object.keys(src[key]).length > 0) {
36
+ extend$1(target[key], src[key]);
37
+ }
38
+ });
39
+ }
40
+
41
+ const ssrDocument = {
42
+ body: {},
43
+ addEventListener() { },
44
+ removeEventListener() { },
45
+ activeElement: {
46
+ blur() { },
47
+ nodeName: '',
48
+ },
49
+ querySelector() {
50
+ return null;
51
+ },
52
+ querySelectorAll() {
53
+ return [];
54
+ },
55
+ getElementById() {
56
+ return null;
57
+ },
58
+ createEvent() {
59
+ return {
60
+ initEvent() { },
61
+ };
62
+ },
63
+ createElement() {
64
+ return {
65
+ children: [],
66
+ childNodes: [],
67
+ style: {},
68
+ setAttribute() { },
69
+ getElementsByTagName() {
70
+ return [];
71
+ },
72
+ };
73
+ },
74
+ createElementNS() {
75
+ return {};
76
+ },
77
+ importNode() {
78
+ return null;
79
+ },
80
+ location: {
81
+ hash: '',
82
+ host: '',
83
+ hostname: '',
84
+ href: '',
85
+ origin: '',
86
+ pathname: '',
87
+ protocol: '',
88
+ search: '',
89
+ },
90
+ };
91
+ function getDocument() {
92
+ const doc = typeof document !== 'undefined' ? document : {};
93
+ extend$1(doc, ssrDocument);
94
+ return doc;
95
+ }
96
+
97
+ const ssrWindow = {
98
+ document: ssrDocument,
99
+ navigator: {
100
+ userAgent: '',
101
+ },
102
+ location: {
103
+ hash: '',
104
+ host: '',
105
+ hostname: '',
106
+ href: '',
107
+ origin: '',
108
+ pathname: '',
109
+ protocol: '',
110
+ search: '',
111
+ },
112
+ history: {
113
+ replaceState() { },
114
+ pushState() { },
115
+ go() { },
116
+ back() { },
117
+ },
118
+ CustomEvent: function CustomEvent() {
119
+ return this;
120
+ },
121
+ addEventListener() { },
122
+ removeEventListener() { },
123
+ getComputedStyle() {
124
+ return {
125
+ getPropertyValue() {
126
+ return '';
127
+ },
128
+ };
129
+ },
130
+ Image() { },
131
+ Date() { },
132
+ screen: {},
133
+ setTimeout() { },
134
+ clearTimeout() { },
135
+ matchMedia() {
136
+ return {};
137
+ },
138
+ requestAnimationFrame(callback) {
139
+ if (typeof setTimeout === 'undefined') {
140
+ callback();
141
+ return null;
142
+ }
143
+ return setTimeout(callback, 0);
144
+ },
145
+ cancelAnimationFrame(id) {
146
+ if (typeof setTimeout === 'undefined') {
147
+ return;
148
+ }
149
+ clearTimeout(id);
150
+ },
151
+ };
152
+ function getWindow() {
153
+ const win = typeof window !== 'undefined' ? window : {};
154
+ extend$1(win, ssrWindow);
155
+ return win;
156
+ }
157
+
158
+ /**
159
+ * Dom7 4.0.4
160
+ * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
161
+ * https://framework7.io/docs/dom7.html
162
+ *
163
+ * Copyright 2022, Vladimir Kharlampidi
164
+ *
165
+ * Licensed under MIT
166
+ *
167
+ * Released on: January 11, 2022
168
+ */
169
+
170
+ /* eslint-disable no-proto */
171
+ function makeReactive(obj) {
172
+ const proto = obj.__proto__;
173
+ Object.defineProperty(obj, '__proto__', {
174
+ get() {
175
+ return proto;
176
+ },
177
+
178
+ set(value) {
179
+ proto.__proto__ = value;
180
+ }
181
+
182
+ });
183
+ }
184
+
185
+ class Dom7 extends Array {
186
+ constructor(items) {
187
+ if (typeof items === 'number') {
188
+ super(items);
189
+ } else {
190
+ super(...(items || []));
191
+ makeReactive(this);
192
+ }
193
+ }
194
+
195
+ }
196
+
197
+ function arrayFlat(arr = []) {
198
+ const res = [];
199
+ arr.forEach(el => {
200
+ if (Array.isArray(el)) {
201
+ res.push(...arrayFlat(el));
202
+ } else {
203
+ res.push(el);
204
+ }
205
+ });
206
+ return res;
207
+ }
208
+ function arrayFilter(arr, callback) {
209
+ return Array.prototype.filter.call(arr, callback);
210
+ }
211
+ function arrayUnique(arr) {
212
+ const uniqueArray = [];
213
+
214
+ for (let i = 0; i < arr.length; i += 1) {
215
+ if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
216
+ }
217
+
218
+ return uniqueArray;
219
+ }
220
+
221
+ // eslint-disable-next-line
222
+
223
+ function qsa(selector, context) {
224
+ if (typeof selector !== 'string') {
225
+ return [selector];
226
+ }
227
+
228
+ const a = [];
229
+ const res = context.querySelectorAll(selector);
230
+
231
+ for (let i = 0; i < res.length; i += 1) {
232
+ a.push(res[i]);
233
+ }
234
+
235
+ return a;
236
+ }
237
+
238
+ function $(selector, context) {
239
+ const window = getWindow();
240
+ const document = getDocument();
241
+ let arr = [];
242
+
243
+ if (!context && selector instanceof Dom7) {
244
+ return selector;
245
+ }
246
+
247
+ if (!selector) {
248
+ return new Dom7(arr);
249
+ }
250
+
251
+ if (typeof selector === 'string') {
252
+ const html = selector.trim();
253
+
254
+ if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
255
+ let toCreate = 'div';
256
+ if (html.indexOf('<li') === 0) toCreate = 'ul';
257
+ if (html.indexOf('<tr') === 0) toCreate = 'tbody';
258
+ if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
259
+ if (html.indexOf('<tbody') === 0) toCreate = 'table';
260
+ if (html.indexOf('<option') === 0) toCreate = 'select';
261
+ const tempParent = document.createElement(toCreate);
262
+ tempParent.innerHTML = html;
263
+
264
+ for (let i = 0; i < tempParent.childNodes.length; i += 1) {
265
+ arr.push(tempParent.childNodes[i]);
266
+ }
267
+ } else {
268
+ arr = qsa(selector.trim(), context || document);
269
+ } // arr = qsa(selector, document);
270
+
271
+ } else if (selector.nodeType || selector === window || selector === document) {
272
+ arr.push(selector);
273
+ } else if (Array.isArray(selector)) {
274
+ if (selector instanceof Dom7) return selector;
275
+ arr = selector;
276
+ }
277
+
278
+ return new Dom7(arrayUnique(arr));
279
+ }
280
+
281
+ $.fn = Dom7.prototype;
282
+
283
+ // eslint-disable-next-line
284
+
285
+ function addClass(...classes) {
286
+ const classNames = arrayFlat(classes.map(c => c.split(' ')));
287
+ this.forEach(el => {
288
+ el.classList.add(...classNames);
289
+ });
290
+ return this;
291
+ }
292
+
293
+ function removeClass(...classes) {
294
+ const classNames = arrayFlat(classes.map(c => c.split(' ')));
295
+ this.forEach(el => {
296
+ el.classList.remove(...classNames);
297
+ });
298
+ return this;
299
+ }
300
+
301
+ function toggleClass(...classes) {
302
+ const classNames = arrayFlat(classes.map(c => c.split(' ')));
303
+ this.forEach(el => {
304
+ classNames.forEach(className => {
305
+ el.classList.toggle(className);
306
+ });
307
+ });
308
+ }
309
+
310
+ function hasClass(...classes) {
311
+ const classNames = arrayFlat(classes.map(c => c.split(' ')));
312
+ return arrayFilter(this, el => {
313
+ return classNames.filter(className => el.classList.contains(className)).length > 0;
314
+ }).length > 0;
315
+ }
316
+
317
+ function attr(attrs, value) {
318
+ if (arguments.length === 1 && typeof attrs === 'string') {
319
+ // Get attr
320
+ if (this[0]) return this[0].getAttribute(attrs);
321
+ return undefined;
322
+ } // Set attrs
323
+
324
+
325
+ for (let i = 0; i < this.length; i += 1) {
326
+ if (arguments.length === 2) {
327
+ // String
328
+ this[i].setAttribute(attrs, value);
329
+ } else {
330
+ // Object
331
+ for (const attrName in attrs) {
332
+ this[i][attrName] = attrs[attrName];
333
+ this[i].setAttribute(attrName, attrs[attrName]);
334
+ }
335
+ }
336
+ }
337
+
338
+ return this;
339
+ }
340
+
341
+ function removeAttr(attr) {
342
+ for (let i = 0; i < this.length; i += 1) {
343
+ this[i].removeAttribute(attr);
344
+ }
345
+
346
+ return this;
347
+ }
348
+
349
+ function transform(transform) {
350
+ for (let i = 0; i < this.length; i += 1) {
351
+ this[i].style.transform = transform;
352
+ }
353
+
354
+ return this;
355
+ }
356
+
357
+ function transition$1(duration) {
358
+ for (let i = 0; i < this.length; i += 1) {
359
+ this[i].style.transitionDuration = typeof duration !== 'string' ? `${duration}ms` : duration;
360
+ }
361
+
362
+ return this;
363
+ }
364
+
365
+ function on(...args) {
366
+ let [eventType, targetSelector, listener, capture] = args;
367
+
368
+ if (typeof args[1] === 'function') {
369
+ [eventType, listener, capture] = args;
370
+ targetSelector = undefined;
371
+ }
372
+
373
+ if (!capture) capture = false;
374
+
375
+ function handleLiveEvent(e) {
376
+ const target = e.target;
377
+ if (!target) return;
378
+ const eventData = e.target.dom7EventData || [];
379
+
380
+ if (eventData.indexOf(e) < 0) {
381
+ eventData.unshift(e);
382
+ }
383
+
384
+ if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
385
+ const parents = $(target).parents(); // eslint-disable-line
386
+
387
+ for (let k = 0; k < parents.length; k += 1) {
388
+ if ($(parents[k]).is(targetSelector)) listener.apply(parents[k], eventData);
389
+ }
390
+ }
391
+ }
392
+
393
+ function handleEvent(e) {
394
+ const eventData = e && e.target ? e.target.dom7EventData || [] : [];
395
+
396
+ if (eventData.indexOf(e) < 0) {
397
+ eventData.unshift(e);
398
+ }
399
+
400
+ listener.apply(this, eventData);
401
+ }
402
+
403
+ const events = eventType.split(' ');
404
+ let j;
405
+
406
+ for (let i = 0; i < this.length; i += 1) {
407
+ const el = this[i];
408
+
409
+ if (!targetSelector) {
410
+ for (j = 0; j < events.length; j += 1) {
411
+ const event = events[j];
412
+ if (!el.dom7Listeners) el.dom7Listeners = {};
413
+ if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
414
+ el.dom7Listeners[event].push({
415
+ listener,
416
+ proxyListener: handleEvent
417
+ });
418
+ el.addEventListener(event, handleEvent, capture);
419
+ }
420
+ } else {
421
+ // Live events
422
+ for (j = 0; j < events.length; j += 1) {
423
+ const event = events[j];
424
+ if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
425
+ if (!el.dom7LiveListeners[event]) el.dom7LiveListeners[event] = [];
426
+ el.dom7LiveListeners[event].push({
427
+ listener,
428
+ proxyListener: handleLiveEvent
429
+ });
430
+ el.addEventListener(event, handleLiveEvent, capture);
431
+ }
432
+ }
433
+ }
434
+
435
+ return this;
436
+ }
437
+
438
+ function off(...args) {
439
+ let [eventType, targetSelector, listener, capture] = args;
440
+
441
+ if (typeof args[1] === 'function') {
442
+ [eventType, listener, capture] = args;
443
+ targetSelector = undefined;
444
+ }
445
+
446
+ if (!capture) capture = false;
447
+ const events = eventType.split(' ');
448
+
449
+ for (let i = 0; i < events.length; i += 1) {
450
+ const event = events[i];
451
+
452
+ for (let j = 0; j < this.length; j += 1) {
453
+ const el = this[j];
454
+ let handlers;
455
+
456
+ if (!targetSelector && el.dom7Listeners) {
457
+ handlers = el.dom7Listeners[event];
458
+ } else if (targetSelector && el.dom7LiveListeners) {
459
+ handlers = el.dom7LiveListeners[event];
460
+ }
461
+
462
+ if (handlers && handlers.length) {
463
+ for (let k = handlers.length - 1; k >= 0; k -= 1) {
464
+ const handler = handlers[k];
465
+
466
+ if (listener && handler.listener === listener) {
467
+ el.removeEventListener(event, handler.proxyListener, capture);
468
+ handlers.splice(k, 1);
469
+ } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
470
+ el.removeEventListener(event, handler.proxyListener, capture);
471
+ handlers.splice(k, 1);
472
+ } else if (!listener) {
473
+ el.removeEventListener(event, handler.proxyListener, capture);
474
+ handlers.splice(k, 1);
475
+ }
476
+ }
477
+ }
478
+ }
479
+ }
480
+
481
+ return this;
482
+ }
483
+
484
+ function trigger(...args) {
485
+ const window = getWindow();
486
+ const events = args[0].split(' ');
487
+ const eventData = args[1];
488
+
489
+ for (let i = 0; i < events.length; i += 1) {
490
+ const event = events[i];
491
+
492
+ for (let j = 0; j < this.length; j += 1) {
493
+ const el = this[j];
494
+
495
+ if (window.CustomEvent) {
496
+ const evt = new window.CustomEvent(event, {
497
+ detail: eventData,
498
+ bubbles: true,
499
+ cancelable: true
500
+ });
501
+ el.dom7EventData = args.filter((data, dataIndex) => dataIndex > 0);
502
+ el.dispatchEvent(evt);
503
+ el.dom7EventData = [];
504
+ delete el.dom7EventData;
505
+ }
506
+ }
507
+ }
508
+
509
+ return this;
510
+ }
511
+
512
+ function transitionEnd$1(callback) {
513
+ const dom = this;
514
+
515
+ function fireCallBack(e) {
516
+ if (e.target !== this) return;
517
+ callback.call(this, e);
518
+ dom.off('transitionend', fireCallBack);
519
+ }
520
+
521
+ if (callback) {
522
+ dom.on('transitionend', fireCallBack);
523
+ }
524
+
525
+ return this;
526
+ }
527
+
528
+ function outerWidth(includeMargins) {
529
+ if (this.length > 0) {
530
+ if (includeMargins) {
531
+ const styles = this.styles();
532
+ return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left'));
533
+ }
534
+
535
+ return this[0].offsetWidth;
536
+ }
537
+
538
+ return null;
539
+ }
540
+
541
+ function outerHeight(includeMargins) {
542
+ if (this.length > 0) {
543
+ if (includeMargins) {
544
+ const styles = this.styles();
545
+ return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom'));
546
+ }
547
+
548
+ return this[0].offsetHeight;
549
+ }
550
+
551
+ return null;
552
+ }
553
+
554
+ function offset() {
555
+ if (this.length > 0) {
556
+ const window = getWindow();
557
+ const document = getDocument();
558
+ const el = this[0];
559
+ const box = el.getBoundingClientRect();
560
+ const body = document.body;
561
+ const clientTop = el.clientTop || body.clientTop || 0;
562
+ const clientLeft = el.clientLeft || body.clientLeft || 0;
563
+ const scrollTop = el === window ? window.scrollY : el.scrollTop;
564
+ const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
565
+ return {
566
+ top: box.top + scrollTop - clientTop,
567
+ left: box.left + scrollLeft - clientLeft
568
+ };
569
+ }
570
+
571
+ return null;
572
+ }
573
+
574
+ function styles() {
575
+ const window = getWindow();
576
+ if (this[0]) return window.getComputedStyle(this[0], null);
577
+ return {};
578
+ }
579
+
580
+ function css(props, value) {
581
+ const window = getWindow();
582
+ let i;
583
+
584
+ if (arguments.length === 1) {
585
+ if (typeof props === 'string') {
586
+ // .css('width')
587
+ if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
588
+ } else {
589
+ // .css({ width: '100px' })
590
+ for (i = 0; i < this.length; i += 1) {
591
+ for (const prop in props) {
592
+ this[i].style[prop] = props[prop];
593
+ }
594
+ }
595
+
596
+ return this;
597
+ }
598
+ }
599
+
600
+ if (arguments.length === 2 && typeof props === 'string') {
601
+ // .css('width', '100px')
602
+ for (i = 0; i < this.length; i += 1) {
603
+ this[i].style[props] = value;
604
+ }
605
+
606
+ return this;
607
+ }
608
+
609
+ return this;
610
+ }
611
+
612
+ function each(callback) {
613
+ if (!callback) return this;
614
+ this.forEach((el, index) => {
615
+ callback.apply(el, [el, index]);
616
+ });
617
+ return this;
618
+ }
619
+
620
+ function filter(callback) {
621
+ const result = arrayFilter(this, callback);
622
+ return $(result);
623
+ }
624
+
625
+ function html(html) {
626
+ if (typeof html === 'undefined') {
627
+ return this[0] ? this[0].innerHTML : null;
628
+ }
629
+
630
+ for (let i = 0; i < this.length; i += 1) {
631
+ this[i].innerHTML = html;
632
+ }
633
+
634
+ return this;
635
+ }
636
+
637
+ function text(text) {
638
+ if (typeof text === 'undefined') {
639
+ return this[0] ? this[0].textContent.trim() : null;
640
+ }
641
+
642
+ for (let i = 0; i < this.length; i += 1) {
643
+ this[i].textContent = text;
644
+ }
645
+
646
+ return this;
647
+ }
648
+
649
+ function is(selector) {
650
+ const window = getWindow();
651
+ const document = getDocument();
652
+ const el = this[0];
653
+ let compareWith;
654
+ let i;
655
+ if (!el || typeof selector === 'undefined') return false;
656
+
657
+ if (typeof selector === 'string') {
658
+ if (el.matches) return el.matches(selector);
659
+ if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
660
+ if (el.msMatchesSelector) return el.msMatchesSelector(selector);
661
+ compareWith = $(selector);
662
+
663
+ for (i = 0; i < compareWith.length; i += 1) {
664
+ if (compareWith[i] === el) return true;
665
+ }
666
+
667
+ return false;
668
+ }
669
+
670
+ if (selector === document) {
671
+ return el === document;
672
+ }
673
+
674
+ if (selector === window) {
675
+ return el === window;
676
+ }
677
+
678
+ if (selector.nodeType || selector instanceof Dom7) {
679
+ compareWith = selector.nodeType ? [selector] : selector;
680
+
681
+ for (i = 0; i < compareWith.length; i += 1) {
682
+ if (compareWith[i] === el) return true;
683
+ }
684
+
685
+ return false;
686
+ }
687
+
688
+ return false;
689
+ }
690
+
691
+ function index() {
692
+ let child = this[0];
693
+ let i;
694
+
695
+ if (child) {
696
+ i = 0; // eslint-disable-next-line
697
+
698
+ while ((child = child.previousSibling) !== null) {
699
+ if (child.nodeType === 1) i += 1;
700
+ }
701
+
702
+ return i;
703
+ }
704
+
705
+ return undefined;
706
+ }
707
+
708
+ function eq(index) {
709
+ if (typeof index === 'undefined') return this;
710
+ const length = this.length;
711
+
712
+ if (index > length - 1) {
713
+ return $([]);
714
+ }
715
+
716
+ if (index < 0) {
717
+ const returnIndex = length + index;
718
+ if (returnIndex < 0) return $([]);
719
+ return $([this[returnIndex]]);
720
+ }
721
+
722
+ return $([this[index]]);
723
+ }
724
+
725
+ function append(...els) {
726
+ let newChild;
727
+ const document = getDocument();
728
+
729
+ for (let k = 0; k < els.length; k += 1) {
730
+ newChild = els[k];
731
+
732
+ for (let i = 0; i < this.length; i += 1) {
733
+ if (typeof newChild === 'string') {
734
+ const tempDiv = document.createElement('div');
735
+ tempDiv.innerHTML = newChild;
736
+
737
+ while (tempDiv.firstChild) {
738
+ this[i].appendChild(tempDiv.firstChild);
739
+ }
740
+ } else if (newChild instanceof Dom7) {
741
+ for (let j = 0; j < newChild.length; j += 1) {
742
+ this[i].appendChild(newChild[j]);
743
+ }
744
+ } else {
745
+ this[i].appendChild(newChild);
746
+ }
747
+ }
748
+ }
749
+
750
+ return this;
751
+ }
752
+
753
+ function prepend(newChild) {
754
+ const document = getDocument();
755
+ let i;
756
+ let j;
757
+
758
+ for (i = 0; i < this.length; i += 1) {
759
+ if (typeof newChild === 'string') {
760
+ const tempDiv = document.createElement('div');
761
+ tempDiv.innerHTML = newChild;
762
+
763
+ for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
764
+ this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
765
+ }
766
+ } else if (newChild instanceof Dom7) {
767
+ for (j = 0; j < newChild.length; j += 1) {
768
+ this[i].insertBefore(newChild[j], this[i].childNodes[0]);
769
+ }
770
+ } else {
771
+ this[i].insertBefore(newChild, this[i].childNodes[0]);
772
+ }
773
+ }
774
+
775
+ return this;
776
+ }
777
+
778
+ function next(selector) {
779
+ if (this.length > 0) {
780
+ if (selector) {
781
+ if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
782
+ return $([this[0].nextElementSibling]);
783
+ }
784
+
785
+ return $([]);
786
+ }
787
+
788
+ if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
789
+ return $([]);
790
+ }
791
+
792
+ return $([]);
793
+ }
794
+
795
+ function nextAll(selector) {
796
+ const nextEls = [];
797
+ let el = this[0];
798
+ if (!el) return $([]);
799
+
800
+ while (el.nextElementSibling) {
801
+ const next = el.nextElementSibling; // eslint-disable-line
802
+
803
+ if (selector) {
804
+ if ($(next).is(selector)) nextEls.push(next);
805
+ } else nextEls.push(next);
806
+
807
+ el = next;
808
+ }
809
+
810
+ return $(nextEls);
811
+ }
812
+
813
+ function prev(selector) {
814
+ if (this.length > 0) {
815
+ const el = this[0];
816
+
817
+ if (selector) {
818
+ if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
819
+ return $([el.previousElementSibling]);
820
+ }
821
+
822
+ return $([]);
823
+ }
824
+
825
+ if (el.previousElementSibling) return $([el.previousElementSibling]);
826
+ return $([]);
827
+ }
828
+
829
+ return $([]);
830
+ }
831
+
832
+ function prevAll(selector) {
833
+ const prevEls = [];
834
+ let el = this[0];
835
+ if (!el) return $([]);
836
+
837
+ while (el.previousElementSibling) {
838
+ const prev = el.previousElementSibling; // eslint-disable-line
839
+
840
+ if (selector) {
841
+ if ($(prev).is(selector)) prevEls.push(prev);
842
+ } else prevEls.push(prev);
843
+
844
+ el = prev;
845
+ }
846
+
847
+ return $(prevEls);
848
+ }
849
+
850
+ function parent(selector) {
851
+ const parents = []; // eslint-disable-line
852
+
853
+ for (let i = 0; i < this.length; i += 1) {
854
+ if (this[i].parentNode !== null) {
855
+ if (selector) {
856
+ if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
857
+ } else {
858
+ parents.push(this[i].parentNode);
859
+ }
860
+ }
861
+ }
862
+
863
+ return $(parents);
864
+ }
865
+
866
+ function parents(selector) {
867
+ const parents = []; // eslint-disable-line
868
+
869
+ for (let i = 0; i < this.length; i += 1) {
870
+ let parent = this[i].parentNode; // eslint-disable-line
871
+
872
+ while (parent) {
873
+ if (selector) {
874
+ if ($(parent).is(selector)) parents.push(parent);
875
+ } else {
876
+ parents.push(parent);
877
+ }
878
+
879
+ parent = parent.parentNode;
880
+ }
881
+ }
882
+
883
+ return $(parents);
884
+ }
885
+
886
+ function closest(selector) {
887
+ let closest = this; // eslint-disable-line
888
+
889
+ if (typeof selector === 'undefined') {
890
+ return $([]);
891
+ }
892
+
893
+ if (!closest.is(selector)) {
894
+ closest = closest.parents(selector).eq(0);
895
+ }
896
+
897
+ return closest;
898
+ }
899
+
900
+ function find(selector) {
901
+ const foundElements = [];
902
+
903
+ for (let i = 0; i < this.length; i += 1) {
904
+ const found = this[i].querySelectorAll(selector);
905
+
906
+ for (let j = 0; j < found.length; j += 1) {
907
+ foundElements.push(found[j]);
908
+ }
909
+ }
910
+
911
+ return $(foundElements);
912
+ }
913
+
914
+ function children(selector) {
915
+ const children = []; // eslint-disable-line
916
+
917
+ for (let i = 0; i < this.length; i += 1) {
918
+ const childNodes = this[i].children;
919
+
920
+ for (let j = 0; j < childNodes.length; j += 1) {
921
+ if (!selector || $(childNodes[j]).is(selector)) {
922
+ children.push(childNodes[j]);
923
+ }
924
+ }
925
+ }
926
+
927
+ return $(children);
928
+ }
929
+
930
+ function remove() {
931
+ for (let i = 0; i < this.length; i += 1) {
932
+ if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
933
+ }
934
+
935
+ return this;
936
+ }
937
+
938
+ const Methods = {
939
+ addClass,
940
+ removeClass,
941
+ hasClass,
942
+ toggleClass,
943
+ attr,
944
+ removeAttr,
945
+ transform,
946
+ transition: transition$1,
947
+ on,
948
+ off,
949
+ trigger,
950
+ transitionEnd: transitionEnd$1,
951
+ outerWidth,
952
+ outerHeight,
953
+ styles,
954
+ offset,
955
+ css,
956
+ each,
957
+ html,
958
+ text,
959
+ is,
960
+ index,
961
+ eq,
962
+ append,
963
+ prepend,
964
+ next,
965
+ nextAll,
966
+ prev,
967
+ prevAll,
968
+ parent,
969
+ parents,
970
+ closest,
971
+ find,
972
+ children,
973
+ filter,
974
+ remove
975
+ };
976
+ Object.keys(Methods).forEach(methodName => {
977
+ Object.defineProperty($.fn, methodName, {
978
+ value: Methods[methodName],
979
+ writable: true
980
+ });
981
+ });
982
+
983
+ function deleteProps(obj) {
984
+ const object = obj;
985
+ Object.keys(object).forEach(key => {
986
+ try {
987
+ object[key] = null;
988
+ } catch (e) {// no getter for object
989
+ }
990
+
991
+ try {
992
+ delete object[key];
993
+ } catch (e) {// something got wrong
994
+ }
995
+ });
996
+ }
997
+
998
+ function nextTick(callback, delay) {
999
+ if (delay === void 0) {
1000
+ delay = 0;
1001
+ }
1002
+
1003
+ return setTimeout(callback, delay);
1004
+ }
1005
+
1006
+ function now() {
1007
+ return Date.now();
1008
+ }
1009
+
1010
+ function getComputedStyle$1(el) {
1011
+ const window = getWindow();
1012
+ let style;
1013
+
1014
+ if (window.getComputedStyle) {
1015
+ style = window.getComputedStyle(el, null);
1016
+ }
1017
+
1018
+ if (!style && el.currentStyle) {
1019
+ style = el.currentStyle;
1020
+ }
1021
+
1022
+ if (!style) {
1023
+ style = el.style;
1024
+ }
1025
+
1026
+ return style;
1027
+ }
1028
+
1029
+ function getTranslate(el, axis) {
1030
+ if (axis === void 0) {
1031
+ axis = 'x';
1032
+ }
1033
+
1034
+ const window = getWindow();
1035
+ let matrix;
1036
+ let curTransform;
1037
+ let transformMatrix;
1038
+ const curStyle = getComputedStyle$1(el);
1039
+
1040
+ if (window.WebKitCSSMatrix) {
1041
+ curTransform = curStyle.transform || curStyle.webkitTransform;
1042
+
1043
+ if (curTransform.split(',').length > 6) {
1044
+ curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
1045
+ } // Some old versions of Webkit choke when 'none' is passed; pass
1046
+ // empty string instead in this case
1047
+
1048
+
1049
+ transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
1050
+ } else {
1051
+ transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
1052
+ matrix = transformMatrix.toString().split(',');
1053
+ }
1054
+
1055
+ if (axis === 'x') {
1056
+ // Latest Chrome and webkits Fix
1057
+ if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix
1058
+ else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers
1059
+ else curTransform = parseFloat(matrix[4]);
1060
+ }
1061
+
1062
+ if (axis === 'y') {
1063
+ // Latest Chrome and webkits Fix
1064
+ if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix
1065
+ else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers
1066
+ else curTransform = parseFloat(matrix[5]);
1067
+ }
1068
+
1069
+ return curTransform || 0;
1070
+ }
1071
+
1072
+ function isObject(o) {
1073
+ return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
1074
+ }
1075
+
1076
+ function isNode(node) {
1077
+ // eslint-disable-next-line
1078
+ if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
1079
+ return node instanceof HTMLElement;
1080
+ }
1081
+
1082
+ return node && (node.nodeType === 1 || node.nodeType === 11);
1083
+ }
1084
+
1085
+ function extend() {
1086
+ const to = Object(arguments.length <= 0 ? undefined : arguments[0]);
1087
+ const noExtend = ['__proto__', 'constructor', 'prototype'];
1088
+
1089
+ for (let i = 1; i < arguments.length; i += 1) {
1090
+ const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
1091
+
1092
+ if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
1093
+ const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
1094
+
1095
+ for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
1096
+ const nextKey = keysArray[nextIndex];
1097
+ const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
1098
+
1099
+ if (desc !== undefined && desc.enumerable) {
1100
+ if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
1101
+ if (nextSource[nextKey].__swiper__) {
1102
+ to[nextKey] = nextSource[nextKey];
1103
+ } else {
1104
+ extend(to[nextKey], nextSource[nextKey]);
1105
+ }
1106
+ } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
1107
+ to[nextKey] = {};
1108
+
1109
+ if (nextSource[nextKey].__swiper__) {
1110
+ to[nextKey] = nextSource[nextKey];
1111
+ } else {
1112
+ extend(to[nextKey], nextSource[nextKey]);
1113
+ }
1114
+ } else {
1115
+ to[nextKey] = nextSource[nextKey];
1116
+ }
1117
+ }
1118
+ }
1119
+ }
1120
+ }
1121
+
1122
+ return to;
1123
+ }
1124
+
1125
+ function setCSSProperty(el, varName, varValue) {
1126
+ el.style.setProperty(varName, varValue);
1127
+ }
1128
+
1129
+ function animateCSSModeScroll(_ref) {
1130
+ let {
1131
+ swiper,
1132
+ targetPosition,
1133
+ side
1134
+ } = _ref;
1135
+ const window = getWindow();
1136
+ const startPosition = -swiper.translate;
1137
+ let startTime = null;
1138
+ let time;
1139
+ const duration = swiper.params.speed;
1140
+ swiper.wrapperEl.style.scrollSnapType = 'none';
1141
+ window.cancelAnimationFrame(swiper.cssModeFrameID);
1142
+ const dir = targetPosition > startPosition ? 'next' : 'prev';
1143
+
1144
+ const isOutOfBound = (current, target) => {
1145
+ return dir === 'next' && current >= target || dir === 'prev' && current <= target;
1146
+ };
1147
+
1148
+ const animate = () => {
1149
+ time = new Date().getTime();
1150
+
1151
+ if (startTime === null) {
1152
+ startTime = time;
1153
+ }
1154
+
1155
+ const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
1156
+ const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
1157
+ let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
1158
+
1159
+ if (isOutOfBound(currentPosition, targetPosition)) {
1160
+ currentPosition = targetPosition;
1161
+ }
1162
+
1163
+ swiper.wrapperEl.scrollTo({
1164
+ [side]: currentPosition
1165
+ });
1166
+
1167
+ if (isOutOfBound(currentPosition, targetPosition)) {
1168
+ swiper.wrapperEl.style.overflow = 'hidden';
1169
+ swiper.wrapperEl.style.scrollSnapType = '';
1170
+ setTimeout(() => {
1171
+ swiper.wrapperEl.style.overflow = '';
1172
+ swiper.wrapperEl.scrollTo({
1173
+ [side]: currentPosition
1174
+ });
1175
+ });
1176
+ window.cancelAnimationFrame(swiper.cssModeFrameID);
1177
+ return;
1178
+ }
1179
+
1180
+ swiper.cssModeFrameID = window.requestAnimationFrame(animate);
1181
+ };
1182
+
1183
+ animate();
1184
+ }
1185
+
1186
+ let support;
1187
+
1188
+ function calcSupport() {
1189
+ const window = getWindow();
1190
+ const document = getDocument();
1191
+ return {
1192
+ smoothScroll: document.documentElement && 'scrollBehavior' in document.documentElement.style,
1193
+ touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),
1194
+ passiveListener: function checkPassiveListener() {
1195
+ let supportsPassive = false;
1196
+
1197
+ try {
1198
+ const opts = Object.defineProperty({}, 'passive', {
1199
+ // eslint-disable-next-line
1200
+ get() {
1201
+ supportsPassive = true;
1202
+ }
1203
+
1204
+ });
1205
+ window.addEventListener('testPassiveListener', null, opts);
1206
+ } catch (e) {// No support
1207
+ }
1208
+
1209
+ return supportsPassive;
1210
+ }(),
1211
+ gestures: function checkGestures() {
1212
+ return 'ongesturestart' in window;
1213
+ }()
1214
+ };
1215
+ }
1216
+
1217
+ function getSupport() {
1218
+ if (!support) {
1219
+ support = calcSupport();
1220
+ }
1221
+
1222
+ return support;
1223
+ }
1224
+
1225
+ let deviceCached;
1226
+
1227
+ function calcDevice(_temp) {
1228
+ let {
1229
+ userAgent
1230
+ } = _temp === void 0 ? {} : _temp;
1231
+ const support = getSupport();
1232
+ const window = getWindow();
1233
+ const platform = window.navigator.platform;
1234
+ const ua = userAgent || window.navigator.userAgent;
1235
+ const device = {
1236
+ ios: false,
1237
+ android: false
1238
+ };
1239
+ const screenWidth = window.screen.width;
1240
+ const screenHeight = window.screen.height;
1241
+ const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
1242
+
1243
+ let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
1244
+ const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
1245
+ const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
1246
+ const windows = platform === 'Win32';
1247
+ let macos = platform === 'MacIntel'; // iPadOs 13 fix
1248
+
1249
+ const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
1250
+
1251
+ if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {
1252
+ ipad = ua.match(/(Version)\/([\d.]+)/);
1253
+ if (!ipad) ipad = [0, 1, '13_0_0'];
1254
+ macos = false;
1255
+ } // Android
1256
+
1257
+
1258
+ if (android && !windows) {
1259
+ device.os = 'android';
1260
+ device.android = true;
1261
+ }
1262
+
1263
+ if (ipad || iphone || ipod) {
1264
+ device.os = 'ios';
1265
+ device.ios = true;
1266
+ } // Export object
1267
+
1268
+
1269
+ return device;
1270
+ }
1271
+
1272
+ function getDevice(overrides) {
1273
+ if (overrides === void 0) {
1274
+ overrides = {};
1275
+ }
1276
+
1277
+ if (!deviceCached) {
1278
+ deviceCached = calcDevice(overrides);
1279
+ }
1280
+
1281
+ return deviceCached;
1282
+ }
1283
+
1284
+ let browser;
1285
+
1286
+ function calcBrowser() {
1287
+ const window = getWindow();
1288
+
1289
+ function isSafari() {
1290
+ const ua = window.navigator.userAgent.toLowerCase();
1291
+ return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
1292
+ }
1293
+
1294
+ return {
1295
+ isSafari: isSafari(),
1296
+ isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
1297
+ };
1298
+ }
1299
+
1300
+ function getBrowser() {
1301
+ if (!browser) {
1302
+ browser = calcBrowser();
1303
+ }
1304
+
1305
+ return browser;
1306
+ }
1307
+
1308
+ function Resize(_ref) {
1309
+ let {
1310
+ swiper,
1311
+ on,
1312
+ emit
1313
+ } = _ref;
1314
+ const window = getWindow();
1315
+ let observer = null;
1316
+ let animationFrame = null;
1317
+
1318
+ const resizeHandler = () => {
1319
+ if (!swiper || swiper.destroyed || !swiper.initialized) return;
1320
+ emit('beforeResize');
1321
+ emit('resize');
1322
+ };
1323
+
1324
+ const createObserver = () => {
1325
+ if (!swiper || swiper.destroyed || !swiper.initialized) return;
1326
+ observer = new ResizeObserver(entries => {
1327
+ animationFrame = window.requestAnimationFrame(() => {
1328
+ const {
1329
+ width,
1330
+ height
1331
+ } = swiper;
1332
+ let newWidth = width;
1333
+ let newHeight = height;
1334
+ entries.forEach(_ref2 => {
1335
+ let {
1336
+ contentBoxSize,
1337
+ contentRect,
1338
+ target
1339
+ } = _ref2;
1340
+ if (target && target !== swiper.el) return;
1341
+ newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
1342
+ newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
1343
+ });
1344
+
1345
+ if (newWidth !== width || newHeight !== height) {
1346
+ resizeHandler();
1347
+ }
1348
+ });
1349
+ });
1350
+ observer.observe(swiper.el);
1351
+ };
1352
+
1353
+ const removeObserver = () => {
1354
+ if (animationFrame) {
1355
+ window.cancelAnimationFrame(animationFrame);
1356
+ }
1357
+
1358
+ if (observer && observer.unobserve && swiper.el) {
1359
+ observer.unobserve(swiper.el);
1360
+ observer = null;
1361
+ }
1362
+ };
1363
+
1364
+ const orientationChangeHandler = () => {
1365
+ if (!swiper || swiper.destroyed || !swiper.initialized) return;
1366
+ emit('orientationchange');
1367
+ };
1368
+
1369
+ on('init', () => {
1370
+ if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
1371
+ createObserver();
1372
+ return;
1373
+ }
1374
+
1375
+ window.addEventListener('resize', resizeHandler);
1376
+ window.addEventListener('orientationchange', orientationChangeHandler);
1377
+ });
1378
+ on('destroy', () => {
1379
+ removeObserver();
1380
+ window.removeEventListener('resize', resizeHandler);
1381
+ window.removeEventListener('orientationchange', orientationChangeHandler);
1382
+ });
1383
+ }
1384
+
1385
+ function Observer(_ref) {
1386
+ let {
1387
+ swiper,
1388
+ extendParams,
1389
+ on,
1390
+ emit
1391
+ } = _ref;
1392
+ const observers = [];
1393
+ const window = getWindow();
1394
+
1395
+ const attach = function (target, options) {
1396
+ if (options === void 0) {
1397
+ options = {};
1398
+ }
1399
+
1400
+ const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
1401
+ const observer = new ObserverFunc(mutations => {
1402
+ // The observerUpdate event should only be triggered
1403
+ // once despite the number of mutations. Additional
1404
+ // triggers are redundant and are very costly
1405
+ if (mutations.length === 1) {
1406
+ emit('observerUpdate', mutations[0]);
1407
+ return;
1408
+ }
1409
+
1410
+ const observerUpdate = function observerUpdate() {
1411
+ emit('observerUpdate', mutations[0]);
1412
+ };
1413
+
1414
+ if (window.requestAnimationFrame) {
1415
+ window.requestAnimationFrame(observerUpdate);
1416
+ } else {
1417
+ window.setTimeout(observerUpdate, 0);
1418
+ }
1419
+ });
1420
+ observer.observe(target, {
1421
+ attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
1422
+ childList: typeof options.childList === 'undefined' ? true : options.childList,
1423
+ characterData: typeof options.characterData === 'undefined' ? true : options.characterData
1424
+ });
1425
+ observers.push(observer);
1426
+ };
1427
+
1428
+ const init = () => {
1429
+ if (!swiper.params.observer) return;
1430
+
1431
+ if (swiper.params.observeParents) {
1432
+ const containerParents = swiper.$el.parents();
1433
+
1434
+ for (let i = 0; i < containerParents.length; i += 1) {
1435
+ attach(containerParents[i]);
1436
+ }
1437
+ } // Observe container
1438
+
1439
+
1440
+ attach(swiper.$el[0], {
1441
+ childList: swiper.params.observeSlideChildren
1442
+ }); // Observe wrapper
1443
+
1444
+ attach(swiper.$wrapperEl[0], {
1445
+ attributes: false
1446
+ });
1447
+ };
1448
+
1449
+ const destroy = () => {
1450
+ observers.forEach(observer => {
1451
+ observer.disconnect();
1452
+ });
1453
+ observers.splice(0, observers.length);
1454
+ };
1455
+
1456
+ extendParams({
1457
+ observer: false,
1458
+ observeParents: false,
1459
+ observeSlideChildren: false
1460
+ });
1461
+ on('init', init);
1462
+ on('destroy', destroy);
1463
+ }
1464
+
1465
+ /* eslint-disable no-underscore-dangle */
1466
+ const eventsEmitter = {
1467
+ on(events, handler, priority) {
1468
+ const self = this;
1469
+ if (!self.eventsListeners || self.destroyed) return self;
1470
+ if (typeof handler !== 'function') return self;
1471
+ const method = priority ? 'unshift' : 'push';
1472
+ events.split(' ').forEach(event => {
1473
+ if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
1474
+ self.eventsListeners[event][method](handler);
1475
+ });
1476
+ return self;
1477
+ },
1478
+
1479
+ once(events, handler, priority) {
1480
+ const self = this;
1481
+ if (!self.eventsListeners || self.destroyed) return self;
1482
+ if (typeof handler !== 'function') return self;
1483
+
1484
+ function onceHandler() {
1485
+ self.off(events, onceHandler);
1486
+
1487
+ if (onceHandler.__emitterProxy) {
1488
+ delete onceHandler.__emitterProxy;
1489
+ }
1490
+
1491
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1492
+ args[_key] = arguments[_key];
1493
+ }
1494
+
1495
+ handler.apply(self, args);
1496
+ }
1497
+
1498
+ onceHandler.__emitterProxy = handler;
1499
+ return self.on(events, onceHandler, priority);
1500
+ },
1501
+
1502
+ onAny(handler, priority) {
1503
+ const self = this;
1504
+ if (!self.eventsListeners || self.destroyed) return self;
1505
+ if (typeof handler !== 'function') return self;
1506
+ const method = priority ? 'unshift' : 'push';
1507
+
1508
+ if (self.eventsAnyListeners.indexOf(handler) < 0) {
1509
+ self.eventsAnyListeners[method](handler);
1510
+ }
1511
+
1512
+ return self;
1513
+ },
1514
+
1515
+ offAny(handler) {
1516
+ const self = this;
1517
+ if (!self.eventsListeners || self.destroyed) return self;
1518
+ if (!self.eventsAnyListeners) return self;
1519
+ const index = self.eventsAnyListeners.indexOf(handler);
1520
+
1521
+ if (index >= 0) {
1522
+ self.eventsAnyListeners.splice(index, 1);
1523
+ }
1524
+
1525
+ return self;
1526
+ },
1527
+
1528
+ off(events, handler) {
1529
+ const self = this;
1530
+ if (!self.eventsListeners || self.destroyed) return self;
1531
+ if (!self.eventsListeners) return self;
1532
+ events.split(' ').forEach(event => {
1533
+ if (typeof handler === 'undefined') {
1534
+ self.eventsListeners[event] = [];
1535
+ } else if (self.eventsListeners[event]) {
1536
+ self.eventsListeners[event].forEach((eventHandler, index) => {
1537
+ if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
1538
+ self.eventsListeners[event].splice(index, 1);
1539
+ }
1540
+ });
1541
+ }
1542
+ });
1543
+ return self;
1544
+ },
1545
+
1546
+ emit() {
1547
+ const self = this;
1548
+ if (!self.eventsListeners || self.destroyed) return self;
1549
+ if (!self.eventsListeners) return self;
1550
+ let events;
1551
+ let data;
1552
+ let context;
1553
+
1554
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1555
+ args[_key2] = arguments[_key2];
1556
+ }
1557
+
1558
+ if (typeof args[0] === 'string' || Array.isArray(args[0])) {
1559
+ events = args[0];
1560
+ data = args.slice(1, args.length);
1561
+ context = self;
1562
+ } else {
1563
+ events = args[0].events;
1564
+ data = args[0].data;
1565
+ context = args[0].context || self;
1566
+ }
1567
+
1568
+ data.unshift(context);
1569
+ const eventsArray = Array.isArray(events) ? events : events.split(' ');
1570
+ eventsArray.forEach(event => {
1571
+ if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
1572
+ self.eventsAnyListeners.forEach(eventHandler => {
1573
+ eventHandler.apply(context, [event, ...data]);
1574
+ });
1575
+ }
1576
+
1577
+ if (self.eventsListeners && self.eventsListeners[event]) {
1578
+ self.eventsListeners[event].forEach(eventHandler => {
1579
+ eventHandler.apply(context, data);
1580
+ });
1581
+ }
1582
+ });
1583
+ return self;
1584
+ }
1585
+
1586
+ };
1587
+
1588
+ function updateSize() {
1589
+ const swiper = this;
1590
+ let width;
1591
+ let height;
1592
+ const $el = swiper.$el;
1593
+
1594
+ if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
1595
+ width = swiper.params.width;
1596
+ } else {
1597
+ width = $el[0].clientWidth;
1598
+ }
1599
+
1600
+ if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
1601
+ height = swiper.params.height;
1602
+ } else {
1603
+ height = $el[0].clientHeight;
1604
+ }
1605
+
1606
+ if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
1607
+ return;
1608
+ } // Subtract paddings
1609
+
1610
+
1611
+ width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);
1612
+ height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);
1613
+ if (Number.isNaN(width)) width = 0;
1614
+ if (Number.isNaN(height)) height = 0;
1615
+ Object.assign(swiper, {
1616
+ width,
1617
+ height,
1618
+ size: swiper.isHorizontal() ? width : height
1619
+ });
1620
+ }
1621
+
1622
+ function updateSlides() {
1623
+ const swiper = this;
1624
+
1625
+ function getDirectionLabel(property) {
1626
+ if (swiper.isHorizontal()) {
1627
+ return property;
1628
+ } // prettier-ignore
1629
+
1630
+
1631
+ return {
1632
+ 'width': 'height',
1633
+ 'margin-top': 'margin-left',
1634
+ 'margin-bottom ': 'margin-right',
1635
+ 'margin-left': 'margin-top',
1636
+ 'margin-right': 'margin-bottom',
1637
+ 'padding-left': 'padding-top',
1638
+ 'padding-right': 'padding-bottom',
1639
+ 'marginRight': 'marginBottom'
1640
+ }[property];
1641
+ }
1642
+
1643
+ function getDirectionPropertyValue(node, label) {
1644
+ return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
1645
+ }
1646
+
1647
+ const params = swiper.params;
1648
+ const {
1649
+ $wrapperEl,
1650
+ size: swiperSize,
1651
+ rtlTranslate: rtl,
1652
+ wrongRTL
1653
+ } = swiper;
1654
+ const isVirtual = swiper.virtual && params.virtual.enabled;
1655
+ const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
1656
+ const slides = $wrapperEl.children(`.${swiper.params.slideClass}`);
1657
+ const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
1658
+ let snapGrid = [];
1659
+ const slidesGrid = [];
1660
+ const slidesSizesGrid = [];
1661
+ let offsetBefore = params.slidesOffsetBefore;
1662
+
1663
+ if (typeof offsetBefore === 'function') {
1664
+ offsetBefore = params.slidesOffsetBefore.call(swiper);
1665
+ }
1666
+
1667
+ let offsetAfter = params.slidesOffsetAfter;
1668
+
1669
+ if (typeof offsetAfter === 'function') {
1670
+ offsetAfter = params.slidesOffsetAfter.call(swiper);
1671
+ }
1672
+
1673
+ const previousSnapGridLength = swiper.snapGrid.length;
1674
+ const previousSlidesGridLength = swiper.slidesGrid.length;
1675
+ let spaceBetween = params.spaceBetween;
1676
+ let slidePosition = -offsetBefore;
1677
+ let prevSlideSize = 0;
1678
+ let index = 0;
1679
+
1680
+ if (typeof swiperSize === 'undefined') {
1681
+ return;
1682
+ }
1683
+
1684
+ if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
1685
+ spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
1686
+ }
1687
+
1688
+ swiper.virtualSize = -spaceBetween; // reset margins
1689
+
1690
+ if (rtl) slides.css({
1691
+ marginLeft: '',
1692
+ marginBottom: '',
1693
+ marginTop: ''
1694
+ });else slides.css({
1695
+ marginRight: '',
1696
+ marginBottom: '',
1697
+ marginTop: ''
1698
+ }); // reset cssMode offsets
1699
+
1700
+ if (params.centeredSlides && params.cssMode) {
1701
+ setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', '');
1702
+ setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', '');
1703
+ }
1704
+
1705
+ const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
1706
+
1707
+ if (gridEnabled) {
1708
+ swiper.grid.initSlides(slidesLength);
1709
+ } // Calc slides
1710
+
1711
+
1712
+ let slideSize;
1713
+ const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {
1714
+ return typeof params.breakpoints[key].slidesPerView !== 'undefined';
1715
+ }).length > 0;
1716
+
1717
+ for (let i = 0; i < slidesLength; i += 1) {
1718
+ slideSize = 0;
1719
+ const slide = slides.eq(i);
1720
+
1721
+ if (gridEnabled) {
1722
+ swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
1723
+ }
1724
+
1725
+ if (slide.css('display') === 'none') continue; // eslint-disable-line
1726
+
1727
+ if (params.slidesPerView === 'auto') {
1728
+ if (shouldResetSlideSize) {
1729
+ slides[i].style[getDirectionLabel('width')] = ``;
1730
+ }
1731
+
1732
+ const slideStyles = getComputedStyle(slide[0]);
1733
+ const currentTransform = slide[0].style.transform;
1734
+ const currentWebKitTransform = slide[0].style.webkitTransform;
1735
+
1736
+ if (currentTransform) {
1737
+ slide[0].style.transform = 'none';
1738
+ }
1739
+
1740
+ if (currentWebKitTransform) {
1741
+ slide[0].style.webkitTransform = 'none';
1742
+ }
1743
+
1744
+ if (params.roundLengths) {
1745
+ slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
1746
+ } else {
1747
+ // eslint-disable-next-line
1748
+ const width = getDirectionPropertyValue(slideStyles, 'width');
1749
+ const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
1750
+ const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
1751
+ const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
1752
+ const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
1753
+ const boxSizing = slideStyles.getPropertyValue('box-sizing');
1754
+
1755
+ if (boxSizing && boxSizing === 'border-box') {
1756
+ slideSize = width + marginLeft + marginRight;
1757
+ } else {
1758
+ const {
1759
+ clientWidth,
1760
+ offsetWidth
1761
+ } = slide[0];
1762
+ slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
1763
+ }
1764
+ }
1765
+
1766
+ if (currentTransform) {
1767
+ slide[0].style.transform = currentTransform;
1768
+ }
1769
+
1770
+ if (currentWebKitTransform) {
1771
+ slide[0].style.webkitTransform = currentWebKitTransform;
1772
+ }
1773
+
1774
+ if (params.roundLengths) slideSize = Math.floor(slideSize);
1775
+ } else {
1776
+ slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
1777
+ if (params.roundLengths) slideSize = Math.floor(slideSize);
1778
+
1779
+ if (slides[i]) {
1780
+ slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
1781
+ }
1782
+ }
1783
+
1784
+ if (slides[i]) {
1785
+ slides[i].swiperSlideSize = slideSize;
1786
+ }
1787
+
1788
+ slidesSizesGrid.push(slideSize);
1789
+
1790
+ if (params.centeredSlides) {
1791
+ slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
1792
+ if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
1793
+ if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
1794
+ if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
1795
+ if (params.roundLengths) slidePosition = Math.floor(slidePosition);
1796
+ if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
1797
+ slidesGrid.push(slidePosition);
1798
+ } else {
1799
+ if (params.roundLengths) slidePosition = Math.floor(slidePosition);
1800
+ if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
1801
+ slidesGrid.push(slidePosition);
1802
+ slidePosition = slidePosition + slideSize + spaceBetween;
1803
+ }
1804
+
1805
+ swiper.virtualSize += slideSize + spaceBetween;
1806
+ prevSlideSize = slideSize;
1807
+ index += 1;
1808
+ }
1809
+
1810
+ swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
1811
+
1812
+ if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
1813
+ $wrapperEl.css({
1814
+ width: `${swiper.virtualSize + params.spaceBetween}px`
1815
+ });
1816
+ }
1817
+
1818
+ if (params.setWrapperSize) {
1819
+ $wrapperEl.css({
1820
+ [getDirectionLabel('width')]: `${swiper.virtualSize + params.spaceBetween}px`
1821
+ });
1822
+ }
1823
+
1824
+ if (gridEnabled) {
1825
+ swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
1826
+ } // Remove last grid elements depending on width
1827
+
1828
+
1829
+ if (!params.centeredSlides) {
1830
+ const newSlidesGrid = [];
1831
+
1832
+ for (let i = 0; i < snapGrid.length; i += 1) {
1833
+ let slidesGridItem = snapGrid[i];
1834
+ if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
1835
+
1836
+ if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
1837
+ newSlidesGrid.push(slidesGridItem);
1838
+ }
1839
+ }
1840
+
1841
+ snapGrid = newSlidesGrid;
1842
+
1843
+ if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
1844
+ snapGrid.push(swiper.virtualSize - swiperSize);
1845
+ }
1846
+ }
1847
+
1848
+ if (snapGrid.length === 0) snapGrid = [0];
1849
+
1850
+ if (params.spaceBetween !== 0) {
1851
+ const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
1852
+ slides.filter((_, slideIndex) => {
1853
+ if (!params.cssMode) return true;
1854
+
1855
+ if (slideIndex === slides.length - 1) {
1856
+ return false;
1857
+ }
1858
+
1859
+ return true;
1860
+ }).css({
1861
+ [key]: `${spaceBetween}px`
1862
+ });
1863
+ }
1864
+
1865
+ if (params.centeredSlides && params.centeredSlidesBounds) {
1866
+ let allSlidesSize = 0;
1867
+ slidesSizesGrid.forEach(slideSizeValue => {
1868
+ allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
1869
+ });
1870
+ allSlidesSize -= params.spaceBetween;
1871
+ const maxSnap = allSlidesSize - swiperSize;
1872
+ snapGrid = snapGrid.map(snap => {
1873
+ if (snap < 0) return -offsetBefore;
1874
+ if (snap > maxSnap) return maxSnap + offsetAfter;
1875
+ return snap;
1876
+ });
1877
+ }
1878
+
1879
+ if (params.centerInsufficientSlides) {
1880
+ let allSlidesSize = 0;
1881
+ slidesSizesGrid.forEach(slideSizeValue => {
1882
+ allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
1883
+ });
1884
+ allSlidesSize -= params.spaceBetween;
1885
+
1886
+ if (allSlidesSize < swiperSize) {
1887
+ const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
1888
+ snapGrid.forEach((snap, snapIndex) => {
1889
+ snapGrid[snapIndex] = snap - allSlidesOffset;
1890
+ });
1891
+ slidesGrid.forEach((snap, snapIndex) => {
1892
+ slidesGrid[snapIndex] = snap + allSlidesOffset;
1893
+ });
1894
+ }
1895
+ }
1896
+
1897
+ Object.assign(swiper, {
1898
+ slides,
1899
+ snapGrid,
1900
+ slidesGrid,
1901
+ slidesSizesGrid
1902
+ });
1903
+
1904
+ if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
1905
+ setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);
1906
+ setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);
1907
+ const addToSnapGrid = -swiper.snapGrid[0];
1908
+ const addToSlidesGrid = -swiper.slidesGrid[0];
1909
+ swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
1910
+ swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
1911
+ }
1912
+
1913
+ if (slidesLength !== previousSlidesLength) {
1914
+ swiper.emit('slidesLengthChange');
1915
+ }
1916
+
1917
+ if (snapGrid.length !== previousSnapGridLength) {
1918
+ if (swiper.params.watchOverflow) swiper.checkOverflow();
1919
+ swiper.emit('snapGridLengthChange');
1920
+ }
1921
+
1922
+ if (slidesGrid.length !== previousSlidesGridLength) {
1923
+ swiper.emit('slidesGridLengthChange');
1924
+ }
1925
+
1926
+ if (params.watchSlidesProgress) {
1927
+ swiper.updateSlidesOffset();
1928
+ }
1929
+
1930
+ if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
1931
+ const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
1932
+ const hasClassBackfaceClassAdded = swiper.$el.hasClass(backFaceHiddenClass);
1933
+
1934
+ if (slidesLength <= params.maxBackfaceHiddenSlides) {
1935
+ if (!hasClassBackfaceClassAdded) swiper.$el.addClass(backFaceHiddenClass);
1936
+ } else if (hasClassBackfaceClassAdded) {
1937
+ swiper.$el.removeClass(backFaceHiddenClass);
1938
+ }
1939
+ }
1940
+ }
1941
+
1942
+ function updateAutoHeight(speed) {
1943
+ const swiper = this;
1944
+ const activeSlides = [];
1945
+ const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
1946
+ let newHeight = 0;
1947
+ let i;
1948
+
1949
+ if (typeof speed === 'number') {
1950
+ swiper.setTransition(speed);
1951
+ } else if (speed === true) {
1952
+ swiper.setTransition(swiper.params.speed);
1953
+ }
1954
+
1955
+ const getSlideByIndex = index => {
1956
+ if (isVirtual) {
1957
+ return swiper.slides.filter(el => parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index)[0];
1958
+ }
1959
+
1960
+ return swiper.slides.eq(index)[0];
1961
+ }; // Find slides currently in view
1962
+
1963
+
1964
+ if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
1965
+ if (swiper.params.centeredSlides) {
1966
+ (swiper.visibleSlides || $([])).each(slide => {
1967
+ activeSlides.push(slide);
1968
+ });
1969
+ } else {
1970
+ for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
1971
+ const index = swiper.activeIndex + i;
1972
+ if (index > swiper.slides.length && !isVirtual) break;
1973
+ activeSlides.push(getSlideByIndex(index));
1974
+ }
1975
+ }
1976
+ } else {
1977
+ activeSlides.push(getSlideByIndex(swiper.activeIndex));
1978
+ } // Find new height from highest slide in view
1979
+
1980
+
1981
+ for (i = 0; i < activeSlides.length; i += 1) {
1982
+ if (typeof activeSlides[i] !== 'undefined') {
1983
+ const height = activeSlides[i].offsetHeight;
1984
+ newHeight = height > newHeight ? height : newHeight;
1985
+ }
1986
+ } // Update Height
1987
+
1988
+
1989
+ if (newHeight || newHeight === 0) swiper.$wrapperEl.css('height', `${newHeight}px`);
1990
+ }
1991
+
1992
+ function updateSlidesOffset() {
1993
+ const swiper = this;
1994
+ const slides = swiper.slides;
1995
+
1996
+ for (let i = 0; i < slides.length; i += 1) {
1997
+ slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
1998
+ }
1999
+ }
2000
+
2001
+ function updateSlidesProgress(translate) {
2002
+ if (translate === void 0) {
2003
+ translate = this && this.translate || 0;
2004
+ }
2005
+
2006
+ const swiper = this;
2007
+ const params = swiper.params;
2008
+ const {
2009
+ slides,
2010
+ rtlTranslate: rtl,
2011
+ snapGrid
2012
+ } = swiper;
2013
+ if (slides.length === 0) return;
2014
+ if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
2015
+ let offsetCenter = -translate;
2016
+ if (rtl) offsetCenter = translate; // Visible Slides
2017
+
2018
+ slides.removeClass(params.slideVisibleClass);
2019
+ swiper.visibleSlidesIndexes = [];
2020
+ swiper.visibleSlides = [];
2021
+
2022
+ for (let i = 0; i < slides.length; i += 1) {
2023
+ const slide = slides[i];
2024
+ let slideOffset = slide.swiperSlideOffset;
2025
+
2026
+ if (params.cssMode && params.centeredSlides) {
2027
+ slideOffset -= slides[0].swiperSlideOffset;
2028
+ }
2029
+
2030
+ const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween);
2031
+ const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween);
2032
+ const slideBefore = -(offsetCenter - slideOffset);
2033
+ const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
2034
+ const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
2035
+
2036
+ if (isVisible) {
2037
+ swiper.visibleSlides.push(slide);
2038
+ swiper.visibleSlidesIndexes.push(i);
2039
+ slides.eq(i).addClass(params.slideVisibleClass);
2040
+ }
2041
+
2042
+ slide.progress = rtl ? -slideProgress : slideProgress;
2043
+ slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
2044
+ }
2045
+
2046
+ swiper.visibleSlides = $(swiper.visibleSlides);
2047
+ }
2048
+
2049
+ function updateProgress(translate) {
2050
+ const swiper = this;
2051
+
2052
+ if (typeof translate === 'undefined') {
2053
+ const multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line
2054
+
2055
+ translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
2056
+ }
2057
+
2058
+ const params = swiper.params;
2059
+ const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
2060
+ let {
2061
+ progress,
2062
+ isBeginning,
2063
+ isEnd
2064
+ } = swiper;
2065
+ const wasBeginning = isBeginning;
2066
+ const wasEnd = isEnd;
2067
+
2068
+ if (translatesDiff === 0) {
2069
+ progress = 0;
2070
+ isBeginning = true;
2071
+ isEnd = true;
2072
+ } else {
2073
+ progress = (translate - swiper.minTranslate()) / translatesDiff;
2074
+ isBeginning = progress <= 0;
2075
+ isEnd = progress >= 1;
2076
+ }
2077
+
2078
+ Object.assign(swiper, {
2079
+ progress,
2080
+ isBeginning,
2081
+ isEnd
2082
+ });
2083
+ if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
2084
+
2085
+ if (isBeginning && !wasBeginning) {
2086
+ swiper.emit('reachBeginning toEdge');
2087
+ }
2088
+
2089
+ if (isEnd && !wasEnd) {
2090
+ swiper.emit('reachEnd toEdge');
2091
+ }
2092
+
2093
+ if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
2094
+ swiper.emit('fromEdge');
2095
+ }
2096
+
2097
+ swiper.emit('progress', progress);
2098
+ }
2099
+
2100
+ function updateSlidesClasses() {
2101
+ const swiper = this;
2102
+ const {
2103
+ slides,
2104
+ params,
2105
+ $wrapperEl,
2106
+ activeIndex,
2107
+ realIndex
2108
+ } = swiper;
2109
+ const isVirtual = swiper.virtual && params.virtual.enabled;
2110
+ slides.removeClass(`${params.slideActiveClass} ${params.slideNextClass} ${params.slidePrevClass} ${params.slideDuplicateActiveClass} ${params.slideDuplicateNextClass} ${params.slideDuplicatePrevClass}`);
2111
+ let activeSlide;
2112
+
2113
+ if (isVirtual) {
2114
+ activeSlide = swiper.$wrapperEl.find(`.${params.slideClass}[data-swiper-slide-index="${activeIndex}"]`);
2115
+ } else {
2116
+ activeSlide = slides.eq(activeIndex);
2117
+ } // Active classes
2118
+
2119
+
2120
+ activeSlide.addClass(params.slideActiveClass);
2121
+
2122
+ if (params.loop) {
2123
+ // Duplicate to all looped slides
2124
+ if (activeSlide.hasClass(params.slideDuplicateClass)) {
2125
+ $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass);
2126
+ } else {
2127
+ $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass);
2128
+ }
2129
+ } // Next Slide
2130
+
2131
+
2132
+ let nextSlide = activeSlide.nextAll(`.${params.slideClass}`).eq(0).addClass(params.slideNextClass);
2133
+
2134
+ if (params.loop && nextSlide.length === 0) {
2135
+ nextSlide = slides.eq(0);
2136
+ nextSlide.addClass(params.slideNextClass);
2137
+ } // Prev Slide
2138
+
2139
+
2140
+ let prevSlide = activeSlide.prevAll(`.${params.slideClass}`).eq(0).addClass(params.slidePrevClass);
2141
+
2142
+ if (params.loop && prevSlide.length === 0) {
2143
+ prevSlide = slides.eq(-1);
2144
+ prevSlide.addClass(params.slidePrevClass);
2145
+ }
2146
+
2147
+ if (params.loop) {
2148
+ // Duplicate to all looped slides
2149
+ if (nextSlide.hasClass(params.slideDuplicateClass)) {
2150
+ $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass);
2151
+ } else {
2152
+ $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass);
2153
+ }
2154
+
2155
+ if (prevSlide.hasClass(params.slideDuplicateClass)) {
2156
+ $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass);
2157
+ } else {
2158
+ $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass);
2159
+ }
2160
+ }
2161
+
2162
+ swiper.emitSlidesClasses();
2163
+ }
2164
+
2165
+ function updateActiveIndex(newActiveIndex) {
2166
+ const swiper = this;
2167
+ const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
2168
+ const {
2169
+ slidesGrid,
2170
+ snapGrid,
2171
+ params,
2172
+ activeIndex: previousIndex,
2173
+ realIndex: previousRealIndex,
2174
+ snapIndex: previousSnapIndex
2175
+ } = swiper;
2176
+ let activeIndex = newActiveIndex;
2177
+ let snapIndex;
2178
+
2179
+ if (typeof activeIndex === 'undefined') {
2180
+ for (let i = 0; i < slidesGrid.length; i += 1) {
2181
+ if (typeof slidesGrid[i + 1] !== 'undefined') {
2182
+ if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
2183
+ activeIndex = i;
2184
+ } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
2185
+ activeIndex = i + 1;
2186
+ }
2187
+ } else if (translate >= slidesGrid[i]) {
2188
+ activeIndex = i;
2189
+ }
2190
+ } // Normalize slideIndex
2191
+
2192
+
2193
+ if (params.normalizeSlideIndex) {
2194
+ if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
2195
+ }
2196
+ }
2197
+
2198
+ if (snapGrid.indexOf(translate) >= 0) {
2199
+ snapIndex = snapGrid.indexOf(translate);
2200
+ } else {
2201
+ const skip = Math.min(params.slidesPerGroupSkip, activeIndex);
2202
+ snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
2203
+ }
2204
+
2205
+ if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
2206
+
2207
+ if (activeIndex === previousIndex) {
2208
+ if (snapIndex !== previousSnapIndex) {
2209
+ swiper.snapIndex = snapIndex;
2210
+ swiper.emit('snapIndexChange');
2211
+ }
2212
+
2213
+ return;
2214
+ } // Get real index
2215
+
2216
+
2217
+ const realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
2218
+ Object.assign(swiper, {
2219
+ snapIndex,
2220
+ realIndex,
2221
+ previousIndex,
2222
+ activeIndex
2223
+ });
2224
+ swiper.emit('activeIndexChange');
2225
+ swiper.emit('snapIndexChange');
2226
+
2227
+ if (previousRealIndex !== realIndex) {
2228
+ swiper.emit('realIndexChange');
2229
+ }
2230
+
2231
+ if (swiper.initialized || swiper.params.runCallbacksOnInit) {
2232
+ swiper.emit('slideChange');
2233
+ }
2234
+ }
2235
+
2236
+ function updateClickedSlide(e) {
2237
+ const swiper = this;
2238
+ const params = swiper.params;
2239
+ const slide = $(e).closest(`.${params.slideClass}`)[0];
2240
+ let slideFound = false;
2241
+ let slideIndex;
2242
+
2243
+ if (slide) {
2244
+ for (let i = 0; i < swiper.slides.length; i += 1) {
2245
+ if (swiper.slides[i] === slide) {
2246
+ slideFound = true;
2247
+ slideIndex = i;
2248
+ break;
2249
+ }
2250
+ }
2251
+ }
2252
+
2253
+ if (slide && slideFound) {
2254
+ swiper.clickedSlide = slide;
2255
+
2256
+ if (swiper.virtual && swiper.params.virtual.enabled) {
2257
+ swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10);
2258
+ } else {
2259
+ swiper.clickedIndex = slideIndex;
2260
+ }
2261
+ } else {
2262
+ swiper.clickedSlide = undefined;
2263
+ swiper.clickedIndex = undefined;
2264
+ return;
2265
+ }
2266
+
2267
+ if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
2268
+ swiper.slideToClickedSlide();
2269
+ }
2270
+ }
2271
+
2272
+ const update = {
2273
+ updateSize,
2274
+ updateSlides,
2275
+ updateAutoHeight,
2276
+ updateSlidesOffset,
2277
+ updateSlidesProgress,
2278
+ updateProgress,
2279
+ updateSlidesClasses,
2280
+ updateActiveIndex,
2281
+ updateClickedSlide
2282
+ };
2283
+
2284
+ function getSwiperTranslate(axis) {
2285
+ if (axis === void 0) {
2286
+ axis = this.isHorizontal() ? 'x' : 'y';
2287
+ }
2288
+
2289
+ const swiper = this;
2290
+ const {
2291
+ params,
2292
+ rtlTranslate: rtl,
2293
+ translate,
2294
+ $wrapperEl
2295
+ } = swiper;
2296
+
2297
+ if (params.virtualTranslate) {
2298
+ return rtl ? -translate : translate;
2299
+ }
2300
+
2301
+ if (params.cssMode) {
2302
+ return translate;
2303
+ }
2304
+
2305
+ let currentTranslate = getTranslate($wrapperEl[0], axis);
2306
+ if (rtl) currentTranslate = -currentTranslate;
2307
+ return currentTranslate || 0;
2308
+ }
2309
+
2310
+ function setTranslate(translate, byController) {
2311
+ const swiper = this;
2312
+ const {
2313
+ rtlTranslate: rtl,
2314
+ params,
2315
+ $wrapperEl,
2316
+ wrapperEl,
2317
+ progress
2318
+ } = swiper;
2319
+ let x = 0;
2320
+ let y = 0;
2321
+ const z = 0;
2322
+
2323
+ if (swiper.isHorizontal()) {
2324
+ x = rtl ? -translate : translate;
2325
+ } else {
2326
+ y = translate;
2327
+ }
2328
+
2329
+ if (params.roundLengths) {
2330
+ x = Math.floor(x);
2331
+ y = Math.floor(y);
2332
+ }
2333
+
2334
+ if (params.cssMode) {
2335
+ wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
2336
+ } else if (!params.virtualTranslate) {
2337
+ $wrapperEl.transform(`translate3d(${x}px, ${y}px, ${z}px)`);
2338
+ }
2339
+
2340
+ swiper.previousTranslate = swiper.translate;
2341
+ swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress
2342
+
2343
+ let newProgress;
2344
+ const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
2345
+
2346
+ if (translatesDiff === 0) {
2347
+ newProgress = 0;
2348
+ } else {
2349
+ newProgress = (translate - swiper.minTranslate()) / translatesDiff;
2350
+ }
2351
+
2352
+ if (newProgress !== progress) {
2353
+ swiper.updateProgress(translate);
2354
+ }
2355
+
2356
+ swiper.emit('setTranslate', swiper.translate, byController);
2357
+ }
2358
+
2359
+ function minTranslate() {
2360
+ return -this.snapGrid[0];
2361
+ }
2362
+
2363
+ function maxTranslate() {
2364
+ return -this.snapGrid[this.snapGrid.length - 1];
2365
+ }
2366
+
2367
+ function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
2368
+ if (translate === void 0) {
2369
+ translate = 0;
2370
+ }
2371
+
2372
+ if (speed === void 0) {
2373
+ speed = this.params.speed;
2374
+ }
2375
+
2376
+ if (runCallbacks === void 0) {
2377
+ runCallbacks = true;
2378
+ }
2379
+
2380
+ if (translateBounds === void 0) {
2381
+ translateBounds = true;
2382
+ }
2383
+
2384
+ const swiper = this;
2385
+ const {
2386
+ params,
2387
+ wrapperEl
2388
+ } = swiper;
2389
+
2390
+ if (swiper.animating && params.preventInteractionOnTransition) {
2391
+ return false;
2392
+ }
2393
+
2394
+ const minTranslate = swiper.minTranslate();
2395
+ const maxTranslate = swiper.maxTranslate();
2396
+ let newTranslate;
2397
+ if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress
2398
+
2399
+ swiper.updateProgress(newTranslate);
2400
+
2401
+ if (params.cssMode) {
2402
+ const isH = swiper.isHorizontal();
2403
+
2404
+ if (speed === 0) {
2405
+ wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
2406
+ } else {
2407
+ if (!swiper.support.smoothScroll) {
2408
+ animateCSSModeScroll({
2409
+ swiper,
2410
+ targetPosition: -newTranslate,
2411
+ side: isH ? 'left' : 'top'
2412
+ });
2413
+ return true;
2414
+ }
2415
+
2416
+ wrapperEl.scrollTo({
2417
+ [isH ? 'left' : 'top']: -newTranslate,
2418
+ behavior: 'smooth'
2419
+ });
2420
+ }
2421
+
2422
+ return true;
2423
+ }
2424
+
2425
+ if (speed === 0) {
2426
+ swiper.setTransition(0);
2427
+ swiper.setTranslate(newTranslate);
2428
+
2429
+ if (runCallbacks) {
2430
+ swiper.emit('beforeTransitionStart', speed, internal);
2431
+ swiper.emit('transitionEnd');
2432
+ }
2433
+ } else {
2434
+ swiper.setTransition(speed);
2435
+ swiper.setTranslate(newTranslate);
2436
+
2437
+ if (runCallbacks) {
2438
+ swiper.emit('beforeTransitionStart', speed, internal);
2439
+ swiper.emit('transitionStart');
2440
+ }
2441
+
2442
+ if (!swiper.animating) {
2443
+ swiper.animating = true;
2444
+
2445
+ if (!swiper.onTranslateToWrapperTransitionEnd) {
2446
+ swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
2447
+ if (!swiper || swiper.destroyed) return;
2448
+ if (e.target !== this) return;
2449
+ swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
2450
+ swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
2451
+ swiper.onTranslateToWrapperTransitionEnd = null;
2452
+ delete swiper.onTranslateToWrapperTransitionEnd;
2453
+
2454
+ if (runCallbacks) {
2455
+ swiper.emit('transitionEnd');
2456
+ }
2457
+ };
2458
+ }
2459
+
2460
+ swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
2461
+ swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
2462
+ }
2463
+ }
2464
+
2465
+ return true;
2466
+ }
2467
+
2468
+ const translate = {
2469
+ getTranslate: getSwiperTranslate,
2470
+ setTranslate,
2471
+ minTranslate,
2472
+ maxTranslate,
2473
+ translateTo
2474
+ };
2475
+
2476
+ function setTransition(duration, byController) {
2477
+ const swiper = this;
2478
+
2479
+ if (!swiper.params.cssMode) {
2480
+ swiper.$wrapperEl.transition(duration);
2481
+ }
2482
+
2483
+ swiper.emit('setTransition', duration, byController);
2484
+ }
2485
+
2486
+ function transitionEmit(_ref) {
2487
+ let {
2488
+ swiper,
2489
+ runCallbacks,
2490
+ direction,
2491
+ step
2492
+ } = _ref;
2493
+ const {
2494
+ activeIndex,
2495
+ previousIndex
2496
+ } = swiper;
2497
+ let dir = direction;
2498
+
2499
+ if (!dir) {
2500
+ if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
2501
+ }
2502
+
2503
+ swiper.emit(`transition${step}`);
2504
+
2505
+ if (runCallbacks && activeIndex !== previousIndex) {
2506
+ if (dir === 'reset') {
2507
+ swiper.emit(`slideResetTransition${step}`);
2508
+ return;
2509
+ }
2510
+
2511
+ swiper.emit(`slideChangeTransition${step}`);
2512
+
2513
+ if (dir === 'next') {
2514
+ swiper.emit(`slideNextTransition${step}`);
2515
+ } else {
2516
+ swiper.emit(`slidePrevTransition${step}`);
2517
+ }
2518
+ }
2519
+ }
2520
+
2521
+ function transitionStart(runCallbacks, direction) {
2522
+ if (runCallbacks === void 0) {
2523
+ runCallbacks = true;
2524
+ }
2525
+
2526
+ const swiper = this;
2527
+ const {
2528
+ params
2529
+ } = swiper;
2530
+ if (params.cssMode) return;
2531
+
2532
+ if (params.autoHeight) {
2533
+ swiper.updateAutoHeight();
2534
+ }
2535
+
2536
+ transitionEmit({
2537
+ swiper,
2538
+ runCallbacks,
2539
+ direction,
2540
+ step: 'Start'
2541
+ });
2542
+ }
2543
+
2544
+ function transitionEnd(runCallbacks, direction) {
2545
+ if (runCallbacks === void 0) {
2546
+ runCallbacks = true;
2547
+ }
2548
+
2549
+ const swiper = this;
2550
+ const {
2551
+ params
2552
+ } = swiper;
2553
+ swiper.animating = false;
2554
+ if (params.cssMode) return;
2555
+ swiper.setTransition(0);
2556
+ transitionEmit({
2557
+ swiper,
2558
+ runCallbacks,
2559
+ direction,
2560
+ step: 'End'
2561
+ });
2562
+ }
2563
+
2564
+ const transition = {
2565
+ setTransition,
2566
+ transitionStart,
2567
+ transitionEnd
2568
+ };
2569
+
2570
+ function slideTo(index, speed, runCallbacks, internal, initial) {
2571
+ if (index === void 0) {
2572
+ index = 0;
2573
+ }
2574
+
2575
+ if (speed === void 0) {
2576
+ speed = this.params.speed;
2577
+ }
2578
+
2579
+ if (runCallbacks === void 0) {
2580
+ runCallbacks = true;
2581
+ }
2582
+
2583
+ if (typeof index !== 'number' && typeof index !== 'string') {
2584
+ throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof index}] given.`);
2585
+ }
2586
+
2587
+ if (typeof index === 'string') {
2588
+ /**
2589
+ * The `index` argument converted from `string` to `number`.
2590
+ * @type {number}
2591
+ */
2592
+ const indexAsNumber = parseInt(index, 10);
2593
+ /**
2594
+ * Determines whether the `index` argument is a valid `number`
2595
+ * after being converted from the `string` type.
2596
+ * @type {boolean}
2597
+ */
2598
+
2599
+ const isValidNumber = isFinite(indexAsNumber);
2600
+
2601
+ if (!isValidNumber) {
2602
+ throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`);
2603
+ } // Knowing that the converted `index` is a valid number,
2604
+ // we can update the original argument's value.
2605
+
2606
+
2607
+ index = indexAsNumber;
2608
+ }
2609
+
2610
+ const swiper = this;
2611
+ let slideIndex = index;
2612
+ if (slideIndex < 0) slideIndex = 0;
2613
+ const {
2614
+ params,
2615
+ snapGrid,
2616
+ slidesGrid,
2617
+ previousIndex,
2618
+ activeIndex,
2619
+ rtlTranslate: rtl,
2620
+ wrapperEl,
2621
+ enabled
2622
+ } = swiper;
2623
+
2624
+ if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
2625
+ return false;
2626
+ }
2627
+
2628
+ const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
2629
+ let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
2630
+ if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
2631
+
2632
+ if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {
2633
+ swiper.emit('beforeSlideChangeStart');
2634
+ }
2635
+
2636
+ const translate = -snapGrid[snapIndex]; // Update progress
2637
+
2638
+ swiper.updateProgress(translate); // Normalize slideIndex
2639
+
2640
+ if (params.normalizeSlideIndex) {
2641
+ for (let i = 0; i < slidesGrid.length; i += 1) {
2642
+ const normalizedTranslate = -Math.floor(translate * 100);
2643
+ const normalizedGrid = Math.floor(slidesGrid[i] * 100);
2644
+ const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
2645
+
2646
+ if (typeof slidesGrid[i + 1] !== 'undefined') {
2647
+ if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
2648
+ slideIndex = i;
2649
+ } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
2650
+ slideIndex = i + 1;
2651
+ }
2652
+ } else if (normalizedTranslate >= normalizedGrid) {
2653
+ slideIndex = i;
2654
+ }
2655
+ }
2656
+ } // Directions locks
2657
+
2658
+
2659
+ if (swiper.initialized && slideIndex !== activeIndex) {
2660
+ if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
2661
+ return false;
2662
+ }
2663
+
2664
+ if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
2665
+ if ((activeIndex || 0) !== slideIndex) return false;
2666
+ }
2667
+ }
2668
+
2669
+ let direction;
2670
+ if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index
2671
+
2672
+ if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
2673
+ swiper.updateActiveIndex(slideIndex); // Update Height
2674
+
2675
+ if (params.autoHeight) {
2676
+ swiper.updateAutoHeight();
2677
+ }
2678
+
2679
+ swiper.updateSlidesClasses();
2680
+
2681
+ if (params.effect !== 'slide') {
2682
+ swiper.setTranslate(translate);
2683
+ }
2684
+
2685
+ if (direction !== 'reset') {
2686
+ swiper.transitionStart(runCallbacks, direction);
2687
+ swiper.transitionEnd(runCallbacks, direction);
2688
+ }
2689
+
2690
+ return false;
2691
+ }
2692
+
2693
+ if (params.cssMode) {
2694
+ const isH = swiper.isHorizontal();
2695
+ const t = rtl ? translate : -translate;
2696
+
2697
+ if (speed === 0) {
2698
+ const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
2699
+
2700
+ if (isVirtual) {
2701
+ swiper.wrapperEl.style.scrollSnapType = 'none';
2702
+ swiper._immediateVirtual = true;
2703
+ }
2704
+
2705
+ wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
2706
+
2707
+ if (isVirtual) {
2708
+ requestAnimationFrame(() => {
2709
+ swiper.wrapperEl.style.scrollSnapType = '';
2710
+ swiper._swiperImmediateVirtual = false;
2711
+ });
2712
+ }
2713
+ } else {
2714
+ if (!swiper.support.smoothScroll) {
2715
+ animateCSSModeScroll({
2716
+ swiper,
2717
+ targetPosition: t,
2718
+ side: isH ? 'left' : 'top'
2719
+ });
2720
+ return true;
2721
+ }
2722
+
2723
+ wrapperEl.scrollTo({
2724
+ [isH ? 'left' : 'top']: t,
2725
+ behavior: 'smooth'
2726
+ });
2727
+ }
2728
+
2729
+ return true;
2730
+ }
2731
+
2732
+ swiper.setTransition(speed);
2733
+ swiper.setTranslate(translate);
2734
+ swiper.updateActiveIndex(slideIndex);
2735
+ swiper.updateSlidesClasses();
2736
+ swiper.emit('beforeTransitionStart', speed, internal);
2737
+ swiper.transitionStart(runCallbacks, direction);
2738
+
2739
+ if (speed === 0) {
2740
+ swiper.transitionEnd(runCallbacks, direction);
2741
+ } else if (!swiper.animating) {
2742
+ swiper.animating = true;
2743
+
2744
+ if (!swiper.onSlideToWrapperTransitionEnd) {
2745
+ swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
2746
+ if (!swiper || swiper.destroyed) return;
2747
+ if (e.target !== this) return;
2748
+ swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
2749
+ swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
2750
+ swiper.onSlideToWrapperTransitionEnd = null;
2751
+ delete swiper.onSlideToWrapperTransitionEnd;
2752
+ swiper.transitionEnd(runCallbacks, direction);
2753
+ };
2754
+ }
2755
+
2756
+ swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
2757
+ swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
2758
+ }
2759
+
2760
+ return true;
2761
+ }
2762
+
2763
+ function slideToLoop(index, speed, runCallbacks, internal) {
2764
+ if (index === void 0) {
2765
+ index = 0;
2766
+ }
2767
+
2768
+ if (speed === void 0) {
2769
+ speed = this.params.speed;
2770
+ }
2771
+
2772
+ if (runCallbacks === void 0) {
2773
+ runCallbacks = true;
2774
+ }
2775
+
2776
+ if (typeof index === 'string') {
2777
+ /**
2778
+ * The `index` argument converted from `string` to `number`.
2779
+ * @type {number}
2780
+ */
2781
+ const indexAsNumber = parseInt(index, 10);
2782
+ /**
2783
+ * Determines whether the `index` argument is a valid `number`
2784
+ * after being converted from the `string` type.
2785
+ * @type {boolean}
2786
+ */
2787
+
2788
+ const isValidNumber = isFinite(indexAsNumber);
2789
+
2790
+ if (!isValidNumber) {
2791
+ throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`);
2792
+ } // Knowing that the converted `index` is a valid number,
2793
+ // we can update the original argument's value.
2794
+
2795
+
2796
+ index = indexAsNumber;
2797
+ }
2798
+
2799
+ const swiper = this;
2800
+ let newIndex = index;
2801
+
2802
+ if (swiper.params.loop) {
2803
+ newIndex += swiper.loopedSlides;
2804
+ }
2805
+
2806
+ return swiper.slideTo(newIndex, speed, runCallbacks, internal);
2807
+ }
2808
+
2809
+ /* eslint no-unused-vars: "off" */
2810
+ function slideNext(speed, runCallbacks, internal) {
2811
+ if (speed === void 0) {
2812
+ speed = this.params.speed;
2813
+ }
2814
+
2815
+ if (runCallbacks === void 0) {
2816
+ runCallbacks = true;
2817
+ }
2818
+
2819
+ const swiper = this;
2820
+ const {
2821
+ animating,
2822
+ enabled,
2823
+ params
2824
+ } = swiper;
2825
+ if (!enabled) return swiper;
2826
+ let perGroup = params.slidesPerGroup;
2827
+
2828
+ if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
2829
+ perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
2830
+ }
2831
+
2832
+ const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
2833
+
2834
+ if (params.loop) {
2835
+ if (animating && params.loopPreventsSlide) return false;
2836
+ swiper.loopFix(); // eslint-disable-next-line
2837
+
2838
+ swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
2839
+ }
2840
+
2841
+ if (params.rewind && swiper.isEnd) {
2842
+ return swiper.slideTo(0, speed, runCallbacks, internal);
2843
+ }
2844
+
2845
+ return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
2846
+ }
2847
+
2848
+ /* eslint no-unused-vars: "off" */
2849
+ function slidePrev(speed, runCallbacks, internal) {
2850
+ if (speed === void 0) {
2851
+ speed = this.params.speed;
2852
+ }
2853
+
2854
+ if (runCallbacks === void 0) {
2855
+ runCallbacks = true;
2856
+ }
2857
+
2858
+ const swiper = this;
2859
+ const {
2860
+ params,
2861
+ animating,
2862
+ snapGrid,
2863
+ slidesGrid,
2864
+ rtlTranslate,
2865
+ enabled
2866
+ } = swiper;
2867
+ if (!enabled) return swiper;
2868
+
2869
+ if (params.loop) {
2870
+ if (animating && params.loopPreventsSlide) return false;
2871
+ swiper.loopFix(); // eslint-disable-next-line
2872
+
2873
+ swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
2874
+ }
2875
+
2876
+ const translate = rtlTranslate ? swiper.translate : -swiper.translate;
2877
+
2878
+ function normalize(val) {
2879
+ if (val < 0) return -Math.floor(Math.abs(val));
2880
+ return Math.floor(val);
2881
+ }
2882
+
2883
+ const normalizedTranslate = normalize(translate);
2884
+ const normalizedSnapGrid = snapGrid.map(val => normalize(val));
2885
+ let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
2886
+
2887
+ if (typeof prevSnap === 'undefined' && params.cssMode) {
2888
+ let prevSnapIndex;
2889
+ snapGrid.forEach((snap, snapIndex) => {
2890
+ if (normalizedTranslate >= snap) {
2891
+ // prevSnap = snap;
2892
+ prevSnapIndex = snapIndex;
2893
+ }
2894
+ });
2895
+
2896
+ if (typeof prevSnapIndex !== 'undefined') {
2897
+ prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
2898
+ }
2899
+ }
2900
+
2901
+ let prevIndex = 0;
2902
+
2903
+ if (typeof prevSnap !== 'undefined') {
2904
+ prevIndex = slidesGrid.indexOf(prevSnap);
2905
+ if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
2906
+
2907
+ if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
2908
+ prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
2909
+ prevIndex = Math.max(prevIndex, 0);
2910
+ }
2911
+ }
2912
+
2913
+ if (params.rewind && swiper.isBeginning) {
2914
+ const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
2915
+ return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
2916
+ }
2917
+
2918
+ return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
2919
+ }
2920
+
2921
+ /* eslint no-unused-vars: "off" */
2922
+ function slideReset(speed, runCallbacks, internal) {
2923
+ if (speed === void 0) {
2924
+ speed = this.params.speed;
2925
+ }
2926
+
2927
+ if (runCallbacks === void 0) {
2928
+ runCallbacks = true;
2929
+ }
2930
+
2931
+ const swiper = this;
2932
+ return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
2933
+ }
2934
+
2935
+ /* eslint no-unused-vars: "off" */
2936
+ function slideToClosest(speed, runCallbacks, internal, threshold) {
2937
+ if (speed === void 0) {
2938
+ speed = this.params.speed;
2939
+ }
2940
+
2941
+ if (runCallbacks === void 0) {
2942
+ runCallbacks = true;
2943
+ }
2944
+
2945
+ if (threshold === void 0) {
2946
+ threshold = 0.5;
2947
+ }
2948
+
2949
+ const swiper = this;
2950
+ let index = swiper.activeIndex;
2951
+ const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
2952
+ const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
2953
+ const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
2954
+
2955
+ if (translate >= swiper.snapGrid[snapIndex]) {
2956
+ // The current translate is on or after the current snap index, so the choice
2957
+ // is between the current index and the one after it.
2958
+ const currentSnap = swiper.snapGrid[snapIndex];
2959
+ const nextSnap = swiper.snapGrid[snapIndex + 1];
2960
+
2961
+ if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
2962
+ index += swiper.params.slidesPerGroup;
2963
+ }
2964
+ } else {
2965
+ // The current translate is before the current snap index, so the choice
2966
+ // is between the current index and the one before it.
2967
+ const prevSnap = swiper.snapGrid[snapIndex - 1];
2968
+ const currentSnap = swiper.snapGrid[snapIndex];
2969
+
2970
+ if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
2971
+ index -= swiper.params.slidesPerGroup;
2972
+ }
2973
+ }
2974
+
2975
+ index = Math.max(index, 0);
2976
+ index = Math.min(index, swiper.slidesGrid.length - 1);
2977
+ return swiper.slideTo(index, speed, runCallbacks, internal);
2978
+ }
2979
+
2980
+ function slideToClickedSlide() {
2981
+ const swiper = this;
2982
+ const {
2983
+ params,
2984
+ $wrapperEl
2985
+ } = swiper;
2986
+ const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
2987
+ let slideToIndex = swiper.clickedIndex;
2988
+ let realIndex;
2989
+
2990
+ if (params.loop) {
2991
+ if (swiper.animating) return;
2992
+ realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
2993
+
2994
+ if (params.centeredSlides) {
2995
+ if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
2996
+ swiper.loopFix();
2997
+ slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
2998
+ nextTick(() => {
2999
+ swiper.slideTo(slideToIndex);
3000
+ });
3001
+ } else {
3002
+ swiper.slideTo(slideToIndex);
3003
+ }
3004
+ } else if (slideToIndex > swiper.slides.length - slidesPerView) {
3005
+ swiper.loopFix();
3006
+ slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
3007
+ nextTick(() => {
3008
+ swiper.slideTo(slideToIndex);
3009
+ });
3010
+ } else {
3011
+ swiper.slideTo(slideToIndex);
3012
+ }
3013
+ } else {
3014
+ swiper.slideTo(slideToIndex);
3015
+ }
3016
+ }
3017
+
3018
+ const slide = {
3019
+ slideTo,
3020
+ slideToLoop,
3021
+ slideNext,
3022
+ slidePrev,
3023
+ slideReset,
3024
+ slideToClosest,
3025
+ slideToClickedSlide
3026
+ };
3027
+
3028
+ function loopCreate() {
3029
+ const swiper = this;
3030
+ const document = getDocument();
3031
+ const {
3032
+ params,
3033
+ $wrapperEl
3034
+ } = swiper; // Remove duplicated slides
3035
+
3036
+ const $selector = $wrapperEl.children().length > 0 ? $($wrapperEl.children()[0].parentNode) : $wrapperEl;
3037
+ $selector.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove();
3038
+ let slides = $selector.children(`.${params.slideClass}`);
3039
+
3040
+ if (params.loopFillGroupWithBlank) {
3041
+ const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;
3042
+
3043
+ if (blankSlidesNum !== params.slidesPerGroup) {
3044
+ for (let i = 0; i < blankSlidesNum; i += 1) {
3045
+ const blankNode = $(document.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`);
3046
+ $selector.append(blankNode);
3047
+ }
3048
+
3049
+ slides = $selector.children(`.${params.slideClass}`);
3050
+ }
3051
+ }
3052
+
3053
+ if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
3054
+ swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
3055
+ swiper.loopedSlides += params.loopAdditionalSlides;
3056
+
3057
+ if (swiper.loopedSlides > slides.length && swiper.params.loopedSlidesLimit) {
3058
+ swiper.loopedSlides = slides.length;
3059
+ }
3060
+
3061
+ const prependSlides = [];
3062
+ const appendSlides = [];
3063
+ slides.each((el, index) => {
3064
+ $(el).attr('data-swiper-slide-index', index);
3065
+ });
3066
+
3067
+ for (let i = 0; i < swiper.loopedSlides; i += 1) {
3068
+ const index = i - Math.floor(i / slides.length) * slides.length;
3069
+ appendSlides.push(slides.eq(index)[0]);
3070
+ prependSlides.unshift(slides.eq(slides.length - index - 1)[0]);
3071
+ }
3072
+
3073
+ for (let i = 0; i < appendSlides.length; i += 1) {
3074
+ $selector.append($(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
3075
+ }
3076
+
3077
+ for (let i = prependSlides.length - 1; i >= 0; i -= 1) {
3078
+ $selector.prepend($(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
3079
+ }
3080
+ }
3081
+
3082
+ function loopFix() {
3083
+ const swiper = this;
3084
+ swiper.emit('beforeLoopFix');
3085
+ const {
3086
+ activeIndex,
3087
+ slides,
3088
+ loopedSlides,
3089
+ allowSlidePrev,
3090
+ allowSlideNext,
3091
+ snapGrid,
3092
+ rtlTranslate: rtl
3093
+ } = swiper;
3094
+ let newIndex;
3095
+ swiper.allowSlidePrev = true;
3096
+ swiper.allowSlideNext = true;
3097
+ const snapTranslate = -snapGrid[activeIndex];
3098
+ const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding
3099
+
3100
+ if (activeIndex < loopedSlides) {
3101
+ newIndex = slides.length - loopedSlides * 3 + activeIndex;
3102
+ newIndex += loopedSlides;
3103
+ const slideChanged = swiper.slideTo(newIndex, 0, false, true);
3104
+
3105
+ if (slideChanged && diff !== 0) {
3106
+ swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
3107
+ }
3108
+ } else if (activeIndex >= slides.length - loopedSlides) {
3109
+ // Fix For Positive Oversliding
3110
+ newIndex = -slides.length + activeIndex + loopedSlides;
3111
+ newIndex += loopedSlides;
3112
+ const slideChanged = swiper.slideTo(newIndex, 0, false, true);
3113
+
3114
+ if (slideChanged && diff !== 0) {
3115
+ swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
3116
+ }
3117
+ }
3118
+
3119
+ swiper.allowSlidePrev = allowSlidePrev;
3120
+ swiper.allowSlideNext = allowSlideNext;
3121
+ swiper.emit('loopFix');
3122
+ }
3123
+
3124
+ function loopDestroy() {
3125
+ const swiper = this;
3126
+ const {
3127
+ $wrapperEl,
3128
+ params,
3129
+ slides
3130
+ } = swiper;
3131
+ $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove();
3132
+ slides.removeAttr('data-swiper-slide-index');
3133
+ }
3134
+
3135
+ const loop = {
3136
+ loopCreate,
3137
+ loopFix,
3138
+ loopDestroy
3139
+ };
3140
+
3141
+ function setGrabCursor(moving) {
3142
+ const swiper = this;
3143
+ if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
3144
+ const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
3145
+ el.style.cursor = 'move';
3146
+ el.style.cursor = moving ? 'grabbing' : 'grab';
3147
+ }
3148
+
3149
+ function unsetGrabCursor() {
3150
+ const swiper = this;
3151
+
3152
+ if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
3153
+ return;
3154
+ }
3155
+
3156
+ swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
3157
+ }
3158
+
3159
+ const grabCursor = {
3160
+ setGrabCursor,
3161
+ unsetGrabCursor
3162
+ };
3163
+
3164
+ function closestElement(selector, base) {
3165
+ if (base === void 0) {
3166
+ base = this;
3167
+ }
3168
+
3169
+ function __closestFrom(el) {
3170
+ if (!el || el === getDocument() || el === getWindow()) return null;
3171
+ if (el.assignedSlot) el = el.assignedSlot;
3172
+ const found = el.closest(selector);
3173
+
3174
+ if (!found && !el.getRootNode) {
3175
+ return null;
3176
+ }
3177
+
3178
+ return found || __closestFrom(el.getRootNode().host);
3179
+ }
3180
+
3181
+ return __closestFrom(base);
3182
+ }
3183
+
3184
+ function onTouchStart(event) {
3185
+ const swiper = this;
3186
+ const document = getDocument();
3187
+ const window = getWindow();
3188
+ const data = swiper.touchEventsData;
3189
+ const {
3190
+ params,
3191
+ touches,
3192
+ enabled
3193
+ } = swiper;
3194
+ if (!enabled) return;
3195
+
3196
+ if (swiper.animating && params.preventInteractionOnTransition) {
3197
+ return;
3198
+ }
3199
+
3200
+ if (!swiper.animating && params.cssMode && params.loop) {
3201
+ swiper.loopFix();
3202
+ }
3203
+
3204
+ let e = event;
3205
+ if (e.originalEvent) e = e.originalEvent;
3206
+ let $targetEl = $(e.target);
3207
+
3208
+ if (params.touchEventsTarget === 'wrapper') {
3209
+ if (!$targetEl.closest(swiper.wrapperEl).length) return;
3210
+ }
3211
+
3212
+ data.isTouchEvent = e.type === 'touchstart';
3213
+ if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
3214
+ if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
3215
+ if (data.isTouched && data.isMoved) return; // change target el for shadow root component
3216
+
3217
+ const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
3218
+
3219
+ if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) {
3220
+ $targetEl = $(event.path[0]);
3221
+ }
3222
+
3223
+ const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
3224
+ const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element
3225
+
3226
+ if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, $targetEl[0]) : $targetEl.closest(noSwipingSelector)[0])) {
3227
+ swiper.allowClick = true;
3228
+ return;
3229
+ }
3230
+
3231
+ if (params.swipeHandler) {
3232
+ if (!$targetEl.closest(params.swipeHandler)[0]) return;
3233
+ }
3234
+
3235
+ touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
3236
+ touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
3237
+ const startX = touches.currentX;
3238
+ const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
3239
+
3240
+ const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
3241
+ const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
3242
+
3243
+ if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
3244
+ if (edgeSwipeDetection === 'prevent') {
3245
+ event.preventDefault();
3246
+ } else {
3247
+ return;
3248
+ }
3249
+ }
3250
+
3251
+ Object.assign(data, {
3252
+ isTouched: true,
3253
+ isMoved: false,
3254
+ allowTouchCallbacks: true,
3255
+ isScrolling: undefined,
3256
+ startMoving: undefined
3257
+ });
3258
+ touches.startX = startX;
3259
+ touches.startY = startY;
3260
+ data.touchStartTime = now();
3261
+ swiper.allowClick = true;
3262
+ swiper.updateSize();
3263
+ swiper.swipeDirection = undefined;
3264
+ if (params.threshold > 0) data.allowThresholdMove = false;
3265
+
3266
+ if (e.type !== 'touchstart') {
3267
+ let preventDefault = true;
3268
+
3269
+ if ($targetEl.is(data.focusableElements)) {
3270
+ preventDefault = false;
3271
+
3272
+ if ($targetEl[0].nodeName === 'SELECT') {
3273
+ data.isTouched = false;
3274
+ }
3275
+ }
3276
+
3277
+ if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) {
3278
+ document.activeElement.blur();
3279
+ }
3280
+
3281
+ const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
3282
+
3283
+ if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) {
3284
+ e.preventDefault();
3285
+ }
3286
+ }
3287
+
3288
+ if (swiper.params.freeMode && swiper.params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
3289
+ swiper.freeMode.onTouchStart();
3290
+ }
3291
+
3292
+ swiper.emit('touchStart', e);
3293
+ }
3294
+
3295
+ function onTouchMove(event) {
3296
+ const document = getDocument();
3297
+ const swiper = this;
3298
+ const data = swiper.touchEventsData;
3299
+ const {
3300
+ params,
3301
+ touches,
3302
+ rtlTranslate: rtl,
3303
+ enabled
3304
+ } = swiper;
3305
+ if (!enabled) return;
3306
+ let e = event;
3307
+ if (e.originalEvent) e = e.originalEvent;
3308
+
3309
+ if (!data.isTouched) {
3310
+ if (data.startMoving && data.isScrolling) {
3311
+ swiper.emit('touchMoveOpposite', e);
3312
+ }
3313
+
3314
+ return;
3315
+ }
3316
+
3317
+ if (data.isTouchEvent && e.type !== 'touchmove') return;
3318
+ const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
3319
+ const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
3320
+ const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;
3321
+
3322
+ if (e.preventedByNestedSwiper) {
3323
+ touches.startX = pageX;
3324
+ touches.startY = pageY;
3325
+ return;
3326
+ }
3327
+
3328
+ if (!swiper.allowTouchMove) {
3329
+ if (!$(e.target).is(data.focusableElements)) {
3330
+ swiper.allowClick = false;
3331
+ }
3332
+
3333
+ if (data.isTouched) {
3334
+ Object.assign(touches, {
3335
+ startX: pageX,
3336
+ startY: pageY,
3337
+ currentX: pageX,
3338
+ currentY: pageY
3339
+ });
3340
+ data.touchStartTime = now();
3341
+ }
3342
+
3343
+ return;
3344
+ }
3345
+
3346
+ if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
3347
+ if (swiper.isVertical()) {
3348
+ // Vertical
3349
+ if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
3350
+ data.isTouched = false;
3351
+ data.isMoved = false;
3352
+ return;
3353
+ }
3354
+ } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
3355
+ return;
3356
+ }
3357
+ }
3358
+
3359
+ if (data.isTouchEvent && document.activeElement) {
3360
+ if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) {
3361
+ data.isMoved = true;
3362
+ swiper.allowClick = false;
3363
+ return;
3364
+ }
3365
+ }
3366
+
3367
+ if (data.allowTouchCallbacks) {
3368
+ swiper.emit('touchMove', e);
3369
+ }
3370
+
3371
+ if (e.targetTouches && e.targetTouches.length > 1) return;
3372
+ touches.currentX = pageX;
3373
+ touches.currentY = pageY;
3374
+ const diffX = touches.currentX - touches.startX;
3375
+ const diffY = touches.currentY - touches.startY;
3376
+ if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
3377
+
3378
+ if (typeof data.isScrolling === 'undefined') {
3379
+ let touchAngle;
3380
+
3381
+ if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
3382
+ data.isScrolling = false;
3383
+ } else {
3384
+ // eslint-disable-next-line
3385
+ if (diffX * diffX + diffY * diffY >= 25) {
3386
+ touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
3387
+ data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
3388
+ }
3389
+ }
3390
+ }
3391
+
3392
+ if (data.isScrolling) {
3393
+ swiper.emit('touchMoveOpposite', e);
3394
+ }
3395
+
3396
+ if (typeof data.startMoving === 'undefined') {
3397
+ if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
3398
+ data.startMoving = true;
3399
+ }
3400
+ }
3401
+
3402
+ if (data.isScrolling) {
3403
+ data.isTouched = false;
3404
+ return;
3405
+ }
3406
+
3407
+ if (!data.startMoving) {
3408
+ return;
3409
+ }
3410
+
3411
+ swiper.allowClick = false;
3412
+
3413
+ if (!params.cssMode && e.cancelable) {
3414
+ e.preventDefault();
3415
+ }
3416
+
3417
+ if (params.touchMoveStopPropagation && !params.nested) {
3418
+ e.stopPropagation();
3419
+ }
3420
+
3421
+ if (!data.isMoved) {
3422
+ if (params.loop && !params.cssMode) {
3423
+ swiper.loopFix();
3424
+ }
3425
+
3426
+ data.startTranslate = swiper.getTranslate();
3427
+ swiper.setTransition(0);
3428
+
3429
+ if (swiper.animating) {
3430
+ swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
3431
+ }
3432
+
3433
+ data.allowMomentumBounce = false; // Grab Cursor
3434
+
3435
+ if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
3436
+ swiper.setGrabCursor(true);
3437
+ }
3438
+
3439
+ swiper.emit('sliderFirstMove', e);
3440
+ }
3441
+
3442
+ swiper.emit('sliderMove', e);
3443
+ data.isMoved = true;
3444
+ let diff = swiper.isHorizontal() ? diffX : diffY;
3445
+ touches.diff = diff;
3446
+ diff *= params.touchRatio;
3447
+ if (rtl) diff = -diff;
3448
+ swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
3449
+ data.currentTranslate = diff + data.startTranslate;
3450
+ let disableParentSwiper = true;
3451
+ let resistanceRatio = params.resistanceRatio;
3452
+
3453
+ if (params.touchReleaseOnEdges) {
3454
+ resistanceRatio = 0;
3455
+ }
3456
+
3457
+ if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
3458
+ disableParentSwiper = false;
3459
+ if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
3460
+ } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
3461
+ disableParentSwiper = false;
3462
+ if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
3463
+ }
3464
+
3465
+ if (disableParentSwiper) {
3466
+ e.preventedByNestedSwiper = true;
3467
+ } // Directions locks
3468
+
3469
+
3470
+ if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
3471
+ data.currentTranslate = data.startTranslate;
3472
+ }
3473
+
3474
+ if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
3475
+ data.currentTranslate = data.startTranslate;
3476
+ }
3477
+
3478
+ if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
3479
+ data.currentTranslate = data.startTranslate;
3480
+ } // Threshold
3481
+
3482
+
3483
+ if (params.threshold > 0) {
3484
+ if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
3485
+ if (!data.allowThresholdMove) {
3486
+ data.allowThresholdMove = true;
3487
+ touches.startX = touches.currentX;
3488
+ touches.startY = touches.currentY;
3489
+ data.currentTranslate = data.startTranslate;
3490
+ touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
3491
+ return;
3492
+ }
3493
+ } else {
3494
+ data.currentTranslate = data.startTranslate;
3495
+ return;
3496
+ }
3497
+ }
3498
+
3499
+ if (!params.followFinger || params.cssMode) return; // Update active index in free mode
3500
+
3501
+ if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
3502
+ swiper.updateActiveIndex();
3503
+ swiper.updateSlidesClasses();
3504
+ }
3505
+
3506
+ if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) {
3507
+ swiper.freeMode.onTouchMove();
3508
+ } // Update progress
3509
+
3510
+
3511
+ swiper.updateProgress(data.currentTranslate); // Update translate
3512
+
3513
+ swiper.setTranslate(data.currentTranslate);
3514
+ }
3515
+
3516
+ function onTouchEnd(event) {
3517
+ const swiper = this;
3518
+ const data = swiper.touchEventsData;
3519
+ const {
3520
+ params,
3521
+ touches,
3522
+ rtlTranslate: rtl,
3523
+ slidesGrid,
3524
+ enabled
3525
+ } = swiper;
3526
+ if (!enabled) return;
3527
+ let e = event;
3528
+ if (e.originalEvent) e = e.originalEvent;
3529
+
3530
+ if (data.allowTouchCallbacks) {
3531
+ swiper.emit('touchEnd', e);
3532
+ }
3533
+
3534
+ data.allowTouchCallbacks = false;
3535
+
3536
+ if (!data.isTouched) {
3537
+ if (data.isMoved && params.grabCursor) {
3538
+ swiper.setGrabCursor(false);
3539
+ }
3540
+
3541
+ data.isMoved = false;
3542
+ data.startMoving = false;
3543
+ return;
3544
+ } // Return Grab Cursor
3545
+
3546
+
3547
+ if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
3548
+ swiper.setGrabCursor(false);
3549
+ } // Time diff
3550
+
3551
+
3552
+ const touchEndTime = now();
3553
+ const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click
3554
+
3555
+ if (swiper.allowClick) {
3556
+ const pathTree = e.path || e.composedPath && e.composedPath();
3557
+ swiper.updateClickedSlide(pathTree && pathTree[0] || e.target);
3558
+ swiper.emit('tap click', e);
3559
+
3560
+ if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
3561
+ swiper.emit('doubleTap doubleClick', e);
3562
+ }
3563
+ }
3564
+
3565
+ data.lastClickTime = now();
3566
+ nextTick(() => {
3567
+ if (!swiper.destroyed) swiper.allowClick = true;
3568
+ });
3569
+
3570
+ if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
3571
+ data.isTouched = false;
3572
+ data.isMoved = false;
3573
+ data.startMoving = false;
3574
+ return;
3575
+ }
3576
+
3577
+ data.isTouched = false;
3578
+ data.isMoved = false;
3579
+ data.startMoving = false;
3580
+ let currentPos;
3581
+
3582
+ if (params.followFinger) {
3583
+ currentPos = rtl ? swiper.translate : -swiper.translate;
3584
+ } else {
3585
+ currentPos = -data.currentTranslate;
3586
+ }
3587
+
3588
+ if (params.cssMode) {
3589
+ return;
3590
+ }
3591
+
3592
+ if (swiper.params.freeMode && params.freeMode.enabled) {
3593
+ swiper.freeMode.onTouchEnd({
3594
+ currentPos
3595
+ });
3596
+ return;
3597
+ } // Find current slide
3598
+
3599
+
3600
+ let stopIndex = 0;
3601
+ let groupSize = swiper.slidesSizesGrid[0];
3602
+
3603
+ for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
3604
+ const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
3605
+
3606
+ if (typeof slidesGrid[i + increment] !== 'undefined') {
3607
+ if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
3608
+ stopIndex = i;
3609
+ groupSize = slidesGrid[i + increment] - slidesGrid[i];
3610
+ }
3611
+ } else if (currentPos >= slidesGrid[i]) {
3612
+ stopIndex = i;
3613
+ groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
3614
+ }
3615
+ }
3616
+
3617
+ let rewindFirstIndex = null;
3618
+ let rewindLastIndex = null;
3619
+
3620
+ if (params.rewind) {
3621
+ if (swiper.isBeginning) {
3622
+ rewindLastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
3623
+ } else if (swiper.isEnd) {
3624
+ rewindFirstIndex = 0;
3625
+ }
3626
+ } // Find current slide size
3627
+
3628
+
3629
+ const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
3630
+ const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
3631
+
3632
+ if (timeDiff > params.longSwipesMs) {
3633
+ // Long touches
3634
+ if (!params.longSwipes) {
3635
+ swiper.slideTo(swiper.activeIndex);
3636
+ return;
3637
+ }
3638
+
3639
+ if (swiper.swipeDirection === 'next') {
3640
+ if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);
3641
+ }
3642
+
3643
+ if (swiper.swipeDirection === 'prev') {
3644
+ if (ratio > 1 - params.longSwipesRatio) {
3645
+ swiper.slideTo(stopIndex + increment);
3646
+ } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {
3647
+ swiper.slideTo(rewindLastIndex);
3648
+ } else {
3649
+ swiper.slideTo(stopIndex);
3650
+ }
3651
+ }
3652
+ } else {
3653
+ // Short swipes
3654
+ if (!params.shortSwipes) {
3655
+ swiper.slideTo(swiper.activeIndex);
3656
+ return;
3657
+ }
3658
+
3659
+ const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
3660
+
3661
+ if (!isNavButtonTarget) {
3662
+ if (swiper.swipeDirection === 'next') {
3663
+ swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);
3664
+ }
3665
+
3666
+ if (swiper.swipeDirection === 'prev') {
3667
+ swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);
3668
+ }
3669
+ } else if (e.target === swiper.navigation.nextEl) {
3670
+ swiper.slideTo(stopIndex + increment);
3671
+ } else {
3672
+ swiper.slideTo(stopIndex);
3673
+ }
3674
+ }
3675
+ }
3676
+
3677
+ function onResize() {
3678
+ const swiper = this;
3679
+ const {
3680
+ params,
3681
+ el
3682
+ } = swiper;
3683
+ if (el && el.offsetWidth === 0) return; // Breakpoints
3684
+
3685
+ if (params.breakpoints) {
3686
+ swiper.setBreakpoint();
3687
+ } // Save locks
3688
+
3689
+
3690
+ const {
3691
+ allowSlideNext,
3692
+ allowSlidePrev,
3693
+ snapGrid
3694
+ } = swiper; // Disable locks on resize
3695
+
3696
+ swiper.allowSlideNext = true;
3697
+ swiper.allowSlidePrev = true;
3698
+ swiper.updateSize();
3699
+ swiper.updateSlides();
3700
+ swiper.updateSlidesClasses();
3701
+
3702
+ if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
3703
+ swiper.slideTo(swiper.slides.length - 1, 0, false, true);
3704
+ } else {
3705
+ swiper.slideTo(swiper.activeIndex, 0, false, true);
3706
+ }
3707
+
3708
+ if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
3709
+ swiper.autoplay.run();
3710
+ } // Return locks after resize
3711
+
3712
+
3713
+ swiper.allowSlidePrev = allowSlidePrev;
3714
+ swiper.allowSlideNext = allowSlideNext;
3715
+
3716
+ if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
3717
+ swiper.checkOverflow();
3718
+ }
3719
+ }
3720
+
3721
+ function onClick(e) {
3722
+ const swiper = this;
3723
+ if (!swiper.enabled) return;
3724
+
3725
+ if (!swiper.allowClick) {
3726
+ if (swiper.params.preventClicks) e.preventDefault();
3727
+
3728
+ if (swiper.params.preventClicksPropagation && swiper.animating) {
3729
+ e.stopPropagation();
3730
+ e.stopImmediatePropagation();
3731
+ }
3732
+ }
3733
+ }
3734
+
3735
+ function onScroll() {
3736
+ const swiper = this;
3737
+ const {
3738
+ wrapperEl,
3739
+ rtlTranslate,
3740
+ enabled
3741
+ } = swiper;
3742
+ if (!enabled) return;
3743
+ swiper.previousTranslate = swiper.translate;
3744
+
3745
+ if (swiper.isHorizontal()) {
3746
+ swiper.translate = -wrapperEl.scrollLeft;
3747
+ } else {
3748
+ swiper.translate = -wrapperEl.scrollTop;
3749
+ } // eslint-disable-next-line
3750
+
3751
+
3752
+ if (swiper.translate === 0) swiper.translate = 0;
3753
+ swiper.updateActiveIndex();
3754
+ swiper.updateSlidesClasses();
3755
+ let newProgress;
3756
+ const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
3757
+
3758
+ if (translatesDiff === 0) {
3759
+ newProgress = 0;
3760
+ } else {
3761
+ newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
3762
+ }
3763
+
3764
+ if (newProgress !== swiper.progress) {
3765
+ swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
3766
+ }
3767
+
3768
+ swiper.emit('setTranslate', swiper.translate, false);
3769
+ }
3770
+
3771
+ let dummyEventAttached = false;
3772
+
3773
+ function dummyEventListener() {}
3774
+
3775
+ const events = (swiper, method) => {
3776
+ const document = getDocument();
3777
+ const {
3778
+ params,
3779
+ touchEvents,
3780
+ el,
3781
+ wrapperEl,
3782
+ device,
3783
+ support
3784
+ } = swiper;
3785
+ const capture = !!params.nested;
3786
+ const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
3787
+ const swiperMethod = method; // Touch Events
3788
+
3789
+ if (!support.touch) {
3790
+ el[domMethod](touchEvents.start, swiper.onTouchStart, false);
3791
+ document[domMethod](touchEvents.move, swiper.onTouchMove, capture);
3792
+ document[domMethod](touchEvents.end, swiper.onTouchEnd, false);
3793
+ } else {
3794
+ const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
3795
+ passive: true,
3796
+ capture: false
3797
+ } : false;
3798
+ el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener);
3799
+ el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
3800
+ passive: false,
3801
+ capture
3802
+ } : capture);
3803
+ el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener);
3804
+
3805
+ if (touchEvents.cancel) {
3806
+ el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener);
3807
+ }
3808
+ } // Prevent Links Clicks
3809
+
3810
+
3811
+ if (params.preventClicks || params.preventClicksPropagation) {
3812
+ el[domMethod]('click', swiper.onClick, true);
3813
+ }
3814
+
3815
+ if (params.cssMode) {
3816
+ wrapperEl[domMethod]('scroll', swiper.onScroll);
3817
+ } // Resize handler
3818
+
3819
+
3820
+ if (params.updateOnWindowResize) {
3821
+ swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
3822
+ } else {
3823
+ swiper[swiperMethod]('observerUpdate', onResize, true);
3824
+ }
3825
+ };
3826
+
3827
+ function attachEvents() {
3828
+ const swiper = this;
3829
+ const document = getDocument();
3830
+ const {
3831
+ params,
3832
+ support
3833
+ } = swiper;
3834
+ swiper.onTouchStart = onTouchStart.bind(swiper);
3835
+ swiper.onTouchMove = onTouchMove.bind(swiper);
3836
+ swiper.onTouchEnd = onTouchEnd.bind(swiper);
3837
+
3838
+ if (params.cssMode) {
3839
+ swiper.onScroll = onScroll.bind(swiper);
3840
+ }
3841
+
3842
+ swiper.onClick = onClick.bind(swiper);
3843
+
3844
+ if (support.touch && !dummyEventAttached) {
3845
+ document.addEventListener('touchstart', dummyEventListener);
3846
+ dummyEventAttached = true;
3847
+ }
3848
+
3849
+ events(swiper, 'on');
3850
+ }
3851
+
3852
+ function detachEvents() {
3853
+ const swiper = this;
3854
+ events(swiper, 'off');
3855
+ }
3856
+
3857
+ const events$1 = {
3858
+ attachEvents,
3859
+ detachEvents
3860
+ };
3861
+
3862
+ const isGridEnabled = (swiper, params) => {
3863
+ return swiper.grid && params.grid && params.grid.rows > 1;
3864
+ };
3865
+
3866
+ function setBreakpoint() {
3867
+ const swiper = this;
3868
+ const {
3869
+ activeIndex,
3870
+ initialized,
3871
+ loopedSlides = 0,
3872
+ params,
3873
+ $el
3874
+ } = swiper;
3875
+ const breakpoints = params.breakpoints;
3876
+ if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters
3877
+
3878
+ const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
3879
+ if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
3880
+ const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
3881
+ const breakpointParams = breakpointOnlyParams || swiper.originalParams;
3882
+ const wasMultiRow = isGridEnabled(swiper, params);
3883
+ const isMultiRow = isGridEnabled(swiper, breakpointParams);
3884
+ const wasEnabled = params.enabled;
3885
+
3886
+ if (wasMultiRow && !isMultiRow) {
3887
+ $el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`);
3888
+ swiper.emitContainerClasses();
3889
+ } else if (!wasMultiRow && isMultiRow) {
3890
+ $el.addClass(`${params.containerModifierClass}grid`);
3891
+
3892
+ if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
3893
+ $el.addClass(`${params.containerModifierClass}grid-column`);
3894
+ }
3895
+
3896
+ swiper.emitContainerClasses();
3897
+ } // Toggle navigation, pagination, scrollbar
3898
+
3899
+
3900
+ ['navigation', 'pagination', 'scrollbar'].forEach(prop => {
3901
+ const wasModuleEnabled = params[prop] && params[prop].enabled;
3902
+ const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
3903
+
3904
+ if (wasModuleEnabled && !isModuleEnabled) {
3905
+ swiper[prop].disable();
3906
+ }
3907
+
3908
+ if (!wasModuleEnabled && isModuleEnabled) {
3909
+ swiper[prop].enable();
3910
+ }
3911
+ });
3912
+ const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
3913
+ const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
3914
+
3915
+ if (directionChanged && initialized) {
3916
+ swiper.changeDirection();
3917
+ }
3918
+
3919
+ extend(swiper.params, breakpointParams);
3920
+ const isEnabled = swiper.params.enabled;
3921
+ Object.assign(swiper, {
3922
+ allowTouchMove: swiper.params.allowTouchMove,
3923
+ allowSlideNext: swiper.params.allowSlideNext,
3924
+ allowSlidePrev: swiper.params.allowSlidePrev
3925
+ });
3926
+
3927
+ if (wasEnabled && !isEnabled) {
3928
+ swiper.disable();
3929
+ } else if (!wasEnabled && isEnabled) {
3930
+ swiper.enable();
3931
+ }
3932
+
3933
+ swiper.currentBreakpoint = breakpoint;
3934
+ swiper.emit('_beforeBreakpoint', breakpointParams);
3935
+
3936
+ if (needsReLoop && initialized) {
3937
+ swiper.loopDestroy();
3938
+ swiper.loopCreate();
3939
+ swiper.updateSlides();
3940
+ swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
3941
+ }
3942
+
3943
+ swiper.emit('breakpoint', breakpointParams);
3944
+ }
3945
+
3946
+ function getBreakpoint(breakpoints, base, containerEl) {
3947
+ if (base === void 0) {
3948
+ base = 'window';
3949
+ }
3950
+
3951
+ if (!breakpoints || base === 'container' && !containerEl) return undefined;
3952
+ let breakpoint = false;
3953
+ const window = getWindow();
3954
+ const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
3955
+ const points = Object.keys(breakpoints).map(point => {
3956
+ if (typeof point === 'string' && point.indexOf('@') === 0) {
3957
+ const minRatio = parseFloat(point.substr(1));
3958
+ const value = currentHeight * minRatio;
3959
+ return {
3960
+ value,
3961
+ point
3962
+ };
3963
+ }
3964
+
3965
+ return {
3966
+ value: point,
3967
+ point
3968
+ };
3969
+ });
3970
+ points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
3971
+
3972
+ for (let i = 0; i < points.length; i += 1) {
3973
+ const {
3974
+ point,
3975
+ value
3976
+ } = points[i];
3977
+
3978
+ if (base === 'window') {
3979
+ if (window.matchMedia(`(min-width: ${value}px)`).matches) {
3980
+ breakpoint = point;
3981
+ }
3982
+ } else if (value <= containerEl.clientWidth) {
3983
+ breakpoint = point;
3984
+ }
3985
+ }
3986
+
3987
+ return breakpoint || 'max';
3988
+ }
3989
+
3990
+ const breakpoints = {
3991
+ setBreakpoint,
3992
+ getBreakpoint
3993
+ };
3994
+
3995
+ function prepareClasses(entries, prefix) {
3996
+ const resultClasses = [];
3997
+ entries.forEach(item => {
3998
+ if (typeof item === 'object') {
3999
+ Object.keys(item).forEach(classNames => {
4000
+ if (item[classNames]) {
4001
+ resultClasses.push(prefix + classNames);
4002
+ }
4003
+ });
4004
+ } else if (typeof item === 'string') {
4005
+ resultClasses.push(prefix + item);
4006
+ }
4007
+ });
4008
+ return resultClasses;
4009
+ }
4010
+
4011
+ function addClasses() {
4012
+ const swiper = this;
4013
+ const {
4014
+ classNames,
4015
+ params,
4016
+ rtl,
4017
+ $el,
4018
+ device,
4019
+ support
4020
+ } = swiper; // prettier-ignore
4021
+
4022
+ const suffixes = prepareClasses(['initialized', params.direction, {
4023
+ 'pointer-events': !support.touch
4024
+ }, {
4025
+ 'free-mode': swiper.params.freeMode && params.freeMode.enabled
4026
+ }, {
4027
+ 'autoheight': params.autoHeight
4028
+ }, {
4029
+ 'rtl': rtl
4030
+ }, {
4031
+ 'grid': params.grid && params.grid.rows > 1
4032
+ }, {
4033
+ 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
4034
+ }, {
4035
+ 'android': device.android
4036
+ }, {
4037
+ 'ios': device.ios
4038
+ }, {
4039
+ 'css-mode': params.cssMode
4040
+ }, {
4041
+ 'centered': params.cssMode && params.centeredSlides
4042
+ }, {
4043
+ 'watch-progress': params.watchSlidesProgress
4044
+ }], params.containerModifierClass);
4045
+ classNames.push(...suffixes);
4046
+ $el.addClass([...classNames].join(' '));
4047
+ swiper.emitContainerClasses();
4048
+ }
4049
+
4050
+ function removeClasses() {
4051
+ const swiper = this;
4052
+ const {
4053
+ $el,
4054
+ classNames
4055
+ } = swiper;
4056
+ $el.removeClass(classNames.join(' '));
4057
+ swiper.emitContainerClasses();
4058
+ }
4059
+
4060
+ const classes = {
4061
+ addClasses,
4062
+ removeClasses
4063
+ };
4064
+
4065
+ function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
4066
+ const window = getWindow();
4067
+ let image;
4068
+
4069
+ function onReady() {
4070
+ if (callback) callback();
4071
+ }
4072
+
4073
+ const isPicture = $(imageEl).parent('picture')[0];
4074
+
4075
+ if (!isPicture && (!imageEl.complete || !checkForComplete)) {
4076
+ if (src) {
4077
+ image = new window.Image();
4078
+ image.onload = onReady;
4079
+ image.onerror = onReady;
4080
+
4081
+ if (sizes) {
4082
+ image.sizes = sizes;
4083
+ }
4084
+
4085
+ if (srcset) {
4086
+ image.srcset = srcset;
4087
+ }
4088
+
4089
+ if (src) {
4090
+ image.src = src;
4091
+ }
4092
+ } else {
4093
+ onReady();
4094
+ }
4095
+ } else {
4096
+ // image already loaded...
4097
+ onReady();
4098
+ }
4099
+ }
4100
+
4101
+ function preloadImages() {
4102
+ const swiper = this;
4103
+ swiper.imagesToLoad = swiper.$el.find('img');
4104
+
4105
+ function onReady() {
4106
+ if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
4107
+ if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;
4108
+
4109
+ if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
4110
+ if (swiper.params.updateOnImagesReady) swiper.update();
4111
+ swiper.emit('imagesReady');
4112
+ }
4113
+ }
4114
+
4115
+ for (let i = 0; i < swiper.imagesToLoad.length; i += 1) {
4116
+ const imageEl = swiper.imagesToLoad[i];
4117
+ swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
4118
+ }
4119
+ }
4120
+
4121
+ const images = {
4122
+ loadImage,
4123
+ preloadImages
4124
+ };
4125
+
4126
+ function checkOverflow() {
4127
+ const swiper = this;
4128
+ const {
4129
+ isLocked: wasLocked,
4130
+ params
4131
+ } = swiper;
4132
+ const {
4133
+ slidesOffsetBefore
4134
+ } = params;
4135
+
4136
+ if (slidesOffsetBefore) {
4137
+ const lastSlideIndex = swiper.slides.length - 1;
4138
+ const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
4139
+ swiper.isLocked = swiper.size > lastSlideRightEdge;
4140
+ } else {
4141
+ swiper.isLocked = swiper.snapGrid.length === 1;
4142
+ }
4143
+
4144
+ if (params.allowSlideNext === true) {
4145
+ swiper.allowSlideNext = !swiper.isLocked;
4146
+ }
4147
+
4148
+ if (params.allowSlidePrev === true) {
4149
+ swiper.allowSlidePrev = !swiper.isLocked;
4150
+ }
4151
+
4152
+ if (wasLocked && wasLocked !== swiper.isLocked) {
4153
+ swiper.isEnd = false;
4154
+ }
4155
+
4156
+ if (wasLocked !== swiper.isLocked) {
4157
+ swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
4158
+ }
4159
+ }
4160
+
4161
+ const checkOverflow$1 = {
4162
+ checkOverflow
4163
+ };
4164
+
4165
+ const defaults = {
4166
+ init: true,
4167
+ direction: 'horizontal',
4168
+ touchEventsTarget: 'wrapper',
4169
+ initialSlide: 0,
4170
+ speed: 300,
4171
+ cssMode: false,
4172
+ updateOnWindowResize: true,
4173
+ resizeObserver: true,
4174
+ nested: false,
4175
+ createElements: false,
4176
+ enabled: true,
4177
+ focusableElements: 'input, select, option, textarea, button, video, label',
4178
+ // Overrides
4179
+ width: null,
4180
+ height: null,
4181
+ //
4182
+ preventInteractionOnTransition: false,
4183
+ // ssr
4184
+ userAgent: null,
4185
+ url: null,
4186
+ // To support iOS's swipe-to-go-back gesture (when being used in-app).
4187
+ edgeSwipeDetection: false,
4188
+ edgeSwipeThreshold: 20,
4189
+ // Autoheight
4190
+ autoHeight: false,
4191
+ // Set wrapper width
4192
+ setWrapperSize: false,
4193
+ // Virtual Translate
4194
+ virtualTranslate: false,
4195
+ // Effects
4196
+ effect: 'slide',
4197
+ // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
4198
+ // Breakpoints
4199
+ breakpoints: undefined,
4200
+ breakpointsBase: 'window',
4201
+ // Slides grid
4202
+ spaceBetween: 0,
4203
+ slidesPerView: 1,
4204
+ slidesPerGroup: 1,
4205
+ slidesPerGroupSkip: 0,
4206
+ slidesPerGroupAuto: false,
4207
+ centeredSlides: false,
4208
+ centeredSlidesBounds: false,
4209
+ slidesOffsetBefore: 0,
4210
+ // in px
4211
+ slidesOffsetAfter: 0,
4212
+ // in px
4213
+ normalizeSlideIndex: true,
4214
+ centerInsufficientSlides: false,
4215
+ // Disable swiper and hide navigation when container not overflow
4216
+ watchOverflow: true,
4217
+ // Round length
4218
+ roundLengths: false,
4219
+ // Touches
4220
+ touchRatio: 1,
4221
+ touchAngle: 45,
4222
+ simulateTouch: true,
4223
+ shortSwipes: true,
4224
+ longSwipes: true,
4225
+ longSwipesRatio: 0.5,
4226
+ longSwipesMs: 300,
4227
+ followFinger: true,
4228
+ allowTouchMove: true,
4229
+ threshold: 0,
4230
+ touchMoveStopPropagation: false,
4231
+ touchStartPreventDefault: true,
4232
+ touchStartForcePreventDefault: false,
4233
+ touchReleaseOnEdges: false,
4234
+ // Unique Navigation Elements
4235
+ uniqueNavElements: true,
4236
+ // Resistance
4237
+ resistance: true,
4238
+ resistanceRatio: 0.85,
4239
+ // Progress
4240
+ watchSlidesProgress: false,
4241
+ // Cursor
4242
+ grabCursor: false,
4243
+ // Clicks
4244
+ preventClicks: true,
4245
+ preventClicksPropagation: true,
4246
+ slideToClickedSlide: false,
4247
+ // Images
4248
+ preloadImages: true,
4249
+ updateOnImagesReady: true,
4250
+ // loop
4251
+ loop: false,
4252
+ loopAdditionalSlides: 0,
4253
+ loopedSlides: null,
4254
+ loopedSlidesLimit: true,
4255
+ loopFillGroupWithBlank: false,
4256
+ loopPreventsSlide: true,
4257
+ // rewind
4258
+ rewind: false,
4259
+ // Swiping/no swiping
4260
+ allowSlidePrev: true,
4261
+ allowSlideNext: true,
4262
+ swipeHandler: null,
4263
+ // '.swipe-handler',
4264
+ noSwiping: true,
4265
+ noSwipingClass: 'swiper-no-swiping',
4266
+ noSwipingSelector: null,
4267
+ // Passive Listeners
4268
+ passiveListeners: true,
4269
+ maxBackfaceHiddenSlides: 10,
4270
+ // NS
4271
+ containerModifierClass: 'swiper-',
4272
+ // NEW
4273
+ slideClass: 'swiper-slide',
4274
+ slideBlankClass: 'swiper-slide-invisible-blank',
4275
+ slideActiveClass: 'swiper-slide-active',
4276
+ slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
4277
+ slideVisibleClass: 'swiper-slide-visible',
4278
+ slideDuplicateClass: 'swiper-slide-duplicate',
4279
+ slideNextClass: 'swiper-slide-next',
4280
+ slideDuplicateNextClass: 'swiper-slide-duplicate-next',
4281
+ slidePrevClass: 'swiper-slide-prev',
4282
+ slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
4283
+ wrapperClass: 'swiper-wrapper',
4284
+ // Callbacks
4285
+ runCallbacksOnInit: true,
4286
+ // Internals
4287
+ _emitClasses: false
4288
+ };
4289
+
4290
+ function moduleExtendParams(params, allModulesParams) {
4291
+ return function extendParams(obj) {
4292
+ if (obj === void 0) {
4293
+ obj = {};
4294
+ }
4295
+
4296
+ const moduleParamName = Object.keys(obj)[0];
4297
+ const moduleParams = obj[moduleParamName];
4298
+
4299
+ if (typeof moduleParams !== 'object' || moduleParams === null) {
4300
+ extend(allModulesParams, obj);
4301
+ return;
4302
+ }
4303
+
4304
+ if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {
4305
+ params[moduleParamName] = {
4306
+ auto: true
4307
+ };
4308
+ }
4309
+
4310
+ if (!(moduleParamName in params && 'enabled' in moduleParams)) {
4311
+ extend(allModulesParams, obj);
4312
+ return;
4313
+ }
4314
+
4315
+ if (params[moduleParamName] === true) {
4316
+ params[moduleParamName] = {
4317
+ enabled: true
4318
+ };
4319
+ }
4320
+
4321
+ if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
4322
+ params[moduleParamName].enabled = true;
4323
+ }
4324
+
4325
+ if (!params[moduleParamName]) params[moduleParamName] = {
4326
+ enabled: false
4327
+ };
4328
+ extend(allModulesParams, obj);
4329
+ };
4330
+ }
4331
+
4332
+ /* eslint no-param-reassign: "off" */
4333
+ const prototypes = {
4334
+ eventsEmitter,
4335
+ update,
4336
+ translate,
4337
+ transition,
4338
+ slide,
4339
+ loop,
4340
+ grabCursor,
4341
+ events: events$1,
4342
+ breakpoints,
4343
+ checkOverflow: checkOverflow$1,
4344
+ classes,
4345
+ images
4346
+ };
4347
+ const extendedDefaults = {};
4348
+
4349
+ class Swiper {
4350
+ constructor() {
4351
+ let el;
4352
+ let params;
4353
+
4354
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4355
+ args[_key] = arguments[_key];
4356
+ }
4357
+
4358
+ if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
4359
+ params = args[0];
4360
+ } else {
4361
+ [el, params] = args;
4362
+ }
4363
+
4364
+ if (!params) params = {};
4365
+ params = extend({}, params);
4366
+ if (el && !params.el) params.el = el;
4367
+
4368
+ if (params.el && $(params.el).length > 1) {
4369
+ const swipers = [];
4370
+ $(params.el).each(containerEl => {
4371
+ const newParams = extend({}, params, {
4372
+ el: containerEl
4373
+ });
4374
+ swipers.push(new Swiper(newParams));
4375
+ });
4376
+ return swipers;
4377
+ } // Swiper Instance
4378
+
4379
+
4380
+ const swiper = this;
4381
+ swiper.__swiper__ = true;
4382
+ swiper.support = getSupport();
4383
+ swiper.device = getDevice({
4384
+ userAgent: params.userAgent
4385
+ });
4386
+ swiper.browser = getBrowser();
4387
+ swiper.eventsListeners = {};
4388
+ swiper.eventsAnyListeners = [];
4389
+ swiper.modules = [...swiper.__modules__];
4390
+
4391
+ if (params.modules && Array.isArray(params.modules)) {
4392
+ swiper.modules.push(...params.modules);
4393
+ }
4394
+
4395
+ const allModulesParams = {};
4396
+ swiper.modules.forEach(mod => {
4397
+ mod({
4398
+ swiper,
4399
+ extendParams: moduleExtendParams(params, allModulesParams),
4400
+ on: swiper.on.bind(swiper),
4401
+ once: swiper.once.bind(swiper),
4402
+ off: swiper.off.bind(swiper),
4403
+ emit: swiper.emit.bind(swiper)
4404
+ });
4405
+ }); // Extend defaults with modules params
4406
+
4407
+ const swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params
4408
+
4409
+ swiper.params = extend({}, swiperParams, extendedDefaults, params);
4410
+ swiper.originalParams = extend({}, swiper.params);
4411
+ swiper.passedParams = extend({}, params); // add event listeners
4412
+
4413
+ if (swiper.params && swiper.params.on) {
4414
+ Object.keys(swiper.params.on).forEach(eventName => {
4415
+ swiper.on(eventName, swiper.params.on[eventName]);
4416
+ });
4417
+ }
4418
+
4419
+ if (swiper.params && swiper.params.onAny) {
4420
+ swiper.onAny(swiper.params.onAny);
4421
+ } // Save Dom lib
4422
+
4423
+
4424
+ swiper.$ = $; // Extend Swiper
4425
+
4426
+ Object.assign(swiper, {
4427
+ enabled: swiper.params.enabled,
4428
+ el,
4429
+ // Classes
4430
+ classNames: [],
4431
+ // Slides
4432
+ slides: $(),
4433
+ slidesGrid: [],
4434
+ snapGrid: [],
4435
+ slidesSizesGrid: [],
4436
+
4437
+ // isDirection
4438
+ isHorizontal() {
4439
+ return swiper.params.direction === 'horizontal';
4440
+ },
4441
+
4442
+ isVertical() {
4443
+ return swiper.params.direction === 'vertical';
4444
+ },
4445
+
4446
+ // Indexes
4447
+ activeIndex: 0,
4448
+ realIndex: 0,
4449
+ //
4450
+ isBeginning: true,
4451
+ isEnd: false,
4452
+ // Props
4453
+ translate: 0,
4454
+ previousTranslate: 0,
4455
+ progress: 0,
4456
+ velocity: 0,
4457
+ animating: false,
4458
+ // Locks
4459
+ allowSlideNext: swiper.params.allowSlideNext,
4460
+ allowSlidePrev: swiper.params.allowSlidePrev,
4461
+ // Touch Events
4462
+ touchEvents: function touchEvents() {
4463
+ const touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
4464
+ const desktop = ['pointerdown', 'pointermove', 'pointerup'];
4465
+ swiper.touchEventsTouch = {
4466
+ start: touch[0],
4467
+ move: touch[1],
4468
+ end: touch[2],
4469
+ cancel: touch[3]
4470
+ };
4471
+ swiper.touchEventsDesktop = {
4472
+ start: desktop[0],
4473
+ move: desktop[1],
4474
+ end: desktop[2]
4475
+ };
4476
+ return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
4477
+ }(),
4478
+ touchEventsData: {
4479
+ isTouched: undefined,
4480
+ isMoved: undefined,
4481
+ allowTouchCallbacks: undefined,
4482
+ touchStartTime: undefined,
4483
+ isScrolling: undefined,
4484
+ currentTranslate: undefined,
4485
+ startTranslate: undefined,
4486
+ allowThresholdMove: undefined,
4487
+ // Form elements to match
4488
+ focusableElements: swiper.params.focusableElements,
4489
+ // Last click time
4490
+ lastClickTime: now(),
4491
+ clickTimeout: undefined,
4492
+ // Velocities
4493
+ velocities: [],
4494
+ allowMomentumBounce: undefined,
4495
+ isTouchEvent: undefined,
4496
+ startMoving: undefined
4497
+ },
4498
+ // Clicks
4499
+ allowClick: true,
4500
+ // Touches
4501
+ allowTouchMove: swiper.params.allowTouchMove,
4502
+ touches: {
4503
+ startX: 0,
4504
+ startY: 0,
4505
+ currentX: 0,
4506
+ currentY: 0,
4507
+ diff: 0
4508
+ },
4509
+ // Images
4510
+ imagesToLoad: [],
4511
+ imagesLoaded: 0
4512
+ });
4513
+ swiper.emit('_swiper'); // Init
4514
+
4515
+ if (swiper.params.init) {
4516
+ swiper.init();
4517
+ } // Return app instance
4518
+
4519
+
4520
+ return swiper;
4521
+ }
4522
+
4523
+ enable() {
4524
+ const swiper = this;
4525
+ if (swiper.enabled) return;
4526
+ swiper.enabled = true;
4527
+
4528
+ if (swiper.params.grabCursor) {
4529
+ swiper.setGrabCursor();
4530
+ }
4531
+
4532
+ swiper.emit('enable');
4533
+ }
4534
+
4535
+ disable() {
4536
+ const swiper = this;
4537
+ if (!swiper.enabled) return;
4538
+ swiper.enabled = false;
4539
+
4540
+ if (swiper.params.grabCursor) {
4541
+ swiper.unsetGrabCursor();
4542
+ }
4543
+
4544
+ swiper.emit('disable');
4545
+ }
4546
+
4547
+ setProgress(progress, speed) {
4548
+ const swiper = this;
4549
+ progress = Math.min(Math.max(progress, 0), 1);
4550
+ const min = swiper.minTranslate();
4551
+ const max = swiper.maxTranslate();
4552
+ const current = (max - min) * progress + min;
4553
+ swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
4554
+ swiper.updateActiveIndex();
4555
+ swiper.updateSlidesClasses();
4556
+ }
4557
+
4558
+ emitContainerClasses() {
4559
+ const swiper = this;
4560
+ if (!swiper.params._emitClasses || !swiper.el) return;
4561
+ const cls = swiper.el.className.split(' ').filter(className => {
4562
+ return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
4563
+ });
4564
+ swiper.emit('_containerClasses', cls.join(' '));
4565
+ }
4566
+
4567
+ getSlideClasses(slideEl) {
4568
+ const swiper = this;
4569
+ if (swiper.destroyed) return '';
4570
+ return slideEl.className.split(' ').filter(className => {
4571
+ return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
4572
+ }).join(' ');
4573
+ }
4574
+
4575
+ emitSlidesClasses() {
4576
+ const swiper = this;
4577
+ if (!swiper.params._emitClasses || !swiper.el) return;
4578
+ const updates = [];
4579
+ swiper.slides.each(slideEl => {
4580
+ const classNames = swiper.getSlideClasses(slideEl);
4581
+ updates.push({
4582
+ slideEl,
4583
+ classNames
4584
+ });
4585
+ swiper.emit('_slideClass', slideEl, classNames);
4586
+ });
4587
+ swiper.emit('_slideClasses', updates);
4588
+ }
4589
+
4590
+ slidesPerViewDynamic(view, exact) {
4591
+ if (view === void 0) {
4592
+ view = 'current';
4593
+ }
4594
+
4595
+ if (exact === void 0) {
4596
+ exact = false;
4597
+ }
4598
+
4599
+ const swiper = this;
4600
+ const {
4601
+ params,
4602
+ slides,
4603
+ slidesGrid,
4604
+ slidesSizesGrid,
4605
+ size: swiperSize,
4606
+ activeIndex
4607
+ } = swiper;
4608
+ let spv = 1;
4609
+
4610
+ if (params.centeredSlides) {
4611
+ let slideSize = slides[activeIndex].swiperSlideSize;
4612
+ let breakLoop;
4613
+
4614
+ for (let i = activeIndex + 1; i < slides.length; i += 1) {
4615
+ if (slides[i] && !breakLoop) {
4616
+ slideSize += slides[i].swiperSlideSize;
4617
+ spv += 1;
4618
+ if (slideSize > swiperSize) breakLoop = true;
4619
+ }
4620
+ }
4621
+
4622
+ for (let i = activeIndex - 1; i >= 0; i -= 1) {
4623
+ if (slides[i] && !breakLoop) {
4624
+ slideSize += slides[i].swiperSlideSize;
4625
+ spv += 1;
4626
+ if (slideSize > swiperSize) breakLoop = true;
4627
+ }
4628
+ }
4629
+ } else {
4630
+ // eslint-disable-next-line
4631
+ if (view === 'current') {
4632
+ for (let i = activeIndex + 1; i < slides.length; i += 1) {
4633
+ const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
4634
+
4635
+ if (slideInView) {
4636
+ spv += 1;
4637
+ }
4638
+ }
4639
+ } else {
4640
+ // previous
4641
+ for (let i = activeIndex - 1; i >= 0; i -= 1) {
4642
+ const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
4643
+
4644
+ if (slideInView) {
4645
+ spv += 1;
4646
+ }
4647
+ }
4648
+ }
4649
+ }
4650
+
4651
+ return spv;
4652
+ }
4653
+
4654
+ update() {
4655
+ const swiper = this;
4656
+ if (!swiper || swiper.destroyed) return;
4657
+ const {
4658
+ snapGrid,
4659
+ params
4660
+ } = swiper; // Breakpoints
4661
+
4662
+ if (params.breakpoints) {
4663
+ swiper.setBreakpoint();
4664
+ }
4665
+
4666
+ swiper.updateSize();
4667
+ swiper.updateSlides();
4668
+ swiper.updateProgress();
4669
+ swiper.updateSlidesClasses();
4670
+
4671
+ function setTranslate() {
4672
+ const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
4673
+ const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
4674
+ swiper.setTranslate(newTranslate);
4675
+ swiper.updateActiveIndex();
4676
+ swiper.updateSlidesClasses();
4677
+ }
4678
+
4679
+ let translated;
4680
+
4681
+ if (swiper.params.freeMode && swiper.params.freeMode.enabled) {
4682
+ setTranslate();
4683
+
4684
+ if (swiper.params.autoHeight) {
4685
+ swiper.updateAutoHeight();
4686
+ }
4687
+ } else {
4688
+ if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
4689
+ translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
4690
+ } else {
4691
+ translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
4692
+ }
4693
+
4694
+ if (!translated) {
4695
+ setTranslate();
4696
+ }
4697
+ }
4698
+
4699
+ if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
4700
+ swiper.checkOverflow();
4701
+ }
4702
+
4703
+ swiper.emit('update');
4704
+ }
4705
+
4706
+ changeDirection(newDirection, needUpdate) {
4707
+ if (needUpdate === void 0) {
4708
+ needUpdate = true;
4709
+ }
4710
+
4711
+ const swiper = this;
4712
+ const currentDirection = swiper.params.direction;
4713
+
4714
+ if (!newDirection) {
4715
+ // eslint-disable-next-line
4716
+ newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
4717
+ }
4718
+
4719
+ if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
4720
+ return swiper;
4721
+ }
4722
+
4723
+ swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`);
4724
+ swiper.emitContainerClasses();
4725
+ swiper.params.direction = newDirection;
4726
+ swiper.slides.each(slideEl => {
4727
+ if (newDirection === 'vertical') {
4728
+ slideEl.style.width = '';
4729
+ } else {
4730
+ slideEl.style.height = '';
4731
+ }
4732
+ });
4733
+ swiper.emit('changeDirection');
4734
+ if (needUpdate) swiper.update();
4735
+ return swiper;
4736
+ }
4737
+
4738
+ changeLanguageDirection(direction) {
4739
+ const swiper = this;
4740
+ if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;
4741
+ swiper.rtl = direction === 'rtl';
4742
+ swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;
4743
+
4744
+ if (swiper.rtl) {
4745
+ swiper.$el.addClass(`${swiper.params.containerModifierClass}rtl`);
4746
+ swiper.el.dir = 'rtl';
4747
+ } else {
4748
+ swiper.$el.removeClass(`${swiper.params.containerModifierClass}rtl`);
4749
+ swiper.el.dir = 'ltr';
4750
+ }
4751
+
4752
+ swiper.update();
4753
+ }
4754
+
4755
+ mount(el) {
4756
+ const swiper = this;
4757
+ if (swiper.mounted) return true; // Find el
4758
+
4759
+ const $el = $(el || swiper.params.el);
4760
+ el = $el[0];
4761
+
4762
+ if (!el) {
4763
+ return false;
4764
+ }
4765
+
4766
+ el.swiper = swiper;
4767
+
4768
+ const getWrapperSelector = () => {
4769
+ return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;
4770
+ };
4771
+
4772
+ const getWrapper = () => {
4773
+ if (el && el.shadowRoot && el.shadowRoot.querySelector) {
4774
+ const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items
4775
+
4776
+ res.children = options => $el.children(options);
4777
+
4778
+ return res;
4779
+ }
4780
+
4781
+ if (!$el.children) {
4782
+ return $($el).children(getWrapperSelector());
4783
+ }
4784
+
4785
+ return $el.children(getWrapperSelector());
4786
+ }; // Find Wrapper
4787
+
4788
+
4789
+ let $wrapperEl = getWrapper();
4790
+
4791
+ if ($wrapperEl.length === 0 && swiper.params.createElements) {
4792
+ const document = getDocument();
4793
+ const wrapper = document.createElement('div');
4794
+ $wrapperEl = $(wrapper);
4795
+ wrapper.className = swiper.params.wrapperClass;
4796
+ $el.append(wrapper);
4797
+ $el.children(`.${swiper.params.slideClass}`).each(slideEl => {
4798
+ $wrapperEl.append(slideEl);
4799
+ });
4800
+ }
4801
+
4802
+ Object.assign(swiper, {
4803
+ $el,
4804
+ el,
4805
+ $wrapperEl,
4806
+ wrapperEl: $wrapperEl[0],
4807
+ mounted: true,
4808
+ // RTL
4809
+ rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',
4810
+ rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
4811
+ wrongRTL: $wrapperEl.css('display') === '-webkit-box'
4812
+ });
4813
+ return true;
4814
+ }
4815
+
4816
+ init(el) {
4817
+ const swiper = this;
4818
+ if (swiper.initialized) return swiper;
4819
+ const mounted = swiper.mount(el);
4820
+ if (mounted === false) return swiper;
4821
+ swiper.emit('beforeInit'); // Set breakpoint
4822
+
4823
+ if (swiper.params.breakpoints) {
4824
+ swiper.setBreakpoint();
4825
+ } // Add Classes
4826
+
4827
+
4828
+ swiper.addClasses(); // Create loop
4829
+
4830
+ if (swiper.params.loop) {
4831
+ swiper.loopCreate();
4832
+ } // Update size
4833
+
4834
+
4835
+ swiper.updateSize(); // Update slides
4836
+
4837
+ swiper.updateSlides();
4838
+
4839
+ if (swiper.params.watchOverflow) {
4840
+ swiper.checkOverflow();
4841
+ } // Set Grab Cursor
4842
+
4843
+
4844
+ if (swiper.params.grabCursor && swiper.enabled) {
4845
+ swiper.setGrabCursor();
4846
+ }
4847
+
4848
+ if (swiper.params.preloadImages) {
4849
+ swiper.preloadImages();
4850
+ } // Slide To Initial Slide
4851
+
4852
+
4853
+ if (swiper.params.loop) {
4854
+ swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true);
4855
+ } else {
4856
+ swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
4857
+ } // Attach events
4858
+
4859
+
4860
+ swiper.attachEvents(); // Init Flag
4861
+
4862
+ swiper.initialized = true; // Emit
4863
+
4864
+ swiper.emit('init');
4865
+ swiper.emit('afterInit');
4866
+ return swiper;
4867
+ }
4868
+
4869
+ destroy(deleteInstance, cleanStyles) {
4870
+ if (deleteInstance === void 0) {
4871
+ deleteInstance = true;
4872
+ }
4873
+
4874
+ if (cleanStyles === void 0) {
4875
+ cleanStyles = true;
4876
+ }
4877
+
4878
+ const swiper = this;
4879
+ const {
4880
+ params,
4881
+ $el,
4882
+ $wrapperEl,
4883
+ slides
4884
+ } = swiper;
4885
+
4886
+ if (typeof swiper.params === 'undefined' || swiper.destroyed) {
4887
+ return null;
4888
+ }
4889
+
4890
+ swiper.emit('beforeDestroy'); // Init Flag
4891
+
4892
+ swiper.initialized = false; // Detach events
4893
+
4894
+ swiper.detachEvents(); // Destroy loop
4895
+
4896
+ if (params.loop) {
4897
+ swiper.loopDestroy();
4898
+ } // Cleanup styles
4899
+
4900
+
4901
+ if (cleanStyles) {
4902
+ swiper.removeClasses();
4903
+ $el.removeAttr('style');
4904
+ $wrapperEl.removeAttr('style');
4905
+
4906
+ if (slides && slides.length) {
4907
+ slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');
4908
+ }
4909
+ }
4910
+
4911
+ swiper.emit('destroy'); // Detach emitter events
4912
+
4913
+ Object.keys(swiper.eventsListeners).forEach(eventName => {
4914
+ swiper.off(eventName);
4915
+ });
4916
+
4917
+ if (deleteInstance !== false) {
4918
+ swiper.$el[0].swiper = null;
4919
+ deleteProps(swiper);
4920
+ }
4921
+
4922
+ swiper.destroyed = true;
4923
+ return null;
4924
+ }
4925
+
4926
+ static extendDefaults(newDefaults) {
4927
+ extend(extendedDefaults, newDefaults);
4928
+ }
4929
+
4930
+ static get extendedDefaults() {
4931
+ return extendedDefaults;
4932
+ }
4933
+
4934
+ static get defaults() {
4935
+ return defaults;
4936
+ }
4937
+
4938
+ static installModule(mod) {
4939
+ if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
4940
+ const modules = Swiper.prototype.__modules__;
4941
+
4942
+ if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
4943
+ modules.push(mod);
4944
+ }
4945
+ }
4946
+
4947
+ static use(module) {
4948
+ if (Array.isArray(module)) {
4949
+ module.forEach(m => Swiper.installModule(m));
4950
+ return Swiper;
4951
+ }
4952
+
4953
+ Swiper.installModule(module);
4954
+ return Swiper;
4955
+ }
4956
+
4957
+ }
4958
+
4959
+ Object.keys(prototypes).forEach(prototypeGroup => {
4960
+ Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {
4961
+ Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
4962
+ });
4963
+ });
4964
+ Swiper.use([Resize, Observer]);
4965
+
4966
+ const ArrowLeftIcon = `<!-- Generated by IcoMoon.io -->
4967
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
4968
+ <title>arrow-left</title>
4969
+ <path d="M28 14.667h-20.452l7.996-6.997c0.555-0.485 0.611-1.327 0.125-1.881-0.485-0.553-1.327-0.611-1.881-0.125l-10.667 9.333c-0.011 0.009-0.015 0.024-0.025 0.033-0.096 0.089-0.167 0.199-0.232 0.313-0.025 0.043-0.063 0.076-0.081 0.121-0.073 0.165-0.116 0.345-0.116 0.536s0.043 0.371 0.116 0.535c0.020 0.045 0.057 0.079 0.081 0.121 0.067 0.115 0.136 0.224 0.232 0.313 0.011 0.009 0.015 0.024 0.025 0.033l10.667 9.333c0.253 0.221 0.567 0.331 0.879 0.331 0.371 0 0.74-0.155 1.004-0.455 0.485-0.555 0.429-1.396-0.125-1.881l-7.997-6.997h20.452c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>
4970
+ </svg>
4971
+ `;
4972
+
4973
+ const sallaSwiperCss = "@font-face{font-family:\"swiper-icons\";src:url(\"data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA\") format(\"woff\");font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{transform:translate3d(0px, 0, 0)}.swiper-pointer-events{touch-action:pan-y}.swiper-pointer-events.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform, height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d,.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper,.swiper-3d .swiper-slide,.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0, 0, 0, 0.15)}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-horizontal.swiper-css-mode>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:\"\";flex-shrink:0;order:9999}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;height:var(--swiper-centered-offset-after)}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center}.s-swiper{position:relative}";
4974
+
4975
+ const SallaSwiper = class {
4976
+ constructor(hostRef) {
4977
+ index$1.registerInstance(this, hostRef);
4978
+ /**
4979
+ * Set to true to enable continuous loop mode. Defaults to false.
4980
+ */
4981
+ this.loop = false;
4982
+ /**
4983
+ * Duration of transition between slides (in ms). Defaults to 300ms.
4984
+ */
4985
+ this.speed = 300;
4986
+ /**
4987
+ * Number of slides per view (slides visible at the same time on slider's container).
4988
+ */
4989
+ this.itemPerView = "auto";
4990
+ /**
4991
+ * Distance between slide items in px. Defaults to 8px
4992
+ */
4993
+ this.spaceBetweenItems = 8;
4994
+ // States
4995
+ this.currentIndex = undefined;
4996
+ this.isLastSlideItem = false;
4997
+ this.isFirstSlideItem = true;
4998
+ }
4999
+ componentDidLoad() {
5000
+ this.initSwiper();
5001
+ }
5002
+ initSwiper() {
5003
+ for (const slide of this.swiperWrapper.children) {
5004
+ slide.classList.add('swiper-slide');
5005
+ }
5006
+ this.swiper = new Swiper(this.swiperContainer, {
5007
+ loop: this.loop,
5008
+ speed: this.speed,
5009
+ slidesPerView: this.itemPerView,
5010
+ spaceBetween: this.spaceBetweenItems,
5011
+ });
5012
+ }
5013
+ update() {
5014
+ this.swiper.update();
5015
+ }
5016
+ render() {
5017
+ var _a, _b;
5018
+ return (index$1.h("div", { class: "s-swiper" }, index$1.h("div", { class: "s-swiper-button-prev" }, index$1.h("salla-button", { disabled: (_a = this.swiper) === null || _a === void 0 ? void 0 : _a.isBeginning, shape: "icon", color: "light", onClick: () => this.swiper.slidePrev() }, index$1.h("span", { class: "s-swiper-button-icon", innerHTML: ArrowLeftIcon }))), index$1.h("div", { class: "s-swiper-button-next" }, index$1.h("salla-button", { disabled: (_b = this.swiper) === null || _b === void 0 ? void 0 : _b.isEnd, shape: "icon", color: "light", onClick: () => this.swiper.slideNext() }, index$1.h("span", { class: "s-swiper-button-icon", innerHTML: arrowRight.ArrowRightIcon }))), index$1.h("div", { class: "swiper" }, index$1.h("div", { class: "swiper-container s-swiper-container", ref: el => this.swiperContainer = el }, index$1.h("div", { class: "swiper-wrapper s-swiper-wrapper", ref: el => this.swiperWrapper = el }, index$1.h("slot", null))))));
5019
+ }
5020
+ };
5021
+ SallaSwiper.style = sallaSwiperCss;
5022
+
5023
+ exports.salla_swiper = SallaSwiper;