@gravity-ui/page-constructor 7.19.0 → 7.20.0-alpha.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 (85) hide show
  1. package/build/cjs/_vendor/swiper-modules.js +1309 -0
  2. package/build/cjs/_vendor/swiper-modules.js.map +7 -0
  3. package/build/cjs/_vendor/swiper-react.js +4651 -0
  4. package/build/cjs/_vendor/swiper-react.js.map +7 -0
  5. package/build/cjs/_vendor/swiper.js +3822 -0
  6. package/build/cjs/_vendor/swiper.js.map +7 -0
  7. package/build/cjs/blocks/Media/Media.js +1 -1
  8. package/build/cjs/blocks/Media/Media.js.map +1 -1
  9. package/build/cjs/blocks/Share/Share.js +3 -1
  10. package/build/cjs/blocks/Share/Share.js.map +1 -1
  11. package/build/cjs/blocks/Slider/Slider.css +1 -4
  12. package/build/cjs/blocks/Slider/Slider.d.ts +6 -4
  13. package/build/cjs/blocks/Slider/Slider.js +7 -7
  14. package/build/cjs/blocks/Slider/Slider.js.map +1 -1
  15. package/build/cjs/blocks/Slider/useSlider.d.ts +1 -2
  16. package/build/cjs/blocks/Slider/useSlider.js +3 -7
  17. package/build/cjs/blocks/Slider/useSlider.js.map +1 -1
  18. package/build/cjs/blocks/Slider/useSliderPagination.d.ts +1 -1
  19. package/build/cjs/blocks/Slider/useSliderPagination.js.map +1 -1
  20. package/build/cjs/blocks/Slider/utils.d.ts +1 -1
  21. package/build/cjs/blocks/Slider/utils.js.map +1 -1
  22. package/build/cjs/blocks/Table/Table.js +3 -4
  23. package/build/cjs/blocks/Table/Table.js.map +1 -1
  24. package/build/cjs/components/CardBase/CardBase.css +0 -3
  25. package/build/cjs/components/Map/YMap/YandexMap.js +1 -3
  26. package/build/cjs/components/Map/YMap/YandexMap.js.map +1 -1
  27. package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
  28. package/build/cjs/models/constructor-items/blocks.js.map +1 -1
  29. package/build/cjs/models/constructor-items/common.d.ts +0 -7
  30. package/build/cjs/models/constructor-items/common.js.map +1 -1
  31. package/build/cjs/models/constructor-items/sub-blocks.d.ts +0 -1
  32. package/build/cjs/models/constructor-items/sub-blocks.js.map +1 -1
  33. package/build/cjs/node_modules/swiper/modules/a11y.css +9 -0
  34. package/build/cjs/node_modules/swiper/modules/autoplay.css +0 -0
  35. package/build/cjs/node_modules/swiper/modules/index.js +1309 -0
  36. package/build/cjs/node_modules/swiper/modules/pagination.css +181 -0
  37. package/build/cjs/node_modules/swiper/package.json +14 -0
  38. package/build/cjs/node_modules/swiper/swiper-react.d.ts +497 -0
  39. package/build/cjs/node_modules/swiper/swiper-react.js +4651 -0
  40. package/build/cjs/node_modules/swiper/swiper.css +229 -0
  41. package/build/cjs/node_modules/swiper/swiper.d.ts +5 -0
  42. package/build/cjs/node_modules/swiper/swiper.js +3822 -0
  43. package/build/cjs/node_modules/swiper/types/index.d.ts +6 -0
  44. package/build/cjs/node_modules/swiper/types/modules/index.d.ts +53 -0
  45. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +2 -10
  46. package/build/cjs/sub-blocks/BasicCard/BasicCard.js.map +1 -1
  47. package/build/esm/blocks/Media/Media.js +1 -1
  48. package/build/esm/blocks/Media/Media.js.map +1 -1
  49. package/build/esm/blocks/Share/Share.js +3 -1
  50. package/build/esm/blocks/Share/Share.js.map +1 -1
  51. package/build/esm/blocks/Slider/Slider.css +1 -4
  52. package/build/esm/blocks/Slider/Slider.d.ts +6 -4
  53. package/build/esm/blocks/Slider/Slider.js +7 -7
  54. package/build/esm/blocks/Slider/Slider.js.map +1 -1
  55. package/build/esm/blocks/Slider/useSlider.d.ts +2 -3
  56. package/build/esm/blocks/Slider/useSlider.js +3 -7
  57. package/build/esm/blocks/Slider/useSlider.js.map +1 -1
  58. package/build/esm/blocks/Slider/useSliderPagination.d.ts +1 -1
  59. package/build/esm/blocks/Slider/useSliderPagination.js.map +1 -1
  60. package/build/esm/blocks/Slider/utils.d.ts +1 -1
  61. package/build/esm/blocks/Slider/utils.js.map +1 -1
  62. package/build/esm/blocks/Table/Table.js +3 -4
  63. package/build/esm/blocks/Table/Table.js.map +1 -1
  64. package/build/esm/components/CardBase/CardBase.css +0 -3
  65. package/build/esm/components/Map/YMap/YandexMap.js +1 -3
  66. package/build/esm/components/Map/YMap/YandexMap.js.map +1 -1
  67. package/build/esm/models/constructor-items/blocks.d.ts +1 -1
  68. package/build/esm/models/constructor-items/blocks.js.map +1 -1
  69. package/build/esm/models/constructor-items/common.d.ts +0 -7
  70. package/build/esm/models/constructor-items/common.js.map +1 -1
  71. package/build/esm/models/constructor-items/sub-blocks.d.ts +0 -1
  72. package/build/esm/models/constructor-items/sub-blocks.js.map +1 -1
  73. package/build/esm/sub-blocks/BasicCard/BasicCard.js +2 -10
  74. package/build/esm/sub-blocks/BasicCard/BasicCard.js.map +1 -1
  75. package/package.json +4 -2
  76. package/server/models/constructor-items/blocks.d.ts +1 -1
  77. package/server/models/constructor-items/common.d.ts +0 -7
  78. package/server/models/constructor-items/sub-blocks.d.ts +0 -1
  79. package/styles/mixins.scss +0 -6
  80. package/build/cjs/blocks/Table/models.d.ts +0 -5
  81. package/build/cjs/blocks/Table/models.js +0 -9
  82. package/build/cjs/blocks/Table/models.js.map +0 -1
  83. package/build/esm/blocks/Table/models.d.ts +0 -5
  84. package/build/esm/blocks/Table/models.js +0 -6
  85. package/build/esm/blocks/Table/models.js.map +0 -1
