@annotorious/plugin-segment-anything 0.1.1 → 0.1.2

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.
@@ -1,7 +1,7 @@
1
1
  import { c as J, a as Fe, d as Be, q as Oe, F as Ae, f as He, s as Me, g as Le, m as Ie, W as ze, b as ke, v as Ne } from "../get-image-bounds-B6IwrQGx.js";
2
- const Ue = (N) => {
3
- const R = J.imread(N), e = new J.Mat(), t = new J.MatVector(), n = new J.Mat();
4
- J.cvtColor(R, e, J.COLOR_RGBA2GRAY);
2
+ const Ue = (W) => {
3
+ const S = J.imread(W), e = new J.Mat(), t = new J.MatVector(), n = new J.Mat();
4
+ J.cvtColor(S, e, J.COLOR_RGBA2GRAY);
5
5
  const i = new J.Size(9, 9);
6
6
  J.GaussianBlur(e, e, i, 0), J.threshold(e, e, 80, 255, J.THRESH_BINARY);
7
7
  const r = J.Mat.ones(3, 3, J.CV_8U);
@@ -22,32 +22,32 @@ const Ue = (N) => {
22
22
  ]);
23
23
  a = Fe(a), h.delete();
24
24
  }
25
- return R.delete(), e.delete(), t.delete(), n.delete(), a;
25
+ return S.delete(), e.delete(), t.delete(), n.delete(), a;
26
26
  };
