@gravity-ui/page-constructor 8.13.1 → 8.13.2

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.
@@ -41,14 +41,9 @@ var import_react = __toESM(require("react"), 1);
41
41
  function isObject(obj) {
42
42
  return obj !== null && typeof obj === "object" && "constructor" in obj && obj.constructor === Object;
43
43
  }
44
- function extend(target, src) {
45
- if (target === void 0) {
46
- target = {};
47
- }
48
- if (src === void 0) {
49
- src = {};
50
- }
51
- Object.keys(src).forEach((key) => {
44
+ function extend(target = {}, src = {}) {
45
+ const noExtend = ["__proto__", "constructor", "prototype"];
46
+ Object.keys(src).filter((key) => noExtend.indexOf(key) < 0).forEach((key) => {
52
47
  if (typeof target[key] === "undefined") target[key] = src[key];
53
48
  else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
54
49
  extend(target[key], src[key]);
@@ -187,6 +182,9 @@ function getWindow() {
187
182
  }
188
183
 
189
184
  // node_modules/swiper/shared/utils.mjs
185
+ function classesToTokens(classes2 = "") {
186
+ return classes2.trim().split(" ").filter((c) => !!c.trim());
187
+ }
190
188
  function deleteProps(obj) {
191
189
  const object = obj;
192
190
  Object.keys(object).forEach((key) => {
@@ -200,10 +198,7 @@ function deleteProps(obj) {
200
198
  }
201
199
  });
202
200
  }
203
- function nextTick(callback, delay) {
204
- if (delay === void 0) {
205
- delay = 0;
206
- }
201
+ function nextTick(callback, delay = 0) {
207
202
  return setTimeout(callback, delay);
208
203
  }
209
204
  function now() {
@@ -223,10 +218,7 @@ function getComputedStyle2(el) {
223
218
  }
224
219
  return style;
225
220
  }
226
- function getTranslate(el, axis) {
227
- if (axis === void 0) {
228
- axis = "x";
229
- }
221
+ function getTranslate(el, axis = "x") {
230
222
  const window2 = getWindow();
231
223
  let matrix;
232
224
  let curTransform;
@@ -263,13 +255,12 @@ function isNode(node) {
263
255
  }
264
256
  return node && (node.nodeType === 1 || node.nodeType === 11);
265
257
  }
266
- function extend2() {
267
- const to = Object(arguments.length <= 0 ? void 0 : arguments[0]);
268
- const noExtend = ["__proto__", "constructor", "prototype"];
269
- for (let i = 1; i < arguments.length; i += 1) {
270
- const nextSource = i < 0 || arguments.length <= i ? void 0 : arguments[i];
258
+ function extend2(...args) {
259
+ const to = Object(args[0]);
260
+ for (let i = 1; i < args.length; i += 1) {
261
+ const nextSource = args[i];
271
262
  if (nextSource !== void 0 && nextSource !== null && !isNode(nextSource)) {
272
- const keysArray = Object.keys(Object(nextSource)).filter((key) => noExtend.indexOf(key) < 0);
263
+ const keysArray = Object.keys(Object(nextSource)).filter((key) => key !== "__proto__" && key !== "constructor" && key !== "prototype");
273
264
  for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
274
265
  const nextKey = keysArray[nextIndex];
275
266
  const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
@@ -299,12 +290,11 @@ function extend2() {
299
290
  function setCSSProperty(el, varName, varValue) {
300
291
  el.style.setProperty(varName, varValue);
301
292
  }
302
- function animateCSSModeScroll(_ref) {
303
- let {
304
- swiper,
305
- targetPosition,
306
- side
307
- } = _ref;
293
+ function animateCSSModeScroll({
294
+ swiper,
295
+ targetPosition,
296
+ side
297
+ }) {
308
298
  const window2 = getWindow();
309
299
  const startPosition = -swiper.translate;
310
300
  let startTime = null;
@@ -346,18 +336,49 @@ function animateCSSModeScroll(_ref) {
346
336
  };
347
337
  animate();
348
338
  }
349
- function elementChildren(element, selector) {
350
- if (selector === void 0) {
351
- selector = "";
339
+ function elementChildren(element, selector = "") {
340
+ const window2 = getWindow();
341
+ const children = [...element.children];
342
+ if (window2.HTMLSlotElement && element instanceof HTMLSlotElement) {
343
+ children.push(...element.assignedElements());
344
+ }
345
+ if (!selector) {
346
+ return children;
352
347
  }
353
- return [...element.children].filter((el) => el.matches(selector));
348
+ return children.filter((el) => el.matches(selector));
354
349
  }
355
- function createElement(tag, classes2) {
356
- if (classes2 === void 0) {
357
- classes2 = [];
350
+ function elementIsChildOfSlot(el, slot) {
351
+ const elementsQueue = [slot];
352
+ while (elementsQueue.length > 0) {
353
+ const elementToCheck = elementsQueue.shift();
354
+ if (el === elementToCheck) {
355
+ return true;
356
+ }
357
+ elementsQueue.push(...elementToCheck.children, ...elementToCheck.shadowRoot ? elementToCheck.shadowRoot.children : [], ...elementToCheck.assignedElements ? elementToCheck.assignedElements() : []);
358
358
  }
359
+ }
360
+ function elementIsChildOf(el, parent) {
361
+ const window2 = getWindow();
362
+ let isChild = parent.contains(el);
363
+ if (!isChild && window2.HTMLSlotElement && parent instanceof HTMLSlotElement) {
364
+ const children = [...parent.assignedElements()];
365
+ isChild = children.includes(el);
366
+ if (!isChild) {
367
+ isChild = elementIsChildOfSlot(el, parent);
368
+ }
369
+ }
370
+ return isChild;
371
+ }
372
+ function showWarning(text) {
373
+ try {
374
+ console.warn(text);
375
+ return;
376
+ } catch (err) {
377
+ }
378
+ }
379
+ function createElement(tag, classes2 = []) {
359
380
  const el = document.createElement(tag);
360
- el.classList.add(...Array.isArray(classes2) ? classes2 : [classes2]);
381
+ el.classList.add(...Array.isArray(classes2) ? classes2 : classesToTokens(classes2));
361
382
  return el;
362
383
  }
363
384
  function elementPrevAll(el, selector) {
@@ -418,6 +439,15 @@ function elementOuterSize(el, size, includeMargins) {
418
439
  }
419
440
  return el.offsetWidth;
420
441
  }
442
+ function setInnerHTML(el, html = "") {
443
+ if (typeof trustedTypes !== "undefined") {
444
+ el.innerHTML = trustedTypes.createPolicy("html", {
445
+ createHTML: (s) => s
446
+ }).createHTML(html);
447
+ } else {
448
+ el.innerHTML = html;
449
+ }
450
+ }
421
451
 
422
452
  // node_modules/swiper/shared/swiper-core.mjs
423
453
  var support;
@@ -436,10 +466,9 @@ function getSupport() {
436
466
  return support;
437
467
  }
438
468
  var deviceCached;
439
- function calcDevice(_temp) {
440
- let {
441
- userAgent
442
- } = _temp === void 0 ? {} : _temp;
469
+ function calcDevice({
470
+ userAgent
471
+ } = {}) {
443
472
  const support2 = getSupport();
444
473
  const window2 = getWindow();
445
474
  const platform = window2.navigator.platform;
@@ -451,7 +480,7 @@ function calcDevice(_temp) {
451
480
  const screenWidth = window2.screen.width;
452
481
  const screenHeight = window2.screen.height;
453
482
  const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
454
- let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
483
+ let ipad = ua.match(/(iPad)(?!\1).*OS\s([\d_]+)/);
455
484
  const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
456
485
  const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
457
486
  const windows = platform === "Win32";
@@ -472,10 +501,7 @@ function calcDevice(_temp) {
472
501
  }
473
502
  return device;
474
503
  }
475
- function getDevice(overrides) {
476
- if (overrides === void 0) {
477
- overrides = {};
478
- }
504
+ function getDevice(overrides = {}) {
479
505
  if (!deviceCached) {
480
506
  deviceCached = calcDevice(overrides);
481
507
  }
@@ -484,6 +510,7 @@ function getDevice(overrides) {
484
510
  var browser;
485
511
  function calcBrowser() {
486
512
  const window2 = getWindow();
513
+ const device = getDevice();
487
514
  let needPerspectiveFix = false;
488
515
  function isSafari() {
489
516
  const ua = window2.navigator.userAgent.toLowerCase();
@@ -496,10 +523,14 @@ function calcBrowser() {
496
523
  needPerspectiveFix = major < 16 || major === 16 && minor < 2;
497
524
  }
498
525
  }
526
+ const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window2.navigator.userAgent);
527
+ const isSafariBrowser = isSafari();
528
+ const need3dFix = isSafariBrowser || isWebView && device.ios;
499
529
  return {
500
- isSafari: needPerspectiveFix || isSafari(),
530
+ isSafari: needPerspectiveFix || isSafariBrowser,
501
531
  needPerspectiveFix,
502
- isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window2.navigator.userAgent)
532
+ need3dFix,
533
+ isWebView
503
534
  };
504
535
  }
505
536
  function getBrowser() {
@@ -508,12 +539,11 @@ function getBrowser() {
508
539
  }
509
540
  return browser;
510
541
  }
511
- function Resize(_ref) {
512
- let {
513
- swiper,
514
- on,
515
- emit
516
- } = _ref;
542
+ function Resize({
543
+ swiper,
544
+ on,
545
+ emit
546
+ }) {
517
547
  const window2 = getWindow();
518
548
  let observer = null;
519
549
  let animationFrame = null;
@@ -532,12 +562,11 @@ function Resize(_ref) {
532
562
  } = swiper;
533
563
  let newWidth = width;
534
564
  let newHeight = height;
535
- entries.forEach((_ref2) => {
536
- let {
537
- contentBoxSize,
538
- contentRect,
539
- target
540
- } = _ref2;
565
+ entries.forEach(({
566
+ contentBoxSize,
567
+ contentRect,
568
+ target
569
+ }) => {
541
570
  if (target && target !== swiper.el) return;
542
571
  newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
543
572
  newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
@@ -576,19 +605,15 @@ function Resize(_ref) {
576
605
  window2.removeEventListener("orientationchange", orientationChangeHandler);
577
606
  });
578
607
  }
579
- function Observer(_ref) {
580
- let {
581
- swiper,
582
- extendParams,
583
- on,
584
- emit
585
- } = _ref;
608
+ function Observer({
609
+ swiper,
610
+ extendParams,
611
+ on,
612
+ emit
613
+ }) {
586
614
  const observers = [];
587
615
  const window2 = getWindow();
588
- const attach = function(target, options) {
589
- if (options === void 0) {
590
- options = {};
591
- }
616
+ const attach = (target, options = {}) => {
592
617
  const ObserverFunc = window2.MutationObserver || window2.WebkitMutationObserver;
593
618
  const observer = new ObserverFunc((mutations) => {
594
619
  if (swiper.__preventObserver__) return;
@@ -607,7 +632,7 @@ function Observer(_ref) {
607
632
  });
608
633
  observer.observe(target, {
609
634
  attributes: typeof options.attributes === "undefined" ? true : options.attributes,
610
- childList: typeof options.childList === "undefined" ? true : options.childList,
635
+ childList: swiper.isElement || (typeof options.childList === "undefined" ? true : options).childList,
611
636
  characterData: typeof options.characterData === "undefined" ? true : options.characterData
612
637
  });
613
638
  observers.push(observer);
@@ -657,14 +682,11 @@ var eventsEmitter = {
657
682
  const self = this;
658
683
  if (!self.eventsListeners || self.destroyed) return self;
659
684
  if (typeof handler !== "function") return self;
660
- function onceHandler() {
685
+ function onceHandler(...args) {
661
686
  self.off(events2, onceHandler);
662
687
  if (onceHandler.__emitterProxy) {
663
688
  delete onceHandler.__emitterProxy;
664
689
  }
665
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
666
- args[_key] = arguments[_key];
667
- }
668
690
  handler.apply(self, args);
669
691
  }
670
692
  onceHandler.__emitterProxy = handler;
@@ -707,16 +729,13 @@ var eventsEmitter = {
707
729
  });
708
730
  return self;
709
731
  },
710
- emit() {
732
+ emit(...args) {
711
733
  const self = this;
712
734
  if (!self.eventsListeners || self.destroyed) return self;
713
735
  if (!self.eventsListeners) return self;
714
736
  let events2;
715
737
  let data;
716
738
  let context;
717
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
718
- args[_key2] = arguments[_key2];
719
- }
720
739
  if (typeof args[0] === "string" || Array.isArray(args[0])) {
721
740
  events2 = args[0];
722
741
  data = args.slice(1, args.length);
@@ -773,29 +792,13 @@ function updateSize() {
773
792
  }
774
793
  function updateSlides() {
775
794
  const swiper = this;
776
- function getDirectionLabel(property) {
777
- if (swiper.isHorizontal()) {
778
- return property;
779
- }
780
- return {
781
- "width": "height",
782
- "margin-top": "margin-left",
783
- "margin-bottom ": "margin-right",
784
- "margin-left": "margin-top",
785
- "margin-right": "margin-bottom",
786
- "padding-left": "padding-top",
787
- "padding-right": "padding-bottom",
788
- "marginRight": "marginBottom"
789
- }[property];
790
- }
791
795
  function getDirectionPropertyValue(node, label) {
792
- return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
796
+ return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
793
797
  }
794
798
  const params = swiper.params;
795
799
  const {
796
800
  wrapperEl,
797
801
  slidesEl,
798
- size: swiperSize,
799
802
  rtlTranslate: rtl,
800
803
  wrongRTL
801
804
  } = swiper;
@@ -816,6 +819,7 @@ function updateSlides() {
816
819
  }
817
820
  const previousSnapGridLength = swiper.snapGrid.length;
818
821
  const previousSlidesGridLength = swiper.slidesGrid.length;
822
+ const swiperSize = swiper.size - offsetBefore - offsetAfter;
819
823
  let spaceBetween = params.spaceBetween;
820
824
  let slidePosition = -offsetBefore;
821
825
  let prevSlideSize = 0;
@@ -828,7 +832,7 @@ function updateSlides() {
828
832
  } else if (typeof spaceBetween === "string") {
829
833
  spaceBetween = parseFloat(spaceBetween);
830
834
  }
831
- swiper.virtualSize = -spaceBetween;
835
+ swiper.virtualSize = -spaceBetween - offsetBefore - offsetAfter;
832
836
  slides.forEach((slideEl) => {
833
837
  if (rtl) {
834
838
  slideEl.style.marginLeft = "";
@@ -842,9 +846,15 @@ function updateSlides() {
842
846
  setCSSProperty(wrapperEl, "--swiper-centered-offset-before", "");
843
847
  setCSSProperty(wrapperEl, "--swiper-centered-offset-after", "");
844
848
  }
849
+ if (params.cssMode) {
850
+ setCSSProperty(wrapperEl, "--swiper-slides-offset-before", `${offsetBefore}px`);
851
+ setCSSProperty(wrapperEl, "--swiper-slides-offset-after", `${offsetAfter}px`);
852
+ }
845
853
  const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
846
854
  if (gridEnabled) {
847
- swiper.grid.initSlides(slidesLength);
855
+ swiper.grid.initSlides(slides);
856
+ } else if (swiper.grid) {
857
+ swiper.grid.unsetSlides();
848
858
  }
849
859
  let slideSize;
850
860
  const shouldResetSlideSize = params.slidesPerView === "auto" && params.breakpoints && Object.keys(params.breakpoints).filter((key) => {
@@ -852,15 +862,24 @@ function updateSlides() {
852
862
  }).length > 0;
853
863
  for (let i = 0; i < slidesLength; i += 1) {
854
864
  slideSize = 0;
855
- let slide2;
856
- if (slides[i]) slide2 = slides[i];
857
- if (gridEnabled) {
858
- swiper.grid.updateSlide(i, slide2, slidesLength, getDirectionLabel);
865
+ const slide2 = slides[i];
866
+ if (slide2) {
867
+ if (gridEnabled) {
868
+ swiper.grid.updateSlide(i, slide2, slides);
869
+ }
870
+ if (elementStyle(slide2, "display") === "none") continue;
859
871
  }
860
- if (slides[i] && elementStyle(slide2, "display") === "none") continue;
861
- if (params.slidesPerView === "auto") {
872
+ if (isVirtual && params.slidesPerView === "auto") {
873
+ if (params.virtual.slidesPerViewAutoSlideSize) {
874
+ slideSize = params.virtual.slidesPerViewAutoSlideSize;
875
+ }
876
+ if (slideSize && slide2) {
877
+ if (params.roundLengths) slideSize = Math.floor(slideSize);
878
+ slide2.style[swiper.getDirectionLabel("width")] = `${slideSize}px`;
879
+ }
880
+ } else if (params.slidesPerView === "auto") {
862
881
  if (shouldResetSlideSize) {
863
- slides[i].style[getDirectionLabel("width")] = ``;
882
+ slide2.style[swiper.getDirectionLabel("width")] = ``;
864
883
  }
865
884
  const slideStyles = getComputedStyle(slide2);
866
885
  const currentTransform = slide2.style.transform;
@@ -900,12 +919,12 @@ function updateSlides() {
900
919
  } else {
901
920
  slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
902
921
  if (params.roundLengths) slideSize = Math.floor(slideSize);
903
- if (slides[i]) {
904
- slides[i].style[getDirectionLabel("width")] = `${slideSize}px`;
922
+ if (slide2) {
923
+ slide2.style[swiper.getDirectionLabel("width")] = `${slideSize}px`;
905
924
  }
906
925
  }
907
- if (slides[i]) {
908
- slides[i].swiperSlideSize = slideSize;
926
+ if (slide2) {
927
+ slide2.swiperSlideSize = slideSize;
909
928
  }
910
929
  slidesSizesGrid.push(slideSize);
911
930
  if (params.centeredSlides) {
@@ -931,23 +950,50 @@ function updateSlides() {
931
950
  wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
932
951
  }
933
952
  if (params.setWrapperSize) {
934
- wrapperEl.style[getDirectionLabel("width")] = `${swiper.virtualSize + spaceBetween}px`;
953
+ wrapperEl.style[swiper.getDirectionLabel("width")] = `${swiper.virtualSize + spaceBetween}px`;
935
954
  }
936
955
  if (gridEnabled) {
937
- swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
956
+ swiper.grid.updateWrapperSize(slideSize, snapGrid);
938
957
  }
939
958
  if (!params.centeredSlides) {
959
+ const isFractionalSlidesPerView = params.slidesPerView !== "auto" && params.slidesPerView % 1 !== 0;
960
+ const shouldSnapToSlideEdge = params.snapToSlideEdge && !params.loop && (params.slidesPerView === "auto" || isFractionalSlidesPerView);
961
+ let lastAllowedSnapIndex = snapGrid.length;
962
+ if (shouldSnapToSlideEdge) {
963
+ let minVisibleSlides;
964
+ if (params.slidesPerView === "auto") {
965
+ minVisibleSlides = 1;
966
+ let accumulatedSize = 0;
967
+ for (let i = slidesSizesGrid.length - 1; i >= 0; i -= 1) {
968
+ accumulatedSize += slidesSizesGrid[i] + (i < slidesSizesGrid.length - 1 ? spaceBetween : 0);
969
+ if (accumulatedSize <= swiperSize) {
970
+ minVisibleSlides = slidesSizesGrid.length - i;
971
+ } else {
972
+ break;
973
+ }
974
+ }
975
+ } else {
976
+ minVisibleSlides = Math.floor(params.slidesPerView);
977
+ }
978
+ lastAllowedSnapIndex = Math.max(slidesLength - minVisibleSlides, 0);
979
+ }
940
980
  const newSlidesGrid = [];
941
981
  for (let i = 0; i < snapGrid.length; i += 1) {
942
982
  let slidesGridItem = snapGrid[i];
943
983
  if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
944
- if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
984
+ if (shouldSnapToSlideEdge) {
985
+ if (i <= lastAllowedSnapIndex) {
986
+ newSlidesGrid.push(slidesGridItem);
987
+ }
988
+ } else if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
945
989
  newSlidesGrid.push(slidesGridItem);
946
990
  }
947
991
  }
948
992
  snapGrid = newSlidesGrid;
949
993
  if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
950
- snapGrid.push(swiper.virtualSize - swiperSize);
994
+ if (!shouldSnapToSlideEdge) {
995
+ snapGrid.push(swiper.virtualSize - swiperSize);
996
+ }
951
997
  }
952
998
  }
953
999
  if (isVirtual && params.loop) {
@@ -969,7 +1015,7 @@ function updateSlides() {
969
1015
  }
970
1016
  if (snapGrid.length === 0) snapGrid = [0];
971
1017
  if (spaceBetween !== 0) {
972
- const key = swiper.isHorizontal() && rtl ? "marginLeft" : getDirectionLabel("marginRight");
1018
+ const key = swiper.isHorizontal() && rtl ? "marginLeft" : swiper.getDirectionLabel("marginRight");
973
1019
  slides.filter((_, slideIndex) => {
974
1020
  if (!params.cssMode || params.loop) return true;
975
1021
  if (slideIndex === slides.length - 1) {
@@ -986,7 +1032,7 @@ function updateSlides() {
986
1032
  allSlidesSize += slideSizeValue + (spaceBetween || 0);
987
1033
  });
988
1034
  allSlidesSize -= spaceBetween;
989
- const maxSnap = allSlidesSize - swiperSize;
1035
+ const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0;
990
1036
  snapGrid = snapGrid.map((snap) => {
991
1037
  if (snap <= 0) return -offsetBefore;
992
1038
  if (snap > maxSnap) return maxSnap + offsetAfter;
@@ -1036,6 +1082,7 @@ function updateSlides() {
1036
1082
  if (params.watchSlidesProgress) {
1037
1083
  swiper.updateSlidesOffset();
1038
1084
  }
1085
+ swiper.emit("slidesUpdated");
1039
1086
  if (!isVirtual && !params.cssMode && (params.effect === "slide" || params.effect === "fade")) {
1040
1087
  const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
1041
1088
  const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
@@ -1094,10 +1141,14 @@ function updateSlidesOffset() {
1094
1141
  slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();
1095
1142
  }
1096
1143
  }
1097
- function updateSlidesProgress(translate2) {
1098
- if (translate2 === void 0) {
1099
- translate2 = this && this.translate || 0;
1144
+ var toggleSlideClasses$1 = (slideEl, condition, className) => {
1145
+ if (condition && !slideEl.classList.contains(className)) {
1146
+ slideEl.classList.add(className);
1147
+ } else if (!condition && slideEl.classList.contains(className)) {
1148
+ slideEl.classList.remove(className);
1100
1149
  }
1150
+ };
1151
+ function updateSlidesProgress(translate2 = this && this.translate || 0) {
1101
1152
  const swiper = this;
1102
1153
  const params = swiper.params;
1103
1154
  const {
@@ -1109,9 +1160,6 @@ function updateSlidesProgress(translate2) {
1109
1160
  if (typeof slides[0].swiperSlideOffset === "undefined") swiper.updateSlidesOffset();
1110
1161
  let offsetCenter = -translate2;
1111
1162
  if (rtl) offsetCenter = translate2;
1112
- slides.forEach((slideEl) => {
1113
- slideEl.classList.remove(params.slideVisibleClass);
1114
- });
1115
1163
  swiper.visibleSlidesIndexes = [];
1116
1164
  swiper.visibleSlides = [];
1117
1165
  let spaceBetween = params.spaceBetween;
@@ -1130,12 +1178,14 @@ function updateSlidesProgress(translate2) {
1130
1178
  const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide2.swiperSlideSize + spaceBetween);
1131
1179
  const slideBefore = -(offsetCenter - slideOffset);
1132
1180
  const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
1181
+ const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
1133
1182
  const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
1134
1183
  if (isVisible) {
1135
1184
  swiper.visibleSlides.push(slide2);
1136
1185
  swiper.visibleSlidesIndexes.push(i);
1137
- slides[i].classList.add(params.slideVisibleClass);
1138
1186
  }
1187
+ toggleSlideClasses$1(slide2, isVisible, params.slideVisibleClass);
1188
+ toggleSlideClasses$1(slide2, isFullyVisible, params.slideFullyVisibleClass);
1139
1189
  slide2.progress = rtl ? -slideProgress : slideProgress;
1140
1190
  slide2.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
1141
1191
  }
@@ -1201,6 +1251,13 @@ function updateProgress(translate2) {
1201
1251
  }
1202
1252
  swiper.emit("progress", progress);
1203
1253
  }
1254
+ var toggleSlideClasses = (slideEl, condition, className) => {
1255
+ if (condition && !slideEl.classList.contains(className)) {
1256
+ slideEl.classList.add(className);
1257
+ } else if (!condition && slideEl.classList.contains(className)) {
1258
+ slideEl.classList.remove(className);
1259
+ }
1260
+ };
1204
1261
  function updateSlidesClasses() {
1205
1262
  const swiper = this;
1206
1263
  const {
@@ -1210,13 +1267,13 @@ function updateSlidesClasses() {
1210
1267
  activeIndex
1211
1268
  } = swiper;
1212
1269
  const isVirtual = swiper.virtual && params.virtual.enabled;
1270
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1213
1271
  const getFilteredSlide = (selector) => {
1214
1272
  return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
1215
1273
  };
1216
- slides.forEach((slideEl) => {
1217
- slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
1218
- });
1219
1274
  let activeSlide;
1275
+ let prevSlide;
1276
+ let nextSlide;
1220
1277
  if (isVirtual) {
1221
1278
  if (params.loop) {
1222
1279
  let slideIndex = activeIndex - swiper.virtual.slidesBefore;
@@ -1227,25 +1284,31 @@ function updateSlidesClasses() {
1227
1284
  activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
1228
1285
  }
1229
1286
  } else {
1230
- activeSlide = slides[activeIndex];
1287
+ if (gridEnabled) {
1288
+ activeSlide = slides.find((slideEl) => slideEl.column === activeIndex);
1289
+ nextSlide = slides.find((slideEl) => slideEl.column === activeIndex + 1);
1290
+ prevSlide = slides.find((slideEl) => slideEl.column === activeIndex - 1);
1291
+ } else {
1292
+ activeSlide = slides[activeIndex];
1293
+ }
1231
1294
  }
1232
1295
  if (activeSlide) {
1233
- activeSlide.classList.add(params.slideActiveClass);
1234
- let nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1235
- if (params.loop && !nextSlide) {
1236
- nextSlide = slides[0];
1237
- }
1238
- if (nextSlide) {
1239
- nextSlide.classList.add(params.slideNextClass);
1240
- }
1241
- let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1242
- if (params.loop && !prevSlide === 0) {
1243
- prevSlide = slides[slides.length - 1];
1244
- }
1245
- if (prevSlide) {
1246
- prevSlide.classList.add(params.slidePrevClass);
1296
+ if (!gridEnabled) {
1297
+ nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1298
+ if (params.loop && !nextSlide) {
1299
+ nextSlide = slides[0];
1300
+ }
1301
+ prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1302
+ if (params.loop && !prevSlide === 0) {
1303
+ prevSlide = slides[slides.length - 1];
1304
+ }
1247
1305
  }
1248
1306
  }
1307
+ slides.forEach((slideEl) => {
1308
+ toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass);
1309
+ toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass);
1310
+ toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass);
1311
+ });
1249
1312
  swiper.emitSlidesClasses();
1250
1313
  }
1251
1314
  var processLazyPreloader = (swiper, imageEl) => {
@@ -1261,12 +1324,12 @@ var processLazyPreloader = (swiper, imageEl) => {
1261
1324
  requestAnimationFrame(() => {
1262
1325
  if (slideEl.shadowRoot) {
1263
1326
  lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
1264
- if (lazyEl) lazyEl.remove();
1327
+ if (lazyEl && !lazyEl.lazyPreloaderManaged) lazyEl.remove();
1265
1328
  }
1266
1329
  });
1267
1330
  }
1268
1331
  }
1269
- if (lazyEl) lazyEl.remove();
1332
+ if (lazyEl && !lazyEl.lazyPreloaderManaged) lazyEl.remove();
1270
1333
  }
1271
1334
  };
1272
1335
  var unlazy = (swiper, index) => {
@@ -1364,21 +1427,39 @@ function updateActiveIndex(newActiveIndex) {
1364
1427
  snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
1365
1428
  }
1366
1429
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
1367
- if (activeIndex === previousIndex) {
1430
+ if (activeIndex === previousIndex && !swiper.params.loop) {
1368
1431
  if (snapIndex !== previousSnapIndex) {
1369
1432
  swiper.snapIndex = snapIndex;
1370
1433
  swiper.emit("snapIndexChange");
1371
1434
  }
1372
- if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
1373
- swiper.realIndex = getVirtualRealIndex(activeIndex);
1374
- }
1375
1435
  return;
1376
1436
  }
1437
+ if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
1438
+ swiper.realIndex = getVirtualRealIndex(activeIndex);
1439
+ return;
1440
+ }
1441
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1377
1442
  let realIndex;
1378
- if (swiper.virtual && params.virtual.enabled && params.loop) {
1379
- realIndex = getVirtualRealIndex(activeIndex);
1443
+ if (swiper.virtual && params.virtual.enabled) {
1444
+ if (params.loop) {
1445
+ realIndex = getVirtualRealIndex(activeIndex);
1446
+ } else {
1447
+ realIndex = activeIndex;
1448
+ }
1449
+ } else if (gridEnabled) {
1450
+ const firstSlideInColumn = swiper.slides.find((slideEl) => slideEl.column === activeIndex);
1451
+ let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute("data-swiper-slide-index"), 10);
1452
+ if (Number.isNaN(activeSlideIndex)) {
1453
+ activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
1454
+ }
1455
+ realIndex = Math.floor(activeSlideIndex / params.grid.rows);
1380
1456
  } else if (swiper.slides[activeIndex]) {
1381
- realIndex = parseInt(swiper.slides[activeIndex].getAttribute("data-swiper-slide-index") || activeIndex, 10);
1457
+ const slideIndex = swiper.slides[activeIndex].getAttribute("data-swiper-slide-index");
1458
+ if (slideIndex) {
1459
+ realIndex = parseInt(slideIndex, 10);
1460
+ } else {
1461
+ realIndex = activeIndex;
1462
+ }
1382
1463
  } else {
1383
1464
  realIndex = activeIndex;
1384
1465
  }
@@ -1451,10 +1532,7 @@ var update = {
1451
1532
  updateActiveIndex,
1452
1533
  updateClickedSlide
1453
1534
  };
1454
- function getSwiperTranslate(axis) {
1455
- if (axis === void 0) {
1456
- axis = this.isHorizontal() ? "x" : "y";
1457
- }
1535
+ function getSwiperTranslate(axis = this.isHorizontal() ? "x" : "y") {
1458
1536
  const swiper = this;
1459
1537
  const {
1460
1538
  params,
@@ -1523,19 +1601,7 @@ function minTranslate() {
1523
1601
  function maxTranslate() {
1524
1602
  return -this.snapGrid[this.snapGrid.length - 1];
1525
1603
  }
1526
- function translateTo(translate2, speed, runCallbacks, translateBounds, internal) {
1527
- if (translate2 === void 0) {
1528
- translate2 = 0;
1529
- }
1530
- if (speed === void 0) {
1531
- speed = this.params.speed;
1532
- }
1533
- if (runCallbacks === void 0) {
1534
- runCallbacks = true;
1535
- }
1536
- if (translateBounds === void 0) {
1537
- translateBounds = true;
1538
- }
1604
+ function translateTo(translate2 = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) {
1539
1605
  const swiper = this;
1540
1606
  const {
1541
1607
  params,
@@ -1594,6 +1660,7 @@ function translateTo(translate2, speed, runCallbacks, translateBounds, internal)
1594
1660
  swiper.wrapperEl.removeEventListener("transitionend", swiper.onTranslateToWrapperTransitionEnd);
1595
1661
  swiper.onTranslateToWrapperTransitionEnd = null;
1596
1662
  delete swiper.onTranslateToWrapperTransitionEnd;
1663
+ swiper.animating = false;
1597
1664
  if (runCallbacks) {
1598
1665
  swiper.emit("transitionEnd");
1599
1666
  }
@@ -1619,13 +1686,12 @@ function setTransition(duration, byController) {
1619
1686
  }
1620
1687
  swiper.emit("setTransition", duration, byController);
1621
1688
  }
1622
- function transitionEmit(_ref) {
1623
- let {
1624
- swiper,
1625
- runCallbacks,
1626
- direction,
1627
- step
1628
- } = _ref;
1689
+ function transitionEmit({
1690
+ swiper,
1691
+ runCallbacks,
1692
+ direction,
1693
+ step
1694
+ }) {
1629
1695
  const {
1630
1696
  activeIndex,
1631
1697
  previousIndex
@@ -1637,11 +1703,9 @@ function transitionEmit(_ref) {
1637
1703
  else dir = "reset";
1638
1704
  }
1639
1705
  swiper.emit(`transition${step}`);
1640
- if (runCallbacks && activeIndex !== previousIndex) {
1641
- if (dir === "reset") {
1642
- swiper.emit(`slideResetTransition${step}`);
1643
- return;
1644
- }
1706
+ if (runCallbacks && dir === "reset") {
1707
+ swiper.emit(`slideResetTransition${step}`);
1708
+ } else if (runCallbacks && activeIndex !== previousIndex) {
1645
1709
  swiper.emit(`slideChangeTransition${step}`);
1646
1710
  if (dir === "next") {
1647
1711
  swiper.emit(`slideNextTransition${step}`);
@@ -1650,10 +1714,7 @@ function transitionEmit(_ref) {
1650
1714
  }
1651
1715
  }
1652
1716
  }
1653
- function transitionStart(runCallbacks, direction) {
1654
- if (runCallbacks === void 0) {
1655
- runCallbacks = true;
1656
- }
1717
+ function transitionStart(runCallbacks = true, direction) {
1657
1718
  const swiper = this;
1658
1719
  const {
1659
1720
  params
@@ -1669,10 +1730,7 @@ function transitionStart(runCallbacks, direction) {
1669
1730
  step: "Start"
1670
1731
  });
1671
1732
  }
1672
- function transitionEnd(runCallbacks, direction) {
1673
- if (runCallbacks === void 0) {
1674
- runCallbacks = true;
1675
- }
1733
+ function transitionEnd(runCallbacks = true, direction) {
1676
1734
  const swiper = this;
1677
1735
  const {
1678
1736
  params
@@ -1692,16 +1750,7 @@ var transition = {
1692
1750
  transitionStart,
1693
1751
  transitionEnd
1694
1752
  };
1695
- function slideTo(index, speed, runCallbacks, internal, initial) {
1696
- if (index === void 0) {
1697
- index = 0;
1698
- }
1699
- if (speed === void 0) {
1700
- speed = this.params.speed;
1701
- }
1702
- if (runCallbacks === void 0) {
1703
- runCallbacks = true;
1704
- }
1753
+ function slideTo(index = 0, speed, runCallbacks = true, internal, initial) {
1705
1754
  if (typeof index === "string") {
1706
1755
  index = parseInt(index, 10);
1707
1756
  }
@@ -1718,9 +1767,12 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
1718
1767
  wrapperEl,
1719
1768
  enabled
1720
1769
  } = swiper;
1721
- if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
1770
+ if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) {
1722
1771
  return false;
1723
1772
  }
1773
+ if (typeof speed === "undefined") {
1774
+ speed = swiper.params.speed;
1775
+ }
1724
1776
  const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
1725
1777
  let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
1726
1778
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
@@ -1759,7 +1811,9 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
1759
1811
  if (slideIndex > activeIndex) direction = "next";
1760
1812
  else if (slideIndex < activeIndex) direction = "prev";
1761
1813
  else direction = "reset";
1762
- if (rtl && -translate2 === swiper.translate || !rtl && translate2 === swiper.translate) {
1814
+ const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
1815
+ const isInitialVirtual = isVirtual && initial;
1816
+ if (!isInitialVirtual && (rtl && -translate2 === swiper.translate || !rtl && translate2 === swiper.translate)) {
1763
1817
  swiper.updateActiveIndex(slideIndex);
1764
1818
  if (params.autoHeight) {
1765
1819
  swiper.updateAutoHeight();
@@ -1778,7 +1832,6 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
1778
1832
  const isH = swiper.isHorizontal();
1779
1833
  const t = rtl ? translate2 : -translate2;
1780
1834
  if (speed === 0) {
1781
- const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
1782
1835
  if (isVirtual) {
1783
1836
  swiper.wrapperEl.style.scrollSnapType = "none";
1784
1837
  swiper._immediateVirtual = true;
@@ -1813,6 +1866,11 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
1813
1866
  }
1814
1867
  return true;
1815
1868
  }
1869
+ const browser2 = getBrowser();
1870
+ const isSafari = browser2.isSafari;
1871
+ if (isVirtual && !initial && isSafari && swiper.isElement) {
1872
+ swiper.virtual.update(false, false, slideIndex);
1873
+ }
1816
1874
  swiper.setTransition(speed);
1817
1875
  swiper.setTranslate(translate2);
1818
1876
  swiper.updateActiveIndex(slideIndex);
@@ -1837,45 +1895,85 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
1837
1895
  }
1838
1896
  return true;
1839
1897
  }
1840
- function slideToLoop(index, speed, runCallbacks, internal) {
1841
- if (index === void 0) {
1842
- index = 0;
1843
- }
1844
- if (speed === void 0) {
1845
- speed = this.params.speed;
1846
- }
1847
- if (runCallbacks === void 0) {
1848
- runCallbacks = true;
1849
- }
1898
+ function slideToLoop(index = 0, speed, runCallbacks = true, internal) {
1850
1899
  if (typeof index === "string") {
1851
1900
  const indexAsNumber = parseInt(index, 10);
1852
1901
  index = indexAsNumber;
1853
1902
  }
1854
1903
  const swiper = this;
1904
+ if (swiper.destroyed) return;
1905
+ if (typeof speed === "undefined") {
1906
+ speed = swiper.params.speed;
1907
+ }
1908
+ const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
1855
1909
  let newIndex = index;
1856
1910
  if (swiper.params.loop) {
1857
1911
  if (swiper.virtual && swiper.params.virtual.enabled) {
1858
1912
  newIndex = newIndex + swiper.virtual.slidesBefore;
1859
1913
  } else {
1860
- newIndex = swiper.getSlideIndexByData(newIndex);
1914
+ let targetSlideIndex;
1915
+ if (gridEnabled) {
1916
+ const slideIndex = newIndex * swiper.params.grid.rows;
1917
+ targetSlideIndex = swiper.slides.find((slideEl) => slideEl.getAttribute("data-swiper-slide-index") * 1 === slideIndex).column;
1918
+ } else {
1919
+ targetSlideIndex = swiper.getSlideIndexByData(newIndex);
1920
+ }
1921
+ const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
1922
+ const {
1923
+ centeredSlides,
1924
+ slidesOffsetBefore,
1925
+ slidesOffsetAfter
1926
+ } = swiper.params;
1927
+ const bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter;
1928
+ let slidesPerView = swiper.params.slidesPerView;
1929
+ if (slidesPerView === "auto") {
1930
+ slidesPerView = swiper.slidesPerViewDynamic();
1931
+ } else {
1932
+ slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
1933
+ if (bothDirections && slidesPerView % 2 === 0) {
1934
+ slidesPerView = slidesPerView + 1;
1935
+ }
1936
+ }
1937
+ let needLoopFix = cols - targetSlideIndex < slidesPerView;
1938
+ if (bothDirections) {
1939
+ needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
1940
+ }
1941
+ if (internal && bothDirections && swiper.params.slidesPerView !== "auto" && !gridEnabled) {
1942
+ needLoopFix = false;
1943
+ }
1944
+ if (needLoopFix) {
1945
+ const direction = bothDirections ? targetSlideIndex < swiper.activeIndex ? "prev" : "next" : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? "next" : "prev";
1946
+ swiper.loopFix({
1947
+ direction,
1948
+ slideTo: true,
1949
+ activeSlideIndex: direction === "next" ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
1950
+ slideRealIndex: direction === "next" ? swiper.realIndex : void 0
1951
+ });
1952
+ }
1953
+ if (gridEnabled) {
1954
+ const slideIndex = newIndex * swiper.params.grid.rows;
1955
+ newIndex = swiper.slides.find((slideEl) => slideEl.getAttribute("data-swiper-slide-index") * 1 === slideIndex).column;
1956
+ } else {
1957
+ newIndex = swiper.getSlideIndexByData(newIndex);
1958
+ }
1861
1959
  }
1862
1960
  }
1863
- return swiper.slideTo(newIndex, speed, runCallbacks, internal);
1961
+ requestAnimationFrame(() => {
1962
+ swiper.slideTo(newIndex, speed, runCallbacks, internal);
1963
+ });
1964
+ return swiper;
1864
1965
  }
1865
- function slideNext(speed, runCallbacks, internal) {
1866
- if (speed === void 0) {
1867
- speed = this.params.speed;
1868
- }
1869
- if (runCallbacks === void 0) {
1870
- runCallbacks = true;
1871
- }
1966
+ function slideNext(speed, runCallbacks = true, internal) {
1872
1967
  const swiper = this;
1873
1968
  const {
1874
1969
  enabled,
1875
1970
  params,
1876
1971
  animating
1877
1972
  } = swiper;
1878
- if (!enabled) return swiper;
1973
+ if (!enabled || swiper.destroyed) return swiper;
1974
+ if (typeof speed === "undefined") {
1975
+ speed = swiper.params.speed;
1976
+ }
1879
1977
  let perGroup = params.slidesPerGroup;
1880
1978
  if (params.slidesPerView === "auto" && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
1881
1979
  perGroup = Math.max(swiper.slidesPerViewDynamic("current", true), 1);
@@ -1900,13 +1998,7 @@ function slideNext(speed, runCallbacks, internal) {
1900
1998
  }
1901
1999
  return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
1902
2000
  }
1903
- function slidePrev(speed, runCallbacks, internal) {
1904
- if (speed === void 0) {
1905
- speed = this.params.speed;
1906
- }
1907
- if (runCallbacks === void 0) {
1908
- runCallbacks = true;
1909
- }
2001
+ function slidePrev(speed, runCallbacks = true, internal) {
1910
2002
  const swiper = this;
1911
2003
  const {
1912
2004
  params,
@@ -1916,7 +2008,10 @@ function slidePrev(speed, runCallbacks, internal) {
1916
2008
  enabled,
1917
2009
  animating
1918
2010
  } = swiper;
1919
- if (!enabled) return swiper;
2011
+ if (!enabled || swiper.destroyed) return swiper;
2012
+ if (typeof speed === "undefined") {
2013
+ speed = swiper.params.speed;
2014
+ }
1920
2015
  const isVirtual = swiper.virtual && params.virtual.enabled;
1921
2016
  if (params.loop) {
1922
2017
  if (animating && !isVirtual && params.loopPreventsSliding) return false;
@@ -1932,8 +2027,9 @@ function slidePrev(speed, runCallbacks, internal) {
1932
2027
  }
1933
2028
  const normalizedTranslate = normalize(translate2);
1934
2029
  const normalizedSnapGrid = snapGrid.map((val) => normalize(val));
2030
+ const isFreeMode = params.freeMode && params.freeMode.enabled;
1935
2031
  let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
1936
- if (typeof prevSnap === "undefined" && params.cssMode) {
2032
+ if (typeof prevSnap === "undefined" && (params.cssMode || isFreeMode)) {
1937
2033
  let prevSnapIndex;
1938
2034
  snapGrid.forEach((snap, snapIndex) => {
1939
2035
  if (normalizedTranslate >= snap) {
@@ -1941,7 +2037,7 @@ function slidePrev(speed, runCallbacks, internal) {
1941
2037
  }
1942
2038
  });
1943
2039
  if (typeof prevSnapIndex !== "undefined") {
1944
- prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
2040
+ prevSnap = isFreeMode ? snapGrid[prevSnapIndex] : snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
1945
2041
  }
1946
2042
  }
1947
2043
  let prevIndex = 0;
@@ -1964,27 +2060,20 @@ function slidePrev(speed, runCallbacks, internal) {
1964
2060
  }
1965
2061
  return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
1966
2062
  }
1967
- function slideReset(speed, runCallbacks, internal) {
1968
- if (speed === void 0) {
1969
- speed = this.params.speed;
1970
- }
1971
- if (runCallbacks === void 0) {
1972
- runCallbacks = true;
1973
- }
2063
+ function slideReset(speed, runCallbacks = true, internal) {
1974
2064
  const swiper = this;
2065
+ if (swiper.destroyed) return;
2066
+ if (typeof speed === "undefined") {
2067
+ speed = swiper.params.speed;
2068
+ }
1975
2069
  return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
1976
2070
  }
1977
- function slideToClosest(speed, runCallbacks, internal, threshold) {
1978
- if (speed === void 0) {
1979
- speed = this.params.speed;
1980
- }
1981
- if (runCallbacks === void 0) {
1982
- runCallbacks = true;
1983
- }
1984
- if (threshold === void 0) {
1985
- threshold = 0.5;
1986
- }
2071
+ function slideToClosest(speed, runCallbacks = true, internal, threshold = 0.5) {
1987
2072
  const swiper = this;
2073
+ if (swiper.destroyed) return;
2074
+ if (typeof speed === "undefined") {
2075
+ speed = swiper.params.speed;
2076
+ }
1988
2077
  let index = swiper.activeIndex;
1989
2078
  const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
1990
2079
  const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
@@ -2008,28 +2097,22 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
2008
2097
  }
2009
2098
  function slideToClickedSlide() {
2010
2099
  const swiper = this;
2100
+ if (swiper.destroyed) return;
2011
2101
  const {
2012
2102
  params,
2013
2103
  slidesEl
2014
2104
  } = swiper;
2015
2105
  const slidesPerView = params.slidesPerView === "auto" ? swiper.slidesPerViewDynamic() : params.slidesPerView;
2016
- let slideToIndex = swiper.clickedIndex;
2106
+ let slideToIndex = swiper.getSlideIndexWhenGrid(swiper.clickedIndex);
2017
2107
  let realIndex;
2018
2108
  const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
2109
+ const isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
2019
2110
  if (params.loop) {
2020
2111
  if (swiper.animating) return;
2021
2112
  realIndex = parseInt(swiper.clickedSlide.getAttribute("data-swiper-slide-index"), 10);
2022
2113
  if (params.centeredSlides) {
2023
- if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
2024
- swiper.loopFix();
2025
- slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
2026
- nextTick(() => {
2027
- swiper.slideTo(slideToIndex);
2028
- });
2029
- } else {
2030
- swiper.slideTo(slideToIndex);
2031
- }
2032
- } else if (slideToIndex > swiper.slides.length - slidesPerView) {
2114
+ swiper.slideToLoop(realIndex);
2115
+ } else if (slideToIndex > (isGrid ? (swiper.slides.length - slidesPerView) / 2 - (swiper.params.grid.rows - 1) : swiper.slides.length - slidesPerView)) {
2033
2116
  swiper.loopFix();
2034
2117
  slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
2035
2118
  nextTick(() => {
@@ -2051,32 +2134,82 @@ var slide = {
2051
2134
  slideToClosest,
2052
2135
  slideToClickedSlide
2053
2136
  };
2054
- function loopCreate(slideRealIndex) {
2137
+ function loopCreate(slideRealIndex, initial) {
2055
2138
  const swiper = this;
2056
2139
  const {
2057
2140
  params,
2058
2141
  slidesEl
2059
2142
  } = swiper;
2060
2143
  if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
2061
- const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
2062
- slides.forEach((el, index) => {
2063
- el.setAttribute("data-swiper-slide-index", index);
2064
- });
2144
+ const initSlides = () => {
2145
+ const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
2146
+ slides.forEach((el, index) => {
2147
+ el.setAttribute("data-swiper-slide-index", index);
2148
+ });
2149
+ };
2150
+ const clearBlankSlides = () => {
2151
+ const slides = elementChildren(slidesEl, `.${params.slideBlankClass}`);
2152
+ slides.forEach((el) => {
2153
+ el.remove();
2154
+ });
2155
+ if (slides.length > 0) {
2156
+ swiper.recalcSlides();
2157
+ swiper.updateSlides();
2158
+ }
2159
+ };
2160
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
2161
+ if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) {
2162
+ clearBlankSlides();
2163
+ }
2164
+ const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
2165
+ const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
2166
+ const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
2167
+ const addBlankSlides = (amountOfSlides) => {
2168
+ for (let i = 0; i < amountOfSlides; i += 1) {
2169
+ const slideEl = swiper.isElement ? createElement("swiper-slide", [params.slideBlankClass]) : createElement("div", [params.slideClass, params.slideBlankClass]);
2170
+ swiper.slidesEl.append(slideEl);
2171
+ }
2172
+ };
2173
+ if (shouldFillGroup) {
2174
+ if (params.loopAddBlankSlides) {
2175
+ const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
2176
+ addBlankSlides(slidesToAdd);
2177
+ swiper.recalcSlides();
2178
+ swiper.updateSlides();
2179
+ } else {
2180
+ showWarning("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");
2181
+ }
2182
+ initSlides();
2183
+ } else if (shouldFillGrid) {
2184
+ if (params.loopAddBlankSlides) {
2185
+ const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
2186
+ addBlankSlides(slidesToAdd);
2187
+ swiper.recalcSlides();
2188
+ swiper.updateSlides();
2189
+ } else {
2190
+ showWarning("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");
2191
+ }
2192
+ initSlides();
2193
+ } else {
2194
+ initSlides();
2195
+ }
2196
+ const bothDirections = params.centeredSlides || !!params.slidesOffsetBefore || !!params.slidesOffsetAfter;
2065
2197
  swiper.loopFix({
2066
2198
  slideRealIndex,
2067
- direction: params.centeredSlides ? void 0 : "next"
2199
+ direction: bothDirections ? void 0 : "next",
2200
+ initial
2068
2201
  });
2069
2202
  }
2070
- function loopFix(_temp) {
2071
- let {
2072
- slideRealIndex,
2073
- slideTo: slideTo2 = true,
2074
- direction,
2075
- setTranslate: setTranslate2,
2076
- activeSlideIndex,
2077
- byController,
2078
- byMousewheel
2079
- } = _temp === void 0 ? {} : _temp;
2203
+ function loopFix({
2204
+ slideRealIndex,
2205
+ slideTo: slideTo2 = true,
2206
+ direction,
2207
+ setTranslate: setTranslate2,
2208
+ activeSlideIndex,
2209
+ initial,
2210
+ byController,
2211
+ byMousewheel
2212
+ } = {}) {
2080
2213
  const swiper = this;
2081
2214
  if (!swiper.params.loop) return;
2082
2215
  swiper.emit("beforeLoopFix");
@@ -2087,13 +2220,20 @@ function loopFix(_temp) {
2087
2220
  slidesEl,
2088
2221
  params
2089
2222
  } = swiper;
2223
+ const {
2224
+ centeredSlides,
2225
+ slidesOffsetBefore,
2226
+ slidesOffsetAfter,
2227
+ initialSlide
2228
+ } = params;
2229
+ const bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter;
2090
2230
  swiper.allowSlidePrev = true;
2091
2231
  swiper.allowSlideNext = true;
2092
2232
  if (swiper.virtual && params.virtual.enabled) {
2093
2233
  if (slideTo2) {
2094
- if (!params.centeredSlides && swiper.snapIndex === 0) {
2234
+ if (!bothDirections && swiper.snapIndex === 0) {
2095
2235
  swiper.slideTo(swiper.virtual.slides.length, 0, false, true);
2096
- } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {
2236
+ } else if (bothDirections && swiper.snapIndex < params.slidesPerView) {
2097
2237
  swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);
2098
2238
  } else if (swiper.snapIndex === swiper.snapGrid.length - 1) {
2099
2239
  swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);
@@ -2104,17 +2244,35 @@ function loopFix(_temp) {
2104
2244
  swiper.emit("loopFix");
2105
2245
  return;
2106
2246
  }
2107
- const slidesPerView = params.slidesPerView === "auto" ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
2108
- let loopedSlides = params.loopedSlides || slidesPerView;
2109
- if (loopedSlides % params.slidesPerGroup !== 0) {
2110
- loopedSlides += params.slidesPerGroup - loopedSlides % params.slidesPerGroup;
2247
+ let slidesPerView = params.slidesPerView;
2248
+ if (slidesPerView === "auto") {
2249
+ slidesPerView = swiper.slidesPerViewDynamic();
2250
+ } else {
2251
+ slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
2252
+ if (bothDirections && slidesPerView % 2 === 0) {
2253
+ slidesPerView = slidesPerView + 1;
2254
+ }
2111
2255
  }
2256
+ const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
2257
+ let loopedSlides = bothDirections ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup;
2258
+ if (loopedSlides % slidesPerGroup !== 0) {
2259
+ loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
2260
+ }
2261
+ loopedSlides += params.loopAdditionalSlides;
2112
2262
  swiper.loopedSlides = loopedSlides;
2263
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
2264
+ if (slides.length < slidesPerView + loopedSlides || swiper.params.effect === "cards" && slides.length < slidesPerView + loopedSlides * 2) {
2265
+ showWarning("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters");
2266
+ } else if (gridEnabled && params.grid.fill === "row") {
2267
+ showWarning("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");
2268
+ }
2113
2269
  const prependSlidesIndexes = [];
2114
2270
  const appendSlidesIndexes = [];
2115
- let activeIndex = swiper.activeIndex;
2271
+ const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
2272
+ const isInitialOverflow = initial && cols - initialSlide < slidesPerView && !bothDirections;
2273
+ let activeIndex = isInitialOverflow ? initialSlide : swiper.activeIndex;
2116
2274
  if (typeof activeSlideIndex === "undefined") {
2117
- activeSlideIndex = swiper.getSlideIndex(swiper.slides.filter((el) => el.classList.contains(params.slideActiveClass))[0]);
2275
+ activeSlideIndex = swiper.getSlideIndex(slides.find((el) => el.classList.contains(params.slideActiveClass)));
2118
2276
  } else {
2119
2277
  activeIndex = activeSlideIndex;
2120
2278
  }
@@ -2122,36 +2280,70 @@ function loopFix(_temp) {
2122
2280
  const isPrev = direction === "prev" || !direction;
2123
2281
  let slidesPrepended = 0;
2124
2282
  let slidesAppended = 0;
2125
- if (activeSlideIndex < loopedSlides) {
2126
- slidesPrepended = Math.max(loopedSlides - activeSlideIndex, params.slidesPerGroup);
2127
- for (let i = 0; i < loopedSlides - activeSlideIndex; i += 1) {
2128
- const index = i - Math.floor(i / slides.length) * slides.length;
2129
- prependSlidesIndexes.push(slides.length - index - 1);
2130
- }
2131
- } else if (activeSlideIndex > swiper.slides.length - loopedSlides * 2) {
2132
- slidesAppended = Math.max(activeSlideIndex - (swiper.slides.length - loopedSlides * 2), params.slidesPerGroup);
2283
+ const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
2284
+ const activeColIndexWithShift = activeColIndex + (bothDirections && typeof setTranslate2 === "undefined" ? -slidesPerView / 2 + 0.5 : 0);
2285
+ if (activeColIndexWithShift < loopedSlides) {
2286
+ slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
2287
+ for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
2288
+ const index = i - Math.floor(i / cols) * cols;
2289
+ if (gridEnabled) {
2290
+ const colIndexToPrepend = cols - index - 1;
2291
+ for (let i2 = slides.length - 1; i2 >= 0; i2 -= 1) {
2292
+ if (slides[i2].column === colIndexToPrepend) prependSlidesIndexes.push(i2);
2293
+ }
2294
+ } else {
2295
+ prependSlidesIndexes.push(cols - index - 1);
2296
+ }
2297
+ }
2298
+ } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
2299
+ slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
2300
+ if (isInitialOverflow) {
2301
+ slidesAppended = Math.max(slidesAppended, slidesPerView - cols + initialSlide + 1);
2302
+ }
2133
2303
  for (let i = 0; i < slidesAppended; i += 1) {
2134
- const index = i - Math.floor(i / slides.length) * slides.length;
2135
- appendSlidesIndexes.push(index);
2304
+ const index = i - Math.floor(i / cols) * cols;
2305
+ if (gridEnabled) {
2306
+ slides.forEach((slide2, slideIndex) => {
2307
+ if (slide2.column === index) appendSlidesIndexes.push(slideIndex);
2308
+ });
2309
+ } else {
2310
+ appendSlidesIndexes.push(index);
2311
+ }
2312
+ }
2313
+ }
2314
+ swiper.__preventObserver__ = true;
2315
+ requestAnimationFrame(() => {
2316
+ swiper.__preventObserver__ = false;
2317
+ });
2318
+ if (swiper.params.effect === "cards" && slides.length < slidesPerView + loopedSlides * 2) {
2319
+ if (appendSlidesIndexes.includes(activeSlideIndex)) {
2320
+ appendSlidesIndexes.splice(appendSlidesIndexes.indexOf(activeSlideIndex), 1);
2321
+ }
2322
+ if (prependSlidesIndexes.includes(activeSlideIndex)) {
2323
+ prependSlidesIndexes.splice(prependSlidesIndexes.indexOf(activeSlideIndex), 1);
2136
2324
  }
2137
2325
  }
2138
2326
  if (isPrev) {
2139
2327
  prependSlidesIndexes.forEach((index) => {
2140
- swiper.slides[index].swiperLoopMoveDOM = true;
2141
- slidesEl.prepend(swiper.slides[index]);
2142
- swiper.slides[index].swiperLoopMoveDOM = false;
2328
+ slides[index].swiperLoopMoveDOM = true;
2329
+ slidesEl.prepend(slides[index]);
2330
+ slides[index].swiperLoopMoveDOM = false;
2143
2331
  });
2144
2332
  }
2145
2333
  if (isNext) {
2146
2334
  appendSlidesIndexes.forEach((index) => {
2147
- swiper.slides[index].swiperLoopMoveDOM = true;
2148
- slidesEl.append(swiper.slides[index]);
2149
- swiper.slides[index].swiperLoopMoveDOM = false;
2335
+ slides[index].swiperLoopMoveDOM = true;
2336
+ slidesEl.append(slides[index]);
2337
+ slides[index].swiperLoopMoveDOM = false;
2150
2338
  });
2151
2339
  }
2152
2340
  swiper.recalcSlides();
2153
2341
  if (params.slidesPerView === "auto") {
2154
2342
  swiper.updateSlides();
2343
+ } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
2344
+ swiper.slides.forEach((slide2, slideIndex) => {
2345
+ swiper.grid.updateSlide(slideIndex, slide2, swiper.slides);
2346
+ });
2155
2347
  }
2156
2348
  if (params.watchSlidesProgress) {
2157
2349
  swiper.updateSlidesOffset();
@@ -2165,15 +2357,16 @@ function loopFix(_temp) {
2165
2357
  if (byMousewheel) {
2166
2358
  swiper.setTranslate(swiper.translate - diff);
2167
2359
  } else {
2168
- swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
2360
+ swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true);
2169
2361
  if (setTranslate2) {
2170
- swiper.touches[swiper.isHorizontal() ? "startX" : "startY"] += diff;
2171
- swiper.touchEventsData.currentTranslate = swiper.translate;
2362
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2363
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2172
2364
  }
2173
2365
  }
2174
2366
  } else {
2175
2367
  if (setTranslate2) {
2176
- swiper.slideToLoop(slideRealIndex, 0, false, true);
2368
+ const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
2369
+ swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
2177
2370
  swiper.touchEventsData.currentTranslate = swiper.translate;
2178
2371
  }
2179
2372
  }
@@ -2187,12 +2380,13 @@ function loopFix(_temp) {
2187
2380
  } else {
2188
2381
  swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
2189
2382
  if (setTranslate2) {
2190
- swiper.touches[swiper.isHorizontal() ? "startX" : "startY"] += diff;
2191
- swiper.touchEventsData.currentTranslate = swiper.translate;
2383
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2384
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2192
2385
  }
2193
2386
  }
2194
2387
  } else {
2195
- swiper.slideToLoop(slideRealIndex, 0, false, true);
2388
+ const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
2389
+ swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
2196
2390
  }
2197
2391
  }
2198
2392
  }
@@ -2228,7 +2422,7 @@ function loopDestroy() {
2228
2422
  params,
2229
2423
  slidesEl
2230
2424
  } = swiper;
2231
- if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
2425
+ if (!params.loop || !slidesEl || swiper.virtual && swiper.params.virtual.enabled) return;
2232
2426
  swiper.recalcSlides();
2233
2427
  const newSlidesOrder = [];
2234
2428
  swiper.slides.forEach((slideEl) => {
@@ -2283,10 +2477,7 @@ var grabCursor = {
2283
2477
  setGrabCursor,
2284
2478
  unsetGrabCursor
2285
2479
  };
2286
- function closestElement(selector, base) {
2287
- if (base === void 0) {
2288
- base = this;
2289
- }
2480
+ function closestElement(selector, base = this) {
2290
2481
  function __closestFrom(el) {
2291
2482
  if (!el || el === getDocument() || el === getWindow()) return null;
2292
2483
  if (el.assignedSlot) el = el.assignedSlot;
@@ -2298,36 +2489,63 @@ function closestElement(selector, base) {
2298
2489
  }
2299
2490
  return __closestFrom(base);
2300
2491
  }
2492
+ function preventEdgeSwipe(swiper, event, startX) {
2493
+ const window2 = getWindow();
2494
+ const {
2495
+ params
2496
+ } = swiper;
2497
+ const edgeSwipeDetection = params.edgeSwipeDetection;
2498
+ const edgeSwipeThreshold = params.edgeSwipeThreshold;
2499
+ if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window2.innerWidth - edgeSwipeThreshold)) {
2500
+ if (edgeSwipeDetection === "prevent") {
2501
+ event.preventDefault();
2502
+ return true;
2503
+ }
2504
+ return false;
2505
+ }
2506
+ return true;
2507
+ }
2301
2508
  function onTouchStart(event) {
2302
2509
  const swiper = this;
2510
+ if (swiper.destroyed) return;
2303
2511
  const document2 = getDocument();
2304
- const window2 = getWindow();
2512
+ let e = event;
2513
+ if (e.originalEvent) e = e.originalEvent;
2305
2514
  const data = swiper.touchEventsData;
2306
- data.evCache.push(event);
2515
+ if (e.type === "pointerdown") {
2516
+ if (data.pointerId !== null && data.pointerId !== e.pointerId) {
2517
+ return;
2518
+ }
2519
+ data.pointerId = e.pointerId;
2520
+ } else if (e.type === "touchstart" && e.targetTouches.length === 1) {
2521
+ data.touchId = e.targetTouches[0].identifier;
2522
+ }
2523
+ if (e.type === "touchstart") {
2524
+ preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
2525
+ return;
2526
+ }
2307
2527
  const {
2308
2528
  params,
2309
2529
  touches,
2310
2530
  enabled
2311
2531
  } = swiper;
2312
2532
  if (!enabled) return;
2313
- if (!params.simulateTouch && event.pointerType === "mouse") return;
2533
+ if (!params.simulateTouch && e.pointerType === "mouse") return;
2314
2534
  if (swiper.animating && params.preventInteractionOnTransition) {
2315
2535
  return;
2316
2536
  }
2317
2537
  if (!swiper.animating && params.cssMode && params.loop) {
2318
2538
  swiper.loopFix();
2319
2539
  }
2320
- let e = event;
2321
- if (e.originalEvent) e = e.originalEvent;
2322
2540
  let targetEl = e.target;
2323
2541
  if (params.touchEventsTarget === "wrapper") {
2324
- if (!swiper.wrapperEl.contains(targetEl)) return;
2542
+ if (!elementIsChildOf(targetEl, swiper.wrapperEl)) return;
2325
2543
  }
2326
2544
  if ("which" in e && e.which === 3) return;
2327
2545
  if ("button" in e && e.button > 0) return;
2328
2546
  if (data.isTouched && data.isMoved) return;
2329
2547
  const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== "";
2330
- const eventPath = event.composedPath ? event.composedPath() : event.path;
2548
+ const eventPath = e.composedPath ? e.composedPath() : e.path;
2331
2549
  if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
2332
2550
  targetEl = eventPath[0];
2333
2551
  }
@@ -2344,14 +2562,8 @@ function onTouchStart(event) {
2344
2562
  touches.currentY = e.pageY;
2345
2563
  const startX = touches.currentX;
2346
2564
  const startY = touches.currentY;
2347
- const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
2348
- const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
2349
- if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window2.innerWidth - edgeSwipeThreshold)) {
2350
- if (edgeSwipeDetection === "prevent") {
2351
- event.preventDefault();
2352
- } else {
2353
- return;
2354
- }
2565
+ if (!preventEdgeSwipe(swiper, e, startX)) {
2566
+ return;
2355
2567
  }
2356
2568
  Object.assign(data, {
2357
2569
  isTouched: true,
@@ -2374,7 +2586,7 @@ function onTouchStart(event) {
2374
2586
  data.isTouched = false;
2375
2587
  }
2376
2588
  }
2377
- if (document2.activeElement && document2.activeElement.matches(data.focusableElements) && document2.activeElement !== targetEl) {
2589
+ if (document2.activeElement && document2.activeElement.matches(data.focusableElements) && document2.activeElement !== targetEl && (e.pointerType === "mouse" || e.pointerType !== "mouse" && !targetEl.matches(data.focusableElements))) {
2378
2590
  document2.activeElement.blur();
2379
2591
  }
2380
2592
  const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
@@ -2389,6 +2601,7 @@ function onTouchStart(event) {
2389
2601
  function onTouchMove(event) {
2390
2602
  const document2 = getDocument();
2391
2603
  const swiper = this;
2604
+ if (swiper.destroyed) return;
2392
2605
  const data = swiper.touchEventsData;
2393
2606
  const {
2394
2607
  params,
@@ -2400,15 +2613,24 @@ function onTouchMove(event) {
2400
2613
  if (!params.simulateTouch && event.pointerType === "mouse") return;
2401
2614
  let e = event;
2402
2615
  if (e.originalEvent) e = e.originalEvent;
2616
+ if (e.type === "pointermove") {
2617
+ if (data.touchId !== null) return;
2618
+ const id = e.pointerId;
2619
+ if (id !== data.pointerId) return;
2620
+ }
2621
+ let targetTouch;
2622
+ if (e.type === "touchmove") {
2623
+ targetTouch = [...e.changedTouches].find((t) => t.identifier === data.touchId);
2624
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2625
+ } else {
2626
+ targetTouch = e;
2627
+ }
2403
2628
  if (!data.isTouched) {
2404
2629
  if (data.startMoving && data.isScrolling) {
2405
2630
  swiper.emit("touchMoveOpposite", e);
2406
2631
  }
2407
2632
  return;
2408
2633
  }
2409
- const pointerIndex = data.evCache.findIndex((cachedEv) => cachedEv.pointerId === e.pointerId);
2410
- if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
2411
- const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
2412
2634
  const pageX = targetTouch.pageX;
2413
2635
  const pageY = targetTouch.pageY;
2414
2636
  if (e.preventedByNestedSwiper) {
@@ -2424,8 +2646,6 @@ function onTouchMove(event) {
2424
2646
  Object.assign(touches, {
2425
2647
  startX: pageX,
2426
2648
  startY: pageY,
2427
- prevX: swiper.touches.currentX,
2428
- prevY: swiper.touches.currentY,
2429
2649
  currentX: pageX,
2430
2650
  currentY: pageY
2431
2651
  });
@@ -2440,10 +2660,15 @@ function onTouchMove(event) {
2440
2660
  data.isMoved = false;
2441
2661
  return;
2442
2662
  }
2443
- } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
2663
+ } else if (rtl && (pageX > touches.startX && -swiper.translate <= swiper.maxTranslate() || pageX < touches.startX && -swiper.translate >= swiper.minTranslate())) {
2664
+ return;
2665
+ } else if (!rtl && (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate())) {
2444
2666
  return;
2445
2667
  }
2446
2668
  }
2669
+ if (document2.activeElement && document2.activeElement.matches(data.focusableElements) && document2.activeElement !== e.target && e.pointerType !== "mouse") {
2670
+ document2.activeElement.blur();
2671
+ }
2447
2672
  if (document2.activeElement) {
2448
2673
  if (e.target === document2.activeElement && e.target.matches(data.focusableElements)) {
2449
2674
  data.isMoved = true;
@@ -2454,7 +2679,8 @@ function onTouchMove(event) {
2454
2679
  if (data.allowTouchCallbacks) {
2455
2680
  swiper.emit("touchMove", e);
2456
2681
  }
2457
- if (e.targetTouches && e.targetTouches.length > 1) return;
2682
+ touches.previousX = touches.currentX;
2683
+ touches.previousY = touches.currentY;
2458
2684
  touches.currentX = pageX;
2459
2685
  touches.currentY = pageY;
2460
2686
  const diffX = touches.currentX - touches.startX;
@@ -2479,7 +2705,7 @@ function onTouchMove(event) {
2479
2705
  data.startMoving = true;
2480
2706
  }
2481
2707
  }
2482
- if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled && data.evCache.length > 1) {
2708
+ if (data.isScrolling || e.type === "touchmove" && data.preventTouchMoveFromPointerMove) {
2483
2709
  data.isTouched = false;
2484
2710
  return;
2485
2711
  }
@@ -2509,7 +2735,7 @@ function onTouchMove(event) {
2509
2735
  swiper.swipeDirection = diff > 0 ? "prev" : "next";
2510
2736
  swiper.touchesDirection = touchesDiff > 0 ? "prev" : "next";
2511
2737
  const isLoop = swiper.params.loop && !params.cssMode;
2512
- const allowLoopFix = swiper.swipeDirection === "next" && swiper.allowSlideNext || swiper.swipeDirection === "prev" && swiper.allowSlidePrev;
2738
+ const allowLoopFix = swiper.touchesDirection === "next" && swiper.allowSlideNext || swiper.touchesDirection === "prev" && swiper.allowSlidePrev;
2513
2739
  if (!data.isMoved) {
2514
2740
  if (isLoop && allowLoopFix) {
2515
2741
  swiper.loopFix({
@@ -2521,7 +2747,10 @@ function onTouchMove(event) {
2521
2747
  if (swiper.animating) {
2522
2748
  const evt = new window.CustomEvent("transitionend", {
2523
2749
  bubbles: true,
2524
- cancelable: true
2750
+ cancelable: true,
2751
+ detail: {
2752
+ bySwiperTouchMove: true
2753
+ }
2525
2754
  });
2526
2755
  swiper.wrapperEl.dispatchEvent(evt);
2527
2756
  }
@@ -2532,12 +2761,18 @@ function onTouchMove(event) {
2532
2761
  swiper.emit("sliderFirstMove", e);
2533
2762
  }
2534
2763
  let loopFixed;
2535
- if (data.isMoved && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
2536
- swiper.loopFix({
2537
- direction: swiper.swipeDirection,
2538
- setTranslate: true
2764
+ (/* @__PURE__ */ new Date()).getTime();
2765
+ if (params._loopSwapReset !== false && data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
2766
+ Object.assign(touches, {
2767
+ startX: pageX,
2768
+ startY: pageY,
2769
+ currentX: pageX,
2770
+ currentY: pageY,
2771
+ startTranslate: data.currentTranslate
2539
2772
  });
2540
- loopFixed = true;
2773
+ data.loopSwapReset = true;
2774
+ data.startTranslate = data.currentTranslate;
2775
+ return;
2541
2776
  }
2542
2777
  swiper.emit("sliderMove", e);
2543
2778
  data.isMoved = true;
@@ -2548,7 +2783,7 @@ function onTouchMove(event) {
2548
2783
  resistanceRatio = 0;
2549
2784
  }
2550
2785
  if (diff > 0) {
2551
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.size / 2 : swiper.minTranslate())) {
2786
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] - (params.slidesPerView !== "auto" && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween : 0) - swiper.params.spaceBetween : swiper.minTranslate())) {
2552
2787
  swiper.loopFix({
2553
2788
  direction: "prev",
2554
2789
  setTranslate: true,
@@ -2562,7 +2797,7 @@ function onTouchMove(event) {
2562
2797
  }
2563
2798
  }
2564
2799
  } else if (diff < 0) {
2565
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.size / 2 : swiper.maxTranslate())) {
2800
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween + (params.slidesPerView !== "auto" && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween : 0) : swiper.maxTranslate())) {
2566
2801
  swiper.loopFix({
2567
2802
  direction: "next",
2568
2803
  setTranslate: true,
@@ -2616,17 +2851,28 @@ function onTouchMove(event) {
2616
2851
  }
2617
2852
  function onTouchEnd(event) {
2618
2853
  const swiper = this;
2854
+ if (swiper.destroyed) return;
2619
2855
  const data = swiper.touchEventsData;
2620
- const pointerIndex = data.evCache.findIndex((cachedEv) => cachedEv.pointerId === event.pointerId);
2621
- if (pointerIndex >= 0) {
2622
- data.evCache.splice(pointerIndex, 1);
2856
+ let e = event;
2857
+ if (e.originalEvent) e = e.originalEvent;
2858
+ let targetTouch;
2859
+ const isTouchEvent = e.type === "touchend" || e.type === "touchcancel";
2860
+ if (!isTouchEvent) {
2861
+ if (data.touchId !== null) return;
2862
+ if (e.pointerId !== data.pointerId) return;
2863
+ targetTouch = e;
2864
+ } else {
2865
+ targetTouch = [...e.changedTouches].find((t) => t.identifier === data.touchId);
2866
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2623
2867
  }
2624
- if (["pointercancel", "pointerout", "pointerleave", "contextmenu"].includes(event.type)) {
2625
- const proceed = ["pointercancel", "contextmenu"].includes(event.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
2868
+ if (["pointercancel", "pointerout", "pointerleave", "contextmenu"].includes(e.type)) {
2869
+ const proceed = ["pointercancel", "contextmenu"].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
2626
2870
  if (!proceed) {
2627
2871
  return;
2628
2872
  }
2629
2873
  }
2874
+ data.pointerId = null;
2875
+ data.touchId = null;
2630
2876
  const {
2631
2877
  params,
2632
2878
  touches,
@@ -2635,9 +2881,7 @@ function onTouchEnd(event) {
2635
2881
  enabled
2636
2882
  } = swiper;
2637
2883
  if (!enabled) return;
2638
- if (!params.simulateTouch && event.pointerType === "mouse") return;
2639
- let e = event;
2640
- if (e.originalEvent) e = e.originalEvent;
2884
+ if (!params.simulateTouch && e.pointerType === "mouse") return;
2641
2885
  if (data.allowTouchCallbacks) {
2642
2886
  swiper.emit("touchEnd", e);
2643
2887
  }
@@ -2667,7 +2911,7 @@ function onTouchEnd(event) {
2667
2911
  nextTick(() => {
2668
2912
  if (!swiper.destroyed) swiper.allowClick = true;
2669
2913
  });
2670
- if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
2914
+ if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
2671
2915
  data.isTouched = false;
2672
2916
  data.isMoved = false;
2673
2917
  data.startMoving = false;
@@ -2691,16 +2935,17 @@ function onTouchEnd(event) {
2691
2935
  });
2692
2936
  return;
2693
2937
  }
2938
+ const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;
2694
2939
  let stopIndex = 0;
2695
2940
  let groupSize = swiper.slidesSizesGrid[0];
2696
2941
  for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
2697
2942
  const increment2 = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
2698
2943
  if (typeof slidesGrid[i + increment2] !== "undefined") {
2699
- if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment2]) {
2944
+ if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment2]) {
2700
2945
  stopIndex = i;
2701
2946
  groupSize = slidesGrid[i + increment2] - slidesGrid[i];
2702
2947
  }
2703
- } else if (currentPos >= slidesGrid[i]) {
2948
+ } else if (swipeToLast || currentPos >= slidesGrid[i]) {
2704
2949
  stopIndex = i;
2705
2950
  groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
2706
2951
  }
@@ -2777,7 +3022,8 @@ function onResize() {
2777
3022
  swiper.updateSlidesClasses();
2778
3023
  const isVirtualLoop = isVirtual && params.loop;
2779
3024
  if ((params.slidesPerView === "auto" || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {
2780
- swiper.slideTo(swiper.slides.length - 1, 0, false, true);
3025
+ const slides = isVirtual ? swiper.virtual.slides : swiper.slides;
3026
+ swiper.slideTo(slides.length - 1, 0, false, true);
2781
3027
  } else {
2782
3028
  if (swiper.params.loop && !isVirtual) {
2783
3029
  swiper.slideToLoop(swiper.realIndex, 0, false, true);
@@ -2801,6 +3047,7 @@ function onResize() {
2801
3047
  }
2802
3048
  function onClick(e) {
2803
3049
  const swiper = this;
3050
+ if (swiper.destroyed) return;
2804
3051
  if (!swiper.enabled) return;
2805
3052
  if (!swiper.allowClick) {
2806
3053
  if (swiper.params.preventClicks) e.preventDefault();
@@ -2812,6 +3059,7 @@ function onClick(e) {
2812
3059
  }
2813
3060
  function onScroll() {
2814
3061
  const swiper = this;
3062
+ if (swiper.destroyed) return;
2815
3063
  const {
2816
3064
  wrapperEl,
2817
3065
  rtlTranslate,
@@ -2841,14 +3089,21 @@ function onScroll() {
2841
3089
  }
2842
3090
  function onLoad(e) {
2843
3091
  const swiper = this;
3092
+ if (swiper.destroyed) return;
2844
3093
  processLazyPreloader(swiper, e.target);
2845
3094
  if (swiper.params.cssMode || swiper.params.slidesPerView !== "auto" && !swiper.params.autoHeight) {
2846
3095
  return;
2847
3096
  }
2848
3097
  swiper.update();
2849
3098
  }
2850
- var dummyEventAttached = false;
2851
- function dummyEventListener() {
3099
+ function onDocumentTouchStart() {
3100
+ const swiper = this;
3101
+ if (swiper.destroyed) return;
3102
+ if (swiper.documentTouchHandlerProceeded) return;
3103
+ swiper.documentTouchHandlerProceeded = true;
3104
+ if (swiper.params.touchReleaseOnEdges) {
3105
+ swiper.el.style.touchAction = "auto";
3106
+ }
2852
3107
  }
2853
3108
  var events = (swiper, method) => {
2854
3109
  const document2 = getDocument();
@@ -2861,19 +3116,37 @@ var events = (swiper, method) => {
2861
3116
  const capture = !!params.nested;
2862
3117
  const domMethod = method === "on" ? "addEventListener" : "removeEventListener";
2863
3118
  const swiperMethod = method;
3119
+ if (!el || typeof el === "string") return;
3120
+ document2[domMethod]("touchstart", swiper.onDocumentTouchStart, {
3121
+ passive: false,
3122
+ capture
3123
+ });
3124
+ el[domMethod]("touchstart", swiper.onTouchStart, {
3125
+ passive: false
3126
+ });
2864
3127
  el[domMethod]("pointerdown", swiper.onTouchStart, {
2865
3128
  passive: false
2866
3129
  });
3130
+ document2[domMethod]("touchmove", swiper.onTouchMove, {
3131
+ passive: false,
3132
+ capture
3133
+ });
2867
3134
  document2[domMethod]("pointermove", swiper.onTouchMove, {
2868
3135
  passive: false,
2869
3136
  capture
2870
3137
  });
3138
+ document2[domMethod]("touchend", swiper.onTouchEnd, {
3139
+ passive: true
3140
+ });
2871
3141
  document2[domMethod]("pointerup", swiper.onTouchEnd, {
2872
3142
  passive: true
2873
3143
  });
2874
3144
  document2[domMethod]("pointercancel", swiper.onTouchEnd, {
2875
3145
  passive: true
2876
3146
  });
3147
+ document2[domMethod]("touchcancel", swiper.onTouchEnd, {
3148
+ passive: true
3149
+ });
2877
3150
  document2[domMethod]("pointerout", swiper.onTouchEnd, {
2878
3151
  passive: true
2879
3152
  });
@@ -2900,22 +3173,18 @@ var events = (swiper, method) => {
2900
3173
  };
2901
3174
  function attachEvents() {
2902
3175
  const swiper = this;
2903
- const document2 = getDocument();
2904
3176
  const {
2905
3177
  params
2906
3178
  } = swiper;
2907
3179
  swiper.onTouchStart = onTouchStart.bind(swiper);
2908
3180
  swiper.onTouchMove = onTouchMove.bind(swiper);
2909
3181
  swiper.onTouchEnd = onTouchEnd.bind(swiper);
3182
+ swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
2910
3183
  if (params.cssMode) {
2911
3184
  swiper.onScroll = onScroll.bind(swiper);
2912
3185
  }
2913
3186
  swiper.onClick = onClick.bind(swiper);
2914
3187
  swiper.onLoad = onLoad.bind(swiper);
2915
- if (!dummyEventAttached) {
2916
- document2.addEventListener("touchstart", dummyEventListener);
2917
- dummyEventAttached = true;
2918
- }
2919
3188
  events(swiper, "on");
2920
3189
  }
2921
3190
  function detachEvents() {
@@ -2939,12 +3208,17 @@ function setBreakpoint() {
2939
3208
  } = swiper;
2940
3209
  const breakpoints2 = params.breakpoints;
2941
3210
  if (!breakpoints2 || breakpoints2 && Object.keys(breakpoints2).length === 0) return;
2942
- const breakpoint = swiper.getBreakpoint(breakpoints2, swiper.params.breakpointsBase, swiper.el);
3211
+ const document2 = getDocument();
3212
+ const breakpointsBase = params.breakpointsBase === "window" || !params.breakpointsBase ? params.breakpointsBase : "container";
3213
+ const breakpointContainer = ["window", "container"].includes(params.breakpointsBase) || !params.breakpointsBase ? swiper.el : document2.querySelector(params.breakpointsBase);
3214
+ const breakpoint = swiper.getBreakpoint(breakpoints2, breakpointsBase, breakpointContainer);
2943
3215
  if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
2944
3216
  const breakpointOnlyParams = breakpoint in breakpoints2 ? breakpoints2[breakpoint] : void 0;
2945
3217
  const breakpointParams = breakpointOnlyParams || swiper.originalParams;
2946
3218
  const wasMultiRow = isGridEnabled(swiper, params);
2947
3219
  const isMultiRow = isGridEnabled(swiper, breakpointParams);
3220
+ const wasGrabCursor = swiper.params.grabCursor;
3221
+ const isGrabCursor = breakpointParams.grabCursor;
2948
3222
  const wasEnabled = params.enabled;
2949
3223
  if (wasMultiRow && !isMultiRow) {
2950
3224
  el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
@@ -2956,6 +3230,11 @@ function setBreakpoint() {
2956
3230
  }
2957
3231
  swiper.emitContainerClasses();
2958
3232
  }
3233
+ if (wasGrabCursor && !isGrabCursor) {
3234
+ swiper.unsetGrabCursor();
3235
+ } else if (!wasGrabCursor && isGrabCursor) {
3236
+ swiper.setGrabCursor();
3237
+ }
2959
3238
  ["navigation", "pagination", "scrollbar"].forEach((prop) => {
2960
3239
  if (typeof breakpointParams[prop] === "undefined") return;
2961
3240
  const wasModuleEnabled = params[prop] && params[prop].enabled;
@@ -3002,10 +3281,7 @@ function setBreakpoint() {
3002
3281
  }
3003
3282
  swiper.emit("breakpoint", breakpointParams);
3004
3283
  }
3005
- function getBreakpoint(breakpoints2, base, containerEl) {
3006
- if (base === void 0) {
3007
- base = "window";
3008
- }
3284
+ function getBreakpoint(breakpoints2, base = "window", containerEl) {
3009
3285
  if (!breakpoints2 || base === "container" && !containerEl) return void 0;
3010
3286
  let breakpoint = false;
3011
3287
  const window2 = getWindow();
@@ -3099,6 +3375,7 @@ function removeClasses() {
3099
3375
  el,
3100
3376
  classNames
3101
3377
  } = swiper;
3378
+ if (!el || typeof el === "string") return;
3102
3379
  el.classList.remove(...classNames);
3103
3380
  swiper.emitContainerClasses();
3104
3381
  }
@@ -3142,6 +3419,7 @@ var defaults = {
3142
3419
  init: true,
3143
3420
  direction: "horizontal",
3144
3421
  oneWayMovement: false,
3422
+ swiperElementNodeName: "SWIPER-CONTAINER",
3145
3423
  touchEventsTarget: "wrapper",
3146
3424
  initialSlide: 0,
3147
3425
  speed: 300,
@@ -3150,6 +3428,7 @@ var defaults = {
3150
3428
  resizeObserver: true,
3151
3429
  nested: false,
3152
3430
  createElements: false,
3431
+ eventsPrefix: "swiper",
3153
3432
  enabled: true,
3154
3433
  focusableElements: "input, select, option, textarea, button, video, label",
3155
3434
  // Overrides
@@ -3189,6 +3468,7 @@ var defaults = {
3189
3468
  // in px
3190
3469
  normalizeSlideIndex: true,
3191
3470
  centerInsufficientSlides: false,
3471
+ snapToSlideEdge: false,
3192
3472
  // Disable swiper and hide navigation when container not overflow
3193
3473
  watchOverflow: true,
3194
3474
  // Round length
@@ -3223,7 +3503,8 @@ var defaults = {
3223
3503
  slideToClickedSlide: false,
3224
3504
  // loop
3225
3505
  loop: false,
3226
- loopedSlides: null,
3506
+ loopAddBlankSlides: true,
3507
+ loopAdditionalSlides: 0,
3227
3508
  loopPreventsSliding: true,
3228
3509
  // rewind
3229
3510
  rewind: false,
@@ -3242,8 +3523,10 @@ var defaults = {
3242
3523
  containerModifierClass: "swiper-",
3243
3524
  // NEW
3244
3525
  slideClass: "swiper-slide",
3526
+ slideBlankClass: "swiper-slide-blank",
3245
3527
  slideActiveClass: "swiper-slide-active",
3246
3528
  slideVisibleClass: "swiper-slide-visible",
3529
+ slideFullyVisibleClass: "swiper-slide-fully-visible",
3247
3530
  slideNextClass: "swiper-slide-next",
3248
3531
  slidePrevClass: "swiper-slide-prev",
3249
3532
  wrapperClass: "swiper-wrapper",
@@ -3255,10 +3538,7 @@ var defaults = {
3255
3538
  _emitClasses: false
3256
3539
  };
3257
3540
  function moduleExtendParams(params, allModulesParams) {
3258
- return function extendParams(obj) {
3259
- if (obj === void 0) {
3260
- obj = {};
3261
- }
3541
+ return function extendParams(obj = {}) {
3262
3542
  const moduleParamName = Object.keys(obj)[0];
3263
3543
  const moduleParams = obj[moduleParamName];
3264
3544
  if (typeof moduleParams !== "object" || moduleParams === null) {
@@ -3304,12 +3584,9 @@ var prototypes = {
3304
3584
  };
3305
3585
  var extendedDefaults = {};
3306
3586
  var Swiper = class _Swiper {
3307
- constructor() {
3587
+ constructor(...args) {
3308
3588
  let el;
3309
3589
  let params;
3310
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3311
- args[_key] = arguments[_key];
3312
- }
3313
3590
  if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === "Object") {
3314
3591
  params = args[0];
3315
3592
  } else {
@@ -3340,7 +3617,11 @@ var Swiper = class _Swiper {
3340
3617
  swiper.eventsAnyListeners = [];
3341
3618
  swiper.modules = [...swiper.__modules__];
3342
3619
  if (params.modules && Array.isArray(params.modules)) {
3343
- swiper.modules.push(...params.modules);
3620
+ params.modules.forEach((mod) => {
3621
+ if (typeof mod === "function" && swiper.modules.indexOf(mod) < 0) {
3622
+ swiper.modules.push(mod);
3623
+ }
3624
+ });
3344
3625
  }
3345
3626
  const allModulesParams = {};
3346
3627
  swiper.modules.forEach((mod) => {
@@ -3420,7 +3701,8 @@ var Swiper = class _Swiper {
3420
3701
  velocities: [],
3421
3702
  allowMomentumBounce: void 0,
3422
3703
  startMoving: void 0,
3423
- evCache: []
3704
+ pointerId: null,
3705
+ touchId: null
3424
3706
  },
3425
3707
  // Clicks
3426
3708
  allowClick: true,
@@ -3443,6 +3725,21 @@ var Swiper = class _Swiper {
3443
3725
  }
3444
3726
  return swiper;
3445
3727
  }
3728
+ getDirectionLabel(property) {
3729
+ if (this.isHorizontal()) {
3730
+ return property;
3731
+ }
3732
+ return {
3733
+ "width": "height",
3734
+ "margin-top": "margin-left",
3735
+ "margin-bottom ": "margin-right",
3736
+ "margin-left": "margin-top",
3737
+ "margin-right": "margin-bottom",
3738
+ "padding-left": "padding-top",
3739
+ "padding-right": "padding-bottom",
3740
+ "marginRight": "marginBottom"
3741
+ }[property];
3742
+ }
3446
3743
  getSlideIndex(slideEl) {
3447
3744
  const {
3448
3745
  slidesEl,
@@ -3453,7 +3750,17 @@ var Swiper = class _Swiper {
3453
3750
  return elementIndex(slideEl) - firstSlideIndex;
3454
3751
  }
3455
3752
  getSlideIndexByData(index) {
3456
- return this.getSlideIndex(this.slides.filter((slideEl) => slideEl.getAttribute("data-swiper-slide-index") * 1 === index)[0]);
3753
+ return this.getSlideIndex(this.slides.find((slideEl) => slideEl.getAttribute("data-swiper-slide-index") * 1 === index));
3754
+ }
3755
+ getSlideIndexWhenGrid(index) {
3756
+ if (this.grid && this.params.grid && this.params.grid.rows > 1) {
3757
+ if (this.params.grid.fill === "column") {
3758
+ index = Math.floor(index / this.params.grid.rows);
3759
+ } else if (this.params.grid.fill === "row") {
3760
+ index = index % Math.ceil(this.slides.length / this.params.grid.rows);
3761
+ }
3762
+ }
3763
+ return index;
3457
3764
  }
3458
3765
  recalcSlides() {
3459
3766
  const swiper = this;
@@ -3520,13 +3827,7 @@ var Swiper = class _Swiper {
3520
3827
  });
3521
3828
  swiper.emit("_slideClasses", updates);
3522
3829
  }
3523
- slidesPerViewDynamic(view, exact) {
3524
- if (view === void 0) {
3525
- view = "current";
3526
- }
3527
- if (exact === void 0) {
3528
- exact = false;
3529
- }
3830
+ slidesPerViewDynamic(view = "current", exact = false) {
3530
3831
  const swiper = this;
3531
3832
  const {
3532
3833
  params,
@@ -3539,11 +3840,11 @@ var Swiper = class _Swiper {
3539
3840
  let spv = 1;
3540
3841
  if (typeof params.slidesPerView === "number") return params.slidesPerView;
3541
3842
  if (params.centeredSlides) {
3542
- let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;
3843
+ let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;
3543
3844
  let breakLoop;
3544
3845
  for (let i = activeIndex + 1; i < slides.length; i += 1) {
3545
3846
  if (slides[i] && !breakLoop) {
3546
- slideSize += slides[i].swiperSlideSize;
3847
+ slideSize += Math.ceil(slides[i].swiperSlideSize);
3547
3848
  spv += 1;
3548
3849
  if (slideSize > swiperSize) breakLoop = true;
3549
3850
  }
@@ -3622,10 +3923,7 @@ var Swiper = class _Swiper {
3622
3923
  }
3623
3924
  swiper.emit("update");
3624
3925
  }
3625
- changeDirection(newDirection, needUpdate) {
3626
- if (needUpdate === void 0) {
3627
- needUpdate = true;
3628
- }
3926
+ changeDirection(newDirection, needUpdate = true) {
3629
3927
  const swiper = this;
3630
3928
  const currentDirection = swiper.params.direction;
3631
3929
  if (!newDirection) {
@@ -3674,7 +3972,7 @@ var Swiper = class _Swiper {
3674
3972
  return false;
3675
3973
  }
3676
3974
  el.swiper = swiper;
3677
- if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === "SWIPER-CONTAINER") {
3975
+ if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
3678
3976
  swiper.isElement = true;
3679
3977
  }
3680
3978
  const getWrapperSelector = () => {
@@ -3732,7 +4030,7 @@ var Swiper = class _Swiper {
3732
4030
  swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
3733
4031
  }
3734
4032
  if (swiper.params.loop) {
3735
- swiper.loopCreate();
4033
+ swiper.loopCreate(void 0, true);
3736
4034
  }
3737
4035
  swiper.attachEvents();
3738
4036
  const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')];
@@ -3755,13 +4053,7 @@ var Swiper = class _Swiper {
3755
4053
  swiper.emit("afterInit");
3756
4054
  return swiper;
3757
4055
  }
3758
- destroy(deleteInstance, cleanStyles) {
3759
- if (deleteInstance === void 0) {
3760
- deleteInstance = true;
3761
- }
3762
- if (cleanStyles === void 0) {
3763
- cleanStyles = true;
3764
- }
4056
+ destroy(deleteInstance = true, cleanStyles = true) {
3765
4057
  const swiper = this;
3766
4058
  const {
3767
4059
  params,
@@ -3780,11 +4072,15 @@ var Swiper = class _Swiper {
3780
4072
  }
3781
4073
  if (cleanStyles) {
3782
4074
  swiper.removeClasses();
3783
- el.removeAttribute("style");
3784
- wrapperEl.removeAttribute("style");
4075
+ if (el && typeof el !== "string") {
4076
+ el.removeAttribute("style");
4077
+ }
4078
+ if (wrapperEl) {
4079
+ wrapperEl.removeAttribute("style");
4080
+ }
3785
4081
  if (slides && slides.length) {
3786
4082
  slides.forEach((slideEl) => {
3787
- slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
4083
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
3788
4084
  slideEl.removeAttribute("style");
3789
4085
  slideEl.removeAttribute("data-swiper-slide-index");
3790
4086
  });
@@ -3795,7 +4091,9 @@ var Swiper = class _Swiper {
3795
4091
  swiper.off(eventName);
3796
4092
  });
3797
4093
  if (deleteInstance !== false) {
3798
- swiper.el.swiper = null;
4094
+ if (swiper.el && typeof swiper.el !== "string") {
4095
+ swiper.el.swiper = null;
4096
+ }
3799
4097
  deleteProps(swiper);
3800
4098
  }
3801
4099
  swiper.destroyed = true;
@@ -3842,6 +4140,7 @@ var paramsList = [
3842
4140
  "init",
3843
4141
  "_direction",
3844
4142
  "oneWayMovement",
4143
+ "swiperElementNodeName",
3845
4144
  "touchEventsTarget",
3846
4145
  "initialSlide",
3847
4146
  "_speed",
@@ -3878,6 +4177,7 @@ var paramsList = [
3878
4177
  "_slidesOffsetAfter",
3879
4178
  "normalizeSlideIndex",
3880
4179
  "_centerInsufficientSlides",
4180
+ "_snapToSlideEdge",
3881
4181
  "_watchOverflow",
3882
4182
  "roundLengths",
3883
4183
  "touchRatio",
@@ -3903,7 +4203,8 @@ var paramsList = [
3903
4203
  "preventClicksPropagation",
3904
4204
  "_slideToClickedSlide",
3905
4205
  "_loop",
3906
- "loopedSlides",
4206
+ "loopAdditionalSlides",
4207
+ "loopAddBlankSlides",
3907
4208
  "loopPreventsSliding",
3908
4209
  "_rewind",
3909
4210
  "_allowSlidePrev",
@@ -3917,8 +4218,10 @@ var paramsList = [
3917
4218
  "slideClass",
3918
4219
  "slideActiveClass",
3919
4220
  "slideVisibleClass",
4221
+ "slideFullyVisibleClass",
3920
4222
  "slideNextClass",
3921
4223
  "slidePrevClass",
4224
+ "slideBlankClass",
3922
4225
  "wrapperClass",
3923
4226
  "lazyPreloaderClass",
3924
4227
  "lazyPreloadPrevNext",
@@ -3964,28 +4267,16 @@ function extend3(target, src) {
3964
4267
  }
3965
4268
  });
3966
4269
  }
3967
- function needsNavigation(params) {
3968
- if (params === void 0) {
3969
- params = {};
3970
- }
4270
+ function needsNavigation(params = {}) {
3971
4271
  return params.navigation && typeof params.navigation.nextEl === "undefined" && typeof params.navigation.prevEl === "undefined";
3972
4272
  }
3973
- function needsPagination(params) {
3974
- if (params === void 0) {
3975
- params = {};
3976
- }
4273
+ function needsPagination(params = {}) {
3977
4274
  return params.pagination && typeof params.pagination.el === "undefined";
3978
4275
  }
3979
- function needsScrollbar(params) {
3980
- if (params === void 0) {
3981
- params = {};
3982
- }
4276
+ function needsScrollbar(params = {}) {
3983
4277
  return params.scrollbar && typeof params.scrollbar.el === "undefined";
3984
4278
  }
3985
- function uniqueClasses(classNames) {
3986
- if (classNames === void 0) {
3987
- classNames = "";
3988
- }
4279
+ function uniqueClasses(classNames = "") {
3989
4280
  const classes2 = classNames.split(" ").map((c) => c.trim()).filter((c) => !!c);
3990
4281
  const unique = [];
3991
4282
  classes2.forEach((c) => {
@@ -3993,25 +4284,21 @@ function uniqueClasses(classNames) {
3993
4284
  });
3994
4285
  return unique.join(" ");
3995
4286
  }
3996
- function wrapperClass(className) {
3997
- if (className === void 0) {
3998
- className = "";
3999
- }
4287
+ function wrapperClass(className = "") {
4000
4288
  if (!className) return "swiper-wrapper";
4001
4289
  if (!className.includes("swiper-wrapper")) return `swiper-wrapper ${className}`;
4002
4290
  return className;
4003
4291
  }
4004
- function updateSwiper(_ref) {
4005
- let {
4006
- swiper,
4007
- slides,
4008
- passedParams,
4009
- changedParams,
4010
- nextEl,
4011
- prevEl,
4012
- scrollbarEl,
4013
- paginationEl
4014
- } = _ref;
4292
+ function updateSwiper({
4293
+ swiper,
4294
+ slides,
4295
+ passedParams,
4296
+ changedParams,
4297
+ nextEl,
4298
+ prevEl,
4299
+ scrollbarEl,
4300
+ paginationEl
4301
+ }) {
4015
4302
  const updateParams = changedParams.filter((key) => key !== "children" && key !== "direction" && key !== "wrapperClass");
4016
4303
  const {
4017
4304
  params: currentParams,
@@ -4029,7 +4316,7 @@ function updateSwiper(_ref) {
4029
4316
  let loopNeedDestroy;
4030
4317
  let loopNeedEnable;
4031
4318
  let loopNeedReloop;
4032
- if (changedParams.includes("thumbs") && passedParams.thumbs && passedParams.thumbs.swiper && currentParams.thumbs && !currentParams.thumbs.swiper) {
4319
+ if (changedParams.includes("thumbs") && passedParams.thumbs && passedParams.thumbs.swiper && !passedParams.thumbs.swiper.destroyed && currentParams.thumbs && (!currentParams.thumbs.swiper || currentParams.thumbs.swiper.destroyed)) {
4033
4320
  needThumbsInit = true;
4034
4321
  }
4035
4322
  if (changedParams.includes("controller") && passedParams.controller && passedParams.controller.control && currentParams.controller && !currentParams.controller.control) {
@@ -4075,7 +4362,7 @@ function updateSwiper(_ref) {
4075
4362
  }
4076
4363
  updateParams.forEach((key) => {
4077
4364
  if (isObject3(currentParams[key]) && isObject3(passedParams[key])) {
4078
- extend3(currentParams[key], passedParams[key]);
4365
+ Object.assign(currentParams[key], passedParams[key]);
4079
4366
  if ((key === "navigation" || key === "pagination" || key === "scrollbar") && "enabled" in passedParams[key] && !passedParams[key].enabled) {
4080
4367
  destroyModule(key);
4081
4368
  }
@@ -4096,6 +4383,9 @@ function updateSwiper(_ref) {
4096
4383
  if (changedParams.includes("children") && slides && virtual && currentParams.virtual.enabled) {
4097
4384
  virtual.slides = slides;
4098
4385
  virtual.update(true);
4386
+ } else if (changedParams.includes("virtual") && virtual && currentParams.virtual.enabled) {
4387
+ if (slides) virtual.slides = slides;
4388
+ virtual.update(true);
4099
4389
  }
4100
4390
  if (changedParams.includes("children") && slides && currentParams.loop) {
4101
4391
  loopNeedReloop = true;
@@ -4136,14 +4426,14 @@ function updateSwiper(_ref) {
4136
4426
  if (!nextEl || typeof nextEl === "string") {
4137
4427
  nextEl = document.createElement("div");
4138
4428
  nextEl.classList.add("swiper-button-next");
4139
- nextEl.innerHTML = swiper.hostEl.constructor.nextButtonSvg;
4429
+ setInnerHTML(nextEl, swiper.navigation.arrowSvg);
4140
4430
  nextEl.part.add("button-next");
4141
4431
  swiper.el.appendChild(nextEl);
4142
4432
  }
4143
4433
  if (!prevEl || typeof prevEl === "string") {
4144
4434
  prevEl = document.createElement("div");
4145
4435
  prevEl.classList.add("swiper-button-prev");
4146
- prevEl.innerHTML = swiper.hostEl.constructor.prevButtonSvg;
4436
+ setInnerHTML(prevEl, swiper.navigation.arrowSvg);
4147
4437
  prevEl.part.add("button-prev");
4148
4438
  swiper.el.appendChild(prevEl);
4149
4439
  }
@@ -4172,13 +4462,7 @@ function updateSwiper(_ref) {
4172
4462
  }
4173
4463
 
4174
4464
  // node_modules/swiper/shared/update-on-virtual-data.mjs
4175
- function getParams(obj, splitEvents) {
4176
- if (obj === void 0) {
4177
- obj = {};
4178
- }
4179
- if (splitEvents === void 0) {
4180
- splitEvents = true;
4181
- }
4465
+ function getParams(obj = {}, splitEvents = true) {
4182
4466
  const params = {
4183
4467
  on: {}
4184
4468
  };
@@ -4223,15 +4507,14 @@ function getParams(obj, splitEvents) {
4223
4507
  events: events2
4224
4508
  };
4225
4509
  }
4226
- function mountSwiper(_ref, swiperParams) {
4227
- let {
4228
- el,
4229
- nextEl,
4230
- prevEl,
4231
- paginationEl,
4232
- scrollbarEl,
4233
- swiper
4234
- } = _ref;
4510
+ function mountSwiper({
4511
+ el,
4512
+ nextEl,
4513
+ prevEl,
4514
+ paginationEl,
4515
+ scrollbarEl,
4516
+ swiper
4517
+ }, swiperParams) {
4235
4518
  if (needsNavigation(swiperParams) && nextEl && prevEl) {
4236
4519
  swiper.params.navigation.nextEl = nextEl;
4237
4520
  swiper.originalParams.navigation.nextEl = nextEl;
@@ -4290,6 +4573,7 @@ var updateOnVirtualData = (swiper) => {
4290
4573
  swiper.updateSlides();
4291
4574
  swiper.updateProgress();
4292
4575
  swiper.updateSlidesClasses();
4576
+ swiper.emit("_virtualUpdated");
4293
4577
  if (swiper.parallax && swiper.params.parallax && swiper.params.parallax.enabled) {
4294
4578
  swiper.parallax.setTranslate();
4295
4579
  }
@@ -4385,7 +4669,7 @@ function renderVirtual(swiper, slides, virtualData) {
4385
4669
  return /* @__PURE__ */ import_react.default.cloneElement(child, {
4386
4670
  swiper,
4387
4671
  style,
4388
- key: `slide-${index}`
4672
+ key: child.props.virtualIndex || child.key || `slide-${index}`
4389
4673
  });
4390
4674
  });
4391
4675
  }
@@ -4401,15 +4685,14 @@ var SwiperContext = /* @__PURE__ */ (0, import_react.createContext)(null);
4401
4685
  var useSwiper = () => {
4402
4686
  return (0, import_react.useContext)(SwiperContext);
4403
4687
  };
4404
- var Swiper2 = /* @__PURE__ */ (0, import_react.forwardRef)(function(_temp, externalElRef) {
4405
- let {
4406
- className,
4407
- tag: Tag = "div",
4408
- wrapperTag: WrapperTag = "div",
4409
- children,
4410
- onSwiper,
4411
- ...rest
4412
- } = _temp === void 0 ? {} : _temp;
4688
+ var Swiper2 = /* @__PURE__ */ (0, import_react.forwardRef)(({
4689
+ className,
4690
+ tag: Tag = "div",
4691
+ wrapperTag: WrapperTag = "div",
4692
+ children,
4693
+ onSwiper,
4694
+ ...rest
4695
+ } = {}, externalElRef) => {
4413
4696
  let eventsAssigned = false;
4414
4697
  const [containerClasses, setContainerClasses] = (0, import_react.useState)("swiper");
4415
4698
  const [virtualData, setVirtualData] = (0, import_react.useState)(null);
@@ -4506,7 +4789,7 @@ var Swiper2 = /* @__PURE__ */ (0, import_react.forwardRef)(function(_temp, exter
4506
4789
  scrollbarEl: scrollbarElRef.current,
4507
4790
  swiper: swiperRef.current
4508
4791
  }, swiperParams);
4509
- if (onSwiper) onSwiper(swiperRef.current);
4792
+ if (onSwiper && !swiperRef.current.destroyed) onSwiper(swiperRef.current);
4510
4793
  return () => {
4511
4794
  if (swiperRef.current && !swiperRef.current.destroyed) {
4512
4795
  swiperRef.current.destroy(true, false);
@@ -4570,18 +4853,17 @@ var Swiper2 = /* @__PURE__ */ (0, import_react.forwardRef)(function(_temp, exter
4570
4853
  }), slots["container-end"]));
4571
4854
  });
4572
4855
  Swiper2.displayName = "Swiper";
4573
- var SwiperSlide = /* @__PURE__ */ (0, import_react.forwardRef)(function(_temp, externalRef) {
4574
- let {
4575
- tag: Tag = "div",
4576
- children,
4577
- className = "",
4578
- swiper,
4579
- zoom,
4580
- lazy,
4581
- virtualIndex,
4582
- swiperSlideIndex,
4583
- ...rest
4584
- } = _temp === void 0 ? {} : _temp;
4856
+ var SwiperSlide = /* @__PURE__ */ (0, import_react.forwardRef)(({
4857
+ tag: Tag = "div",
4858
+ children,
4859
+ className = "",
4860
+ swiper,
4861
+ zoom,
4862
+ lazy,
4863
+ virtualIndex,
4864
+ swiperSlideIndex,
4865
+ ...rest
4866
+ } = {}, externalRef) => {
4585
4867
  const slideElRef = (0, import_react.useRef)(null);
4586
4868
  const [slideClasses, setSlideClasses] = (0, import_react.useState)("swiper-slide");
4587
4869
  const [lazyLoaded, setLazyLoaded] = (0, import_react.useState)(false);
@@ -4620,6 +4902,7 @@ var SwiperSlide = /* @__PURE__ */ (0, import_react.forwardRef)(function(_temp, e
4620
4902
  const slideData = {
4621
4903
  isActive: slideClasses.indexOf("swiper-slide-active") >= 0,
4622
4904
  isVisible: slideClasses.indexOf("swiper-slide-visible") >= 0,
4905
+ isFullyVisible: slideClasses.indexOf("swiper-slide-fully-visible") >= 0,
4623
4906
  isPrev: slideClasses.indexOf("swiper-slide-prev") >= 0,
4624
4907
  isNext: slideClasses.indexOf("swiper-slide-next") >= 0
4625
4908
  };
@@ -4640,11 +4923,17 @@ var SwiperSlide = /* @__PURE__ */ (0, import_react.forwardRef)(function(_temp, e
4640
4923
  className: "swiper-zoom-container",
4641
4924
  "data-swiper-zoom": typeof zoom === "number" ? zoom : void 0
4642
4925
  }, renderChildren(), lazy && !lazyLoaded && /* @__PURE__ */ import_react.default.createElement("div", {
4643
- className: "swiper-lazy-preloader"
4926
+ className: "swiper-lazy-preloader",
4927
+ ref: (node) => {
4928
+ if (node) node.lazyPreloaderManaged = true;
4929
+ }
4644
4930
  }))), !zoom && /* @__PURE__ */ import_react.default.createElement(SwiperSlideContext.Provider, {
4645
4931
  value: slideData
4646
4932
  }, renderChildren(), lazy && !lazyLoaded && /* @__PURE__ */ import_react.default.createElement("div", {
4647
- className: "swiper-lazy-preloader"
4933
+ className: "swiper-lazy-preloader",
4934
+ ref: (node) => {
4935
+ if (node) node.lazyPreloaderManaged = true;
4936
+ }
4648
4937
  })));
4649
4938
  });
4650
4939
  SwiperSlide.displayName = "SwiperSlide";