hexo-theme-linen 1.0.18 → 1.0.19

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,6 +148,16 @@ function removeTransitionStyle(el) {
150
148
  * @returns {Promise<HTMLImageElement | void>}
151
149
  */
152
150
  function decodeImage(img) {
151
+ // Skip decode for HDR images to prevent Chrome crashes
152
+ if (img.src && img.src.includes("/hdr/")) {
153
+ if (img.complete) {
154
+ return Promise.resolve(img);
155
+ }
156
+ return new Promise((resolve, reject) => {
157
+ img.onload = () => resolve(img);
158
+ img.onerror = reject;
159
+ });
160
+ }
153
161
  if ("decode" in img) {
154
162
  return img.decode().catch(() => {});
155
163
  }
@@ -168,7 +176,7 @@ const LOAD_STATE = {
168
176
  IDLE: "idle",
169
177
  LOADING: "loading",
170
178
  LOADED: "loaded",
171
- ERROR: "error",
179
+ ERROR: "error"
172
180
  };
173
181
 
174
182
  /**
@@ -179,13 +187,7 @@ const LOAD_STATE = {
179
187
  * @returns {boolean}
180
188
  */
181
189
  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
- );
190
+ return ("button" in e && e.button === 1) || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey;
189
191
  }
190
192
 
191
193
  /**
@@ -232,7 +234,7 @@ try {
232
234
  Object.defineProperty({}, "passive", {
233
235
  get: () => {
234
236
  supportsPassive = true;
235
- },
237
+ }
236
238
  })
237
239
  );
238
240
  } catch (e) {}
@@ -333,7 +335,7 @@ class DOMEvents {
333
335
  target,
334
336
  type: eType,
335
337
  listener,
336
- passive,
338
+ passive
337
339
  });
338
340
  }
339
341
  }
@@ -342,7 +344,7 @@ class DOMEvents {
342
344
  // and we do not need browser to scroll the page
343
345
  const eventOptions = supportsPassive
344
346
  ? {
345
- passive: passive || false,
347
+ passive: passive || false
346
348
  }
347
349
  : false;
348
350
  target[methodName](eType, listener, eventOptions);
@@ -374,7 +376,7 @@ function getViewportSize(options, pswp) {
374
376
  // find a way to improve this
375
377
  //
376
378
  // document.documentElement.clientHeight - doesn't seem to work well
377
- y: window.innerHeight,
379
+ y: window.innerHeight
378
380
  };
379
381
  }
380
382
 
@@ -446,7 +448,7 @@ function getPanAreaSize(options, viewportSize, itemData, index) {
446
448
  y:
447
449
  viewportSize.y -
448
450
  parsePaddingOption("top", options, viewportSize, itemData, index) -
449
- parsePaddingOption("bottom", options, viewportSize, itemData, index),
451
+ parsePaddingOption("bottom", options, viewportSize, itemData, index)
450
452
  };
451
453
  }
452
454
 
@@ -466,15 +468,15 @@ class PanBounds {
466
468
  this.currZoomLevel = 1;
467
469
  this.center = /** @type {Point} */ {
468
470
  x: 0,
469
- y: 0,
471
+ y: 0
470
472
  };
471
473
  this.max = /** @type {Point} */ {
472
474
  x: 0,
473
- y: 0,
475
+ y: 0
474
476
  };
475
477
  this.min = /** @type {Point} */ {
476
478
  x: 0,
477
- y: 0,
479
+ y: 0
478
480
  };
479
481
  }
480
482
 
@@ -491,7 +493,7 @@ class PanBounds {
491
493
  this._updateAxis("x");
492
494
  this._updateAxis("y");
493
495
  this.slide.pswp.dispatch("calcBounds", {
494
- slide: this.slide,
496
+ slide: this.slide
495
497
  });
496
498
  }
497
499
  }
