hexo-theme-linen 1.0.18 → 1.0.20

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.
@@ -121,9 +121,7 @@ function setTransitionStyle(el, prop, duration, ease) {
121
121
  // inOut: 'cubic-bezier(.4, 0, .22, 1)', // for "toggle state" transitions
122
122
  // out: 'cubic-bezier(0, 0, .22, 1)', // for "show" transitions
123
123
  // in: 'cubic-bezier(.4, 0, 1, 1)'// for "hide" transitions
124
- el.style.transition = prop
125
- ? `${prop} ${duration}ms ${ease || defaultCSSEasing}`
126
- : "none";
124
+ el.style.transition = prop ? `${prop} ${duration}ms ${ease || defaultCSSEasing}` : "none";
127
125
  }
128
126
 
129
127
  /**
@@ -150,9 +148,6 @@ function removeTransitionStyle(el) {
150
148
  * @returns {Promise<HTMLImageElement | void>}
151
149
  */
152
150
  function decodeImage(img) {
153
- if ("decode" in img) {
154
- return img.decode().catch(() => {});
155
- }
156
151
  if (img.complete) {
157
152
  return Promise.resolve(img);
158
153
  }
@@ -168,7 +163,7 @@ const LOAD_STATE = {
168
163
  IDLE: "idle",
169
164
  LOADING: "loading",
170
165
  LOADED: "loaded",
171
- ERROR: "error",
166
+ ERROR: "error"
172
167
  };
173
168
 
174
169
  /**
@@ -179,13 +174,7 @@ const LOAD_STATE = {
179
174
  * @returns {boolean}
180
175
  */
181
176
  function specialKeyUsed(e) {
182
- return (
183
- ("button" in e && e.button === 1) ||
184
- e.ctrlKey ||
185
- e.metaKey ||
186
- e.altKey ||
187
- e.shiftKey
188
- );
177
+ return ("button" in e && e.button === 1) || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey;
189
178
  }
190
179
 
191
180
  /**
@@ -232,7 +221,7 @@ try {
232
221
  Object.defineProperty({}, "passive", {
233
222
  get: () => {
234
223
  supportsPassive = true;
235
- },
224
+ }
236
225
  })
237
226
  );
238
227
  } catch (e) {}
@@ -333,7 +322,7 @@ class DOMEvents {
333
322
  target,
334
323
  type: eType,
335
324
  listener,
336
- passive,
325
+ passive
337
326
  });
338
327
  }
339
328
  }
@@ -342,7 +331,7 @@ class DOMEvents {
342
331
  // and we do not need browser to scroll the page
343
332
  const eventOptions = supportsPassive
344
333
  ? {
345
- passive: passive || false,
334
+ passive: passive || false
346
335
  }
347
336
  : false;
348
337
  target[methodName](eType, listener, eventOptions);
@@ -374,7 +363,7 @@ function getViewportSize(options, pswp) {
374
363
  // find a way to improve this
375
364
  //
376
365
  // document.documentElement.clientHeight - doesn't seem to work well
377
- y: window.innerHeight,
366
+ y: window.innerHeight
378
367
  };
379
368
  }
380
369
 
@@ -446,7 +435,7 @@ function getPanAreaSize(options, viewportSize, itemData, index) {
446
435
  y:
447
436
  viewportSize.y -
448
437
  parsePaddingOption("top", options, viewportSize, itemData, index) -
449
- parsePaddingOption("bottom", options, viewportSize, itemData, index),
438
+ parsePaddingOption("bottom", options, viewportSize, itemData, index)
450
439
  };
451
440
  }
452
441
 
@@ -466,15 +455,15 @@ class PanBounds {
466
455
  this.currZoomLevel = 1;
467
456
  this.center = /** @type {Point} */ {
468
457
  x: 0,
469
- y: 0,
458
+ y: 0
470
459
  };
471
460
  this.max = /** @type {Point} */ {
472
461
  x: 0,
473
- y: 0,
462
+ y: 0
474
463
  };
475
464
  this.min = /** @type {Point} */ {
476
465
  x: 0,
477
- y: 0,
466
+ y: 0
478
467
  };
479
468
  }
480
469
 
@@ -491,7 +480,7 @@ class PanBounds {
491
480
  this._updateAxis("x");
492
481
  this._updateAxis("y");
493
482
  this.slide.pswp.dispatch("calcBounds", {
494
- slide: this.slide,
483
+ slide: this.slide
495
484
  });
496
485
  }
497
486
  }
