PageSourceSearch

https://www.cryptopunks.app/openseadragon/openseadragon.min.js

js cryptopunks.app collected 2026-10-03 21:11:59 UTC 306,281 bytes, 9,902 lines download raw bytes

1//! openseadragon 2.2.1
2//! Built on 2016-06-21
3//! Git commit: v2.2.1-0-babdefd
4//! http://openseadragon.github.io
5//! License: http://openseadragon.github.io/license/
6
7window.OpenSeadragon =
8  window.OpenSeadragon ||
9  function (a) {
10    return new OpenSeadragon.Viewer(a);
11  };
12"function" == typeof define &&
13  define.amd &&
14  define(function () {
15    return window.OpenSeadragon;
16  });
17!(function (a) {
18  a.version = {
19    versionStr: "<%= osdVersion.versionStr %>",
20    major: parseInt("<%= osdVersion.major %>", 10),
21    minor: parseInt("<%= osdVersion.minor %>", 10),
22    revision: parseInt("<%= osdVersion.revision %>", 10),
23  };
24  var b = {
25      "[object Boolean]": "boolean",
26      "[object Number]": "number",
27      "[object String]": "string",
28      "[object Function]": "function",
29      "[object Array]": "array",
30      "[object Date]": "date",
31      "[object RegExp]": "regexp",
32      "[object Object]": "object",
33    },
34    c = Object.prototype.toString,
35    d = Object.prototype.hasOwnProperty;
36  a.isFunction = function (b) {
37    return "function" === a.type(b);
38  };
39  a.isArray =
40    Array.isArray ||
41    function (b) {
42      return "array" === a.type(b);
43    };
44  a.isWindow = function (a) {
45    return a && "object" == typeof a && "setInterval" in a;
46  };
47  a.type = function (a) {
48    return null === a || void 0 === a ? String(a) : b[c.call(a)] || "object";
49  };
50  a.isPlainObject = function (b) {
51    if (!b || "object" !== OpenSeadragon.type(b) || b.nodeType || a.isWindow(b))
52      return !1;
53    if (
54      b.constructor &&
55      !d.call(b, "constructor") &&
56      !d.call(b.constructor.prototype, "isPrototypeOf")
57    )
58      return !1;
59    var c;
60    for (var e in b) c = e;
61    return void 0 === c || d.call(b, c);
62  };
63  a.isEmptyObject = function (a) {
64    for (var b in a) return !1;
65    return !0;
66  };
67  a.freezeObject = function (b) {
68    Object.freeze
69      ? (a.freezeObject = Object.freeze)
70      : (a.freezeObject = function (a) {
71          return a;
72        });
73    return a.freezeObject(b);
74  };
75  a.supportsCanvas = (function () {
76    var b = document.createElement("canvas");
77    return !(!a.isFunction(b.getContext) || !b.getContext("2d"));
78  })();
79  a.isCanvasTainted = function (a) {
80    var b = !1;
81    try {
82      a.getContext("2d").getImageData(0, 0, 1, 1);
83    } catch (c) {
84      b = !0;
85    }
86    return b;
87  };
88  a.pixelDensityRatio = (function () {
89    if (a.supportsCanvas) {
90      var b = document.createElement("canvas").getContext("2d");
91      var c = window.devicePixelRatio || 1;
92      var d =
93        b.webkitBackingStorePixelRatio ||
94        b.mozBackingStorePixelRatio ||
95        b.msBackingStorePixelRatio ||
96        b.oBackingStorePixelRatio ||
97        b.backingStorePixelRatio ||
98        1;
99      return c / d;
100    }
101    return 1;
102  })();
103})(OpenSeadragon);
104!(function ($) {
105  function getOffsetParent(a, b) {
106    return b && a != document.body ? document.body : a.offsetParent;
107  }
108  $.extend = function () {
109    var a,
110      b,
111      c,
112      d,
113      e,
114      f,
115      g = arguments[0] || {},
116      h = arguments.length,
117      i = !1,
118      j = 1;
119    if ("boolean" == typeof g) {
120      i = g;
121      g = arguments[1] || {};
122      j = 2;
123    }
124    "object" == typeof g || OpenSeadragon.isFunction(g) || (g = {});
125    if (h === j) {
126      g = this;
127      --j;
128    }
129    for (; h > j; j++) {
130      a = arguments[j];
131      if (null !== a || void 0 !== a)
132        for (b in a) {
133          c = g[b];
134          d = a[b];
135          if (g !== d)
136            if (
137              i &&
138              d &&
139              (OpenSeadragon.isPlainObject(d) || (e = OpenSeadragon.isArray(d)))
140            ) {
141              if (e) {
142                e = !1;
143                f = c && OpenSeadragon.isArray(c) ? c : [];
144              } else f = c && OpenSeadragon.isPlainObject(c) ? c : {};
145              g[b] = OpenSeadragon.extend(i, f, d);
146            } else void 0 !== d && (g[b] = d);
147        }
148    }
149    return g;
150  };
151  var isIOSDevice = function () {
152    if ("object" != typeof navigator) return !1;
153    var a = navigator.userAgent;
154    return "string" != typeof a
155      ? !1
156      : -1 !== a.indexOf("iPhone") ||
157          -1 !== a.indexOf("iPad") ||
158          -1 !== a.indexOf("iPod");
159  };
160  $.extend($, {
161    DEFAULT_SETTINGS: {
162      xmlPath: null,
163      tileSources: null,
164      tileHost: null,
165      initialPage: 0,
166      crossOriginPolicy: !1,
167      ajaxWithCredentials: !1,
168      panHorizontal: !0,
169      panVertical: !0,
170      constrainDuringPan: !1,
171      wrapHorizontal: !1,
172      wrapVertical: !1,
173      visibilityRatio: 0.5,
174      minPixelRatio: 0.5,
175      defaultZoomLevel: 0,
176      minZoomLevel: null,
177      maxZoomLevel: null,
178      homeFillsViewer: !1,
179      clickTimeThreshold: 300,
180      clickDistThreshold: 5,
181      dblClickTimeThreshold: 300,
182      dblClickDistThreshold: 20,
183      springStiffness: 6.5,
184      animationTime: 1.2,
185      gestureSettingsMouse: {
186        scrollToZoom: !0,
187        clickToZoom: !0,
188        dblClickToZoom: !1,
189        pinchToZoom: !1,
190        flickEnabled: !1,
191        flickMinSpeed: 120,
192        flickMomentum: 0.25,
193        pinchRotate: !1,
194      },
195      gestureSettingsTouch: {
196        scrollToZoom: !1,
197        clickToZoom: !1,
198        dblClickToZoom: !0,
199        pinchToZoom: !0,
200        flickEnabled: !0,
201        flickMinSpeed: 120,
202        flickMomentum: 0.25,
203        pinchRotate: !1,
204      },
205      gestureSettingsPen: {
206        scrollToZoom: !1,
207        clickToZoom: !0,
208        dblClickToZoom: !1,
209        pinchToZoom: !1,
210        flickEnabled: !1,
211        flickMinSpeed: 120,
212        flickMomentum: 0.25,
213        pinchRotate: !1,
214      },
215      gestureSettingsUnknown: {
216        scrollToZoom: !1,
217        clickToZoom: !1,
218        dblClickToZoom: !0,
219        pinchToZoom: !0,
220        flickEnabled: !0,
221        flickMinSpeed: 120,
222        flickMomentum: 0.25,
223        pinchRotate: !1,
224      },
225      zoomPerClick: 2,
226      zoomPerScroll: 1.2,
227      zoomPerSecond: 1,
228      blendTime: 0,
229      alwaysBlend: !1,
230      autoHideControls: !0,
231      immediateRender: !1,
232      minZoomImageRatio: 0.9,
233      maxZoomPixelRatio: 1.1,
234      smoothTileEdgesMinZoom: 1.1,
235      iOSDevice: isIOSDevice(),
236      pixelsPerWheelLine: 40,
237      autoResize: !0,
238      preserveImageSizeOnResize: !1,
239      minScrollDeltaTime: 50,
240      showSequenceControl: !0,
241      sequenceControlAnchor: null,
242      preserveViewport: !1,
243      preserveOverlays: !1,
244      navPrevNextWrap: !1,
245      showNavigationControl: !0,
246      navigationControlAnchor: null,
247      showZoomControl: !0,
248      showHomeControl: !0,
249      showFullPageControl: !0,
250      showRotationControl: !1,
251      controlsFadeDelay: 2e3,
252      controlsFadeLength: 1500,
253      mouseNavEnabled: !0,
254      showNavigator: !1,
255      navigatorId: null,
256      navigatorPosition: null,
257      navigatorSizeRatio: 0.2,
258      navigatorMaintainSizeRatio: !1,
259      navigatorTop: null,
260      navigatorLeft: null,
261      navigatorHeight: null,
262      navigatorWidth: null,
263      navigatorAutoResize: !0,
264      navigatorAutoFade: !0,
265      navigatorRotate: !0,
266      degrees: 0,
267      opacity: 1,
268      compositeOperation: null,
269      placeholderFillStyle: null,
270      showReferenceStrip: !1,
271      referenceStripScroll: "horizontal",
272      referenceStripElement: null,
273      referenceStripHeight: null,
274      referenceStripWidth: null,
275      referenceStripPosition: "BOTTOM_LEFT",
276      referenceStripSizeRatio: 0.2,
277      collectionRows: 3,
278      collectionColumns: 0,
279      collectionLayout: "horizontal",
280      collectionMode: !1,
281      collectionTileSize: 800,
282      collectionTileMargin: 80,
283      imageLoaderLimit: 0,
284      maxImageCacheCount: 200,
285      timeout: 3e4,
286      useCanvas: !0,
287      prefixUrl: "/images/",
288      navImages: {
289        zoomIn: {
290          REST: "zoomin_rest.png",
291          GROUP: "zoomin_grouphover.png",
292          HOVER: "zoomin_hover.png",
293          DOWN: "zoomin_pressed.png",
294        },
295        zoomOut: {
296          REST: "zoomout_rest.png",
297          GROUP: "zoomout_grouphover.png",
298          HOVER: "zoomout_hover.png",
299          DOWN: "zoomout_pressed.png",
300        },
301        home: {
302          REST: "home_rest.png",
303          GROUP: "home_grouphover.png",
304          HOVER: "home_hover.png",
305          DOWN: "home_pressed.png",
306        },
307        fullpage: {
308          REST: "fullpage_rest.png",
309          GROUP: "fullpage_grouphover.png",
310          HOVER: "fullpage_hover.png",
311          DOWN: "fullpage_pressed.png",
312        },
313        rotateleft: {
314          REST: "rotateleft_rest.png",
315          GROUP: "rotateleft_grouphover.png",
316          HOVER: "rotateleft_hover.png",
317          DOWN: "rotateleft_pressed.png",
318        },
319        rotateright: {
320          REST: "rotateright_rest.png",
321          GROUP: "rotateright_grouphover.png",
322          HOVER: "rotateright_hover.png",
323          DOWN: "rotateright_pressed.png",
324        },
325        previous: {
326          REST: "previous_rest.png",
327          GROUP: "previous_grouphover.png",
328          HOVER: "previous_hover.png",
329          DOWN: "previous_pressed.png",
330        },
331        next: {
332          REST: "next_rest.png",
333          GROUP: "next_grouphover.png",
334          HOVER: "next_hover.png",
335          DOWN: "next_pressed.png",
336        },
337      },
338      debugMode: !1,
339      debugGridColor: "#437AB2",
340    },
341    SIGNAL: "----seadragon----",
342    delegate: function (a, b) {
343      return function () {
344        var c = arguments;
345        void 0 === c && (c = []);
346        return b.apply(a, c);
347      };
348    },
349    BROWSERS: { UNKNOWN: 0, IE: 1, FIREFOX: 2, SAFARI: 3, CHROME: 4, OPERA: 5 },
350    getElement: function (a) {
351      "string" == typeof a && (a = document.getElementById(a));
352      return a;
353    },
354    getElementPosition: function (a) {
355      var b,
356        c,
357        d = new $.Point();
358      a = $.getElement(a);
359      b = "fixed" == $.getElementStyle(a).position;
360      c = getOffsetParent(a, b);
361      for (; c; ) {
362        d.x += a.offsetLeft;
363        d.y += a.offsetTop;
364        b && (d = d.plus($.getPageScroll()));
365        a = c;
366        b = "fixed" == $.getElementStyle(a).position;
367        c = getOffsetParent(a, b);
368      }
369      return d;
370    },
371    getElementOffset: function (a) {
372      a = $.getElement(a);
373      var b,
374        c,
375        d = a && a.ownerDocument,
376        e = { top: 0, left: 0 };
377      if (!d) return new $.Point();
378      b = d.documentElement;
379      "undefined" != typeof a.getBoundingClientRect &&
380        (e = a.getBoundingClientRect());
381      c =
382        d == d.window
383          ? d
384          : 9 === d.nodeType
385            ? d.defaultView || d.parentWindow
386            : !1;
387      return new $.Point(
388        e.left + (c.pageXOffset || b.scrollLeft) - (b.clientLeft || 0),
389        e.top + (c.pageYOffset || b.scrollTop) - (b.clientTop || 0),
390      );
391    },
392    getElementSize: function (a) {
393      a = $.getElement(a);
394      return new $.Point(a.clientWidth, a.clientHeight);
395    },
396    getElementStyle: document.documentElement.currentStyle
397      ? function (a) {
398          a = $.getElement(a);
399          return a.currentStyle;
400        }
401      : function (a) {
402          a = $.getElement(a);
403          return window.getComputedStyle(a, "");
404        },
405    getCssPropertyWithVendorPrefix: function (a) {
406      var b = {};
407      $.getCssPropertyWithVendorPrefix = function (a) {
408        if (void 0 !== b[a]) return b[a];
409        var c = document.createElement("div").style;
410        var d = null;
411        if (void 0 !== c[a]) d = a;
412        else {
413          var e = ["Webkit", "Moz", "MS", "O", "webkit", "moz", "ms", "o"];
414          var f = $.capitalizeFirstLetter(a);
415          for (var g = 0; g < e.length; g++) {
416            var h = e[g] + f;
417            if (void 0 !== c[h]) {
418              d = h;
419              break;
420            }
421          }
422        }
423        b[a] = d;
424        return d;
425      };
426      return $.getCssPropertyWithVendorPrefix(a);
427    },
428    capitalizeFirstLetter: function (a) {
429      return a.charAt(0).toUpperCase() + a.slice(1);
430    },
431    pointInElement: function (a, b) {
432      a = $.getElement(a);
433      var c = $.getElementOffset(a),
434        d = $.getElementSize(a);
435      return b.x >= c.x && b.x < c.x + d.x && b.y < c.y + d.y && b.y >= c.y;
436    },
437    getEvent: function (a) {
438      a
439        ? ($.getEvent = function (a) {
440            return a;
441          })
442        : ($.getEvent = function () {
443            return window.event;
444          });
445      return $.getEvent(a);
446    },
447    getMousePosition: function (a) {
448      if ("number" == typeof a.pageX)
449        $.getMousePosition = function (a) {
450          var b = new $.Point();
451          a = $.getEvent(a);
452          b.x = a.pageX;
453          b.y = a.pageY;
454          return b;
455        };
456      else {
457        if ("number" != typeof a.clientX)
458          throw new Error("Unknown event mouse position, no known technique.");
459        $.getMousePosition = function (a) {
460          var b = new $.Point();
461          a = $.getEvent(a);
462          b.x =
463            a.clientX +
464            document.body.scrollLeft +
465            document.documentElement.scrollLeft;
466          b.y =
467            a.clientY +
468            document.body.scrollTop +
469            document.documentElement.scrollTop;
470          return b;
471        };
472      }
473      return $.getMousePosition(a);
474    },
475    getPageScroll: function () {
476      var a = document.documentElement || {},
477        b = document.body || {};
478      if ("number" == typeof window.pageXOffset)
479        $.getPageScroll = function () {
480          return new $.Point(window.pageXOffset, window.pageYOffset);
481        };
482      else if (b.scrollLeft || b.scrollTop)
483        $.getPageScroll = function () {
484          return new $.Point(document.body.scrollLeft, document.body.scrollTop);
485        };
486      else {
487        if (!a.scrollLeft && !a.scrollTop) return new $.Point(0, 0);
488        $.getPageScroll = function () {
489          return new $.Point(
490            document.documentElement.scrollLeft,
491            document.documentElement.scrollTop,
492          );
493        };
494      }
495      return $.getPageScroll();
496    },
497    setPageScroll: function (a) {
498      if ("undefined" != typeof window.scrollTo)
499        $.setPageScroll = function (a) {
500          window.scrollTo(a.x, a.y);
501        };
502      else {
503        var b = $.getPageScroll();
504        if (b.x === a.x && b.y === a.y) return;
505        document.body.scrollLeft = a.x;
506        document.body.scrollTop = a.y;
507        var c = $.getPageScroll();
508        if (c.x !== b.x && c.y !== b.y) {
509          $.setPageScroll = function (a) {
510            document.body.scrollLeft = a.x;
511            document.body.scrollTop = a.y;
512          };
513          return;
514        }
515        document.documentElement.scrollLeft = a.x;
516        document.documentElement.scrollTop = a.y;
517        c = $.getPageScroll();
518        if (c.x !== b.x && c.y !== b.y) {
519          $.setPageScroll = function (a) {
520            document.documentElement.scrollLeft = a.x;
521            document.documentElement.scrollTop = a.y;
522          };
523          return;
524        }
525        $.setPageScroll = function (a) {};
526      }
527      return $.setPageScroll(a);
528    },
529    getWindowSize: function () {
530      var a = document.documentElement || {},
531        b = document.body || {};
532      if ("number" == typeof window.innerWidth)
533        $.getWindowSize = function () {
534          return new $.Point(window.innerWidth, window.innerHeight);
535        };
536      else if (a.clientWidth || a.clientHeight)
537        $.getWindowSize = function () {
538          return new $.Point(
539            document.documentElement.clientWidth,
540            document.documentElement.clientHeight,
541          );
542        };
543      else {
544        if (!b.clientWidth && !b.clientHeight)
545          throw new Error("Unknown window size, no known technique.");
546        $.getWindowSize = function () {
547          return new $.Point(
548            document.body.clientWidth,
549            document.body.clientHeight,
550          );
551        };
552      }
553      return $.getWindowSize();
554    },
555    makeCenteredNode: function (a) {
556      a = $.getElement(a);
557      var b = [
558        $.makeNeutralElement("div"),
559        $.makeNeutralElement("div"),
560        $.makeNeutralElement("div"),
561      ];
562      $.extend(b[0].style, { display: "table", height: "100%", width: "100%" });
563      $.extend(b[1].style, { display: "table-row" });
564      $.extend(b[2].style, {
565        display: "table-cell",
566        verticalAlign: "middle",
567        textAlign: "center",
568      });
569      b[0].appendChild(b[1]);
570      b[1].appendChild(b[2]);
571      b[2].appendChild(a);
572      return b[0];
573    },
574    makeNeutralElement: function (a) {
575      var b = document.createElement(a),
576        c = b.style;
577      c.background = "transparent none";
578      c.border = "none";
579      c.margin = "0px";
580      c.padding = "0px";
581      c.position = "static";
582      return b;
583    },
584    now: function () {
585      Date.now
586        ? ($.now = Date.now)
587        : ($.now = function () {
588            return new Date().getTime();
589          });
590      return $.now();
591    },
592    makeTransparentImage: function (a) {
593      $.makeTransparentImage = function (a) {
594        var b = $.makeNeutralElement("img");
595        b.src = a;
596        return b;
597      };
598      $.Browser.vendor == $.BROWSERS.IE &&
599        $.Browser.version < 7 &&
600        ($.makeTransparentImage = function (a) {
601          var b = $.makeNeutralElement("img"),
602            c = null;
603          c = $.makeNeutralElement("span");
604          c.style.display = "inline-block";
605          b.onload = function () {
606            c.style.width = c.style.width || b.width + "px";
607            c.style.height = c.style.height || b.height + "px";
608            b.onload = null;
609            b = null;
610          };
611          b.src = a;
612          c.style.filter =
613            "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
614            a +
615            "', sizingMethod='scale')";
616          return c;
617        });
618      return $.makeTransparentImage(a);
619    },
620    setElementOpacity: function (a, b, c) {
621      var d, e;
622      a = $.getElement(a);
623      c && !$.Browser.alpha && (b = Math.round(b));
624      if ($.Browser.opacity) a.style.opacity = 1 > b ? b : "";
625      else if (1 > b) {
626        d = Math.round(100 * b);
627        e = "alpha(opacity=" + d + ")";
628        a.style.filter = e;
629      } else a.style.filter = "";
630    },
631    setElementTouchActionNone: function (a) {
632      a = $.getElement(a);
633      "undefined" != typeof a.style.touchAction
634        ? (a.style.touchAction = "none")
635        : "undefined" != typeof a.style.msTouchAction &&
636          (a.style.msTouchAction = "none");
637    },
638    addClass: function (a, b) {
639      a = $.getElement(a);
640      a.className
641        ? -1 === (" " + a.className + " ").indexOf(" " + b + " ") &&
642          (a.className += " " + b)
643        : (a.className = b);
644    },
645    indexOf: function (a, b, c) {
646      Array.prototype.indexOf
647        ? (this.indexOf = function (a, b, c) {
648            return a.indexOf(b, c);
649          })
650        : (this.indexOf = function (a, b, c) {
651            var d,
652              e,
653              f = c ? c : 0;
654            if (!a) throw new TypeError();
655            e = a.length;
656            if (0 === e || f >= e) return -1;
657            0 > f && (f = e - Math.abs(f));
658            for (d = f; e > d; d++) if (a[d] === b) return d;
659            return -1;
660          });
661      return this.indexOf(a, b, c);
662    },
663    removeClass: function (a, b) {
664      var c,
665        d,
666        e = [];
667      a = $.getElement(a);
668      c = a.className.split(/\s+/);
669      for (d = 0; d < c.length; d++) c[d] && c[d] !== b && e.push(c[d]);
670      a.className = e.join(" ");
671    },
672    addEvent: (function () {
673      if (window.addEventListener)
674        return function (a, b, c, d) {
675          a = $.getElement(a);
676          a.addEventListener(b, c, d);
677        };
678      if (window.attachEvent)
679        return function (a, b, c, d) {
680          a = $.getElement(a);
681          a.attachEvent("on" + b, c);
682        };
683      throw new Error("No known event model.");
684    })(),
685    removeEvent: (function () {
686      if (window.removeEventListener)
687        return function (a, b, c, d) {
688          a = $.getElement(a);
689          a.removeEventListener(b, c, d);
690        };
691      if (window.detachEvent)
692        return function (a, b, c, d) {
693          a = $.getElement(a);
694          a.detachEvent("on" + b, c);
695        };
696      throw new Error("No known event model.");
697    })(),
698    cancelEvent: function (a) {
699      a = $.getEvent(a);
700      a.preventDefault
701        ? ($.cancelEvent = function (a) {
702            a.preventDefault();
703          })
704        : ($.cancelEvent = function (a) {
705            a = $.getEvent(a);
706            a.cancel = !0;
707            a.returnValue = !1;
708          });
709      $.cancelEvent(a);
710    },
711    stopEvent: function (a) {
712      a = $.getEvent(a);
713      a.stopPropagation
714        ? ($.stopEvent = function (a) {
715            a.stopPropagation();
716          })
717        : ($.stopEvent = function (a) {
718            a = $.getEvent(a);
719            a.cancelBubble = !0;
720          });
721      $.stopEvent(a);
722    },
723    createCallback: function (a, b) {
724      var c,
725        d = [];
726      for (c = 2; c < arguments.length; c++) d.push(arguments[c]);
727      return function () {
728        var c,
729          e = d.concat([]);
730        for (c = 0; c < arguments.length; c++) e.push(arguments[c]);
731        return b.apply(a, e);
732      };
733    },
734    getUrlParameter: function (a) {
735      var b = URLPARAMS[a];
736      return b ? b : null;
737    },
738    getUrlProtocol: function (a) {
739      var b = a.match(/^([a-z]+:)\/\//i);
740      return null === b ? window.location.protocol : b[1].toLowerCase();
741    },
742    createAjaxRequest: function (a) {
743      var b;
744      try {
745        b = !!new ActiveXObject("Microsoft.XMLHTTP");
746      } catch (c) {
747        b = !1;
748      }
749      if (b)
750        window.XMLHttpRequest
751          ? ($.createAjaxRequest = function (a) {
752              return a
753                ? new ActiveXObject("Microsoft.XMLHTTP")
754                : new XMLHttpRequest();
755            })
756          : ($.createAjaxRequest = function () {
757              return new ActiveXObject("Microsoft.XMLHTTP");
758            });
759      else {
760        if (!window.XMLHttpRequest)
761          throw new Error("Browser doesn't support XMLHttpRequest.");
762        $.createAjaxRequest = function () {
763          return new XMLHttpRequest();
764        };
765      }
766      return $.createAjaxRequest(a);
767    },
768    makeAjaxRequest: function (a, b, c) {
769      var d;
770      if ($.isPlainObject(a)) {
771        b = a.success;
772        c = a.error;
773        d = a.withCredentials;
774        a = a.url;
775      }
776      var e = $.getUrlProtocol(a);
777      var f = $.createAjaxRequest("file:" === e);
778      if (!$.isFunction(b))
779        throw new Error("makeAjaxRequest requires a success callback");
780      f.onreadystatechange = function () {
781        if (4 == f.readyState) {
782          f.onreadystatechange = function () {};
783          if (
784            200 === f.status ||
785            (0 === f.status && "http:" !== e && "https:" !== e)
786          )
787            b(f);
788          else {
789            $.console.log("AJAX request returned %d: %s", f.status, a);
790            $.isFunction(c) && c(f);
791          }
792        }
793      };
794      d && (f.withCredentials = !0);
795      try {
796        f.open("GET", a, !0);
797        f.send(null);
798      } catch (g) {
799        var h = g.message;
800        var i = $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 10;
801        i &&
802          "undefined" != typeof g.number &&
803          -2147024891 == g.number &&
804          (h +=
805            "\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain");
806        $.console.log("%s while making AJAX request: %s", g.name, h);
807        f.onreadystatechange = function () {};
808        if (window.XDomainRequest) {
809          var j = new XDomainRequest();
810          if (j) {
811            j.onload = function (a) {
812              $.isFunction(b) &&
813                b({
814                  responseText: j.responseText,
815                  status: 200,
816                  statusText: "OK",
817                });
818            };
819            j.onerror = function (a) {
820              $.isFunction(c) &&
821                c({
822                  responseText: j.responseText,
823                  status: 444,
824                  statusText:
825                    "An error happened. Due to an XDomainRequest deficiency we can not extract any information about this error. Upgrade your browser.",
826                });
827            };
828            try {
829              j.open("GET", a);
830              j.send();
831            } catch (k) {
832              $.isFunction(c) && c(f, g);
833            }
834          }
835        } else $.isFunction(c) && c(f, g);
836      }
837    },
838    jsonp: function (a) {
839      var b,
840        c = a.url,
841        d =
842          document.head ||
843          document.getElementsByTagName("head")[0] ||
844          document.documentElement,
845        e = a.callbackName || "openseadragon" + $.now(),
846        f = window[e],
847        g = "$1" + e + "$2",
848        h = a.param || "callback",
849        i = a.callback;
850      c = c.replace(/(\=)\?(&|$)|\?\?/i, g);
851      c += (/\?/.test(c) ? "&" : "?") + h + "=" + e;
852      window[e] = function (a) {
853        if (f) window[e] = f;
854        else
855          try {
856            delete window[e];
857          } catch (b) {}
858        i && $.isFunction(i) && i(a);
859      };
860      b = document.createElement("script");
861      (void 0 !== a.async || !1 !== a.async) && (b.async = "async");
862      a.scriptCharset && (b.charset = a.scriptCharset);
863      b.src = c;
864      b.onload = b.onreadystatechange = function (a, c) {
865        if (c || !b.readyState || /loaded|complete/.test(b.readyState)) {
866          b.onload = b.onreadystatechange = null;
867          d && b.parentNode && d.removeChild(b);
868          b = void 0;
869        }
870      };
871      d.insertBefore(b, d.firstChild);
872    },
873    createFromDZI: function () {
874      throw "OpenSeadragon.createFromDZI is deprecated, use Viewer.open.";
875    },
876    parseXml: function (a) {
877      if (window.DOMParser)
878        $.parseXml = function (a) {
879          var b,
880            c = null;
881          b = new DOMParser();
882          c = b.parseFromString(a, "text/xml");
883          return c;
884        };
885      else {
886        if (!window.ActiveXObject)
887          throw new Error("Browser doesn't support XML DOM.");
888        $.parseXml = function (a) {
889          var b = null;
890          b = new ActiveXObject("Microsoft.XMLDOM");
891          b.async = !1;
892          b.loadXML(a);
893          return b;
894        };
895      }
896      return $.parseXml(a);
897    },
898    parseJSON: function (string) {
899      window.JSON && window.JSON.parse
900        ? ($.parseJSON = window.JSON.parse)
901        : ($.parseJSON = function (string) {
902            return eval("(" + string + ")");
903          });
904      return $.parseJSON(string);
905    },
906    imageFormatSupported: function (a) {
907      a = a ? a : "";
908      return !!FILEFORMATS[a.toLowerCase()];
909    },
910  });
911  $.Browser = { vendor: $.BROWSERS.UNKNOWN, version: 0, alpha: !0 };
912  var FILEFORMATS = { bmp: !1, jpeg: !0, jpg: !0, png: !0, tif: !1, wdp: !1 },
913    URLPARAMS = {};
914  !(function () {
915    var a,
916      b = (navigator.appName, navigator.appVersion),
917      c = navigator.userAgent;
918    switch (navigator.appName) {
919      case "Microsoft Internet Explorer":
920        if (window.attachEvent && window.ActiveXObject) {
921          $.Browser.vendor = $.BROWSERS.IE;
922          $.Browser.version = parseFloat(
923            c.substring(
924              c.indexOf("MSIE") + 5,
925              c.indexOf(";", c.indexOf("MSIE")),
926            ),
927          );
928        }
929        break;
930      case "Netscape":
931        if (window.addEventListener)
932          if (c.indexOf("Firefox") >= 0) {
933            $.Browser.vendor = $.BROWSERS.FIREFOX;
934            $.Browser.version = parseFloat(
935              c.substring(c.indexOf("Firefox") + 8),
936            );
937          } else if (c.indexOf("Safari") >= 0) {
938            $.Browser.vendor =
939              c.indexOf("Chrome") >= 0 ? $.BROWSERS.CHROME : $.BROWSERS.SAFARI;
940            $.Browser.version = parseFloat(
941              c.substring(
942                c.substring(0, c.indexOf("Safari")).lastIndexOf("/") + 1,
943                c.indexOf("Safari"),
944              ),
945            );
946          } else {
947            a = new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})");
948            if (null !== a.exec(c)) {
949              $.Browser.vendor = $.BROWSERS.IE;
950              $.Browser.version = parseFloat(RegExp.$1);
951            }
952          }
953        break;
954      case "Opera":
955        $.Browser.vendor = $.BROWSERS.OPERA;
956        $.Browser.version = parseFloat(b);
957    }
958    var d,
959      e,
960      f,
961      g = window.location.search.substring(1),
962      h = g.split("&");
963    for (f = 0; f < h.length; f++) {
964      d = h[f];
965      e = d.indexOf("=");
966      e > 0 &&
967        (URLPARAMS[d.substring(0, e)] = decodeURIComponent(d.substring(e + 1)));
968    }
969    $.Browser.alpha = !(
970      ($.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 9) ||
971      ($.Browser.vendor == $.BROWSERS.CHROME && $.Browser.version < 2)
972    );
973    $.Browser.opacity = !(
974      $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 9
975    );
976  })();
977  var nullfunction = function (a) {};
978  $.console = window.console || {
979    log: nullfunction,
980    debug: nullfunction,
981    info: nullfunction,
982    warn: nullfunction,
983    error: nullfunction,
984    assert: nullfunction,
985  };
986  !(function (a) {
987    var b =
988      a.requestAnimationFrame ||
989      a.mozRequestAnimationFrame ||
990      a.webkitRequestAnimationFrame ||
991      a.msRequestAnimationFrame;
992    var c =
993      a.cancelAnimationFrame ||
994      a.mozCancelAnimationFrame ||
995      a.webkitCancelAnimationFrame ||
996      a.msCancelAnimationFrame;
997    if (b && c) {
998      $.requestAnimationFrame = function () {
999        return b.apply(a, arguments);
1000      };
1001      $.cancelAnimationFrame = function () {
1002        return c.apply(a, arguments);
1003      };
1004    } else {
1005      var d,
1006        e = [],
1007        f = [],
1008        g = 0;
1009      $.requestAnimationFrame = function (a) {
1010        e.push([++g, a]);
1011        d ||
1012          (d = setInterval(function () {
1013            if (e.length) {
1014              var a = $.now();
1015              var b = f;
1016              f = e;
1017              e = b;
1018              for (; f.length; ) f.shift()[1](a);
1019            } else {
1020              clearInterval(d);
1021              d = void 0;
1022            }
1023          }, 20));
1024        return g;
1025      };
1026      $.cancelAnimationFrame = function (a) {
1027        var b, c;
1028        for (b = 0, c = e.length; c > b; b += 1)
1029          if (e[b][0] === a) {
1030            e.splice(b, 1);
1031            return;
1032          }
1033        for (b = 0, c = f.length; c > b; b += 1)
1034          if (f[b][0] === a) {
1035            f.splice(b, 1);
1036            return;
1037          }
1038      };
1039    }
1040  })(window);
1041})(OpenSeadragon);
1042!(function (a) {
1043  var b = {
1044    supportsFullScreen: !1,
1045    isFullScreen: function () {
1046      return !1;
1047    },
1048    getFullScreenElement: function () {
1049      return null;
1050    },
1051    requestFullScreen: function () {},
1052    exitFullScreen: function () {},
1053    cancelFullScreen: function () {},
1054    fullScreenEventName: "",
1055    fullScreenErrorEventName: "",
1056  };
1057  if (document.exitFullscreen) {
1058    b.supportsFullScreen = !0;
1059    b.getFullScreenElement = function () {
1060      return document.fullscreenElement;
1061    };
1062    b.requestFullScreen = function (a) {
1063      return a.requestFullscreen();
1064    };
1065    b.exitFullScreen = function () {
1066      document.exitFullscreen();
1067    };
1068    b.fullScreenEventName = "fullscreenchange";
1069    b.fullScreenErrorEventName = "fullscreenerror";
1070  } else if (document.msExitFullscreen) {
1071    b.supportsFullScreen = !0;
1072    b.getFullScreenElement = function () {
1073      return document.msFullscreenElement;
1074    };
1075    b.requestFullScreen = function (a) {
1076      return a.msRequestFullscreen();
1077    };
1078    b.exitFullScreen = function () {
1079      document.msExitFullscreen();
1080    };
1081    b.fullScreenEventName = "MSFullscreenChange";
1082    b.fullScreenErrorEventName = "MSFullscreenError";
1083  } else if (document.webkitExitFullscreen) {
1084    b.supportsFullScreen = !0;
1085    b.getFullScreenElement = function () {
1086      return document.webkitFullscreenElement;
1087    };
1088    b.requestFullScreen = function (a) {
1089      return a.webkitRequestFullscreen();
1090    };
1091    b.exitFullScreen = function () {
1092      document.webkitExitFullscreen();
1093    };
1094    b.fullScreenEventName = "webkitfullscreenchange";
1095    b.fullScreenErrorEventName = "webkitfullscreenerror";
1096  } else if (document.webkitCancelFullScreen) {
1097    b.supportsFullScreen = !0;
1098    b.getFullScreenElement = function () {
1099      return document.webkitCurrentFullScreenElement;
1100    };
1101    b.requestFullScreen = function (a) {
1102      return a.webkitRequestFullScreen();
1103    };
1104    b.exitFullScreen = function () {
1105      document.webkitCancelFullScreen();
1106    };
1107    b.fullScreenEventName = "webkitfullscreenchange";
1108    b.fullScreenErrorEventName = "webkitfullscreenerror";
1109  } else if (document.mozCancelFullScreen) {
1110    b.supportsFullScreen = !0;
1111    b.getFullScreenElement = function () {
1112      return document.mozFullScreenElement;
1113    };
1114    b.requestFullScreen = function (a) {
1115      return a.mozRequestFullScreen();
1116    };
1117    b.exitFullScreen = function () {
1118      document.mozCancelFullScreen();
1119    };
1120    b.fullScreenEventName = "mozfullscreenchange";
1121    b.fullScreenErrorEventName = "mozfullscreenerror";
1122  }
1123  b.isFullScreen = function () {
1124    return null !== b.getFullScreenElement();
1125  };
1126  b.cancelFullScreen = function () {
1127    a.console.error(
1128      "cancelFullScreen is deprecated. Use exitFullScreen instead.",
1129    );
1130    b.exitFullScreen();
1131  };
1132  a.extend(a, b);
1133})(OpenSeadragon);
1134!(function (a) {
1135  a.EventSource = function () {
1136    this.events = {};
1137  };
1138  a.EventSource.prototype = {
1139    addOnceHandler: function (a, b, c, d) {
1140      var e = this;
1141      d = d || 1;
1142      var f = 0;
1143      var g = function (c) {
1144        f++;
1145        f === d && e.removeHandler(a, g);
1146        b(c);
1147      };
1148      this.addHandler(a, g, c);
1149    },
1150    addHandler: function (b, c, d) {
1151      var e = this.events[b];
1152      e || (this.events[b] = e = []);
1153      c &&
1154        a.isFunction(c) &&
1155        (e[e.length] = { handler: c, userData: d || null });
1156    },
1157    removeHandler: function (b, c) {
1158      var d,
1159        e = this.events[b],
1160        f = [];
1161      if (e && a.isArray(e)) {
1162        for (d = 0; d < e.length; d++) e[d].handler !== c && f.push(e[d]);
1163        this.events[b] = f;
1164      }
1165    },
1166    removeAllHandlers: function (a) {
1167      if (a) this.events[a] = [];
1168      else for (var b in this.events) this.events[b] = [];
1169    },
1170    getHandler: function (a) {
1171      var b = this.events[a];
1172      if (!b || !b.length) return null;
1173      b = 1 === b.length ? [b[0]] : Array.apply(null, b);
1174      return function (a, c) {
1175        var d,
1176          e = b.length;
1177        for (d = 0; e > d; d++)
1178          if (b[d]) {
1179            c.eventSource = a;
1180            c.userData = b[d].userData;
1181            b[d].handler(c);
1182          }
1183      };
1184    },
1185    raiseEvent: function (a, b) {
1186      var c = this.getHandler(a);
1187      if (c) {
1188        b || (b = {});
1189        c(this, b);
1190      }
1191    },
1192  };
1193})(OpenSeadragon);
1194!(function (a) {
1195  function b(b) {
1196    var c,
1197      d = pa[b.hash],
1198      e = d.activePointersLists.length;
1199    for (c = 0; e > c; c++)
1200      if (d.activePointersLists[c].captureCount > 0) {
1201        a.removeEvent(
1202          a.MouseTracker.captureElement,
1203          "mousemove",
1204          d.mousemovecaptured,
1205          !0,
1206        );
1207        a.removeEvent(
1208          a.MouseTracker.captureElement,
1209          "mouseup",
1210          d.mouseupcaptured,
1211          !0,
1212        );
1213        a.removeEvent(
1214          a.MouseTracker.captureElement,
1215          a.MouseTracker.unprefixedPointerEvents
1216            ? "pointermove"
1217            : "MSPointerMove",
1218          d.pointermovecaptured,
1219          !0,
1220        );
1221        a.removeEvent(
1222          a.MouseTracker.captureElement,
1223          a.MouseTracker.unprefixedPointerEvents ? "pointerup" : "MSPointerUp",
1224          d.pointerupcaptured,
1225          !0,
1226        );
1227        a.removeEvent(
1228          a.MouseTracker.captureElement,
1229          "touchmove",
1230          d.touchmovecaptured,
1231          !0,
1232        );
1233        a.removeEvent(
1234          a.MouseTracker.captureElement,
1235          "touchend",
1236          d.touchendcaptured,
1237          !0,
1238        );
1239        d.activePointersLists[c].captureCount = 0;
1240      }
1241    for (c = 0; e > c; c++) d.activePointersLists.pop();
1242  }
1243  function c(c) {
1244    var d,
1245      e,
1246      f = pa[c.hash];
1247    if (!f.tracking) {
1248      for (e = 0; e < a.MouseTracker.subscribeEvents.length; e++) {
1249        d = a.MouseTracker.subscribeEvents[e];
1250        a.addEvent(c.element, d, f[d], !1);
1251      }
1252      b(c);
1253      f.tracking = !0;
1254    }
1255  }
1256  function d(c) {
1257    var d,
1258      e,
1259      f = pa[c.hash];
1260    if (f.tracking) {
1261      for (e = 0; e < a.MouseTracker.subscribeEvents.length; e++) {
1262        d = a.MouseTracker.subscribeEvents[e];
1263        a.removeEvent(c.element, d, f[d], !1);
1264      }
1265      b(c);
1266      f.tracking = !1;
1267    }
1268  }
1269  function e(b, c) {
1270    var d = pa[b.hash];
1271    if ("pointerevent" === c)
1272      return {
1273        upName: a.MouseTracker.unprefixedPointerEvents
1274          ? "pointerup"
1275          : "MSPointerUp",
1276        upHandler: d.pointerupcaptured,
1277        moveName: a.MouseTracker.unprefixedPointerEvents
1278          ? "pointermove"
1279          : "MSPointerMove",
1280        moveHandler: d.pointermovecaptured,
1281      };
1282    if ("mouse" === c)
1283      return {
1284        upName: "mouseup",
1285        upHandler: d.mouseupcaptured,
1286        moveName: "mousemove",
1287        moveHandler: d.mousemovecaptured,
1288      };
1289    if ("touch" === c)
1290      return {
1291        upName: "touchend",
1292        upHandler: d.touchendcaptured,
1293        moveName: "touchmove",
1294        moveHandler: d.touchmovecaptured,
1295      };
1296    throw new Error(
1297      "MouseTracker.getCaptureEventParams: Unknown pointer type.",
1298    );
1299  }
1300  function f(b, c, d) {
1301    var f,
1302      g = b.getActivePointersListByType(c);
1303    g.captureCount += d || 1;
1304    if (1 === g.captureCount)
1305      if (a.Browser.vendor === a.BROWSERS.IE && a.Browser.version < 9)
1306        b.element.setCapture(!0);
1307      else {
1308        f = e(b, a.MouseTracker.havePointerEvents ? "pointerevent" : c);
1309        qa &&
1310          na(window.top) &&
1311          a.addEvent(window.top, f.upName, f.upHandler, !0);
1312        a.addEvent(a.MouseTracker.captureElement, f.upName, f.up
1312Handler, !0);
1313        a.addEvent(
1314          a.MouseTracker.captureElement,
1315          f.moveName,
1316          f.moveHandler,
1317          !0,
1318        );
1319      }
1320  }
1321  function g(b, c, d) {
1322    var f,
1323      g = b.getActivePointersListByType(c);
1324    g.captureCount -= d || 1;
1325    if (0 === g.captureCount)
1326      if (a.Browser.vendor === a.BROWSERS.IE && a.Browser.version < 9)
1327        b.element.releaseCapture();
1328      else {
1329        f = e(b, a.MouseTracker.havePointerEvents ? "pointerevent" : c);
1330        qa &&
1331          na(window.top) &&
1332          a.removeEvent(window.top, f.upName, f.upHandler, !0);
1333        a.removeEvent(
1334          a.MouseTracker.captureElement,
1335          f.moveName,
1336          f.moveHandler,
1337          !0,
1338        );
1339        a.removeEvent(a.MouseTracker.captureElement, f.upName, f.upHandler, !0);
1340      }
1341  }
1342  function h(b) {
1343    var c;
1344    if (a.MouseTracker.unprefixedPointerEvents) c = b.pointerType;
1345    else
1346      switch (b.pointerType) {
1347        case 2:
1348          c = "touch";
1349          break;
1350        case 3:
1351          c = "pen";
1352          break;
1353        case 4:
1354          c = "mouse";
1355          break;
1356        default:
1357          c = "";
1358      }
1359    return c;
1360  }
1361  function i(b) {
1362    return a.getMousePosition(b);
1363  }
1364  function j(a, b) {
1365    return k(i(a), b);
1366  }
1367  function k(b, c) {
1368    var d = a.getElementOffset(c);
1369    return b.minus(d);
1370  }
1371  function l(b, c) {
1372    return new a.Point((b.x + c.x) / 2, (b.y + c.y) / 2);
1373  }
1374  function m(b, c) {
1375    b.clickHandler && a.cancelEvent(c);
1376  }
1377  function n(b, c) {
1378    b.dblClickHandler && a.cancelEvent(c);
1379  }
1380  function o(b, c) {
1381    var d;
1382    if (b.keyDownHandler) {
1383      c = a.getEvent(c);
1384      d = b.keyDownHandler({
1385        eventSource: b,
1386        keyCode: c.keyCode ? c.keyCode : c.charCode,
1387        ctrl: c.ctrlKey,
1388        shift: c.shiftKey,
1389        alt: c.altKey,
1390        meta: c.metaKey,
1391        originalEvent: c,
1392        preventDefaultAction: !1,
1393        userData: b.userData,
1394      });
1395      d || a.cancelEvent(c);
1396    }
1397  }
1398  function p(b, c) {
1399    var d;
1400    if (b.keyUpHandler) {
1401      c = a.getEvent(c);
1402      d = b.keyUpHandler({
1403        eventSource: b,
1404        keyCode: c.keyCode ? c.keyCode : c.charCode,
1405        ctrl: c.ctrlKey,
1406        shift: c.shiftKey,
1407        alt: c.altKey,
1408        meta: c.metaKey,
1409        originalEvent: c,
1410        preventDefaultAction: !1,
1411        userData: b.userData,
1412      });
1413      d || a.cancelEvent(c);
1414    }
1415  }
1416  function q(b, c) {
1417    var d;
1418    if (b.keyHandler) {
1419      c = a.getEvent(c);
1420      d = b.keyHandler({
1421        eventSource: b,
1422        keyCode: c.keyCode ? c.keyCode : c.charCode,
1423        ctrl: c.ctrlKey,
1424        shift: c.shiftKey,
1425        alt: c.altKey,
1426        meta: c.metaKey,
1427        originalEvent: c,
1428        preventDefaultAction: !1,
1429        userData: b.userData,
1430      });
1431      d || a.cancelEvent(c);
1432    }
1433  }
1434  function r(b, c) {
1435    var d;
1436    if (b.focusHandler) {
1437      c = a.getEvent(c);
1438      d = b.focusHandler({
1439        eventSource: b,
1440        originalEvent: c,
1441        preventDefaultAction: !1,
1442        userData: b.userData,
1443      });
1444      d === !1 && a.cancelEvent(c);
1445    }
1446  }
1447  function s(b, c) {
1448    var d;
1449    if (b.blurHandler) {
1450      c = a.getEvent(c);
1451      d = b.blurHandler({
1452        eventSource: b,
1453        originalEvent: c,
1454        preventDefaultAction: !1,
1455        userData: b.userData,
1456      });
1457      d === !1 && a.cancelEvent(c);
1458    }
1459  }
1460  function t(a, b) {
1461    v(a, b, b);
1462  }
1463  function u(b, c) {
1464    c = a.getEvent(c);
1465    var d = {
1466      target: c.target || c.srcElement,
1467      type: "wheel",
1468      shiftKey: c.shiftKey || !1,
1469      clientX: c.clientX,
1470      clientY: c.clientY,
1471      pageX: c.pageX ? c.pageX : c.clientX,
1472      pageY: c.pageY ? c.pageY : c.clientY,
1473      deltaMode: "MozMousePixelScroll" == c.type ? 0 : 1,
1474      deltaX: 0,
1475      deltaZ: 0,
1476    };
1477    "mousewheel" == a.MouseTracker.wheelEventName
1478      ? (d.deltaY = (-1 / a.DEFAULT_SETTINGS.pixelsPerWheelLine) * c.wheelDelta)
1479      : (d.deltaY = c.detail);
1480    v(b, d, c);
1481  }
1482  function v(b, c, d) {
1483    var e,
1484      f = 0;
1485    f = c.deltaY < 0 ? 1 : -1;
1486    if (b.scrollHandler) {
1487      e = b.scrollHandler({
1488        eventSource: b,
1489        pointerType: "mouse",
1490        position: j(c, b.element),
1491        scroll: f,
1492        shift: c.shiftKey,
1493        isTouchEvent: !1,
1494        originalEvent: d,
1495        preventDefaultAction: !1,
1496        userData: b.userData,
1497      });
1498      e === !1 && a.cancelEvent(d);
1499    }
1500  }
1501  function w(a, b) {
1502    if (a === b) return !1;
1503    for (; b && b !== a; ) b = b.parentNode;
1504    return b === a;
1505  }
1506  function x(b, c) {
1507    c = a.getEvent(c);
1508    z(b, c);
1509  }
1510  function y(b, c) {
1511    c = a.getEvent(c);
1512    c.currentTarget === c.relatedTarget ||
1513      w(c.currentTarget, c.relatedTarget) ||
1514      z(b, c);
1515  }
1516  function z(b, c) {
1517    var d = {
1518      id: a.MouseTracker.mousePointerId,
1519      type: "mouse",
1520      isPrimary: !0,
1521      currentPos: i(c),
1522      currentTime: a.now(),
1523    };
1524    ga(b, c, [d]);
1525  }
1526  function A(b, c) {
1527    c = a.getEvent(c);
1528    C(b, c);
1529  }
1530  function B(b, c) {
1531    c = a.getEvent(c);
1532    c.currentTarget === c.relatedTarget ||
1533      w(c.currentTarget, c.relatedTarget) ||
1534      C(b, c);
1535  }
1536  function C(b, c) {
1537    var d = {
1538      id: a.MouseTracker.mousePointerId,
1539      type: "mouse",
1540      isPrimary: !0,
1541      currentPos: i(c),
1542      currentTime: a.now(),
1543    };
1544    ha(b, c, [d]);
1545  }
1546  function D(b) {
1547    return a.Browser.vendor === a.BROWSERS.IE && a.Browser.version < 9
1548      ? 1 === b
1549        ? 0
1550        : 2 === b
1551          ? 2
1552          : 4 === b
1553            ? 1
1554            : -1
1555      : b;
1556  }
1557  function E(b, c) {
1558    var d;
1559    c = a.getEvent(c);
1560    d = {
1561      id: a.MouseTracker.mousePointerId,
1562      type: "mouse",
1563      isPrimary: !0,
1564      currentPos: i(c),
1565      currentTime: a.now(),
1566    };
1567    if (ia(b, c, [d], D(c.button))) {
1568      a.stopEvent(c);
1569      f(b, "mouse");
1570    }
1571    (b.clickHandler ||
1572      b.dblClickHandler ||
1573      b.pressHandler ||
1574      b.dragHandler ||
1575      b.dragEndHandler) &&
1576      a.cancelEvent(c);
1577  }
1578  function F(a, b) {
1579    H(a, b);
1580  }
1581  function G(b, c) {
1582    H(b, c);
1583    a.stopEvent(c);
1584  }
1585  function H(b, c) {
1586    var d;
1587    c = a.getEvent(c);
1588    d = {
1589      id: a.MouseTracker.mousePointerId,
1590      type: "mouse",
1591      isPrimary: !0,
1592      currentPos: i(c),
1593      currentTime: a.now(),
1594    };
1595    ja(b, c, [d], D(c.button)) && g(b, "mouse");
1596  }
1597  function I(a, b) {
1598    K(a, b);
1599  }
1600  function J(b, c) {
1601    K(b, c);
1602    a.stopEvent(c);
1603  }
1604  function K(b, c) {
1605    var d;
1606    c = a.getEvent(c);
1607    d = {
1608      id: a.MouseTracker.mousePointerId,
1609      type: "mouse",
1610      isPrimary: !0,
1611      currentPos: i(c),
1612      currentTime: a.now(),
1613    };
1614    ka(b, c, [d]);
1615  }
1616  function L(a, b, c) {
1617    var d,
1618      e = c.getLength(),
1619      f = [];
1620    for (d = 0; e > d; d++) f.push(c.getByIndex(d));
1621    if (f.length > 0) {
1622      ja(a, b, f, 0);
1623      c.captureCount = 1;
1624      g(a, "touch");
1625      ha(a, b, f);
1626    }
1627  }
1628  function M(b, c) {
1629    var d,
1630      e,
1631      g,
1632      h,
1633      j = c.changedTouches.length,
1634      k = [],
1635      l = b.getActivePointersListByType("touch");
1636    d = a.now();
1637    if (l.getLength() > c.touches.length - j) {
1638      a.console.warn(
1639        "Tracked touch contact count doesn't match event.touches.length. Removing all tracked touch pointers.",
1640      );
1641      L(b, c, l);
1642    }
1643    for (e = 0; j > e; e++)
1644      k.push({
1645        id: c.changedTouches[e].identifier,
1646        type: "touch",
1647        currentPos: i(c.changedTouches[e]),
1648        currentTime: d,
1649      });
1650    ga(b, c, k);
1651    for (e = 0; e < oa.length; e++)
1652      if (oa[e] !== b && oa[e].isTracking() && w(oa[e].element, b.element)) {
1653        h = [];
1654        for (g = 0; j > g; g++)
1655          h.push({
1656            id: c.changedTouches[g].identifier,
1657            type: "touch",
1658            currentPos: i(c.changedTouches[g]),
1659            currentTime: d,
1660          });
1661        ga(oa[e], c, h);
1662      }
1663    if (ia(b, c, k, 0)) {
1664      a.stopEvent(c);
1665      f(b, "touch", j);
1666    }
1667    a.cancelEvent(c);
1668  }
1669  function N(a, b) {
1670    P(a, b);
1671  }
1672  function O(b, c) {
1673    P(b, c);
1674    a.stopEvent(c);
1675  }
1676  function P(b, c) {
1677    var d,
1678      e,
1679      f,
1680      h,
1681      j = c.changedTouches.length,
1682      k = [];
1683    d = a.now();
1684    for (e = 0; j > e; e++)
1685      k.push({
1686        id: c.changedTouches[e].identifier,
1687        type: "touch",
1688        currentPos: i(c.changedTouches[e]),
1689        currentTime: d,
1690      });
1691    ja(b, c, k, 0) && g(b, "touch", j);
1692    ha(b, c, k);
1693    for (e = 0; e < oa.length; e++)
1694      if (oa[e] !== b && oa[e].isTracking() && w(oa[e].element, b.element)) {
1695        h = [];
1696        for (f = 0; j > f; f++)
1697          h.push({
1698            id: c.changedTouches[f].identifier,
1699            type: "touch",
1700            currentPos: i(c.changedTouches[f]),
1701            currentTime: d,
1702          });
1703        ha(oa[e], c, h);
1704      }
1705    a.cancelEvent(c);
1706  }
1707  function Q(a, b) {
1708    S(a, b);
1709  }
1710  function R(b, c) {
1711    S(b, c);
1712    a.stopEvent(c);
1713  }
1714  function S(b, c) {
1715    var d,
1716      e = c.changedTouches.length,
1717      f = [];
1718    for (d = 0; e > d; d++)
1719      f.push({
1720        id: c.changedTouches[d].identifier,
1721        type: "touch",
1722        currentPos: i(c.changedTouches[d]),
1723        currentTime: a.now(),
1724      });
1725    ka(b, c, f);
1726    a.cancelEvent(c);
1727  }
1728  function T(a, b) {
1729    var c = (b.changedTouches.length, a.getActivePointersListByType("touch"));
1730    L(a, b, c);
1731  }
1732  function U(a, b) {
1733    b.stopPropagation();
1734    b.preventDefault();
1735    return !1;
1736  }
1737  function V(a, b) {
1738    b.stopPropagation();
1739    b.preventDefault();
1740    return !1;
1741  }
1742  function W(b, c) {
1743    var d;
1744    if (
1745      c.currentTarget !== c.relatedTarget &&
1746      !w(c.currentTarget, c.relatedTarget)
1747    ) {
1748      d = {
1749        id: c.pointerId,
1750        type: h(c),
1751        isPrimary: c.isPrimary,
1752        currentPos: i(c),
1753        currentTime: a.now(),
1754      };
1755      ga(b, c, [d]);
1756    }
1757  }
1758  function X(b, c) {
1759    var d;
1760    if (
1761      c.currentTarget !== c.relatedTarget &&
1762      !w(c.currentTarget, c.relatedTarget)
1763    ) {
1764      d = {
1765        id: c.pointerId,
1766        type: h(c),
1767        isPrimary: c.isPrimary,
1768        currentPos: i(c),
1769        currentTime: a.now(),
1770      };
1771      ha(b, c, [d]);
1772    }
1773  }
1774  function Y(b, c) {
1775    var d;
1776    d = {
1777      id: c.pointerId,
1778      type: h(c),
1779      isPrimary: c.isPrimary,
1780      currentPos: i(c),
1781      currentTime: a.now(),
1782    };
1783    if (ia(b, c, [d], c.button)) {
1784      a.stopEvent(c);
1785      f(b, d.type);
1786    }
1787    (b.clickHandler ||
1788      b.dblClickHandler ||
1789      b.pressHandler ||
1790      b.dragHandler ||
1791      b.dragEndHandler ||
1792      b.pinchHandler) &&
1793      a.cancelEvent(c);
1794  }
1795  function Z(a, b) {
1796    _(a, b);
1797  }
1798  function $(b, c) {
1799    var d = b.getActivePointersListByType(h(c));
1800    d.getById(c.pointerId) && _(b, c);
1801    a.stopEvent(c);
1802  }
1803  function _(b, c) {
1804    var d;
1805    d = {
1806      id: c.pointerId,
1807      type: h(c),
1808      isPrimary: c.isPrimary,
1809      currentPos: i(c),
1810      currentTime: a.now(),
1811    };
1812    ja(b, c, [d], c.button) && g(b, d.type);
1813  }
1814  function aa(a, b) {
1815    ca(a, b);
1816  }
1817  function ba(b, c) {
1818    var d = b.getActivePointersListByType(h(c));
1819    d.getById(c.pointerId) && ca(b, c);
1820    a.stopEvent(c);
1821  }
1822  function ca(b, c) {
1823    var d;
1824    d = {
1825      id: c.pointerId,
1826      type: h(c),
1827      isPrimary: c.isPrimary,
1828      currentPos: i(c),
1829      currentTime: a.now(),
1830    };
1831    ka(b, c, [d]);
1832  }
1833  function da(a, b) {
1834    var c;
1835    c = { id: b.pointerId, type: h(b) };
1836    la(a, b, [c]);
1837  }
1838  function ea(a, b) {
1839    b.hasOwnProperty("isPrimary") ||
1840      (0 === a.getLength() ? (b.isPrimary = !0) : (b.isPrimary = !1));
1841    b.speed = 0;
1842    b.direction = 0;
1843    b.contactPos = b.currentPos;
1844    b.contactTime = b.currentTime;
1845    b.lastPos = b.currentPos;
1846    b.lastTime = b.currentTime;
1847    return a.add(b);
1848  }
1849  function fa(a, b) {
1850    var c, d;
1851    if (a.getById(b.id)) {
1852      c = a.removeById(b.id);
1853      if (!b.hasOwnProperty("isPrimary")) {
1854        d = a.getPrimary();
1855        if (!d) {
1856          d = a.getByIndex(0);
1857          d && (d.isPrimary = !0);
1858        }
1859      }
1860    } else c = a.getLength();
1861    return c;
1862  }
1863  function ga(b, c, d) {
1864    var e,
1865      f,
1866      g,
1867      h,
1868      i = b.getActivePointersListByType(d[0].type),
1869      j = d.length;
1870    for (e = 0; j > e; e++) {
1871      f = d[e];
1872      g = i.getById(f.id);
1873      if (g) {
1874        g.insideElement = !0;
1875        g.lastPos = g.currentPos;
1876        g.lastTime = g.currentTime;
1877        g.currentPos = f.currentPos;
1878        g.currentTime = f.currentTime;
1879        f = g;
1880      } else {
1881        f.captured = !1;
1882        f.insideElementPressed = !1;
1883        f.insideElement = !0;
1884        ea(i, f);
1885      }
1886      if (b.enterHandler) {
1887        h = b.enterHandler({
1888          eventSource: b,
1889          pointerType: f.type,
1890          position: k(f.currentPos, b.element),
1891          buttons: i.buttons,
1892          pointers: b.getActivePointerCount(),
1893          insideElementPressed: f.insideElementPressed,
1894          buttonDownAny: 0 !== i.buttons,
1895          isTouchEvent: "touch" === f.type,
1896          originalEvent: c,
1897          preventDefaultAction: !1,
1898          userData: b.userData,
1899        });
1900        h === !1 && a.cancelEvent(c);
1901      }
1902    }
1903  }
1904  function ha(b, c, d) {
1905    var e,
1906      f,
1907      g,
1908      h,
1909      i = (pa[b.hash], b.getActivePointersListByType(d[0].type)),
1910      j = d.length;
1911    for (e = 0; j > e; e++) {
1912      f = d[e];
1913      g = i.getById(f.id);
1914      if (g) {
1915        if (g.captured) {
1916          g.insideElement = !1;
1917          g.lastPos = g.currentPos;
1918          g.lastTime = g.currentTime;
1919          g.currentPos = f.currentPos;
1920          g.currentTime = f.currentTime;
1921        } else fa(i, g);
1922        f = g;
1923      }
1924      if (b.exitHandler) {
1925        h = b.exitHandler({
1926          eventSource: b,
1927          pointerType: f.type,
1928          position: k(f.currentPos, b.element),
1929          buttons: i.buttons,
1930          pointers: b.getActivePointerCount(),
1931          insideElementPressed: g ? g.insideElementPressed : !1,
1932          buttonDownAny: 0 !== i.buttons,
1933          isTouchEvent: "touch" === f.type,
1934          originalEvent: c,
1935          preventDefaultAction: !1,
1936          userData: b.userData,
1937        });
1938        h === !1 && a.cancelEvent(c);
1939      }
1940    }
1941  }
1942  function ia(b, c, d, e) {
1943    var f,
1944      g,
1945      h,
1946      i,
1947      j = pa[b.hash],
1948      m = b.getActivePointersListByType(d[0].type),
1949      n = d.length;
1950    "undefined" != typeof c.buttons
1951      ? (m.buttons = c.buttons)
1952      : a.Browser.vendor === a.BROWSERS.IE && a.Browser.version < 9
1953        ? 0 === e
1954          ? (m.buttons += 1)
1955          : 1 === e
1956            ? (m.buttons += 4)
1957            : 2 === e
1958              ? (m.buttons += 2)
1959              : 3 === e
1960                ? (m.buttons += 8)
1961                : 4 === e
1962                  ? (m.buttons += 16)
1963                  : 5 === e && (m.buttons += 32)
1964        : 0 === e
1965          ? (m.buttons |= 1)
1966          : 1 === e
1967            ? (m.buttons |= 4)
1968            : 2 === e
1969              ? (m.buttons |= 2)
1970              : 3 === e
1971                ? (m.buttons |= 8)
1972                : 4 === e
1973                  ? (m.buttons |= 16)
1974                  : 5 === e && (m.buttons |= 32);
1975    if (0 !== e) {
1976      if (b.nonPrimaryPressHandler) {
1977        f = b.nonPrimaryPressHandler({
1978          eventSource: b,
1979          pointerType: d[0].type,
1980          position: k(d[0].currentPos, b.element),
1981          button: e,
1982          buttons: m.buttons,
1983          isTouchEvent: "touch" === d[0].type,
1984          originalEvent: c,
1985          preventDefaultAction: !1,
1986          userData: b.userData,
1987        });
1988        f === !1 && a.cancelEvent(c);
1989      }
1990      return !1;
1991    }
1992    for (g = 0; n > g; g++) {
1993      h = d[g];
1994      i = m.getById(h.id);
1995      if (i) {
1996        i.captured = !0;
1997        i.insideElementPressed = !0;
1998        i.insideElement = !0;
1999        i.contactPos = h.currentPos;
2000        i.contactTime = h.currentTime;
2001        i.lastPos = i.currentPos;
2002        i.lastTime = i.currentTime;
2003        i.currentPos = h.currentPos;
2004        i.currentTime = h.currentTime;
2005        h = i;
2006      } else {
2007        h.captured = !0;
2008        h.insideElementPressed = !0;
2009        h.insideElement = !0;
2010        ea(m, h);
2011      }
2012      m.contacts++;
2013      (b.dragHandler || b.dragEndHandler || b.pinchHandler) &&
2014        a.MouseTracker.gesturePointVelocityTracker.addPoint(b, h);
2015      if (1 === m.contacts) {
2016        if (b.pressHandler) {
2017          f = b.pressHandler({
2018            eventSource: b,
2019            pointerType: h.type,
2020            position: k(h.contactPos, b.element),
2021            buttons: m.buttons,
2022            isTouchEvent: "touch" === h.type,
2023            originalEvent: c,
2024            preventDefaultAction: !1,
2025            userData: b.userData,
2026          });
2027          f === !1 && a.cancelEvent(c);
2028        }
2029      } else if (2 === m.contacts && b.pinchHandler && "touch" === h.type) {
2030        j.pinchGPoints = m.asArray();
2031        j.lastPinchDist = j.currentPinchDist =
2032          j.pinchGPoints[0].currentPos.distanceTo(j.pinchGPoints[1].currentPos);
2033        j.lastPinchCenter = j.currentPinchCenter = l(
2034          j.pinchGPoints[0].currentPos,
2035          j.pinchGPoints[1].currentPos,
2036        );
2037      }
2038    }
2039    return !0;
2040  }
2041  function ja(b, c, d, e) {
2042    var f,
2043      g,
2044      h,
2045      i,
2046      j,
2047      m,
2048      n,
2049      o = pa[b.hash],
2050      p = b.getActivePointersListByType(d[0].type),
2051      q = d.length,
2052      r = !1,
2053      s = !1;
2054    "undefined" != typeof c.buttons
2055      ? (p.buttons = c.buttons)
2056      : a.Browser.vendor === a.BROWSERS.IE && a.Browser.version < 9
2057        ? 0 === e
2058          ? (p.buttons -= 1)
2059          : 1 === e
2060            ? (p.buttons -= 4)
2061            : 2 === e
2062              ? (p.buttons -= 2)
2063              : 3 === e
2064                ? (p.buttons -= 8)
2065                : 4 === e
2066                  ? (p.buttons -= 16)
2067                  : 5 === e && (p.buttons -= 32)
2068        : 0 === e
2069          ? (p.buttons ^= -2)
2070          : 1 === e
2071            ? (p.buttons ^= -5)
2072            : 2 === e
2073              ? (p.buttons ^= -3)
2074              : 3 === e
2075                ? (p.buttons ^= -9)
2076                : 4 === e
2077                  ? (p.buttons ^= -17)
2078                  : 5 === e && (p.buttons ^= -33);
2079    if (0 !== e) {
2080      if (b.nonPrimaryReleaseHandler) {
2081        f = b.nonPrimaryReleaseHandler({
2082          eventSource: b,
2083          pointerType: d[0].type,
2084          position: k(d[0].currentPos, b.element),
2085          button: e,
2086          buttons: p.buttons,
2087          isTouchEvent: "touch" === d[0].type,
2088          originalEvent: c,
2089          preventDefaultAction: !1,
2090          userData: b.userData,
2091        });
2092        f === !1 && a.cancelEvent(c);
2093      }
2094      return !1;
2095    }
2096    for (i = 0; q > i; i++) {
2097      j = d[i];
2098      m = p.getById(j.id);
2099      if (m) {
2100        if (m.captured) {
2101          m.captured = !1;
2102          r = !0;
2103          s = !0;
2104        }
2105        m.lastPos = m.currentPos;
2106        m.lastTime = m.currentTime;
2107        m.currentPos = j.currentPos;
2108        m.currentTime = j.currentTime;
2109        m.insideElement || fa(p, m);
2110        g = m.currentPos;
2111        h = m.currentTime;
2112        if (s) {
2113          p.contacts--;
2114          (b.dragHandler || b.dragEndHandler || b.pinchHandler) &&
2115            a.MouseTracker.gesturePointVelocityTracker.removePoint(b, m);
2116          if (0 === p.contacts) {
2117            if (b.releaseHandler) {
2118              f = b.releaseHandler({
2119                eventSource: b,
2120                pointerType: m.type,
2121                position: k(g, b.element),
2122                buttons: p.buttons,
2123                insideElementPressed: m.insideElementPressed,
2124                insideElementReleased: m.insideElement,
2125                isTouchEvent: "touch" === m.type,
2126                originalEvent: c,
2127                preventDefaultAction: !1,
2128                userData: b.userData,
2129              });
2130              f === !1 && a.cancelEvent(c);
2131            }
2132            if (b.dragEndHandler && !m.currentPos.equals(m.contactPos)) {
2133              f = b.dragEndHandler({
2134                eventSource: b,
2135                pointerType: m.type,
2136                position: k(m.currentPos, b.element),
2137                speed: m.speed,
2138                direction: m.direction,
2139                shift: c.shiftKey,
2140                isTouchEvent: "touch" === m.type,
2141                originalEvent: c,
2142                preventDefaultAction: !1,
2143                userData: b.userData,
2144              });
2145              f === !1 && a.cancelEvent(c);
2146            }
2147            if ((b.clickHandler || b.dblClickHandler) && m.insideElement) {
2148              n =
2149                h - m.contactTime <= b.clickTimeThreshold &&
2150                m.contactPos.distanceTo(g) <= b.clickDistThreshold;
2151              if (b.clickHandler) {
2152                f = b.clickHandler({
2153                  eventSource: b,
2154                  pointerType: m.type,
2155                  position: k(m.currentPos, b.element),
2156                  quick: n,
2157                  shift: c.shiftKey,
2158                  isTouchEvent: "touch" === m.type,
2159                  originalEvent: c,
2160                  preventDefaultAction: !1,
2161                  userData: b.userData,
2162                });
2163                f === !1 && a.cancelEvent(c);
2164              }
2165              if (b.dblClickHandler && n) {
2166                p.clicks++;
2167                if (1 === p.clicks) {
2168                  o.lastClickPos = g;
2169                  o.dblClickTimeOut = setTimeout(function () {
2170                    p.clicks = 0;
2171                  }, b.dblClickTimeThreshold);
2172                } else if (2 === p.clicks) {
2173                  clearTimeout(o.dblClickTimeOut);
2174                  p.clicks = 0;
2175                  if (o.lastClickPos.distanceTo(g) <= b.dblClickDistThreshold) {
2176                    f = b.dblClickHandler({
2177                      eventSource: b,
2178                      pointerType: m.type,
2179                      position: k(m.currentPos, b.element),
2180                      shift: c.shiftKey,
2181                      isTouchEvent: "touch" === m.type,
2182                      originalEvent: c,
2183                      preventDefaultAction: !1,
2184                      userData: b.userData,
2185                    });
2186                    f === !1 && a.cancelEvent(c);
2187                  }
2188                  o.lastClickPos = null;
2189                }
2190              }
2191            }
2192          } else if (2 === p.contacts && b.pinchHandler && "touch" === m.type) {
2193            o.pinchGPoints = p.asArray();
2194            o.lastPinchDist = o.currentPinchDist =
2195              o.pinchGPoints[0].currentPos.distanceTo(
2196                o.pinchGPoints[1].currentPos,
2197              );
2198            o.lastPinchCenter = o.currentPinchCenter = l(
2199              o.pinchGPoints[0].currentPos,
2200              o.pinchGPoints[1].currentPos,
2201            );
2202          }
2203        } else if (b.releaseHandler) {
2204          f = b.releaseHandler({
2205            eventSource: b,
2206            pointerType: m.type,
2207            position: k(g, b.element),
2208            buttons: p.buttons,
2209            insideElementPressed: m.insideElementPressed,
2210            insideElementReleased: m.insideElement,
2211            isTouchEvent: "touch" === m.type,
2212            originalEvent: c,
2213            preventDefaultAction: !1,
2214            userData: b.userData,
2215          });
2216          f === !1 && a.cancelEvent(c);
2217        }
2218      }
2219    }
2220    return r;
2221  }
2222  function ka(b, c, d) {
2223    var e,
2224      f,
2225      g,
2226      h,
2227      i,
2228      j,
2229      m = pa[b.hash],
2230      n = b.getActivePointersListByType(d[0].type),
2231      o = d.length;
2232    "undefined" != typeof c.buttons && (n.buttons = c.buttons);
2233    for (e = 0; o > e; e++) {
2234      f = d[e];
2235      g = n.getById(f.id);
2236      if (g) {
2237        f.hasOwnProperty("isPrimary") && (g.isPrimary = f.isPrimary);
2238        g.lastPos = g.currentPos;
2239        g.lastTime = g.currentTime;
2240        g.currentPos = f.currentPos;
2241        g.currentTime = f.currentTime;
2242      } else {
2243        f.captured = !1;
2244        f.insideElementPressed = !1;
2245        f.insideElement = !0;
2246        ea(n, f);
2247      }
2248    }
2249    if (b.stopHandler && "mouse" === d[0].type) {
2250      clearTimeout(b.stopTimeOut);
2251      b.stopTimeOut = setTimeout(function () {
2252        ma(b, c, d[0].type);
2253      }, b.stopDelay);
2254    }
2255    if (0 === n.contacts) {
2256      if (b.moveHandler) {
2257        j = b.moveHandler({
2258          eventSource: b,
2259          pointerType: d[0].type,
2260          position: k(d[0].currentPos, b.element),
2261          buttons: n.buttons,
2262          isTouchEvent: "touch" === d[0].type,
2263          originalEvent: c,
2264          preventDefaultAction: !1,
2265          userData: b.userData,
2266        });
2267        j === !1 && a.cancelEvent(c);
2268      }
2269    } else if (1 === n.contacts) {
2270      if (b.moveHandler) {
2271        g = n.asArray()[0];
2272        j = b.moveHandler({
2273          eventSource: b,
2274          pointerType: g.type,
2275          position: k(g.currentPos, b.element),
2276          buttons: n.buttons,
2277          isTouchEvent: "touch" === g.type,
2278          originalEvent: c,
2279          preventDefaultAction: !1,
2280          userData: b.userData,
2281        });
2282        j === !1 && a.cancelEvent(c);
2283      }
2284      if (b.dragHandler) {
2285        g = n.asArray()[0];
2286        i = g.currentPos.minus(g.lastPos);
2287        j = b.dragHandler({
2288          eventSource: b,
2289          pointerType: g.type,
2290          position: k(g.currentPos, b.element),
2291          buttons: n.buttons,
2292          delta: i,
2293          speed: g.speed,
2294          direction: g.direction,
2295          shift: c.shiftKey,
2296          isTouchEvent: "touch" === g.type,
2297          originalEvent: c,
2298          preventDefaultAction: !1,
2299          userData: b.userData,
2300        });
2301        j === !1 && a.cancelEvent(c);
2302      }
2303    } else if (2 === n.contacts) {
2304      if (b.moveHandler) {
2305        h = n.asArray();
2306        j = b.moveHandler({
2307          eventSource: b,
2308          pointerType: h[0].type,
2309          position: k(l(h[0].currentPos, h[1].currentPos), b.element),
2310          buttons: n.buttons,
2311          isTouchEvent: "touch" === h[0].type,
2312          originalEvent: c,
2313          preventDefaultAction: !1,
2314          userData: b.userData,
2315        });
2316        j === !1 && a.cancelEvent(c);
2317      }
2318      if (b.pinchHandler && "touch" === d[0].type) {
2319        i = m.pinchGPoints[0].currentPos.distanceTo(
2320          m.pinchGPoints[1].currentPos,
2321        );
2322        if (i != m.currentPinchDist) {
2323          m.lastPinchDist = m.currentPinchDist;
2324          m.currentPinchDist = i;
2325          m.lastPinchCenter = m.currentPinchCenter;
2326          m.currentPinchCenter = l(
2327            m.pinchGPoints[0].currentPos,
2328            m.pinchGPoints[1].currentPos,
2329          );
2330          j = b.pinchHandler({
2331            eventSource: b,
2332            pointerType: "touch",
2333            gesturePoints: m.pinchGPoints,
2334            lastCenter: k(m.lastPinchCenter, b.element),
2335            center: k(m.currentPinchCenter, b.element),
2336            lastDistance: m.lastPinchDist,
2337            distance: m.currentPinchDist,
2338            shift: c.shiftKey,
2339            originalEvent: c,
2340            preventDefaultAction: !1,
2341            userData: b.userData,
2342          });
2343          j === !1 && a.cancelEvent(c);
2344        }
2345      }
2346    }
2347  }
2348  function la(a, b, c) {
2349    ja(a, b, c, 0);
2350    ha(a, b, c);
2351  }
2352  function ma(a, b, c) {
2353    a.stopHandler &&
2354      a.stopHandler({
2355        eventSource: a,
2356        pointerType: c,
2357        position: j(b, a.element),
2358        buttons: a.getActivePointersListByType(c).buttons,
2359        isTouchEvent: "touch" === c,
2360        originalEvent: b,
2361        preventDefaultAction: !1,
2362        userData: a.userData,
2363      });
2364  }
2365  function na(a) {
2366    try {
2367      return a.addEventListener && a.removeEventListener;
2368    } catch (b) {
2369      return !1;
2370    }
2371  }
2372  var oa = [];
2373  var pa = {};
2374  a.MouseTracker = function (b) {
2375    oa.push(this);
2376    var c = arguments;
2377    a.isPlainObject(b) ||
2378      (b = {
2379        element: c[0],
2380        clickTimeThreshold: c[1],
2381        clickDistThreshold: c[2],
2382      });
2383    this.hash = Math.random();
2384    this.element = a.getElement(b.element);
2385    this.clickTimeThreshold =
2386      b.clickTimeThreshold || a.DEFAULT_SETTINGS.clickTimeThreshold;
2387    this.clickDistThreshold =
2388      b.clickDistThreshold || a.DEFAULT_SETTINGS.clickDistThreshold;
2389    this.dblClickTimeThreshold =
2390      b.dblClickTimeThreshold || a.DEFAULT_SETTINGS.dblClickTimeThreshold;
2391    this.dblClickDistThreshold =
2392      b.dblClickDistThreshold || a.DEFAULT_SETTINGS.dblClickDistThreshold;
2393    this.userData = b.userData || null;
2394    this.stopDelay = b.stopDelay || 50;
2395    this.enterHandler = b.enterHandler || null;
2396    this.exitHandler = b.exitHandler || null;
2397    this.pressHandler = b.pressHandler || null;
2398    this.nonPrimaryPressHandler = b.nonPrimaryPressHandler || null;
2399    this.releaseHandler = b.releaseHandler || null;
2400    this.nonPrimaryReleaseHandler = b.nonPrimaryReleaseHandler || null;
2401    this.moveHandler = b.moveHandler || null;
2402    this.scrollHandler = b.scrollHandler || null;
2403    this.clickHandler = b.clickHandler || null;
2404    this.dblClickHandler = b.dblClickHandler || null;
2405    this.dragHandler = b.dragHandler || null;
2406    this.dragEndHandler = b.dragEndHandler || null;
2407    this.pinchHandler = b.pinchHandler || null;
2408    this.stopHandler = b.stopHandler || null;
2409    this.keyDownHandler = b.keyDownHandler || null;
2410    this.keyUpHandler = b.keyUpHandler || null;
2411    this.keyHandler = b.keyHandler || null;
2412    this.focusHandler = b.focusHandler || null;
2413    this.blurHandler = b.blurHandler || null;
2414    var d = this;
2415    pa[this.hash] = {
2416      click: function (a) {
2417        m(d, a);
2418      },
2419      dblclick: function (a) {
2420        n(d, a);
2421      },
2422      keydown: function (a) {
2423        o(d, a);
2424      },
2425      keyup: function (a) {
2426        p(d, a);
2427      },
2428      keypress: function (a) {
2429        q(d, a);
2430      },
2431      focus: function (a) {
2432        r(d, a);
2433      },
2434      blur: function (a) {
2435        s(d, a);
2436      },
2437      wheel: function (a) {
2438        t(d, a);
2439      },
2440      mousewheel: function (a) {
2441        u(d, a);
2442      },
2443      DOMMouseScroll: function (a) {
2444        u(d, a);
2445      },
2446      MozMousePixelScroll: function (a) {
2447        u(d, a);
2448      },
2449      mouseenter: function (a) {
2450        x(d, a);
2451      },
2452      mouseleave: function (a) {
2453        A(d, a);
2454      },
2455      mouseover: function (a) {
2456        y(d, a);
2457      },
2458      mouseout: function (a) {
2459        B(d, a);
2460      },
2461      mousedown: function (a) {
2462        E(d, a);
2463      },
2464      mouseup: function (a) {
2465        F(d, a);
2466      },
2467      mouseupcaptured: function (a) {
2468        G(d, a);
2469      },
2470      mousemove: function (a) {
2471        I(d, a);
2472      },
2473      mousemovecaptured: function (a) {
2474        J(d, a);
2475      },
2476      touchstart: function (a) {
2477        M(d, a);
2478      },
2479      touchend: function (a) {
2480        N(d, a);
2481      },
2482      touchendcaptured: function (a) {
2483        O(d, a);
2484      },
2485      touchmove: function (a) {
2486        Q(d, a);
2487      },
2488      touchmovecaptured: function (a) {
2489        R(d, a);
2490      },
2491      touchcancel: function (a) {
2492        T(d, a);
2493      },
2494      gesturestart: function (a) {
2495        U(d, a);
2496      },
2497      gesturechange: function (a) {
2498        V(d, a);
2499      },
2500      pointerover: function (a) {
2501        W(d, a);
2502      },
2503      MSPointerOver: function (a) {
2504        W(d, a);
2505      },
2506      pointerout: function (a) {
2507        X(d, a);
2508      },
2509      MSPointerOut: function (a) {
2510        X(d, a);
2511      },
2512      pointerdown: function (a) {
2513        Y(d, a);
2514      },
2515      MSPointerDown: function (a) {
2516        Y(d, a);
2517      },
2518      pointerup: function (a) {
2519        Z(d, a);
2520      },
2521      MSPointerUp: function (a) {
2522        Z(d, a);
2523      },
2524      pointermove: function (a) {
2525        aa(d, a);
2526      },
2527      MSPointerMove: function (a) {
2528        aa(d, a);
2529      },
2530      pointercancel: function (a) {
2531        da(d, a);
2532      },
2533      MSPointerCancel: function (a) {
2534        da(d, a);
2535      },
2536      pointerupcaptured: function (a) {
2537        $(d, a);
2538      },
2539      pointermovecaptured: function (a) {
2540        ba(d, a);
2541      },
2542      tracking: !1,
2543      activePointersLists: [],
2544      lastClickPos: null,
2545      dblClickTimeOut: null,
2546      pinchGPoints: [],
2547      lastPinchDist: 0,
2548      currentPinchDist: 0,
2549      lastPinchCenter: null,
2550      currentPinchCenter: null,
2551    };
2552    b.startDisabled || this.setTracking(!0);
2553  };
2554  a.MouseTracker.prototype = {
2555    destroy: function () {
2556      var a;
2557      d(this);
2558      this.element = null;
2559      for (a = 0; a < oa.length; a++)
2560        if (oa[a] === this) {
2561          oa.splice(a, 1);
2562          break;
2563        }
2564      pa[this.hash] = null;
2565      delete pa[this.hash];
2566    },
2567    isTracking: function () {
2568      return pa[this.hash].tracking;
2569    },
2570    setTracking: function (a) {
2571      a ? c(this) : d(this);
2572      return this;
2573    },
2574    getActivePointersListByType: function (b) {
2575      var c,
2576        d,
2577        e = pa[this.hash],
2578        f = e.activePointersLists.length;
2579      for (c = 0; f > c; c++)
2580        if (e.activePointersLists[c].type === b)
2581          return e.activePointersLists[c];
2582      d = new a.MouseTracker.GesturePointList(b);
2583      e.activePointersLists.push(d);
2584      return d;
2585    },
2586    getActivePointerCount: function () {
2587      var a,
2588        b = pa[this.hash],
2589        c = b.activePointersLists.length,
2590        d = 0;
2591      for (a = 0; c > a; a++) d += b.activePointersLists[a].getLength();
2592      return d;
2593    },
2594    enterHandler: function () {},
2595    exitHandler: function () {},
2596    pressHandler: function () {},
2597    nonPrimaryPressHandler: function () {},
2598    releaseHandler: function () {},
2599    nonPrimaryReleaseHandler: function () {},
2600    moveHandler: function () {},
2601    scrollHandler: function () {},
2602    clickHandler: function () {},
2603    dblClickHandler: function () {},
2604    dragHandler: function () {},
2605    dragEndHandler: function () {},
2606    pinchHandler: function () {},
2607    stopHandler: function () {},
2608    keyDownHandler: function () {},
2609    keyUpHandler: function () {},
2610    keyHandler: function () {},
2611    focusHandler: function () {},
2612    blurHandler: function () {},
2613  };
2614  a.MouseTracker.gesturePointVelocityTracker = (function () {
2615    var b = [],
2616      c = 0,
2617      d = 0;
2618    var e = function (a, b) {
2619      return a.hash.toString() + b.type + b.id.toString();
2620    };
2621    var f = function () {
2622      var c,
2623        e,
2624        f,
2625        g,
2626        h,
2627        i,
2628        j = b.length,
2629        k = a.now();
2630      g = k - d;
2631      d = k;
2632      for (c = 0; j > c; c++) {
2633        e = b[c];
2634        f = e.gPoint;
2635        f.direction = Math.atan2(
2636          f.currentPos.y - e.lastPos.y,
2637          f.currentPos.x - e.lastPos.x,
2638        );
2639        h = e.lastPos.distanceTo(f.currentPos);
2640        e.lastPos = f.currentPos;
2641        i = (1e3 * h) / (g + 1);
2642        f.speed = 0.75 * i + 0.25 * f.speed;
2643      }
2644    };
2645    var g = function (g, h) {
2646      var i = e(g, h);
2647      b.push({ guid: i, gPoint: h, lastPos: h.currentPos });
2648      if (1 === b.length) {
2649        d = a.now();
2650        c = window.setInterval(f, 50);
2651      }
2652    };
2653    var h = function (a, d) {
2654      var f,
2655        g = e(a, d),
2656        h = b.length;
2657      for (f = 0; h > f; f++)
2658        if (b[f].guid === g) {
2659          b.splice(f, 1);
2660          h--;
2661          0 === h && window.clearInterval(c);
2662          break;
2663        }
2664    };
2665    return { addPoint: g, removePoint: h };
2666  })();
2667  a.MouseTracker.captureElement = document;
2668  a.MouseTracker.wheelEventName =
2669    (a.Browser.vendor == a.BROWSERS.IE && a.Browser.version > 8) ||
2670    "onwheel" in document.createElement("div")
2671      ? "wheel"
2672      : void 0 !== document.onmousewheel
2673        ? "mousewheel"
2674        : "DOMMouseScroll";
2675  a.MouseTracker.supportsMouseCapture = (function () {
2676    var b = document.createElement("div");
2677    return a.isFunction(b.setCapture) && a.isFunction(b.releaseCapture);
2678  })();
2679  a.MouseTracker.subscribeEvents = [
2680    "click",
2681    "dblclick",
2682    "keydown",
2683    "keyup",
2684    "keypress",
2685    "focus",
2686    "blur",
2687    a.MouseTracker.wheelEventName,
2688  ];
2689  "DOMMouseScroll" == a.MouseTracker.wheelEventName &&
2690    a.MouseTracker.subscribeEvents.push("MozMousePixelScroll");
2691  if (
2692    window.PointerEvent &&
2693    (window.navigator.pointerEnabled || a.Browser.vendor !== a.BROWSERS.IE)
2694  ) {
2695    a.MouseTracker.havePointerEvents = !0;
2696    a.MouseTracker.subscribeEvents.push(
2697      "pointerover",
2698      "pointerout",
2699      "pointerdown",
2700      "pointerup",
2701      "pointermove",
2702      "pointercancel",
2703    );
2704    a.MouseTracker.unprefixedPointerEvents = !0;
2705    navigator.maxTouchPoints
2706      ? (a.MouseTracker.maxTouchPoints = navigator.maxTouchPoints)
2707      : (a.MouseTracker.maxTouchPoints = 0);
2708    a.MouseTracker.haveMouseEnter = !1;
2709  } else if (window.MSPointerEvent && window.navigator.msPointerEnabled) {
2710    a.MouseTracker.havePointerEvents = !0;
2711    a.MouseTracker.subscribeEvents.push(
2712      "MSPointerOver",
2713      "MSPointerOut",
2714      "MSPointerDown",
2715      "MSPointerUp",
2716      "MSPointerMove",
2717      "MSPointerCancel",
2718    );
2719    a.MouseTracker.unprefixedPointerEvents = !1;
2720    navigator.msMaxTouchPoints
2721      ? (a.MouseTracker.maxTouchPoints = navigator.msMaxTouchPoints)
2722      : (a.MouseTracker.maxTouchPoints = 0);
2723    a.MouseTracker.haveMouseEnter = !1;
2724  } else {
2725    a.MouseTracker.havePointerEvents = !1;
2726    if (a.Browser.vendor === a.BROWSERS.IE && a.Browser.version < 9) {
2727      a.MouseTracker.subscribeEvents.push("mouseenter", "mouseleave");
2728      a.MouseTracker.haveMouseEnter = !0;
2729    } else {
2730      a.MouseTracker.subscribeEvents.push("mouseover", "mouseout");
2731      a.MouseTracker.haveMouseEnter = !1;
2732    }
2733    a.MouseTracker.subscribeEvents.push("mousedown", "mouseup", "mousemove");
2734    "ontouchstart" in window &&
2735      a.MouseTracker.subscribeEvents.push(
2736        "touchstart",
2737        "touchend",
2738        "touchmove",
2739        "touchcancel",
2740      );
2741    "ongesturestart" in window &&
2742      a.MouseTracker.subscribeEvents.push("gesturestart", "gesturechange");
2743    a.MouseTracker.mousePointerId = "legacy-mouse";
2744    a.MouseTracker.maxTouchPoints = 10;
2745  }
2746  a.MouseTracker.GesturePointList = function (a) {
2747    this._gPoints = [];
2748    this.type = a;
2749    this.buttons = 0;
2750    this.contacts = 0;
2751    this.clicks = 0;
2752    this.captureCount = 0;
2753  };
2754  a.MouseTracker.GesturePointList.prototype = {
2755    getLength: function () {
2756      return this._gPoints.length;
2757    },
2758    asArray: function () {
2759      return this._gPoints;
2760    },
2761    add: function (a) {
2762      return this._gPoints.push(a);
2763    },
2764    removeById: function (a) {
2765      var b,
2766        c = this._gPoints.length;
2767      for (b = 0; c > b; b++)
2768        if (this._gPoints[b].id === a) {
2769          this._gPoints.splice(b, 1);
2770          break;
2771        }
2772      return this._gPoints.length;
2773    },
2774    getByIndex: function (a) {
2775      return a < this._gPoints.length ? this._gPoints[a] : null;
2776    },
2777    getById: function (a) {
2778      var b,
2779        c = this._gPoints.length;
2780      for (b = 0; c > b; b++)
2781        if (this._gPoints[b].id === a) return this._gPoints[b];
2782      return null;
2783    },
2784    getPrimary: function (a) {
2785      var b,
2786        c = this._gPoints.length;
2787      for (b = 0; c > b; b++)
2788        if (this._gPoints[b].isPrimary) return this._gPoints[b];
2789      return null;
2790    },
2791  };
2792  var qa = (function () {
2793    try {
2794      return window.self !== window.top;
2795    } catch (a) {
2796      return !0;
2797    }
2798  })();
2799})(OpenSeadragon);
2800!(function (a) {
2801  a.ControlAnchor = {
2802    NONE: 0,
2803    TOP_LEFT: 1,
2804    TOP_RIGHT: 2,
2805    BOTTOM_RIGHT: 3,
2806    BOTTOM_LEFT: 4,
2807    ABSOLUTE: 5,
2808  };
2809  a.Control = function (b, c, d) {
2810    var e = b.parentNode;
2811    if ("number" == typeof c) {
2812      a.console.error(
2813        "Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; please use an options object instead.  Support for this deprecated variant is scheduled for removal in December 2013",
2814      );
2815      c = { anchor: c };
2816    }
2817    c.attachToViewer =
2818      "undefined" == typeof c.attachToViewer ? !0 : c.attachToViewer;
2819    this.autoFade = "undefined" == typeof c.autoFade ? !0 : c.autoFade;
2820    this.element = b;
2821    this.anchor = c.anchor;
2822    this.container = d;
2823    if (this.anchor == a.ControlAnchor.ABSOLUTE) {
2824      this.wrapper = a.makeNeutralElement("div");
2825      this.wrapper.style.position = "absolute";
2826      this.wrapper.style.top = "number" == typeof c.top ? c.top + "px" : c.top;
2827      this.wrapper.style.left =
2828        "number" == typeof c.left ? c.left + "px" : c.left;
2829      this.wrapper.style.height =
2830        "number" == typeof c.height ? c.height + "px" : c.height;
2831      this.wrapper.style.width =
2832        "number" == typeof c.width ? c.width + "px" : c.width;
2833      this.wrapper.style.margin = "0px";
2834      this.wrapper.style.padding = "0px";
2835      this.element.style.position = "relative";
2836      this.element.style.top = "0px";
2837      this.element.style.left = "0px";
2838      this.element.style.height = "100%";
2839      this.element.style.width = "100%";
2840    } else {
2841      this.wrapper = a.makeNeutralElement("div");
2842      this.wrapper.style.display = "inline-block";
2843      this.anchor == a.ControlAnchor.NONE &&
2844        (this.wrapper.style.width = this.wrapper.style.height = "100%");
2845    }
2846    this.wrapper.appendChild(this.element);
2847    c.attachToViewer
2848      ? this.anchor == a.ControlAnchor.TOP_RIGHT ||
2849        this.anchor == a.ControlAnchor.BOTTOM_RIGHT
2850        ? this.container.insertBefore(this.wrapper, this.container.firstChild)
2851        : this.container.appendChild(this.wrapper)
2852      : e.appendChild(this.wrapper);
2853  };
2854  a.Control.prototype = {
2855    destroy: function () {
2856      this.wrapper.removeChild(this.element);
2857      this.container.removeChild(this.wrapper);
2858    },
2859    isVisible: function () {
2860      return "none" != this.wrapper.style.display;
2861    },
2862    setVisible: function (b) {
2863      this.wrapper.style.display = b
2864        ? this.anchor == a.ControlAnchor.ABSOLUTE
2865          ? "block"
2866          : "inline-block"
2867        : "none";
2868    },
2869    setOpacity: function (b) {
2870      this.element[a.SIGNAL] && a.Browser.vendor == a.BROWSERS.IE
2871        ? a.setElementOpacity(this.element, b, !0)
2872        : a.setElementOpacity(this.wrapper, b, !0);
2873    },
2874  };
2875})(OpenSeadragon);
2876!(function (a) {
2877  function b(a, b) {
2878    var c,
2879      d = a.controls;
2880    for (c = d.length - 1; c >= 0; c--) if (d[c].element == b) return c;
2881    return -1;
2882  }
2883  a.ControlDock = function (b) {
2884    var c,
2885      d,
2886      e = ["topleft", "topright", "bottomright", "bottomleft"];
2887    a.extend(
2888      !0,
2889      this,
2890      {
2891        id: "controldock-" + a.now() + "-" + Math.floor(1e6 * Math.random()),
2892        container: a.makeNeutralElement("div"),
2893        controls: [],
2894      },
2895      b,
2896    );
2897    this.container.onsubmit = function () {
2898      return !1;
2899    };
2900    if (this.element) {
2901      this.element = a.getElement(this.element);
2902      this.element.appendChild(this.container);
2903      this.element.style.position = "relative";
2904      this.container.style.width = "100%";
2905      this.container.style.height = "100%";
2906    }
2907    for (d = 0; d < e.length; d++) {
2908      c = e[d];
2909      this.controls[c] = a.makeNeutralElement("div");
2910      this.controls[c].style.position = "absolute";
2911      c.match("left") && (this.controls[c].style.left = "0px");
2912      c.match("right") && (this.controls[c].style.right = "0px");
2913      c.match("top") && (this.controls[c].style.top = "0px");
2914      c.match("bottom") && (this.controls[c].style.bottom = "0px");
2915    }
2916    this.container.appendChild(this.controls.topleft);
2917    this.container.appendChild(this.controls.topright);
2918    this.container.appendChild(this.controls.bottomright);
2919    this.container.appendChild(this.controls.bottomleft);
2920  };
2921  a.ControlDock.prototype = {
2922    addControl: function (c, d) {
2923      c = a.getElement(c);
2924      var e = null;
2925      if (!(b(this, c) >= 0)) {
2926        switch (d.anchor) {
2927          case a.ControlAnchor.TOP_RIGHT:
2928            e = this.controls.topright;
2929            c.style.position = "relative";
2930            c.style.paddingRight = "0px";
2931            c.style.paddingTop = "0px";
2932            break;
2933          case a.ControlAnchor.BOTTOM_RIGHT:
2934            e = this.controls.bottomright;
2935            c.style.position = "relative";
2936            c.style.paddingRight = "0px";
2937            c.style.paddingBottom = "0px";
2938            break;
2939          case a.ControlAnchor.BOTTOM_LEFT:
2940            e = this.controls.bottomleft;
2941            c.style.position = "relative";
2942            c.style.paddingLeft = "0px";
2943            c.style.paddingBottom = "0px";
2944            break;
2945          case a.ControlAnchor.TOP_LEFT:
2946            e = this.controls.topleft;
2947            c.style.position = "relative";
2948            c.style.paddingLeft = "0px";
2949            c.style.paddingTop = "0px";
2950            break;
2951          case a.ControlAnchor.ABSOLUTE:
2952            e = this.container;
2953            c.style.margin = "0px";
2954            c.style.padding = "0px";
2955            break;
2956          default:
2957          case a.ControlAnchor.NONE:
2958            e = this.container;
2959            c.style.margin = "0px";
2960            c.style.padding = "0px";
2961        }
2962        this.controls.push(new a.Control(c, d, e));
2963        c.style.display = "inline-block";
2964      }
2965    },
2966    removeControl: function (c) {
2967      c = a.getElement(c);
2968      var d = b(this, c);
2969      if (d >= 0) {
2970        this.controls[d].destroy();
2971        this.controls.splice(d, 1);
2972      }
2973      return this;
2974    },
2975    clearControls: function () {
2976      for (; this.controls.length > 0; ) this.controls.pop().destroy();
2977      return this;
2978    },
2979    areControlsEnabled: function () {
2980      var a;
2981      for (a = this.controls.length - 1; a >= 0; a--)
2982        if (this.controls[a].isVisible()) return !0;
2983      return !1;
2984    },
2985    setControlsEnabled: function (a) {
2986      var b;
2987      for (b = this.controls.length - 1; b >= 0; b--)
2988        this.controls[b].setVisible(a);
2989      return this;
2990    },
2991  };
2992})(OpenSeadragon);
2993!(function (a) {
2994  a.Placement = a.freezeObject({
2995    CENTER: 0,
2996    TOP_LEFT: 1,
2997    TOP: 2,
2998    TOP_RIGHT: 3,
2999    RIGHT: 4,
3000    BOTTOM_RIGHT: 5,
3001    BOTTOM: 6,
3002    BOTTOM_LEFT: 7,
3003    LEFT: 8,
3004    properties: {
3005      0: {
3006        isLeft: !1,
3007        isHorizontallyCentered: !0,
3008        isRight: !1,
3009        isTop: !1,
3010        isVerticallyCentered: !0,
3011        isBottom: !1,
3012      },
3013      1: {
3014        isLeft: !0,
3015        isHorizontallyCentered: !1,
3016        isRight: !1,
3017        isTop: !0,
3018        isVerticallyCentered: !1,
3019        isBottom: !1,
3020      },
3021      2: {
3022        isLeft: !1,
3023        isHorizontallyCentered: !0,
3024        isRight: !1,
3025        isTop: !0,
3026        isVerticallyCentered: !1,
3027        isBottom: !1,
3028      },
3029      3: {
3030        isLeft: !1,
3031        isHorizontallyCentered: !1,
3032        isRight: !0,
3033        isTop: !0,
3034        isVerticallyCentered: !1,
3035        isBottom: !1,
3036      },
3037      4: {
3038        isLeft: !1,
3039        isHorizontallyCentered: !1,
3040        isRight: !0,
3041        isTop: !1,
3042        isVerticallyCentered: !0,
3043        isBottom: !1,
3044      },
3045      5: {
3046        isLeft: !1,
3047        isHorizontallyCentered: !1,
3048        isRight: !0,
3049        isTop: !1,
3050        isVerticallyCentered: !1,
3051        isBottom: !0,
3052      },
3053      6: {
3054        isLeft: !1,
3055        isHorizontallyCentered: !0,
3056        isRight: !1,
3057        isTop: !1,
3058        isVerticallyCentered: !1,
3059        isBottom: !0,
3060      },
3061      7: {
3062        isLeft: !0,
3063        isHorizontallyCentered: !1,
3064        isRight: !1,
3065        isTop: !1,
3066        isVerticallyCentered: !1,
3067        isBottom: !0,
3068      },
3069      8: {
3070        isLeft: !0,
3071        isHorizontallyCentered: !1,
3072        isRight: !1,
3073        isTop: !1,
3074        isVerticallyCentered: !0,
3075        isBottom: !1,
3076      },
3077    },
3078  });
3079})(OpenSeadragon);
3080!(function (a) {
3081  function b(b) {
3082    b = a.getElement(b);
3083    return new a.Point(
3084      0 === b.clientWidth ? 1 : b.clientWidth,
3085      0 === b.clientHeight ? 1 : b.clientHeight,
3086    );
3087  }
3088  function c(b, c, d, e) {
3089    function f(a, b) {
3090      if (a.ready) d(a);
3091      else {
3092        a.addHandler("ready", function () {
3093          d(a);
3094        });
3095        a.addHandler("open-failed", function (a) {
3096          e({ message: a.message, source: b });
3097        });
3098      }
3099    }
3100    var g = b;
3101    "string" == a.type(c) &&
3102      (c.match(/\s*<.*/)
3103        ? (c = a.parseXml(c))
3104        : c.match(/\s*[\{\[].*/) && (c = a.parseJSON(c)));
3105    setTimeout(function () {
3106      if ("string" == a.type(c)) {
3107        c = new a.TileSource({
3108          url: c,
3109          crossOriginPolicy: b.crossOriginPolicy,
3110          ajaxWithCredentials: b.ajaxWithCredentials,
3111          useCanvas: b.useCanvas,
3112          success: function (a) {
3113            d(a.tileSource);
3114          },
3115        });
3116        c.addHandler("open-failed", function (a) {
3117          e(a);
3118        });
3119      } else if (a.isPlainObject(c) || c.nodeType) {
3120        !c.crossOriginPolicy &&
3121          b.crossOriginPolicy &&
3122          (c.crossOriginPolicy = b.crossOriginPolicy);
3123        void 0 === c.ajaxWithCredentials &&
3124          (c.ajaxWithCredentials = b.ajaxWithCredentials);
3125        void 0 === c.useCanvas && (c.useCanvas = b.useCanvas);
3126        if (a.isFunction(c.getTileUrl)) {
3127          var h = new a.TileSource(c);
3128          h.getTileUrl = c.getTileUrl;
3129          d(h);
3130        } else {
3131          var i = a.TileSource.determineType(g, c);
3132          if (!i) {
3133            e({ message: "Unable to load TileSource", source: c });
3134            return;
3135          }
3136          var j = i.prototype.configure.apply(g, [c]);
3137          f(new i(j), c);
3138        }
3139      } else f(c, c);
3140    });
3141  }
3142  function d(b, c) {
3143    if (c instanceof a.Overlay) return c;
3144    var d = null;
3145    if (c.element) d = a.getElement(c.element);
3146    else {
3147      var e = c.id
3148        ? c.id
3149        : "openseadragon-overlay-" + Math.floor(1e7 * Math.random());
3150      d = a.getElement(c.id);
3151      if (!d) {
3152        d = document.createElement("a");
3153        d.href = "#/overlay/" + e;
3154      }
3155      d.id = e;
3156      a.addClass(d, c.className ? c.className : "openseadragon-overlay");
3157    }
3158    var f = c.location;
3159    var g = c.width;
3160    var h = c.height;
3161    if (!f) {
3162      var i = c.x;
3163      var j = c.y;
3164      if (void 0 !== c.px) {
3165        var k = b.viewport.imageToViewportRectangle(
3166          new a.Rect(c.px, c.py, g || 0, h || 0),
3167        );
3168        i = k.x;
3169        j = k.y;
3170        g = void 0 !== g ? k.width : void 0;
3171        h = void 0 !== h ? k.height : void 0;
3172      }
3173      f = new a.Point(i, j);
3174    }
3175    var l = c.placement;
3176    l && "string" === a.type(l) && (l = a.Placement[c.placement.toUpperCase()]);
3177    return new a.Overlay({
3178      element: d,
3179      location: f,
3180      placement: l,
3181      onDraw: c.onDraw,
3182      checkResize: c.checkResize,
3183      width: g,
3184      height: h,
3185      rotationMode: c.rotationMode,
3186    });
3187  }
3188  function e(a, b) {
3189    var c;
3190    for (c = a.length - 1; c >= 0; c--) if (a[c].element === b) return c;
3191    return -1;
3192  }
3193  function f(b, c) {
3194    return a.requestAnimationFrame(function () {
3195      c(b);
3196    });
3197  }
3198  function g(b) {
3199    a.requestAnimationFrame(function () {
3200      i(b);
3201    });
3202  }
3203  function h(b) {
3204    if (b.autoHideControls) {
3205      b.controlsShouldFade = !0;
3206      b.controlsFadeBeginTime = a.now() + b.controlsFadeDelay;
3207      window.setTimeout(function () {
3208        g(b);
3209      }, b.controlsFadeDelay);
3210    }
3211  }
3212  function i(b) {
3213    var c, d, e, f;
3214    if (b.controlsShouldFade) {
3215      c = a.now();
3216      d = c - b.controlsFadeBeginTime;
3217      e = 1 - d / b.controlsFadeLength;
3218      e = Math.min(1, e);
3219      e = Math.max(0, e);
3220      for (f = b.controls.length - 1; f >= 0;
3220 f--)
3221        b.controls[f].autoFade && b.controls[f].setOpacity(e);
3222      e > 0 && g(b);
3223    }
3224  }
3225  function j(a) {
3226    var b;
3227    a.controlsShouldFade = !1;
3228    for (b = a.controls.length - 1; b >= 0; b--) a.controls[b].setOpacity(1);
3229  }
3230  function k() {
3231    j(this);
3232  }
3233  function l() {
3234    h(this);
3235  }
3236  function m(b) {
3237    if (b.preventDefaultAction || b.ctrl || b.alt || b.meta) return !0;
3238    switch (b.keyCode) {
3239      case 38:
3240        b.shift
3241          ? this.viewport.zoomBy(1.1)
3242          : this.viewport.panBy(
3243              this.viewport.deltaPointsFromPixels(new a.Point(0, -40)),
3244            );
3245        this.viewport.applyConstraints();
3246        return !1;
3247      case 40:
3248        b.shift
3249          ? this.viewport.zoomBy(0.9)
3250          : this.viewport.panBy(
3251              this.viewport.deltaPointsFromPixels(new a.Point(0, 40)),
3252            );
3253        this.viewport.applyConstraints();
3254        return !1;
3255      case 37:
3256        this.viewport.panBy(
3257          this.viewport.deltaPointsFromPixels(new a.Point(-40, 0
3257)),
3258        );
3259        this.viewport.applyConstraints();
3260        return !1;
3261      case 39:
3262        this.viewport.panBy(
3263          this.viewport.deltaPointsFromPixels(new a.Point(40, 0)),
3264        );
3265        this.viewport.applyConstraints();
3266        return !1;
3267      default:
3268        return !0;
3269    }
3270  }
3271  function n(b) {
3272    if (b.preventDefaultAction || b.ctrl || b.alt || b.meta) return !0;
3273    switch (b.keyCode) {
3274      case 43:
3275      case 61:
3276        this.viewport.zoomBy(1.1);
3277        this.viewport.applyConstraints();
3278        return !1;
3279      case 45:
3280        this.viewport.zoomBy(0.9);
3281        this.viewport.applyConstraints();
3282        return !1;
3283      case 48:
3284        this.viewport.goHome();
3285        this.viewport.applyConstraints();
3286        return !1;
3287      case 119:
3288      case 87:
3289        b.shift
3290          ? this.viewport.zoomBy(1.1)
3291          : this.viewport.panBy(
3292              this.viewport.deltaPointsFromPixels(new a.Point(0, -40)),
3293            );
3294        this.viewport.applyConstraints();
3295        return !1;
3296      case 115:
3297      case 83:
3298        b.shift
3299          ? this.viewport.zoomBy(0.9)
3300          : this.viewport.panBy(
3301              this.viewport.deltaPointsFromPixels(new a.Point(0, 40)),
3302            );
3303        this.viewport.applyConstraints();
3304        return !1;
3305      case 97:
3306        this.viewport.panBy(
3307          this.viewport.deltaPointsFromPixels(new a.Point(-40, 0)),
3308        );
3309        this.viewport.applyConstraints();
3310        return !1;
3311      case 100:
3312        this.viewport.panBy(
3313          this.viewport.deltaPointsFromPixels(new a.Point(40, 0)),
3314        );
3315        this.viewport.applyConstraints();
3316        return !1;
3317      default:
3318        return !0;
3319    }
3320  }
3321  function o(a) {
3322    var b;
3323    var c = document.activeElement == this.canvas;
3324    c || this.canvas.focus();
3325    if (!a.preventDefaultAction && this.viewport && a.quick) {
3326      b = this.gestureSettingsByDeviceType(a.pointerType);
3327      if (b.clickToZoom) {
3328        this.viewport.zoomBy(
3329          a.shift ? 1 / this.zoomPerClick : this.zoomPerClick,
3330          this.viewport.pointFromPixel(a.position, !0),
3331        );
3332        this.viewport.applyConstraints();
3333      }
3334    }
3335    this.raiseEvent("canvas-click", {
3336      tracker: a.eventSource,
3337      position: a.position,
3338      quick: a.quick,
3339      shift: a.shift,
3340      originalEvent: a.originalEvent,
3341    });
3342  }
3343  function p(a) {
3344    var b;
3345    if (!a.preventDefaultAction && this.viewport) {
3346      b = this.gestureSettingsByDeviceType(a.pointerType);
3347      if (b.dblClickToZoom) {
3348        this.viewport.zoomBy(
3349          a.shift ? 1 / this.zoomPerClick : this.zoomPerClick,
3350          this.viewport.pointFromPixel(a.position, !0),
3351        );
3352        this.viewport.applyConstraints();
3353      }
3354    }
3355    this.raiseEvent("canvas-double-click", {
3356      tracker: a.eventSource,
3357      position: a.position,
3358      shift: a.shift,
3359      originalEvent: a.originalEvent,
3360    });
3361  }
3362  function q(a) {
3363    var b;
3364    if (!a.preventDefaultAction && this.viewport) {
3365      b = this.gestureSettingsByDeviceType(a.pointerType);
3366      this.panHorizontal || (a.delta.x = 0);
3367      this.panVertical || (a.delta.y = 0);
3368      this.viewport.panBy(
3369        this.viewport.deltaPointsFromPixels(a.delta.negate()),
3370        b.flickEnabled,
3371      );
3372      this.constrainDuringPan && this.viewport.applyConstraints();
3373    }
3374    this.raiseEvent("canvas-drag", {
3375      tracker: a.eventSource,
3376      position: a.position,
3377      delta: a.delta,
3378      speed: a.speed,
3379      direction: a.direction,
3380      shift: a.shift,
3381      originalEvent: a.originalEvent,
3382    });
3383  }
3384  function r(b) {
3385    if (!b.preventDefaultAction && this.viewport) {
3386      var c = this.gestureSettingsByDeviceType(b.pointerType);
3387      if (c.flickEnabled && b.speed >= c.flickMinSpeed) {
3388        var d = 0;
3389        this.panHorizontal &&
3390          (d = c.flickMomentum * b.speed * Math.cos(b.direction));
3391        var e = 0;
3392        this.panVertical &&
3393          (e = c.flickMomentum * b.speed * Math.sin(b.direction));
3394        var f = this.viewport.pixelFromPoint(this.viewport.getCenter(!0));
3395        var g = this.viewport.pointFromPixel(new a.Point(f.x - d, f.y - e));
3396        this.viewport.panTo(g, !1);
3397      }
3398      this.viewport.applyConstraints();
3399    }
3400    this.raiseEvent("canvas-drag-end", {
3401      tracker: b.eventSource,
3402      position: b.position,
3403      speed: b.speed,
3404      direction: b.direction,
3405      shift: b.shift,
3406      originalEvent: b.originalEvent,
3407    });
3408  }
3409  function s(a) {
3410    this.raiseEvent("canvas-enter", {
3411      tracker: a.eventSource,
3412      pointerType: a.pointerType,
3413      position: a.position,
3414      buttons: a.buttons,
3415      pointers: a.pointers,
3416      insideElementPressed: a.insideElementPressed,
3417      buttonDownAny: a.buttonDownAny,
3418      originalEvent: a.originalEvent,
3419    });
3420  }
3421  function t(a) {
3422    this.raiseEvent("canvas-exit", {
3423      tracker: a.eventSource,
3424      pointerType: a.pointerType,
3425      position: a.position,
3426      buttons: a.buttons,
3427      pointers: a.pointers,
3428      insideElementPressed: a.insideElementPressed,
3429      buttonDownAny: a.buttonDownAny,
3430      originalEvent: a.originalEvent,
3431    });
3432  }
3433  function u(a) {
3434    this.raiseEvent("canvas-press", {
3435      tracker: a.eventSource,
3436      pointerType: a.pointerType,
3437      position: a.position,
3438      insideElementPressed: a.insideElementPressed,
3439      insideElementReleased: a.insideElementReleased,
3440      originalEvent: a.originalEvent,
3441    });
3442  }
3443  function v(a) {
3444    this.raiseEvent("canvas-release", {
3445      tracker: a.eventSource,
3446      pointerType: a.pointerType,
3447      position: a.position,
3448      insideElementPressed: a.insideElementPressed,
3449      insideElementReleased: a.insideElementReleased,
3450      originalEvent: a.originalEvent,
3451    });
3452  }
3453  function w(a) {
3454    this.raiseEvent("canvas-nonprimary-press", {
3455      tracker: a.eventSource,
3456      position: a.position,
3457      pointerType: a.pointerType,
3458      button: a.button,
3459      buttons: a.buttons,
3460      originalEvent: a.originalEvent,
3461    });
3462  }
3463  function x(a) {
3464    this.raiseEvent("canvas-nonprimary-release", {
3465      tracker: a.eventSource,
3466      position: a.position,
3467      pointerType: a.pointerType,
3468      button: a.button,
3469      buttons: a.buttons,
3470      originalEvent: a.originalEvent,
3471    });
3472  }
3473  function y(a) {
3474    var b, c, d, e;
3475    if (!a.preventDefaultAction && this.viewport) {
3476      b = this.gestureSettingsByDeviceType(a.pointerType);
3477      if (b.pinchToZoom) {
3478        c = this.viewport.pointFromPixel(a.center, !0);
3479        d = this.viewport.pointFromPixel(a.lastCenter, !0);
3480        e = d.minus(c);
3481        this.panHorizontal || (e.x = 0);
3482        this.panVertical || (e.y = 0);
3483        this.viewport.zoomBy(a.distance / a.lastDistance, c, !0);
3484        this.viewport.panBy(e, !0);
3485        this.viewport.applyConstraints();
3486      }
3487      if (b.pinchRotate) {
3488        var f = Math.atan2(
3489          a.gesturePoints[0].currentPos.y - a.gesturePoints[1].currentPos.y,
3490          a.gesturePoints[0].currentPos.x - a.gesturePoints[1].currentPos.x,
3491        );
3492        var g = Math.atan2(
3493          a.gesturePoints[0].lastPos.y - a.gesturePoints[1].lastPos.y,
3494          a.gesturePoints[0].lastPos.x - a.gesturePoints[1].lastPos.x,
3495        );
3496        this.viewport.setRotation(
3497          this.viewport.getRotation() + (f - g) * (180 / Math.PI),
3498        );
3499      }
3500    }
3501    this.raiseEvent("canvas-pinch", {
3502      tracker: a.eventSource,
3503      gesturePoints: a.gesturePoints,
3504      lastCenter: a.lastCenter,
3505      center: a.center,
3506      lastDistance: a.lastDistance,
3507      distance: a.distance,
3508      shift: a.shift,
3509      originalEvent: a.originalEvent,
3510    });
3511    return !1;
3512  }
3513  function z(b) {
3514    var c, d, e, f;
3515    e = a.now();
3516    f = e - this._lastScrollTime;
3517    if (f >
3517 this.minScrollDeltaTime) {
3518      this._lastScrollTime = e;
3519      if (!b.preventDefaultAction && this.viewport) {
3520        c = this.gestureSettingsByDeviceType(b.pointerType);
3521        if (c.scrollToZoom) {
3522          d = Math.pow(this.zoomPerScroll, b.scroll);
3523          this.viewport.zoomBy(d, this.viewport.pointFromPixel(b.position, !0));
3524          this.viewport.applyConstraints();
3525        }
3526      }
3527      this.raiseEvent("canvas-scroll", {
3528        tracker: b.eventSource,
3529        position: b.position,
3530        scroll: b.scroll,
3531        shift: b.shift,
3532        originalEvent: b.originalEvent,
3533      });
3534      if (c && c.scrollToZoom) return !1;
3535    } else {
3536      c = this.gestureSettingsByDeviceType(b.pointerType);
3537      if (c && c.scrollToZoom) return !1;
3538    }
3539  }
3540  function A(a) {
3541    U[this.hash].mouseInside = !0;
3542    j(this);
3543    this.raiseEvent("container-enter", {
3544      tracker: a.eventSource,
3545      position: a.position,
3546      buttons: a.buttons,
3547      pointers: a.pointers,
3548      insideElementPressed: a.insideElementPressed,
3549      buttonDownAny: a.buttonDownAny,
3550      originalEvent: a.originalEvent,
3551    });
3552  }
3553  function B(a) {
3554    if (a.pointers < 1) {
3555      U[this.hash].mouseInside = !1;
3556      U[this.hash].animating || h(this);
3557    }
3558    this.raiseEvent("container-exit", {
3559      tracker: a.eventSource,
3560      position: a.position,
3561      buttons: a.buttons,
3562      pointers: a.pointers,
3563      insideElementPressed: a.insideElementPressed,
3564      buttonDownAny: a.buttonDownAny,
3565      originalEvent: a.originalEvent,
3566    });
3567  }
3568  function C(a) {
3569    D(a);
3570    a.isOpen() ? (a._updateRequestId = f(a, C)) : (a._updateRequestId = !1);
3571  }
3572  function D(a) {
3573    if (!a._opening) {
3574      if (a.autoResize) {
3575        var c = b(a.container);
3576        var d = U[a.hash].prevContainerSize;
3577        if (!c.equals(d)) {
3578          var e = a.viewport;
3579          if (a.preserveImageSizeOnResize) {
3580            var f = d.x / c.x;
3581            var g = e.getZoom() * f;
3582            var i = e.getCenter();
3583            e.resize(c, !1);
3584            e.zoomTo(g, null, !0);
3585            e.panTo(i, !0);
3586          } else {
3587            var k = e.getBounds();
3588            e.resize(c, !0);
3589            e.fitBoundsWithConstraints(k, !0);
3590          }
3591          U[a.hash].prevContainerSize = c;
3592          U[a.hash].forceRedraw = !0;
3593        }
3594      }
3595      var l = a.viewport.update();
3596      var m = a.world.update() || l;
3597      l && a.raiseEvent("viewport-change");
3598      a.referenceStrip && (m = a.referenceStrip.update(a.viewport) || m);
3599      if (!U[a.hash].animating && m) {
3600        a.raiseEvent("animation-start");
3601        j(a);
3602      }
3603      if (m || U[a.hash].forceRedraw || a.world.needsDraw()) {
3604        E(a);
3605        a._drawOverlays();
3606        a.navigator && a.navigator.update(a.viewport);
3607        U[a.hash].forceRedraw = !1;
3608        m && a.raiseEvent("animation");
3609      }
3610      if (U[a.hash].animating && !m) {
3611        a.raiseEvent("animation-finish");
3612        U[a.hash].mouseInside || h(a);
3613      }
3614      U[a.hash].animating = m;
3615    }
3616  }
3617  function E(a) {
3618    a.imageLoader.clear();
3619    a.drawer.clear();
3620    a.world.draw();
3621    a.raiseEvent("update-viewport", {});
3622  }
3623  function F(a, b) {
3624    return a ? a + b : b;
3625  }
3626  function G() {
3627    U[this.hash].lastZoomTime = a.now();
3628    U[this.hash].zoomFactor = this.zoomPerSecond;
3629    U[this.hash].zooming = !0;
3630    J(this);
3631  }
3632  function H() {
3633    U[this.hash].lastZoomTime = a.now();
3634    U[this.hash].zoomFactor = 1 / this.zoomPerSecond;
3635    U[this.hash].zooming = !0;
3636    J(this);
3637  }
3638  function I() {
3639    U[this.hash].zooming = !1;
3640  }
3641  function J(b) {
3642    a.requestAnimationFrame(a.delegate(b, K));
3643  }
3644  function K() {
3645    var b, c, d;
3646    if (U[this.hash].zooming && this.viewport) {
3647      b = a.now();
3648      c = b - U[this.hash].lastZoomTime;
3649      d = Math.pow(U[this.hash].zoomFactor, c / 1e3);
3650      this.viewport.zoomBy(d);
3651      this.viewport.applyConstraints();
3652      U[this.hash].lastZoomTime = b;
3653      J(this);
3654    }
3655  }
3656  function L() {
3657    if (this.viewport) {
3658      U[this.hash].zooming = !1;
3659      this.viewport.zoomBy(this.zoomPerClick / 1);
3660      this.viewport.applyConstraints();
3661    }
3662  }
3663  function M() {
3664    if (this.viewport) {
3665      U[this.hash].zooming = !1;
3666      this.viewport.zoomBy(1 / this.zoomPerClick);
3667      this.viewport.applyConstraints();
3668    }
3669  }
3670  function N() {
3671    this.buttons.emulateEnter();
3672    this.buttons.emulateExit();
3673  }
3674  function O() {
3675    this.viewport && this.viewport.goHome();
3676  }
3677  function P() {
3678    this.isFullPage() && !a.isFullScreen()
3679      ? this.setFullPage(!1)
3680      : this.setFullScreen(!this.isFullPage());
3681    this.buttons && this.buttons.emulateExit();
3682    this.fullPageButton.element.focus();
3683    this.viewport && this.viewport.applyConstraints();
3684  }
3685  function Q() {
3686    if (this.viewport) {
3687      var a = this.viewport.getRotation();
3688      0 === a ? (a = 270) : (a -= 90);
3689      this.viewport.setRotation(a);
3690    }
3691  }
3692  function R() {
3693    if (this.viewport) {
3694      var a = this.viewport.getRotation();
3695      270 === a ? (a = 0) : (a += 90);
3696      this.viewport.setRotation(a);
3697    }
3698  }
3699  function S() {
3700    var a = this._sequenceIndex - 1;
3701    this.navPrevNextWrap && 0 > a && (a += this.tileSources.length);
3702    this.goToPage(a);
3703  }
3704  function T() {
3705    var a = this._sequenceIndex + 1;
3706    this.navPrevNextWrap && a >= this.tileSources.length && (a = 0);
3707    this.goToPage(a);
3708  }
3709  var U = {};
3710  var V = 1;
3711  a.Viewer = function (c) {
3712    var d,
3713      e = arguments,
3714      g = this;
3715    a.isPlainObject(c) ||
3716      (c = {
3717        id: e[0],
3718        xmlPath: e.length > 1 ? e[1] : void 0,
3719        prefixUrl: e.length > 2 ? e[2] : void 0,
3720        controls: e.length > 3 ? e[3] : void 0,
3721        overlays: e.length > 4 ? e[4] : void 0,
3722      });
3723    if (c.config) {
3724      a.extend(!0, c, c.config);
3725      delete c.config;
3726    }
3727    a.extend(
3728      !0,
3729      this,
3730      {
3731        id: c.id,
3732        hash: c.hash || V++,
3733        element: null,
3734        container: null,
3735        canvas: null,
3736        overlays: [],
3737        overlaysContainer: null,
3738        previousBody: [],
3739        customControls: [],
3740        source: null,
3741        drawer: null,
3742        world: null,
3743        viewport: null,
3744        navigator: null,
3745        collectionViewport: null,
3746        collectionDrawer: null,
3747        navImages: null,
3748        buttons: null,
3749        profiler: null,
3750      },
3751      a.DEFAULT_SETTINGS,
3752      c,
3753    );
3754    if ("undefined" == typeof this.hash)
3755      throw new Error(
3756        "A hash must be defined, either by specifying options.id or options.hash.",
3757      );
3758    "undefined" != typeof U[this.hash] &&
3759      a.console.warn("Hash " + this.hash + " has already been used.");
3760    U[this.hash] = {
3761      fsBoundsDelta: new a.Point(1, 1),
3762      prevContainerSize: null,
3763      animating: !1,
3764      forceRedraw: !1,
3765      mouseInside: !1,
3766      group: null,
3767      zooming: !1,
3768      zoomFactor: null,
3769      lastZoomTime: null,
3770      fullPage: !1,
3771      onfullscreenchange: null,
3772    };
3773    this._sequenceIndex = 0;
3774    this._firstOpen = !0;
3775    this._updateRequestId = null;
3776    this._loadQueue = [];
3777    this.currentOverlays = [];
3778    this._lastScrollTime = a.now();
3779    a.EventSource.call(this);
3780    this.addHandler("open-failed", function (b) {
3781      var c = a.getString("Errors.OpenFailed", b.eventSource, b.message);
3782      g._showMessage(c);
3783    });
3784    a.ControlDock.call(this, c);
3785    this.xmlPath && (this.tileSources = [this.xmlPath]);
3786    this.element = this.element || document.getElementById(this.id);
3787    this.canvas = a.makeNeutralElement("div");
3788    this.canvas.className = "openseadragon-canvas";
3789    !(function (a) {
3790      a.width = "100%";
3791      a.height = "100%";
3792      a.overflow = "hidden";
3793      a.position = "absolute";
3794      a.top = "0px";
3795      a.left = "0px";
3796    })(this.canvas.style);
3797    a.setElementTouchActionNone(this.canvas);
3798    "" !== c.tabIndex &&
3799      (this.canvas.tabIndex = void 0 === c.tabIndex ? 0 : c.tabIndex);
3800    this.container.className = "openseadragon-container";
3801    !(function (a) {
3802      a.width = "100%";
3803      a.height = "100%";
3804      a.position = "relative";
3805      a.overflow = "hidden";
3806      a.left = "0px";
3807      a.top = "0px";
3808      a.textAlign = "left";
3809    })(this.container.style);
3810    this.container.insertBefore(this.canvas, this.container.firstChild);
3811    this.element.appendChild(this.container);
3812    this.bodyWidth = document.body.style.width;
3813    this.bodyHeight = document.body.style.height;
3814    this.bodyOverflow = document.body.style.overflow;
3815    this.docOverflow = document.documentElement.style.overflow;
3816    this.innerTracker = new a.MouseTracker({
3817      element: this.canvas,
3818      startDisabled: this.mouseNavEnabled ? !1 : !0,
3819      clickTimeThreshold: this.clickTimeThreshold,
3820      clickDistThreshold: this.clickDistThreshold,
3821      dblClickTimeThreshold: this.dblClickTimeThreshold,
3822      dblClickDistThreshold: this.dblClickDistThreshold,
3823      keyDownHandler: a.delegate(this, m),
3824      keyHandler: a.delegate(this, n),
3825      clickHandler: a.delegate(this, o),
3826      dblClickHandler: a.delegate(this, p),
3827      dragHandler: a.delegate(this, q),
3828      dragEndHandler: a.delegate(this, r),
3829      enterHandler: a.delegate(this, s),
3830      exitHandler: a.delegate(this, t),
3831      pressHandler: a.delegate(this, u),
3832      releaseHandler: a.delegate(this, v),
3833      nonPrimaryPressHandler: a.delegate(this, w),
3834      nonPrimaryReleaseHandler: a.delegate(this, x),
3835      scrollHandler: a.delegate(this, z),
3836      pinchHandler: a.delegate(this, y),
3837    });
3838    this.outerTracker = new a.MouseTracker({
3839      element: this.container,
3840      startDisabled: this.mouseNavEnabled ? !1 : !0,
3841      clickTimeThreshold: this.clickTimeThreshold,
3842      clickDistThreshold: this.clickDistThreshold,
3843      dblClickTimeThreshold: this.dblClickTimeThreshold,
3844      dblClickDistThreshold: this.dblClickDistThreshold,
3845      enterHandler: a.delegate(this, A),
3846      exitHandler: a.delegate(this, B),
3847    });
3848    this.toolbar &&
3849      (this.toolbar = new a.ControlDock({ element: this.toolbar }));
3850    this.bindStandardControls();
3851    U[this.hash].prevContainerSize = b(this.container);
3852    this.world = new a.World({ viewer: this });
3853    this.world.addHandler("add-item", function (a) {
3854      g.source = g.world.getItemAt(0).source;
3855      U[g.hash].forceRedraw = !0;
3856      g._updateRequestId || (g._updateRequestId = f(g, C));
3857    });
3858    this.world.addHandler("remove-item", function (a) {
3859      g.world.getItemCount()
3860        ? (g.source = g.world.getItemAt(0).source)
3861        : (g.source = null);
3862      U[g.hash].forceRedraw = !0;
3863    });
3864    this.world.addHandler("metrics-change", function (a) {
3865      g.viewport &&
3866        g.viewport._setContentBounds(
3867          g.world.getHomeBounds(),
3868          g.world.getContentFactor(),
3869        );
3870    });
3871    this.world.addHandler("item-index-change", function (a) {
3872      g.source = g.world.getItemAt(0).source;
3873    });
3874    this.viewport = new a.Viewport({
3875      containerSize: U[this.hash].prevContainerSize,
3876      springStiffness: this.springStiffness,
3877      animationTime: this.animationTime,
3878      minZoomImageRatio: this.minZoomImageRatio,
3879      maxZoomPixelRatio: this.maxZoomPixelRatio,
3880      visibilityRatio: this.visibilityRatio,
3881      wrapHorizontal: this.wrapHorizontal,
3882      wrapVertical: this.wrapVertical,
3883      defaultZoomLevel: this.defaultZoomLevel,
3884      minZoomLevel: this.minZoomLevel,
3885      maxZoomLevel: this.maxZoomLevel,
3886      viewer: this,
3887      degrees: this.degrees,
3888      navigatorRotate: this.navigatorRotate,
3889      homeFillsViewer: this.homeFillsViewer,
3890      margins: this.viewportMargins,
3891    });
3892    this.viewport._setContentBounds(
3893      this.world.getHomeBounds(),
3894      this.world.getContentFactor(),
3895    );
3896    this.imageLoader = new a.ImageLoader({ jobLimit: this.imageLoaderLimit });
3897    this.tileCache = new a.TileCache({
3898      maxImageCacheCount: this.maxImageCacheCount,
3899    });
3900    this.drawer = new a.Drawer({
3901      viewer: this,
3902      viewport: this.viewport,
3903      element: this.canvas,
3904      debugGridColor: this.debugGridColor,
3905    });
3906    this.overlaysContainer = a.makeNeutralElement("div");
3907    this.canvas.appendChild(this.overlaysContainer);
3908    if (!this.drawer.canRotate()) {
3909      if (this.rotateLeft) {
3910        d = this.buttons.buttons.indexOf(this.rotateLeft);
3911        this.buttons.buttons.splice(d, 1);
3912        this.buttons.element.removeChild(this.rotateLeft.element);
3913      }
3914      if (this.rotateRight) {
3915        d = this.buttons.buttons.indexOf(this.rotateRight);
3916        this.buttons.buttons.splice(d, 1);
3917        this.buttons.element.removeChild(this.rotateRight.element);
3918      }
3919    }
3920    this.showNavigator &&
3921      (this.navigator = new a.Navigator({
3922        id: this.navigatorId,
3923        position: this.navigatorPosition,
3924        sizeRatio: this.navigatorSizeRatio,
3925        maintainSizeRatio: this.navigatorMaintainSizeRatio,
3926        top: this.navigatorTop,
3927        left: this.navigatorLeft,
3928        width: this.navigatorWidth,
3929        height: this.navigatorHeight,
3930        autoResize: this.navigatorAutoResize,
3931        autoFade: this.navigatorAutoFade,
3932        prefixUrl: this.prefixUrl,
3933        viewer: this,
3934        navigatorRotate: this.navigatorRotate,
3935        crossOriginPolicy: this.crossOriginPolicy,
3936      }));
3937    this.sequenceMode && this.bindSequenceControls();
3938    this.tileSources && this.open(this.tileSources);
3939    for (d = 0; d < this.customControls.length; d++)
3940      this.addControl(this.customControls[d].id, {
3941        anchor: this.customControls[d].anchor,
3942      });
3943    a.requestAnimationFrame(function () {
3944      h(g);
3945    });
3946  };
3947  a.extend(
3948    a.Viewer.prototype,
3949    a.EventSource.prototype,
3950    a.ControlDock.prototype,
3951    {
3952      isOpen: function () {
3953        return !!this.world.getItemCount();
3954      },
3955      openDzi: function (b) {
3956        a.console.error(
3957          "[Viewer.openDzi] this function is deprecated; use Viewer.open() instead.",
3958        );
3959        return this.open(b);
3960      },
3961      openTileSource: function (b) {
3962        a.console.error(
3963          "[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead.",
3964        );
3965        return this.open(b);
3966      },
3967      open: function (b) {
3968        var c = this;
3969        this.close();
3970        if (b)
3971          if (this.sequenceMode && a.isArray(b)) {
3972            if (this.referenceStrip) {
3973              this.referenceStrip.destroy();
3974              this.referenceStrip = null;
3975            }
3976            this.tileSources = b;
3977            this._sequenceIndex = Math.max(
3978              0,
3979              Math.min(this.tileSources.length - 1, this.initialPage),
3980            );
3981            if (this.tileSources.length) {
3982              this.open(this.tileSources[this._sequenceIndex]);
3983              this.showReferenceStrip &&
3984                (this.referenceStrip = new a.ReferenceStrip({
3985                  id: this.referenceStripElement,
3986                  position: this.referenceStripPosition,
3987                  sizeRatio: this.referenceStripSizeRatio,
3988                  scroll: this.referenceStripScroll,
3989                  height: this.referenceStripHeight,
3990                  width: this.referenceStripWidth,
3991                  tileSources: this.tileSources,
3992                  prefixUrl: this.prefixUrl,
3993                  viewer: this,
3994                }));
3995            }
3996            this._updateSequenceButtons(this._sequenceIndex);
3997          } else {
3998            a.isArray(b) || (b = [b]);
3999            if (b.length) {
4000              this._opening = !0;
4001              var e = b.length;
4002              var f = 0;
4003              var g = 0;
4004              var h;
4005              var i = function () {
4006                if (f + g === e)
4007                  if (f) {
4008                    if (c._firstOpen || !c.preserveViewport) {
4009                      c.viewport.goHome(!0);
4010                      c.viewport.update();
4011                    }
4012                    c._firstOpen = !1;
4013                    var a = b[0];
4014                    a.tileSource && (a = a.tileSource);
4015                    if (c.overlays && !c.preserveOverlays)
4016                      for (var i = 0; i < c.overlays.length; i++)
4017                        c.currentOverlays[i] = d(c, c.overlays[i]);
4018                    c._drawOverlays();
4019                    c._opening = !1;
4020                    c.raiseEvent("open", { source: a });
4021                  } else {
4022                    c._opening = !1;
4023                    c.raiseEvent("open-failed", h);
4024                  }
4025              };
4026              var j = function (b) {
4027                (a.isPlainObject(b) && b.tileSource) || (b = { tileSource: b });
4028                if (void 0 !== b.index) {
4029                  a.console.error(
4030                    "[Viewer.open] setting indexes here is not supported; use addTiledImage instead",
4031                  );
4032                  delete b.index;
4033                }
4034                void 0 === b.collectionImmediately &&
4035                  (b.collectionImmediately = !0);
4036                var d = b.success;
4037                b.success = function (a) {
4038                  f++;
4039                  if (b.tileSource.overlays)
4040                    for (var e = 0; e < b.tileSource.overlays.length; e++)
4041                      c.addOverlay(b.tileSource.overlays[e]);
4042                  d && d(a);
4043                  i();
4044                };
4045                var e = b.error;
4046                b.error = function (a) {
4047                  g++;
4048                  h || (h = a);
4049                  e && e(a);
4050                  i();
4051                };
4052                c.addTiledImage(b);
4053              };
4054              for (var k = 0; k < b.length; k++) j(b[k]);
4055              return this;
4056            }
4057          }
4058      },
4059      close: function () {
4060        if (!U[this.hash]) return this;
4061        this._opening = !1;
4062        this.navigator && this.navigator.close();
4063        if (!this.preserveOverlays) {
4064          this.clearOverlays();
4065          this.overlaysContainer.innerHTML = "";
4066        }
4067        U[this.hash].animating = !1;
4068        this.world.removeAll();
4069        this.imageLoader.clear();
4070        this.raiseEvent("close");
4071        return this;
4072      },
4073      destroy: function () {
4074        if (U[this.hash]) {
4075          this.close();
4076          this.clearOverlays();
4077          this.overlaysContainer.innerHTML = "";
4078          if (this.referenceStrip) {
4079            this.referenceStrip.destroy();
4080            this.referenceStrip = null;
4081          }
4082          if (null !== this._updateRequestId) {
4083            a.cancelAnimationFrame(this._updateRequestId);
4084            this._updateRequestId = null;
4085          }
4086          this.drawer && this.drawer.destroy();
4087          this.removeAllHandlers();
4088          if (this.element)
4089            for (; this.element.firstChild; )
4090              this.element.removeChild(this.element.firstChild);
4091          this.innerTracker && this.innerTracker.destroy();
4092          this.outerTracker && this.outerTracker.destroy();
4093          U[this.hash] = null;
4094          delete U[this.hash];
4095          this.canvas = null;
4096          this.container = null;
4097          this.element = null;
4098        }
4099      },
4100      isMouseNavEnabled: function () {
4101        return this.innerTracker.isTracking();
4102      },
4103      setMouseNavEnabled: function (a) {
4104        this.innerTracker.setTracking(a);
4105        this.outerTracker.setTracking(a);
4106        this.raiseEvent("mouse-enabled", { enabled: a });
4107        return this;
4108      },
4109      areControlsEnabled: function () {
4110        var a,
4111          b = this.controls.length;
4112        for (a = 0; a < this.controls.length; a++)
4113          b = b && this.controls[a].isVisibile();
4114        return b;
4115      },
4116      setControlsEnabled: function (a) {
4117        a ? j(this) : h(this);
4118        this.raiseEvent("controls-enabled", { enabled: a });
4119        return this;
4120      },
4121      isFullPage: function () {
4122        return U[this.hash].fullPage;
4123      },
4124      setFullPage: function (b) {
4125        var c,
4126          d,
4127          e = document.body,
4128          f = e.style,
4129          g = document.documentElement.style,
4130          h = this;
4131        if (b == this.isFullPage()) return this;
4132        var i = { fullPage: b, preventDefaultAction: !1 };
4133        this.raiseEvent("pre-full-page", i);
4134        if (i.preventDefaultAction) return this;
4135        if (b) {
4136          this.elementSize = a.getElementSize(this.element);
4137          this.pageScroll = a.getPageScroll();
4138          this.elementMargin = this.element.style.margin;
4139          this.element.style.margin = "0";
4140          this.elementPadding = this.element.style.padding;
4141          this.element.style.padding = "0";
4142          this.bodyMargin = f.margin;
4143          this.docMargin = g.margin;
4144          f.margin = "0";
4145          g.margin = "0";
4146          this.bodyPadding = f.padding;
4147          this.docPadding = g.padding;
4148          f.padding = "0";
4149          g.padding = "0";
4150          this.bodyWidth = f.width;
4151          this.docWidth = g.width;
4152          f.width = "100%";
4153          g.width = "100%";
4154          this.bodyHeight = f.height;
4155          this.docHeight = g.height;
4156          f.height = "100%";
4157          g.height = "100%";
4158          this.previousBody = [];
4159          U[this.hash].prevElementParent = this.element.parentNode;
4160          U[this.hash].prevNextSibling = this.element.nextSibling;
4161          U[this.hash].prevElementWidth = this.element.style.width;
4162          U[this.hash].prevElementHeight = this.element.style.height;
4163          c = e.childNodes.length;
4164          for (d = 0; c > d; d++) {
4165            this.previousBody.push(e.childNodes[0]);
4166            e.removeChild(e.childNodes[0]);
4167          }
4168          if (this.toolbar && this.toolbar.element) {
4169            this.toolbar.parentNode = this.toolbar.element.parentNode;
4170            this.toolbar.nextSibling = this.toolbar.element.nextSibling;
4171            e.appendChild(this.toolbar.element);
4172            a.addClass(this.toolbar.element, "fullpage");
4173          }
4174          a.addClass(this.element, "fullpage");
4175          e.appendChild(this.element);
4176          this.element.style.height = a.getWindowSize().y + "px";
4177          this.element.style.width = a.getWindowSize().x + "px";
4178          this.toolbar &&
4179            this.toolbar.element &&
4180            (this.element.style.height =
4181              a.getElementSize(this.element).y -
4182              a.getElementSize(this.toolbar.element).y +
4183              "px");
4184          U[this.hash].fullPage = !0;
4185          a.delegate(this, A)({});
4186        } else {
4187          this.element.style.margin = this.elementMargin;
4188          this.element.style.padding = this.elementPadding;
4189          f.margin = this.bodyMargin;
4190          g.margin = this.docMargin;
4191          f.padding = this.bodyPadding;
4192          g.padding = this.docPadding;
4193          f.width = this.bodyWidth;
4194          g.width = this.docWidth;
4195          f.height = this.bodyHeight;
4196          g.height = this.docHeight;
4197          e.removeChild(this.element);
4198          c = this.previousBody.length;
4199          for (d = 0; c > d; d++) e.appendChild(this.previousBody.shift());
4200          a.removeClass(this.element, "fullpage");
4201          U[this.hash].prevElementParent.insertBefore(
4202            this.element,
4203            U[this.hash].prevNextSibling,
4204          );
4205          if (this.toolbar && this.toolbar.element) {
4206            e.removeChild(this.toolbar.element);
4207            a.removeClass(this.toolbar.element, "fullpage");
4208            this.toolbar.parentNode.insertBefore(
4209              this.toolbar.element,
4210              this.toolbar.nextSibling,
4211            );
4212            delete this.toolbar.parentNode;
4213            delete this.toolbar.nextSibling;
4214          }
4215          this.element.style.width = U[this.hash].prevElementWidth;
4216          this.element.style.height = U[this.hash].prevElementHeight;
4217          var j = 0;
4218          var k = function () {
4219            a.setPageScroll(h.pageScroll);
4220            var b = a.getPageScroll();
4221            j++;
4222            ((10 > j && b.x !== h.pageScroll.x) || b.y !== h.pageScroll.y) &&
4223              a.requestAnimationFrame(k);
4224          };
4225          a.requestAnimationFrame(k);
4226          U[this.hash].fullPage = !1;
4227          a.delegate(this, B)({});
4228        }
4229        this.navigator && this.viewport && this.navigator.update(this.viewport);
4230        this.raiseEvent("full-page", { fullPage: b });
4231        return this;
4232      },
4233      setFullScreen: function (b) {
4234        var c = this;
4235        if (!a.supportsFullScreen) return this.setFullPage(b);
4236        if (a.isFullScreen() === b) return this;
4237        var d = { fullScreen: b, preventDefaultAction: !1 };
4238        this.raiseEvent("pre-full-screen", d);
4239        if (d.preventDefaultAction) return this;
4240        if (b) {
4241          this.setFullPage(!0);
4242          if (!this.isFullPage()) return this;
4243          this.fullPageStyleWidth = this.element.style.width;
4244          this.fullPageStyleHeight = this.element.style.height;
4245          this.element.style.width = "100%";
4246          this.element.style.height = "100%";
4247          var e = function () {
4248            var b = a.isFullScreen();
4249            if (!b) {
4250              a.removeEvent(document, a.fullScreenEventName, e);
4251              a.removeEvent(document, a.fullScreenErrorEventName, e);
4252              c.setFullPage(!1);
4253              if (c.isFullPage()) {
4254                c.element.style.width = c.fullPageStyleWidth;
4255                c.element.style.height = c.fullPageStyleHeight;
4256              }
4257            }
4258            c.navigator && c.viewport && c.navigator.update(c.viewport);
4259            c.raiseEvent("full-screen", { fullScreen: b });
4260          };
4261          a.addEvent(document, a.fullScreenEventName, e);
4262          a.addEvent(document, a.fullScreenErrorEventName, e);
4263          a.requestFullScreen(document.body);
4264        } else a.exitFullScreen();
4265        return this;
4266      },
4267      isVisible: function () {
4268        return "hidden" != this.container.style.visibility;
4269      },
4270      setVisible: function (a) {
4271        this.container.style.visibility = a ? "" : "hidden";
4272        this.raiseEvent("visible", { visible: a });
4273        return this;
4274      },
4275      addTiledImage: function (b) {
4276        function d(a) {
4277          for (var c = 0; c < f._loadQueue.length; c++)
4278            if (f._loadQueue[c] === g) {
4279              f._loadQueue.splice(c, 1);
4280              break;
4281            }
4282          0 === f._loadQueue.length && e(g);
4283          f.raiseEvent("add-item-failed", a);
4284          b.error && b.error(a);
4285        }
4286        function e(a) {
4287          if (f.collectionMode) {
4288            f.world.arrange({
4289              immediately: a.options.collectionImmediately,
4290              rows: f.collectionRows,
4291              columns: f.collectionColumns,
4292              layout: f.collectionLayout,
4293              tileSize: f.collectionTileSize,
4294              tileMargin: f.collectionTileMargin,
4295            });
4296            f.world.setAutoRefigureSizes(!0);
4297          }
4298        }
4299        a.console.assert(b, "[Viewer.addTiledImage] options is required");
4300        a.console.assert(
4301          b.tileSource,
4302          "[Viewer.addTiledImage] options.tileSource is required",
4303        );
4304        a.console.assert(
4305          !b.replace || (b.index > -1 && b.index < this.world.getItemCount()),
4306          "[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world",
4307        );
4308        var f = this;
4309        b.replace && (b.replaceItem = f.world.getItemAt(b.index));
4310        this._hideMessage();
4311        void 0 === b.placeholderFillStyle &&
4312          (b.placeholderFillStyle = this.placeholderFillStyle);
4313        void 0 === b.opacity && (b.opacity = this.opacity);
4314        void 0 === b.compositeOperation &&
4315          (b.compositeOperation = this.compositeOperation);
4316        var g = { options: b };
4317        if (a.isArray(b.tileSource))
4318          setTimeout(function () {
4319            d({
4320              message:
4321                "[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",
4322              source: b.tileSource,
4323              options: b,
4324            });
4325          });
4326        else {
4327          this._loadQueue.push(g);
4328          c(
4329            this,
4330            b.tileSource,
4331            function (b) {
4332              g.tileSource = b;
4333              var c, d, h;
4334              for (; f._loadQueue.length; ) {
4335                c = f._loadQueue[0];
4336                if (!c.tileSource) break;
4337                f._loadQueue.splice(0, 1);
4338                if (c.options.replace) {
4339                  var i = f.world.getIndexOfItem(c.options.replaceItem);
4340                  -1 != i && (c.options.index = i);
4341                  f.world.removeItem(c.options.replaceItem);
4342                }
4343                d = new a.TiledImage({
4344                  viewer: f,
4345                  source: c.tileSource,
4346                  viewport: f.viewport,
4347                  drawer: f.drawer,
4348                  tileCache: f.tileCache,
4349                  imageLoader: f.imageLoader,
4350                  x: c.options.x,
4351                  y: c.options.y,
4352                  width: c.options.width,
4353                  height: c.options.height,
4354                  fitBounds: c.options.fitBounds,
4355                  fitBoundsPlacement: c.options.fitBoundsPlacement,
4356                  clip: c.options.clip,
4357                  placeholderFillStyle: c.options.placeholderFillStyle,
4358                  opacity: c.options.opacity,
4359                  compositeOperation: c.options.compositeOperation,
4360                  springStiffness: f.springStiffness,
4361                  animationTime: f.animationTime,
4362                  minZoomImageRatio: f.minZoomImageRatio,
4363                  wrapHorizontal: f.wrapHorizontal,
4364                  wrapVertical: f.wrapVertical,
4365                  immediateRender: f.immediateRender,
4366                  blendTime: f.blendTime,
4367                  alwaysBlend: f.alwaysBlend,
4368                  minPixelRatio: f.minPixelRatio,
4369                  smoothTileEdgesMinZoom: f.smoothTileEdgesMinZoom,
4370                  iOSDevice: f.iOSDevice,
4371                  crossOriginPolicy: f.crossOriginPolicy,
4372                  debugMode: f.debugMode,
4373                });
4374                f.collectionMode && f.world.setAutoRefigureSizes(!1);
4375                f.world.addItem(d, { index: c.options.index });
4376                0 === f._loadQueue.length && e(c);
4377                1 !== f.world.getItemCount() ||
4378                  f.preserveViewport ||
4379                  f.viewport.goHome(!0);
4380                if (f.navigator) {
4381                  h = a.extend({}, c.options, {
4382                    replace: !1,
4383                    originalTiledImage: d,
4384                    tileSource: c.tileSource,
4385                  });
4386                  f.navigator.addTiledImage(h);
4387                }
4388                c.options.success && c.options.success({ item: d });
4389              }
4390            },
4391            function (a) {
4392              a.options = b;
4393              d(a);
4394            },
4395          );
4396        }
4397      },
4398      addSimpleImage: function (b) {
4399        a.console.assert(b, "[Viewer.addSimpleImage] options is required");
4400        a.console.assert(
4401          b.url,
4402          "[Viewer.addSimpleImage] options.url is required",
4403        );
4404        var c = a.extend({}, b, { tileSource: { type: "image", url: b.url } });
4405        delete c.url;
4406        this.addTiledImage(c);
4407      },
4408      addLayer: function (b) {
4409        var c = this;
4410        a.console.error(
4411          "[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.",
4412        );
4413        var d = a.extend({}, b, {
4414          success: function (a) {
4415            c.raiseEvent("add-layer", { options: b, drawer: a.item });
4416          },
4417          error: function (a) {
4418            c.raiseEvent("add-layer-failed", a);
4419          },
4420        });
4421        this.addTiledImage(d);
4422        return this;
4423      },
4424      getLayerAtLevel: function (b) {
4425        a.console.error(
4426          "[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead.",
4427        );
4428        return this.world.getItemAt(b);
4429      },
4430      getLevelOfLayer: function (b) {
4431        a.console.error(
4432          "[Viewer.getLevelOfLayer] this function is deprecated;
4432 use World.getIndexOfItem() instead.",
4433        );
4434        return this.world.getIndexOfItem(b);
4435      },
4436      getLayersCount: function () {
4437        a.console.error(
4438          "[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead.",
4439        );
4440        return this.world.getItemCount();
4441      },
4442      setLayerLevel: function (b, c) {
4443        a.console.error(
4444          "[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead.",
4445        );
4446        return this.world.setItemIndex(b, c);
4447      },
4448      removeLayer: function (b) {
4449        a.console.error(
4450          "[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead.",
4451        );
4452        return this.world.removeItem(b);
4453      },
4454      forceRedraw: function () {
4455        U[this.hash].forceRedraw = !0;
4456        return this;
4457      },
4458      bindSequenceControls: function () {
4459        var b = a.delegate(this, k),
4460          c = a.delegate(this, l),
4461          d = a.delegate(this, T),
4462          e = a.delegate(this, S),
4463          f = this.navImages,
4464          g = !0;
4465        if (this.showSequenceControl) {
4466          (this.previousButton || this.nextButton) && (g = !1);
4467          this.previousButton = new a.Button({
4468            element: this.previousButton
4469              ? a.getElement(this.previousButton)
4470              : null,
4471            clickTimeThreshold: this.clickTimeThreshold,
4472            clickDistThreshold: this.clickDistThreshold,
4473            tooltip: a.getString("Tooltips.PreviousPage"),
4474            srcRest: F(this.prefixUrl, f.previous.REST),
4475            srcGroup: F(this.prefixUrl, f.previous.GROUP),
4476            srcHover: F(this.prefixUrl, f.previous.HOVER),
4477            srcDown: F(this.prefixUrl, f.previous.DOWN),
4478            onRelease: e,
4479            onFocus: b,
4480            onBlur: c,
4481          });
4482          this.nextButton = new a.Button({
4483            element: this.nextButton ? a.getElement(this.nextButton) : null,
4484            clickTimeThreshold: this.clickTimeThreshold,
4485            clickDistThreshold: this.clickDistThreshold,
4486            tooltip: a.getString("Tooltips.NextPage"),
4487            srcRest: F(this.prefixUrl, f.next.REST),
4488            srcGroup: F(this.prefixUrl, f.next.GROUP),
4489            srcHover: F(this.prefixUrl, f.next.HOVER),
4490            srcDown: F(this.prefixUrl, f.next.DOWN),
4491            onRelease: d,
4492            onFocus: b,
4493            onBlur: c,
4494          });
4495          this.navPrevNextWrap || this.previousButton.disable();
4496          (this.tileSources && this.tileSources.length) ||
4497            this.nextButton.disable();
4498          if (g) {
4499            this.paging = new a.ButtonGroup({
4500              buttons: [this.previousButton, this.nextButton],
4501              clickTimeThreshold: this.clickTimeThreshold,
4502              clickDistThreshold: this.clickDistThreshold,
4503            });
4504            this.pagingControl = this.paging.element;
4505            this.toolbar
4506              ? this.toolbar.addControl(this.pagingControl, {
4507                  anchor: a.ControlAnchor.BOTTOM_RIGHT,
4508                })
4509              : this.addControl(this.pagingControl, {
4510                  anchor:
4511                    this.sequenceControlAnchor || a.ControlAnchor.TOP_LEFT,
4512                });
4513          }
4514        }
4515        return this;
4516      },
4517      bindStandardControls: function () {
4518        var b = a.delegate(this, G),
4519          c = a.delegate(this, I),
4520          d = a.delegate(this, L),
4521          e = a.delegate(this, H),
4522          f = a.delegate(this, M),
4523          g = a.delegate(this, O),
4524          h = a.delegate(this, P),
4525          i = a.delegate(this, Q),
4526          j = a.delegate(this, R),
4527          m = a.delegate(this, k),
4528          n = a.delegate(this, l),
4529          o = this.navImages,
4530          p = [],
4531          q = !0;
4532        if (this.showNavigationControl) {
4533          (this.zoomInButton ||
4534            this.zoomOutButton ||
4535            this.homeButton ||
4536            this.fullPageButton ||
4537            this.rotateLeftButton ||
4538            this.rotateRightButton) &&
4539            (q = !1);
4540          if (this.showZoomControl) {
4541            p.push(
4542              (this.zoomInButton = new a.Button({
4543                element: this.zoomInButton
4544                  ? a.getElement(this.zoomInButton)
4545                  : null,
4546                clickTimeThreshold: this.clickTimeThreshold,
4547                clickDistThreshold: this.clickDistThreshold,
4548                tooltip: a.getString("Tooltips.ZoomIn"),
4549                srcRest: F(this.prefixUrl, o.zoomIn.REST),
4550                srcGroup: F(this.prefixUrl, o.zoomIn.GROUP),
4551                srcHover: F(this.prefixUrl, o.zoomIn.HOVER),
4552                srcDown: F(this.prefixUrl, o.zoomIn.DOWN),
4553                onPress: b,
4554                onRelease: c,
4555                onClick: d,
4556                onEnter: b,
4557                onExit: c,
4558                onFocus: m,
4559                onBlur: n,
4560              })),
4561            );
4562            p.push(
4563              (this.zoomOutButton = new a.Button({
4564                element: this.zoomOutButton
4565                  ? a.getElement(this.zoomOutButton)
4566                  : null,
4567                clickTimeThreshold: this.clickTimeThreshold,
4568                clickDistThreshold: this.clickDistThreshold,
4569                tooltip: a.getString("Tooltips.ZoomOut"),
4570                srcRest: F(this.prefixUrl, o.zoomOut.REST),
4571                srcGroup: F(this.prefixUrl, o.zoomOut.GROUP),
4572                srcHover: F(this.prefixUrl, o.zoomOut.HOVER),
4573                srcDown: F(this.prefixUrl, o.zoomOut.DOWN),
4574                onPress: e,
4575                onRelease: c,
4576                onClick: f,
4577                onEnter: e,
4578                onExit: c,
4579                onFocus: m,
4580                onBlur: n,
4581              })),
4582            );
4583          }
4584          this.showHomeControl &&
4585            p.push(
4586              (this.homeButton = new a.Button({
4587                element: this.homeButton ? a.getElement(this.homeButton) : null,
4588                clickTimeThreshold: this.clickTimeThreshold,
4589                clickDistThreshold: this.clickDistThreshold,
4590                tooltip: a.getString("Tooltips.Home"),
4591                srcRest: F(this.prefixUrl, o.home.REST),
4592                srcGroup: F(this.prefixUrl, o.home.GROUP),
4593                srcHover: F(this.prefixUrl, o.home.HOVER),
4594                srcDown: F(this.prefixUrl, o.home.DOWN),
4595                onRelease: g,
4596                onFocus: m,
4597                onBlur: n,
4598              })),
4599            );
4600          this.showFullPageControl &&
4601            p.push(
4602              (this.fullPageButton = new a.Button({
4603                element: this.fullPageButton
4604                  ? a.getElement(this.fullPageButton)
4605                  : null,
4606                clickTimeThreshold: this.clickTimeThreshold,
4607                clickDistThreshold: this.clickDistThreshold,
4608                tooltip: a.getString("Tooltips.FullPage"),
4609                srcRest: F(this.prefixUrl, o.fullpage.REST),
4610                srcGroup: F(this.prefixUrl, o.fullpage.GROUP),
4611                srcHover: F(this.prefixUrl, o.fullpage.HOVER),
4612                srcDown: F(this.prefixUrl, o.fullpage.DOWN),
4613                onRelease: h,
4614                onFocus: m,
4615                onBlur: n,
4616              })),
4617            );
4618          if (this.showRotationControl) {
4619            p.push(
4620              (this.rotateLeftButton = new a.Button({
4621                element: this.rotateLeftButton
4622                  ? a.getElement(this.rotateLeftButton)
4623                  : null,
4624                clickTimeThreshold: this.clickTimeThreshold,
4625                clickDistThreshold: this.clickDistThreshold,
4626                tooltip: a.getString("Tooltips.RotateLeft"),
4627                srcRest: F(this.prefixUrl, o.rotateleft.REST),
4628                srcGroup: F(this.prefixUrl, o.rotateleft.GROUP),
4629                srcHover: F(this.prefixUrl, o.rotateleft.HOVER),
4630                srcDown: F(this.prefixUrl, o.rotateleft.DOWN),
4631                onRelease: i,
4632                onFocus: m,
4633                onBlur: n,
4634              })),
4635            );
4636            p.push(
4637              (this.rotateRightButton = new a.Button({
4638                element: this.rotateRightButton
4639                  ? a.getElement(this.rotateRightButton)
4640                  : null,
4641                clickTimeThreshold: this.clickTimeThreshold,
4642                clickDistThreshold: this.clickDistThreshold,
4643                tooltip: a.getString("Tooltips.RotateRight"),
4644                srcRest: F(this.prefixUrl, o.rotateright.REST),
4645                srcGroup: F(this.prefixUrl, o.rotateright.GROUP),
4646                srcHover: F(this.prefixUrl, o.rotateright.HOVER),
4647                srcDown: F(this.prefixUrl, o.rotateright.DOWN),
4648                onRelease: j,
4649                onFocus: m,
4650                onBlur: n,
4651              })),
4652            );
4653          }
4654          if (q) {
4655            this.buttons = new a.ButtonGroup({
4656              buttons: p,
4657              clickTimeThreshold: this.clickTimeThreshold,
4658              clickDistThreshold: this.clickDistThreshold,
4659            });
4660            this.navControl = this.buttons.element;
4661            this.addHandler("open", a.delegate(this, N));
4662            this.toolbar
4663              ? this.toolbar.addControl(this.navControl, {
4664                  anchor: a.ControlAnchor.TOP_LEFT,
4665                })
4666              : this.addControl(this.navControl, {
4667                  anchor:
4668                    this.navigationControlAnchor || a.ControlAnchor.TOP_LEFT,
4669                });
4670          }
4671        }
4672        return this;
4673      },
4674      currentPage: function () {
4675        return this._sequenceIndex;
4676      },
4677      goToPage: function (a) {
4678        if (this.tileSources && a >= 0 && a < this.tileSources.length) {
4679          this.raiseEvent("page", { page: a });
4680          this._sequenceIndex = a;
4681          this._updateSequenceButtons(a);
4682          this.open(this.tileSources[a]);
4683          this.referenceStrip && this.referenceStrip.setFocus(a);
4684        }
4685        return this;
4686      },
4687      addOverlay: function (b, c, f, g) {
4688        var h;
4689        h = a.isPlainObject(b)
4690          ? b
4691          : { element: b, location: c, placement: f, onDraw: g };
4692        b = a.getElement(h.element);
4693        if (e(this.currentOverlays, b) >= 0) return this;
4694        var i = d(this, h);
4695        this.currentOverlays.push(i);
4696        i.drawHTML(this.overlaysContainer, this.viewport);
4697        this.raiseEvent("add-overlay", {
4698          element: b,
4699          location: h.location,
4700          placement: h.placement,
4701        });
4702        return this;
4703      },
4704      updateOverlay: function (b, c, d) {
4705        var f;
4706        b = a.getElement(b);
4707        f = e(this.currentOverlays, b);
4708        if (f >= 0) {
4709          this.currentOverlays[f].update(c, d);
4710          U[this.hash].forceRedraw = !0;
4711          this.raiseEvent("update-overlay", {
4712            element: b,
4713            location: c,
4714            placement: d,
4715          });
4716        }
4717        return this;
4718      },
4719      removeOverlay: function (b) {
4720        var c;
4721        b = a.getElement(b);
4722        c = e(this.currentOverlays, b);
4723        if (c >= 0) {
4724          this.currentOverlays[c].destroy();
4725          this.currentOverlays.splice(c, 1);
4726          U[this.hash].forceRedraw = !0;
4727          this.raiseEvent("remove-overlay", { element: b });
4728        }
4729        return this;
4730      },
4731      clearOverlays: function () {
4732        for (; this.currentOverlays.length > 0; )
4733          this.currentOverlays.pop().destroy();
4734        U[this.hash].forceRedraw = !0;
4735        this.raiseEvent("clear-overlay", {});
4736        return this;
4737      },
4738      getOverlayById: function (b) {
4739        var c;
4740        b = a.getElement(b);
4741        c = e(this.currentOverlays, b);
4742        return c >= 0 ? this.currentOverlays[c] : null;
4743      },
4744      _updateSequenceButtons: function (a) {
4745        this.nextButton &&
4746          (this.tileSources && this.tileSources.length - 1 !== a
4747            ? this.nextButton.enable()
4748            : this.navPrevNextWrap || this.nextButton.disable());
4749        this.previousButton &&
4750          (a > 0
4751            ? this.previousButton.enable()
4752            : this.navPrevNextWrap || this.previousButton.disable());
4753      },
4754      _showMessage: function (b) {
4755        this._hideMessage();
4756        var c = a.makeNeutralElement("div");
4757        c.appendChild(document.createTextNode(b));
4758        this.messageDiv = a.makeCenteredNode(c);
4759        a.addClass(this.messageDiv, "openseadragon-message");
4760        this.container.appendChild(this.messageDiv);
4761      },
4762      _hideMessage: function () {
4763        var a = this.messageDiv;
4764        if (a) {
4765          a.parentNode.removeChild(a);
4766          delete this.messageDiv;
4767        }
4768      },
4769      gestureSettingsByDeviceType: function (a) {
4770        switch (a) {
4771          case "mouse":
4772            return this.gestureSettingsMouse;
4773          case "touch":
4774            return this.gestureSettingsTouch;
4775          case "pen":
4776            return this.gestureSettingsPen;
4777          default:
4778            return this.gestureSettingsUnknown;
4779        }
4780      },
4781      _drawOverlays: function () {
4782        var a,
4783          b = this.currentOverlays.length;
4784        for (a = 0; b > a; a++)
4785          this.currentOverlays[a].drawHTML(
4786            this.overlaysContainer,
4787            this.viewport,
4788          );
4789      },
4790      _cancelPendingImages: function () {
4791        this._loadQueue = [];
4792      },
4793    },
4794  );
4795})(OpenSeadragon);
4796!(function (a) {
4797  function b(a) {
4798    if (a.quick && this.viewer.viewport) {
4799      this.viewer.viewport.panTo(this.viewport.pointFromPixel(a.position));
4800      this.viewer.viewport.applyConstraints();
4801    }
4802  }
4803  function c(a) {
4804    if (this.viewer.viewport) {
4805      this.panHorizontal || (a.delta.x = 0);
4806      this.panVertical || (a.delta.y = 0);
4807      this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(a.delta));
4808    }
4809  }
4810  function d(a) {
4811    a.insideElementPressed &&
4812      this.viewer.viewport &&
4813      this.viewer.viewport.applyConstraints();
4814  }
4815  function e(a) {
4816    this.viewer.raiseEvent("navigator-scroll", {
4817      tracker: a.eventSource,
4818      position: a.position,
4819      scroll: a.scroll,
4820      shift: a.shift,
4821      originalEvent: a.originalEvent,
4822    });
4823    return !1;
4824  }
4825  function f(a, b) {
4826    a.style.webkitTransform = "rotate(" + b + "deg)";
4827    a.style.mozTransform = "rotate(" + b + "deg)";
4828    a.style.msTransform = "rotate(" + b + "deg)";
4829    a.style.oTransform = "rotate(" + b + "deg)";
4830    a.style.transform = "rotate(" + b + "deg)";
4831  }
4832  a.Navigator = function (g) {
4833    function h(a) {
4834      f(l.displayRegionContainer, a);
4835      f(l.displayRegion, -a);
4836      l.viewport.setRotation(a);
4837    }
4838    var i,
4839      j,
4840      k = g.viewer,
4841      l = this;
4842    if (g.id) {
4843      this.element = document.getElementById(g.id);
4844      g.controlOptions = {
4845        anchor: a.ControlAnchor.NONE,
4846        attachToViewer: !1,
4847        autoFade: !1,
4848      };
4849    } else {
4850      g.id = "navigator-" + a.now();
4851      this.element = a.makeNeutralElement("div");
4852      g.controlOptions = {
4853        anchor: a.ControlAnchor.TOP_RIGHT,
4854        attachToViewer: !0,
4855        autoFade: g.autoFade,
4856      };
4857      if (g.position)
4858        if ("BOTTOM_RIGHT" == g.position)
4859          g.controlOptions.anchor = a.ControlAnchor.BOTTOM_RIGHT;
4860        else if ("BOTTOM_LEFT" == g.position)
4861          g.controlOptions.anchor = a.ControlAnchor.BOTTOM_LEFT;
4862        else if ("TOP_RIGHT" == g.position)
4863          g.controlOptions.anchor = a.ControlAnchor.TOP_RIGHT;
4864        else if ("TOP_LEFT" == g.position)
4865          g.controlOptions.anchor = a.ControlAnchor.TOP_LEFT;
4866        else if ("ABSOLUTE" == g.position) {
4867          g.controlOptions.anchor = a.ControlAnchor.ABSOLUTE;
4868          g.controlOptions.top = g.top;
4869          g.controlOptions.left = g.left;
4870          g.controlOptions.height = g.height;
4871          g.controlOptions.width = g.width;
4872        }
4873    }
4874    this.element.id = g.id;
4875    this.element.className += " navigator";
4876    g = a.extend(!0, { sizeRatio: a.DEFAULT_SETTINGS.navigatorSizeRatio }, g, {
4877      element: this.element,
4878      tabIndex: -1,
4879      showNavigator: !1,
4880      mouseNavEnabled: !1,
4881      showNavigationControl: !1,
4882      showSequenceControl: !1,
4883      immediateRender: !0,
4884      blendTime: 0,
4885      animationTime: 0,
4886      autoResize: g.autoResize,
4887      minZoomImageRatio: 1,
4888    });
4889    g.minPixelRatio = this.minPixelRatio = k.minPixelRatio;
4890    a.setElementTouchActionNone(this.element);
4891    this.borderWidth = 2;
4892    this.fudge = new a.Point(1, 1);
4893    this.totalBorderWidths = new a.Point(
4894      2 * this.borderWidth,
4895      2 * this.borderWidth,
4896    ).minus(this.fudge);
4897    g.controlOptions.anchor != a.ControlAnchor.NONE &&
4898      !(function (a, b) {
4899        a.margin = "0px";
4900        a.border = b + "px solid #555";
4901        a.padding = "0px";
4902        a.background = "#000";
4903        a.opacity = 0.8;
4904        a.overflow = "hidden";
4905      })(this.element.style, this.borderWidth);
4906    this.displayRegion = a.makeNeutralElement("div");
4907    this.displayRegion.id = this.element.id + "-displayregion";
4908    this.displayRegion.className = "displayregion";
4909    !(function (a, b) {
4910      a.position = "relative";
4911      a.top = "0px";
4912      a.left = "0px";
4913      a.fontSize = "0px";
4914      a.overflow = "hidden";
4915      a.border = b + "px solid #900";
4916      a.margin = "0px";
4917      a.padding = "0px";
4918      a.background = "transparent";
4919      a["float"] = "left";
4920      a.cssFloat = "left";
4921      a.styleFloat = "left";
4922      a.zIndex = 999999999;
4923      a.cursor = "default";
4924    })(this.displayRegion.style, this.borderWidth);
4925    this.displayRegionContainer = a.makeNeutralElement("div");
4926    this.displayRegionContainer.id =
4927      this.element.id + "-displayregioncontainer";
4928    this.displayRegionContainer.className = "displayregioncontainer";
4929    this.displayRegionContainer.style.width = "100%";
4930    this.displayRegionContainer.style.height = "100%";
4931    k.addControl(this.element, g.controlOptions);
4932    this._resizeWithViewer =
4933      g.controlOptions.anchor != a.ControlAnchor.ABSOLUTE &&
4934      g.controlOptions.anchor != a.ControlAnchor.NONE;
4935    if (this._resizeWithViewer) {
4936      if (g.width && g.height) {
4937        this.element.style.height =
4938          "number" == typeof g.height ? g.height + "px" : g.height;
4939        this.element.style.width =
4940          "number" == typeof g.width ? g.width + "px" : g.width;
4941      } else {
4942        i = a.getElementSize(k.element);
4943        this.element.style.height = Math.round(i.y * g.sizeRatio) + "px";
4944        this.element.style.width = Math.round(i.x * g.sizeRatio) + "px";
4945        this.oldViewerSize = i;
4946      }
4947      j = a.getElementSize(this.element);
4948      this.elementArea = j.x * j.y;
4949    }
4950    this.oldContainerSize = new a.Point(0, 0);
4951    a.Viewer.apply(this, [g]);
4952    this.displayRegionContainer.appendChild(this.displayRegion);
4953    this.element
4954      .getElementsByTagName("div")[0]
4955      .appendChild(this.displayRegionContainer);
4956    if (g.navigatorRotate) {
4957      var m = g.viewer.viewport
4958        ? g.viewer.viewport.getRotation()
4959        : g.viewer.degrees || 0;
4960      h(m);
4961      g.viewer.addHandler("rotate", function (a) {
4962        h(a.degrees);
4963      });
4964    }
4965    this.innerTracker.destroy();
4966    this.innerTracker = new a.MouseTracker({
4967      element: this.element,
4968      dragHandler: a.delegate(this, c),
4969      clickHandler: a.delegate(this, b),
4970      releaseHandler: a.delegate(this, d),
4971      scrollHandler: a.delegate(this, e),
4972    });
4973    this.addHandler("reset-size", function () {
4974      l.viewport && l.viewport.goHome(!0);
4975    });
4976    k.world.addHandler("item-index-change", function (a) {
4977      var b = l.world.getItemAt(a.previousIndex);
4978      l.world.setItemIndex(b, a.newIndex);
4979    });
4980    k.world.addHandler("remove-item", function (a) {
4981      var b = a.item;
4982      var c = l._getMatchingItem(b);
4983      c && l.world.removeItem(c);
4984    });
4985    this.update(k.viewport);
4986  };
4987  a.extend(a.Navigator.prototype, a.EventSource.prototype, a.Viewer.prototype, {
4988    updateSize: function () {
4989      if (this.viewport) {
4990        var b = new a.Point(
4991          0 === this.container.clientWidth ? 1 : this.container.clientWidth,
4992          0 === this.container.clientHeight ? 1 : this.container.clientHeight,
4993        );
4994        if (!b.equals(this.oldContainerSize)) {
4995          this.viewport.resize(b, !0);
4996          this.viewport.goHome(!0);
4997          this.oldContainerSize = b;
4998          this.drawer.clear();
4999          this.world.draw();
5000        }
5001      }
5002    },
5003    update: function (b) {
5004      var c, d, e, f, g, h;
5005      c = a.getElementSize(this.viewer.element);
5006      if (
5007        this._resizeWithViewer &&
5008        c.x &&
5009        c.y &&
5010        !c.equals(this.oldViewerSize)
5011      ) {
5012        this.oldViewerSize = c;
5013        if (this.maintainSizeRatio || !this.elementArea) {
5014          d = c.x * this.sizeRatio;
5015          e = c.y * this.sizeRatio;
5016        } else {
5017          d = Math.sqrt(this.elementArea * (c.x / c.y));
5018          e = this.elementArea / d;
5019        }
5020        this.element.style.width = Math.round(d) + "px";
5021        this.element.style.height = Math.round(e) + "px";
5022        this.elementArea || (this.elementArea = d * e);
5023        this.updateSize();
5024      }
5025      if (b && this.viewport) {
5026        f = b.getBoundsNoRotate(!0);
5027        g = this.viewport.pixelFromPointNoRotate(f.getTopLeft(), !1);
5028        h = this.viewport
5029          .pixelFromPointNoRotate(f.getBottomRight(), !1)
5030          .minus(this.totalBorderWidths);
5031        var i = this.displayRegion.style;
5032        i.display = this.world.getItemCount() ? "block" : "none";
5033        i.top = Math.round(g.y) + "px";
5034        i.left = Math.round(g.x) + "px";
5035        var j = Math.abs(g.x - h.x);
5036        var k = Math.abs(g.y - h.y);
5037        i.width = Math.round(Math.max(j, 0)) + "px";
5038        i.height = Math.round(Math.max(k, 0)) + "px";
5039      }
5040    },
5041    addTiledImage: function (b) {
5042      var c = this;
5043      var d = b.originalTiledImage;
5044      delete b.original;
5045      var e = a.extend({}, b, {
5046        success: function (a) {
5047          var b = a.item;
5048          b._originalForNavigator = d;
5049          c._matchBounds(b, d, !0);
5050          d.addHandler("bounds-change", function () {
5051            c._matchBounds(b, d);
5052          });
5053        },
5054      });
5055      return a.Viewer.prototype.addTiledImage.apply(this, [e]);
5056    },
5057    _getMatchingItem: function (a) {
5058      var b = this.world.getItemCount();
5059      var c;
5060      for (var d = 0; b > d; d++) {
5061        c = this.world.getItemAt(d);
5062        if (c._originalForNavigator === a) return c;
5063      }
5064      return null;
5065    },
5066    _matchBounds: function (a, b, c) {
5067      var d = b.getBounds();
5068      a.setPosition(d.getTopLeft(), c);
5069      a.setWidth(d.width, c);
5070    },
5071  });
5072})(OpenSeadragon);
5073!(function (a) {
5074  var b = {
5075    Errors: {
5076      Dzc: "Sorry, we don't support Deep Zoom Collections!",
5077      Dzi: "Hmm, this doesn't appear to be a valid Deep Zoom Image.",
5078      Xml: "Hmm, this doesn't appear to be a valid Deep Zoom Image.",
5079      ImageFormat: "Sorry, we don't support {0}-based Deep Zoom Images.",
5080      Security:
5081        "It looks like a security restriction stopped us from loading this Deep Zoom Image.",
5082      Status: "This space unintentionally left blank ({0} {1}).",
5083      OpenFailed: "Unable to open {0}: {1}",
5084    },
5085    Tooltips: {
5086      FullPage: "Toggle full page",
5087      Home: "Go home",
5088      ZoomIn: "Zoom in",
5089      ZoomOut: "Zoom out",
5090      NextPage: "Next page",
5091      PreviousPage: "Previous page",
5092      RotateLeft: "Rotate left",
5093      RotateRight: "Rotate right",
5094    },
5095  };
5096  a.extend(a, {
5097    getString: function (c) {
5098      var d,
5099        e = c.split("."),
5100        f = null,
5101        g = arguments,
5102        h = b;
5103      for (d = 0; d < e.length - 1; d++) h = h[e[d]] || {};
5104      f = h[e[d]];
5105      if ("string" != typeof f) {
5106        a.console.debug("Untranslated source string:", c);
5107        f = "";
5108      }
5109      return f.replace(/\{\d+\}/g, function (a) {
5110        var b = parseInt(a.match(/\d+/), 10) + 1;
5111        return b < g.length ? g[b] : "";
5112      });
5113    },
5114    setString: function (a, c) {
5115      var d,
5116        e = a.split("."),
5117        f = b;
5118      for (d = 0; d < e.length - 1; d++) {
5119        f[e[d]] || (f[e[d]] = {});
5120        f = f[e[d]];
5121      }
5122      f[e[d]] = c;
5123    },
5124  });
5125})(OpenSeadragon);
5126!(function (a) {
5127  a.Point = function (a, b) {
5128    this.x = "number" == typeof a ? a : 0;
5129    this.y = "number" == typeof b ? b : 0;
5130  };
5131  a.Point.prototype = {
5132    clone: function () {
5133      return new a.Point(this.x, this.y);
5134    },
5135    plus: function (b) {
5136      return new a.Point(this.x + b.x, this.y + b.y);
5137    },
5138    minus: function (b) {
5139      return new a.Point(this.x - b.x, this.y - b.y);
5140    },
5141    times: function (b) {
5142      return new a.Point(this.x * b, this.y * b);
5143    },
5144    divide: function (b) {
5145      return new a.Point(this.x / b, this.y / b);
5146    },
5147    negate: function () {
5148      return new a.Point(-this.x, -this.y);
5149    },
5150    distanceTo: function (a) {
5151      return Math.sqrt(Math.pow(this.x - a.x, 2) + Math.pow(this.y - a.y, 2));
5152    },
5153    apply: function (b) {
5154      return new a.Point(b(this.x), b(this.y));
5155    },
5156    equals: function (b) {
5157      return b instanceof a.Point && this.x === b.x && this.y === b.y;
5158    },
5159    rotate: function (b, c) {
5160      c = c || new a.Point(0, 0);
5161      var d;
5162      var e;
5163      if (b % 90 === 0) {
5164        var f = b % 360;
5165        0 > f && (f += 360);
5166        switch (f) {
5167          case 0:
5168            d = 1;
5169            e = 0;
5170            break;
5171          case 90:
5172            d = 0;
5173            e = 1;
5174            break;
5175          case 180:
5176            d = -1;
5177            e = 0;
5178            break;
5179          case 270:
5180            d = 0;
5181            e = -1;
5182        }
5183      } else {
5184        var g = (b * Math.PI) / 180;
5185        d = Math.cos(g);
5186        e = Math.sin(g);
5187      }
5188      var h = d * (this.x - c.x) - e * (this.y - c.y) + c.x;
5189      var i = e * (this.x - c.x) + d * (this.y - c.y) + c.y;
5190      return new a.Point(h, i);
5191    },
5192    toString: function () {
5193      return (
5194        "(" +
5195        Math.round(100 * this.x) / 100 +
5196        "," +
5197        Math.round(100 * this.y) / 100 +
5198        ")"
5199      );
5200    },
5201  };
5202})(OpenSeadragon);
5203!(function (a) {
5204  function b(b) {
5205    var c,
5206      d,
5207      e = b.responseText,
5208      f = b.status;
5209    if (!b) throw new Error(a.getString("Errors.Security"));
5210    if (200 !== b.status && 0 !== b.status) {
5211      f = b.status;
5212      c = 404 == f ? "Not Found" : b.statusText;
5213      throw new Error(a.getString("Errors.Status", f, c));
5214    }
5215    if (e.match(/\s*<.*/))
5216      try {
5217        d =
5218          b.responseXML && b.responseXML.documentElement
5219            ? b.responseXML
5220            : a.parseXml(e);
5221      } catch (g) {
5222        d = b.responseText;
5223      }
5224    else d = e.match(/\s*[\{\[].*/) ? a.parseJSON(e) : e;
5225    return d;
5226  }
5227  a.TileSource = function (b, c, d, e, f, g) {
5228    var h = this;
5229    var i,
5230      j,
5231      k = arguments;
5232    i = a.isPlainObject(b)
5233      ? b
5234      : {
5235          width: k[0],
5236          height: k[1],
5237          tileSize: k[2],
5238          tileOverlap: k[3],
5239          minLevel: k[4],
5240          maxLevel: k[5],
5241        };
5242    a.EventSource.call(this);
5243    a.extend(!0, this, i);
5244    if (!this.success)
5245      for (j = 0; j < arguments.length; j++)
5246        if (a.isFunction(arguments[j])) {
5247          this.success = arguments[j];
5248          break;
5249        }
5250    this.success &&
5251      this.addHandler("ready", function (a) {
5252        h.success(a);
5253      });
5254    "string" == a.type(arguments[0]) && (this.url = arguments[0]);
5255    if (this.url) {
5256      this.aspectRatio = 1;
5257      this.dimensions = new a.Point(10, 10);
5258      this._tileWidth = 0;
5259      this._tileHeight = 0;
5260      this.tileOverlap = 0;
5261      this.minLevel = 0;
5262      this.maxLevel = 0;
5263      this.ready = !1;
5264      this.getImageInfo(this.url);
5265    } else {
5266      this.ready = !0;
5267      this.aspectRatio = i.width && i.height ? i.width / i.height : 1;
5268      this.dimensions = new a.Point(i.width, i.height);
5269      if (this.tileSize) {
5270        this._tileWidth = this._tileHeight = this.tileSize;
5271        delete this.tileSize;
5272      } else {
5273        if (this.tileWidth) {
5274          this._tileWidth = this.tileWidth;
5275          delete this.tileWidth;
5276        } else this._tileWidth = 0;
5277        if (this.tileHeight) {
5278          this._tileHeight = this.tileHeight;
5279          delete this.tileHeight;
5280        } else this._tileHeight = 0;
5281      }
5282      this.tileOverlap = i.tileOverlap ? i.tileOverlap : 0;
5283      this.minLevel = i.minLevel ? i.minLevel : 0;
5284      this.maxLevel =
5285        void 0 !== i.maxLevel && null !== i.maxLevel
5286          ? i.maxLevel
5287          : i.width && i.height
5288            ? Math.ceil(Math.log(Math.max(i.width, i.height)) / Math.log(2))
5289            : 0;
5290      this.success && a.isFunction(this.success) && this.success(this);
5291    }
5292  };
5293  a.TileSource.prototype = {
5294    getTileSize: function (b) {
5295      a.console.error(
5296        "[TileSource.getTileSize] is deprecated.Use TileSource.getTileWidth() and TileSource.getTileHeight() instead",
5297      );
5298      return this._tileWidth;
5299    },
5300    getTileWidth: function (a) {
5301      return this._tileWidth ? this._tileWidth : this.getTileSize(a);
5302    },
5303    getTileHeight: function (a) {
5304      return this._tileHeight ? this._tileHeight : this.getTileSize(a);
5305    },
5306    getLevelScale: function (a) {
5307      var b,
5308        c = {};
5309      for (b = 0; b <= this.maxLevel; b++)
5310        c[b] = 1 / Math.pow(2, this.maxLevel - b);
5311      this.getLevelScale = function (a) {
5312        return c[a];
5313      };
5314      return this.getLevelScale(a);
5315    },
5316    getNumTiles: function (b) {
5317      var c = this.getLevelScale(b),
5318        d = Math.ceil((c * this.dimensions.x) / this.getTileWidth(b)),
5319        e = Math.ceil((c * this.dimensions.y) / this.getTileHeight(b));
5320      return new a.Point(d, e);
5321    },
5322    getPixelRatio: function (b) {
5323      var c = this.dimensions.times(this.getLevelScale(b)),
5324        d = 1 / c.x,
5325        e = 1 / c.y;
5326      return new a.Point(d, e);
5327    },
5328    getClosestLevel: function (b) {
5329      var c, d, e;
5330      for (c = this.minLevel; c < this.maxLevel; c++) {
5331        e = this.getNumTiles(c);
5332        d = new a.Point(
5333          Math.floor(b.x / this.getTileWidth(c)),
5334          Math.floor(b.y / this.getTileHeight(c)),
5335        );
5336        if (e.x + 1 >= d.x && e.y + 1 >= d.y) break;
5337      }
5338      return Math.max(0, c - 1);
5339    },
5340    getTileAtPoint: function (b, c) {
5341      var d = c.times(this.dimensions.x).times(this.getLevelScale(b)),
5342        e = Math.floor(d.x / this.getTileWidth(b)),
5343        f = Math.floor(d.y / this.getTileHeight(b));
5344      return new a.Point(e, f);
5345    },
5346    getTileBounds: function (b, c, d) {
5347      var e = this.dimensions.times(this.getLevelScale(b)),
5348        f = this.getTileWidth(b),
5349        g = this.getTileHeight(b),
5350        h = 0 === c ? 0 : f * c - this.tileOverlap,
5351        i = 0 === d ? 0 : g * d - this.tileOverlap,
5352        j = f + (0 === c ? 1 : 2) * this.tileOverlap,
5353        k = g + (0 === d ? 1 : 2) * this.tileOverlap,
5354        l = 1 / e.x;
5355      j = Math.min(j, e.x - h);
5356      k = Math.min(k, e.y - i);
5357      return new a.Rect(h * l, i * l, j * l, k * l);
5358    },
5359    getImageInfo: function (c) {
5360      var d,
5361        e,
5362        f,
5363        g,
5364        h,
5365        i,
5366        j,
5367        k = this;
5368      if (c) {
5369        h = c.split("/");
5370        i = h[h.length - 1];
5371        j = i.lastIndexOf(".");
5372        j > -1 && (h[h.length - 1] = i.slice(0, j));
5373      }
5374      e = function (b) {
5375        "string" == typeof b && (b = a.parseXml(b));
5376        var d = a.TileSource.determineType(k, b, c);
5377        if (d) {
5378          g = d.prototype.configure.apply(k, [b, c]);
5379          void 0 === g.ajaxWithCredentials &&
5380            (g.ajaxWithCredentials = k.ajaxWithCredentials);
5381          f = new d(g);
5382          k.ready = !0;
5383          k.raiseEvent("ready", { tileSource: f });
5384        } else
5385          k.raiseEvent("open-failed", {
5386            message: "Unable to load TileSource",
5387            source: c,
5388          });
5389      };
5390      if (c.match(/\.js$/)) {
5391        d = c.split("/").pop().replace(".js", "");
5392        a.jsonp({ url: c, async: !1, callbackName: d, callback: e });
5393      } else
5394        a.makeAjaxRequest({
5395          url: c,
5396          withCredentials: this.ajaxWithCredentials,
5397          success: function (a) {
5398            var c = b(a);
5399            e(c);
5400          },
5401          error: function (a, b) {
5402            var d;
5403            try {
5404              d = "HTTP " + a.status + " attempting to load TileSource";
5405            } catch (e) {
5406              var f;
5407              f =
5408                "undefined" != typeof b && b.toString
5409                  ? b.toString()
5410                  : "Unknown error";
5411              d = f + " attempting to load TileSource";
5412            }
5413            k.raiseEvent("open-failed", { message: d, source: c });
5414          },
5415        });
5416    },
5417    supports: function (a, b) {
5418      return !1;
5419    },
5420    configure: function (a, b) {
5421      throw new Error("Method not implemented.");
5422    },
5423    getTileUrl: function (a, b, c) {
5424      throw new Error("Method not implemented.");
5425    },
5426    tileExists: function (a, b, c) {
5427      var d = this.getNumTiles(a);
5428      return (
5429        a >= this.minLevel &&
5430        a <= this.maxLevel &&
5431        b >= 0 &&
5432        c >= 0 &&
5433        b < d.x &&
5434        c < d.y
5435      );
5436    },
5437  };
5438  a.extend(!0, a.TileSource.prototype, a.EventSource.prototype);
5439  a.TileSource.determineType = function (b, c, d) {
5440    var e;
5441    for (e in OpenSeadragon)
5442      if (
5443        e.match(/.+TileSource$/) &&
5444        a.isFunction(OpenSeadragon[e]) &&
5445        a.isFunction(OpenSeadragon[e].prototype.supports) &&
5446        OpenSeadragon[e].prototype.supports.call(b, c, d)
5447      )
5448        return OpenSeadragon[e];
5449    a.console.error("No TileSource was able to open %s %s", d, c);
5450  };
5451})(OpenSeadragon);
5452!(function (a) {
5453  function b(b, d) {
5454    if (!d || !d.documentElement) throw new Error(a.getString("Errors.Xml"));
5455    var e,
5456      f,
5457      g,
5458      h,
5459      i,
5460      j = d.documentElement,
5461      k = j.localName || j.tagName,
5462      l = d.documentElement.namespaceURI,
5463      m = null,
5464      n = [];
5465    if ("Image" == k)
5466      try {
5467        h = j.getElementsByTagName("Size")[0];
5468        void 0 === h && (h = j.getElementsByTagNameNS(l, "Size")[0]);
5469        m = {
5470          Image: {
5471            xmlns: "http://schemas.microsoft.com/deepzoom/2008",
5472            Url: j.getAttribute("Url"),
5473            Format: j.getAttribute("Format"),
5474            DisplayRect: null,
5475            Overlap: parseInt(j.getAttribute("Overlap"), 10),
5476            TileSize: parseInt(j.getAttribute("TileSize"), 10),
5477            Size: {
5478              Height: parseInt(h.getAttribute("Height"), 10),
5479              Width: parseInt(h.getAttribute("Width"), 10),
5480            },
5481          },
5482        };
5483        if (!a.imageFormatSupported(m.Image.Format))
5484          throw new Error(
5485            a.getString("Errors.ImageFormat", m.Image.Format.toUpperCase()),
5486          );
5487        e = j.getElementsByTagName("DisplayRect");
5488        void 0 === e && (e = j.getElementsByTagNameNS(l, "DisplayRect")[0]);
5489        for (i = 0; i < e.length; i++) {
5490          f = e[i];
5491          g = f.getElementsByTagName("Rect")[0];
5492          void 0 === g && (g = f.getElementsByTagNameNS(l, "Rect")[0]);
5493          n.push({
5494            Rect: {
5495              X: parseInt(g.getAttribute("X"), 10),
5496              Y: parseInt(g.getAttribute("Y"), 10),
5497              Width: parseInt(g.getAttribute("Width"), 10),
5498              Height: parseInt(g.getAttribute("Height"), 10),
5499              MinLevel: parseInt(f.getAttribute("MinLevel"), 10),
5500              MaxLevel: parseInt(f.getAttribute("MaxLevel"), 10),
5501            },
5502          });
5503        }
5504        n.length && (m.Image.DisplayRect = n);
5505        return c(b, m);
5506      } catch (o) {
5507        throw o instanceof Error ? o : new Error(a.getString("Errors.Dzi"));
5508      }
5509    else {
5510      if ("Collection" == k) throw new Error(a.getString("Errors.Dzc"));
5511      if ("Error" == k) {
5512        var p = j.getElementsByTagName("Message")[0];
5513        var q = p.firstChild.nodeValue;
5514        throw new Error(q);
5515      }
5516    }
5517    throw new Error(a.getString("Errors.Dzi"));
5518  }
5519  function c(b, c) {
5520    var d,
5521      e,
5522      f = c.Image,
5523      g = f.Url,
5524      h = f.Format,
5525      i = f.Size,
5526      j = f.DisplayRect || [],
5527      k = parseInt(i.Width, 10),
5528      l = parseInt(i.Height, 10),
5529      m = parseInt(f.TileSize, 10),
5530      n = parseInt(f.Overlap, 10),
5531      o = [];
5532    for (e = 0; e < j.length; e++) {
5533      d = j[e].Rect;
5534      o.push(
5535        new a.DisplayRect(
5536          parseInt(d.X, 10),
5537          parseInt(d.Y, 10),
5538          parseInt(d.Width, 10),
5539          parseInt(d.Height, 10),
5540          parseInt(d.MinLevel, 10),
5541          parseInt(d.MaxLevel, 10),
5542        ),
5543      );
5544    }
5545    return a.extend(
5546      !0,
5547      {
5548        width: k,
5549        height: l,
5550        tileSize: m,
5551        tileOverlap: n,
5552        minLevel: null,
5553        maxLevel: null,
5554        tilesUrl: g,
5555        fileFormat: h,
5556        displayRects: o,
5557      },
5558      c,
5559    );
5560  }
5561  a.DziTileSource = function (b, c, d, e, f, g, h, i, j) {
5562    var k, l, m, n;
5563    n = a.isPlainObject(b)
5564      ? b
5565      : {
5566          width: arguments[0],
5567          height: arguments[1],
5568          tileSize: arguments[2],
5569          tileOverlap: arguments[3],
5570          tilesUrl: arguments[4],
5571          fileFormat: arguments[5],
5572          displayRects: arguments[6],
5573          minLevel: arguments[7],
5574          maxLevel: arguments[8],
5575        };
5576    this._levelRects = {};
5577    this.tilesUrl = n.tilesUrl;
5578    this.fileFormat = n.fileFormat;
5579    this.displayRects = n.displayRects;
5580    if (this.displayRects)
5581      for (k = this.displayRects.length - 1; k >= 0; k--) {
5582        l = this.displayRects[k];
5583        for (m = l.minLevel; m <= l.maxLevel; m++) {
5584          this._levelRects[m] || (this._levelRects[m] = []);
5585          this._levelRects[m].push(l);
5586        }
5587      }
5588    a.TileSource.apply(this, [n]);
5589  };
5590  a.extend(a.DziTileSource.prototype, a.TileSource.prototype, {
5591    supports: function (a, b) {
5592      var c;
5593      a.Image
5594        ? (c = a.Image.xmlns)
5595        : a.documentElement &&
5596          ("Image" == a.documentElement.localName ||
5597            "Image" == a.documentElement.tagName) &&
5598          (c = a.documentElement.namespaceURI);
5599      return (
5600        "http://schemas.microsoft.com/deepzoom/2008" == c ||
5601        "http://schemas.microsoft.com/deepzoom/2009" == c
5602      );
5603    },
5604    configure: function (d, e) {
5605      var f;
5606      f = a.isPlainObject(d) ? c(this, d) : b(this, d);
5607      if (e && !f.tilesUrl) {
5608        f.tilesUrl = e.replace(
5609          /([^\/]+?)(\.(dzi|xml|js))?\/?(\?.*)?$/,
5610          "$1_files/",
5611        );
5612        -1 != e.search(/\.(dzi|xml|js)\?/)
5613          ? (f.queryParams = e.match(/\?.*/))
5614          : (f.queryParams = "");
5615      }
5616      return f;
5617    },
5618    getTileUrl: function (a, b, c) {
5619      return [
5620        this.tilesUrl,
5621        a,
5622        "/",
5623        b,
5624        "_",
5625        c,
5626        ".",
5627        this.fileFormat,
5628        this.queryParams,
5629      ].join("");
5630    },
5631    tileExists: function (a, b, c) {
5632      var d,
5633        e,
5634        f,
5635        g,
5636        h,
5637        i,
5638        j,
5639        k = this._levelRects[a];
5640      if (!k || !k.length) return !0;
5641      for (j = k.length - 1; j >= 0; j--) {
5642        d = k[j];
5643        if (!(a < d.minLevel || a > d.maxLevel)) {
5644          e = this.getLevelScale(a);
5645          f = d.x * e;
5646          g = d.y * e;
5647          h = f + d.width * e;
5648          i = g + d.height * e;
5649          f = Math.floor(f / this.tileSize);
5650          g = Math.floor(g / this.tileSize);
5651          h = Math.ceil(h / this.tileSize);
5652          i = Math.ceil(i / this.tileSize);
5653          if (b >= f && h > b && c >= g && i > c) return !0;
5654        }
5655      }
5656      return !1;
5657    },
5658  });
5659})(OpenSeadragon);
5660!(function (a) {
5661  function b(a) {
5662    var b = [
5663      "http://library.stanford.edu/iiif/image-api/compliance.html#level0",
5664      "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",
5665      "http://iiif.io/api/image/2/level0.json",
5666    ];
5667    var c = -1 != b.indexOf(a[0]);
5668    return !c || -1 != a.indexOf("sizeByW");
5669  }
5670  function c(a) {
5671    var b = [];
5672    for (var c = 0; c < a.sizes.length; c++)
5673      b.push({
5674        url: a["@id"] + "/full/" + a.sizes[c].width + ",/0/default.jpg",
5675        width: a.sizes[c].width,
5676        height: a.sizes[c].height,
5677      });
5678    return b.sort(function (a, b) {
5679      return a.width - b.width;
5680    });
5681  }
5682  function d(b) {
5683    if (!b || !b.documentElement) throw new Error(a.getString("Errors.Xml"));
5684    var c = b.documentElement,
5685      d = c.tagName,
5686      f = null;
5687    if ("info" == d)
5688      try {
5689        f = {};
5690        e(c, f);
5691        return f;
5692      } catch (g) {
5693        throw g instanceof Error ? g : new Error(a.getString("Errors.IIIF"));
5694      }
5695    throw new Error(a.getString("Errors.IIIF"));
5696  }
5697  function e(b, c, d) {
5698    var f, g;
5699    if (3 == b.nodeType && d) {
5700      g = b.nodeValue.trim();
5701      g.match(/^\d*$/) && (g = Number(g));
5702      if (c[d]) {
5703        a.isArray(c[d]) || (c[d] = [c[d]]);
5704        c[d].push(g);
5705      } else c[d] = g;
5706    } else if (1 == b.nodeType)
5707      for (f = 0; f < b.childNodes.length; f++)
5708        e(b.childNodes[f], c, b.nodeName);
5709  }
5710  a.IIIFTileSource = function (d) {
5711    a.extend(!0, this, d);
5712    if (!(this.height && this.width && this["@id"]))
5713      throw new Error("IIIF required parameters not provided.");
5714    d.tileSizePerScaleFactor = {};
5715    if (this.tile_width && this.tile_height) {
5716      d.tileWidth = this.tile_width;
5717      d.tileHeight = this.tile_height;
5718    } else if (this.tile_width) d.tileSize = this.tile_width;
5719    else if (this.tile_height) d.tileSize = this.tile_height;
5720    else if (this.tiles)
5721      if (1 == this.tiles.length) {
5722        d.tileWidth = this.tiles[0].width;
5723        d.tileHeight = this.tiles[0].height || this.tiles[0].width;
5724        this.scale_factors = this.tiles[0].scaleFactors;
5725      } else {
5726        this.scale_factors = [];
5727        for (var e = 0; e < this.tiles.length; e++)
5728          for (var f = 0; f < this.tiles[e].scaleFactors.length; f++) {
5729            var g = this.tiles[e].scaleFactors[f];
5730            this.scale_factors.push(g);
5731            d.tileSizePerScaleFactor[g] = {
5732              width: this.tiles[e].width,
5733              height: this.tiles[e].height || this.tiles[e].width,
5734            };
5735          }
5736      }
5737    else if (b(d.profile)) {
5738      var h = Math.min(this.height, this.width),
5739        i = [256, 512, 1024],
5740        j = [];
5741      for (var k = 0; k < i.length; k++) i[k] <= h && j.push(i[k]);
5742      j.length > 0 ? (d.tileSize = Math.max.apply(null, j)) : (d.tileSize = h);
5743    } else if (this.sizes && this.sizes.length > 0) {
5744      this.emulateLegacyImagePyramid = !0;
5745      d.levels = c(this);
5746      a.extend(!0, d, {
5747        width: d.levels[d.levels.length - 1].width,
5748        height: d.levels[d.levels.length - 1].height,
5749        tileSize: Math.max(d.height, d.width),
5750        tileOverlap: 0,
5751        minLevel: 0,
5752        maxLevel: d.levels.length - 1,
5753      });
5754      this.levels = d.levels;
5755    } else
5756      a.console.error(
5757        "Nothing in the info.json to construct image pyramids from",
5758      );
5759    d.maxLevel ||
5760      this.emulateLegacyImagePyramid ||
5761      (this.scale_factors
5762        ? (d.maxLevel = Math.floor(
5763            Math.pow(Math.max.apply(null, this.scale_factors), 0.5),
5764          ))
5765        : (d.maxLevel = Number(
5766            Math.ceil(Math.log(Math.max(this.width, this.height), 2)),
5767          )));
5768    a.TileSource.apply(this, [d]);
5769  };
5770  a.extend(a.IIIFTileSource.prototype, a.TileSource.prototype, {
5771    supports: function (a, b) {
5772      return a.protocol && "http://iiif.io/api/image" == a.protocol
5773        ? !0
5774        : !a["@context"] ||
5775            ("http://library.stanford.edu/iiif/image-api/1.1/context.json" !=
5776              a["@context"] &&
5777              "http://iiif.io/api/image/1/context.json" != a["@context"])
5778          ? a.profile &&
5779            0 ===
5780              a.profile.indexOf(
5781                "http://library.stanford.edu/iiif/image-api/compliance.html",
5782              )
5783            ? !0
5784            : a.identifier && a.width && a.height
5785              ? !0
5786              : a.documentElement &&
5787                  "info" == a.documentElement.tagName &&
5788                  "http://library.stanford.edu/iiif/image-api/ns/" ==
5789                    a.documentElement.namespaceURI
5790                ? !0
5791                : !1
5792          : !0;
5793    },
5794    configure: function (b, c) {
5795      if (a.isPlainObject(b)) {
5796        if (b["@context"]) return b;
5797        b["@context"] = "http://iiif.io/api/image/1.0/context.json";
5798        b["@id"] = c.replace("/info.json", "");
5799        return b;
5800      }
5801      var e = d(b);
5802      e["@context"] = "http://iiif.io/api/image/1.0/context.json";
5803      e["@id"] = c.replace("/info.xml", "");
5804      return e;
5805    },
5806    getTileWidth: function (b) {
5807      if (this.emulateLegacyImagePyramid)
5808        return a.TileSource.prototype.getTileWidth.call(this, b);
5809      var c = Math.pow(2, this.maxLevel - b);
5810      return this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[c]
5811        ? this.tileSizePerScaleFactor[c].width
5812        : this._tileWidth;
5813    },
5814    getTileHeight: function (b) {
5815      if (this.emulateLegacyImagePyramid)
5816        return a.TileSource.prototype.getTileHeight.call(this, b);
5817      var c = Math.pow(2, this.maxLevel - b);
5818      return this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[c]
5819        ? this.tileSizePerScaleFactor[c].height
5820        : this._tileHeight;
5821    },
5822    getLevelScale: function (b) {
5823      if (this.emulateLegacyImagePyramid) {
5824        var c = NaN;
5825        this.levels.length > 0 &&
5826          b >= this.minLevel &&
5827          b <= this.maxLevel &&
5828          (c = this.levels[b].width / this.levels[this.maxLevel].width);
5829        return c;
5830      }
5831      return a.TileSource.prototype.getLevelScale.call(this, b);
5832    },
5833    getNumTiles: function (b) {
5834      if (this.emulateLegacyImagePyramid) {
5835        var c = this.getLevelScale(b);
5836        return c ? new a.Point(1, 1) : new a.Point(0, 0);
5837      }
5838      return a.TileSource.prototype.getNumTiles.call(this, b);
5839    },
5840    getTileAtPoint: function (b, c) {
5841      return this.emulateLegacyImagePyramid
5842        ? new a.Point(0, 0)
5843        : a.TileSource.prototype.getTileAtPoint.call(this, b, c);
5844    },
5845    getTileUrl: function (a, b, c) {
5846      if (this.emulateLegacyImagePyramid) {
5847        var d = null;
5848        this.levels.length > 0 &&
5849          a >= this.minLevel &&
5850          a <= this.maxLevel &&
5851          (d = this.levels[a].url);
5852        return d;
5853      }
5854      var e,
5855        f,
5856        g,
5857        h,
5858        i,
5859        j,
5860        k,
5861        l,
5862        m,
5863        n,
5864        o,
5865        p,
5866        q = "0",
5867        r = Math.pow(0.5, this.maxLevel - a),
5868        s = Math.ceil(this.width * r),
5869        t = Math.ceil(this.height * r);
5870      e = this.getTileWidth(a);
5871      f = this.getTileHeight(a);
5872      g = Math.ceil(e / r);
5873      h = Math.ceil(f / r);
5874      o =
5875        this["@context"].indexOf("/1.0/context.json") > -1 ||
5876        this["@context"].indexOf("/1.1/context.json") > -1 ||
5877        this["@context"].indexOf("/1/context.json") > -1
5878          ? "native.jpg"
5879          : "default.jpg";
5880      if (e > s && f > t) {
5881        n = s + ",";
5882        i = "full";
5883      } else {
5884        j = b * g;
5885        k = c * h;
5886        l = Math.min(g, this.width - j);
5887        m = Math.min(h, this.height - k);
5888        n = Math.ceil(l * r) + ",";
5889        i = [j, k, l, m].join(",");
5890      }
5891      p = [this["@id"], i, n, q, o].join("/");
5892      return p;
5893    },
5894  });
5895})(OpenSeadragon);
5896!(function (a) {
5897  a.OsmTileSource = function (b, c, d, e, f) {
5898    var g;
5899    g = a.isPlainObject(b)
5900      ? b
5901      : {
5902          width: arguments[0],
5903          height: arguments[1],
5904          tileSize: arguments[2],
5905          tileOverlap: arguments[3],
5906          tilesUrl: arguments[4],
5907        };
5908    if (!g.width || !g.height) {
5909      g.width = 65572864;
5910      g.height = 65572864;
5911    }
5912    if (!g.tileSize) {
5913      g.tileSize = 256;
5914      g.tileOverlap = 0;
5915    }
5916    g.tilesUrl || (g.tilesUrl = "http://tile.openstreetmap.org/");
5917    g.minLevel = 8;
5918    a.TileSource.apply(this, [g]);
5919  };
5920  a.extend(a.OsmTileSource.prototype, a.TileSource.prototype, {
5921    supports: function (a, b) {
5922      return a.type && "openstreetmaps" == a.type;
5923    },
5924    configure: function (a, b) {
5925      return a;
5926    },
5927    getTileUrl: function (a, b, c) {
5928      return this.tilesUrl + (a - 8) + "/" + b + "/" + c + ".png";
5929    },
5930  });
5931})(OpenSeadragon);
5932!(function (a) {
5933  a.TmsTileSource = function (b, c, d, e, f) {
5934    var g;
5935    g = a.isPlainObject(b)
5936      ? b
5937      : {
5938          width: arguments[0],
5939          height: arguments[1],
5940          tileSize: arguments[2],
5941          tileOverlap: arguments[3],
5942          tilesUrl: arguments[4],
5943        };
5944    var h,
5945      i = 256 * Math.ceil(g.width / 256),
5946      j = 256 * Math.ceil(g.height / 256);
5947    h = i > j ? i / 256 : j / 256;
5948    g.maxLevel = Math.ceil(Math.log(h) / Math.log(2)) - 1;
5949    g.tileSize = 256;
5950    g.width = i;
5951    g.height = j;
5952    a.TileSource.apply(this, [g]);
5953  };
5954  a.extend(a.TmsTileSource.prototype, a.TileSource.prototype, {
5955    supports: function (a, b) {
5956      return a.type && "tiledmapservice" == a.type;
5957    },
5958    configure: function (a, b) {
5959      return a;
5960    },
5961    getTileUrl: function (a, b, c) {
5962      var d = this.getNumTiles(a).y - 1;
5963      return this.tilesUrl + a + "/" + b + "/" + (d - c) + ".png";
5964    },
5965  });
5966})(OpenSeadragon);
5967!(function (a) {
5968  function b(b) {
5969    var c,
5970      d,
5971      e = [];
5972    for (d = 0; d < b.length; d++) {
5973      c = b[d];
5974      c.height &&
5975      c.width &&
5976      c.url &&
5977      (c.url.toLowerCase().match(/^.*\.(png|jpg|jpeg|gif)(?:\?.*)?$/) ||
5978        (c.mimetype &&
5979          c.mimetype.toLowerCase().match(/^.*\/(png|jpg|jpeg|gif)$/)))
5980        ? e.push({
5981            url: c.url,
5982            width: Number(c.width),
5983            height: Number(c.height),
5984          })
5985        : a.console.error(
5986            "Unsupported image format: %s",
5987            c.url ? c.url : "<no URL>",
5988          );
5989    }
5990    return e.sort(function (a, b) {
5991      return a.height - b.height;
5992    });
5993  }
5994  function c(b, c) {
5995    if (!c || !c.documentElement) throw new Error(a.getString("Errors.Xml"));
5996    var e,
5997      f,
5998      g = c.documentElement,
5999      h = g.tagName,
6000      i = null,
6001      j = [];
6002    if ("image" == h)
6003      try {
6004        i = { type: g.getAttribute("type"), levels: [] };
6005        j = g.getElementsByTagName("level");
6006        for (f = 0; f < j.length; f++) {
6007          e = j[f];
6008          i.levels.push({
6009            url: e.getAttribute("url"),
6010            width: parseInt(e.getAttribute("width"), 10),
6011            height: parseInt(e.getAttribute("height"), 10),
6012          });
6013        }
6014        return d(b, i);
6015      } catch (k) {
6016        throw k instanceof Error
6017          ? k
6018          : new Error("Unknown error parsing Legacy Image Pyramid XML.");
6019      }
6020    else {
6021      if ("collection" == h)
6022        throw new Error("Legacy Image Pyramid Collections not yet supported.");
6023      if ("error" == h) throw new Error("Error: " + c);
6024    }
6025    throw new Error("Unknown element " + h);
6026  }
6027  function d(a, b) {
6028    return b.levels;
6029  }
6030  a.LegacyTileSource = function (c) {
6031    var d, e, f;
6032    a.isArray(c) && (d = { type: "legacy-image-pyramid", levels: c });
6033    d.levels = b(d.levels);
6034    if (d.levels.length > 0) {
6035      e = d.levels[d.levels.length - 1].width;
6036      f = d.levels[d.levels.length - 1].height;
6037    } else {
6038      e = 0;
6039      f = 0;
6040      a.console.error("No supported image formats found");
6041    }
6042    a.extend(!0, d, {
6043      width: e,
6044      height: f,
6045      tileSize: Math.max(f, e),
6046      tileOverlap: 0,
6047      minLevel: 0,
6048      maxLevel: d.levels.length > 0 ? d.levels.length - 1 : 0,
6049    });
6050    a.TileSource.apply(this, [d]);
6051    this.levels = d.levels;
6052  };
6053  a.extend(a.LegacyTileSource.prototype, a.TileSource.prototype, {
6054    supports: function (a, b) {
6055      return (
6056        (a.type && "legacy-image-pyramid" == a.type) ||
6057        (a.documentElement &&
6058          "legacy-image-pyramid" == a.documentElement.getAttribute("type"))
6059      );
6060    },
6061    configure: function (b, e) {
6062      var f;
6063      f = a.isPlainObject(b) ? d(this, b) : c(this, b);
6064      return f;
6065    },
6066    getLevelScale: function (a) {
6067      var b = NaN;
6068      this.levels.length > 0 &&
6069        a >= this.minLevel &&
6070        a <= this.maxLevel &&
6071        (b = this.levels[a].width / this.levels[this.maxLevel].width);
6072      return b;
6073    },
6074    getNumTiles: function (b) {
6075      var c = this.getLevelScale(b);
6076      return c ? new a.Point(1, 1) : new a.Point(0, 0);
6077    },
6078    getTileAtPoint: function (b, c) {
6079      return new a.Point(0, 0);
6080    },
6081    getTileUrl: function (a, b, c) {
6082      var d = null;
6083      this.levels.length > 0 &&
6084        a >= this.minLevel &&
6085        a <= this.maxLevel &&
6086        (d = this.levels[a].url);
6087      return d;
6088    },
6089  });
6090})(OpenSeadragon);
6091!(function (a) {
6092  a.ImageTileSource = function (b) {
6093    b = a.extend(
6094      {
6095        buildPyramid: !0,
6096        crossOriginPolicy: !1,
6097        ajaxWithCredentials: !1,
6098        useCanvas: !0,
6099      },
6100      b,
6101    );
6102    a.TileSource.apply(this, [b]);
6103  };
6104  a.extend(a.ImageTileSource.prototype, a.TileSource.prototype, {
6105    supports: function (a, b) {
6106      return a.type && "image" === a.type;
6107    },
6108    configure: function (a, b) {
6109      return a;
6110    },
6111    getImageInfo: function (b) {
6112      var c = (this._image = new Image());
6113      var d = this;
6114      this.crossOriginPolicy && (c.crossOrigin = this.crossOriginPolicy);
6115      this.ajaxWithCredentials && (c.useCredentials = this.ajaxWithCredentials);
6116      a.addEvent(c, "load", function () {
6117        d.width = c.naturalWidth;
6118        d.height = c.naturalHeight;
6119        d.aspectRatio = d.width / d.height;
6120        d.dimensions = new a.Point(d.width, d.height);
6121        d._tileWidth = d.width;
6122        d._tileHeight = d.height;
6123        d.tileOverlap = 0;
6124        d.minLevel = 0;
6125        d.levels = d._buildLevels();
6126        d.maxLevel = d.levels.length - 1;
6127        d.ready = !0;
6128        d.raiseEvent("ready", { tileSource: d });
6129      });
6130      a.addEvent(c, "error", function () {
6131        d.raiseEvent("open-failed", {
6132          message: "Error loading image at " + b,
6133          source: b,
6134        });
6135      });
6136      c.src = b;
6137    },
6138    getLevelScale: function (a) {
6139      var b = NaN;
6140      a >= this.minLevel &&
6141        a <= this.maxLevel &&
6142        (b = this.levels[a].width / this.levels[this.maxLevel].width);
6143      return b;
6144    },
6145    getNumTiles: function (b) {
6146      var c = this.getLevelScale(b);
6147      return c ? new a.Point(1, 1) : new a.Point(0, 0);
6148    },
6149    getTileAtPoint: function (b, c) {
6150      return new a.Point(0, 0);
6151    },
6152    getTileUrl: function (a, b, c) {
6153      var d = null;
6154      a >= this.minLevel && a <= this.maxLevel && (d = this.levels[a].url);
6155      return d;
6156    },
6157    getContext2D: function (a, b, c) {
6158      var d = null;
6159      a >= this.minLevel &&
6160        a <= this.maxLevel &&
6161        (d = this.levels[a].context2D);
6162      return d;
6163    },
6164    _buildLevels: function () {
6165      var b = [
6166        {
6167          url: this._image.src,
6168          width: this._image.naturalWidth,
6169          height: this._image.naturalHeight,
6170        },
6171      ];
6172      if (!this.buildPyramid || !a.supportsCanvas || !this.useCanvas) {
6173        delete this._image;
6174        return b;
6175      }
6176      var c = this._image.naturalWidth;
6177      var d = this._image.naturalHeight;
6178      var e = document.createElement("canvas");
6179      var f = e.getContext("2d");
6180      e.width = c;
6181      e.height = d;
6182      f.drawImage(this._image, 0, 0, c, d);
6183      b[0].context2D = f;
6184      delete this._image;
6185      if (a.isCanvasTainted(e)) return b;
6186      for (; c >= 2 && d >= 2; ) {
6187        c = Math.floor(c / 2);
6188        d = Math.floor(d / 2);
6189        var g = document.createElement("canvas");
6190        var h = g.getContext("2d");
6191        g.width = c;
6192        g.height = d;
6193        h.drawImage(e, 0, 0, c, d);
6194        b.splice(0, 0, { context2D: h, width: c, height: d });
6195        e = g;
6196        f = h;
6197      }
6198      return b;
6199    },
6200  });
6201})(OpenSeadragon);
6202!(function (a) {
6203  a.TileSourceCollection = function (b, c, d, e) {
6204    a.console.error("TileSourceCollection is deprecated; use World instead");
6205  };
6206})(OpenSeadragon);
6207!(function (a) {
6208  function b(b) {
6209    a.requestAnimationFrame(function () {
6210      c(b);
6211    });
6212  }
6213  function c(c) {
6214    var d, e, f;
6215    if (c.shouldFade) {
6216      d = a.now();
6217      e = d - c.fadeBeginTime;
6218      f = 1 - e / c.fadeLength;
6219      f = Math.min(1, f);
6220      f = Math.max(0, f);
6221      c.imgGroup && a.setElementOpacity(c.imgGroup, f, !0);
6222      f > 0 && b(c);
6223    }
6224  }
6225  function d(c) {
6226    c.shouldFade = !0;
6227    c.fadeBeginTime = a.now() + c.fadeDelay;
6228    window.setTimeout(function () {
6229      b(c);
6230    }, c.fadeDelay);
6231  }
6232  function e(b) {
6233    b.shouldFade = !1;
6234    b.imgGroup && a.setElementOpacity(b.imgGroup, 1, !0);
6235  }
6236  function f(b, c) {
6237    if (!b.element.disabled) {
6238      if (c >= a.ButtonState.GROUP && b.currentState == a.ButtonState.REST) {
6239        e(b);
6240        b.currentState = a.ButtonState.GROUP;
6241      }
6242      if (c >= a.ButtonState.HOVER && b.currentState == a.ButtonState.GROUP) {
6243        b.imgHover && (b.imgHover.style.visibility = "");
6244        b.currentState = a.ButtonState.HOVER;
6245      }
6246      if (c >= a.ButtonState.DOWN && b.currentState == a.ButtonState.HOVER) {
6247        b.imgDown && (b.imgDown.style.visibility = "");
6248        b.currentState = a.ButtonState.DOWN;
6249      }
6250    }
6251  }
6252  function g(b, c) {
6253    if (!b.element.disabled) {
6254      if (c <= a.ButtonState.HOVER && b.currentState == a.ButtonState.DOWN) {
6255        b.imgDown && (b.imgDown.style.visibility = "hidden");
6256        b.currentState = a.ButtonState.HOVER;
6257      }
6258      if (c <= a.ButtonState.GROUP && b.currentState == a.ButtonState.HOVER) {
6259        b.imgHover && (b.imgHover.style.visibility = "hidden");
6260        b.currentState = a.ButtonState.GROUP;
6261      }
6262      if (c <= a.ButtonState.REST && b.currentState == a.ButtonState.GROUP) {
6263        d(b);
6264        b.currentState = a.ButtonState.REST;
6265      }
6266    }
6267  }
6268  a.ButtonState = { REST: 0, GROUP: 1, HOVER: 2, DOWN: 3 };
6269  a.Button = function (b) {
6270    var c = this;
6271    a.EventSource.call(this);
6272    a.extend(
6273      !0,
6274      this,
6275      {
6276        tooltip: null,
6277        srcRest: null,
6278        srcGroup: null,
6279        srcHover: null,
6280        srcDown: null,
6281        clickTimeThreshold: a.DEFAULT_SETTINGS.clickTimeThreshold,
6282        clickDistThreshold: a.DEFAULT_SETTINGS.clickDistThreshold,
6283        fadeDelay: 0,
6284        fadeLength: 2e3,
6285        onPress: null,
6286        onRelease: null,
6287        onClick: null,
6288        onEnter: null,
6289        onExit: null,
6290        onFocus: null,
6291        onBlur: null,
6292      },
6293      b,
6294    );
6295    this.element = b.element || a.makeNeutralElement("div");
6296    if (!b.element) {
6297      this.imgRest = a.makeTransparentImage(this.srcRest);
6298      this.imgGroup = a.makeTransparentImage(this.srcGroup);
6299      this.imgHover = a.makeTransparentImage(this.srcHover);
6300      this.imgDown = a.makeTransparentImage(this.srcDown);
6301      this.imgRest.alt =
6302        this.imgGroup.alt =
6303        this.imgHover.alt =
6304        this.imgDown.alt =
6305          this.tooltip;
6306      this.element.style.position = "relative";
6307      a.setElementTouchActionNone(this.element);
6308      this.imgGroup.style.position =
6309        this.imgHover.style.position =
6310        this.imgDown.style.position =
6311          "absolute";
6312      this.imgGroup.style.top =
6313        this.imgHover.style.top =
6314        this.imgDown.style.top =
6315          "0px";
6316      this.imgGroup.style.left =
6317        this.imgHover.style.left =
6318        this.imgDown.style.left =
6319          "0px";
6320      this.imgHover.style.visibility = this.imgDown.style.visibility = "hidden";
6321      a.Browser.vendor == a.BROWSERS.FIREFOX &&
6322        a.Browser.version < 3 &&
6323        (this.imgGroup.style.top =
6324          this.imgHover.style.top =
6325          this.imgDown.style.top =
6326            "");
6327      this.element.appendChild(this.imgRest);
6328      this.element.appendChild(this.imgGroup);
6329      this.element.appendChild(this.imgHover);
6330      this.element.appendChild(this.imgDown);
6331    }
6332    this.addHandler("press", this.onPress);
6333    this.addHandler("release", this.onRelease);
6334    this.addHandler("click", this.onClick);
6335    this.addHandler("enter", this.onEnter);
6336    this.addHandler("exit", this.onExit);
6337    this.addHandler("focus", this.onFocus);
6338    this.addHandler("blur", this.onBlur);
6339    this.currentState = a.ButtonState.GROUP;
6340    this.fadeBeginTime = null;
6341    this.shouldFade = !1;
6342    this.element.style.display = "inline-block";
6343    this.element.style.position = "relative";
6344    this.element.title = this.tooltip;
6345    this.tracker = new a.MouseTracker({
6346      element: this.element,
6347      clickTimeThreshold: this.clickTimeThreshold,
6348      clickDistThreshold: this.clickDistThreshold,
6349      enterHandler: function (b) {
6350        if (b.insideElementPressed) {
6351          f(c, a.ButtonState.DOWN);
6352          c.raiseEvent("enter", { originalEvent: b.originalEvent });
6353        } else b.buttonDownAny || f(c, a.ButtonState.HOVER);
6354      },
6355      focusHandler: function (a) {
6356        this.enterHandler(a);
6357        c.raiseEvent("focus", { originalEvent: a.originalEvent });
6358      },
6359      exitHandler: function (b) {
6360        g(c, a.ButtonState.GROUP);
6361        b.insideElementPressed &&
6362          c.raiseEvent("exit", { originalEvent: b.originalEvent });
6363      },
6364      blurHandler: function (a) {
6365        this.exitHandler(a);
6366        c.raiseEvent("blur", { originalEvent: a.originalEvent });
6367      },
6368      pressHandler: function (b) {
6369        f(c, a.ButtonState.DOWN);
6370        c.raiseEvent("press", { originalEvent: b.originalEvent });
6371      },
6372      releaseHandler: function (b) {
6373        if (b.insideElementPressed && b.insideElementReleased) {
6374          g(c, a.ButtonState.HOVER);
6375          c.raiseEvent("release", { originalEvent: b.originalEvent });
6376        } else
6377          b.insideElementPressed
6378            ? g(c, a.ButtonState.GROUP)
6379            : f(c, a.ButtonState.HOVER);
6380      },
6381      clickHandler: function (a) {
6382        a.quick && c.raiseEvent("click", { originalEvent: a.originalEvent });
6383      },
6384      keyHandler: function (a) {
6385        if (13 === a.keyCode) {
6386          c.raiseEvent("click", { originalEvent: a.originalEvent });
6387          c.raiseEvent("release", { originalEvent: a.originalEvent });
6388          return !1;
6389        }
6390        return !0;
6391      },
6392    });
6393    g(this, a.ButtonState.REST);
6394  };
6395  a.extend(a.Button.prototype, a.EventSource.prototype, {
6396    notifyGroupEnter: function () {
6397      f(this, a.ButtonState.GROUP);
6398    },
6399    notifyGroupExit: function () {
6400      g(this, a.ButtonState.REST);
6401    },
6402    disable: function () {
6403      this.notifyGroupExit();
6404      this.element.disabled = !0;
6405      a.setElementOpacity(this.element, 0.2, !0);
6406    },
6407    enable: function () {
6408      this.element.disabled = !1;
6409      a.setElementOpacity(this.element, 1, !0);
6410      this.notifyGroupEnter();
6411    },
6412  });
6413})(OpenSeadragon);
6414!(function (a) {
6415  a.ButtonGroup = function (b) {
6416    a.extend(
6417      !0,
6418      this,
6419      {
6420        buttons: [],
6421        clickTimeThreshold: a.DEFAULT_SETTINGS.clickTimeThreshold,
6422        clickDistThreshold: a.DEFAULT_SETTINGS.clickDistThreshold,
6423        labelText: "",
6424      },
6425      b,
6426    );
6427    var c,
6428      d = this.buttons.concat([]),
6429      e = this;
6430    this.element = b.element || a.makeNeutralElement("div");
6431    if (!b.group) {
6432      this.label = a.makeNeutralElement("label");
6433      this.element.style.display = "inline-block";
6434      this.element.appendChild(this.label);
6435      for (c = 0; c < d.length; c++) this.element.appendChild(d[c].element);
6436    }
6437    a.setElementTouchActionNone(this.element);
6438    this.tracker = new a.MouseTracker({
6439      element: this.element,
6440      clickTimeThreshold: this.clickTimeThreshold,
6441      clickDistThreshold: this.clickDistThreshold,
6442      enterHandler: function (a) {
6443        var b;
6444        for (b = 0; b < e.buttons.length; b++) e.buttons[b].notifyGroupEnter();
6445      },
6446      exitHandler: function (a) {
6447        var b;
6448        if (!a.insideElementPressed)
6449          for (b = 0; b < e.buttons.length; b++) e.buttons[b].notifyGroupExit();
6450      },
6451    });
6452  };
6453  a.ButtonGroup.prototype = {
6454    emulateEnter: function () {
6455      this.tracker.enterHandler({ eventSource: this.tracker });
6456    },
6457    emulateExit: function () {
6458      this.tracker.exitHandler({ eventSource: this.tracker });
6459    },
6460  };
6461})(OpenSeadragon);
6462!(function (a) {
6463  a.Rect = function (a, b, c, d, e) {
6464    this.x = "number" == typeof a ? a : 0;
6465    this.y = "number" == typeof b ? b : 0;
6466    this.width = "number" == typeof c ? c : 0;
6467    this.height = "number" == typeof d ? d : 0;
6468    this.degrees = "number" == typeof e ? e : 0;
6469    this.degrees = this.degrees % 360;
6470    this.degrees < 0 && (this.degrees += 360);
6471    var f, g;
6472    if (this.degrees >= 270) {
6473      f = this.getTopRight();
6474      this.x = f.x;
6475      this.y = f.y;
6476      g = this.height;
6477      this.height = this.width;
6478      this.width = g;
6479      this.degrees -= 270;
6480    } else if (this.degrees >= 180) {
6481      f = this.getBottomRight();
6482      this.x = f.x;
6483      this.y = f.y;
6484      this.degrees -= 180;
6485    } else if (this.degrees >= 90) {
6486      f = this.getBottomLeft();
6487      this.x = f.x;
6488      this.y = f.y;
6489      g = this.height;
6490      this.height = this.width;
6491      this.width = g;
6492      this.degrees -= 90;
6493    }
6494  };
6495  a.Rect.fromSummits = function (b, c, d) {
6496    var e = b.distanceTo(c);
6497    var f = b.distanceTo(d);
6498    var g = c.minus(b);
6499    var h = Math.atan(g.y / g.x);
6500    g.x < 0 ? (h += Math.PI) : g.y < 0 && (h += 2 * Math.PI);
6501    return new a.Rect(b.x, b.y, e, f, (h / Math.PI) * 180);
6502  };
6503  a.Rect.prototype = {
6504    clone: function () {
6505      return new a.Rect(this.x, this.y, this.width, this.height, this.degrees);
6506    },
6507    getAspectRatio: function () {
6508      return this.width / this.height;
6509    },
6510    getTopLeft: function () {
6511      return new a.Point(this.x, this.y);
6512    },
6513    getBottomRight: function () {
6514      return new a.Point(this.x + this.width, this.y + this.height).rotate(
6515        this.degrees,
6516        this.getTopLeft(),
6517      );
6518    },
6519    getTopRight: function () {
6520      return new a.Point(this.x + this.width, this.y).rotate(
6521        this.degrees,
6522        this.getTopLeft(),
6523      );
6524    },
6525    getBottomLeft: function () {
6526      return new a.Point(this.x, this.y + this.height).rotate(
6527        this.degrees,
6528        this.getTopLeft(),
6529      );
6530    },
6531    getCenter: function () {
6532      return new a.Point(
6533        this.x + this.width / 2,
6534        this.y + this.height / 2,
6535      ).rotate(this.degrees, this.getTopLeft());
6536    },
6537    getSize: function () {
6538      return new a.Point(this.width, this.height);
6539    },
6540    equals: function (b) {
6541      return (
6542        b instanceof a.Rect &&
6543        this.x === b.x &&
6544        this.y === b.y &&
6545        this.width === b.width &&
6546        this.height === b.height &&
6547        this.degrees === b.degrees
6548      );
6549    },
6550    times: function (b) {
6551      return new a.Rect(
6552        this.x * b,
6553        this.y * b,
6554        this.width * b,
6555        this.height * b,
6556        this.degrees,
6557      );
6558    },
6559    translate: function (b) {
6560      return new a.Rect(
6561        this.x + b.x,
6562        this.y + b.y,
6563        this.width,
6564        this.height,
6565        this.degrees,
6566      );
6567    },
6568    union: function (b) {
6569      var c = this.getBoundingBox();
6570      var d = b.getBoundingBox();
6571      var e = Math.min(c.x, d.x);
6572      var f = Math.min(c.y, d.y);
6573      var g = Math.max(c.x + c.width, d.x + d.width);
6574      var h = Math.max(c.y + c.height, d.y + d.height);
6575      return new a.Rect(e, f, g - e, h - f);
6576    },
6577    intersection: function (b) {
6578      function c(b, c, e, f) {
6579        var g = c.minus(b);
6580        var h = f.minus(e);
6581        var i = -h.x * g.y + g.x * h.y;
6582        if (0 === i) return null;
6583        var j = (g.x * (b.y - e.y) - g.y * (b.x - e.x)) / i;
6584        var k = (h.x * (b.y - e.y) - h.y * (b.x - e.x)) / i;
6585        return j >= -d && 1 - d >= j && k >= -d && 1 - d >= k
6586          ? new a.Point(b.x + k * g.x, b.y + k * g.y)
6587          : null;
6588      }
6589      var d = 1e-10;
6590      var e = [];
6591      var f = this.getTopLeft();
6592      b.containsPoint(f, d) && e.push(f);
6593      var g = this.getTopRight();
6594      b.containsPoint(g, d) && e.push(g);
6595      var h = this.getBottomLeft();
6596      b.containsPoint(h, d) && e.push(h);
6597      var i = this.getBottomRight();
6598      b.containsPoint(i, d) && e.push(i);
6599      var j = b.getTopLeft();
6600      this.containsPoint(j, d) && e.push(j);
6601      var k = b.getTopRight();
6602      this.containsPoint(k, d) && e.push(k);
6603      var l = b.getBottomLeft();
6604      this.containsPoint(l, d) && e.push(l);
6605      var m = b.getBottomRight();
6606      this.containsPoint(m, d) && e.push(m);
6607      var n = this._getSegments();
6608      var o = b._getSegments();
6609      for (var p = 0; p < n.length; p++) {
6610        var q = n[p];
6611        for (var r = 0; r < o.length; r++) {
6612          var s = o[r];
6613          var t = c(q[0], q[1], s[0], s[1]);
6614          t && e.push(t);
6615        }
6616      }
6617      if (0 === e.length) return null;
6618      var u = e[0].x;
6619      var v = e[0].x;
6620      var w = e[0].y;
6621      var x = e[0].y;
6622      for (var y = 1; y < e.length; y++) {
6623        var z = e[y];
6624        z.x < u && (u = z.x);
6625        z.x > v && (v = z.x);
6626        z.y < w && (w = z.y);
6627        z.y > x && (x = z.y);
6628      }
6629      return new a.Rect(u, w, v - u, x - w);
6630    },
6631    _getSegments: function () {
6632      var a = this.getTopLeft();
6633      var b = this.getTopRight();
6634      var c = this.getBottomLeft();
6635      var d = this.getBottomRight();
6636      return [
6637        [a, b],
6638        [b, d],
6639        [d, c],
6640        [c, a],
6641      ];
6642    },
6643    rotate: function (b, c) {
6644      b %= 360;
6645      if (0 === b) return this.clone();
6646      0 > b && (b += 360);
6647      c = c || this.getCenter();
6648      var d = this.getTopLeft().rotate(b, c);
6649      var e = this.getTopRight().rotate(b, c);
6650      var f = e.minus(d);
6651      var g = Math.atan(f.y / f.x);
6652      f.x < 0 ? (g += Math.PI) : f.y < 0 && (g += 2 * Math.PI);
6653      return new a.Rect(d.x, d.y, this.width, this.height, (g / Math.PI) * 180);
6654    },
6655    getBoundingBox: function () {
6656      if (0 === this.degrees) return this.clone();
6657      var b = this.getTopLeft();
6658      var c = this.getTopRight();
6659      var d = this.getBottomLeft();
6660      var e = this.getBottomRight();
6661      var f = Math.min(b.x, c.x, d.x, e.x);
6662      var g = Math.max(b.x, c.x, d.x, e.x);
6663      var h = Math.min(b.y, c.y, d.y, e.y);
6664      var i = Math.max(b.y, c.y, d.y, e.y);
6665      return new a.Rect(f, h, g - f, i - h);
6666    },
6667    getIntegerBoundingBox: function () {
6668      var b = this.getBoundingBox();
6669      var c = Math.floor(b.x);
6670      var d = Math.floor(b.y);
6671      var e = Math.ceil(b.width + b.x - c);
6672      var f = Math.ceil(b.height + b.y - d);
6673      return new a.Rect(c, d, e, f);
6674    },
6675    containsPoint: function (a, b) {
6676      b = b || 0;
6677      var c = this.getTopLeft();
6678      var d = this.getTopRight();
6679      var e = this.getBottomLeft();
6680      var f = d.minus(c);
6681      var g = e.minus(c);
6682      return (
6683        (a.x - c.x) * f.x + (a.y - c.y) * f.y >= -b &&
6684        (a.x - d.x) * f.x + (a.y - d.y) * f.y <= b &&
6685        (a.x - c.x) * g.x + (a.y - c.y) * g.y >= -b &&
6686        (a.x - e.x) * g.x + (a.y - e.y) * g.y <= b
6687      );
6688    },
6689    toString: function () {
6690      return (
6691        "[" +
6692        Math.round(100 * this.x) / 100 +
6693        ", " +
6694        Math.round(100 * this.y) / 100 +
6695        ", " +
6696        Math.round(100 * this.width) / 100 +
6697        "x" +
6698        Math.round(100 * this.height) / 100 +
6699        ", " +
6700        Math.round(100 * this.degrees) / 100 +
6701        "deg]"
6702      );
6703    },
6704  };
6705})(OpenSeadragon);
6706!(function (a) {
6707  function b(b) {
6708    var c = Number(this.element.style.marginLeft.replace("px", "")),
6709      e = Number(this.element.style.marginTop.replace("px", "")),
6710      f = Number(this.element.style.width.replace("px", "")),
6711      g = Number(this.element.style.height.replace("px", "")),
6712      h = a.getElementSize(this.viewer.canvas);
6713    this.dragging = !0;
6714    if (this.element)
6715      if ("horizontal" == this.scroll) {
6716        if (-b.delta.x > 0) {
6717          if (c > -(f - h.x)) {
6718            this.element.style.marginLeft = c + 2 * b.delta.x + "px";
6719            d(this, h.x, c + 2 * b.delta.x);
6720          }
6721        } else if (-b.delta.x < 0 && 0 > c) {
6722          this.element.style.marginLeft = c + 2 * b.delta.x + "px";
6723          d(this, h.x, c + 2 * b.delta.x);
6724        }
6725      } else if (-b.delta.y > 0) {
6726        if (e > -(g - h.y)) {
6727          this.element.style.marginTop = e + 2 * b.delta.y + "px";
6728          d(this, h.y, e + 2 * b.delta.y);
6729        }
6730      } else if (-b.delta.y < 0 && 0 > e) {
6731        this.element.style.marginTop = e + 2 * b.delta.y + "px";
6732        d(this, h.y, e + 2 * b.delta.y);
6733      }
6734    return !1;
6735  }
6736  function c(b) {
6737    var c = Number(this.element.style.marginLeft.replace("px", "")),
6738      e = Number(this.element.style.marginTop.replace("px", "")),
6739      f = Number(this.element.style.width.replace("px", "")),
6740      g = Number(this.element.style.height.replace("px", "")),
6741      h = a.getElementSize(this.viewer.canvas);
6742    if (this.element)
6743      if ("horizontal" == this.scroll) {
6744        if (b.scroll > 0) {
6745          if (c > -(f - h.x)) {
6746            this.element.style.marginLeft = c - 60 * b.scroll + "px";
6747            d(this, h.x, c - 60 * b.scroll);
6748          }
6749        } else if (b.scroll < 0 && 0 > c) {
6750          this.element.style.marginLeft = c - 60 * b.scroll + "px";
6751          d(this, h.x, c - 60 * b.scroll);
6752        }
6753      } else if (b.scroll < 0) {
6754        if (e > h.y - g) {
6755          this.element.style.marginTop = e + 60 * b.scroll + "px";
6756          d(this, h.y, e + 60 * b.scroll);
6757        }
6758      } else if (b.scroll > 0 && 0 > e) {
6759        this.element.style.marginTop = e + 60 * b.scroll + "px";
6760        d(this, h.y, e + 60 * b.scroll);
6761      }
6762    return !1;
6763  }
6764  function d(b, c, d) {
6765    var e, f, g, h, i, j, k;
6766    e = "horizontal" == b.scroll ? b.panelWidth : b.panelHeight;
6767    f = Math.ceil(c / e) + 5;
6768    g = Math.ceil((Math.abs(d) + c) / e) + 1;
6769    f = g - f;
6770    f = 0 > f ? 0 : f;
6771    for (j = f; g > j && j < b.panels.length; j++) {
6772      k = b.panels[j];
6773      if (!k.activePanel) {
6774        h = new a.Viewer({
6775          id: k.id,
6776          tileSources: [b.viewer.tileSources[j]],
6777          element: k,
6778          navigatorSizeRatio: b.sizeRatio,
6779          showNavigator: !1,
6780          mouseNavEnabled: !1,
6781          showNavigationControl: !1,
6782          showSequenceControl: !1,
6783          immediateRender: !0,
6784          blendTime: 0,
6785          animationTime: 0,
6786        });
6787        h.displayRegion = a.makeNeutralElement("div");
6788        h.displayRegion.id = k.id + "-displayregion";
6789        h.displayRegion.className = "displayregion";
6790        i = h.displayRegion.style;
6791        i.position = "relative";
6792        i.top = "0px";
6793        i.left = "0px";
6794        i.fontSize = "0px";
6795        i.overflow = "hidden";
6796        i["float"] = "left";
6797        i.cssFloat = "left";
6798        i.styleFloat = "left";
6799        i.zIndex = 999999999;
6800        i.cursor = "default";
6801        i.width = b.panelWidth - 4 + "px";
6802        i.height = b.panelHeight - 4 + "px";
6803        h.displayRegion.innerTracker = new a.MouseTracker({
6804          element: h.displayRegion,
6805          startDisabled: !0,
6806        });
6807        k.getElementsByTagName("div")[0].appendChild(h.displayRegion);
6808        k.activePanel = !0;
6809      }
6810    }
6811  }
6812  function e(a) {
6813    var b = a.eventSource.element;
6814    "horizontal" == this.scroll
6815      ? (b.style.marginBottom = "0px")
6816      : (b.style.marginLeft = "0px");
6817    return !1;
6818  }
6819  function f(b) {
6820    var c = b.eventSource.element;
6821    "horizontal" == this.scroll
6822      ? (c.style.marginBottom = "-" + a.getElementSize(c).y / 2 + "px")
6823      : (c.style.marginLeft = "-" + a.getElementSize(c).x / 2 + "px");
6824    return !1;
6825  }
6826  function g(a) {
6827    if (a.preventDefaultAction || a.ctrl || a.alt || a.meta) return !0;
6828    switch (a.keyCode) {
6829      case 38:
6830        c.call(this, {
6831          eventSource: this.tracker,
6832          position: null,
6833          scroll: 1,
6834          shift: null,
6835        });
6836        return !1;
6837      case 40:
6838        c.call(this, {
6839          eventSource: this.tracker,
6840          position: null,
6841          scroll: -1,
6842          shift: null,
6843        });
6844        return !1;
6845      case 37:
6846        c.call(this, {
6847          eventSource: this.tracker,
6848          position: null,
6849          scroll: -1,
6850          shift: null,
6851        });
6852        return !1;
6853      case 39:
6854        c.call(this, {
6855          eventSource: this.tracker,
6856          position: null,
6857          scroll: 1,
6858          shift: null,
6859        });
6860        return !1;
6861      default:
6862        return !0;
6863    }
6864  }
6865  function h(a) {
6866    if (a.preventDefaultAction || a.ctrl || a.alt || a.meta) return !0;
6867    switch (a.keyCode) {
6868      case 61:
6869        c.call(this, {
6870          eventSource: this.tracker,
6871          position: null,
6872          scroll: 1,
6873          shift: null,
6874        });
6875        return !1;
6876      case 45:
6877        c.call(this, {
6878          eventSource: this.tracker,
6879          position: null,
6880          scroll: -1,
6881          shift: null,
6882        });
6883        return !1;
6884      case 48:
6885      case 119:
6886      case 87:
6887        c.call(this, {
6888          eventSource: this.tracker,
6889          position: null,
6890          scroll: 1,
6891          shift: null,
6892        });
6893        return !1;
6894      case 115:
6895      case 83:
6896        c.call(this, {
6897          eventSource: this.tracker,
6898          position: null,
6899          scroll: -1,
6900          shift: null,
6901        });
6902        return !1;
6903      case 97:
6904        c.call(this, {
6905          eventSource: this.tracker,
6906          position: null,
6907          scroll: -1,
6908          shift: null,
6909        });
6910        return !1;
6911      case 100:
6912        c.call(this, {
6913          eventSource: this.tracker,
6914          position: null,
6915          scroll: 1,
6916          shift: null,
6917        });
6918        return !1;
6919      default:
6920        return !0;
6921    }
6922  }
6923  var i = {};
6924  a.ReferenceStrip = function (j) {
6925    var k,
6926      l,
6927      m,
6928      n = this,
6929      o = j.viewer,
6930      p = a.getElementSize(o.element);
6931    if (!j.id) {
6932      j.id = "referencestrip-" + a.now();
6933      this.element = a.makeNeutralElement("div");
6934      this.element.id = j.id;
6935      this.element.className = "referencestrip";
6936    }
6937    j = a.extend(
6938      !0,
6939      {
6940        sizeRatio: a.DEFAULT_SETTINGS.referenceStripSizeRatio,
6941        position: a.DEFAULT_SETTINGS.referenceStripPosition,
6942        scroll: a.DEFAULT_SETTINGS.referenceStripScroll,
6943        clickTimeThreshold: a.DEFAULT_SETTINGS.clickTimeThreshold,
6944      },
6945      j,
6946      {
6947        element: this.element,
6948        showNavigator: !1,
6949        mouseNavEnabled: !1,
6950        showNavigationControl: !1,
6951        showSequenceControl: !1,
6952      },
6953    );
6954    a.extend(this, j);
6955    i[this.id] = { animating: !1 };
6956    this.minPixelRatio = this.viewer.minPixelRatio;
6957    l = this.element.style;
6958    l.marginTop = "0px";
6959    l.marginRight = "0px";
6960    l.marginBottom = "0px";
6961    l.marginLeft = "0px";
6962    l.left = "0px";
6963    l.bottom = "0px";
6964    l.border = "0px";
6965    l.background = "#000";
6966    l.position = "relative";
6967    a.setElementTouchActionNone(this.element);
6968    a.setElementOpacity(this.element, 0.8);
6969    this.viewer = o;
6970    this.innerTracker = new a.MouseTracker({
6971      element: this.element,
6972      dragHandler: a.delegate(this, b),
6973      scrollHandler: a.delegate(this, c),
6974      enterHandler: a.delegate(this, e),
6975      exitHandler: a.delegate(this, f),
6976      keyDownHandler: a.delegate(this, g),
6977      keyHandler: a.delegate(this, h),
6978    });
6979    if (j.width && j.height) {
6980      this.element.style.width = j.width + "px";
6981      this.element.style.height = j.height + "px";
6982      o.addControl(this.element, { anchor: a.ControlAnchor.BOTTOM_LEFT });
6983    } else if ("horizontal" == j.scroll) {
6984      this.element.style.width =
6985        p.x * j.sizeRatio * o.tileSources.length +
6986        12 * o.tileSources.length +
6987        "px";
6988      this.element.style.height = p.y * j.sizeRatio + "px";
6989      o.addControl(this.element, { anchor: a.ControlAnchor.BOTTOM_LEFT });
6990    } else {
6991      this.element.style.height =
6992        p.y * j.sizeRatio * o.tileSources.length +
6993        12 * o.tileSources.length +
6994        "px";
6995      this.element.style.width = p.x * j.sizeRatio + "px";
6996      o.addControl(this.element, { anchor: a.ControlAnchor.TOP_LEFT });
6997    }
6998    this.panelWidth = p.x * this.sizeRatio + 8;
6999    this.panelHeight = p.y * this.sizeRatio + 8;
7000    this.panels = [];
7001    for (m = 0; m < o.tileSources.length; m++) {
7002      k = a.makeNeutralElement("div");
7003      k.id = this.element.id + "-" + m;
7004      k.style.width = n.panelWidth + "px";
7005      k.style.height = n.panelHeight + "px";
7006      k.style.display = "inline";
7007      k.style["float"] = "left";
7008      k.style.cssFloat = "left";
7009      k.style.styleFloat = "left";
7010      k.style.padding = "2px";
7011      a.setElementTouchActionNone(k);
7012      k.innerTracker = new a.MouseTracker({
7013        element: k,
7014        clickTimeThreshold: this.clickTimeThreshold,
7015        clickDistThreshold: this.clickDistThreshold,
7016        pressHandler: function (b) {
7017          b.eventSource.dragging = a.now();
7018        },
7019        releaseHandler: function (b) {
7020          var c = b.eventSource,
7021            d = c.element.id,
7022            e = Number(d.split("-")[2]),
7023            f = a.now();
7024          if (
7025            b.insideElementPressed &&
7026            b.insideElementReleased &&
7027            c.dragging &&
7028            f - c.dragging < c.clickTimeThreshold
7029          ) {
7030            c.dragging = null;
7031            o.goToPage(e);
7032          }
7033        },
7034      });
7035      this.element.appendChild(k);
7036      k.activePanel = !1;
7037      this.panels.push(k);
7038    }
7039    d(this, "vertical" == this.scroll ? p.y : p.x, 0);
7040    this.setFocus(0);
7041  };
7042  a.extend(
7043    a.ReferenceStrip.prototype,
7044    a.EventSource.prototype,
7045    a.Viewer.prototype,
7046    {
7047      setFocus: function (b) {
7048        var c,
7049          f = a.getElement(this.element.id + "-" + b),
7050          g = a.getElementSize(this.viewer.canvas),
7051          h = Number(this.element.style.width.replace("px", "")),
7052          i = Number(this.element.style.height.replace("px", "")),
7053          j = -Number(this.element.style.marginLeft.replace("px", "")),
7054          k = -Number(this.element.style.marginTop.replace("px", ""));
7055        if (this.currentSelected !== f) {
7056          this.currentSelected &&
7057            (this.currentSelected.style.background = "#000");
7058          this.currentSelected = f;
7059          this.currentSelected.style.background = "#999";
7060          if ("horizontal" == this.scroll) {
7061            c = Number(b) * (this.panelWidth + 3);
7062            if (c > j + g.x - this.panelWidth) {
7063              c = Math.min(c, h - g.x);
7064              this.element.style.marginLeft = -c + "px";
7065              d(this, g.x, -c);
7066            } else if (j > c) {
7067              c = Math.max(0, c - g.x / 2);
7068              this.element.style.marginLeft = -c + "px";
7069              d(this, g.x, -c);
7070            }
7071          } else {
7072            c = Number(b) * (this.panelHeight + 3);
7073            if (c > k + g.y - this.panelHeight) {
7074              c = Math.min(c, i - g.y);
7075              this.element.style.marginTop = -c + "px";
7076              d(this, g.y, -c);
7077            } else if (k > c) {
7078              c = Math.max(0, c - g.y / 2);
7079              this.element.style.marginTop = -c + "px";
7080              d(this, g.y, -c);
7081            }
7082          }
7083          this.currentPage = b;
7084          e.call(this, { eventSource: this.innerTracker });
7085        }
7086      },
7087      update: function () {
7088        if (i[this.id].animating) {
7089          a.console.log("image reference strip update");
7090          return !0;
7091        }
7092        return !1;
7093      },
7094      destroy: function () {
7095        this.element && this.element.parentNode.removeChild(this.element);
7096      },
7097    },
7098  );
7099})(OpenSeadragon);
7100!(function (a) {
7101  a.DisplayRect = function (b, c, d, e, f, g) {
7102    a.Rect.apply(this, [b, c, d, e]);
7103    this.minLevel = f;
7104    this.maxLevel = g;
7105  };
7106  a.extend(a.DisplayRect.prototype, a.Rect.prototype);
7107})(OpenSeadragon);
7108!(function (a) {
7109  function b(a, b) {
7110    return (1 - Math.exp(a * -b)) / (1 - Math.exp(-a));
7111  }
7112  a.Spring = function (b) {
7113    var c = arguments;
7114    "object" != typeof b &&
7115      (b = {
7116        initial: c.length && "number" == typeof c[0] ? c[0] : void 0,
7117        springStiffness: c.length > 1 ? c[1].springStiffness : 5,
7118        animationTime: c.length > 1 ? c[1].animationTime : 1.5,
7119      });
7120    a.console.assert(
7121      "number" == typeof b.springStiffness && 0 !== b.springStiffness,
7122      "[OpenSeadragon.Spring] options.springStiffness must be a non-zero number",
7123    );
7124    a.console.assert(
7125      "number" == typeof b.animationTime && b.animationTime >= 0,
7126      "[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0",
7127    );
7128    if (b.exponential) {
7129      this._exponential = !0;
7130      delete b.exponential;
7131    }
7132    a.extend(!0, this, b);
7133    this.current = {
7134      value:
7135        "number" == typeof this.initial
7136          ? this.initial
7137          : this._exponential
7138            ? 0
7139            : 1,
7140      time: a.now(),
7141    };
7142    a.console.assert(
7143      !this._exponential || 0 !== this.current.value,
7144      "[OpenSeadragon.Spring] value must be non-zero for exponential springs",
7145    );
7146    this.start = { value: this.current.value, time: this.current.time };
7147    this.target = { value: this.current.value, time: this.current.time };
7148    if (this._exponential) {
7149      this.start._logValue = Math.log(this.start.value);
7150      this.target._logValue = Math.log(this.target.value);
7151      this.current._logValue = Math.log(this.current.value);
7152    }
7153  };
7154  a.Spring.prototype = {
7155    resetTo: function (b) {
7156      a.console.assert(
7157        !this._exponential || 0 !== b,
7158        "[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs",
7159      );
7160      this.start.value = this.target.value = this.current.value = b;
7161      this.start.time = this.target.time = this.current.time = a.now();
7162      if (this._exponential) {
7163        this.start._logValue = Math.log(this.start.value);
7164        this.target._logValue = Math.log(this.target.value);
7165        this.current._logValue = Math.log(this.current.value);
7166      }
7167    },
7168    springTo: function (b) {
7169      a.console.assert(
7170        !this._exponential || 0 !== b,
7171        "[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs",
7172      );
7173      this.start.value = this.current.value;
7174      this.start.time = this.current.time;
7175      this.target.value = b;
7176      this.target.time = this.start.time + 1e3 * this.animationTime;
7177      if (this._exponential) {
7178        this.start._logValue = Math.log(this.start.value);
7179        this.target._logValue = Math.log(this.target.value);
7180      }
7181    },
7182    shiftBy: function (b) {
7183      this.start.value += b;
7184      this.target.value += b;
7185      if (this._exponential) {
7186        a.console.assert(
7187          0 !== this.target.value && 0 !== this.start.value,
7188          "[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs",
7189        );
7190        this.start._logValue = Math.log(this.start.value);
7191        this.target._logValue = Math.log(this.target.value);
7192      }
7193    },
7194    setExponential: function (b) {
7195      this._exponential = b;
7196      if (this._exponential) {
7197        a.console.assert(
7198          0 !== this.current.value &&
7199            0 !== this.target.value &&
7200            0 !== this.start.value,
7201          "[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs",
7202        );
7203        this.start._logValue = Math.log(this.start.value);
7204        this.target._logValue = Math.log(this.target.value);
7205        this.current._logValue = Math.log(this.current.value);
7206      }
7207    },
7208    update: function () {
7209      this.current.time = a.now();
7210      var c, d;
7211      if (this._exponential) {
7212        c = this.start._logValue;
7213        d = this.target._logValue;
7214      } else {
7215        c = this.start.value;
7216        d = this.target.value;
7217      }
7218      var e =
7219        this.current.time >= this.target.time
7220          ? d
7221          : c +
7222            (d - c) *
7223              b(
7224                this.springStiffness,
7225                (this.current.time - this.start.time) /
7226                  (this.target.time - this.start.time),
7227              );
7228      this._exponential
7229        ? (this.current.value = Math.exp(e))
7230        : (this.current.value = e);
7231    },
7232    isAtTargetValue: function () {
7233      return this.current.value === this.target.value;
7234    },
7235  };
7236})(OpenSeadragon);
7237!(function (a) {
7238  function b(b) {
7239    a.extend(!0, this, { timeout: a.DEFAULT_SETTINGS.timeout, jobId: null }, b);
7240    this.image = null;
7241  }
7242  function c(a, b, c) {
7243    var d;
7244    a.jobsInProgress--;
7245    if (
7246      (!a.jobLimit || a.jobsInProgress < a.jobLimit) &&
7247      a.jobQueue.length > 0
7248    ) {
7249      d = a.jobQueue.shift();
7250      d.start();
7251      a.jobsInProgress++;
7252    }
7253    c(b.image, b.errorMsg);
7254  }
7255  b.prototype = {
7256    errorMsg: null,
7257    start: function () {
7258      var a = this;
7259      this.image = new Image();
7260      this.crossOriginPolicy !== !1 &&
7261        (this.image.crossOrigin = this.crossOriginPolicy);
7262      this.image.onload = function () {
7263        a.finish(!0);
7264      };
7265      this.image.onabort = this.image.onerror = function () {
7266        a.errorMsg = "Image load aborted";
7267        a.finish(!1);
7268      };
7269      this.jobId = window.setTimeout(function () {
7270        a.errorMsg = "Image load exceeded timeout";
7271        a.finish(!1);
7272      }, this.timeout);
7273      this.image.src = this.src;
7274    },
7275    finish: function (a) {
7276      this.image.onload = this.image.onerror = this.image.onabort = null;
7277      a || (this.image = null);
7278      this.jobId && window.clearTimeout(this.jobId);
7279      this.callback(this);
7280    },
7281  };
7282  a.ImageLoader = function (b) {
7283    a.extend(
7284      !0,
7285      this,
7286      {
7287        jobLimit: a.DEFAULT_SETTINGS.imageLoaderLimit,
7288        jobQueue: [],
7289        jobsInProgress: 0,
7290      },
7291      b,
7292    );
7293  };
7294  a.ImageLoader.prototype = {
7295    addJob: function (a) {
7296      var d = this,
7297        e = function (b) {
7298          c(d, b, a.callback);
7299        },
7300        f = {
7301          src: a.src,
7302          crossOriginPolicy: a.crossOriginPolicy,
7303          callback: e,
7304          abort: a.abort,
7305        },
7306        g = new b(f);
7307      if (!this.jobLimit || this.jobsInProgress < this.jobLimit) {
7308        g.start();
7309        this.jobsInProgress++;
7310      } else this.jobQueue.push(g);
7311    },
7312    clear: function () {
7313      for (var a = 0; a < this.jobQueue.length; a++) {
7314        var b = this.jobQueue[a];
7315        "function" == typeof b.abort && b.abort();
7316      }
7317      this.jobQueue = [];
7318    },
7319  };
7320})(OpenSeadragon);
7321!(function (a) {
7322  a.Tile = function (a, b, c, d, e, f, g) {
7323    this.level = a;
7324    this.x = b;
7325    this.y = c;
7326    this.bounds = d;
7327    this.exists = e;
7328    this.url = f;
7329    this.context2D = g;
7330    this.loaded = !1;
7331    this.loading = !1;
7332    this.element = null;
7333    this.imgElement = null;
7334    this.image = null;
7335    this.style = null;
7336    this.position = null;
7337    this.size = null;
7338    this.blendStart = null;
7339    this.opacity = null;
7340    this.distance = null;
7341    this.visibility = null;
7342    this.beingDrawn = !1;
7343    this.lastTouchTime = 0;
7344  };
7345  a.Tile.prototype = {
7346    toString: function () {
7347      return this.level + "/" + this.x + "_" + this.y;
7348    },
7349    _hasTransparencyChannel: function () {
7350      return !!this.context2D || this.url.match(".png");
7351    },
7352    drawHTML: function (b) {
7353      if (this.cacheImageRecord)
7354        if (this.loaded) {
7355          if (!this.element) {
7356            this.element = a.makeNeutralElement("div");
7357            this.imgElement = this.cacheImageRecord.getImage().cloneNode();
7358            this.imgElement.style.msInterpolationMode = "nearest-neighbor";
7359            this.imgElement.style.width = "100%";
7360            this.imgElement.style.height = "100%";
7361            this.style = this.element.style;
7362            this.style.position = "absolute";
7363          }
7364          this.element.parentNode != b && b.appendChild(this.element);
7365          this.imgElement.parentNode != this.element &&
7366            this.element.appendChild(this.imgElement);
7367          this.style.top = this.position.y + "px";
7368          this.style.left = this.position.x + "px";
7369          this.style.height = this.size.y + "px";
7370          this.style.width = this.size.x + "px";
7371          a.setElementOpacity(this.element, this.opacity);
7372        } else
7373          a.console.warn(
7374            "Attempting to draw tile %s when it's not yet loaded.",
7375            this.toString(),
7376          );
7377      else
7378        a.console.warn(
7379          "[Tile.drawHTML] attempting to draw tile %s when it's not cached",
7380          this.toString(),
7381        );
7382    },
7383    drawCanvas: function (b, c, d, e) {
7384      var f,
7385        g = this.position.times(a.pixelDensityRatio),
7386        h = this.size.times(a.pixelDensityRatio);
7387      if (this.context2D || this.cacheImageRecord) {
7388        f = this.context2D || this.cacheImageRecord.getRenderedContext();
7389        if (this.loaded && f) {
7390          b.save();
7391          b.globalAlpha = this.opacity;
7392          if ("number" == typeof d && 1 !== d) {
7393            g = g.times(d);
7394            h = h.times(d);
7395          }
7396          e instanceof a.Point && (g = g.plus(e));
7397          1 === b.globalAlpha &&
7398            this._hasTransparencyChannel() &&
7399            b.clearRect(g.x + 1, g.y + 1, h.x - 2, h.y - 2);
7400          c({ context: b, tile: this, rendered: f });
7401          b.drawImage(
7402            f.canvas,
7403            0,
7404            0,
7405            f.canvas.width,
7406            f.canvas.height,
7407            g.x,
7408            g.y,
7409            h.x,
7410            h.y,
7411          );
7412          b.restore();
7413        } else
7414          a.console.warn(
7415            "Attempting to draw tile %s when it's not yet loaded.",
7416            this.toString(),
7417          );
7418      } else
7419        a.console.warn(
7420          "[Tile.drawCanvas] attempting to draw tile %s when it's not cached",
7421          this.toString(),
7422        );
7423    },
7424    getScaleForEdgeSmoothing: function () {
7425      var b;
7426      if (this.cacheImageRecord) b = this.cacheImageRecord.getRenderedContext();
7427      else {
7428        if (!this.context2D) {
7429          a.console.warn(
7430            "[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",
7431            this.toString(),
7432          );
7433          return 1;
7434        }
7435        b = this.context2D;
7436      }
7437      return b.canvas.width / (this.size.x * a.pixelDensityRatio);
7438    },
7439    getTranslationForEdgeSmoothing: function (b, c, d) {
7440      var e = Math.max(1, Math.ceil((d.x - c.x) / 2));
7441      var f = Math.max(1, Math.ceil((d.y - c.y) / 2));
7442      return new a.Point(e, f).minus(
7443        this.position
7444          .times(a.pixelDensityRatio)
7445          .times(b || 1)
7446          .apply(function (a) {
7447            return a % 1;
7448          }),
7449      );
7450    },
7451    unload: function () {
7452      this.imgElement &&
7453        this.imgElement.parentNode &&
7454        this.imgElement.parentNode.removeChild(this.imgElement);
7455      this.element &&
7456        this.element.parentNode &&
7457        this.element.parentNode.removeChild(this.element);
7458      this.element = null;
7459      this.imgElement = null;
7460      this.loaded = !1;
7461      this.loading = !1;
7462    },
7463  };
7464})(OpenSeadragon);
7465!(function (a) {
7466  a.OverlayPlacement = a.Placement;
7467  a.OverlayRotationMode = a.freezeObject({
7468    NO_ROTATION: 1,
7469    EXACT: 2,
7470    BOUNDING_BOX: 3,
7471  });
7472  a.Overlay = function (b, c, d) {
7473    var e;
7474    e = a.isPlainObject(b) ? b : { element: b, location: c, placement: d };
7475    this.element = e.element;
7476    this.style = e.element.style;
7477    this._init(e);
7478  };
7479  a.Overlay.prototype = {
7480    _init: function (b) {
7481      this.location = b.location;
7482      this.placement =
7483        void 0 === b.placement ? a.Placement.TOP_LEFT : b.placement;
7484      this.onDraw = b.onDraw;
7485      this.checkResize = void 0 === b.checkResize ? !0 : b.checkResize;
7486      this.width = void 0 === b.width ? null : b.width;
7487      this.height = void 0 === b.height ? null : b.height;
7488      this.rotationMode = b.rotationMode || a.OverlayRotationMode.EXACT;
7489      if (this.location instanceof a.Rect) {
7490        this.width = this.location.width;
7491        this.height = this.location.height;
7492        this.location = this.location.getTopLeft();
7493        this.placement = a.Placement.TOP_LEFT;
7494      }
7495      this.scales = null !== this.width && null !== this.height;
7496      this.bounds = new a.Rect(
7497        this.location.x,
7498        this.location.y,
7499        this.width,
7500        this.height,
7501      );
7502      this.position = this.location;
7503    },
7504    adjust: function (b, c) {
7505      var d = a.Placement.properties[this.placement];
7506      if (d) {
7507        d.isHorizontallyCentered ? (b.x -= c.x / 2) : d.isRight && (b.x -= c.x);
7508        d.isVerticallyCentered ? (b.y -= c.y / 2) : d.isBottom && (b.y -= c.y);
7509      }
7510    },
7511    destroy: function () {
7512      var b = this.element;
7513      var c = this.style;
7514      if (b.parentNode) {
7515        b.parentNode.removeChild(b);
7516        if (b.prevElementParent) {
7517          c.display = "none";
7518          document.body.appendChild(b);
7519        }
7520      }
7521      this.onDraw = null;
7522      c.top = "";
7523      c.left = "";
7524      c.position = "";
7525      null !== this.width && (c.width = "");
7526      null !== this.height && (c.height = "");
7527      var d = a.getCssPropertyWithVendorPrefix("transformOrigin");
7528      var e = a.getCssPropertyWithVendorPrefix("transform");
7529      if (d && e) {
7530        c[d] = "";
7531        c[e] = "";
7532      }
7533    },
7534    drawHTML: function (b, c) {
7535      var d = this.element;
7536      if (d.parentNode !== b) {
7537        d.prevElementParent = d.parentNode;
7538        d.prevNextSibling = d.nextSibling;
7539        b.appendChild(d);
7540        this.size = a.getElementSize(d);
7541      }
7542      var e = this._getOverlayPositionAndSize(c);
7543      var f = e.position;
7544      var g = (this.size = e.size);
7545      var h = e.rotate;
7546      if (this.onDraw) this.onDraw(f, g, this.element);
7547      else {
7548        var i = this.style;
7549        i.left = f.x + "px";
7550        i.top = f.y + "px";
7551        null !== this.width && (i.width = g.x + "px");
7552        null !== this.height && (i.height = g.y + "px");
7553        var j = a.getCssPropertyWithVendorPrefix("transformOrigin");
7554        var k = a.getCssPropertyWithVendorPrefix("transform");
7555        if (j && k)
7556          if (h) {
7557            i[j] = this._getTransformOrigin();
7558            i[k] = "rotate(" + h + "deg)";
7559          } else {
7560            i[j] = "";
7561            i[k] = "";
7562          }
7563        i.position = "absolute";
7564        "none" !== i.display && (i.display = "block");
7565      }
7566    },
7567    _getOverlayPositionAndSize: function (b) {
7568      var c = b.pixelFromPoint(this.location, !0);
7569      var d = this._getSizeInPixels(b);
7570      this.adjust(c, d);
7571      var e = 0;
7572      if (b.degrees && this.rotationMode !== a.OverlayRotationMode.NO_ROTATION)
7573        if (
7574          this.rotationMode === a.OverlayRotationMode.BOUNDING_BOX &&
7575          null !== this.width &&
7576          null !== this.height
7577        ) {
7578          var f = new a.Rect(c.x, c.y, d.x, d.y);
7579          var g = this._getBoundingBox(f, b.degrees);
7580          c = g.getTopLeft();
7581          d = g.getSize();
7582        } else e = b.degrees;
7583      return { position: c, size: d, rotate: e };
7584    },
7585    _getSizeInPixels: function (b) {
7586      var c = this.size.x;
7587      var d = this.size.y;
7588      if (null !== this.width || null !== this.height) {
7589        var e = b.deltaPixelsFromPointsNoRotate(
7590          new a.Point(this.width || 0, this.height || 0),
7591          !0,
7592        );
7593        null !== this.width && (c = e.x);
7594        null !== this.height && (d = e.y);
7595      }
7596      if (this.checkResize && (null === this.width || null === this.height)) {
7597        var f = (this.size = a.getElementSize(this.element));
7598        null === this.width && (c = f.x);
7599        null === this.height && (d = f.y);
7600      }
7601      return new a.Point(c, d);
7602    },
7603    _getBoundingBox: function (a, b) {
7604      var c = this._getPlacementPoint(a);
7605      return a.rotate(b, c).getBoundingBox();
7606    },
7607    _getPlacementPoint: function (b) {
7608      var c = new a.Point(b.x, b.y);
7609      var d = a.Placement.properties[this.placement];
7610      if (d) {
7611        d.isHorizontallyCentered
7612          ? (c.x += b.width / 2)
7613          : d.isRight && (c.x += b.width);
7614        d.isVerticallyCentered
7615          ? (c.y += b.height / 2)
7616          : d.isBottom && (c.y += b.height);
7617      }
7618      return c;
7619    },
7620    _getTransformOrigin: function () {
7621      var b = "";
7622      var c = a.Placement.properties[this.placement];
7623      if (!c) return b;
7624      c.isLeft ? (b = "left") : c.isRight && (b = "right");
7625      c.isTop ? (b += " top") : c.isBottom && (b += " bottom");
7626      return b;
7627    },
7628    update: function (b, c) {
7629      var d = a.isPlainObject(b) ? b : { location: b, placement: c };
7630      this._init({
7631        location: d.location || this.location,
7632        placement: void 0 !== d.placement ? d.placement : this.placement,
7633        onDraw: d.onDraw || this.onDraw,
7634        checkResize: d.checkResize || this.checkResize,
7635        width: void 0 !== d.width ? d.width : this.width,
7636        height: void 0 !== d.height ? d.height : this.height,
7637        rotationMode: d.rotationMode || this.rotationMode,
7638      });
7639    },
7640    getBounds: function (b) {
7641      a.console.assert(
7642        b,
7643        "A viewport must now be passed to Overlay.getBounds.",
7644      );
7645      var c = this.width;
7646      var d = this.height;
7647      if (null === c || null === d) {
7648        var e = b.deltaPointsFromPixelsNoRotate(this.size, !0);
7649        null === c && (c = e.x);
7650        null === d && (d = e.y);
7651      }
7652      var f = this.location.clone();
7653      this.adjust(f, new a.Point(c, d));
7654      return this._adjustBoundsForRotation(b, new a.Rect(f.x, f.y, c, d));
7655    },
7656    _adjustBoundsForRotation: function (b, c) {
7657      if (
7658        !b ||
7659        0 === b.degrees ||
7660        this.rotationMode === a.OverlayRotationMode.EXACT
7661      )
7662        return c;
7663      if (this.rotationMode === a.OverlayRotationMode.BOUNDING_BOX) {
7664        if (null === this.width || null === this.height) return c;
7665        var d = this._getOverlayPositionAndSize(b);
7666        return b.viewerElementToViewportRectangle(
7667          new a.Rect(d.position.x, d.position.y, d.size.x, d.size.y),
7668        );
7669      }
7670      return c.rotate(-b.degrees, this._getPlacementPoint(c));
7671    },
7672  };
7673})(OpenSeadragon);
7674!(function (a) {
7675  a.Drawer = function (b) {
7676    a.console.assert(b.viewer, "[Drawer] options.viewer is required");
7677    var c = arguments;
7678    a.isPlainObject(b) || (b = { source: c[0], viewport: c[1], element: c[2] });
7679    a.console.assert(b.viewport, "[Drawer] options.viewport is required");
7680    a.console.assert(b.element, "[Drawer] options.element is required");
7681    b.source &&
7682      a.console.error(
7683        "[Drawer] options.source is no longer accepted; use TiledImage instead",
7684      );
7685    this.viewer = b.viewer;
7686    this.viewport = b.viewport;
7687    this.debugGridColor = b.debugGridColor || a.DEFAULT_SETTINGS.debugGridColor;
7688    b.opacity &&
7689      a.console.error(
7690        "[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead",
7691      );
7692    this.useCanvas =
7693      a.supportsCanvas && (this.viewer ? this.viewer.useCanvas : !0);
7694    this.container = a.getElement(b.element);
7695    this.canvas = a.makeNeutralElement(this.useCanvas ? "canvas" : "div");
7696    this.context = this.useCanvas ? this.canvas.getContext("2d") : null;
7697    this.sketchCanvas = null;
7698    this.sketchContext = null;
7699    this.element = this.container;
7700    this.container.dir = "ltr";
7701    if (this.useCanvas) {
7702      var d = this._calculateCanvasSize();
7703      this.canvas.width = d.x;
7704      this.canvas.height = d.y;
7705    }
7706    this.canvas.style.width = "100%";
7707    this.canvas.style.height = "100%";
7708    this.canvas.style.position = "absolute";
7709    a.setElementOpacity(this.canvas, this.opacity, !0);
7710    this.container.style.textAlign = "left";
7711    this.container.appendChild(this.canvas);
7712  };
7713  a.Drawer.prototype = {
7714    addOverlay: function (b, c, d, e) {
7715      a.console.error(
7716        "drawer.addOverlay is deprecated. Use viewer.addOverlay instead.",
7717      );
7718      this.viewer.addOverlay(b, c, d, e);
7719      return this;
7720    },
7721    updateOverlay: function (b, c, d) {
7722      a.console.error(
7723        "drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead.",
7724      );
7725      this.viewer.updateOverlay(b, c, d);
7726      return this;
7727    },
7728    removeOverlay: function (b) {
7729      a.console.error(
7730        "drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead.",
7731      );
7732      this.viewer.removeOverlay(b);
7733      return this;
7734    },
7735    clearOverlays: function () {
7736      a.console.error(
7737        "drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead.",
7738      );
7739      this.viewer.clearOverlays();
7740      return this;
7741    },
7742    setOpacity: function (b) {
7743      a.console.error(
7744        "drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.",
7745      );
7746      var c = this.viewer.world;
7747      for (var d = 0; d < c.getItemCount(); d++) c.getItemAt(d).setOpacity(b);
7748      return this;
7749    },
7750    getOpacity: function () {
7751      a.console.error(
7752        "drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.",
7753      );
7754      var b = this.viewer.world;
7755      var c = 0;
7756      for (var d = 0; d < b.getItemCount(); d++) {
7757        var e = b.getItemAt(d).getOpacity();
7758        e > c && (c = e);
7759      }
7760      return c;
7761    },
7762    needsUpdate: function () {
7763      a.console.error(
7764        "[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead.",
7765      );
7766      return this.viewer.world.needsDraw();
7767    },
7768    numTilesLoaded: function () {
7769      a.console.error(
7770        "[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead.",
7771      );
7772      return this.viewer.tileCache.numTilesLoaded();
7773    },
7774    reset: function () {
7775      a.console.error(
7776        "[Drawer.reset] this function is deprecated. Use World.resetItems instead.",
7777      );
7778      this.viewer.world.resetItems();
7779      return this;
7780    },
7781    update: function () {
7782      a.console.error(
7783        "[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead.",
7784      );
7785      this.clear();
7786      this.viewer.world.draw();
7787      return this;
7788    },
7789    canRotate: function () {
7790      return this.useCanvas;
7791    },
7792    destroy: function () {
7793      this.canvas.width = 1;
7794      this.canvas.height = 1;
7795      this.sketchCanvas = null;
7796      this.sketchContext = null;
7797    },
7798    clear: function () {
7799      this.canvas.innerHTML = "";
7800      if (this.useCanvas) {
7801        var a = this._calculateCanvasSize();
7802        if (this.canvas.width != a.x || this.canvas.height != a.y) {
7803          this.canvas.width = a.x;
7804          this.canvas.height = a.y;
7805          if (null !== this.sketchCanvas) {
7806            var b = this._calculateSketchCanvasSize();
7807            this.sketchCanvas.width = b.x;
7808            this.sketchCanvas.height = b.y;
7809          }
7810        }
7811        this._clear();
7812      }
7813    },
7814    _clear: function (a, b) {
7815      if (this.useCanvas) {
7816        var c = this._getContext(a);
7817        if (b) c.clearRect(b.x, b.y, b.width, b.height);
7818        else {
7819          var d = c.canvas;
7820          c.clearRect(0, 0, d.width, d.height);
7821        }
7822      }
7823    },
7824    viewportToDrawerRectangle: function (b) {
7825      var c = this.viewport.pixelFromPointNoRotate(b.getTopLeft(), !0);
7826      var d = this.viewport.deltaPixelsFromPointsNoRotate(b.getSize(), !0);
7827      return new a.Rect(
7828        c.x * a.pixelDensityRatio,
7829        c.y * a.pixelDensityRatio,
7830        d.x * a.pixelDensityRatio,
7831        d.y * a.pixelDensityRatio,
7832      );
7833    },
7834    drawTile: function (b, c, d, e, f) {
7835      a.console.assert(b, "[Drawer.drawTile] tile is required");
7836      a.console.assert(c, "[Drawer.drawTile] drawingHandler is required");
7837      if (this.useCanvas) {
7838        var g = this._getContext(d);
7839        e = e || 1;
7840        b.drawCanvas(g, c, e, f);
7841      } else b.drawHTML(this.canvas);
7842    },
7843    _getContext: function (a) {
7844      var b = this.context;
7845      if (a) {
7846        if (null === this.sketchCanvas) {
7847          this.sketchCanvas = document.createElement("canvas");
7848          var c = this._calculateSketchCanvasSize();
7849          this.sketchCanvas.width = c.x;
7850          this.sketchCanvas.height = c.y;
7851          this.sketchContext = this.sketchCanvas.getContext("2d");
7852          if (0 === this.viewport.getRotation()) {
7853            var d = this;
7854            this.viewer.addHandler("rotate", function e() {
7855              d.viewer.removeHandler("rotate", e);
7856              var a = d._calculateSketchCanvasSize();
7857              d.sketchCanvas.width = a.x;
7858              d.sketchCanvas.height = a.y;
7859            });
7860          }
7861        }
7862        b = this.sketchContext;
7863      }
7864      return b;
7865    },
7866    saveContext: function (a) {
7867      this.useCanvas && this._getContext(a).save();
7868    },
7869    restoreContext: function (a) {
7870      this.useCanvas && this._getContext(a).restore();
7871    },
7872    setClip: function (a, b) {
7873      if (this.useCanvas) {
7874        var c = this._getContext(b);
7875        c.beginPath();
7876        c.rect(a.x, a.y, a.width, a.height);
7877        c.clip();
7878      }
7879    },
7880    drawRectangle: function (a, b, c) {
7881      if (this.useCanvas) {
7882        var d = this._getContext(c);
7883        d.save();
7884        d.fillStyle = b;
7885        d.fillRect(a.x, a.y, a.width, a.height);
7886        d.restore();
7887      }
7888    },
7889    blendSketch: function (b, c, d, e) {
7890      var f = b;
7891      a.isPlainObject(f) ||
7892        (f = { opacity: b, scale: c, translate: d, compositeOperation: e });
7893      if (this.useCanvas && this.sketchCanvas) {
7894        b = f.opacity;
7895        e = f.compositeOperation;
7896        var g = f.bounds;
7897        this.context.save();
7898        this.context.globalAlpha = b;
7899        e && (this.context.globalCompositeOperation = e);
7900        if (g)
7901          this.context.drawImage(
7902            this.sketchCanvas,
7903            g.x,
7904            g.y,
7905            g.width,
7906            g.height,
7907            g.x,
7908            g.y,
7909            g.width,
7910            g.height,
7911          );
7912        else {
7913          c = f.scale || 1;
7914          d = f.translate;
7915          var h = d instanceof a.Point ? d : new a.Point(0, 0);
7916          var i = 0;
7917          var j = 0;
7918          if (d) {
7919            var k = this.sketchCanvas.width - this.canvas.width;
7920            var l = this.sketchCanvas.height - this.canvas.height;
7921            i = Math.round(k / 2);
7922            j = Math.round(l / 2);
7923          }
7924          this.context.drawImage(
7925            this.sketchCanvas,
7926            h.x - i * c,
7927            h.y - j * c,
7928            (this.canvas.width + 2 * i) * c,
7929            (this.canvas.height + 2 * j) * c,
7930            -i,
7931            -j,
7932            this.canvas.width + 2 * i,
7933            this.canvas.height + 2 * j,
7934          );
7935        }
7936        this.context.restore();
7937      }
7938    },
7939    drawDebugInfo: function (b, c, d) {
7940      if (this.useCanvas) {
7941        var e = this.context;
7942        e.save();
7943        e.lineWidth = 2 * a.pixelDensityRatio;
7944        e.font = "small-caps bold " + 13 * a.pixelDensityRatio + "px arial";
7945        e.strokeStyle = this.debugGridColor;
7946        e.fillStyle = this.debugGridColor;
7947        0 !== this.viewport.degrees &&
7948          this._offsetForRotation(this.viewport.degrees);
7949        e.strokeRect(
7950          b.position.x * a.pixelDensityRatio,
7951          b.position.y * a.pixelDensityRatio,
7952          b.size.x * a.pixelDensityRatio,
7953          b.size.y * a.pixelDensityRatio,
7954        );
7955        var f = (b.position.x + b.size.x / 2) * a.pixelDensityRatio;
7956        var g = (b.position.y + b.size.y / 2) * a.pixelDensityRatio;
7957        e.translate(f, g);
7958        e.rotate((Math.PI / 180) * -this.viewport.degrees);
7959        e.translate(-f, -g);
7960        if (0 === b.x && 0 === b.y) {
7961          e.fillText(
7962            "Zoom: " + this.viewport.getZoom(),
7963            b.position.x * a.pixelDensityRatio,
7964            (b.position.y - 30) * a.pixelDensityRatio,
7965          );
7966          e.fillText(
7967            "Pan: " + this.viewport.getBounds().toString(),
7968            b.position.x * a.pixelDensityRatio,
7969            (b.position.y - 20) * a.pixelDensityRatio,
7970          );
7971        }
7972        e.fillText(
7973          "Level: " + b.level,
7974          (b.position.x + 10) * a.pixelDensityRatio,
7975          (b.position.y + 20) * a.pixelDensityRatio,
7976        );
7977        e.fillText(
7978          "Column: " + b.x,
7979          (b.position.x + 10) * a.pixelDensityRatio,
7980          (b.position.y + 30) * a.pixelDensityRatio,
7981        );
7982        e.fillText(
7983          "Row: " + b.y,
7984          (b.position.x + 10) * a.pixelDensityRatio,
7985          (b.position.y + 40) * a.pixelDensityRatio,
7986        );
7987        e.fillText(
7988          "Order: " + d + " of " + c,
7989          (b.position.x + 10) * a.pixelDensityRatio,
7990          (b.position.y + 50) * a.pixelDensityRatio,
7991        );
7992        e.fillText(
7993          "Size: " + b.size.toString(),
7994          (b.position.x + 10) * a.pixelDensityRatio,
7995          (b.position.y + 60) * a.pixelDensityRatio,
7996        );
7997        e.fillText(
7998          "Position: " + b.position.toString(),
7999          (b.position.x + 10) * a.pixelDensityRatio,
8000          (b.position.y + 70) * a.pixelDensityRatio,
8001        );
8002        0 !== this.viewport.degrees && this._restoreRotationChanges();
8003        e.restore();
8004      }
8005    },
8006    debugRect: function (b) {
8007      if (this.useCanvas) {
8008        var c = this.context;
8009        c.save();
8010        c.lineWidth = 2 * a.pixelDensityRatio;
8011        c.strokeStyle = this.debugGridColor;
8012        c.fillStyle = this.debugGridColor;
8013        c.strokeRect(
8014          b.x * a.pixelDensityRatio,
8015          b.y * a.pixelDensityRatio,
8016          b.width * a.pixelDensityRatio,
8017          b.height * a.pixelDensityRatio,
8018        );
8019        c.restore();
8020      }
8021    },
8022    getCanvasSize: function (b) {
8023      var c = this._getContext(b).canvas;
8024      return new a.Point(c.width, c.height);
8025    },
8026    _offsetForRotation: function (a, b) {
8027      var c = this.canvas.width / 2;
8028      var d = this.canvas.height / 2;
8029      var e = this._getContext(b);
8030      e.save();
8031      e.translate(c, d);
8032      e.rotate((Math.PI / 180) * a);
8033      e.translate(-c, -d);
8034    },
8035    _restoreRotationChanges: function (a) {
8036      var b = this._getContext(a);
8037      b.restore();
8038    },
8039    _calculateCanvasSize: function () {
8040      var b = a.pixelDensityRatio;
8041      var c = this.viewport.getContainerSize();
8042      return { x: c.x * b, y: c.y * b };
8043    },
8044    _calculateSketchCanvasSize: function () {
8045      var a = this._calculateCanvasSize();
8046      if (0 === this.viewport.getRotation()) return a;
8047      var b = Math.ceil(Math.sqrt(a.x * a.x + a.y * a.y));
8048      return { x: b, y: b };
8049    },
8050  };
8051})(OpenSeadragon);
8052!(function (a) {
8053  a.Viewport = function (b) {
8054    var c = arguments;
8055    c.length &&
8056      c[0] instanceof a.Point &&
8057      (b = { containerSize: c[0], contentSize: c[1], config: c[2] });
8058    if (b.config) {
8059      a.extend(!0, b, b.config);
8060      delete b.config;
8061    }
8062    this._margins = a.extend(
8063      { left: 0, top: 0, right: 0, bottom: 0 },
8064      b.margins || {},
8065    );
8066    delete b.margins;
8067    a.extend(
8068      !0,
8069      this,
8070      {
8071        containerSize: null,
8072        contentSize: null,
8073        zoomPoint: null,
8074        viewer: null,
8075        springStiffness: a.DEFAULT_SETTINGS.springStiffness,
8076        animationTime: a.DEFAULT_SETTINGS.animationTime,
8077        minZoomImageRatio: a.DEFAULT_SETTINGS.minZoomImageRatio,
8078        maxZoomPixelRatio: a.DEFAULT_SETTINGS.maxZoomPixelRatio,
8079        visibilityRatio: a.DEFAULT_SETTINGS.visibilityRatio,
8080        wrapHorizontal: a.DEFAULT_SETTINGS.wrapHorizontal,
8081        wrapVertical: a.DEFAULT_SETTINGS.wrapVertical,
8082        defaultZoomLevel: a.DEFAULT_SETTINGS.defaultZoomLevel,
8083        minZoomLevel: a.DEFAULT_SETTINGS.minZoomLevel,
8084        maxZoomLevel: a.DEFAULT_SETTINGS.maxZoomLevel,
8085        degrees: a.DEFAULT_SETTINGS.degrees,
8086        homeFillsViewer: a.DEFAULT_SETTINGS.homeFillsViewer,
8087      },
8088      b,
8089    );
8090    this._updateContainerInnerSize();
8091    this.centerSpringX = new a.Spring({
8092      initial: 0,
8093      springStiffness: this.springStiffness,
8094      animationTime: this.animationTime,
8095    });
8096    this.centerSpringY = new a.Spring({
8097      initial: 0,
8098      springStiffness: this.springStiffness,
8099      animationTime: this.animationTime,
8100    });
8101    this.zoomSpring = new a.Spring({
8102      exponential: !0,
8103      initial: 1,
8104      springStiffness: this.springStiffness,
8105      animationTime: this.animationTime,
8106    });
8107    this._oldCenterX = this.centerSpringX.current.value;
8108    this._oldCenterY = this.centerSpringY.current.value;
8109    this._oldZoom = this.zoomSpring.current.value;
8110    this._setContentBounds(new a.Rect(0, 0, 1, 1), 1);
8111    this.goHome(!0);
8112    this.update();
8113  };
8114  a.Viewport.prototype = {
8115    resetContentSize: function (b) {
8116      a.console.assert(
8117        b,
8118        "[Viewport.resetContentSize] contentSize is required",
8119      );
8120      a.console.assert(
8121        b instanceof a.Point,
8122        "[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point",
8123      );
8124      a.console.assert(
8125        b.x > 0,
8126        "[Viewport.resetContentSize] contentSize.x must be greater than 0",
8127      );
8128      a.console.assert(
8129        b.y > 0,
8130        "[Viewport.resetContentSize] contentSize.y must be greater than 0",
8131      );
8132      this._setContentBounds(new a.Rect(0, 0, 1, b.y / b.x), b.x);
8133      return this;
8134    },
8135    setHomeBounds: function (b, c) {
8136      a.console.error(
8137        "[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually.",
8138      );
8139      this._setContentBounds(b, c);
8140    },
8141    _setContentBounds: function (b, c) {
8142      a.console.assert(b, "[Viewport._setContentBounds] bounds is required");
8143      a.console.assert(
8144        b instanceof a.Rect,
8145        "[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect",
8146      );
8147      a.console.assert(
8148        b.width > 0,
8149        "[Viewport._setContentBounds] bounds.width must be greater than 0",
8150      );
8151      a.console.assert(
8152        b.height > 0,
8153        "[Viewport._setContentBounds] bounds.height must be greater than 0",
8154      );
8155      this._contentBoundsNoRotate = b.clone();
8156      this._contentSizeNoRotate = this._contentBoundsNoRotate
8157        .getSize()
8158        .times(c);
8159      this._contentBounds = b.rotate(this.degrees).getBoundingBox();
8160      this._contentSize = this._contentBounds.getSize().times(c);
8161      this._contentAspectRatio = this._contentSize.x / this._contentSize.y;
8162      this.viewer &&
8163        this.viewer.raiseEvent("reset-size", {
8164          contentSize: this._contentSizeNoRotate.clone(),
8165          contentFactor: c,
8166          homeBounds: this._contentBoundsNoRotate.clone(),
8167          contentBounds: this._contentBounds.clone(),
8168        });
8169    },
8170    getHomeZoom: function () {
8171      if (this.defaultZoomLevel) return this.defaultZoomLevel;
8172      var a = this._contentAspectRatio / this.getAspectRatio();
8173      var b;
8174      b = this.homeFillsViewer ? (a >= 1 ? a : 1) : a >= 1 ? 1 : a;
8175      return b / this._contentBounds.width;
8176    },
8177    getHomeBounds: function () {
8178      return this.getHomeBoundsNoRotate().rotate(-this.getRotation());
8179    },
8180    getHomeBoundsNoRotate: function () {
8181      var b = this._contentBounds.getCenter();
8182      var c = 1 / this.getHomeZoom();
8183      var d = c / this.getAspectRatio();
8184      return new a.Rect(b.x - c / 2, b.y - d / 2, c, d);
8185    },
8186    goHome: function (a) {
8187      this.viewer && this.viewer.raiseEvent("home", { immediately: a });
8188      return this.fitBounds(this.getHomeBounds(), a);
8189    },
8190    getMinZoom: function () {
8191      var a = this.getHomeZoom(),
8192        b = this.minZoomLevel ? this.minZoomLevel : this.minZoomImageRatio * a;
8193      return b;
8194    },
8195    getMaxZoom: function () {
8196      var a = this.maxZoomLevel;
8197      if (!a) {
8198        a =
8199          (this._contentSize.x * this.maxZoomPixelRatio) /
8200          this._containerInnerSize.x;
8201        a /= this._contentBounds.width;
8202      }
8203      return Math.max(a, this.getHomeZoom());
8204    },
8205    getAspectRatio: function () {
8206      return this._containerInnerSize.x / this._containerInnerSize.y;
8207    },
8208    getContainerSize: function () {
8209      return new a.Point(this.containerSize.x, this.containerSize.y);
8210    },
8211    getMargins: function () {
8212      return a.extend({}, this._margins);
8213    },
8214    setMargins: function (b) {
8215      a.console.assert(
8216        "object" === a.type(b),
8217        "[Viewport.setMargins] margins must be an object",
8218      );
8219      this._margins = a.extend({ left: 0, top: 0, right: 0, bottom: 0 }, b);
8220      this._updateContainerInnerSize();
8221      this.viewer && this.viewer.forceRedraw();
8222    },
8223    getBounds: function (a) {
8224      return this.getBoundsNoRotate(a).rotate(-this.getRotation());
8225    },
8226    getBoundsNoRotate: function (b) {
8227      var c = this.getCenter(b);
8228      var d = 1 / this.getZoom(b);
8229      var e = d / this.getAspectRatio();
8230      return new a.Rect(c.x - d / 2, c.y - e / 2, d, e);
8231    },
8232    getBoundsWithMargins: function (a) {
8233      return this.getBoundsNoRotateWithMargins(a).rotate(
8234        -this.getRotation(),
8235        this.getCenter(a),
8236      );
8237    },
8238    getBoundsNoRotateWithMargins: function (a) {
8239      var b = this.getBoundsNoRotate(a);
8240      var c = this._containerInnerSize.x * this.getZoom(a);
8241      b.x -= this._margins.left / c;
8242      b.y -= this._margins.top / c;
8243      b.width += (this._margins.left + this._margins.right) / c;
8244      b.height += (this._margins.top + this._margins.bottom) / c;
8245      return b;
8246    },
8247    getCenter: function (b) {
8248      var c,
8249        d,
8250        e,
8251        f,
8252        g,
8253        h,
8254        i,
8255        j,
8256        k = new a.Point(
8257          this.centerSpringX.current.value,
8258          this.centerSpringY.current.value,
8259        ),
8260        l = new a.Point(
8261          this.centerSpringX.target.value,
8262          this.centerSpringY.target.value,
8263        );
8264      if (b) return k;
8265      if (!this.zoomPoint) return l;
8266      c = this.pixelFromPoint(this.zoomPoint, !0);
8267      d = this.getZoom();
8268      e = 1 / d;
8269      f = e / this.getAspectRatio();
8270      g = new a.Rect(k.x - e / 2, k.y - f / 2, e, f);
8271      h = this._pixelFromPoint(this.zoomPoint, g);
8272      i = h.minus(c);
8273      j = i.divide(this._containerInnerSize.x * d);
8274      return l.plus(j);
8275    },
8276    getZoom: function (a) {
8277      return a ? this.zoomSpring.current.value : this.zoomSpring.target.value;
8278    },
8279    _applyZoomConstraints: function (a) {
8280      return Math.max(Math.min(a, this.getMaxZoom()), this.getMinZoom());
8281    },
8282    _applyBoundaryConstraints: function (b, c) {
8283      var d = new a.Rect(b.x, b.y, b.width, b.height);
8284      if (this.wrapHorizontal);
8285      else {
8286        var e = this.visibilityRatio * d.width;
8287        var f = d.x + d.width;
8288        var g =
8289          this._contentBoundsNoRotate.x + this._contentBoundsNoRotate.width;
8290        var h = this._contentBoundsNoRotate.x - f + e;
8291        var i = g - d.x - e;
8292        e > this._contentBoundsNoRotate.width
8293          ? (d.x += (h + i) / 2)
8294          : 0 > i
8295            ? (d.x += i)
8296            : h > 0 && (d.x += h);
8297      }
8298      if (this.wrapVertical);
8299      else {
8300        var j = this.visibilityRatio * d.height;
8301        var k = d.y + d.height;
8302        var l =
8303          this._contentBoundsNoRotate.y + this._contentBoundsNoRotate.height;
8304        var m = this._contentBoundsNoRotate.y - k + j;
8305        var n = l - d.y - j;
8306        j > this._contentBoundsNoRotate.height
8307          ? (d.y += (m + n) / 2)
8308          : 0 > n
8309            ? (d.y += n)
8310            : m > 0 && (d.y += m);
8311      }
8312      this.viewer && this.viewer.raiseEvent("constrain", { immediately: c });
8313      return d;
8314    },
8315    applyConstraints: function (a) {
8316      var b = this.getZoom();
8317      var c = this._applyZoomConstraints(b);
8318      b !== c && this.zoomTo(c, this.zoomPoint, a);
8319      var d = this.getBoundsNoRotate();
8320      var e = this._applyBoundaryConstraints(d, a);
8321      (d.x !== e.x || d.y !== e.y || a) &&
8322        this.fitBounds(e.rotate(-this.getRotation()), a);
8323      return this;
8324    },
8325    ensureVisible: function (a) {
8326      return this.applyConstraints(a);
8327    },
8328    _fitBounds: function (b, c) {
8329      c = c || {};
8330      var d = c.immediately || !1;
8331      var e = c.constraints || !1;
8332      var f = this.getAspectRatio();
8333      var g = b.getCenter();
8334      var h = new a.Rect(
8335        b.x,
8336        b.y,
8337        b.width,
8338        b.height,
8339        b.degrees + this.getRotation(),
8340      ).getBoundingBox();
8341      h.getAspectRatio() >= f
8342        ? (h.height = h.width / f)
8343        : (h.width = h.height * f);
8344      h.x = g.x - h.width / 2;
8345      h.y = g.y - h.height / 2;
8346      var i = 1 / h.width;
8347      if (e) {
8348        var j = h.getAspectRatio();
8349        var k = this._applyZoomConstraints(i);
8350        if (i !== k) {
8351          i = k;
8352          h.width = 1 / i;
8353          h.x = g.x - h.width / 2;
8354          h.height = h.width / j;
8355          h.y = g.y - h.height / 2;
8356        }
8357        h = this._applyBoundaryConstraints(h, d);
8358        g = h.getCenter();
8359      }
8360      if (d) {
8361        this.panTo(g, !0);
8362        return this.zoomTo(i, null, !0);
8363      }
8364      this.panTo(this.getCenter(!0), !0);
8365      this.zoomTo(this.getZoom(!0), null, !0);
8366      var l = this.getBounds();
8367      var m = this.getZoom();
8368      if (0 === m || Math.abs(i / m - 1) < 1e-8) {
8369        this.zoomTo(i, !0);
8370        return this.panTo(g, d);
8371      }
8372      h = h.rotate(-this.getRotation());
8373      var n = h
8374        .getTopLeft()
8375        .times(i)
8376        .minus(l.getTopLeft().times(m))
8377        .divide(i - m);
8378      return this.zoomTo(i, n, d);
8379    },
8380    fitBounds: function (a, b) {
8381      return this._fitBounds(a, { immediately: b, constraints: !1 });
8382    },
8383    fitBoundsWithConstraints: function (a, b) {
8384      return this._fitBounds(a, { immediately: b, constraints: !0 });
8385    },
8386    fitVertically: function (b) {
8387      var c = new a.Rect(
8388        this._contentBounds.x + this._contentBounds.width / 2,
8389        this._contentBounds.y,
8390        0,
8391        this._contentBounds.height,
8392      );
8393      return this.fitBounds(c, b);
8394    },
8395    fitHorizontally: function (b) {
8396      var c = new a.Rect(
8397        this._contentBounds.x,
8398        this._contentBounds.y + this._contentBounds.height / 2,
8399        this._contentBounds.width,
8400        0,
8401      );
8402      return this.fitBounds(c, b);
8403    },
8404    panBy: function (b, c) {
8405      var d = new a.Point(
8406        this.centerSpringX.target.value,
8407        this.centerSpringY.target.value,
8408      );
8409      return this.panTo(d.plus(b), c);
8410    },
8411    panTo: function (a, b) {
8412      if (b) {
8413        this.centerSpringX.resetTo(a.x);
8414        this.centerSpringY.resetTo(a.y);
8415      } else {
8416        this.centerSpringX.springTo(a.x);
8417        this.centerSpringY.springTo(a.y);
8418      }
8419      this.viewer &&
8420        this.viewer.raiseEvent("pan", { center: a, immediately: b });
8421      return this;
8422    },
8423    zoomBy: function (a, b, c) {
8424      return this.zoomTo(this.zoomSpring.target.value * a, b, c);
8425    },
8426    zoomTo: function (b, c, d) {
8427      this.zoomPoint =
8428        c instanceof a.Point && !isNaN(c.x) && !isNaN(c.y) ? c : null;
8429      d ? this.zoomSpring.resetTo(b) : this.zoomSpring.springTo(b);
8430      this.viewer &&
8431        this.viewer.raiseEvent("zoom", {
8432          zoom: b,
8433          refPoint: c,
8434          immediately: d,
8435        });
8436      return this;
8437    },
8438    setRotation: function (a) {
8439      if (!this.viewer || !this.viewer.drawer.canRotate()) return this;
8440      a %= 360;
8441      0 > a && (a += 360);
8442      this.degrees = a;
8443      this._setContentBounds(
8444        this.viewer.world.getHomeBounds(),
8445        this.viewer.world.getContentFactor(),
8446      );
8447      this.viewer.forceRedraw();
8448      this.viewer.raiseEvent("rotate", { degrees: a });
8449      return this;
8450    },
8451    getRotation: function () {
8452      return this.degrees;
8453    },
8454    resize: function (a, b) {
8455      var c,
8456        d = this.getBoundsNoRotate(),
8457        e = d;
8458      this.containerSize.x = a.x;
8459      this.containerSize.y = a.y;
8460      this._updateContainerInnerSize();
8461      if (b) {
8462        c = a.x / this.containerSize.x;
8463        e.width = d.width * c;
8464        e.height = e.width / this.getAspectRatio();
8465      }
8466      this.viewer &&
8467        this.viewer.raiseEvent("resize", { newContainerSize: a, maintain: b });
8468      return this.fitBounds(e, !0);
8469    },
8470    _updateContainerInnerSize: function () {
8471      this._containerInnerSize = new a.Point(
8472        Math.max(
8473          1,
8474          this.containerSize.x - (this._margins.left + this._margins.right),
8475        ),
8476        Math.max(
8477          1,
8478          this.containerSize.y - (this._margins.top + this._margins.bottom),
8479        ),
8480      );
8481    },
8482    update: function () {
8483      if (this.zoomPoint) {
8484        var a = this.pixelFromPoint(this.zoomPoint, !0);
8485        this.zoomSpring.update();
8486        var b = this.pixelFromPoint(this.zoomPoint, !0);
8487        var c = b.minus(a);
8488        var d = this.deltaPointsFromPixels(c, !0);
8489        this.centerSpringX.shiftBy(d.x);
8490        this.centerSpringY.shiftBy(d.y);
8491        this.zoomSpring.isAtTargetValue() && (this.zoomPoint = null);
8492      } else this.zoomSpring.update();
8493      this.centerSpringX.update();
8494      this.centerSpringY.update();
8495      var e =
8496        this.centerSpringX.current.value !== this._oldCenterX ||
8497        this.centerSpringY.current.value !== this._oldCenterY ||
8498        this.zoomSpring.current.value !== this._oldZoom;
8499      this._oldCenterX = this.centerSpringX.current.value;
8500      this._oldCenterY = this.centerSpringY.current.value;
8501      this._oldZoom = this.zoomSpring.current.value;
8502      return e;
8503    },
8504    deltaPixelsFromPointsNoRotate: function (a, b) {
8505      return a.times(this._containerInnerSize.x * this.getZoom(b));
8506    },
8507    deltaPixelsFromPoints: function (a, b) {
8508      return this.deltaPixelsFromPointsNoRotate(
8509        a.rotate(this.getRotation()),
8510        b,
8511      );
8512    },
8513    deltaPointsFromPixelsNoRotate: function (a, b) {
8514      return a.divide(this._containerInnerSize.x * this.getZoom(b));
8515    },
8516    deltaPointsFromPixels: function (a, b) {
8517      return this.deltaPointsFromPixelsNoRotate(a, b).rotate(
8518        -this.getRotation(),
8519      );
8520    },
8521    pixelFromPointNoRotate: function (a, b) {
8522      return this._pixelFromPointNoRotate(a, this.getBoundsNoRotate(b));
8523    },
8524    pixelFromPoint: function (a, b) {
8525      return this._pixelFromPoint(a, this.getBoundsNoRotate(b));
8526    },
8527    _pixelFromPointNoRotate: function (b, c) {
8528      return b
8529        .minus(c.getTopLeft())
8530        .times(this._containerInnerSize.x / c.width)
8531        .plus(new a.Point(this._margins.left, this._margins.top));
8532    },
8533    _pixelFromPoint: function (a, b) {
8534      return this._pixelFromPointNoRotate(
8535        a.rotate(this.getRotation(), this.getCenter(!0)),
8536        b,
8537      );
8538    },
8539    pointFromPixelNoRotate: function (b, c) {
8540      var d = this.getBoundsNoRotate(c);
8541      return b
8542        .minus(new a.Point(this._margins.left, this._margins.top))
8543        .divide(this._containerInnerSize.x / d.width)
8544        .plus(d.getTopLeft());
8545    },
8546    pointFromPixel: function (a, b) {
8547      return this.pointFromPixelNoRotate(a, b).rotate(
8548        -this.getRotation(),
8549        this.getCenter(!0),
8550      );
8551    },
8552    _viewportToImageDelta: function (b, c) {
8553      var d = this._contentBoundsNoRotate.width;
8554      return new a.Point(
8555        (b * this._contentSizeNoRotate.x) / d,
8556        (c * this._contentSizeNoRotate.x) / d,
8557      );
8558    },
8559    viewportToImageCoordinates: function (b, c) {
8560      if (b instanceof a.Point)
8561        return this.viewportToImageCoordinates(b.x, b.y);
8562      if (this.viewer) {
8563        var d = this.viewer.world.getItemCount();
8564        if (d > 1)
8565          a.console.error(
8566            "[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.",
8567          );
8568        else if (1 === d) {
8569          var e = this.viewer.world.getItemAt(0);
8570          return e.viewportToImageCoordinates(b, c, !0);
8571        }
8572      }
8573      return this._viewportToImageDelta(
8574        b - this._contentBoundsNoRotate.x,
8575        c - this._contentBoundsNoRotate.y,
8576      );
8577    },
8578    _imageToViewportDelta: function (b, c) {
8579      var d = this._contentBoundsNoRotate.width;
8580      return new a.Point(
8581        (b / this._contentSizeNoRotate.x) * d,
8582        (c / this._contentSizeNoRotate.x) * d,
8583      );
8584    },
8585    imageToViewportCoordinates: function (b, c) {
8586      if (b instanceof a.Point)
8587        return this.imageToViewportCoordinates(b.x, b.y);
8588      if (this.viewer) {
8589        var d = this.viewer.world.getItemCount();
8590        if (d > 1)
8591          a.console.error(
8592            "[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.",
8593          );
8594        else if (1 === d) {
8595          var e = this.viewer.world.getItemAt(0);
8596          return e.imageToViewportCoordinates(b, c, !0);
8597        }
8598      }
8599      var f = this._imageToViewportDelta(b, c);
8600      f.x += this._contentBoundsNoRotate.x;
8601      f.y += this._contentBoundsNoRotate.y;
8602      return f;
8603    },
8604    imageToViewportRectangle: function (b, c, d, e) {
8605      var f = b;
8606      f instanceof a.Rect || (f = new a.Rect(b, c, d, e));
8607      if (this.viewer) {
8608        var g = this.viewer.world.getItemCount();
8609        if (g > 1)
8610          a.console.error(
8611            "[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.",
8612          );
8613        else if (1 === g) {
8614          var h = this.viewer.world.getItemAt(0);
8615          return h.imageToViewportRectangle(b, c, d, e, !0);
8616        }
8617      }
8618      var i = this.imageToViewportCoordinates(f.x, f.y);
8619      var j = this._imageToViewportDelta(f.width, f.height);
8620      return new a.Rect(i.x, i.y, j.x, j.y, f.degrees);
8621    },
8622    viewportToImageRectangle: function (b, c, d, e) {
8623      var f = b;
8624      f instanceof a.Rect || (f = new a.Rect(b, c, d, e));
8625      if (this.viewer) {
8626        var g = this.viewer.world.getItemCount();
8627        if (g > 1)
8628          a.console.error(
8629            "[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.",
8630          );
8631        else if (1 === g) {
8632          var h = this.viewer.world.getItemAt(0);
8633          return h.viewportToImageRectangle(b, c, d, e, !0);
8634        }
8635      }
8636      var i = this.viewportToImageCoordinates(f.x, f.y);
8637      var j = this._viewportToImageDelta(f.width, f.height);
8638      return new a.Rect(i.x, i.y, j.x, j.y, f.degrees);
8639    },
8640    viewerElementToImageCoordinates: function (a) {
8641      var b = this.pointFromPixel(a, !0);
8642      return this.viewportToImageCoordinates(b);
8643    },
8644    imageToViewerElementCoordinates: function (a) {
8645      var b = this.imageToViewportCoordinates(a);
8646      return this.pixelFromPoint(b, !0);
8647    },
8648    windowToImageCoordinates: function (b) {
8649      a.console.assert(
8650        this.viewer,
8651        "[Viewport.windowToImageCoordinates] the viewport must have a viewer.",
8652      );
8653      var c = b.minus(a.getElementPosition(this.viewer.element));
8654      return this.viewerElementToImageCoordinates(c);
8655    },
8656    imageToWindowCoordinates: function (b) {
8657      a.console.assert(
8658        this.viewer,
8659        "[Viewport.imageToWindowCoordinates] the viewport must have a viewer.",
8660      );
8661      var c = this.imageToViewerElementCoordinates(b);
8662      return c.plus(a.getElementPosition(this.viewer.element));
8663    },
8664    viewerElementToViewportCoordinates: function (a) {
8665      return this.pointFromPixel(a, !0);
8666    },
8667    viewportToViewerElementCoordinates: function (a) {
8668      return this.pixelFromPoint(a, !0);
8669    },
8670    viewerElementToViewportRectangle: function (b) {
8671      return a.Rect.fromSummits(
8672        this.pointFromPixel(b.getTopLeft(), !0),
8673        this.pointFromPixel(b.getTopRight(), !0),
8674        this.pointFromPixel(b.getBottomLeft(), !0),
8675      );
8676    },
8677    viewportToViewerElementRectangle: function (b) {
8678      return a.Rect.fromSummits(
8679        this.pixelFromPoint(b.getTopLeft(), !0),
8680        this.pixelFromPoint(b.getTopRight(), !0),
8681        this.pixelFromPoint(b.getBottomLeft(), !0),
8682      );
8683    },
8684    windowToViewportCoordinates: function (b) {
8685      a.console.assert(
8686        this.viewer,
8687        "[Viewport.windowToViewportCoordinates] the viewport must have a viewer.",
8688      );
8689      var c = b.minus(a.getElementPosition(this.viewer.element));
8690      return this.viewerElementToViewportCoordinates(c);
8691    },
8692    viewportToWindowCoordinates: function (b) {
8693      a.console.assert(
8694        this.viewer,
8695        "[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.",
8696      );
8697      var c = this.viewportToViewerElementCoordinates(b);
8698      return c.plus(a.getElementPosition(this.viewer.element));
8699    },
8700    viewportToImageZoom: function (b) {
8701      if (this.viewer) {
8702        var c = this.viewer.world.getItemCount();
8703        if (c > 1)
8704          a.console.error(
8705            "[Viewport.viewportToImageZoom] is not accurate with multi-image.",
8706          );
8707        else if (1 === c) {
8708          var d = this.viewer.world.getItemAt(0);
8709          return d.viewportToImageZoom(b);
8710        }
8711      }
8712      var e = this._contentSizeNoRotate.x;
8713      var f = this._containerInnerSize.x;
8714      var g = this._contentBoundsNoRotate.width;
8715      var h = (f / e) * g;
8716      return b * h;
8717    },
8718    imageToViewportZoom: function (b) {
8719      if (this.viewer) {
8720        var c = this.viewer.world.getItemCount();
8721        if (c > 1)
8722          a.console.error(
8723            "[Viewport.imageToViewportZoom] is not accurate with multi-image.",
8724          );
8725        else if (1 === c) {
8726          var d = this.viewer.world.getItemAt(0);
8727          return d.imageToViewportZoom(b);
8728        }
8729      }
8730      var e = this._contentSizeNoRotate.x;
8731      var f = this._containerInnerSize.x;
8732      var g = this._contentBoundsNoRotate.width;
8733      var h = e / f / g;
8734      return b * h;
8735    },
8736  };
8737})(OpenSeadragon);
8738!(function (a) {
8739  function b(b) {
8740    b._needsDraw = !1;
8741    var d,
8742      e,
8743      g,
8744      h,
8745      i,
8746      j,
8747      l,
8748      m,
8749      n = null,
8750      o = !1,
8751      q = a.now(),
8752      r = b.viewport.getBoundsWithMargins(!0),
8753      s =
8754        b.viewport.deltaPixelsFromPointsNoRotate(b.source.getPixelRatio(0), !0)
8755          .x * b._scaleSpring.current.value,
8756      t = Math.max(
8757        b.source.minLevel,
8758        Math.floor(Math.log(b.minZoomImageRatio) / Math.log(2)),
8759      ),
8760      u = Math.min(
8761        Math.abs(b.source.maxLevel),
8762        Math.abs(Math.floor(Math.log(s / b.minPixelRatio) / Math.log(2))),
8763      );
8764    for (; b.lastDrawn.length > 0; ) {
8765      d = b.lastDrawn.pop();
8766      d.beingDrawn = !1;
8767    }
8768    if (!b.wrapHorizontal && !b.wrapVertical) {
8769      var v = b.getClippedBounds(!0);
8770      var w = r.intersection(v);
8771      if (null === w) return;
8772      r = w;
8773    }
8774    r = r.getBoundingBox();
8775    r.x -= b._xSpring.current.value;
8776    r.y -= b._ySpring.current.value;
8777    var x = r.getTopLeft();
8778    var y = r.getBottomRight();
8779    if (
8780      (b.wrapHorizontal || !(y.x < 0 || x.x > b._worldWidthCurrent)) &&
8781      (b.wrapVertical || !(y.y < 0 || x.y > b._worldHeightCurrent))
8782    ) {
8783      if (!b.wrapHorizontal) {
8784        x.x = Math.max(x.x, 0);
8785        y.x = Math.min(y.x, b._worldWidthCurrent);
8786      }
8787      if (!b.wrapVertical) {
8788        x.y = Math.max(x.y, 0);
8789        y.y = Math.min(y.y, b._worldHeightCurrent);
8790      }
8791      t = Math.min(t, u);
8792      var z;
8793      for (e = u; e >= t; e--) {
8794        z = !1;
8795        g =
8796          b.viewport.deltaPixelsFromPointsNoRotate(
8797            b.source.getPixelRatio(e),
8798            !0,
8799          ).x * b._scaleSpring.current.value;
8800        if ((!o && g >= b.minPixelRatio) || e == t) {
8801          z = !0;
8802          o = !0;
8803        } else if (!o) continue;
8804        h =
8805          b.viewport.deltaPixelsFromPointsNoRotate(
8806            b.source.getPixelRatio(e),
8807            !1,
8808          ).x * b._scaleSpring.current.value;
8809        i =
8810          b.viewport.deltaPixelsFromPointsNoRotate(
8811            b.source.getPixelRatio(
8812              Math.max(
8813                b.source.getClosestLevel(b.viewport.containerSize) - 1,
8814                0,
8815              ),
8816            ),
8817            !1,
8818          ).x * b._scaleSpring.current.value;
8819        j = b.immediateRender ? 1 : i;
8820        l = Math.min(1, (g - 0.5) / 0.5);
8821        m = j / Math.abs(j - h);
8822        n = c(b, o, z, e, l, m, x, y, q, n);
8823        if (k(b.coverage, e)) break;
8824      }
8825      p(b, b.lastDrawn);
8826      n && !n.context2D && f(b, n, q);
8827    }
8828  }
8829  function c(a, b, c, e, f, g, h, i, j, k) {
8830    var l,
8831      m,
8832      o,
8833      p,
8834      q,
8835      r = a.viewport.pixelFromPoint(a.viewport.getCenter());
8836    a.viewer &&
8837      a.viewer.raiseEvent("update-level", {
8838        tiledImage: a,
8839        havedrawn: b,
8840        level: e,
8841        opacity: f,
8842        visibility: g,
8843        topleft: h,
8844        bottomright: i,
8845        currenttime: j,
8846        best: k,
8847      });
8848    o = a.source.getTileAtPoint(e, h.divide(a._scaleSpring.current.value));
8849    p = a.source.getTileAtPoint(e, i.divide(a._scaleSpring.current.value));
8850    q = a.source.getNumTiles(e);
8851    n(a.coverage, e);
8852    a.wrapHorizontal || (p.x = Math.min(p.x, q.x - 1));
8853    a.wrapVertical || (p.y = Math.min(p.y, q.y - 1));
8854    for (l = o.x; l <= p.x; l++)
8855      for (m = o.y; m <= p.y; m++) k = d(a, c, b, l, m, e, f, g, r, q, j, k);
8856    return k;
8857  }
8858  function d(a, b, c, d, f, g, k, n, p, q, r, s) {
8859    var t = e(
8860        d,
8861        f,
8862        g,
8863        a.source,
8864        a.tilesMatrix,
8865        r,
8866        q,
8867        a._worldWidthCurrent,
8868        a._worldHeightCurrent,
8869      ),
8870      u = b;
8871    a.viewer && a.viewer.raiseEvent("update-tile", { tiledImage: a, tile: t });
8872    m(a.coverage, g, d, f, !1);
8873    if (!t.exists) return s;
8874    c && !u && (l(a.coverage, g, d, f) ? m(a.coverage, g, d, f, !0) : (u = !0));
8875    if (!u) return s;
8876    i(t, a.source.tileOverlap, a.viewport, p, n, a);
8877    if (!t.loaded)
8878      if (t.context2D) h(a, t);
8879      else {
8880        var v = a._tileCache.getImageRecord(t.url);
8881        if (v) {
8882          var w = v.getImage();
8883          h(a, t, w);
8884        }
8885      }
8886    if (t.loaded) {
8887      var x = j(a, t, d, f, g, k, r);
8888      x && (a._needsDraw = !0);
8889    } else t.loading || (s = o(s, t));
8890    return s;
8891  }
8892  function e(b, c, d, e, f, g, h, i, j) {
8893    var k, l, m, n, o, p, q;
8894    f[d] || (f[d] = {});
8895    f[d][b] || (f[d][b] = {});
8896    if (!f[d][b][c]) {
8897      k = (h.x + (b % h.x)) % h.x;
8898      l = (h.y + (c % h.y)) % h.y;
8899      m = e.getTileBounds(d, k, l);
8900      n = e.tileExists(d, k, l);
8901      o = e.getTileUrl(d, k, l);
8902      p = e.getContext2D ? e.getContext2D(d, k, l) : void 0;
8903      m.x += (b - k) / h.x;
8904      m.y += (j / i) * ((c - l) / h.y);
8905      f[d][b][c] = new a.Tile(d, b, c, m, n, o, p);
8906    }
8907    q = f[d][b][c];
8908    q.lastTouchTime = g;
8909    return q;
8910  }
8911  function f(a, b, c) {
8912    b.loading = !0;
8913    a._imageLoader.addJob({
8914      src: b.url,
8915      crossOriginPolicy: a.crossOriginPolicy,
8916      callback: function (d, e) {
8917        g(a, b, c, d, e);
8918      },
8919      abort: function () {
8920        b.loading = !1;
8921      },
8922    });
8923  }
8924  function g(b, c, d, e, f) {
8925    if (e)
8926      if (d < b.lastResetTime) {
8927        a.console.log("Ignoring tile %s loaded before reset: %s", c, c.url);
8928        c.loading = !1;
8929      } else {
8930        var g = function () {
8931          var a = Math.ceil(
8932            Math.log(b.source.getTileWidth(c.level)) / Math.log(2),
8933          );
8934          h(b, c, e, a);
8935        };
8936        b._midDraw ? window.setTimeout(g, 1) : g();
8937      }
8938    else {
8939      a.console.log("Tile %s failed to load: %s - error: %s", c, c.url, f);
8940      b.viewer.raiseEvent("tile-load-failed", {
8941        tile: c,
8942        tiledImage: b,
8943        time: d,
8944        message: f,
8945      });
8946      c.loading = !1;
8947      c.exists = !1;
8948    }
8949  }
8950  function h(a, b, c, d) {
8951    function e() {
8952      g++;
8953      return f;
8954    }
8955    function f() {
8956      g--;
8957      if (0 === g) {
8958        b.loading = !1;
8959        b.loaded = !0;
8960        b.context2D ||
8961          a._tileCache.cacheTile({
8962            image: c,
8963            tile: b,
8964            cutoff: d,
8965            tiledImage: a,
8966          });
8967        a._needsDraw = !0;
8968      }
8969    }
8970    var g = 0;
8971    a.viewer.raiseEvent("tile-loaded", {
8972      tile: b,
8973      tiledImage: a,
8974      image: c,
8975      getCompletionCallback: e,
8976    });
8977    e()();
8978  }
8979  function i(b, c, d, e, f, g) {
8980    var h = b.bounds.getTopLeft();
8981    h.x *= g._scaleSpring.current.value;
8982    h.y *= g._scaleSpring.current.value;
8983    h.x += g._xSpring.current.value;
8984    h.y += g._ySpring.current.value;
8985    var i = b.bounds.getSize();
8986    i.x *= g._scaleSpring.current.value;
8987    i.y *= g._scaleSpring.current.value;
8988    var j = d.pixelFromPointNoRotate(h, !0),
8989      k = d.pixelFromPointNoRotate(h, !1),
8990      l = d.deltaPixelsFromPointsNoRotate(i, !0),
8991      m = d.deltaPixelsFromPointsNoRotate(i, !1),
8992      n = k.plus(m.divide(2)),
8993      o = e.distanceTo(n);
8994    c || (l = l.plus(new a.Point(1, 1)));
8995    b.position = j;
8996    b.size = l;
8997    b.distance = o;
8998    b.visibility = f;
8999  }
9000  function j(a, b, c, d, e, f, g) {
9001    var h,
9002      i,
9003      j = 1e3 * a.blendTime;
9004    b.blendStart || (b.blendStart = g);
9005    h = g - b.blendStart;
9006    i = j ? Math.min(1, h / j) : 1;
9007    a.alwaysBlend && (i *= f);
9008    b.opacity = i;
9009    a.lastDrawn.push(b);
9010    if (1 == i) {
9011      m(a.coverage, e, c, d, !0);
9012      a._hasOpaqueTile = !0;
9013    } else if (j > h) return !0;
9014    return !1;
9015  }
9016  function k(a, b, c, d) {
9017    var e, f, g, h;
9018    if (!a[b]) return !1;
9019    if (void 0 === c || void 0 === d) {
9020      e = a[b];
9021      for (g in e)
9022        if (e.hasOwnProperty(g)) {
9023          f = e[g];
9024          for (h in f) if (f.hasOwnProperty(h) && !f[h]) return !1;
9025        }
9026      return !0;
9027    }
9028    return void 0 === a[b][c] || void 0 === a[b][c][d] || a[b][c][d] === !0;
9029  }
9030  function l(a, b, c, d) {
9031    return void 0 === c || void 0 === d
9032      ? k(a, b + 1)
9033      : k(a, b + 1, 2 * c, 2 * d) &&
9034          k(a, b + 1, 2 * c, 2 * d + 1) &&
9035          k(a, b + 1, 2 * c + 1, 2 * d) &&
9036          k(a, b + 1, 2 * c + 1, 2 * d + 1);
9037  }
9038  function m(b, c, d, e, f) {
9039    if (b[c]) {
9040      b[c][d] || (b[c][d] = {});
9041      b[c][d][e] = f;
9042    } else
9043      a.console.warn(
9044        "Setting coverage for a tile before its level's coverage has been reset: %s",
9045        c,
9046      );
9047  }
9048  function n(a, b) {
9049    a[b] = {};
9050  }
9051  function o(a, b) {
9052    return a
9053      ? b.visibility > a.visibility
9054        ? b
9055        : b.visibility == a.visibility && b.distance < a.distance
9056          ? b
9057          : a
9058      : b;
9059  }
9060  function p(b, c) {
9061    if (0 !== c.length) {
9062      var d = c[0];
9063      var e =
9064        b.opacity < 1 ||
9065        (b.compositeOperation && "source-over" !== b.compositeOperation) ||
9066        (!b._isBottomItem() && d._hasTransparencyChannel());
9067      var f;
9068      var g;
9069      var h = b.viewport.getZoom(!0);
9070      var i = b.viewportToImageZoom(h);
9071      if (i > b.smoothTileEdgesMinZoom && !b.iOSDevice) {
9072        e = !0;
9073        f = d.getScaleForEdgeSmoothing();
9074        g = d.getTranslationForEdgeSmoothing(
9075          f,
9076          b._drawer.getCanvasSize(!1),
9077          b._drawer.getCanvasSize(!0),
9078        );
9079      }
9080      var j;
9081      if (e) {
9082        f ||
9083          (j = b.viewport
9084            .viewportToViewerElementRectangle(b.getClippedBounds(!0))
9085            .getIntegerBoundingBox()
9086            .times(a.pixelDensityRatio));
9087        b._drawer._clear(!0, j);
9088      }
9089      0 === b.viewport.degrees ||
9090        f ||
9091        b._drawer._offsetForRotation(b.viewport.degrees, e);
9092      var k = !1;
9093      if (b._clip) {
9094        b._drawer.saveContext(e);
9095        var l = b.imageToViewportRectangle(b._clip, !0);
9096        var m = b._drawer.viewportToDrawerRectangle(l);
9097        f && (m = m.times(f));
9098        g && (m = m.translate(g));
9099        b._drawer.setClip(m, e);
9100        k = !0;
9101      }
9102      if (b.placeholderFillStyle && b._hasOpaqueTile === !1) {
9103        var n = b._drawer.viewportToDrawerRectangle(b.getBounds(!0));
9104        f && (n = n.times(f));
9105        g && (n = n.translate(g));
9106        var o = null;
9107        o =
9108          "function" == typeof b.placeholderFillStyle
9109            ? b.placeholderFillStyle(b, b._drawer.context)
9110            : b.placeholderFillStyle;
9111        b._drawer.drawRectangle(n, o, e);
9112      }
9113      for (var p = c.length - 1; p >= 0; p--) {
9114        d = c[p];
9115        b._drawer.drawTile(d, b._drawingHandler, e, f, g);
9116        d.beingDrawn = !0;
9117        b.viewer &&
9118          b.viewer.raiseEvent("tile-drawn", { tiledImage: b, tile: d });
9119      }
9120      k && b._drawer.restoreContext(e);
9121      0 === b.viewport.degrees || f || b._drawer._restoreRotationChanges(e);
9122      if (e) {
9123        var r = 0 !== b.viewport.degrees && f;
9124        r && b._drawer._offsetForRotation(b.viewport.degrees, !1);
9125        b._drawer.blendSketch({
9126          opacity: b.opacity,
9127          scale: f,
9128          translate: g,
9129          compositeOperation: b.compositeOperation,
9130          bounds: j,
9131        });
9132        r && b._drawer._restoreRotationChanges(!1);
9133      }
9134      q(b, c);
9135    }
9136  }
9137  function q(b, c) {
9138    if (b.debugMode)
9139      for (var d = c.length - 1; d >= 0; d--) {
9140        var e = c[d];
9141        try {
9142          b._drawer.drawDebugInfo(e, c.length, d);
9143        } catch (f) {
9144          a.console.error(f);
9145        }
9146      }
9147  }
9148  a.TiledImage = function (b) {
9149    var c = this;
9150    a.console.assert(b.tileCache, "[TiledImage] options.tileCache is required");
9151    a.console.assert(b.drawer, "[TiledImage] options.drawer is required");
9152    a.console.assert(b.viewer, "[TiledImage] options.viewer is required");
9153    a.console.assert(
9154      b.imageLoader,
9155      "[TiledImage] options.imageLoader is required",
9156    );
9157    a.console.assert(b.source, "[TiledImage] options.source is required");
9158    a.console.assert(
9159      !b.clip || b.clip instanceof a.Rect,
9160      "[TiledImage] options.clip must be an OpenSeadragon.Rect if present",
9161    );
9162    a.EventSource.call(this);
9163    this._tileCache = b.tileCache;
9164    delete b.tileCache;
9165    this._drawer = b.drawer;
9166    delete b.drawer;
9167    this._imageLoader = b.imageLoader;
9168    delete b.imageLoader;
9169    b.clip instanceof a.Rect && (this._clip = b.clip.clone());
9170    delete b.clip;
9171    var d = b.x || 0;
9172    delete b.x;
9173    var e = b.y || 0;
9174    delete b.y;
9175    this.normHeight = b.source.dimensions.y / b.source.dimensions.x;
9176    this.contentAspectX = b.source.dimensions.x / b.source.dimensions.y;
9177    var f = 1;
9178    if (b.width) {
9179      f = b.width;
9180      delete b.width;
9181      if (b.height) {
9182        a.console.error(
9183          "specifying both width and height to a tiledImage is not supported",
9184        );
9185        delete b.height;
9186      }
9187    } else if (b.height) {
9188      f = b.height / this.normHeight;
9189      delete b.height;
9190    }
9191    var g = b.fitBounds;
9192    delete b.fitBounds;
9193    var h = b.fitBoundsPlacement || OpenSeadragon.Placement.CENTER;
9194    delete b.fitBoundsPlacement;
9195    a.extend(
9196      !0,
9197      this,
9198      {
9199        viewer: null,
9200        tilesMatrix: {},
9201        coverage: {},
9202        lastDrawn: [],
9203        lastResetTime: 0,
9204        _midDraw: !1,
9205        _needsDraw: !0,
9206        _hasOpaqueTile: !1,
9207        springStiffness: a.DEFAULT_SETTINGS.springStiffness,
9208        animationTime: a.DEFAULT_SETTINGS.animationTime,
9209        minZoomImageRatio: a.DEFAULT_SETTINGS.minZoomImageRatio,
9210        wrapHorizontal: a.DEFAULT_SETTINGS.wrapHorizontal,
9211        wrapVertical: a.DEFAULT_SETTINGS.wrapVertical,
9212        immediateRender: a.DEFAULT_SETTINGS.immediateRender,
9213        blendTime: a.DEFAULT_SETTINGS.blendTime,
9214        alwaysBlend: a.DEFAULT_SETTINGS.alwaysBlend,
9215        minPixelRatio: a.DEFAULT_SETTINGS.minPixelRatio,
9216        smoothTileEdgesMinZoom: a.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,
9217        iOSDevice: a.DEFAULT_SETTINGS.iOSDevice,
9218        debugMode: a.DEFAULT_SETTINGS.debugMode,
9219        crossOriginPolicy: a.DEFAULT_SETTINGS.crossOriginPolicy,
9220        placeholderFillStyle: a.DEFAULT_SETTINGS.placeholderFillStyle,
9221        opacity: a.DEFAULT_SETTINGS.opacity,
9222        compositeOperation: a.DEFAULT_SETTINGS.compositeOperation,
9223      },
9224      b,
9225    );
9226    this._xSpring = new a.Spring({
9227      initial: d,
9228      springStiffness: this.springStiffness,
9229      animationTime: this.animationTime,
9230    });
9231    this._ySpring = new a.Spring({
9232      initial: e,
9233      springStiffness: this.springStiffness,
9234      animationTime: this.animationTime,
9235    });
9236    this._scaleSpring = new a.Spring({
9237      initial: f,
9238      springStiffness: this.springStiffness,
9239      animationTime: this.animationTime,
9240    });
9241    this._updateForScale();
9242    g && this.fitBounds(g, h, !0);
9243    this._drawingHandler = function (b) {
9244      c.viewer.raiseEvent("tile-drawing", a.extend({ tiledImage: c }, b));
9245    };
9246  };
9247  a.extend(a.TiledImage.prototype, a.EventSource.prototype, {
9248    needsDraw: function () {
9249      return this._needsDraw;
9250    },
9251    reset: function () {
9252      this._tileCache.clearTilesFor(this);
9253      this.lastResetTime = a.now();
9254      this._needsDraw = !0;
9255    },
9256    update: function () {
9257      var a = this._xSpring.current.value;
9258      var b = this._ySpring.current.value;
9259      var c = this._scaleSpring.current.value;
9260      this._xSpring.update();
9261      this._ySpring.update();
9262      this._scaleSpring.update();
9263      if (
9264        this._xSpring.current.value !== a ||
9265        this._ySpring.current.value !== b ||
9266        this._scaleSpring.current.value !== c
9267      ) {
9268        this._updateForScale();
9269        this._needsDraw = !0;
9270        return !0;
9271      }
9272      return !1;
9273    },
9274    draw: function () {
9275      if (0 !== this.opacity) {
9276        this._midDraw = !0;
9277        b(this);
9278        this._midDraw = !1;
9279      }
9280    },
9281    destroy: function () {
9282      this.reset();
9283    },
9284    getBounds: function (b) {
9285      return b
9286        ? new a.Rect(
9287            this._xSpring.current.value,
9288            this._ySpring.current.value,
9289            this._worldWidthCurrent,
9290            this._worldHeightCurrent,
9291          )
9292        : new a.Rect(
9293            this._xSpring.target.value,
9294            this._ySpring.target.value,
9295            this._worldWidthTarget,
9296            this._worldHeightTarget,
9297          );
9298    },
9299    getWorldBounds: function () {
9300      a.console.error(
9301        "[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead",
9302      );
9303      return this.getBounds();
9304    },
9305    getClippedBounds: function (b) {
9306      var c = this.getBounds(b);
9307      if (this._clip) {
9308        var d = this._worldWidthCurrent / this.source.dimensions.x;
9309        var e = this._clip.times(d);
9310        c = new a.Rect(c.x + e.x, c.y + e.y, e.width, e.height);
9311      }
9312      return c;
9313    },
9314    getContentSize: function () {
9315      return new a.Point(this.source.dimensions.x, this.source.dimensions.y);
9316    },
9317    _viewportToImageDelta: function (b, c, d) {
9318      var e = d
9319        ? this._scaleSpring.current.value
9320        : this._scaleSpring.target.value;
9321      return new a.Point(
9322        b * (this.source.dimensions.x / e),
9323        c * ((this.source.dimensions.y * this.contentAspectX) / e),
9324      );
9325    },
9326    viewportToImageCoordinates: function (b, c, d) {
9327      if (b instanceof a.Point) {
9328        d = c;
9329        c = b.y;
9330        b = b.x;
9331      }
9332      return d
9333        ? this._viewportToImageDelta(
9334            b - this._xSpring.current.value,
9335            c - this._ySpring.current.value,
9336          )
9337        : this._viewportToImageDelta(
9338            b - this._xSpring.target.value,
9339            c - this._ySpring.target.value,
9340          );
9341    },
9342    _imageToViewportDelta: function (b, c, d) {
9343      var e = d
9344        ? this._scaleSpring.current.value
9345        : this._scaleSpring.target.value;
9346      return new a.Point(
9347        (b / this.source.dimensions.x) * e,
9348        (c / this.source.dimensions.y / this.contentAspectX) * e,
9349      );
9350    },
9351    imageToViewportCoordinates: function (b, c, d) {
9352      if (b instanceof a.Point) {
9353        d = c;
9354        c = b.y;
9355        b = b.x;
9356      }
9357      var e = this._imageToViewportDelta(b, c);
9358      if (d) {
9359        e.x += this._xSpring.current.value;
9360        e.y += this._ySpring.current.value;
9361      } else {
9362        e.x += this._xSpring.target.value;
9363        e.y += this._ySpring.target.value;
9364      }
9365      return e;
9366    },
9367    imageToViewportRectangle: function (b, c, d, e, f) {
9368      var g = b;
9369      g instanceof a.Rect ? (f = c) : (g = new a.Rect(b, c, d, e));
9370      var h = this.imageToViewportCoordinates(g.getTopLeft(), f);
9371      var i = this._imageToViewportDelta(g.width, g.height, f);
9372      return new a.Rect(h.x, h.y, i.x, i.y, g.degrees);
9373    },
9374    viewportToImageRectangle: function (b, c, d, e, f) {
9375      var g = b;
9376      b instanceof a.Rect ? (f = c) : (g = new a.Rect(b, c, d, e));
9377      var h = this.viewportToImageCoordinates(g.getTopLeft(), f);
9378      var i = this._viewportToImageDelta(g.width, g.height, f);
9379      return new a.Rect(h.x, h.y, i.x, i.y, g.degrees);
9380    },
9381    viewerElementToImageCoordinates: function (a) {
9382      var b = this.viewport.pointFromPixel(a, !0);
9383      return this.viewportToImageCoordinates(b);
9384    },
9385    imageToViewerElementCoordinates: function (a) {
9386      var b = this.imageToViewportCoordinates(a);
9387      return this.viewport.pixelFromPoint(b, !0);
9388    },
9389    windowToImageCoordinates: function (a) {
9390      var b = a.minus(OpenSeadragon.getElementPosition(this.viewer.element));
9391      return this.viewerElementToImageCoordinates(b);
9392    },
9393    imageToWindowCoordinates: function (a) {
9394      var b = this.imageToViewerElementCoordinates(a);
9395      return b.plus(OpenSeadragon.getElementPosition(this.viewer.element));
9396    },
9397    viewportToImageZoom: function (a) {
9398      var b =
9399        (this._scaleSpring.current.value *
9400          this.viewport._containerInnerSize.x) /
9401        this.source.dimensions.x;
9402      return b * a;
9403    },
9404    imageToViewportZoom: function (a) {
9405      var b =
9406        (this._scaleSpring.current.value *
9407          this.viewport._containerInnerSize.x) /
9408        this.source.dimensions.x;
9409      return a / b;
9410    },
9411    setPosition: function (a, b) {
9412      var c =
9413        this._xSpring.target.value === a.x &&
9414        this._ySpring.target.value === a.y;
9415      if (b) {
9416        if (
9417          c &&
9418          this._xSpring.current.value === a.x &&
9419          this._ySpring.current.value === a.y
9420        )
9421          return;
9422        this._xSpring.resetTo(a.x);
9423        this._ySpring.resetTo(a.y);
9424        this._needsDraw = !0;
9425      } else {
9426        if (c) return;
9427        this._xSpring.springTo(a.x);
9428        this._ySpring.springTo(a.y);
9429        this._needsDraw = !0;
9430      }
9431      c || this._raiseBoundsChange();
9432    },
9433    setWidth: function (a, b) {
9434      this._setScale(a, b);
9435    },
9436    setHeight: function (a, b) {
9437      this._setScale(a / this.normHeight, b);
9438    },
9439    fitBounds: function (b, c, d) {
9440      c = c || a.Placement.CENTER;
9441      var e = a.Placement.properties[c];
9442      var f = this.contentAspectX;
9443      var g = 0;
9444      var h = 0;
9445      var i = 1;
9446      var j = 1;
9447      if (this._clip) {
9448        f = this._clip.getAspectRatio();
9449        i = this._clip.width / this.source.dimensions.x;
9450        j = this._clip.height / this.source.dimensions.y;
9451        if (b.getAspectRatio() > f) {
9452          g = (this._clip.x / this._clip.height) * b.height;
9453          h = (this._clip.y / this._clip.height) * b.height;
9454        } else {
9455          g = (this._clip.x / this._clip.width) * b.width;
9456          h = (this._clip.y / this._clip.width) * b.width;
9457        }
9458      }
9459      if (b.getAspectRatio() > f) {
9460        var k = b.height / j;
9461        var l = 0;
9462        e.isHorizontallyCentered
9463          ? (l = (b.width - b.height * f) / 2)
9464          : e.isRight && (l = b.width - b.height * f);
9465        this.setPosition(new a.Point(b.x - g + l, b.y - h), d);
9466        this.setHeight(k, d);
9467      } else {
9468        var m = b.width / i;
9469        var n = 0;
9470        e.isVerticallyCentered
9471          ? (n = (b.height - b.width / f) / 2)
9472          : e.isBottom && (n = b.height - b.width / f);
9473        this.setPosition(new a.Point(b.x - g, b.y - h + n), d);
9474        this.setWidth(m, d);
9475      }
9476    },
9477    getClip: function () {
9478      return this._clip ? this._clip.clone() : null;
9479    },
9480    setClip: function (b) {
9481      a.console.assert(
9482        !b || b instanceof a.Rect,
9483        "[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null",
9484      );
9485      b instanceof a.Rect ? (this._clip = b.clone()) : (this._clip = null);
9486      this._needsDraw = !0;
9487    },
9488    getOpacity: function () {
9489      return this.opacity;
9490    },
9491    setOpacity: function (a) {
9492      this.opacity = a;
9493      this._needsDraw = !0;
9494    },
9495    getCompositeOperation: function () {
9496      return this.compositeOperation;
9497    },
9498    setCompositeOperation: function (a) {
9499      this.compositeOperation = a;
9500      this._needsDraw = !0;
9501    },
9502    _setScale: function (a, b) {
9503      var c = this._scaleSpring.target.value === a;
9504      if (b) {
9505        if (c && this._scaleSpring.current.value === a) return;
9506        this._scaleSpring.resetTo(a);
9507        this._updateForScale();
9508        this._needsDraw = !0;
9509      } else {
9510        if (c) return;
9511        this._scaleSpring.springTo(a);
9512        this._updateForScale();
9513        this._needsDraw = !0;
9514      }
9515      c || this._raiseBoundsChange();
9516    },
9517    _updateForScale: function () {
9518      this._worldWidthTarget = this._scaleSpring.target.value;
9519      this._worldHeightTarget =
9520        this.normHeight * this._scaleSpring.target.value;
9521      this._worldWidthCurrent = this._scaleSpring.current.value;
9522      this._worldHeightCurrent =
9523        this.normHeight * this._scaleSpring.current.value;
9524    },
9525    _raiseBoundsChange: function () {
9526      this.raiseEvent("bounds-change");
9527    },
9528    _isBottomItem: function () {
9529      return this.viewer.world.getItemAt(0) === this;
9530    },
9531  });
9532})(OpenSeadragon);
9533!(function (a) {
9534  var b = function (b) {
9535    a.console.assert(b, "[TileCache.cacheTile] options is required");
9536    a.console.assert(b.tile, "[TileCache.cacheTile] options.tile is required");
9537    a.console.assert(
9538      b.tiledImage,
9539      "[TileCache.cacheTile] options.tiledImage is required",
9540    );
9541    this.tile = b.tile;
9542    this.tiledImage = b.tiledImage;
9543  };
9544  var c = function (b) {
9545    a.console.assert(b, "[ImageRecord] options is required");
9546    a.console.assert(b.image, "[ImageRecord] options.image is required");
9547    this._image = b.image;
9548    this._tiles = [];
9549  };
9550  c.prototype = {
9551    destroy: function () {
9552      this._image = null;
9553      this._renderedContext = null;
9554      this._tiles = null;
9555    },
9556    getImage: function () {
9557      return this._image;
9558    },
9559    getRenderedContext: function () {
9560      if (!this._renderedContext) {
9561        var a = document.createElement("canvas");
9562        a.width = this._image.width;
9563        a.height = this._image.height;
9564        this._renderedContext = a.getContext("2d");
9565        this._renderedContext.drawImage(this._image, 0, 0);
9566        this._image = null;
9567      }
9568      return this._renderedContext;
9569    },
9570    setRenderedContext: function (b) {
9571      a.console.error(
9572        "ImageRecord.setRenderedContext is deprecated. The rendered context should be created by the ImageRecord itself when calling ImageRecord.getRenderedContext.",
9573      );
9574      this._renderedContext = b;
9575    },
9576    addTile: function (b) {
9577      a.console.assert(b, "[ImageRecord.addTile] tile is required");
9578      this._tiles.push(b);
9579    },
9580    removeTile: function (b) {
9581      for (var c = 0; c < this._tiles.length; c++)
9582        if (this._tiles[c] === b) {
9583          this._tiles.splice(c, 1);
9584          return;
9585        }
9586      a.console.warn(
9587        "[ImageRecord.removeTile] trying to remove unknown tile",
9588        b,
9589      );
9590    },
9591    getTileCount: function () {
9592      return this._tiles.length;
9593    },
9594  };
9595  a.TileCache = function (b) {
9596    b = b || {};
9597    this._maxImageCacheCount =
9598      b.maxImageCacheCount || a.DEFAULT_SETTINGS.maxImageCacheCount;
9599    this._tilesLoaded = [];
9600    this._imagesLoaded = [];
9601    this._imagesLoadedCount = 0;
9602  };
9603  a.TileCache.prototype = {
9604    numTilesLoaded: function () {
9605      return this._tilesLoaded.length;
9606    },
9607    cacheTile: function (d) {
9608      a.console.assert(d, "[TileCache.cacheTile] options is required");
9609      a.console.assert(
9610        d.tile,
9611        "[TileCache.cacheTile] options.tile is required",
9612      );
9613      a.console.assert(
9614        d.tile.url,
9615        "[TileCache.cacheTile] options.tile.url is required",
9616      );
9617      a.console.assert(
9618        d.tiledImage,
9619        "[TileCache.cacheTile] options.tiledImage is required",
9620      );
9621      var e = d.cutoff || 0;
9622      var f = this._tilesLoaded.length;
9623      var g = this._imagesLoaded[d.tile.url];
9624      if (!g) {
9625        a.console.assert(
9626          d.image,
9627          "[TileCache.cacheTile] options.image is required to create an ImageRecord",
9628        );
9629        g = this._imagesLoaded[d.tile.url] = new c({ image: d.image });
9630        this._imagesLoadedCount++;
9631      }
9632      g.addTile(d.tile);
9633      d.tile.cacheImageRecord = g;
9634      if (this._imagesLoadedCount > this._maxImageCacheCount) {
9635        var h = null;
9636        var i = -1;
9637        var j = null;
9638        var k, l, m, n, o, p;
9639        for (var q = this._tilesLoaded.length - 1; q >= 0; q--) {
9640          p = this._tilesLoaded[q];
9641          k = p.tile;
9642          if (!(k.level <= e || k.beingDrawn))
9643            if (h) {
9644              n = k.lastTouchTime;
9645              l = h.lastTouchTime;
9646              o = k.level;
9647              m = h.level;
9648              if (l > n || (n == l && o > m)) {
9649                h = k;
9650                i = q;
9651                j = p;
9652              }
9653            } else {
9654              h = k;
9655              i = q;
9656              j = p;
9657            }
9658        }
9659        if (h && i >= 0) {
9660          this._unloadTile(j);
9661          f = i;
9662        }
9663      }
9664      this._tilesLoaded[f] = new b({ tile: d.tile, tiledImage: d.tiledImage });
9665    },
9666    clearTilesFor: function (b) {
9667      a.console.assert(b, "[TileCache.clearTilesFor] tiledImage is required");
9668      var c;
9669      for (var d = 0; d < this._tilesLoaded.length; ++d) {
9670        c = this._tilesLoaded[d];
9671        if (c.tiledImage === b) {
9672          this._unloadTile(c);
9673          this._tilesLoaded.splice(d, 1);
9674          d--;
9675        }
9676      }
9677    },
9678    getImageRecord: function (b) {
9679      a.console.assert(b, "[TileCache.getImageRecord] url is required");
9680      return this._imagesLoaded[b];
9681    },
9682    _unloadTile: function (b) {
9683      a.console.assert(b, "[TileCache._unloadTile] tileRecord is required");
9684      var c = b.tile;
9685      var d = b.tiledImage;
9686      c.unload();
9687      c.cacheImageRecord = null;
9688      var e = this._imagesLoaded[c.url];
9689      e.removeTile(c);
9690      if (!e.getTileCount()) {
9691        e.destroy();
9692        delete this._imagesLoaded[c.url];
9693        this._imagesLoadedCount--;
9694      }
9695      d.viewer.raiseEvent("tile-unloaded", { tile: c, tiledImage: d });
9696    },
9697  };
9698})(OpenSeadragon);
9699!(function (a) {
9700  a.World = function (b) {
9701    var c = this;
9702    a.console.assert(b.viewer, "[World] options.viewer is required");
9703    a.EventSource.call(this);
9704    this.viewer = b.viewer;
9705    this._items = [];
9706    this._needsDraw = !1;
9707    this._autoRefigureSizes = !0;
9708    this._needsSizesFigured = !1;
9709    this._delegatedFigureSizes = function (a) {
9710      c._autoRefigureSizes ? c._figureSizes() : (c._needsSizesFigured = !0);
9711    };
9712    this._figureSizes();
9713  };
9714  a.extend(a.World.prototype, a.EventSource.prototype, {
9715    addItem: function (b, c) {
9716      a.console.assert(b, "[World.addItem] item is required");
9717      a.console.assert(
9718        b instanceof a.TiledImage,
9719        "[World.addItem] only TiledImages supported at this time",
9720      );
9721      c = c || {};
9722      if (void 0 !== c.index) {
9723        var d = Math.max(0, Math.min(this._items.length, c.index));
9724        this._items.splice(d, 0, b);
9725      } else this._items.push(b);
9726      this._autoRefigureSizes
9727        ? this._figureSizes()
9728        : (this._needsSizesFigured = !0);
9729      this._needsDraw = !0;
9730      b.addHandler("bounds-change", this._delegatedFigureSizes);
9731      this.raiseEvent("add-item", { item: b });
9732    },
9733    getItemAt: function (b) {
9734      a.console.assert(void 0 !== b, "[World.getItemAt] index is required");
9735      return this._items[b];
9736    },
9737    getIndexOfItem: function (b) {
9738      a.console.assert(b, "[World.getIndexOfItem] item is required");
9739      return a.indexOf(this._items, b);
9740    },
9741    getItemCount: function () {
9742      return this._items.length;
9743    },
9744    setItemIndex: function (b, c) {
9745      a.console.assert(b, "[World.setItemIndex] item is required");
9746      a.console.assert(void 0 !== c, "[World.setItemIndex] index is required");
9747      var d = this.getIndexOfItem(b);
9748      if (c >= this._items.length)
9749        throw new Error("Index bigger than number of layers.");
9750      if (c !== d && -1 !== d) {
9751        this._items.splice(d, 1);
9752        this._items.splice(c, 0, b);
9753        this._needsDraw = !0;
9754        this.raiseEvent("item-index-change", {
9755          item: b,
9756          previousIndex: d,
9757          newIndex: c,
9758        });
9759      }
9760    },
9761    removeItem: function (b) {
9762      a.console.assert(b, "[World.removeItem] item is required");
9763      var c = a.indexOf(this._items, b);
9764      if (-1 !== c) {
9765        b.removeHandler("bounds-change", this._delegatedFigureSizes);
9766        b.destroy();
9767        this._items.splice(c, 1);
9768        this._figureSizes();
9769        this._needsDraw = !0;
9770        this._raiseRemoveItem(b);
9771      }
9772    },
9773    removeAll: function () {
9774      this.viewer._cancelPendingImages();
9775      var a;
9776      for (var b = 0; b < this._items.length; b++) {
9777        a = this._items[b];
9778        a.removeHandler("bounds-change", this._delegatedFigureSizes);
9779        a.destroy();
9780      }
9781      var c = this._items;
9782      this._items = [];
9783      this._figureSizes();
9784      this._needsDraw = !0;
9785      for (b = 0; b < c.length; b++) {
9786        a = c[b];
9787        this._raiseRemoveItem(a);
9788      }
9789    },
9790    resetItems: function () {
9791      for (var a = 0; a < this._items.length; a++) this._items[a].reset();
9792    },
9793    update: function () {
9794      var a = !1;
9795      for (var b = 0; b < this._items.length; b++)
9796        a = this._items[b].update() || a;
9797      return a;
9798    },
9799    draw: function () {
9800      for (var a = 0; a < this._items.length; a++) this._items[a].draw();
9801      this._needsDraw = !1;
9802    },
9803    needsDraw: function () {
9804      for (var a = 0; a < this._items.length; a++)
9805        if (this._items[a].needsDraw()) return !0;
9806      return this._needsDraw;
9807    },
9808    getHomeBounds: function () {
9809      return this._homeBounds.clone();
9810    },
9811    getContentFactor: function () {
9812      return this._contentFactor;
9813    },
9814    setAutoRefigureSizes: function (a) {
9815      this._autoRefigureSizes = a;
9816      if (a & this._needsSizesFigured) {
9817        this._figureSizes();
9818        this._needsSizesFigured = !1;
9819      }
9820    },
9821    arrange: function (b) {
9822      b = b || {};
9823      var c = b.immediately || !1;
9824      var d = b.layout || a.DEFAULT_SETTINGS.collectionLayout;
9825      var e = b.rows || a.DEFAULT_SETTINGS.collectionRows;
9826      var f = b.columns || a.DEFAULT_SETTINGS.collectionColumns;
9827      var g = b.tileSize || a.DEFAULT_SETTINGS.collectionTileSize;
9828      var h = b.tileMargin || a.DEFAULT_SETTINGS.collectionTileMargin;
9829      var i = g + h;
9830      var j;
9831      j = !b.rows && f ? f : Math.ceil(this._items.length / e);
9832      var k = 0;
9833      var l = 0;
9834      var m, n, o, p, q;
9835      this.setAutoRefigureSizes(!1);
9836      for (var r = 0; r < this._items.length; r++) {
9837        if (r && r % j === 0)
9838          if ("horizontal" === d) {
9839            l += i;
9840            k = 0;
9841          } else {
9842            k += i;
9843            l = 0;
9844          }
9845        m = this._items[r];
9846        n = m.getBounds();
9847        o = n.width > n.height ? g : g * (n.width / n.height);
9848        p = o * (n.height / n.width);
9849        q = new a.Point(k + (g - o) / 2, l + (g - p) / 2);
9850        m.setPosition(q, c);
9851        m.setWidth(o, c);
9852        "horizontal" === d ? (k += i) : (l += i);
9853      }
9854      this.setAutoRefigureSizes(!0);
9855    },
9856    _figureSizes: function () {
9857      var b = this._homeBounds ? this._homeBounds.clone() : null;
9858      var c = this._contentSize ? this._contentSize.clone() : null;
9859      var d = this._contentFactor || 0;
9860      if (this._items.length) {
9861        var e = this._items[0];
9862        var f = e.getBounds();
9863        this._contentFactor = e.getContentSize().x / f.width;
9864        var g = e.getClippedBounds();
9865        var h = g.x;
9866        var i = g.y;
9867        var j = g.x + g.width;
9868        var k = g.y + g.height;
9869        for (var l = 1; l < this._items.length; l++) {
9870          e = this._items[l];
9871          f = e.getBounds();
9872          this._contentFactor = Math.max(
9873            this._contentFactor,
9874            e.getContentSize().x / f.width,
9875          );
9876          g = e.getClippedBounds();
9877          h = Math.min(h, g.x);
9878          i = Math.min(i, g.y);
9879          j = Math.max(j, g.x + g.width);
9880          k = Math.max(k, g.y + g.height);
9881        }
9882        this._homeBounds = new a.Rect(h, i, j - h, k - i);
9883        this._contentSize = new a.Point(
9884          this._homeBounds.width * this._contentFactor,
9885          this._homeBounds.height * this._contentFactor,
9886        );
9887      } else {
9888        this._homeBounds = new a.Rect(0, 0, 1, 1);
9889        this._contentSize = new a.Point(1, 1);
9890        this._contentFactor = 1;
9891      }
9892      (this._contentFactor === d &&
9893        this._homeBounds.equals(b) &&
9894        this._contentSize.equals(c)) ||
9895        this.raiseEvent("metrics-change", {});
9896    },
9897    _raiseRemoveItem: function (a) {
9898      this.raiseEvent("remove-item", { item: a });
9899    },
9900  });
9901})(OpenSeadragon);
9902//# sourceMappingURL=openseadragon.min.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.