@gravity-ui/page-constructor 8.13.0-beta.1 → 8.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,9 +29,14 @@ module.exports = __toCommonJS(stdin_exports);
29
29
  function isObject(obj) {
30
30
  return obj !== null && typeof obj === "object" && "constructor" in obj && obj.constructor === Object;
31
31
  }
32
- function extend(target = {}, src = {}) {
33
- const noExtend = ["__proto__", "constructor", "prototype"];
34
- Object.keys(src).filter((key) => noExtend.indexOf(key) < 0).forEach((key) => {
32
+ function extend(target, src) {
33
+ if (target === void 0) {
34
+ target = {};
35
+ }
36
+ if (src === void 0) {
37
+ src = {};
38
+ }
39
+ Object.keys(src).forEach((key) => {
35
40
  if (typeof target[key] === "undefined") target[key] = src[key];
36
41
  else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
37
42
  extend(target[key], src[key]);
@@ -170,23 +175,18 @@ function getWindow() {
170
175
  }
171
176
 
172
177
  // node_modules/swiper/shared/utils.mjs
173
- function classesToTokens(classes = "") {
174
- return classes.trim().split(" ").filter((c) => !!c.trim());
175
- }
176
- function elementChildren(element, selector = "") {
177
- const window2 = getWindow();
178
- const children = [...element.children];
179
- if (window2.HTMLSlotElement && element instanceof HTMLSlotElement) {
180
- children.push(...element.assignedElements());
181
- }
182
- if (!selector) {
183
- return children;
178
+ function elementChildren(element, selector) {
179
+ if (selector === void 0) {
180
+ selector = "";
184
181
  }
185
- return children.filter((el) => el.matches(selector));
182
+ return [...element.children].filter((el) => el.matches(selector));
186
183
  }
187
- function createElement(tag, classes = []) {
184
+ function createElement(tag, classes) {
185
+ if (classes === void 0) {
186
+ classes = [];
187
+ }
188
188
  const el = document.createElement(tag);
189
- el.classList.add(...Array.isArray(classes) ? classes : classesToTokens(classes));
189
+ el.classList.add(...Array.isArray(classes) ? classes : [classes]);
190
190
  return el;
191
191
  }
192
192
  function elementIndex(el) {
@@ -221,18 +221,6 @@ function elementOuterSize(el, size, includeMargins) {
221
221
  }
222
222
  return el.offsetWidth;
223
223
  }
224
- function makeElementsArray(el) {
225
- return (Array.isArray(el) ? el : [el]).filter((e) => !!e);
226
- }
227
- function setInnerHTML(el, html = "") {
228
- if (typeof trustedTypes !== "undefined") {
229
- el.innerHTML = trustedTypes.createPolicy("html", {
230
- createHTML: (s) => s
231
- }).createHTML(html);
232
- } else {
233
- el.innerHTML = html;
234
- }
235
- }
236
224
 
237
225
  // node_modules/swiper/shared/create-element-if-not-defined.mjs
238
226
  function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
@@ -254,17 +242,21 @@ function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
254
242
  }
255
243
 
256
244
  // node_modules/swiper/shared/classes-to-selector.mjs
257
- function classesToSelector(classes = "") {
258
- return `.${classes.trim().replace(/([\.:!+\/()[\]#>~*^$|=,'"@{}\\])/g, "\\$1").replace(/ /g, ".")}`;
245
+ function classesToSelector(classes) {
246
+ if (classes === void 0) {
247
+ classes = "";
248
+ }
249
+ return `.${classes.trim().replace(/([\.:!+\/])/g, "\\$1").replace(/ /g, ".")}`;
259
250
  }
260
251
 
261
252
  // node_modules/swiper/modules/pagination.mjs
262
- function Pagination({
263
- swiper,
264
- extendParams,
265
- on,
266
- emit
267
- }) {
253
+ function Pagination(_ref) {
254
+ let {
255
+ swiper,
256
+ extendParams,
257
+ on,
258
+ emit
259
+ } = _ref;
268
260
  const pfx = "swiper-pagination";
269
261
  extendParams({
270
262
  pagination: {
@@ -304,6 +296,7 @@ function Pagination({
304
296
  };
305
297
  let bulletSize;
306
298
  let dynamicBulletIndex = 0;
299
+ const makeElementsArray = (el) => (Array.isArray(el) ? el : [el]).filter((e) => !!e);
307
300
  function isPaginationDisabled() {
308
301
  return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
309
302
  }
@@ -321,16 +314,6 @@ function Pagination({
321
314
  }
322
315
  }
323
316
  }
324
- function getMoveDirection(prevIndex, nextIndex, length) {
325
- prevIndex = prevIndex % length;
326
- nextIndex = nextIndex % length;
327
- if (nextIndex === prevIndex + 1) {
328
- return "next";
329
- } else if (nextIndex === prevIndex - 1) {
330
- return "previous";
331
- }
332
- return;
333
- }
334
317
  function onBulletClick(e) {
335
318
  const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
336
319
  if (!bulletEl) {
@@ -340,14 +323,30 @@ function Pagination({
340
323
  const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;
341
324
  if (swiper.params.loop) {
342
325
  if (swiper.realIndex === index) return;
343
- const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length);
344
- if (moveDirection === "next") {
345
- swiper.slideNext();
346
- } else if (moveDirection === "previous") {
347
- swiper.slidePrev();
348
- } else {
349
- swiper.slideToLoop(index);
326
+ const realIndex = swiper.realIndex;
327
+ const newSlideIndex = swiper.getSlideIndexByData(index);
328
+ const currentSlideIndex = swiper.getSlideIndexByData(swiper.realIndex);
329
+ const loopFix = (dir) => {
330
+ const indexBeforeLoopFix = swiper.activeIndex;
331
+ swiper.loopFix({
332
+ direction: dir,
333
+ activeSlideIndex: newSlideIndex,
334
+ slideTo: false
335
+ });
336
+ const indexAfterFix = swiper.activeIndex;
337
+ if (indexBeforeLoopFix === indexAfterFix) {
338
+ swiper.slideToLoop(realIndex, 0, false, true);
339
+ }
340
+ };
341
+ if (newSlideIndex > swiper.slides.length - swiper.loopedSlides) {
342
+ loopFix(newSlideIndex > currentSlideIndex ? "next" : "prev");
343
+ } else if (swiper.params.centeredSlides) {
344
+ const slidesPerView = swiper.params.slidesPerView === "auto" ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
345
+ if (newSlideIndex < Math.floor(slidesPerView / 2)) {
346
+ loopFix("prev");
347
+ }
350
348
  }
349
+ swiper.slideToLoop(index);
351
350
  } else {
352
351
  swiper.slideTo(index);
353
352
  }
@@ -479,7 +478,7 @@ function Pagination({
479
478
  });
480
479
  }
481
480
  if (params.type === "custom" && params.renderCustom) {
482
- setInnerHTML(subEl, params.renderCustom(swiper, current + 1, total));
481
+ subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
483
482
  if (subElIndex === 0) emit("paginationRender", subEl);
484
483
  } else {
485
484
  if (subElIndex === 0) emit("paginationRender", subEl);
@@ -493,7 +492,7 @@ function Pagination({
493
492
  function render() {
494
493
  const params = swiper.params.pagination;
495
494
  if (isPaginationDisabled()) return;
496
- const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length;
495
+ const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
497
496
  let el = swiper.pagination.el;
498
497
  el = makeElementsArray(el);
499
498
  let paginationHTML = "";
@@ -527,7 +526,7 @@ function Pagination({
527
526
  swiper.pagination.bullets = [];
528
527
  el.forEach((subEl) => {
529
528
  if (params.type !== "custom") {
530
- setInnerHTML(subEl, paginationHTML || "");
529
+ subEl.innerHTML = paginationHTML || "";
531
530
  }
532
531
  if (params.type === "bullets") {
533
532
  swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
@@ -557,10 +556,10 @@ function Pagination({
557
556
  if (swiper.params.uniqueNavElements && typeof params.el === "string" && Array.isArray(el) && el.length > 1) {
558
557
  el = [...swiper.el.querySelectorAll(params.el)];
559
558
  if (el.length > 1) {
560
- el = el.find((subEl) => {
559
+ el = el.filter((subEl) => {
561
560
  if (elementParents(subEl, ".swiper")[0] !== swiper.el) return false;
562
561
  return true;
563
- });
562
+ })[0];
564
563
  }
565
564
  }
566
565
  if (Array.isArray(el) && el.length === 1) el = el[0];
@@ -707,11 +706,12 @@ function Pagination({
707
706
  }
708
707
 
709
708
  // node_modules/swiper/modules/a11y.mjs
710
- function A11y({
711
- swiper,
712
- extendParams,
713
- on
714
- }) {
709
+ function A11y(_ref) {
710
+ let {
711
+ swiper,
712
+ extendParams,
713
+ on
714
+ } = _ref;
715
715
  extendParams({
716
716
  a11y: {
717
717
  enabled: true,
@@ -724,27 +724,26 @@ function A11y({
724
724
  slideLabelMessage: "{{index}} / {{slidesLength}}",
725
725
  containerMessage: null,
726
726
  containerRoleDescriptionMessage: null,
727
- containerRole: null,
728
727
  itemRoleDescriptionMessage: null,
729
728
  slideRole: "group",
730
- id: null,
731
- scrollOnFocus: true,
732
- wrapperLiveRegion: true
729
+ id: null
733
730
  }
734
731
  });
735
732
  swiper.a11y = {
736
733
  clicked: false
737
734
  };
738
735
  let liveRegion = null;
739
- let preventFocusHandler;
740
- let focusTargetSlideEl;
741
- let visibilityChangedTimestamp = (/* @__PURE__ */ new Date()).getTime();
742
736
  function notify(message) {
743
737
  const notification = liveRegion;
744
738
  if (notification.length === 0) return;
745
- setInnerHTML(notification, message);
739
+ notification.innerHTML = "";
740
+ notification.innerHTML = message;
746
741
  }
747
- function getRandomNumber(size = 16) {
742
+ const makeElementsArray = (el) => (Array.isArray(el) ? el : [el]).filter((e) => !!e);
743
+ function getRandomNumber(size) {
744
+ if (size === void 0) {
745
+ size = 16;
746
+ }
748
747
  const randomChar = () => Math.round(16 * Math.random()).toString(16);
749
748
  return "x".repeat(size).replace(/x/g, randomChar);
750
749
  }
@@ -772,6 +771,12 @@ function A11y({
772
771
  subEl.setAttribute("aria-roledescription", description);
773
772
  });
774
773
  }
774
+ function addElControls(el, controls) {
775
+ el = makeElementsArray(el);
776
+ el.forEach((subEl) => {
777
+ subEl.setAttribute("aria-controls", controls);
778
+ });
779
+ }
775
780
  function addElLabel(el, label) {
776
781
  el = makeElementsArray(el);
777
782
  el.forEach((subEl) => {
@@ -799,7 +804,7 @@ function A11y({
799
804
  function enableEl(el) {
800
805
  el = makeElementsArray(el);
801
806
  el.forEach((subEl) => {
802
- subEl.removeAttribute("aria-disabled");
807
+ subEl.setAttribute("aria-disabled", false);
803
808
  });
804
809
  }
805
810
  function onEnterOrSpaceKey(e) {
@@ -809,28 +814,24 @@ function A11y({
809
814
  if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {
810
815
  if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;
811
816
  }
812
- if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) {
813
- const prevEls = makeElementsArray(swiper.navigation.prevEl);
814
- const nextEls = makeElementsArray(swiper.navigation.nextEl);
815
- if (nextEls.includes(targetEl)) {
816
- if (!(swiper.isEnd && !swiper.params.loop)) {
817
- swiper.slideNext();
818
- }
819
- if (swiper.isEnd) {
820
- notify(params.lastSlideMessage);
821
- } else {
822
- notify(params.nextSlideMessage);
823
- }
817
+ if (swiper.navigation && swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl) {
818
+ if (!(swiper.isEnd && !swiper.params.loop)) {
819
+ swiper.slideNext();
824
820
  }
825
- if (prevEls.includes(targetEl)) {
826
- if (!(swiper.isBeginning && !swiper.params.loop)) {
827
- swiper.slidePrev();
828
- }
829
- if (swiper.isBeginning) {
830
- notify(params.firstSlideMessage);
831
- } else {
832
- notify(params.prevSlideMessage);
833
- }
821
+ if (swiper.isEnd) {
822
+ notify(params.lastSlideMessage);
823
+ } else {
824
+ notify(params.nextSlideMessage);
825
+ }
826
+ }
827
+ if (swiper.navigation && swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl) {
828
+ if (!(swiper.isBeginning && !swiper.params.loop)) {
829
+ swiper.slidePrev();
830
+ }
831
+ if (swiper.isBeginning) {
832
+ notify(params.firstSlideMessage);
833
+ } else {
834
+ notify(params.prevSlideMessage);
834
835
  }
835
836
  }
836
837
  if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {
@@ -893,15 +894,12 @@ function A11y({
893
894
  el.addEventListener("keydown", onEnterOrSpaceKey);
894
895
  }
895
896
  addElLabel(el, message);
897
+ addElControls(el, wrapperId);
896
898
  };
897
- const handlePointerDown = (e) => {
898
- if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) {
899
- preventFocusHandler = true;
900
- }
899
+ const handlePointerDown = () => {
901
900
  swiper.a11y.clicked = true;
902
901
  };
903
902
  const handlePointerUp = () => {
904
- preventFocusHandler = false;
905
903
  requestAnimationFrame(() => {
906
904
  requestAnimationFrame(() => {
907
905
  if (!swiper.destroyed) {
@@ -910,17 +908,11 @@ function A11y({
910
908
  });
911
909
  });
912
910
  };
913
- const onVisibilityChange = (e) => {
914
- visibilityChangedTimestamp = (/* @__PURE__ */ new Date()).getTime();
915
- };
916
911
  const handleFocus = (e) => {
917
- if (swiper.a11y.clicked || !swiper.params.a11y.scrollOnFocus) return;
918
- if ((/* @__PURE__ */ new Date()).getTime() - visibilityChangedTimestamp < 100) return;
912
+ if (swiper.a11y.clicked) return;
919
913
  const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
920
914
  if (!slideEl || !swiper.slides.includes(slideEl)) return;
921
- focusTargetSlideEl = slideEl;
922
- const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
923
- const isActive = (isVirtual ? parseInt(slideEl.getAttribute("data-swiper-slide-index"), 10) : swiper.slides.indexOf(slideEl)) === swiper.activeIndex;
915
+ const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
924
916
  const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
925
917
  if (isActive || isVisible) return;
926
918
  if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
@@ -929,17 +921,7 @@ function A11y({
929
921
  } else {
930
922
  swiper.el.scrollTop = 0;
931
923
  }
932
- requestAnimationFrame(() => {
933
- if (preventFocusHandler) return;
934
- if (swiper.params.loop) {
935
- swiper.slideToLoop(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute("data-swiper-slide-index"))), 0);
936
- } else if (isVirtual) {
937
- swiper.slideTo(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute("data-swiper-slide-index"), 10)), 0);
938
- } else {
939
- swiper.slideTo(swiper.getSlideIndexWhenGrid(swiper.slides.indexOf(slideEl)), 0);
940
- }
941
- preventFocusHandler = false;
942
- });
924
+ swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
943
925
  };
944
926
  const initSlides = () => {
945
927
  const params = swiper.params.a11y;
@@ -968,16 +950,11 @@ function A11y({
968
950
  if (params.containerMessage) {
969
951
  addElLabel(containerEl, params.containerMessage);
970
952
  }
971
- if (params.containerRole) {
972
- addElRole(containerEl, params.containerRole);
973
- }
974
953
  const wrapperEl = swiper.wrapperEl;
975
954
  const wrapperId = params.id || wrapperEl.getAttribute("id") || `swiper-wrapper-${getRandomNumber(16)}`;
955
+ const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? "off" : "polite";
976
956
  addElId(wrapperEl, wrapperId);
977
- if (params.wrapperLiveRegion) {
978
- const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? "off" : "polite";
979
- addElLive(wrapperEl, live);
980
- }
957
+ addElLive(wrapperEl, live);
981
958
  initSlides();
982
959
  let {
983
960
  nextEl,
@@ -992,13 +969,11 @@ function A11y({
992
969
  prevEl.forEach((el) => initNavEl(el, wrapperId, params.prevSlideMessage));
993
970
  }
994
971
  if (hasClickablePagination()) {
995
- const paginationEl = makeElementsArray(swiper.pagination.el);
972
+ const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
996
973
  paginationEl.forEach((el) => {
997
974
  el.addEventListener("keydown", onEnterOrSpaceKey);
998
975
  });
999
976
  }
1000
- const document2 = getDocument();
1001
- document2.addEventListener("visibilitychange", onVisibilityChange);
1002
977
  swiper.el.addEventListener("focus", handleFocus, true);
1003
978
  swiper.el.addEventListener("pointerdown", handlePointerDown, true);
1004
979
  swiper.el.addEventListener("pointerup", handlePointerUp, true);
@@ -1018,18 +993,14 @@ function A11y({
1018
993
  prevEl.forEach((el) => el.removeEventListener("keydown", onEnterOrSpaceKey));
1019
994
  }
1020
995
  if (hasClickablePagination()) {
1021
- const paginationEl = makeElementsArray(swiper.pagination.el);
996
+ const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
1022
997
  paginationEl.forEach((el) => {
1023
998
  el.removeEventListener("keydown", onEnterOrSpaceKey);
1024
999
  });
1025
1000
  }
1026
- const document2 = getDocument();
1027
- document2.removeEventListener("visibilitychange", onVisibilityChange);
1028
- if (swiper.el && typeof swiper.el !== "string") {
1029
- swiper.el.removeEventListener("focus", handleFocus, true);
1030
- swiper.el.removeEventListener("pointerdown", handlePointerDown, true);
1031
- swiper.el.removeEventListener("pointerup", handlePointerUp, true);
1032
- }
1001
+ swiper.el.removeEventListener("focus", handleFocus, true);
1002
+ swiper.el.removeEventListener("pointerdown", handlePointerDown, true);
1003
+ swiper.el.removeEventListener("pointerup", handlePointerUp, true);
1033
1004
  }
1034
1005
  on("beforeInit", () => {
1035
1006
  liveRegion = createElement("span", swiper.params.a11y.notificationClass);
@@ -1059,13 +1030,14 @@ function A11y({
1059
1030
  }
1060
1031
 
1061
1032
  // node_modules/swiper/modules/autoplay.mjs
1062
- function Autoplay({
1063
- swiper,
1064
- extendParams,
1065
- on,
1066
- emit,
1067
- params
1068
- }) {
1033
+ function Autoplay(_ref) {
1034
+ let {
1035
+ swiper,
1036
+ extendParams,
1037
+ on,
1038
+ emit,
1039
+ params
1040
+ } = _ref;
1069
1041
  swiper.autoplay = {
1070
1042
  running: false,
1071
1043
  paused: false,
@@ -1076,7 +1048,7 @@ function Autoplay({
1076
1048
  enabled: false,
1077
1049
  delay: 3e3,
1078
1050
  waitForTransition: true,
1079
- disableOnInteraction: false,
1051
+ disableOnInteraction: true,
1080
1052
  stopOnLastSlide: false,
1081
1053
  reverseDirection: false,
1082
1054
  pauseOnMouseEnter: false
@@ -1087,20 +1059,17 @@ function Autoplay({
1087
1059
  let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3e3;
1088
1060
  let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3e3;
1089
1061
  let autoplayTimeLeft;
1090
- let autoplayStartTime = (/* @__PURE__ */ new Date()).getTime();
1062
+ let autoplayStartTime = (/* @__PURE__ */ new Date()).getTime;
1091
1063
  let wasPaused;
1092
1064
  let isTouched;
1093
1065
  let pausedByTouch;
1094
1066
  let touchStartTimeout;
1067
+ let slideChanged;
1095
1068
  let pausedByInteraction;
1096
- let pausedByPointerEnter;
1097
1069
  function onTransitionEnd(e) {
1098
1070
  if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
1099
1071
  if (e.target !== swiper.wrapperEl) return;
1100
1072
  swiper.wrapperEl.removeEventListener("transitionend", onTransitionEnd);
1101
- if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) {
1102
- return;
1103
- }
1104
1073
  resume();
1105
1074
  }
1106
1075
  const calcTimeLeft = () => {
@@ -1121,7 +1090,7 @@ function Autoplay({
1121
1090
  const getSlideDelay = () => {
1122
1091
  let activeSlideEl;
1123
1092
  if (swiper.virtual && swiper.params.virtual.enabled) {
1124
- activeSlideEl = swiper.slides.find((slideEl) => slideEl.classList.contains("swiper-slide-active"));
1093
+ activeSlideEl = swiper.slides.filter((slideEl) => slideEl.classList.contains("swiper-slide-active"))[0];
1125
1094
  } else {
1126
1095
  activeSlideEl = swiper.slides[swiper.activeIndex];
1127
1096
  }
@@ -1129,23 +1098,18 @@ function Autoplay({
1129
1098
  const currentSlideDelay = parseInt(activeSlideEl.getAttribute("data-swiper-autoplay"), 10);
1130
1099
  return currentSlideDelay;
1131
1100
  };
1132
- const getTotalDelay = () => {
1133
- let totalDelay = swiper.params.autoplay.delay;
1134
- const currentSlideDelay = getSlideDelay();
1135
- if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0) {
1136
- totalDelay = currentSlideDelay;
1137
- }
1138
- return totalDelay;
1139
- };
1140
1101
  const run = (delayForce) => {
1141
1102
  if (swiper.destroyed || !swiper.autoplay.running) return;
1142
1103
  cancelAnimationFrame(raf);
1143
1104
  calcTimeLeft();
1144
- let delay = delayForce;
1145
- if (typeof delay === "undefined") {
1146
- delay = getTotalDelay();
1147
- autoplayDelayTotal = delay;
1148
- autoplayDelayCurrent = delay;
1105
+ let delay = typeof delayForce === "undefined" ? swiper.params.autoplay.delay : delayForce;
1106
+ autoplayDelayTotal = swiper.params.autoplay.delay;
1107
+ autoplayDelayCurrent = swiper.params.autoplay.delay;
1108
+ const currentSlideDelay = getSlideDelay();
1109
+ if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === "undefined") {
1110
+ delay = currentSlideDelay;
1111
+ autoplayDelayTotal = currentSlideDelay;
1112
+ autoplayDelayCurrent = currentSlideDelay;
1149
1113
  }
1150
1114
  autoplayTimeLeft = delay;
1151
1115
  const speed = swiper.params.speed;
@@ -1188,7 +1152,6 @@ function Autoplay({
1188
1152
  return delay;
1189
1153
  };
1190
1154
  const start = () => {
1191
- autoplayStartTime = (/* @__PURE__ */ new Date()).getTime();
1192
1155
  swiper.autoplay.running = true;
1193
1156
  run();
1194
1157
  emit("autoplayStart");
@@ -1215,6 +1178,10 @@ function Autoplay({
1215
1178
  };
1216
1179
  swiper.autoplay.paused = true;
1217
1180
  if (reset) {
1181
+ if (slideChanged) {
1182
+ autoplayTimeLeft = swiper.params.autoplay.delay;
1183
+ }
1184
+ slideChanged = false;
1218
1185
  proceed();
1219
1186
  return;
1220
1187
  }
@@ -1250,13 +1217,11 @@ function Autoplay({
1250
1217
  const onPointerEnter = (e) => {
1251
1218
  if (e.pointerType !== "mouse") return;
1252
1219
  pausedByInteraction = true;
1253
- pausedByPointerEnter = true;
1254
1220
  if (swiper.animating || swiper.autoplay.paused) return;
1255
1221
  pause(true);
1256
1222
  };
1257
1223
  const onPointerLeave = (e) => {
1258
1224
  if (e.pointerType !== "mouse") return;
1259
- pausedByPointerEnter = false;
1260
1225
  if (swiper.autoplay.paused) {
1261
1226
  resume();
1262
1227
  }
@@ -1268,10 +1233,8 @@ function Autoplay({
1268
1233
  }
1269
1234
  };
1270
1235
  const detachMouseEvents = () => {
1271
- if (swiper.el && typeof swiper.el !== "string") {
1272
- swiper.el.removeEventListener("pointerenter", onPointerEnter);
1273
- swiper.el.removeEventListener("pointerleave", onPointerLeave);
1274
- }
1236
+ swiper.el.removeEventListener("pointerenter", onPointerEnter);
1237
+ swiper.el.removeEventListener("pointerleave", onPointerLeave);
1275
1238
  };
1276
1239
  const attachDocumentEvents = () => {
1277
1240
  const document2 = getDocument();
@@ -1285,6 +1248,7 @@ function Autoplay({
1285
1248
  if (swiper.params.autoplay.enabled) {
1286
1249
  attachMouseEvents();
1287
1250
  attachDocumentEvents();
1251
+ autoplayStartTime = (/* @__PURE__ */ new Date()).getTime();
1288
1252
  start();
1289
1253
  }
1290
1254
  });
@@ -1295,18 +1259,6 @@ function Autoplay({
1295
1259
  stop();
1296
1260
  }
1297
1261
  });
1298
- on("_freeModeStaticRelease", () => {
1299
- if (pausedByTouch || pausedByInteraction) {
1300
- resume();
1301
- }
1302
- });
1303
- on("_freeModeNoMomentumRelease", () => {
1304
- if (!swiper.params.autoplay.disableOnInteraction) {
1305
- pause(true, true);
1306
- } else {
1307
- stop();
1308
- }
1309
- });
1310
1262
  on("beforeTransitionStart", (_s, speed, internal) => {
1311
1263
  if (swiper.destroyed || !swiper.autoplay.running) return;
1312
1264
  if (internal || !swiper.params.autoplay.disableOnInteraction) {
@@ -1345,10 +1297,7 @@ function Autoplay({
1345
1297
  });
1346
1298
  on("slideChange", () => {
1347
1299
  if (swiper.destroyed || !swiper.autoplay.running) return;
1348
- if (swiper.autoplay.paused) {
1349
- autoplayTimeLeft = getTotalDelay();
1350
- autoplayDelayTotal = getTotalDelay();
1351
- }
1300
+ slideChanged = true;
1352
1301
  });
1353
1302
  Object.assign(swiper.autoplay, {
1354
1303
  start,