@@ -503,8 +492,7 @@ class PanBounds {
503
492
  */
504
493
  _updateAxis(axis) {
505
494
  const { pswp } = this.slide;
506
- const elSize =
507
- this.slide[axis === "x" ? "width" : "height"] * this.currZoomLevel;
495
+ const elSize = this.slide[axis === "x" ? "width" : "height"] * this.currZoomLevel;
508
496
  const paddingProp = axis === "x" ? "left" : "top";
509
497
  const padding = parsePaddingOption(
510
498
  paddingProp,
@@ -521,9 +509,7 @@ class PanBounds {
521
509
 
522
510
  // maximum pan position
523
511
  this.max[axis] =
524
- elSize > panAreaSize
525
- ? Math.round(panAreaSize - elSize) + padding
526
- : this.center[axis];
512
+ elSize > panAreaSize ? Math.round(panAreaSize - elSize) + padding : this.center[axis];
527
513
 
528
514
  // minimum pan position
529
515
  this.min[axis] = elSize > panAreaSize ? padding : this.center[axis];
@@ -603,7 +589,7 @@ class ZoomLevel {
603
589
  /** @type {Point} */
604
590
  const elementSize = {
605
591
  x: maxWidth,
606
- y: maxHeight,
592
+ y: maxHeight
607
593
  };
608
594
  this.elementSize = elementSize;
609
595
  this.panAreaSize = panAreaSize;
@@ -622,7 +608,7 @@ class ZoomLevel {
622
608
  if (this.pswp) {
623
609
  this.pswp.dispatch("zoomLevelsUpdate", {
624
610
  zoomLevels: this,
625
- slideData: this.itemData,
611
+ slideData: this.itemData
626
612
  });
627
613
  }
628
614
  }
@@ -671,10 +657,7 @@ class ZoomLevel {
671
657
 
672
658
  // 3x of "fit" state, but not larger than original
673
659
  currZoomLevel = Math.min(1, this.fit * 3);
674
- if (
675
- this.elementSize &&
676
- currZoomLevel * this.elementSize.x > MAX_IMAGE_WIDTH
677
- ) {
660
+ if (this.elementSize && currZoomLevel * this.elementSize.x > MAX_IMAGE_WIDTH) {
678
661
  currZoomLevel = MAX_IMAGE_WIDTH / this.elementSize.x;
679
662
  }
680
663
  return currZoomLevel;
@@ -725,19 +708,19 @@ class Slide {
725
708
  /** @type {Point} */
726
709
  this.panAreaSize = {
727
710
  x: 0,
728
- y: 0,
711
+ y: 0
729
712
  };
730
713
  /** @type {Point} */
731
714
  this.pan = {
732
715
  x: 0,
733
- y: 0,
716
+ y: 0
734
717
  };
735
718
  this.isFirstSlide = this.isActive && !pswp.opener.isOpen;
736
719
  this.zoomLevels = new ZoomLevel(pswp.options, data, index, pswp);
737
720
  this.pswp.dispatch("gettingData", {
738
721
  slide: this,
739
722
  data: this.data,
740
- index,
723
+ index
741
724
  });
742
725
  this.content = this.pswp.contentLoader.getContentBySlide(this);
743
726
  this.container = createElement("pswp__zoom-wrap", "div");
@@ -753,7 +736,7 @@ class Slide {
753
736
  this.prevDisplayedWidth = -1;
754
737
  this.prevDisplayedHeight = -1;
755
738
  this.pswp.dispatch("slideInit", {
756
- slide: this,
739
+ slide: this
757
740
  });
758
741
  }
759
742
 
@@ -792,11 +775,11 @@ class Slide {
792
775
  this.holderElement.appendChild(this.container);
793
776
  this.zoomAndPanToInitial();
794
777
  this.pswp.dispatch("firstZoomPan", {
795
- slide: this,
778
+ slide: this
796
779
  });
797
780
  this.applyCurrentZoomPan();
798
781
  this.pswp.dispatch("afterSetContent", {
799
- slide: this,
782
+ slide: this
800
783
  });
801
784
  if (this.isActive) {
802
785
  this.activate();
@@ -805,7 +788,7 @@ class Slide {
805
788
  load() {
806
789
  this.content.load(false);
807
790
  this.pswp.dispatch("slideLoad", {
808
- slide: this,
791
+ slide: this
809
792
  });
810
793
  }
811
794
 
@@ -830,7 +813,7 @@ class Slide {
830
813
  }
831
814
  if (
832
815
  this.pswp.dispatch("appendHeavy", {
833
- slide: this,
816
+ slide: this
834
817
  }).defaultPrevented
835
818
  ) {
836
819
  return;
@@ -838,7 +821,7 @@ class Slide {
838
821
  this.heavyAppended = true;
839
822
  this.content.append();
840
823
  this.pswp.dispatch("appendHeavyContent", {
841
- slide: this,
824
+ slide: this
842
825
  });
843
826
  }
844
827
 
@@ -853,7 +836,7 @@ class Slide {
853
836
  this.appendHeavy();
854
837
  this.content.activate();
855
838
  this.pswp.dispatch("slideActivate", {
856
- slide: this,
839
+ slide: this
857
840
  });
858
841
  }
859
842
 
@@ -876,7 +859,7 @@ class Slide {
876
859
  this.applyCurrentZoomPan();
877
860
  this.updateContentSize();
878
861
  this.pswp.dispatch("slideDeactivate", {
879
- slide: this,
862
+ slide: this
880
863
  });
881
864
  }
882
865
 
@@ -889,7 +872,7 @@ class Slide {
889
872
  this.content.remove();
890
873
  this.container.remove();
891
874
  this.pswp.dispatch("slideDestroy", {
892
- slide: this,
875
+ slide: this
893
876
  });
894
877
  }
895
878
  resize() {
@@ -924,10 +907,8 @@ class Slide {
924
907
  if (!scaleMultiplier) {
925
908
  return;
926
909
  }
927
- const width =
928
- Math.round(this.width * scaleMultiplier) || this.pswp.viewportSize.x;
929
- const height =
930
- Math.round(this.height * scaleMultiplier) || this.pswp.viewportSize.y;
910
+ const width = Math.round(this.width * scaleMultiplier) || this.pswp.viewportSize.x;
911
+ const height = Math.round(this.height * scaleMultiplier) || this.pswp.viewportSize.y;
931
912
  if (!this.sizeChanged(width, height) && !force) {
932
913
  return;
933
914
  }
@@ -939,10 +920,7 @@ class Slide {
939
920
  * @param {number} height
940
921
  */
941
922
  sizeChanged(width, height) {
942
- if (
943
- width !== this.prevDisplayedWidth ||
944
- height !== this.prevDisplayedHeight
945
- ) {
923
+ if (width !== this.prevDisplayedWidth || height !== this.prevDisplayedHeight) {
946
924
  this.prevDisplayedWidth = width;
947
925
  this.prevDisplayedHeight = height;
948
926
  return true;
@@ -976,7 +954,7 @@ class Slide {
976
954
  pswp.dispatch("beforeZoomTo", {
977
955
  destZoomLevel,
978
956
  centerPoint,
979
- transitionDuration,
957
+ transitionDuration
980
958
  });
981
959
 
982
960
  // stop all pan and zoom transitions
@@ -988,11 +966,7 @@ class Slide {
988
966
 
989
967
  const prevZoomLevel = this.currZoomLevel;
990
968
  if (!ignoreBounds) {
991
- destZoomLevel = clamp(
992
- destZoomLevel,
993
- this.zoomLevels.min,
994
- this.zoomLevels.max
995
- );
969
+ destZoomLevel = clamp(destZoomLevel, this.zoomLevels.min, this.zoomLevels.max);
996
970
  }
997
971
 
998
972
  // if (transitionDuration === undefined) {
@@ -1019,7 +993,7 @@ class Slide {
1019
993
  transform: this.getCurrentTransform(),
1020
994
  onComplete: finishTransition,
1021
995
  duration: transitionDuration,
1022
- easing: pswp.options.easing,
996
+ easing: pswp.options.easing
1023
997
  });
1024
998
  }
1025
999
  }
@@ -1073,10 +1047,7 @@ class Slide {
1073
1047
  prevZoomLevel = this.zoomLevels.initial;
1074
1048
  }
1075
1049
  const zoomFactor = this.currZoomLevel / prevZoomLevel;
1076
- return this.bounds.correctPan(
1077
- axis,
1078
- (this.pan[axis] - point[axis]) * zoomFactor + point[axis]
1079
- );
1050
+ return this.bounds.correctPan(axis, (this.pan[axis] - point[axis]) * zoomFactor + point[axis]);
1080
1051
  }
1081
1052
 
1082
1053
  /**
@@ -1112,10 +1083,7 @@ class Slide {
1112
1083
  * the current pan position (this.pan) and zoom level (this.currZoomLevel)
1113
1084
  */
1114
1085
  applyCurrentZoomPan() {
1115
- if (
1116
- this.pswp.gestures.isDragging &&
1117
- !this.pswp.element.classList.contains("action-updating")
1118
- ) {
1086
+ if (this.pswp.gestures.isDragging && !this.pswp.element.classList.contains("action-updating")) {
1119
1087
  this.pswp.element.classList.add("action-updating");
1120
1088
  }
1121
1089
  // else if(!this.pswp.gestures.isDragging && this.pswp.element.classList.contains('action-updating')) {
@@ -1124,7 +1092,7 @@ class Slide {
1124
1092
  this._applyZoomTransform(this.pan.x, this.pan.y, this.currZoomLevel);
1125
1093
  if (this === this.pswp.currSlide) {
1126
1094
  this.pswp.dispatch("zoomPanUpdate", {
1127
- slide: this,
1095
+ slide: this
1128
1096
  });
1129
1097
  }
1130
1098
  }
@@ -1135,7 +1103,7 @@ class Slide {
1135
1103
  this.bounds.update(this.currZoomLevel);
1136
1104
  equalizePoints(this.pan, this.bounds.center);
1137
1105
  this.pswp.dispatch("initialZoomPan", {
1138
- slide: this,
1106
+ slide: this
1139
1107
  });
1140
1108
  }
1141
1109
 
@@ -1159,14 +1127,13 @@ class Slide {
1159
1127
  );
1160
1128
  this.zoomLevels.update(this.width, this.height, this.panAreaSize);
1161
1129
  pswp.dispatch("calcSlideSize", {
1162
- slide: this,
1130
+ slide: this
1163
1131
  });
1164
1132
  }
1165
1133
 
1166
1134
  /** @returns {string} */
1167
1135
  getCurrentTransform() {
1168
- const scale =
1169
- this.currZoomLevel / (this.currentResolution || this.zoomLevels.initial);
1136
+ const scale = this.currZoomLevel / (this.currentResolution || this.zoomLevels.initial);
1170
1137
  return toTransformString(this.pan.x, this.pan.y, scale);
1171
1138
  }
1172
1139
 
@@ -1230,7 +1197,7 @@ class DragHandler {
1230
1197
  /** @type {Point} */
1231
1198
  this.startPan = {
1232
1199
  x: 0,
1233
- y: 0,
1200
+ y: 0
1234
1201
  };
1235
1202
  }
1236
1203
  start() {
@@ -1253,12 +1220,11 @@ class DragHandler {
1253
1220
  const panY = currSlide.pan.y + (p1.y - prevP1.y);
1254
1221
  if (
1255
1222
  !this.pswp.dispatch("verticalDrag", {
1256
- panY,
1223
+ panY
1257
1224
  }).defaultPrevented
1258
1225
  ) {
1259
1226
  this._setPanWithFriction("y", panY, VERTICAL_DRAG_FRICTION);
1260
- const bgOpacity =
1261
- 1 - Math.abs(this._getVerticalDragRatio(currSlide.pan.y));
1227
+ const bgOpacity = 1 - Math.abs(this._getVerticalDragRatio(currSlide.pan.y));
1262
1228
  this.pswp.applyBgOpacity(bgOpacity);
1263
1229
  currSlide.applyCurrentZoomPan();
1264
1230
  }
@@ -1288,8 +1254,7 @@ class DragHandler {
1288
1254
  // 0 - slide is not visible at all,
1289
1255
  // 0.5 - half of the slide is visible
1290
1256
  // 1 - slide is fully visible
1291
- const currentSlideVisibilityRatio =
1292
- mainScrollShiftDiff / this.pswp.viewportSize.x;
1257
+ const currentSlideVisibilityRatio = mainScrollShiftDiff / this.pswp.viewportSize.x;
1293
1258
 
1294
1259
  // Go next slide.
1295
1260
  //
@@ -1300,16 +1265,14 @@ class DragHandler {
1300
1265
  // and velocity is close to 0
1301
1266
  //
1302
1267
  if (
1303
- (velocity.x < -MIN_NEXT_SLIDE_SPEED &&
1304
- currentSlideVisibilityRatio < 0) ||
1268
+ (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0) ||
1305
1269
  (velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5)
1306
1270
  ) {
1307
1271
  // Go to next slide
1308
1272
  indexDiff = 1;
1309
1273
  velocity.x = Math.min(velocity.x, 0);
1310
1274
  } else if (
1311
- (velocity.x > MIN_NEXT_SLIDE_SPEED &&
1312
- currentSlideVisibilityRatio > 0) ||
1275
+ (velocity.x > MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio > 0) ||
1313
1276
  (velocity.x > -0.1 && currentSlideVisibilityRatio > 0.5)
1314
1277
  ) {
1315
1278
  // Go to prev slide
@@ -1354,8 +1317,7 @@ class DragHandler {
1354
1317
  const decelerationRate = 0.995; // 0.99
1355
1318
 
1356
1319
  // Pan position if there is no bounds
1357
- const projectedPosition =
1358
- panPos + project(velocity[axis], decelerationRate);
1320
+ const projectedPosition = panPos + project(velocity[axis], decelerationRate);
1359
1321
  if (restoreBgOpacity) {
1360
1322
  const vDragRatio = this._getVerticalDragRatio(panPos);
1361
1323
  const projectedVDragRatio = this._getVerticalDragRatio(projectedPosition);
@@ -1398,19 +1360,13 @@ class DragHandler {
1398
1360
  // Animate opacity of background relative to Y pan position of an image
1399
1361
  if (restoreBgOpacity && this.pswp.bgOpacity < 1) {
1400
1362
  // 0 - start of animation, 1 - end of animation
1401
- const animationProgressRatio =
1402
- 1 - (correctedPanPosition - pos) / totalPanDist;
1363
+ const animationProgressRatio = 1 - (correctedPanPosition - pos) / totalPanDist;
1403
1364
 
1404
1365
  // We clamp opacity to keep it between 0 and 1.
1405
1366
  // As progress ratio can be larger than 1 due to overshoot,
1406
1367
  // and we do not want to bounce opacity.
1407
1368
  this.pswp.applyBgOpacity(
1408
- clamp(
1409
- initialBgOpacity +
1410
- (1 - initialBgOpacity) * animationProgressRatio,
1411
- 0,
1412
- 1
1413
- )
1369
+ clamp(initialBgOpacity + (1 - initialBgOpacity) * animationProgressRatio, 0, 1)
1414
1370
  );
1415
1371
  }
1416
1372
  pan[axis] = Math.floor(pos);
@@ -1420,7 +1376,7 @@ class DragHandler {
1420
1376
  if (this.pswp.element.classList.contains("action-updating")) {
1421
1377
  this.pswp.element.classList.remove("action-updating");
1422
1378
  }
1423
- },
1379
+ }
1424
1380
  });
1425
1381
  }
1426
1382
 
@@ -1450,12 +1406,7 @@ class DragHandler {
1450
1406
  }
1451
1407
  const { bounds } = currSlide;
1452
1408
  const newPan = currSlide.pan[axis] + delta;
1453
- if (
1454
- this.pswp.options.allowPanToNext &&
1455
- dragAxis === "x" &&
1456
- axis === "x" &&
1457
- !isMultitouch
1458
- ) {
1409
+ if (this.pswp.options.allowPanToNext && dragAxis === "x" && axis === "x" && !isMultitouch) {
1459
1410
  const currSlideMainScrollX = mainScroll.getCurrSlideX();
1460
1411
 
1461
1412
  // Position of the main scroll relative to the viewport
@@ -1493,17 +1444,11 @@ class DragHandler {
1493
1444
  if (mainScrollShiftDiff !== 0) {
1494
1445
  // If main scroll is shifted right
1495
1446
  if (mainScrollShiftDiff > 0 /*&& isRightToLeft*/) {
1496
- mainScroll.moveTo(
1497
- Math.max(newMainScrollX, currSlideMainScrollX),
1498
- true
1499
- );
1447
+ mainScroll.moveTo(Math.max(newMainScrollX, currSlideMainScrollX), true);
1500
1448
  return true;
1501
1449
  } else if (mainScrollShiftDiff < 0 /*&& isLeftToRight*/) {
1502
1450
  // Main scroll is shifted left (Position is less than 0 comparing to the viewport 0)
1503
- mainScroll.moveTo(
1504
- Math.min(newMainScrollX, currSlideMainScrollX),
1505
- true
1506
- );
1451
+ mainScroll.moveTo(Math.min(newMainScrollX, currSlideMainScrollX), true);
1507
1452
  return true;
1508
1453
  }
1509
1454
  } else {
@@ -1543,11 +1488,9 @@ class DragHandler {
1543
1488
  return (
1544
1489
  (panY -
1545
1490
  ((_this$pswp$currSlide$ =
1546
- (_this$pswp$currSlide = this.pswp.currSlide) === null ||
1547
- _this$pswp$currSlide === void 0
1491
+ (_this$pswp$currSlide = this.pswp.currSlide) === null || _this$pswp$currSlide === void 0
1548
1492
  ? void 0
1549
- : _this$pswp$currSlide.bounds.center.y) !== null &&
1550
- _this$pswp$currSlide$ !== void 0
1493
+ : _this$pswp$currSlide.bounds.center.y) !== null && _this$pswp$currSlide$ !== void 0
1551
1494
  ? _this$pswp$currSlide$
1552
1495
  : 0)) /
1553
1496
  (this.pswp.viewportSize.y / 3)
@@ -1612,7 +1555,7 @@ class ZoomHandler {
1612
1555
  */
1613
1556
  this._startPan = {
1614
1557
  x: 0,
1615
- y: 0,
1558
+ y: 0
1616
1559
  };
1617
1560
  /**
1618
1561
  * @private
@@ -1620,7 +1563,7 @@ class ZoomHandler {
1620
1563
  */
1621
1564
  this._startZoomPoint = {
1622
1565
  x: 0,
1623
- y: 0,
1566
+ y: 0
1624
1567
  };
1625
1568
  /**
1626
1569
  * @private
@@ -1628,7 +1571,7 @@ class ZoomHandler {
1628
1571
  */
1629
1572
  this._zoomPoint = {
1630
1573
  x: 0,
1631
- y: 0,
1574
+ y: 0
1632
1575
  };
1633
1576
  /** @private */
1634
1577
  this._wasOverFitZoomLevel = false;
@@ -1663,10 +1606,7 @@ class ZoomHandler {
1663
1606
  this._startZoomLevel;
1664
1607
 
1665
1608
  // slightly over the zoom.fit
1666
- if (
1667
- currZoomLevel >
1668
- currSlide.zoomLevels.initial + currSlide.zoomLevels.initial / 15
1669
- ) {
1609
+ if (currZoomLevel > currSlide.zoomLevels.initial + currSlide.zoomLevels.initial / 15) {
1670
1610
  this._wasOverFitZoomLevel = true;
1671
1611
  }
1672
1612
  if (currZoomLevel < minZoomLevel) {
@@ -1676,24 +1616,21 @@ class ZoomHandler {
1676
1616
  this._startZoomLevel <= currSlide.zoomLevels.initial
1677
1617
  ) {
1678
1618
  // fade out background if zooming out
1679
- const bgOpacity =
1680
- 1 - (minZoomLevel - currZoomLevel) / (minZoomLevel / 1.2);
1619
+ const bgOpacity = 1 - (minZoomLevel - currZoomLevel) / (minZoomLevel / 1.2);
1681
1620
  if (
1682
1621
  !pswp.dispatch("pinchClose", {
1683
- bgOpacity,
1622
+ bgOpacity
1684
1623
  }).defaultPrevented
1685
1624
  ) {
1686
1625
  pswp.applyBgOpacity(bgOpacity);
1687
1626
  }
1688
1627
  } else {
1689
1628
  // Apply the friction if zoom level is below the min
1690
- currZoomLevel =
1691
- minZoomLevel - (minZoomLevel - currZoomLevel) * LOWER_ZOOM_FRICTION;
1629
+ currZoomLevel = minZoomLevel - (minZoomLevel - currZoomLevel) * LOWER_ZOOM_FRICTION;
1692
1630
  }
1693
1631
  } else if (currZoomLevel > maxZoomLevel) {
1694
1632
  // Apply the friction if zoom level is above the max
1695
- currZoomLevel =
1696
- maxZoomLevel + (currZoomLevel - maxZoomLevel) * UPPER_ZOOM_FRICTION;
1633
+ currZoomLevel = maxZoomLevel + (currZoomLevel - maxZoomLevel) * UPPER_ZOOM_FRICTION;
1697
1634
  }
1698
1635
  currSlide.pan.x = this._calculatePanForZoomLevel("x", currZoomLevel);
1699
1636
  currSlide.pan.y = this._calculatePanForZoomLevel("y", currZoomLevel);
@@ -1722,10 +1659,7 @@ class ZoomHandler {
1722
1659
  */
1723
1660
  _calculatePanForZoomLevel(axis, currZoomLevel) {
1724
1661
  const zoomFactor = currZoomLevel / this._startZoomLevel;
1725
- return (
1726
- this._zoomPoint[axis] -
1727
- (this._startZoomPoint[axis] - this._startPan[axis]) * zoomFactor
1728
- );
1662
+ return this._zoomPoint[axis] - (this._startZoomPoint[axis] - this._startPan[axis]) * zoomFactor;
1729
1663
  }
1730
1664
 
1731
1665
  /**
@@ -1739,9 +1673,7 @@ class ZoomHandler {
1739
1673
  correctZoomPan(ignoreGesture) {
1740
1674
  const { pswp } = this.gestures;
1741
1675
  const { currSlide } = pswp;
1742
- if (
1743
- !(currSlide !== null && currSlide !== void 0 && currSlide.isZoomable())
1744
- ) {
1676
+ if (!(currSlide !== null && currSlide !== void 0 && currSlide.isZoomable())) {
1745
1677
  return;
1746
1678
  }
1747
1679
  if (this._zoomPoint.x === 0) {
@@ -1767,14 +1699,14 @@ class ZoomHandler {
1767
1699
  const initialPan = equalizePoints(
1768
1700
  {
1769
1701
  x: 0,
1770
- y: 0,
1702
+ y: 0
1771
1703
  },
1772
1704
  currSlide.pan
1773
1705
  );
1774
1706
  let destinationPan = equalizePoints(
1775
1707
  {
1776
1708
  x: 0,
1777
- y: 0,
1709
+ y: 0
1778
1710
  },
1779
1711
  initialPan
1780
1712
  );
@@ -1789,7 +1721,7 @@ class ZoomHandler {
1789
1721
  if (currZoomLevelNeedsChange) {
1790
1722
  destinationPan = {
1791
1723
  x: this._calculatePanForZoomLevel("x", destinationZoomLevel),
1792
- y: this._calculatePanForZoomLevel("y", destinationZoomLevel),
1724
+ y: this._calculatePanForZoomLevel("y", destinationZoomLevel)
1793
1725
  };
1794
1726
  }
1795
1727
 
@@ -1797,7 +1729,7 @@ class ZoomHandler {
1797
1729
  currSlide.setZoomLevel(destinationZoomLevel);
1798
1730
  destinationPan = {
1799
1731
  x: currSlide.bounds.correctPan("x", destinationPan.x),
1800
- y: currSlide.bounds.correctPan("y", destinationPan.y),
1732
+ y: currSlide.bounds.correctPan("y", destinationPan.y)
1801
1733
  };
1802
1734
 
1803
1735
  // return zoom level and its bounds to initial
@@ -1824,14 +1756,11 @@ class ZoomHandler {
1824
1756
 
1825
1757
  if (panNeedsChange || currZoomLevelNeedsChange) {
1826
1758
  if (panNeedsChange) {
1827
- currSlide.pan.x =
1828
- initialPan.x + (destinationPan.x - initialPan.x) * now;
1829
- currSlide.pan.y =
1830
- initialPan.y + (destinationPan.y - initialPan.y) * now;
1759
+ currSlide.pan.x = initialPan.x + (destinationPan.x - initialPan.x) * now;
1760
+ currSlide.pan.y = initialPan.y + (destinationPan.y - initialPan.y) * now;
1831
1761
  }
1832
1762
  if (currZoomLevelNeedsChange) {
1833
- const newZoomLevel =
1834
- prevZoomLevel + (destinationZoomLevel - prevZoomLevel) * now;
1763
+ const newZoomLevel = prevZoomLevel + (destinationZoomLevel - prevZoomLevel) * now;
1835
1764
  currSlide.setZoomLevel(newZoomLevel);
1836
1765
  }
1837
1766
  currSlide.applyCurrentZoomPan();
@@ -1842,16 +1771,14 @@ class ZoomHandler {
1842
1771
  // We clamp opacity to keep it between 0 and 1.
1843
1772
  // As progress ratio can be larger than 1 due to overshoot,
1844
1773
  // and we do not want to bounce opacity.
1845
- pswp.applyBgOpacity(
1846
- clamp(initialBgOpacity + (1 - initialBgOpacity) * now, 0, 1)
1847
- );
1774
+ pswp.applyBgOpacity(clamp(initialBgOpacity + (1 - initialBgOpacity) * now, 0, 1));
1848
1775
  }
1849
1776
  },
1850
1777
  onComplete: () => {
1851
1778
  // update resolution after transition ends
1852
1779
  currSlide._setResolution(destinationZoomLevel);
1853
1780
  currSlide.applyCurrentZoomPan();
1854
- },
1781
+ }
1855
1782
  });
1856
1783
  }
1857
1784
  }
@@ -1875,9 +1802,7 @@ class ZoomHandler {
1875
1802
  * @returns {boolean}
1876
1803
  */
1877
1804
  function didTapOnMainContent(event) {
1878
- return !!(
1879
- /** @type {HTMLElement} */ event.target.closest(".pswp__container")
1880
- );
1805
+ return !!(/** @type {HTMLElement} */ event.target.closest(".pswp__container"));
1881
1806
  }
1882
1807
 
1883
1808
  /**
@@ -1896,12 +1821,10 @@ class TapHandler {
1896
1821
  * @param {PointerEvent} originalEvent
1897
1822
  */
1898
1823
  click(point, originalEvent) {
1899
- const targetClassList =
1900
- /** @type {HTMLElement} */ originalEvent.target.classList;
1824
+ const targetClassList = /** @type {HTMLElement} */ originalEvent.target.classList;
1901
1825
  const isImageClick = targetClassList.contains("pswp__img");
1902
1826
  const isBackgroundClick =
1903
- targetClassList.contains("pswp__item") ||
1904
- targetClassList.contains("pswp__zoom-wrap");
1827
+ targetClassList.contains("pswp__item") || targetClassList.contains("pswp__zoom-wrap");
1905
1828
  if (isImageClick) {
1906
1829
  this._doClickOrTapAction("imageClick", point, originalEvent);
1907
1830
  } else if (isBackgroundClick) {
@@ -1939,13 +1862,12 @@ class TapHandler {
1939
1862
  var _this$gestures$pswp$e;
1940
1863
  const { pswp } = this.gestures;
1941
1864
  const { currSlide } = pswp;
1942
- const actionFullName =
1943
- /** @type {AddPostfix<Actions, 'Action'>} */ actionName + "Action";
1865
+ const actionFullName = /** @type {AddPostfix<Actions, 'Action'>} */ actionName + "Action";
1944
1866
  const optionValue = pswp.options[actionFullName];
1945
1867
  if (
1946
1868
  pswp.dispatch(actionFullName, {
1947
1869
  point,
1948
- originalEvent,
1870
+ originalEvent
1949
1871
  }).defaultPrevented
1950
1872
  ) {
1951
1873
  return;
@@ -1960,9 +1882,7 @@ class TapHandler {
1960
1882
  pswp[optionValue]();
1961
1883
  break;
1962
1884
  case "zoom":
1963
- currSlide === null ||
1964
- currSlide === void 0 ||
1965
- currSlide.toggleZoom(point);
1885
+ currSlide === null || currSlide === void 0 || currSlide.toggleZoom(point);
1966
1886
  break;
1967
1887
  case "zoom-or-close":
1968
1888
  // by default click zooms current image,
@@ -2027,37 +1947,37 @@ class Gestures {
2027
1947
  /** @type {Point} */
2028
1948
  this.p1 = {
2029
1949
  x: 0,
2030
- y: 0,
1950
+ y: 0
2031
1951
  }; // the first pressed pointer
2032
1952
  /** @type {Point} */
2033
1953
  this.p2 = {
2034
1954
  x: 0,
2035
- y: 0,
1955
+ y: 0
2036
1956
  }; // the second pressed pointer
2037
1957
  /** @type {Point} */
2038
1958
  this.prevP1 = {
2039
1959
  x: 0,
2040
- y: 0,
1960
+ y: 0
2041
1961
  };
2042
1962
  /** @type {Point} */
2043
1963
  this.prevP2 = {
2044
1964
  x: 0,
2045
- y: 0,
1965
+ y: 0
2046
1966
  };
2047
1967
  /** @type {Point} */
2048
1968
  this.startP1 = {
2049
1969
  x: 0,
2050
- y: 0,
1970
+ y: 0
2051
1971
  };
2052
1972
  /** @type {Point} */
2053
1973
  this.startP2 = {
2054
1974
  x: 0,
2055
- y: 0,
1975
+ y: 0
2056
1976
  };
2057
1977
  /** @type {Point} */
2058
1978
  this.velocity = {
2059
1979
  x: 0,
2060
- y: 0,
1980
+ y: 0
2061
1981
  };
2062
1982
 
2063
1983
  /** @type {Point}
@@ -2065,14 +1985,14 @@ class Gestures {
2065
1985
  */
2066
1986
  this._lastStartP1 = {
2067
1987
  x: 0,
2068
- y: 0,
1988
+ y: 0
2069
1989
  };
2070
1990
  /** @type {Point}
2071
1991
  * @private
2072
1992
  */
2073
1993
  this._intervalP1 = {
2074
1994
  x: 0,
2075
- y: 0,
1995
+ y: 0
2076
1996
  };
2077
1997
  /** @private */
2078
1998
  this._numActivePoints = 0;
@@ -2085,8 +2005,7 @@ class Gestures {
2085
2005
  /** @private */
2086
2006
  this._pointerEventEnabled = !!window.PointerEvent;
2087
2007
  this.supportsTouch =
2088
- this._touchEventEnabled ||
2089
- (this._pointerEventEnabled && navigator.maxTouchPoints > 1);
2008
+ this._touchEventEnabled || (this._pointerEventEnabled && navigator.maxTouchPoints > 1);
2090
2009
  /** @private */
2091
2010
  this._numActivePoints = 0;
2092
2011
  /** @private */
@@ -2154,16 +2073,8 @@ class Gestures {
2154
2073
  pref + down,
2155
2074
  /** @type EventListener */ this.onPointerDown.bind(this)
2156
2075
  );
2157
- events.add(
2158
- window,
2159
- pref + "move",
2160
- /** @type EventListener */ this.onPointerMove.bind(this)
2161
- );
2162
- events.add(
2163
- window,
2164
- pref + up,
2165
- /** @type EventListener */ this.onPointerUp.bind(this)
2166
- );
2076
+ events.add(window, pref + "move", /** @type EventListener */ this.onPointerMove.bind(this));
2077
+ events.add(window, pref + up, /** @type EventListener */ this.onPointerUp.bind(this));
2167
2078
  if (cancelEvent) {
2168
2079
  events.add(
2169
2080
  pswp.scrollWrap,
@@ -2200,7 +2111,7 @@ class Gestures {
2200
2111
  }
2201
2112
  if (
2202
2113
  pswp.dispatch("pointerDown", {
2203
- originalEvent: e,
2114
+ originalEvent: e
2204
2115
  }).defaultPrevented
2205
2116
  ) {
2206
2117
  return;
@@ -2240,7 +2151,7 @@ class Gestures {
2240
2151
  this._updatePoints(e, "move");
2241
2152
  if (
2242
2153
  this.pswp.dispatch("pointerMove", {
2243
- originalEvent: e,
2154
+ originalEvent: e
2244
2155
  }).defaultPrevented
2245
2156
  ) {
2246
2157
  return;
@@ -2310,7 +2221,7 @@ class Gestures {
2310
2221
  this._updatePoints(e, "up");
2311
2222
  if (
2312
2223
  this.pswp.dispatch("pointerUp", {
2313
- originalEvent: e,
2224
+ originalEvent: e
2314
2225
  }).defaultPrevented
2315
2226
  ) {
2316
2227
  return;
@@ -2347,10 +2258,7 @@ class Gestures {
2347
2258
  this.drag.change();
2348
2259
  }
2349
2260
  } /* if (this.isZooming) */ else {
2350
- if (
2351
- !pointsEqual(this.p1, this.prevP1) ||
2352
- !pointsEqual(this.p2, this.prevP2)
2353
- ) {
2261
+ if (!pointsEqual(this.p1, this.prevP1) || !pointsEqual(this.p2, this.prevP2)) {
2354
2262
  this.zoomLevels.change();
2355
2263
  }
2356
2264
  }
@@ -2413,9 +2321,7 @@ class Gestures {
2413
2321
  if (this._tapTimer) {
2414
2322
  this._clearTapTimer();
2415
2323
  // Check if two taps were more or less on the same place
2416
- if (
2417
- getDistanceBetween(this._lastStartP1, this.startP1) < MIN_TAP_DISTANCE
2418
- ) {
2324
+ if (getDistanceBetween(this._lastStartP1, this.startP1) < MIN_TAP_DISTANCE) {
2419
2325
  this.tapHandler.doubleTap(this.startP1, e);
2420
2326
  }
2421
2327
  } else {
@@ -2470,12 +2376,7 @@ class Gestures {
2470
2376
  * @param {'up' | 'down' | 'move'} pointerType Normalized pointer type
2471
2377
  */
2472
2378
  _preventPointerEventBehaviour(e, pointerType) {
2473
- const preventPointerEvent = this.pswp.applyFilters(
2474
- "preventPointerEvent",
2475
- true,
2476
- e,
2477
- pointerType
2478
- );
2379
+ const preventPointerEvent = this.pswp.applyFilters("preventPointerEvent", true, e, pointerType);
2479
2380
  if (preventPointerEvent) {
2480
2381
  e.preventDefault();
2481
2382
  }
@@ -2504,15 +2405,12 @@ class Gestures {
2504
2405
  this._ongoingPointers.push(
2505
2406
  this._convertEventPosToPoint(pointerEvent, {
2506
2407
  x: 0,
2507
- y: 0,
2408
+ y: 0
2508
2409
  })
2509
2410
  );
2510
2411
  } else if (pointerIndex > -1) {
2511
2412
  // update existing pointer
2512
- this._convertEventPosToPoint(
2513
- pointerEvent,
2514
- this._ongoingPointers[pointerIndex]
2515
- );
2413
+ this._convertEventPosToPoint(pointerEvent, this._ongoingPointers[pointerIndex]);
2516
2414
  }
2517
2415
  this._numActivePoints = this._ongoingPointers.length;
2518
2416
 
@@ -2575,16 +2473,11 @@ class Gestures {
2575
2473
  this.dragAxis = "x";
2576
2474
  } else {
2577
2475
  // calculate delta of the last touchmove tick
2578
- const diff =
2579
- Math.abs(this.p1.x - this.startP1.x) -
2580
- Math.abs(this.p1.y - this.startP1.y);
2476
+ const diff = Math.abs(this.p1.x - this.startP1.x) - Math.abs(this.p1.y - this.startP1.y);
2581
2477
  if (diff !== 0) {
2582
2478
  // check if pointer was shifted horizontally or vertically
2583
2479
  const axisToCheck = diff > 0 ? "x" : "y";
2584
- if (
2585
- Math.abs(this.p1[axisToCheck] - this.startP1[axisToCheck]) >=
2586
- AXIS_SWIPE_HYSTERISIS
2587
- ) {
2480
+ if (Math.abs(this.p1[axisToCheck] - this.startP1[axisToCheck]) >= AXIS_SWIPE_HYSTERISIS) {
2588
2481
  this.dragAxis = axisToCheck;
2589
2482
  }
2590
2483
  }
@@ -2681,10 +2574,7 @@ class MainScroll {
2681
2574
  }
2682
2575
  this.itemHolders.forEach((itemHolder, index) => {
2683
2576
  if (slideWidthChanged) {
2684
- setTransform(
2685
- itemHolder.el,
2686
- (index + this._containerShiftIndex) * this.slideWidth
2687
- );
2577
+ setTransform(itemHolder.el, (index + this._containerShiftIndex) * this.slideWidth);
2688
2578
  }
2689
2579
  if (resizeSlides && itemHolder.slide) {
2690
2580
  itemHolder.slide.resize();
@@ -2726,7 +2616,7 @@ class MainScroll {
2726
2616
  // hide nearby item holders until initial zoom animation finishes (to avoid extra Paints)
2727
2617
  el.style.display = i === 1 ? "block" : "none";
2728
2618
  this.itemHolders.push({
2729
- el,
2619
+ el
2730
2620
  //index: -1
2731
2621
  });
2732
2622
  }
@@ -2799,7 +2689,7 @@ class MainScroll {
2799
2689
  onComplete: () => {
2800
2690
  this.updateCurrItem();
2801
2691
  pswp.appendHeavy();
2802
- },
2692
+ }
2803
2693
  });
2804
2694
  let currDiff = pswp.potentialIndex - pswp.currIndex;
2805
2695
  if (pswp.canLoop()) {
@@ -2846,8 +2736,7 @@ class MainScroll {
2846
2736
  updateCurrItem() {
2847
2737
  var _this$itemHolders$;
2848
2738
  const { pswp } = this;
2849
- const positionDifference =
2850
- this._prevPositionIndex - this._currPositionIndex;
2739
+ const positionDifference = this._prevPositionIndex - this._currPositionIndex;
2851
2740
  if (!positionDifference) {
2852
2741
  return;
2853
2742
  }
@@ -2857,8 +2746,7 @@ class MainScroll {
2857
2746
  /** @type {ItemHolder | undefined} */
2858
2747
  let tempHolder;
2859
2748
  if (diffAbs >= 3) {
2860
- this._containerShiftIndex +=
2861
- positionDifference + (positionDifference > 0 ? -3 : 3);
2749
+ this._containerShiftIndex += positionDifference + (positionDifference > 0 ? -3 : 3);
2862
2750
  diffAbs = 3;
2863
2751
 
2864
2752
  // If slides are changed by 3 screens or more - clean up previous slides
@@ -2877,10 +2765,7 @@ class MainScroll {
2877
2765
  this.itemHolders[2] = tempHolder; // move first to last
2878
2766
 
2879
2767
  this._containerShiftIndex++;
2880
- setTransform(
2881
- tempHolder.el,
2882
- (this._containerShiftIndex + 2) * this.slideWidth
2883
- );
2768
+ setTransform(tempHolder.el, (this._containerShiftIndex + 2) * this.slideWidth);
2884
2769
  pswp.setContent(tempHolder, pswp.currIndex - diffAbs + i + 2);
2885
2770
  }
2886
2771
  } else {
@@ -2889,10 +2774,7 @@ class MainScroll {
2889
2774
  this.itemHolders.unshift(tempHolder); // move last to first
2890
2775
 
2891
2776
  this._containerShiftIndex--;
2892
- setTransform(
2893
- tempHolder.el,
2894
- this._containerShiftIndex * this.slideWidth
2895
- );
2777
+ setTransform(tempHolder.el, this._containerShiftIndex * this.slideWidth);
2896
2778
  pswp.setContent(tempHolder, pswp.currIndex + diffAbs - i - 2);
2897
2779
  }
2898
2780
  }
@@ -2918,8 +2800,7 @@ class MainScroll {
2918
2800
  }
2919
2801
  });
2920
2802
  pswp.currSlide =
2921
- (_this$itemHolders$ = this.itemHolders[1]) === null ||
2922
- _this$itemHolders$ === void 0
2803
+ (_this$itemHolders$ = this.itemHolders[1]) === null || _this$itemHolders$ === void 0
2923
2804
  ? void 0
2924
2805
  : _this$itemHolders$.slide;
2925
2806
  pswp.contentLoader.updateLazy(positionDifference);
@@ -2939,8 +2820,7 @@ class MainScroll {
2939
2820
  moveTo(x, dragging) {
2940
2821
  if (!this.pswp.canLoop() && dragging) {
2941
2822
  // Apply friction
2942
- let newSlideIndexOffset =
2943
- (this.slideWidth * this._currPositionIndex - x) / this.slideWidth;
2823
+ let newSlideIndexOffset = (this.slideWidth * this._currPositionIndex - x) / this.slideWidth;
2944
2824
  newSlideIndexOffset += this.pswp.currIndex;
2945
2825
  const delta = Math.round(x - this.x);
2946
2826
  if (
@@ -2956,7 +2836,7 @@ class MainScroll {
2956
2836
  }
2957
2837
  this.pswp.dispatch("moveMainScroll", {
2958
2838
  x,
2959
- dragging: dragging !== null && dragging !== void 0 ? dragging : false,
2839
+ dragging: dragging !== null && dragging !== void 0 ? dragging : false
2960
2840
  });
2961
2841
  }
2962
2842
  }
@@ -2975,7 +2855,7 @@ const KeyboardKeyCodesMap = {
2975
2855
  ArrowUp: 38,
2976
2856
  ArrowRight: 39,
2977
2857
  ArrowDown: 40,
2978
- Tab: 9,
2858
+ Tab: 9
2979
2859
  };
2980
2860
 
2981
2861
  /**
@@ -3009,17 +2889,9 @@ class Keyboard {
3009
2889
  // that's why we delay it until the opener transition ends
3010
2890
  this._focusRoot();
3011
2891
  }
3012
- pswp.events.add(
3013
- document,
3014
- "focusin",
3015
- /** @type EventListener */ this._onFocusIn.bind(this)
3016
- );
2892
+ pswp.events.add(document, "focusin", /** @type EventListener */ this._onFocusIn.bind(this));
3017
2893
  }
3018
- pswp.events.add(
3019
- document,
3020
- "keydown",
3021
- /** @type EventListener */ this._onKeyDown.bind(this)
3022
- );
2894
+ pswp.events.add(document, "keydown", /** @type EventListener */ this._onKeyDown.bind(this));
3023
2895
  });
3024
2896
  const lastActiveElement = /** @type {HTMLElement} */ document.activeElement;
3025
2897
  pswp.on("destroy", () => {
@@ -3045,7 +2917,7 @@ class Keyboard {
3045
2917
  const { pswp } = this;
3046
2918
  if (
3047
2919
  pswp.dispatch("keydown", {
3048
- originalEvent: e,
2920
+ originalEvent: e
3049
2921
  }).defaultPrevented
3050
2922
  ) {
3051
2923
  return;
@@ -3098,10 +2970,7 @@ class Keyboard {
3098
2970
  const { currSlide } = pswp;
3099
2971
  if (pswp.options.arrowKeys && axis === "x" && pswp.getNumItems() > 1) {
3100
2972
  keydownAction = isForward ? "next" : "prev";
3101
- } else if (
3102
- currSlide &&
3103
- currSlide.currZoomLevel > currSlide.zoomLevels.fit
3104
- ) {
2973
+ } else if (currSlide && currSlide.currZoomLevel > currSlide.zoomLevels.fit) {
3105
2974
  // up/down arrow keys pan the image vertically
3106
2975
  // left/right arrow keys pan horizontally.
3107
2976
  // Unless there is only one image,
@@ -3170,16 +3039,14 @@ class CSSAnimation {
3170
3039
  transform,
3171
3040
  onFinish = () => {},
3172
3041
  duration = 333,
3173
- easing = DEFAULT_EASING,
3042
+ easing = DEFAULT_EASING
3174
3043
  } = props;
3175
3044
  this.onFinish = onFinish;
3176
3045
 
3177
3046
  // support only transform and opacity
3178
3047
  const prop = transform ? "transform" : "opacity";
3179
3048
  const propValue =
3180
- (_props$prop = props[prop]) !== null && _props$prop !== void 0
3181
- ? _props$prop
3182
- : "";
3049
+ (_props$prop = props[prop]) !== null && _props$prop !== void 0 ? _props$prop : "";
3183
3050
 
3184
3051
  /** @private */
3185
3052
  this._target = target;
@@ -3202,11 +3069,7 @@ class CSSAnimation {
3202
3069
  setTransitionStyle(target, prop, duration, easing);
3203
3070
  this._helperTimeout = setTimeout(() => {
3204
3071
  target.addEventListener("transitionend", this._onTransitionEnd, false);
3205
- target.addEventListener(
3206
- "transitioncancel",
3207
- this._onTransitionEnd,
3208
- false
3209
- );
3072
+ target.addEventListener("transitioncancel", this._onTransitionEnd, false);
3210
3073
 
3211
3074
  // Safari occasionally does not emit transitionend event
3212
3075
  // if element property was modified during the transition,
@@ -3249,16 +3112,8 @@ class CSSAnimation {
3249
3112
  clearTimeout(this._helperTimeout);
3250
3113
  }
3251
3114
  removeTransitionStyle(this._target);
3252
- this._target.removeEventListener(
3253
- "transitionend",
3254
- this._onTransitionEnd,
3255
- false
3256
- );
3257
- this._target.removeEventListener(
3258
- "transitioncancel",
3259
- this._onTransitionEnd,
3260
- false
3261
- );
3115
+ this._target.removeEventListener("transitionend", this._onTransitionEnd, false);
3116
+ this._target.removeEventListener("transitioncancel", this._onTransitionEnd, false);
3262
3117
  if (!this._finished) {
3263
3118
  this._finalizeAnimation();
3264
3119
  }
@@ -3297,9 +3152,7 @@ class SpringEaser {
3297
3152
  this._naturalFrequency = naturalFrequency || DEFAULT_NATURAL_FREQUENCY;
3298
3153
  this._dampedFrequency = this._naturalFrequency;
3299
3154
  if (this._dampingRatio < 1) {
3300
- this._dampedFrequency *= Math.sqrt(
3301
- 1 - this._dampingRatio * this._dampingRatio
3302
- );
3155
+ this._dampedFrequency *= Math.sqrt(1 - this._dampingRatio * this._dampingRatio);
3303
3156
  }
3304
3157
  }
3305
3158
 
@@ -3318,22 +3171,18 @@ class SpringEaser {
3318
3171
  let displacement = 0;
3319
3172
  let coeff;
3320
3173
  deltaTime /= 1000;
3321
- const naturalDumpingPow =
3322
- Math.E ** (-this._dampingRatio * this._naturalFrequency * deltaTime);
3174
+ const naturalDumpingPow = Math.E ** (-this._dampingRatio * this._naturalFrequency * deltaTime);
3323
3175
  if (this._dampingRatio === 1) {
3324
3176
  coeff = this.velocity + this._naturalFrequency * deltaPosition;
3325
3177
  displacement = (deltaPosition + coeff * deltaTime) * naturalDumpingPow;
3326
- this.velocity =
3327
- displacement * -this._naturalFrequency + coeff * naturalDumpingPow;
3178
+ this.velocity = displacement * -this._naturalFrequency + coeff * naturalDumpingPow;
3328
3179
  } else if (this._dampingRatio < 1) {
3329
3180
  coeff =
3330
3181
  (1 / this._dampedFrequency) *
3331
- (this._dampingRatio * this._naturalFrequency * deltaPosition +
3332
- this.velocity);
3182
+ (this._dampingRatio * this._naturalFrequency * deltaPosition + this.velocity);
3333
3183
  const dumpedFCos = Math.cos(this._dampedFrequency * deltaTime);
3334
3184
  const dumpedFSin = Math.sin(this._dampedFrequency * deltaTime);
3335
- displacement =
3336
- naturalDumpingPow * (deltaPosition * dumpedFCos + coeff * dumpedFSin);
3185
+ displacement = naturalDumpingPow * (deltaPosition * dumpedFCos + coeff * dumpedFSin);
3337
3186
  this.velocity =
3338
3187
  displacement * -this._naturalFrequency * this._dampingRatio +
3339
3188
  naturalDumpingPow *
@@ -3377,7 +3226,7 @@ class SpringAnimation {
3377
3226
  onComplete,
3378
3227
  onFinish = () => {},
3379
3228
  dampingRatio,
3380
- naturalFrequency,
3229
+ naturalFrequency
3381
3230
  } = props;
3382
3231
  this.onFinish = onFinish;
3383
3232
  const easer = new SpringEaser(velocity, dampingRatio, naturalFrequency);
@@ -3537,11 +3386,7 @@ class ScrollWheel {
3537
3386
  */
3538
3387
  constructor(pswp) {
3539
3388
  this.pswp = pswp;
3540
- pswp.events.add(
3541
- pswp.element,
3542
- "wheel",
3543
- /** @type EventListener */ this._onWheel.bind(this)
3544
- );
3389
+ pswp.events.add(pswp.element, "wheel", /** @type EventListener */ this._onWheel.bind(this));
3545
3390
  }
3546
3391
 
3547
3392
  /**
@@ -3557,7 +3402,7 @@ class ScrollWheel {
3557
3402
  }
3558
3403
  if (
3559
3404
  this.pswp.dispatch("wheel", {
3560
- originalEvent: e,
3405
+ originalEvent: e
3561
3406
  }).defaultPrevented
3562
3407
  ) {
3563
3408
  return;
@@ -3575,7 +3420,7 @@ class ScrollWheel {
3575
3420
  const destZoomLevel = currSlide.currZoomLevel * zoomFactor;
3576
3421
  currSlide.zoomTo(destZoomLevel, {
3577
3422
  x: e.clientX,
3578
- y: e.clientY,
3423
+ y: e.clientY
3579
3424
  });
3580
3425
  }
3581
3426
  } else {
@@ -3645,8 +3490,7 @@ function addElementHTML(htmlData) {
3645
3490
  return "";
3646
3491
  }
3647
3492
  const svgData = htmlData;
3648
- let out =
3649
- '<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';
3493
+ let out = '<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';
3650
3494
  // replace all %d with size
3651
3495
  out = out.split("%d").join(/** @type {string} */ svgData.size || 32);
3652
3496
 
@@ -3656,8 +3500,7 @@ function addElementHTML(htmlData) {
3656
3500
  //
3657
3501
  // Property shadowID defines ID of element that should be cloned.
3658
3502
  if (svgData.outlineID) {
3659
- out +=
3660
- '<use class="pswp__icn-shadow" xlink:href="#' + svgData.outlineID + '"/>';
3503
+ out += '<use class="pswp__icn-shadow" xlink:href="#' + svgData.outlineID + '"/>';
3661
3504
  }
3662
3505
  out += svgData.inner;
3663
3506
  out += "</svg>";
@@ -3690,7 +3533,7 @@ class UIElement {
3690
3533
  elementHTML = pswp.options[name + "SVG"];
3691
3534
  }
3692
3535
  pswp.dispatch("uiElementCreate", {
3693
- data,
3536
+ data
3694
3537
  });
3695
3538
  let className = "";
3696
3539
  if (data.isButton) {
@@ -3699,9 +3542,7 @@ class UIElement {
3699
3542
  } else {
3700
3543
  className += data.className || `pswp__${data.name}`;
3701
3544
  }
3702
- let tagName = data.isButton
3703
- ? data.tagName || "button"
3704
- : data.tagName || "div";
3545
+ let tagName = data.isButton ? data.tagName || "button" : data.tagName || "div";
3705
3546
  tagName = /** @type {keyof HTMLElementTagNameMap} */ tagName.toLowerCase();
3706
3547
  /** @type {HTMLElement} */
3707
3548
  const element = createElement(className, tagName);
@@ -3746,11 +3587,7 @@ class UIElement {
3746
3587
  let container = pswp.element;
3747
3588
  if (appendTo === "bar") {
3748
3589
  if (!pswp.topBar) {
3749
- pswp.topBar = createElement(
3750
- "pswp__top-bar pswp__hide-on-close",
3751
- "div",
3752
- pswp.scrollWrap
3753
- );
3590
+ pswp.topBar = createElement("pswp__top-bar pswp__hide-on-close", "div", pswp.scrollWrap);
3754
3591
  }
3755
3592
  container = pswp.topBar;
3756
3593
  } else {
@@ -3808,12 +3645,11 @@ const arrowPrev = {
3808
3645
  html: {
3809
3646
  isCustomSVG: true,
3810
3647
  size: 60,
3811
- inner:
3812
- '<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',
3813
- outlineID: "pswp__icn-arrow",
3648
+ inner: '<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',
3649
+ outlineID: "pswp__icn-arrow"
3814
3650
  },
3815
3651
  onClick: "prev",
3816
- onInit: initArrowButton,
3652
+ onInit: initArrowButton
3817
3653
  };
3818
3654
 
3819
3655
  /** @type {UIElementData} */
@@ -3828,12 +3664,12 @@ const arrowNext = {
3828
3664
  isCustomSVG: true,
3829
3665
  size: 60,
3830
3666
  inner: '<use xlink:href="#pswp__icn-arrow"/>',
3831
- outlineID: "pswp__icn-arrow",
3667
+ outlineID: "pswp__icn-arrow"
3832
3668
  },
3833
3669
  onClick: "next",
3834
3670
  onInit: (el, pswp) => {
3835
3671
  initArrowButton(el, pswp, true);
3836
- },
3672
+ }
3837
3673
  };
3838
3674
 
3839
3675
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3844,11 +3680,10 @@ const closeButton = {
3844
3680
  isButton: true,
3845
3681
  html: {
3846
3682
  isCustomSVG: true,
3847
- inner:
3848
- '<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>',
3849
- outlineID: "pswp__icn-close",
3683
+ inner: '<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>',
3684
+ outlineID: "pswp__icn-close"
3850
3685
  },
3851
- onClick: "close",
3686
+ onClick: "close"
3852
3687
  };
3853
3688
 
3854
3689
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3864,9 +3699,9 @@ const zoomButton = {
3864
3699
  '<path d="M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z" id="pswp__icn-zoom"/>' +
3865
3700
  '<path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/>' +
3866
3701
  '<path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>',
3867
- outlineID: "pswp__icn-zoom",
3702
+ outlineID: "pswp__icn-zoom"
3868
3703
  },
3869
- onClick: "toggleZoom",
3704
+ onClick: "toggleZoom"
3870
3705
  };
3871
3706
 
3872
3707
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3879,7 +3714,7 @@ const loadingIndicator = {
3879
3714
  // eslint-disable-next-line max-len
3880
3715
  inner:
3881
3716
  '<path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z" id="pswp__icn-loading"/>',
3882
- outlineID: "pswp__icn-loading",
3717
+ outlineID: "pswp__icn-loading"
3883
3718
  },
3884
3719
  onInit: (indicatorElement, pswp) => {
3885
3720
  /** @type {boolean | undefined} */
@@ -3926,8 +3761,7 @@ const loadingIndicator = {
3926
3761
  var _pswp$currSlide2;
3927
3762
  setIndicatorVisibility(
3928
3763
  Boolean(
3929
- (_pswp$currSlide2 = pswp.currSlide) === null ||
3930
- _pswp$currSlide2 === void 0
3764
+ (_pswp$currSlide2 = pswp.currSlide) === null || _pswp$currSlide2 === void 0
3931
3765
  ? void 0
3932
3766
  : _pswp$currSlide2.content.isLoading()
3933
3767
  )
@@ -3947,7 +3781,7 @@ const loadingIndicator = {
3947
3781
  if (pswp.ui) {
3948
3782
  pswp.ui.updatePreloaderVisibility = updatePreloaderVisibility;
3949
3783
  }
3950
- },
3784
+ }
3951
3785
  };
3952
3786
 
3953
3787
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3957,12 +3791,9 @@ const counterIndicator = {
3957
3791
  onInit: (counterElement, pswp) => {
3958
3792
  pswp.on("change", () => {
3959
3793
  counterElement.innerText =
3960
- pswp.currIndex +
3961
- 1 +
3962
- pswp.options.indexIndicatorSep +
3963
- pswp.getNumItems();
3794
+ pswp.currIndex + 1 + pswp.options.indexIndicatorSep + pswp.getNumItems();
3964
3795
  });
3965
- },
3796
+ }
3966
3797
  };
3967
3798
 
3968
3799
  /** @typedef {import('../photoswipe.js').default} PhotoSwipe */
@@ -4009,7 +3840,7 @@ class UI {
4009
3840
  arrowNext,
4010
3841
  zoomButton,
4011
3842
  loadingIndicator,
4012
- counterIndicator,
3843
+ counterIndicator
4013
3844
  ];
4014
3845
  pswp.dispatch("uiRegister");
4015
3846
 
@@ -4027,10 +3858,7 @@ class UI {
4027
3858
  var _pswp$element;
4028
3859
  (_pswp$element = pswp.element) === null ||
4029
3860
  _pswp$element === void 0 ||
4030
- _pswp$element.classList.toggle(
4031
- "pswp--one-slide",
4032
- pswp.getNumItems() === 1
4033
- );
3861
+ _pswp$element.classList.toggle("pswp--one-slide", pswp.getNumItems() === 1);
4034
3862
  });
4035
3863
  pswp.on("zoomPanUpdate", () => this._onZoomPanUpdate());
4036
3864
  }
@@ -4067,8 +3895,7 @@ class UI {
4067
3895
  return;
4068
3896
  }
4069
3897
  this._lastUpdatedZoomLevel = currZoomLevel;
4070
- const currZoomLevelDiff =
4071
- currSlide.zoomLevels.initial - currSlide.zoomLevels.secondary;
3898
+ const currZoomLevelDiff = currSlide.zoomLevels.initial - currSlide.zoomLevels.secondary;
4072
3899
 
4073
3900
  // Initial and secondary zoom levels are almost equal
4074
3901
  if (Math.abs(currZoomLevelDiff) < 0.01 || !currSlide.isZoomable()) {
@@ -4083,10 +3910,7 @@ class UI {
4083
3910
  ? currSlide.zoomLevels.secondary
4084
3911
  : currSlide.zoomLevels.initial;
4085
3912
  setZoomedIn(template, potentialZoomLevel <= currZoomLevel);
4086
- if (
4087
- options.imageClickAction === "zoom" ||
4088
- options.imageClickAction === "zoom-or-close"
4089
- ) {
3913
+ if (options.imageClickAction === "zoom" || options.imageClickAction === "zoom-or-close") {
4090
3914
  template.classList.add("pswp--click-to-zoom");
4091
3915
  }
4092
3916
  }
@@ -4106,7 +3930,7 @@ function getBoundsByElement(el) {
4106
3930
  return {
4107
3931
  x: thumbAreaRect.left,
4108
3932
  y: thumbAreaRect.top,
4109
- w: thumbAreaRect.width,
3933
+ w: thumbAreaRect.width
4110
3934
  };
4111
3935
  }
4112
3936
 
@@ -4137,7 +3961,7 @@ function getCroppedBoundsByElement(el, imageWidth, imageHeight) {
4137
3961
  const bounds = {
4138
3962
  x: thumbAreaRect.left + offsetX,
4139
3963
  y: thumbAreaRect.top + offsetY,
4140
- w: imageWidth * fillZoomLevel,
3964
+ w: imageWidth * fillZoomLevel
4141
3965
  };
4142
3966
 
4143
3967
  // Coordinates of inner crop area
@@ -4146,7 +3970,7 @@ function getCroppedBoundsByElement(el, imageWidth, imageHeight) {
4146
3970
  w: thumbAreaRect.width,
4147
3971
  h: thumbAreaRect.height,
4148
3972
  x: offsetX,
4149
- y: offsetY,
3973
+ y: offsetY
4150
3974
  };
4151
3975
  return bounds;
4152
3976
  }
@@ -4165,7 +3989,7 @@ function getThumbBounds(index, itemData, instance) {
4165
3989
  const event = instance.dispatch("thumbBounds", {
4166
3990
  index,
4167
3991
  itemData,
4168
- instance,
3992
+ instance
4169
3993
  });
4170
3994
  // @ts-expect-error
4171
3995
  if (event.thumbBounds) {
@@ -4461,7 +4285,7 @@ class Eventable {
4461
4285
  _this$_filters$name === void 0 ||
4462
4286
  _this$_filters$name.push({
4463
4287
  fn,
4464
- priority,
4288
+ priority
4465
4289
  });
4466
4290
  (_this$_filters$name2 = this._filters[name]) === null ||
4467
4291
  _this$_filters$name2 === void 0 ||
@@ -4479,9 +4303,7 @@ class Eventable {
4479
4303
  removeFilter(name, fn) {
4480
4304
  if (this._filters[name]) {
4481
4305
  // @ts-expect-error
4482
- this._filters[name] = this._filters[name].filter(
4483
- (filter) => filter.fn !== fn
4484
- );
4306
+ this._filters[name] = this._filters[name].filter((filter) => filter.fn !== fn);
4485
4307
  }
4486
4308
  if (this.pswp) {
4487
4309
  this.pswp.removeFilter(name, fn);
@@ -4522,9 +4344,7 @@ class Eventable {
4522
4344
  // When binding events to lightbox,
4523
4345
  // also bind events to PhotoSwipe Core,
4524
4346
  // if it's open.
4525
- (_this$pswp2 = this.pswp) === null ||
4526
- _this$pswp2 === void 0 ||
4527
- _this$pswp2.on(name, fn);
4347
+ (_this$pswp2 = this.pswp) === null || _this$pswp2 === void 0 || _this$pswp2.on(name, fn);
4528
4348
  }
4529
4349
 
4530
4350
  /**
@@ -4536,13 +4356,9 @@ class Eventable {
4536
4356
  var _this$pswp3;
4537
4357
  if (this._listeners[name]) {
4538
4358
  // @ts-expect-error
4539
- this._listeners[name] = this._listeners[name].filter(
4540
- (listener) => fn !== listener
4541
- );
4359
+ this._listeners[name] = this._listeners[name].filter((listener) => fn !== listener);
4542
4360
  }
4543
- (_this$pswp3 = this.pswp) === null ||
4544
- _this$pswp3 === void 0 ||
4545
- _this$pswp3.off(name, fn);
4361
+ (_this$pswp3 = this.pswp) === null || _this$pswp3 === void 0 || _this$pswp3.off(name, fn);
4546
4362
  }
4547
4363
 
4548
4364
  /**
@@ -4556,10 +4372,7 @@ class Eventable {
4556
4372
  if (this.pswp) {
4557
4373
  return this.pswp.dispatch(name, details);
4558
4374
  }
4559
- const event = /** @type {AugmentedEvent<T>} */ new PhotoSwipeEvent(
4560
- name,
4561
- details
4562
- );
4375
+ const event = /** @type {AugmentedEvent<T>} */ new PhotoSwipeEvent(name, details);
4563
4376
  (_this$_listeners$name2 = this._listeners[name]) === null ||
4564
4377
  _this$_listeners$name2 === void 0 ||
4565
4378
  _this$_listeners$name2.forEach((listener) => {
@@ -4664,7 +4477,7 @@ class Content {
4664
4477
  this.type = "html";
4665
4478
  }
4666
4479
  this.instance.dispatch("contentInit", {
4667
- content: this,
4480
+ content: this
4668
4481
  });
4669
4482
  }
4670
4483
  removePlaceholder() {
@@ -4695,10 +4508,7 @@ class Content {
4695
4508
  this.data.msrc && this.slide.isFirstSlide ? this.data.msrc : false,
4696
4509
  this
4697
4510
  );
4698
- this.placeholder = new Placeholder(
4699
- placeholderSrc,
4700
- this.slide.container
4701
- );
4511
+ this.placeholder = new Placeholder(placeholderSrc, this.slide.container);
4702
4512
  } else {
4703
4513
  const placeholderEl = this.placeholder.element;
4704
4514
  // Add placeholder to DOM if it was already created
@@ -4713,7 +4523,7 @@ class Content {
4713
4523
  if (
4714
4524
  this.instance.dispatch("contentLoad", {
4715
4525
  content: this,
4716
- isLazy,
4526
+ isLazy
4717
4527
  }).defaultPrevented
4718
4528
  ) {
4719
4529
  return;
@@ -4746,7 +4556,7 @@ class Content {
4746
4556
  !this.element ||
4747
4557
  this.instance.dispatch("contentLoadImage", {
4748
4558
  content: this,
4749
- isLazy,
4559
+ isLazy
4750
4560
  }).defaultPrevented
4751
4561
  ) {
4752
4562
  return;
@@ -4757,13 +4567,9 @@ class Content {
4757
4567
  imageElement.srcset = this.data.srcset;
4758
4568
  }
4759
4569
  imageElement.src =
4760
- (_this$data$src = this.data.src) !== null && _this$data$src !== void 0
4761
- ? _this$data$src
4762
- : "";
4570
+ (_this$data$src = this.data.src) !== null && _this$data$src !== void 0 ? _this$data$src : "";
4763
4571
  imageElement.alt =
4764
- (_this$data$alt = this.data.alt) !== null && _this$data$alt !== void 0
4765
- ? _this$data$alt
4766
- : "";
4572
+ (_this$data$alt = this.data.alt) !== null && _this$data$alt !== void 0 ? _this$data$alt : "";
4767
4573
  this.state = LOAD_STATE.LOADING;
4768
4574
  if (imageElement.complete) {
4769
4575
  this.onLoaded();
@@ -4798,15 +4604,11 @@ class Content {
4798
4604
  if (this.slide && this.element) {
4799
4605
  this.instance.dispatch("loadComplete", {
4800
4606
  slide: this.slide,
4801
- content: this,
4607
+ content: this
4802
4608
  });
4803
4609
 
4804
4610
  // if content is reloaded
4805
- if (
4806
- this.slide.isActive &&
4807
- this.slide.heavyAppended &&
4808
- !this.element.parentNode
4809
- ) {
4611
+ if (this.slide.isActive && this.slide.heavyAppended && !this.element.parentNode) {
4810
4612
  this.append();
4811
4613
  this.slide.updateContentSize(true);
4812
4614
  }
@@ -4826,11 +4628,11 @@ class Content {
4826
4628
  this.instance.dispatch("loadComplete", {
4827
4629
  slide: this.slide,
4828
4630
  isError: true,
4829
- content: this,
4631
+ content: this
4830
4632
  });
4831
4633
  this.instance.dispatch("loadError", {
4832
4634
  slide: this.slide,
4833
- content: this,
4635
+ content: this
4834
4636
  });
4835
4637
  }
4836
4638
  }
@@ -4839,11 +4641,7 @@ class Content {
4839
4641
  * @returns {Boolean} If the content is currently loading
4840
4642
  */
4841
4643
  isLoading() {
4842
- return this.instance.applyFilters(
4843
- "isContentLoading",
4844
- this.state === LOAD_STATE.LOADING,
4845
- this
4846
- );
4644
+ return this.instance.applyFilters("isContentLoading", this.state === LOAD_STATE.LOADING, this);
4847
4645
  }
4848
4646
 
4849
4647
  /**
@@ -4877,7 +4675,7 @@ class Content {
4877
4675
  this.instance.dispatch("contentResize", {
4878
4676
  content: this,
4879
4677
  width,
4880
- height,
4678
+ height
4881
4679
  }).defaultPrevented
4882
4680
  ) {
4883
4681
  return;
@@ -4897,7 +4695,7 @@ class Content {
4897
4695
  slide: this.slide,
4898
4696
  width,
4899
4697
  height,
4900
- content: this,
4698
+ content: this
4901
4699
  });
4902
4700
  }
4903
4701
  }
@@ -4945,11 +4743,7 @@ class Content {
4945
4743
  * @returns {boolean} If content should use a placeholder (from msrc by default)
4946
4744
  */
4947
4745
  usePlaceholder() {
4948
- return this.instance.applyFilters(
4949
- "useContentPlaceholder",
4950
- this.isImageContent(),
4951
- this
4952
- );
4746
+ return this.instance.applyFilters("useContentPlaceholder", this.isImageContent(), this);
4953
4747
  }
4954
4748
 
4955
4749
  /**
@@ -4958,7 +4752,7 @@ class Content {
4958
4752
  lazyLoad() {
4959
4753
  if (
4960
4754
  this.instance.dispatch("contentLazyLoad", {
4961
- content: this,
4755
+ content: this
4962
4756
  }).defaultPrevented
4963
4757
  ) {
4964
4758
  return;
@@ -4970,11 +4764,7 @@ class Content {
4970
4764
  * @returns {boolean} If placeholder should be kept after content is loaded
4971
4765
  */
4972
4766
  keepPlaceholder() {
4973
- return this.instance.applyFilters(
4974
- "isKeepingPlaceholder",
4975
- this.isLoading(),
4976
- this
4977
- );
4767
+ return this.instance.applyFilters("isKeepingPlaceholder", this.isLoading(), this);
4978
4768
  }
4979
4769
 
4980
4770
  /**
@@ -4985,7 +4775,7 @@ class Content {
4985
4775
  this.slide = undefined;
4986
4776
  if (
4987
4777
  this.instance.dispatch("contentDestroy", {
4988
- content: this,
4778
+ content: this
4989
4779
  }).defaultPrevented
4990
4780
  ) {
4991
4781
  return;
@@ -5014,8 +4804,7 @@ class Content {
5014
4804
  (_this$instance$option2 = this.instance.options) === null ||
5015
4805
  _this$instance$option2 === void 0
5016
4806
  ? void 0
5017
- : _this$instance$option2.errorMsg) !== null &&
5018
- _this$instance$option !== void 0
4807
+ : _this$instance$option2.errorMsg) !== null && _this$instance$option !== void 0
5019
4808
  ? _this$instance$option
5020
4809
  : "";
5021
4810
  errorMsgEl = /** @type {HTMLDivElement} */ this.instance.applyFilters(
@@ -5023,10 +4812,7 @@ class Content {
5023
4812
  errorMsgEl,
5024
4813
  this
5025
4814
  );
5026
- this.element = createElement(
5027
- "pswp__content pswp__error-msg-container",
5028
- "div"
5029
- );
4815
+ this.element = createElement("pswp__content pswp__error-msg-container", "div");
5030
4816
  this.element.appendChild(errorMsgEl);
5031
4817
  this.slide.container.innerText = "";
5032
4818
  this.slide.container.appendChild(this.element);
@@ -5049,7 +4835,7 @@ class Content {
5049
4835
  }
5050
4836
  if (
5051
4837
  this.instance.dispatch("contentAppend", {
5052
- content: this,
4838
+ content: this
5053
4839
  }).defaultPrevented
5054
4840
  ) {
5055
4841
  return;
@@ -5068,11 +4854,9 @@ class Content {
5068
4854
  // that's because I want to show image before it's fully loaded,
5069
4855
  // as browser can render parts of image while it is loading.
5070
4856
  // We do not do this in Safari due to partial loading bug.
5071
- if (
5072
- supportsDecode &&
5073
- this.slide &&
5074
- (!this.slide.isActive || isSafari())
5075
- ) {
4857
+ // Skip decode for HDR images to prevent Chrome crashes
4858
+ const isHdrImage = this.data.src && this.data.src.includes("/hdr/");
4859
+ if (supportsDecode && this.slide && (!this.slide.isActive || isSafari()) && !isHdrImage) {
5076
4860
  this.isDecoding = true;
5077
4861
  // purposefully using finally instead of then,
5078
4862
  // as if srcset sizes changes dynamically - it may cause decode error
@@ -5100,7 +4884,7 @@ class Content {
5100
4884
  activate() {
5101
4885
  if (
5102
4886
  this.instance.dispatch("contentActivate", {
5103
- content: this,
4887
+ content: this
5104
4888
  }).defaultPrevented ||
5105
4889
  !this.slide
5106
4890
  ) {
@@ -5123,7 +4907,7 @@ class Content {
5123
4907
  */
5124
4908
  deactivate() {
5125
4909
  this.instance.dispatch("contentDeactivate", {
5126
- content: this,
4910
+ content: this
5127
4911
  });
5128
4912
  if (this.slide && this.slide.holderElement) {
5129
4913
  this.slide.holderElement.setAttribute("aria-hidden", "true");
@@ -5137,7 +4921,7 @@ class Content {
5137
4921
  this.isAttached = false;
5138
4922
  if (
5139
4923
  this.instance.dispatch("contentRemove", {
5140
- content: this,
4924
+ content: this
5141
4925
  }).defaultPrevented
5142
4926
  ) {
5143
4927
  return;
@@ -5159,7 +4943,7 @@ class Content {
5159
4943
  }
5160
4944
  if (
5161
4945
  this.instance.dispatch("contentAppendImage", {
5162
- content: this,
4946
+ content: this
5163
4947
  }).defaultPrevented
5164
4948
  ) {
5165
4949
  return;
@@ -5238,7 +5022,7 @@ function lazyLoadSlide(index, instance) {
5238
5022
  if (
5239
5023
  instance.dispatch("lazyLoadSlide", {
5240
5024
  index,
5241
- itemData,
5025
+ itemData
5242
5026
  }).defaultPrevented
5243
5027
  ) {
5244
5028
  return;
@@ -5344,9 +5128,7 @@ class ContentLoader {
5344
5128
  * @param {number} index
5345
5129
  */
5346
5130
  removeByIndex(index) {
5347
- const indexToRemove = this._cachedItems.findIndex(
5348
- (item) => item.index === index
5349
- );
5131
+ const indexToRemove = this._cachedItems.findIndex((item) => item.index === index);
5350
5132
  if (indexToRemove !== -1) {
5351
5133
  this._cachedItems.splice(indexToRemove, 1);
5352
5134
  }
@@ -5401,7 +5183,7 @@ class PhotoSwipeBase extends Eventable {
5401
5183
  // legacy event, before filters were introduced
5402
5184
  const event = this.dispatch("numItems", {
5403
5185
  dataSource,
5404
- numItems,
5186
+ numItems
5405
5187
  });
5406
5188
  return this.applyFilters("numItems", event.numItems, dataSource);
5407
5189
  }
@@ -5456,7 +5238,7 @@ class PhotoSwipeBase extends Eventable {
5456
5238
  // it's a legacy verion before filters were introduced
5457
5239
  const event = this.dispatch("itemData", {
5458
5240
  itemData: itemData || {},
5459
- index,
5241
+ index
5460
5242
  });
5461
5243
  return this.applyFilters("itemData", event.itemData, index);
5462
5244
  }
@@ -5479,11 +5261,8 @@ class PhotoSwipeBase extends Eventable {
5479
5261
  _this$options4.childSelector)
5480
5262
  ) {
5481
5263
  return (
5482
- getElementsFromOption(
5483
- this.options.children,
5484
- this.options.childSelector,
5485
- galleryElement
5486
- ) || []
5264
+ getElementsFromOption(this.options.children, this.options.childSelector, galleryElement) ||
5265
+ []
5487
5266
  );
5488
5267
  }
5489
5268
  return [galleryElement];
@@ -5498,7 +5277,7 @@ class PhotoSwipeBase extends Eventable {
5498
5277
  _domElementToItemData(element) {
5499
5278
  /** @type {SlideData} */
5500
5279
  const itemData = {
5501
- element,
5280
+ element
5502
5281
  };
5503
5282
  const linkEl =
5504
5283
  /** @type {HTMLAnchorElement} */
@@ -5510,12 +5289,8 @@ class PhotoSwipeBase extends Eventable {
5510
5289
  if (linkEl.dataset.pswpSrcset) {
5511
5290
  itemData.srcset = linkEl.dataset.pswpSrcset;
5512
5291
  }
5513
- itemData.width = linkEl.dataset.pswpWidth
5514
- ? parseInt(linkEl.dataset.pswpWidth, 10)
5515
- : 0;
5516
- itemData.height = linkEl.dataset.pswpHeight
5517
- ? parseInt(linkEl.dataset.pswpHeight, 10)
5518
- : 0;
5292
+ itemData.width = linkEl.dataset.pswpWidth ? parseInt(linkEl.dataset.pswpWidth, 10) : 0;
5293
+ itemData.height = linkEl.dataset.pswpHeight ? parseInt(linkEl.dataset.pswpHeight, 10) : 0;
5519
5294
 
5520
5295
  // support legacy w & h properties
5521
5296
  itemData.w = itemData.width;
@@ -5639,10 +5414,7 @@ class Opener {
5639
5414
  this.isOpening = false;
5640
5415
  this.isClosing = true;
5641
5416
  this._duration = this.pswp.options.hideAnimationDuration;
5642
- if (
5643
- slide &&
5644
- slide.currZoomLevel * slide.width >= this.pswp.options.maxWidthToAnimate
5645
- ) {
5417
+ if (slide && slide.currZoomLevel * slide.width >= this.pswp.options.maxWidthToAnimate) {
5646
5418
  this._duration = 0;
5647
5419
  }
5648
5420
  this._applyStartProps();
@@ -5662,11 +5434,7 @@ class Opener {
5662
5434
  this.isOpening = true;
5663
5435
  this.isClosing = false;
5664
5436
  this._duration = this.pswp.options.showAnimationDuration;
5665
- if (
5666
- slide &&
5667
- slide.zoomLevels.initial * slide.width >=
5668
- this.pswp.options.maxWidthToAnimate
5669
- ) {
5437
+ if (slide && slide.zoomLevels.initial * slide.width >= this.pswp.options.maxWidthToAnimate) {
5670
5438
  this._duration = 0;
5671
5439
  }
5672
5440
  this._applyStartProps();
@@ -5691,19 +5459,14 @@ class Opener {
5691
5459
  } else {
5692
5460
  this._thumbBounds = this.pswp.getThumbBounds();
5693
5461
  }
5694
- this._placeholder =
5695
- slide === null || slide === void 0
5696
- ? void 0
5697
- : slide.getPlaceholderElement();
5462
+ this._placeholder = slide === null || slide === void 0 ? void 0 : slide.getPlaceholderElement();
5698
5463
  pswp.animations.stopAll();
5699
5464
 
5700
5465
  // Discard animations when duration is less than 50ms
5701
5466
  this._useAnimation = Boolean(this._duration && this._duration > 50);
5702
5467
  this._animateZoom =
5703
5468
  Boolean(this._thumbBounds) &&
5704
- (slide === null || slide === void 0
5705
- ? void 0
5706
- : slide.content.usePlaceholder()) &&
5469
+ (slide === null || slide === void 0 ? void 0 : slide.content.usePlaceholder()) &&
5707
5470
  (!this.isClosing || !pswp.mainScroll.isShifted());
5708
5471
  if (!this._animateZoom) {
5709
5472
  this._animateRootOpacity = true;
@@ -5719,8 +5482,7 @@ class Opener {
5719
5482
  ? _options$showHideOpac
5720
5483
  : false;
5721
5484
  }
5722
- this._animateBgOpacity =
5723
- !this._animateRootOpacity && this.pswp.options.bgOpacity > MIN_OPACITY;
5485
+ this._animateBgOpacity = !this._animateRootOpacity && this.pswp.options.bgOpacity > MIN_OPACITY;
5724
5486
  this._opacityElement = this._animateRootOpacity ? pswp.element : pswp.bg;
5725
5487
  if (!this._useAnimation) {
5726
5488
  this._duration = 0;
@@ -5741,8 +5503,7 @@ class Opener {
5741
5503
  this._croppedZoom = true;
5742
5504
  this._cropContainer1 = this.pswp.container;
5743
5505
  this._cropContainer2 =
5744
- (_this$pswp$currSlide = this.pswp.currSlide) === null ||
5745
- _this$pswp$currSlide === void 0
5506
+ (_this$pswp$currSlide = this.pswp.currSlide) === null || _this$pswp$currSlide === void 0
5746
5507
  ? void 0
5747
5508
  : _this$pswp$currSlide.holderElement;
5748
5509
  if (pswp.container) {
@@ -5814,14 +5575,12 @@ class Opener {
5814
5575
  new Promise((resolve) => {
5815
5576
  let decoded = false;
5816
5577
  let isDelaying = true;
5817
- decodeImage(/** @type {HTMLImageElement} */ this._placeholder).finally(
5818
- () => {
5819
- decoded = true;
5820
- if (!isDelaying) {
5821
- resolve(true);
5822
- }
5578
+ decodeImage(/** @type {HTMLImageElement} */ this._placeholder).finally(() => {
5579
+ decoded = true;
5580
+ if (!isDelaying) {
5581
+ resolve(true);
5823
5582
  }
5824
- );
5583
+ });
5825
5584
  setTimeout(() => {
5826
5585
  isDelaying = false;
5827
5586
  if (decoded) {
@@ -5840,13 +5599,8 @@ class Opener {
5840
5599
  var _this$pswp$element, _this$pswp$element2;
5841
5600
  (_this$pswp$element = this.pswp.element) === null ||
5842
5601
  _this$pswp$element === void 0 ||
5843
- _this$pswp$element.style.setProperty(
5844
- "--pswp-transition-duration",
5845
- this._duration + "ms"
5846
- );
5847
- this.pswp.dispatch(
5848
- this.isOpening ? "openingAnimationStart" : "closingAnimationStart"
5849
- );
5602
+ _this$pswp$element.style.setProperty("--pswp-transition-duration", this._duration + "ms");
5603
+ this.pswp.dispatch(this.isOpening ? "openingAnimationStart" : "closingAnimationStart");
5850
5604
 
5851
5605
  // legacy event
5852
5606
  this.pswp.dispatch(
@@ -5903,11 +5657,7 @@ class Opener {
5903
5657
  const { pswp } = this;
5904
5658
  if (this._animateZoom) {
5905
5659
  if (this._croppedZoom && this._cropContainer1 && this._cropContainer2) {
5906
- this._animateTo(
5907
- this._cropContainer1,
5908
- "transform",
5909
- "translate3d(0,0,0)"
5910
- );
5660
+ this._animateTo(this._cropContainer1, "transform", "translate3d(0,0,0)");
5911
5661
  this._animateTo(this._cropContainer2, "transform", "none");
5912
5662
  }
5913
5663
  if (pswp.currSlide) {
@@ -5952,16 +5702,9 @@ class Opener {
5952
5702
  const { pswp } = this;
5953
5703
  const { innerRect } = this._thumbBounds;
5954
5704
  const { currSlide, viewportSize } = pswp;
5955
- if (
5956
- this._croppedZoom &&
5957
- innerRect &&
5958
- this._cropContainer1 &&
5959
- this._cropContainer2
5960
- ) {
5961
- const containerOnePanX =
5962
- -viewportSize.x + (this._thumbBounds.x - innerRect.x) + innerRect.w;
5963
- const containerOnePanY =
5964
- -viewportSize.y + (this._thumbBounds.y - innerRect.y) + innerRect.h;
5705
+ if (this._croppedZoom && innerRect && this._cropContainer1 && this._cropContainer2) {
5706
+ const containerOnePanX = -viewportSize.x + (this._thumbBounds.x - innerRect.x) + innerRect.w;
5707
+ const containerOnePanY = -viewportSize.y + (this._thumbBounds.y - innerRect.y) + innerRect.h;
5965
5708
  const containerTwoPanX = viewportSize.x - innerRect.w;
5966
5709
  const containerTwoPanY = viewportSize.y - innerRect.h;
5967
5710
  if (animate) {
@@ -5984,11 +5727,7 @@ class Opener {
5984
5727
  equalizePoints(currSlide.pan, innerRect || this._thumbBounds);
5985
5728
  currSlide.currZoomLevel = this._thumbBounds.w / currSlide.width;
5986
5729
  if (animate) {
5987
- this._animateTo(
5988
- currSlide.container,
5989
- "transform",
5990
- currSlide.getCurrentTransform()
5991
- );
5730
+ this._animateTo(currSlide.container, "transform", currSlide.getCurrentTransform());
5992
5731
  } else {
5993
5732
  currSlide.applyCurrentZoomPan();
5994
5733
  }
@@ -6016,7 +5755,7 @@ class Opener {
6016
5755
  this._onAnimationComplete();
6017
5756
  }
6018
5757
  },
6019
- target,
5758
+ target
6020
5759
  };
6021
5760
  animProps[prop] = propValue;
6022
5761
  animations.startTransition(animProps);
@@ -6252,7 +5991,7 @@ const defaultOptions = {
6252
5991
  index: 0,
6253
5992
  errorMsg: "The image cannot be loaded",
6254
5993
  preload: [1, 2],
6255
- easing: "cubic-bezier(.4,0,.22,1)",
5994
+ easing: "cubic-bezier(.4,0,.22,1)"
6256
5995
  };
6257
5996
 
6258
5997
  /**
@@ -6273,7 +6012,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6273
6012
  */
6274
6013
  this.offset = {
6275
6014
  x: 0,
6276
- y: 0,
6015
+ y: 0
6277
6016
  };
6278
6017
 
6279
6018
  /**
@@ -6282,7 +6021,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6282
6021
  */
6283
6022
  this._prevViewportSize = {
6284
6023
  x: 0,
6285
- y: 0,
6024
+ y: 0
6286
6025
  };
6287
6026
 
6288
6027
  /**
@@ -6292,7 +6031,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6292
6031
  */
6293
6032
  this.viewportSize = {
6294
6033
  x: 0,
6295
- y: 0,
6034
+ y: 0
6296
6035
  };
6297
6036
 
6298
6037
  /**
@@ -6382,7 +6121,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6382
6121
  this.dispatch("gettingData", {
6383
6122
  index: this.currIndex,
6384
6123
  data: this._initialItemData,
6385
- slide: undefined,
6124
+ slide: undefined
6386
6125
  });
6387
6126
 
6388
6127
  // *Layout* - calculate size and position of elements here
@@ -6403,11 +6142,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6403
6142
  this.appendHeavy();
6404
6143
  this.contentLoader.updateLazy();
6405
6144
  this.events.add(window, "resize", this._handlePageResize.bind(this));
6406
- this.events.add(
6407
- window,
6408
- "scroll",
6409
- this._updatePageScrollOffset.bind(this)
6410
- );
6145
+ this.events.add(window, "scroll", this._updatePageScrollOffset.bind(this));
6411
6146
  this.dispatch("bindEvents");
6412
6147
  });
6413
6148
 
@@ -6454,9 +6189,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6454
6189
  * @param {number} index New index
6455
6190
  */
6456
6191
  goTo(index) {
6457
- this.mainScroll.moveIndexBy(
6458
- this.getLoopedIndex(index) - this.potentialIndex
6459
- );
6192
+ this.mainScroll.moveIndexBy(this.getLoopedIndex(index) - this.potentialIndex);
6460
6193
  }
6461
6194
 
6462
6195
  /**
@@ -6529,9 +6262,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6529
6262
  this.scrollWrap.ontouchmove = null;
6530
6263
  this.scrollWrap.ontouchend = null;
6531
6264
  }
6532
- (_this$element = this.element) === null ||
6533
- _this$element === void 0 ||
6534
- _this$element.remove();
6265
+ (_this$element = this.element) === null || _this$element === void 0 || _this$element.remove();
6535
6266
  this.mainScroll.itemHolders.forEach((itemHolder) => {
6536
6267
  var _itemHolder$slide2;
6537
6268
  (_itemHolder$slide2 = itemHolder.slide) === null ||
@@ -6553,11 +6284,9 @@ class PhotoSwipe extends PhotoSwipeBase {
6553
6284
  var _this$currSlide$index, _this$currSlide3;
6554
6285
  let potentialHolderIndex =
6555
6286
  ((_this$currSlide$index =
6556
- (_this$currSlide3 = this.currSlide) === null ||
6557
- _this$currSlide3 === void 0
6287
+ (_this$currSlide3 = this.currSlide) === null || _this$currSlide3 === void 0
6558
6288
  ? void 0
6559
- : _this$currSlide3.index) !== null &&
6560
- _this$currSlide$index !== void 0
6289
+ : _this$currSlide3.index) !== null && _this$currSlide$index !== void 0
6561
6290
  ? _this$currSlide$index
6562
6291
  : 0) -
6563
6292
  1 +
@@ -6623,7 +6352,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6623
6352
  getViewportCenterPoint() {
6624
6353
  return {
6625
6354
  x: this.viewportSize.x / 2,
6626
- y: this.viewportSize.y / 2,
6355
+ y: this.viewportSize.y / 2
6627
6356
  };
6628
6357
  }
6629
6358
 
@@ -6751,11 +6480,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6751
6480
  // Background is added as a separate element,
6752
6481
  // as animating opacity is faster than animating rgba()
6753
6482
  this.bg = createElement("pswp__bg", "div", this.element);
6754
- this.scrollWrap = createElement(
6755
- "pswp__scroll-wrap",
6756
- "section",
6757
- this.element
6758
- );
6483
+ this.scrollWrap = createElement("pswp__scroll-wrap", "section", this.element);
6759
6484
  this.container = createElement("pswp__container", "div", this.scrollWrap);
6760
6485
 
6761
6486
  // aria pattern: carousel
@@ -6808,7 +6533,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6808
6533
  /** @type {PreparedPhotoSwipeOptions} */
6809
6534
  return {
6810
6535
  ...defaultOptions,
6811
- ...options,
6536
+ ...options
6812
6537
  };
6813
6538
  }
6814
6539
  }