27
27
  let We = () => ({
28
- emit(N, ...R) {
29
- for (let e = this.events[N] || [], t = 0, n = e.length; t < n; t++)
30
- e[t](...R);
28
+ emit(W, ...S) {
29
+ for (let e = this.events[W] || [], t = 0, n = e.length; t < n; t++)
30
+ e[t](...S);
31
31
  },
32
32
  events: {},
33
- on(N, R) {
33
+ on(W, S) {
34
34
  var e;
35
- return ((e = this.events)[N] || (e[N] = [])).push(R), () => {
35
+ return ((e = this.events)[W] || (e[W] = [])).push(S), () => {
36
36
  var t;
37
- this.events[N] = (t = this.events[N]) == null ? void 0 : t.filter((n) => R !== n);
37
+ this.events[W] = (t = this.events[W]) == null ? void 0 : t.filter((n) => S !== n);
38
38
  };
39
39
  }
40
40
  });
41
41
  var we = { exports: {} }, Ge = we.exports, be;
42
42
  function Ve() {
43
- return be || (be = 1, function(N) {
43
+ return be || (be = 1, function(W) {
44
44
  //! openseadragon 5.0.1
45
45
  //! Built on 2024-12-09
46
46
  //! Git commit: v5.0.1-0-480de92d
47
47
  //! http://openseadragon.github.io
48
48
  //! License: http://openseadragon.github.io/license/
49
- function R(e) {
50
- return new R.Viewer(e);
49
+ function S(e) {
50
+ return new S.Viewer(e);
51
51
  }
52
52
  (function(e) {
53
53
  e.version = {
@@ -77,7 +77,7 @@ function Ve() {
77
77
  }, e.type = function(r) {
78
78
  return r == null ? String(r) : t[n.call(r)] || "object";
79
79
  }, e.isPlainObject = function(r) {
80
- if (!r || R.type(r) !== "object" || r.nodeType || e.isWindow(r) || r.constructor && !i.call(r, "constructor") && !i.call(r.constructor.prototype, "isPrototypeOf"))
80
+ if (!r || S.type(r) !== "object" || r.nodeType || e.isWindow(r) || r.constructor && !i.call(r, "constructor") && !i.call(r.constructor.prototype, "isPrototypeOf"))
81
81
  return !1;
82
82
  var a;
83
83
  for (var s in r)
@@ -133,10 +133,10 @@ function Ve() {
133
133
  } else
134
134
  return 1;
135
135
  }, e.pixelDensityRatio = e.getCurrentPixelDensityRatio();
136
- })(R), function(e) {
136
+ })(S), function(e) {
137
137
  e.extend = function() {
138
138
  var s, o, l, h, d, f, v = arguments[0] || {}, w = arguments.length, T = !1, x = 1;
139
- for (typeof v == "boolean" && (T = v, v = arguments[1] || {}, x = 2), typeof v != "object" && !R.isFunction(v) && (v = {}), w === x && (v = this, --x); x < w; x++)
139
+ for (typeof v == "boolean" && (T = v, v = arguments[1] || {}, x = 2), typeof v != "object" && !S.isFunction(v) && (v = {}), w === x && (v = this, --x); x < w; x++)
140
140
  if (s = arguments[x], s !== null || s !== void 0)
141
141
  for (o in s) {
142
142
  var E = Object.getOwnPropertyDescriptor(s, o);
@@ -150,7 +150,7 @@ function Ve() {
150
150
  e.console.warn('Could not copy inherited property "' + o + '".');
151
151
  continue;
152
152
  }
153
- v !== h && (T && h && (R.isPlainObject(h) || (d = R.isArray(h))) ? (l = v[o], d ? (d = !1, f = l && R.isArray(l) ? l : []) : f = l && R.isPlainObject(l) ? l : {}, v[o] = R.extend(T, f, h)) : h !== void 0 && (v[o] = h));
153
+ v !== h && (T && h && (S.isPlainObject(h) || (d = S.isArray(h))) ? (l = v[o], d ? (d = !1, f = l && S.isArray(l) ? l : []) : f = l && S.isPlainObject(l) ? l : {}, v[o] = S.extend(T, f, h)) : h !== void 0 && (v[o] = h));
154
154
  }
155
155
  return v;
156
156
  };
@@ -1054,9 +1054,9 @@ function Ve() {
1054
1054
  for (var E in d)
1055
1055
  Object.prototype.hasOwnProperty.call(d, E) && d[E] && T.setRequestHeader(E, d[E]);
1056
1056
  h && (T.withCredentials = !0), T.send(v);
1057
- } catch (S) {
1058
- e.console.error("%s while making AJAX request: %s", S.name, S.message), T.onreadystatechange = function() {
1059
- }, e.isFunction(l) && l(T, S);
1057
+ } catch (R) {
1058
+ e.console.error("%s while making AJAX request: %s", R.name, R.message), T.onreadystatechange = function() {
1059
+ }, e.isFunction(l) && l(T, R);
1060
1060
  }
1061
1061
  return T;
1062
1062
  },
@@ -1257,10 +1257,10 @@ function Ve() {
1257
1257
  function a(s, o) {
1258
1258
  return o && s !== document.body ? document.body : s.offsetParent;
1259
1259
  }
1260
- }(R), function(e, t) {
1261
- N.exports ? N.exports = t() : e.OpenSeadragon = t();
1260
+ }(S), function(e, t) {
1261
+ W.exports ? W.exports = t() : e.OpenSeadragon = t();
1262
1262
  }(Ge, function() {
1263
- return R;
1263
+ return S;
1264
1264
  }), function(e) {
1265
1265
  class t {
1266
1266
  constructor(i) {
@@ -1366,22 +1366,22 @@ 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], S = a[0 * 3 + 2], O = a[1 * 3 + 0], F = a[1 * 3 + 1], A = a[1 * 3 + 2], U = a[2 * 3 + 0], G = a[2 * 3 + 1], V = 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], R = a[0 * 3 + 2], M = a[1 * 3 + 0], D = a[1 * 3 + 1], O = a[1 * 3 + 2], A = a[2 * 3 + 0], z = a[2 * 3 + 1], V = a[2 * 3 + 2];
1370
1370
  return new t([
1371
- x * s + E * h + S * v,
1372
- x * o + E * d + S * w,
1373
- x * l + E * f + S * T,
1374
- O * s + F * h + A * v,
1375
- O * o + F * d + A * w,
1376
- O * l + F * f + A * T,
1377
- U * s + G * h + V * v,
1378
- U * o + G * d + V * w,
1379
- U * l + G * f + V * T
1371
+ x * s + E * h + R * v,
1372
+ x * o + E * d + R * w,
1373
+ x * l + E * f + R * T,
1374
+ M * s + D * h + O * v,
1375
+ M * o + D * d + O * w,
1376
+ M * l + D * f + O * T,
1377
+ A * s + z * h + V * v,
1378
+ A * o + z * d + V * w,
1379
+ A * l + z * f + V * T
1380
1380
  ]);
1381
1381
  }
1382
1382
  }
1383
1383
  e.Mat3 = t;
1384
- }(R), function(e) {
1384
+ }(S), function(e) {
1385
1385
  var t = {
1386
1386
  supportsFullScreen: !1,
1387
1387
  isFullScreen: function() {
@@ -1438,7 +1438,7 @@ function Ve() {
1438
1438
  }, t.cancelFullScreen = function() {
1439
1439
  e.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."), t.exitFullScreen();
1440
1440
  }, e.extend(e, t);
1441
- }(R), function(e) {
1441
+ }(S), function(e) {
1442
1442
  e.EventSource = function() {
1443
1443
  this.events = {}, this._rejectedEventList = {};
1444
1444
  }, e.EventSource.prototype = {
@@ -1566,7 +1566,7 @@ function Ve() {
1566
1566
  delete this._rejectedEventList[t];
1567
1567
  }
1568
1568
  };
1569
- }(R), function(e) {
1569
+ }(S), function(e) {
1570
1570
  var t = {};
1571
1571
  e.MouseTracker = function(p) {
1572
1572
  var c = arguments;
@@ -1578,31 +1578,31 @@ function Ve() {
1578
1578
  var g = this;
1579
1579
  t[this.hash] = {
1580
1580
  click: function(y) {
1581
- S(g, y);
1581
+ R(g, y);
1582
1582
  },
1583
1583
  dblclick: function(y) {
1584
- O(g, y);
1584
+ M(g, y);
1585
1585
  },
1586
1586
  keydown: function(y) {
1587
- F(g, y);
1587
+ D(g, y);
1588
1588
  },
1589
1589
  keyup: function(y) {
1590
- A(g, y);
1590
+ O(g, y);
1591
1591
  },
1592
1592
  keypress: function(y) {
1593
- U(g, y);
1593
+ A(g, y);
1594
1594
  },
1595
1595
  focus: function(y) {
1596
- G(g, y);
1596
+ z(g, y);
1597
1597
  },
1598
1598
  blur: function(y) {
1599
1599
  V(g, y);
1600
1600
  },
1601
1601
  contextmenu: function(y) {
1602
- X(g, y);
1602
+ K(g, y);
1603
1603
  },
1604
1604
  wheel: function(y) {
1605
- q(g, y);
1605
+ j(g, y);
1606
1606
  },
1607
1607
  mousewheel: function(y) {
1608
1608
  k(g, y);
@@ -1614,10 +1614,10 @@ function Ve() {
1614
1614
  k(g, y);
1615
1615
  },
1616
1616
  losecapture: function(y) {
1617
- ie(g, y);
1617
+ $(g, y);
1618
1618
  },
1619
1619
  mouseenter: function(y) {
1620
- W(g, y);
1620
+ G(g, y);
1621
1621
  },
1622
1622
  mouseleave: function(y) {
1623
1623
  de(g, y);
@@ -1638,10 +1638,10 @@ function Ve() {
1638
1638
  ve(g, y);
1639
1639
  },
1640
1640
  touchstart: function(y) {
1641
- ee(g, y);
1641
+ te(g, y);
1642
1642
  },
1643
1643
  touchend: function(y) {
1644
- te(g, y);
1644
+ ie(g, y);
1645
1645
  },
1646
1646
  touchmove: function(y) {
1647
1647
  re(g, y);
@@ -1664,7 +1664,7 @@ function Ve() {
1664
1664
  xe(g, y);
1665
1665
  },
1666
1666
  pointerenter: function(y) {
1667
- W(g, y);
1667
+ G(g, y);
1668
1668
  },
1669
1669
  pointerleave: function(y) {
1670
1670
  de(g, y);
@@ -2372,32 +2372,32 @@ function Ve() {
2372
2372
  }
2373
2373
  }
2374
2374
  e.MouseTracker.gesturePointVelocityTracker = /* @__PURE__ */ function() {
2375
- var p = [], c = 0, g = 0, y = function(Z, L) {
2376
- return Z.hash.toString() + L.type + L.id.toString();
2375
+ var p = [], c = 0, g = 0, y = function(q, I) {
2376
+ return q.hash.toString() + I.type + I.id.toString();
2377
2377
  }, P = function() {
2378
- var Z, L = p.length, se, $, ue = e.now(), Pe, Re, Ce;
2379
- for (Pe = ue - g, g = ue, Z = 0; Z < L; Z++)
2380
- se = p[Z], $ = se.gPoint, $.direction = Math.atan2($.currentPos.y - se.lastPos.y, $.currentPos.x - se.lastPos.x), Re = se.lastPos.distanceTo($.currentPos), se.lastPos = $.currentPos, Ce = 1e3 * Re / (Pe + 1), $.speed = 0.75 * Ce + 0.25 * $.speed;
2381
- }, D = function(Z, L) {
2382
- var se = y(Z, L);
2378
+ var q, I = p.length, se, ee, ue = e.now(), Pe, Re, Ce;
2379
+ for (Pe = ue - g, g = ue, q = 0; q < I; q++)
2380
+ se = p[q], ee = se.gPoint, ee.direction = Math.atan2(ee.currentPos.y - se.lastPos.y, ee.currentPos.x - se.lastPos.x), Re = se.lastPos.distanceTo(ee.currentPos), se.lastPos = ee.currentPos, Ce = 1e3 * Re / (Pe + 1), ee.speed = 0.75 * Ce + 0.25 * ee.speed;
2381
+ }, F = function(q, I) {
2382
+ var se = y(q, I);
2383
2383
  p.push(
2384
2384
  {
2385
2385
  guid: se,
2386
- gPoint: L,
2387
- lastPos: L.currentPos
2386
+ gPoint: I,
2387
+ lastPos: I.currentPos
2388
2388
  }
2389
2389
  ), p.length === 1 && (g = e.now(), c = window.setInterval(P, 50));
2390
- }, M = function(Z, L) {
2391
- var se = y(Z, L), $, ue = p.length;
2392
- for ($ = 0; $ < ue; $++)
2393
- if (p[$].guid === se) {
2394
- p.splice($, 1), ue--, ue === 0 && window.clearInterval(c);
2390
+ }, L = function(q, I) {
2391
+ var se = y(q, I), ee, ue = p.length;
2392
+ for (ee = 0; ee < ue; ee++)
2393
+ if (p[ee].guid === se) {
2394
+ p.splice(ee, 1), ue--, ue === 0 && window.clearInterval(c);
2395
2395
  break;
2396
2396
  }
2397
2397
  };
2398
2398
  return {
2399
- addPoint: D,
2400
- removePoint: M
2399
+ addPoint: F,
2400
+ removePoint: L
2401
2401
  };
2402
2402
  }(), e.MouseTracker.captureElement = document, e.MouseTracker.wheelEventName = "onwheel" in document.createElement("div") ? "wheel" : (
2403
2403
  // Modern browsers support 'wheel'
@@ -2499,15 +2499,15 @@ function Ve() {
2499
2499
  }
2500
2500
  };
2501
2501
  function r(p) {
2502
- var c = t[p.hash], g, y, P, D, M, Z = c.activePointersLists.length;
2503
- for (g = 0; g < Z; g++)
2502
+ var c = t[p.hash], g, y, P, F, L, q = c.activePointersLists.length;
2503
+ for (g = 0; g < q; g++)
2504
2504
  if (P = c.activePointersLists[g], P.getLength() > 0) {
2505
- for (M = [], D = P.asArray(), y = 0; y < D.length; y++)
2506
- M.push(D[y]);
2507
- for (y = 0; y < M.length; y++)
2508
- he(p, P, M[y]);
2505
+ for (L = [], F = P.asArray(), y = 0; y < F.length; y++)
2506
+ L.push(F[y]);
2507
+ for (y = 0; y < L.length; y++)
2508
+ he(p, P, L[y]);
2509
2509
  }
2510
- for (g = 0; g < Z; g++)
2510
+ for (g = 0; g < q; g++)
2511
2511
  c.activePointersLists.pop();
2512
2512
  c.sentDragEvent = !1;
2513
2513
  }
@@ -2646,7 +2646,7 @@ function Ve() {
2646
2646
  function E(p, c) {
2647
2647
  return new e.Point((p.x + c.x) / 2, (p.y + c.y) / 2);
2648
2648
  }
2649
- function S(p, c) {
2649
+ function R(p, c) {
2650
2650
  var g = {
2651
2651
  originalEvent: c,
2652
2652
  eventType: "click",
@@ -2655,7 +2655,7 @@ function Ve() {
2655
2655
  };
2656
2656
  m(p, g), g.preventDefault && !g.defaultPrevented && e.cancelEvent(c), g.stopPropagation && e.stopEvent(c);
2657
2657
  }
2658
- function O(p, c) {
2658
+ function M(p, c) {
2659
2659
  var g = {
2660
2660
  originalEvent: c,
2661
2661
  eventType: "dblclick",
@@ -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 F(p, c) {
2667
+ function D(p, c) {
2668
2668
  var g = null, y = {
2669
2669
  originalEvent: c,
2670
2670
  eventType: "keydown",
@@ -2683,7 +2683,7 @@ function Ve() {
2683
2683
  userData: p.userData
2684
2684
  }, p.keyDownHandler(g)), (g && g.preventDefault || y.preventDefault && !y.defaultPrevented) && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
2685
2685
  }
2686
- function A(p, c) {
2686
+ function O(p, c) {
2687
2687
  var g = null, y = {
2688
2688
  originalEvent: c,
2689
2689
  eventType: "keyup",
@@ -2702,7 +2702,7 @@ function Ve() {
2702
2702
  userData: p.userData
2703
2703
  }, p.keyUpHandler(g)), (g && g.preventDefault || y.preventDefault && !y.defaultPrevented) && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
2704
2704
  }
2705
- function U(p, c) {
2705
+ function A(p, c) {
2706
2706
  var g = null, y = {
2707
2707
  originalEvent: c,
2708
2708
  eventType: "keypress",
@@ -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 G(p, c) {
2724
+ function z(p, c) {
2725
2725
  var g = {
2726
2726
  originalEvent: c,
2727
2727
  eventType: "focus",
@@ -2751,7 +2751,7 @@ function Ve() {
2751
2751
  }
2752
2752
  );
2753
2753
  }
2754
- function X(p, c) {
2754
+ function K(p, c) {
2755
2755
  var g = null, y = {
2756
2756
  originalEvent: c,
2757
2757
  eventType: "contextmenu",
@@ -2766,8 +2766,8 @@ 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 q(p, c) {
2770
- K(p, c, c);
2769
+ function j(p, c) {
2770
+ X(p, c, c);
2771
2771
  }
2772
2772
  function k(p, c) {
2773
2773
  var g = {
@@ -2783,16 +2783,16 @@ 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, K(p, g, c);
2786
+ e.MouseTracker.wheelEventName === "mousewheel" ? g.deltaY = -c.wheelDelta / e.DEFAULT_SETTINGS.pixelsPerWheelLine : g.deltaY = c.detail, X(p, g, c);
2787
2787
  }
2788
- function K(p, c, g) {
2789
- var y = 0, P, D = null;
2788
+ function X(p, c, g) {
2789
+ var y = 0, P, F = null;
2790
2790
  y = c.deltaY ? c.deltaY < 0 ? 1 : -1 : 0, P = {
2791
2791
  originalEvent: c,
2792
2792
  eventType: "wheel",
2793
2793
  pointerType: "mouse",
2794
2794
  isEmulated: c !== g
2795
- }, m(p, P), p.scrollHandler && !P.preventGesture && !P.defaultPrevented && (D = {
2795
+ }, m(p, P), p.scrollHandler && !P.preventGesture && !P.defaultPrevented && (F = {
2796
2796
  eventSource: p,
2797
2797
  pointerType: "mouse",
2798
2798
  position: T(c, p.element),
@@ -2802,9 +2802,9 @@ function Ve() {
2802
2802
  originalEvent: g,
2803
2803
  preventDefault: P.preventDefault || P.defaultPrevented,
2804
2804
  userData: p.userData
2805
- }, p.scrollHandler(D)), P.stopPropagation && e.stopEvent(g), (D && D.preventDefault || P.preventDefault && !P.defaultPrevented) && e.cancelEvent(g);
2805
+ }, p.scrollHandler(F)), P.stopPropagation && e.stopEvent(g), (F && F.preventDefault || P.preventDefault && !P.defaultPrevented) && e.cancelEvent(g);
2806
2806
  }
2807
- function ie(p, c) {
2807
+ function $(p, c) {
2808
2808
  var g = {
2809
2809
  id: e.MouseTracker.mousePointerId,
2810
2810
  type: "mouse"
@@ -2816,75 +2816,75 @@ 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 ee(p, c) {
2820
- var g, y, P = c.changedTouches.length, D, M = p.getActivePointersListByType("touch");
2821
- g = e.now(), M.getLength() > c.touches.length - P && e.console.warn("Tracked touch contact count doesn't match event.touches.length");
2822
- var Z = {
2819
+ function te(p, c) {
2820
+ var g, y, P = c.changedTouches.length, F, L = p.getActivePointersListByType("touch");
2821
+ g = e.now(), L.getLength() > c.touches.length - P && e.console.warn("Tracked touch contact count doesn't match event.touches.length");
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, Z), y = 0; y < P; y++)
2829
- D = {
2828
+ for (m(p, q), y = 0; y < P; y++)
2829
+ F = {
2830
2830
  id: c.changedTouches[y].identifier,
2831
2831
  type: "touch",
2832
2832
  // Simulate isPrimary
2833
- isPrimary: M.getLength() === 0,
2833
+ isPrimary: L.getLength() === 0,
2834
2834
  currentPos: w(c.changedTouches[y]),
2835
2835
  currentTime: g
2836
- }, b(p, Z, D), I(p, Z, D, 0), _(p, D, !0);
2837
- Z.preventDefault && !Z.defaultPrevented && e.cancelEvent(c), Z.stopPropagation && e.stopEvent(c);
2836
+ }, b(p, q, F), N(p, q, F, 0), _(p, F, !0);
2837
+ q.preventDefault && !q.defaultPrevented && e.cancelEvent(c), q.stopPropagation && e.stopEvent(c);
2838
2838
  }
2839
- function te(p, c) {
2840
- var g, y, P = c.changedTouches.length, D;
2839
+ function ie(p, c) {
2840
+ var g, y, P = c.changedTouches.length, F;
2841
2841
  g = e.now();
2842
- var M = {
2842
+ var L = {
2843
2843
  originalEvent: c,
2844
2844
  eventType: "pointerup",
2845
2845
  pointerType: "touch",
2846
2846
  isEmulated: !1
2847
2847
  };
2848
- for (m(p, M), y = 0; y < P; y++)
2849
- D = {
2848
+ for (m(p, L), y = 0; y < P; y++)
2849
+ F = {
2850
2850
  id: c.changedTouches[y].identifier,
2851
2851
  type: "touch",
2852
2852
  currentPos: w(c.changedTouches[y]),
2853
2853
  currentTime: g
2854
- }, j(p, M, D, 0), _(p, D, !1), B(p, M, D);
2855
- M.preventDefault && !M.defaultPrevented && e.cancelEvent(c), M.stopPropagation && e.stopEvent(c);
2854
+ }, Z(p, L, F, 0), _(p, F, !1), B(p, L, F);
2855
+ L.preventDefault && !L.defaultPrevented && e.cancelEvent(c), L.stopPropagation && e.stopEvent(c);
2856
2856
  }
2857
2857
  function re(p, c) {
2858
- var g, y, P = c.changedTouches.length, D;
2858
+ var g, y, P = c.changedTouches.length, F;
2859
2859
  g = e.now();
2860
- var M = {
2860
+ var L = {
2861
2861
  originalEvent: c,
2862
2862
  eventType: "pointermove",
2863
2863
  pointerType: "touch",
2864
2864
  isEmulated: !1
2865
2865
  };
2866
- for (m(p, M), y = 0; y < P; y++)
2867
- D = {
2866
+ for (m(p, L), y = 0; y < P; y++)
2867
+ F = {
2868
2868
  id: c.changedTouches[y].identifier,
2869
2869
  type: "touch",
2870
2870
  currentPos: w(c.changedTouches[y]),
2871
2871
  currentTime: g
2872
- }, Y(p, M, D);
2873
- M.preventDefault && !M.defaultPrevented && e.cancelEvent(c), M.stopPropagation && e.stopEvent(c);
2872
+ }, Y(p, L, F);
2873
+ L.preventDefault && !L.defaultPrevented && e.cancelEvent(c), L.stopPropagation && e.stopEvent(c);
2874
2874
  }
2875
2875
  function ne(p, c) {
2876
- var g = c.changedTouches.length, y, P, D = {
2876
+ var g = c.changedTouches.length, y, P, F = {
2877
2877
  originalEvent: c,
2878
2878
  eventType: "pointercancel",
2879
2879
  pointerType: "touch",
2880
2880
  isEmulated: !1
2881
2881
  };
2882
- for (m(p, D), y = 0; y < g; y++)
2882
+ for (m(p, F), y = 0; y < g; y++)
2883
2883
  P = {
2884
2884
  id: c.changedTouches[y].identifier,
2885
2885
  type: "touch"
2886
- }, z(p, D, P);
2887
- D.stopPropagation && e.stopEvent(c);
2886
+ }, U(p, F, P);
2887
+ F.stopPropagation && e.stopEvent(c);
2888
2888
  }
2889
2889
  function oe(p, c) {
2890
2890
  return e.eventIsCanceled(c) || c.preventDefault(), !1;
@@ -2916,7 +2916,7 @@ function Ve() {
2916
2916
  type: f(c)
2917
2917
  }, !1), g.stopPropagation && e.stopEvent(c);
2918
2918
  }
2919
- function W(p, c) {
2919
+ function G(p, c) {
2920
2920
  var g = {
2921
2921
  id: d(c),
2922
2922
  type: f(c),
@@ -2989,7 +2989,7 @@ function Ve() {
2989
2989
  pointerType: g.type,
2990
2990
  isEmulated: !1
2991
2991
  };
2992
- m(p, P), I(p, P, g, c.button), P.preventDefault && !P.defaultPrevented && e.cancelEvent(c), P.stopPropagation && e.stopEvent(c), P.shouldCapture && (y ? _(p, g, !0) : l(p, g));
2992
+ m(p, P), N(p, P, g, c.button), P.preventDefault && !P.defaultPrevented && e.cancelEvent(c), P.stopPropagation && e.stopEvent(c), P.shouldCapture && (y ? _(p, g, !0) : l(p, g));
2993
2993
  }
2994
2994
  function ge(p, c) {
2995
2995
  me(p, c);
@@ -3013,7 +3013,7 @@ function Ve() {
3013
3013
  pointerType: g.type,
3014
3014
  isEmulated: !1
3015
3015
  };
3016
- m(p, y), j(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), Z(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
3018
  function ve(p, c) {
3019
3019
  ye(p, c);
@@ -3047,7 +3047,7 @@ function Ve() {
3047
3047
  pointerType: g.type,
3048
3048
  isEmulated: !1
3049
3049
  };
3050
- m(p, y), z(p, y, g), y.stopPropagation && e.stopEvent(c);
3050
+ m(p, y), U(p, y, g), y.stopPropagation && e.stopEvent(c);
3051
3051
  }
3052
3052
  function ce(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);
@@ -3123,8 +3123,8 @@ function Ve() {
3123
3123
  );
3124
3124
  }
3125
3125
  function B(p, c, g) {
3126
- var y = p.getActivePointersListByType(g.type), P, D;
3127
- P = y.getById(g.id), P ? (P.captured ? (P.insideElement = !1, P.lastPos = P.currentPos, P.lastTime = P.currentTime, P.currentPos = g.currentPos, P.currentTime = g.currentTime) : he(p, y, P), g = P) : (g.captured = !1, g.insideElementPressed = !1), (p.leaveHandler || p.exitHandler) && (D = {
3126
+ var y = p.getActivePointersListByType(g.type), P, F;
3127
+ P = y.getById(g.id), P ? (P.captured ? (P.insideElement = !1, P.lastPos = P.currentPos, P.lastTime = P.currentTime, P.currentPos = g.currentPos, P.currentTime = g.currentTime) : he(p, y, P), g = P) : (g.captured = !1, g.insideElementPressed = !1), (p.leaveHandler || p.exitHandler) && (F = {
3128
3128
  eventSource: p,
3129
3129
  pointerType: g.type,
3130
3130
  // GitHub PR: https://github.com/openseadragon/openseadragon/pull/1754 (gPoint.currentPos && )
@@ -3136,7 +3136,7 @@ function Ve() {
3136
3136
  isTouchEvent: g.type === "touch",
3137
3137
  originalEvent: c.originalEvent,
3138
3138
  userData: p.userData
3139
- }, p.leaveHandler && p.leaveHandler(D), p.exitHandler && p.exitHandler(D));
3139
+ }, p.leaveHandler && p.leaveHandler(F), p.exitHandler && p.exitHandler(F));
3140
3140
  }
3141
3141
  function H(p, c, g) {
3142
3142
  var y, P;
@@ -3170,16 +3170,16 @@ function Ve() {
3170
3170
  userData: p.userData
3171
3171
  });
3172
3172
  }
3173
- function I(p, c, g, y) {
3174
- var P = t[p.hash], D = p.getActivePointersListByType(g.type), M;
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) {
3173
+ function N(p, c, g, y) {
3174
+ var P = t[p.hash], F = p.getActivePointersListByType(g.type), L;
3175
+ if (typeof c.originalEvent.buttons < "u" ? F.buttons = c.originalEvent.buttons : y === 0 ? F.buttons |= 1 : y === 1 ? F.buttons |= 4 : y === 2 ? F.buttons |= 2 : y === 3 ? F.buttons |= 8 : y === 4 ? F.buttons |= 16 : y === 5 && (F.buttons |= 32), y !== 0) {
3176
3176
  c.shouldCapture = !1, c.shouldReleaseCapture = !1, p.nonPrimaryPressHandler && !c.preventGesture && !c.defaultPrevented && (c.preventDefault = !0, p.nonPrimaryPressHandler(
3177
3177
  {
3178
3178
  eventSource: p,
3179
3179
  pointerType: g.type,
3180
3180
  position: x(g.currentPos, p.element),
3181
3181
  button: y,
3182
- buttons: D.buttons,
3182
+ buttons: F.buttons,
3183
3183
  isTouchEvent: g.type === "touch",
3184
3184
  originalEvent: c.originalEvent,
3185
3185
  userData: p.userData
@@ -3187,28 +3187,28 @@ function Ve() {
3187
3187
  ));
3188
3188
  return;
3189
3189
  }
3190
- M = D.getById(g.id), M ? (M.insideElementPressed = !0, M.insideElement = !0, M.originalTarget = c.originalEvent.target, M.contactPos = g.currentPos, M.contactTime = g.currentTime, M.lastPos = M.currentPos, M.lastTime = M.currentTime, M.currentPos = g.currentPos, M.currentTime = g.currentTime, g = M) : (g.captured = !1, g.insideElementPressed = !0, g.insideElement = !0, g.originalTarget = c.originalEvent.target, ce(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
+ L = F.getById(g.id), L ? (L.insideElementPressed = !0, L.insideElement = !0, L.originalTarget = c.originalEvent.target, L.contactPos = g.currentPos, L.contactTime = g.currentTime, L.lastPos = L.currentPos, L.lastTime = L.currentTime, L.currentPos = g.currentPos, L.currentTime = g.currentTime, g = L) : (g.captured = !1, g.insideElementPressed = !0, g.insideElement = !0, g.originalTarget = c.originalEvent.target, ce(F, g)), F.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), F.contacts === 1 ? p.pressHandler && !c.preventGesture && p.pressHandler(
3191
3191
  {
3192
3192
  eventSource: p,
3193
3193
  pointerType: g.type,
3194
3194
  position: x(g.contactPos, p.element),
3195
- buttons: D.buttons,
3195
+ buttons: F.buttons,
3196
3196
  isTouchEvent: g.type === "touch",
3197
3197
  originalEvent: c.originalEvent,
3198
3198
  userData: p.userData
3199
3199
  }
3200
- ) : D.contacts === 2 && p.pinchHandler && g.type === "touch" && (P.pinchGPoints = D.asArray(), P.lastPinchDist = P.currentPinchDist = P.pinchGPoints[0].currentPos.distanceTo(P.pinchGPoints[1].currentPos), P.lastPinchCenter = P.currentPinchCenter = E(P.pinchGPoints[0].currentPos, P.pinchGPoints[1].currentPos))) : (c.shouldCapture = !1, c.shouldReleaseCapture = !1);
3200
+ ) : F.contacts === 2 && p.pinchHandler && g.type === "touch" && (P.pinchGPoints = F.asArray(), P.lastPinchDist = P.currentPinchDist = P.pinchGPoints[0].currentPos.distanceTo(P.pinchGPoints[1].currentPos), P.lastPinchCenter = P.currentPinchCenter = E(P.pinchGPoints[0].currentPos, P.pinchGPoints[1].currentPos))) : (c.shouldCapture = !1, c.shouldReleaseCapture = !1);
3201
3201
  }
3202
- function j(p, c, g, y) {
3203
- var P = t[p.hash], D = p.getActivePointersListByType(g.type), M, Z, L, se = !1, $;
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) {
3202
+ function Z(p, c, g, y) {
3203
+ var P = t[p.hash], F = p.getActivePointersListByType(g.type), L, q, I, se = !1, ee;
3204
+ if (typeof c.originalEvent.buttons < "u" ? F.buttons = c.originalEvent.buttons : y === 0 ? F.buttons ^= -2 : y === 1 ? F.buttons ^= -5 : y === 2 ? F.buttons ^= -3 : y === 3 ? F.buttons ^= -9 : y === 4 ? F.buttons ^= -17 : y === 5 && (F.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
  {
3207
3207
  eventSource: p,
3208
3208
  pointerType: g.type,
3209
3209
  position: x(g.currentPos, p.element),
3210
3210
  button: y,
3211
- buttons: D.buttons,
3211
+ buttons: F.buttons,
3212
3212
  isTouchEvent: g.type === "touch",
3213
3213
  originalEvent: c.originalEvent,
3214
3214
  userData: p.userData
@@ -3216,72 +3216,72 @@ function Ve() {
3216
3216
  ));
3217
3217
  return;
3218
3218
  }
3219
- L = D.getById(g.id), L ? (D.removeContact(), L.captured && (se = !0), L.lastPos = L.currentPos, L.lastTime = L.currentTime, L.currentPos = g.currentPos, L.currentTime = g.currentTime, L.insideElement || he(p, D, L), M = L.currentPos, Z = L.currentTime) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, ce(D, g), L = g), !c.preventGesture && !c.defaultPrevented && (se ? (c.shouldReleaseCapture = !0, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.removePoint(p, L), D.contacts === 0 ? (p.releaseHandler && M && p.releaseHandler(
3219
+ I = F.getById(g.id), I ? (F.removeContact(), I.captured && (se = !0), I.lastPos = I.currentPos, I.lastTime = I.currentTime, I.currentPos = g.currentPos, I.currentTime = g.currentTime, I.insideElement || he(p, F, I), L = I.currentPos, q = I.currentTime) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, ce(F, g), I = g), !c.preventGesture && !c.defaultPrevented && (se ? (c.shouldReleaseCapture = !0, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.removePoint(p, I), F.contacts === 0 ? (p.releaseHandler && L && p.releaseHandler(
3220
3220
  {
3221
3221
  eventSource: p,
3222
- pointerType: L.type,
3223
- position: x(M, p.element),
3224
- buttons: D.buttons,
3225
- insideElementPressed: L.insideElementPressed,
3226
- insideElementReleased: L.insideElement,
3227
- isTouchEvent: L.type === "touch",
3222
+ pointerType: I.type,
3223
+ position: x(L, p.element),
3224
+ buttons: F.buttons,
3225
+ insideElementPressed: I.insideElementPressed,
3226
+ insideElementReleased: I.insideElement,
3227
+ isTouchEvent: I.type === "touch",
3228
3228
  originalEvent: c.originalEvent,
3229
3229
  userData: p.userData
3230
3230
  }
3231
3231
  ), p.dragEndHandler && P.sentDragEvent && p.dragEndHandler(
3232
3232
  {
3233
3233
  eventSource: p,
3234
- pointerType: L.type,
3235
- position: x(L.currentPos, p.element),
3236
- speed: L.speed,
3237
- direction: L.direction,
3234
+ pointerType: I.type,
3235
+ position: x(I.currentPos, p.element),
3236
+ speed: I.speed,
3237
+ direction: I.direction,
3238
3238
  shift: c.originalEvent.shiftKey,
3239
- isTouchEvent: L.type === "touch",
3239
+ isTouchEvent: I.type === "touch",
3240
3240
  originalEvent: c.originalEvent,
3241
3241
  userData: p.userData
3242
3242
  }
3243
- ), P.sentDragEvent = !1, (p.clickHandler || p.dblClickHandler) && L.insideElement && ($ = Z - L.contactTime <= p.clickTimeThreshold && L.contactPos.distanceTo(M) <= p.clickDistThreshold, p.clickHandler && p.clickHandler(
3243
+ ), P.sentDragEvent = !1, (p.clickHandler || p.dblClickHandler) && I.insideElement && (ee = q - I.contactTime <= p.clickTimeThreshold && I.contactPos.distanceTo(L) <= p.clickDistThreshold, p.clickHandler && p.clickHandler(
3244
3244
  {
3245
3245
  eventSource: p,
3246
- pointerType: L.type,
3247
- position: x(L.currentPos, p.element),
3248
- quick: $,
3246
+ pointerType: I.type,
3247
+ position: x(I.currentPos, p.element),
3248
+ quick: ee,
3249
3249
  shift: c.originalEvent.shiftKey,
3250
- isTouchEvent: L.type === "touch",
3250
+ isTouchEvent: I.type === "touch",
3251
3251
  originalEvent: c.originalEvent,
3252
- originalTarget: L.originalTarget,
3252
+ originalTarget: I.originalTarget,
3253
3253
  userData: p.userData
3254
3254
  }
3255
- ), p.dblClickHandler && $ && (D.clicks++, D.clicks === 1 ? (P.lastClickPos = M, P.dblClickTimeOut = setTimeout(function() {
3256
- D.clicks = 0;
3257
- }, p.dblClickTimeThreshold)) : D.clicks === 2 && (clearTimeout(P.dblClickTimeOut), D.clicks = 0, P.lastClickPos.distanceTo(M) <= p.dblClickDistThreshold && p.dblClickHandler(
3255
+ ), p.dblClickHandler && ee && (F.clicks++, F.clicks === 1 ? (P.lastClickPos = L, P.dblClickTimeOut = setTimeout(function() {
3256
+ F.clicks = 0;
3257
+ }, p.dblClickTimeThreshold)) : F.clicks === 2 && (clearTimeout(P.dblClickTimeOut), F.clicks = 0, P.lastClickPos.distanceTo(L) <= p.dblClickDistThreshold && p.dblClickHandler(
3258
3258
  {
3259
3259
  eventSource: p,
3260
- pointerType: L.type,
3261
- position: x(L.currentPos, p.element),
3260
+ pointerType: I.type,
3261
+ position: x(I.currentPos, p.element),
3262
3262
  shift: c.originalEvent.shiftKey,
3263
- isTouchEvent: L.type === "touch",
3263
+ isTouchEvent: I.type === "touch",
3264
3264
  originalEvent: c.originalEvent,
3265
3265
  userData: p.userData
3266
3266
  }
3267
- ), P.lastClickPos = null)))) : D.contacts === 2 && p.pinchHandler && L.type === "touch" && (P.pinchGPoints = D.asArray(), P.lastPinchDist = P.currentPinchDist = P.pinchGPoints[0].currentPos.distanceTo(P.pinchGPoints[1].currentPos), P.lastPinchCenter = P.currentPinchCenter = E(P.pinchGPoints[0].currentPos, P.pinchGPoints[1].currentPos))) : (c.shouldReleaseCapture = !1, p.releaseHandler && M && (p.releaseHandler(
3267
+ ), P.lastClickPos = null)))) : F.contacts === 2 && p.pinchHandler && I.type === "touch" && (P.pinchGPoints = F.asArray(), P.lastPinchDist = P.currentPinchDist = P.pinchGPoints[0].currentPos.distanceTo(P.pinchGPoints[1].currentPos), P.lastPinchCenter = P.currentPinchCenter = E(P.pinchGPoints[0].currentPos, P.pinchGPoints[1].currentPos))) : (c.shouldReleaseCapture = !1, p.releaseHandler && L && (p.releaseHandler(
3268
3268
  {
3269
3269
  eventSource: p,
3270
- pointerType: L.type,
3271
- position: x(M, p.element),
3272
- buttons: D.buttons,
3273
- insideElementPressed: L.insideElementPressed,
3274
- insideElementReleased: L.insideElement,
3275
- isTouchEvent: L.type === "touch",
3270
+ pointerType: I.type,
3271
+ position: x(L, p.element),
3272
+ buttons: F.buttons,
3273
+ insideElementPressed: I.insideElementPressed,
3274
+ insideElementReleased: I.insideElement,
3275
+ isTouchEvent: I.type === "touch",
3276
3276
  originalEvent: c.originalEvent,
3277
3277
  userData: p.userData
3278
3278
  }
3279
3279
  ), c.preventDefault = !0)));
3280
3280
  }
3281
3281
  function Y(p, c, g) {
3282
- var y = t[p.hash], P = p.getActivePointersListByType(g.type), D, M, Z;
3283
- if (typeof c.originalEvent.buttons < "u" && (P.buttons = c.originalEvent.buttons), D = P.getById(g.id), D)
3284
- D.lastPos = D.currentPos, D.lastTime = D.currentTime, D.currentPos = g.currentPos, D.currentTime = g.currentTime;
3282
+ var y = t[p.hash], P = p.getActivePointersListByType(g.type), F, L, q;
3283
+ if (typeof c.originalEvent.buttons < "u" && (P.buttons = c.originalEvent.buttons), F = P.getById(g.id), F)
3284
+ F.lastPos = F.currentPos, F.lastTime = F.currentTime, F.currentPos = g.currentPos, F.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() {
@@ -3296,41 +3296,41 @@ function Ve() {
3296
3296
  originalEvent: c.originalEvent,
3297
3297
  userData: p.userData
3298
3298
  }
3299
- ) : P.contacts === 1 ? (p.moveHandler && (D = P.asArray()[0], p.moveHandler(
3299
+ ) : P.contacts === 1 ? (p.moveHandler && (F = P.asArray()[0], p.moveHandler(
3300
3300
  {
3301
3301
  eventSource: p,
3302
- pointerType: D.type,
3303
- position: x(D.currentPos, p.element),
3302
+ pointerType: F.type,
3303
+ position: x(F.currentPos, p.element),
3304
3304
  buttons: P.buttons,
3305
- isTouchEvent: D.type === "touch",
3305
+ isTouchEvent: F.type === "touch",
3306
3306
  originalEvent: c.originalEvent,
3307
3307
  userData: p.userData
3308
3308
  }
3309
- )), p.dragHandler && !c.preventGesture && !c.defaultPrevented && (D = P.asArray()[0], Z = D.currentPos.minus(D.lastPos), p.dragHandler(
3309
+ )), p.dragHandler && !c.preventGesture && !c.defaultPrevented && (F = P.asArray()[0], q = F.currentPos.minus(F.lastPos), p.dragHandler(
3310
3310
  {
3311
3311
  eventSource: p,
3312
- pointerType: D.type,
3313
- position: x(D.currentPos, p.element),
3312
+ pointerType: F.type,
3313
+ position: x(F.currentPos, p.element),
3314
3314
  buttons: P.buttons,
3315
- delta: Z,
3316
- speed: D.speed,
3317
- direction: D.direction,
3315
+ delta: q,
3316
+ speed: F.speed,
3317
+ direction: F.direction,
3318
3318
  shift: c.originalEvent.shiftKey,
3319
- isTouchEvent: D.type === "touch",
3319
+ isTouchEvent: F.type === "touch",
3320
3320
  originalEvent: c.originalEvent,
3321
3321
  userData: p.userData
3322
3322
  }
3323
- ), c.preventDefault = !0, y.sentDragEvent = !0)) : P.contacts === 2 && (p.moveHandler && (M = P.asArray(), p.moveHandler(
3323
+ ), c.preventDefault = !0, y.sentDragEvent = !0)) : P.contacts === 2 && (p.moveHandler && (L = P.asArray(), p.moveHandler(
3324
3324
  {
3325
3325
  eventSource: p,
3326
- pointerType: M[0].type,
3327
- position: x(E(M[0].currentPos, M[1].currentPos), p.element),
3326
+ pointerType: L[0].type,
3327
+ position: x(E(L[0].currentPos, L[1].currentPos), p.element),
3328
3328
  buttons: P.buttons,
3329
- isTouchEvent: M[0].type === "touch",
3329
+ isTouchEvent: L[0].type === "touch",
3330
3330
  originalEvent: c.originalEvent,
3331
3331
  userData: p.userData
3332
3332
  }
3333
- )), p.pinchHandler && g.type === "touch" && !c.preventGesture && !c.defaultPrevented && (Z = y.pinchGPoints[0].currentPos.distanceTo(y.pinchGPoints[1].currentPos), Z !== y.currentPinchDist && (y.lastPinchDist = y.currentPinchDist, y.currentPinchDist = Z, 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,7 +3345,7 @@ function Ve() {
3345
3345
  }
3346
3346
  ), c.preventDefault = !0)));
3347
3347
  }
3348
- function z(p, c, g) {
3348
+ function U(p, c, g) {
3349
3349
  var y = p.getActivePointersListByType(g.type), P;
3350
3350
  P = y.getById(g.id), P && he(p, y, P);
3351
3351
  }
@@ -3360,7 +3360,7 @@ function Ve() {
3360
3360
  userData: p.userData
3361
3361
  });
3362
3362
  }
3363
- }(R), function(e) {
3363
+ }(S), function(e) {
3364
3364
  e.ControlAnchor = {
3365
3365
  NONE: 0,
3366
3366
  TOP_LEFT: 1,
@@ -3407,7 +3407,7 @@ function Ve() {
3407
3407
  e.setElementOpacity(this.wrapper, t, !0);
3408
3408
  }
3409
3409
  };
3410
- }(R), function(e) {
3410
+ }(S), function(e) {
3411
3411
  e.ControlDock = function(n) {
3412
3412
  var i = ["topleft", "topright", "bottomright", "bottomleft"], r, a;
3413
3413
  for (e.extend(!0, this, {
@@ -3500,7 +3500,7 @@ function Ve() {
3500
3500
  return a;
3501
3501
  return -1;
3502
3502
  }
3503
- }(R), function(e) {
3503
+ }(S), function(e) {
3504
3504
  e.Placement = e.freezeObject({
3505
3505
  CENTER: 0,
3506
3506
  TOP_LEFT: 1,
@@ -3586,7 +3586,7 @@ function Ve() {
3586
3586
  }
3587
3587
  }
3588
3588
  });
3589
- }(R), function(e) {
3589
+ }(S), function(e) {
3590
3590
  var t = {}, n = 1;
3591
3591
  e.Viewer = function(u) {
3592
3592
  var m = arguments, _ = this, b;
@@ -3603,7 +3603,7 @@ function Ve() {
3603
3603
  ];
3604
3604
  if (u.drawerOptions = Object.assign(
3605
3605
  {},
3606
- B.reduce((C, I) => (C[I] = u[I], delete u[I], C), {}),
3606
+ B.reduce((C, N) => (C[N] = u[N], delete u[N], C), {}),
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(C) {
3714
- var I = e.getString("Errors.OpenFailed", C.eventSource, C.message);
3715
- _._showMessage(I);
3714
+ var N = e.getString("Errors.OpenFailed", C.eventSource, C.message);
3715
+ _._showMessage(N);
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(C) {
3717
3717
  C.width = "100%", C.height = "100%", C.overflow = "hidden", C.position = "absolute", C.top = "0px", C.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(C) {
@@ -3728,20 +3728,20 @@ function Ve() {
3728
3728
  contextMenuHandler: e.delegate(this, T),
3729
3729
  keyDownHandler: e.delegate(this, x),
3730
3730
  keyHandler: e.delegate(this, E),
3731
- clickHandler: e.delegate(this, S),
3732
- dblClickHandler: e.delegate(this, O),
3733
- dragHandler: e.delegate(this, F),
3734
- dragEndHandler: e.delegate(this, A),
3735
- enterHandler: e.delegate(this, U),
3736
- leaveHandler: e.delegate(this, G),
3731
+ clickHandler: e.delegate(this, R),
3732
+ dblClickHandler: e.delegate(this, M),
3733
+ dragHandler: e.delegate(this, D),
3734
+ dragEndHandler: e.delegate(this, O),
3735
+ enterHandler: e.delegate(this, A),
3736
+ leaveHandler: e.delegate(this, z),
3737
3737
  pressHandler: e.delegate(this, V),
3738
- releaseHandler: e.delegate(this, X),
3739
- nonPrimaryPressHandler: e.delegate(this, q),
3738
+ releaseHandler: e.delegate(this, K),
3739
+ nonPrimaryPressHandler: e.delegate(this, j),
3740
3740
  nonPrimaryReleaseHandler: e.delegate(this, k),
3741
- scrollHandler: e.delegate(this, te),
3742
- pinchHandler: e.delegate(this, K),
3743
- focusHandler: e.delegate(this, ie),
3744
- blurHandler: e.delegate(this, ee)
3741
+ scrollHandler: e.delegate(this, ie),
3742
+ pinchHandler: e.delegate(this, X),
3743
+ focusHandler: e.delegate(this, $),
3744
+ blurHandler: e.delegate(this, te)
3745
3745
  }), this.outerTracker = new e.MouseTracker({
3746
3746
  userData: "Viewer.outerTracker",
3747
3747
  element: this.container,
@@ -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, B = 0, H = 0, C, I = function() {
3887
+ for (var b = u.length, B = 0, H = 0, C, N = function() {
3888
3888
  if (B + H === b)
3889
3889
  if (B) {
3890
3890
  (_._firstOpen || !_.preserveViewport) && (_.viewport.goHome(!0), _.viewport.update()), _._firstOpen = !1;
3891
- var z = u[0];
3892
- if (z.tileSource && (z = z.tileSource), _.overlays && !_.preserveOverlays)
3891
+ var U = u[0];
3892
+ if (U.tileSource && (U = U.tileSource), _.overlays && !_.preserveOverlays)
3893
3893
  for (var Q = 0; Q < _.overlays.length; Q++)
3894
3894
  _.currentOverlays[Q] = a(_, _.overlays[Q]);
3895
- _._drawOverlays(), _._opening = !1, _.raiseEvent("open", { source: z });
3895
+ _._drawOverlays(), _._opening = !1, _.raiseEvent("open", { source: U });
3896
3896
  } else
3897
3897
  _._opening = !1, _.raiseEvent("open-failed", C);
3898
- }, j = function(z) {
3899
- (!e.isPlainObject(z) || !z.tileSource) && (z = {
3900
- tileSource: z
3901
- }), z.index !== void 0 && (e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"), delete z.index), z.collectionImmediately === void 0 && (z.collectionImmediately = !0);
3902
- var Q = z.success;
3903
- z.success = function(c) {
3904
- if (B++, z.tileSource.overlays)
3905
- for (var g = 0; g < z.tileSource.overlays.length; g++)
3906
- _.addOverlay(z.tileSource.overlays[g]);
3907
- Q && Q(c), I();
3898
+ }, Z = 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 Q = U.success;
3903
+ U.success = function(c) {
3904
+ if (B++, U.tileSource.overlays)
3905
+ for (var g = 0; g < U.tileSource.overlays.length; g++)
3906
+ _.addOverlay(U.tileSource.overlays[g]);
3907
+ Q && Q(c), N();
3908
3908
  };
3909
- var p = z.error;
3910
- z.error = function(c) {
3911
- H++, C || (C = c), p && p(c), I();
3912
- }, _.addTiledImage(z);
3909
+ var p = U.error;
3910
+ U.error = function(c) {
3911
+ H++, C || (C = c), p && p(c), N();
3912
+ }, _.addTiledImage(U);
3913
3913
  }, Y = 0; Y < u.length; Y++)
3914
- j(u[Y]);
3914
+ Z(u[Y]);
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, B = m.redrawImmediately, H = m.drawerOptions, C = this.drawer;
3972
- let I = null;
3973
- if (u && u.prototype instanceof e.DrawerBase ? (I = u, u = "custom") : typeof u == "string" && (I = e.determineDrawer(u)), I || e.console.warn("Unsupported drawer! Drawer must be an existing string type, or a class that extends OpenSeadragon.DrawerBase."), I && I.isSupported()) {
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()) {
3974
3974
  C && b && C.destroy();
3975
- const j = new I({
3975
+ const Z = new N({
3976
3976
  viewer: this,
3977
3977
  viewport: this.viewport,
3978
3978
  element: this.canvas,
3979
3979
  debugGridColor: this.debugGridColor,
3980
3980
  options: H || this.drawerOptions[u]
3981
3981
  });
3982
- return b && (this.drawer = j, B && this.forceRedraw()), j;
3982
+ return b && (this.drawer = Z, B && this.forceRedraw()), Z;
3983
3983
  }
3984
3984
  return !1;
3985
3985
  },
@@ -4089,11 +4089,11 @@ function Ve() {
4089
4089
  var m = document.body, _ = m.style, b = document.documentElement.style, B = this, H, C;
4090
4090
  if (u === this.isFullPage())
4091
4091
  return this;
4092
- var I = {
4092
+ var N = {
4093
4093
  fullPage: u,
4094
4094
  preventDefaultAction: !1
4095
4095
  };
4096
- if (this.raiseEvent("pre-full-page", I), I.preventDefaultAction)
4096
+ if (this.raiseEvent("pre-full-page", N), N.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, H = m.childNodes.length, C = 0; C < H; C++)
@@ -4109,10 +4109,10 @@ 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 j = 0, Y = function() {
4112
+ var Z = 0, Y = function() {
4113
4113
  e.setPageScroll(B.pageScroll);
4114
- var z = e.getPageScroll();
4115
- j++, j < 10 && (z.x !== B.pageScroll.x || z.y !== B.pageScroll.y) && e.requestAnimationFrame(Y);
4114
+ var U = e.getPageScroll();
4115
+ Z++, Z < 10 && (U.x !== B.pageScroll.x || U.y !== B.pageScroll.y) && e.requestAnimationFrame(Y);
4116
4116
  };
4117
4117
  e.requestAnimationFrame(Y), t[this.hash].fullPage = !1, e.delegate(this, ne)({});
4118
4118
  }
@@ -4253,9 +4253,9 @@ function Ve() {
4253
4253
  options: u
4254
4254
  };
4255
4255
  function b(C) {
4256
- for (var I = 0; I < m._loadQueue.length; I++)
4257
- if (m._loadQueue[I] === _) {
4258
- m._loadQueue.splice(I, 1);
4256
+ for (var N = 0; N < m._loadQueue.length; N++)
4257
+ if (m._loadQueue[N] === _) {
4258
+ m._loadQueue.splice(N, 1);
4259
4259
  break;
4260
4260
  }
4261
4261
  m._loadQueue.length === 0 && B(_), m.raiseEvent("add-item-failed", C), u.error && u.error(C);
@@ -4282,12 +4282,12 @@ function Ve() {
4282
4282
  }
4283
4283
  this._loadQueue.push(_);
4284
4284
  function H() {
4285
- for (var C, I, j; m._loadQueue.length && (C = m._loadQueue[0], !!C.tileSource); ) {
4285
+ for (var C, N, Z; m._loadQueue.length && (C = m._loadQueue[0], !!C.tileSource); ) {
4286
4286
  if (m._loadQueue.splice(0, 1), C.options.replace) {
4287
4287
  var Y = m.world.getIndexOfItem(C.options.replaceItem);
4288
4288
  Y !== -1 && (C.options.index = Y), m.world.removeItem(C.options.replaceItem);
4289
4289
  }
4290
- I = new e.TiledImage({
4290
+ N = new e.TiledImage({
4291
4291
  viewer: m,
4292
4292
  source: C.tileSource,
4293
4293
  viewport: m.viewport,
@@ -4325,15 +4325,15 @@ function Ve() {
4325
4325
  ajaxHeaders: C.options.ajaxHeaders,
4326
4326
  debugMode: m.debugMode,
4327
4327
  subPixelRoundingForTransparency: m.subPixelRoundingForTransparency
4328
- }), m.collectionMode && m.world.setAutoRefigureSizes(!1), m.navigator && (j = e.extend({}, C.options, {
4328
+ }), m.collectionMode && m.world.setAutoRefigureSizes(!1), m.navigator && (Z = e.extend({}, C.options, {
4329
4329
  replace: !1,
4330
4330
  // navigator already removed the layer, nothing to replace
4331
- originalTiledImage: I,
4331
+ originalTiledImage: N,
4332
4332
  tileSource: C.tileSource
4333
- }), m.navigator.addTiledImage(j)), m.world.addItem(I, {
4333
+ }), m.navigator.addTiledImage(Z)), m.world.addItem(N, {
4334
4334
  index: C.options.index
4335
4335
  }), m._loadQueue.length === 0 && B(C), m.world.getItemCount() === 1 && !m.preserveViewport && m.viewport.goHome(!0), C.options.success && C.options.success({
4336
- item: I
4336
+ item: N
4337
4337
  });
4338
4338
  }
4339
4339
  }
@@ -4425,10 +4425,10 @@ function Ve() {
4425
4425
  clickTimeThreshold: this.clickTimeThreshold,
4426
4426
  clickDistThreshold: this.clickDistThreshold,
4427
4427
  tooltip: e.getString("Tooltips.PreviousPage"),
4428
- srcRest: W(this.prefixUrl, B.previous.REST),
4429
- srcGroup: W(this.prefixUrl, B.previous.GROUP),
4430
- srcHover: W(this.prefixUrl, B.previous.HOVER),
4431
- srcDown: W(this.prefixUrl, B.previous.DOWN),
4428
+ srcRest: G(this.prefixUrl, B.previous.REST),
4429
+ srcGroup: G(this.prefixUrl, B.previous.GROUP),
4430
+ srcHover: G(this.prefixUrl, B.previous.HOVER),
4431
+ srcDown: G(this.prefixUrl, B.previous.DOWN),
4432
4432
  onRelease: b,
4433
4433
  onFocus: u,
4434
4434
  onBlur: m
@@ -4437,10 +4437,10 @@ function Ve() {
4437
4437
  clickTimeThreshold: this.clickTimeThreshold,
4438
4438
  clickDistThreshold: this.clickDistThreshold,
4439
4439
  tooltip: e.getString("Tooltips.NextPage"),
4440
- srcRest: W(this.prefixUrl, B.next.REST),
4441
- srcGroup: W(this.prefixUrl, B.next.GROUP),
4442
- srcHover: W(this.prefixUrl, B.next.HOVER),
4443
- srcDown: W(this.prefixUrl, B.next.DOWN),
4440
+ srcRest: G(this.prefixUrl, B.next.REST),
4441
+ srcGroup: G(this.prefixUrl, B.next.GROUP),
4442
+ srcHover: G(this.prefixUrl, B.next.HOVER),
4443
+ srcDown: G(this.prefixUrl, B.next.DOWN),
4444
4444
  onRelease: _,
4445
4445
  onFocus: u,
4446
4446
  onBlur: m
@@ -4464,98 +4464,98 @@ function Ve() {
4464
4464
  * @returns {OpenSeadragon.Viewer} Chainable.
4465
4465
  */
4466
4466
  bindStandardControls: function() {
4467
- var u = e.delegate(this, de), m = e.delegate(this, fe), _ = e.delegate(this, _e), b = e.delegate(this, pe), B = e.delegate(this, me), H = e.delegate(this, Ee), C = e.delegate(this, ye), I = e.delegate(this, Se), j = e.delegate(this, ce), Y = e.delegate(this, he), z = e.delegate(this, v), Q = e.delegate(this, w), p = this.navImages, c = [], g = !0;
4467
+ var u = e.delegate(this, de), m = e.delegate(this, fe), _ = e.delegate(this, _e), b = e.delegate(this, pe), B = e.delegate(this, me), H = e.delegate(this, Ee), C = e.delegate(this, ye), N = e.delegate(this, Se), Z = e.delegate(this, ce), Y = e.delegate(this, he), U = e.delegate(this, v), Q = 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,
4471
4471
  clickDistThreshold: this.clickDistThreshold,
4472
4472
  tooltip: e.getString("Tooltips.ZoomIn"),
4473
- srcRest: W(this.prefixUrl, p.zoomIn.REST),
4474
- srcGroup: W(this.prefixUrl, p.zoomIn.GROUP),
4475
- srcHover: W(this.prefixUrl, p.zoomIn.HOVER),
4476
- srcDown: W(this.prefixUrl, p.zoomIn.DOWN),
4473
+ srcRest: G(this.prefixUrl, p.zoomIn.REST),
4474
+ srcGroup: G(this.prefixUrl, p.zoomIn.GROUP),
4475
+ srcHover: G(this.prefixUrl, p.zoomIn.HOVER),
4476
+ srcDown: G(this.prefixUrl, p.zoomIn.DOWN),
4477
4477
  onPress: u,
4478
4478
  onRelease: m,
4479
4479
  onClick: _,
4480
4480
  onEnter: u,
4481
4481
  onExit: m,
4482
- onFocus: z,
4482
+ onFocus: U,
4483
4483
  onBlur: Q
4484
4484
  })), c.push(this.zoomOutButton = new e.Button({
4485
4485
  element: this.zoomOutButton ? e.getElement(this.zoomOutButton) : null,
4486
4486
  clickTimeThreshold: this.clickTimeThreshold,
4487
4487
  clickDistThreshold: this.clickDistThreshold,
4488
4488
  tooltip: e.getString("Tooltips.ZoomOut"),
4489
- srcRest: W(this.prefixUrl, p.zoomOut.REST),
4490
- srcGroup: W(this.prefixUrl, p.zoomOut.GROUP),
4491
- srcHover: W(this.prefixUrl, p.zoomOut.HOVER),
4492
- srcDown: W(this.prefixUrl, p.zoomOut.DOWN),
4489
+ srcRest: G(this.prefixUrl, p.zoomOut.REST),
4490
+ srcGroup: G(this.prefixUrl, p.zoomOut.GROUP),
4491
+ srcHover: G(this.prefixUrl, p.zoomOut.HOVER),
4492
+ srcDown: G(this.prefixUrl, p.zoomOut.DOWN),
4493
4493
  onPress: b,
4494
4494
  onRelease: m,
4495
4495
  onClick: B,
4496
4496
  onEnter: b,
4497
4497
  onExit: m,
4498
- onFocus: z,
4498
+ onFocus: U,
4499
4499
  onBlur: Q
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,
4503
4503
  clickDistThreshold: this.clickDistThreshold,
4504
4504
  tooltip: e.getString("Tooltips.Home"),
4505
- srcRest: W(this.prefixUrl, p.home.REST),
4506
- srcGroup: W(this.prefixUrl, p.home.GROUP),
4507
- srcHover: W(this.prefixUrl, p.home.HOVER),
4508
- srcDown: W(this.prefixUrl, p.home.DOWN),
4505
+ srcRest: G(this.prefixUrl, p.home.REST),
4506
+ srcGroup: G(this.prefixUrl, p.home.GROUP),
4507
+ srcHover: G(this.prefixUrl, p.home.HOVER),
4508
+ srcDown: G(this.prefixUrl, p.home.DOWN),
4509
4509
  onRelease: H,
4510
- onFocus: z,
4510
+ onFocus: U,
4511
4511
  onBlur: Q
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,
4515
4515
  clickDistThreshold: this.clickDistThreshold,
4516
4516
  tooltip: e.getString("Tooltips.FullPage"),
4517
- srcRest: W(this.prefixUrl, p.fullpage.REST),
4518
- srcGroup: W(this.prefixUrl, p.fullpage.GROUP),
4519
- srcHover: W(this.prefixUrl, p.fullpage.HOVER),
4520
- srcDown: W(this.prefixUrl, p.fullpage.DOWN),
4517
+ srcRest: G(this.prefixUrl, p.fullpage.REST),
4518
+ srcGroup: G(this.prefixUrl, p.fullpage.GROUP),
4519
+ srcHover: G(this.prefixUrl, p.fullpage.HOVER),
4520
+ srcDown: G(this.prefixUrl, p.fullpage.DOWN),
4521
4521
  onRelease: C,
4522
- onFocus: z,
4522
+ onFocus: U,
4523
4523
  onBlur: Q
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,
4527
4527
  clickDistThreshold: this.clickDistThreshold,
4528
4528
  tooltip: e.getString("Tooltips.RotateLeft"),
4529
- srcRest: W(this.prefixUrl, p.rotateleft.REST),
4530
- srcGroup: W(this.prefixUrl, p.rotateleft.GROUP),
4531
- srcHover: W(this.prefixUrl, p.rotateleft.HOVER),
4532
- srcDown: W(this.prefixUrl, p.rotateleft.DOWN),
4533
- onRelease: I,
4534
- onFocus: z,
4529
+ srcRest: G(this.prefixUrl, p.rotateleft.REST),
4530
+ srcGroup: G(this.prefixUrl, p.rotateleft.GROUP),
4531
+ srcHover: G(this.prefixUrl, p.rotateleft.HOVER),
4532
+ srcDown: G(this.prefixUrl, p.rotateleft.DOWN),
4533
+ onRelease: N,
4534
+ onFocus: U,
4535
4535
  onBlur: Q
4536
4536
  })), c.push(this.rotateRightButton = new e.Button({
4537
4537
  element: this.rotateRightButton ? e.getElement(this.rotateRightButton) : null,
4538
4538
  clickTimeThreshold: this.clickTimeThreshold,
4539
4539
  clickDistThreshold: this.clickDistThreshold,
4540
4540
  tooltip: e.getString("Tooltips.RotateRight"),
4541
- srcRest: W(this.prefixUrl, p.rotateright.REST),
4542
- srcGroup: W(this.prefixUrl, p.rotateright.GROUP),
4543
- srcHover: W(this.prefixUrl, p.rotateright.HOVER),
4544
- srcDown: W(this.prefixUrl, p.rotateright.DOWN),
4545
- onRelease: j,
4546
- onFocus: z,
4541
+ srcRest: G(this.prefixUrl, p.rotateright.REST),
4542
+ srcGroup: G(this.prefixUrl, p.rotateright.GROUP),
4543
+ srcHover: G(this.prefixUrl, p.rotateright.HOVER),
4544
+ srcDown: G(this.prefixUrl, p.rotateright.DOWN),
4545
+ onRelease: Z,
4546
+ onFocus: U,
4547
4547
  onBlur: Q
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,
4551
4551
  clickDistThreshold: this.clickDistThreshold,
4552
4552
  tooltip: e.getString("Tooltips.Flip"),
4553
- srcRest: W(this.prefixUrl, p.flip.REST),
4554
- srcGroup: W(this.prefixUrl, p.flip.GROUP),
4555
- srcHover: W(this.prefixUrl, p.flip.HOVER),
4556
- srcDown: W(this.prefixUrl, p.flip.DOWN),
4553
+ srcRest: G(this.prefixUrl, p.flip.REST),
4554
+ srcGroup: G(this.prefixUrl, p.flip.GROUP),
4555
+ srcHover: G(this.prefixUrl, p.flip.HOVER),
4556
+ srcDown: G(this.prefixUrl, p.flip.DOWN),
4557
4557
  onRelease: Y,
4558
- onFocus: z,
4558
+ onFocus: U,
4559
4559
  onBlur: Q
4560
4560
  })), g ? (this.buttonGroup = new e.ButtonGroup({
4561
4561
  buttons: c,
@@ -4841,12 +4841,12 @@ function Ve() {
4841
4841
  } catch {
4842
4842
  }
4843
4843
  }
4844
- function I(j, Y) {
4845
- j.ready ? b(j) : (j.addHandler("ready", function() {
4846
- b(j);
4847
- }), j.addHandler("open-failed", function(z) {
4844
+ function N(Z, Y) {
4845
+ Z.ready ? b(Z) : (Z.addHandler("ready", function() {
4846
+ b(Z);
4847
+ }), Z.addHandler("open-failed", function(U) {
4848
4848
  B({
4849
- message: z.message,
4849
+ message: U.message,
4850
4850
  source: Y
4851
4851
  });
4852
4852
  }));
@@ -4867,8 +4867,8 @@ function Ve() {
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 j = new e.TileSource(m);
4871
- j.getTileUrl = m.getTileUrl, b(j);
4870
+ var Z = new e.TileSource(m);
4871
+ Z.getTileUrl = m.getTileUrl, b(Z);
4872
4872
  } else {
4873
4873
  var Y = e.TileSource.determineType(H, m);
4874
4874
  if (!Y) {
@@ -4878,11 +4878,11 @@ function Ve() {
4878
4878
  });
4879
4879
  return;
4880
4880
  }
4881
- var z = Y.prototype.configure.apply(H, [m]);
4882
- I(new Y(z), m);
4881
+ var U = Y.prototype.configure.apply(H, [m]);
4882
+ N(new Y(U), m);
4883
4883
  }
4884
4884
  else
4885
- I(m, m);
4885
+ N(m, m);
4886
4886
  });
4887
4887
  }
4888
4888
  function a(u, m) {
@@ -4900,7 +4900,7 @@ function Ve() {
4900
4900
  }
4901
4901
  var B = m.location, H = m.width, C = m.height;
4902
4902
  if (!B) {
4903
- var I = m.x, j = m.y;
4903
+ var N = m.x, Z = m.y;
4904
4904
  if (m.px !== void 0) {
4905
4905
  var Y = u.viewport.imageToViewportRectangle(new e.Rect(
4906
4906
  m.px,
@@ -4908,15 +4908,15 @@ function Ve() {
4908
4908
  H || 0,
4909
4909
  C || 0
4910
4910
  ));
4911
- I = Y.x, j = Y.y, H = H !== void 0 ? Y.width : void 0, C = C !== void 0 ? Y.height : void 0;
4911
+ N = Y.x, Z = Y.y, H = H !== void 0 ? Y.width : void 0, C = C !== void 0 ? Y.height : void 0;
4912
4912
  }
4913
- B = new e.Point(I, j);
4913
+ B = new e.Point(N, Z);
4914
4914
  }
4915
- var z = m.placement;
4916
- return z && e.type(z) === "string" && (z = e.Placement[m.placement.toUpperCase()]), new e.Overlay({
4915
+ var U = m.placement;
4916
+ return U && e.type(U) === "string" && (U = e.Placement[m.placement.toUpperCase()]), new e.Overlay({
4917
4917
  element: _,
4918
4918
  location: B,
4919
- placement: z,
4919
+ placement: U,
4920
4920
  onDraw: m.onDraw,
4921
4921
  checkResize: m.checkResize,
4922
4922
  width: H,
@@ -5041,7 +5041,7 @@ function Ve() {
5041
5041
  };
5042
5042
  this.raiseEvent("canvas-key-press", m);
5043
5043
  }
5044
- function S(u) {
5044
+ function R(u) {
5045
5045
  var m, _ = document.activeElement === this.canvas;
5046
5046
  _ || this.canvas.focus(), this.viewport.flipped && (u.position.x = this.viewport.getContainerSize().x - u.position.x);
5047
5047
  var b = {
@@ -5058,7 +5058,7 @@ function Ve() {
5058
5058
  m.zoomToRefPoint ? this.viewport.pointFromPixel(u.position, !0) : null
5059
5059
  ), this.viewport.applyConstraints()), m.dblClickDragToZoom && (t[this.hash].draggingToZoom === !0 ? (t[this.hash].lastClickTime = null, t[this.hash].draggingToZoom = !1) : t[this.hash].lastClickTime = e.now()));
5060
5060
  }
5061
- function O(u) {
5061
+ function M(u) {
5062
5062
  var m, _ = {
5063
5063
  tracker: u.eventSource,
5064
5064
  position: u.position,
@@ -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 F(u) {
5074
+ function D(u) {
5075
5075
  var m, _ = {
5076
5076
  tracker: u.eventSource,
5077
5077
  pointerType: u.pointerType,
@@ -5098,7 +5098,7 @@ function Ve() {
5098
5098
  }
5099
5099
  }
5100
5100
  }
5101
- function A(u) {
5101
+ function O(u) {
5102
5102
  var m, _ = {
5103
5103
  tracker: u.eventSource,
5104
5104
  pointerType: u.pointerType,
@@ -5126,7 +5126,7 @@ function Ve() {
5126
5126
  }
5127
5127
  m.dblClickDragToZoom && t[this.hash].draggingToZoom === !0 && (t[this.hash].draggingToZoom = !1);
5128
5128
  }
5129
- function U(u) {
5129
+ function A(u) {
5130
5130
  this.raiseEvent("canvas-enter", {
5131
5131
  tracker: u.eventSource,
5132
5132
  pointerType: u.pointerType,
@@ -5138,7 +5138,7 @@ function Ve() {
5138
5138
  originalEvent: u.originalEvent
5139
5139
  });
5140
5140
  }
5141
- function G(u) {
5141
+ function z(u) {
5142
5142
  this.raiseEvent("canvas-exit", {
5143
5143
  tracker: u.eventSource,
5144
5144
  pointerType: u.pointerType,
@@ -5166,7 +5166,7 @@ function Ve() {
5166
5166
  b - _ < this.dblClickTimeThreshold && (t[this.hash].draggingToZoom = !0), t[this.hash].lastClickTime = null;
5167
5167
  }
5168
5168
  }
5169
- function X(u) {
5169
+ function K(u) {
5170
5170
  this.raiseEvent("canvas-release", {
5171
5171
  tracker: u.eventSource,
5172
5172
  pointerType: u.pointerType,
@@ -5176,7 +5176,7 @@ function Ve() {
5176
5176
  originalEvent: u.originalEvent
5177
5177
  });
5178
5178
  }
5179
- function q(u) {
5179
+ function j(u) {
5180
5180
  this.raiseEvent("canvas-nonprimary-press", {
5181
5181
  tracker: u.eventSource,
5182
5182
  position: u.position,
@@ -5196,7 +5196,7 @@ function Ve() {
5196
5196
  originalEvent: u.originalEvent
5197
5197
  });
5198
5198
  }
5199
- function K(u) {
5199
+ function X(u) {
5200
5200
  var m, _, b, B, H = {
5201
5201
  tracker: u.eventSource,
5202
5202
  pointerType: u.pointerType,
@@ -5215,26 +5215,26 @@ function Ve() {
5215
5215
  var C = 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
- ), I = Math.atan2(
5218
+ ), N = 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) + (C - I) * (180 / Math.PI), _, !0);
5222
+ _ = this.viewport.pointFromPixel(u.center, !0), this.viewport.rotateTo(this.viewport.getRotation(!0) + (C - N) * (180 / Math.PI), _, !0);
5223
5223
  }
5224
5224
  }
5225
- function ie(u) {
5225
+ function $(u) {
5226
5226
  this.raiseEvent("canvas-focus", {
5227
5227
  tracker: u.eventSource,
5228
5228
  originalEvent: u.originalEvent
5229
5229
  });
5230
5230
  }
5231
- function ee(u) {
5231
+ function te(u) {
5232
5232
  this.raiseEvent("canvas-blur", {
5233
5233
  tracker: u.eventSource,
5234
5234
  originalEvent: u.originalEvent
5235
5235
  });
5236
5236
  }
5237
- function te(u) {
5237
+ function ie(u) {
5238
5238
  var m, _, b, B, H;
5239
5239
  B = e.now(), H = B - this._lastScrollTime, H > this.minScrollDeltaTime ? (this._lastScrollTime = B, m = {
5240
5240
  tracker: u.eventSource,
@@ -5283,8 +5283,8 @@ function Ve() {
5283
5283
  if (u.preserveImageSizeOnResize)
5284
5284
  H = t[u.hash].prevContainerSize.x / m.x;
5285
5285
  else {
5286
- var C = new e.Point(0, 0), I = new e.Point(t[u.hash].prevContainerSize.x, t[u.hash].prevContainerSize.y).distanceTo(C), j = new e.Point(m.x, m.y).distanceTo(C);
5287
- H = j / I * t[u.hash].prevContainerSize.x / m.x;
5286
+ var C = new e.Point(0, 0), N = new e.Point(t[u.hash].prevContainerSize.x, t[u.hash].prevContainerSize.y).distanceTo(C), Z = new e.Point(m.x, m.y).distanceTo(C);
5287
+ H = Z / N * t[u.hash].prevContainerSize.x / m.x;
5288
5288
  }
5289
5289
  _.zoomTo(b * H, null, !0), t[u.hash].prevContainerSize = m, t[u.hash].forceRedraw = !0, t[u.hash].needsResize = !1, t[u.hash].forceResize = !1;
5290
5290
  }
@@ -5310,7 +5310,7 @@ function Ve() {
5310
5310
  function xe(u) {
5311
5311
  u.imageLoader.clear(), u.world.draw(), u.raiseEvent("update-viewport", {});
5312
5312
  }
5313
- function W(u, m) {
5313
+ function G(u, m) {
5314
5314
  return u ? u + m : m;
5315
5315
  }
5316
5316
  function de() {
@@ -5364,14 +5364,14 @@ function Ve() {
5364
5364
  this.viewport.toggleFlip();
5365
5365
  }
5366
5366
  e.determineDrawer = function(u) {
5367
- for (let m in R) {
5368
- const _ = R[m], b = _.prototype;
5369
- if (b && b instanceof R.DrawerBase && e.isFunction(b.getType) && b.getType.call(_) === u)
5367
+ for (let m in S) {
5368
+ const _ = S[m], b = _.prototype;
5369
+ if (b && b instanceof S.DrawerBase && e.isFunction(b.getType) && b.getType.call(_) === u)
5370
5370
  return _;
5371
5371
  }
5372
5372
  return null;
5373
5373
  };
5374
- }(R), function(e) {
5374
+ }(S), function(e) {
5375
5375
  e.Navigator = function(o) {
5376
5376
  var l = o.viewer, h = this, d, f;
5377
5377
  o.element || o.id ? (o.element ? (o.id && e.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."), o.element.id ? o.id = o.element.id : o.id = "navigator-" + e.now(), this.element = o.element) : this.element = document.getElementById(o.id), o.controlOptions = {
@@ -5502,8 +5502,8 @@ function Ve() {
5502
5502
  }
5503
5503
  var x = this.displayRegion.style;
5504
5504
  x.display = this.world.getItemCount() ? "block" : "none", x.top = v.y.toFixed(2) + "px", x.left = v.x.toFixed(2) + "px";
5505
- var E = w.x - v.x, S = w.y - v.y;
5506
- x.width = Math.round(Math.max(E, 0)) + "px", x.height = Math.round(Math.max(S, 0)) + "px";
5505
+ var E = w.x - v.x, R = w.y - v.y;
5506
+ x.width = Math.round(Math.max(E, 0)) + "px", x.height = Math.round(Math.max(R, 0)) + "px";
5507
5507
  }
5508
5508
  },
5509
5509
  // overrides Viewer.addTiledImage
@@ -5605,7 +5605,7 @@ function Ve() {
5605
5605
  function s(o, l) {
5606
5606
  o.style.webkitTransform = l, o.style.mozTransform = l, o.style.msTransform = l, o.style.oTransform = l, o.style.transform = l;
5607
5607
  }
5608
- }(R), function(e) {
5608
+ }(S), function(e) {
5609
5609
  var t = {
5610
5610
  Errors: {
5611
5611
  Dzc: "Sorry, we don't support Deep Zoom Collections!",
@@ -5658,7 +5658,7 @@ function Ve() {
5658
5658
  }
5659
5659
  }
5660
5660
  );
5661
- }(R), function(e) {
5661
+ }(S), function(e) {
5662
5662
  e.Point = function(t, n) {
5663
5663
  this.x = typeof t == "number" ? t : 0, this.y = typeof n == "number" ? n : 0;
5664
5664
  }, e.Point.prototype = {
@@ -5815,7 +5815,7 @@ function Ve() {
5815
5815
  return "(" + Math.round(this.x * 100) / 100 + "," + Math.round(this.y * 100) / 100 + ")";
5816
5816
  }
5817
5817
  };
5818
- }(R), function(e) {
5818
+ }(S), function(e) {
5819
5819
  e.TileSource = function(n, i, r, a, s, o) {
5820
5820
  var l = this, h = arguments, d, f;
5821
5821
  if (e.isPlainObject(n) ? d = n : d = {
@@ -6296,12 +6296,12 @@ function Ve() {
6296
6296
  }
6297
6297
  e.TileSource.determineType = function(n, i, r) {
6298
6298
  var a;
6299
- for (a in R)
6300
- if (a.match(/.+TileSource$/) && e.isFunction(R[a]) && e.isFunction(R[a].prototype.supports) && R[a].prototype.supports.call(n, i, r))
6301
- return R[a];
6299
+ for (a in S)
6300
+ if (a.match(/.+TileSource$/) && e.isFunction(S[a]) && e.isFunction(S[a].prototype.supports) && S[a].prototype.supports.call(n, i, r))
6301
+ return S[a];
6302
6302
  return e.console.error("No TileSource was able to open %s %s", r, i), null;
6303
6303
  };
6304
- }(R), function(e) {
6304
+ }(S), function(e) {
6305
6305
  e.DziTileSource = function(i, r, a, s, o, l, h, d, f) {
6306
6306
  var v, w, T, x;
6307
6307
  if (e.isPlainObject(i) ? x = i : x = {
@@ -6414,8 +6414,8 @@ function Ve() {
6414
6414
  }
6415
6415
  });
6416
6416
  return h.length && (l.Image.DisplayRect = h), n(i, l);
6417
- } catch (S) {
6418
- throw S instanceof Error ? S : new Error(e.getString("Errors.Dzi"));
6417
+ } catch (R) {
6418
+ throw R instanceof Error ? R : new Error(e.getString("Errors.Dzi"));
6419
6419
  }
6420
6420
  else {
6421
6421
  if (s === "Collection")
@@ -6459,7 +6459,7 @@ function Ve() {
6459
6459
  /* displayRects */
6460
6460
  }, r);
6461
6461
  }
6462
- }(R), function(e) {
6462
+ }(S), function(e) {
6463
6463
  e.IIIFTileSource = function(a) {
6464
6464
  if (e.extend(!0, this, a), this._id = this["@id"] || this.id || this.identifier || null, !(this.height && this.width && this._id))
6465
6465
  throw new Error("IIIF required parameters (width, height, or id) not provided.");
@@ -6578,7 +6578,7 @@ function Ve() {
6578
6578
  }
6579
6579
  if (a.preferredFormats) {
6580
6580
  for (var f = 0; f < a.preferredFormats.length; f++)
6581
- if (R.imageFormatSupported(a.preferredFormats[f])) {
6581
+ if (S.imageFormatSupported(a.preferredFormats[f])) {
6582
6582
  a.tileFormat = a.preferredFormats[f];
6583
6583
  break;
6584
6584
  }
@@ -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, S, O, F, A, U, G, V, X, q, k;
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 ? q = "native." + this.tileFormat : q = "default." + this.tileFormat, f < w && v < T ? (this.version === 2 && f === this.width ? G = "full" : this.version === 3 && f === this.width && v === this.height ? G = "max" : this.version === 3 ? G = f + "," + v : G = f + ",", S = "full") : (O = s * x, F = o * E, A = Math.min(x, this.width - O), U = Math.min(E, this.height - F), s === 0 && o === 0 && A === this.width && U === this.height ? S = "full" : S = [O, F, A, U].join(","), V = Math.min(w, f - s * w), X = Math.min(T, v - o * T), this.version === 2 && V === this.width ? G = "full" : this.version === 3 && V === this.width && X === this.height ? G = "max" : this.version === 3 ? G = V + "," + X : G = V + ","), k = [this._id, S, G, h, q].join("/"), k;
6672
+ var h = "0", d = Math.pow(0.5, this.maxLevel - a), f, v, w, T, x, E, R, M, D, O, A, z, V, K, j, k;
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 ? j = "native." + this.tileFormat : j = "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 + ",", R = "full") : (M = s * x, D = o * E, O = Math.min(x, this.width - M), A = Math.min(E, this.height - D), s === 0 && o === 0 && O === this.width && A === this.height ? R = "full" : R = [M, D, O, A].join(","), V = Math.min(w, f - s * w), K = Math.min(T, v - o * T), this.version === 2 && V === this.width ? z = "full" : this.version === 3 && V === this.width && K === this.height ? z = "max" : this.version === 3 ? z = V + "," + K : z = V + ","), k = [this._id, R, z, h, j].join("/"), k;
6674
6674
  },
6675
6675
  __testonly__: {
6676
6676
  canBeTiled: t,
@@ -6719,7 +6719,7 @@ function Ve() {
6719
6719
  for (l = 0; l < a.childNodes.length; l++)
6720
6720
  r(a.childNodes[l], s, a.nodeName);
6721
6721
  }
6722
- }(R), function(e) {
6722
+ }(S), function(e) {
6723
6723
  e.OsmTileSource = function(t, n, i, r, a) {
6724
6724
  var s;
6725
6725
  e.isPlainObject(t) ? s = t : s = {
@@ -6767,7 +6767,7 @@ function Ve() {
6767
6767
  }
6768
6768
  }
6769
6769
  );
6770
- }(R), function(e) {
6770
+ }(S), function(e) {
6771
6771
  e.TmsTileSource = function(t, n, i, r, a) {
6772
6772
  var s;
6773
6773
  e.isPlainObject(t) ? s = t : s = {
@@ -6818,7 +6818,7 @@ function Ve() {
6818
6818
  }
6819
6819
  }
6820
6820
  );
6821
- }(R), function(e) {
6821
+ }(S), function(e) {
6822
6822
  e.ZoomifyTileSource = function(t) {
6823
6823
  typeof t.tileSize > "u" && (t.tileSize = 256), typeof t.fileFormat > "u" && (t.fileFormat = "jpg", this.fileFormat = t.fileFormat);
6824
6824
  var n = {
@@ -6833,7 +6833,7 @@ function Ve() {
6833
6833
  x: n.x,
6834
6834
  y: n.y
6835
6835
  }), t.gridSize.push(this._getGridSize(n.x, n.y, t.tileSize));
6836
- t.imageSizes.reverse(), t.gridSize.reverse(), t.minLevel = 0, t.maxLevel = t.gridSize.length - 1, R.TileSource.apply(this, [t]);
6836
+ t.imageSizes.reverse(), t.gridSize.reverse(), t.minLevel = 0, t.maxLevel = t.gridSize.length - 1, S.TileSource.apply(this, [t]);
6837
6837
  }, e.extend(
6838
6838
  e.ZoomifyTileSource.prototype,
6839
6839
  e.TileSource.prototype,
@@ -6886,7 +6886,7 @@ function Ve() {
6886
6886
  }
6887
6887
  }
6888
6888
  );
6889
- }(R), function(e) {
6889
+ }(S), function(e) {
6890
6890
  e.LegacyTileSource = function(r) {
6891
6891
  var a, s, o;
6892
6892
  e.isArray(r) && (a = {
@@ -7003,7 +7003,7 @@ function Ve() {
7003
7003
  function i(r, a) {
7004
7004
  return a.levels;
7005
7005
  }
7006
- }(R), function(e) {
7006
+ }(S), function(e) {
7007
7007
  e.ImageTileSource = function(t) {
7008
7008
  t = e.extend({
7009
7009
  buildPyramid: !0,
@@ -7142,11 +7142,11 @@ function Ve() {
7142
7142
  }
7143
7143
  }
7144
7144
  );
7145
- }(R), function(e) {
7145
+ }(S), function(e) {
7146
7146
  e.TileSourceCollection = function(t, n, i, r) {
7147
7147
  e.console.error("TileSourceCollection is deprecated; use World instead");
7148
7148
  };
7149
- }(R), function(e) {
7149
+ }(S), function(e) {
7150
7150
  e.ButtonState = {
7151
7151
  REST: 0,
7152
7152
  GROUP: 1,
@@ -7273,7 +7273,7 @@ function Ve() {
7273
7273
  function s(o, l) {
7274
7274
  o.element.disabled || (l <= e.ButtonState.HOVER && o.currentState === e.ButtonState.DOWN && (o.imgDown && (o.imgDown.style.visibility = "hidden"), o.currentState = e.ButtonState.HOVER), l <= e.ButtonState.GROUP && o.currentState === e.ButtonState.HOVER && (o.imgHover && (o.imgHover.style.visibility = "hidden"), o.currentState = e.ButtonState.GROUP), l <= e.ButtonState.REST && o.currentState === e.ButtonState.GROUP && (i(o), o.currentState = e.ButtonState.REST));
7275
7275
  }
7276
- }(R), function(e) {
7276
+ }(S), function(e) {
7277
7277
  e.ButtonGroup = function(t) {
7278
7278
  e.extend(!0, this, {
7279
7279
  /**
@@ -7343,7 +7343,7 @@ function Ve() {
7343
7343
  this.tracker.destroy(), this.element = null;
7344
7344
  }
7345
7345
  };
7346
- }(R), function(e) {
7346
+ }(S), function(e) {
7347
7347
  e.Rect = function(t, n, i, r, a) {
7348
7348
  this.x = typeof t == "number" ? t : 0, this.y = typeof n == "number" ? n : 0, this.width = typeof i == "number" ? i : 0, this.height = typeof r == "number" ? r : 0, this.degrees = typeof a == "number" ? a : 0, this.degrees = e.positiveModulo(this.degrees, 360);
7349
7349
  var s, o;
@@ -7531,28 +7531,28 @@ 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 S = w[E], O = F(
7534
+ var R = w[E], M = D(
7535
7535
  x[0],
7536
7536
  x[1],
7537
- S[0],
7538
- S[1]
7537
+ R[0],
7538
+ R[1]
7539
7539
  );
7540
- O && i.push(O);
7540
+ M && i.push(M);
7541
7541
  }
7542
- function F(k, K, ie, ee) {
7543
- var te = K.minus(k), re = ee.minus(ie), ne = -re.x * te.y + te.x * re.y;
7542
+ function D(k, X, $, te) {
7543
+ var ie = X.minus(k), re = te.minus($), ne = -re.x * ie.y + ie.x * re.y;
7544
7544
  if (ne === 0)
7545
7545
  return null;
7546
- var oe = (te.x * (k.y - ie.y) - te.y * (k.x - ie.x)) / ne, ae = (re.x * (k.y - ie.y) - re.y * (k.x - ie.x)) / ne;
7547
- return -1e-10 <= oe && oe <= 1 - n && -1e-10 <= ae && ae <= 1 - n ? new e.Point(k.x + ae * te.x, k.y + ae * te.y) : null;
7546
+ var oe = (ie.x * (k.y - $.y) - ie.y * (k.x - $.x)) / ne, ae = (re.x * (k.y - $.y) - re.y * (k.x - $.x)) / ne;
7547
+ return -1e-10 <= oe && oe <= 1 - n && -1e-10 <= ae && ae <= 1 - n ? new e.Point(k.x + ae * ie.x, k.y + ae * ie.y) : null;
7548
7548
  }
7549
7549
  if (i.length === 0)
7550
7550
  return null;
7551
- for (var A = i[0].x, U = i[0].x, G = i[0].y, V = i[0].y, X = 1; X < i.length; X++) {
7552
- var q = i[X];
7553
- q.x < A && (A = q.x), q.x > U && (U = q.x), q.y < G && (G = q.y), q.y > V && (V = q.y);
7551
+ for (var O = i[0].x, A = i[0].x, z = i[0].y, V = i[0].y, K = 1; K < i.length; K++) {
7552
+ var j = i[K];
7553
+ j.x < O && (O = j.x), j.x > A && (A = j.x), j.y < z && (z = j.y), j.y > V && (V = j.y);
7554
7554
  }
7555
- return new e.Rect(A, G, U - A, V - G);
7555
+ return new e.Rect(O, z, A - O, V - z);
7556
7556
  },
7557
7557
  // private
7558
7558
  _getSegments: function() {
@@ -7638,7 +7638,7 @@ function Ve() {
7638
7638
  return "[" + Math.round(this.x * 100) / 100 + ", " + Math.round(this.y * 100) / 100 + ", " + Math.round(this.width * 100) / 100 + "x" + Math.round(this.height * 100) / 100 + ", " + Math.round(this.degrees * 100) / 100 + "deg]";
7639
7639
  }
7640
7640
  };
7641
- }(R), function(e) {
7641
+ }(S), function(e) {
7642
7642
  var t = {};
7643
7643
  e.ReferenceStrip = function(d) {
7644
7644
  var f = this, v = d.viewer, w = e.getElementSize(v.element), T, x, E;
@@ -7661,8 +7661,8 @@ function Ve() {
7661
7661
  leaveHandler: e.delegate(this, o),
7662
7662
  keyDownHandler: e.delegate(this, l),
7663
7663
  keyHandler: e.delegate(this, h),
7664
- preProcessEventHandler: function(S) {
7665
- S.eventType === "wheel" && (S.preventDefault = !0);
7664
+ preProcessEventHandler: function(R) {
7665
+ R.eventType === "wheel" && (R.preventDefault = !0);
7666
7666
  }
7667
7667
  }), d.width && d.height ? (this.element.style.width = d.width + "px", this.element.style.height = d.height + "px", v.addControl(
7668
7668
  this.element,
@@ -7681,8 +7681,8 @@ function Ve() {
7681
7681
  * @function
7682
7682
  */
7683
7683
  setFocus: function(d) {
7684
- var f = this.element.querySelector("#" + this.element.id + "-" + d), v = e.getElementSize(this.viewer.canvas), w = Number(this.element.style.width.replace("px", "")), T = Number(this.element.style.height.replace("px", "")), x = -Number(this.element.style.marginLeft.replace("px", "")), E = -Number(this.element.style.marginTop.replace("px", "")), S;
7685
- this.currentSelected !== f && (this.currentSelected && (this.currentSelected.style.background = "#000"), this.currentSelected = f, this.currentSelected.style.background = "#999", this.scroll === "horizontal" ? (S = Number(d) * (this.panelWidth + 3), S > x + v.x - this.panelWidth ? (S = Math.min(S, w - v.x), this.element.style.marginLeft = -S + "px", a(this, v.x, -S)) : S < x && (S = Math.max(0, S - v.x / 2), this.element.style.marginLeft = -S + "px", a(this, v.x, -S))) : (S = Number(d) * (this.panelHeight + 3), S > E + v.y - this.panelHeight ? (S = Math.min(S, T - v.y), this.element.style.marginTop = -S + "px", a(this, v.y, -S)) : S < E && (S = Math.max(0, S - v.y / 2), this.element.style.marginTop = -S + "px", a(this, v.y, -S))), this.currentPage = d, s.call(this, { eventSource: this.tracker }));
7684
+ var f = this.element.querySelector("#" + this.element.id + "-" + d), v = e.getElementSize(this.viewer.canvas), w = Number(this.element.style.width.replace("px", "")), T = Number(this.element.style.height.replace("px", "")), x = -Number(this.element.style.marginLeft.replace("px", "")), E = -Number(this.element.style.marginTop.replace("px", "")), R;
7685
+ this.currentSelected !== f && (this.currentSelected && (this.currentSelected.style.background = "#000"), this.currentSelected = f, this.currentSelected.style.background = "#999", this.scroll === "horizontal" ? (R = Number(d) * (this.panelWidth + 3), R > x + v.x - this.panelWidth ? (R = Math.min(R, w - v.x), this.element.style.marginLeft = -R + "px", a(this, v.x, -R)) : R < x && (R = Math.max(0, R - v.x / 2), this.element.style.marginLeft = -R + "px", a(this, v.x, -R))) : (R = Number(d) * (this.panelHeight + 3), R > E + v.y - this.panelHeight ? (R = Math.min(R, T - v.y), this.element.style.marginTop = -R + "px", a(this, v.y, -R)) : R < E && (R = Math.max(0, R - v.y / 2), this.element.style.marginTop = -R + "px", a(this, v.y, -R))), this.currentPage = d, s.call(this, { eventSource: this.tracker }));
7686
7686
  },
7687
7687
  /**
7688
7688
  * @function
@@ -7717,17 +7717,17 @@ function Ve() {
7717
7717
  }
7718
7718
  }
7719
7719
  function a(d, f, v) {
7720
- var w, T, x, E, S, O;
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, S = T; S < x && S < d.panels.length; S++)
7722
- if (O = d.panels[S], !O.activePanel) {
7723
- var F, A = d.viewer.tileSources[S];
7724
- A.referenceStripThumbnailUrl ? F = {
7720
+ var w, T, x, E, R, M;
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, R = T; R < x && R < d.panels.length; R++)
7722
+ if (M = d.panels[R], !M.activePanel) {
7723
+ var D, O = d.viewer.tileSources[R];
7724
+ O.referenceStripThumbnailUrl ? D = {
7725
7725
  type: "image",
7726
- url: A.referenceStripThumbnailUrl
7727
- } : F = A, E = new e.Viewer({
7728
- id: O.id,
7729
- tileSources: [F],
7730
- element: O,
7726
+ url: O.referenceStripThumbnailUrl
7727
+ } : D = O, E = new e.Viewer({
7728
+ id: M.id,
7729
+ tileSources: [D],
7730
+ element: M,
7731
7731
  navigatorSizeRatio: d.sizeRatio,
7732
7732
  showNavigator: !1,
7733
7733
  mouseNavEnabled: !1,
@@ -7740,7 +7740,7 @@ function Ve() {
7740
7740
  ajaxHeaders: d.viewer.ajaxHeaders,
7741
7741
  drawer: "canvas"
7742
7742
  //always use canvas for the reference strip
7743
- }), e.setElementPointerEventsNone(E.canvas), e.setElementPointerEventsNone(E.container), E.innerTracker.setTracking(!1), E.outerTracker.setTracking(!1), d.miniViewers[O.id] = E, O.activePanel = !0;
7743
+ }), e.setElementPointerEventsNone(E.canvas), e.setElementPointerEventsNone(E.container), E.innerTracker.setTracking(!1), E.outerTracker.setTracking(!1), d.miniViewers[M.id] = E, M.activePanel = !0;
7744
7744
  }
7745
7745
  }
7746
7746
  function s(d) {
@@ -7807,11 +7807,11 @@ function Ve() {
7807
7807
  else
7808
7808
  d.preventDefault = !1;
7809
7809
  }
7810
- }(R), function(e) {
7810
+ }(S), function(e) {
7811
7811
  e.DisplayRect = function(t, n, i, r, a, s) {
7812
7812
  e.Rect.apply(this, [t, n, i, r]), this.minLevel = a, this.maxLevel = s;
7813
7813
  }, e.extend(e.DisplayRect.prototype, e.Rect.prototype);
7814
- }(R), function(e) {
7814
+ }(S), function(e) {
7815
7815
  e.Spring = function(n) {
7816
7816
  var i = arguments;
7817
7817
  typeof n != "object" && (n = {
@@ -7916,7 +7916,7 @@ function Ve() {
7916
7916
  function t(n, i) {
7917
7917
  return (1 - Math.exp(n * -i)) / (1 - Math.exp(-n));
7918
7918
  }
7919
- }(R), function(e) {
7919
+ }(S), function(e) {
7920
7920
  e.ImageJob = function(n) {
7921
7921
  e.extend(!0, this, {
7922
7922
  timeout: e.DEFAULT_SETTINGS.timeout,
@@ -8020,9 +8020,9 @@ function Ve() {
8020
8020
  a.start();
8021
8021
  }, n.tileRetryDelay), n.jobsInProgress++), r(i.data, i.errorMsg, i.request);
8022
8022
  }
8023
- }(R), function(e) {
8023
+ }(S), function(e) {
8024
8024
  e.Tile = function(t, n, i, r, a, s, o, l, h, d, f, v) {
8025
- this.level = t, this.x = n, this.y = i, this.bounds = r, this.positionedBounds = new R.Rect(r.x, r.y, r.width, r.height), this.sourceBounds = d, this.exists = a, this._url = s, this.postData = f, this.context2D = o, this.loadWithAjax = l, this.ajaxHeaders = h, v === void 0 && (e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."), v = e.TileSource.prototype.getTileHashKey(t, n, i, s, h, f)), this.cacheKey = v, this.loaded = !1, this.loading = !1, this.element = null, this.imgElement = null, this.style = null, this.position = null, this.size = null, this.flipped = !1, this.blendStart = null, this.opacity = null, this.squaredDistance = null, this.visibility = null, this.hasTransparency = !1, this.beingDrawn = !1, this.lastTouchTime = 0, this.isRightMost = !1, this.isBottomMost = !1;
8025
+ this.level = t, this.x = n, this.y = i, this.bounds = r, this.positionedBounds = new S.Rect(r.x, r.y, r.width, r.height), this.sourceBounds = d, this.exists = a, this._url = s, this.postData = f, this.context2D = o, this.loadWithAjax = l, this.ajaxHeaders = h, v === void 0 && (e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."), v = e.TileSource.prototype.getTileHashKey(t, n, i, s, h, f)), this.cacheKey = v, this.loaded = !1, this.loading = !1, this.element = null, this.imgElement = null, this.style = null, this.position = null, this.size = null, this.flipped = !1, this.blendStart = null, this.opacity = null, this.squaredDistance = null, this.visibility = null, this.hasTransparency = !1, this.beingDrawn = !1, this.lastTouchTime = 0, this.isRightMost = !1, this.isBottomMost = !1;
8026
8026
  }, e.Tile.prototype = {
8027
8027
  /**
8028
8028
  * Provides a string representation of this tiles level and (x,y)
@@ -8120,7 +8120,7 @@ function Ve() {
8120
8120
  this.imgElement && this.imgElement.parentNode && this.imgElement.parentNode.removeChild(this.imgElement), this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element), this.element = null, this.imgElement = null, this.loaded = !1, this.loading = !1;
8121
8121
  }
8122
8122
  };
8123
- }(R), function(e) {
8123
+ }(S), function(e) {
8124
8124
  e.OverlayPlacement = e.Placement, e.OverlayRotationMode = e.freezeObject({
8125
8125
  NO_ROTATION: 1,
8126
8126
  EXACT: 2,
@@ -8303,7 +8303,7 @@ function Ve() {
8303
8303
  );
8304
8304
  }
8305
8305
  };
8306
- }(R), function(e) {
8306
+ }(S), function(e) {
8307
8307
  const t = e;
8308
8308
  t.DrawerBase = class {
8309
8309
  constructor(i) {
@@ -8472,7 +8472,7 @@ function Ve() {
8472
8472
  });
8473
8473
  }
8474
8474
  };
8475
- }(R), function(e) {
8475
+ }(S), function(e) {
8476
8476
  const t = e;
8477
8477
  class n extends t.DrawerBase {
8478
8478
  constructor(r) {
@@ -8593,7 +8593,7 @@ function Ve() {
8593
8593
  }
8594
8594
  }
8595
8595
  e.HTMLDrawer = n;
8596
- }(R), function(e) {
8596
+ }(S), function(e) {
8597
8597
  const t = e;
8598
8598
  class n extends t.DrawerBase {
8599
8599
  constructor(l) {
@@ -8734,45 +8734,45 @@ function Ve() {
8734
8734
  f && (v || (E = this.viewport.viewportToViewerElementRectangle(
8735
8735
  l.getClippedBounds(!0)
8736
8736
  ).getIntegerBoundingBox(), E = E.times(e.pixelDensityRatio)), this._clear(!0, E)), v || this._setRotations(l, f);
8737
- var S = !1;
8737
+ var R = !1;
8738
8738
  if (l._clip) {
8739
8739
  this._saveContext(f);
8740
- var O = l.imageToViewportRectangle(l._clip, !0);
8741
- O = O.rotate(-l.getRotation(!0), l._getRotationPoint(!0));
8742
- var F = this.viewportToDrawerRectangle(O);
8743
- v && (F = F.times(v)), w && (F = F.translate(w)), this._setClip(F, f), S = !0;
8740
+ var M = l.imageToViewportRectangle(l._clip, !0);
8741
+ M = M.rotate(-l.getRotation(!0), l._getRotationPoint(!0));
8742
+ var D = this.viewportToDrawerRectangle(M);
8743
+ v && (D = D.times(v)), w && (D = D.translate(w)), this._setClip(D, f), R = !0;
8744
8744
  }
8745
8745
  if (l._croppingPolygons) {
8746
- var A = this;
8747
- S || this._saveContext(f);
8746
+ var O = this;
8747
+ R || this._saveContext(f);
8748
8748
  try {
8749
- var U = l._croppingPolygons.map(function(k) {
8750
- return k.map(function(K) {
8751
- var ie = l.imageToViewportCoordinates(K.x, K.y, !0).rotate(-l.getRotation(!0), l._getRotationPoint(!0)), ee = A.viewportCoordToDrawerCoord(ie);
8752
- return v && (ee = ee.times(v)), w && (ee = ee.plus(w)), ee;
8749
+ var A = l._croppingPolygons.map(function(k) {
8750
+ return k.map(function(X) {
8751
+ var $ = l.imageToViewportCoordinates(X.x, X.y, !0).rotate(-l.getRotation(!0), l._getRotationPoint(!0)), te = O.viewportCoordToDrawerCoord($);
8752
+ return v && (te = te.times(v)), w && (te = te.plus(w)), te;
8753
8753
  });
8754
8754
  });
8755
- this._clipWithPolygons(U, f);
8755
+ this._clipWithPolygons(A, f);
8756
8756
  } catch (k) {
8757
8757
  e.console.error(k);
8758
8758
  }
8759
- S = !0;
8759
+ R = !0;
8760
8760
  }
8761
8761
  if (l._hasOpaqueTile = !1, l.placeholderFillStyle && l._hasOpaqueTile === !1) {
8762
8762
  let k = this.viewportToDrawerRectangle(l.getBoundsNoRotate(!0));
8763
8763
  v && (k = k.times(v)), w && (k = k.translate(w));
8764
- let K = null;
8765
- typeof l.placeholderFillStyle == "function" ? K = l.placeholderFillStyle(l, this.context) : K = l.placeholderFillStyle, this._drawRectangle(k, K, f);
8764
+ let X = null;
8765
+ typeof l.placeholderFillStyle == "function" ? X = l.placeholderFillStyle(l, this.context) : X = l.placeholderFillStyle, this._drawRectangle(k, X, f);
8766
8766
  }
8767
- var G = s(l.subPixelRoundingForTransparency), V = !1;
8768
- if (G === e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)
8767
+ var z = s(l.subPixelRoundingForTransparency), V = !1;
8768
+ if (z === e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)
8769
8769
  V = !0;
8770
- else if (G === e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST) {
8771
- var X = this.viewer && this.viewer.isAnimating();
8772
- V = !X;
8770
+ else if (z === e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST) {
8771
+ var K = this.viewer && this.viewer.isAnimating();
8772
+ V = !K;
8773
8773
  }
8774
- for (var q = 0; q < h.length; q++)
8775
- d = h[q], this._drawTile(
8774
+ for (var j = 0; j < h.length; j++)
8775
+ d = h[j], this._drawTile(
8776
8776
  d,
8777
8777
  l,
8778
8778
  f,
@@ -8784,7 +8784,7 @@ function Ve() {
8784
8784
  tiledImage: l,
8785
8785
  tile: d
8786
8786
  });
8787
- S && this._restoreContext(f), v || (l.getRotation(!0) % 360 !== 0 && this._restoreRotationChanges(f), this.viewport.getRotation(!0) % 360 !== 0 && this._restoreRotationChanges(f)), f && (v && this._setRotations(l), this.blendSketch({
8787
+ R && this._restoreContext(f), v || (l.getRotation(!0) % 360 !== 0 && this._restoreRotationChanges(f), this.viewport.getRotation(!0) % 360 !== 0 && this._restoreRotationChanges(f)), f && (v && this._setRotations(l), this.blendSketch({
8788
8788
  opacity: l.opacity,
8789
8789
  scale: v,
8790
8790
  translate: w,
@@ -8860,7 +8860,7 @@ function Ve() {
8860
8860
  * @param {OpenSeadragon.TileSource} source - The source specification of the tile.
8861
8861
  */
8862
8862
  _drawTileToCanvas(l, h, d, f, v, w, T) {
8863
- var x = l.position.times(e.pixelDensityRatio), E = l.size.times(e.pixelDensityRatio), S;
8863
+ var x = l.position.times(e.pixelDensityRatio), E = l.size.times(e.pixelDensityRatio), R;
8864
8864
  if (!l.context2D && !l.cacheImageRecord) {
8865
8865
  e.console.warn(
8866
8866
  "[Drawer._drawTileToCanvas] attempting to draw tile %s when it's not cached",
@@ -8868,7 +8868,7 @@ function Ve() {
8868
8868
  );
8869
8869
  return;
8870
8870
  }
8871
- if (S = l.getCanvasContext(), !l.loaded || !S) {
8871
+ if (R = l.getCanvasContext(), !l.loaded || !R) {
8872
8872
  e.console.warn(
8873
8873
  "Attempting to draw tile %s when it's not yet loaded.",
8874
8874
  l.toString()
@@ -8880,14 +8880,14 @@ function Ve() {
8880
8880
  x.y,
8881
8881
  E.x,
8882
8882
  E.y
8883
- )), this._raiseTileDrawingEvent(d, h, l, S);
8884
- var O, F;
8885
- l.sourceBounds ? (O = Math.min(l.sourceBounds.width, S.canvas.width), F = Math.min(l.sourceBounds.height, S.canvas.height)) : (O = S.canvas.width, F = S.canvas.height), h.translate(x.x + E.x / 2, 0), l.flipped && h.scale(-1, 1), h.drawImage(
8886
- S.canvas,
8883
+ )), this._raiseTileDrawingEvent(d, h, l, R);
8884
+ var M, D;
8885
+ l.sourceBounds ? (M = Math.min(l.sourceBounds.width, R.canvas.width), D = Math.min(l.sourceBounds.height, R.canvas.height)) : (M = R.canvas.width, D = R.canvas.height), h.translate(x.x + E.x / 2, 0), l.flipped && h.scale(-1, 1), h.drawImage(
8886
+ R.canvas,
8887
8887
  0,
8888
8888
  0,
8889
- O,
8890
- F,
8889
+ M,
8890
+ D,
8891
8891
  -E.x / 2,
8892
8892
  x.y,
8893
8893
  E.x,
@@ -8990,8 +8990,8 @@ function Ve() {
8990
8990
  h = v.scale || 1, d = v.translate;
8991
8991
  var T = d instanceof e.Point ? d : new e.Point(0, 0), x = 0, E = 0;
8992
8992
  if (d) {
8993
- var S = this.sketchCanvas.width - this.canvas.width, O = this.sketchCanvas.height - this.canvas.height;
8994
- x = Math.round(S / 2), E = Math.round(O / 2);
8993
+ var R = this.sketchCanvas.width - this.canvas.width, M = this.sketchCanvas.height - this.canvas.height;
8994
+ x = Math.round(R / 2), E = Math.round(M / 2);
8995
8995
  }
8996
8996
  this.context.drawImage(
8997
8997
  this.sketchCanvas,
@@ -9153,7 +9153,7 @@ function Ve() {
9153
9153
  var l = o[e.Browser.vendor];
9154
9154
  return r(l) && (l = o["*"]), a(l);
9155
9155
  }
9156
- }(R), function(e) {
9156
+ }(S), function(e) {
9157
9157
  const t = e;
9158
9158
  t.WebGLDrawer = class extends t.DrawerBase {
9159
9159
  constructor(i) {
@@ -9246,29 +9246,29 @@ function Ve() {
9246
9246
  let x = w.getTilesToDraw();
9247
9247
  if (w.placeholderFillStyle && w._hasOpaqueTile === !1 && this._drawPlaceholder(w), x.length === 0 || w.getOpacity() === 0)
9248
9248
  return;
9249
- let E = x[0], S = w.compositeOperation || this.viewer.compositeOperation || w._clip || w._croppingPolygons || w.debugMode, O = S || w.opacity < 1 || E.hasTransparency;
9250
- S && (v && this._outputContext.drawImage(this._renderingCanvas, 0, 0), r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), r.useProgram(this._firstPass.shaderProgram), O ? (r.bindFramebuffer(r.FRAMEBUFFER, this._glFrameBuffer), r.clear(r.COLOR_BUFFER_BIT)) : r.bindFramebuffer(r.FRAMEBUFFER, null);
9251
- let F = f, A = w.getRotation(!0);
9252
- if (A % 360 !== 0) {
9253
- let k = e.Mat3.makeRotation(-A * Math.PI / 180), K = w.getBoundsNoRotate(!0).getCenter(), ie = e.Mat3.makeTranslation(K.x, K.y), ee = e.Mat3.makeTranslation(-K.x, -K.y), te = ie.multiply(k).multiply(ee);
9254
- F = f.multiply(te);
9249
+ let E = x[0], R = w.compositeOperation || this.viewer.compositeOperation || w._clip || w._croppingPolygons || w.debugMode, M = R || w.opacity < 1 || E.hasTransparency;
9250
+ R && (v && this._outputContext.drawImage(this._renderingCanvas, 0, 0), r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), r.useProgram(this._firstPass.shaderProgram), M ? (r.bindFramebuffer(r.FRAMEBUFFER, this._glFrameBuffer), r.clear(r.COLOR_BUFFER_BIT)) : r.bindFramebuffer(r.FRAMEBUFFER, null);
9251
+ let D = f, O = w.getRotation(!0);
9252
+ if (O % 360 !== 0) {
9253
+ let k = e.Mat3.makeRotation(-O * Math.PI / 180), X = w.getBoundsNoRotate(!0).getCenter(), $ = e.Mat3.makeTranslation(X.x, X.y), te = e.Mat3.makeTranslation(-X.x, -X.y), ie = $.multiply(k).multiply(te);
9254
+ D = f.multiply(ie);
9255
9255
  }
9256
- let U = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);
9257
- if (U <= 0)
9258
- throw new Error(`WegGL error: bad value for gl parameter MAX_TEXTURE_IMAGE_UNITS (${U}). This could happen
9256
+ let A = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);
9257
+ if (A <= 0)
9258
+ throw new Error(`WegGL error: bad value for gl parameter MAX_TEXTURE_IMAGE_UNITS (${A}). 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 G = new Float32Array(U * 12), V = new Array(U), X = new Array(U), q = new Array(U);
9260
+ let z = new Float32Array(A * 12), V = new Array(A), K = new Array(A), j = new Array(A);
9261
9261
  for (let k = 0; k < x.length; k++) {
9262
- let K = x[k].tile, ie = k % U, ee = ie + 1, te = K.getCanvasContext(), re = te ? this._TextureMap.get(te.canvas) : null;
9263
- if (re || (this._tileReadyHandler({ tile: K, tiledImage: w }), re = te ? this._TextureMap.get(te.canvas) : null), re && this._getTileData(K, w, re, F, ie, G, V, X, q), ee === U || k === x.length - 1) {
9264
- for (let ne = 0; ne <= ee; ne++)
9262
+ let X = x[k].tile, $ = k % A, te = $ + 1, ie = X.getCanvasContext(), re = ie ? this._TextureMap.get(ie.canvas) : null;
9263
+ if (re || (this._tileReadyHandler({ tile: X, tiledImage: w }), re = ie ? this._TextureMap.get(ie.canvas) : null), re && this._getTileData(X, w, re, D, $, z, V, K, j), te === A || k === x.length - 1) {
9264
+ for (let ne = 0; ne <= te; ne++)
9265
9265
  r.activeTexture(r.TEXTURE0 + ne), r.bindTexture(r.TEXTURE_2D, V[ne]);
9266
- r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.bufferData(r.ARRAY_BUFFER, G, r.DYNAMIC_DRAW), X.forEach((ne, oe) => {
9266
+ r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.bufferData(r.ARRAY_BUFFER, z, r.DYNAMIC_DRAW), K.forEach((ne, oe) => {
9267
9267
  r.uniformMatrix3fv(this._firstPass.uTransformMatrices[oe], !1, ne);
9268
- }), r.uniform1fv(this._firstPass.uOpacities, new Float32Array(q)), 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 * ee);
9268
+ }), r.uniform1fv(this._firstPass.uOpacities, new Float32Array(j)), 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 * te);
9269
9269
  }
9270
9270
  }
9271
- O && (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, S && (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((k) => k.tile));
9271
+ M && (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, R && (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((k) => k.tile));
9272
9272
  }
9273
9273
  }), v && this._outputContext.drawImage(this._renderingCanvas, 0, 0);
9274
9274
  }
@@ -9314,23 +9314,23 @@ 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, S = i.positionedBounds.x + (i.x === 0 ? 0 : x), O = i.positionedBounds.y + (i.y === 0 ? 0 : E), F = i.positionedBounds.x + i.positionedBounds.width - (i.isRightMost ? 0 : x), A = i.positionedBounds.y + i.positionedBounds.height - (i.isBottomMost ? 0 : E), U = F - S, G = A - O, V = new e.Mat3([
9318
- U,
9317
+ let T = this._calculateOverlapFraction(i, r), x = i.positionedBounds.width * T.x, E = i.positionedBounds.height * T.y, R = i.positionedBounds.x + (i.x === 0 ? 0 : x), M = i.positionedBounds.y + (i.y === 0 ? 0 : E), D = i.positionedBounds.x + i.positionedBounds.width - (i.isRightMost ? 0 : x), O = i.positionedBounds.y + i.positionedBounds.height - (i.isBottomMost ? 0 : E), A = D - R, z = O - M, V = new e.Mat3([
9318
+ A,
9319
9319
  0,
9320
9320
  0,
9321
9321
  0,
9322
- G,
9322
+ z,
9323
9323
  0,
9324
- S,
9325
- O,
9324
+ R,
9325
+ M,
9326
9326
  1
9327
9327
  ]);
9328
9328
  if (i.flipped) {
9329
- let q = e.Mat3.makeTranslation(0.5, 0), k = e.Mat3.makeTranslation(-0.5, 0), K = q.multiply(e.Mat3.makeScaling(-1, 1)).multiply(k);
9330
- V = V.multiply(K);
9329
+ let j = e.Mat3.makeTranslation(0.5, 0), k = e.Mat3.makeTranslation(-0.5, 0), X = j.multiply(e.Mat3.makeScaling(-1, 1)).multiply(k);
9330
+ V = V.multiply(X);
9331
9331
  }
9332
- let X = s.multiply(V);
9333
- f[o] = i.opacity, h[o] = v, d[o] = X.values;
9332
+ let K = s.multiply(V);
9333
+ f[o] = i.opacity, h[o] = v, d[o] = K.values;
9334
9334
  }
9335
9335
  // private
9336
9336
  _textureFilter() {
@@ -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), S = (r.x === 0 ? 0 : E.x) * w, O = (r.y === 0 ? 0 : E.y) * T, F = (r.isRightMost ? 1 : 1 - E.x) * w, A = (r.isBottomMost ? 1 : 1 - E.y) * T;
9511
- f = this._makeQuadVertexBuffer(S, F, O, A);
9510
+ let E = this._calculateOverlapFraction(r, a), R = (r.x === 0 ? 0 : E.x) * w, M = (r.y === 0 ? 0 : E.y) * T, D = (r.isRightMost ? 1 : 1 - E.x) * w, O = (r.isBottomMost ? 1 : 1 - E.y) * T;
9511
+ f = this._makeQuadVertexBuffer(R, D, M, O);
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,
@@ -9713,7 +9713,7 @@ function Ve() {
9713
9713
  ), null);
9714
9714
  }
9715
9715
  };
9716
- }(R), function(e) {
9716
+ }(S), function(e) {
9717
9717
  e.Viewport = function(t) {
9718
9718
  var n = arguments;
9719
9719
  n.length && n[0] instanceof e.Point && (t = {
@@ -9998,8 +9998,8 @@ function Ve() {
9998
9998
  var f = n.y + n.height, v = i.y + i.height, w, T, x;
9999
9999
  n.height > i.height ? w = this.visibilityRatio * i.height : w = this.visibilityRatio * n.height, T = i.y - f + w, x = v - n.y - w, w > i.height ? (n.y += (T + x) / 2, a = !0) : x < 0 ? (n.y += x, a = !0) : T > 0 && (n.y += T, a = !0);
10000
10000
  }
10001
- var E = r || a, S = E ? this.viewerElementToViewportRectangle(n) : t.clone();
10002
- return S.xConstrained = r, S.yConstrained = a, S.constraintApplied = E, S;
10001
+ var E = r || a, R = E ? this.viewerElementToViewportRectangle(n) : t.clone();
10002
+ return R.xConstrained = r, R.yConstrained = a, R.constraintApplied = E, R;
10003
10003
  },
10004
10004
  /**
10005
10005
  * @function
@@ -10848,7 +10848,7 @@ function Ve() {
10848
10848
  e.console.assert(!isNaN(t), "[Viewport.setMaxZoomPixelRatio] ratio must be a number"), !isNaN(t) && (this.maxZoomPixelRatio = t, n && this.getZoom() > this.getMaxZoom() && this.applyConstraints(i));
10849
10849
  }
10850
10850
  };
10851
- }(R), function(e) {
10851
+ }(S), function(e) {
10852
10852
  e.TiledImage = function(t) {
10853
10853
  this._initialized = !1, e.console.assert(t.tileCache, "[TiledImage] options.tileCache is required"), e.console.assert(t.drawer, "[TiledImage] options.drawer is required"), e.console.assert(t.viewer, "[TiledImage] options.viewer is required"), e.console.assert(t.imageLoader, "[TiledImage] options.imageLoader is required"), e.console.assert(t.source, "[TiledImage] options.source is required"), e.console.assert(
10854
10854
  !t.clip || t.clip instanceof e.Rect,
@@ -10862,7 +10862,7 @@ function Ve() {
10862
10862
  t.width ? (r = t.width, delete t.width, t.height && (e.console.error("specifying both width and height to a tiledImage is not supported"), delete t.height)) : t.height && (r = t.height / this.normHeight, delete t.height);
10863
10863
  var a = t.fitBounds;
10864
10864
  delete t.fitBounds;
10865
- var s = t.fitBoundsPlacement || R.Placement.CENTER;
10865
+ var s = t.fitBoundsPlacement || S.Placement.CENTER;
10866
10866
  delete t.fitBoundsPlacement;
10867
10867
  var o = t.degrees || 0;
10868
10868
  delete t.degrees;
@@ -11214,7 +11214,7 @@ function Ve() {
11214
11214
  */
11215
11215
  windowToImageCoordinates: function(t) {
11216
11216
  var n = t.minus(
11217
- R.getElementPosition(this.viewer.element)
11217
+ S.getElementPosition(this.viewer.element)
11218
11218
  );
11219
11219
  return this.viewerElementToImageCoordinates(n);
11220
11220
  },
@@ -11226,7 +11226,7 @@ function Ve() {
11226
11226
  imageToWindowCoordinates: function(t) {
11227
11227
  var n = this.imageToViewerElementCoordinates(t);
11228
11228
  return n.plus(
11229
- R.getElementPosition(this.viewer.element)
11229
+ S.getElementPosition(this.viewer.element)
11230
11230
  );
11231
11231
  },
11232
11232
  // private
@@ -11648,33 +11648,33 @@ 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((F) => {
11652
- F.tile.beingDrawn = !1;
11651
+ if (this._lastDrawn.forEach((D) => {
11652
+ D.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 F = 0, A = i; A >= n; A--, F++)
11657
- o[F] = A;
11658
- for (let F = i + 1; F <= this.source.maxLevel; F++) {
11659
- var l = this.tilesMatrix[F] && this.tilesMatrix[F][0] && this.tilesMatrix[F][0][0];
11656
+ for (let D = 0, O = i; O >= n; O--, D++)
11657
+ o[D] = O;
11658
+ for (let D = i + 1; D <= this.source.maxLevel; D++) {
11659
+ var l = this.tilesMatrix[D] && this.tilesMatrix[D][0] && this.tilesMatrix[D][0][0];
11660
11660
  if (l && l.isBottomMost && l.isRightMost && l.loaded) {
11661
- o.push(F);
11661
+ o.push(D);
11662
11662
  break;
11663
11663
  }
11664
11664
  }
11665
11665
  let h = !1;
11666
- for (let F = 0; F < o.length; F++) {
11667
- let A = o[F];
11666
+ for (let D = 0; D < o.length; D++) {
11667
+ let O = o[D];
11668
11668
  var d = this.viewport.deltaPixelsFromPointsNoRotate(
11669
- this.source.getPixelRatio(A),
11669
+ this.source.getPixelRatio(O),
11670
11670
  !0
11671
11671
  ).x * this._scaleSpring.current.value;
11672
- if (F === o.length - 1 || d >= this.minPixelRatio)
11672
+ if (D === o.length - 1 || d >= this.minPixelRatio)
11673
11673
  h = !0;
11674
11674
  else if (!h)
11675
11675
  continue;
11676
11676
  var f = this.viewport.deltaPixelsFromPointsNoRotate(
11677
- this.source.getPixelRatio(A),
11677
+ this.source.getPixelRatio(O),
11678
11678
  !1
11679
11679
  ).x * this._scaleSpring.current.value, v = this.viewport.deltaPixelsFromPointsNoRotate(
11680
11680
  this.source.getPixelRatio(
@@ -11687,7 +11687,7 @@ function Ve() {
11687
11687
  ).x * this._scaleSpring.current.value, w = this.immediateRender ? 1 : v, T = Math.min(1, (d - 0.5) / 0.5), x = w / Math.abs(
11688
11688
  w - f
11689
11689
  ), E = this._updateLevel(
11690
- A,
11690
+ O,
11691
11691
  T,
11692
11692
  x,
11693
11693
  a,
@@ -11695,21 +11695,21 @@ function Ve() {
11695
11695
  r
11696
11696
  );
11697
11697
  r = E.bestTiles;
11698
- var S = E.updatedTiles.filter((U) => U.loaded), O = /* @__PURE__ */ function(U, G, V) {
11699
- return function(X) {
11698
+ var R = E.updatedTiles.filter((A) => A.loaded), M = /* @__PURE__ */ function(A, z, V) {
11699
+ return function(K) {
11700
11700
  return {
11701
- tile: X,
11702
- level: U,
11703
- levelOpacity: G,
11701
+ tile: K,
11702
+ level: A,
11703
+ levelOpacity: z,
11704
11704
  currentTime: V
11705
11705
  };
11706
11706
  };
11707
- }(A, T, s);
11708
- if (this._tilesToDraw[A] = S.map(O), this._providesCoverage(this.coverage, A))
11707
+ }(O, T, s);
11708
+ if (this._tilesToDraw[O] = R.map(M), this._providesCoverage(this.coverage, O))
11709
11709
  break;
11710
11710
  }
11711
- return r && r.length > 0 ? (r.forEach(function(F) {
11712
- F && !F.context2D && this._loadTile(F, s);
11711
+ return r && r.length > 0 ? (r.forEach(function(D) {
11712
+ D && !D.context2D && this._loadTile(D, s);
11713
11713
  }, this), this._needsDraw = !0, !1) : this._tilesLoading === 0;
11714
11714
  },
11715
11715
  /**
@@ -11795,18 +11795,18 @@ function Ve() {
11795
11795
  }), this._resetCoverage(this.coverage, t), this._resetCoverage(this.loadingCoverage, t);
11796
11796
  var h = this._getCornerTiles(t, o, l), d = h.topLeft, f = h.bottomRight, v = this.source.getNumTiles(t), w = this.viewport.pixelFromPoint(this.viewport.getCenter());
11797
11797
  this.getFlip() && (f.x += 1, this.wrapHorizontal || (f.x = Math.min(f.x, v.x - 1)));
11798
- for (var T = Math.max(0, (f.x - d.x) * (f.y - d.y)), x = new Array(T), E = 0, S = d.x; S <= f.x; S++)
11799
- for (var O = d.y; O <= f.y; O++) {
11800
- var F;
11798
+ for (var T = Math.max(0, (f.x - d.x) * (f.y - d.y)), x = new Array(T), E = 0, R = d.x; R <= f.x; R++)
11799
+ for (var M = d.y; M <= f.y; M++) {
11800
+ var D;
11801
11801
  if (this.getFlip()) {
11802
- var A = (v.x + S % v.x) % v.x;
11803
- F = S + v.x - A - A - 1;
11802
+ var O = (v.x + R % v.x) % v.x;
11803
+ D = R + v.x - O - O - 1;
11804
11804
  } else
11805
- F = S;
11806
- if (r.intersection(this.getTileBounds(t, F, O)) !== null) {
11807
- var U = this._updateTile(
11808
- F,
11809
- O,
11805
+ D = R;
11806
+ if (r.intersection(this.getTileBounds(t, D, M)) !== null) {
11807
+ var A = this._updateTile(
11808
+ D,
11809
+ M,
11810
11810
  t,
11811
11811
  i,
11812
11812
  w,
@@ -11814,7 +11814,7 @@ function Ve() {
11814
11814
  a,
11815
11815
  s
11816
11816
  );
11817
- s = U.bestTiles, x[E] = U.tile, E += 1;
11817
+ s = A.bestTiles, x[E] = A.tile, E += 1;
11818
11818
  }
11819
11819
  }
11820
11820
  return {
@@ -11910,8 +11910,8 @@ function Ve() {
11910
11910
  * @returns {OpenSeadragon.Tile}
11911
11911
  */
11912
11912
  _getTile: function(t, n, i, r, a) {
11913
- var s, o, l, h, d, f, v, w, T, x, E = this.tilesMatrix, S = this.source;
11914
- return E[i] || (E[i] = {}), E[i][t] || (E[i][t] = {}), (!E[i][t][n] || !E[i][t][n].flipped != !this.flipped) && (s = (a.x + t % a.x) % a.x, o = (a.y + n % a.y) % a.y, l = this.getTileBounds(i, t, n), h = S.getTileBounds(i, s, o, !0), d = S.tileExists(i, s, o), f = S.getTileUrl(i, s, o), v = S.getTilePostData(i, s, o), this.loadTilesWithAjax ? (w = S.getTileAjaxHeaders(i, s, o), e.isPlainObject(this.ajaxHeaders) && (w = e.extend({}, this.ajaxHeaders, w))) : w = null, T = S.getContext2D ? S.getContext2D(i, s, o) : void 0, x = new e.Tile(
11913
+ var s, o, l, h, d, f, v, w, T, x, E = this.tilesMatrix, R = this.source;
11914
+ return E[i] || (E[i] = {}), E[i][t] || (E[i][t] = {}), (!E[i][t][n] || !E[i][t][n].flipped != !this.flipped) && (s = (a.x + t % a.x) % a.x, o = (a.y + n % a.y) % a.y, l = this.getTileBounds(i, t, n), h = R.getTileBounds(i, s, o, !0), d = R.tileExists(i, s, o), f = R.getTileUrl(i, s, o), v = R.getTilePostData(i, s, o), this.loadTilesWithAjax ? (w = R.getTileAjaxHeaders(i, s, o), e.isPlainObject(this.ajaxHeaders) && (w = e.extend({}, this.ajaxHeaders, w))) : w = null, T = R.getContext2D ? R.getContext2D(i, s, o) : void 0, x = new e.Tile(
11915
11915
  i,
11916
11916
  t,
11917
11917
  n,
@@ -11923,7 +11923,7 @@ function Ve() {
11923
11923
  w,
11924
11924
  h,
11925
11925
  v,
11926
- S.getTileHashKey(i, s, o, f, w, v)
11926
+ R.getTileHashKey(i, s, o, f, w, v)
11927
11927
  ), this.getFlip() ? s === 0 && (x.isRightMost = !0) : s === a.x - 1 && (x.isRightMost = !0), o === a.y - 1 && (x.isBottomMost = !0), x.flipped = this.flipped, E[i][t][n] = x), x = E[i][t][n], x.lastTouchTime = r, x;
11928
11928
  },
11929
11929
  /**
@@ -12130,7 +12130,7 @@ function Ve() {
12130
12130
  }
12131
12131
  }
12132
12132
  );
12133
- }(R), function(e) {
12133
+ }(S), function(e) {
12134
12134
  var t = function(i) {
12135
12135
  e.console.assert(i, "[TileCache.cacheTile] options is required"), e.console.assert(i.tile, "[TileCache.cacheTile] options.tile is required"), e.console.assert(i.tiledImage, "[TileCache.cacheTile] options.tiledImage is required"), this.tile = i.tile, this.tiledImage = i.tiledImage;
12136
12136
  }, n = function(i) {
@@ -12235,7 +12235,7 @@ function Ve() {
12235
12235
  }));
12236
12236
  }
12237
12237
  };
12238
- }(R), function(e) {
12238
+ }(S), function(e) {
12239
12239
  e.World = function(t) {
12240
12240
  var n = this;
12241
12241
  e.console.assert(t.viewer, "[World] options.viewer is required"), e.EventSource.call(this), this.viewer = t.viewer, this._items = [], this._needsDraw = !1, this._autoRefigureSizes = !0, this._needsSizesFigured = !1, this._delegatedFigureSizes = function(i) {
@@ -12404,8 +12404,8 @@ function Ve() {
12404
12404
  !t.rows && a ? h = a : h = Math.ceil(this._items.length / r);
12405
12405
  var d = 0, f = 0, v, w, T, x, E;
12406
12406
  this.setAutoRefigureSizes(!1);
12407
- for (var S = 0; S < this._items.length; S++)
12408
- S && S % h === 0 && (i === "horizontal" ? (f += l, d = 0) : (d += l, f = 0)), v = this._items[S], w = v.getBounds(), w.width > w.height ? T = s : T = s * (w.width / w.height), x = T * (w.height / w.width), E = new e.Point(
12407
+ for (var R = 0; R < this._items.length; R++)
12408
+ R && R % h === 0 && (i === "horizontal" ? (f += l, d = 0) : (d += l, f = 0)), v = this._items[R], w = v.getBounds(), w.width > w.height ? T = s : T = s * (w.width / w.height), x = T * (w.height / w.width), E = new e.Point(
12409
12409
  d + (s - T) / 2,
12410
12410
  f + (s - x) / 2
12411
12411
  ), v.setPosition(E, n), v.setWidth(T, n), i === "horizontal" ? d += l : f += l;
@@ -12437,29 +12437,29 @@ function Ve() {
12437
12437
  }
12438
12438
  }
12439
12439
  );
12440
- }(R);
12440
+ }(S);
12441
12441
  }(we)), we.exports;
12442
12442
  }
12443
12443
  var je = Ve();
12444
- const Ze = /* @__PURE__ */ Be(je), qe = (N, R = [255, 255, 255, 255], e = [0, 0, 0, 255]) => {
12445
- const t = N.masks, [n, i, r, a] = t.dims, s = N.iou_predictions.cpuData, o = s.indexOf(Math.max(...s));
12444
+ const Ze = /* @__PURE__ */ Be(je), qe = (W, S = [255, 255, 255, 255], e = [0, 0, 0, 255]) => {
12445
+ const t = W.masks, [n, i, r, a] = t.dims, s = W.iou_predictions.cpuData, o = s.indexOf(Math.max(...s));
12446
12446
  return He(
12447
12447
  Me(t, o),
12448
12448
  r,
12449
12449
  a,
12450
- R,
12450
+ S,
12451
12451
  e
12452
12452
  );
12453
- }, Xe = (N, R, e, t) => {
12454
- const n = qe(N), { offsetWidth: i, offsetHeight: r } = t.element, a = document.createElement("canvas");
12453
+ }, Xe = (W, S, e, t) => {
12454
+ const n = qe(W), { offsetWidth: i, offsetHeight: r } = t.element, a = document.createElement("canvas");
12455
12455
  a.width = i, a.height = r;
12456
- const s = Math.max(i, r) / 1024, o = R.currentBounds.x * s, l = R.currentBounds.y * s;
12456
+ const s = Math.max(i, r) / 1024, o = S.currentBounds.x * s, l = S.currentBounds.y * s;
12457
12457
  a.getContext("2d").drawImage(
12458
12458
  n,
12459
12459
  -o,
12460
12460
  -l,
12461
- s * R.currentBounds.w + 2 * o,
12462
- s * R.currentBounds.h + 2 * l
12461
+ s * S.currentBounds.w + 2 * o,
12462
+ s * S.currentBounds.h + 2 * l
12463
12463
  );
12464
12464
  const d = Ue(a).map((v) => {
12465
12465
  const w = t.viewport.pointFromPixel(new Ze.Point(v[0], v[1])), { x: T, y: x } = t.viewport.viewportToImageCoordinates(w.x, w.y);
@@ -12472,27 +12472,27 @@ const Ze = /* @__PURE__ */ Be(je), qe = (N, R = [255, 255, 255, 255], e = [0, 0,
12472
12472
  }
12473
12473
  };
12474
12474
  return {
12475
- id: R.currentAnnotationId,
12475
+ id: S.currentAnnotationId,
12476
12476
  bodies: [],
12477
12477
  target: {
12478
- annotation: R.currentAnnotationId,
12478
+ annotation: S.currentAnnotationId,
12479
12479
  selector: f,
12480
12480
  creator: e,
12481
12481
  created: /* @__PURE__ */ new Date()
12482
12482
  }
12483
12483
  };
12484
- }, Ye = (N, R) => {
12485
- N.addHandler("open", (e) => {
12486
- const t = N.world.getItemCount();
12487
- N.world.getItemAt(t - 1).addOnceHandler("fully-loaded-change", (i) => {
12484
+ }, Ye = (W, S) => {
12485
+ W.addHandler("open", (e) => {
12486
+ const t = W.world.getItemCount();
12487
+ W.world.getItemAt(t - 1).addOnceHandler("fully-loaded-change", (i) => {
12488
12488
  const { fullyLoaded: r } = i;
12489
- r && R();
12489
+ r && S();
12490
12490
  });
12491
12491
  });
12492
- }, De = (N) => {
12493
- const R = N.element.querySelector(".openseadragon-canvas");
12494
- if (!R) throw "[a9s-sam] Error creating overlay canvas";
12495
- const e = N.drawer.canvas, t = document.createElement("canvas");
12492
+ }, De = (W) => {
12493
+ const S = W.element.querySelector(".openseadragon-canvas");
12494
+ if (!S) throw "[a9s-sam] Error creating overlay canvas";
12495
+ const e = W.drawer.canvas, t = document.createElement("canvas");
12496
12496
  t.width = e.width, t.height = e.height;
12497
12497
  const n = t.getContext("2d");
12498
12498
  if (!n) throw "[a9s-sam] Error creating preview drawing context";
@@ -12502,70 +12502,70 @@ const Ze = /* @__PURE__ */ Be(je), qe = (N, R = [255, 255, 255, 255], e = [0, 0,
12502
12502
  } catch {
12503
12503
  console.warn("WebGL canvas already disposed");
12504
12504
  }
12505
- }).observe(e), R.appendChild(t), { canvas: t, ctx: n };
12506
- }, Ke = (N) => {
12507
- const { bounds: R, scale: e } = Le(
12508
- { h: N.height, w: N.width },
12505
+ }).observe(e), S.appendChild(t), { canvas: t, ctx: n };
12506
+ }, Ke = (W) => {
12507
+ const { bounds: S, scale: e } = Le(
12508
+ { h: W.height, w: W.width },
12509
12509
  { h: 1024, w: 1024 }
12510
12510
  ), t = document.createElement("canvas");
12511
12511
  return t.width = 1024, t.height = 1024, t.getContext("2d").drawImage(
12512
- N,
12512
+ W,
12513
12513
  0,
12514
12514
  0,
12515
- N.width,
12516
- N.height,
12517
- R.x,
12518
- R.y,
12519
- R.w,
12520
- R.h
12521
- ), { canvas: t, bounds: R, scale: e };
12522
- }, Qe = (N) => {
12523
- const { canvas: R, ctx: e } = De(N);
12524
- R.setAttribute("class", "a9s-sam a9s-osd-sam-preview"), R.style.display = "none";
12515
+ W.width,
12516
+ W.height,
12517
+ S.x,
12518
+ S.y,
12519
+ S.w,
12520
+ S.h
12521
+ ), { canvas: t, bounds: S, scale: e };
12522
+ }, Qe = (W) => {
12523
+ const { canvas: S, ctx: e } = De(W);
12524
+ S.setAttribute("class", "a9s-sam a9s-osd-sam-preview"), S.style.display = "none";
12525
12525
  const t = (s, o) => {
12526
- e.clearRect(0, 0, R.width, R.height);
12526
+ e.clearRect(0, 0, S.width, S.height);
12527
12527
  const l = Ie(
12528
12528
  s,
12529
12529
  o,
12530
12530
  [0, 114, 189, 255],
12531
12531
  [0, 0, 0, 0]
12532
12532
  );
12533
- e.drawImage(l, 0, 0, R.width, R.height);
12533
+ e.drawImage(l, 0, 0, S.width, S.height);
12534
12534
  }, n = () => {
12535
- R.style.display = null;
12535
+ S.style.display = null;
12536
12536
  }, i = () => {
12537
- r(), R.style.display = "none";
12537
+ r(), S.style.display = "none";
12538
12538
  }, r = () => {
12539
- e.clearRect(0, 0, R.width, R.height);
12539
+ e.clearRect(0, 0, S.width, S.height);
12540
12540
  };
12541
12541
  return {
12542
12542
  clear: r,
12543
12543
  destroy: () => {
12544
- R.remove();
12544
+ S.remove();
12545
12545
  },
12546
12546
  hide: i,
12547
12547
  render: t,
12548
12548
  show: n
12549
12549
  };
12550
- }, Je = window.devicePixelRatio || 1, $e = (N) => {
12551
- const { canvas: R, ctx: e } = De(N);
12552
- R.setAttribute("class", "a9s-sam a9s-osd-prompt-markers"), R.style.display = "none";
12550
+ }, Je = window.devicePixelRatio || 1, $e = (W) => {
12551
+ const { canvas: S, ctx: e } = De(W);
12552
+ S.setAttribute("class", "a9s-sam a9s-osd-prompt-markers"), S.style.display = "none";
12553
12553
  const t = (o, l, h, d) => {
12554
12554
  const f = (o.x - l.x) * h, v = (o.y - l.y) * h;
12555
12555
  e.beginPath(), e.arc(f, v, 5 * Je, 0, 2 * Math.PI, !1), e.fillStyle = d, e.fill(), e.lineWidth = 1, e.strokeStyle = "#000", e.stroke();
12556
12556
  }, n = (o, l, h) => {
12557
12557
  a(), o.include.forEach((d) => t(d, l, h, "#33ff33")), o.exclude.forEach((d) => t(d, l, h, "#ff3333"));
12558
12558
  }, i = () => {
12559
- R.style.display = null;
12559
+ S.style.display = null;
12560
12560
  }, r = () => {
12561
- a(), R.style.display = "none";
12561
+ a(), S.style.display = "none";
12562
12562
  }, a = () => {
12563
- e.clearRect(0, 0, R.width, R.height);
12563
+ e.clearRect(0, 0, S.width, S.height);
12564
12564
  };
12565
12565
  return {
12566
12566
  clear: a,
12567
12567
  destroy: () => {
12568
- R.remove();
12568
+ S.remove();
12569
12569
  },
12570
12570
  hide: r,
12571
12571
  setPrompt: n,
@@ -12576,94 +12576,96 @@ const Ze = /* @__PURE__ */ Be(je), qe = (N, R = [255, 255, 255, 255], e = [0, 0,
12576
12576
  isOSDReady: !1,
12577
12577
  isAnimationInProgress: !1,
12578
12578
  viewportVersion: 0
12579
- }), rt = (N) => {
12580
- const { viewer: R } = N;
12581
- let e = !1;
12582
- const t = We(), n = et(), i = Qe(N.viewer), r = $e(N.viewer), a = (S) => {
12583
- const { isSAMReady: O, sam: F } = n;
12584
- if (!F || !O) return;
12585
- const A = R.drawer.canvas, U = A.width / (F.currentScale * A.offsetWidth), G = A.height / (F.currentScale * A.offsetHeight), V = S.x * U + F.currentBounds.x, X = S.y * G + F.currentBounds.y;
12586
- return { x: V, y: X };
12587
- }, s = (S) => {
12588
- var A;
12589
- if (!n.isSAMReady || !n.isOSDReady || !!((A = n.sam) != null && A.currentPrompt)) return;
12590
- const F = { x: S.offsetX, y: S.offsetY };
12591
- n.lastPointerPos = F, n.isAnimationInProgress || h(F);
12592
- }, o = (S) => {
12593
- var V, X, q, k;
12594
- if (!n.sam || !n.isSAMReady || !n.isOSDReady || n.isAnimationInProgress) return;
12595
- const O = { x: S.offsetX, y: S.offsetY }, F = a(O);
12596
- if (!F) return;
12597
- S.shiftKey ? n.sam.currentPrompt = {
12598
- include: ((V = n.sam.currentPrompt) == null ? void 0 : V.include) || [],
12599
- exclude: [...((X = n.sam.currentPrompt) == null ? void 0 : X.exclude) || [], F]
12600
- } : n.sam.currentPrompt = {
12601
- include: [...((q = n.sam.currentPrompt) == null ? void 0 : q.include) || [], F],
12602
- exclude: ((k = n.sam.currentPrompt) == null ? void 0 : k.exclude) || []
12579
+ }), rt = (W) => {
12580
+ const { viewer: S } = W;
12581
+ let e = !1, t = "add";
12582
+ const n = We(), i = et(), r = Qe(W.viewer), a = $e(W.viewer), s = (D) => {
12583
+ const { isSAMReady: O, sam: A } = i;
12584
+ if (!A || !O) return;
12585
+ const z = S.drawer.canvas, V = z.width / (A.currentScale * z.offsetWidth), K = z.height / (A.currentScale * z.offsetHeight), j = D.x * V + A.currentBounds.x, k = D.y * K + A.currentBounds.y;
12586
+ return { x: j, y: k };
12587
+ }, o = (D) => {
12588
+ var z;
12589
+ if (!i.isSAMReady || !i.isOSDReady || !!((z = i.sam) != null && z.currentPrompt)) return;
12590
+ const A = { x: D.offsetX, y: D.offsetY };
12591
+ i.lastPointerPos = A, i.isAnimationInProgress || d(A);
12592
+ }, l = (D) => {
12593
+ var j, k, X, $;
12594
+ if (!i.sam || !i.isSAMReady || !i.isOSDReady || i.isAnimationInProgress) return;
12595
+ const O = { x: D.offsetX, y: D.offsetY }, A = s(O);
12596
+ if (!A) return;
12597
+ D.shiftKey || t === "remove" ? i.sam.currentPrompt = {
12598
+ include: ((j = i.sam.currentPrompt) == null ? void 0 : j.include) || [],
12599
+ exclude: [...((k = i.sam.currentPrompt) == null ? void 0 : k.exclude) || [], A]
12600
+ } : i.sam.currentPrompt = {
12601
+ include: [...((X = i.sam.currentPrompt) == null ? void 0 : X.include) || [], A],
12602
+ exclude: (($ = i.sam.currentPrompt) == null ? void 0 : $.exclude) || []
12603
12603
  };
12604
- const { currentPrompt: A, currentBounds: U, currentScale: G } = n.sam;
12605
- r.setPrompt(A, U, G), E.postMessage({ type: "decode", prompt: n.sam.currentPrompt });
12606
- }, l = () => {
12607
- if (!n.sam) return;
12608
- t.emit("startEncoding"), n.viewportVersion += 1;
12609
- const S = ke(n.sam.currentCanvas);
12610
- E.postMessage({ type: "encode", data: S, viewportVersion: n.viewportVersion });
12611
- }, h = (S) => {
12612
- const O = a(S);
12613
- O && E.postMessage({ type: "decode_preview", point: O });
12614
- }, d = () => {
12615
- n.isAnimationInProgress = !0, n.sam = void 0, i.clear(), r.clear();
12604
+ const { currentPrompt: z, currentBounds: V, currentScale: K } = i.sam;
12605
+ a.setPrompt(z, V, K), M.postMessage({ type: "decode", prompt: i.sam.currentPrompt });
12606
+ }, h = () => {
12607
+ if (!i.sam) return;
12608
+ n.emit("startEncoding"), i.viewportVersion += 1;
12609
+ const D = ke(i.sam.currentCanvas);
12610
+ M.postMessage({ type: "encode", data: D, viewportVersion: i.viewportVersion });
12611
+ }, d = (D) => {
12612
+ const O = s(D);
12613
+ O && M.postMessage({ type: "decode_preview", point: O });
12616
12614
  }, f = () => {
12617
- if (n.isAnimationInProgress = !1, !n.isOSDReady || !e) return;
12618
- const { canvas: S, bounds: O, scale: F } = Ke(R.drawer.canvas);
12619
- n.sam = {
12615
+ i.isAnimationInProgress = !0, i.sam = void 0, r.clear(), a.clear();
12616
+ }, v = () => {
12617
+ if (i.isAnimationInProgress = !1, !i.isOSDReady || !e) return;
12618
+ const { canvas: D, bounds: O, scale: A } = Ke(S.drawer.canvas);
12619
+ i.sam = {
12620
12620
  // The current 1024 x 1024 SAM working canvas
12621
- currentCanvas: S,
12621
+ currentCanvas: D,
12622
12622
  // The bbox of the resized & padded viewport on the working canvas
12623
12623
  currentBounds: O,
12624
12624
  // The current SAM scale (longer image dimension / 1024)
12625
- currentScale: F,
12625
+ currentScale: A,
12626
12626
  // New annotation ID for the current shape
12627
12627
  currentAnnotationId: Ne()
12628
- }, n.isSAMReady && l();
12628
+ }, i.isSAMReady && h();
12629
12629
  };
12630
- Ye(R, () => {
12631
- console.log("[a9s-sam] OSD canvas ready"), n.isOSDReady = !0, f();
12630
+ Ye(S, () => {
12631
+ console.log("[a9s-sam] OSD canvas ready"), i.isOSDReady = !0, v();
12632
12632
  });
12633
- const v = () => {
12634
- R.element.addEventListener("pointermove", s), R.element.addEventListener("pointerdown", o), R.addHandler("animation-start", d), R.addHandler("animation-finish", f);
12635
- }, w = () => {
12636
- R.element.removeEventListener("pointermove", s), R.element.removeEventListener("pointerdown", o), R.removeHandler("animation-start", d), R.removeHandler("animation-finish", f);
12637
- }, T = (S) => {
12638
- e = S, n.sam = void 0, S ? (R.setMouseNavEnabled(!1), i.show(), r.show(), v(), f()) : (R.setMouseNavEnabled(!0), i.hide(), r.hide(), w());
12639
- }, x = () => {
12640
- i.destroy(), r.destroy(), w();
12641
- }, E = new ze();
12642
- return E.onmessage = (S) => {
12643
- const { type: O } = S.data;
12633
+ const w = () => {
12634
+ S.element.addEventListener("pointermove", o), S.element.addEventListener("pointerdown", l), S.addHandler("animation-start", f), S.addHandler("animation-finish", v);
12635
+ }, T = () => {
12636
+ var D, O;
12637
+ (D = S.element) == null || D.removeEventListener("pointermove", o), (O = S.element) == null || O.removeEventListener("pointerdown", l), S == null || S.removeHandler("animation-start", f), S == null || S.removeHandler("animation-finish", v);
12638
+ }, x = (D) => {
12639
+ e = D, i.sam = void 0, D ? (S.setMouseNavEnabled(!1), r.show(), a.show(), w(), v()) : (S.setMouseNavEnabled(!0), r.hide(), a.hide(), T());
12640
+ }, E = (D) => t = D, R = () => {
12641
+ r.destroy(), a.destroy(), T();
12642
+ }, M = new ze();
12643
+ return M.onmessage = (D) => {
12644
+ const { type: O } = D.data;
12644
12645
  if (O === "init_success")
12645
- n.isSAMReady = !0, t.emit("initialized"), e && l();
12646
+ i.isSAMReady = !0, n.emit("initialized"), e && h();
12646
12647
  else if (O === "encode_success") {
12647
- const { viewportVersion: F } = S.data;
12648
- F < n.viewportVersion ? console.log("[a9s-sam] Stale encoding - discarding") : (t.emit("encodingComplete"), n.lastPointerPos && h(n.lastPointerPos));
12648
+ const { viewportVersion: A } = D.data;
12649
+ A < i.viewportVersion ? console.log("[a9s-sam] Stale encoding - discarding") : (n.emit("encodingComplete"), i.lastPointerPos && d(i.lastPointerPos));
12649
12650
  } else if (O === "decode_preview_success") {
12650
- if (n.sam && !n.isAnimationInProgress) {
12651
- const { result: F, viewportVersion: A } = S.data;
12652
- A === n.viewportVersion ? i.render(F, n.sam.currentBounds) : console.log("[a9s-sam] Stale preview - discarding");
12651
+ if (i.sam && !i.isAnimationInProgress) {
12652
+ const { result: A, viewportVersion: z } = D.data;
12653
+ z === i.viewportVersion ? r.render(A, i.sam.currentBounds) : console.log("[a9s-sam] Stale preview - discarding");
12653
12654
  }
12654
12655
  } else if (O === "decode_success") {
12655
- if (i.clear(), n.sam) {
12656
- const F = Xe(S.data.result, n.sam, N.getUser(), R), { store: A } = N.state;
12657
- A.getAnnotation(n.sam.currentAnnotationId) ? A.updateAnnotation(n.sam.currentAnnotationId, F) : A.addAnnotation(F);
12656
+ if (r.clear(), i.sam) {
12657
+ const A = Xe(D.data.result, i.sam, W.getUser(), S), { store: z } = W.state;
12658
+ z.getAnnotation(i.sam.currentAnnotationId) ? z.updateAnnotation(i.sam.currentAnnotationId, A) : z.addAnnotation(A);
12658
12659
  }
12659
12660
  } else if (O === "encode_error") {
12660
- const { viewportVersion: F } = S.data;
12661
- F === n.viewportVersion && setTimeout(() => l(), 100);
12661
+ const { viewportVersion: A } = D.data;
12662
+ A === i.viewportVersion && setTimeout(() => h(), 100);
12662
12663
  }
12663
- }, E.postMessage({ type: "init" }), {
12664
- destroy: x,
12665
- setEnabled: T,
12666
- on: t.on.bind(t)
12664
+ }, M.postMessage({ type: "init" }), {
12665
+ destroy: R,
12666
+ setEnabled: x,
12667
+ setQueryMode: E,
12668
+ on: (D, O) => n.on(D, O)
12667
12669
  };
12668
12670
  };
12669
12671
  export {