@bigbinary/neeto-site-blocks 1.11.0-beta2 → 1.11.0-beta4

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.
package/dist/index.js CHANGED
@@ -17414,6 +17414,13 @@ function getWindow() {
17414
17414
  return win;
17415
17415
  }
17416
17416
 
17417
+ function classesToTokens(classes) {
17418
+ if (classes === void 0) {
17419
+ classes = '';
17420
+ }
17421
+ return classes.trim().split(' ').filter(c => !!c.trim());
17422
+ }
17423
+
17417
17424
  function deleteProps(obj) {
17418
17425
  const object = obj;
17419
17426
  Object.keys(object).forEach(key => {
@@ -17590,12 +17597,20 @@ function elementChildren(element, selector) {
17590
17597
  }
17591
17598
  return [...element.children].filter(el => el.matches(selector));
17592
17599
  }
17600
+ function showWarning(text) {
17601
+ try {
17602
+ console.warn(text);
17603
+ return;
17604
+ } catch (err) {
17605
+ // err
17606
+ }
17607
+ }
17593
17608
  function createElement(tag, classes) {
17594
17609
  if (classes === void 0) {
17595
17610
  classes = [];
17596
17611
  }
17597
17612
  const el = document.createElement(tag);
17598
- el.classList.add(...(Array.isArray(classes) ? classes : [classes]));
17613
+ el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
17599
17614
  return el;
17600
17615
  }
17601
17616
  function elementOffset(el) {
@@ -17744,6 +17759,7 @@ function getDevice(overrides) {
17744
17759
  let browser$1;
17745
17760
  function calcBrowser() {
17746
17761
  const window = getWindow();
17762
+ const device = getDevice();
17747
17763
  let needPerspectiveFix = false;
17748
17764
  function isSafari() {
17749
17765
  const ua = window.navigator.userAgent.toLowerCase();
@@ -17756,10 +17772,14 @@ function calcBrowser() {
17756
17772
  needPerspectiveFix = major < 16 || major === 16 && minor < 2;
17757
17773
  }
17758
17774
  }
17775
+ const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent);
17776
+ const isSafariBrowser = isSafari();
17777
+ const need3dFix = isSafariBrowser || isWebView && device.ios;
17759
17778
  return {
17760
- isSafari: needPerspectiveFix || isSafari(),
17779
+ isSafari: needPerspectiveFix || isSafariBrowser,
17761
17780
  needPerspectiveFix,
17762
- isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
17781
+ need3dFix,
17782
+ isWebView
17763
17783
  };
17764
17784
  }
17765
17785
  function getBrowser() {
@@ -18048,24 +18068,8 @@ function updateSize() {
18048
18068
 
18049
18069
  function updateSlides() {
18050
18070
  const swiper = this;
18051
- function getDirectionLabel(property) {
18052
- if (swiper.isHorizontal()) {
18053
- return property;
18054
- }
18055
- // prettier-ignore
18056
- return {
18057
- 'width': 'height',
18058
- 'margin-top': 'margin-left',
18059
- 'margin-bottom ': 'margin-right',
18060
- 'margin-left': 'margin-top',
18061
- 'margin-right': 'margin-bottom',
18062
- 'padding-left': 'padding-top',
18063
- 'padding-right': 'padding-bottom',
18064
- 'marginRight': 'marginBottom'
18065
- }[property];
18066
- }
18067
18071
  function getDirectionPropertyValue(node, label) {
18068
- return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
18072
+ return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
18069
18073
  }
18070
18074
  const params = swiper.params;
18071
18075
  const {
@@ -18124,7 +18128,9 @@ function updateSlides() {
18124
18128
  }
18125
18129
  const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
18126
18130
  if (gridEnabled) {
18127
- swiper.grid.initSlides(slidesLength);
18131
+ swiper.grid.initSlides(slides);
18132
+ } else if (swiper.grid) {
18133
+ swiper.grid.unsetSlides();
18128
18134
  }
18129
18135
 
18130
18136
  // Calc slides
@@ -18137,13 +18143,13 @@ function updateSlides() {
18137
18143
  let slide;
18138
18144
  if (slides[i]) slide = slides[i];
18139
18145
  if (gridEnabled) {
18140
- swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
18146
+ swiper.grid.updateSlide(i, slide, slides);
18141
18147
  }
18142
18148
  if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
18143
18149
 
18144
18150
  if (params.slidesPerView === 'auto') {
18145
18151
  if (shouldResetSlideSize) {
18146
- slides[i].style[getDirectionLabel('width')] = ``;
18152
+ slides[i].style[swiper.getDirectionLabel('width')] = ``;
18147
18153
  }
18148
18154
  const slideStyles = getComputedStyle(slide);
18149
18155
  const currentTransform = slide.style.transform;
@@ -18185,7 +18191,7 @@ function updateSlides() {
18185
18191
  slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
18186
18192
  if (params.roundLengths) slideSize = Math.floor(slideSize);
18187
18193
  if (slides[i]) {
18188
- slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
18194
+ slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
18189
18195
  }
18190
18196
  }
18191
18197
  if (slides[i]) {
@@ -18215,10 +18221,10 @@ function updateSlides() {
18215
18221
  wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
18216
18222
  }
18217
18223
  if (params.setWrapperSize) {
18218
- wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
18224
+ wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
18219
18225
  }
18220
18226
  if (gridEnabled) {
18221
- swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
18227
+ swiper.grid.updateWrapperSize(slideSize, snapGrid);
18222
18228
  }
18223
18229
 
18224
18230
  // Remove last grid elements depending on width
@@ -18255,7 +18261,7 @@ function updateSlides() {
18255
18261
  }
18256
18262
  if (snapGrid.length === 0) snapGrid = [0];
18257
18263
  if (spaceBetween !== 0) {
18258
- const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
18264
+ const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
18259
18265
  slides.filter((_, slideIndex) => {
18260
18266
  if (!params.cssMode || params.loop) return true;
18261
18267
  if (slideIndex === slides.length - 1) {
@@ -18285,8 +18291,9 @@ function updateSlides() {
18285
18291
  allSlidesSize += slideSizeValue + (spaceBetween || 0);
18286
18292
  });
18287
18293
  allSlidesSize -= spaceBetween;
18288
- if (allSlidesSize < swiperSize) {
18289
- const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
18294
+ const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0);
18295
+ if (allSlidesSize + offsetSize < swiperSize) {
18296
+ const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2;
18290
18297
  snapGrid.forEach((snap, snapIndex) => {
18291
18298
  snapGrid[snapIndex] = snap - allSlidesOffset;
18292
18299
  });
@@ -18322,6 +18329,7 @@ function updateSlides() {
18322
18329
  if (params.watchSlidesProgress) {
18323
18330
  swiper.updateSlidesOffset();
18324
18331
  }
18332
+ swiper.emit('slidesUpdated');
18325
18333
  if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
18326
18334
  const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
18327
18335
  const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
@@ -18389,6 +18397,13 @@ function updateSlidesOffset() {
18389
18397
  }
18390
18398
  }
18391
18399
 
18400
+ const toggleSlideClasses$1 = (slideEl, condition, className) => {
18401
+ if (condition && !slideEl.classList.contains(className)) {
18402
+ slideEl.classList.add(className);
18403
+ } else if (!condition && slideEl.classList.contains(className)) {
18404
+ slideEl.classList.remove(className);
18405
+ }
18406
+ };
18392
18407
  function updateSlidesProgress(translate) {
18393
18408
  if (translate === void 0) {
18394
18409
  translate = this && this.translate || 0;
@@ -18404,11 +18419,6 @@ function updateSlidesProgress(translate) {
18404
18419
  if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
18405
18420
  let offsetCenter = -translate;
18406
18421
  if (rtl) offsetCenter = translate;
18407
-
18408
- // Visible Slides
18409
- slides.forEach(slideEl => {
18410
- slideEl.classList.remove(params.slideVisibleClass);
18411
- });
18412
18422
  swiper.visibleSlidesIndexes = [];
18413
18423
  swiper.visibleSlides = [];
18414
18424
  let spaceBetween = params.spaceBetween;
@@ -18427,12 +18437,14 @@ function updateSlidesProgress(translate) {
18427
18437
  const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
18428
18438
  const slideBefore = -(offsetCenter - slideOffset);
18429
18439
  const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
18440
+ const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
18430
18441
  const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
18431
18442
  if (isVisible) {
18432
18443
  swiper.visibleSlides.push(slide);
18433
18444
  swiper.visibleSlidesIndexes.push(i);
18434
- slides[i].classList.add(params.slideVisibleClass);
18435
18445
  }
18446
+ toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass);
18447
+ toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass);
18436
18448
  slide.progress = rtl ? -slideProgress : slideProgress;
18437
18449
  slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
18438
18450
  }
@@ -18501,6 +18513,13 @@ function updateProgress(translate) {
18501
18513
  swiper.emit('progress', progress);
18502
18514
  }
18503
18515
 
18516
+ const toggleSlideClasses = (slideEl, condition, className) => {
18517
+ if (condition && !slideEl.classList.contains(className)) {
18518
+ slideEl.classList.add(className);
18519
+ } else if (!condition && slideEl.classList.contains(className)) {
18520
+ slideEl.classList.remove(className);
18521
+ }
18522
+ };
18504
18523
  function updateSlidesClasses() {
18505
18524
  const swiper = this;
18506
18525
  const {
@@ -18510,13 +18529,13 @@ function updateSlidesClasses() {
18510
18529
  activeIndex
18511
18530
  } = swiper;
18512
18531
  const isVirtual = swiper.virtual && params.virtual.enabled;
18532
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
18513
18533
  const getFilteredSlide = selector => {
18514
18534
  return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
18515
18535
  };
18516
- slides.forEach(slideEl => {
18517
- slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
18518
- });
18519
18536
  let activeSlide;
18537
+ let prevSlide;
18538
+ let nextSlide;
18520
18539
  if (isVirtual) {
18521
18540
  if (params.loop) {
18522
18541
  let slideIndex = activeIndex - swiper.virtual.slidesBefore;
@@ -18527,29 +18546,34 @@ function updateSlidesClasses() {
18527
18546
  activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
18528
18547
  }
18529
18548
  } else {
18530
- activeSlide = slides[activeIndex];
18549
+ if (gridEnabled) {
18550
+ activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];
18551
+ nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];
18552
+ prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];
18553
+ } else {
18554
+ activeSlide = slides[activeIndex];
18555
+ }
18531
18556
  }
18532
18557
  if (activeSlide) {
18533
- // Active classes
18534
- activeSlide.classList.add(params.slideActiveClass);
18558
+ if (!gridEnabled) {
18559
+ // Next Slide
18560
+ nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18561
+ if (params.loop && !nextSlide) {
18562
+ nextSlide = slides[0];
18563
+ }
18535
18564
 
18536
- // Next Slide
18537
- let nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18538
- if (params.loop && !nextSlide) {
18539
- nextSlide = slides[0];
18540
- }
18541
- if (nextSlide) {
18542
- nextSlide.classList.add(params.slideNextClass);
18543
- }
18544
- // Prev Slide
18545
- let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18546
- if (params.loop && !prevSlide === 0) {
18547
- prevSlide = slides[slides.length - 1];
18548
- }
18549
- if (prevSlide) {
18550
- prevSlide.classList.add(params.slidePrevClass);
18565
+ // Prev Slide
18566
+ prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18567
+ if (params.loop && !prevSlide === 0) {
18568
+ prevSlide = slides[slides.length - 1];
18569
+ }
18551
18570
  }
18552
18571
  }
18572
+ slides.forEach(slideEl => {
18573
+ toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass);
18574
+ toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass);
18575
+ toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass);
18576
+ });
18553
18577
  swiper.emitSlidesClasses();
18554
18578
  }
18555
18579
 
@@ -18672,22 +18696,37 @@ function updateActiveIndex(newActiveIndex) {
18672
18696
  snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
18673
18697
  }
18674
18698
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
18675
- if (activeIndex === previousIndex) {
18699
+ if (activeIndex === previousIndex && !swiper.params.loop) {
18676
18700
  if (snapIndex !== previousSnapIndex) {
18677
18701
  swiper.snapIndex = snapIndex;
18678
18702
  swiper.emit('snapIndexChange');
18679
18703
  }
18680
- if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
18681
- swiper.realIndex = getVirtualRealIndex(activeIndex);
18682
- }
18683
18704
  return;
18684
18705
  }
18706
+ if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
18707
+ swiper.realIndex = getVirtualRealIndex(activeIndex);
18708
+ return;
18709
+ }
18710
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
18711
+
18685
18712
  // Get real index
18686
18713
  let realIndex;
18687
18714
  if (swiper.virtual && params.virtual.enabled && params.loop) {
18688
18715
  realIndex = getVirtualRealIndex(activeIndex);
18716
+ } else if (gridEnabled) {
18717
+ const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];
18718
+ let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
18719
+ if (Number.isNaN(activeSlideIndex)) {
18720
+ activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
18721
+ }
18722
+ realIndex = Math.floor(activeSlideIndex / params.grid.rows);
18689
18723
  } else if (swiper.slides[activeIndex]) {
18690
- realIndex = parseInt(swiper.slides[activeIndex].getAttribute('data-swiper-slide-index') || activeIndex, 10);
18724
+ const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
18725
+ if (slideIndex) {
18726
+ realIndex = parseInt(slideIndex, 10);
18727
+ } else {
18728
+ realIndex = activeIndex;
18729
+ }
18691
18730
  } else {
18692
18731
  realIndex = activeIndex;
18693
18732
  }
@@ -18912,6 +18951,7 @@ function translateTo(translate, speed, runCallbacks, translateBounds, internal)
18912
18951
  swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
18913
18952
  swiper.onTranslateToWrapperTransitionEnd = null;
18914
18953
  delete swiper.onTranslateToWrapperTransitionEnd;
18954
+ swiper.animating = false;
18915
18955
  if (runCallbacks) {
18916
18956
  swiper.emit('transitionEnd');
18917
18957
  }
@@ -19019,9 +19059,6 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
19019
19059
  if (index === void 0) {
19020
19060
  index = 0;
19021
19061
  }
19022
- if (speed === void 0) {
19023
- speed = this.params.speed;
19024
- }
19025
19062
  if (runCallbacks === void 0) {
19026
19063
  runCallbacks = true;
19027
19064
  }
@@ -19041,9 +19078,12 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
19041
19078
  wrapperEl,
19042
19079
  enabled
19043
19080
  } = swiper;
19044
- if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
19081
+ if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) {
19045
19082
  return false;
19046
19083
  }
19084
+ if (typeof speed === 'undefined') {
19085
+ speed = swiper.params.speed;
19086
+ }
19047
19087
  const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
19048
19088
  let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
19049
19089
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
@@ -19170,9 +19210,6 @@ function slideToLoop(index, speed, runCallbacks, internal) {
19170
19210
  if (index === void 0) {
19171
19211
  index = 0;
19172
19212
  }
19173
- if (speed === void 0) {
19174
- speed = this.params.speed;
19175
- }
19176
19213
  if (runCallbacks === void 0) {
19177
19214
  runCallbacks = true;
19178
19215
  }
@@ -19181,23 +19218,69 @@ function slideToLoop(index, speed, runCallbacks, internal) {
19181
19218
  index = indexAsNumber;
19182
19219
  }
19183
19220
  const swiper = this;
19221
+ if (swiper.destroyed) return;
19222
+ if (typeof speed === 'undefined') {
19223
+ speed = swiper.params.speed;
19224
+ }
19225
+ const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
19184
19226
  let newIndex = index;
19185
19227
  if (swiper.params.loop) {
19186
19228
  if (swiper.virtual && swiper.params.virtual.enabled) {
19187
19229
  // eslint-disable-next-line
19188
19230
  newIndex = newIndex + swiper.virtual.slidesBefore;
19189
19231
  } else {
19190
- newIndex = swiper.getSlideIndexByData(newIndex);
19232
+ let targetSlideIndex;
19233
+ if (gridEnabled) {
19234
+ const slideIndex = newIndex * swiper.params.grid.rows;
19235
+ targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
19236
+ } else {
19237
+ targetSlideIndex = swiper.getSlideIndexByData(newIndex);
19238
+ }
19239
+ const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
19240
+ const {
19241
+ centeredSlides
19242
+ } = swiper.params;
19243
+ let slidesPerView = swiper.params.slidesPerView;
19244
+ if (slidesPerView === 'auto') {
19245
+ slidesPerView = swiper.slidesPerViewDynamic();
19246
+ } else {
19247
+ slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
19248
+ if (centeredSlides && slidesPerView % 2 === 0) {
19249
+ slidesPerView = slidesPerView + 1;
19250
+ }
19251
+ }
19252
+ let needLoopFix = cols - targetSlideIndex < slidesPerView;
19253
+ if (centeredSlides) {
19254
+ needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
19255
+ }
19256
+ if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
19257
+ needLoopFix = false;
19258
+ }
19259
+ if (needLoopFix) {
19260
+ const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
19261
+ swiper.loopFix({
19262
+ direction,
19263
+ slideTo: true,
19264
+ activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
19265
+ slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
19266
+ });
19267
+ }
19268
+ if (gridEnabled) {
19269
+ const slideIndex = newIndex * swiper.params.grid.rows;
19270
+ newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
19271
+ } else {
19272
+ newIndex = swiper.getSlideIndexByData(newIndex);
19273
+ }
19191
19274
  }
19192
19275
  }
19193
- return swiper.slideTo(newIndex, speed, runCallbacks, internal);
19276
+ requestAnimationFrame(() => {
19277
+ swiper.slideTo(newIndex, speed, runCallbacks, internal);
19278
+ });
19279
+ return swiper;
19194
19280
  }
19195
19281
 
19196
19282
  /* eslint no-unused-vars: "off" */
19197
19283
  function slideNext(speed, runCallbacks, internal) {
19198
- if (speed === void 0) {
19199
- speed = this.params.speed;
19200
- }
19201
19284
  if (runCallbacks === void 0) {
19202
19285
  runCallbacks = true;
19203
19286
  }
@@ -19207,7 +19290,10 @@ function slideNext(speed, runCallbacks, internal) {
19207
19290
  params,
19208
19291
  animating
19209
19292
  } = swiper;
19210
- if (!enabled) return swiper;
19293
+ if (!enabled || swiper.destroyed) return swiper;
19294
+ if (typeof speed === 'undefined') {
19295
+ speed = swiper.params.speed;
19296
+ }
19211
19297
  let perGroup = params.slidesPerGroup;
19212
19298
  if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
19213
19299
  perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
@@ -19223,7 +19309,7 @@ function slideNext(speed, runCallbacks, internal) {
19223
19309
  swiper._clientLeft = swiper.wrapperEl.clientLeft;
19224
19310
  if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {
19225
19311
  requestAnimationFrame(() => {
19226
- swiper.slideTo(swiper.activeIndex + increment);
19312
+ swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
19227
19313
  });
19228
19314
  return true;
19229
19315
  }
@@ -19231,14 +19317,11 @@ function slideNext(speed, runCallbacks, internal) {
19231
19317
  if (params.rewind && swiper.isEnd) {
19232
19318
  return swiper.slideTo(0, speed, runCallbacks, internal);
19233
19319
  }
19234
- return swiper.slideTo(swiper.activeIndex + increment);
19320
+ return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
19235
19321
  }
19236
19322
 
19237
19323
  /* eslint no-unused-vars: "off" */
19238
19324
  function slidePrev(speed, runCallbacks, internal) {
19239
- if (speed === void 0) {
19240
- speed = this.params.speed;
19241
- }
19242
19325
  if (runCallbacks === void 0) {
19243
19326
  runCallbacks = true;
19244
19327
  }
@@ -19251,7 +19334,10 @@ function slidePrev(speed, runCallbacks, internal) {
19251
19334
  enabled,
19252
19335
  animating
19253
19336
  } = swiper;
19254
- if (!enabled) return swiper;
19337
+ if (!enabled || swiper.destroyed) return swiper;
19338
+ if (typeof speed === 'undefined') {
19339
+ speed = swiper.params.speed;
19340
+ }
19255
19341
  const isVirtual = swiper.virtual && params.virtual.enabled;
19256
19342
  if (params.loop) {
19257
19343
  if (animating && !isVirtual && params.loopPreventsSliding) return false;
@@ -19304,21 +19390,19 @@ function slidePrev(speed, runCallbacks, internal) {
19304
19390
 
19305
19391
  /* eslint no-unused-vars: "off" */
19306
19392
  function slideReset(speed, runCallbacks, internal) {
19307
- if (speed === void 0) {
19308
- speed = this.params.speed;
19309
- }
19310
19393
  if (runCallbacks === void 0) {
19311
19394
  runCallbacks = true;
19312
19395
  }
19313
19396
  const swiper = this;
19397
+ if (swiper.destroyed) return;
19398
+ if (typeof speed === 'undefined') {
19399
+ speed = swiper.params.speed;
19400
+ }
19314
19401
  return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
19315
19402
  }
19316
19403
 
19317
19404
  /* eslint no-unused-vars: "off" */
19318
19405
  function slideToClosest(speed, runCallbacks, internal, threshold) {
19319
- if (speed === void 0) {
19320
- speed = this.params.speed;
19321
- }
19322
19406
  if (runCallbacks === void 0) {
19323
19407
  runCallbacks = true;
19324
19408
  }
@@ -19326,6 +19410,10 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
19326
19410
  threshold = 0.5;
19327
19411
  }
19328
19412
  const swiper = this;
19413
+ if (swiper.destroyed) return;
19414
+ if (typeof speed === 'undefined') {
19415
+ speed = swiper.params.speed;
19416
+ }
19329
19417
  let index = swiper.activeIndex;
19330
19418
  const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
19331
19419
  const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
@@ -19354,6 +19442,7 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
19354
19442
 
19355
19443
  function slideToClickedSlide() {
19356
19444
  const swiper = this;
19445
+ if (swiper.destroyed) return;
19357
19446
  const {
19358
19447
  params,
19359
19448
  slidesEl
@@ -19406,10 +19495,45 @@ function loopCreate(slideRealIndex) {
19406
19495
  slidesEl
19407
19496
  } = swiper;
19408
19497
  if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
19409
- const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
19410
- slides.forEach((el, index) => {
19411
- el.setAttribute('data-swiper-slide-index', index);
19412
- });
19498
+ const initSlides = () => {
19499
+ const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
19500
+ slides.forEach((el, index) => {
19501
+ el.setAttribute('data-swiper-slide-index', index);
19502
+ });
19503
+ };
19504
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
19505
+ const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
19506
+ const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
19507
+ const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
19508
+ const addBlankSlides = amountOfSlides => {
19509
+ for (let i = 0; i < amountOfSlides; i += 1) {
19510
+ const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);
19511
+ swiper.slidesEl.append(slideEl);
19512
+ }
19513
+ };
19514
+ if (shouldFillGroup) {
19515
+ if (params.loopAddBlankSlides) {
19516
+ const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
19517
+ addBlankSlides(slidesToAdd);
19518
+ swiper.recalcSlides();
19519
+ swiper.updateSlides();
19520
+ } else {
19521
+ 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)');
19522
+ }
19523
+ initSlides();
19524
+ } else if (shouldFillGrid) {
19525
+ if (params.loopAddBlankSlides) {
19526
+ const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
19527
+ addBlankSlides(slidesToAdd);
19528
+ swiper.recalcSlides();
19529
+ swiper.updateSlides();
19530
+ } else {
19531
+ 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)');
19532
+ }
19533
+ initSlides();
19534
+ } else {
19535
+ initSlides();
19536
+ }
19413
19537
  swiper.loopFix({
19414
19538
  slideRealIndex,
19415
19539
  direction: params.centeredSlides ? undefined : 'next'
@@ -19436,6 +19560,9 @@ function loopFix(_temp) {
19436
19560
  slidesEl,
19437
19561
  params
19438
19562
  } = swiper;
19563
+ const {
19564
+ centeredSlides
19565
+ } = params;
19439
19566
  swiper.allowSlidePrev = true;
19440
19567
  swiper.allowSlideNext = true;
19441
19568
  if (swiper.virtual && params.virtual.enabled) {
@@ -19453,17 +19580,33 @@ function loopFix(_temp) {
19453
19580
  swiper.emit('loopFix');
19454
19581
  return;
19455
19582
  }
19456
- const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
19457
- let loopedSlides = params.loopedSlides || slidesPerView;
19458
- if (loopedSlides % params.slidesPerGroup !== 0) {
19459
- loopedSlides += params.slidesPerGroup - loopedSlides % params.slidesPerGroup;
19583
+ let slidesPerView = params.slidesPerView;
19584
+ if (slidesPerView === 'auto') {
19585
+ slidesPerView = swiper.slidesPerViewDynamic();
19586
+ } else {
19587
+ slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
19588
+ if (centeredSlides && slidesPerView % 2 === 0) {
19589
+ slidesPerView = slidesPerView + 1;
19590
+ }
19591
+ }
19592
+ const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
19593
+ let loopedSlides = slidesPerGroup;
19594
+ if (loopedSlides % slidesPerGroup !== 0) {
19595
+ loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
19460
19596
  }
19597
+ loopedSlides += params.loopAdditionalSlides;
19461
19598
  swiper.loopedSlides = loopedSlides;
19599
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
19600
+ if (slides.length < slidesPerView + loopedSlides) {
19601
+ showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
19602
+ } else if (gridEnabled && params.grid.fill === 'row') {
19603
+ showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
19604
+ }
19462
19605
  const prependSlidesIndexes = [];
19463
19606
  const appendSlidesIndexes = [];
19464
19607
  let activeIndex = swiper.activeIndex;
19465
19608
  if (typeof activeSlideIndex === 'undefined') {
19466
- activeSlideIndex = swiper.getSlideIndex(swiper.slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
19609
+ activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
19467
19610
  } else {
19468
19611
  activeIndex = activeSlideIndex;
19469
19612
  }
@@ -19471,37 +19614,64 @@ function loopFix(_temp) {
19471
19614
  const isPrev = direction === 'prev' || !direction;
19472
19615
  let slidesPrepended = 0;
19473
19616
  let slidesAppended = 0;
19617
+ const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
19618
+ const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
19619
+ const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
19474
19620
  // prepend last slides before start
19475
- if (activeSlideIndex < loopedSlides) {
19476
- slidesPrepended = Math.max(loopedSlides - activeSlideIndex, params.slidesPerGroup);
19477
- for (let i = 0; i < loopedSlides - activeSlideIndex; i += 1) {
19478
- const index = i - Math.floor(i / slides.length) * slides.length;
19479
- prependSlidesIndexes.push(slides.length - index - 1);
19480
- }
19481
- } else if (activeSlideIndex /* + slidesPerView */ > swiper.slides.length - loopedSlides * 2) {
19482
- slidesAppended = Math.max(activeSlideIndex - (swiper.slides.length - loopedSlides * 2), params.slidesPerGroup);
19621
+ if (activeColIndexWithShift < loopedSlides) {
19622
+ slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
19623
+ for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
19624
+ const index = i - Math.floor(i / cols) * cols;
19625
+ if (gridEnabled) {
19626
+ const colIndexToPrepend = cols - index - 1;
19627
+ for (let i = slides.length - 1; i >= 0; i -= 1) {
19628
+ if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
19629
+ }
19630
+ // slides.forEach((slide, slideIndex) => {
19631
+ // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
19632
+ // });
19633
+ } else {
19634
+ prependSlidesIndexes.push(cols - index - 1);
19635
+ }
19636
+ }
19637
+ } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
19638
+ slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
19483
19639
  for (let i = 0; i < slidesAppended; i += 1) {
19484
- const index = i - Math.floor(i / slides.length) * slides.length;
19485
- appendSlidesIndexes.push(index);
19640
+ const index = i - Math.floor(i / cols) * cols;
19641
+ if (gridEnabled) {
19642
+ slides.forEach((slide, slideIndex) => {
19643
+ if (slide.column === index) appendSlidesIndexes.push(slideIndex);
19644
+ });
19645
+ } else {
19646
+ appendSlidesIndexes.push(index);
19647
+ }
19486
19648
  }
19487
19649
  }
19650
+ swiper.__preventObserver__ = true;
19651
+ requestAnimationFrame(() => {
19652
+ swiper.__preventObserver__ = false;
19653
+ });
19488
19654
  if (isPrev) {
19489
19655
  prependSlidesIndexes.forEach(index => {
19490
- swiper.slides[index].swiperLoopMoveDOM = true;
19491
- slidesEl.prepend(swiper.slides[index]);
19492
- swiper.slides[index].swiperLoopMoveDOM = false;
19656
+ slides[index].swiperLoopMoveDOM = true;
19657
+ slidesEl.prepend(slides[index]);
19658
+ slides[index].swiperLoopMoveDOM = false;
19493
19659
  });
19494
19660
  }
19495
19661
  if (isNext) {
19496
19662
  appendSlidesIndexes.forEach(index => {
19497
- swiper.slides[index].swiperLoopMoveDOM = true;
19498
- slidesEl.append(swiper.slides[index]);
19499
- swiper.slides[index].swiperLoopMoveDOM = false;
19663
+ slides[index].swiperLoopMoveDOM = true;
19664
+ slidesEl.append(slides[index]);
19665
+ slides[index].swiperLoopMoveDOM = false;
19500
19666
  });
19501
19667
  }
19502
19668
  swiper.recalcSlides();
19503
19669
  if (params.slidesPerView === 'auto') {
19504
19670
  swiper.updateSlides();
19671
+ } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
19672
+ swiper.slides.forEach((slide, slideIndex) => {
19673
+ swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
19674
+ });
19505
19675
  }
19506
19676
  if (params.watchSlidesProgress) {
19507
19677
  swiper.updateSlidesOffset();
@@ -19515,15 +19685,16 @@ function loopFix(_temp) {
19515
19685
  if (byMousewheel) {
19516
19686
  swiper.setTranslate(swiper.translate - diff);
19517
19687
  } else {
19518
- swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
19688
+ swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true);
19519
19689
  if (setTranslate) {
19520
- swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
19521
- swiper.touchEventsData.currentTranslate = swiper.translate;
19690
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
19691
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
19522
19692
  }
19523
19693
  }
19524
19694
  } else {
19525
19695
  if (setTranslate) {
19526
- swiper.slideToLoop(slideRealIndex, 0, false, true);
19696
+ const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
19697
+ swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
19527
19698
  swiper.touchEventsData.currentTranslate = swiper.translate;
19528
19699
  }
19529
19700
  }
@@ -19537,12 +19708,13 @@ function loopFix(_temp) {
19537
19708
  } else {
19538
19709
  swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
19539
19710
  if (setTranslate) {
19540
- swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
19541
- swiper.touchEventsData.currentTranslate = swiper.translate;
19711
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
19712
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
19542
19713
  }
19543
19714
  }
19544
19715
  } else {
19545
- swiper.slideToLoop(slideRealIndex, 0, false, true);
19716
+ const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
19717
+ swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
19546
19718
  }
19547
19719
  }
19548
19720
  }
@@ -19655,27 +19827,54 @@ function closestElement(selector, base) {
19655
19827
  }
19656
19828
  return __closestFrom(base);
19657
19829
  }
19830
+ function preventEdgeSwipe(swiper, event, startX) {
19831
+ const window = getWindow();
19832
+ const {
19833
+ params
19834
+ } = swiper;
19835
+ const edgeSwipeDetection = params.edgeSwipeDetection;
19836
+ const edgeSwipeThreshold = params.edgeSwipeThreshold;
19837
+ if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
19838
+ if (edgeSwipeDetection === 'prevent') {
19839
+ event.preventDefault();
19840
+ return true;
19841
+ }
19842
+ return false;
19843
+ }
19844
+ return true;
19845
+ }
19658
19846
  function onTouchStart(event) {
19659
19847
  const swiper = this;
19660
19848
  const document = getDocument();
19661
- const window = getWindow();
19849
+ let e = event;
19850
+ if (e.originalEvent) e = e.originalEvent;
19662
19851
  const data = swiper.touchEventsData;
19663
- data.evCache.push(event);
19852
+ if (e.type === 'pointerdown') {
19853
+ if (data.pointerId !== null && data.pointerId !== e.pointerId) {
19854
+ return;
19855
+ }
19856
+ data.pointerId = e.pointerId;
19857
+ } else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
19858
+ data.touchId = e.targetTouches[0].identifier;
19859
+ }
19860
+ if (e.type === 'touchstart') {
19861
+ // don't proceed touch event
19862
+ preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
19863
+ return;
19864
+ }
19664
19865
  const {
19665
19866
  params,
19666
19867
  touches,
19667
19868
  enabled
19668
19869
  } = swiper;
19669
19870
  if (!enabled) return;
19670
- if (!params.simulateTouch && event.pointerType === 'mouse') return;
19871
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
19671
19872
  if (swiper.animating && params.preventInteractionOnTransition) {
19672
19873
  return;
19673
19874
  }
19674
19875
  if (!swiper.animating && params.cssMode && params.loop) {
19675
19876
  swiper.loopFix();
19676
19877
  }
19677
- let e = event;
19678
- if (e.originalEvent) e = e.originalEvent;
19679
19878
  let targetEl = e.target;
19680
19879
  if (params.touchEventsTarget === 'wrapper') {
19681
19880
  if (!swiper.wrapperEl.contains(targetEl)) return;
@@ -19687,7 +19886,7 @@ function onTouchStart(event) {
19687
19886
  // change target el for shadow root component
19688
19887
  const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
19689
19888
  // eslint-disable-next-line
19690
- const eventPath = event.composedPath ? event.composedPath() : event.path;
19889
+ const eventPath = e.composedPath ? e.composedPath() : e.path;
19691
19890
  if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
19692
19891
  targetEl = eventPath[0];
19693
19892
  }
@@ -19709,14 +19908,8 @@ function onTouchStart(event) {
19709
19908
 
19710
19909
  // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
19711
19910
 
19712
- const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
19713
- const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
19714
- if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
19715
- if (edgeSwipeDetection === 'prevent') {
19716
- event.preventDefault();
19717
- } else {
19718
- return;
19719
- }
19911
+ if (!preventEdgeSwipe(swiper, e, startX)) {
19912
+ return;
19720
19913
  }
19721
19914
  Object.assign(data, {
19722
19915
  isTouched: true,
@@ -19766,15 +19959,24 @@ function onTouchMove(event) {
19766
19959
  if (!params.simulateTouch && event.pointerType === 'mouse') return;
19767
19960
  let e = event;
19768
19961
  if (e.originalEvent) e = e.originalEvent;
19962
+ if (e.type === 'pointermove') {
19963
+ if (data.touchId !== null) return; // return from pointer if we use touch
19964
+ const id = e.pointerId;
19965
+ if (id !== data.pointerId) return;
19966
+ }
19967
+ let targetTouch;
19968
+ if (e.type === 'touchmove') {
19969
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
19970
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
19971
+ } else {
19972
+ targetTouch = e;
19973
+ }
19769
19974
  if (!data.isTouched) {
19770
19975
  if (data.startMoving && data.isScrolling) {
19771
19976
  swiper.emit('touchMoveOpposite', e);
19772
19977
  }
19773
19978
  return;
19774
19979
  }
19775
- const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
19776
- if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
19777
- const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
19778
19980
  const pageX = targetTouch.pageX;
19779
19981
  const pageY = targetTouch.pageY;
19780
19982
  if (e.preventedByNestedSwiper) {
@@ -19790,8 +19992,6 @@ function onTouchMove(event) {
19790
19992
  Object.assign(touches, {
19791
19993
  startX: pageX,
19792
19994
  startY: pageY,
19793
- prevX: swiper.touches.currentX,
19794
- prevY: swiper.touches.currentY,
19795
19995
  currentX: pageX,
19796
19996
  currentY: pageY
19797
19997
  });
@@ -19821,7 +20021,8 @@ function onTouchMove(event) {
19821
20021
  if (data.allowTouchCallbacks) {
19822
20022
  swiper.emit('touchMove', e);
19823
20023
  }
19824
- if (e.targetTouches && e.targetTouches.length > 1) return;
20024
+ touches.previousX = touches.currentX;
20025
+ touches.previousY = touches.currentY;
19825
20026
  touches.currentX = pageX;
19826
20027
  touches.currentY = pageY;
19827
20028
  const diffX = touches.currentX - touches.startX;
@@ -19847,7 +20048,7 @@ function onTouchMove(event) {
19847
20048
  data.startMoving = true;
19848
20049
  }
19849
20050
  }
19850
- if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled && data.evCache.length > 1) {
20051
+ if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) {
19851
20052
  data.isTouched = false;
19852
20053
  return;
19853
20054
  }
@@ -19877,7 +20078,7 @@ function onTouchMove(event) {
19877
20078
  swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
19878
20079
  swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
19879
20080
  const isLoop = swiper.params.loop && !params.cssMode;
19880
- const allowLoopFix = swiper.swipeDirection === 'next' && swiper.allowSlideNext || swiper.swipeDirection === 'prev' && swiper.allowSlidePrev;
20081
+ const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;
19881
20082
  if (!data.isMoved) {
19882
20083
  if (isLoop && allowLoopFix) {
19883
20084
  swiper.loopFix({
@@ -19889,7 +20090,10 @@ function onTouchMove(event) {
19889
20090
  if (swiper.animating) {
19890
20091
  const evt = new window.CustomEvent('transitionend', {
19891
20092
  bubbles: true,
19892
- cancelable: true
20093
+ cancelable: true,
20094
+ detail: {
20095
+ bySwiperTouchMove: true
20096
+ }
19893
20097
  });
19894
20098
  swiper.wrapperEl.dispatchEvent(evt);
19895
20099
  }
@@ -19901,13 +20105,18 @@ function onTouchMove(event) {
19901
20105
  swiper.emit('sliderFirstMove', e);
19902
20106
  }
19903
20107
  let loopFixed;
19904
- if (data.isMoved && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
19905
- // need another loop fix
19906
- swiper.loopFix({
19907
- direction: swiper.swipeDirection,
19908
- setTranslate: true
20108
+ new Date().getTime();
20109
+ if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
20110
+ Object.assign(touches, {
20111
+ startX: pageX,
20112
+ startY: pageY,
20113
+ currentX: pageX,
20114
+ currentY: pageY,
20115
+ startTranslate: data.currentTranslate
19909
20116
  });
19910
- loopFixed = true;
20117
+ data.loopSwapReset = true;
20118
+ data.startTranslate = data.currentTranslate;
20119
+ return;
19911
20120
  }
19912
20121
  swiper.emit('sliderMove', e);
19913
20122
  data.isMoved = true;
@@ -19918,7 +20127,7 @@ function onTouchMove(event) {
19918
20127
  resistanceRatio = 0;
19919
20128
  }
19920
20129
  if (diff > 0) {
19921
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.size / 2 : swiper.minTranslate())) {
20130
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) {
19922
20131
  swiper.loopFix({
19923
20132
  direction: 'prev',
19924
20133
  setTranslate: true,
@@ -19932,7 +20141,7 @@ function onTouchMove(event) {
19932
20141
  }
19933
20142
  }
19934
20143
  } else if (diff < 0) {
19935
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.size / 2 : swiper.maxTranslate())) {
20144
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) {
19936
20145
  swiper.loopFix({
19937
20146
  direction: 'next',
19938
20147
  setTranslate: true,
@@ -19996,16 +20205,26 @@ function onTouchMove(event) {
19996
20205
  function onTouchEnd(event) {
19997
20206
  const swiper = this;
19998
20207
  const data = swiper.touchEventsData;
19999
- const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);
20000
- if (pointerIndex >= 0) {
20001
- data.evCache.splice(pointerIndex, 1);
20208
+ let e = event;
20209
+ if (e.originalEvent) e = e.originalEvent;
20210
+ let targetTouch;
20211
+ const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
20212
+ if (!isTouchEvent) {
20213
+ if (data.touchId !== null) return; // return from pointer if we use touch
20214
+ if (e.pointerId !== data.pointerId) return;
20215
+ targetTouch = e;
20216
+ } else {
20217
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
20218
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
20002
20219
  }
20003
- if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(event.type)) {
20004
- const proceed = ['pointercancel', 'contextmenu'].includes(event.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
20220
+ if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
20221
+ const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
20005
20222
  if (!proceed) {
20006
20223
  return;
20007
20224
  }
20008
20225
  }
20226
+ data.pointerId = null;
20227
+ data.touchId = null;
20009
20228
  const {
20010
20229
  params,
20011
20230
  touches,
@@ -20014,9 +20233,7 @@ function onTouchEnd(event) {
20014
20233
  enabled
20015
20234
  } = swiper;
20016
20235
  if (!enabled) return;
20017
- if (!params.simulateTouch && event.pointerType === 'mouse') return;
20018
- let e = event;
20019
- if (e.originalEvent) e = e.originalEvent;
20236
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
20020
20237
  if (data.allowTouchCallbacks) {
20021
20238
  swiper.emit('touchEnd', e);
20022
20239
  }
@@ -20029,6 +20246,7 @@ function onTouchEnd(event) {
20029
20246
  data.startMoving = false;
20030
20247
  return;
20031
20248
  }
20249
+
20032
20250
  // Return Grab Cursor
20033
20251
  if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
20034
20252
  swiper.setGrabCursor(false);
@@ -20051,7 +20269,7 @@ function onTouchEnd(event) {
20051
20269
  nextTick(() => {
20052
20270
  if (!swiper.destroyed) swiper.allowClick = true;
20053
20271
  });
20054
- if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
20272
+ if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
20055
20273
  data.isTouched = false;
20056
20274
  data.isMoved = false;
20057
20275
  data.startMoving = false;
@@ -20077,16 +20295,17 @@ function onTouchEnd(event) {
20077
20295
  }
20078
20296
 
20079
20297
  // Find current slide
20298
+ const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;
20080
20299
  let stopIndex = 0;
20081
20300
  let groupSize = swiper.slidesSizesGrid[0];
20082
20301
  for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
20083
20302
  const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
20084
20303
  if (typeof slidesGrid[i + increment] !== 'undefined') {
20085
- if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
20304
+ if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
20086
20305
  stopIndex = i;
20087
20306
  groupSize = slidesGrid[i + increment] - slidesGrid[i];
20088
20307
  }
20089
- } else if (currentPos >= slidesGrid[i]) {
20308
+ } else if (swipeToLast || currentPos >= slidesGrid[i]) {
20090
20309
  stopIndex = i;
20091
20310
  groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
20092
20311
  }
@@ -20248,8 +20467,15 @@ function onLoad(e) {
20248
20467
  swiper.update();
20249
20468
  }
20250
20469
 
20251
- let dummyEventAttached = false;
20252
- function dummyEventListener() {}
20470
+ function onDocumentTouchStart() {
20471
+ const swiper = this;
20472
+ if (swiper.documentTouchHandlerProceeded) return;
20473
+ swiper.documentTouchHandlerProceeded = true;
20474
+ if (swiper.params.touchReleaseOnEdges) {
20475
+ swiper.el.style.touchAction = 'auto';
20476
+ }
20477
+ }
20478
+
20253
20479
  const events = (swiper, method) => {
20254
20480
  const document = getDocument();
20255
20481
  const {
@@ -20261,21 +20487,39 @@ const events = (swiper, method) => {
20261
20487
  const capture = !!params.nested;
20262
20488
  const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
20263
20489
  const swiperMethod = method;
20490
+ if (!el || typeof el === 'string') return;
20264
20491
 
20265
20492
  // Touch Events
20493
+ document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
20494
+ passive: false,
20495
+ capture
20496
+ });
20497
+ el[domMethod]('touchstart', swiper.onTouchStart, {
20498
+ passive: false
20499
+ });
20266
20500
  el[domMethod]('pointerdown', swiper.onTouchStart, {
20267
20501
  passive: false
20268
20502
  });
20503
+ document[domMethod]('touchmove', swiper.onTouchMove, {
20504
+ passive: false,
20505
+ capture
20506
+ });
20269
20507
  document[domMethod]('pointermove', swiper.onTouchMove, {
20270
20508
  passive: false,
20271
20509
  capture
20272
20510
  });
20511
+ document[domMethod]('touchend', swiper.onTouchEnd, {
20512
+ passive: true
20513
+ });
20273
20514
  document[domMethod]('pointerup', swiper.onTouchEnd, {
20274
20515
  passive: true
20275
20516
  });
20276
20517
  document[domMethod]('pointercancel', swiper.onTouchEnd, {
20277
20518
  passive: true
20278
20519
  });
20520
+ document[domMethod]('touchcancel', swiper.onTouchEnd, {
20521
+ passive: true
20522
+ });
20279
20523
  document[domMethod]('pointerout', swiper.onTouchEnd, {
20280
20524
  passive: true
20281
20525
  });
@@ -20308,22 +20552,18 @@ const events = (swiper, method) => {
20308
20552
  };
20309
20553
  function attachEvents() {
20310
20554
  const swiper = this;
20311
- const document = getDocument();
20312
20555
  const {
20313
20556
  params
20314
20557
  } = swiper;
20315
20558
  swiper.onTouchStart = onTouchStart.bind(swiper);
20316
20559
  swiper.onTouchMove = onTouchMove.bind(swiper);
20317
20560
  swiper.onTouchEnd = onTouchEnd.bind(swiper);
20561
+ swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
20318
20562
  if (params.cssMode) {
20319
20563
  swiper.onScroll = onScroll.bind(swiper);
20320
20564
  }
20321
20565
  swiper.onClick = onClick.bind(swiper);
20322
20566
  swiper.onLoad = onLoad.bind(swiper);
20323
- if (!dummyEventAttached) {
20324
- document.addEventListener('touchstart', dummyEventListener);
20325
- dummyEventAttached = true;
20326
- }
20327
20567
  events(swiper, 'on');
20328
20568
  }
20329
20569
  function detachEvents() {
@@ -20356,6 +20596,8 @@ function setBreakpoint() {
20356
20596
  const breakpointParams = breakpointOnlyParams || swiper.originalParams;
20357
20597
  const wasMultiRow = isGridEnabled(swiper, params);
20358
20598
  const isMultiRow = isGridEnabled(swiper, breakpointParams);
20599
+ const wasGrabCursor = swiper.params.grabCursor;
20600
+ const isGrabCursor = breakpointParams.grabCursor;
20359
20601
  const wasEnabled = params.enabled;
20360
20602
  if (wasMultiRow && !isMultiRow) {
20361
20603
  el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
@@ -20367,6 +20609,11 @@ function setBreakpoint() {
20367
20609
  }
20368
20610
  swiper.emitContainerClasses();
20369
20611
  }
20612
+ if (wasGrabCursor && !isGrabCursor) {
20613
+ swiper.unsetGrabCursor();
20614
+ } else if (!wasGrabCursor && isGrabCursor) {
20615
+ swiper.setGrabCursor();
20616
+ }
20370
20617
 
20371
20618
  // Toggle navigation, pagination, scrollbar
20372
20619
  ['navigation', 'pagination', 'scrollbar'].forEach(prop => {
@@ -20517,6 +20764,7 @@ function removeClasses() {
20517
20764
  el,
20518
20765
  classNames
20519
20766
  } = swiper;
20767
+ if (!el || typeof el === 'string') return;
20520
20768
  el.classList.remove(...classNames);
20521
20769
  swiper.emitContainerClasses();
20522
20770
  }
@@ -20563,6 +20811,7 @@ var defaults$4 = {
20563
20811
  init: true,
20564
20812
  direction: 'horizontal',
20565
20813
  oneWayMovement: false,
20814
+ swiperElementNodeName: 'SWIPER-CONTAINER',
20566
20815
  touchEventsTarget: 'wrapper',
20567
20816
  initialSlide: 0,
20568
20817
  speed: 300,
@@ -20571,6 +20820,7 @@ var defaults$4 = {
20571
20820
  resizeObserver: true,
20572
20821
  nested: false,
20573
20822
  createElements: false,
20823
+ eventsPrefix: 'swiper',
20574
20824
  enabled: true,
20575
20825
  focusableElements: 'input, select, option, textarea, button, video, label',
20576
20826
  // Overrides
@@ -20645,7 +20895,8 @@ var defaults$4 = {
20645
20895
  slideToClickedSlide: false,
20646
20896
  // loop
20647
20897
  loop: false,
20648
- loopedSlides: null,
20898
+ loopAddBlankSlides: true,
20899
+ loopAdditionalSlides: 0,
20649
20900
  loopPreventsSliding: true,
20650
20901
  // rewind
20651
20902
  rewind: false,
@@ -20664,8 +20915,10 @@ var defaults$4 = {
20664
20915
  containerModifierClass: 'swiper-',
20665
20916
  // NEW
20666
20917
  slideClass: 'swiper-slide',
20918
+ slideBlankClass: 'swiper-slide-blank',
20667
20919
  slideActiveClass: 'swiper-slide-active',
20668
20920
  slideVisibleClass: 'swiper-slide-visible',
20921
+ slideFullyVisibleClass: 'swiper-slide-fully-visible',
20669
20922
  slideNextClass: 'swiper-slide-next',
20670
20923
  slidePrevClass: 'swiper-slide-prev',
20671
20924
  wrapperClass: 'swiper-wrapper',
@@ -20858,7 +21111,8 @@ class Swiper$1 {
20858
21111
  velocities: [],
20859
21112
  allowMomentumBounce: undefined,
20860
21113
  startMoving: undefined,
20861
- evCache: []
21114
+ pointerId: null,
21115
+ touchId: null
20862
21116
  },
20863
21117
  // Clicks
20864
21118
  allowClick: true,
@@ -20886,6 +21140,22 @@ class Swiper$1 {
20886
21140
  // eslint-disable-next-line no-constructor-return
20887
21141
  return swiper;
20888
21142
  }
21143
+ getDirectionLabel(property) {
21144
+ if (this.isHorizontal()) {
21145
+ return property;
21146
+ }
21147
+ // prettier-ignore
21148
+ return {
21149
+ 'width': 'height',
21150
+ 'margin-top': 'margin-left',
21151
+ 'margin-bottom ': 'margin-right',
21152
+ 'margin-left': 'margin-top',
21153
+ 'margin-right': 'margin-bottom',
21154
+ 'padding-left': 'padding-top',
21155
+ 'padding-right': 'padding-bottom',
21156
+ 'marginRight': 'marginBottom'
21157
+ }[property];
21158
+ }
20889
21159
  getSlideIndex(slideEl) {
20890
21160
  const {
20891
21161
  slidesEl,
@@ -20982,11 +21252,11 @@ class Swiper$1 {
20982
21252
  let spv = 1;
20983
21253
  if (typeof params.slidesPerView === 'number') return params.slidesPerView;
20984
21254
  if (params.centeredSlides) {
20985
- let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;
21255
+ let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;
20986
21256
  let breakLoop;
20987
21257
  for (let i = activeIndex + 1; i < slides.length; i += 1) {
20988
21258
  if (slides[i] && !breakLoop) {
20989
- slideSize += slides[i].swiperSlideSize;
21259
+ slideSize += Math.ceil(slides[i].swiperSlideSize);
20990
21260
  spv += 1;
20991
21261
  if (slideSize > swiperSize) breakLoop = true;
20992
21262
  }
@@ -21123,7 +21393,7 @@ class Swiper$1 {
21123
21393
  return false;
21124
21394
  }
21125
21395
  el.swiper = swiper;
21126
- if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === 'SWIPER-CONTAINER') {
21396
+ if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
21127
21397
  swiper.isElement = true;
21128
21398
  }
21129
21399
  const getWrapperSelector = () => {
@@ -21259,11 +21529,15 @@ class Swiper$1 {
21259
21529
  // Cleanup styles
21260
21530
  if (cleanStyles) {
21261
21531
  swiper.removeClasses();
21262
- el.removeAttribute('style');
21263
- wrapperEl.removeAttribute('style');
21532
+ if (el && typeof el !== 'string') {
21533
+ el.removeAttribute('style');
21534
+ }
21535
+ if (wrapperEl) {
21536
+ wrapperEl.removeAttribute('style');
21537
+ }
21264
21538
  if (slides && slides.length) {
21265
21539
  slides.forEach(slideEl => {
21266
- slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
21540
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
21267
21541
  slideEl.removeAttribute('style');
21268
21542
  slideEl.removeAttribute('data-swiper-slide-index');
21269
21543
  });
@@ -21276,7 +21550,9 @@ class Swiper$1 {
21276
21550
  swiper.off(eventName);
21277
21551
  });
21278
21552
  if (deleteInstance !== false) {
21279
- swiper.el.swiper = null;
21553
+ if (swiper.el && typeof swiper.el !== 'string') {
21554
+ swiper.el.swiper = null;
21555
+ }
21280
21556
  deleteProps(swiper);
21281
21557
  }
21282
21558
  swiper.destroyed = true;
@@ -21315,7 +21591,7 @@ Object.keys(prototypes).forEach(prototypeGroup => {
21315
21591
  Swiper$1.use([Resize, Observer]);
21316
21592
 
21317
21593
  /* underscore in name -> watch for changes */
21318
- const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopedSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideNextClass', 'slidePrevClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
21594
+ const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'swiperElementNodeName', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopAdditionalSlides', 'loopAddBlankSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideFullyVisibleClass', 'slideNextClass', 'slidePrevClass', 'slideBlankClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
21319
21595
  // modules
21320
21596
  'a11y', '_autoplay', '_controller', 'coverflowEffect', 'cubeEffect', 'fadeEffect', 'flipEffect', 'creativeEffect', 'cardsEffect', 'hashNavigation', 'history', 'keyboard', 'mousewheel', '_navigation', '_pagination', 'parallax', '_scrollbar', '_thumbs', 'virtual', 'zoom', 'control'];
21321
21597
 
@@ -21444,7 +21720,7 @@ function updateSwiper(_ref) {
21444
21720
  }
21445
21721
  updateParams.forEach(key => {
21446
21722
  if (isObject$1(currentParams[key]) && isObject$1(passedParams[key])) {
21447
- extend$1(currentParams[key], passedParams[key]);
21723
+ Object.assign(currentParams[key], passedParams[key]);
21448
21724
  if ((key === 'navigation' || key === 'pagination' || key === 'scrollbar') && 'enabled' in passedParams[key] && !passedParams[key].enabled) {
21449
21725
  destroyModule(key);
21450
21726
  }
@@ -21465,6 +21741,9 @@ function updateSwiper(_ref) {
21465
21741
  if (changedParams.includes('children') && slides && virtual && currentParams.virtual.enabled) {
21466
21742
  virtual.slides = slides;
21467
21743
  virtual.update(true);
21744
+ } else if (changedParams.includes('virtual') && virtual && currentParams.virtual.enabled) {
21745
+ if (slides) virtual.slides = slides;
21746
+ virtual.update(true);
21468
21747
  }
21469
21748
  if (changedParams.includes('children') && slides && currentParams.loop) {
21470
21749
  loopNeedReloop = true;
@@ -21667,15 +21946,15 @@ const updateOnVirtualData = swiper => {
21667
21946
  };
21668
21947
 
21669
21948
  /**
21670
- * Swiper React 10.3.0
21949
+ * Swiper React 11.1.4
21671
21950
  * Most modern mobile touch slider and framework with hardware accelerated transitions
21672
21951
  * https://swiperjs.com
21673
21952
  *
21674
- * Copyright 2014-2023 Vladimir Kharlampidi
21953
+ * Copyright 2014-2024 Vladimir Kharlampidi
21675
21954
  *
21676
21955
  * Released under the MIT License
21677
21956
  *
21678
- * Released on: September 21, 2023
21957
+ * Released on: May 30, 2024
21679
21958
  */
21680
21959
 
21681
21960
  function _extends() {
@@ -21770,7 +22049,7 @@ function renderVirtual(swiper, slides, virtualData) {
21770
22049
  return /*#__PURE__*/React__default.cloneElement(child, {
21771
22050
  swiper,
21772
22051
  style,
21773
- key: `slide-${index}`
22052
+ key: child.props.virtualIndex || child.key || `slide-${index}`
21774
22053
  });
21775
22054
  });
21776
22055
  }
@@ -21896,7 +22175,7 @@ const Swiper = /*#__PURE__*/forwardRef(function (_temp, externalElRef) {
21896
22175
  scrollbarEl: scrollbarElRef.current,
21897
22176
  swiper: swiperRef.current
21898
22177
  }, swiperParams);
21899
- if (onSwiper) onSwiper(swiperRef.current);
22178
+ if (onSwiper && !swiperRef.current.destroyed) onSwiper(swiperRef.current);
21900
22179
  // eslint-disable-next-line
21901
22180
  return () => {
21902
22181
  if (swiperRef.current && !swiperRef.current.destroyed) {
@@ -41514,7 +41793,7 @@ function History(_ref) {
41514
41793
  } else {
41515
41794
  location = window.location;
41516
41795
  }
41517
- const slide = swiper.slides[index];
41796
+ const slide = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${index}"]`) : swiper.slides[index];
41518
41797
  let value = slugify(slide.getAttribute('data-history'));
41519
41798
  if (swiper.params.history.root.length > 0) {
41520
41799
  let root = swiper.params.history.root;
@@ -41627,7 +41906,7 @@ function Autoplay(_ref) {
41627
41906
  enabled: false,
41628
41907
  delay: 3000,
41629
41908
  waitForTransition: true,
41630
- disableOnInteraction: true,
41909
+ disableOnInteraction: false,
41631
41910
  stopOnLastSlide: false,
41632
41911
  reverseDirection: false,
41633
41912
  pauseOnMouseEnter: false
@@ -41638,17 +41917,21 @@ function Autoplay(_ref) {
41638
41917
  let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000;
41639
41918
  let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000;
41640
41919
  let autoplayTimeLeft;
41641
- let autoplayStartTime = new Date().getTime;
41920
+ let autoplayStartTime = new Date().getTime();
41642
41921
  let wasPaused;
41643
41922
  let isTouched;
41644
41923
  let pausedByTouch;
41645
41924
  let touchStartTimeout;
41646
41925
  let slideChanged;
41647
41926
  let pausedByInteraction;
41927
+ let pausedByPointerEnter;
41648
41928
  function onTransitionEnd(e) {
41649
41929
  if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
41650
41930
  if (e.target !== swiper.wrapperEl) return;
41651
41931
  swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);
41932
+ if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) {
41933
+ return;
41934
+ }
41652
41935
  resume();
41653
41936
  }
41654
41937
  const calcTimeLeft = () => {
@@ -41733,6 +42016,7 @@ function Autoplay(_ref) {
41733
42016
  return delay;
41734
42017
  };
41735
42018
  const start = () => {
42019
+ autoplayStartTime = new Date().getTime();
41736
42020
  swiper.autoplay.running = true;
41737
42021
  run();
41738
42022
  emit('autoplayStart');
@@ -41798,11 +42082,13 @@ function Autoplay(_ref) {
41798
42082
  const onPointerEnter = e => {
41799
42083
  if (e.pointerType !== 'mouse') return;
41800
42084
  pausedByInteraction = true;
42085
+ pausedByPointerEnter = true;
41801
42086
  if (swiper.animating || swiper.autoplay.paused) return;
41802
42087
  pause(true);
41803
42088
  };
41804
42089
  const onPointerLeave = e => {
41805
42090
  if (e.pointerType !== 'mouse') return;
42091
+ pausedByPointerEnter = false;
41806
42092
  if (swiper.autoplay.paused) {
41807
42093
  resume();
41808
42094
  }
@@ -41814,8 +42100,10 @@ function Autoplay(_ref) {
41814
42100
  }
41815
42101
  };
41816
42102
  const detachMouseEvents = () => {
41817
- swiper.el.removeEventListener('pointerenter', onPointerEnter);
41818
- swiper.el.removeEventListener('pointerleave', onPointerLeave);
42103
+ if (swiper.el && typeof swiper.el !== 'string') {
42104
+ swiper.el.removeEventListener('pointerenter', onPointerEnter);
42105
+ swiper.el.removeEventListener('pointerleave', onPointerLeave);
42106
+ }
41819
42107
  };
41820
42108
  const attachDocumentEvents = () => {
41821
42109
  const document = getDocument();
@@ -41829,7 +42117,6 @@ function Autoplay(_ref) {
41829
42117
  if (swiper.params.autoplay.enabled) {
41830
42118
  attachMouseEvents();
41831
42119
  attachDocumentEvents();
41832
- autoplayStartTime = new Date().getTime();
41833
42120
  start();
41834
42121
  }
41835
42122
  });
@@ -41840,6 +42127,18 @@ function Autoplay(_ref) {
41840
42127
  stop();
41841
42128
  }
41842
42129
  });
42130
+ on('_freeModeStaticRelease', () => {
42131
+ if (pausedByTouch || pausedByInteraction) {
42132
+ resume();
42133
+ }
42134
+ });
42135
+ on('_freeModeNoMomentumRelease', () => {
42136
+ if (!swiper.params.autoplay.disableOnInteraction) {
42137
+ pause(true, true);
42138
+ } else {
42139
+ stop();
42140
+ }
42141
+ });
41843
42142
  on('beforeTransitionStart', (_s, speed, internal) => {
41844
42143
  if (swiper.destroyed || !swiper.autoplay.running) return;
41845
42144
  if (internal || !swiper.params.autoplay.disableOnInteraction) {
@@ -42917,22 +43216,17 @@ var HeroWithGallery = function HeroWithGallery(_ref) {
42917
43216
  return swiper === null || swiper === void 0 ? void 0 : swiper.slidePrev();
42918
43217
  }
42919
43218
  }), /*#__PURE__*/React__default.createElement(Swiper, {
42920
- loop: true,
42921
43219
  className: "ns-hero-with-slider",
43220
+ loop: slides.length > 0,
42922
43221
  onSwiper: setSwiper
42923
43222
  }, slides.map(function (_ref7, index) {
42924
- var content = _ref7.content,
42925
- buttons = _ref7.buttons,
42926
- media = _ref7.media;
43223
+ _ref7.content;
43224
+ _ref7.buttons;
43225
+ _ref7.media;
42927
43226
  return /*#__PURE__*/React__default.createElement(SwiperSlide, {
42928
43227
  className: classnames("my-auto", className),
42929
- key: getUniqueKey(content.title, index)
42930
- }, renderHeroWithMedia({
42931
- content: content,
42932
- buttons: buttons,
42933
- media: media,
42934
- index: index
42935
- }));
43228
+ key: index
43229
+ }, /*#__PURE__*/React__default.createElement("h1", null, "Hello"));
42936
43230
  })), /*#__PURE__*/React__default.createElement(ArrowButton, {
42937
43231
  Icon: ArrowRightS$1,
42938
43232
  className: "hidden sm:flex",