@annotorious/plugin-segment-anything 0.1.13 → 0.1.14

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.
@@ -38,7 +38,7 @@ let We = () => ({
38
38
  };
39
39
  }
40
40
  });
41
- var Te = { exports: {} }, Ge = Te.exports, De;
41
+ var xe = { exports: {} }, Ge = xe.exports, De;
42
42
  function Ve() {
43
43
  return De || (De = 1, function(W) {
44
44
  //! openseadragon 5.0.1
@@ -1366,17 +1366,17 @@ function Ve() {
1366
1366
  */
1367
1367
  multiply(i) {
1368
1368
  let r = this.values, a = i.values;
1369
- var s = r[0 * 3 + 0], o = r[0 * 3 + 1], l = r[0 * 3 + 2], h = r[1 * 3 + 0], d = r[1 * 3 + 1], f = r[1 * 3 + 2], v = r[2 * 3 + 0], w = r[2 * 3 + 1], T = r[2 * 3 + 2], x = a[0 * 3 + 0], E = a[0 * 3 + 1], P = a[0 * 3 + 2], I = a[1 * 3 + 0], O = a[1 * 3 + 1], z = a[1 * 3 + 2], V = a[2 * 3 + 0], j = a[2 * 3 + 1], q = a[2 * 3 + 2];
1369
+ var s = r[0 * 3 + 0], o = r[0 * 3 + 1], l = r[0 * 3 + 2], h = r[1 * 3 + 0], d = r[1 * 3 + 1], f = r[1 * 3 + 2], v = r[2 * 3 + 0], w = r[2 * 3 + 1], T = r[2 * 3 + 2], x = a[0 * 3 + 0], E = a[0 * 3 + 1], P = a[0 * 3 + 2], I = a[1 * 3 + 0], B = a[1 * 3 + 1], z = a[1 * 3 + 2], V = a[2 * 3 + 0], Z = a[2 * 3 + 1], X = a[2 * 3 + 2];
1370
1370
  return new t([
1371
1371
  x * s + E * h + P * v,
1372
1372
  x * o + E * d + P * w,
1373
1373
  x * l + E * f + P * T,
1374
- I * s + O * h + z * v,
1375
- I * o + O * d + z * w,
1376
- I * l + O * f + z * T,
1377
- V * s + j * h + q * v,
1378
- V * o + j * d + q * w,
1379
- V * l + j * f + q * T
1374
+ I * s + B * h + z * v,
1375
+ I * o + B * d + z * w,
1376
+ I * l + B * f + z * T,
1377
+ V * s + Z * h + X * v,
1378
+ V * o + Z * d + X * w,
1379
+ V * l + Z * f + X * T
1380
1380
  ]);
1381
1381
  }
1382
1382
  }
@@ -1584,7 +1584,7 @@ function Ve() {
1584
1584
  I(g, y);
1585
1585
  },
1586
1586
  keydown: function(y) {
1587
- O(g, y);
1587
+ B(g, y);
1588
1588
  },
1589
1589
  keyup: function(y) {
1590
1590
  z(g, y);
@@ -1593,96 +1593,96 @@ function Ve() {
1593
1593
  V(g, y);
1594
1594
  },
1595
1595
  focus: function(y) {
1596
- j(g, y);
1596
+ Z(g, y);
1597
1597
  },
1598
1598
  blur: function(y) {
1599
- q(g, y);
1599
+ X(g, y);
1600
1600
  },
1601
1601
  contextmenu: function(y) {
1602
1602
  $(g, y);
1603
1603
  },
1604
1604
  wheel: function(y) {
1605
- X(g, y);
1605
+ Y(g, y);
1606
1606
  },
1607
1607
  mousewheel: function(y) {
1608
- B(g, y);
1608
+ U(g, y);
1609
1609
  },
1610
1610
  DOMMouseScroll: function(y) {
1611
- B(g, y);
1611
+ U(g, y);
1612
1612
  },
1613
1613
  MozMousePixelScroll: function(y) {
1614
- B(g, y);
1614
+ U(g, y);
1615
1615
  },
1616
1616
  losecapture: function(y) {
1617
- k(g, y);
1617
+ j(g, y);
1618
1618
  },
1619
1619
  mouseenter: function(y) {
1620
1620
  G(g, y);
1621
1621
  },
1622
1622
  mouseleave: function(y) {
1623
- pe(g, y);
1623
+ fe(g, y);
1624
1624
  },
1625
1625
  mouseover: function(y) {
1626
- fe(g, y);
1626
+ ge(g, y);
1627
1627
  },
1628
1628
  mouseout: function(y) {
1629
- ge(g, y);
1629
+ me(g, y);
1630
1630
  },
1631
1631
  mousedown: function(y) {
1632
- he(g, y);
1632
+ ue(g, y);
1633
1633
  },
1634
1634
  mouseup: function(y) {
1635
- me(g, y);
1635
+ ve(g, y);
1636
1636
  },
1637
1637
  mousemove: function(y) {
1638
- ye(g, y);
1638
+ we(g, y);
1639
1639
  },
1640
1640
  touchstart: function(y) {
1641
- Z(g, y);
1641
+ L(g, y);
1642
1642
  },
1643
1643
  touchend: function(y) {
1644
- J(g, y);
1644
+ q(g, y);
1645
1645
  },
1646
1646
  touchmove: function(y) {
1647
- ne(g, y);
1647
+ ee(g, y);
1648
1648
  },
1649
1649
  touchcancel: function(y) {
1650
- te(g, y);
1650
+ ne(g, y);
1651
1651
  },
1652
1652
  gesturestart: function(y) {
1653
1653
  se(g, y);
1654
1654
  },
1655
1655
  // Safari/Safari iOS
1656
1656
  gesturechange: function(y) {
1657
- ae(g, y);
1657
+ oe(g, y);
1658
1658
  },
1659
1659
  // Safari/Safari iOS
1660
1660
  gotpointercapture: function(y) {
1661
1661
  le(g, y);
1662
1662
  },
1663
1663
  lostpointercapture: function(y) {
1664
- xe(g, y);
1664
+ he(g, y);
1665
1665
  },
1666
1666
  pointerenter: function(y) {
1667
1667
  G(g, y);
1668
1668
  },
1669
1669
  pointerleave: function(y) {
1670
- pe(g, y);
1670
+ fe(g, y);
1671
1671
  },
1672
1672
  pointerover: function(y) {
1673
- fe(g, y);
1673
+ ge(g, y);
1674
1674
  },
1675
1675
  pointerout: function(y) {
1676
- ge(g, y);
1676
+ me(g, y);
1677
1677
  },
1678
1678
  pointerdown: function(y) {
1679
- he(g, y);
1679
+ ue(g, y);
1680
1680
  },
1681
1681
  pointerup: function(y) {
1682
- me(g, y);
1682
+ ve(g, y);
1683
1683
  },
1684
1684
  pointermove: function(y) {
1685
- ye(g, y);
1685
+ we(g, y);
1686
1686
  },
1687
1687
  pointercancel: function(y) {
1688
1688
  Se(g, y);
@@ -2372,26 +2372,26 @@ function Ve() {
2372
2372
  }
2373
2373
  }
2374
2374
  e.MouseTracker.gesturePointVelocityTracker = /* @__PURE__ */ function() {
2375
- var p = [], c = 0, g = 0, y = function(K, M) {
2376
- return K.hash.toString() + M.type + M.id.toString();
2375
+ var p = [], c = 0, g = 0, y = function(Q, M) {
2376
+ return Q.hash.toString() + M.type + M.id.toString();
2377
2377
  }, S = function() {
2378
- var K, M = p.length, oe, re, ce = e.now(), Pe, Re, Ce;
2379
- for (Pe = ce - g, g = ce, K = 0; K < M; K++)
2380
- oe = p[K], re = oe.gPoint, re.direction = Math.atan2(re.currentPos.y - oe.lastPos.y, re.currentPos.x - oe.lastPos.x), Re = oe.lastPos.distanceTo(re.currentPos), oe.lastPos = re.currentPos, Ce = 1e3 * Re / (Pe + 1), re.speed = 0.75 * Ce + 0.25 * re.speed;
2381
- }, D = function(K, M) {
2382
- var oe = y(K, M);
2378
+ var Q, M = p.length, ae, re, de = e.now(), Pe, Re, Ce;
2379
+ for (Pe = de - g, g = de, Q = 0; Q < M; Q++)
2380
+ ae = p[Q], re = ae.gPoint, re.direction = Math.atan2(re.currentPos.y - ae.lastPos.y, re.currentPos.x - ae.lastPos.x), Re = ae.lastPos.distanceTo(re.currentPos), ae.lastPos = re.currentPos, Ce = 1e3 * Re / (Pe + 1), re.speed = 0.75 * Ce + 0.25 * re.speed;
2381
+ }, D = function(Q, M) {
2382
+ var ae = y(Q, M);
2383
2383
  p.push(
2384
2384
  {
2385
- guid: oe,
2385
+ guid: ae,
2386
2386
  gPoint: M,
2387
2387
  lastPos: M.currentPos
2388
2388
  }
2389
2389
  ), p.length === 1 && (g = e.now(), c = window.setInterval(S, 50));
2390
- }, H = function(K, M) {
2391
- var oe = y(K, M), re, ce = p.length;
2392
- for (re = 0; re < ce; re++)
2393
- if (p[re].guid === oe) {
2394
- p.splice(re, 1), ce--, ce === 0 && window.clearInterval(c);
2390
+ }, H = function(Q, M) {
2391
+ var ae = y(Q, M), re, de = p.length;
2392
+ for (re = 0; re < de; re++)
2393
+ if (p[re].guid === ae) {
2394
+ p.splice(re, 1), de--, de === 0 && window.clearInterval(c);
2395
2395
  break;
2396
2396
  }
2397
2397
  };
@@ -2499,15 +2499,15 @@ function Ve() {
2499
2499
  }
2500
2500
  };
2501
2501
  function r(p) {
2502
- var c = t[p.hash], g, y, S, D, H, K = c.activePointersLists.length;
2503
- for (g = 0; g < K; g++)
2502
+ var c = t[p.hash], g, y, S, D, H, Q = c.activePointersLists.length;
2503
+ for (g = 0; g < Q; g++)
2504
2504
  if (S = c.activePointersLists[g], S.getLength() > 0) {
2505
2505
  for (H = [], D = S.asArray(), y = 0; y < D.length; y++)
2506
2506
  H.push(D[y]);
2507
2507
  for (y = 0; y < H.length; y++)
2508
- ue(p, S, H[y]);
2508
+ ce(p, S, H[y]);
2509
2509
  }
2510
- for (g = 0; g < K; g++)
2510
+ for (g = 0; g < Q; g++)
2511
2511
  c.activePointersLists.pop();
2512
2512
  c.sentDragEvent = !1;
2513
2513
  }
@@ -2664,7 +2664,7 @@ function Ve() {
2664
2664
  };
2665
2665
  m(p, g), g.preventDefault && !g.defaultPrevented && e.cancelEvent(c), g.stopPropagation && e.stopEvent(c);
2666
2666
  }
2667
- function O(p, c) {
2667
+ function B(p, c) {
2668
2668
  var g = null, y = {
2669
2669
  originalEvent: c,
2670
2670
  eventType: "keydown",
@@ -2721,7 +2721,7 @@ function Ve() {
2721
2721
  userData: p.userData
2722
2722
  }, p.keyHandler(g)), (g && g.preventDefault || y.preventDefault && !y.defaultPrevented) && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
2723
2723
  }
2724
- function j(p, c) {
2724
+ function Z(p, c) {
2725
2725
  var g = {
2726
2726
  originalEvent: c,
2727
2727
  eventType: "focus",
@@ -2736,7 +2736,7 @@ function Ve() {
2736
2736
  }
2737
2737
  );
2738
2738
  }
2739
- function q(p, c) {
2739
+ function X(p, c) {
2740
2740
  var g = {
2741
2741
  originalEvent: c,
2742
2742
  eventType: "blur",
@@ -2766,10 +2766,10 @@ function Ve() {
2766
2766
  userData: p.userData
2767
2767
  }, p.contextMenuHandler(g)), (g && g.preventDefault || y.preventDefault && !y.defaultPrevented) && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
2768
2768
  }
2769
- function X(p, c) {
2770
- L(p, c, c);
2769
+ function Y(p, c) {
2770
+ O(p, c, c);
2771
2771
  }
2772
- function B(p, c) {
2772
+ function U(p, c) {
2773
2773
  var g = {
2774
2774
  target: c.target || c.srcElement,
2775
2775
  type: "wheel",
@@ -2783,9 +2783,9 @@ function Ve() {
2783
2783
  deltaX: 0,
2784
2784
  deltaZ: 0
2785
2785
  };
2786
- e.MouseTracker.wheelEventName === "mousewheel" ? g.deltaY = -c.wheelDelta / e.DEFAULT_SETTINGS.pixelsPerWheelLine : g.deltaY = c.detail, L(p, g, c);
2786
+ e.MouseTracker.wheelEventName === "mousewheel" ? g.deltaY = -c.wheelDelta / e.DEFAULT_SETTINGS.pixelsPerWheelLine : g.deltaY = c.detail, O(p, g, c);
2787
2787
  }
2788
- function L(p, c, g) {
2788
+ function O(p, c, g) {
2789
2789
  var y = 0, S, D = null;
2790
2790
  y = c.deltaY ? c.deltaY < 0 ? 1 : -1 : 0, S = {
2791
2791
  originalEvent: c,
@@ -2804,7 +2804,7 @@ function Ve() {
2804
2804
  userData: p.userData
2805
2805
  }, p.scrollHandler(D)), S.stopPropagation && e.stopEvent(g), (D && D.preventDefault || S.preventDefault && !S.defaultPrevented) && e.cancelEvent(g);
2806
2806
  }
2807
- function k(p, c) {
2807
+ function j(p, c) {
2808
2808
  var g = {
2809
2809
  id: e.MouseTracker.mousePointerId,
2810
2810
  type: "mouse"
@@ -2816,16 +2816,16 @@ function Ve() {
2816
2816
  };
2817
2817
  m(p, y), c.target === p.element && _(p, g, !1), y.stopPropagation && e.stopEvent(c);
2818
2818
  }
2819
- function Z(p, c) {
2819
+ function L(p, c) {
2820
2820
  var g, y, S = c.changedTouches.length, D, H = p.getActivePointersListByType("touch");
2821
2821
  g = e.now(), H.getLength() > c.touches.length - S && e.console.warn("Tracked touch contact count doesn't match event.touches.length");
2822
- var K = {
2822
+ var Q = {
2823
2823
  originalEvent: c,
2824
2824
  eventType: "pointerdown",
2825
2825
  pointerType: "touch",
2826
2826
  isEmulated: !1
2827
2827
  };
2828
- for (m(p, K), y = 0; y < S; y++)
2828
+ for (m(p, Q), y = 0; y < S; y++)
2829
2829
  D = {
2830
2830
  id: c.changedTouches[y].identifier,
2831
2831
  type: "touch",
@@ -2833,10 +2833,10 @@ function Ve() {
2833
2833
  isPrimary: H.getLength() === 0,
2834
2834
  currentPos: w(c.changedTouches[y]),
2835
2835
  currentTime: g
2836
- }, b(p, K, D), N(p, K, D, 0), _(p, D, !0);
2837
- K.preventDefault && !K.defaultPrevented && e.cancelEvent(c), K.stopPropagation && e.stopEvent(c);
2836
+ }, b(p, Q, D), k(p, Q, D, 0), _(p, D, !0);
2837
+ Q.preventDefault && !Q.defaultPrevented && e.cancelEvent(c), Q.stopPropagation && e.stopEvent(c);
2838
2838
  }
2839
- function J(p, c) {
2839
+ function q(p, c) {
2840
2840
  var g, y, S = c.changedTouches.length, D;
2841
2841
  g = e.now();
2842
2842
  var H = {
@@ -2851,10 +2851,10 @@ function Ve() {
2851
2851
  type: "touch",
2852
2852
  currentPos: w(c.changedTouches[y]),
2853
2853
  currentTime: g
2854
- }, Y(p, H, D, 0), _(p, D, !1), F(p, H, D);
2854
+ }, K(p, H, D, 0), _(p, D, !1), F(p, H, D);
2855
2855
  H.preventDefault && !H.defaultPrevented && e.cancelEvent(c), H.stopPropagation && e.stopEvent(c);
2856
2856
  }
2857
- function ne(p, c) {
2857
+ function ee(p, c) {
2858
2858
  var g, y, S = c.changedTouches.length, D;
2859
2859
  g = e.now();
2860
2860
  var H = {
@@ -2869,10 +2869,10 @@ function Ve() {
2869
2869
  type: "touch",
2870
2870
  currentPos: w(c.changedTouches[y]),
2871
2871
  currentTime: g
2872
- }, Q(p, H, D);
2872
+ }, J(p, H, D);
2873
2873
  H.preventDefault && !H.defaultPrevented && e.cancelEvent(c), H.stopPropagation && e.stopEvent(c);
2874
2874
  }
2875
- function te(p, c) {
2875
+ function ne(p, c) {
2876
2876
  var g = c.changedTouches.length, y, S, D = {
2877
2877
  originalEvent: c,
2878
2878
  eventType: "pointercancel",
@@ -2883,13 +2883,13 @@ function Ve() {
2883
2883
  S = {
2884
2884
  id: c.changedTouches[y].identifier,
2885
2885
  type: "touch"
2886
- }, U(p, D, S);
2886
+ }, N(p, D, S);
2887
2887
  D.stopPropagation && e.stopEvent(c);
2888
2888
  }
2889
2889
  function se(p, c) {
2890
2890
  return e.eventIsCanceled(c) || c.preventDefault(), !1;
2891
2891
  }
2892
- function ae(p, c) {
2892
+ function oe(p, c) {
2893
2893
  return e.eventIsCanceled(c) || c.preventDefault(), !1;
2894
2894
  }
2895
2895
  function le(p, c) {
@@ -2904,7 +2904,7 @@ function Ve() {
2904
2904
  type: f(c)
2905
2905
  }, !0), g.stopPropagation && e.stopEvent(c);
2906
2906
  }
2907
- function xe(p, c) {
2907
+ function he(p, c) {
2908
2908
  var g = {
2909
2909
  originalEvent: c,
2910
2910
  eventType: "lostpointercapture",
@@ -2931,7 +2931,7 @@ function Ve() {
2931
2931
  };
2932
2932
  m(p, y), b(p, y, g);
2933
2933
  }
2934
- function pe(p, c) {
2934
+ function fe(p, c) {
2935
2935
  var g = {
2936
2936
  id: d(c),
2937
2937
  type: f(c),
@@ -2946,7 +2946,7 @@ function Ve() {
2946
2946
  };
2947
2947
  m(p, y), F(p, y, g);
2948
2948
  }
2949
- function fe(p, c) {
2949
+ function ge(p, c) {
2950
2950
  var g = {
2951
2951
  id: d(c),
2952
2952
  type: f(c),
@@ -2961,7 +2961,7 @@ function Ve() {
2961
2961
  };
2962
2962
  m(p, y), A(p, y, g), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
2963
2963
  }
2964
- function ge(p, c) {
2964
+ function me(p, c) {
2965
2965
  var g = {
2966
2966
  id: d(c),
2967
2967
  type: f(c),
@@ -2976,7 +2976,7 @@ function Ve() {
2976
2976
  };
2977
2977
  m(p, y), R(p, y, g), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
2978
2978
  }
2979
- function he(p, c) {
2979
+ function ue(p, c) {
2980
2980
  var g = {
2981
2981
  id: d(c),
2982
2982
  type: f(c),
@@ -2989,16 +2989,16 @@ function Ve() {
2989
2989
  pointerType: g.type,
2990
2990
  isEmulated: !1
2991
2991
  };
2992
- m(p, S), N(p, S, g, c.button), S.preventDefault && !S.defaultPrevented && e.cancelEvent(c), S.stopPropagation && e.stopEvent(c), S.shouldCapture && (y ? _(p, g, !0) : l(p, g));
2992
+ m(p, S), k(p, S, g, c.button), S.preventDefault && !S.defaultPrevented && e.cancelEvent(c), S.stopPropagation && e.stopEvent(c), S.shouldCapture && (y ? _(p, g, !0) : l(p, g));
2993
2993
  }
2994
- function me(p, c) {
2995
- ve(p, c);
2994
+ function ve(p, c) {
2995
+ ye(p, c);
2996
2996
  }
2997
2997
  function _e(p, c) {
2998
2998
  var g = p.getActivePointersListByType(f(c));
2999
- g.getById(c.pointerId) && ve(p, c), e.stopEvent(c);
2999
+ g.getById(c.pointerId) && ye(p, c), e.stopEvent(c);
3000
3000
  }
3001
- function ve(p, c) {
3001
+ function ye(p, c) {
3002
3002
  var g;
3003
3003
  g = {
3004
3004
  id: d(c),
@@ -3013,16 +3013,16 @@ function Ve() {
3013
3013
  pointerType: g.type,
3014
3014
  isEmulated: !1
3015
3015
  };
3016
- m(p, y), Y(p, y, g, c.button), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c), y.shouldReleaseCapture && (c.target === p.element ? h(p, g) : _(p, g, !1));
3016
+ m(p, y), K(p, y, g, c.button), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c), y.shouldReleaseCapture && (c.target === p.element ? h(p, g) : _(p, g, !1));
3017
3017
  }
3018
- function ye(p, c) {
3019
- we(p, c);
3018
+ function we(p, c) {
3019
+ Te(p, c);
3020
3020
  }
3021
3021
  function Ee(p, c) {
3022
3022
  var g = p.getActivePointersListByType(f(c));
3023
- g.getById(c.pointerId) && we(p, c), e.stopEvent(c);
3023
+ g.getById(c.pointerId) && Te(p, c), e.stopEvent(c);
3024
3024
  }
3025
- function we(p, c) {
3025
+ function Te(p, c) {
3026
3026
  var g = {
3027
3027
  id: d(c),
3028
3028
  type: f(c),
@@ -3035,7 +3035,7 @@ function Ve() {
3035
3035
  pointerType: g.type,
3036
3036
  isEmulated: !1
3037
3037
  };
3038
- m(p, y), Q(p, y, g), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
3038
+ m(p, y), J(p, y, g), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
3039
3039
  }
3040
3040
  function Se(p, c) {
3041
3041
  var g = {
@@ -3047,12 +3047,12 @@ function Ve() {
3047
3047
  pointerType: g.type,
3048
3048
  isEmulated: !1
3049
3049
  };
3050
- m(p, y), U(p, y, g), y.stopPropagation && e.stopEvent(c);
3050
+ m(p, y), N(p, y, g), y.stopPropagation && e.stopEvent(c);
3051
3051
  }
3052
- function de(p, c) {
3052
+ function pe(p, c) {
3053
3053
  return c.speed = 0, c.direction = 0, c.contactPos = c.currentPos, c.contactTime = c.currentTime, c.lastPos = c.currentPos, c.lastTime = c.currentTime, p.add(c);
3054
3054
  }
3055
- function ue(p, c, g) {
3055
+ function ce(p, c, g) {
3056
3056
  var y, S = c.getById(g.id);
3057
3057
  return S ? (S.captured && (e.console.warn("stopTrackingPointer() called on captured pointer"), h(p, S)), c.removeContact(), y = c.removeById(g.id)) : y = c.getLength(), y;
3058
3058
  }
@@ -3107,7 +3107,7 @@ function Ve() {
3107
3107
  }
3108
3108
  function b(p, c, g) {
3109
3109
  var y = p.getActivePointersListByType(g.type), S;
3110
- S = y.getById(g.id), S ? (S.insideElement = !0, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime, g = S) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, de(y, g)), p.enterHandler && p.enterHandler(
3110
+ S = y.getById(g.id), S ? (S.insideElement = !0, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime, g = S) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, pe(y, g)), p.enterHandler && p.enterHandler(
3111
3111
  {
3112
3112
  eventSource: p,
3113
3113
  pointerType: g.type,
@@ -3124,7 +3124,7 @@ function Ve() {
3124
3124
  }
3125
3125
  function F(p, c, g) {
3126
3126
  var y = p.getActivePointersListByType(g.type), S, D;
3127
- S = y.getById(g.id), S ? (S.captured ? (S.insideElement = !1, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime) : ue(p, y, S), g = S) : (g.captured = !1, g.insideElementPressed = !1), (p.leaveHandler || p.exitHandler) && (D = {
3127
+ S = y.getById(g.id), S ? (S.captured ? (S.insideElement = !1, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime) : ce(p, y, S), g = S) : (g.captured = !1, g.insideElementPressed = !1), (p.leaveHandler || p.exitHandler) && (D = {
3128
3128
  eventSource: p,
3129
3129
  pointerType: g.type,
3130
3130
  // GitHub PR: https://github.com/openseadragon/openseadragon/pull/1754 (gPoint.currentPos && )
@@ -3170,7 +3170,7 @@ function Ve() {
3170
3170
  userData: p.userData
3171
3171
  });
3172
3172
  }
3173
- function N(p, c, g, y) {
3173
+ function k(p, c, g, y) {
3174
3174
  var S = t[p.hash], D = p.getActivePointersListByType(g.type), H;
3175
3175
  if (typeof c.originalEvent.buttons < "u" ? D.buttons = c.originalEvent.buttons : y === 0 ? D.buttons |= 1 : y === 1 ? D.buttons |= 4 : y === 2 ? D.buttons |= 2 : y === 3 ? D.buttons |= 8 : y === 4 ? D.buttons |= 16 : y === 5 && (D.buttons |= 32), y !== 0) {
3176
3176
  c.shouldCapture = !1, c.shouldReleaseCapture = !1, p.nonPrimaryPressHandler && !c.preventGesture && !c.defaultPrevented && (c.preventDefault = !0, p.nonPrimaryPressHandler(
@@ -3187,7 +3187,7 @@ function Ve() {
3187
3187
  ));
3188
3188
  return;
3189
3189
  }
3190
- H = D.getById(g.id), H ? (H.insideElementPressed = !0, H.insideElement = !0, H.originalTarget = c.originalEvent.target, H.contactPos = g.currentPos, H.contactTime = g.currentTime, H.lastPos = H.currentPos, H.lastTime = H.currentTime, H.currentPos = g.currentPos, H.currentTime = g.currentTime, g = H) : (g.captured = !1, g.insideElementPressed = !0, g.insideElement = !0, g.originalTarget = c.originalEvent.target, de(D, g)), D.addContact(), !c.preventGesture && !c.defaultPrevented ? (c.shouldCapture = !0, c.shouldReleaseCapture = !1, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.addPoint(p, g), D.contacts === 1 ? p.pressHandler && !c.preventGesture && p.pressHandler(
3190
+ H = D.getById(g.id), H ? (H.insideElementPressed = !0, H.insideElement = !0, H.originalTarget = c.originalEvent.target, H.contactPos = g.currentPos, H.contactTime = g.currentTime, H.lastPos = H.currentPos, H.lastTime = H.currentTime, H.currentPos = g.currentPos, H.currentTime = g.currentTime, g = H) : (g.captured = !1, g.insideElementPressed = !0, g.insideElement = !0, g.originalTarget = c.originalEvent.target, pe(D, g)), D.addContact(), !c.preventGesture && !c.defaultPrevented ? (c.shouldCapture = !0, c.shouldReleaseCapture = !1, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.addPoint(p, g), D.contacts === 1 ? p.pressHandler && !c.preventGesture && p.pressHandler(
3191
3191
  {
3192
3192
  eventSource: p,
3193
3193
  pointerType: g.type,
@@ -3199,8 +3199,8 @@ function Ve() {
3199
3199
  }
3200
3200
  ) : D.contacts === 2 && p.pinchHandler && g.type === "touch" && (S.pinchGPoints = D.asArray(), S.lastPinchDist = S.currentPinchDist = S.pinchGPoints[0].currentPos.distanceTo(S.pinchGPoints[1].currentPos), S.lastPinchCenter = S.currentPinchCenter = E(S.pinchGPoints[0].currentPos, S.pinchGPoints[1].currentPos))) : (c.shouldCapture = !1, c.shouldReleaseCapture = !1);
3201
3201
  }
3202
- function Y(p, c, g, y) {
3203
- var S = t[p.hash], D = p.getActivePointersListByType(g.type), H, K, M, oe = !1, re;
3202
+ function K(p, c, g, y) {
3203
+ var S = t[p.hash], D = p.getActivePointersListByType(g.type), H, Q, M, ae = !1, re;
3204
3204
  if (typeof c.originalEvent.buttons < "u" ? D.buttons = c.originalEvent.buttons : y === 0 ? D.buttons ^= -2 : y === 1 ? D.buttons ^= -5 : y === 2 ? D.buttons ^= -3 : y === 3 ? D.buttons ^= -9 : y === 4 ? D.buttons ^= -17 : y === 5 && (D.buttons ^= -33), c.shouldCapture = !1, y !== 0) {
3205
3205
  c.shouldReleaseCapture = !1, p.nonPrimaryReleaseHandler && !c.preventGesture && !c.defaultPrevented && (c.preventDefault = !0, p.nonPrimaryReleaseHandler(
3206
3206
  {
@@ -3216,7 +3216,7 @@ function Ve() {
3216
3216
  ));
3217
3217
  return;
3218
3218
  }
3219
- M = D.getById(g.id), M ? (D.removeContact(), M.captured && (oe = !0), M.lastPos = M.currentPos, M.lastTime = M.currentTime, M.currentPos = g.currentPos, M.currentTime = g.currentTime, M.insideElement || ue(p, D, M), H = M.currentPos, K = M.currentTime) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, de(D, g), M = g), !c.preventGesture && !c.defaultPrevented && (oe ? (c.shouldReleaseCapture = !0, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.removePoint(p, M), D.contacts === 0 ? (p.releaseHandler && H && p.releaseHandler(
3219
+ M = D.getById(g.id), M ? (D.removeContact(), M.captured && (ae = !0), M.lastPos = M.currentPos, M.lastTime = M.currentTime, M.currentPos = g.currentPos, M.currentTime = g.currentTime, M.insideElement || ce(p, D, M), H = M.currentPos, Q = M.currentTime) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, pe(D, g), M = g), !c.preventGesture && !c.defaultPrevented && (ae ? (c.shouldReleaseCapture = !0, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.removePoint(p, M), D.contacts === 0 ? (p.releaseHandler && H && p.releaseHandler(
3220
3220
  {
3221
3221
  eventSource: p,
3222
3222
  pointerType: M.type,
@@ -3240,7 +3240,7 @@ function Ve() {
3240
3240
  originalEvent: c.originalEvent,
3241
3241
  userData: p.userData
3242
3242
  }
3243
- ), S.sentDragEvent = !1, (p.clickHandler || p.dblClickHandler) && M.insideElement && (re = K - M.contactTime <= p.clickTimeThreshold && M.contactPos.distanceTo(H) <= p.clickDistThreshold, p.clickHandler && p.clickHandler(
3243
+ ), S.sentDragEvent = !1, (p.clickHandler || p.dblClickHandler) && M.insideElement && (re = Q - M.contactTime <= p.clickTimeThreshold && M.contactPos.distanceTo(H) <= p.clickDistThreshold, p.clickHandler && p.clickHandler(
3244
3244
  {
3245
3245
  eventSource: p,
3246
3246
  pointerType: M.type,
@@ -3278,14 +3278,14 @@ function Ve() {
3278
3278
  }
3279
3279
  ), c.preventDefault = !0)));
3280
3280
  }
3281
- function Q(p, c, g) {
3282
- var y = t[p.hash], S = p.getActivePointersListByType(g.type), D, H, K;
3281
+ function J(p, c, g) {
3282
+ var y = t[p.hash], S = p.getActivePointersListByType(g.type), D, H, Q;
3283
3283
  if (typeof c.originalEvent.buttons < "u" && (S.buttons = c.originalEvent.buttons), D = S.getById(g.id), D)
3284
3284
  D.lastPos = D.currentPos, D.lastTime = D.currentTime, D.currentPos = g.currentPos, D.currentTime = g.currentTime;
3285
3285
  else
3286
3286
  return;
3287
3287
  c.shouldCapture = !1, c.shouldReleaseCapture = !1, p.stopHandler && g.type === "mouse" && (clearTimeout(p.stopTimeOut), p.stopTimeOut = setTimeout(function() {
3288
- ee(p, c.originalEvent, g.type);
3288
+ te(p, c.originalEvent, g.type);
3289
3289
  }, p.stopDelay)), S.contacts === 0 ? p.moveHandler && p.moveHandler(
3290
3290
  {
3291
3291
  eventSource: p,
@@ -3306,13 +3306,13 @@ function Ve() {
3306
3306
  originalEvent: c.originalEvent,
3307
3307
  userData: p.userData
3308
3308
  }
3309
- )), p.dragHandler && !c.preventGesture && !c.defaultPrevented && (D = S.asArray()[0], K = D.currentPos.minus(D.lastPos), p.dragHandler(
3309
+ )), p.dragHandler && !c.preventGesture && !c.defaultPrevented && (D = S.asArray()[0], Q = D.currentPos.minus(D.lastPos), p.dragHandler(
3310
3310
  {
3311
3311
  eventSource: p,
3312
3312
  pointerType: D.type,
3313
3313
  position: x(D.currentPos, p.element),
3314
3314
  buttons: S.buttons,
3315
- delta: K,
3315
+ delta: Q,
3316
3316
  speed: D.speed,
3317
3317
  direction: D.direction,
3318
3318
  shift: c.originalEvent.shiftKey,
@@ -3330,7 +3330,7 @@ function Ve() {
3330
3330
  originalEvent: c.originalEvent,
3331
3331
  userData: p.userData
3332
3332
  }
3333
- )), p.pinchHandler && g.type === "touch" && !c.preventGesture && !c.defaultPrevented && (K = y.pinchGPoints[0].currentPos.distanceTo(y.pinchGPoints[1].currentPos), K !== y.currentPinchDist && (y.lastPinchDist = y.currentPinchDist, y.currentPinchDist = K, y.lastPinchCenter = y.currentPinchCenter, y.currentPinchCenter = E(y.pinchGPoints[0].currentPos, y.pinchGPoints[1].currentPos), p.pinchHandler(
3333
+ )), p.pinchHandler && g.type === "touch" && !c.preventGesture && !c.defaultPrevented && (Q = y.pinchGPoints[0].currentPos.distanceTo(y.pinchGPoints[1].currentPos), Q !== y.currentPinchDist && (y.lastPinchDist = y.currentPinchDist, y.currentPinchDist = Q, y.lastPinchCenter = y.currentPinchCenter, y.currentPinchCenter = E(y.pinchGPoints[0].currentPos, y.pinchGPoints[1].currentPos), p.pinchHandler(
3334
3334
  {
3335
3335
  eventSource: p,
3336
3336
  pointerType: "touch",
@@ -3345,11 +3345,11 @@ function Ve() {
3345
3345
  }
3346
3346
  ), c.preventDefault = !0)));
3347
3347
  }
3348
- function U(p, c, g) {
3348
+ function N(p, c, g) {
3349
3349
  var y = p.getActivePointersListByType(g.type), S;
3350
- S = y.getById(g.id), S && ue(p, y, S);
3350
+ S = y.getById(g.id), S && ce(p, y, S);
3351
3351
  }
3352
- function ee(p, c, g) {
3352
+ function te(p, c, g) {
3353
3353
  p.stopHandler && p.stopHandler({
3354
3354
  eventSource: p,
3355
3355
  pointerType: g,
@@ -3603,7 +3603,7 @@ function Ve() {
3603
3603
  ];
3604
3604
  if (u.drawerOptions = Object.assign(
3605
3605
  {},
3606
- F.reduce((R, N) => (R[N] = u[N], delete u[N], R), {}),
3606
+ F.reduce((R, k) => (R[k] = u[k], delete u[k], R), {}),
3607
3607
  u.drawerOptions
3608
3608
  ), e.extend(!0, this, {
3609
3609
  //internal state and dom identifiers
@@ -3711,8 +3711,8 @@ function Ve() {
3711
3711
  lastClickTime: null,
3712
3712
  draggingToZoom: !1
3713
3713
  }, this._sequenceIndex = 0, this._firstOpen = !0, this._updateRequestId = null, this._loadQueue = [], this.currentOverlays = [], this._updatePixelDensityRatioBind = null, this._lastScrollTime = e.now(), e.EventSource.call(this), this.addHandler("open-failed", function(R) {
3714
- var N = e.getString("Errors.OpenFailed", R.eventSource, R.message);
3715
- _._showMessage(N);
3714
+ var k = e.getString("Errors.OpenFailed", R.eventSource, R.message);
3715
+ _._showMessage(k);
3716
3716
  }), e.ControlDock.call(this, u), this.xmlPath && (this.tileSources = [this.xmlPath]), this.element = this.element || document.getElementById(this.id), this.canvas = e.makeNeutralElement("div"), this.canvas.className = "openseadragon-canvas", function(R) {
3717
3717
  R.width = "100%", R.height = "100%", R.overflow = "hidden", R.position = "absolute", R.top = "0px", R.left = "0px";
3718
3718
  }(this.canvas.style), e.setElementTouchActionNone(this.canvas), u.tabIndex !== "" && (this.canvas.tabIndex = u.tabIndex === void 0 ? 0 : u.tabIndex), this.container.className = "openseadragon-container", function(R) {
@@ -3730,18 +3730,18 @@ function Ve() {
3730
3730
  keyHandler: e.delegate(this, E),
3731
3731
  clickHandler: e.delegate(this, P),
3732
3732
  dblClickHandler: e.delegate(this, I),
3733
- dragHandler: e.delegate(this, O),
3733
+ dragHandler: e.delegate(this, B),
3734
3734
  dragEndHandler: e.delegate(this, z),
3735
3735
  enterHandler: e.delegate(this, V),
3736
- leaveHandler: e.delegate(this, j),
3737
- pressHandler: e.delegate(this, q),
3736
+ leaveHandler: e.delegate(this, Z),
3737
+ pressHandler: e.delegate(this, X),
3738
3738
  releaseHandler: e.delegate(this, $),
3739
- nonPrimaryPressHandler: e.delegate(this, X),
3740
- nonPrimaryReleaseHandler: e.delegate(this, B),
3741
- scrollHandler: e.delegate(this, J),
3742
- pinchHandler: e.delegate(this, L),
3743
- focusHandler: e.delegate(this, k),
3744
- blurHandler: e.delegate(this, Z)
3739
+ nonPrimaryPressHandler: e.delegate(this, Y),
3740
+ nonPrimaryReleaseHandler: e.delegate(this, U),
3741
+ scrollHandler: e.delegate(this, q),
3742
+ pinchHandler: e.delegate(this, O),
3743
+ focusHandler: e.delegate(this, j),
3744
+ blurHandler: e.delegate(this, L)
3745
3745
  }), this.outerTracker = new e.MouseTracker({
3746
3746
  userData: "Viewer.outerTracker",
3747
3747
  element: this.container,
@@ -3750,8 +3750,8 @@ function Ve() {
3750
3750
  clickDistThreshold: this.clickDistThreshold,
3751
3751
  dblClickTimeThreshold: this.dblClickTimeThreshold,
3752
3752
  dblClickDistThreshold: this.dblClickDistThreshold,
3753
- enterHandler: e.delegate(this, ne),
3754
- leaveHandler: e.delegate(this, te)
3753
+ enterHandler: e.delegate(this, ee),
3754
+ leaveHandler: e.delegate(this, ne)
3755
3755
  }), this.toolbar && (this.toolbar = new e.ControlDock({ element: this.toolbar })), this.bindStandardControls(), t[this.hash].prevContainerSize = i(this.container), window.ResizeObserver ? (this._autoResizePolling = !1, this._resizeObserver = new ResizeObserver(function() {
3756
3756
  t[_.hash].needsResize = !0;
3757
3757
  }), this._resizeObserver.observe(this.container, {})) : this._autoResizePolling = !0, this.world = new e.World({
@@ -3884,34 +3884,34 @@ function Ve() {
3884
3884
  if (e.isArray(u) || (u = [u]), !u.length)
3885
3885
  return this;
3886
3886
  this._opening = !0;
3887
- for (var b = u.length, F = 0, A = 0, R, N = function() {
3887
+ for (var b = u.length, F = 0, A = 0, R, k = function() {
3888
3888
  if (F + A === b)
3889
3889
  if (F) {
3890
3890
  (_._firstOpen || !_.preserveViewport) && (_.viewport.goHome(!0), _.viewport.update()), _._firstOpen = !1;
3891
- var U = u[0];
3892
- if (U.tileSource && (U = U.tileSource), _.overlays && !_.preserveOverlays)
3893
- for (var ee = 0; ee < _.overlays.length; ee++)
3894
- _.currentOverlays[ee] = a(_, _.overlays[ee]);
3895
- _._drawOverlays(), _._opening = !1, _.raiseEvent("open", { source: U });
3891
+ var N = u[0];
3892
+ if (N.tileSource && (N = N.tileSource), _.overlays && !_.preserveOverlays)
3893
+ for (var te = 0; te < _.overlays.length; te++)
3894
+ _.currentOverlays[te] = a(_, _.overlays[te]);
3895
+ _._drawOverlays(), _._opening = !1, _.raiseEvent("open", { source: N });
3896
3896
  } else
3897
3897
  _._opening = !1, _.raiseEvent("open-failed", R);
3898
- }, Y = function(U) {
3899
- (!e.isPlainObject(U) || !U.tileSource) && (U = {
3900
- tileSource: U
3901
- }), U.index !== void 0 && (e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"), delete U.index), U.collectionImmediately === void 0 && (U.collectionImmediately = !0);
3902
- var ee = U.success;
3903
- U.success = function(c) {
3904
- if (F++, U.tileSource.overlays)
3905
- for (var g = 0; g < U.tileSource.overlays.length; g++)
3906
- _.addOverlay(U.tileSource.overlays[g]);
3907
- ee && ee(c), N();
3898
+ }, K = function(N) {
3899
+ (!e.isPlainObject(N) || !N.tileSource) && (N = {
3900
+ tileSource: N
3901
+ }), N.index !== void 0 && (e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"), delete N.index), N.collectionImmediately === void 0 && (N.collectionImmediately = !0);
3902
+ var te = N.success;
3903
+ N.success = function(c) {
3904
+ if (F++, N.tileSource.overlays)
3905
+ for (var g = 0; g < N.tileSource.overlays.length; g++)
3906
+ _.addOverlay(N.tileSource.overlays[g]);
3907
+ te && te(c), k();
3908
3908
  };
3909
- var p = U.error;
3910
- U.error = function(c) {
3911
- A++, R || (R = c), p && p(c), N();
3912
- }, _.addTiledImage(U);
3913
- }, Q = 0; Q < u.length; Q++)
3914
- Y(u[Q]);
3909
+ var p = N.error;
3910
+ N.error = function(c) {
3911
+ A++, R || (R = c), p && p(c), k();
3912
+ }, _.addTiledImage(N);
3913
+ }, J = 0; J < u.length; J++)
3914
+ K(u[J]);
3915
3915
  return this;
3916
3916
  },
3917
3917
  /**
@@ -3969,17 +3969,17 @@ function Ve() {
3969
3969
  };
3970
3970
  m = e.extend(!0, _, m);
3971
3971
  const b = m.mainDrawer, F = m.redrawImmediately, A = m.drawerOptions, R = this.drawer;
3972
- let N = null;
3973
- if (u && u.prototype instanceof e.DrawerBase ? (N = u, u = "custom") : typeof u == "string" && (N = e.determineDrawer(u)), N || e.console.warn("Unsupported drawer! Drawer must be an existing string type, or a class that extends OpenSeadragon.DrawerBase."), N && N.isSupported()) {
3972
+ let k = null;
3973
+ if (u && u.prototype instanceof e.DrawerBase ? (k = u, u = "custom") : typeof u == "string" && (k = e.determineDrawer(u)), k || e.console.warn("Unsupported drawer! Drawer must be an existing string type, or a class that extends OpenSeadragon.DrawerBase."), k && k.isSupported()) {
3974
3974
  R && b && R.destroy();
3975
- const Y = new N({
3975
+ const K = new k({
3976
3976
  viewer: this,
3977
3977
  viewport: this.viewport,
3978
3978
  element: this.canvas,
3979
3979
  debugGridColor: this.debugGridColor,
3980
3980
  options: A || this.drawerOptions[u]
3981
3981
  });
3982
- return b && (this.drawer = Y, F && this.forceRedraw()), Y;
3982
+ return b && (this.drawer = K, F && this.forceRedraw()), K;
3983
3983
  }
3984
3984
  return !1;
3985
3985
  },
@@ -4089,16 +4089,16 @@ function Ve() {
4089
4089
  var m = document.body, _ = m.style, b = document.documentElement.style, F = this, A, R;
4090
4090
  if (u === this.isFullPage())
4091
4091
  return this;
4092
- var N = {
4092
+ var k = {
4093
4093
  fullPage: u,
4094
4094
  preventDefaultAction: !1
4095
4095
  };
4096
- if (this.raiseEvent("pre-full-page", N), N.preventDefaultAction)
4096
+ if (this.raiseEvent("pre-full-page", k), k.preventDefaultAction)
4097
4097
  return this;
4098
4098
  if (u && this.element) {
4099
4099
  for (this.elementSize = e.getElementSize(this.element), this.pageScroll = e.getPageScroll(), this.elementMargin = this.element.style.margin, this.element.style.margin = "0", this.elementPadding = this.element.style.padding, this.element.style.padding = "0", this.bodyMargin = _.margin, this.docMargin = b.margin, _.margin = "0", b.margin = "0", this.bodyPadding = _.padding, this.docPadding = b.padding, _.padding = "0", b.padding = "0", this.bodyWidth = _.width, this.docWidth = b.width, _.width = "100%", b.width = "100%", this.bodyHeight = _.height, this.docHeight = b.height, _.height = "100%", b.height = "100%", this.bodyDisplay = _.display, _.display = "block", this.previousBody = [], t[this.hash].prevElementParent = this.element.parentNode, t[this.hash].prevNextSibling = this.element.nextSibling, t[this.hash].prevElementWidth = this.element.style.width, t[this.hash].prevElementHeight = this.element.style.height, A = m.childNodes.length, R = 0; R < A; R++)
4100
4100
  this.previousBody.push(m.childNodes[0]), m.removeChild(m.childNodes[0]);
4101
- this.toolbar && this.toolbar.element && (this.toolbar.parentNode = this.toolbar.element.parentNode, this.toolbar.nextSibling = this.toolbar.element.nextSibling, m.appendChild(this.toolbar.element), e.addClass(this.toolbar.element, "fullpage")), e.addClass(this.element, "fullpage"), m.appendChild(this.element), this.element.style.height = "100vh", this.element.style.width = "100vw", this.toolbar && this.toolbar.element && (this.element.style.height = e.getElementSize(this.element).y - e.getElementSize(this.toolbar.element).y + "px"), t[this.hash].fullPage = !0, e.delegate(this, ne)({});
4101
+ this.toolbar && this.toolbar.element && (this.toolbar.parentNode = this.toolbar.element.parentNode, this.toolbar.nextSibling = this.toolbar.element.nextSibling, m.appendChild(this.toolbar.element), e.addClass(this.toolbar.element, "fullpage")), e.addClass(this.element, "fullpage"), m.appendChild(this.element), this.element.style.height = "100vh", this.element.style.width = "100vw", this.toolbar && this.toolbar.element && (this.element.style.height = e.getElementSize(this.element).y - e.getElementSize(this.toolbar.element).y + "px"), t[this.hash].fullPage = !0, e.delegate(this, ee)({});
4102
4102
  } else {
4103
4103
  for (this.element.style.margin = this.elementMargin, this.element.style.padding = this.elementPadding, _.margin = this.bodyMargin, b.margin = this.docMargin, _.padding = this.bodyPadding, b.padding = this.docPadding, _.width = this.bodyWidth, b.width = this.docWidth, _.height = this.bodyHeight, b.height = this.docHeight, _.display = this.bodyDisplay, m.removeChild(this.element), A = this.previousBody.length, R = 0; R < A; R++)
4104
4104
  m.appendChild(this.previousBody.shift());
@@ -4109,12 +4109,12 @@ function Ve() {
4109
4109
  this.toolbar.element,
4110
4110
  this.toolbar.nextSibling
4111
4111
  ), delete this.toolbar.parentNode, delete this.toolbar.nextSibling), this.element.style.width = t[this.hash].prevElementWidth, this.element.style.height = t[this.hash].prevElementHeight;
4112
- var Y = 0, Q = function() {
4112
+ var K = 0, J = function() {
4113
4113
  e.setPageScroll(F.pageScroll);
4114
- var U = e.getPageScroll();
4115
- Y++, Y < 10 && (U.x !== F.pageScroll.x || U.y !== F.pageScroll.y) && e.requestAnimationFrame(Q);
4114
+ var N = e.getPageScroll();
4115
+ K++, K < 10 && (N.x !== F.pageScroll.x || N.y !== F.pageScroll.y) && e.requestAnimationFrame(J);
4116
4116
  };
4117
- e.requestAnimationFrame(Q), t[this.hash].fullPage = !1, e.delegate(this, te)({});
4117
+ e.requestAnimationFrame(J), t[this.hash].fullPage = !1, e.delegate(this, ne)({});
4118
4118
  }
4119
4119
  return this.navigator && this.viewport && this.navigator.update(this.viewport), this.raiseEvent("full-page", { fullPage: u }), this;
4120
4120
  },
@@ -4253,9 +4253,9 @@ function Ve() {
4253
4253
  options: u
4254
4254
  };
4255
4255
  function b(R) {
4256
- for (var N = 0; N < m._loadQueue.length; N++)
4257
- if (m._loadQueue[N] === _) {
4258
- m._loadQueue.splice(N, 1);
4256
+ for (var k = 0; k < m._loadQueue.length; k++)
4257
+ if (m._loadQueue[k] === _) {
4258
+ m._loadQueue.splice(k, 1);
4259
4259
  break;
4260
4260
  }
4261
4261
  m._loadQueue.length === 0 && F(_), m.raiseEvent("add-item-failed", R), u.error && u.error(R);
@@ -4282,12 +4282,12 @@ function Ve() {
4282
4282
  }
4283
4283
  this._loadQueue.push(_);
4284
4284
  function A() {
4285
- for (var R, N, Y; m._loadQueue.length && (R = m._loadQueue[0], !!R.tileSource); ) {
4285
+ for (var R, k, K; m._loadQueue.length && (R = m._loadQueue[0], !!R.tileSource); ) {
4286
4286
  if (m._loadQueue.splice(0, 1), R.options.replace) {
4287
- var Q = m.world.getIndexOfItem(R.options.replaceItem);
4288
- Q !== -1 && (R.options.index = Q), m.world.removeItem(R.options.replaceItem);
4287
+ var J = m.world.getIndexOfItem(R.options.replaceItem);
4288
+ J !== -1 && (R.options.index = J), m.world.removeItem(R.options.replaceItem);
4289
4289
  }
4290
- N = new e.TiledImage({
4290
+ k = new e.TiledImage({
4291
4291
  viewer: m,
4292
4292
  source: R.tileSource,
4293
4293
  viewport: m.viewport,
@@ -4325,15 +4325,15 @@ function Ve() {
4325
4325
  ajaxHeaders: R.options.ajaxHeaders,
4326
4326
  debugMode: m.debugMode,
4327
4327
  subPixelRoundingForTransparency: m.subPixelRoundingForTransparency
4328
- }), m.collectionMode && m.world.setAutoRefigureSizes(!1), m.navigator && (Y = e.extend({}, R.options, {
4328
+ }), m.collectionMode && m.world.setAutoRefigureSizes(!1), m.navigator && (K = e.extend({}, R.options, {
4329
4329
  replace: !1,
4330
4330
  // navigator already removed the layer, nothing to replace
4331
- originalTiledImage: N,
4331
+ originalTiledImage: k,
4332
4332
  tileSource: R.tileSource
4333
- }), m.navigator.addTiledImage(Y)), m.world.addItem(N, {
4333
+ }), m.navigator.addTiledImage(K)), m.world.addItem(k, {
4334
4334
  index: R.options.index
4335
4335
  }), m._loadQueue.length === 0 && F(R), m.world.getItemCount() === 1 && !m.preserveViewport && m.viewport.goHome(!0), R.options.success && R.options.success({
4336
- item: N
4336
+ item: k
4337
4337
  });
4338
4338
  }
4339
4339
  }
@@ -4464,7 +4464,7 @@ function Ve() {
4464
4464
  * @returns {OpenSeadragon.Viewer} Chainable.
4465
4465
  */
4466
4466
  bindStandardControls: function() {
4467
- var u = e.delegate(this, pe), m = e.delegate(this, ge), _ = e.delegate(this, _e), b = e.delegate(this, fe), F = e.delegate(this, ve), A = e.delegate(this, Ee), R = e.delegate(this, we), N = e.delegate(this, Se), Y = e.delegate(this, de), Q = e.delegate(this, ue), U = e.delegate(this, v), ee = e.delegate(this, w), p = this.navImages, c = [], g = !0;
4467
+ var u = e.delegate(this, fe), m = e.delegate(this, me), _ = e.delegate(this, _e), b = e.delegate(this, ge), F = e.delegate(this, ye), A = e.delegate(this, Ee), R = e.delegate(this, Te), k = e.delegate(this, Se), K = e.delegate(this, pe), J = e.delegate(this, ce), N = e.delegate(this, v), te = e.delegate(this, w), p = this.navImages, c = [], g = !0;
4468
4468
  return this.showNavigationControl && ((this.zoomInButton || this.zoomOutButton || this.homeButton || this.fullPageButton || this.rotateLeftButton || this.rotateRightButton || this.flipButton) && (g = !1), this.showZoomControl && (c.push(this.zoomInButton = new e.Button({
4469
4469
  element: this.zoomInButton ? e.getElement(this.zoomInButton) : null,
4470
4470
  clickTimeThreshold: this.clickTimeThreshold,
@@ -4479,8 +4479,8 @@ function Ve() {
4479
4479
  onClick: _,
4480
4480
  onEnter: u,
4481
4481
  onExit: m,
4482
- onFocus: U,
4483
- onBlur: ee
4482
+ onFocus: N,
4483
+ onBlur: te
4484
4484
  })), c.push(this.zoomOutButton = new e.Button({
4485
4485
  element: this.zoomOutButton ? e.getElement(this.zoomOutButton) : null,
4486
4486
  clickTimeThreshold: this.clickTimeThreshold,
@@ -4495,8 +4495,8 @@ function Ve() {
4495
4495
  onClick: F,
4496
4496
  onEnter: b,
4497
4497
  onExit: m,
4498
- onFocus: U,
4499
- onBlur: ee
4498
+ onFocus: N,
4499
+ onBlur: te
4500
4500
  }))), this.showHomeControl && c.push(this.homeButton = new e.Button({
4501
4501
  element: this.homeButton ? e.getElement(this.homeButton) : null,
4502
4502
  clickTimeThreshold: this.clickTimeThreshold,
@@ -4507,8 +4507,8 @@ function Ve() {
4507
4507
  srcHover: G(this.prefixUrl, p.home.HOVER),
4508
4508
  srcDown: G(this.prefixUrl, p.home.DOWN),
4509
4509
  onRelease: A,
4510
- onFocus: U,
4511
- onBlur: ee
4510
+ onFocus: N,
4511
+ onBlur: te
4512
4512
  })), this.showFullPageControl && c.push(this.fullPageButton = new e.Button({
4513
4513
  element: this.fullPageButton ? e.getElement(this.fullPageButton) : null,
4514
4514
  clickTimeThreshold: this.clickTimeThreshold,
@@ -4519,8 +4519,8 @@ function Ve() {
4519
4519
  srcHover: G(this.prefixUrl, p.fullpage.HOVER),
4520
4520
  srcDown: G(this.prefixUrl, p.fullpage.DOWN),
4521
4521
  onRelease: R,
4522
- onFocus: U,
4523
- onBlur: ee
4522
+ onFocus: N,
4523
+ onBlur: te
4524
4524
  })), this.showRotationControl && (c.push(this.rotateLeftButton = new e.Button({
4525
4525
  element: this.rotateLeftButton ? e.getElement(this.rotateLeftButton) : null,
4526
4526
  clickTimeThreshold: this.clickTimeThreshold,
@@ -4530,9 +4530,9 @@ function Ve() {
4530
4530
  srcGroup: G(this.prefixUrl, p.rotateleft.GROUP),
4531
4531
  srcHover: G(this.prefixUrl, p.rotateleft.HOVER),
4532
4532
  srcDown: G(this.prefixUrl, p.rotateleft.DOWN),
4533
- onRelease: N,
4534
- onFocus: U,
4535
- onBlur: ee
4533
+ onRelease: k,
4534
+ onFocus: N,
4535
+ onBlur: te
4536
4536
  })), c.push(this.rotateRightButton = new e.Button({
4537
4537
  element: this.rotateRightButton ? e.getElement(this.rotateRightButton) : null,
4538
4538
  clickTimeThreshold: this.clickTimeThreshold,
@@ -4542,9 +4542,9 @@ function Ve() {
4542
4542
  srcGroup: G(this.prefixUrl, p.rotateright.GROUP),
4543
4543
  srcHover: G(this.prefixUrl, p.rotateright.HOVER),
4544
4544
  srcDown: G(this.prefixUrl, p.rotateright.DOWN),
4545
- onRelease: Y,
4546
- onFocus: U,
4547
- onBlur: ee
4545
+ onRelease: K,
4546
+ onFocus: N,
4547
+ onBlur: te
4548
4548
  }))), this.showFlipControl && c.push(this.flipButton = new e.Button({
4549
4549
  element: this.flipButton ? e.getElement(this.flipButton) : null,
4550
4550
  clickTimeThreshold: this.clickTimeThreshold,
@@ -4554,14 +4554,14 @@ function Ve() {
4554
4554
  srcGroup: G(this.prefixUrl, p.flip.GROUP),
4555
4555
  srcHover: G(this.prefixUrl, p.flip.HOVER),
4556
4556
  srcDown: G(this.prefixUrl, p.flip.DOWN),
4557
- onRelease: Q,
4558
- onFocus: U,
4559
- onBlur: ee
4557
+ onRelease: J,
4558
+ onFocus: N,
4559
+ onBlur: te
4560
4560
  })), g ? (this.buttonGroup = new e.ButtonGroup({
4561
4561
  buttons: c,
4562
4562
  clickTimeThreshold: this.clickTimeThreshold,
4563
4563
  clickDistThreshold: this.clickDistThreshold
4564
- }), this.navControl = this.buttonGroup.element, this.addHandler("open", e.delegate(this, ye)), this.toolbar ? this.toolbar.addControl(
4564
+ }), this.navControl = this.buttonGroup.element, this.addHandler("open", e.delegate(this, we)), this.toolbar ? this.toolbar.addControl(
4565
4565
  this.navControl,
4566
4566
  { anchor: this.navigationControlAnchor || e.ControlAnchor.TOP_LEFT }
4567
4567
  ) : this.addControl(
@@ -4841,13 +4841,13 @@ function Ve() {
4841
4841
  } catch {
4842
4842
  }
4843
4843
  }
4844
- function N(Y, Q) {
4845
- Y.ready ? b(Y) : (Y.addHandler("ready", function() {
4846
- b(Y);
4847
- }), Y.addHandler("open-failed", function(U) {
4844
+ function k(K, J) {
4845
+ K.ready ? b(K) : (K.addHandler("ready", function() {
4846
+ b(K);
4847
+ }), K.addHandler("open-failed", function(N) {
4848
4848
  F({
4849
- message: U.message,
4850
- source: Q
4849
+ message: N.message,
4850
+ source: J
4851
4851
  });
4852
4852
  }));
4853
4853
  }
@@ -4859,30 +4859,30 @@ function Ve() {
4859
4859
  ajaxWithCredentials: u.ajaxWithCredentials,
4860
4860
  ajaxHeaders: _.ajaxHeaders ? _.ajaxHeaders : u.ajaxHeaders,
4861
4861
  splitHashDataForPost: u.splitHashDataForPost,
4862
- success: function(ee) {
4863
- b(ee.tileSource);
4862
+ success: function(te) {
4863
+ b(te.tileSource);
4864
4864
  }
4865
- }), m.addHandler("open-failed", function(ee) {
4866
- F(ee);
4865
+ }), m.addHandler("open-failed", function(te) {
4866
+ F(te);
4867
4867
  });
4868
4868
  else if (e.isPlainObject(m) || m.nodeType)
4869
4869
  if (m.crossOriginPolicy === void 0 && (_.crossOriginPolicy !== void 0 || u.crossOriginPolicy !== void 0) && (m.crossOriginPolicy = _.crossOriginPolicy !== void 0 ? _.crossOriginPolicy : u.crossOriginPolicy), m.ajaxWithCredentials === void 0 && (m.ajaxWithCredentials = u.ajaxWithCredentials), e.isFunction(m.getTileUrl)) {
4870
- var Y = new e.TileSource(m);
4871
- Y.getTileUrl = m.getTileUrl, b(Y);
4870
+ var K = new e.TileSource(m);
4871
+ K.getTileUrl = m.getTileUrl, b(K);
4872
4872
  } else {
4873
- var Q = e.TileSource.determineType(A, m);
4874
- if (!Q) {
4873
+ var J = e.TileSource.determineType(A, m);
4874
+ if (!J) {
4875
4875
  F({
4876
4876
  message: "Unable to load TileSource",
4877
4877
  source: m
4878
4878
  });
4879
4879
  return;
4880
4880
  }
4881
- var U = Q.prototype.configure.apply(A, [m]);
4882
- N(new Q(U), m);
4881
+ var N = J.prototype.configure.apply(A, [m]);
4882
+ k(new J(N), m);
4883
4883
  }
4884
4884
  else
4885
- N(m, m);
4885
+ k(m, m);
4886
4886
  });
4887
4887
  }
4888
4888
  function a(u, m) {
@@ -4900,23 +4900,23 @@ function Ve() {
4900
4900
  }
4901
4901
  var F = m.location, A = m.width, R = m.height;
4902
4902
  if (!F) {
4903
- var N = m.x, Y = m.y;
4903
+ var k = m.x, K = m.y;
4904
4904
  if (m.px !== void 0) {
4905
- var Q = u.viewport.imageToViewportRectangle(new e.Rect(
4905
+ var J = u.viewport.imageToViewportRectangle(new e.Rect(
4906
4906
  m.px,
4907
4907
  m.py,
4908
4908
  A || 0,
4909
4909
  R || 0
4910
4910
  ));
4911
- N = Q.x, Y = Q.y, A = A !== void 0 ? Q.width : void 0, R = R !== void 0 ? Q.height : void 0;
4911
+ k = J.x, K = J.y, A = A !== void 0 ? J.width : void 0, R = R !== void 0 ? J.height : void 0;
4912
4912
  }
4913
- F = new e.Point(N, Y);
4913
+ F = new e.Point(k, K);
4914
4914
  }
4915
- var U = m.placement;
4916
- return U && e.type(U) === "string" && (U = e.Placement[m.placement.toUpperCase()]), new e.Overlay({
4915
+ var N = m.placement;
4916
+ return N && e.type(N) === "string" && (N = e.Placement[m.placement.toUpperCase()]), new e.Overlay({
4917
4917
  element: _,
4918
4918
  location: F,
4919
- placement: U,
4919
+ placement: N,
4920
4920
  onDraw: m.onDraw,
4921
4921
  checkResize: m.checkResize,
4922
4922
  width: A,
@@ -5071,7 +5071,7 @@ function Ve() {
5071
5071
  m.zoomToRefPoint ? this.viewport.pointFromPixel(u.position, !0) : null
5072
5072
  ), this.viewport.applyConstraints()));
5073
5073
  }
5074
- function O(u) {
5074
+ function B(u) {
5075
5075
  var m, _ = {
5076
5076
  tracker: u.eventSource,
5077
5077
  pointerType: u.pointerType,
@@ -5138,7 +5138,7 @@ function Ve() {
5138
5138
  originalEvent: u.originalEvent
5139
5139
  });
5140
5140
  }
5141
- function j(u) {
5141
+ function Z(u) {
5142
5142
  this.raiseEvent("canvas-exit", {
5143
5143
  tracker: u.eventSource,
5144
5144
  pointerType: u.pointerType,
@@ -5150,7 +5150,7 @@ function Ve() {
5150
5150
  originalEvent: u.originalEvent
5151
5151
  });
5152
5152
  }
5153
- function q(u) {
5153
+ function X(u) {
5154
5154
  var m;
5155
5155
  if (this.raiseEvent("canvas-press", {
5156
5156
  tracker: u.eventSource,
@@ -5176,7 +5176,7 @@ function Ve() {
5176
5176
  originalEvent: u.originalEvent
5177
5177
  });
5178
5178
  }
5179
- function X(u) {
5179
+ function Y(u) {
5180
5180
  this.raiseEvent("canvas-nonprimary-press", {
5181
5181
  tracker: u.eventSource,
5182
5182
  position: u.position,
@@ -5186,7 +5186,7 @@ function Ve() {
5186
5186
  originalEvent: u.originalEvent
5187
5187
  });
5188
5188
  }
5189
- function B(u) {
5189
+ function U(u) {
5190
5190
  this.raiseEvent("canvas-nonprimary-release", {
5191
5191
  tracker: u.eventSource,
5192
5192
  position: u.position,
@@ -5196,7 +5196,7 @@ function Ve() {
5196
5196
  originalEvent: u.originalEvent
5197
5197
  });
5198
5198
  }
5199
- function L(u) {
5199
+ function O(u) {
5200
5200
  var m, _, b, F, A = {
5201
5201
  tracker: u.eventSource,
5202
5202
  pointerType: u.pointerType,
@@ -5215,26 +5215,26 @@ function Ve() {
5215
5215
  var R = Math.atan2(
5216
5216
  u.gesturePoints[0].currentPos.y - u.gesturePoints[1].currentPos.y,
5217
5217
  u.gesturePoints[0].currentPos.x - u.gesturePoints[1].currentPos.x
5218
- ), N = Math.atan2(
5218
+ ), k = Math.atan2(
5219
5219
  u.gesturePoints[0].lastPos.y - u.gesturePoints[1].lastPos.y,
5220
5220
  u.gesturePoints[0].lastPos.x - u.gesturePoints[1].lastPos.x
5221
5221
  );
5222
- _ = this.viewport.pointFromPixel(u.center, !0), this.viewport.rotateTo(this.viewport.getRotation(!0) + (R - N) * (180 / Math.PI), _, !0);
5222
+ _ = this.viewport.pointFromPixel(u.center, !0), this.viewport.rotateTo(this.viewport.getRotation(!0) + (R - k) * (180 / Math.PI), _, !0);
5223
5223
  }
5224
5224
  }
5225
- function k(u) {
5225
+ function j(u) {
5226
5226
  this.raiseEvent("canvas-focus", {
5227
5227
  tracker: u.eventSource,
5228
5228
  originalEvent: u.originalEvent
5229
5229
  });
5230
5230
  }
5231
- function Z(u) {
5231
+ function L(u) {
5232
5232
  this.raiseEvent("canvas-blur", {
5233
5233
  tracker: u.eventSource,
5234
5234
  originalEvent: u.originalEvent
5235
5235
  });
5236
5236
  }
5237
- function J(u) {
5237
+ function q(u) {
5238
5238
  var m, _, b, F, A;
5239
5239
  F = e.now(), A = F - this._lastScrollTime, A > this.minScrollDeltaTime ? (this._lastScrollTime = F, m = {
5240
5240
  tracker: u.eventSource,
@@ -5249,7 +5249,7 @@ function Ve() {
5249
5249
  _.zoomToRefPoint ? this.viewport.pointFromPixel(u.position, !0) : null
5250
5250
  ), this.viewport.applyConstraints())), u.preventDefault = m.preventDefault) : u.preventDefault = !0;
5251
5251
  }
5252
- function ne(u) {
5252
+ function ee(u) {
5253
5253
  t[this.hash].mouseInside = !0, f(this), this.raiseEvent("container-enter", {
5254
5254
  tracker: u.eventSource,
5255
5255
  pointerType: u.pointerType,
@@ -5261,7 +5261,7 @@ function Ve() {
5261
5261
  originalEvent: u.originalEvent
5262
5262
  });
5263
5263
  }
5264
- function te(u) {
5264
+ function ne(u) {
5265
5265
  u.pointers < 1 && (t[this.hash].mouseInside = !1, t[this.hash].animating || h(this)), this.raiseEvent("container-exit", {
5266
5266
  tracker: u.eventSource,
5267
5267
  pointerType: u.pointerType,
@@ -5276,15 +5276,15 @@ function Ve() {
5276
5276
  function se(u) {
5277
5277
  le(u), u.isOpen() ? u._updateRequestId = o(u, se) : u._updateRequestId = !1;
5278
5278
  }
5279
- function ae(u, m) {
5279
+ function oe(u, m) {
5280
5280
  var _ = u.viewport, b = _.getZoom(), F = _.getCenter();
5281
5281
  _.resize(m, u.preserveImageSizeOnResize), _.panTo(F, !0);
5282
5282
  var A;
5283
5283
  if (u.preserveImageSizeOnResize)
5284
5284
  A = t[u.hash].prevContainerSize.x / m.x;
5285
5285
  else {
5286
- var R = new e.Point(0, 0), N = new e.Point(t[u.hash].prevContainerSize.x, t[u.hash].prevContainerSize.y).distanceTo(R), Y = new e.Point(m.x, m.y).distanceTo(R);
5287
- A = Y / N * t[u.hash].prevContainerSize.x / m.x;
5286
+ var R = new e.Point(0, 0), k = new e.Point(t[u.hash].prevContainerSize.x, t[u.hash].prevContainerSize.y).distanceTo(R), K = new e.Point(m.x, m.y).distanceTo(R);
5287
+ A = K / k * t[u.hash].prevContainerSize.x / m.x;
5288
5288
  }
5289
5289
  _.zoomTo(b * A, null, !0), t[u.hash].prevContainerSize = m, t[u.hash].forceRedraw = !0, t[u.hash].needsResize = !1, t[u.hash].forceResize = !1;
5290
5290
  }
@@ -5297,55 +5297,55 @@ function Ve() {
5297
5297
  var _ = t[u.hash].prevContainerSize;
5298
5298
  m.equals(_) || (t[u.hash].needsResize = !0);
5299
5299
  }
5300
- t[u.hash].needsResize && ae(u, m || i(u.container));
5300
+ t[u.hash].needsResize && oe(u, m || i(u.container));
5301
5301
  }
5302
5302
  var b = u.viewport.update(), F = u.world.update(b) || b;
5303
5303
  b && u.raiseEvent("viewport-change"), u.referenceStrip && (F = u.referenceStrip.update(u.viewport) || F);
5304
5304
  var A = t[u.hash].animating;
5305
5305
  !A && F && (u.raiseEvent("animation-start"), f(u));
5306
5306
  var R = A && !F;
5307
- R && (t[u.hash].animating = !1), (F || R || t[u.hash].forceRedraw || u.world.needsDraw()) && (xe(u), u._drawOverlays(), u.navigator && u.navigator.update(u.viewport), t[u.hash].forceRedraw = !1, F && u.raiseEvent("animation")), R && (u.raiseEvent("animation-finish"), t[u.hash].mouseInside || h(u)), t[u.hash].animating = F;
5307
+ R && (t[u.hash].animating = !1), (F || R || t[u.hash].forceRedraw || u.world.needsDraw()) && (he(u), u._drawOverlays(), u.navigator && u.navigator.update(u.viewport), t[u.hash].forceRedraw = !1, F && u.raiseEvent("animation")), R && (u.raiseEvent("animation-finish"), t[u.hash].mouseInside || h(u)), t[u.hash].animating = F;
5308
5308
  }
5309
5309
  }
5310
- function xe(u) {
5310
+ function he(u) {
5311
5311
  u.imageLoader.clear(), u.world.draw(), u.raiseEvent("update-viewport", {});
5312
5312
  }
5313
5313
  function G(u, m) {
5314
5314
  return u ? u + m : m;
5315
5315
  }
5316
- function pe() {
5317
- t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = this.zoomPerSecond, t[this.hash].zooming = !0, he(this);
5318
- }
5319
5316
  function fe() {
5320
- t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = 1 / this.zoomPerSecond, t[this.hash].zooming = !0, he(this);
5317
+ t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = this.zoomPerSecond, t[this.hash].zooming = !0, ue(this);
5321
5318
  }
5322
5319
  function ge() {
5320
+ t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = 1 / this.zoomPerSecond, t[this.hash].zooming = !0, ue(this);
5321
+ }
5322
+ function me() {
5323
5323
  t[this.hash].zooming = !1;
5324
5324
  }
5325
- function he(u) {
5326
- e.requestAnimationFrame(e.delegate(u, me));
5325
+ function ue(u) {
5326
+ e.requestAnimationFrame(e.delegate(u, ve));
5327
5327
  }
5328
- function me() {
5328
+ function ve() {
5329
5329
  var u, m, _;
5330
- t[this.hash].zooming && this.viewport && (u = e.now(), m = u - t[this.hash].lastZoomTime, _ = Math.pow(t[this.hash].zoomFactor, m / 1e3), this.viewport.zoomBy(_), this.viewport.applyConstraints(), t[this.hash].lastZoomTime = u, he(this));
5330
+ t[this.hash].zooming && this.viewport && (u = e.now(), m = u - t[this.hash].lastZoomTime, _ = Math.pow(t[this.hash].zoomFactor, m / 1e3), this.viewport.zoomBy(_), this.viewport.applyConstraints(), t[this.hash].lastZoomTime = u, ue(this));
5331
5331
  }
5332
5332
  function _e() {
5333
5333
  this.viewport && (t[this.hash].zooming = !1, this.viewport.zoomBy(
5334
5334
  this.zoomPerClick / 1
5335
5335
  ), this.viewport.applyConstraints());
5336
5336
  }
5337
- function ve() {
5337
+ function ye() {
5338
5338
  this.viewport && (t[this.hash].zooming = !1, this.viewport.zoomBy(
5339
5339
  1 / this.zoomPerClick
5340
5340
  ), this.viewport.applyConstraints());
5341
5341
  }
5342
- function ye() {
5342
+ function we() {
5343
5343
  this.buttonGroup && (this.buttonGroup.emulateEnter(), this.buttonGroup.emulateLeave());
5344
5344
  }
5345
5345
  function Ee() {
5346
5346
  this.viewport && this.viewport.goHome();
5347
5347
  }
5348
- function we() {
5348
+ function Te() {
5349
5349
  this.isFullPage() && !e.isFullScreen() ? this.setFullPage(!1) : this.setFullScreen(!this.isFullPage()), this.buttonGroup && this.buttonGroup.emulateLeave(), this.fullPageButton.element.focus(), this.viewport && this.viewport.applyConstraints();
5350
5350
  }
5351
5351
  function Se() {
@@ -5354,13 +5354,13 @@ function Ve() {
5354
5354
  this.viewport.flipped ? u += this.rotationIncrement : u -= this.rotationIncrement, this.viewport.setRotation(u);
5355
5355
  }
5356
5356
  }
5357
- function de() {
5357
+ function pe() {
5358
5358
  if (this.viewport) {
5359
5359
  var u = this.viewport.getRotation();
5360
5360
  this.viewport.flipped ? u -= this.rotationIncrement : u += this.rotationIncrement, this.viewport.setRotation(u);
5361
5361
  }
5362
5362
  }
5363
- function ue() {
5363
+ function ce() {
5364
5364
  this.viewport.toggleFlip();
5365
5365
  }
5366
5366
  e.determineDrawer = function(u) {
@@ -6669,8 +6669,8 @@ function Ve() {
6669
6669
  var l = null;
6670
6670
  return this.levels.length > 0 && a >= this.minLevel && a <= this.maxLevel && (l = this.levels[a].url), l;
6671
6671
  }
6672
- var h = "0", d = Math.pow(0.5, this.maxLevel - a), f, v, w, T, x, E, P, I, O, z, V, j, q, $, X, B;
6673
- return this.levelSizes ? (f = this.levelSizes[a].width, v = this.levelSizes[a].height) : (f = Math.ceil(this.width * d), v = Math.ceil(this.height * d)), w = this.getTileWidth(a), T = this.getTileHeight(a), x = Math.round(w / d), E = Math.round(T / d), this.version === 1 ? X = "native." + this.tileFormat : X = "default." + this.tileFormat, f < w && v < T ? (this.version === 2 && f === this.width ? j = "full" : this.version === 3 && f === this.width && v === this.height ? j = "max" : this.version === 3 ? j = f + "," + v : j = f + ",", P = "full") : (I = s * x, O = o * E, z = Math.min(x, this.width - I), V = Math.min(E, this.height - O), s === 0 && o === 0 && z === this.width && V === this.height ? P = "full" : P = [I, O, z, V].join(","), q = Math.min(w, f - s * w), $ = Math.min(T, v - o * T), this.version === 2 && q === this.width ? j = "full" : this.version === 3 && q === this.width && $ === this.height ? j = "max" : this.version === 3 ? j = q + "," + $ : j = q + ","), B = [this._id, P, j, h, X].join("/"), B;
6672
+ var h = "0", d = Math.pow(0.5, this.maxLevel - a), f, v, w, T, x, E, P, I, B, z, V, Z, X, $, Y, U;
6673
+ return this.levelSizes ? (f = this.levelSizes[a].width, v = this.levelSizes[a].height) : (f = Math.ceil(this.width * d), v = Math.ceil(this.height * d)), w = this.getTileWidth(a), T = this.getTileHeight(a), x = Math.round(w / d), E = Math.round(T / d), this.version === 1 ? Y = "native." + this.tileFormat : Y = "default." + this.tileFormat, f < w && v < T ? (this.version === 2 && f === this.width ? Z = "full" : this.version === 3 && f === this.width && v === this.height ? Z = "max" : this.version === 3 ? Z = f + "," + v : Z = f + ",", P = "full") : (I = s * x, B = o * E, z = Math.min(x, this.width - I), V = Math.min(E, this.height - B), s === 0 && o === 0 && z === this.width && V === this.height ? P = "full" : P = [I, B, z, V].join(","), X = Math.min(w, f - s * w), $ = Math.min(T, v - o * T), this.version === 2 && X === this.width ? Z = "full" : this.version === 3 && X === this.width && $ === this.height ? Z = "max" : this.version === 3 ? Z = X + "," + $ : Z = X + ","), U = [this._id, P, Z, h, Y].join("/"), U;
6674
6674
  },
6675
6675
  __testonly__: {
6676
6676
  canBeTiled: t,
@@ -7531,7 +7531,7 @@ function Ve() {
7531
7531
  this.containsPoint(f, n) && i.push(f);
7532
7532
  for (var v = this._getSegments(), w = t._getSegments(), T = 0; T < v.length; T++)
7533
7533
  for (var x = v[T], E = 0; E < w.length; E++) {
7534
- var P = w[E], I = O(
7534
+ var P = w[E], I = B(
7535
7535
  x[0],
7536
7536
  x[1],
7537
7537
  P[0],
@@ -7539,20 +7539,20 @@ function Ve() {
7539
7539
  );
7540
7540
  I && i.push(I);
7541
7541
  }
7542
- function O(B, L, k, Z) {
7543
- var J = L.minus(B), ne = Z.minus(k), te = -ne.x * J.y + J.x * ne.y;
7544
- if (te === 0)
7542
+ function B(U, O, j, L) {
7543
+ var q = O.minus(U), ee = L.minus(j), ne = -ee.x * q.y + q.x * ee.y;
7544
+ if (ne === 0)
7545
7545
  return null;
7546
- var se = (J.x * (B.y - k.y) - J.y * (B.x - k.x)) / te, ae = (ne.x * (B.y - k.y) - ne.y * (B.x - k.x)) / te;
7547
- return -1e-10 <= se && se <= 1 - n && -1e-10 <= ae && ae <= 1 - n ? new e.Point(B.x + ae * J.x, B.y + ae * J.y) : null;
7546
+ var se = (q.x * (U.y - j.y) - q.y * (U.x - j.x)) / ne, oe = (ee.x * (U.y - j.y) - ee.y * (U.x - j.x)) / ne;
7547
+ return -1e-10 <= se && se <= 1 - n && -1e-10 <= oe && oe <= 1 - n ? new e.Point(U.x + oe * q.x, U.y + oe * q.y) : null;
7548
7548
  }
7549
7549
  if (i.length === 0)
7550
7550
  return null;
7551
- for (var z = i[0].x, V = i[0].x, j = i[0].y, q = i[0].y, $ = 1; $ < i.length; $++) {
7552
- var X = i[$];
7553
- X.x < z && (z = X.x), X.x > V && (V = X.x), X.y < j && (j = X.y), X.y > q && (q = X.y);
7551
+ for (var z = i[0].x, V = i[0].x, Z = i[0].y, X = i[0].y, $ = 1; $ < i.length; $++) {
7552
+ var Y = i[$];
7553
+ Y.x < z && (z = Y.x), Y.x > V && (V = Y.x), Y.y < Z && (Z = Y.y), Y.y > X && (X = Y.y);
7554
7554
  }
7555
- return new e.Rect(z, j, V - z, q - j);
7555
+ return new e.Rect(z, Z, V - z, X - Z);
7556
7556
  },
7557
7557
  // private
7558
7558
  _getSegments: function() {
@@ -7720,13 +7720,13 @@ function Ve() {
7720
7720
  var w, T, x, E, P, I;
7721
7721
  for (d.scroll === "horizontal" ? w = d.panelWidth : w = d.panelHeight, T = Math.ceil(f / w) + 5, x = Math.ceil((Math.abs(v) + f) / w) + 1, T = x - T, T = T < 0 ? 0 : T, P = T; P < x && P < d.panels.length; P++)
7722
7722
  if (I = d.panels[P], !I.activePanel) {
7723
- var O, z = d.viewer.tileSources[P];
7724
- z.referenceStripThumbnailUrl ? O = {
7723
+ var B, z = d.viewer.tileSources[P];
7724
+ z.referenceStripThumbnailUrl ? B = {
7725
7725
  type: "image",
7726
7726
  url: z.referenceStripThumbnailUrl
7727
- } : O = z, E = new e.Viewer({
7727
+ } : B = z, E = new e.Viewer({
7728
7728
  id: I.id,
7729
- tileSources: [O],
7729
+ tileSources: [B],
7730
7730
  element: I,
7731
7731
  navigatorSizeRatio: d.sizeRatio,
7732
7732
  showNavigator: !1,
@@ -8720,7 +8720,7 @@ function Ve() {
8720
8720
  *
8721
8721
  */
8722
8722
  _drawTiles(l) {
8723
- var h = l.getTilesToDraw().map((B) => B.tile);
8723
+ var h = l.getTilesToDraw().map((U) => U.tile);
8724
8724
  if (!(l.opacity === 0 || h.length === 0 && !l.placeholderFillStyle)) {
8725
8725
  var d = h[0], f;
8726
8726
  d && (f = l.opacity < 1 || l.compositeOperation && l.compositeOperation !== "source-over" || !l._isBottomItem() && l.source.hasTransparency(d.context2D, d.getUrl(), d.ajaxHeaders, d.postData));
@@ -8739,46 +8739,46 @@ function Ve() {
8739
8739
  this._saveContext(f);
8740
8740
  var I = l.imageToViewportRectangle(l._clip, !0);
8741
8741
  I = I.rotate(-l.getRotation(!0), l._getRotationPoint(!0));
8742
- var O = this.viewportToDrawerRectangle(I);
8743
- v && (O = O.times(v)), w && (O = O.translate(w)), this._setClip(O, f), P = !0;
8742
+ var B = this.viewportToDrawerRectangle(I);
8743
+ v && (B = B.times(v)), w && (B = B.translate(w)), this._setClip(B, f), P = !0;
8744
8744
  }
8745
8745
  if (l._croppingPolygons) {
8746
8746
  var z = this;
8747
8747
  P || this._saveContext(f);
8748
8748
  try {
8749
- var V = l._croppingPolygons.map(function(B) {
8750
- return B.map(function(L) {
8751
- var k = l.imageToViewportCoordinates(L.x, L.y, !0).rotate(-l.getRotation(!0), l._getRotationPoint(!0)), Z = z.viewportCoordToDrawerCoord(k);
8752
- return v && (Z = Z.times(v)), w && (Z = Z.plus(w)), Z;
8749
+ var V = l._croppingPolygons.map(function(U) {
8750
+ return U.map(function(O) {
8751
+ var j = l.imageToViewportCoordinates(O.x, O.y, !0).rotate(-l.getRotation(!0), l._getRotationPoint(!0)), L = z.viewportCoordToDrawerCoord(j);
8752
+ return v && (L = L.times(v)), w && (L = L.plus(w)), L;
8753
8753
  });
8754
8754
  });
8755
8755
  this._clipWithPolygons(V, f);
8756
- } catch (B) {
8757
- e.console.error(B);
8756
+ } catch (U) {
8757
+ e.console.error(U);
8758
8758
  }
8759
8759
  P = !0;
8760
8760
  }
8761
8761
  if (l._hasOpaqueTile = !1, l.placeholderFillStyle && l._hasOpaqueTile === !1) {
8762
- let B = this.viewportToDrawerRectangle(l.getBoundsNoRotate(!0));
8763
- v && (B = B.times(v)), w && (B = B.translate(w));
8764
- let L = null;
8765
- typeof l.placeholderFillStyle == "function" ? L = l.placeholderFillStyle(l, this.context) : L = l.placeholderFillStyle, this._drawRectangle(B, L, f);
8762
+ let U = this.viewportToDrawerRectangle(l.getBoundsNoRotate(!0));
8763
+ v && (U = U.times(v)), w && (U = U.translate(w));
8764
+ let O = null;
8765
+ typeof l.placeholderFillStyle == "function" ? O = l.placeholderFillStyle(l, this.context) : O = l.placeholderFillStyle, this._drawRectangle(U, O, f);
8766
8766
  }
8767
- var j = s(l.subPixelRoundingForTransparency), q = !1;
8768
- if (j === e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)
8769
- q = !0;
8770
- else if (j === e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST) {
8767
+ var Z = s(l.subPixelRoundingForTransparency), X = !1;
8768
+ if (Z === e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)
8769
+ X = !0;
8770
+ else if (Z === e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST) {
8771
8771
  var $ = this.viewer && this.viewer.isAnimating();
8772
- q = !$;
8772
+ X = !$;
8773
8773
  }
8774
- for (var X = 0; X < h.length; X++)
8775
- d = h[X], this._drawTile(
8774
+ for (var Y = 0; Y < h.length; Y++)
8775
+ d = h[Y], this._drawTile(
8776
8776
  d,
8777
8777
  l,
8778
8778
  f,
8779
8779
  v,
8780
8780
  w,
8781
- q,
8781
+ X,
8782
8782
  l.source
8783
8783
  ), this.viewer && this.viewer.raiseEvent("tile-drawn", {
8784
8784
  tiledImage: l,
@@ -8881,13 +8881,13 @@ function Ve() {
8881
8881
  E.x,
8882
8882
  E.y
8883
8883
  )), this._raiseTileDrawingEvent(d, h, l, P);
8884
- var I, O;
8885
- l.sourceBounds ? (I = Math.min(l.sourceBounds.width, P.canvas.width), O = Math.min(l.sourceBounds.height, P.canvas.height)) : (I = P.canvas.width, O = P.canvas.height), h.translate(x.x + E.x / 2, 0), l.flipped && h.scale(-1, 1), h.drawImage(
8884
+ var I, B;
8885
+ l.sourceBounds ? (I = Math.min(l.sourceBounds.width, P.canvas.width), B = Math.min(l.sourceBounds.height, P.canvas.height)) : (I = P.canvas.width, B = P.canvas.height), h.translate(x.x + E.x / 2, 0), l.flipped && h.scale(-1, 1), h.drawImage(
8886
8886
  P.canvas,
8887
8887
  0,
8888
8888
  0,
8889
8889
  I,
8890
- O,
8890
+ B,
8891
8891
  -E.x / 2,
8892
8892
  x.y,
8893
8893
  E.x,
@@ -9248,27 +9248,27 @@ function Ve() {
9248
9248
  return;
9249
9249
  let E = x[0], P = w.compositeOperation || this.viewer.compositeOperation || w._clip || w._croppingPolygons || w.debugMode, I = P || w.opacity < 1 || E.hasTransparency;
9250
9250
  P && (v && this._outputContext.drawImage(this._renderingCanvas, 0, 0), r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), r.useProgram(this._firstPass.shaderProgram), I ? (r.bindFramebuffer(r.FRAMEBUFFER, this._glFrameBuffer), r.clear(r.COLOR_BUFFER_BIT)) : r.bindFramebuffer(r.FRAMEBUFFER, null);
9251
- let O = f, z = w.getRotation(!0);
9251
+ let B = f, z = w.getRotation(!0);
9252
9252
  if (z % 360 !== 0) {
9253
- let B = e.Mat3.makeRotation(-z * Math.PI / 180), L = w.getBoundsNoRotate(!0).getCenter(), k = e.Mat3.makeTranslation(L.x, L.y), Z = e.Mat3.makeTranslation(-L.x, -L.y), J = k.multiply(B).multiply(Z);
9254
- O = f.multiply(J);
9253
+ let U = e.Mat3.makeRotation(-z * Math.PI / 180), O = w.getBoundsNoRotate(!0).getCenter(), j = e.Mat3.makeTranslation(O.x, O.y), L = e.Mat3.makeTranslation(-O.x, -O.y), q = j.multiply(U).multiply(L);
9254
+ B = f.multiply(q);
9255
9255
  }
9256
9256
  let V = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);
9257
9257
  if (V <= 0)
9258
9258
  throw new Error(`WegGL error: bad value for gl parameter MAX_TEXTURE_IMAGE_UNITS (${V}). This could happen
9259
9259
  if too many contexts have been created and not released, or there is another problem with the graphics card.`);
9260
- let j = new Float32Array(V * 12), q = new Array(V), $ = new Array(V), X = new Array(V);
9261
- for (let B = 0; B < x.length; B++) {
9262
- let L = x[B].tile, k = B % V, Z = k + 1, J = L.getCanvasContext(), ne = J ? this._TextureMap.get(J.canvas) : null;
9263
- if (ne || (this._tileReadyHandler({ tile: L, tiledImage: w }), ne = J ? this._TextureMap.get(J.canvas) : null), ne && this._getTileData(L, w, ne, O, k, j, q, $, X), Z === V || B === x.length - 1) {
9264
- for (let te = 0; te <= Z; te++)
9265
- r.activeTexture(r.TEXTURE0 + te), r.bindTexture(r.TEXTURE_2D, q[te]);
9266
- r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.bufferData(r.ARRAY_BUFFER, j, r.DYNAMIC_DRAW), $.forEach((te, se) => {
9267
- r.uniformMatrix3fv(this._firstPass.uTransformMatrices[se], !1, te);
9268
- }), r.uniform1fv(this._firstPass.uOpacities, new Float32Array(X)), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferOutputPosition), r.vertexAttribPointer(this._firstPass.aOutputPosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.vertexAttribPointer(this._firstPass.aTexturePosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferIndex), r.vertexAttribPointer(this._firstPass.aIndex, 1, r.FLOAT, !1, 0, 0), r.drawArrays(r.TRIANGLES, 0, 6 * Z);
9260
+ let Z = new Float32Array(V * 12), X = new Array(V), $ = new Array(V), Y = new Array(V);
9261
+ for (let U = 0; U < x.length; U++) {
9262
+ let O = x[U].tile, j = U % V, L = j + 1, q = O.getCanvasContext(), ee = q ? this._TextureMap.get(q.canvas) : null;
9263
+ if (ee || (this._tileReadyHandler({ tile: O, tiledImage: w }), ee = q ? this._TextureMap.get(q.canvas) : null), ee && this._getTileData(O, w, ee, B, j, Z, X, $, Y), L === V || U === x.length - 1) {
9264
+ for (let ne = 0; ne <= L; ne++)
9265
+ r.activeTexture(r.TEXTURE0 + ne), r.bindTexture(r.TEXTURE_2D, X[ne]);
9266
+ r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.bufferData(r.ARRAY_BUFFER, Z, r.DYNAMIC_DRAW), $.forEach((ne, se) => {
9267
+ r.uniformMatrix3fv(this._firstPass.uTransformMatrices[se], !1, ne);
9268
+ }), r.uniform1fv(this._firstPass.uOpacities, new Float32Array(Y)), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferOutputPosition), r.vertexAttribPointer(this._firstPass.aOutputPosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.vertexAttribPointer(this._firstPass.aTexturePosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferIndex), r.vertexAttribPointer(this._firstPass.aIndex, 1, r.FLOAT, !1, 0, 0), r.drawArrays(r.TRIANGLES, 0, 6 * L);
9269
9269
  }
9270
9270
  }
9271
- I && (r.useProgram(this._secondPass.shaderProgram), r.bindFramebuffer(r.FRAMEBUFFER, null), r.activeTexture(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, this._renderToTexture), this._gl.uniform1f(this._secondPass.uOpacityMultiplier, w.opacity), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferTexturePosition), r.vertexAttribPointer(this._secondPass.aTexturePosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferOutputPosition), r.vertexAttribPointer(this._secondPass.aOutputPosition, 2, r.FLOAT, !1, 0, 0), r.drawArrays(r.TRIANGLES, 0, 6)), v = !0, P && (this._applyContext2dPipeline(w, x, T), v = !1, r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), T === 0 && this._raiseTiledImageDrawnEvent(w, x.map((B) => B.tile));
9271
+ I && (r.useProgram(this._secondPass.shaderProgram), r.bindFramebuffer(r.FRAMEBUFFER, null), r.activeTexture(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, this._renderToTexture), this._gl.uniform1f(this._secondPass.uOpacityMultiplier, w.opacity), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferTexturePosition), r.vertexAttribPointer(this._secondPass.aTexturePosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferOutputPosition), r.vertexAttribPointer(this._secondPass.aOutputPosition, 2, r.FLOAT, !1, 0, 0), r.drawArrays(r.TRIANGLES, 0, 6)), v = !0, P && (this._applyContext2dPipeline(w, x, T), v = !1, r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), T === 0 && this._raiseTiledImageDrawnEvent(w, x.map((U) => U.tile));
9272
9272
  }
9273
9273
  }), v && this._outputContext.drawImage(this._renderingCanvas, 0, 0);
9274
9274
  }
@@ -9314,22 +9314,22 @@ function Ve() {
9314
9314
  _getTileData(i, r, a, s, o, l, h, d, f) {
9315
9315
  let v = a.texture, w = a.position;
9316
9316
  l.set(w, o * 12);
9317
- let T = this._calculateOverlapFraction(i, r), x = i.positionedBounds.width * T.x, E = i.positionedBounds.height * T.y, P = i.positionedBounds.x + (i.x === 0 ? 0 : x), I = i.positionedBounds.y + (i.y === 0 ? 0 : E), O = i.positionedBounds.x + i.positionedBounds.width - (i.isRightMost ? 0 : x), z = i.positionedBounds.y + i.positionedBounds.height - (i.isBottomMost ? 0 : E), V = O - P, j = z - I, q = new e.Mat3([
9317
+ let T = this._calculateOverlapFraction(i, r), x = i.positionedBounds.width * T.x, E = i.positionedBounds.height * T.y, P = i.positionedBounds.x + (i.x === 0 ? 0 : x), I = i.positionedBounds.y + (i.y === 0 ? 0 : E), B = i.positionedBounds.x + i.positionedBounds.width - (i.isRightMost ? 0 : x), z = i.positionedBounds.y + i.positionedBounds.height - (i.isBottomMost ? 0 : E), V = B - P, Z = z - I, X = new e.Mat3([
9318
9318
  V,
9319
9319
  0,
9320
9320
  0,
9321
9321
  0,
9322
- j,
9322
+ Z,
9323
9323
  0,
9324
9324
  P,
9325
9325
  I,
9326
9326
  1
9327
9327
  ]);
9328
9328
  if (i.flipped) {
9329
- let X = e.Mat3.makeTranslation(0.5, 0), B = e.Mat3.makeTranslation(-0.5, 0), L = X.multiply(e.Mat3.makeScaling(-1, 1)).multiply(B);
9330
- q = q.multiply(L);
9329
+ let Y = e.Mat3.makeTranslation(0.5, 0), U = e.Mat3.makeTranslation(-0.5, 0), O = Y.multiply(e.Mat3.makeScaling(-1, 1)).multiply(U);
9330
+ X = X.multiply(O);
9331
9331
  }
9332
- let $ = s.multiply(q);
9332
+ let $ = s.multiply(X);
9333
9333
  f[o] = i.opacity, h[o] = v, d[o] = $.values;
9334
9334
  }
9335
9335
  // private
@@ -9507,8 +9507,8 @@ function Ve() {
9507
9507
  if (!this._TextureMap.get(o)) {
9508
9508
  let h = this._gl, d = h.createTexture(), f, v = a.source.tileOverlap, w, T;
9509
9509
  if (r.sourceBounds ? (w = Math.min(r.sourceBounds.width, o.width) / o.width, T = Math.min(r.sourceBounds.height, o.height) / o.height) : (w = 1, T = 1), v > 0) {
9510
- let E = this._calculateOverlapFraction(r, a), P = (r.x === 0 ? 0 : E.x) * w, I = (r.y === 0 ? 0 : E.y) * T, O = (r.isRightMost ? 1 : 1 - E.x) * w, z = (r.isBottomMost ? 1 : 1 - E.y) * T;
9511
- f = this._makeQuadVertexBuffer(P, O, I, z);
9510
+ let E = this._calculateOverlapFraction(r, a), P = (r.x === 0 ? 0 : E.x) * w, I = (r.y === 0 ? 0 : E.y) * T, B = (r.isRightMost ? 1 : 1 - E.x) * w, z = (r.isBottomMost ? 1 : 1 - E.y) * T;
9511
+ f = this._makeQuadVertexBuffer(P, B, I, z);
9512
9512
  } else w === 1 && T === 1 ? f = this._unitQuad : f = this._makeQuadVertexBuffer(0, w, 0, T);
9513
9513
  let x = {
9514
9514
  texture: d,
@@ -11648,28 +11648,28 @@ function Ve() {
11648
11648
  // returns boolean flag of whether the image should be marked as fully loaded
11649
11649
  _updateLevelsForViewport: function() {
11650
11650
  var t = this._getLevelsInterval(), n = t.lowestLevel, i = t.highestLevel, r = [], a = this.getDrawArea(), s = e.now();
11651
- if (this._lastDrawn.forEach((O) => {
11652
- O.tile.beingDrawn = !1;
11651
+ if (this._lastDrawn.forEach((B) => {
11652
+ B.tile.beingDrawn = !1;
11653
11653
  }), this._tilesToDraw = [], this._tilesLoading = 0, this.loadingCoverage = {}, !a)
11654
11654
  return this._needsDraw = !1, this._fullyLoaded;
11655
11655
  var o = new Array(i - n + 1);
11656
- for (let O = 0, z = i; z >= n; z--, O++)
11657
- o[O] = z;
11658
- for (let O = i + 1; O <= this.source.maxLevel; O++) {
11659
- var l = this.tilesMatrix[O] && this.tilesMatrix[O][0] && this.tilesMatrix[O][0][0];
11656
+ for (let B = 0, z = i; z >= n; z--, B++)
11657
+ o[B] = z;
11658
+ for (let B = i + 1; B <= this.source.maxLevel; B++) {
11659
+ var l = this.tilesMatrix[B] && this.tilesMatrix[B][0] && this.tilesMatrix[B][0][0];
11660
11660
  if (l && l.isBottomMost && l.isRightMost && l.loaded) {
11661
- o.push(O);
11661
+ o.push(B);
11662
11662
  break;
11663
11663
  }
11664
11664
  }
11665
11665
  let h = !1;
11666
- for (let O = 0; O < o.length; O++) {
11667
- let z = o[O];
11666
+ for (let B = 0; B < o.length; B++) {
11667
+ let z = o[B];
11668
11668
  var d = this.viewport.deltaPixelsFromPointsNoRotate(
11669
11669
  this.source.getPixelRatio(z),
11670
11670
  !0
11671
11671
  ).x * this._scaleSpring.current.value;
11672
- if (O === o.length - 1 || d >= this.minPixelRatio)
11672
+ if (B === o.length - 1 || d >= this.minPixelRatio)
11673
11673
  h = !0;
11674
11674
  else if (!h)
11675
11675
  continue;
@@ -11695,21 +11695,21 @@ function Ve() {
11695
11695
  r
11696
11696
  );
11697
11697
  r = E.bestTiles;
11698
- var P = E.updatedTiles.filter((V) => V.loaded), I = /* @__PURE__ */ function(V, j, q) {
11698
+ var P = E.updatedTiles.filter((V) => V.loaded), I = /* @__PURE__ */ function(V, Z, X) {
11699
11699
  return function($) {
11700
11700
  return {
11701
11701
  tile: $,
11702
11702
  level: V,
11703
- levelOpacity: j,
11704
- currentTime: q
11703
+ levelOpacity: Z,
11704
+ currentTime: X
11705
11705
  };
11706
11706
  };
11707
11707
  }(z, T, s);
11708
11708
  if (this._tilesToDraw[z] = P.map(I), this._providesCoverage(this.coverage, z))
11709
11709
  break;
11710
11710
  }
11711
- return r && r.length > 0 ? (r.forEach(function(O) {
11712
- O && !O.context2D && this._loadTile(O, s);
11711
+ return r && r.length > 0 ? (r.forEach(function(B) {
11712
+ B && !B.context2D && this._loadTile(B, s);
11713
11713
  }, this), this._needsDraw = !0, !1) : this._tilesLoading === 0;
11714
11714
  },
11715
11715
  /**
@@ -11797,15 +11797,15 @@ function Ve() {
11797
11797
  this.getFlip() && (f.x += 1, this.wrapHorizontal || (f.x = Math.min(f.x, v.x - 1)));
11798
11798
  for (var T = Math.max(0, (f.x - d.x) * (f.y - d.y)), x = new Array(T), E = 0, P = d.x; P <= f.x; P++)
11799
11799
  for (var I = d.y; I <= f.y; I++) {
11800
- var O;
11800
+ var B;
11801
11801
  if (this.getFlip()) {
11802
11802
  var z = (v.x + P % v.x) % v.x;
11803
- O = P + v.x - z - z - 1;
11803
+ B = P + v.x - z - z - 1;
11804
11804
  } else
11805
- O = P;
11806
- if (r.intersection(this.getTileBounds(t, O, I)) !== null) {
11805
+ B = P;
11806
+ if (r.intersection(this.getTileBounds(t, B, I)) !== null) {
11807
11807
  var V = this._updateTile(
11808
- O,
11808
+ B,
11809
11809
  I,
11810
11810
  t,
11811
11811
  i,
@@ -12438,7 +12438,7 @@ function Ve() {
12438
12438
  }
12439
12439
  );
12440
12440
  }(C);
12441
- }(Te)), Te.exports;
12441
+ }(xe)), xe.exports;
12442
12442
  }
12443
12443
  var je = Ve();
12444
12444
  const Ze = /* @__PURE__ */ Oe(je), qe = (W, C = [255, 255, 255, 255], e = [0, 0, 0, 255]) => {
@@ -12490,13 +12490,14 @@ const Ze = /* @__PURE__ */ Oe(je), qe = (W, C = [255, 255, 255, 255], e = [0, 0,
12490
12490
  });
12491
12491
  });
12492
12492
  }, Fe = (W) => {
12493
- const C = W.element.querySelector(".openseadragon-canvas");
12493
+ var r;
12494
+ const C = (r = W.element) == null ? void 0 : r.querySelector(".openseadragon-canvas");
12494
12495
  if (!C) throw "[a9s-sam] Error creating overlay canvas";
12495
12496
  const e = W.drawer.canvas, t = document.createElement("canvas");
12496
12497
  t.width = e.width, t.height = e.height;
12497
12498
  const n = t.getContext("2d");
12498
12499
  if (!n) throw "[a9s-sam] Error creating preview drawing context";
12499
- return new ResizeObserver((r) => {
12500
+ return new ResizeObserver((a) => {
12500
12501
  try {
12501
12502
  t.width = e.width, t.height = e.height;
12502
12503
  } catch {
@@ -12579,51 +12580,53 @@ const Ze = /* @__PURE__ */ Oe(je), qe = (W, C = [255, 255, 255, 255], e = [0, 0,
12579
12580
  }), rt = (W, C = {}) => {
12580
12581
  const { viewer: e } = W;
12581
12582
  let t = !1, n = "add";
12582
- const i = We(), r = et(), a = Qe(W.viewer, C), s = $e(W.viewer), o = (B) => {
12583
- const { isSAMReady: L, sam: k } = r;
12584
- if (!k || !L) return;
12585
- const Z = e.drawer.canvas, J = Z.width / (k.currentScale * Z.offsetWidth), ne = Z.height / (k.currentScale * Z.offsetHeight), te = B.x * J + k.currentBounds.x, se = B.y * ne + k.currentBounds.y;
12586
- return { x: te, y: se };
12587
- }, l = (B) => {
12588
- var Z;
12589
- if (!r.isSAMReady || !r.isOSDReady || !!((Z = r.sam) != null && Z.currentPrompt)) return;
12590
- const k = { x: B.offsetX, y: B.offsetY };
12591
- r.lastPointerPos = k, r.isAnimationInProgress || w(k);
12592
- }, h = (B) => {
12593
- var te, se, ae, le;
12594
- const L = { x: B.offsetX, y: B.offsetY }, k = o(L);
12595
- if (!k) return;
12596
- B.shiftKey || n === "remove" ? r.sam.currentPrompt = {
12597
- include: ((te = r.sam.currentPrompt) == null ? void 0 : te.include) || [],
12598
- exclude: [...((se = r.sam.currentPrompt) == null ? void 0 : se.exclude) || [], k]
12583
+ const i = We(), r = et();
12584
+ let a, s;
12585
+ const o = (O) => {
12586
+ const { isSAMReady: j, sam: L } = r;
12587
+ if (!L || !j) return;
12588
+ const q = e.drawer.canvas, ee = q.width / (L.currentScale * q.offsetWidth), ne = q.height / (L.currentScale * q.offsetHeight), se = O.x * ee + L.currentBounds.x, oe = O.y * ne + L.currentBounds.y;
12589
+ return { x: se, y: oe };
12590
+ }, l = (O) => {
12591
+ var q;
12592
+ if (!r.isSAMReady || !r.isOSDReady || !!((q = r.sam) != null && q.currentPrompt)) return;
12593
+ const L = { x: O.offsetX, y: O.offsetY };
12594
+ r.lastPointerPos = L, r.isAnimationInProgress || w(L);
12595
+ }, h = (O) => {
12596
+ var se, oe, le, he;
12597
+ const j = { x: O.offsetX, y: O.offsetY }, L = o(j);
12598
+ if (!L) return;
12599
+ O.shiftKey || n === "remove" ? r.sam.currentPrompt = {
12600
+ include: ((se = r.sam.currentPrompt) == null ? void 0 : se.include) || [],
12601
+ exclude: [...((oe = r.sam.currentPrompt) == null ? void 0 : oe.exclude) || [], L]
12599
12602
  } : r.sam.currentPrompt = {
12600
- include: [...((ae = r.sam.currentPrompt) == null ? void 0 : ae.include) || [], k],
12601
- exclude: ((le = r.sam.currentPrompt) == null ? void 0 : le.exclude) || []
12603
+ include: [...((le = r.sam.currentPrompt) == null ? void 0 : le.include) || [], L],
12604
+ exclude: ((he = r.sam.currentPrompt) == null ? void 0 : he.exclude) || []
12602
12605
  };
12603
- const { currentPrompt: Z, currentBounds: J, currentScale: ne } = r.sam;
12604
- s.setPrompt(Z, J, ne), X.postMessage({ type: "decode", prompt: r.sam.currentPrompt });
12605
- }, d = (B) => {
12606
- B.quick && (!r.sam || !r.isSAMReady || !r.isOSDReady || r.isAnimationInProgress || (e.setMouseNavEnabled(!1), h(B.originalEvent)));
12607
- }, f = (B) => {
12608
- e.isMouseNavEnabled() || h(B);
12606
+ const { currentPrompt: q, currentBounds: ee, currentScale: ne } = r.sam;
12607
+ s.setPrompt(q, ee, ne), Y.postMessage({ type: "decode", prompt: r.sam.currentPrompt });
12608
+ }, d = (O) => {
12609
+ O.quick && (!r.sam || !r.isSAMReady || !r.isOSDReady || r.isAnimationInProgress || (e.setMouseNavEnabled(!1), h(O.originalEvent)));
12610
+ }, f = (O) => {
12611
+ e.isMouseNavEnabled() || h(O);
12609
12612
  }, v = () => {
12610
12613
  if (!r.sam) return;
12611
12614
  r.viewportVersion += 1, i.emit("encodingStart");
12612
- const B = Ne(r.sam.currentCanvas);
12613
- X.postMessage({ type: "encode", data: B, viewportVersion: r.viewportVersion });
12614
- }, w = (B) => {
12615
+ const O = Ne(r.sam.currentCanvas);
12616
+ Y.postMessage({ type: "encode", data: O, viewportVersion: r.viewportVersion });
12617
+ }, w = (O) => {
12615
12618
  if (r.lastEncodingVersion !== r.viewportVersion) return;
12616
- const L = o(B);
12617
- L && X.postMessage({ type: "decode_preview", point: L });
12619
+ const j = o(O);
12620
+ j && Y.postMessage({ type: "decode_preview", point: j });
12618
12621
  }, T = () => {
12619
- const { canvas: B, bounds: L, scale: k } = Ke(e.drawer.canvas);
12622
+ const { canvas: O, bounds: j, scale: L } = Ke(e.drawer.canvas);
12620
12623
  r.sam = {
12621
12624
  // The current 1024 x 1024 SAM working canvas
12622
- currentCanvas: B,
12625
+ currentCanvas: O,
12623
12626
  // The bbox of the resized & padded viewport on the working canvas
12624
- currentBounds: L,
12627
+ currentBounds: j,
12625
12628
  // The current SAM scale (longer image dimension / 1024)
12626
- currentScale: k,
12629
+ currentScale: L,
12627
12630
  // New annotation ID for the current shape
12628
12631
  currentAnnotationId: be()
12629
12632
  };
@@ -12639,56 +12642,59 @@ const Ze = /* @__PURE__ */ Oe(je), qe = (W, C = [255, 255, 255, 255], e = [0, 0,
12639
12642
  });
12640
12643
  const I = () => {
12641
12644
  e.element.addEventListener("pointermove", l), e.element.addEventListener("pointerdown", f), e.addHandler("canvas-click", d);
12642
- }, O = () => {
12643
- var B, L;
12644
- (B = e.element) == null || B.removeEventListener("pointermove", l), (L = e.element) == null || L.removeEventListener("pointerdown", f), e == null || e.removeHandler("canvas-click", d);
12645
- }, z = (B) => n = B, V = () => {
12646
- t = !1, e == null || e.setMouseNavEnabled(!0), a.hide(), s.hide(), O();
12647
- }, j = () => {
12645
+ }, B = () => {
12646
+ var O, j;
12647
+ (O = e.element) == null || O.removeEventListener("pointermove", l), (j = e.element) == null || j.removeEventListener("pointerdown", f), e == null || e.removeHandler("canvas-click", d);
12648
+ }, z = (O) => n = O, V = () => {
12649
+ t = !1, e == null || e.setMouseNavEnabled(!0), a.hide(), s.hide(), B();
12650
+ }, Z = () => {
12648
12651
  V(), P();
12649
- }, q = () => {
12652
+ }, X = () => {
12650
12653
  if (r.sam) {
12651
- const B = W.state.store.getAnnotation(r.sam.currentAnnotationId);
12652
- B && (W.removeAnnotation(r.sam.currentAnnotationId), i.emit("deleteAnnotation", B));
12654
+ const O = W.state.store.getAnnotation(r.sam.currentAnnotationId);
12655
+ O && (W.removeAnnotation(r.sam.currentAnnotationId), i.emit("deleteAnnotation", O));
12653
12656
  }
12654
- j();
12657
+ Z();
12655
12658
  };
12656
12659
  e.addHandler("animation-start", x), e.addHandler("animation-finish", E);
12657
12660
  const $ = () => {
12658
- a.destroy(), s.destroy(), O(), e == null || e.removeHandler("animation-start", x), e == null || e.removeHandler("animation-finish", E);
12659
- }, X = new ke();
12660
- return X.onmessage = (B) => {
12661
- const { type: L } = B.data;
12662
- if (L === "init_success")
12661
+ a.destroy(), s.destroy(), B(), e == null || e.removeHandler("animation-start", x), e == null || e.removeHandler("animation-finish", E);
12662
+ }, Y = new ke();
12663
+ return Y.onmessage = (O) => {
12664
+ const { type: j } = O.data;
12665
+ if (j === "init_success")
12663
12666
  r.isSAMReady = !0, i.emit("initialized"), t && v();
12664
- else if (L === "encode_success") {
12665
- const { viewportVersion: k } = B.data;
12666
- r.lastEncodingVersion = k, k < r.viewportVersion ? console.log("[a9s-sam] Stale encoding - discarding") : (i.emit("encodingFinished"), r.lastPointerPos && w(r.lastPointerPos));
12667
- } else if (L === "decode_preview_success") {
12667
+ else if (j === "encode_success") {
12668
+ const { viewportVersion: L } = O.data;
12669
+ r.lastEncodingVersion = L, L < r.viewportVersion ? console.log("[a9s-sam] Stale encoding - discarding") : (i.emit("encodingFinished"), r.lastPointerPos && w(r.lastPointerPos));
12670
+ } else if (j === "decode_preview_success") {
12668
12671
  if (r.sam && !r.isAnimationInProgress) {
12669
- const { result: k, viewportVersion: Z } = B.data;
12670
- Z === r.viewportVersion ? a.render(k, r.sam.currentBounds) : console.log("[a9s-sam] Stale preview - discarding");
12672
+ const { result: L, viewportVersion: q } = O.data;
12673
+ q === r.viewportVersion ? a.render(L, r.sam.currentBounds) : console.log("[a9s-sam] Stale preview - discarding");
12671
12674
  }
12672
- } else if (L === "decode_success") {
12675
+ } else if (j === "decode_success") {
12673
12676
  if (a.clear(), r.sam) {
12674
- const k = Xe(B.data.result, r.sam, W.getUser(), e), { store: Z } = W.state, J = Z.getAnnotation(r.sam.currentAnnotationId);
12675
- J ? (Z.updateAnnotation(r.sam.currentAnnotationId, k), i.emit("updateAnnotation", k, J, r.sam.currentPrompt)) : (Z.addAnnotation(k), i.emit("createAnnotation", k, r.sam.currentPrompt));
12676
- }
12677
- } else if (L === "init_error") {
12678
- const { error: k } = B.data;
12679
- i.emit("initError", k);
12680
- } else if (L === "encode_error") {
12681
- const { viewportVersion: k } = B.data;
12682
- k === r.viewportVersion && setTimeout(() => v(), 100);
12677
+ const L = Xe(O.data.result, r.sam, W.getUser(), e), { store: q } = W.state, ee = q.getAnnotation(r.sam.currentAnnotationId);
12678
+ ee ? (q.updateAnnotation(r.sam.currentAnnotationId, L), i.emit("updateAnnotation", L, ee, r.sam.currentPrompt)) : (q.addAnnotation(L), i.emit("createAnnotation", L, r.sam.currentPrompt));
12679
+ }
12680
+ } else if (j === "init_error") {
12681
+ const { error: L } = O.data;
12682
+ i.emit("initError", L);
12683
+ } else if (j === "encode_error") {
12684
+ const { viewportVersion: L } = O.data;
12685
+ L === r.viewportVersion && setTimeout(() => v(), 100);
12683
12686
  }
12684
- }, X.postMessage({ type: "init" }), {
12687
+ }, {
12685
12688
  destroy: $,
12686
- reset: q,
12687
- restart: j,
12689
+ init: () => {
12690
+ a = Qe(e, C), s = $e(e), Y.postMessage({ type: "init" });
12691
+ },
12692
+ reset: X,
12693
+ restart: Z,
12688
12694
  setQueryMode: z,
12689
12695
  start: P,
12690
12696
  stop: V,
12691
- on: (B, L) => i.on(B, L)
12697
+ on: (O, j) => i.on(O, j)
12692
12698
  };
12693
12699
  };
12694
12700
  export {