@@ -0,0 +1,1309 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // <stdin>
20
+ var stdin_exports = {};
21
+ __export(stdin_exports, {
22
+ A11y: () => A11y,
23
+ Autoplay: () => Autoplay,
24
+ Pagination: () => Pagination
25
+ });
26
+ module.exports = __toCommonJS(stdin_exports);
27
+
28
+ // node_modules/swiper/shared/ssr-window.esm.mjs
29
+ function isObject(obj) {
30
+ return obj !== null && typeof obj === "object" && "constructor" in obj && obj.constructor === Object;
31
+ }
32
+ function extend(target, src) {
33
+ if (target === void 0) {
34
+ target = {};
35
+ }
36
+ if (src === void 0) {
37
+ src = {};
38
+ }
39
+ Object.keys(src).forEach((key) => {
40
+ if (typeof target[key] === "undefined") target[key] = src[key];
41
+ else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
42
+ extend(target[key], src[key]);
43
+ }
44
+ });
45
+ }
46
+ var ssrDocument = {
47
+ body: {},
48
+ addEventListener() {
49
+ },
50
+ removeEventListener() {
51
+ },
52
+ activeElement: {
53
+ blur() {
54
+ },
55
+ nodeName: ""
56
+ },
57
+ querySelector() {
58
+ return null;
59
+ },
60
+ querySelectorAll() {
61
+ return [];
62
+ },
63
+ getElementById() {
64
+ return null;
65
+ },
66
+ createEvent() {
67
+ return {
68
+ initEvent() {
69
+ }
70
+ };
71
+ },
72
+ createElement() {
73
+ return {
74
+ children: [],
75
+ childNodes: [],
76
+ style: {},
77
+ setAttribute() {
78
+ },
79
+ getElementsByTagName() {
80
+ return [];
81
+ }
82
+ };
83
+ },
84
+ createElementNS() {
85
+ return {};
86
+ },
87
+ importNode() {
88
+ return null;
89
+ },
90
+ location: {
91
+ hash: "",
92
+ host: "",
93
+ hostname: "",
94
+ href: "",
95
+ origin: "",
96
+ pathname: "",
97
+ protocol: "",
98
+ search: ""
99
+ }
100
+ };
101
+ function getDocument() {
102
+ const doc = typeof document !== "undefined" ? document : {};
103
+ extend(doc, ssrDocument);
104
+ return doc;
105
+ }
106
+ var ssrWindow = {
107
+ document: ssrDocument,
108
+ navigator: {
109
+ userAgent: ""
110
+ },
111
+ location: {
112
+ hash: "",
113
+ host: "",
114
+ hostname: "",
115
+ href: "",
116
+ origin: "",
117
+ pathname: "",
118
+ protocol: "",
119
+ search: ""
120
+ },
121
+ history: {
122
+ replaceState() {
123
+ },
124
+ pushState() {
125
+ },
126
+ go() {
127
+ },
128
+ back() {
129
+ }
130
+ },
131
+ CustomEvent: function CustomEvent() {
132
+ return this;
133
+ },
134
+ addEventListener() {
135
+ },
136
+ removeEventListener() {
137
+ },
138
+ getComputedStyle() {
139
+ return {
140
+ getPropertyValue() {
141
+ return "";
142
+ }
143
+ };
144
+ },
145
+ Image() {
146
+ },
147
+ Date() {
148
+ },
149
+ screen: {},
150
+ setTimeout() {
151
+ },
152
+ clearTimeout() {
153
+ },
154
+ matchMedia() {
155
+ return {};
156
+ },
157
+ requestAnimationFrame(callback) {
158
+ if (typeof setTimeout === "undefined") {
159
+ callback();
160
+ return null;
161
+ }
162
+ return setTimeout(callback, 0);
163
+ },
164
+ cancelAnimationFrame(id) {
165
+ if (typeof setTimeout === "undefined") {
166
+ return;
167
+ }
168
+ clearTimeout(id);
169
+ }
170
+ };
171
+ function getWindow() {
172
+ const win = typeof window !== "undefined" ? window : {};
173
+ extend(win, ssrWindow);
174
+ return win;
175
+ }
176
+
177
+ // node_modules/swiper/shared/utils.mjs
178
+ function elementChildren(element, selector) {
179
+ if (selector === void 0) {
180
+ selector = "";
181
+ }
182
+ return [...element.children].filter((el) => el.matches(selector));
183
+ }
184
+ function createElement(tag, classes) {
185
+ if (classes === void 0) {
186
+ classes = [];
187
+ }
188
+ const el = document.createElement(tag);
189
+ el.classList.add(...Array.isArray(classes) ? classes : [classes]);
190
+ return el;
191
+ }
192
+ function elementIndex(el) {
193
+ let child = el;
194
+ let i;
195
+ if (child) {
196
+ i = 0;
197
+ while ((child = child.previousSibling) !== null) {
198
+ if (child.nodeType === 1) i += 1;
199
+ }
200
+ return i;
201
+ }
202
+ return void 0;
203
+ }
204
+ function elementParents(el, selector) {
205
+ const parents = [];
206
+ let parent = el.parentElement;
207
+ while (parent) {
208
+ if (selector) {
209
+ if (parent.matches(selector)) parents.push(parent);
210
+ } else {
211
+ parents.push(parent);
212
+ }
213
+ parent = parent.parentElement;
214
+ }
215
+ return parents;
216
+ }
217
+ function elementOuterSize(el, size, includeMargins) {
218
+ const window2 = getWindow();
219
+ if (includeMargins) {
220
+ return el[size === "width" ? "offsetWidth" : "offsetHeight"] + parseFloat(window2.getComputedStyle(el, null).getPropertyValue(size === "width" ? "margin-right" : "margin-top")) + parseFloat(window2.getComputedStyle(el, null).getPropertyValue(size === "width" ? "margin-left" : "margin-bottom"));
221
+ }
222
+ return el.offsetWidth;
223
+ }
224
+
225
+ // node_modules/swiper/shared/create-element-if-not-defined.mjs
226
+ function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
227
+ if (swiper.params.createElements) {
228
+ Object.keys(checkProps).forEach((key) => {
229
+ if (!params[key] && params.auto === true) {
230
+ let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
231
+ if (!element) {
232
+ element = createElement("div", checkProps[key]);
233
+ element.className = checkProps[key];
234
+ swiper.el.append(element);
235
+ }
236
+ params[key] = element;
237
+ originalParams[key] = element;
238
+ }
239
+ });
240
+ }
241
+ return params;
242
+ }
243
+
244
+ // node_modules/swiper/shared/classes-to-selector.mjs
245
+ function classesToSelector(classes) {
246
+ if (classes === void 0) {
247
+ classes = "";
248
+ }
249
+ return `.${classes.trim().replace(/([\.:!+\/])/g, "\\$1").replace(/ /g, ".")}`;
250
+ }
251
+
252
+ // node_modules/swiper/modules/pagination.mjs
253
+ function Pagination(_ref) {
254
+ let {
255
+ swiper,
256
+ extendParams,
257
+ on,
258
+ emit
259
+ } = _ref;
260
+ const pfx = "swiper-pagination";
261
+ extendParams({
262
+ pagination: {
263
+ el: null,
264
+ bulletElement: "span",
265
+ clickable: false,
266
+ hideOnClick: false,
267
+ renderBullet: null,
268
+ renderProgressbar: null,
269
+ renderFraction: null,
270
+ renderCustom: null,
271
+ progressbarOpposite: false,
272
+ type: "bullets",
273
+ // 'bullets' or 'progressbar' or 'fraction' or 'custom'
274
+ dynamicBullets: false,
275
+ dynamicMainBullets: 1,
276
+ formatFractionCurrent: (number) => number,
277
+ formatFractionTotal: (number) => number,
278
+ bulletClass: `${pfx}-bullet`,
279
+ bulletActiveClass: `${pfx}-bullet-active`,
280
+ modifierClass: `${pfx}-`,
281
+ currentClass: `${pfx}-current`,
282
+ totalClass: `${pfx}-total`,
283
+ hiddenClass: `${pfx}-hidden`,
284
+ progressbarFillClass: `${pfx}-progressbar-fill`,
285
+ progressbarOppositeClass: `${pfx}-progressbar-opposite`,
286
+ clickableClass: `${pfx}-clickable`,
287
+ lockClass: `${pfx}-lock`,
288
+ horizontalClass: `${pfx}-horizontal`,
289
+ verticalClass: `${pfx}-vertical`,
290
+ paginationDisabledClass: `${pfx}-disabled`
291
+ }
292
+ });
293
+ swiper.pagination = {
294
+ el: null,
295
+ bullets: []
296
+ };
297
+ let bulletSize;
298
+ let dynamicBulletIndex = 0;
299
+ const makeElementsArray = (el) => (Array.isArray(el) ? el : [el]).filter((e) => !!e);
300
+ function isPaginationDisabled() {
301
+ return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
302
+ }
303
+ function setSideBullets(bulletEl, position) {
304
+ const {
305
+ bulletActiveClass
306
+ } = swiper.params.pagination;
307
+ if (!bulletEl) return;
308
+ bulletEl = bulletEl[`${position === "prev" ? "previous" : "next"}ElementSibling`];
309
+ if (bulletEl) {
310
+ bulletEl.classList.add(`${bulletActiveClass}-${position}`);
311
+ bulletEl = bulletEl[`${position === "prev" ? "previous" : "next"}ElementSibling`];
312
+ if (bulletEl) {
313
+ bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
314
+ }
315
+ }
316
+ }
317
+ function onBulletClick(e) {
318
+ const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
319
+ if (!bulletEl) {
320
+ return;
321
+ }
322
+ e.preventDefault();
323
+ const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;
324
+ if (swiper.params.loop) {
325
+ if (swiper.realIndex === index) return;
326
+ const realIndex = swiper.realIndex;
327
+ const newSlideIndex = swiper.getSlideIndexByData(index);
328
+ const currentSlideIndex = swiper.getSlideIndexByData(swiper.realIndex);
329
+ const loopFix = (dir) => {
330
+ const indexBeforeLoopFix = swiper.activeIndex;
331
+ swiper.loopFix({
332
+ direction: dir,
333
+ activeSlideIndex: newSlideIndex,
334
+ slideTo: false
335
+ });
336
+ const indexAfterFix = swiper.activeIndex;
337
+ if (indexBeforeLoopFix === indexAfterFix) {
338
+ swiper.slideToLoop(realIndex, 0, false, true);
339
+ }
340
+ };
341
+ if (newSlideIndex > swiper.slides.length - swiper.loopedSlides) {
342
+ loopFix(newSlideIndex > currentSlideIndex ? "next" : "prev");
343
+ } else if (swiper.params.centeredSlides) {
344
+ const slidesPerView = swiper.params.slidesPerView === "auto" ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
345
+ if (newSlideIndex < Math.floor(slidesPerView / 2)) {
346
+ loopFix("prev");
347
+ }
348
+ }
349
+ swiper.slideToLoop(index);
350
+ } else {
351
+ swiper.slideTo(index);
352
+ }
353
+ }
354
+ function update() {
355
+ const rtl = swiper.rtl;
356
+ const params = swiper.params.pagination;
357
+ if (isPaginationDisabled()) return;
358
+ let el = swiper.pagination.el;
359
+ el = makeElementsArray(el);
360
+ let current;
361
+ let previousIndex;
362
+ const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
363
+ const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
364
+ if (swiper.params.loop) {
365
+ previousIndex = swiper.previousRealIndex || 0;
366
+ current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
367
+ } else if (typeof swiper.snapIndex !== "undefined") {
368
+ current = swiper.snapIndex;
369
+ previousIndex = swiper.previousSnapIndex;
370
+ } else {
371
+ previousIndex = swiper.previousIndex || 0;
372
+ current = swiper.activeIndex || 0;
373
+ }
374
+ if (params.type === "bullets" && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
375
+ const bullets = swiper.pagination.bullets;
376
+ let firstIndex;
377
+ let lastIndex;
378
+ let midIndex;
379
+ if (params.dynamicBullets) {
380
+ bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? "width" : "height", true);
381
+ el.forEach((subEl) => {
382
+ subEl.style[swiper.isHorizontal() ? "width" : "height"] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
383
+ });
384
+ if (params.dynamicMainBullets > 1 && previousIndex !== void 0) {
385
+ dynamicBulletIndex += current - (previousIndex || 0);
386
+ if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
387
+ dynamicBulletIndex = params.dynamicMainBullets - 1;
388
+ } else if (dynamicBulletIndex < 0) {
389
+ dynamicBulletIndex = 0;
390
+ }
391
+ }
392
+ firstIndex = Math.max(current - dynamicBulletIndex, 0);
393
+ lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
394
+ midIndex = (lastIndex + firstIndex) / 2;
395
+ }
396
+ bullets.forEach((bulletEl) => {
397
+ const classesToRemove = [...["", "-next", "-next-next", "-prev", "-prev-prev", "-main"].map((suffix) => `${params.bulletActiveClass}${suffix}`)].map((s) => typeof s === "string" && s.includes(" ") ? s.split(" ") : s).flat();
398
+ bulletEl.classList.remove(...classesToRemove);
399
+ });
400
+ if (el.length > 1) {
401
+ bullets.forEach((bullet) => {
402
+ const bulletIndex = elementIndex(bullet);
403
+ if (bulletIndex === current) {
404
+ bullet.classList.add(...params.bulletActiveClass.split(" "));
405
+ } else if (swiper.isElement) {
406
+ bullet.setAttribute("part", "bullet");
407
+ }
408
+ if (params.dynamicBullets) {
409
+ if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
410
+ bullet.classList.add(...`${params.bulletActiveClass}-main`.split(" "));
411
+ }
412
+ if (bulletIndex === firstIndex) {
413
+ setSideBullets(bullet, "prev");
414
+ }
415
+ if (bulletIndex === lastIndex) {
416
+ setSideBullets(bullet, "next");
417
+ }
418
+ }
419
+ });
420
+ } else {
421
+ const bullet = bullets[current];
422
+ if (bullet) {
423
+ bullet.classList.add(...params.bulletActiveClass.split(" "));
424
+ }
425
+ if (swiper.isElement) {
426
+ bullets.forEach((bulletEl, bulletIndex) => {
427
+ bulletEl.setAttribute("part", bulletIndex === current ? "bullet-active" : "bullet");
428
+ });
429
+ }
430
+ if (params.dynamicBullets) {
431
+ const firstDisplayedBullet = bullets[firstIndex];
432
+ const lastDisplayedBullet = bullets[lastIndex];
433
+ for (let i = firstIndex; i <= lastIndex; i += 1) {
434
+ if (bullets[i]) {
435
+ bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(" "));
436
+ }
437
+ }
438
+ setSideBullets(firstDisplayedBullet, "prev");
439
+ setSideBullets(lastDisplayedBullet, "next");
440
+ }
441
+ }
442
+ if (params.dynamicBullets) {
443
+ const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
444
+ const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
445
+ const offsetProp = rtl ? "right" : "left";
446
+ bullets.forEach((bullet) => {
447
+ bullet.style[swiper.isHorizontal() ? offsetProp : "top"] = `${bulletsOffset}px`;
448
+ });
449
+ }
450
+ }
451
+ el.forEach((subEl, subElIndex) => {
452
+ if (params.type === "fraction") {
453
+ subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach((fractionEl) => {
454
+ fractionEl.textContent = params.formatFractionCurrent(current + 1);
455
+ });
456
+ subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach((totalEl) => {
457
+ totalEl.textContent = params.formatFractionTotal(total);
458
+ });
459
+ }
460
+ if (params.type === "progressbar") {
461
+ let progressbarDirection;
462
+ if (params.progressbarOpposite) {
463
+ progressbarDirection = swiper.isHorizontal() ? "vertical" : "horizontal";
464
+ } else {
465
+ progressbarDirection = swiper.isHorizontal() ? "horizontal" : "vertical";
466
+ }
467
+ const scale = (current + 1) / total;
468
+ let scaleX = 1;
469
+ let scaleY = 1;
470
+ if (progressbarDirection === "horizontal") {
471
+ scaleX = scale;
472
+ } else {
473
+ scaleY = scale;
474
+ }
475
+ subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach((progressEl) => {
476
+ progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
477
+ progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
478
+ });
479
+ }
480
+ if (params.type === "custom" && params.renderCustom) {
481
+ subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
482
+ if (subElIndex === 0) emit("paginationRender", subEl);
483
+ } else {
484
+ if (subElIndex === 0) emit("paginationRender", subEl);
485
+ emit("paginationUpdate", subEl);
486
+ }
487
+ if (swiper.params.watchOverflow && swiper.enabled) {
488
+ subEl.classList[swiper.isLocked ? "add" : "remove"](params.lockClass);
489
+ }
490
+ });
491
+ }
492
+ function render() {
493
+ const params = swiper.params.pagination;
494
+ if (isPaginationDisabled()) return;
495
+ const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
496
+ let el = swiper.pagination.el;
497
+ el = makeElementsArray(el);
498
+ let paginationHTML = "";
499
+ if (params.type === "bullets") {
500
+ let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
501
+ if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
502
+ numberOfBullets = slidesLength;
503
+ }
504
+ for (let i = 0; i < numberOfBullets; i += 1) {
505
+ if (params.renderBullet) {
506
+ paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
507
+ } else {
508
+ paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ""} class="${params.bulletClass}"></${params.bulletElement}>`;
509
+ }
510
+ }
511
+ }
512
+ if (params.type === "fraction") {
513
+ if (params.renderFraction) {
514
+ paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
515
+ } else {
516
+ paginationHTML = `<span class="${params.currentClass}"></span> / <span class="${params.totalClass}"></span>`;
517
+ }
518
+ }
519
+ if (params.type === "progressbar") {
520
+ if (params.renderProgressbar) {
521
+ paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
522
+ } else {
523
+ paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
524
+ }
525
+ }
526
+ swiper.pagination.bullets = [];
527
+ el.forEach((subEl) => {
528
+ if (params.type !== "custom") {
529
+ subEl.innerHTML = paginationHTML || "";
530
+ }
531
+ if (params.type === "bullets") {
532
+ swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
533
+ }
534
+ });
535
+ if (params.type !== "custom") {
536
+ emit("paginationRender", el[0]);
537
+ }
538
+ }
539
+ function init() {
540
+ swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
541
+ el: "swiper-pagination"
542
+ });
543
+ const params = swiper.params.pagination;
544
+ if (!params.el) return;
545
+ let el;
546
+ if (typeof params.el === "string" && swiper.isElement) {
547
+ el = swiper.el.querySelector(params.el);
548
+ }
549
+ if (!el && typeof params.el === "string") {
550
+ el = [...document.querySelectorAll(params.el)];
551
+ }
552
+ if (!el) {
553
+ el = params.el;
554
+ }
555
+ if (!el || el.length === 0) return;
556
+ if (swiper.params.uniqueNavElements && typeof params.el === "string" && Array.isArray(el) && el.length > 1) {
557
+ el = [...swiper.el.querySelectorAll(params.el)];
558
+ if (el.length > 1) {
559
+ el = el.filter((subEl) => {
560
+ if (elementParents(subEl, ".swiper")[0] !== swiper.el) return false;
561
+ return true;
562
+ })[0];
563
+ }
564
+ }
565
+ if (Array.isArray(el) && el.length === 1) el = el[0];
566
+ Object.assign(swiper.pagination, {
567
+ el
568
+ });
569
+ el = makeElementsArray(el);
570
+ el.forEach((subEl) => {
571
+ if (params.type === "bullets" && params.clickable) {
572
+ subEl.classList.add(...(params.clickableClass || "").split(" "));
573
+ }
574
+ subEl.classList.add(params.modifierClass + params.type);
575
+ subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
576
+ if (params.type === "bullets" && params.dynamicBullets) {
577
+ subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
578
+ dynamicBulletIndex = 0;
579
+ if (params.dynamicMainBullets < 1) {
580
+ params.dynamicMainBullets = 1;
581
+ }
582
+ }
583
+ if (params.type === "progressbar" && params.progressbarOpposite) {
584
+ subEl.classList.add(params.progressbarOppositeClass);
585
+ }
586
+ if (params.clickable) {
587
+ subEl.addEventListener("click", onBulletClick);
588
+ }
589
+ if (!swiper.enabled) {
590
+ subEl.classList.add(params.lockClass);
591
+ }
592
+ });
593
+ }
594
+ function destroy() {
595
+ const params = swiper.params.pagination;
596
+ if (isPaginationDisabled()) return;
597
+ let el = swiper.pagination.el;
598
+ if (el) {
599
+ el = makeElementsArray(el);
600
+ el.forEach((subEl) => {
601
+ subEl.classList.remove(params.hiddenClass);
602
+ subEl.classList.remove(params.modifierClass + params.type);
603
+ subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
604
+ if (params.clickable) {
605
+ subEl.classList.remove(...(params.clickableClass || "").split(" "));
606
+ subEl.removeEventListener("click", onBulletClick);
607
+ }
608
+ });
609
+ }
610
+ if (swiper.pagination.bullets) swiper.pagination.bullets.forEach((subEl) => subEl.classList.remove(...params.bulletActiveClass.split(" ")));
611
+ }
612
+ on("changeDirection", () => {
613
+ if (!swiper.pagination || !swiper.pagination.el) return;
614
+ const params = swiper.params.pagination;
615
+ let {
616
+ el
617
+ } = swiper.pagination;
618
+ el = makeElementsArray(el);
619
+ el.forEach((subEl) => {
620
+ subEl.classList.remove(params.horizontalClass, params.verticalClass);
621
+ subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
622
+ });
623
+ });
624
+ on("init", () => {
625
+ if (swiper.params.pagination.enabled === false) {
626
+ disable();
627
+ } else {
628
+ init();
629
+ render();
630
+ update();
631
+ }
632
+ });
633
+ on("activeIndexChange", () => {
634
+ if (typeof swiper.snapIndex === "undefined") {
635
+ update();
636
+ }
637
+ });
638
+ on("snapIndexChange", () => {
639
+ update();
640
+ });
641
+ on("snapGridLengthChange", () => {
642
+ render();
643
+ update();
644
+ });
645
+ on("destroy", () => {
646
+ destroy();
647
+ });
648
+ on("enable disable", () => {
649
+ let {
650
+ el
651
+ } = swiper.pagination;
652
+ if (el) {
653
+ el = makeElementsArray(el);
654
+ el.forEach((subEl) => subEl.classList[swiper.enabled ? "remove" : "add"](swiper.params.pagination.lockClass));
655
+ }
656
+ });
657
+ on("lock unlock", () => {
658
+ update();
659
+ });
660
+ on("click", (_s, e) => {
661
+ const targetEl = e.target;
662
+ const el = makeElementsArray(swiper.pagination.el);
663
+ if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
664
+ if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
665
+ const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
666
+ if (isHidden === true) {
667
+ emit("paginationShow");
668
+ } else {
669
+ emit("paginationHide");
670
+ }
671
+ el.forEach((subEl) => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
672
+ }
673
+ });
674
+ const enable = () => {
675
+ swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
676
+ let {
677
+ el
678
+ } = swiper.pagination;
679
+ if (el) {
680
+ el = makeElementsArray(el);
681
+ el.forEach((subEl) => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
682
+ }
683
+ init();
684
+ render();
685
+ update();
686
+ };
687
+ const disable = () => {
688
+ swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
689
+ let {
690
+ el
691
+ } = swiper.pagination;
692
+ if (el) {
693
+ el = makeElementsArray(el);
694
+ el.forEach((subEl) => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
695
+ }
696
+ destroy();
697
+ };
698
+ Object.assign(swiper.pagination, {
699
+ enable,
700
+ disable,
701
+ render,
702
+ update,
703
+ init,
704
+ destroy
705
+ });
706
+ }
707
+
708
+ // node_modules/swiper/modules/a11y.mjs
709
+ function A11y(_ref) {
710
+ let {
711
+ swiper,
712
+ extendParams,
713
+ on
714
+ } = _ref;
715
+ extendParams({
716
+ a11y: {
717
+ enabled: true,
718
+ notificationClass: "swiper-notification",
719
+ prevSlideMessage: "Previous slide",
720
+ nextSlideMessage: "Next slide",
721
+ firstSlideMessage: "This is the first slide",
722
+ lastSlideMessage: "This is the last slide",
723
+ paginationBulletMessage: "Go to slide {{index}}",
724
+ slideLabelMessage: "{{index}} / {{slidesLength}}",
725
+ containerMessage: null,
726
+ containerRoleDescriptionMessage: null,
727
+ itemRoleDescriptionMessage: null,
728
+ slideRole: "group",
729
+ id: null
730
+ }
731
+ });
732
+ swiper.a11y = {
733
+ clicked: false
734
+ };
735
+ let liveRegion = null;
736
+ function notify(message) {
737
+ const notification = liveRegion;
738
+ if (notification.length === 0) return;
739
+ notification.innerHTML = "";
740
+ notification.innerHTML = message;
741
+ }
742
+ const makeElementsArray = (el) => (Array.isArray(el) ? el : [el]).filter((e) => !!e);
743
+ function getRandomNumber(size) {
744
+ if (size === void 0) {
745
+ size = 16;
746
+ }
747
+ const randomChar = () => Math.round(16 * Math.random()).toString(16);
748
+ return "x".repeat(size).replace(/x/g, randomChar);
749
+ }
750
+ function makeElFocusable(el) {
751
+ el = makeElementsArray(el);
752
+ el.forEach((subEl) => {
753
+ subEl.setAttribute("tabIndex", "0");
754
+ });
755
+ }
756
+ function makeElNotFocusable(el) {
757
+ el = makeElementsArray(el);
758
+ el.forEach((subEl) => {
759
+ subEl.setAttribute("tabIndex", "-1");
760
+ });
761
+ }
762
+ function addElRole(el, role) {
763
+ el = makeElementsArray(el);
764
+ el.forEach((subEl) => {
765
+ subEl.setAttribute("role", role);
766
+ });
767
+ }
768
+ function addElRoleDescription(el, description) {
769
+ el = makeElementsArray(el);
770
+ el.forEach((subEl) => {
771
+ subEl.setAttribute("aria-roledescription", description);
772
+ });
773
+ }
774
+ function addElControls(el, controls) {
775
+ el = makeElementsArray(el);
776
+ el.forEach((subEl) => {
777
+ subEl.setAttribute("aria-controls", controls);
778
+ });
779
+ }
780
+ function addElLabel(el, label) {
781
+ el = makeElementsArray(el);
782
+ el.forEach((subEl) => {
783
+ subEl.setAttribute("aria-label", label);
784
+ });
785
+ }
786
+ function addElId(el, id) {
787
+ el = makeElementsArray(el);
788
+ el.forEach((subEl) => {
789
+ subEl.setAttribute("id", id);
790
+ });
791
+ }
792
+ function addElLive(el, live) {
793
+ el = makeElementsArray(el);
794
+ el.forEach((subEl) => {
795
+ subEl.setAttribute("aria-live", live);
796
+ });
797
+ }
798
+ function disableEl(el) {
799
+ el = makeElementsArray(el);
800
+ el.forEach((subEl) => {
801
+ subEl.setAttribute("aria-disabled", true);
802
+ });
803
+ }
804
+ function enableEl(el) {
805
+ el = makeElementsArray(el);
806
+ el.forEach((subEl) => {
807
+ subEl.setAttribute("aria-disabled", false);
808
+ });
809
+ }
810
+ function onEnterOrSpaceKey(e) {
811
+ if (e.keyCode !== 13 && e.keyCode !== 32) return;
812
+ const params = swiper.params.a11y;
813
+ const targetEl = e.target;
814
+ if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {
815
+ if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;
816
+ }
817
+ if (swiper.navigation && swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl) {
818
+ if (!(swiper.isEnd && !swiper.params.loop)) {
819
+ swiper.slideNext();
820
+ }
821
+ if (swiper.isEnd) {
822
+ notify(params.lastSlideMessage);
823
+ } else {
824
+ notify(params.nextSlideMessage);
825
+ }
826
+ }
827
+ if (swiper.navigation && swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl) {
828
+ if (!(swiper.isBeginning && !swiper.params.loop)) {
829
+ swiper.slidePrev();
830
+ }
831
+ if (swiper.isBeginning) {
832
+ notify(params.firstSlideMessage);
833
+ } else {
834
+ notify(params.prevSlideMessage);
835
+ }
836
+ }
837
+ if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {
838
+ targetEl.click();
839
+ }
840
+ }
841
+ function updateNavigation() {
842
+ if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;
843
+ const {
844
+ nextEl,
845
+ prevEl
846
+ } = swiper.navigation;
847
+ if (prevEl) {
848
+ if (swiper.isBeginning) {
849
+ disableEl(prevEl);
850
+ makeElNotFocusable(prevEl);
851
+ } else {
852
+ enableEl(prevEl);
853
+ makeElFocusable(prevEl);
854
+ }
855
+ }
856
+ if (nextEl) {
857
+ if (swiper.isEnd) {
858
+ disableEl(nextEl);
859
+ makeElNotFocusable(nextEl);
860
+ } else {
861
+ enableEl(nextEl);
862
+ makeElFocusable(nextEl);
863
+ }
864
+ }
865
+ }
866
+ function hasPagination() {
867
+ return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;
868
+ }
869
+ function hasClickablePagination() {
870
+ return hasPagination() && swiper.params.pagination.clickable;
871
+ }
872
+ function updatePagination() {
873
+ const params = swiper.params.a11y;
874
+ if (!hasPagination()) return;
875
+ swiper.pagination.bullets.forEach((bulletEl) => {
876
+ if (swiper.params.pagination.clickable) {
877
+ makeElFocusable(bulletEl);
878
+ if (!swiper.params.pagination.renderBullet) {
879
+ addElRole(bulletEl, "button");
880
+ addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, elementIndex(bulletEl) + 1));
881
+ }
882
+ }
883
+ if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) {
884
+ bulletEl.setAttribute("aria-current", "true");
885
+ } else {
886
+ bulletEl.removeAttribute("aria-current");
887
+ }
888
+ });
889
+ }
890
+ const initNavEl = (el, wrapperId, message) => {
891
+ makeElFocusable(el);
892
+ if (el.tagName !== "BUTTON") {
893
+ addElRole(el, "button");
894
+ el.addEventListener("keydown", onEnterOrSpaceKey);
895
+ }
896
+ addElLabel(el, message);
897
+ addElControls(el, wrapperId);
898
+ };
899
+ const handlePointerDown = () => {
900
+ swiper.a11y.clicked = true;
901
+ };
902
+ const handlePointerUp = () => {
903
+ requestAnimationFrame(() => {
904
+ requestAnimationFrame(() => {
905
+ if (!swiper.destroyed) {
906
+ swiper.a11y.clicked = false;
907
+ }
908
+ });
909
+ });
910
+ };
911
+ const handleFocus = (e) => {
912
+ if (swiper.a11y.clicked) return;
913
+ const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
914
+ if (!slideEl || !swiper.slides.includes(slideEl)) return;
915
+ const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
916
+ const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
917
+ if (isActive || isVisible) return;
918
+ if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
919
+ if (swiper.isHorizontal()) {
920
+ swiper.el.scrollLeft = 0;
921
+ } else {
922
+ swiper.el.scrollTop = 0;
923
+ }
924
+ swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
925
+ };
926
+ const initSlides = () => {
927
+ const params = swiper.params.a11y;
928
+ if (params.itemRoleDescriptionMessage) {
929
+ addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage);
930
+ }
931
+ if (params.slideRole) {
932
+ addElRole(swiper.slides, params.slideRole);
933
+ }
934
+ const slidesLength = swiper.slides.length;
935
+ if (params.slideLabelMessage) {
936
+ swiper.slides.forEach((slideEl, index) => {
937
+ const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute("data-swiper-slide-index"), 10) : index;
938
+ const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
939
+ addElLabel(slideEl, ariaLabelMessage);
940
+ });
941
+ }
942
+ };
943
+ const init = () => {
944
+ const params = swiper.params.a11y;
945
+ swiper.el.append(liveRegion);
946
+ const containerEl = swiper.el;
947
+ if (params.containerRoleDescriptionMessage) {
948
+ addElRoleDescription(containerEl, params.containerRoleDescriptionMessage);
949
+ }
950
+ if (params.containerMessage) {
951
+ addElLabel(containerEl, params.containerMessage);
952
+ }
953
+ const wrapperEl = swiper.wrapperEl;
954
+ const wrapperId = params.id || wrapperEl.getAttribute("id") || `swiper-wrapper-${getRandomNumber(16)}`;
955
+ const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? "off" : "polite";
956
+ addElId(wrapperEl, wrapperId);
957
+ addElLive(wrapperEl, live);
958
+ initSlides();
959
+ let {
960
+ nextEl,
961
+ prevEl
962
+ } = swiper.navigation ? swiper.navigation : {};
963
+ nextEl = makeElementsArray(nextEl);
964
+ prevEl = makeElementsArray(prevEl);
965
+ if (nextEl) {
966
+ nextEl.forEach((el) => initNavEl(el, wrapperId, params.nextSlideMessage));
967
+ }
968
+ if (prevEl) {
969
+ prevEl.forEach((el) => initNavEl(el, wrapperId, params.prevSlideMessage));
970
+ }
971
+ if (hasClickablePagination()) {
972
+ const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
973
+ paginationEl.forEach((el) => {
974
+ el.addEventListener("keydown", onEnterOrSpaceKey);
975
+ });
976
+ }
977
+ swiper.el.addEventListener("focus", handleFocus, true);
978
+ swiper.el.addEventListener("pointerdown", handlePointerDown, true);
979
+ swiper.el.addEventListener("pointerup", handlePointerUp, true);
980
+ };
981
+ function destroy() {
982
+ if (liveRegion) liveRegion.remove();
983
+ let {
984
+ nextEl,
985
+ prevEl
986
+ } = swiper.navigation ? swiper.navigation : {};
987
+ nextEl = makeElementsArray(nextEl);
988
+ prevEl = makeElementsArray(prevEl);
989
+ if (nextEl) {
990
+ nextEl.forEach((el) => el.removeEventListener("keydown", onEnterOrSpaceKey));
991
+ }
992
+ if (prevEl) {
993
+ prevEl.forEach((el) => el.removeEventListener("keydown", onEnterOrSpaceKey));
994
+ }
995
+ if (hasClickablePagination()) {
996
+ const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
997
+ paginationEl.forEach((el) => {
998
+ el.removeEventListener("keydown", onEnterOrSpaceKey);
999
+ });
1000
+ }
1001
+ swiper.el.removeEventListener("focus", handleFocus, true);
1002
+ swiper.el.removeEventListener("pointerdown", handlePointerDown, true);
1003
+ swiper.el.removeEventListener("pointerup", handlePointerUp, true);
1004
+ }
1005
+ on("beforeInit", () => {
1006
+ liveRegion = createElement("span", swiper.params.a11y.notificationClass);
1007
+ liveRegion.setAttribute("aria-live", "assertive");
1008
+ liveRegion.setAttribute("aria-atomic", "true");
1009
+ });
1010
+ on("afterInit", () => {
1011
+ if (!swiper.params.a11y.enabled) return;
1012
+ init();
1013
+ });
1014
+ on("slidesLengthChange snapGridLengthChange slidesGridLengthChange", () => {
1015
+ if (!swiper.params.a11y.enabled) return;
1016
+ initSlides();
1017
+ });
1018
+ on("fromEdge toEdge afterInit lock unlock", () => {
1019
+ if (!swiper.params.a11y.enabled) return;
1020
+ updateNavigation();
1021
+ });
1022
+ on("paginationUpdate", () => {
1023
+ if (!swiper.params.a11y.enabled) return;
1024
+ updatePagination();
1025
+ });
1026
+ on("destroy", () => {
1027
+ if (!swiper.params.a11y.enabled) return;
1028
+ destroy();
1029
+ });
1030
+ }
1031
+
1032
+ // node_modules/swiper/modules/autoplay.mjs
1033
+ function Autoplay(_ref) {
1034
+ let {
1035
+ swiper,
1036
+ extendParams,
1037
+ on,
1038
+ emit,
1039
+ params
1040
+ } = _ref;
1041
+ swiper.autoplay = {
1042
+ running: false,
1043
+ paused: false,
1044
+ timeLeft: 0
1045
+ };
1046
+ extendParams({
1047
+ autoplay: {
1048
+ enabled: false,
1049
+ delay: 3e3,
1050
+ waitForTransition: true,
1051
+ disableOnInteraction: true,
1052
+ stopOnLastSlide: false,
1053
+ reverseDirection: false,
1054
+ pauseOnMouseEnter: false
1055
+ }
1056
+ });
1057
+ let timeout;
1058
+ let raf;
1059
+ let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3e3;
1060
+ let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3e3;
1061
+ let autoplayTimeLeft;
1062
+ let autoplayStartTime = (/* @__PURE__ */ new Date()).getTime;
1063
+ let wasPaused;
1064
+ let isTouched;
1065
+ let pausedByTouch;
1066
+ let touchStartTimeout;
1067
+ let slideChanged;
1068
+ let pausedByInteraction;
1069
+ function onTransitionEnd(e) {
1070
+ if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
1071
+ if (e.target !== swiper.wrapperEl) return;
1072
+ swiper.wrapperEl.removeEventListener("transitionend", onTransitionEnd);
1073
+ resume();
1074
+ }
1075
+ const calcTimeLeft = () => {
1076
+ if (swiper.destroyed || !swiper.autoplay.running) return;
1077
+ if (swiper.autoplay.paused) {
1078
+ wasPaused = true;
1079
+ } else if (wasPaused) {
1080
+ autoplayDelayCurrent = autoplayTimeLeft;
1081
+ wasPaused = false;
1082
+ }
1083
+ const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - (/* @__PURE__ */ new Date()).getTime();
1084
+ swiper.autoplay.timeLeft = timeLeft;
1085
+ emit("autoplayTimeLeft", timeLeft, timeLeft / autoplayDelayTotal);
1086
+ raf = requestAnimationFrame(() => {
1087
+ calcTimeLeft();
1088
+ });
1089
+ };
1090
+ const getSlideDelay = () => {
1091
+ let activeSlideEl;
1092
+ if (swiper.virtual && swiper.params.virtual.enabled) {
1093
+ activeSlideEl = swiper.slides.filter((slideEl) => slideEl.classList.contains("swiper-slide-active"))[0];
1094
+ } else {
1095
+ activeSlideEl = swiper.slides[swiper.activeIndex];
1096
+ }
1097
+ if (!activeSlideEl) return void 0;
1098
+ const currentSlideDelay = parseInt(activeSlideEl.getAttribute("data-swiper-autoplay"), 10);
1099
+ return currentSlideDelay;
1100
+ };
1101
+ const run = (delayForce) => {
1102
+ if (swiper.destroyed || !swiper.autoplay.running) return;
1103
+ cancelAnimationFrame(raf);
1104
+ calcTimeLeft();
1105
+ let delay = typeof delayForce === "undefined" ? swiper.params.autoplay.delay : delayForce;
1106
+ autoplayDelayTotal = swiper.params.autoplay.delay;
1107
+ autoplayDelayCurrent = swiper.params.autoplay.delay;
1108
+ const currentSlideDelay = getSlideDelay();
1109
+ if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === "undefined") {
1110
+ delay = currentSlideDelay;
1111
+ autoplayDelayTotal = currentSlideDelay;
1112
+ autoplayDelayCurrent = currentSlideDelay;
1113
+ }
1114
+ autoplayTimeLeft = delay;
1115
+ const speed = swiper.params.speed;
1116
+ const proceed = () => {
1117
+ if (!swiper || swiper.destroyed) return;
1118
+ if (swiper.params.autoplay.reverseDirection) {
1119
+ if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) {
1120
+ swiper.slidePrev(speed, true, true);
1121
+ emit("autoplay");
1122
+ } else if (!swiper.params.autoplay.stopOnLastSlide) {
1123
+ swiper.slideTo(swiper.slides.length - 1, speed, true, true);
1124
+ emit("autoplay");
1125
+ }
1126
+ } else {
1127
+ if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) {
1128
+ swiper.slideNext(speed, true, true);
1129
+ emit("autoplay");
1130
+ } else if (!swiper.params.autoplay.stopOnLastSlide) {
1131
+ swiper.slideTo(0, speed, true, true);
1132
+ emit("autoplay");
1133
+ }
1134
+ }
1135
+ if (swiper.params.cssMode) {
1136
+ autoplayStartTime = (/* @__PURE__ */ new Date()).getTime();
1137
+ requestAnimationFrame(() => {
1138
+ run();
1139
+ });
1140
+ }
1141
+ };
1142
+ if (delay > 0) {
1143
+ clearTimeout(timeout);
1144
+ timeout = setTimeout(() => {
1145
+ proceed();
1146
+ }, delay);
1147
+ } else {
1148
+ requestAnimationFrame(() => {
1149
+ proceed();
1150
+ });
1151
+ }
1152
+ return delay;
1153
+ };
1154
+ const start = () => {
1155
+ swiper.autoplay.running = true;
1156
+ run();
1157
+ emit("autoplayStart");
1158
+ };
1159
+ const stop = () => {
1160
+ swiper.autoplay.running = false;
1161
+ clearTimeout(timeout);
1162
+ cancelAnimationFrame(raf);
1163
+ emit("autoplayStop");
1164
+ };
1165
+ const pause = (internal, reset) => {
1166
+ if (swiper.destroyed || !swiper.autoplay.running) return;
1167
+ clearTimeout(timeout);
1168
+ if (!internal) {
1169
+ pausedByInteraction = true;
1170
+ }
1171
+ const proceed = () => {
1172
+ emit("autoplayPause");
1173
+ if (swiper.params.autoplay.waitForTransition) {
1174
+ swiper.wrapperEl.addEventListener("transitionend", onTransitionEnd);
1175
+ } else {
1176
+ resume();
1177
+ }
1178
+ };
1179
+ swiper.autoplay.paused = true;
1180
+ if (reset) {
1181
+ if (slideChanged) {
1182
+ autoplayTimeLeft = swiper.params.autoplay.delay;
1183
+ }
1184
+ slideChanged = false;
1185
+ proceed();
1186
+ return;
1187
+ }
1188
+ const delay = autoplayTimeLeft || swiper.params.autoplay.delay;
1189
+ autoplayTimeLeft = delay - ((/* @__PURE__ */ new Date()).getTime() - autoplayStartTime);
1190
+ if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return;
1191
+ if (autoplayTimeLeft < 0) autoplayTimeLeft = 0;
1192
+ proceed();
1193
+ };
1194
+ const resume = () => {
1195
+ if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return;
1196
+ autoplayStartTime = (/* @__PURE__ */ new Date()).getTime();
1197
+ if (pausedByInteraction) {
1198
+ pausedByInteraction = false;
1199
+ run(autoplayTimeLeft);
1200
+ } else {
1201
+ run();
1202
+ }
1203
+ swiper.autoplay.paused = false;
1204
+ emit("autoplayResume");
1205
+ };
1206
+ const onVisibilityChange = () => {
1207
+ if (swiper.destroyed || !swiper.autoplay.running) return;
1208
+ const document2 = getDocument();
1209
+ if (document2.visibilityState === "hidden") {
1210
+ pausedByInteraction = true;
1211
+ pause(true);
1212
+ }
1213
+ if (document2.visibilityState === "visible") {
1214
+ resume();
1215
+ }
1216
+ };
1217
+ const onPointerEnter = (e) => {
1218
+ if (e.pointerType !== "mouse") return;
1219
+ pausedByInteraction = true;
1220
+ if (swiper.animating || swiper.autoplay.paused) return;
1221
+ pause(true);
1222
+ };
1223
+ const onPointerLeave = (e) => {
1224
+ if (e.pointerType !== "mouse") return;
1225
+ if (swiper.autoplay.paused) {
1226
+ resume();
1227
+ }
1228
+ };
1229
+ const attachMouseEvents = () => {
1230
+ if (swiper.params.autoplay.pauseOnMouseEnter) {
1231
+ swiper.el.addEventListener("pointerenter", onPointerEnter);
1232
+ swiper.el.addEventListener("pointerleave", onPointerLeave);
1233
+ }
1234
+ };
1235
+ const detachMouseEvents = () => {
1236
+ swiper.el.removeEventListener("pointerenter", onPointerEnter);
1237
+ swiper.el.removeEventListener("pointerleave", onPointerLeave);
1238
+ };
1239
+ const attachDocumentEvents = () => {
1240
+ const document2 = getDocument();
1241
+ document2.addEventListener("visibilitychange", onVisibilityChange);
1242
+ };
1243
+ const detachDocumentEvents = () => {
1244
+ const document2 = getDocument();
1245
+ document2.removeEventListener("visibilitychange", onVisibilityChange);
1246
+ };
1247
+ on("init", () => {
1248
+ if (swiper.params.autoplay.enabled) {
1249
+ attachMouseEvents();
1250
+ attachDocumentEvents();
1251
+ autoplayStartTime = (/* @__PURE__ */ new Date()).getTime();
1252
+ start();
1253
+ }
1254
+ });
1255
+ on("destroy", () => {
1256
+ detachMouseEvents();
1257
+ detachDocumentEvents();
1258
+ if (swiper.autoplay.running) {
1259
+ stop();
1260
+ }
1261
+ });
1262
+ on("beforeTransitionStart", (_s, speed, internal) => {
1263
+ if (swiper.destroyed || !swiper.autoplay.running) return;
1264
+ if (internal || !swiper.params.autoplay.disableOnInteraction) {
1265
+ pause(true, true);
1266
+ } else {
1267
+ stop();
1268
+ }
1269
+ });
1270
+ on("sliderFirstMove", () => {
1271
+ if (swiper.destroyed || !swiper.autoplay.running) return;
1272
+ if (swiper.params.autoplay.disableOnInteraction) {
1273
+ stop();
1274
+ return;
1275
+ }
1276
+ isTouched = true;
1277
+ pausedByTouch = false;
1278
+ pausedByInteraction = false;
1279
+ touchStartTimeout = setTimeout(() => {
1280
+ pausedByInteraction = true;
1281
+ pausedByTouch = true;
1282
+ pause(true);
1283
+ }, 200);
1284
+ });
1285
+ on("touchEnd", () => {
1286
+ if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return;
1287
+ clearTimeout(touchStartTimeout);
1288
+ clearTimeout(timeout);
1289
+ if (swiper.params.autoplay.disableOnInteraction) {
1290
+ pausedByTouch = false;
1291
+ isTouched = false;
1292
+ return;
1293
+ }
1294
+ if (pausedByTouch && swiper.params.cssMode) resume();
1295
+ pausedByTouch = false;
1296
+ isTouched = false;
1297
+ });
1298
+ on("slideChange", () => {
1299
+ if (swiper.destroyed || !swiper.autoplay.running) return;
1300
+ slideChanged = true;
1301
+ });
1302
+ Object.assign(swiper.autoplay, {
1303
+ start,
1304
+ stop,
1305
+ pause,
1306
+ resume
1307
+ });
1308
+ }
1309
+ //# sourceMappingURL=swiper-modules.js.map