@@ -503,8 +505,7 @@ class PanBounds {
503
505
  */
504
506
  _updateAxis(axis) {
505
507
  const { pswp } = this.slide;
506
- const elSize =
507
- this.slide[axis === "x" ? "width" : "height"] * this.currZoomLevel;
508
+ const elSize = this.slide[axis === "x" ? "width" : "height"] * this.currZoomLevel;
508
509
  const paddingProp = axis === "x" ? "left" : "top";
509
510
  const padding = parsePaddingOption(
510
511
  paddingProp,
@@ -521,9 +522,7 @@ class PanBounds {
521
522
 
522
523
  // maximum pan position
523
524
  this.max[axis] =
524
- elSize > panAreaSize
525
- ? Math.round(panAreaSize - elSize) + padding
526
- : this.center[axis];
525
+ elSize > panAreaSize ? Math.round(panAreaSize - elSize) + padding : this.center[axis];
527
526
 
528
527
  // minimum pan position
529
528
  this.min[axis] = elSize > panAreaSize ? padding : this.center[axis];
@@ -603,7 +602,7 @@ class ZoomLevel {
603
602
  /** @type {Point} */
604
603
  const elementSize = {
605
604
  x: maxWidth,
606
- y: maxHeight,
605
+ y: maxHeight
607
606
  };
608
607
  this.elementSize = elementSize;
609
608
  this.panAreaSize = panAreaSize;
@@ -622,7 +621,7 @@ class ZoomLevel {
622
621
  if (this.pswp) {
623
622
  this.pswp.dispatch("zoomLevelsUpdate", {
624
623
  zoomLevels: this,
625
- slideData: this.itemData,
624
+ slideData: this.itemData
626
625
  });
627
626
  }
628
627
  }
@@ -671,10 +670,7 @@ class ZoomLevel {
671
670
 
672
671
  // 3x of "fit" state, but not larger than original
673
672
  currZoomLevel = Math.min(1, this.fit * 3);
674
- if (
675
- this.elementSize &&
676
- currZoomLevel * this.elementSize.x > MAX_IMAGE_WIDTH
677
- ) {
673
+ if (this.elementSize && currZoomLevel * this.elementSize.x > MAX_IMAGE_WIDTH) {
678
674
  currZoomLevel = MAX_IMAGE_WIDTH / this.elementSize.x;
679
675
  }
680
676
  return currZoomLevel;
@@ -725,19 +721,19 @@ class Slide {
725
721
  /** @type {Point} */
726
722
  this.panAreaSize = {
727
723
  x: 0,
728
- y: 0,
724
+ y: 0
729
725
  };
730
726
  /** @type {Point} */
731
727
  this.pan = {
732
728
  x: 0,
733
- y: 0,
729
+ y: 0
734
730
  };
735
731
  this.isFirstSlide = this.isActive && !pswp.opener.isOpen;
736
732
  this.zoomLevels = new ZoomLevel(pswp.options, data, index, pswp);
737
733
  this.pswp.dispatch("gettingData", {
738
734
  slide: this,
739
735
  data: this.data,
740
- index,
736
+ index
741
737
  });
742
738
  this.content = this.pswp.contentLoader.getContentBySlide(this);
743
739
  this.container = createElement("pswp__zoom-wrap", "div");
@@ -753,7 +749,7 @@ class Slide {
753
749
  this.prevDisplayedWidth = -1;
754
750
  this.prevDisplayedHeight = -1;
755
751
  this.pswp.dispatch("slideInit", {
756
- slide: this,
752
+ slide: this
757
753
  });
758
754
  }
759
755
 
@@ -792,11 +788,11 @@ class Slide {
792
788
  this.holderElement.appendChild(this.container);
793
789
  this.zoomAndPanToInitial();
794
790
  this.pswp.dispatch("firstZoomPan", {
795
- slide: this,
791
+ slide: this
796
792
  });
797
793
  this.applyCurrentZoomPan();
798
794
  this.pswp.dispatch("afterSetContent", {
799
- slide: this,
795
+ slide: this
800
796
  });
801
797
  if (this.isActive) {
802
798
  this.activate();
@@ -805,7 +801,7 @@ class Slide {
805
801
  load() {
806
802
  this.content.load(false);
807
803
  this.pswp.dispatch("slideLoad", {
808
- slide: this,
804
+ slide: this
809
805
  });
810
806
  }
811
807
 
@@ -830,7 +826,7 @@ class Slide {
830
826
  }
831
827
  if (
832
828
  this.pswp.dispatch("appendHeavy", {
833
- slide: this,
829
+ slide: this
834
830
  }).defaultPrevented
835
831
  ) {
836
832
  return;
@@ -838,7 +834,7 @@ class Slide {
838
834
  this.heavyAppended = true;
839
835
  this.content.append();
840
836
  this.pswp.dispatch("appendHeavyContent", {
841
- slide: this,
837
+ slide: this
842
838
  });
843
839
  }
844
840
 
@@ -853,7 +849,7 @@ class Slide {
853
849
  this.appendHeavy();
854
850
  this.content.activate();
855
851
  this.pswp.dispatch("slideActivate", {
856
- slide: this,
852
+ slide: this
857
853
  });
858
854
  }
859
855
 
@@ -876,7 +872,7 @@ class Slide {
876
872
  this.applyCurrentZoomPan();
877
873
  this.updateContentSize();
878
874
  this.pswp.dispatch("slideDeactivate", {
879
- slide: this,
875
+ slide: this
880
876
  });
881
877
  }
882
878
 
@@ -889,7 +885,7 @@ class Slide {
889
885
  this.content.remove();
890
886
  this.container.remove();
891
887
  this.pswp.dispatch("slideDestroy", {
892
- slide: this,
888
+ slide: this
893
889
  });
894
890
  }
895
891
  resize() {
@@ -924,10 +920,8 @@ class Slide {
924
920
  if (!scaleMultiplier) {
925
921
  return;
926
922
  }
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;
923
+ const width = Math.round(this.width * scaleMultiplier) || this.pswp.viewportSize.x;
924
+ const height = Math.round(this.height * scaleMultiplier) || this.pswp.viewportSize.y;
931
925
  if (!this.sizeChanged(width, height) && !force) {
932
926
  return;
933
927
  }
@@ -939,10 +933,7 @@ class Slide {
939
933
  * @param {number} height
940
934
  */
941
935
  sizeChanged(width, height) {
942
- if (
943
- width !== this.prevDisplayedWidth ||
944
- height !== this.prevDisplayedHeight
945
- ) {
936
+ if (width !== this.prevDisplayedWidth || height !== this.prevDisplayedHeight) {
946
937
  this.prevDisplayedWidth = width;
947
938
  this.prevDisplayedHeight = height;
948
939
  return true;
@@ -976,7 +967,7 @@ class Slide {
976
967
  pswp.dispatch("beforeZoomTo", {
977
968
  destZoomLevel,
978
969
  centerPoint,
979
- transitionDuration,
970
+ transitionDuration
980
971
  });
981
972
 
982
973
  // stop all pan and zoom transitions
@@ -988,11 +979,7 @@ class Slide {
988
979
 
989
980
  const prevZoomLevel = this.currZoomLevel;
990
981
  if (!ignoreBounds) {
991
- destZoomLevel = clamp(
992
- destZoomLevel,
993
- this.zoomLevels.min,
994
- this.zoomLevels.max
995
- );
982
+ destZoomLevel = clamp(destZoomLevel, this.zoomLevels.min, this.zoomLevels.max);
996
983
  }
997
984
 
998
985
  // if (transitionDuration === undefined) {
@@ -1019,7 +1006,7 @@ class Slide {
1019
1006
  transform: this.getCurrentTransform(),
1020
1007
  onComplete: finishTransition,
1021
1008
  duration: transitionDuration,
1022
- easing: pswp.options.easing,
1009
+ easing: pswp.options.easing
1023
1010
  });
1024
1011
  }
1025
1012
  }
@@ -1073,10 +1060,7 @@ class Slide {
1073
1060
  prevZoomLevel = this.zoomLevels.initial;
1074
1061
  }
1075
1062
  const zoomFactor = this.currZoomLevel / prevZoomLevel;
1076
- return this.bounds.correctPan(
1077
- axis,
1078
- (this.pan[axis] - point[axis]) * zoomFactor + point[axis]
1079
- );
1063
+ return this.bounds.correctPan(axis, (this.pan[axis] - point[axis]) * zoomFactor + point[axis]);
1080
1064
  }
1081
1065
 
1082
1066
  /**
@@ -1112,10 +1096,7 @@ class Slide {
1112
1096
  * the current pan position (this.pan) and zoom level (this.currZoomLevel)
1113
1097
  */
1114
1098
  applyCurrentZoomPan() {
1115
- if (
1116
- this.pswp.gestures.isDragging &&
1117
- !this.pswp.element.classList.contains("action-updating")
1118
- ) {
1099
+ if (this.pswp.gestures.isDragging && !this.pswp.element.classList.contains("action-updating")) {
1119
1100
  this.pswp.element.classList.add("action-updating");
1120
1101
  }
1121
1102
  // else if(!this.pswp.gestures.isDragging && this.pswp.element.classList.contains('action-updating')) {
@@ -1124,7 +1105,7 @@ class Slide {
1124
1105
  this._applyZoomTransform(this.pan.x, this.pan.y, this.currZoomLevel);
1125
1106
  if (this === this.pswp.currSlide) {
1126
1107
  this.pswp.dispatch("zoomPanUpdate", {
1127
- slide: this,
1108
+ slide: this
1128
1109
  });
1129
1110
  }
1130
1111
  }
@@ -1135,7 +1116,7 @@ class Slide {
1135
1116
  this.bounds.update(this.currZoomLevel);
1136
1117
  equalizePoints(this.pan, this.bounds.center);
1137
1118
  this.pswp.dispatch("initialZoomPan", {
1138
- slide: this,
1119
+ slide: this
1139
1120
  });
1140
1121
  }
1141
1122
 
@@ -1159,14 +1140,13 @@ class Slide {
1159
1140
  );
1160
1141
  this.zoomLevels.update(this.width, this.height, this.panAreaSize);
1161
1142
  pswp.dispatch("calcSlideSize", {
1162
- slide: this,
1143
+ slide: this
1163
1144
  });
1164
1145
  }
1165
1146
 
1166
1147
  /** @returns {string} */
1167
1148
  getCurrentTransform() {
1168
- const scale =
1169
- this.currZoomLevel / (this.currentResolution || this.zoomLevels.initial);
1149
+ const scale = this.currZoomLevel / (this.currentResolution || this.zoomLevels.initial);
1170
1150
  return toTransformString(this.pan.x, this.pan.y, scale);
1171
1151
  }
1172
1152
 
@@ -1230,7 +1210,7 @@ class DragHandler {
1230
1210
  /** @type {Point} */
1231
1211
  this.startPan = {
1232
1212
  x: 0,
1233
- y: 0,
1213
+ y: 0
1234
1214
  };
1235
1215
  }
1236
1216
  start() {
@@ -1253,12 +1233,11 @@ class DragHandler {
1253
1233
  const panY = currSlide.pan.y + (p1.y - prevP1.y);
1254
1234
  if (
1255
1235
  !this.pswp.dispatch("verticalDrag", {
1256
- panY,
1236
+ panY
1257
1237
  }).defaultPrevented
1258
1238
  ) {
1259
1239
  this._setPanWithFriction("y", panY, VERTICAL_DRAG_FRICTION);
1260
- const bgOpacity =
1261
- 1 - Math.abs(this._getVerticalDragRatio(currSlide.pan.y));
1240
+ const bgOpacity = 1 - Math.abs(this._getVerticalDragRatio(currSlide.pan.y));
1262
1241
  this.pswp.applyBgOpacity(bgOpacity);
1263
1242
  currSlide.applyCurrentZoomPan();
1264
1243
  }
@@ -1288,8 +1267,7 @@ class DragHandler {
1288
1267
  // 0 - slide is not visible at all,
1289
1268
  // 0.5 - half of the slide is visible
1290
1269
  // 1 - slide is fully visible
1291
- const currentSlideVisibilityRatio =
1292
- mainScrollShiftDiff / this.pswp.viewportSize.x;
1270
+ const currentSlideVisibilityRatio = mainScrollShiftDiff / this.pswp.viewportSize.x;
1293
1271
 
1294
1272
  // Go next slide.
1295
1273
  //
@@ -1300,16 +1278,14 @@ class DragHandler {
1300
1278
  // and velocity is close to 0
1301
1279
  //
1302
1280
  if (
1303
- (velocity.x < -MIN_NEXT_SLIDE_SPEED &&
1304
- currentSlideVisibilityRatio < 0) ||
1281
+ (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0) ||
1305
1282
  (velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5)
1306
1283
  ) {
1307
1284
  // Go to next slide
1308
1285
  indexDiff = 1;
1309
1286
  velocity.x = Math.min(velocity.x, 0);
1310
1287
  } else if (
1311
- (velocity.x > MIN_NEXT_SLIDE_SPEED &&
1312
- currentSlideVisibilityRatio > 0) ||
1288
+ (velocity.x > MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio > 0) ||
1313
1289
  (velocity.x > -0.1 && currentSlideVisibilityRatio > 0.5)
1314
1290
  ) {
1315
1291
  // Go to prev slide
@@ -1354,8 +1330,7 @@ class DragHandler {
1354
1330
  const decelerationRate = 0.995; // 0.99
1355
1331
 
1356
1332
  // Pan position if there is no bounds
1357
- const projectedPosition =
1358
- panPos + project(velocity[axis], decelerationRate);
1333
+ const projectedPosition = panPos + project(velocity[axis], decelerationRate);
1359
1334
  if (restoreBgOpacity) {
1360
1335
  const vDragRatio = this._getVerticalDragRatio(panPos);
1361
1336
  const projectedVDragRatio = this._getVerticalDragRatio(projectedPosition);
@@ -1398,19 +1373,13 @@ class DragHandler {
1398
1373
  // Animate opacity of background relative to Y pan position of an image
1399
1374
  if (restoreBgOpacity && this.pswp.bgOpacity < 1) {
1400
1375
  // 0 - start of animation, 1 - end of animation
1401
- const animationProgressRatio =
1402
- 1 - (correctedPanPosition - pos) / totalPanDist;
1376
+ const animationProgressRatio = 1 - (correctedPanPosition - pos) / totalPanDist;
1403
1377
 
1404
1378
  // We clamp opacity to keep it between 0 and 1.
1405
1379
  // As progress ratio can be larger than 1 due to overshoot,
1406
1380
  // and we do not want to bounce opacity.
1407
1381
  this.pswp.applyBgOpacity(
1408
- clamp(
1409
- initialBgOpacity +
1410
- (1 - initialBgOpacity) * animationProgressRatio,
1411
- 0,
1412
- 1
1413
- )
1382
+ clamp(initialBgOpacity + (1 - initialBgOpacity) * animationProgressRatio, 0, 1)
1414
1383
  );
1415
1384
  }
1416
1385
  pan[axis] = Math.floor(pos);
@@ -1420,7 +1389,7 @@ class DragHandler {
1420
1389
  if (this.pswp.element.classList.contains("action-updating")) {
1421
1390
  this.pswp.element.classList.remove("action-updating");
1422
1391
  }
1423
- },
1392
+ }
1424
1393
  });
1425
1394
  }
1426
1395
 
@@ -1450,12 +1419,7 @@ class DragHandler {
1450
1419
  }
1451
1420
  const { bounds } = currSlide;
1452
1421
  const newPan = currSlide.pan[axis] + delta;
1453
- if (
1454
- this.pswp.options.allowPanToNext &&
1455
- dragAxis === "x" &&
1456
- axis === "x" &&
1457
- !isMultitouch
1458
- ) {
1422
+ if (this.pswp.options.allowPanToNext && dragAxis === "x" && axis === "x" && !isMultitouch) {
1459
1423
  const currSlideMainScrollX = mainScroll.getCurrSlideX();
1460
1424
 
1461
1425
  // Position of the main scroll relative to the viewport
@@ -1493,17 +1457,11 @@ class DragHandler {
1493
1457
  if (mainScrollShiftDiff !== 0) {
1494
1458
  // If main scroll is shifted right
1495
1459
  if (mainScrollShiftDiff > 0 /*&& isRightToLeft*/) {
1496
- mainScroll.moveTo(
1497
- Math.max(newMainScrollX, currSlideMainScrollX),
1498
- true
1499
- );
1460
+ mainScroll.moveTo(Math.max(newMainScrollX, currSlideMainScrollX), true);
1500
1461
  return true;
1501
1462
  } else if (mainScrollShiftDiff < 0 /*&& isLeftToRight*/) {
1502
1463
  // 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
- );
1464
+ mainScroll.moveTo(Math.min(newMainScrollX, currSlideMainScrollX), true);
1507
1465
  return true;
1508
1466
  }
1509
1467
  } else {
@@ -1543,11 +1501,9 @@ class DragHandler {
1543
1501
  return (
1544
1502
  (panY -
1545
1503
  ((_this$pswp$currSlide$ =
1546
- (_this$pswp$currSlide = this.pswp.currSlide) === null ||
1547
- _this$pswp$currSlide === void 0
1504
+ (_this$pswp$currSlide = this.pswp.currSlide) === null || _this$pswp$currSlide === void 0
1548
1505
  ? void 0
1549
- : _this$pswp$currSlide.bounds.center.y) !== null &&
1550
- _this$pswp$currSlide$ !== void 0
1506
+ : _this$pswp$currSlide.bounds.center.y) !== null && _this$pswp$currSlide$ !== void 0
1551
1507
  ? _this$pswp$currSlide$
1552
1508
  : 0)) /
1553
1509
  (this.pswp.viewportSize.y / 3)
@@ -1612,7 +1568,7 @@ class ZoomHandler {
1612
1568
  */
1613
1569
  this._startPan = {
1614
1570
  x: 0,
1615
- y: 0,
1571
+ y: 0
1616
1572
  };
1617
1573
  /**
1618
1574
  * @private
@@ -1620,7 +1576,7 @@ class ZoomHandler {
1620
1576
  */
1621
1577
  this._startZoomPoint = {
1622
1578
  x: 0,
1623
- y: 0,
1579
+ y: 0
1624
1580
  };
1625
1581
  /**
1626
1582
  * @private
@@ -1628,7 +1584,7 @@ class ZoomHandler {
1628
1584
  */
1629
1585
  this._zoomPoint = {
1630
1586
  x: 0,
1631
- y: 0,
1587
+ y: 0
1632
1588
  };
1633
1589
  /** @private */
1634
1590
  this._wasOverFitZoomLevel = false;
@@ -1663,10 +1619,7 @@ class ZoomHandler {
1663
1619
  this._startZoomLevel;
1664
1620
 
1665
1621
  // slightly over the zoom.fit
1666
- if (
1667
- currZoomLevel >
1668
- currSlide.zoomLevels.initial + currSlide.zoomLevels.initial / 15
1669
- ) {
1622
+ if (currZoomLevel > currSlide.zoomLevels.initial + currSlide.zoomLevels.initial / 15) {
1670
1623
  this._wasOverFitZoomLevel = true;
1671
1624
  }
1672
1625
  if (currZoomLevel < minZoomLevel) {
@@ -1676,24 +1629,21 @@ class ZoomHandler {
1676
1629
  this._startZoomLevel <= currSlide.zoomLevels.initial
1677
1630
  ) {
1678
1631
  // fade out background if zooming out
1679
- const bgOpacity =
1680
- 1 - (minZoomLevel - currZoomLevel) / (minZoomLevel / 1.2);
1632
+ const bgOpacity = 1 - (minZoomLevel - currZoomLevel) / (minZoomLevel / 1.2);
1681
1633
  if (
1682
1634
  !pswp.dispatch("pinchClose", {
1683
- bgOpacity,
1635
+ bgOpacity
1684
1636
  }).defaultPrevented
1685
1637
  ) {
1686
1638
  pswp.applyBgOpacity(bgOpacity);
1687
1639
  }
1688
1640
  } else {
1689
1641
  // Apply the friction if zoom level is below the min
1690
- currZoomLevel =
1691
- minZoomLevel - (minZoomLevel - currZoomLevel) * LOWER_ZOOM_FRICTION;
1642
+ currZoomLevel = minZoomLevel - (minZoomLevel - currZoomLevel) * LOWER_ZOOM_FRICTION;
1692
1643
  }
1693
1644
  } else if (currZoomLevel > maxZoomLevel) {
1694
1645
  // Apply the friction if zoom level is above the max
1695
- currZoomLevel =
1696
- maxZoomLevel + (currZoomLevel - maxZoomLevel) * UPPER_ZOOM_FRICTION;
1646
+ currZoomLevel = maxZoomLevel + (currZoomLevel - maxZoomLevel) * UPPER_ZOOM_FRICTION;
1697
1647
  }
1698
1648
  currSlide.pan.x = this._calculatePanForZoomLevel("x", currZoomLevel);
1699
1649
  currSlide.pan.y = this._calculatePanForZoomLevel("y", currZoomLevel);
@@ -1722,10 +1672,7 @@ class ZoomHandler {
1722
1672
  */
1723
1673
  _calculatePanForZoomLevel(axis, currZoomLevel) {
1724
1674
  const zoomFactor = currZoomLevel / this._startZoomLevel;
1725
- return (
1726
- this._zoomPoint[axis] -
1727
- (this._startZoomPoint[axis] - this._startPan[axis]) * zoomFactor
1728
- );
1675
+ return this._zoomPoint[axis] - (this._startZoomPoint[axis] - this._startPan[axis]) * zoomFactor;
1729
1676
  }
1730
1677
 
1731
1678
  /**
@@ -1739,9 +1686,7 @@ class ZoomHandler {
1739
1686
  correctZoomPan(ignoreGesture) {
1740
1687
  const { pswp } = this.gestures;
1741
1688
  const { currSlide } = pswp;
1742
- if (
1743
- !(currSlide !== null && currSlide !== void 0 && currSlide.isZoomable())
1744
- ) {
1689
+ if (!(currSlide !== null && currSlide !== void 0 && currSlide.isZoomable())) {
1745
1690
  return;
1746
1691
  }
1747
1692
  if (this._zoomPoint.x === 0) {
@@ -1767,14 +1712,14 @@ class ZoomHandler {
1767
1712
  const initialPan = equalizePoints(
1768
1713
  {
1769
1714
  x: 0,
1770
- y: 0,
1715
+ y: 0
1771
1716
  },
1772
1717
  currSlide.pan
1773
1718
  );
1774
1719
  let destinationPan = equalizePoints(
1775
1720
  {
1776
1721
  x: 0,
1777
- y: 0,
1722
+ y: 0
1778
1723
  },
1779
1724
  initialPan
1780
1725
  );
@@ -1789,7 +1734,7 @@ class ZoomHandler {
1789
1734
  if (currZoomLevelNeedsChange) {
1790
1735
  destinationPan = {
1791
1736
  x: this._calculatePanForZoomLevel("x", destinationZoomLevel),
1792
- y: this._calculatePanForZoomLevel("y", destinationZoomLevel),
1737
+ y: this._calculatePanForZoomLevel("y", destinationZoomLevel)
1793
1738
  };
1794
1739
  }
1795
1740
 
@@ -1797,7 +1742,7 @@ class ZoomHandler {
1797
1742
  currSlide.setZoomLevel(destinationZoomLevel);
1798
1743
  destinationPan = {
1799
1744
  x: currSlide.bounds.correctPan("x", destinationPan.x),
1800
- y: currSlide.bounds.correctPan("y", destinationPan.y),
1745
+ y: currSlide.bounds.correctPan("y", destinationPan.y)
1801
1746
  };
1802
1747
 
1803
1748
  // return zoom level and its bounds to initial
@@ -1824,14 +1769,11 @@ class ZoomHandler {
1824
1769
 
1825
1770
  if (panNeedsChange || currZoomLevelNeedsChange) {
1826
1771
  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;
1772
+ currSlide.pan.x = initialPan.x + (destinationPan.x - initialPan.x) * now;
1773
+ currSlide.pan.y = initialPan.y + (destinationPan.y - initialPan.y) * now;
1831
1774
  }
1832
1775
  if (currZoomLevelNeedsChange) {
1833
- const newZoomLevel =
1834
- prevZoomLevel + (destinationZoomLevel - prevZoomLevel) * now;
1776
+ const newZoomLevel = prevZoomLevel + (destinationZoomLevel - prevZoomLevel) * now;
1835
1777
  currSlide.setZoomLevel(newZoomLevel);
1836
1778
  }
1837
1779
  currSlide.applyCurrentZoomPan();
@@ -1842,16 +1784,14 @@ class ZoomHandler {
1842
1784
  // We clamp opacity to keep it between 0 and 1.
1843
1785
  // As progress ratio can be larger than 1 due to overshoot,
1844
1786
  // and we do not want to bounce opacity.
1845
- pswp.applyBgOpacity(
1846
- clamp(initialBgOpacity + (1 - initialBgOpacity) * now, 0, 1)
1847
- );
1787
+ pswp.applyBgOpacity(clamp(initialBgOpacity + (1 - initialBgOpacity) * now, 0, 1));
1848
1788
  }
1849
1789
  },
1850
1790
  onComplete: () => {
1851
1791
  // update resolution after transition ends
1852
1792
  currSlide._setResolution(destinationZoomLevel);
1853
1793
  currSlide.applyCurrentZoomPan();
1854
- },
1794
+ }
1855
1795
  });
1856
1796
  }
1857
1797
  }
@@ -1875,9 +1815,7 @@ class ZoomHandler {
1875
1815
  * @returns {boolean}
1876
1816
  */
1877
1817
  function didTapOnMainContent(event) {
1878
- return !!(
1879
- /** @type {HTMLElement} */ event.target.closest(".pswp__container")
1880
- );
1818
+ return !!(/** @type {HTMLElement} */ event.target.closest(".pswp__container"));
1881
1819
  }
1882
1820
 
1883
1821
  /**
@@ -1896,12 +1834,10 @@ class TapHandler {
1896
1834
  * @param {PointerEvent} originalEvent
1897
1835
  */
1898
1836
  click(point, originalEvent) {
1899
- const targetClassList =
1900
- /** @type {HTMLElement} */ originalEvent.target.classList;
1837
+ const targetClassList = /** @type {HTMLElement} */ originalEvent.target.classList;
1901
1838
  const isImageClick = targetClassList.contains("pswp__img");
1902
1839
  const isBackgroundClick =
1903
- targetClassList.contains("pswp__item") ||
1904
- targetClassList.contains("pswp__zoom-wrap");
1840
+ targetClassList.contains("pswp__item") || targetClassList.contains("pswp__zoom-wrap");
1905
1841
  if (isImageClick) {
1906
1842
  this._doClickOrTapAction("imageClick", point, originalEvent);
1907
1843
  } else if (isBackgroundClick) {
@@ -1939,13 +1875,12 @@ class TapHandler {
1939
1875
  var _this$gestures$pswp$e;
1940
1876
  const { pswp } = this.gestures;
1941
1877
  const { currSlide } = pswp;
1942
- const actionFullName =
1943
- /** @type {AddPostfix<Actions, 'Action'>} */ actionName + "Action";
1878
+ const actionFullName = /** @type {AddPostfix<Actions, 'Action'>} */ actionName + "Action";
1944
1879
  const optionValue = pswp.options[actionFullName];
1945
1880
  if (
1946
1881
  pswp.dispatch(actionFullName, {
1947
1882
  point,
1948
- originalEvent,
1883
+ originalEvent
1949
1884
  }).defaultPrevented
1950
1885
  ) {
1951
1886
  return;
@@ -1960,9 +1895,7 @@ class TapHandler {
1960
1895
  pswp[optionValue]();
1961
1896
  break;
1962
1897
  case "zoom":
1963
- currSlide === null ||
1964
- currSlide === void 0 ||
1965
- currSlide.toggleZoom(point);
1898
+ currSlide === null || currSlide === void 0 || currSlide.toggleZoom(point);
1966
1899
  break;
1967
1900
  case "zoom-or-close":
1968
1901
  // by default click zooms current image,
@@ -2027,37 +1960,37 @@ class Gestures {
2027
1960
  /** @type {Point} */
2028
1961
  this.p1 = {
2029
1962
  x: 0,
2030
- y: 0,
1963
+ y: 0
2031
1964
  }; // the first pressed pointer
2032
1965
  /** @type {Point} */
2033
1966
  this.p2 = {
2034
1967
  x: 0,
2035
- y: 0,
1968
+ y: 0
2036
1969
  }; // the second pressed pointer
2037
1970
  /** @type {Point} */
2038
1971
  this.prevP1 = {
2039
1972
  x: 0,
2040
- y: 0,
1973
+ y: 0
2041
1974
  };
2042
1975
  /** @type {Point} */
2043
1976
  this.prevP2 = {
2044
1977
  x: 0,
2045
- y: 0,
1978
+ y: 0
2046
1979
  };
2047
1980
  /** @type {Point} */
2048
1981
  this.startP1 = {
2049
1982
  x: 0,
2050
- y: 0,
1983
+ y: 0
2051
1984
  };
2052
1985
  /** @type {Point} */
2053
1986
  this.startP2 = {
2054
1987
  x: 0,
2055
- y: 0,
1988
+ y: 0
2056
1989
  };
2057
1990
  /** @type {Point} */
2058
1991
  this.velocity = {
2059
1992
  x: 0,
2060
- y: 0,
1993
+ y: 0
2061
1994
  };
2062
1995
 
2063
1996
  /** @type {Point}
@@ -2065,14 +1998,14 @@ class Gestures {
2065
1998
  */
2066
1999
  this._lastStartP1 = {
2067
2000
  x: 0,
2068
- y: 0,
2001
+ y: 0
2069
2002
  };
2070
2003
  /** @type {Point}
2071
2004
  * @private
2072
2005
  */
2073
2006
  this._intervalP1 = {
2074
2007
  x: 0,
2075
- y: 0,
2008
+ y: 0
2076
2009
  };
2077
2010
  /** @private */
2078
2011
  this._numActivePoints = 0;
@@ -2085,8 +2018,7 @@ class Gestures {
2085
2018
  /** @private */
2086
2019
  this._pointerEventEnabled = !!window.PointerEvent;
2087
2020
  this.supportsTouch =
2088
- this._touchEventEnabled ||
2089
- (this._pointerEventEnabled && navigator.maxTouchPoints > 1);
2021
+ this._touchEventEnabled || (this._pointerEventEnabled && navigator.maxTouchPoints > 1);
2090
2022
  /** @private */
2091
2023
  this._numActivePoints = 0;
2092
2024
  /** @private */
@@ -2154,16 +2086,8 @@ class Gestures {
2154
2086
  pref + down,
2155
2087
  /** @type EventListener */ this.onPointerDown.bind(this)
2156
2088
  );
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
- );
2089
+ events.add(window, pref + "move", /** @type EventListener */ this.onPointerMove.bind(this));
2090
+ events.add(window, pref + up, /** @type EventListener */ this.onPointerUp.bind(this));
2167
2091
  if (cancelEvent) {
2168
2092
  events.add(
2169
2093
  pswp.scrollWrap,
@@ -2200,7 +2124,7 @@ class Gestures {
2200
2124
  }
2201
2125
  if (
2202
2126
  pswp.dispatch("pointerDown", {
2203
- originalEvent: e,
2127
+ originalEvent: e
2204
2128
  }).defaultPrevented
2205
2129
  ) {
2206
2130
  return;
@@ -2240,7 +2164,7 @@ class Gestures {
2240
2164
  this._updatePoints(e, "move");
2241
2165
  if (
2242
2166
  this.pswp.dispatch("pointerMove", {
2243
- originalEvent: e,
2167
+ originalEvent: e
2244
2168
  }).defaultPrevented
2245
2169
  ) {
2246
2170
  return;
@@ -2310,7 +2234,7 @@ class Gestures {
2310
2234
  this._updatePoints(e, "up");
2311
2235
  if (
2312
2236
  this.pswp.dispatch("pointerUp", {
2313
- originalEvent: e,
2237
+ originalEvent: e
2314
2238
  }).defaultPrevented
2315
2239
  ) {
2316
2240
  return;
@@ -2347,10 +2271,7 @@ class Gestures {
2347
2271
  this.drag.change();
2348
2272
  }
2349
2273
  } /* if (this.isZooming) */ else {
2350
- if (
2351
- !pointsEqual(this.p1, this.prevP1) ||
2352
- !pointsEqual(this.p2, this.prevP2)
2353
- ) {
2274
+ if (!pointsEqual(this.p1, this.prevP1) || !pointsEqual(this.p2, this.prevP2)) {
2354
2275
  this.zoomLevels.change();
2355
2276
  }
2356
2277
  }
@@ -2413,9 +2334,7 @@ class Gestures {
2413
2334
  if (this._tapTimer) {
2414
2335
  this._clearTapTimer();
2415
2336
  // Check if two taps were more or less on the same place
2416
- if (
2417
- getDistanceBetween(this._lastStartP1, this.startP1) < MIN_TAP_DISTANCE
2418
- ) {
2337
+ if (getDistanceBetween(this._lastStartP1, this.startP1) < MIN_TAP_DISTANCE) {
2419
2338
  this.tapHandler.doubleTap(this.startP1, e);
2420
2339
  }
2421
2340
  } else {
@@ -2470,12 +2389,7 @@ class Gestures {
2470
2389
  * @param {'up' | 'down' | 'move'} pointerType Normalized pointer type
2471
2390
  */
2472
2391
  _preventPointerEventBehaviour(e, pointerType) {
2473
- const preventPointerEvent = this.pswp.applyFilters(
2474
- "preventPointerEvent",
2475
- true,
2476
- e,
2477
- pointerType
2478
- );
2392
+ const preventPointerEvent = this.pswp.applyFilters("preventPointerEvent", true, e, pointerType);
2479
2393
  if (preventPointerEvent) {
2480
2394
  e.preventDefault();
2481
2395
  }
@@ -2504,15 +2418,12 @@ class Gestures {
2504
2418
  this._ongoingPointers.push(
2505
2419
  this._convertEventPosToPoint(pointerEvent, {
2506
2420
  x: 0,
2507
- y: 0,
2421
+ y: 0
2508
2422
  })
2509
2423
  );
2510
2424
  } else if (pointerIndex > -1) {
2511
2425
  // update existing pointer
2512
- this._convertEventPosToPoint(
2513
- pointerEvent,
2514
- this._ongoingPointers[pointerIndex]
2515
- );
2426
+ this._convertEventPosToPoint(pointerEvent, this._ongoingPointers[pointerIndex]);
2516
2427
  }
2517
2428
  this._numActivePoints = this._ongoingPointers.length;
2518
2429
 
@@ -2575,16 +2486,11 @@ class Gestures {
2575
2486
  this.dragAxis = "x";
2576
2487
  } else {
2577
2488
  // 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);
2489
+ const diff = Math.abs(this.p1.x - this.startP1.x) - Math.abs(this.p1.y - this.startP1.y);
2581
2490
  if (diff !== 0) {
2582
2491
  // check if pointer was shifted horizontally or vertically
2583
2492
  const axisToCheck = diff > 0 ? "x" : "y";
2584
- if (
2585
- Math.abs(this.p1[axisToCheck] - this.startP1[axisToCheck]) >=
2586
- AXIS_SWIPE_HYSTERISIS
2587
- ) {
2493
+ if (Math.abs(this.p1[axisToCheck] - this.startP1[axisToCheck]) >= AXIS_SWIPE_HYSTERISIS) {
2588
2494
  this.dragAxis = axisToCheck;
2589
2495
  }
2590
2496
  }
@@ -2681,10 +2587,7 @@ class MainScroll {
2681
2587
  }
2682
2588
  this.itemHolders.forEach((itemHolder, index) => {
2683
2589
  if (slideWidthChanged) {
2684
- setTransform(
2685
- itemHolder.el,
2686
- (index + this._containerShiftIndex) * this.slideWidth
2687
- );
2590
+ setTransform(itemHolder.el, (index + this._containerShiftIndex) * this.slideWidth);
2688
2591
  }
2689
2592
  if (resizeSlides && itemHolder.slide) {
2690
2593
  itemHolder.slide.resize();
@@ -2726,7 +2629,7 @@ class MainScroll {
2726
2629
  // hide nearby item holders until initial zoom animation finishes (to avoid extra Paints)
2727
2630
  el.style.display = i === 1 ? "block" : "none";
2728
2631
  this.itemHolders.push({
2729
- el,
2632
+ el
2730
2633
  //index: -1
2731
2634
  });
2732
2635
  }
@@ -2799,7 +2702,7 @@ class MainScroll {
2799
2702
  onComplete: () => {
2800
2703
  this.updateCurrItem();
2801
2704
  pswp.appendHeavy();
2802
- },
2705
+ }
2803
2706
  });
2804
2707
  let currDiff = pswp.potentialIndex - pswp.currIndex;
2805
2708
  if (pswp.canLoop()) {
@@ -2846,8 +2749,7 @@ class MainScroll {
2846
2749
  updateCurrItem() {
2847
2750
  var _this$itemHolders$;
2848
2751
  const { pswp } = this;
2849
- const positionDifference =
2850
- this._prevPositionIndex - this._currPositionIndex;
2752
+ const positionDifference = this._prevPositionIndex - this._currPositionIndex;
2851
2753
  if (!positionDifference) {
2852
2754
  return;
2853
2755
  }
@@ -2857,8 +2759,7 @@ class MainScroll {
2857
2759
  /** @type {ItemHolder | undefined} */
2858
2760
  let tempHolder;
2859
2761
  if (diffAbs >= 3) {
2860
- this._containerShiftIndex +=
2861
- positionDifference + (positionDifference > 0 ? -3 : 3);
2762
+ this._containerShiftIndex += positionDifference + (positionDifference > 0 ? -3 : 3);
2862
2763
  diffAbs = 3;
2863
2764
 
2864
2765
  // If slides are changed by 3 screens or more - clean up previous slides
@@ -2877,10 +2778,7 @@ class MainScroll {
2877
2778
  this.itemHolders[2] = tempHolder; // move first to last
2878
2779
 
2879
2780
  this._containerShiftIndex++;
2880
- setTransform(
2881
- tempHolder.el,
2882
- (this._containerShiftIndex + 2) * this.slideWidth
2883
- );
2781
+ setTransform(tempHolder.el, (this._containerShiftIndex + 2) * this.slideWidth);
2884
2782
  pswp.setContent(tempHolder, pswp.currIndex - diffAbs + i + 2);
2885
2783
  }
2886
2784
  } else {
@@ -2889,10 +2787,7 @@ class MainScroll {
2889
2787
  this.itemHolders.unshift(tempHolder); // move last to first
2890
2788
 
2891
2789
  this._containerShiftIndex--;
2892
- setTransform(
2893
- tempHolder.el,
2894
- this._containerShiftIndex * this.slideWidth
2895
- );
2790
+ setTransform(tempHolder.el, this._containerShiftIndex * this.slideWidth);
2896
2791
  pswp.setContent(tempHolder, pswp.currIndex + diffAbs - i - 2);
2897
2792
  }
2898
2793
  }
@@ -2918,8 +2813,7 @@ class MainScroll {
2918
2813
  }
2919
2814
  });
2920
2815
  pswp.currSlide =
2921
- (_this$itemHolders$ = this.itemHolders[1]) === null ||
2922
- _this$itemHolders$ === void 0
2816
+ (_this$itemHolders$ = this.itemHolders[1]) === null || _this$itemHolders$ === void 0
2923
2817
  ? void 0
2924
2818
  : _this$itemHolders$.slide;
2925
2819
  pswp.contentLoader.updateLazy(positionDifference);
@@ -2939,8 +2833,7 @@ class MainScroll {
2939
2833
  moveTo(x, dragging) {
2940
2834
  if (!this.pswp.canLoop() && dragging) {
2941
2835
  // Apply friction
2942
- let newSlideIndexOffset =
2943
- (this.slideWidth * this._currPositionIndex - x) / this.slideWidth;
2836
+ let newSlideIndexOffset = (this.slideWidth * this._currPositionIndex - x) / this.slideWidth;
2944
2837
  newSlideIndexOffset += this.pswp.currIndex;
2945
2838
  const delta = Math.round(x - this.x);
2946
2839
  if (
@@ -2956,7 +2849,7 @@ class MainScroll {
2956
2849
  }
2957
2850
  this.pswp.dispatch("moveMainScroll", {
2958
2851
  x,
2959
- dragging: dragging !== null && dragging !== void 0 ? dragging : false,
2852
+ dragging: dragging !== null && dragging !== void 0 ? dragging : false
2960
2853
  });
2961
2854
  }
2962
2855
  }
@@ -2975,7 +2868,7 @@ const KeyboardKeyCodesMap = {
2975
2868
  ArrowUp: 38,
2976
2869
  ArrowRight: 39,
2977
2870
  ArrowDown: 40,
2978
- Tab: 9,
2871
+ Tab: 9
2979
2872
  };
2980
2873
 
2981
2874
  /**
@@ -3009,17 +2902,9 @@ class Keyboard {
3009
2902
  // that's why we delay it until the opener transition ends
3010
2903
  this._focusRoot();
3011
2904
  }
3012
- pswp.events.add(
3013
- document,
3014
- "focusin",
3015
- /** @type EventListener */ this._onFocusIn.bind(this)
3016
- );
2905
+ pswp.events.add(document, "focusin", /** @type EventListener */ this._onFocusIn.bind(this));
3017
2906
  }
3018
- pswp.events.add(
3019
- document,
3020
- "keydown",
3021
- /** @type EventListener */ this._onKeyDown.bind(this)
3022
- );
2907
+ pswp.events.add(document, "keydown", /** @type EventListener */ this._onKeyDown.bind(this));
3023
2908
  });
3024
2909
  const lastActiveElement = /** @type {HTMLElement} */ document.activeElement;
3025
2910
  pswp.on("destroy", () => {
@@ -3045,7 +2930,7 @@ class Keyboard {
3045
2930
  const { pswp } = this;
3046
2931
  if (
3047
2932
  pswp.dispatch("keydown", {
3048
- originalEvent: e,
2933
+ originalEvent: e
3049
2934
  }).defaultPrevented
3050
2935
  ) {
3051
2936
  return;
@@ -3098,10 +2983,7 @@ class Keyboard {
3098
2983
  const { currSlide } = pswp;
3099
2984
  if (pswp.options.arrowKeys && axis === "x" && pswp.getNumItems() > 1) {
3100
2985
  keydownAction = isForward ? "next" : "prev";
3101
- } else if (
3102
- currSlide &&
3103
- currSlide.currZoomLevel > currSlide.zoomLevels.fit
3104
- ) {
2986
+ } else if (currSlide && currSlide.currZoomLevel > currSlide.zoomLevels.fit) {
3105
2987
  // up/down arrow keys pan the image vertically
3106
2988
  // left/right arrow keys pan horizontally.
3107
2989
  // Unless there is only one image,
@@ -3170,16 +3052,14 @@ class CSSAnimation {
3170
3052
  transform,
3171
3053
  onFinish = () => {},
3172
3054
  duration = 333,
3173
- easing = DEFAULT_EASING,
3055
+ easing = DEFAULT_EASING
3174
3056
  } = props;
3175
3057
  this.onFinish = onFinish;
3176
3058
 
3177
3059
  // support only transform and opacity
3178
3060
  const prop = transform ? "transform" : "opacity";
3179
3061
  const propValue =
3180
- (_props$prop = props[prop]) !== null && _props$prop !== void 0
3181
- ? _props$prop
3182
- : "";
3062
+ (_props$prop = props[prop]) !== null && _props$prop !== void 0 ? _props$prop : "";
3183
3063
 
3184
3064
  /** @private */
3185
3065
  this._target = target;
@@ -3202,11 +3082,7 @@ class CSSAnimation {
3202
3082
  setTransitionStyle(target, prop, duration, easing);
3203
3083
  this._helperTimeout = setTimeout(() => {
3204
3084
  target.addEventListener("transitionend", this._onTransitionEnd, false);
3205
- target.addEventListener(
3206
- "transitioncancel",
3207
- this._onTransitionEnd,
3208
- false
3209
- );
3085
+ target.addEventListener("transitioncancel", this._onTransitionEnd, false);
3210
3086
 
3211
3087
  // Safari occasionally does not emit transitionend event
3212
3088
  // if element property was modified during the transition,
@@ -3249,16 +3125,8 @@ class CSSAnimation {
3249
3125
  clearTimeout(this._helperTimeout);
3250
3126
  }
3251
3127
  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
- );
3128
+ this._target.removeEventListener("transitionend", this._onTransitionEnd, false);
3129
+ this._target.removeEventListener("transitioncancel", this._onTransitionEnd, false);
3262
3130
  if (!this._finished) {
3263
3131
  this._finalizeAnimation();
3264
3132
  }
@@ -3297,9 +3165,7 @@ class SpringEaser {
3297
3165
  this._naturalFrequency = naturalFrequency || DEFAULT_NATURAL_FREQUENCY;
3298
3166
  this._dampedFrequency = this._naturalFrequency;
3299
3167
  if (this._dampingRatio < 1) {
3300
- this._dampedFrequency *= Math.sqrt(
3301
- 1 - this._dampingRatio * this._dampingRatio
3302
- );
3168
+ this._dampedFrequency *= Math.sqrt(1 - this._dampingRatio * this._dampingRatio);
3303
3169
  }
3304
3170
  }
3305
3171
 
@@ -3318,22 +3184,18 @@ class SpringEaser {
3318
3184
  let displacement = 0;
3319
3185
  let coeff;
3320
3186
  deltaTime /= 1000;
3321
- const naturalDumpingPow =
3322
- Math.E ** (-this._dampingRatio * this._naturalFrequency * deltaTime);
3187
+ const naturalDumpingPow = Math.E ** (-this._dampingRatio * this._naturalFrequency * deltaTime);
3323
3188
  if (this._dampingRatio === 1) {
3324
3189
  coeff = this.velocity + this._naturalFrequency * deltaPosition;
3325
3190
  displacement = (deltaPosition + coeff * deltaTime) * naturalDumpingPow;
3326
- this.velocity =
3327
- displacement * -this._naturalFrequency + coeff * naturalDumpingPow;
3191
+ this.velocity = displacement * -this._naturalFrequency + coeff * naturalDumpingPow;
3328
3192
  } else if (this._dampingRatio < 1) {
3329
3193
  coeff =
3330
3194
  (1 / this._dampedFrequency) *
3331
- (this._dampingRatio * this._naturalFrequency * deltaPosition +
3332
- this.velocity);
3195
+ (this._dampingRatio * this._naturalFrequency * deltaPosition + this.velocity);
3333
3196
  const dumpedFCos = Math.cos(this._dampedFrequency * deltaTime);
3334
3197
  const dumpedFSin = Math.sin(this._dampedFrequency * deltaTime);
3335
- displacement =
3336
- naturalDumpingPow * (deltaPosition * dumpedFCos + coeff * dumpedFSin);
3198
+ displacement = naturalDumpingPow * (deltaPosition * dumpedFCos + coeff * dumpedFSin);
3337
3199
  this.velocity =
3338
3200
  displacement * -this._naturalFrequency * this._dampingRatio +
3339
3201
  naturalDumpingPow *
@@ -3377,7 +3239,7 @@ class SpringAnimation {
3377
3239
  onComplete,
3378
3240
  onFinish = () => {},
3379
3241
  dampingRatio,
3380
- naturalFrequency,
3242
+ naturalFrequency
3381
3243
  } = props;
3382
3244
  this.onFinish = onFinish;
3383
3245
  const easer = new SpringEaser(velocity, dampingRatio, naturalFrequency);
@@ -3537,11 +3399,7 @@ class ScrollWheel {
3537
3399
  */
3538
3400
  constructor(pswp) {
3539
3401
  this.pswp = pswp;
3540
- pswp.events.add(
3541
- pswp.element,
3542
- "wheel",
3543
- /** @type EventListener */ this._onWheel.bind(this)
3544
- );
3402
+ pswp.events.add(pswp.element, "wheel", /** @type EventListener */ this._onWheel.bind(this));
3545
3403
  }
3546
3404
 
3547
3405
  /**
@@ -3557,7 +3415,7 @@ class ScrollWheel {
3557
3415
  }
3558
3416
  if (
3559
3417
  this.pswp.dispatch("wheel", {
3560
- originalEvent: e,
3418
+ originalEvent: e
3561
3419
  }).defaultPrevented
3562
3420
  ) {
3563
3421
  return;
@@ -3575,7 +3433,7 @@ class ScrollWheel {
3575
3433
  const destZoomLevel = currSlide.currZoomLevel * zoomFactor;
3576
3434
  currSlide.zoomTo(destZoomLevel, {
3577
3435
  x: e.clientX,
3578
- y: e.clientY,
3436
+ y: e.clientY
3579
3437
  });
3580
3438
  }
3581
3439
  } else {
@@ -3645,8 +3503,7 @@ function addElementHTML(htmlData) {
3645
3503
  return "";
3646
3504
  }
3647
3505
  const svgData = htmlData;
3648
- let out =
3649
- '<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';
3506
+ let out = '<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';
3650
3507
  // replace all %d with size
3651
3508
  out = out.split("%d").join(/** @type {string} */ svgData.size || 32);
3652
3509
 
@@ -3656,8 +3513,7 @@ function addElementHTML(htmlData) {
3656
3513
  //
3657
3514
  // Property shadowID defines ID of element that should be cloned.
3658
3515
  if (svgData.outlineID) {
3659
- out +=
3660
- '<use class="pswp__icn-shadow" xlink:href="#' + svgData.outlineID + '"/>';
3516
+ out += '<use class="pswp__icn-shadow" xlink:href="#' + svgData.outlineID + '"/>';
3661
3517
  }
3662
3518
  out += svgData.inner;
3663
3519
  out += "</svg>";
@@ -3690,7 +3546,7 @@ class UIElement {
3690
3546
  elementHTML = pswp.options[name + "SVG"];
3691
3547
  }
3692
3548
  pswp.dispatch("uiElementCreate", {
3693
- data,
3549
+ data
3694
3550
  });
3695
3551
  let className = "";
3696
3552
  if (data.isButton) {
@@ -3699,9 +3555,7 @@ class UIElement {
3699
3555
  } else {
3700
3556
  className += data.className || `pswp__${data.name}`;
3701
3557
  }
3702
- let tagName = data.isButton
3703
- ? data.tagName || "button"
3704
- : data.tagName || "div";
3558
+ let tagName = data.isButton ? data.tagName || "button" : data.tagName || "div";
3705
3559
  tagName = /** @type {keyof HTMLElementTagNameMap} */ tagName.toLowerCase();
3706
3560
  /** @type {HTMLElement} */
3707
3561
  const element = createElement(className, tagName);
@@ -3746,11 +3600,7 @@ class UIElement {
3746
3600
  let container = pswp.element;
3747
3601
  if (appendTo === "bar") {
3748
3602
  if (!pswp.topBar) {
3749
- pswp.topBar = createElement(
3750
- "pswp__top-bar pswp__hide-on-close",
3751
- "div",
3752
- pswp.scrollWrap
3753
- );
3603
+ pswp.topBar = createElement("pswp__top-bar pswp__hide-on-close", "div", pswp.scrollWrap);
3754
3604
  }
3755
3605
  container = pswp.topBar;
3756
3606
  } else {
@@ -3808,12 +3658,11 @@ const arrowPrev = {
3808
3658
  html: {
3809
3659
  isCustomSVG: true,
3810
3660
  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",
3661
+ inner: '<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',
3662
+ outlineID: "pswp__icn-arrow"
3814
3663
  },
3815
3664
  onClick: "prev",
3816
- onInit: initArrowButton,
3665
+ onInit: initArrowButton
3817
3666
  };
3818
3667
 
3819
3668
  /** @type {UIElementData} */
@@ -3828,12 +3677,12 @@ const arrowNext = {
3828
3677
  isCustomSVG: true,
3829
3678
  size: 60,
3830
3679
  inner: '<use xlink:href="#pswp__icn-arrow"/>',
3831
- outlineID: "pswp__icn-arrow",
3680
+ outlineID: "pswp__icn-arrow"
3832
3681
  },
3833
3682
  onClick: "next",
3834
3683
  onInit: (el, pswp) => {
3835
3684
  initArrowButton(el, pswp, true);
3836
- },
3685
+ }
3837
3686
  };
3838
3687
 
3839
3688
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3844,11 +3693,10 @@ const closeButton = {
3844
3693
  isButton: true,
3845
3694
  html: {
3846
3695
  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",
3696
+ 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"/>',
3697
+ outlineID: "pswp__icn-close"
3850
3698
  },
3851
- onClick: "close",
3699
+ onClick: "close"
3852
3700
  };
3853
3701
 
3854
3702
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3864,9 +3712,9 @@ const zoomButton = {
3864
3712
  '<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
3713
  '<path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/>' +
3866
3714
  '<path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>',
3867
- outlineID: "pswp__icn-zoom",
3715
+ outlineID: "pswp__icn-zoom"
3868
3716
  },
3869
- onClick: "toggleZoom",
3717
+ onClick: "toggleZoom"
3870
3718
  };
3871
3719
 
3872
3720
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3879,7 +3727,7 @@ const loadingIndicator = {
3879
3727
  // eslint-disable-next-line max-len
3880
3728
  inner:
3881
3729
  '<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",
3730
+ outlineID: "pswp__icn-loading"
3883
3731
  },
3884
3732
  onInit: (indicatorElement, pswp) => {
3885
3733
  /** @type {boolean | undefined} */
@@ -3926,8 +3774,7 @@ const loadingIndicator = {
3926
3774
  var _pswp$currSlide2;
3927
3775
  setIndicatorVisibility(
3928
3776
  Boolean(
3929
- (_pswp$currSlide2 = pswp.currSlide) === null ||
3930
- _pswp$currSlide2 === void 0
3777
+ (_pswp$currSlide2 = pswp.currSlide) === null || _pswp$currSlide2 === void 0
3931
3778
  ? void 0
3932
3779
  : _pswp$currSlide2.content.isLoading()
3933
3780
  )
@@ -3947,7 +3794,7 @@ const loadingIndicator = {
3947
3794
  if (pswp.ui) {
3948
3795
  pswp.ui.updatePreloaderVisibility = updatePreloaderVisibility;
3949
3796
  }
3950
- },
3797
+ }
3951
3798
  };
3952
3799
 
3953
3800
  /** @type {import('./ui-element.js').UIElementData} UIElementData */
@@ -3957,12 +3804,9 @@ const counterIndicator = {
3957
3804
  onInit: (counterElement, pswp) => {
3958
3805
  pswp.on("change", () => {
3959
3806
  counterElement.innerText =
3960
- pswp.currIndex +
3961
- 1 +
3962
- pswp.options.indexIndicatorSep +
3963
- pswp.getNumItems();
3807
+ pswp.currIndex + 1 + pswp.options.indexIndicatorSep + pswp.getNumItems();
3964
3808
  });
3965
- },
3809
+ }
3966
3810
  };
3967
3811
 
3968
3812
  /** @typedef {import('../photoswipe.js').default} PhotoSwipe */
@@ -4009,7 +3853,7 @@ class UI {
4009
3853
  arrowNext,
4010
3854
  zoomButton,
4011
3855
  loadingIndicator,
4012
- counterIndicator,
3856
+ counterIndicator
4013
3857
  ];
4014
3858
  pswp.dispatch("uiRegister");
4015
3859
 
@@ -4027,10 +3871,7 @@ class UI {
4027
3871
  var _pswp$element;
4028
3872
  (_pswp$element = pswp.element) === null ||
4029
3873
  _pswp$element === void 0 ||
4030
- _pswp$element.classList.toggle(
4031
- "pswp--one-slide",
4032
- pswp.getNumItems() === 1
4033
- );
3874
+ _pswp$element.classList.toggle("pswp--one-slide", pswp.getNumItems() === 1);
4034
3875
  });
4035
3876
  pswp.on("zoomPanUpdate", () => this._onZoomPanUpdate());
4036
3877
  }
@@ -4067,8 +3908,7 @@ class UI {
4067
3908
  return;
4068
3909
  }
4069
3910
  this._lastUpdatedZoomLevel = currZoomLevel;
4070
- const currZoomLevelDiff =
4071
- currSlide.zoomLevels.initial - currSlide.zoomLevels.secondary;
3911
+ const currZoomLevelDiff = currSlide.zoomLevels.initial - currSlide.zoomLevels.secondary;
4072
3912
 
4073
3913
  // Initial and secondary zoom levels are almost equal
4074
3914
  if (Math.abs(currZoomLevelDiff) < 0.01 || !currSlide.isZoomable()) {
@@ -4083,10 +3923,7 @@ class UI {
4083
3923
  ? currSlide.zoomLevels.secondary
4084
3924
  : currSlide.zoomLevels.initial;
4085
3925
  setZoomedIn(template, potentialZoomLevel <= currZoomLevel);
4086
- if (
4087
- options.imageClickAction === "zoom" ||
4088
- options.imageClickAction === "zoom-or-close"
4089
- ) {
3926
+ if (options.imageClickAction === "zoom" || options.imageClickAction === "zoom-or-close") {
4090
3927
  template.classList.add("pswp--click-to-zoom");
4091
3928
  }
4092
3929
  }
@@ -4106,7 +3943,7 @@ function getBoundsByElement(el) {
4106
3943
  return {
4107
3944
  x: thumbAreaRect.left,
4108
3945
  y: thumbAreaRect.top,
4109
- w: thumbAreaRect.width,
3946
+ w: thumbAreaRect.width
4110
3947
  };
4111
3948
  }
4112
3949
 
@@ -4137,7 +3974,7 @@ function getCroppedBoundsByElement(el, imageWidth, imageHeight) {
4137
3974
  const bounds = {
4138
3975
  x: thumbAreaRect.left + offsetX,
4139
3976
  y: thumbAreaRect.top + offsetY,
4140
- w: imageWidth * fillZoomLevel,
3977
+ w: imageWidth * fillZoomLevel
4141
3978
  };
4142
3979
 
4143
3980
  // Coordinates of inner crop area
@@ -4146,7 +3983,7 @@ function getCroppedBoundsByElement(el, imageWidth, imageHeight) {
4146
3983
  w: thumbAreaRect.width,
4147
3984
  h: thumbAreaRect.height,
4148
3985
  x: offsetX,
4149
- y: offsetY,
3986
+ y: offsetY
4150
3987
  };
4151
3988
  return bounds;
4152
3989
  }
@@ -4165,7 +4002,7 @@ function getThumbBounds(index, itemData, instance) {
4165
4002
  const event = instance.dispatch("thumbBounds", {
4166
4003
  index,
4167
4004
  itemData,
4168
- instance,
4005
+ instance
4169
4006
  });
4170
4007
  // @ts-expect-error
4171
4008
  if (event.thumbBounds) {
@@ -4461,7 +4298,7 @@ class Eventable {
4461
4298
  _this$_filters$name === void 0 ||
4462
4299
  _this$_filters$name.push({
4463
4300
  fn,
4464
- priority,
4301
+ priority
4465
4302
  });
4466
4303
  (_this$_filters$name2 = this._filters[name]) === null ||
4467
4304
  _this$_filters$name2 === void 0 ||
@@ -4479,9 +4316,7 @@ class Eventable {
4479
4316
  removeFilter(name, fn) {
4480
4317
  if (this._filters[name]) {
4481
4318
  // @ts-expect-error
4482
- this._filters[name] = this._filters[name].filter(
4483
- (filter) => filter.fn !== fn
4484
- );
4319
+ this._filters[name] = this._filters[name].filter((filter) => filter.fn !== fn);
4485
4320
  }
4486
4321
  if (this.pswp) {
4487
4322
  this.pswp.removeFilter(name, fn);
@@ -4522,9 +4357,7 @@ class Eventable {
4522
4357
  // When binding events to lightbox,
4523
4358
  // also bind events to PhotoSwipe Core,
4524
4359
  // if it's open.
4525
- (_this$pswp2 = this.pswp) === null ||
4526
- _this$pswp2 === void 0 ||
4527
- _this$pswp2.on(name, fn);
4360
+ (_this$pswp2 = this.pswp) === null || _this$pswp2 === void 0 || _this$pswp2.on(name, fn);
4528
4361
  }
4529
4362
 
4530
4363
  /**
@@ -4536,13 +4369,9 @@ class Eventable {
4536
4369
  var _this$pswp3;
4537
4370
  if (this._listeners[name]) {
4538
4371
  // @ts-expect-error
4539
- this._listeners[name] = this._listeners[name].filter(
4540
- (listener) => fn !== listener
4541
- );
4372
+ this._listeners[name] = this._listeners[name].filter((listener) => fn !== listener);
4542
4373
  }
4543
- (_this$pswp3 = this.pswp) === null ||
4544
- _this$pswp3 === void 0 ||
4545
- _this$pswp3.off(name, fn);
4374
+ (_this$pswp3 = this.pswp) === null || _this$pswp3 === void 0 || _this$pswp3.off(name, fn);
4546
4375
  }
4547
4376
 
4548
4377
  /**
@@ -4556,10 +4385,7 @@ class Eventable {
4556
4385
  if (this.pswp) {
4557
4386
  return this.pswp.dispatch(name, details);
4558
4387
  }
4559
- const event = /** @type {AugmentedEvent<T>} */ new PhotoSwipeEvent(
4560
- name,
4561
- details
4562
- );
4388
+ const event = /** @type {AugmentedEvent<T>} */ new PhotoSwipeEvent(name, details);
4563
4389
  (_this$_listeners$name2 = this._listeners[name]) === null ||
4564
4390
  _this$_listeners$name2 === void 0 ||
4565
4391
  _this$_listeners$name2.forEach((listener) => {
@@ -4664,7 +4490,7 @@ class Content {
4664
4490
  this.type = "html";
4665
4491
  }
4666
4492
  this.instance.dispatch("contentInit", {
4667
- content: this,
4493
+ content: this
4668
4494
  });
4669
4495
  }
4670
4496
  removePlaceholder() {
@@ -4695,10 +4521,7 @@ class Content {
4695
4521
  this.data.msrc && this.slide.isFirstSlide ? this.data.msrc : false,
4696
4522
  this
4697
4523
  );
4698
- this.placeholder = new Placeholder(
4699
- placeholderSrc,
4700
- this.slide.container
4701
- );
4524
+ this.placeholder = new Placeholder(placeholderSrc, this.slide.container);
4702
4525
  } else {
4703
4526
  const placeholderEl = this.placeholder.element;
4704
4527
  // Add placeholder to DOM if it was already created
@@ -4713,7 +4536,7 @@ class Content {
4713
4536
  if (
4714
4537
  this.instance.dispatch("contentLoad", {
4715
4538
  content: this,
4716
- isLazy,
4539
+ isLazy
4717
4540
  }).defaultPrevented
4718
4541
  ) {
4719
4542
  return;
@@ -4746,7 +4569,7 @@ class Content {
4746
4569
  !this.element ||
4747
4570
  this.instance.dispatch("contentLoadImage", {
4748
4571
  content: this,
4749
- isLazy,
4572
+ isLazy
4750
4573
  }).defaultPrevented
4751
4574
  ) {
4752
4575
  return;
@@ -4757,13 +4580,9 @@ class Content {
4757
4580
  imageElement.srcset = this.data.srcset;
4758
4581
  }
4759
4582
  imageElement.src =
4760
- (_this$data$src = this.data.src) !== null && _this$data$src !== void 0
4761
- ? _this$data$src
4762
- : "";
4583
+ (_this$data$src = this.data.src) !== null && _this$data$src !== void 0 ? _this$data$src : "";
4763
4584
  imageElement.alt =
4764
- (_this$data$alt = this.data.alt) !== null && _this$data$alt !== void 0
4765
- ? _this$data$alt
4766
- : "";
4585
+ (_this$data$alt = this.data.alt) !== null && _this$data$alt !== void 0 ? _this$data$alt : "";
4767
4586
  this.state = LOAD_STATE.LOADING;
4768
4587
  if (imageElement.complete) {
4769
4588
  this.onLoaded();
@@ -4798,15 +4617,11 @@ class Content {
4798
4617
  if (this.slide && this.element) {
4799
4618
  this.instance.dispatch("loadComplete", {
4800
4619
  slide: this.slide,
4801
- content: this,
4620
+ content: this
4802
4621
  });
4803
4622
 
4804
4623
  // if content is reloaded
4805
- if (
4806
- this.slide.isActive &&
4807
- this.slide.heavyAppended &&
4808
- !this.element.parentNode
4809
- ) {
4624
+ if (this.slide.isActive && this.slide.heavyAppended && !this.element.parentNode) {
4810
4625
  this.append();
4811
4626
  this.slide.updateContentSize(true);
4812
4627
  }
@@ -4826,11 +4641,11 @@ class Content {
4826
4641
  this.instance.dispatch("loadComplete", {
4827
4642
  slide: this.slide,
4828
4643
  isError: true,
4829
- content: this,
4644
+ content: this
4830
4645
  });
4831
4646
  this.instance.dispatch("loadError", {
4832
4647
  slide: this.slide,
4833
- content: this,
4648
+ content: this
4834
4649
  });
4835
4650
  }
4836
4651
  }
@@ -4839,11 +4654,7 @@ class Content {
4839
4654
  * @returns {Boolean} If the content is currently loading
4840
4655
  */
4841
4656
  isLoading() {
4842
- return this.instance.applyFilters(
4843
- "isContentLoading",
4844
- this.state === LOAD_STATE.LOADING,
4845
- this
4846
- );
4657
+ return this.instance.applyFilters("isContentLoading", this.state === LOAD_STATE.LOADING, this);
4847
4658
  }
4848
4659
 
4849
4660
  /**
@@ -4877,7 +4688,7 @@ class Content {
4877
4688
  this.instance.dispatch("contentResize", {
4878
4689
  content: this,
4879
4690
  width,
4880
- height,
4691
+ height
4881
4692
  }).defaultPrevented
4882
4693
  ) {
4883
4694
  return;
@@ -4897,7 +4708,7 @@ class Content {
4897
4708
  slide: this.slide,
4898
4709
  width,
4899
4710
  height,
4900
- content: this,
4711
+ content: this
4901
4712
  });
4902
4713
  }
4903
4714
  }
@@ -4945,11 +4756,7 @@ class Content {
4945
4756
  * @returns {boolean} If content should use a placeholder (from msrc by default)
4946
4757
  */
4947
4758
  usePlaceholder() {
4948
- return this.instance.applyFilters(
4949
- "useContentPlaceholder",
4950
- this.isImageContent(),
4951
- this
4952
- );
4759
+ return this.instance.applyFilters("useContentPlaceholder", this.isImageContent(), this);
4953
4760
  }
4954
4761
 
4955
4762
  /**
@@ -4958,7 +4765,7 @@ class Content {
4958
4765
  lazyLoad() {
4959
4766
  if (
4960
4767
  this.instance.dispatch("contentLazyLoad", {
4961
- content: this,
4768
+ content: this
4962
4769
  }).defaultPrevented
4963
4770
  ) {
4964
4771
  return;
@@ -4970,11 +4777,7 @@ class Content {
4970
4777
  * @returns {boolean} If placeholder should be kept after content is loaded
4971
4778
  */
4972
4779
  keepPlaceholder() {
4973
- return this.instance.applyFilters(
4974
- "isKeepingPlaceholder",
4975
- this.isLoading(),
4976
- this
4977
- );
4780
+ return this.instance.applyFilters("isKeepingPlaceholder", this.isLoading(), this);
4978
4781
  }
4979
4782
 
4980
4783
  /**
@@ -4985,7 +4788,7 @@ class Content {
4985
4788
  this.slide = undefined;
4986
4789
  if (
4987
4790
  this.instance.dispatch("contentDestroy", {
4988
- content: this,
4791
+ content: this
4989
4792
  }).defaultPrevented
4990
4793
  ) {
4991
4794
  return;
@@ -5014,8 +4817,7 @@ class Content {
5014
4817
  (_this$instance$option2 = this.instance.options) === null ||
5015
4818
  _this$instance$option2 === void 0
5016
4819
  ? void 0
5017
- : _this$instance$option2.errorMsg) !== null &&
5018
- _this$instance$option !== void 0
4820
+ : _this$instance$option2.errorMsg) !== null && _this$instance$option !== void 0
5019
4821
  ? _this$instance$option
5020
4822
  : "";
5021
4823
  errorMsgEl = /** @type {HTMLDivElement} */ this.instance.applyFilters(
@@ -5023,10 +4825,7 @@ class Content {
5023
4825
  errorMsgEl,
5024
4826
  this
5025
4827
  );
5026
- this.element = createElement(
5027
- "pswp__content pswp__error-msg-container",
5028
- "div"
5029
- );
4828
+ this.element = createElement("pswp__content pswp__error-msg-container", "div");
5030
4829
  this.element.appendChild(errorMsgEl);
5031
4830
  this.slide.container.innerText = "";
5032
4831
  this.slide.container.appendChild(this.element);
@@ -5049,7 +4848,7 @@ class Content {
5049
4848
  }
5050
4849
  if (
5051
4850
  this.instance.dispatch("contentAppend", {
5052
- content: this,
4851
+ content: this
5053
4852
  }).defaultPrevented
5054
4853
  ) {
5055
4854
  return;
@@ -5068,11 +4867,9 @@ class Content {
5068
4867
  // that's because I want to show image before it's fully loaded,
5069
4868
  // as browser can render parts of image while it is loading.
5070
4869
  // 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
- ) {
4870
+ // Skip decode for HDR images to prevent Chrome crashes
4871
+ const isHdrImage = this.data.src && this.data.src.includes("/hdr/");
4872
+ if (supportsDecode && this.slide && (!this.slide.isActive || isSafari()) && !isHdrImage) {
5076
4873
  this.isDecoding = true;
5077
4874
  // purposefully using finally instead of then,
5078
4875
  // as if srcset sizes changes dynamically - it may cause decode error
@@ -5100,7 +4897,7 @@ class Content {
5100
4897
  activate() {
5101
4898
  if (
5102
4899
  this.instance.dispatch("contentActivate", {
5103
- content: this,
4900
+ content: this
5104
4901
  }).defaultPrevented ||
5105
4902
  !this.slide
5106
4903
  ) {
@@ -5123,7 +4920,7 @@ class Content {
5123
4920
  */
5124
4921
  deactivate() {
5125
4922
  this.instance.dispatch("contentDeactivate", {
5126
- content: this,
4923
+ content: this
5127
4924
  });
5128
4925
  if (this.slide && this.slide.holderElement) {
5129
4926
  this.slide.holderElement.setAttribute("aria-hidden", "true");
@@ -5137,7 +4934,7 @@ class Content {
5137
4934
  this.isAttached = false;
5138
4935
  if (
5139
4936
  this.instance.dispatch("contentRemove", {
5140
- content: this,
4937
+ content: this
5141
4938
  }).defaultPrevented
5142
4939
  ) {
5143
4940
  return;
@@ -5159,7 +4956,7 @@ class Content {
5159
4956
  }
5160
4957
  if (
5161
4958
  this.instance.dispatch("contentAppendImage", {
5162
- content: this,
4959
+ content: this
5163
4960
  }).defaultPrevented
5164
4961
  ) {
5165
4962
  return;
@@ -5238,7 +5035,7 @@ function lazyLoadSlide(index, instance) {
5238
5035
  if (
5239
5036
  instance.dispatch("lazyLoadSlide", {
5240
5037
  index,
5241
- itemData,
5038
+ itemData
5242
5039
  }).defaultPrevented
5243
5040
  ) {
5244
5041
  return;
@@ -5344,9 +5141,7 @@ class ContentLoader {
5344
5141
  * @param {number} index
5345
5142
  */
5346
5143
  removeByIndex(index) {
5347
- const indexToRemove = this._cachedItems.findIndex(
5348
- (item) => item.index === index
5349
- );
5144
+ const indexToRemove = this._cachedItems.findIndex((item) => item.index === index);
5350
5145
  if (indexToRemove !== -1) {
5351
5146
  this._cachedItems.splice(indexToRemove, 1);
5352
5147
  }
@@ -5401,7 +5196,7 @@ class PhotoSwipeBase extends Eventable {
5401
5196
  // legacy event, before filters were introduced
5402
5197
  const event = this.dispatch("numItems", {
5403
5198
  dataSource,
5404
- numItems,
5199
+ numItems
5405
5200
  });
5406
5201
  return this.applyFilters("numItems", event.numItems, dataSource);
5407
5202
  }
@@ -5456,7 +5251,7 @@ class PhotoSwipeBase extends Eventable {
5456
5251
  // it's a legacy verion before filters were introduced
5457
5252
  const event = this.dispatch("itemData", {
5458
5253
  itemData: itemData || {},
5459
- index,
5254
+ index
5460
5255
  });
5461
5256
  return this.applyFilters("itemData", event.itemData, index);
5462
5257
  }
@@ -5479,11 +5274,8 @@ class PhotoSwipeBase extends Eventable {
5479
5274
  _this$options4.childSelector)
5480
5275
  ) {
5481
5276
  return (
5482
- getElementsFromOption(
5483
- this.options.children,
5484
- this.options.childSelector,
5485
- galleryElement
5486
- ) || []
5277
+ getElementsFromOption(this.options.children, this.options.childSelector, galleryElement) ||
5278
+ []
5487
5279
  );
5488
5280
  }
5489
5281
  return [galleryElement];
@@ -5498,7 +5290,7 @@ class PhotoSwipeBase extends Eventable {
5498
5290
  _domElementToItemData(element) {
5499
5291
  /** @type {SlideData} */
5500
5292
  const itemData = {
5501
- element,
5293
+ element
5502
5294
  };
5503
5295
  const linkEl =
5504
5296
  /** @type {HTMLAnchorElement} */
@@ -5510,12 +5302,8 @@ class PhotoSwipeBase extends Eventable {
5510
5302
  if (linkEl.dataset.pswpSrcset) {
5511
5303
  itemData.srcset = linkEl.dataset.pswpSrcset;
5512
5304
  }
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;
5305
+ itemData.width = linkEl.dataset.pswpWidth ? parseInt(linkEl.dataset.pswpWidth, 10) : 0;
5306
+ itemData.height = linkEl.dataset.pswpHeight ? parseInt(linkEl.dataset.pswpHeight, 10) : 0;
5519
5307
 
5520
5308
  // support legacy w & h properties
5521
5309
  itemData.w = itemData.width;
@@ -5639,10 +5427,7 @@ class Opener {
5639
5427
  this.isOpening = false;
5640
5428
  this.isClosing = true;
5641
5429
  this._duration = this.pswp.options.hideAnimationDuration;
5642
- if (
5643
- slide &&
5644
- slide.currZoomLevel * slide.width >= this.pswp.options.maxWidthToAnimate
5645
- ) {
5430
+ if (slide && slide.currZoomLevel * slide.width >= this.pswp.options.maxWidthToAnimate) {
5646
5431
  this._duration = 0;
5647
5432
  }
5648
5433
  this._applyStartProps();
@@ -5662,11 +5447,7 @@ class Opener {
5662
5447
  this.isOpening = true;
5663
5448
  this.isClosing = false;
5664
5449
  this._duration = this.pswp.options.showAnimationDuration;
5665
- if (
5666
- slide &&
5667
- slide.zoomLevels.initial * slide.width >=
5668
- this.pswp.options.maxWidthToAnimate
5669
- ) {
5450
+ if (slide && slide.zoomLevels.initial * slide.width >= this.pswp.options.maxWidthToAnimate) {
5670
5451
  this._duration = 0;
5671
5452
  }
5672
5453
  this._applyStartProps();
@@ -5691,19 +5472,14 @@ class Opener {
5691
5472
  } else {
5692
5473
  this._thumbBounds = this.pswp.getThumbBounds();
5693
5474
  }
5694
- this._placeholder =
5695
- slide === null || slide === void 0
5696
- ? void 0
5697
- : slide.getPlaceholderElement();
5475
+ this._placeholder = slide === null || slide === void 0 ? void 0 : slide.getPlaceholderElement();
5698
5476
  pswp.animations.stopAll();
5699
5477
 
5700
5478
  // Discard animations when duration is less than 50ms
5701
5479
  this._useAnimation = Boolean(this._duration && this._duration > 50);
5702
5480
  this._animateZoom =
5703
5481
  Boolean(this._thumbBounds) &&
5704
- (slide === null || slide === void 0
5705
- ? void 0
5706
- : slide.content.usePlaceholder()) &&
5482
+ (slide === null || slide === void 0 ? void 0 : slide.content.usePlaceholder()) &&
5707
5483
  (!this.isClosing || !pswp.mainScroll.isShifted());
5708
5484
  if (!this._animateZoom) {
5709
5485
  this._animateRootOpacity = true;
@@ -5719,8 +5495,7 @@ class Opener {
5719
5495
  ? _options$showHideOpac
5720
5496
  : false;
5721
5497
  }
5722
- this._animateBgOpacity =
5723
- !this._animateRootOpacity && this.pswp.options.bgOpacity > MIN_OPACITY;
5498
+ this._animateBgOpacity = !this._animateRootOpacity && this.pswp.options.bgOpacity > MIN_OPACITY;
5724
5499
  this._opacityElement = this._animateRootOpacity ? pswp.element : pswp.bg;
5725
5500
  if (!this._useAnimation) {
5726
5501
  this._duration = 0;
@@ -5741,8 +5516,7 @@ class Opener {
5741
5516
  this._croppedZoom = true;
5742
5517
  this._cropContainer1 = this.pswp.container;
5743
5518
  this._cropContainer2 =
5744
- (_this$pswp$currSlide = this.pswp.currSlide) === null ||
5745
- _this$pswp$currSlide === void 0
5519
+ (_this$pswp$currSlide = this.pswp.currSlide) === null || _this$pswp$currSlide === void 0
5746
5520
  ? void 0
5747
5521
  : _this$pswp$currSlide.holderElement;
5748
5522
  if (pswp.container) {
@@ -5814,14 +5588,12 @@ class Opener {
5814
5588
  new Promise((resolve) => {
5815
5589
  let decoded = false;
5816
5590
  let isDelaying = true;
5817
- decodeImage(/** @type {HTMLImageElement} */ this._placeholder).finally(
5818
- () => {
5819
- decoded = true;
5820
- if (!isDelaying) {
5821
- resolve(true);
5822
- }
5591
+ decodeImage(/** @type {HTMLImageElement} */ this._placeholder).finally(() => {
5592
+ decoded = true;
5593
+ if (!isDelaying) {
5594
+ resolve(true);
5823
5595
  }
5824
- );
5596
+ });
5825
5597
  setTimeout(() => {
5826
5598
  isDelaying = false;
5827
5599
  if (decoded) {
@@ -5840,13 +5612,8 @@ class Opener {
5840
5612
  var _this$pswp$element, _this$pswp$element2;
5841
5613
  (_this$pswp$element = this.pswp.element) === null ||
5842
5614
  _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
- );
5615
+ _this$pswp$element.style.setProperty("--pswp-transition-duration", this._duration + "ms");
5616
+ this.pswp.dispatch(this.isOpening ? "openingAnimationStart" : "closingAnimationStart");
5850
5617
 
5851
5618
  // legacy event
5852
5619
  this.pswp.dispatch(
@@ -5903,11 +5670,7 @@ class Opener {
5903
5670
  const { pswp } = this;
5904
5671
  if (this._animateZoom) {
5905
5672
  if (this._croppedZoom && this._cropContainer1 && this._cropContainer2) {
5906
- this._animateTo(
5907
- this._cropContainer1,
5908
- "transform",
5909
- "translate3d(0,0,0)"
5910
- );
5673
+ this._animateTo(this._cropContainer1, "transform", "translate3d(0,0,0)");
5911
5674
  this._animateTo(this._cropContainer2, "transform", "none");
5912
5675
  }
5913
5676
  if (pswp.currSlide) {
@@ -5952,16 +5715,9 @@ class Opener {
5952
5715
  const { pswp } = this;
5953
5716
  const { innerRect } = this._thumbBounds;
5954
5717
  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;
5718
+ if (this._croppedZoom && innerRect && this._cropContainer1 && this._cropContainer2) {
5719
+ const containerOnePanX = -viewportSize.x + (this._thumbBounds.x - innerRect.x) + innerRect.w;
5720
+ const containerOnePanY = -viewportSize.y + (this._thumbBounds.y - innerRect.y) + innerRect.h;
5965
5721
  const containerTwoPanX = viewportSize.x - innerRect.w;
5966
5722
  const containerTwoPanY = viewportSize.y - innerRect.h;
5967
5723
  if (animate) {
@@ -5984,11 +5740,7 @@ class Opener {
5984
5740
  equalizePoints(currSlide.pan, innerRect || this._thumbBounds);
5985
5741
  currSlide.currZoomLevel = this._thumbBounds.w / currSlide.width;
5986
5742
  if (animate) {
5987
- this._animateTo(
5988
- currSlide.container,
5989
- "transform",
5990
- currSlide.getCurrentTransform()
5991
- );
5743
+ this._animateTo(currSlide.container, "transform", currSlide.getCurrentTransform());
5992
5744
  } else {
5993
5745
  currSlide.applyCurrentZoomPan();
5994
5746
  }
@@ -6016,7 +5768,7 @@ class Opener {
6016
5768
  this._onAnimationComplete();
6017
5769
  }
6018
5770
  },
6019
- target,
5771
+ target
6020
5772
  };
6021
5773
  animProps[prop] = propValue;
6022
5774
  animations.startTransition(animProps);
@@ -6252,7 +6004,7 @@ const defaultOptions = {
6252
6004
  index: 0,
6253
6005
  errorMsg: "The image cannot be loaded",
6254
6006
  preload: [1, 2],
6255
- easing: "cubic-bezier(.4,0,.22,1)",
6007
+ easing: "cubic-bezier(.4,0,.22,1)"
6256
6008
  };
6257
6009
 
6258
6010
  /**
@@ -6273,7 +6025,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6273
6025
  */
6274
6026
  this.offset = {
6275
6027
  x: 0,
6276
- y: 0,
6028
+ y: 0
6277
6029
  };
6278
6030
 
6279
6031
  /**
@@ -6282,7 +6034,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6282
6034
  */
6283
6035
  this._prevViewportSize = {
6284
6036
  x: 0,
6285
- y: 0,
6037
+ y: 0
6286
6038
  };
6287
6039
 
6288
6040
  /**
@@ -6292,7 +6044,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6292
6044
  */
6293
6045
  this.viewportSize = {
6294
6046
  x: 0,
6295
- y: 0,
6047
+ y: 0
6296
6048
  };
6297
6049
 
6298
6050
  /**
@@ -6382,7 +6134,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6382
6134
  this.dispatch("gettingData", {
6383
6135
  index: this.currIndex,
6384
6136
  data: this._initialItemData,
6385
- slide: undefined,
6137
+ slide: undefined
6386
6138
  });
6387
6139
 
6388
6140
  // *Layout* - calculate size and position of elements here
@@ -6403,11 +6155,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6403
6155
  this.appendHeavy();
6404
6156
  this.contentLoader.updateLazy();
6405
6157
  this.events.add(window, "resize", this._handlePageResize.bind(this));
6406
- this.events.add(
6407
- window,
6408
- "scroll",
6409
- this._updatePageScrollOffset.bind(this)
6410
- );
6158
+ this.events.add(window, "scroll", this._updatePageScrollOffset.bind(this));
6411
6159
  this.dispatch("bindEvents");
6412
6160
  });
6413
6161
 
@@ -6454,9 +6202,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6454
6202
  * @param {number} index New index
6455
6203
  */
6456
6204
  goTo(index) {
6457
- this.mainScroll.moveIndexBy(
6458
- this.getLoopedIndex(index) - this.potentialIndex
6459
- );
6205
+ this.mainScroll.moveIndexBy(this.getLoopedIndex(index) - this.potentialIndex);
6460
6206
  }
6461
6207
 
6462
6208
  /**
@@ -6529,9 +6275,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6529
6275
  this.scrollWrap.ontouchmove = null;
6530
6276
  this.scrollWrap.ontouchend = null;
6531
6277
  }
6532
- (_this$element = this.element) === null ||
6533
- _this$element === void 0 ||
6534
- _this$element.remove();
6278
+ (_this$element = this.element) === null || _this$element === void 0 || _this$element.remove();
6535
6279
  this.mainScroll.itemHolders.forEach((itemHolder) => {
6536
6280
  var _itemHolder$slide2;
6537
6281
  (_itemHolder$slide2 = itemHolder.slide) === null ||
@@ -6553,11 +6297,9 @@ class PhotoSwipe extends PhotoSwipeBase {
6553
6297
  var _this$currSlide$index, _this$currSlide3;
6554
6298
  let potentialHolderIndex =
6555
6299
  ((_this$currSlide$index =
6556
- (_this$currSlide3 = this.currSlide) === null ||
6557
- _this$currSlide3 === void 0
6300
+ (_this$currSlide3 = this.currSlide) === null || _this$currSlide3 === void 0
6558
6301
  ? void 0
6559
- : _this$currSlide3.index) !== null &&
6560
- _this$currSlide$index !== void 0
6302
+ : _this$currSlide3.index) !== null && _this$currSlide$index !== void 0
6561
6303
  ? _this$currSlide$index
6562
6304
  : 0) -
6563
6305
  1 +
@@ -6623,7 +6365,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6623
6365
  getViewportCenterPoint() {
6624
6366
  return {
6625
6367
  x: this.viewportSize.x / 2,
6626
- y: this.viewportSize.y / 2,
6368
+ y: this.viewportSize.y / 2
6627
6369
  };
6628
6370
  }
6629
6371
 
@@ -6751,11 +6493,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6751
6493
  // Background is added as a separate element,
6752
6494
  // as animating opacity is faster than animating rgba()
6753
6495
  this.bg = createElement("pswp__bg", "div", this.element);
6754
- this.scrollWrap = createElement(
6755
- "pswp__scroll-wrap",
6756
- "section",
6757
- this.element
6758
- );
6496
+ this.scrollWrap = createElement("pswp__scroll-wrap", "section", this.element);
6759
6497
  this.container = createElement("pswp__container", "div", this.scrollWrap);
6760
6498
 
6761
6499
  // aria pattern: carousel
@@ -6808,7 +6546,7 @@ class PhotoSwipe extends PhotoSwipeBase {
6808
6546
  /** @type {PreparedPhotoSwipeOptions} */
6809
6547
  return {
6810
6548
  ...defaultOptions,
6811
- ...options,
6549
+ ...options
6812
6550
  };
6813
6551
  }
6814
6552
  }