@sjcrh/proteinpaint-client 2.63.0 → 2.63.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/{2dmaf-70c0b6bb.js → 2dmaf-0cabb4a4.js} +1 -1
- package/dist/{ColorScale-b44d51ef.js → ColorScale-9800a609.js} +1 -1
- package/dist/{DEanalysis-b86d0874.js → DEanalysis-567989ff.js} +1 -1
- package/dist/{Disco-16cd51c0.js → Disco-5d1404ce.js} +1 -1
- package/dist/{Disco.UI-a38a12e6.js → Disco.UI-54228bb6.js} +1 -1
- package/dist/{DragControls-0c173a20.js → DragControls-a05737c2.js} +1 -1
- package/dist/{DziViewer-5c2d68e7.js → DziViewer-3f466d90.js} +2 -2
- package/dist/{FilterRxComp-0e75dd8d.js → FilterRxComp-fc769f34.js} +1 -1
- package/dist/{FilterStateless-ad3df967.js → FilterStateless-8f30f856.js} +1 -1
- package/dist/{HicApp-bcf8330c.js → HicApp-aac413df.js} +1 -1
- package/dist/{OrbitControls-c33cf781.js → OrbitControls-8b7f91ca.js} +1 -1
- package/dist/app-59194db0.js +1 -0
- package/dist/{app-f91922b4.js → app-71453429.js} +1 -1
- package/dist/{app-bfce9bf5.js → app-fb676934.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{bam-95f36008.js → bam-e7f6baea.js} +1 -1
- package/dist/{barchart-e2af00a8.js → barchart-ef4874c8.js} +1 -1
- package/dist/{barchart.events-272fd122.js → barchart.events-e24facf7.js} +1 -1
- package/dist/{bars.renderer-f0e5af5a.js → bars.renderer-c46d3f44.js} +1 -1
- package/dist/{block-ec76524e.js → block-4f585abe.js} +1 -1
- package/dist/block.lazyload-6f83d057.js +1 -0
- package/dist/{block.legend-f8cad7e4.js → block.legend-cec87c6f.js} +1 -1
- package/dist/{block.mds-20655637.js → block.mds-f5a11c42.js} +1 -1
- package/dist/{block.mds.cnv-5feb86a0.js → block.mds.cnv-25423c1e.js} +1 -1
- package/dist/{block.mds.expressionrank-c7043f35.js → block.mds.expressionrank-fc1996d5.js} +1 -1
- package/dist/{block.mds.expressionstat-4bf457f3.js → block.mds.expressionstat-45b6bf47.js} +1 -1
- package/dist/{block.mds.geneboxplot-132e5fe6.js → block.mds.geneboxplot-037df46d.js} +1 -1
- package/dist/{block.mds.junction-1f9810df.js → block.mds.junction-00161de6.js} +1 -1
- package/dist/{block.mds.svcnv-094c416f.js → block.mds.svcnv-0c257af4.js} +1 -1
- package/dist/{block.mds.svcnv.share-bb976e02.js → block.mds.svcnv.share-c0b9dfad.js} +1 -1
- package/dist/{block.mds2-7045e32c.js → block.mds2-9009f8d8.js} +1 -1
- package/dist/{block.svg-d8d76ba7.js → block.svg-86bbfcb0.js} +1 -1
- package/dist/{block.tk.aicheck-317d04bd.js → block.tk.aicheck-a5697794.js} +1 -1
- package/dist/{block.tk.ase-d1577ec1.js → block.tk.ase-ad1be47c.js} +1 -1
- package/dist/{block.tk.bam-3cdc13a0.js → block.tk.bam-14339d16.js} +1 -1
- package/dist/{block.tk.bedgraphdot-5304e06c.js → block.tk.bedgraphdot-efe19e56.js} +1 -1
- package/dist/{block.tk.bigwig.ui-0c96dce5.js → block.tk.bigwig.ui-a92f286b.js} +1 -1
- package/dist/{block.tk.hicstraw-39d89269.js → block.tk.hicstraw-57fbbe61.js} +1 -1
- package/dist/{block.tk.junction-b45b3a95.js → block.tk.junction-64c39cd5.js} +1 -1
- package/dist/{block.tk.junction.textmatrixui-6ec019e1.js → block.tk.junction.textmatrixui-09e5e02f.js} +1 -1
- package/dist/{block.tk.ld-5c54e58b.js → block.tk.ld-f681d099.js} +1 -1
- package/dist/{block.tk.menu-30a2c3a5.js → block.tk.menu-2563364c.js} +1 -1
- package/dist/{block.tk.pgv-7ff2dfaf.js → block.tk.pgv-9dfc00c0.js} +1 -1
- package/dist/{boxplot-7de25274.js → boxplot-a2e1ace0.js} +1 -1
- package/dist/brainImaging-21701238.js +1 -0
- package/dist/{brush-db0ed33a.js → brush-bb4566a3.js} +1 -1
- package/dist/{categorical-bc309399.js → categorical-a00f4ffc.js} +1 -1
- package/dist/{condition-f0eb2343.js → condition-2034db37.js} +1 -1
- package/dist/{controls-8d4972c8.js → controls-0467d2ec.js} +1 -1
- package/dist/{controls.btns-bad9e4cf.js → controls.btns-ad7b28a2.js} +1 -1
- package/dist/{controls.config-e0f394cb.js → controls.config-6cf816fb.js} +1 -1
- package/dist/{controls.divide-d8ac5a9b.js → controls.divide-3c0d52d7.js} +1 -1
- package/dist/{controls.overlay-3ac8773d.js → controls.overlay-3a55c2ec.js} +1 -1
- package/dist/{controls.term1-008f4be4.js → controls.term1-59f4cd60.js} +1 -1
- package/dist/cuminc-8d21132b.js +1 -0
- package/dist/{customdata.inputui-58cd9b32.js → customdata.inputui-40ba6d7f.js} +1 -1
- package/dist/{dataDownload-91da6dd6.js → dataDownload-bfa92dad.js} +1 -1
- package/dist/{databrowser.ui-c50862e4.js → databrowser.ui-4799f04d.js} +1 -1
- package/dist/{density-7c3f91eb.js → density-4c2b53f6.js} +1 -1
- package/dist/{dictionary-48a38837.js → dictionary-89e860ee.js} +1 -1
- package/dist/{drag-c354e2c6.js → drag-88d451b4.js} +1 -1
- package/dist/{e2pca-3bba91fa.js → e2pca-8a3f2566.js} +1 -1
- package/dist/{ep-144d8973.js → ep-5399c5cc.js} +1 -1
- package/dist/{fusion.parse-ae1253f4.js → fusion.parse-fc25e5bd.js} +1 -1
- package/dist/{geneExpClustering-96d09008.js → geneExpClustering-a916ebda.js} +1 -1
- package/dist/{geneExpression-d6494fd3.js → geneExpression-501e95c0.js} +1 -1
- package/dist/{geneExpression-9ca2da4f.js → geneExpression-9047481a.js} +1 -1
- package/dist/{geneExpression-be9b5da2.js → geneExpression-da4b50f0.js} +1 -1
- package/dist/{geneORA-85850143.js → geneORA-ffb2497e.js} +1 -1
- package/dist/{geneVariant-3df05e0c.js → geneVariant-7ab521d6.js} +1 -1
- package/dist/{geneVariant-3d674865.js → geneVariant-d79431a2.js} +1 -1
- package/dist/{genefusion.ui-3e2a3a73.js → genefusion.ui-3ce190c7.js} +1 -1
- package/dist/{geneset-3b761b2c.js → geneset-3522bcda.js} +1 -1
- package/dist/{genomeBrowser-2105a98f.js → genomeBrowser-9b72eb22.js} +1 -1
- package/dist/{genomeBrowser.controls-f9b9bf42.js → genomeBrowser.controls-bef8bf99.js} +1 -1
- package/dist/{groupsetting-4901d033.js → groupsetting-574ad150.js} +1 -1
- package/dist/{hierCluster-a7ff7f5a.js → hierCluster-3b14b2b3.js} +1 -1
- package/dist/{hierCluster.config-3d124abf.js → hierCluster.config-f8686a30.js} +1 -1
- package/dist/{hierCluster.interactivity-3463cc0b.js → hierCluster.interactivity-3b5f1e81.js} +1 -1
- package/dist/{hierCluster.renderers-668d0075.js → hierCluster.renderers-9f9a7cad.js} +1 -1
- package/dist/{html.legend-3e428f9e.js → html.legend-ef8066dd.js} +1 -1
- package/dist/{imagePlot-6d89200c.js → imagePlot-095b9a92.js} +1 -1
- package/dist/{lasso-393c1570.js → lasso-ef63631b.js} +1 -1
- package/dist/{launch.adhoc-9c59874e.js → launch.adhoc-1b356f97.js} +1 -1
- package/dist/{legacyDataset-26ead9cc.js → legacyDataset-056e9d4c.js} +1 -1
- package/dist/{log-4d74231e.js → log-ca1e2a74.js} +1 -1
- package/dist/{lollipop-59f65024.js → lollipop-6ad9ec3c.js} +1 -1
- package/dist/{maf-72e5b7da.js → maf-dfada1c8.js} +1 -1
- package/dist/{maftimeline-ed8aaae8.js → maftimeline-1b715a01.js} +1 -1
- package/dist/{matrix-3d09a31f.js → matrix-3fae58f8.js} +1 -1
- package/dist/matrix.cells-3620eb3a.js +1 -0
- package/dist/{matrix.cluster-acdfc6a7.js → matrix.cluster-15b8a865.js} +1 -1
- package/dist/{matrix.config-cd01ebbd.js → matrix.config-8247bea5.js} +1 -1
- package/dist/{matrix.controls-86eb8d5c.js → matrix.controls-dea65894.js} +1 -1
- package/dist/{matrix.data-e2d7ac16.js → matrix.data-121a1a8c.js} +1 -1
- package/dist/{matrix.dom-e5f91cc0.js → matrix.dom-83c5fa39.js} +1 -1
- package/dist/{matrix.groups-f1969b5c.js → matrix.groups-2e1202ef.js} +1 -1
- package/dist/{matrix.interactivity-92bc8332.js → matrix.interactivity-2b076155.js} +1 -1
- package/dist/{matrix.layout-29a8f334.js → matrix.layout-8dc54c05.js} +1 -1
- package/dist/{matrix.legend-8c28039e.js → matrix.legend-e0078739.js} +1 -1
- package/dist/matrix.renderers-0c8eddc9.js +1 -0
- package/dist/{matrix.serieses-e079f04a.js → matrix.serieses-2898da6b.js} +1 -1
- package/dist/{matrix.sort-e1f83454.js → matrix.sort-249d4a35.js} +1 -1
- package/dist/{matrix.sorterUi-2025f39d.js → matrix.sorterUi-d26208c8.js} +1 -1
- package/dist/{mavb-37fffd68.js → mavb-9a6fa2e9.js} +1 -1
- package/dist/{mds.fimo-68f0eaf5.js → mds.fimo-ce97371c.js} +1 -1
- package/dist/{mds.samplescatterplot-362f3591.js → mds.samplescatterplot-a54b9e93.js} +1 -1
- package/dist/{mds.survivalplot-f5bda05a.js → mds.survivalplot-c5093f73.js} +1 -1
- package/dist/{mdsjsonform-7f0b6cc7.js → mdsjsonform-09b4e1cb.js} +1 -1
- package/dist/metaboliteIntensity-eeb5ad12.js +1 -0
- package/dist/niceNumLabels-ddb76164.js +1 -0
- package/dist/{nodrag-777a34a5.js → nodrag-bed2488c.js} +1 -1
- package/dist/{numeric-2eb8c25b.js → numeric-d5536b1c.js} +1 -1
- package/dist/numeric.binary-d67da945.js +1 -0
- package/dist/numeric.continuous-9a0c88bc.js +1 -0
- package/dist/numeric.discrete-921f7097.js +1 -0
- package/dist/numeric.spline-649308d5.js +1 -0
- package/dist/{numeric.toggle-5316211b.js → numeric.toggle-52789fd2.js} +1 -1
- package/dist/{oncomatrix-cd9fa01b.js → oncomatrix-6950c48c.js} +1 -1
- package/dist/{parseData-1bfa9946.js → parseData-480d1ff3.js} +1 -1
- package/dist/{plot.2dvaf-1ed153c1.js → plot.2dvaf-1ecc4bbc.js} +1 -1
- package/dist/plot.app-c841507a.js +1 -0
- package/dist/{plot.barplot-61742e94.js → plot.barplot-24140b0f.js} +1 -1
- package/dist/{plot.boxplot-fe966ac3.js → plot.boxplot-87fe8ab2.js} +1 -1
- package/dist/{plot.brainImaging-d2c23bb7.js → plot.brainImaging-325ebded.js} +1 -1
- package/dist/{plot.disco-70d493f4.js → plot.disco-621d1b8e.js} +1 -1
- package/dist/{plot.dzi-14e6fdc4.js → plot.dzi-3a7e478e.js} +1 -1
- package/dist/{plot.ssgq-9d364d41.js → plot.ssgq-1949c207.js} +1 -1
- package/dist/{plot.vaf2cov-4d28015b.js → plot.vaf2cov-d03c6409.js} +1 -1
- package/dist/{profileBarchart-c104f8e2.js → profileBarchart-11755d7c.js} +1 -1
- package/dist/{profileHome-a555583d.js → profileHome-9c5e266b.js} +1 -1
- package/dist/{profilePlot-5ce5b6a0.js → profilePlot-8ee3034a.js} +1 -1
- package/dist/{profilePolar-610213d4.js → profilePolar-9fe70c32.js} +1 -1
- package/dist/{profileRadar-fddb18f7.js → profileRadar-0e744181.js} +1 -1
- package/dist/{profileRadarFacility-2c2db1dd.js → profileRadarFacility-102544c5.js} +1 -1
- package/dist/{recover-a08c8d01.js → recover-b1ec4fed.js} +1 -1
- package/dist/{regression.inputs-5718cf72.js → regression.inputs-ad548745.js} +1 -1
- package/dist/{regression.inputs.values.table-d587c1cf.js → regression.inputs.values.table-1618447a.js} +1 -1
- package/dist/{regression.results-748024be.js → regression.results-25008028.js} +1 -1
- package/dist/{renderPvalueTable-c435aefd.js → renderPvalueTable-46056189.js} +1 -1
- package/dist/sampleScatter-47dd82cb.js +1 -0
- package/dist/{sampleScatter.interactivity-e9c30652.js → sampleScatter.interactivity-cfa3451d.js} +1 -1
- package/dist/{sampleScatter.rendererThree-3e6c032e.js → sampleScatter.rendererThree-c5321d24.js} +2 -2
- package/dist/{sampleView-d6a91293.js → sampleView-30b97c7d.js} +1 -1
- package/dist/{samplelst-821ec148.js → samplelst-2bdc1b9d.js} +1 -1
- package/dist/{samplematrix-7aa0a780.js → samplematrix-4f0ec523.js} +1 -1
- package/dist/{scatter-2e2c76f4.js → scatter-8a337eeb.js} +1 -1
- package/dist/{selectGenomeWithTklst-51cd21a4.js → selectGenomeWithTklst-895106fb.js} +1 -1
- package/dist/{singleCellPlot-c7347a27.js → singleCellPlot-360eaec6.js} +1 -1
- package/dist/{singlecell-a668bb17.js → singlecell-29c1cbb1.js} +1 -1
- package/dist/{singlecell-7c851ef8.js → singlecell-75f8af89.js} +1 -1
- package/dist/{snplocus-fe6f4ba1.js → snplocus-0cafa73c.js} +1 -1
- package/dist/{snplst-751cea95.js → snplst-2284d5ce.js} +1 -1
- package/dist/{spliceevent.a53ss.diagram-b157f95d.js → spliceevent.a53ss.diagram-44ccabf9.js} +1 -1
- package/dist/{spliceevent.exonskip.diagram-071a3467.js → spliceevent.exonskip.diagram-c8d1bdf0.js} +1 -1
- package/dist/spliceevent.exonskip.getdefault-9fe16119.js +1 -0
- package/dist/{spliceevent.noeventdiagram-1c731f35.js → spliceevent.noeventdiagram-5e244090.js} +1 -1
- package/dist/{spliceevent.phrase-7a3bfb00.js → spliceevent.phrase-186eb050.js} +1 -1
- package/dist/{stattable-a7713026.js → stattable-886f7dad.js} +1 -1
- package/dist/{style.gdc-40ec2784.js → style.gdc-4ac9b96b.js} +1 -1
- package/dist/{summary-592d8f81.js → summary-ee2045a5.js} +1 -1
- package/dist/{sunburst-452df940.js → sunburst-bbff8818.js} +1 -1
- package/dist/survival-04e279f8.js +1 -0
- package/dist/{survival-450b6df4.js → survival-d7bd3c6b.js} +1 -1
- package/dist/{svg.download-56529955.js → svg.download-54c99186.js} +1 -1
- package/dist/{svg.legend-c82b153f.js → svg.legend-28652faa.js} +1 -1
- package/dist/{svgraph-3c5cd8d2.js → svgraph-a12d89da.js} +1 -1
- package/dist/{svmr-3dd531ef.js → svmr-248055c8.js} +1 -1
- package/dist/{table-d6c411fd.js → table-1dae543a.js} +1 -1
- package/dist/{table-bf604c50.js → table-b4a61573.js} +1 -1
- package/dist/{termInfo-96285f4a.js → termInfo-4c759483.js} +1 -1
- package/dist/{termsetting-9a7511e6.js → termsetting-636d2271.js} +1 -1
- package/dist/{tk-6a8e5bb0.js → tk-741d4674.js} +1 -1
- package/dist/{tp.ui-221efed6.js → tp.ui-23151bb1.js} +1 -1
- package/dist/{tvs.density-9fdae0cc.js → tvs.density-9fe0c7fd.js} +1 -1
- package/dist/{tvs.geneVariant-149e25b7.js → tvs.geneVariant-1b179327.js} +1 -1
- package/dist/tvs.numeric-b4cfc975.js +1 -0
- package/dist/{tvs.samplelst-a38e9c2b.js → tvs.samplelst-681358bc.js} +1 -1
- package/dist/{uiUtils-a6de7f14.js → uiUtils-74700a01.js} +1 -1
- package/dist/{variantBrowser-05375469.js → variantBrowser-910b4bcd.js} +1 -1
- package/dist/{vcf-58904308.js → vcf-16ba1e06.js} +1 -1
- package/dist/{violin-c1b78717.js → violin-a41b2e2b.js} +1 -1
- package/dist/{violin.interactivity-534d6993.js → violin.interactivity-bcf0ccc2.js} +1 -1
- package/dist/{violin.renderer-16540fb8.js → violin.renderer-149310eb.js} +1 -1
- package/dist/{violinRenderer-688abcb2.js → violinRenderer-71c9f3ab.js} +1 -1
- package/dist/{viridis-d3cf2713.js → viridis-81de7bcd.js} +1 -1
- package/dist/{y-2d48b9e4.js → y-76c7da8c.js} +1 -1
- package/dist/{zoom-2d4ede33.js → zoom-a40839cf.js} +1 -1
- package/package.json +7 -7
- package/dist/app-de19f41c.js +0 -1
- package/dist/block.lazyload-ebd949e4.js +0 -1
- package/dist/brainImaging-007edaa3.js +0 -1
- package/dist/cuminc-72257faf.js +0 -1
- package/dist/matrix.cells-a5157233.js +0 -1
- package/dist/matrix.renderers-3b8dfd04.js +0 -1
- package/dist/metaboliteIntensity-512257f3.js +0 -1
- package/dist/niceNumLabels-8fdc6507.js +0 -1
- package/dist/numeric.binary-0a3b17d2.js +0 -1
- package/dist/numeric.continuous-f77038de.js +0 -1
- package/dist/numeric.discrete-b977e88f.js +0 -1
- package/dist/numeric.spline-d64b1abe.js +0 -1
- package/dist/plot.app-91a1d78d.js +0 -1
- package/dist/sampleScatter-031f47de.js +0 -1
- package/dist/spliceevent.exonskip.getdefault-93feb627.js +0 -1
- package/dist/survival-6a4c4f12.js +0 -1
- package/dist/tvs.numeric-f9ce58bc.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{az as e,aD as t}from"./app-
|
|
1
|
+
import{az as e,aD as t}from"./app-71453429.js";import{c as i,a as n}from"./_commonjsHelpers-318dc0aa.js";var r=i((function(e){
|
|
2
2
|
//! openseadragon 4.1.1
|
|
3
3
|
//! Built on 2024-04-01
|
|
4
4
|
//! Git commit: v4.1.1-0-f90d9814
|
|
5
5
|
//! http://openseadragon.github.io
|
|
6
6
|
//! License: http://openseadragon.github.io/license/
|
|
7
|
-
function t(e){return new t.Viewer(e)}(function(e){e.version={versionStr:"4.1.1",major:parseInt("4",10),minor:parseInt("1",10),revision:parseInt("1",10)};var i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Promise]":"promise","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;e.isFunction=function(t){return e.type(t)==="function"};e.isArray=Array.isArray||function(t){return e.type(t)==="array"};e.isWindow=function(e){return e&&typeof e==="object"&&"setInterval"in e};e.type=function(e){return e===null||e===undefined?String(e):i[n.call(e)]||"object"};e.isPlainObject=function(i){if(!i||t.type(i)!=="object"||i.nodeType||e.isWindow(i)){return false}if(i.constructor&&!r.call(i,"constructor")&&!r.call(i.constructor.prototype,"isPrototypeOf")){return false}var n;for(var o in i){n=o}return n===undefined||r.call(i,n)};e.isEmptyObject=function(e){for(var t in e){return false}return true};e.freezeObject=function(t){if(Object.freeze){e.freezeObject=Object.freeze}else{e.freezeObject=function(e){return e}}return e.freezeObject(t)};e.supportsCanvas=function(){var t=document.createElement("canvas");return!!(e.isFunction(t.getContext)&&t.getContext("2d"))}();e.isCanvasTainted=function(e){var t=false;try{e.getContext("2d").getImageData(0,0,1,1)}catch(e){t=true}return t};e.supportsAddEventListener=function(){return!!(document.documentElement.addEventListener&&document.addEventListener)}();e.supportsRemoveEventListener=function(){return!!(document.documentElement.removeEventListener&&document.removeEventListener)}();e.supportsEventListenerOptions=function(){var t=0;if(e.supportsAddEventListener){try{var i={get capture(){t++;return false},get once(){t++;return false},get passive(){t++;return false}};window.addEventListener("test",null,i);window.removeEventListener("test",null,i)}catch(e){t=0}}return t>=3}();e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var t=document.createElement("canvas").getContext("2d");var i=window.devicePixelRatio||1;var n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return Math.max(i,1)/n}else{return 1}};e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(t);(function(e){e.extend=function(){var i,n,r,o,s,a,l=arguments[0]||{},h=arguments.length,u=false,c=1;if(typeof l==="boolean"){u=l;l=arguments[1]||{};c=2}if(typeof l!=="object"&&!t.isFunction(l)){l={}}if(h===c){l=this;--c}for(;c<h;c++){i=arguments[c];if(i!==null||i!==undefined){for(n in i){var d=Object.getOwnPropertyDescriptor(i,n);if(d!==undefined){if(d.get||d.set){Object.defineProperty(l,n,d);continue}o=d.value}else{e.console.warn('Could not copy inherited property "'+n+'".');continue}if(l===o){continue}if(u&&o&&(t.isPlainObject(o)||(s=t.isArray(o)))){r=l[n];if(s){s=false;a=r&&t.isArray(r)?r:[]}else{a=r&&t.isPlainObject(r)?r:{}}l[n]=t.extend(u,a,o)}else if(o!==undefined){l[n]=o}}}}return l};var i=function(){if(typeof navigator!=="object"){return false}var e=navigator.userAgent;if(typeof e!=="string"){return false}return e.indexOf("iPhone")!==-1||e.indexOf("iPad")!==-1||e.indexOf("iPod")!==-1};e.extend(e,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:false,ajaxWithCredentials:false,loadTilesWithAjax:false,ajaxHeaders:{},splitHashDataForPost:false,panHorizontal:true,panVertical:true,constrainDuringPan:false,wrapHorizontal:false,wrapVertical:false,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:false,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:true,scrollToZoom:true,clickToZoom:true,dblClickToZoom:false,dblClickDragToZoom:false,pinchToZoom:false,zoomToRefPoint:true,flickEnabled:false,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},gestureSettingsTouch:{dragToPan:true,scrollToZoom:false,clickToZoom:false,dblClickToZoom:true,dblClickDragToZoom:true,pinchToZoom:true,zoomToRefPoint:true,flickEnabled:true,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},gestureSettingsPen:{dragToPan:true,scrollToZoom:false,clickToZoom:true,dblClickToZoom:false,dblClickDragToZoom:false,pinchToZoom:false,zoomToRefPoint:true,flickEnabled:false,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},gestureSettingsUnknown:{dragToPan:true,scrollToZoom:false,clickToZoom:false,dblClickToZoom:true,dblClickDragToZoom:false,pinchToZoom:true,zoomToRefPoint:true,flickEnabled:true,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},zoomPerClick:2,zoomPerScroll:1.2,zoomPerDblClickDrag:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:false,autoHideControls:true,immediateRender:false,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:i(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:true,preserveImageSizeOnResize:false,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:true,sequenceControlAnchor:null,preserveViewport:false,preserveOverlays:false,navPrevNextWrap:false,showNavigationControl:true,navigationControlAnchor:null,showZoomControl:true,showHomeControl:true,showFullPageControl:true,showRotationControl:false,showFlipControl:false,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:true,showNavigator:false,navigatorElement:null,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:false,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:true,navigatorAutoFade:true,navigatorRotate:true,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:false,opacity:1,preload:false,compositeOperation:null,imageSmoothingEnabled:true,placeholderFillStyle:null,subPixelRoundingForTransparency:null,showReferenceStrip:false,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:false,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,useCanvas:true,tileRetryMax:0,tileRetryDelay:2500,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:false,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"],silenceMultiImageWarnings:false},SIGNAL:"----seadragon----",delegate:function(e,t){return function(){var i=arguments;if(i===undefined){i=[]}return t.apply(e,i)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},SUBPIXEL_ROUNDING_OCCURRENCES:{NEVER:0,ONLY_AT_REST:1,ALWAYS:2},_viewers:new Map,getViewer:function(t){return e._viewers.get(this.getElement(t))},getElement:function(e){if(typeof e==="string"){e=document.getElementById(e)}return e},getElementPosition:function(t){var i=new e.Point,n,r;t=e.getElement(t);n=e.getElementStyle(t).position==="fixed";r=s(t,n);while(r){i.x+=t.offsetLeft;i.y+=t.offsetTop;if(n){i=i.plus(e.getPageScroll())}t=r;n=e.getElementStyle(t).position==="fixed";r=s(t,n)}return i},getElementOffset:function(t){t=e.getElement(t);var i=t&&t.ownerDocument,n,r,o={top:0,left:0};if(!i){return new e.Point}n=i.documentElement;if(typeof t.getBoundingClientRect!==typeof undefined){o=t.getBoundingClientRect()}r=i===i.window?i:i.nodeType===9?i.defaultView||i.parentWindow:false;return new e.Point(o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0),o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0))},getElementSize:function(t){t=e.getElement(t);return new e.Point(t.clientWidth,t.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(t){t=e.getElement(t);return t.currentStyle}:function(t){t=e.getElement(t);return window.getComputedStyle(t,"")},getCssPropertyWithVendorPrefix:function(t){var i={};e.getCssPropertyWithVendorPrefix=function(t){if(i[t]!==undefined){return i[t]}var n=document.createElement("div").style;var r=null;if(n[t]!==undefined){r=t}else{var o=["Webkit","Moz","MS","O","webkit","moz","ms","o"];var s=e.capitalizeFirstLetter(t);for(var a=0;a<o.length;a++){var l=o[a]+s;if(n[l]!==undefined){r=l;break}}}i[t]=r;return r};return e.getCssPropertyWithVendorPrefix(t)},capitalizeFirstLetter:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},positiveModulo:function(e,t){var i=e%t;if(i<0){i+=t}return i},pointInElement:function(t,i){t=e.getElement(t);var n=e.getElementOffset(t),r=e.getElementSize(t);return i.x>=n.x&&i.x<n.x+r.x&&i.y<n.y+r.y&&i.y>=n.y},getMousePosition:function(t){if(typeof t.pageX==="number"){e.getMousePosition=function(t){var i=new e.Point;i.x=t.pageX;i.y=t.pageY;return i}}else if(typeof t.clientX==="number"){e.getMousePosition=function(t){var i=new e.Point;i.x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;i.y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop;return i}}else{throw new Error("Unknown event mouse position, no known technique.")}return e.getMousePosition(t)},getPageScroll:function(){var t=document.documentElement||{},i=document.body||{};if(typeof window.pageXOffset==="number"){e.getPageScroll=function(){return new e.Point(window.pageXOffset,window.pageYOffset)}}else if(i.scrollLeft||i.scrollTop){e.getPageScroll=function(){return new e.Point(document.body.scrollLeft,document.body.scrollTop)}}else if(t.scrollLeft||t.scrollTop){e.getPageScroll=function(){return new e.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}else{return new e.Point(0,0)}return e.getPageScroll()},setPageScroll:function(t){if(typeof window.scrollTo!=="undefined"){e.setPageScroll=function(e){window.scrollTo(e.x,e.y)}}else{var i=e.getPageScroll();if(i.x===t.x&&i.y===t.y){return}document.body.scrollLeft=t.x;document.body.scrollTop=t.y;var n=e.getPageScroll();if(n.x!==i.x&&n.y!==i.y){e.setPageScroll=function(e){document.body.scrollLeft=e.x;document.body.scrollTop=e.y};return}document.documentElement.scrollLeft=t.x;document.documentElement.scrollTop=t.y;n=e.getPageScroll();if(n.x!==i.x&&n.y!==i.y){e.setPageScroll=function(e){document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y};return}e.setPageScroll=function(e){}}e.setPageScroll(t)},getWindowSize:function(){var t=document.documentElement||{},i=document.body||{};if(typeof window.innerWidth==="number"){e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)}}else if(t.clientWidth||t.clientHeight){e.getWindowSize=function(){return new e.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)}}else if(i.clientWidth||i.clientHeight){e.getWindowSize=function(){return new e.Point(document.body.clientWidth,document.body.clientHeight)}}else{throw new Error("Unknown window size, no known technique.")}return e.getWindowSize()},makeCenteredNode:function(t){t=e.getElement(t);var i=[e.makeNeutralElement("div"),e.makeNeutralElement("div"),e.makeNeutralElement("div")];e.extend(i[0].style,{display:"table",height:"100%",width:"100%"});e.extend(i[1].style,{display:"table-row"});e.extend(i[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"});i[0].appendChild(i[1]);i[1].appendChild(i[2]);i[2].appendChild(t);return i[0]},makeNeutralElement:function(e){var t=document.createElement(e),i=t.style;i.background="transparent none";i.border="none";i.margin="0px";i.padding="0px";i.position="static";return t},now:function(){if(Date.now){e.now=Date.now}else{e.now=function(){return(new Date).getTime()}}return e.now()},makeTransparentImage:function(t){var i=e.makeNeutralElement("img");i.src=t;return i},setElementOpacity:function(t,i,n){var r,o;t=e.getElement(t);if(n&&!e.Browser.alpha){i=Math.round(i)}if(e.Browser.opacity){t.style.opacity=i<1?i:""}else{if(i<1){r=Math.round(100*i);o="alpha(opacity="+r+")";t.style.filter=o}else{t.style.filter=""}}},setElementTouchActionNone:function(t){t=e.getElement(t);if(typeof t.style.touchAction!=="undefined"){t.style.touchAction="none"}else if(typeof t.style.msTouchAction!=="undefined"){t.style.msTouchAction="none"}},setElementPointerEvents:function(t,i){t=e.getElement(t);if(typeof t.style!=="undefined"&&typeof t.style.pointerEvents!=="undefined"){t.style.pointerEvents=i}},setElementPointerEventsNone:function(t){e.setElementPointerEvents(t,"none")},addClass:function(t,i){t=e.getElement(t);if(!t.className){t.className=i}else if((" "+t.className+" ").indexOf(" "+i+" ")===-1){t.className+=" "+i}},indexOf:function(e,t,i){if(Array.prototype.indexOf){this.indexOf=function(e,t,i){return e.indexOf(t,i)}}else{this.indexOf=function(e,t,i){var n,r=i?i:0,o;if(!e){throw new TypeError}o=e.length;if(o===0||r>=o){return-1}if(r<0){r=o-Math.abs(r)}for(n=r;n<o;n++){if(e[n]===t){return n}}return-1}}return this.indexOf(e,t,i)},removeClass:function(t,i){var n,r=[],o;t=e.getElement(t);n=t.className.split(/\s+/);for(o=0;o<n.length;o++){if(n[o]&&n[o]!==i){r.push(n[o])}}t.className=r.join(" ")},normalizeEventListenerOptions:function(t){var i;if(typeof t!=="undefined"){if(typeof t==="boolean"){i=e.supportsEventListenerOptions?{capture:t}:t}else{i=e.supportsEventListenerOptions?t:typeof t.capture!=="undefined"?t.capture:false}}else{i=e.supportsEventListenerOptions?{capture:false}:false}return i},addEvent:function(){if(e.supportsAddEventListener){return function(t,i,n,r){r=e.normalizeEventListenerOptions(r);t=e.getElement(t);t.addEventListener(i,n,r)}}else if(document.documentElement.attachEvent&&document.attachEvent){return function(t,i,n){t=e.getElement(t);t.attachEvent("on"+i,n)}}else{throw new Error("No known event model.")}}(),removeEvent:function(){if(e.supportsRemoveEventListener){return function(t,i,n,r){r=e.normalizeEventListenerOptions(r);t=e.getElement(t);t.removeEventListener(i,n,r)}}else if(document.documentElement.detachEvent&&document.detachEvent){return function(t,i,n){t=e.getElement(t);t.detachEvent("on"+i,n)}}else{throw new Error("No known event model.")}}(),cancelEvent:function(e){e.preventDefault()},eventIsCanceled:function(e){return e.defaultPrevented},stopEvent:function(e){e.stopPropagation()},createCallback:function(e,t){var i=[],n;for(n=2;n<arguments.length;n++){i.push(arguments[n])}return function(){var n=i.concat([]),r;for(r=0;r<arguments.length;r++){n.push(arguments[r])}return t.apply(e,n)}},getUrlParameter:function(e){var t=o[e];return t?t:null},getUrlProtocol:function(e){var t=e.match(/^([a-z]+:)\/\//i);if(t===null){return window.location.protocol}return t[1].toLowerCase()},createAjaxRequest:function(t){var i;try{i=!!new ActiveXObject("Microsoft.XMLHTTP")}catch(e){i=false}if(i){if(window.XMLHttpRequest){e.createAjaxRequest=function(e){if(e){return new ActiveXObject("Microsoft.XMLHTTP")}return new XMLHttpRequest}}else{e.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}}else if(window.XMLHttpRequest){e.createAjaxRequest=function(){return new XMLHttpRequest}}else{throw new Error("Browser doesn't support XMLHttpRequest.")}return e.createAjaxRequest(t)},makeAjaxRequest:function(t,i,n){var r;var o;var s;var a;if(e.isPlainObject(t)){i=t.success;n=t.error;r=t.withCredentials;o=t.headers;s=t.responseType||null;a=t.postData||null;t=t.url}var l=e.getUrlProtocol(t);var h=e.createAjaxRequest(l==="file:");if(!e.isFunction(i)){throw new Error("makeAjaxRequest requires a success callback")}h.onreadystatechange=function(){if(h.readyState===4){h.onreadystatechange=function(){};if(h.status>=200&&h.status<300||h.status===0&&l!=="http:"&&l!=="https:"){i(h)}else{if(e.isFunction(n)){n(h)}else{e.console.error("AJAX request returned %d: %s",h.status,t)}}}};var u=a?"POST":"GET";try{h.open(u,t,true);if(s){h.responseType=s}if(o){for(var c in o){if(Object.prototype.hasOwnProperty.call(o,c)&&o[c]){h.setRequestHeader(c,o[c])}}}if(r){h.withCredentials=true}h.send(a)}catch(t){e.console.error("%s while making AJAX request: %s",t.name,t.message);h.onreadystatechange=function(){};if(e.isFunction(n)){n(h,t)}}return h},jsonp:function(t){var i,n=t.url,r=document.head||document.getElementsByTagName("head")[0]||document.documentElement,o=t.callbackName||"openseadragon"+e.now(),s=window[o],a="$1"+o+"$2",l=t.param||"callback",h=t.callback;n=n.replace(/(=)\?(&|$)|\?\?/i,a);n+=(/\?/.test(n)?"&":"?")+l+"="+o;window[o]=function(t){if(!s){try{delete window[o]}catch(e){}}else{window[o]=s}if(h&&e.isFunction(h)){h(t)}};i=document.createElement("script");if(undefined!==t.async||false!==t.async){i.async="async"}if(t.scriptCharset){i.charset=t.scriptCharset}i.src=n;i.onload=i.onreadystatechange=function(e,t){if(t||!i.readyState||/loaded|complete/.test(i.readyState)){i.onload=i.onreadystatechange=null;if(r&&i.parentNode){r.removeChild(i)}i=undefined}};r.insertBefore(i,r.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(t){if(window.DOMParser){e.parseXml=function(e){var t=null,i;i=new DOMParser;t=i.parseFromString(e,"text/xml");return t}}else if(window.ActiveXObject){e.parseXml=function(e){var t=null;t=new ActiveXObject("Microsoft.XMLDOM");t.async=false;t.loadXML(e);return t}}else{throw new Error("Browser doesn't support XML DOM.")}return e.parseXml(t)},parseJSON:function(t){e.parseJSON=window.JSON.parse;return e.parseJSON(t)},imageFormatSupported:function(e){e=e?e:"";return!!r[e.toLowerCase()]},setImageFormatsSupported:function(t){e.extend(r,t)}});var n=function(e){};e.console=window.console||{log:n,debug:n,info:n,warn:n,error:n,assert:n};e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:true};var r={bmp:false,jpeg:true,jpg:true,png:true,tif:false,wdp:false},o={};(function(){var t=navigator.appVersion,i=navigator.userAgent,n;switch(navigator.appName){case"Microsoft Internet Explorer":if(!!window.attachEvent&&!!window.ActiveXObject){e.Browser.vendor=e.BROWSERS.IE;e.Browser.version=parseFloat(i.substring(i.indexOf("MSIE")+5,i.indexOf(";",i.indexOf("MSIE"))))}break;case"Netscape":if(window.addEventListener){if(i.indexOf("Edge")>=0){e.Browser.vendor=e.BROWSERS.EDGE;e.Browser.version=parseFloat(i.substring(i.indexOf("Edge")+5))}else if(i.indexOf("Edg")>=0){e.Browser.vendor=e.BROWSERS.CHROMEEDGE;e.Browser.version=parseFloat(i.substring(i.indexOf("Edg")+4))}else if(i.indexOf("Firefox")>=0){e.Browser.vendor=e.BROWSERS.FIREFOX;e.Browser.version=parseFloat(i.substring(i.indexOf("Firefox")+8))}else if(i.indexOf("Safari")>=0){e.Browser.vendor=i.indexOf("Chrome")>=0?e.BROWSERS.CHROME:e.BROWSERS.SAFARI;e.Browser.version=parseFloat(i.substring(i.substring(0,i.indexOf("Safari")).lastIndexOf("/")+1,i.indexOf("Safari")))}else{n=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})");if(n.exec(i)!==null){e.Browser.vendor=e.BROWSERS.IE;e.Browser.version=parseFloat(RegExp.$1)}}}break;case"Opera":e.Browser.vendor=e.BROWSERS.OPERA;e.Browser.version=parseFloat(t);break}var r=window.location.search.substring(1),s=r.split("&"),a,l,h;for(h=0;h<s.length;h++){a=s[h];l=a.indexOf("=");if(l>0){var u=a.substring(0,l),c=a.substring(l+1);try{o[u]=decodeURIComponent(c)}catch(t){e.console.error("Ignoring malformed URL parameter: %s=%s",u,c)}}}e.Browser.alpha=!(e.Browser.vendor===e.BROWSERS.CHROME&&e.Browser.version<2);e.Browser.opacity=true;if(e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<11){e.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")}})();(function(t){var i=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame;var n=t.cancelAnimationFrame||t.mozCancelAnimationFrame||t.webkitCancelAnimationFrame||t.msCancelAnimationFrame;if(i&&n){e.requestAnimationFrame=function(){return i.apply(t,arguments)};e.cancelAnimationFrame=function(){return n.apply(t,arguments)}}else{var r=[],o=[],s=0,a;e.requestAnimationFrame=function(t){r.push([++s,t]);if(!a){a=setInterval((function(){if(r.length){var t=e.now();var i=o;o=r;r=i;while(o.length){o.shift()[1](t)}}else{clearInterval(a);a=undefined}}),1e3/50)}return s};e.cancelAnimationFrame=function(e){var t,i;for(t=0,i=r.length;t<i;t+=1){if(r[t][0]===e){r.splice(t,1);return}}for(t=0,i=o.length;t<i;t+=1){if(o[t][0]===e){o.splice(t,1);return}}}}})(window);function s(e,t){if(t&&e!==document.body){return document.body}else{return e.offsetParent}}})(t);(function(t,i){if(e.exports){e.exports=i()}else{t.OpenSeadragon=i()}})(n,(function(){return t}));(function(e){var t={supportsFullScreen:false,isFullScreen:function(){return false},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""};if(document.exitFullscreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.fullscreenElement};t.requestFullScreen=function(e){return e.requestFullscreen()};t.exitFullScreen=function(){document.exitFullscreen()};t.fullScreenEventName="fullscreenchange";t.fullScreenErrorEventName="fullscreenerror"}else if(document.msExitFullscreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.msFullscreenElement};t.requestFullScreen=function(e){return e.msRequestFullscreen()};t.exitFullScreen=function(){document.msExitFullscreen()};t.fullScreenEventName="MSFullscreenChange";t.fullScreenErrorEventName="MSFullscreenError"}else if(document.webkitExitFullscreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.webkitFullscreenElement};t.requestFullScreen=function(e){return e.webkitRequestFullscreen()};t.exitFullScreen=function(){document.webkitExitFullscreen()};t.fullScreenEventName="webkitfullscreenchange";t.fullScreenErrorEventName="webkitfullscreenerror"}else if(document.webkitCancelFullScreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement};t.requestFullScreen=function(e){return e.webkitRequestFullScreen()};t.exitFullScreen=function(){document.webkitCancelFullScreen()};t.fullScreenEventName="webkitfullscreenchange";t.fullScreenErrorEventName="webkitfullscreenerror"}else if(document.mozCancelFullScreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.mozFullScreenElement};t.requestFullScreen=function(e){return e.mozRequestFullScreen()};t.exitFullScreen=function(){document.mozCancelFullScreen()};t.fullScreenEventName="mozfullscreenchange";t.fullScreenErrorEventName="mozfullscreenerror"}t.isFullScreen=function(){return t.getFullScreenElement()!==null};t.cancelFullScreen=function(){e.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead.");t.exitFullScreen()};e.extend(e,t)})(t);(function(e){e.EventSource=function(){this.events={}};e.EventSource.prototype={addOnceHandler:function(e,t,i,n,r){var o=this;n=n||1;var s=0;var a=function(i){s++;if(s===n){o.removeHandler(e,a)}return t(i)};this.addHandler(e,a,i,r)},addHandler:function(t,i,n,r){var o=this.events[t];if(!o){this.events[t]=o=[]}if(i&&e.isFunction(i)){var s=o.length,a={handler:i,userData:n||null,priority:r||0};o[s]=a;while(s>0&&o[s-1].priority<o[s].priority){o[s]=o[s-1];o[s-1]=a;s--}}},removeHandler:function(t,i){var n=this.events[t],r=[],o;if(!n){return}if(e.isArray(n)){for(o=0;o<n.length;o++){if(n[o].handler!==i){r.push(n[o])}}this.events[t]=r}},numberOfHandlers:function(e){var t=this.events[e];if(!t){return 0}return t.length},removeAllHandlers:function(e){if(e){this.events[e]=[]}else{for(var t in this.events){this.events[t]=[]}}},getHandler:function(e){var t=this.events[e];if(!t||!t.length){return null}t=t.length===1?[t[0]]:Array.apply(null,t);return function(e,i){var n,r=t.length;for(n=0;n<r;n++){if(t[n]){i.eventSource=e;i.userData=t[n].userData;t[n].handler(i)}}}},raiseEvent:function(e,t){var i=this.getHandler(e);if(i){return i(this,t||{})}return undefined}}})(t);(function(e){var t={};e.MouseTracker=function(i){var n=arguments;if(!e.isPlainObject(i)){i={element:n[0],clickTimeThreshold:n[1],clickDistThreshold:n[2]}}this.hash=Math.random();this.element=e.getElement(i.element);this.clickTimeThreshold=i.clickTimeThreshold||e.DEFAULT_SETTINGS.clickTimeThreshold;this.clickDistThreshold=i.clickDistThreshold||e.DEFAULT_SETTINGS.clickDistThreshold;this.dblClickTimeThreshold=i.dblClickTimeThreshold||e.DEFAULT_SETTINGS.dblClickTimeThreshold;this.dblClickDistThreshold=i.dblClickDistThreshold||e.DEFAULT_SETTINGS.dblClickDistThreshold;this.userData=i.userData||null;this.stopDelay=i.stopDelay||50;this.preProcessEventHandler=i.preProcessEventHandler||null;this.contextMenuHandler=i.contextMenuHandler||null;this.enterHandler=i.enterHandler||null;this.leaveHandler=i.leaveHandler||null;this.exitHandler=i.exitHandler||null;this.overHandler=i.overHandler||null;this.outHandler=i.outHandler||null;this.pressHandler=i.pressHandler||null;this.nonPrimaryPressHandler=i.nonPrimaryPressHandler||null;this.releaseHandler=i.releaseHandler||null;this.nonPrimaryReleaseHandler=i.nonPrimaryReleaseHandler||null;this.moveHandler=i.moveHandler||null;this.scrollHandler=i.scrollHandler||null;this.clickHandler=i.clickHandler||null;this.dblClickHandler=i.dblClickHandler||null;this.dragHandler=i.dragHandler||null;this.dragEndHandler=i.dragEndHandler||null;this.pinchHandler=i.pinchHandler||null;this.stopHandler=i.stopHandler||null;this.keyDownHandler=i.keyDownHandler||null;this.keyUpHandler=i.keyUpHandler||null;this.keyHandler=i.keyHandler||null;this.focusHandler=i.focusHandler||null;this.blurHandler=i.blurHandler||null;var r=this;t[this.hash]={click:function(e){m(r,e)},dblclick:function(e){y(r,e)},keydown:function(e){w(r,e)},keyup:function(e){T(r,e)},keypress:function(e){x(r,e)},focus:function(e){S(r,e)},blur:function(e){E(r,e)},contextmenu:function(e){P(r,e)},wheel:function(e){_(r,e)},mousewheel:function(e){R(r,e)},DOMMouseScroll:function(e){R(r,e)},MozMousePixelScroll:function(e){R(r,e)},losecapture:function(e){C(r,e)},mouseenter:function(e){F(r,e)},mouseleave:function(e){M(r,e)},mouseover:function(e){N(r,e)},mouseout:function(e){A(r,e)},mousedown:function(e){W(r,e)},mouseup:function(e){U(r,e)},mousemove:function(e){G(r,e)},touchstart:function(e){D(r,e)},touchend:function(e){I(r,e)},touchmove:function(e){k(r,e)},touchcancel:function(e){O(r,e)},gesturestart:function(e){H(r,e)},gesturechange:function(e){z(r,e)},gotpointercapture:function(e){B(r,e)},lostpointercapture:function(e){L(r,e)},pointerenter:function(e){F(r,e)},pointerleave:function(e){M(r,e)},pointerover:function(e){N(r,e)},pointerout:function(e){A(r,e)},pointerdown:function(e){W(r,e)},pointerup:function(e){U(r,e)},pointermove:function(e){G(r,e)},pointercancel:function(e){X(r,e)},pointerupcaptured:function(e){V(r,e)},pointermovecaptured:function(e){q(r,e)},tracking:false,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:false};this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler);this.hasScrollHandler=!!this.scrollHandler;if(e.MouseTracker.havePointerEvents){e.setElementPointerEvents(this.element,"auto")}if(this.exitHandler){e.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead.")}if(!i.startDisabled){this.setTracking(true)}};e.MouseTracker.prototype={destroy:function(){s(this);this.element=null;t[this.hash]=null;delete t[this.hash]},isTracking:function(){return t[this.hash].tracking},setTracking:function(e){if(e){o(this)}else{s(this)}return this},getActivePointersListByType:function(i){var n=t[this.hash],r,o=n.activePointersLists.length,s;for(r=0;r<o;r++){if(n.activePointersLists[r].type===i){return n.activePointersLists[r]}}s=new e.MouseTracker.GesturePointList(i);n.activePointersLists.push(s);return s},getActivePointerCount:function(){var e=t[this.hash],i,n=e.activePointersLists.length,r=0;for(i=0;i<n;i++){r+=e.activePointersLists[i].getLength()}return r},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};var i=function(){try{return window.self!==window.top}catch(e){return true}}();function n(e){try{return e.addEventListener&&e.removeEventListener}catch(e){return false}}e.MouseTracker.gesturePointVelocityTracker=function(){var t=[],i=0,n=0;var r=function(e,t){return e.hash.toString()+t.type+t.id.toString()};var o=function(){var i,r=t.length,o,s,a=e.now(),l,h,u;l=a-n;n=a;for(i=0;i<r;i++){o=t[i];s=o.gPoint;s.direction=Math.atan2(s.currentPos.y-o.lastPos.y,s.currentPos.x-o.lastPos.x);h=o.lastPos.distanceTo(s.currentPos);o.lastPos=s.currentPos;u=1e3*h/(l+1);s.speed=.75*u+.25*s.speed}};var s=function(s,a){var l=r(s,a);t.push({guid:l,gPoint:a,lastPos:a.currentPos});if(t.length===1){n=e.now();i=window.setInterval(o,50)}};var a=function(e,n){var o=r(e,n),s,a=t.length;for(s=0;s<a;s++){if(t[s].guid===o){t.splice(s,1);a--;if(a===0){window.clearInterval(i)}break}}};return{addPoint:s,removePoint:a}}();e.MouseTracker.captureElement=document;e.MouseTracker.wheelEventName=e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version>8||"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==undefined?"mousewheel":"DOMMouseScroll";e.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",e.MouseTracker.wheelEventName];if(e.MouseTracker.wheelEventName==="DOMMouseScroll"){e.MouseTracker.subscribeEvents.push("MozMousePixelScroll")}if(window.PointerEvent){e.MouseTracker.havePointerEvents=true;e.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel");e.MouseTracker.havePointerCapture=function(){var t=document.createElement("div");return e.isFunction(t.setPointerCapture)&&e.isFunction(t.releasePointerCapture)}();if(e.MouseTracker.havePointerCapture){e.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")}}else{e.MouseTracker.havePointerEvents=false;e.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove");e.MouseTracker.mousePointerId="legacy-mouse";e.MouseTracker.havePointerCapture=function(){var t=document.createElement("div");return e.isFunction(t.setCapture)&&e.isFunction(t.releaseCapture)}();if(e.MouseTracker.havePointerCapture){e.MouseTracker.subscribeEvents.push("losecapture")}if("ontouchstart"in window){e.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel")}if("ongesturestart"in window){e.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")}}e.MouseTracker.GesturePointList=function(e){this._gPoints=[];this.type=e;this.buttons=0;this.contacts=0;this.clicks=0;this.captureCount=0};e.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(e){return this._gPoints.push(e)},removeById:function(e){var t,i=this._gPoints.length;for(t=0;t<i;t++){if(this._gPoints[t].id===e){this._gPoints.splice(t,1);break}}return this._gPoints.length},getByIndex:function(e){if(e<this._gPoints.length){return this._gPoints[e]}return null},getById:function(e){var t,i=this._gPoints.length;for(t=0;t<i;t++){if(this._gPoints[t].id===e){return this._gPoints[t]}}return null},getPrimary:function(e){var t,i=this._gPoints.length;for(t=0;t<i;t++){if(this._gPoints[t].isPrimary){return this._gPoints[t]}}return null},addContact:function(){++this.contacts;if(this.contacts>1&&(this.type==="mouse"||this.type==="pen")){e.console.warn("GesturePointList.addContact() Implausible contacts value");this.contacts=1}},removeContact:function(){--this.contacts;if(this.contacts<0){this.contacts=0}}};function r(e){var i=t[e.hash],n,r,o,s,a,l=i.activePointersLists.length;for(n=0;n<l;n++){o=i.activePointersLists[n];if(o.getLength()>0){a=[];s=o.asArray();for(r=0;r<s.length;r++){a.push(s[r])}for(r=0;r<a.length;r++){K(e,o,a[r])}}}for(n=0;n<l;n++){i.activePointersLists.pop()}i.sentDragEvent=false}function o(i){var n=t[i.hash],o,s;if(!n.tracking){for(s=0;s<e.MouseTracker.subscribeEvents.length;s++){o=e.MouseTracker.subscribeEvents[s];e.addEvent(i.element,o,n[o],o===e.MouseTracker.wheelEventName?{passive:false,capture:false}:false)}r(i);n.tracking=true}}function s(i){var n=t[i.hash],o,s;if(n.tracking){for(s=0;s<e.MouseTracker.subscribeEvents.length;s++){o=e.MouseTracker.subscribeEvents[s];e.removeEvent(i.element,o,n[o],false)}r(i);n.tracking=false}}function a(e,i){var n=t[e.hash];if(i==="pointerevent"){return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured}}else if(i==="mouse"){return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured}}else if(i==="touch"){return{upName:"touchend",upHandler:n.touchendcaptured,moveName:"touchmove",moveHandler:n.touchmovecaptured}}else{throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}}function l(t,r){var o;if(e.MouseTracker.havePointerCapture){if(e.MouseTracker.havePointerEvents){try{t.element.setPointerCapture(r.id)}catch(t){e.console.warn("setPointerCapture() called on invalid pointer ID");return}}else{t.element.setCapture(true)}}else{o=a(t,e.MouseTracker.havePointerEvents?"pointerevent":r.type);if(i&&n(window.top)){e.addEvent(window.top,o.upName,o.upHandler,true)}e.addEvent(e.MouseTracker.captureElement,o.upName,o.upHandler,true);e.addEvent(e.MouseTracker.captureElement,o.moveName,o.moveHandler,true)}J(t,r,true)}function h(t,r){var o;var s;var l;if(e.MouseTracker.havePointerCapture){if(e.MouseTracker.havePointerEvents){s=t.getActivePointersListByType(r.type);l=s.getById(r.id);if(!l||!l.captured){return}try{t.element.releasePointerCapture(r.id)}catch(e){}}else{t.element.releaseCapture()}}else{o=a(t,e.MouseTracker.havePointerEvents?"pointerevent":r.type);if(i&&n(window.top)){e.removeEvent(window.top,o.upName,o.upHandler,true)}e.removeEvent(e.MouseTracker.captureElement,o.moveName,o.moveHandler,true);e.removeEvent(e.MouseTracker.captureElement,o.upName,o.upHandler,true)}J(t,r,false)}function u(t){return e.MouseTracker.havePointerEvents?t.pointerId:e.MouseTracker.mousePointerId}function c(t){if(e.MouseTracker.havePointerEvents){return t.pointerType||(e.Browser.vendor===e.BROWSERS.IE?"mouse":"")}else{return"mouse"}}function d(t){return e.MouseTracker.havePointerEvents?t.isPrimary:true}function p(t){return e.getMousePosition(t)}function f(e,t){return g(p(e),t)}function g(t,i){var n=e.getElementOffset(i);return t.minus(n)}function v(t,i){return new e.Point((t.x+i.x)/2,(t.y+i.y)/2)}function m(t,i){var n={originalEvent:i,eventType:"click",pointerType:"mouse",isEmulated:false};$(t,n);if(n.preventDefault&&!n.defaultPrevented){e.cancelEvent(i)}if(n.stopPropagation){e.stopEvent(i)}}function y(t,i){var n={originalEvent:i,eventType:"dblclick",pointerType:"mouse",isEmulated:false};$(t,n);if(n.preventDefault&&!n.defaultPrevented){e.cancelEvent(i)}if(n.stopPropagation){e.stopEvent(i)}}function w(t,i){var n=null;var r={originalEvent:i,eventType:"keydown",pointerType:"",isEmulated:false};$(t,r);if(t.keyDownHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.keyDownHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function T(t,i){var n=null;var r={originalEvent:i,eventType:"keyup",pointerType:"",isEmulated:false};$(t,r);if(t.keyUpHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.keyUpHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function x(t,i){var n=null;var r={originalEvent:i,eventType:"keypress",pointerType:"",isEmulated:false};$(t,r);if(t.keyHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.keyHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function S(e,t){var i={originalEvent:t,eventType:"focus",pointerType:"",isEmulated:false};$(e,i);if(e.focusHandler&&!i.preventGesture){e.focusHandler({eventSource:e,originalEvent:t,userData:e.userData})}}function E(e,t){var i={originalEvent:t,eventType:"blur",pointerType:"",isEmulated:false};$(e,i);if(e.blurHandler&&!i.preventGesture){e.blurHandler({eventSource:e,originalEvent:t,userData:e.userData})}}function P(t,i){var n=null;var r={originalEvent:i,eventType:"contextmenu",pointerType:"mouse",isEmulated:false};$(t,r);if(t.contextMenuHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,position:g(p(i),t.element),originalEvent:r.originalEvent,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.contextMenuHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function _(e,t){b(e,t,t)}function R(t,i){var n={target:i.target||i.srcElement,type:"wheel",shiftKey:i.shiftKey||false,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX?i.pageX:i.clientX,pageY:i.pageY?i.pageY:i.clientY,deltaMode:i.type==="MozMousePixelScroll"?0:1,deltaX:0,deltaZ:0};if(e.MouseTracker.wheelEventName==="mousewheel"){n.deltaY=-i.wheelDelta/e.DEFAULT_SETTINGS.pixelsPerWheelLine}else{n.deltaY=i.detail}b(t,n,i)}function b(t,i,n){var r=0,o;var s=null;r=i.deltaY<0?1:-1;o={originalEvent:i,eventType:"wheel",pointerType:"mouse",isEmulated:i!==n};$(t,o);if(t.scrollHandler&&!o.preventGesture&&!o.defaultPrevented){s={eventSource:t,pointerType:"mouse",position:f(i,t.element),scroll:r,shift:i.shiftKey,isTouchEvent:false,originalEvent:n,preventDefault:o.preventDefault||o.defaultPrevented,userData:t.userData};t.scrollHandler(s)}if(o.stopPropagation){e.stopEvent(n)}if(s&&s.preventDefault||o.preventDefault&&!o.defaultPrevented){e.cancelEvent(n)}}function C(t,i){var n={id:e.MouseTracker.mousePointerId,type:"mouse"};var r={originalEvent:i,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:false};$(t,r);if(i.target===t.element){J(t,n,false)}if(r.stopPropagation){e.stopEvent(i)}}function D(t,i){var n,r,o=i.changedTouches.length,s,a=t.getActivePointersListByType("touch");n=e.now();if(a.getLength()>i.touches.length-o){e.console.warn("Tracked touch contact count doesn't match event.touches.length")}var l={originalEvent:i,eventType:"pointerdown",pointerType:"touch",isEmulated:false};$(t,l);for(r=0;r<o;r++){s={id:i.changedTouches[r].identifier,type:"touch",isPrimary:a.getLength()===0,currentPos:p(i.changedTouches[r]),currentTime:n};ee(t,l,s);re(t,l,s,0);J(t,s,true)}if(l.preventDefault&&!l.defaultPrevented){e.cancelEvent(i)}if(l.stopPropagation){e.stopEvent(i)}}function I(t,i){var n,r,o=i.changedTouches.length,s;n=e.now();var a={originalEvent:i,eventType:"pointerup",pointerType:"touch",isEmulated:false};$(t,a);for(r=0;r<o;r++){s={id:i.changedTouches[r].identifier,type:"touch",currentPos:p(i.changedTouches[r]),currentTime:n};oe(t,a,s,0);J(t,s,false);te(t,a,s)}if(a.preventDefault&&!a.defaultPrevented){e.cancelEvent(i)}if(a.stopPropagation){e.stopEvent(i)}}function k(t,i){var n,r,o=i.changedTouches.length,s;n=e.now();var a={originalEvent:i,eventType:"pointermove",pointerType:"touch",isEmulated:false};$(t,a);for(r=0;r<o;r++){s={id:i.changedTouches[r].identifier,type:"touch",currentPos:p(i.changedTouches[r]),currentTime:n};se(t,a,s)}if(a.preventDefault&&!a.defaultPrevented){e.cancelEvent(i)}if(a.stopPropagation){e.stopEvent(i)}}function O(t,i){var n=i.changedTouches.length,r,o;var s={originalEvent:i,eventType:"pointercancel",pointerType:"touch",isEmulated:false};$(t,s);for(r=0;r<n;r++){o={id:i.changedTouches[r].identifier,type:"touch"};ae(t,s,o)}if(s.stopPropagation){e.stopEvent(i)}}function H(t,i){if(!e.eventIsCanceled(i)){i.preventDefault()}return false}function z(t,i){if(!e.eventIsCanceled(i)){i.preventDefault()}return false}function B(t,i){var n={originalEvent:i,eventType:"gotpointercapture",pointerType:c(i),isEmulated:false};$(t,n);if(i.target===t.element){J(t,{id:i.pointerId,type:c(i)},true)}if(n.stopPropagation){e.stopEvent(i)}}function L(t,i){var n={originalEvent:i,eventType:"lostpointercapture",pointerType:c(i),isEmulated:false};$(t,n);if(i.target===t.element){J(t,{id:i.pointerId,type:c(i)},false)}if(n.stopPropagation){e.stopEvent(i)}}function F(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerenter",pointerType:n.type,isEmulated:false};$(t,r);ee(t,r,n)}function M(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerleave",pointerType:n.type,isEmulated:false};$(t,r);te(t,r,n)}function N(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerover",pointerType:n.type,isEmulated:false};$(t,r);ie(t,r,n);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function A(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerout",pointerType:n.type,isEmulated:false};$(t,r);ne(t,r,n);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function W(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r=e.MouseTracker.havePointerEvents&&n.type==="touch"&&e.Browser.vendor!==e.BROWSERS.IE;var o={originalEvent:i,eventType:"pointerdown",pointerType:n.type,isEmulated:false};$(t,o);re(t,o,n,i.button);if(o.preventDefault&&!o.defaultPrevented){e.cancelEvent(i)}if(o.stopPropagation){e.stopEvent(i)}if(o.shouldCapture){if(r){J(t,n,true)}else{l(t,n)}}}function U(e,t){j(e,t)}function V(t,i){var n=t.getActivePointersListByType(c(i));if(n.getById(i.pointerId)){j(t,i)}e.stopEvent(i)}function j(t,i){var n;n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerup",pointerType:n.type,isEmulated:false};$(t,r);oe(t,r,n,i.button);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}if(r.shouldReleaseCapture){if(i.target===t.element){h(t,n)}else{J(t,n,false)}}}function G(e,t){Z(e,t)}function q(t,i){var n=t.getActivePointersListByType(c(i));if(n.getById(i.pointerId)){Z(t,i)}e.stopEvent(i)}function Z(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointermove",pointerType:n.type,isEmulated:false};$(t,r);se(t,r,n);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function X(t,i){var n={id:i.pointerId,type:c(i)};var r={originalEvent:i,eventType:"pointercancel",pointerType:n.type,isEmulated:false};$(t,r);ae(t,r,n);if(r.stopPropagation){e.stopEvent(i)}}function Y(e,t){t.speed=0;t.direction=0;t.contactPos=t.currentPos;t.contactTime=t.currentTime;t.lastPos=t.currentPos;t.lastTime=t.currentTime;return e.add(t)}function K(t,i,n){var r;var o=i.getById(n.id);if(o){if(o.captured){e.console.warn("stopTrackingPointer() called on captured pointer");h(t,o)}i.removeContact();r=i.removeById(n.id)}else{r=i.getLength()}return r}function Q(e,t){switch(t.eventType){case"pointermove":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasGestureHandlers;t.stopPropagation=false;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=false;t.stopPropagation=false;break;case"pointerdown":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasGestureHandlers;t.stopPropagation=false;break;case"pointerup":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasGestureHandlers;t.stopPropagation=false;break;case"wheel":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasScrollHandler;t.stopPropagation=false;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":t.isStoppable=true;t.isCancelable=false;t.preventDefault=false;t.preventGesture=false;t.stopPropagation=false;break;case"click":t.isStoppable=true;t.isCancelable=true;t.preventDefault=!!e.clickHandler;t.preventGesture=false;t.stopPropagation=false;break;case"dblclick":t.isStoppable=true;t.isCancelable=true;t.preventDefault=!!e.dblClickHandler;t.preventGesture=false;t.stopPropagation=false;break;case"focus":case"blur":case"pointerenter":case"pointerleave":default:t.isStoppable=false;t.isCancelable=false;t.preventDefault=false;t.preventGesture=false;t.stopPropagation=false;break}}function $(t,i){i.eventSource=t;i.eventPhase=i.originalEvent?typeof i.originalEvent.eventPhase!=="undefined"?i.originalEvent.eventPhase:0:0;i.defaultPrevented=e.eventIsCanceled(i.originalEvent);i.shouldCapture=false;i.shouldReleaseCapture=false;i.userData=t.userData;Q(t,i);if(t.preProcessEventHandler){t.preProcessEventHandler(i)}}function J(t,i,n){var r=t.getActivePointersListByType(i.type);var o=r.getById(i.id);if(o){if(n&&!o.captured){o.captured=true;r.captureCount++}else if(!n&&o.captured){o.captured=false;r.captureCount--;if(r.captureCount<0){r.captureCount=0;e.console.warn("updatePointerCaptured() - pointsList.captureCount went negative")}}}else{e.console.warn("updatePointerCaptured() called on untracked pointer")}}function ee(e,t,i){var n=e.getActivePointersListByType(i.type),r;r=n.getById(i.id);if(r){r.insideElement=true;r.lastPos=r.currentPos;r.lastTime=r.currentTime;r.currentPos=i.currentPos;r.currentTime=i.currentTime;i=r}else{i.captured=false;i.insideElementPressed=false;i.insideElement=true;Y(n,i)}if(e.enterHandler){e.enterHandler({eventSource:e,pointerType:i.type,position:g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData})}}function te(e,t,i){var n=e.getActivePointersListByType(i.type),r,o;r=n.getById(i.id);if(r){if(r.captured){r.insideElement=false;r.lastPos=r.currentPos;r.lastTime=r.currentTime;r.currentPos=i.currentPos;r.currentTime=i.currentTime}else{K(e,n,r)}i=r}else{i.captured=false;i.insideElementPressed=false}if(e.leaveHandler||e.exitHandler){o={eventSource:e,pointerType:i.type,position:i.currentPos&&g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData};if(e.leaveHandler){e.leaveHandler(o)}if(e.exitHandler){e.exitHandler(o)}}}function ie(e,t,i){var n,r;n=e.getActivePointersListByType(i.type);r=n.getById(i.id);if(r){i=r}else{i.captured=false;i.insideElementPressed=false}if(e.overHandler){e.overHandler({eventSource:e,pointerType:i.type,position:g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData})}}function ne(e,t,i){var n,r;n=e.getActivePointersListByType(i.type);r=n.getById(i.id);if(r){i=r}else{i.captured=false;i.insideElementPressed=false}if(e.outHandler){e.outHandler({eventSource:e,pointerType:i.type,position:i.currentPos&&g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData})}}function re(i,n,r,o){var s=t[i.hash],a=i.getActivePointersListByType(r.type),l;if(typeof n.originalEvent.buttons!=="undefined"){a.buttons=n.originalEvent.buttons}else{if(o===0){a.buttons|=1}else if(o===1){a.buttons|=4}else if(o===2){a.buttons|=2}else if(o===3){a.buttons|=8}else if(o===4){a.buttons|=16}else if(o===5){a.buttons|=32}}if(o!==0){n.shouldCapture=false;n.shouldReleaseCapture=false;if(i.nonPrimaryPressHandler&&!n.preventGesture&&!n.defaultPrevented){n.preventDefault=true;i.nonPrimaryPressHandler({eventSource:i,pointerType:r.type,position:g(r.currentPos,i.element),button:o,buttons:a.buttons,isTouchEvent:r.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}return}l=a.getById(r.id);if(l){l.insideElementPressed=true;l.insideElement=true;l.originalTarget=n.originalEvent.target;l.contactPos=r.currentPos;l.contactTime=r.currentTime;l.lastPos=l.currentPos;l.lastTime=l.currentTime;l.currentPos=r.currentPos;l.currentTime=r.currentTime;r=l}else{r.captured=false;r.insideElementPressed=true;r.insideElement=true;r.originalTarget=n.originalEvent.target;Y(a,r)}a.addContact();if(!n.preventGesture&&!n.defaultPrevented){n.shouldCapture=true;n.shouldReleaseCapture=false;n.preventDefault=true;if(i.dragHandler||i.dragEndHandler||i.pinchHandler){e.MouseTracker.gesturePointVelocityTracker.addPoint(i,r)}if(a.contacts===1){if(i.pressHandler&&!n.preventGesture){i.pressHandler({eventSource:i,pointerType:r.type,position:g(r.contactPos,i.element),buttons:a.buttons,isTouchEvent:r.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}}else if(a.contacts===2){if(i.pinchHandler&&r.type==="touch"){s.pinchGPoints=a.asArray();s.lastPinchDist=s.currentPinchDist=s.pinchGPoints[0].currentPos.distanceTo(s.pinchGPoints[1].currentPos);s.lastPinchCenter=s.currentPinchCenter=v(s.pinchGPoints[0].currentPos,s.pinchGPoints[1].currentPos)}}}else{n.shouldCapture=false;n.shouldReleaseCapture=false}}function oe(i,n,r,o){var s=t[i.hash],a=i.getActivePointersListByType(r.type),l,h,u,c=false,d;if(typeof n.originalEvent.buttons!=="undefined"){a.buttons=n.originalEvent.buttons}else{if(o===0){a.buttons^=~1}else if(o===1){a.buttons^=~4}else if(o===2){a.buttons^=~2}else if(o===3){a.buttons^=~8}else if(o===4){a.buttons^=~16}else if(o===5){a.buttons^=~32}}n.shouldCapture=false;if(o!==0){n.shouldReleaseCapture=false;if(i.nonPrimaryReleaseHandler&&!n.preventGesture&&!n.defaultPrevented){n.preventDefault=true;i.nonPrimaryReleaseHandler({eventSource:i,pointerType:r.type,position:g(r.currentPos,i.element),button:o,buttons:a.buttons,isTouchEvent:r.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}return}u=a.getById(r.id);if(u){a.removeContact();if(u.captured){c=true}u.lastPos=u.currentPos;u.lastTime=u.currentTime;u.currentPos=r.currentPos;u.currentTime=r.currentTime;if(!u.insideElement){K(i,a,u)}l=u.currentPos;h=u.currentTime}else{r.captured=false;r.insideElementPressed=false;r.insideElement=true;Y(a,r);u=r}if(!n.preventGesture&&!n.defaultPrevented){if(c){n.shouldReleaseCapture=true;n.preventDefault=true;if(i.dragHandler||i.dragEndHandler||i.pinchHandler){e.MouseTracker.gesturePointVelocityTracker.removePoint(i,u)}if(a.contacts===0){if(i.releaseHandler&&l){i.releaseHandler({eventSource:i,pointerType:u.type,position:g(l,i.element),buttons:a.buttons,insideElementPressed:u.insideElementPressed,insideElementReleased:u.insideElement,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}if(i.dragEndHandler&&s.sentDragEvent){i.dragEndHandler({eventSource:i,pointerType:u.type,position:g(u.currentPos,i.element),speed:u.speed,direction:u.direction,shift:n.originalEvent.shiftKey,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}s.sentDragEvent=false;if((i.clickHandler||i.dblClickHandler)&&u.insideElement){d=h-u.contactTime<=i.clickTimeThreshold&&u.contactPos.distanceTo(l)<=i.clickDistThreshold;if(i.clickHandler){i.clickHandler({eventSource:i,pointerType:u.type,position:g(u.currentPos,i.element),quick:d,shift:n.originalEvent.shiftKey,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,originalTarget:u.originalTarget,userData:i.userData})}if(i.dblClickHandler&&d){a.clicks++;if(a.clicks===1){s.lastClickPos=l;s.dblClickTimeOut=setTimeout((function(){a.clicks=0}),i.dblClickTimeThreshold)}else if(a.clicks===2){clearTimeout(s.dblClickTimeOut);a.clicks=0;if(s.lastClickPos.distanceTo(l)<=i.dblClickDistThreshold){i.dblClickHandler({eventSource:i,pointerType:u.type,position:g(u.currentPos,i.element),shift:n.originalEvent.shiftKey,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}s.lastClickPos=null}}}}else if(a.contacts===2){if(i.pinchHandler&&u.type==="touch"){s.pinchGPoints=a.asArray();s.lastPinchDist=s.currentPinchDist=s.pinchGPoints[0].currentPos.distanceTo(s.pinchGPoints[1].currentPos);s.lastPinchCenter=s.currentPinchCenter=v(s.pinchGPoints[0].currentPos,s.pinchGPoints[1].currentPos)}}}else{n.shouldReleaseCapture=false;if(i.releaseHandler&&l){i.releaseHandler({eventSource:i,pointerType:u.type,position:g(l,i.element),buttons:a.buttons,insideElementPressed:u.insideElementPressed,insideElementReleased:u.insideElement,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData});n.preventDefault=true}}}}function se(e,i,n){var r=t[e.hash],o=e.getActivePointersListByType(n.type),s,a,l;if(typeof i.originalEvent.buttons!=="undefined"){o.buttons=i.originalEvent.buttons}s=o.getById(n.id);if(s){s.lastPos=s.currentPos;s.lastTime=s.currentTime;s.currentPos=n.currentPos;s.currentTime=n.currentTime}else{return}i.shouldCapture=false;i.shouldReleaseCapture=false;if(e.stopHandler&&n.type==="mouse"){clearTimeout(e.stopTimeOut);e.stopTimeOut=setTimeout((function(){le(e,i.originalEvent,n.type)}),e.stopDelay)}if(o.contacts===0){if(e.moveHandler){e.moveHandler({eventSource:e,pointerType:n.type,position:g(n.currentPos,e.element),buttons:o.buttons,isTouchEvent:n.type==="touch",originalEvent:i.originalEvent,userData:e.userData})}}else if(o.contacts===1){if(e.moveHandler){s=o.asArray()[0];e.moveHandler({eventSource:e,pointerType:s.type,position:g(s.currentPos,e.element),buttons:o.buttons,isTouchEvent:s.type==="touch",originalEvent:i.originalEvent,userData:e.userData})}if(e.dragHandler&&!i.preventGesture&&!i.defaultPrevented){s=o.asArray()[0];l=s.currentPos.minus(s.lastPos);e.dragHandler({eventSource:e,pointerType:s.type,position:g(s.currentPos,e.element),buttons:o.buttons,delta:l,speed:s.speed,direction:s.direction,shift:i.originalEvent.shiftKey,isTouchEvent:s.type==="touch",originalEvent:i.originalEvent,userData:e.userData});i.preventDefault=true;r.sentDragEvent=true}}else if(o.contacts===2){if(e.moveHandler){a=o.asArray();e.moveHandler({eventSource:e,pointerType:a[0].type,position:g(v(a[0].currentPos,a[1].currentPos),e.element),buttons:o.buttons,isTouchEvent:a[0].type==="touch",originalEvent:i.originalEvent,userData:e.userData})}if(e.pinchHandler&&n.type==="touch"&&!i.preventGesture&&!i.defaultPrevented){l=r.pinchGPoints[0].currentPos.distanceTo(r.pinchGPoints[1].currentPos);if(l!==r.currentPinchDist){r.lastPinchDist=r.currentPinchDist;r.currentPinchDist=l;r.lastPinchCenter=r.currentPinchCenter;r.currentPinchCenter=v(r.pinchGPoints[0].currentPos,r.pinchGPoints[1].currentPos);e.pinchHandler({eventSource:e,pointerType:"touch",gesturePoints:r.pinchGPoints,lastCenter:g(r.lastPinchCenter,e.element),center:g(r.currentPinchCenter,e.element),lastDistance:r.lastPinchDist,distance:r.currentPinchDist,shift:i.originalEvent.shiftKey,originalEvent:i.originalEvent,userData:e.userData});i.preventDefault=true}}}}function ae(e,t,i){var n=e.getActivePointersListByType(i.type),r;r=n.getById(i.id);if(r){K(e,n,r)}}function le(e,t,i){if(e.stopHandler){e.stopHandler({eventSource:e,pointerType:i,position:f(t,e.element),buttons:e.getActivePointersListByType(i).buttons,isTouchEvent:i==="touch",originalEvent:t,userData:e.userData})}}})(t);(function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5};e.Control=function(t,i,n){var r=t.parentNode;if(typeof i==="number"){e.console.error("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");i={anchor:i}}i.attachToViewer=typeof i.attachToViewer==="undefined"?true:i.attachToViewer;this.autoFade=typeof i.autoFade==="undefined"?true:i.autoFade;this.element=t;this.anchor=i.anchor;this.container=n;if(this.anchor===e.ControlAnchor.ABSOLUTE){this.wrapper=e.makeNeutralElement("div");this.wrapper.style.position="absolute";this.wrapper.style.top=typeof i.top==="number"?i.top+"px":i.top;this.wrapper.style.left=typeof i.left==="number"?i.left+"px":i.left;this.wrapper.style.height=typeof i.height==="number"?i.height+"px":i.height;this.wrapper.style.width=typeof i.width==="number"?i.width+"px":i.width;this.wrapper.style.margin="0px";this.wrapper.style.padding="0px";this.element.style.position="relative";this.element.style.top="0px";this.element.style.left="0px";this.element.style.height="100%";this.element.style.width="100%"}else{this.wrapper=e.makeNeutralElement("div");this.wrapper.style.display="inline-block";if(this.anchor===e.ControlAnchor.NONE){this.wrapper.style.width=this.wrapper.style.height="100%"}}this.wrapper.appendChild(this.element);if(i.attachToViewer){if(this.anchor===e.ControlAnchor.TOP_RIGHT||this.anchor===e.ControlAnchor.BOTTOM_RIGHT){this.container.insertBefore(this.wrapper,this.container.firstChild)}else{this.container.appendChild(this.wrapper)}}else{r.appendChild(this.wrapper)}};e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element);if(this.anchor!==e.ControlAnchor.NONE){this.container.removeChild(this.wrapper)}},isVisible:function(){return this.wrapper.style.display!=="none"},setVisible:function(t){this.wrapper.style.display=t?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(t){if(this.element[e.SIGNAL]&&e.Browser.vendor===e.BROWSERS.IE){e.setElementOpacity(this.element,t,true)}else{e.setElementOpacity(this.wrapper,t,true)}}}})(t);(function(e){e.ControlDock=function(t){var i=["topleft","topright","bottomright","bottomleft"],n,r;e.extend(true,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},t);this.container.onsubmit=function(){return false};if(this.element){this.element=e.getElement(this.element);this.element.appendChild(this.container);this.element.style.position="relative";this.container.style.width="100%";this.container.style.height="100%"}for(r=0;r<i.length;r++){n=i[r];this.controls[n]=e.makeNeutralElement("div");this.controls[n].style.position="absolute";if(n.match("left")){this.controls[n].style.left="0px"}if(n.match("right")){this.controls[n].style.right="0px"}if(n.match("top")){this.controls[n].style.top="0px"}if(n.match("bottom")){this.controls[n].style.bottom="0px"}}this.container.appendChild(this.controls.topleft);this.container.appendChild(this.controls.topright);this.container.appendChild(this.controls.bottomright);this.container.appendChild(this.controls.bottomleft)};e.ControlDock.prototype={addControl:function(i,n){i=e.getElement(i);var r=null;if(t(this,i)>=0){return}switch(n.anchor){case e.ControlAnchor.TOP_RIGHT:r=this.controls.topright;i.style.position="relative";i.style.paddingRight="0px";i.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:r=this.controls.bottomright;i.style.position="relative";i.style.paddingRight="0px";i.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:r=this.controls.bottomleft;i.style.position="relative";i.style.paddingLeft="0px";i.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:r=this.controls.topleft;i.style.position="relative";i.style.paddingLeft="0px";i.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:r=this.container;i.style.margin="0px";i.style.padding="0px";break;default:case e.ControlAnchor.NONE:r=this.container;i.style.margin="0px";i.style.padding="0px";break}this.controls.push(new e.Control(i,n,r));i.style.display="inline-block"},removeControl:function(i){i=e.getElement(i);var n=t(this,i);if(n>=0){this.controls[n].destroy();this.controls.splice(n,1)}return this},clearControls:function(){while(this.controls.length>0){this.controls.pop().destroy()}return this},areControlsEnabled:function(){var e;for(e=this.controls.length-1;e>=0;e--){if(this.controls[e].isVisible()){return true}}return false},setControlsEnabled:function(e){var t;for(t=this.controls.length-1;t>=0;t--){this.controls[t].setVisible(e)}return this}};function t(e,t){var i=e.controls,n;for(n=i.length-1;n>=0;n--){if(i[n].element===t){return n}}return-1}})(t);(function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:false,isVerticallyCentered:true,isBottom:false},1:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:true,isVerticallyCentered:false,isBottom:false},2:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:true,isVerticallyCentered:false,isBottom:false},3:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:true,isVerticallyCentered:false,isBottom:false},4:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:false,isVerticallyCentered:true,isBottom:false},5:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:false,isVerticallyCentered:false,isBottom:true},6:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:false,isVerticallyCentered:false,isBottom:true},7:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:false,isVerticallyCentered:false,isBottom:true},8:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:false,isVerticallyCentered:true,isBottom:false}}})})(t);(function(e){var t={};var i=1;e.Viewer=function(r){var o=arguments,s=this,l;if(!e.isPlainObject(r)){r={id:o[0],xmlPath:o.length>1?o[1]:undefined,prefixUrl:o.length>2?o[2]:undefined,controls:o.length>3?o[3]:undefined,overlays:o.length>4?o[4]:undefined}}if(r.config){e.extend(true,r,r.config);delete r.config}e.extend(true,this,{id:r.id,hash:r.hash||i++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttonGroup:null,profiler:null},e.DEFAULT_SETTINGS,r);if(typeof this.hash==="undefined"){throw new Error("A hash must be defined, either by specifying options.id or options.hash.")}if(typeof t[this.hash]!=="undefined"){e.console.warn("Hash "+this.hash+" has already been used.")}t[this.hash]={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:false,forceRedraw:false,needsResize:false,forceResize:false,mouseInside:false,group:null,zooming:false,zoomFactor:null,lastZoomTime:null,fullPage:false,onfullscreenchange:null,lastClickTime:null,draggingToZoom:false};this._sequenceIndex=0;this._firstOpen=true;this._updateRequestId=null;this._loadQueue=[];this.currentOverlays=[];this._updatePixelDensityRatioBind=null;this._lastScrollTime=e.now();e.EventSource.call(this);this.addHandler("open-failed",(function(t){var i=e.getString("Errors.OpenFailed",t.eventSource,t.message);s._showMessage(i)}));e.ControlDock.call(this,r);if(this.xmlPath){this.tileSources=[this.xmlPath]}this.element=this.element||document.getElementById(this.id);this.canvas=e.makeNeutralElement("div");this.canvas.className="openseadragon-canvas";(function(e){e.width="100%";e.height="100%";e.overflow="hidden";e.position="absolute";e.top="0px";e.left="0px"})(this.canvas.style);e.setElementTouchActionNone(this.canvas);if(r.tabIndex!==""){this.canvas.tabIndex=r.tabIndex===undefined?0:r.tabIndex}this.container.className="openseadragon-container";(function(e){e.width="100%";e.height="100%";e.position="relative";e.overflow="hidden";e.left="0px";e.top="0px";e.textAlign="left"})(this.container.style);e.setElementTouchActionNone(this.container);this.container.insertBefore(this.canvas,this.container.firstChild);this.element.appendChild(this.container);this.bodyWidth=document.body.style.width;this.bodyHeight=document.body.style.height;this.bodyOverflow=document.body.style.overflow;this.docOverflow=document.documentElement.style.overflow;this.innerTracker=new e.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:e.delegate(this,f),keyDownHandler:e.delegate(this,g),keyHandler:e.delegate(this,v),clickHandler:e.delegate(this,m),dblClickHandler:e.delegate(this,y),dragHandler:e.delegate(this,w),dragEndHandler:e.delegate(this,T),enterHandler:e.delegate(this,x),leaveHandler:e.delegate(this,S),pressHandler:e.delegate(this,E),releaseHandler:e.delegate(this,P),nonPrimaryPressHandler:e.delegate(this,_),nonPrimaryReleaseHandler:e.delegate(this,R),scrollHandler:e.delegate(this,I),pinchHandler:e.delegate(this,b),focusHandler:e.delegate(this,C),blurHandler:e.delegate(this,D)});this.outerTracker=new e.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:e.delegate(this,k),leaveHandler:e.delegate(this,O)});if(this.toolbar){this.toolbar=new e.ControlDock({element:this.toolbar})}this.bindStandardControls();t[this.hash].prevContainerSize=n(this.container);if(window.ResizeObserver){this._autoResizePolling=false;this._resizeObserver=new ResizeObserver((function(){t[s.hash].needsResize=true}));this._resizeObserver.observe(this.container,{})}else{this._autoResizePolling=true}this.world=new e.World({viewer:this});this.world.addHandler("add-item",(function(e){s.source=s.world.getItemAt(0).source;t[s.hash].forceRedraw=true;if(!s._updateRequestId){s._updateRequestId=a(s,H)}}));this.world.addHandler("remove-item",(function(e){if(s.world.getItemCount()){s.source=s.world.getItemAt(0).source}else{s.source=null}t[s.hash].forceRedraw=true}));this.world.addHandler("metrics-change",(function(e){if(s.viewport){s.viewport._setContentBounds(s.world.getHomeBounds(),s.world.getContentFactor())}}));this.world.addHandler("item-index-change",(function(e){s.source=s.world.getItemAt(0).source}));this.viewport=new e.Viewport({containerSize:t[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins,silenceMultiImageWarnings:this.silenceMultiImageWarnings});this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor());this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:r.timeout,tileRetryMax:this.tileRetryMax,tileRetryDelay:this.tileRetryDelay});this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount});this.drawer=new e.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor});this.overlaysContainer=e.makeNeutralElement("div");this.canvas.appendChild(this.overlaysContainer);if(!this.drawer.canRotate()){if(this.rotateLeft){l=this.buttonGroup.buttons.indexOf(this.rotateLeft);this.buttonGroup.buttons.splice(l,1);this.buttonGroup.element.removeChild(this.rotateLeft.element)}if(this.rotateRight){l=this.buttonGroup.buttons.indexOf(this.rotateRight);this.buttonGroup.buttons.splice(l,1);this.buttonGroup.element.removeChild(this.rotateRight.element)}}this._addUpdatePixelDensityRatioEvent();if(this.showNavigator){this.navigator=new e.Navigator({element:this.navigatorElement,id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy,animationTime:this.animationTime})}if(this.sequenceMode){this.bindSequenceControls()}if(this.tileSources){this.open(this.tileSources)}for(l=0;l<this.customControls.length;l++){this.addControl(this.customControls[l].id,{anchor:this.customControls[l].anchor})}e.requestAnimationFrame((function(){h(s)}));if(this.imageSmoothingEnabled!==undefined&&!this.imageSmoothingEnabled){this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled)}e._viewers.set(this.element,this)};e.extend(e.Viewer.prototype,e.EventSource.prototype,e.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(t){e.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead.");return this.open(t)},openTileSource:function(t){e.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead.");return this.open(t)},get buttons(){e.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup");return this.buttonGroup},open:function(t,i){var n=this;this.close();if(!t){return this}if(this.sequenceMode&&e.isArray(t)){if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}if(typeof i!=="undefined"&&!isNaN(i)){this.initialPage=i}this.tileSources=t;this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage));if(this.tileSources.length){this.open(this.tileSources[this._sequenceIndex]);if(this.showReferenceStrip){this.addReferenceStrip()}}this._updateSequenceButtons(this._sequenceIndex);return this}if(!e.isArray(t)){t=[t]}if(!t.length){return this}this._opening=true;var r=t.length;var s=0;var a=0;var l;var h=function(){if(s+a===r){if(s){if(n._firstOpen||!n.preserveViewport){n.viewport.goHome(true);n.viewport.update()}n._firstOpen=false;var e=t[0];if(e.tileSource){e=e.tileSource}if(n.overlays&&!n.preserveOverlays){for(var i=0;i<n.overlays.length;i++){n.currentOverlays[i]=o(n,n.overlays[i])}}n._drawOverlays();n._opening=false;n.raiseEvent("open",{source:e})}else{n._opening=false;n.raiseEvent("open-failed",l)}}};var u=function(t){if(!e.isPlainObject(t)||!t.tileSource){t={tileSource:t}}if(t.index!==undefined){e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead");delete t.index}if(t.collectionImmediately===undefined){t.collectionImmediately=true}var i=t.success;t.success=function(e){s++;if(t.tileSource.overlays){for(var r=0;r<t.tileSource.overlays.length;r++){n.addOverlay(t.tileSource.overlays[r])}}if(i){i(e)}h()};var r=t.error;t.error=function(e){a++;if(!l){l=e}if(r){r(e)}h()};n.addTiledImage(t)};for(var c=0;c<t.length;c++){u(t[c])}return this},close:function(){if(!t[this.hash]){return this}this._opening=false;if(this.navigator){this.navigator.close()}if(!this.preserveOverlays){this.clearOverlays();this.overlaysContainer.innerHTML=""}t[this.hash].animating=false;this.world.removeAll();this.imageLoader.clear();this.raiseEvent("close");return this},destroy:function(){if(!t[this.hash]){return}this.raiseEvent("before-destroy");this._removeUpdatePixelDensityRatioEvent();this.close();this.clearOverlays();this.overlaysContainer.innerHTML="";if(this._resizeObserver){this._resizeObserver.disconnect()}if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}if(this._updateRequestId!==null){e.cancelAnimationFrame(this._updateRequestId);this._updateRequestId=null}if(this.drawer){this.drawer.destroy()}if(this.navigator){this.navigator.destroy();t[this.navigator.hash]=null;delete t[this.navigator.hash];this.navigator=null}if(this.buttonGroup){this.buttonGroup.destroy()}else if(this.customButtons){while(this.customButtons.length){this.customButtons.pop().destroy()}}if(this.paging){this.paging.destroy()}if(this.element){while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}}this.container.onsubmit=null;this.clearControls();if(this.innerTracker){this.innerTracker.destroy()}if(this.outerTracker){this.outerTracker.destroy()}t[this.hash]=null;delete t[this.hash];this.canvas=null;this.container=null;e._viewers.delete(this.element);this.element=null;this.raiseEvent("destroy");this.removeAllHandlers()},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(e){this.innerTracker.setTracking(e);this.outerTracker.setTracking(e);this.raiseEvent("mouse-enabled",{enabled:e});return this},areControlsEnabled:function(){var e=this.controls.length,t;for(t=0;t<this.controls.length;t++){e=e&&this.controls[t].isVisible()}return e},setControlsEnabled:function(e){if(e){c(this)}else{h(this)}this.raiseEvent("controls-enabled",{enabled:e});return this},setDebugMode:function(e){for(var t=0;t<this.world.getItemCount();t++){this.world.getItemAt(t).debugMode=e}this.debugMode=e;this.forceRedraw()},setAjaxHeaders:function(t,i){if(t===null){t={}}if(!e.isPlainObject(t)){console.error("[Viewer.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}if(i===undefined){i=true}this.ajaxHeaders=t;if(i){for(var n=0;n<this.world.getItemCount();n++){this.world.getItemAt(n)._updateAjaxHeaders(true)}if(this.navigator){this.navigator.setAjaxHeaders(this.ajaxHeaders,true)}if(this.referenceStrip&&this.referenceStrip.miniViewers){for(var r in this.referenceStrip.miniViewers){this.referenceStrip.miniViewers[r].setAjaxHeaders(this.ajaxHeaders,true)}}}},addButton:function(e){this.buttonGroup.addButton(e)},isFullPage:function(){return t[this.hash].fullPage},setFullPage:function(i){var n=document.body,r=n.style,o=document.documentElement.style,s=this,a,l;if(i===this.isFullPage()){return this}var h={fullPage:i,preventDefaultAction:false};this.raiseEvent("pre-full-page",h);if(h.preventDefaultAction){return this}if(i){this.elementSize=e.getElementSize(this.element);this.pageScroll=e.getPageScroll();this.elementMargin=this.element.style.margin;this.element.style.margin="0";this.elementPadding=this.element.style.padding;this.element.style.padding="0";this.bodyMargin=r.margin;this.docMargin=o.margin;r.margin="0";o.margin="0";this.bodyPadding=r.padding;this.docPadding=o.padding;r.padding="0";o.padding="0";this.bodyWidth=r.width;this.docWidth=o.width;r.width="100%";o.width="100%";this.bodyHeight=r.height;this.docHeight=o.height;r.height="100%";o.height="100%";this.bodyDisplay=r.display;r.display="block";this.previousBody=[];t[this.hash].prevElementParent=this.element.parentNode;t[this.hash].prevNextSibling=this.element.nextSibling;t[this.hash].prevElementWidth=this.element.style.width;t[this.hash].prevElementHeight=this.element.style.height;a=n.childNodes.length;for(l=0;l<a;l++){this.previousBody.push(n.childNodes[0]);n.removeChild(n.childNodes[0])}if(this.toolbar&&this.toolbar.element){this.toolbar.parentNode=this.toolbar.element.parentNode;this.toolbar.nextSibling=this.toolbar.element.nextSibling;n.appendChild(this.toolbar.element);e.addClass(this.toolbar.element,"fullpage")}e.addClass(this.element,"fullpage");n.appendChild(this.element);this.element.style.height="100vh";this.element.style.width="100vw";if(this.toolbar&&this.toolbar.element){this.element.style.height=e.getElementSize(this.element).y-e.getElementSize(this.toolbar.element).y+"px"}t[this.hash].fullPage=true;e.delegate(this,k)({})}else{this.element.style.margin=this.elementMargin;this.element.style.padding=this.elementPadding;r.margin=this.bodyMargin;o.margin=this.docMargin;r.padding=this.bodyPadding;o.padding=this.docPadding;r.width=this.bodyWidth;o.width=this.docWidth;r.height=this.bodyHeight;o.height=this.docHeight;r.display=this.bodyDisplay;n.removeChild(this.element);a=this.previousBody.length;for(l=0;l<a;l++){n.appendChild(this.previousBody.shift())}e.removeClass(this.element,"fullpage");t[this.hash].prevElementParent.insertBefore(this.element,t[this.hash].prevNextSibling);if(this.toolbar&&this.toolbar.element){n.removeChild(this.toolbar.element);e.removeClass(this.toolbar.element,"fullpage");this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling);delete this.toolbar.parentNode;delete this.toolbar.nextSibling}this.element.style.width=t[this.hash].prevElementWidth;this.element.style.height=t[this.hash].prevElementHeight;var u=0;var c=function(){e.setPageScroll(s.pageScroll);var t=e.getPageScroll();u++;if(u<10&&(t.x!==s.pageScroll.x||t.y!==s.pageScroll.y)){e.requestAnimationFrame(c)}};e.requestAnimationFrame(c);t[this.hash].fullPage=false;e.delegate(this,O)({})}if(this.navigator&&this.viewport){this.navigator.update(this.viewport)}this.raiseEvent("full-page",{fullPage:i});return this},setFullScreen:function(t){var i=this;if(!e.supportsFullScreen){return this.setFullPage(t)}if(e.isFullScreen()===t){return this}var n={fullScreen:t,preventDefaultAction:false};this.raiseEvent("pre-full-screen",n);if(n.preventDefaultAction){return this}if(t){this.setFullPage(true);if(!this.isFullPage()){return this}this.fullPageStyleWidth=this.element.style.width;this.fullPageStyleHeight=this.element.style.height;this.element.style.width="100%";this.element.style.height="100%";var r=function(){var t=e.isFullScreen();if(!t){e.removeEvent(document,e.fullScreenEventName,r);e.removeEvent(document,e.fullScreenErrorEventName,r);i.setFullPage(false);if(i.isFullPage()){i.element.style.width=i.fullPageStyleWidth;i.element.style.height=i.fullPageStyleHeight}}if(i.navigator&&i.viewport){setTimeout((function(){i.navigator.update(i.viewport)}))}i.raiseEvent("full-screen",{fullScreen:t})};e.addEvent(document,e.fullScreenEventName,r);e.addEvent(document,e.fullScreenErrorEventName,r);e.requestFullScreen(document.body)}else{e.exitFullScreen()}return this},isVisible:function(){return this.container.style.visibility!=="hidden"},isFullScreen:function(){return e.isFullScreen()&&this.isFullPage()},setVisible:function(e){this.container.style.visibility=e?"":"hidden";this.raiseEvent("visible",{visible:e});return this},addTiledImage:function(t){e.console.assert(t,"[Viewer.addTiledImage] options is required");e.console.assert(t.tileSource,"[Viewer.addTiledImage] options.tileSource is required");e.console.assert(!t.replace||t.index>-1&&t.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var i=this;if(t.replace){t.replaceItem=i.world.getItemAt(t.index)}this._hideMessage();if(t.placeholderFillStyle===undefined){t.placeholderFillStyle=this.placeholderFillStyle}if(t.opacity===undefined){t.opacity=this.opacity}if(t.preload===undefined){t.preload=this.preload}if(t.compositeOperation===undefined){t.compositeOperation=this.compositeOperation}if(t.crossOriginPolicy===undefined){t.crossOriginPolicy=t.tileSource.crossOriginPolicy!==undefined?t.tileSource.crossOriginPolicy:this.crossOriginPolicy}if(t.ajaxWithCredentials===undefined){t.ajaxWithCredentials=this.ajaxWithCredentials}if(t.loadTilesWithAjax===undefined){t.loadTilesWithAjax=this.loadTilesWithAjax}if(!e.isPlainObject(t.ajaxHeaders)){t.ajaxHeaders={}}var n={options:t};function o(e){for(var r=0;r<i._loadQueue.length;r++){if(i._loadQueue[r]===n){i._loadQueue.splice(r,1);break}}if(i._loadQueue.length===0){s(n)}i.raiseEvent("add-item-failed",e);if(t.error){t.error(e)}}function s(e){if(i.collectionMode){i.world.arrange({immediately:e.options.collectionImmediately,rows:i.collectionRows,columns:i.collectionColumns,layout:i.collectionLayout,tileSize:i.collectionTileSize,tileMargin:i.collectionTileMargin});i.world.setAutoRefigureSizes(true)}}if(e.isArray(t.tileSource)){setTimeout((function(){o({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:t.tileSource,options:t})}));return}this._loadQueue.push(n);function a(){var t,n,r;while(i._loadQueue.length){t=i._loadQueue[0];if(!t.tileSource){break}i._loadQueue.splice(0,1);if(t.options.replace){var o=i.world.getIndexOfItem(t.options.replaceItem);if(o!==-1){t.options.index=o}i.world.removeItem(t.options.replaceItem)}n=new e.TiledImage({viewer:i,source:t.tileSource,viewport:i.viewport,drawer:i.drawer,tileCache:i.tileCache,imageLoader:i.imageLoader,x:t.options.x,y:t.options.y,width:t.options.width,height:t.options.height,fitBounds:t.options.fitBounds,fitBoundsPlacement:t.options.fitBoundsPlacement,clip:t.options.clip,placeholderFillStyle:t.options.placeholderFillStyle,opacity:t.options.opacity,preload:t.options.preload,degrees:t.options.degrees,flipped:t.options.flipped,compositeOperation:t.options.compositeOperation,springStiffness:i.springStiffness,animationTime:i.animationTime,minZoomImageRatio:i.minZoomImageRatio,wrapHorizontal:i.wrapHorizontal,wrapVertical:i.wrapVertical,immediateRender:i.immediateRender,blendTime:i.blendTime,alwaysBlend:i.alwaysBlend,minPixelRatio:i.minPixelRatio,smoothTileEdgesMinZoom:i.smoothTileEdgesMinZoom,iOSDevice:i.iOSDevice,crossOriginPolicy:t.options.crossOriginPolicy,ajaxWithCredentials:t.options.ajaxWithCredentials,loadTilesWithAjax:t.options.loadTilesWithAjax,ajaxHeaders:t.options.ajaxHeaders,debugMode:i.debugMode,subPixelRoundingForTransparency:i.subPixelRoundingForTransparency});if(i.collectionMode){i.world.setAutoRefigureSizes(false)}if(i.navigator){r=e.extend({},t.options,{replace:false,originalTiledImage:n,tileSource:t.tileSource});i.navigator.addTiledImage(r)}i.world.addItem(n,{index:t.options.index});if(i._loadQueue.length===0){s(t)}if(i.world.getItemCount()===1&&!i.preserveViewport){i.viewport.goHome(true)}if(t.options.success){t.options.success({item:n})}}}r(this,t.tileSource,t,(function(e){n.tileSource=e;a()}),(function(e){e.options=t;o(e);a()}))},addSimpleImage:function(t){e.console.assert(t,"[Viewer.addSimpleImage] options is required");e.console.assert(t.url,"[Viewer.addSimpleImage] options.url is required");var i=e.extend({},t,{tileSource:{type:"image",url:t.url}});delete i.url;this.addTiledImage(i)},addLayer:function(t){var i=this;e.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var n=e.extend({},t,{success:function(e){i.raiseEvent("add-layer",{options:t,drawer:e.item})},error:function(e){i.raiseEvent("add-layer-failed",e)}});this.addTiledImage(n);return this},getLayerAtLevel:function(t){e.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead.");return this.world.getItemAt(t)},getLevelOfLayer:function(t){e.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead.");return this.world.getIndexOfItem(t)},getLayersCount:function(){e.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead.");return this.world.getItemCount()},setLayerLevel:function(t,i){e.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead.");return this.world.setItemIndex(t,i)},removeLayer:function(t){e.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead.");return this.world.removeItem(t)},forceRedraw:function(){t[this.hash].forceRedraw=true;return this},forceResize:function(){t[this.hash].needsResize=true;t[this.hash].forceResize=true},bindSequenceControls:function(){var t=e.delegate(this,d),i=e.delegate(this,p),n=e.delegate(this,this.goToNextPage),r=e.delegate(this,this.goToPreviousPage),o=this.navImages,s=true;if(this.showSequenceControl){if(this.previousButton||this.nextButton){s=false}this.previousButton=new e.Button({element:this.previousButton?e.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.PreviousPage"),srcRest:F(this.prefixUrl,o.previous.REST),srcGroup:F(this.prefixUrl,o.previous.GROUP),srcHover:F(this.prefixUrl,o.previous.HOVER),srcDown:F(this.prefixUrl,o.previous.DOWN),onRelease:r,onFocus:t,onBlur:i});this.nextButton=new e.Button({element:this.nextButton?e.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.NextPage"),srcRest:F(this.prefixUrl,o.next.REST),srcGroup:F(this.prefixUrl,o.next.GROUP),srcHover:F(this.prefixUrl,o.next.HOVER),srcDown:F(this.prefixUrl,o.next.DOWN),onRelease:n,onFocus:t,onBlur:i});if(!this.navPrevNextWrap){this.previousButton.disable()}if(!this.tileSources||!this.tileSources.length){this.nextButton.disable()}if(s){this.paging=new e.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.pagingControl=this.paging.element;if(this.toolbar){this.toolbar.addControl(this.pagingControl,{anchor:e.ControlAnchor.BOTTOM_RIGHT})}else{this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||e.ControlAnchor.TOP_LEFT})}}}return this},bindStandardControls:function(){var t=e.delegate(this,M),i=e.delegate(this,A),n=e.delegate(this,V),r=e.delegate(this,N),o=e.delegate(this,j),s=e.delegate(this,q),a=e.delegate(this,Z),l=e.delegate(this,X),h=e.delegate(this,Y),u=e.delegate(this,K),c=e.delegate(this,d),f=e.delegate(this,p),g=this.navImages,v=[],m=true;if(this.showNavigationControl){if(this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton){m=false}if(this.showZoomControl){v.push(this.zoomInButton=new e.Button({element:this.zoomInButton?e.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomIn"),srcRest:F(this.prefixUrl,g.zoomIn.REST),srcGroup:F(this.prefixUrl,g.zoomIn.GROUP),srcHover:F(this.prefixUrl,g.zoomIn.HOVER),srcDown:F(this.prefixUrl,g.zoomIn.DOWN),onPress:t,onRelease:i,onClick:n,onEnter:t,onExit:i,onFocus:c,onBlur:f}));v.push(this.zoomOutButton=new e.Button({element:this.zoomOutButton?e.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomOut"),srcRest:F(this.prefixUrl,g.zoomOut.REST),srcGroup:F(this.prefixUrl,g.zoomOut.GROUP),srcHover:F(this.prefixUrl,g.zoomOut.HOVER),srcDown:F(this.prefixUrl,g.zoomOut.DOWN),onPress:r,onRelease:i,onClick:o,onEnter:r,onExit:i,onFocus:c,onBlur:f}))}if(this.showHomeControl){v.push(this.homeButton=new e.Button({element:this.homeButton?e.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Home"),srcRest:F(this.prefixUrl,g.home.REST),srcGroup:F(this.prefixUrl,g.home.GROUP),srcHover:F(this.prefixUrl,g.home.HOVER),srcDown:F(this.prefixUrl,g.home.DOWN),onRelease:s,onFocus:c,onBlur:f}))}if(this.showFullPageControl){v.push(this.fullPageButton=new e.Button({element:this.fullPageButton?e.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.FullPage"),srcRest:F(this.prefixUrl,g.fullpage.REST),srcGroup:F(this.prefixUrl,g.fullpage.GROUP),srcHover:F(this.prefixUrl,g.fullpage.HOVER),srcDown:F(this.prefixUrl,g.fullpage.DOWN),onRelease:a,onFocus:c,onBlur:f}))}if(this.showRotationControl){v.push(this.rotateLeftButton=new e.Button({element:this.rotateLeftButton?e.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateLeft"),srcRest:F(this.prefixUrl,g.rotateleft.REST),srcGroup:F(this.prefixUrl,g.rotateleft.GROUP),srcHover:F(this.prefixUrl,g.rotateleft.HOVER),srcDown:F(this.prefixUrl,g.rotateleft.DOWN),onRelease:l,onFocus:c,onBlur:f}));v.push(this.rotateRightButton=new e.Button({element:this.rotateRightButton?e.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateRight"),srcRest:F(this.prefixUrl,g.rotateright.REST),srcGroup:F(this.prefixUrl,g.rotateright.GROUP),srcHover:F(this.prefixUrl,g.rotateright.HOVER),srcDown:F(this.prefixUrl,g.rotateright.DOWN),onRelease:h,onFocus:c,onBlur:f}))}if(this.showFlipControl){v.push(this.flipButton=new e.Button({element:this.flipButton?e.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Flip"),srcRest:F(this.prefixUrl,g.flip.REST),srcGroup:F(this.prefixUrl,g.flip.GROUP),srcHover:F(this.prefixUrl,g.flip.HOVER),srcDown:F(this.prefixUrl,g.flip.DOWN),onRelease:u,onFocus:c,onBlur:f}))}if(m){this.buttonGroup=new e.ButtonGroup({buttons:v,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.navControl=this.buttonGroup.element;this.addHandler("open",e.delegate(this,G));if(this.toolbar){this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT})}else{this.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT})}}else{this.customButtons=v}}return this},currentPage:function(){return this._sequenceIndex},goToPage:function(e){if(this.tileSources&&e>=0&&e<this.tileSources.length){this._sequenceIndex=e;this._updateSequenceButtons(e);this.open(this.tileSources[e]);if(this.referenceStrip){this.referenceStrip.setFocus(e)}this.raiseEvent("page",{page:e})}return this},addOverlay:function(t,i,n,r){var a;if(e.isPlainObject(t)){a=t}else{a={element:t,location:i,placement:n,onDraw:r}}t=e.getElement(a.element);if(s(this.currentOverlays,t)>=0){return this}var l=o(this,a);this.currentOverlays.push(l);l.drawHTML(this.overlaysContainer,this.viewport);this.raiseEvent("add-overlay",{element:t,location:a.location,placement:a.placement});return this},updateOverlay:function(i,n,r){var o;i=e.getElement(i);o=s(this.currentOverlays,i);if(o>=0){this.currentOverlays[o].update(n,r);t[this.hash].forceRedraw=true;this.raiseEvent("update-overlay",{element:i,location:n,placement:r})}return this},removeOverlay:function(i){var n;i=e.getElement(i);n=s(this.currentOverlays,i);if(n>=0){this.currentOverlays[n].destroy();this.currentOverlays.splice(n,1);t[this.hash].forceRedraw=true;this.raiseEvent("remove-overlay",{element:i})}return this},clearOverlays:function(){while(this.currentOverlays.length>0){this.currentOverlays.pop().destroy()}t[this.hash].forceRedraw=true;this.raiseEvent("clear-overlay",{});return this},getOverlayById:function(t){var i;t=e.getElement(t);i=s(this.currentOverlays,t);if(i>=0){return this.currentOverlays[i]}else{return null}},_updateSequenceButtons:function(e){if(this.nextButton){if(!this.tileSources||this.tileSources.length-1===e){if(!this.navPrevNextWrap){this.nextButton.disable()}}else{this.nextButton.enable()}}if(this.previousButton){if(e>0){this.previousButton.enable()}else{if(!this.navPrevNextWrap){this.previousButton.disable()}}}},_showMessage:function(t){this._hideMessage();var i=e.makeNeutralElement("div");i.appendChild(document.createTextNode(t));this.messageDiv=e.makeCenteredNode(i);e.addClass(this.messageDiv,"openseadragon-message");this.container.appendChild(this.messageDiv)},_hideMessage:function(){var e=this.messageDiv;if(e){e.parentNode.removeChild(e);delete this.messageDiv}},gestureSettingsByDeviceType:function(e){switch(e){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var e,t=this.currentOverlays.length;for(e=0;e<t;e++){this.currentOverlays[e].drawHTML(this.overlaysContainer,this.viewport)}},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=false;if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}},addReferenceStrip:function(){this.showReferenceStrip=true;if(this.sequenceMode){if(this.referenceStrip){return}if(this.tileSources.length&&this.tileSources.length>1){this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this});this.referenceStrip.setFocus(this._sequenceIndex)}}else{e.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')}},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this);e.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){e.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var t=e.pixelDensityRatio;var i=e.getCurrentPixelDensityRatio();if(t!==i){e.pixelDensityRatio=i;this.world.resetItems();this.forceRedraw()}},goToPreviousPage:function(){var e=this._sequenceIndex-1;if(this.navPrevNextWrap&&e<0){e+=this.tileSources.length}this.goToPage(e)},goToNextPage:function(){var e=this._sequenceIndex+1;if(this.navPrevNextWrap&&e>=this.tileSources.length){e=0}this.goToPage(e)},isAnimating:function(){return t[this.hash].animating}});function n(t){t=e.getElement(t);return new e.Point(t.clientWidth===0?1:t.clientWidth,t.clientHeight===0?1:t.clientHeight)}function r(t,i,n,r,o){var s=t;if(e.type(i)==="string"){if(i.match(/^\s*<.*>\s*$/)){i=e.parseXml(i)}else if(i.match(/^\s*[{[].*[}\]]\s*$/)){try{var a=e.parseJSON(i);i=a}catch(e){}}}function l(e,t){if(e.ready){r(e)}else{e.addHandler("ready",(function(){r(e)}));e.addHandler("open-failed",(function(e){o({message:e.message,source:t})}))}}setTimeout((function(){if(e.type(i)==="string"){i=new e.TileSource({url:i,crossOriginPolicy:n.crossOriginPolicy!==undefined?n.crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,ajaxHeaders:n.ajaxHeaders?n.ajaxHeaders:t.ajaxHeaders,splitHashDataForPost:t.splitHashDataForPost,useCanvas:t.useCanvas,success:function(e){r(e.tileSource)}});i.addHandler("open-failed",(function(e){o(e)}))}else if(e.isPlainObject(i)||i.nodeType){if(i.crossOriginPolicy===undefined&&(n.crossOriginPolicy!==undefined||t.crossOriginPolicy!==undefined)){i.crossOriginPolicy=n.crossOriginPolicy!==undefined?n.crossOriginPolicy:t.crossOriginPolicy}if(i.ajaxWithCredentials===undefined){i.ajaxWithCredentials=t.ajaxWithCredentials}if(i.useCanvas===undefined){i.useCanvas=t.useCanvas}if(e.isFunction(i.getTileUrl)){var a=new e.TileSource(i);a.getTileUrl=i.getTileUrl;r(a)}else{var h=e.TileSource.determineType(s,i);if(!h){o({message:"Unable to load TileSource",source:i});return}var u=h.prototype.configure.apply(s,[i]);l(new h(u),i)}}else{l(i,i)}}))}function o(t,i){if(i instanceof e.Overlay){return i}var n=null;if(i.element){n=e.getElement(i.element)}else{var r=i.id?i.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);n=e.getElement(i.id);if(!n){n=document.createElement("a");n.href="#/overlay/"+r}n.id=r;e.addClass(n,i.className?i.className:"openseadragon-overlay")}var o=i.location;var s=i.width;var a=i.height;if(!o){var l=i.x;var h=i.y;if(i.px!==undefined){var u=t.viewport.imageToViewportRectangle(new e.Rect(i.px,i.py,s||0,a||0));l=u.x;h=u.y;s=s!==undefined?u.width:undefined;a=a!==undefined?u.height:undefined}o=new e.Point(l,h)}var c=i.placement;if(c&&e.type(c)==="string"){c=e.Placement[i.placement.toUpperCase()]}return new e.Overlay({element:n,location:o,placement:c,onDraw:i.onDraw,checkResize:i.checkResize,width:s,height:a,rotationMode:i.rotationMode})}function s(e,t){var i;for(i=e.length-1;i>=0;i--){if(e[i].element===t){return i}}return-1}function a(t,i){return e.requestAnimationFrame((function(){i(t)}))}function l(t){e.requestAnimationFrame((function(){u(t)}))}function h(t){if(!t.autoHideControls){return}t.controlsShouldFade=true;t.controlsFadeBeginTime=e.now()+t.controlsFadeDelay;window.setTimeout((function(){l(t)}),t.controlsFadeDelay)}function u(t){var i,n,r,o;if(t.controlsShouldFade){i=e.now();n=i-t.controlsFadeBeginTime;r=1-n/t.controlsFadeLength;r=Math.min(1,r);r=Math.max(0,r);for(o=t.controls.length-1;o>=0;o--){if(t.controls[o].autoFade){t.controls[o].setOpacity(r)}}if(r>0){l(t)}}}function c(e){var t;e.controlsShouldFade=false;for(t=e.controls.length-1;t>=0;t--){e.controls[t].setOpacity(1)}}function d(){c(this)}function p(){h(this)}function f(e){var t={tracker:e.eventSource,position:e.position,originalEvent:e.originalEvent,preventDefault:e.preventDefault};this.raiseEvent("canvas-contextmenu",t);e.preventDefault=t.preventDefault}function g(t){var i={originalEvent:t.originalEvent,preventDefaultAction:false,preventVerticalPan:t.preventVerticalPan||!this.panVertical,preventHorizontalPan:t.preventHorizontalPan||!this.panHorizontal};this.raiseEvent("canvas-key",i);if(!i.preventDefaultAction&&!t.ctrl&&!t.alt&&!t.meta){switch(t.keyCode){case 38:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(1.1)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 40:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(.9)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 37:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 39:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 187:this.viewport.zoomBy(1.1);this.viewport.applyConstraints();t.preventDefault=true;break;case 189:this.viewport.zoomBy(.9);this.viewport.applyConstraints();t.preventDefault=true;break;case 48:this.viewport.goHome();this.viewport.applyConstraints();t.preventDefault=true;break;case 87:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(1.1)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 83:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(.9)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 65:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 68:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 82:if(t.shift){if(this.viewport.flipped){this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement)}else{this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement)}}else{if(this.viewport.flipped){this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement)}else{this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement)}}this.viewport.applyConstraints();t.preventDefault=true;break;case 70:this.viewport.toggleFlip();t.preventDefault=true;break;case 74:this.goToPreviousPage();break;case 75:this.goToNextPage();break;default:t.preventDefault=false;break}}else{t.preventDefault=false}}function v(e){var t={originalEvent:e.originalEvent};this.raiseEvent("canvas-key-press",t)}function m(i){var n;var r=document.activeElement===this.canvas;if(!r){this.canvas.focus()}if(this.viewport.flipped){i.position.x=this.viewport.getContainerSize().x-i.position.x}var o={tracker:i.eventSource,position:i.position,quick:i.quick,shift:i.shift,originalEvent:i.originalEvent,originalTarget:i.originalTarget,preventDefaultAction:false};this.raiseEvent("canvas-click",o);if(!o.preventDefaultAction&&this.viewport&&i.quick){n=this.gestureSettingsByDeviceType(i.pointerType);if(n.clickToZoom===true){this.viewport.zoomBy(i.shift?1/this.zoomPerClick:this.zoomPerClick,n.zoomToRefPoint?this.viewport.pointFromPixel(i.position,true):null);this.viewport.applyConstraints()}if(n.dblClickDragToZoom){if(t[this.hash].draggingToZoom===true){t[this.hash].lastClickTime=null;t[this.hash].draggingToZoom=false}else{t[this.hash].lastClickTime=e.now()}}}}function y(e){var t;var i={tracker:e.eventSource,position:e.position,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.raiseEvent("canvas-double-click",i);if(!i.preventDefaultAction&&this.viewport){t=this.gestureSettingsByDeviceType(e.pointerType);if(t.dblClickToZoom){this.viewport.zoomBy(e.shift?1/this.zoomPerClick:this.zoomPerClick,t.zoomToRefPoint?this.viewport.pointFromPixel(e.position,true):null);this.viewport.applyConstraints()}}}function w(e){var i;var n={tracker:e.eventSource,pointerType:e.pointerType,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.raiseEvent("canvas-drag",n);i=this.gestureSettingsByDeviceType(e.pointerType);if(!n.preventDefaultAction&&this.viewport){if(i.dblClickDragToZoom&&t[this.hash].draggingToZoom){var r=Math.pow(this.zoomPerDblClickDrag,e.delta.y/50);this.viewport.zoomBy(r)}else if(i.dragToPan&&!t[this.hash].draggingToZoom){if(!this.panHorizontal){e.delta.x=0}if(!this.panVertical){e.delta.y=0}if(this.viewport.flipped){e.delta.x=-e.delta.x}if(this.constrainDuringPan){var o=this.viewport.deltaPointsFromPixels(e.delta.negate());this.viewport.centerSpringX.target.value+=o.x;this.viewport.centerSpringY.target.value+=o.y;var s=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=o.x;this.viewport.centerSpringY.target.value-=o.y;if(s.xConstrained){e.delta.x=0}if(s.yConstrained){e.delta.y=0}}this.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta.negate()),i.flickEnabled&&!this.constrainDuringPan)}}}function T(i){var n;var r={tracker:i.eventSource,pointerType:i.pointerType,position:i.position,speed:i.speed,direction:i.direction,shift:i.shift,originalEvent:i.originalEvent,preventDefaultAction:false};this.raiseEvent("canvas-drag-end",r);n=this.gestureSettingsByDeviceType(i.pointerType);if(!r.preventDefaultAction&&this.viewport){if(!t[this.hash].draggingToZoom&&n.flickEnabled&&i.speed>=n.flickMinSpeed){var o=0;if(this.panHorizontal){o=n.flickMomentum*i.speed*Math.cos(i.direction)}var s=0;if(this.panVertical){s=n.flickMomentum*i.speed*Math.sin(i.direction)}var a=this.viewport.pixelFromPoint(this.viewport.getCenter(true));var l=this.viewport.pointFromPixel(new e.Point(a.x-o,a.y-s));this.viewport.panTo(l,false)}this.viewport.applyConstraints()}if(n.dblClickDragToZoom&&t[this.hash].draggingToZoom===true){t[this.hash].draggingToZoom=false}}function x(e){this.raiseEvent("canvas-enter",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function S(e){this.raiseEvent("canvas-exit",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function E(i){var n;this.raiseEvent("canvas-press",{tracker:i.eventSource,pointerType:i.pointerType,position:i.position,insideElementPressed:i.insideElementPressed,insideElementReleased:i.insideElementReleased,originalEvent:i.originalEvent});n=this.gestureSettingsByDeviceType(i.pointerType);if(n.dblClickDragToZoom){var r=t[this.hash].lastClickTime;var o=e.now();if(r===null){return}if(o-r<this.dblClickTimeThreshold){t[this.hash].draggingToZoom=true}t[this.hash].lastClickTime=null}}function P(e){this.raiseEvent("canvas-release",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent})}function _(e){this.raiseEvent("canvas-nonprimary-press",{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function R(e){this.raiseEvent("canvas-nonprimary-release",{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function b(e){var t,i,n,r;var o={tracker:e.eventSource,pointerType:e.pointerType,gesturePoints:e.gesturePoints,lastCenter:e.lastCenter,center:e.center,lastDistance:e.lastDistance,distance:e.distance,shift:e.shift,originalEvent:e.originalEvent,preventDefaultPanAction:false,preventDefaultZoomAction:false,preventDefaultRotateAction:false};this.raiseEvent("canvas-pinch",o);if(this.viewport){t=this.gestureSettingsByDeviceType(e.pointerType);if(t.pinchToZoom&&(!o.preventDefaultPanAction||!o.preventDefaultZoomAction)){i=this.viewport.pointFromPixel(e.center,true);if(t.zoomToRefPoint&&!o.preventDefaultPanAction){n=this.viewport.pointFromPixel(e.lastCenter,true);r=n.minus(i);if(!this.panHorizontal){r.x=0}if(!this.panVertical){r.y=0}this.viewport.panBy(r,true)}if(!o.preventDefaultZoomAction){this.viewport.zoomBy(e.distance/e.lastDistance,i,true)}this.viewport.applyConstraints()}if(t.pinchRotate&&!o.preventDefaultRotateAction){var s=Math.atan2(e.gesturePoints[0].currentPos.y-e.gesturePoints[1].currentPos.y,e.gesturePoints[0].currentPos.x-e.gesturePoints[1].currentPos.x);var a=Math.atan2(e.gesturePoints[0].lastPos.y-e.gesturePoints[1].lastPos.y,e.gesturePoints[0].lastPos.x-e.gesturePoints[1].lastPos.x);i=this.viewport.pointFromPixel(e.center,true);this.viewport.rotateTo(this.viewport.getRotation(true)+(s-a)*(180/Math.PI),i,true)}}}function C(e){this.raiseEvent("canvas-focus",{tracker:e.eventSource,originalEvent:e.originalEvent})}function D(e){this.raiseEvent("canvas-blur",{tracker:e.eventSource,originalEvent:e.originalEvent})}function I(t){var i,n,r,o,s;o=e.now();s=o-this._lastScrollTime;if(s>this.minScrollDeltaTime){this._lastScrollTime=o;i={tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:false,preventDefault:true};this.raiseEvent("canvas-scroll",i);if(!i.preventDefaultAction&&this.viewport){if(this.viewport.flipped){t.position.x=this.viewport.getContainerSize().x-t.position.x}n=this.gestureSettingsByDeviceType(t.pointerType);if(n.scrollToZoom){r=Math.pow(this.zoomPerScroll,t.scroll);this.viewport.zoomBy(r,n.zoomToRefPoint?this.viewport.pointFromPixel(t.position,true):null);this.viewport.applyConstraints()}}t.preventDefault=i.preventDefault}else{t.preventDefault=true}}function k(e){t[this.hash].mouseInside=true;c(this);this.raiseEvent("container-enter",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function O(e){if(e.pointers<1){t[this.hash].mouseInside=false;if(!t[this.hash].animating){h(this)}}this.raiseEvent("container-exit",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function H(e){B(e);if(e.isOpen()){e._updateRequestId=a(e,H)}else{e._updateRequestId=false}}function z(i,n){var r=i.viewport;var o=r.getZoom();var s=r.getCenter();r.resize(n,i.preserveImageSizeOnResize);r.panTo(s,true);var a;if(i.preserveImageSizeOnResize){a=t[i.hash].prevContainerSize.x/n.x}else{var l=new e.Point(0,0);var h=new e.Point(t[i.hash].prevContainerSize.x,t[i.hash].prevContainerSize.y).distanceTo(l);var u=new e.Point(n.x,n.y).distanceTo(l);a=u/h*t[i.hash].prevContainerSize.x/n.x}r.zoomTo(o*a,null,true);t[i.hash].prevContainerSize=n;t[i.hash].forceRedraw=true;t[i.hash].needsResize=false;t[i.hash].forceResize=false}function B(e){if(e._opening||!t[e.hash]){return}if(e.autoResize||t[e.hash].forceResize){var i;if(e._autoResizePolling){i=n(e.container);var r=t[e.hash].prevContainerSize;if(!i.equals(r)){t[e.hash].needsResize=true}}if(t[e.hash].needsResize){z(e,i||n(e.container))}}var o=e.viewport.update();var s=e.world.update()||o;if(o){e.raiseEvent("viewport-change")}if(e.referenceStrip){s=e.referenceStrip.update(e.viewport)||s}var a=t[e.hash].animating;if(!a&&s){e.raiseEvent("animation-start");c(e)}var l=a&&!s;if(l){t[e.hash].animating=false}if(s||l||t[e.hash].forceRedraw||e.world.needsDraw()){L(e);e._drawOverlays();if(e.navigator){e.navigator.update(e.viewport)}t[e.hash].forceRedraw=false;if(s){e.raiseEvent("animation")}}if(l){e.raiseEvent("animation-finish");if(!t[e.hash].mouseInside){h(e)}}t[e.hash].animating=s}function L(e){e.imageLoader.clear();e.drawer.clear();e.world.draw();e.raiseEvent("update-viewport",{})}function F(e,t){return e?e+t:t}function M(){t[this.hash].lastZoomTime=e.now();t[this.hash].zoomFactor=this.zoomPerSecond;t[this.hash].zooming=true;W(this)}function N(){t[this.hash].lastZoomTime=e.now();t[this.hash].zoomFactor=1/this.zoomPerSecond;t[this.hash].zooming=true;W(this)}function A(){t[this.hash].zooming=false}function W(t){e.requestAnimationFrame(e.delegate(t,U))}function U(){var i,n,r;if(t[this.hash].zooming&&this.viewport){i=e.now();n=i-t[this.hash].lastZoomTime;r=Math.pow(t[this.hash].zoomFactor,n/1e3);this.viewport.zoomBy(r);this.viewport.applyConstraints();t[this.hash].lastZoomTime=i;W(this)}}function V(){if(this.viewport){t[this.hash].zooming=false;this.viewport.zoomBy(this.zoomPerClick/1);this.viewport.applyConstraints()}}function j(){if(this.viewport){t[this.hash].zooming=false;this.viewport.zoomBy(1/this.zoomPerClick);this.viewport.applyConstraints()}}function G(){if(this.buttonGroup){this.buttonGroup.emulateEnter();this.buttonGroup.emulateLeave()}}function q(){if(this.viewport){this.viewport.goHome()}}function Z(){if(this.isFullPage()&&!e.isFullScreen()){this.setFullPage(false)}else{this.setFullScreen(!this.isFullPage())}if(this.buttonGroup){this.buttonGroup.emulateLeave()}this.fullPageButton.element.focus();if(this.viewport){this.viewport.applyConstraints()}}function X(){if(this.viewport){var e=this.viewport.getRotation();if(this.viewport.flipped){e+=this.rotationIncrement}else{e-=this.rotationIncrement}this.viewport.setRotation(e)}}function Y(){if(this.viewport){var e=this.viewport.getRotation();if(this.viewport.flipped){e-=this.rotationIncrement}else{e+=this.rotationIncrement}this.viewport.setRotation(e)}}function K(){this.viewport.toggleFlip()}})(t);(function(e){e.Navigator=function(s){var a=s.viewer,l=this,h,u;if(s.element||s.id){if(s.element){if(s.id){e.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.")}if(s.element.id){s.id=s.element.id}else{s.id="navigator-"+e.now()}this.element=s.element}else{this.element=document.getElementById(s.id)}s.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:false,autoFade:false}}else{s.id="navigator-"+e.now();this.element=e.makeNeutralElement("div");s.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:true,autoFade:s.autoFade};if(s.position){if("BOTTOM_RIGHT"===s.position){s.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT}else if("BOTTOM_LEFT"===s.position){s.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT}else if("TOP_RIGHT"===s.position){s.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT}else if("TOP_LEFT"===s.position){s.controlOptions.anchor=e.ControlAnchor.TOP_LEFT}else if("ABSOLUTE"===s.position){s.controlOptions.anchor=e.ControlAnchor.ABSOLUTE;s.controlOptions.top=s.top;s.controlOptions.left=s.left;s.controlOptions.height=s.height;s.controlOptions.width=s.width}}}this.element.id=s.id;this.element.className+=" navigator";s=e.extend(true,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},s,{element:this.element,tabIndex:-1,showNavigator:false,mouseNavEnabled:false,showNavigationControl:false,showSequenceControl:false,immediateRender:true,blendTime:0,animationTime:s.animationTime,autoResize:false,minZoomImageRatio:1,background:s.background,opacity:s.opacity,borderColor:s.borderColor,displayRegionColor:s.displayRegionColor});s.minPixelRatio=this.minPixelRatio=a.minPixelRatio;e.setElementTouchActionNone(this.element);this.borderWidth=2;this.fudge=new e.Point(1,1);this.totalBorderWidths=new e.Point(this.borderWidth*2,this.borderWidth*2).minus(this.fudge);if(s.controlOptions.anchor!==e.ControlAnchor.NONE){(function(e,t){e.margin="0px";e.border=t+"px solid "+s.borderColor;e.padding="0px";e.background=s.background;e.opacity=s.opacity;e.overflow="hidden"})(this.element.style,this.borderWidth)}this.displayRegion=e.makeNeutralElement("div");this.displayRegion.id=this.element.id+"-displayregion";this.displayRegion.className="displayregion";(function(e,t){e.position="relative";e.top="0px";e.left="0px";e.fontSize="0px";e.overflow="hidden";e.border=t+"px solid "+s.displayRegionColor;e.margin="0px";e.padding="0px";e.background="transparent";e["float"]="left";e.cssFloat="left";e.styleFloat="left";e.zIndex=999999999;e.cursor="default";e.boxSizing="content-box"})(this.displayRegion.style,this.borderWidth);e.setElementPointerEventsNone(this.displayRegion);e.setElementTouchActionNone(this.displayRegion);this.displayRegionContainer=e.makeNeutralElement("div");this.displayRegionContainer.id=this.element.id+"-displayregioncontainer";this.displayRegionContainer.className="displayregioncontainer";this.displayRegionContainer.style.width="100%";this.displayRegionContainer.style.height="100%";e.setElementPointerEventsNone(this.displayRegionContainer);e.setElementTouchActionNone(this.displayRegionContainer);a.addControl(this.element,s.controlOptions);this._resizeWithViewer=s.controlOptions.anchor!==e.ControlAnchor.ABSOLUTE&&s.controlOptions.anchor!==e.ControlAnchor.NONE;if(s.width&&s.height){this.setWidth(s.width);this.setHeight(s.height)}else if(this._resizeWithViewer){h=e.getElementSize(a.element);this.element.style.height=Math.round(h.y*s.sizeRatio)+"px";this.element.style.width=Math.round(h.x*s.sizeRatio)+"px";this.oldViewerSize=h;u=e.getElementSize(this.element);this.elementArea=u.x*u.y}this.oldContainerSize=new e.Point(0,0);e.Viewer.apply(this,[s]);this.displayRegionContainer.appendChild(this.displayRegion);this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function c(e,t){o(l.displayRegionContainer,e);o(l.displayRegion,-e);l.viewport.setRotation(e,t)}if(s.navigatorRotate){var d=s.viewer.viewport?s.viewer.viewport.getRotation():s.viewer.degrees||0;c(d,true);s.viewer.addHandler("rotate",(function(e){c(e.degrees,e.immediately)}))}this.innerTracker.destroy();this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,i),clickHandler:e.delegate(this,t),releaseHandler:e.delegate(this,n),scrollHandler:e.delegate(this,r),preProcessEventHandler:function(e){if(e.eventType==="wheel"){e.preventDefault=true}}});this.outerTracker.userData="Navigator.outerTracker";e.setElementPointerEventsNone(this.canvas);e.setElementPointerEventsNone(this.container);this.addHandler("reset-size",(function(){if(l.viewport){l.viewport.goHome(true)}}));a.world.addHandler("item-index-change",(function(e){window.setTimeout((function(){var t=l.world.getItemAt(e.previousIndex);l.world.setItemIndex(t,e.newIndex)}),1)}));a.world.addHandler("remove-item",(function(e){var t=e.item;var i=l._getMatchingItem(t);if(i){l.world.removeItem(i)}}));this.update(a.viewport)};e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var t=new e.Point(this.container.clientWidth===0?1:this.container.clientWidth,this.container.clientHeight===0?1:this.container.clientHeight);if(!t.equals(this.oldContainerSize)){this.viewport.resize(t,true);this.viewport.goHome(true);this.oldContainerSize=t;this.drawer.clear();this.world.draw()}}},setWidth:function(e){this.width=e;this.element.style.width=typeof e==="number"?e+"px":e;this._resizeWithViewer=false;this.updateSize()},setHeight:function(e){this.height=e;this.element.style.height=typeof e==="number"?e+"px":e;this._resizeWithViewer=false;this.updateSize()},setFlip:function(e){this.viewport.setFlip(e);this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)");return this},setDisplayTransform:function(e){s(this.displayRegion,e);s(this.canvas,e);s(this.element,e)},update:function(t){var i,n,r,s,a,l;i=e.getElementSize(this.viewer.element);if(this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)){this.oldViewerSize=i;if(this.maintainSizeRatio||!this.elementArea){n=i.x*this.sizeRatio;r=i.y*this.sizeRatio}else{n=Math.sqrt(this.elementArea*(i.x/i.y));r=this.elementArea/n}this.element.style.width=Math.round(n)+"px";this.element.style.height=Math.round(r)+"px";if(!this.elementArea){this.elementArea=n*r}this.updateSize()}if(t&&this.viewport){s=t.getBoundsNoRotate(true);a=this.viewport.pixelFromPointNoRotate(s.getTopLeft(),false);l=this.viewport.pixelFromPointNoRotate(s.getBottomRight(),false).minus(this.totalBorderWidths);if(!this.navigatorRotate){var h=t.getRotation(true);o(this.displayRegion,-h)}var u=this.displayRegion.style;u.display=this.world.getItemCount()?"block":"none";u.top=a.y.toFixed(2)+"px";u.left=a.x.toFixed(2)+"px";var c=l.x-a.x;var d=l.y-a.y;u.width=Math.round(Math.max(c,0))+"px";u.height=Math.round(Math.max(d,0))+"px"}},addTiledImage:function(t){var i=this;var n=t.originalTiledImage;delete t.original;var r=e.extend({},t,{success:function(e){var t=e.item;t._originalForNavigator=n;i._matchBounds(t,n,true);i._matchOpacity(t,n);i._matchCompositeOperation(t,n);function r(){i._matchBounds(t,n)}function o(){i._matchOpacity(t,n)}function s(){i._matchCompositeOperation(t,n)}n.addHandler("bounds-change",r);n.addHandler("clip-change",r);n.addHandler("opacity-change",o);n.addHandler("composite-operation-change",s)}});return e.Viewer.prototype.addTiledImage.apply(this,[r])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(e){var t=this.world.getItemCount();var i;for(var n=0;n<t;n++){i=this.world.getItemAt(n);if(i._originalForNavigator===e){return i}}return null},_matchBounds:function(e,t,i){var n=t.getBoundsNoRotate();e.setPosition(n.getTopLeft(),i);e.setWidth(n.width,i);e.setRotation(t.getRotation(),i);e.setClip(t.getClip());e.setFlip(t.getFlip())},_matchOpacity:function(e,t){e.setOpacity(t.opacity)},_matchCompositeOperation:function(e,t){e.setCompositeOperation(t.compositeOperation)}});function t(e){var t={tracker:e.eventSource,position:e.position,quick:e.quick,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.viewer.raiseEvent("navigator-click",t);if(!t.preventDefaultAction&&e.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){if(this.viewer.viewport.flipped){e.position.x=this.viewport.getContainerSize().x-e.position.x}var i=this.viewport.pointFromPixel(e.position);if(!this.panVertical){i.y=this.viewer.viewport.getCenter(true).y}else if(!this.panHorizontal){i.x=this.viewer.viewport.getCenter(true).x}this.viewer.viewport.panTo(i);this.viewer.viewport.applyConstraints()}}function i(e){var t={tracker:e.eventSource,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.viewer.raiseEvent("navigator-drag",t);if(!t.preventDefaultAction&&this.viewer.viewport){if(!this.panHorizontal){e.delta.x=0}if(!this.panVertical){e.delta.y=0}if(this.viewer.viewport.flipped){e.delta.x=-e.delta.x}this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta));if(this.viewer.constrainDuringPan){this.viewer.viewport.applyConstraints()}}}function n(e){if(e.insideElementPressed&&this.viewer.viewport){this.viewer.viewport.applyConstraints()}}function r(e){var t={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefault:e.preventDefault};this.viewer.raiseEvent("navigator-scroll",t);e.preventDefault=t.preventDefault}function o(e,t){s(e,"rotate("+t+"deg)")}function s(e,t){e.style.webkitTransform=t;e.style.mozTransform=t;e.style.msTransform=t;e.style.oTransform=t;e.style.transform=t}})(t);(function(e){var t={Errors:{Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from "+"loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",OpenFailed:"Unable to open {0}: {1}"},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in",ZoomOut:"Zoom out",NextPage:"Next page",PreviousPage:"Previous page",RotateLeft:"Rotate left",RotateRight:"Rotate right",Flip:"Flip Horizontally"}};e.extend(e,{getString:function(i){var n=i.split("."),r=null,o=arguments,s=t,a;for(a=0;a<n.length-1;a++){s=s[n[a]]||{}}r=s[n[a]];if(typeof r!=="string"){e.console.error("Untranslated source string:",i);r=""}return r.replace(/\{\d+\}/g,(function(e){var t=parseInt(e.match(/\d+/),10)+1;return t<o.length?o[t]:""}))},setString:function(e,i){var n=e.split("."),r=t,o;for(o=0;o<n.length-1;o++){if(!r[n[o]]){r[n[o]]={}}r=r[n[o]]}r[n[o]]=i}})})(t);(function(e){e.Point=function(e,t){this.x=typeof e==="number"?e:0;this.y=typeof t==="number"?t:0};e.Point.prototype={clone:function(){return new e.Point(this.x,this.y)},plus:function(t){return new e.Point(this.x+t.x,this.y+t.y)},minus:function(t){return new e.Point(this.x-t.x,this.y-t.y)},times:function(t){return new e.Point(this.x*t,this.y*t)},divide:function(t){return new e.Point(this.x/t,this.y/t)},negate:function(){return new e.Point(-this.x,-this.y)},distanceTo:function(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))},squaredDistanceTo:function(e){return Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2)},apply:function(t){return new e.Point(t(this.x),t(this.y))},equals:function(t){return t instanceof e.Point&&this.x===t.x&&this.y===t.y},rotate:function(t,i){i=i||new e.Point(0,0);var n;var r;if(t%90===0){var o=e.positiveModulo(t,360);switch(o){case 0:n=1;r=0;break;case 90:n=0;r=1;break;case 180:n=-1;r=0;break;case 270:n=0;r=-1;break}}else{var s=t*Math.PI/180;n=Math.cos(s);r=Math.sin(s)}var a=n*(this.x-i.x)-r*(this.y-i.y)+i.x;var l=r*(this.x-i.x)+n*(this.y-i.y)+i.y;return new e.Point(a,l)},toString:function(){return"("+Math.round(this.x*100)/100+","+Math.round(this.y*100)/100+")"}}})(t);(function(e){e.TileSource=function(t,i,n,r,o,s){var a=this;var l=arguments,h,u;if(e.isPlainObject(t)){h=t}else{h={width:l[0],height:l[1],tileSize:l[2],tileOverlap:l[3],minLevel:l[4],maxLevel:l[5]}}e.EventSource.call(this);e.extend(true,this,h);if(!this.success){for(u=0;u<arguments.length;u++){if(e.isFunction(arguments[u])){this.success=arguments[u];break}}}if(this.success){this.addHandler("ready",(function(e){a.success(e)}))}if("string"===e.type(arguments[0])){this.url=arguments[0]}if(this.url){this.aspectRatio=1;this.dimensions=new e.Point(10,10);this._tileWidth=0;this._tileHeight=0;this.tileOverlap=0;this.minLevel=0;this.maxLevel=0;this.ready=false;this.getImageInfo(this.url)}else{this.ready=true;this.aspectRatio=h.width&&h.height?h.width/h.height:1;this.dimensions=new e.Point(h.width,h.height);if(this.tileSize){this._tileWidth=this._tileHeight=this.tileSize;delete this.tileSize}else{if(this.tileWidth){this._tileWidth=this.tileWidth;delete this.tileWidth}else{this._tileWidth=0}if(this.tileHeight){this._tileHeight=this.tileHeight;delete this.tileHeight}else{this._tileHeight=0}}this.tileOverlap=h.tileOverlap?h.tileOverlap:0;this.minLevel=h.minLevel?h.minLevel:0;this.maxLevel=undefined!==h.maxLevel&&null!==h.maxLevel?h.maxLevel:h.width&&h.height?Math.ceil(Math.log(Math.max(h.width,h.height))/Math.log(2)):0;if(this.success&&e.isFunction(this.success)){this.success(this)}}};e.TileSource.prototype={getTileSize:function(t){e.console.error("[TileSource.getTileSize] is deprecated. "+"Use TileSource.getTileWidth() and TileSource.getTileHeight() instead");return this._tileWidth},getTileWidth:function(e){if(!this._tileWidth){return this.getTileSize(e)}return this._tileWidth},getTileHeight:function(e){if(!this._tileHeight){return this.getTileSize(e)}return this._tileHeight},setMaxLevel:function(e){this.maxLevel=e;this._memoizeLevelScale()},getLevelScale:function(e){this._memoizeLevelScale();return this.getLevelScale(e)},_memoizeLevelScale:function(){var e={},t;for(t=0;t<=this.maxLevel;t++){e[t]=1/Math.pow(2,this.maxLevel-t)}this.getLevelScale=function(t){return e[t]}},getNumTiles:function(t){var i=this.getLevelScale(t),n=Math.ceil(i*this.dimensions.x/this.getTileWidth(t)),r=Math.ceil(i*this.dimensions.y/this.getTileHeight(t));return new e.Point(n,r)},getPixelRatio:function(t){var i=this.dimensions.times(this.getLevelScale(t)),n=1/i.x*e.pixelDensityRatio,r=1/i.y*e.pixelDensityRatio;return new e.Point(n,r)},getClosestLevel:function(){var e,t;for(e=this.minLevel+1;e<=this.maxLevel;e++){t=this.getNumTiles(e);if(t.x>1||t.y>1){break}}return e-1},getTileAtPoint:function(t,i){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;e.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var r=this.dimensions.x*this.getLevelScale(t);var o=i.x*r;var s=i.y*r;var a=Math.floor(o/this.getTileWidth(t));var l=Math.floor(s/this.getTileHeight(t));if(i.x>=1){a=this.getNumTiles(t).x-1}var h=1e-15;if(i.y>=1/this.aspectRatio-h){l=this.getNumTiles(t).y-1}return new e.Point(a,l)},getTileBounds:function(t,i,n,r){var o=this.dimensions.times(this.getLevelScale(t)),s=this.getTileWidth(t),a=this.getTileHeight(t),l=i===0?0:s*i-this.tileOverlap,h=n===0?0:a*n-this.tileOverlap,u=s+(i===0?1:2)*this.tileOverlap,c=a+(n===0?1:2)*this.tileOverlap,d=1/o.x;u=Math.min(u,o.x-l);c=Math.min(c,o.y-h);if(r){return new e.Rect(0,0,u,c)}return new e.Rect(l*d,h*d,u*d,c*d)},getImageInfo:function(t){var n=this,r,o,s,a,l,h,u;if(t){l=t.split("/");h=l[l.length-1];u=h.lastIndexOf(".");if(u>-1){l[l.length-1]=h.slice(0,u)}}var c=null;if(this.splitHashDataForPost){var d=t.indexOf("#");if(d!==-1){c=t.substring(d+1);t=t.substr(0,d)}}o=function(i){if(typeof i==="string"){i=e.parseXml(i)}var r=e.TileSource.determineType(n,i,t);if(!r){n.raiseEvent("open-failed",{message:"Unable to load TileSource",source:t});return}a=r.prototype.configure.apply(n,[i,t,c]);if(a.ajaxWithCredentials===undefined){a.ajaxWithCredentials=n.ajaxWithCredentials}s=new r(a);n.ready=true;n.raiseEvent("ready",{tileSource:s})};if(t.match(/\.js$/)){r=t.split("/").pop().replace(".js","");e.jsonp({url:t,async:false,callbackName:r,callback:o})}else{e.makeAjaxRequest({url:t,postData:c,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){var t=i(e);o(t)},error:function(i,r){var o;try{o="HTTP "+i.status+" attempting to load TileSource: "+t}catch(e){var s;if(typeof r==="undefined"||!r.toString){s="Unknown error"}else{s=r.toString()}o=s+" attempting to load TileSource: "+t}e.console.error(o);n.raiseEvent("open-failed",{message:o,source:t,postData:c})}})}},supports:function(e,t){return false},configure:function(e,t,i){throw new Error("Method not implemented.")},getTileUrl:function(e,t,i){throw new Error("Method not implemented.")},getTilePostData:function(e,t,i){return null},getTileAjaxHeaders:function(e,t,i){return{}},getTileHashKey:function(e,t,i,n,r,o){function s(e){return r?e+"+"+JSON.stringify(r):e}if(typeof n!=="string"){return s(e+"/"+t+"_"+i)}return s(n)},tileExists:function(e,t,i){var n=this.getNumTiles(e);return e>=this.minLevel&&e<=this.maxLevel&&t>=0&&i>=0&&t<n.x&&i<n.y},hasTransparency:function(e,t,i,n){return!!e||t.match(".png")},downloadTileStart:function(t){var i=t.userData,n=new Image;i.image=n;i.request=null;var r=function(e){if(!n){t.finish(null,i.request,"Image load failed: undefined Image instance.");return}n.onload=n.onerror=n.onabort=null;t.finish(e?null:n,i.request,e)};n.onload=function(){r()};n.onabort=n.onerror=function(){r("Image load aborted.")};if(t.loadWithAjax){i.request=e.makeAjaxRequest({url:t.src,withCredentials:t.ajaxWithCredentials,headers:t.ajaxHeaders,responseType:"arraybuffer",postData:t.postData,success:function(e){var t;try{t=new window.Blob([e.response])}catch(n){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n.name==="TypeError"&&i){var o=new i;o.append(e.response);t=o.getBlob()}}if(t.size===0){r("Empty image response.")}else{n.src=(window.URL||window.webkitURL).createObjectURL(t)}},error:function(e){r("Image load aborted - XHR error")}})}else{if(t.crossOriginPolicy!==false){n.crossOrigin=t.crossOriginPolicy}n.src=t.src}},downloadTileAbort:function(e){if(e.userData.request){e.userData.request.abort()}var t=e.userData.image;if(e.userData.image){t.onload=t.onerror=t.onabort=null}},createTileCache:function(e,t,i){e._data=t},destroyTileCache:function(e){e._data=null;e._renderedContext=null},getTileCacheData:function(e){return e._data},getTileCacheDataAsImage:function(e){return e._data},getTileCacheDataAsContext2D:function(e){if(!e._renderedContext){var t=document.createElement("canvas");t.width=e._data.width;t.height=e._data.height;e._renderedContext=t.getContext("2d");e._renderedContext.drawImage(e._data,0,0);e._data=null}return e._renderedContext}};e.extend(true,e.TileSource.prototype,e.EventSource.prototype);function i(t){var i=t.responseText,n=t.status,r,o;if(!t){throw new Error(e.getString("Errors.Security"))}else if(t.status!==200&&t.status!==0){n=t.status;r=n===404?"Not Found":t.statusText;throw new Error(e.getString("Errors.Status",n,r))}if(i.match(/^\s*<.*/)){try{o=t.responseXML&&t.responseXML.documentElement?t.responseXML:e.parseXml(i)}catch(e){o=t.responseText}}else if(i.match(/\s*[{[].*/)){try{o=e.parseJSON(i)}catch(e){o=i}}else{o=i}return o}e.TileSource.determineType=function(i,n,r){var o;for(o in t){if(o.match(/.+TileSource$/)&&e.isFunction(t[o])&&e.isFunction(t[o].prototype.supports)&&t[o].prototype.supports.call(i,n,r)){return t[o]}}e.console.error("No TileSource was able to open %s %s",r,n);return null}})(t);(function(e){e.DziTileSource=function(t,i,n,r,o,s,a,l,h){var u,c,d,p;if(e.isPlainObject(t)){p=t}else{p={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]}}this._levelRects={};this.tilesUrl=p.tilesUrl;this.fileFormat=p.fileFormat;this.displayRects=p.displayRects;if(this.displayRects){for(u=this.displayRects.length-1;u>=0;u--){c=this.displayRects[u];for(d=c.minLevel;d<=c.maxLevel;d++){if(!this._levelRects[d]){this._levelRects[d]=[]}this._levelRects[d].push(c)}}}e.TileSource.apply(this,[p])};e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){var i;if(e.Image){i=e.Image.xmlns}else if(e.documentElement){if("Image"===e.documentElement.localName||"Image"===e.documentElement.tagName){i=e.documentElement.namespaceURI}}i=(i||"").toLowerCase();return i.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||i.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(n,r,o){var s;if(!e.isPlainObject(n)){s=t(this,n)}else{s=i(this,n)}if(r&&!s.tilesUrl){s.tilesUrl=r.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/");if(r.search(/\.(dzi|xml|js)\?/)!==-1){s.queryParams=r.match(/\?.*/)}else{s.queryParams=""}}return s},getTileUrl:function(e,t,i){return[this.tilesUrl,e,"/",t,"_",i,".",this.fileFormat,this.queryParams].join("")},tileExists:function(e,t,i){var n=this._levelRects[e],r,o,s,a,l,h,u;if(this.minLevel&&e<this.minLevel||this.maxLevel&&e>this.maxLevel){return false}if(!n||!n.length){return true}for(u=n.length-1;u>=0;u--){r=n[u];if(e<r.minLevel||e>r.maxLevel){continue}o=this.getLevelScale(e);s=r.x*o;a=r.y*o;l=s+r.width*o;h=a+r.height*o;s=Math.floor(s/this._tileWidth);a=Math.floor(a/this._tileWidth);l=Math.ceil(l/this._tileWidth);h=Math.ceil(h/this._tileWidth);if(s<=t&&t<l&&a<=i&&i<h){return true}}return false}});function t(t,n){if(!n||!n.documentElement){throw new Error(e.getString("Errors.Xml"))}var r=n.documentElement,o=r.localName||r.tagName,s=n.documentElement.namespaceURI,a=null,l=[],h,u,c,d,p;if(o==="Image"){try{d=r.getElementsByTagName("Size")[0];if(d===undefined){d=r.getElementsByTagNameNS(s,"Size")[0]}a={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:r.getAttribute("Url"),Format:r.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(r.getAttribute("Overlap"),10),TileSize:parseInt(r.getAttribute("TileSize"),10),Size:{Height:parseInt(d.getAttribute("Height"),10),Width:parseInt(d.getAttribute("Width"),10)}}};if(!e.imageFormatSupported(a.Image.Format)){throw new Error(e.getString("Errors.ImageFormat",a.Image.Format.toUpperCase()))}h=r.getElementsByTagName("DisplayRect");if(h===undefined){h=r.getElementsByTagNameNS(s,"DisplayRect")[0]}for(p=0;p<h.length;p++){u=h[p];c=u.getElementsByTagName("Rect")[0];if(c===undefined){c=u.getElementsByTagNameNS(s,"Rect")[0]}l.push({Rect:{X:parseInt(c.getAttribute("X"),10),Y:parseInt(c.getAttribute("Y"),10),Width:parseInt(c.getAttribute("Width"),10),Height:parseInt(c.getAttribute("Height"),10),MinLevel:parseInt(u.getAttribute("MinLevel"),10),MaxLevel:parseInt(u.getAttribute("MaxLevel"),10)}})}if(l.length){a.Image.DisplayRect=l}return i(t,a)}catch(t){throw t instanceof Error?t:new Error(e.getString("Errors.Dzi"))}}else if(o==="Collection"){throw new Error(e.getString("Errors.Dzc"))}else if(o==="Error"){var f=r.getElementsByTagName("Message")[0];var g=f.firstChild.nodeValue;throw new Error(g)}throw new Error(e.getString("Errors.Dzi"))}function i(t,i){var n=i.Image,r=n.Url,o=n.Format,s=n.Size,a=n.DisplayRect||[],l=parseInt(s.Width,10),h=parseInt(s.Height,10),u=parseInt(n.TileSize,10),c=parseInt(n.Overlap,10),d=[],p,f;for(f=0;f<a.length;f++){p=a[f].Rect;d.push(new e.DisplayRect(parseInt(p.X,10),parseInt(p.Y,10),parseInt(p.Width,10),parseInt(p.Height,10),parseInt(p.MinLevel,10),parseInt(p.MaxLevel,10)))}return e.extend(true,{width:l,height:h,tileSize:u,tileOverlap:c,minLevel:null,maxLevel:null,tilesUrl:r,fileFormat:o,displayRects:d},i)}})(t);(function(e){e.IIIFTileSource=function(t){e.extend(true,this,t);this._id=this["@id"]||this["id"]||this["identifier"]||null;if(!(this.height&&this.width&&this._id)){throw new Error("IIIF required parameters (width, height, or id) not provided.")}t.tileSizePerScaleFactor={};this.tileFormat=this.tileFormat||"jpg";this.version=t.version;if(this.tile_width&&this.tile_height){t.tileWidth=this.tile_width;t.tileHeight=this.tile_height}else if(this.tile_width){t.tileSize=this.tile_width}else if(this.tile_height){t.tileSize=this.tile_height}else if(this.tiles){if(this.tiles.length===1){t.tileWidth=this.tiles[0].width;t.tileHeight=this.tiles[0].height||this.tiles[0].width;this.scale_factors=this.tiles[0].scaleFactors}else{this.scale_factors=[];for(var r=0;r<this.tiles.length;r++){for(var o=0;o<this.tiles[r].scaleFactors.length;o++){var s=this.tiles[r].scaleFactors[o];this.scale_factors.push(s);t.tileSizePerScaleFactor[s]={width:this.tiles[r].width,height:this.tiles[r].height||this.tiles[r].width}}}}}else if(i(t)){var a=Math.min(this.height,this.width),l=[256,512,1024],h=[];for(var u=0;u<l.length;u++){if(l[u]<=a){h.push(l[u])}}if(h.length>0){t.tileSize=Math.max.apply(null,h)}else{t.tileSize=a}}else if(this.sizes&&this.sizes.length>0){this.emulateLegacyImagePyramid=true;t.levels=n(this);e.extend(true,t,{width:t.levels[t.levels.length-1].width,height:t.levels[t.levels.length-1].height,tileSize:Math.max(t.height,t.width),tileOverlap:0,minLevel:0,maxLevel:t.levels.length-1});this.levels=t.levels}else{e.console.error("Nothing in the info.json to construct image pyramids from")}if(!t.maxLevel&&!this.emulateLegacyImagePyramid){if(!this.scale_factors){t.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)))}else{var c=Math.max.apply(null,this.scale_factors);t.maxLevel=Math.round(Math.log(c)*Math.LOG2E)}}if(this.sizes){var d=this.sizes.length;if(d===t.maxLevel||d===t.maxLevel+1){this.levelSizes=this.sizes.slice().sort((function(e,t){return e.width-t.width}));if(d===t.maxLevel){this.levelSizes.push({width:this.width,height:this.height})}}}e.TileSource.apply(this,[t])};e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){if(e.protocol&&e.protocol==="http://iiif.io/api/image"){return true}else if(e["@context"]&&(e["@context"]==="http://library.stanford.edu/iiif/image-api/1.1/context.json"||e["@context"]==="http://iiif.io/api/image/1/context.json")){return true}else if(e.profile&&e.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0){return true}else if(e.identifier&&e.width&&e.height){return true}else if(e.documentElement&&"info"===e.documentElement.tagName&&"http://library.stanford.edu/iiif/image-api/ns/"===e.documentElement.namespaceURI){return true}else{return false}},configure:function(i,n,o){if(!e.isPlainObject(i)){var s=r(i);s["@context"]="http://iiif.io/api/image/1.0/context.json";s["@id"]=n.replace("/info.xml","");s.version=1;return s}else{if(!i["@context"]){i["@context"]="http://iiif.io/api/image/1.0/context.json";i["@id"]=n.replace("/info.json","");i.version=1}else{var a=i["@context"];if(Array.isArray(a)){for(var l=0;l<a.length;l++){if(typeof a[l]==="string"&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(a[l])||a[l]==="http://library.stanford.edu/iiif/image-api/1.1/context.json")){a=a[l];break}}}switch(a){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":i.version=1;break;case"http://iiif.io/api/image/2/context.json":i.version=2;break;case"http://iiif.io/api/image/3/context.json":i.version=3;break;default:e.console.error("Data has a @context property which contains no known IIIF context URI.")}}if(i.preferredFormats){for(var h=0;h<i.preferredFormats.length;h++){if(t.imageFormatSupported(i.preferredFormats[h])){i.tileFormat=i.preferredFormats[h];break}}}return i}},getTileWidth:function(t){if(this.emulateLegacyImagePyramid){return e.TileSource.prototype.getTileWidth.call(this,t)}var i=Math.pow(2,this.maxLevel-t);if(this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]){return this.tileSizePerScaleFactor[i].width}return this._tileWidth},getTileHeight:function(t){if(this.emulateLegacyImagePyramid){return e.TileSource.prototype.getTileHeight.call(this,t)}var i=Math.pow(2,this.maxLevel-t);if(this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]){return this.tileSizePerScaleFactor[i].height}return this._tileHeight},getLevelScale:function(t){if(this.emulateLegacyImagePyramid){var i=NaN;if(this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel){i=this.levels[t].width/this.levels[this.maxLevel].width}return i}return e.TileSource.prototype.getLevelScale.call(this,t)},getNumTiles:function(t){if(this.emulateLegacyImagePyramid){var i=this.getLevelScale(t);if(i){return new e.Point(1,1)}else{return new e.Point(0,0)}}if(this.levelSizes){var n=this.levelSizes[t];var r=Math.ceil(n.width/this.getTileWidth(t)),o=Math.ceil(n.height/this.getTileHeight(t));return new e.Point(r,o)}else{return e.TileSource.prototype.getNumTiles.call(this,t)}},getTileAtPoint:function(t,i){if(this.emulateLegacyImagePyramid){return new e.Point(0,0)}if(this.levelSizes){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;e.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var r=this.levelSizes[t].width;var o=i.x*r;var s=i.y*r;var a=Math.floor(o/this.getTileWidth(t));var l=Math.floor(s/this.getTileHeight(t));if(i.x>=1){a=this.getNumTiles(t).x-1}var h=1e-15;if(i.y>=1/this.aspectRatio-h){l=this.getNumTiles(t).y-1}return new e.Point(a,l)}return e.TileSource.prototype.getTileAtPoint.call(this,t,i)},getTileUrl:function(e,t,i){if(this.emulateLegacyImagePyramid){var n=null;if(this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].url}return n}var r="0",o=Math.pow(.5,this.maxLevel-e),s,a,l,h,u,c,d,p,f,g,v,m,y,w,T,x;if(this.levelSizes){s=this.levelSizes[e].width;a=this.levelSizes[e].height}else{s=Math.ceil(this.width*o);a=Math.ceil(this.height*o)}l=this.getTileWidth(e);h=this.getTileHeight(e);u=Math.round(l/o);c=Math.round(h/o);if(this.version===1){T="native."+this.tileFormat}else{T="default."+this.tileFormat}if(s<l&&a<h){if(this.version===2&&s===this.width){m="full"}else if(this.version===3&&s===this.width&&a===this.height){m="max"}else if(this.version===3){m=s+","+a}else{m=s+","}d="full"}else{p=t*u;f=i*c;g=Math.min(u,this.width-p);v=Math.min(c,this.height-f);if(t===0&&i===0&&g===this.width&&v===this.height){d="full"}else{d=[p,f,g,v].join(",")}y=Math.min(l,s-t*l);w=Math.min(h,a-i*h);if(this.version===2&&y===this.width){m="full"}else if(this.version===3&&y===this.width&&w===this.height){m="max"}else if(this.version===3){m=y+","+w}else{m=y+","}}x=[this._id,d,m,r,T].join("/");return x},__testonly__:{canBeTiled:i,constructLevels:n}});function i(e){var t=["http://library.stanford.edu/iiif/image-api/compliance.html#level0","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0","http://iiif.io/api/image/2/level0.json","level0","https://iiif.io/api/image/3/level0.json"];var i=Array.isArray(e.profile)?e.profile[0]:e.profile;var n=t.indexOf(i)!==-1;var r=false;if(e.version===2&&e.profile.length>1&&e.profile[1].supports){r=e.profile[1].supports.indexOf("sizeByW")!==-1}if(e.version===3&&e.extraFeatures){r=e.extraFeatures.indexOf("sizeByWh")!==-1}return!n||r}function n(e){var t=[];for(var i=0;i<e.sizes.length;i++){t.push({url:e._id+"/full/"+e.sizes[i].width+","+(e.version===3?e.sizes[i].height:"")+"/0/default."+e.tileFormat,width:e.sizes[i].width,height:e.sizes[i].height})}return t.sort((function(e,t){return e.width-t.width}))}function r(t){if(!t||!t.documentElement){throw new Error(e.getString("Errors.Xml"))}var i=t.documentElement,n=i.tagName,r=null;if(n==="info"){try{r={};o(i,r);return r}catch(t){throw t instanceof Error?t:new Error(e.getString("Errors.IIIF"))}}throw new Error(e.getString("Errors.IIIF"))}function o(t,i,n){var r,s;if(t.nodeType===3&&n){s=t.nodeValue.trim();if(s.match(/^\d*$/)){s=Number(s)}if(!i[n]){i[n]=s}else{if(!e.isArray(i[n])){i[n]=[i[n]]}i[n].push(s)}}else if(t.nodeType===1){for(r=0;r<t.childNodes.length;r++){o(t.childNodes[r],i,t.nodeName)}}}})(t);(function(e){e.OsmTileSource=function(t,i,n,r,o){var s;if(e.isPlainObject(t)){s=t}else{s={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}}if(!s.width||!s.height){s.width=65572864;s.height=65572864}if(!s.tileSize){s.tileSize=256;s.tileOverlap=0}if(!s.tilesUrl){s.tilesUrl="http://tile.openstreetmap.org/"}s.minLevel=8;e.TileSource.apply(this,[s])};e.extend(e.OsmTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"openstreetmaps"===e.type},configure:function(e,t,i){return e},getTileUrl:function(e,t,i){return this.tilesUrl+(e-8)+"/"+t+"/"+i+".png"}})})(t);(function(e){e.TmsTileSource=function(t,i,n,r,o){var s;if(e.isPlainObject(t)){s=t}else{s={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}}var a=Math.ceil(s.width/256)*256,l=Math.ceil(s.height/256)*256,h;if(a>l){h=a/256}else{h=l/256}s.maxLevel=Math.ceil(Math.log(h)/Math.log(2))-1;s.tileSize=256;s.width=a;s.height=l;e.TileSource.apply(this,[s])};e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"tiledmapservice"===e.type},configure:function(e,t,i){return e},getTileUrl:function(e,t,i){var n=this.getNumTiles(e).y-1;return this.tilesUrl+e+"/"+t+"/"+(n-i)+".png"}})})(t);(function(e){e.ZoomifyTileSource=function(e){if(typeof e.tileSize==="undefined"){e.tileSize=256}if(typeof e.fileFormat==="undefined"){e.fileFormat="jpg";this.fileFormat=e.fileFormat}var i={x:e.width,y:e.height};e.imageSizes=[{x:e.width,y:e.height}];e.gridSize=[this._getGridSize(e.width,e.height,e.tileSize)];while(parseInt(i.x,10)>e.tileSize||parseInt(i.y,10)>e.tileSize){i.x=Math.floor(i.x/2);i.y=Math.floor(i.y/2);e.imageSizes.push({x:i.x,y:i.y});e.gridSize.push(this._getGridSize(i.x,i.y,e.tileSize))}e.imageSizes.reverse();e.gridSize.reverse();e.minLevel=0;e.maxLevel=e.gridSize.length-1;t.TileSource.apply(this,[e])};e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(e,t,i){return{x:Math.ceil(e/i),y:Math.ceil(t/i)}},_calculateAbsoluteTileNumber:function(e,t,i){var n=0;var r={};for(var o=0;o<e;o++){r=this.gridSize[o];n+=r.x*r.y}r=this.gridSize[e];n+=r.x*i+t;return n},supports:function(e,t){return e.type&&"zoomifytileservice"===e.type},configure:function(e,t,i){return e},getTileUrl:function(e,t,i){var n=0;var r=this._calculateAbsoluteTileNumber(e,t,i);n=Math.floor(r/256);return this.tilesUrl+"TileGroup"+n+"/"+e+"-"+t+"-"+i+"."+this.fileFormat}})})(t);(function(e){e.LegacyTileSource=function(i){var n,r,o;if(e.isArray(i)){n={type:"legacy-image-pyramid",levels:i}}n.levels=t(n.levels);if(n.levels.length>0){r=n.levels[n.levels.length-1].width;o=n.levels[n.levels.length-1].height}else{r=0;o=0;e.console.error("No supported image formats found")}e.extend(true,n,{width:r,height:o,tileSize:Math.max(o,r),tileOverlap:0,minLevel:0,maxLevel:n.levels.length>0?n.levels.length-1:0});e.TileSource.apply(this,[n]);this.levels=n.levels};e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"legacy-image-pyramid"===e.type||e.documentElement&&"legacy-image-pyramid"===e.documentElement.getAttribute("type")},configure:function(t,r,o){var s;if(!e.isPlainObject(t)){s=i(this,t)}else{s=n(this,t)}return s},getLevelScale:function(e){var t=NaN;if(this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel){t=this.levels[e].width/this.levels[this.maxLevel].width}return t},getNumTiles:function(t){var i=this.getLevelScale(t);if(i){return new e.Point(1,1)}else{return new e.Point(0,0)}},getTileUrl:function(e,t,i){var n=null;if(this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].url}return n}});function t(t){var i=[],n,r;for(r=0;r<t.length;r++){n=t[r];if(n.height&&n.width&&n.url){i.push({url:n.url,width:Number(n.width),height:Number(n.height)})}else{e.console.error("Unsupported image format: %s",n.url?n.url:"<no URL>")}}return i.sort((function(e,t){return e.height-t.height}))}function i(t,i){if(!i||!i.documentElement){throw new Error(e.getString("Errors.Xml"))}var r=i.documentElement,o=r.tagName,s=null,a=[],l,h;if(o==="image"){try{s={type:r.getAttribute("type"),levels:[]};a=r.getElementsByTagName("level");for(h=0;h<a.length;h++){l=a[h];s.levels.push({url:l.getAttribute("url"),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10)})}return n(t,s)}catch(e){throw e instanceof Error?e:new Error("Unknown error parsing Legacy Image Pyramid XML.")}}else if(o==="collection"){throw new Error("Legacy Image Pyramid Collections not yet supported.")}else if(o==="error"){throw new Error("Error: "+i)}throw new Error("Unknown element "+o)}function n(e,t){return t.levels}})(t);(function(e){e.ImageTileSource=function(t){t=e.extend({buildPyramid:true,crossOriginPolicy:false,ajaxWithCredentials:false,useCanvas:true},t);e.TileSource.apply(this,[t])};e.extend(e.ImageTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&e.type==="image"},configure:function(e,t,i){return e},getImageInfo:function(t){var i=this._image=new Image;var n=this;if(this.crossOriginPolicy){i.crossOrigin=this.crossOriginPolicy}if(this.ajaxWithCredentials){i.useCredentials=this.ajaxWithCredentials}e.addEvent(i,"load",(function(){n.width=i.naturalWidth;n.height=i.naturalHeight;n.aspectRatio=n.width/n.height;n.dimensions=new e.Point(n.width,n.height);n._tileWidth=n.width;n._tileHeight=n.height;n.tileOverlap=0;n.minLevel=0;n.levels=n._buildLevels();n.maxLevel=n.levels.length-1;n.ready=true;n.raiseEvent("ready",{tileSource:n})}));e.addEvent(i,"error",(function(){n.raiseEvent("open-failed",{message:"Error loading image at "+t,source:t})}));i.src=t},getLevelScale:function(e){var t=NaN;if(e>=this.minLevel&&e<=this.maxLevel){t=this.levels[e].width/this.levels[this.maxLevel].width}return t},getNumTiles:function(t){var i=this.getLevelScale(t);if(i){return new e.Point(1,1)}else{return new e.Point(0,0)}},getTileUrl:function(e,t,i){var n=null;if(e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].url}return n},getContext2D:function(e,t,i){var n=null;if(e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].context2D}return n},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var t=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas){delete this._image;return t}var i=this._image.naturalWidth;var n=this._image.naturalHeight;var r=document.createElement("canvas");var o=r.getContext("2d");r.width=i;r.height=n;o.drawImage(this._image,0,0,i,n);t[0].context2D=o;delete this._image;if(e.isCanvasTainted(r)){return t}while(i>=2&&n>=2){i=Math.floor(i/2);n=Math.floor(n/2);var s=document.createElement("canvas");var a=s.getContext("2d");s.width=i;s.height=n;a.drawImage(r,0,0,i,n);t.splice(0,0,{context2D:a,width:i,height:n});r=s;o=a}return t},_freeupCanvasMemory:function(){for(var e=0;e<this.levels.length;e++){if(this.levels[e].context2D){this.levels[e].context2D.canvas.height=0;this.levels[e].context2D.canvas.width=0}}}})})(t);(function(e){e.TileSourceCollection=function(t,i,n,r){e.console.error("TileSourceCollection is deprecated; use World instead")}})(t);(function(e){e.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3};e.Button=function(t){var i=this;e.EventSource.call(this);e.extend(true,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},t);this.element=t.element||e.makeNeutralElement("div");if(!t.element){this.imgRest=e.makeTransparentImage(this.srcRest);this.imgGroup=e.makeTransparentImage(this.srcGroup);this.imgHover=e.makeTransparentImage(this.srcHover);this.imgDown=e.makeTransparentImage(this.srcDown);this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip;e.setElementPointerEventsNone(this.imgRest);e.setElementPointerEventsNone(this.imgGroup);e.setElementPointerEventsNone(this.imgHover);e.setElementPointerEventsNone(this.imgDown);this.element.style.position="relative";e.setElementTouchActionNone(this.element);this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute";this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px";this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px";this.imgHover.style.visibility=this.imgDown.style.visibility="hidden";if(e.Browser.vendor===e.BROWSERS.FIREFOX&&e.Browser.version<3){this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=""}this.element.appendChild(this.imgRest);this.element.appendChild(this.imgGroup);this.element.appendChild(this.imgHover);this.element.appendChild(this.imgDown)}this.addHandler("press",this.onPress);this.addHandler("release",this.onRelease);this.addHandler("click",this.onClick);this.addHandler("enter",this.onEnter);this.addHandler("exit",this.onExit);this.addHandler("focus",this.onFocus);this.addHandler("blur",this.onBlur);this.currentState=e.ButtonState.GROUP;this.fadeBeginTime=null;this.shouldFade=false;this.element.style.display="inline-block";this.element.style.position="relative";this.element.title=this.tooltip;this.tracker=new e.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){if(t.insideElementPressed){o(i,e.ButtonState.DOWN);i.raiseEvent("enter",{originalEvent:t.originalEvent})}else if(!t.buttonDownAny){o(i,e.ButtonState.HOVER)}},focusHandler:function(e){i.tracker.enterHandler(e);i.raiseEvent("focus",{originalEvent:e.originalEvent})},leaveHandler:function(t){s(i,e.ButtonState.GROUP);if(t.insideElementPressed){i.raiseEvent("exit",{originalEvent:t.originalEvent})}},blurHandler:function(e){i.tracker.leaveHandler(e);i.raiseEvent("blur",{originalEvent:e.originalEvent})},pressHandler:function(t){o(i,e.ButtonState.DOWN);i.raiseEvent("press",{originalEvent:t.originalEvent})},releaseHandler:function(t){if(t.insideElementPressed&&t.insideElementReleased){s(i,e.ButtonState.HOVER);i.raiseEvent("release",{originalEvent:t.originalEvent})}else if(t.insideElementPressed){s(i,e.ButtonState.GROUP)}else{o(i,e.ButtonState.HOVER)}},clickHandler:function(e){if(e.quick){i.raiseEvent("click",{originalEvent:e.originalEvent})}},keyHandler:function(e){if(13===e.keyCode){i.raiseEvent("click",{originalEvent:e.originalEvent});i.raiseEvent("release",{originalEvent:e.originalEvent});e.preventDefault=true}else{e.preventDefault=false}}});s(this,e.ButtonState.REST)};e.extend(e.Button.prototype,e.EventSource.prototype,{notifyGroupEnter:function(){o(this,e.ButtonState.GROUP)},notifyGroupExit:function(){s(this,e.ButtonState.REST)},disable:function(){this.notifyGroupExit();this.element.disabled=true;this.tracker.setTracking(false);e.setElementOpacity(this.element,.2,true)},enable:function(){this.element.disabled=false;this.tracker.setTracking(true);e.setElementOpacity(this.element,1,true);this.notifyGroupEnter()},destroy:function(){if(this.imgRest){this.element.removeChild(this.imgRest);this.imgRest=null}if(this.imgGroup){this.element.removeChild(this.imgGroup);this.imgGroup=null}if(this.imgHover){this.element.removeChild(this.imgHover);this.imgHover=null}if(this.imgDown){this.element.removeChild(this.imgDown);this.imgDown=null}this.removeAllHandlers();this.tracker.destroy();this.element=null}});function t(t){e.requestAnimationFrame((function(){i(t)}))}function i(i){var n,r,o;if(i.shouldFade){n=e.now();r=n-i.fadeBeginTime;o=1-r/i.fadeLength;o=Math.min(1,o);o=Math.max(0,o);if(i.imgGroup){e.setElementOpacity(i.imgGroup,o,true)}if(o>0){t(i)}}}function n(i){i.shouldFade=true;i.fadeBeginTime=e.now()+i.fadeDelay;window.setTimeout((function(){t(i)}),i.fadeDelay)}function r(t){t.shouldFade=false;if(t.imgGroup){e.setElementOpacity(t.imgGroup,1,true)}}function o(t,i){if(t.element.disabled){return}if(i>=e.ButtonState.GROUP&&t.currentState===e.ButtonState.REST){r(t);t.currentState=e.ButtonState.GROUP}if(i>=e.ButtonState.HOVER&&t.currentState===e.ButtonState.GROUP){if(t.imgHover){t.imgHover.style.visibility=""}t.currentState=e.ButtonState.HOVER}if(i>=e.ButtonState.DOWN&&t.currentState===e.ButtonState.HOVER){if(t.imgDown){t.imgDown.style.visibility=""}t.currentState=e.ButtonState.DOWN}}function s(t,i){if(t.element.disabled){return}if(i<=e.ButtonState.HOVER&&t.currentState===e.ButtonState.DOWN){if(t.imgDown){t.imgDown.style.visibility="hidden"}t.currentState=e.ButtonState.HOVER}if(i<=e.ButtonState.GROUP&&t.currentState===e.ButtonState.HOVER){if(t.imgHover){t.imgHover.style.visibility="hidden"}t.currentState=e.ButtonState.GROUP}if(i<=e.ButtonState.REST&&t.currentState===e.ButtonState.GROUP){n(t);t.currentState=e.ButtonState.REST}}})(t);(function(e){e.ButtonGroup=function(t){e.extend(true,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},t);var i=this.buttons.concat([]),n=this,r;this.element=t.element||e.makeNeutralElement("div");if(!t.group){this.element.style.display="inline-block";for(r=0;r<i.length;r++){this.element.appendChild(i[r].element)}}e.setElementTouchActionNone(this.element);this.tracker=new e.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(e){var t;for(t=0;t<n.buttons.length;t++){n.buttons[t].notifyGroupEnter()}},leaveHandler:function(e){var t;if(!e.insideElementPressed){for(t=0;t<n.buttons.length;t++){n.buttons[t].notifyGroupExit()}}}})};e.ButtonGroup.prototype={addButton:function(e){this.buttons.push(e);this.element.appendChild(e.element)},emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){while(this.buttons.length){var e=this.buttons.pop();this.element.removeChild(e.element);e.destroy()}this.tracker.destroy();this.element=null}}})(t);(function(e){e.Rect=function(t,i,n,r,o){this.x=typeof t==="number"?t:0;this.y=typeof i==="number"?i:0;this.width=typeof n==="number"?n:0;this.height=typeof r==="number"?r:0;this.degrees=typeof o==="number"?o:0;this.degrees=e.positiveModulo(this.degrees,360);var s,a;if(this.degrees>=270){s=this.getTopRight();this.x=s.x;this.y=s.y;a=this.height;this.height=this.width;this.width=a;this.degrees-=270}else if(this.degrees>=180){s=this.getBottomRight();this.x=s.x;this.y=s.y;this.degrees-=180}else if(this.degrees>=90){s=this.getBottomLeft();this.x=s.x;this.y=s.y;a=this.height;this.height=this.width;this.width=a;this.degrees-=90}};e.Rect.fromSummits=function(t,i,n){var r=t.distanceTo(i);var o=t.distanceTo(n);var s=i.minus(t);var a=Math.atan(s.y/s.x);if(s.x<0){a+=Math.PI}else if(s.y<0){a+=2*Math.PI}return new e.Rect(t.x,t.y,r,o,a/Math.PI*180)};e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(t){return t instanceof e.Rect&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height&&this.degrees===t.degrees},times:function(t){return new e.Rect(this.x*t,this.y*t,this.width*t,this.height*t,this.degrees)},translate:function(t){return new e.Rect(this.x+t.x,this.y+t.y,this.width,this.height,this.degrees)},union:function(t){var i=this.getBoundingBox();var n=t.getBoundingBox();var r=Math.min(i.x,n.x);var o=Math.min(i.y,n.y);var s=Math.max(i.x+i.width,n.x+n.width);var a=Math.max(i.y+i.height,n.y+n.height);return new e.Rect(r,o,s-r,a-o)},intersection:function(t){var i=1e-10;var n=[];var r=this.getTopLeft();if(t.containsPoint(r,i)){n.push(r)}var o=this.getTopRight();if(t.containsPoint(o,i)){n.push(o)}var s=this.getBottomLeft();if(t.containsPoint(s,i)){n.push(s)}var a=this.getBottomRight();if(t.containsPoint(a,i)){n.push(a)}var l=t.getTopLeft();if(this.containsPoint(l,i)){n.push(l)}var h=t.getTopRight();if(this.containsPoint(h,i)){n.push(h)}var u=t.getBottomLeft();if(this.containsPoint(u,i)){n.push(u)}var c=t.getBottomRight();if(this.containsPoint(c,i)){n.push(c)}var d=this._getSegments();var p=t._getSegments();for(var f=0;f<d.length;f++){var g=d[f];for(var v=0;v<p.length;v++){var m=p[v];var y=w(g[0],g[1],m[0],m[1]);if(y){n.push(y)}}}function w(t,n,r,o){var s=n.minus(t);var a=o.minus(r);var l=-a.x*s.y+s.x*a.y;if(l===0){return null}var h=(s.x*(t.y-r.y)-s.y*(t.x-r.x))/l;var u=(a.x*(t.y-r.y)-a.y*(t.x-r.x))/l;if(-i<=h&&h<=1-i&&-i<=u&&u<=1-i){return new e.Point(t.x+u*s.x,t.y+u*s.y)}return null}if(n.length===0){return null}var T=n[0].x;var x=n[0].x;var S=n[0].y;var E=n[0].y;for(var P=1;P<n.length;P++){var _=n[P];if(_.x<T){T=_.x}if(_.x>x){x=_.x}if(_.y<S){S=_.y}if(_.y>E){E=_.y}}return new e.Rect(T,S,x-T,E-S)},_getSegments:function(){var e=this.getTopLeft();var t=this.getTopRight();var i=this.getBottomLeft();var n=this.getBottomRight();return[[e,t],[t,n],[n,i],[i,e]]},rotate:function(t,i){t=e.positiveModulo(t,360);if(t===0){return this.clone()}i=i||this.getCenter();var n=this.getTopLeft().rotate(t,i);var r=this.getTopRight().rotate(t,i);var o=r.minus(n);o=o.apply((function(e){var t=1e-15;return Math.abs(e)<t?0:e}));var s=Math.atan(o.y/o.x);if(o.x<0){s+=Math.PI}else if(o.y<0){s+=2*Math.PI}return new e.Rect(n.x,n.y,this.width,this.height,s/Math.PI*180)},getBoundingBox:function(){if(this.degrees===0){return this.clone()}var t=this.getTopLeft();var i=this.getTopRight();var n=this.getBottomLeft();var r=this.getBottomRight();var o=Math.min(t.x,i.x,n.x,r.x);var s=Math.max(t.x,i.x,n.x,r.x);var a=Math.min(t.y,i.y,n.y,r.y);var l=Math.max(t.y,i.y,n.y,r.y);return new e.Rect(o,a,s-o,l-a)},getIntegerBoundingBox:function(){var t=this.getBoundingBox();var i=Math.floor(t.x);var n=Math.floor(t.y);var r=Math.ceil(t.width+t.x-i);var o=Math.ceil(t.height+t.y-n);return new e.Rect(i,n,r,o)},containsPoint:function(e,t){t=t||0;var i=this.getTopLeft();var n=this.getTopRight();var r=this.getBottomLeft();var o=n.minus(i);var s=r.minus(i);return(e.x-i.x)*o.x+(e.y-i.y)*o.y>=-t&&(e.x-n.x)*o.x+(e.y-n.y)*o.y<=t&&(e.x-i.x)*s.x+(e.y-i.y)*s.y>=-t&&(e.x-r.x)*s.x+(e.y-r.y)*s.y<=t},toString:function(){return"["+Math.round(this.x*100)/100+", "+Math.round(this.y*100)/100+", "+Math.round(this.width*100)/100+"x"+Math.round(this.height*100)/100+", "+Math.round(this.degrees*100)/100+"deg"+"]"}}})(t);(function(e){var t={};e.ReferenceStrip=function(u){var c=this,d=u.viewer,p=e.getElementSize(d.element),f,g,v;if(!u.id){u.id="referencestrip-"+e.now();this.element=e.makeNeutralElement("div");this.element.id=u.id;this.element.className="referencestrip"}u=e.extend(true,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},u,{element:this.element});e.extend(this,u);t[this.id]={animating:false};this.minPixelRatio=this.viewer.minPixelRatio;this.element.tabIndex=0;g=this.element.style;g.marginTop="0px";g.marginRight="0px";g.marginBottom="0px";g.marginLeft="0px";g.left="0px";g.bottom="0px";g.border="0px";g.background="#000";g.position="relative";e.setElementTouchActionNone(this.element);e.setElementOpacity(this.element,.8);this.viewer=d;this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,i),dragHandler:e.delegate(this,n),scrollHandler:e.delegate(this,r),enterHandler:e.delegate(this,s),leaveHandler:e.delegate(this,a),keyDownHandler:e.delegate(this,l),keyHandler:e.delegate(this,h),preProcessEventHandler:function(e){if(e.eventType==="wheel"){e.preventDefault=true}}});if(u.width&&u.height){this.element.style.width=u.width+"px";this.element.style.height=u.height+"px";d.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})}else{if("horizontal"===u.scroll){this.element.style.width=p.x*u.sizeRatio*d.tileSources.length+12*d.tileSources.length+"px";this.element.style.height=p.y*u.sizeRatio+"px";d.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})}else{this.element.style.height=p.y*u.sizeRatio*d.tileSources.length+12*d.tileSources.length+"px";this.element.style.width=p.x*u.sizeRatio+"px";d.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})}}this.panelWidth=p.x*this.sizeRatio+8;this.panelHeight=p.y*this.sizeRatio+8;this.panels=[];this.miniViewers={};for(v=0;v<d.tileSources.length;v++){f=e.makeNeutralElement("div");f.id=this.element.id+"-"+v;f.style.width=c.panelWidth+"px";f.style.height=c.panelHeight+"px";f.style.display="inline";f.style["float"]="left";f.style.cssFloat="left";f.style.styleFloat="left";f.style.padding="2px";e.setElementTouchActionNone(f);e.setElementPointerEventsNone(f);this.element.appendChild(f);f.activePanel=false;this.panels.push(f)}o(this,this.scroll==="vertical"?p.y:p.x,0);this.setFocus(0)};e.ReferenceStrip.prototype={setFocus:function(t){var i=this.element.querySelector("#"+this.element.id+"-"+t),n=e.getElementSize(this.viewer.canvas),r=Number(this.element.style.width.replace("px","")),a=Number(this.element.style.height.replace("px","")),l=-Number(this.element.style.marginLeft.replace("px","")),h=-Number(this.element.style.marginTop.replace("px","")),u;if(this.currentSelected!==i){if(this.currentSelected){this.currentSelected.style.background="#000"}this.currentSelected=i;this.currentSelected.style.background="#999";if("horizontal"===this.scroll){u=Number(t)*(this.panelWidth+3);if(u>l+n.x-this.panelWidth){u=Math.min(u,r-n.x);this.element.style.marginLeft=-u+"px";o(this,n.x,-u)}else if(u<l){u=Math.max(0,u-n.x/2);this.element.style.marginLeft=-u+"px";o(this,n.x,-u)}}else{u=Number(t)*(this.panelHeight+3);if(u>h+n.y-this.panelHeight){u=Math.min(u,a-n.y);this.element.style.marginTop=-u+"px";o(this,n.y,-u)}else if(u<h){u=Math.max(0,u-n.y/2);this.element.style.marginTop=-u+"px";o(this,n.y,-u)}}this.currentPage=t;s.call(this,{eventSource:this.tracker})}},update:function(){if(t[this.id].animating){return true}return false},destroy:function(){if(this.miniViewers){for(var e in this.miniViewers){this.miniViewers[e].destroy()}}this.tracker.destroy();if(this.element){this.viewer.removeControl(this.element)}}};function i(e){if(e.quick){var t;if("horizontal"===this.scroll){t=Math.floor(e.position.x/(this.panelWidth+4))}else{t=Math.floor(e.position.y/this.panelHeight)}this.viewer.goToPage(t)}this.element.focus()}function n(t){this.dragging=true;if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),r=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=e.getElementSize(this.viewer.canvas);if("horizontal"===this.scroll){if(-t.delta.x>0){if(i>-(r-a.x)){this.element.style.marginLeft=i+t.delta.x*2+"px";o(this,a.x,i+t.delta.x*2)}}else if(-t.delta.x<0){if(i<0){this.element.style.marginLeft=i+t.delta.x*2+"px";o(this,a.x,i+t.delta.x*2)}}}else{if(-t.delta.y>0){if(n>-(s-a.y)){this.element.style.marginTop=n+t.delta.y*2+"px";o(this,a.y,n+t.delta.y*2)}}else if(-t.delta.y<0){if(n<0){this.element.style.marginTop=n+t.delta.y*2+"px";o(this,a.y,n+t.delta.y*2)}}}}}function r(t){if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),r=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=e.getElementSize(this.viewer.canvas);if("horizontal"===this.scroll){if(t.scroll>0){if(i>-(r-a.x)){this.element.style.marginLeft=i-t.scroll*60+"px";o(this,a.x,i-t.scroll*60)}}else if(t.scroll<0){if(i<0){this.element.style.marginLeft=i-t.scroll*60+"px";o(this,a.x,i-t.scroll*60)}}}else{if(t.scroll<0){if(n>a.y-s){this.element.style.marginTop=n+t.scroll*60+"px";o(this,a.y,n+t.scroll*60)}}else if(t.scroll>0){if(n<0){this.element.style.marginTop=n+t.scroll*60+"px";o(this,a.y,n+t.scroll*60)}}}t.preventDefault=true}}function o(t,i,n){var r,o,s,a,l,h;if("horizontal"===t.scroll){r=t.panelWidth}else{r=t.panelHeight}o=Math.ceil(i/r)+5;s=Math.ceil((Math.abs(n)+i)/r)+1;o=s-o;o=o<0?0:o;for(l=o;l<s&&l<t.panels.length;l++){h=t.panels[l];if(!h.activePanel){var u;var c=t.viewer.tileSources[l];if(c.referenceStripThumbnailUrl){u={type:"image",url:c.referenceStripThumbnailUrl}}else{u=c}a=new e.Viewer({id:h.id,tileSources:[u],element:h,navigatorSizeRatio:t.sizeRatio,showNavigator:false,mouseNavEnabled:false,showNavigationControl:false,showSequenceControl:false,immediateRender:true,blendTime:0,animationTime:0,loadTilesWithAjax:t.viewer.loadTilesWithAjax,ajaxHeaders:t.viewer.ajaxHeaders,useCanvas:t.useCanvas});e.setElementPointerEventsNone(a.canvas);e.setElementPointerEventsNone(a.container);a.innerTracker.setTracking(false);a.outerTracker.setTracking(false);t.miniViewers[h.id]=a;h.activePanel=true}}}function s(e){var t=e.eventSource.element;if("horizontal"===this.scroll){t.style.marginBottom="0px"}else{t.style.marginLeft="0px"}}function a(t){var i=t.eventSource.element;if("horizontal"===this.scroll){i.style.marginBottom="-"+e.getElementSize(i).y/2+"px"}else{i.style.marginLeft="-"+e.getElementSize(i).x/2+"px"}}function l(e){if(!e.ctrl&&!e.alt&&!e.meta){switch(e.keyCode){case 38:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;case 40:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 37:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 39:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;default:e.preventDefault=false;break}}else{e.preventDefault=false}}function h(e){if(!e.ctrl&&!e.alt&&!e.meta){switch(e.keyCode){case 61:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;case 45:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 48:case 119:case 87:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;case 115:case 83:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 97:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 100:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;default:e.preventDefault=false;break}}else{e.preventDefault=false}}})(t);(function(e){e.DisplayRect=function(t,i,n,r,o,s){e.Rect.apply(this,[t,i,n,r]);this.minLevel=o;this.maxLevel=s};e.extend(e.DisplayRect.prototype,e.Rect.prototype)})(t);(function(e){e.Spring=function(t){var i=arguments;if(typeof t!=="object"){t={initial:i.length&&typeof i[0]==="number"?i[0]:undefined,springStiffness:i.length>1?i[1].springStiffness:5,animationTime:i.length>1?i[1].animationTime:1.5}}e.console.assert(typeof t.springStiffness==="number"&&t.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number");e.console.assert(typeof t.animationTime==="number"&&t.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0");if(t.exponential){this._exponential=true;delete t.exponential}e.extend(true,this,t);this.current={value:typeof this.initial==="number"?this.initial:this._exponential?0:1,time:e.now()};e.console.assert(!this._exponential||this.current.value!==0,"[OpenSeadragon.Spring] value must be non-zero for exponential springs");this.start={value:this.current.value,time:this.current.time};this.target={value:this.current.value,time:this.current.time};if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}};e.Spring.prototype={resetTo:function(t){e.console.assert(!this._exponential||t!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs");this.start.value=this.target.value=this.current.value=t;this.start.time=this.target.time=this.current.time=e.now();if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}},springTo:function(t){e.console.assert(!this._exponential||t!==0,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs");this.start.value=this.current.value;this.start.time=this.current.time;this.target.value=t;this.target.time=this.start.time+1e3*this.animationTime;if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value)}},shiftBy:function(t){this.start.value+=t;this.target.value+=t;if(this._exponential){e.console.assert(this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs");this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value)}},setExponential:function(t){this._exponential=t;if(this._exponential){e.console.assert(this.current.value!==0&&this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs");this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}},update:function(){this.current.time=e.now();var i,n;if(this._exponential){i=this.start._logValue;n=this.target._logValue}else{i=this.start.value;n=this.target.value}var r=this.current.time>=this.target.time?n:i+(n-i)*t(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time));var o=this.current.value;if(this._exponential){this.current.value=Math.exp(r)}else{this.current.value=r}return o!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function t(e,t){return(1-Math.exp(e*-t))/(1-Math.exp(-e))}})(t);(function(e){e.ImageJob=function(t){e.extend(true,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},t);this.data=null;this.userData={};this.errorMsg=null};e.ImageJob.prototype={start:function(){this.tries++;var e=this;var t=this.abort;this.jobId=window.setTimeout((function(){e.finish(null,null,"Image load exceeded timeout ("+e.timeout+" ms)")}),this.timeout);this.abort=function(){e.source.downloadTileAbort(e);if(typeof t==="function"){t()}};this.source.downloadTileStart(this)},finish:function(e,t,i){this.data=e;this.request=t;this.errorMsg=i;if(this.jobId){window.clearTimeout(this.jobId)}this.callback(this)}};e.ImageLoader=function(t){e.extend(true,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},t)};e.ImageLoader.prototype={addJob:function(i){if(!i.source){e.console.error("ImageLoader.prototype.addJob() requires [options.source]. "+"TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var n=e.TileSource.prototype;i.source={downloadTileStart:n.downloadTileStart,downloadTileAbort:n.downloadTileAbort}}var r=this,o=function(e){t(r,e,i.callback)},s={src:i.src,tile:i.tile||{},source:i.source,loadWithAjax:i.loadWithAjax,ajaxHeaders:i.loadWithAjax?i.ajaxHeaders:null,crossOriginPolicy:i.crossOriginPolicy,ajaxWithCredentials:i.ajaxWithCredentials,postData:i.postData,callback:o,abort:i.abort,timeout:this.timeout},a=new e.ImageJob(s);if(!this.jobLimit||this.jobsInProgress<this.jobLimit){a.start();this.jobsInProgress++}else{this.jobQueue.push(a)}},clear:function(){for(var e=0;e<this.jobQueue.length;e++){var t=this.jobQueue[e];if(typeof t.abort==="function"){t.abort()}}this.jobQueue=[]}};function t(e,t,i){if(t.errorMsg!==""&&(t.data===null||t.data===undefined)&&t.tries<1+e.tileRetryMax){e.failedTiles.push(t)}var n;e.jobsInProgress--;if((!e.jobLimit||e.jobsInProgress<e.jobLimit)&&e.jobQueue.length>0){n=e.jobQueue.shift();n.start();e.jobsInProgress++}if(e.tileRetryMax>0&&e.jobQueue.length===0){if((!e.jobLimit||e.jobsInProgress<e.jobLimit)&&e.failedTiles.length>0){n=e.failedTiles.shift();setTimeout((function(){n.start()}),e.tileRetryDelay);e.jobsInProgress++}}i(t.data,t.errorMsg,t.request)}})(t);(function(e){e.Tile=function(t,i,n,r,o,s,a,l,h,u,c,d){this.level=t;this.x=i;this.y=n;this.bounds=r;this.sourceBounds=u;this.exists=o;this._url=s;this.postData=c;this.context2D=a;this.loadWithAjax=l;this.ajaxHeaders=h;if(d===undefined){e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache"+" in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used.");d=e.TileSource.prototype.getTileHashKey(t,i,n,s,h,c)}this.cacheKey=d;this.loaded=false;this.loading=false;this.element=null;this.imgElement=null;this.style=null;this.position=null;this.size=null;this.flipped=false;this.blendStart=null;this.opacity=null;this.squaredDistance=null;this.visibility=null;this.hasTransparency=false;this.beingDrawn=false;this.lastTouchTime=0;this.isRightMost=false;this.isBottomMost=false};e.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){console.warn("Tile.prototype._hasTransparencyChannel() has been "+"deprecated and will be removed in the future. Use TileSource.prototype.hasTransparency() instead.");return!!this.context2D||this.getUrl().match(".png")},drawHTML:function(t){if(!this.cacheImageRecord){e.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString());return}if(!this.loaded){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}if(!this.element){var i=this.getImage();if(!i){return}this.element=e.makeNeutralElement("div");this.imgElement=i.cloneNode();this.imgElement.style.msInterpolationMode="nearest-neighbor";this.imgElement.style.width="100%";this.imgElement.style.height="100%";this.style=this.element.style;this.style.position="absolute"}if(this.element.parentNode!==t){t.appendChild(this.element)}if(this.imgElement.parentNode!==this.element){this.element.appendChild(this.imgElement)}this.style.top=this.position.y+"px";this.style.left=this.position.x+"px";this.style.height=this.size.y+"px";this.style.width=this.size.x+"px";if(this.flipped){this.style.transform="scaleX(-1)"}e.setElementOpacity(this.element,this.opacity)},get image(){e.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead.");return this.getImage()},get url(){e.console.error("[Tile.url] property has been deprecated. Use [Tile.prototype.getUrl] instead.");return this.getUrl()},getImage:function(){return this.cacheImageRecord.getImage()},getUrl:function(){if(typeof this._url==="function"){return this._url()}return this._url},getCanvasContext:function(){return this.context2D||this.cacheImageRecord.getRenderedContext()},drawCanvas:function(t,i,n,r,o,s){var a=this.position.times(e.pixelDensityRatio),l=this.size.times(e.pixelDensityRatio),h;if(!this.context2D&&!this.cacheImageRecord){e.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString());return}h=this.getCanvasContext();if(!this.loaded||!h){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}t.save();t.globalAlpha=this.opacity;if(typeof n==="number"&&n!==1){a=a.times(n);l=l.times(n)}if(r instanceof e.Point){a=a.plus(r)}if(t.globalAlpha===1&&this.hasTransparency){if(o){a.x=Math.round(a.x);a.y=Math.round(a.y);l.x=Math.round(l.x);l.y=Math.round(l.y)}t.clearRect(a.x,a.y,l.x,l.y)}i({context:t,tile:this,rendered:h});var u,c;if(this.sourceBounds){u=Math.min(this.sourceBounds.width,h.canvas.width);c=Math.min(this.sourceBounds.height,h.canvas.height)}else{u=h.canvas.width;c=h.canvas.height}t.translate(a.x+l.x/2,0);if(this.flipped){t.scale(-1,1)}t.drawImage(h.canvas,0,0,u,c,-l.x/2,a.y,l.x,l.y);t.restore()},getScaleForEdgeSmoothing:function(){var t;if(this.cacheImageRecord){t=this.cacheImageRecord.getRenderedContext()}else if(this.context2D){t=this.context2D}else{e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString());return 1}return t.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(t,i,n){var r=Math.max(1,Math.ceil((n.x-i.x)/2));var o=Math.max(1,Math.ceil((n.y-i.y)/2));return new e.Point(r,o).minus(this.position.times(e.pixelDensityRatio).times(t||1).apply((function(e){return e%1})))},unload:function(){if(this.imgElement&&this.imgElement.parentNode){this.imgElement.parentNode.removeChild(this.imgElement)}if(this.element&&this.element.parentNode){this.element.parentNode.removeChild(this.element)}this.element=null;this.imgElement=null;this.loaded=false;this.loading=false}}})(t);(function(e){e.OverlayPlacement=e.Placement;e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3});e.Overlay=function(t,i,n){var r;if(e.isPlainObject(t)){r=t}else{r={element:t,location:i,placement:n}}this.element=r.element;this.style=r.element.style;this._init(r)};e.Overlay.prototype={_init:function(t){this.location=t.location;this.placement=t.placement===undefined?e.Placement.TOP_LEFT:t.placement;this.onDraw=t.onDraw;this.checkResize=t.checkResize===undefined?true:t.checkResize;this.width=t.width===undefined?null:t.width;this.height=t.height===undefined?null:t.height;this.rotationMode=t.rotationMode||e.OverlayRotationMode.EXACT;if(this.location instanceof e.Rect){this.width=this.location.width;this.height=this.location.height;this.location=this.location.getTopLeft();this.placement=e.Placement.TOP_LEFT}this.scales=this.width!==null&&this.height!==null;this.bounds=new e.Rect(this.location.x,this.location.y,this.width,this.height);this.position=this.location},adjust:function(t,i){var n=e.Placement.properties[this.placement];if(!n){return}if(n.isHorizontallyCentered){t.x-=i.x/2}else if(n.isRight){t.x-=i.x}if(n.isVerticallyCentered){t.y-=i.y/2}else if(n.isBottom){t.y-=i.y}},destroy:function(){var t=this.element;var i=this.style;if(t.parentNode){t.parentNode.removeChild(t);if(t.prevElementParent){i.display="none";document.body.appendChild(t)}}this.onDraw=null;i.top="";i.left="";i.position="";if(this.width!==null){i.width=""}if(this.height!==null){i.height=""}var n=e.getCssPropertyWithVendorPrefix("transformOrigin");var r=e.getCssPropertyWithVendorPrefix("transform");if(n&&r){i[n]="";i[r]=""}},drawHTML:function(t,i){var n=this.element;if(n.parentNode!==t){n.prevElementParent=n.parentNode;n.prevNextSibling=n.nextSibling;t.appendChild(n);this.style.position="absolute";this.size=e.getElementSize(n)}var r=this._getOverlayPositionAndSize(i);var o=r.position;var s=this.size=r.size;var a=r.rotate;if(this.onDraw){this.onDraw(o,s,this.element)}else{var l=this.style;l.left=o.x+"px";l.top=o.y+"px";if(this.width!==null){l.width=s.x+"px"}if(this.height!==null){l.height=s.y+"px"}var h=e.getCssPropertyWithVendorPrefix("transformOrigin");var u=e.getCssPropertyWithVendorPrefix("transform");if(h&&u){if(a){l[h]=this._getTransformOrigin();l[u]="rotate("+a+"deg)"}else{l[h]="";l[u]=""}}l.display="block"}},_getOverlayPositionAndSize:function(t){var i=t.pixelFromPoint(this.location,true);var n=this._getSizeInPixels(t);this.adjust(i,n);var r=0;if(t.getRotation(true)&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION){if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var o=new e.Rect(i.x,i.y,n.x,n.y);var s=this._getBoundingBox(o,t.getRotation(true));i=s.getTopLeft();n=s.getSize()}else{r=t.getRotation(true)}}return{position:i,size:n,rotate:r}},_getSizeInPixels:function(t){var i=this.size.x;var n=this.size.y;if(this.width!==null||this.height!==null){var r=t.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),true);if(this.width!==null){i=r.x}if(this.height!==null){n=r.y}}if(this.checkResize&&(this.width===null||this.height===null)){var o=this.size=e.getElementSize(this.element);if(this.width===null){i=o.x}if(this.height===null){n=o.y}}return new e.Point(i,n)},_getBoundingBox:function(e,t){var i=this._getPlacementPoint(e);return e.rotate(t,i).getBoundingBox()},_getPlacementPoint:function(t){var i=new e.Point(t.x,t.y);var n=e.Placement.properties[this.placement];if(n){if(n.isHorizontallyCentered){i.x+=t.width/2}else if(n.isRight){i.x+=t.width}if(n.isVerticallyCentered){i.y+=t.height/2}else if(n.isBottom){i.y+=t.height}}return i},_getTransformOrigin:function(){var t="";var i=e.Placement.properties[this.placement];if(!i){return t}if(i.isLeft){t="left"}else if(i.isRight){t="right"}if(i.isTop){t+=" top"}else if(i.isBottom){t+=" bottom"}return t},update:function(t,i){var n=e.isPlainObject(t)?t:{location:t,placement:i};this._init({location:n.location||this.location,placement:n.placement!==undefined?n.placement:this.placement,onDraw:n.onDraw||this.onDraw,checkResize:n.checkResize||this.checkResize,width:n.width!==undefined?n.width:this.width,height:n.height!==undefined?n.height:this.height,rotationMode:n.rotationMode||this.rotationMode})},getBounds:function(t){e.console.assert(t,"A viewport must now be passed to Overlay.getBounds.");var i=this.width;var n=this.height;if(i===null||n===null){var r=t.deltaPointsFromPixelsNoRotate(this.size,true);if(i===null){i=r.x}if(n===null){n=r.y}}var o=this.location.clone();this.adjust(o,new e.Point(i,n));return this._adjustBoundsForRotation(t,new e.Rect(o.x,o.y,i,n))},_adjustBoundsForRotation:function(t,i){if(!t||t.getRotation(true)===0||this.rotationMode===e.OverlayRotationMode.EXACT){return i}if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null){return i}var n=this._getOverlayPositionAndSize(t);return t.viewerElementToViewportRectangle(new e.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-t.getRotation(true),this._getPlacementPoint(i))}}})(t);(function(e){e.Drawer=function(t){e.console.assert(t.viewer,"[Drawer] options.viewer is required");var i=arguments;if(!e.isPlainObject(t)){t={source:i[0],viewport:i[1],element:i[2]}}e.console.assert(t.viewport,"[Drawer] options.viewport is required");e.console.assert(t.element,"[Drawer] options.element is required");if(t.source){e.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead")}this.viewer=t.viewer;this.viewport=t.viewport;this.debugGridColor=typeof t.debugGridColor==="string"?[t.debugGridColor]:t.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor;if(t.opacity){e.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead")}this.useCanvas=e.supportsCanvas&&(this.viewer?this.viewer.useCanvas:true);this.container=e.getElement(t.element);this.canvas=e.makeNeutralElement(this.useCanvas?"canvas":"div");this.context=this.useCanvas?this.canvas.getContext("2d"):null;this.sketchCanvas=null;this.sketchContext=null;this.element=this.container;this.container.dir="ltr";if(this.useCanvas){var n=this._calculateCanvasSize();this.canvas.width=n.x;this.canvas.height=n.y}this.canvas.style.width="100%";this.canvas.style.height="100%";this.canvas.style.position="absolute";e.setElementOpacity(this.canvas,this.opacity,true);e.setElementPointerEventsNone(this.canvas);e.setElementTouchActionNone(this.canvas);this.container.style.textAlign="left";this.container.appendChild(this.canvas);this._imageSmoothingEnabled=true};e.Drawer.prototype={addOverlay:function(t,i,n,r){e.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead.");this.viewer.addOverlay(t,i,n,r);return this},updateOverlay:function(t,i,n){e.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead.");this.viewer.updateOverlay(t,i,n);return this},removeOverlay:function(t){e.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead.");this.viewer.removeOverlay(t);return this},clearOverlays:function(){e.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead.");this.viewer.clearOverlays();return this},viewportCoordToDrawerCoord:function(t){var i=this.viewport.pixelFromPointNoRotate(t,true);return new e.Point(i.x*e.pixelDensityRatio,i.y*e.pixelDensityRatio)},clipWithPolygons:function(e,t){if(!this.useCanvas){return}var i=this._getContext(t);i.beginPath();e.forEach((function(e){e.forEach((function(e,t){i[t===0?"moveTo":"lineTo"](e.x,e.y)}))}));i.clip()},setOpacity:function(t){e.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");var i=this.viewer.world;for(var n=0;n<i.getItemCount();n++){i.getItemAt(n).setOpacity(t)}return this},getOpacity:function(){e.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");var t=this.viewer.world;var i=0;for(var n=0;n<t.getItemCount();n++){var r=t.getItemAt(n).getOpacity();if(r>i){i=r}}return i},needsUpdate:function(){e.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead.");return this.viewer.world.needsDraw()},numTilesLoaded:function(){e.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead.");return this.viewer.tileCache.numTilesLoaded()},reset:function(){e.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead.");this.viewer.world.resetItems();return this},update:function(){e.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead.");this.clear();this.viewer.world.draw();return this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1;this.canvas.height=1;this.sketchCanvas=null;this.sketchContext=null},clear:function(){this.canvas.innerHTML="";if(this.useCanvas){var e=this._calculateCanvasSize();if(this.canvas.width!==e.x||this.canvas.height!==e.y){this.canvas.width=e.x;this.canvas.height=e.y;this._updateImageSmoothingEnabled(this.context);if(this.sketchCanvas!==null){var t=this._calculateSketchCanvasSize();this.sketchCanvas.width=t.x;this.sketchCanvas.height=t.y;this._updateImageSmoothingEnabled(this.sketchContext)}}this._clear()}},_clear:function(e,t){if(!this.useCanvas){return}var i=this._getContext(e);if(t){i.clearRect(t.x,t.y,t.width,t.height)}else{var n=i.canvas;i.clearRect(0,0,n.width,n.height)}},viewportToDrawerRectangle:function(t){var i=this.viewport.pixelFromPointNoRotate(t.getTopLeft(),true);var n=this.viewport.deltaPixelsFromPointsNoRotate(t.getSize(),true);return new e.Rect(i.x*e.pixelDensityRatio,i.y*e.pixelDensityRatio,n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio)},drawTile:function(t,i,n,r,o,s,a){e.console.assert(t,"[Drawer.drawTile] tile is required");e.console.assert(i,"[Drawer.drawTile] drawingHandler is required");if(this.useCanvas){var l=this._getContext(n);r=r||1;t.drawCanvas(l,i,r,o,s,a)}else{t.drawHTML(this.canvas)}},_getContext:function(e){var t=this.context;if(e){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var i=this._calculateSketchCanvasSize();this.sketchCanvas.width=i.x;this.sketchCanvas.height=i.y;this.sketchContext=this.sketchCanvas.getContext("2d");if(this.viewport.getRotation()===0){var n=this;this.viewer.addHandler("rotate",(function e(){if(n.viewport.getRotation()===0){return}n.viewer.removeHandler("rotate",e);var t=n._calculateSketchCanvasSize();n.sketchCanvas.width=t.x;n.sketchCanvas.height=t.y}))}this._updateImageSmoothingEnabled(this.sketchContext)}t=this.sketchContext}return t},saveContext:function(e){if(!this.useCanvas){return}this._getContext(e).save()},restoreContext:function(e){if(!this.useCanvas){return}this._getContext(e).restore()},setClip:function(e,t){if(!this.useCanvas){return}var i=this._getContext(t);i.beginPath();i.rect(e.x,e.y,e.width,e.height);i.clip()},drawRectangle:function(e,t,i){if(!this.useCanvas){return}var n=this._getContext(i);n.save();n.fillStyle=t;n.fillRect(e.x,e.y,e.width,e.height);n.restore()},blendSketch:function(t,i,n,r){var o=t;if(!e.isPlainObject(o)){o={opacity:t,scale:i,translate:n,compositeOperation:r}}if(!this.useCanvas||!this.sketchCanvas){return}t=o.opacity;r=o.compositeOperation;var s=o.bounds;this.context.save();this.context.globalAlpha=t;if(r){this.context.globalCompositeOperation=r}if(s){if(s.x<0){s.width+=s.x;s.x=0}if(s.x+s.width>this.canvas.width){s.width=this.canvas.width-s.x}if(s.y<0){s.height+=s.y;s.y=0}if(s.y+s.height>this.canvas.height){s.height=this.canvas.height-s.y}this.context.drawImage(this.sketchCanvas,s.x,s.y,s.width,s.height,s.x,s.y,s.width,s.height)}else{i=o.scale||1;n=o.translate;var a=n instanceof e.Point?n:new e.Point(0,0);var l=0;var h=0;if(n){var u=this.sketchCanvas.width-this.canvas.width;var c=this.sketchCanvas.height-this.canvas.height;l=Math.round(u/2);h=Math.round(c/2)}this.context.drawImage(this.sketchCanvas,a.x-l*i,a.y-h*i,(this.canvas.width+2*l)*i,(this.canvas.height+2*h)*i,-l,-h,this.canvas.width+2*l,this.canvas.height+2*h)}this.context.restore()},drawDebugInfo:function(t,i,n,r){if(!this.useCanvas){return}var o=this.viewer.world.getIndexOfItem(r)%this.debugGridColor.length;var s=this.context;s.save();s.lineWidth=2*e.pixelDensityRatio;s.font="small-caps bold "+13*e.pixelDensityRatio+"px arial";s.strokeStyle=this.debugGridColor[o];s.fillStyle=this.debugGridColor[o];if(this.viewport.getRotation(true)%360!==0){this._offsetForRotation({degrees:this.viewport.getRotation(true)})}if(r.getRotation(true)%360!==0){this._offsetForRotation({degrees:r.getRotation(true),point:r.viewport.pixelFromPointNoRotate(r._getRotationPoint(true),true)})}if(r.viewport.getRotation(true)%360===0&&r.getRotation(true)%360===0){if(r._drawer.viewer.viewport.getFlip()){r._drawer._flip()}}s.strokeRect(t.position.x*e.pixelDensityRatio,t.position.y*e.pixelDensityRatio,t.size.x*e.pixelDensityRatio,t.size.y*e.pixelDensityRatio);var a=(t.position.x+t.size.x/2)*e.pixelDensityRatio;var l=(t.position.y+t.size.y/2)*e.pixelDensityRatio;s.translate(a,l);s.rotate(Math.PI/180*-this.viewport.getRotation(true));s.translate(-a,-l);if(t.x===0&&t.y===0){s.fillText("Zoom: "+this.viewport.getZoom(),t.position.x*e.pixelDensityRatio,(t.position.y-30)*e.pixelDensityRatio);s.fillText("Pan: "+this.viewport.getBounds().toString(),t.position.x*e.pixelDensityRatio,(t.position.y-20)*e.pixelDensityRatio)}s.fillText("Level: "+t.level,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+20)*e.pixelDensityRatio);s.fillText("Column: "+t.x,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+30)*e.pixelDensityRatio);s.fillText("Row: "+t.y,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+40)*e.pixelDensityRatio);s.fillText("Order: "+n+" of "+i,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+50)*e.pixelDensityRatio);s.fillText("Size: "+t.size.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+60)*e.pixelDensityRatio);s.fillText("Position: "+t.position.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+70)*e.pixelDensityRatio);if(this.viewport.getRotation(true)%360!==0){this._restoreRotationChanges()}if(r.getRotation(true)%360!==0){this._restoreRotationChanges()}if(r.viewport.getRotation(true)%360===0&&r.getRotation(true)%360===0){if(r._drawer.viewer.viewport.getFlip()){r._drawer._flip()}}s.restore()},debugRect:function(t){if(this.useCanvas){var i=this.context;i.save();i.lineWidth=2*e.pixelDensityRatio;i.strokeStyle=this.debugGridColor[0];i.fillStyle=this.debugGridColor[0];i.strokeRect(t.x*e.pixelDensityRatio,t.y*e.pixelDensityRatio,t.width*e.pixelDensityRatio,t.height*e.pixelDensityRatio);i.restore()}},setImageSmoothingEnabled:function(e){if(this.useCanvas){this._imageSmoothingEnabled=e;this._updateImageSmoothingEnabled(this.context);this.viewer.forceRedraw()}},_updateImageSmoothingEnabled:function(e){e.msImageSmoothingEnabled=this._imageSmoothingEnabled;e.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(t){var i=this._getContext(t).canvas;return new e.Point(i.width,i.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(t){var i=t.point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter();var n=this._getContext(t.useSketch);n.save();n.translate(i.x,i.y);if(this.viewer.viewport.flipped){n.rotate(Math.PI/180*-t.degrees);n.scale(-1,1)}else{n.rotate(Math.PI/180*t.degrees)}n.translate(-i.x,-i.y)},_flip:function(t){t=t||{};var i=t.point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter();var n=this._getContext(t.useSketch);n.translate(i.x,0);n.scale(-1,1);n.translate(-i.x,0)},_restoreRotationChanges:function(e){var t=this._getContext(e);t.restore()},_calculateCanvasSize:function(){var t=e.pixelDensityRatio;var i=this.viewport.getContainerSize();return{x:Math.round(i.x*t),y:Math.round(i.y*t)}},_calculateSketchCanvasSize:function(){var e=this._calculateCanvasSize();if(this.viewport.getRotation()===0){return e}var t=Math.ceil(Math.sqrt(e.x*e.x+e.y*e.y));return{x:t,y:t}}}})(t);(function(e){e.Viewport=function(t){var i=arguments;if(i.length&&i[0]instanceof e.Point){t={containerSize:i[0],contentSize:i[1],config:i[2]}}if(t.config){e.extend(true,t,t.config);delete t.config}this._margins=e.extend({left:0,top:0,right:0,bottom:0},t.margins||{});delete t.margins;t.initialDegrees=t.degrees;delete t.degrees;e.extend(true,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:e.DEFAULT_SETTINGS.silenceMultiImageWarnings},t);this._updateContainerInnerSize();this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.zoomSpring=new e.Spring({exponential:true,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime});this.degreesSpring=new e.Spring({initial:t.initialDegrees,springStiffness:this.springStiffness,animationTime:this.animationTime});this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;this._oldDegrees=this.degreesSpring.current.value;this._setContentBounds(new e.Rect(0,0,1,1),1);this.goHome(true);this.update()};e.Viewport.prototype={get degrees(){e.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead.");return this.getRotation()},set degrees(t){e.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead.");this.rotateTo(t)},resetContentSize:function(t){e.console.assert(t,"[Viewport.resetContentSize] contentSize is required");e.console.assert(t instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point");e.console.assert(t.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0");e.console.assert(t.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0");this._setContentBounds(new e.Rect(0,0,1,t.y/t.x),t.x);return this},setHomeBounds:function(t,i){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually.");this._setContentBounds(t,i)},_setContentBounds:function(t,i){e.console.assert(t,"[Viewport._setContentBounds] bounds is required");e.console.assert(t instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect");e.console.assert(t.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0");e.console.assert(t.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0");this._contentBoundsNoRotate=t.clone();this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i);this._contentBounds=t.rotate(this.getRotation()).getBoundingBox();this._contentSize=this._contentBounds.getSize().times(i);this._contentAspectRatio=this._contentSize.x/this._contentSize.y;if(this.viewer){this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:i,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})}},getHomeZoom:function(){if(this.defaultZoomLevel){return this.defaultZoomLevel}var e=this._contentAspectRatio/this.getAspectRatio();var t;if(this.homeFillsViewer){t=e>=1?e:1}else{t=e>=1?1:e}return t/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var t=this._contentBounds.getCenter();var i=1/this.getHomeZoom();var n=i/this.getAspectRatio();return new e.Rect(t.x-i/2,t.y-n/2,i,n)},goHome:function(e){if(this.viewer){this.viewer.raiseEvent("home",{immediately:e})}return this.fitBounds(this.getHomeBounds(),e)},getMinZoom:function(){var e=this.getHomeZoom(),t=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*e;return t},getMaxZoom:function(){var e=this.maxZoomLevel;if(!e){e=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x;e/=this._contentBounds.width}return Math.max(e,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(t){e.console.assert(e.type(t)==="object","[Viewport.setMargins] margins must be an object");this._margins=e.extend({left:0,top:0,right:0,bottom:0},t);this._updateContainerInnerSize();if(this.viewer){this.viewer.forceRedraw()}},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(-this.getRotation(e))},getBoundsNoRotate:function(t){var i=this.getCenter(t);var n=1/this.getZoom(t);var r=n/this.getAspectRatio();return new e.Rect(i.x-n/2,i.y-r/2,n,r)},getBoundsWithMargins:function(e){return this.getBoundsNoRotateWithMargins(e).rotate(-this.getRotation(e),this.getCenter(e))},getBoundsNoRotateWithMargins:function(e){var t=this.getBoundsNoRotate(e);var i=this._containerInnerSize.x*this.getZoom(e);t.x-=this._margins.left/i;t.y-=this._margins.top/i;t.width+=(this._margins.left+this._margins.right)/i;t.height+=(this._margins.top+this._margins.bottom)/i;return t},getCenter:function(t){var i=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),n=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),r,o,s,a,l,h,u,c;if(t){return i}else if(!this.zoomPoint){return n}r=this.pixelFromPoint(this.zoomPoint,true);o=this.getZoom();s=1/o;a=s/this.getAspectRatio();l=new e.Rect(i.x-s/2,i.y-a/2,s,a);h=this._pixelFromPoint(this.zoomPoint,l);u=h.minus(r).rotate(-this.getRotation(true));c=u.divide(this._containerInnerSize.x*o);return n.plus(c)},getZoom:function(e){if(e){return this.zoomSpring.current.value}else{return this.zoomSpring.target.value}},_applyZoomConstraints:function(e){return Math.max(Math.min(e,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(e){var t=this.viewportToViewerElementRectangle(e).getBoundingBox();var i=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox();var n=false;var r=false;if(this.wrapHorizontal);else{var o=t.x+t.width;var s=i.x+i.width;var a,l,h;if(t.width>i.width){a=this.visibilityRatio*i.width}else{a=this.visibilityRatio*t.width}l=i.x-o+a;h=s-t.x-a;if(a>i.width){t.x+=(l+h)/2;n=true}else if(h<0){t.x+=h;n=true}else if(l>0){t.x+=l;n=true}}if(this.wrapVertical);else{var u=t.y+t.height;var c=i.y+i.height;var d,p,f;if(t.height>i.height){d=this.visibilityRatio*i.height}else{d=this.visibilityRatio*t.height}p=i.y-u+d;f=c-t.y-d;if(d>i.height){t.y+=(p+f)/2;r=true}else if(f<0){t.y+=f;r=true}else if(p>0){t.y+=p;r=true}}var g=n||r;var v=g?this.viewerElementToViewportRectangle(t):e.clone();v.xConstrained=n;v.yConstrained=r;v.constraintApplied=g;return v},_raiseConstraintsEvent:function(e){if(this.viewer){this.viewer.raiseEvent("constrain",{immediately:e})}},applyConstraints:function(e){var t=this.getZoom();var i=this._applyZoomConstraints(t);if(t!==i){this.zoomTo(i,this.zoomPoint,e)}var n=this.getConstrainedBounds(false);if(n.constraintApplied){this.fitBounds(n,e);this._raiseConstraintsEvent(e)}return this},ensureVisible:function(e){return this.applyConstraints(e)},_fitBounds:function(t,i){i=i||{};var n=i.immediately||false;var r=i.constraints||false;var o=this.getAspectRatio();var s=t.getCenter();var a=new e.Rect(t.x,t.y,t.width,t.height,t.degrees+this.getRotation()).getBoundingBox();if(a.getAspectRatio()>=o){a.height=a.width/o}else{a.width=a.height*o}a.x=s.x-a.width/2;a.y=s.y-a.height/2;var l=1/a.width;if(n){this.panTo(s,true);this.zoomTo(l,null,true);if(r){this.applyConstraints(true)}return this}var h=this.getCenter(true);var u=this.getZoom(true);this.panTo(h,true);this.zoomTo(u,null,true);var c=this.getBounds();var d=this.getZoom();if(d===0||Math.abs(l/d-1)<1e-8){this.zoomTo(l,null,true);this.panTo(s,n);if(r){this.applyConstraints(false)}return this}if(r){this.panTo(s,false);l=this._applyZoomConstraints(l);this.zoomTo(l,null,false);var p=this.getConstrainedBounds();this.panTo(h,true);this.zoomTo(u,null,true);this.fitBounds(p)}else{var f=a.rotate(-this.getRotation());var g=f.getTopLeft().times(l).minus(c.getTopLeft().times(d)).divide(l-d);this.zoomTo(l,g,n)}return this},fitBounds:function(e,t){return this._fitBounds(e,{immediately:t,constraints:false})},fitBoundsWithConstraints:function(e,t){return this._fitBounds(e,{immediately:t,constraints:true})},fitVertically:function(t){var i=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,t)},fitHorizontally:function(t){var i=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,t)},getConstrainedBounds:function(e){var t,i;t=this.getBounds(e);i=this._applyBoundaryConstraints(t);return i},panBy:function(t,i){var n=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(t),i)},panTo:function(e,t){if(t){this.centerSpringX.resetTo(e.x);this.centerSpringY.resetTo(e.y)}else{this.centerSpringX.springTo(e.x);this.centerSpringY.springTo(e.y)}if(this.viewer){this.viewer.raiseEvent("pan",{center:e,immediately:t})}return this},zoomBy:function(e,t,i){return this.zoomTo(this.zoomSpring.target.value*e,t,i)},zoomTo:function(t,i,n){var r=this;this.zoomPoint=i instanceof e.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null;if(n){this._adjustCenterSpringsForZoomPoint((function(){r.zoomSpring.resetTo(t)}))}else{this.zoomSpring.springTo(t)}if(this.viewer){this.viewer.raiseEvent("zoom",{zoom:t,refPoint:i,immediately:n})}return this},setRotation:function(e,t){return this.rotateTo(e,null,t)},getRotation:function(e){return e?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(e,t,i){return this.rotateTo(e,t,i)},rotateTo:function(t,i,n){if(!this.viewer||!this.viewer.drawer.canRotate()){return this}if(this.degreesSpring.target.value===t&&this.degreesSpring.isAtTargetValue()){return this}this.rotationPivot=i instanceof e.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null;if(n){if(this.rotationPivot){var r=t-this._oldDegrees;if(!r){this.rotationPivot=null;return this}this._rotateAboutPivot(t)}else{this.degreesSpring.resetTo(t)}}else{var o=e.positiveModulo(this.degreesSpring.current.value,360);var s=e.positiveModulo(t,360);var a=s-o;if(a>180){s-=360}else if(a<-180){s+=360}var l=o-s;this.degreesSpring.resetTo(t+l);this.degreesSpring.springTo(t)}this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor());this.viewer.forceRedraw();this.viewer.raiseEvent("rotate",{degrees:t,immediately:!!n,pivot:this.rotationPivot||this.getCenter()});return this},rotateBy:function(e,t,i){return this.rotateTo(this.degreesSpring.target.value+e,t,i)},resize:function(e,t){var i=this.getBoundsNoRotate(),n=i,r;this.containerSize.x=e.x;this.containerSize.y=e.y;this._updateContainerInnerSize();if(t){r=e.x/this.containerSize.x;n.width=i.width*r;n.height=n.width/this.getAspectRatio()}if(this.viewer){this.viewer.raiseEvent("resize",{newContainerSize:e,maintain:t})}var o=this.fitBounds(n,true);if(this.viewer){this.viewer.raiseEvent("after-resize",{newContainerSize:e,maintain:t})}return o},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var e=this;this._adjustCenterSpringsForZoomPoint((function(){e.zoomSpring.update()}));if(this.degreesSpring.isAtTargetValue()){this.rotationPivot=null}this.centerSpringX.update();this.centerSpringY.update();if(this.rotationPivot){this._rotateAboutPivot(true)}else{this.degreesSpring.update()}var t=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;this._oldDegrees=this.degreesSpring.current.value;return t},_rotateAboutPivot:function(e){var t=e===true;var i=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(i.x);this.centerSpringY.shiftBy(i.y);if(t){this.degreesSpring.update()}else{this.degreesSpring.resetTo(e)}var n=this.degreesSpring.current.value-this._oldDegrees;var r=i.rotate(n*-1).times(-1);this.centerSpringX.shiftBy(r.x);this.centerSpringY.shiftBy(r.y)},_adjustCenterSpringsForZoomPoint:function(e){if(this.zoomPoint){var t=this.pixelFromPoint(this.zoomPoint,true);e();var i=this.pixelFromPoint(this.zoomPoint,true);var n=i.minus(t);var r=this.deltaPointsFromPixels(n,true);this.centerSpringX.shiftBy(r.x);this.centerSpringY.shiftBy(r.y);if(this.zoomSpring.isAtTargetValue()){this.zoomPoint=null}}else{e()}},deltaPixelsFromPointsNoRotate:function(e,t){return e.times(this._containerInnerSize.x*this.getZoom(t))},deltaPixelsFromPoints:function(e,t){return this.deltaPixelsFromPointsNoRotate(e.rotate(this.getRotation(t)),t)},deltaPointsFromPixelsNoRotate:function(e,t){return e.divide(this._containerInnerSize.x*this.getZoom(t))},deltaPointsFromPixels:function(e,t){return this.deltaPointsFromPixelsNoRotate(e,t).rotate(-this.getRotation(t))},pixelFromPointNoRotate:function(e,t){return this._pixelFromPointNoRotate(e,this.getBoundsNoRotate(t))},pixelFromPoint:function(e,t){return this._pixelFromPoint(e,this.getBoundsNoRotate(t))},_pixelFromPointNoRotate:function(t,i){return t.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(e,t){return this._pixelFromPointNoRotate(e.rotate(this.getRotation(true),this.getCenter(true)),t)},pointFromPixelNoRotate:function(t,i){var n=this.getBoundsNoRotate(i);return t.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(e,t){return this.pointFromPixelNoRotate(e,t).rotate(-this.getRotation(t),this.getCenter(t))},_viewportToImageDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(t,i){if(t instanceof e.Point){return this.viewportToImageCoordinates(t.x,t.y)}if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.viewportToImageCoordinates] is not accurate "+"with multi-image; use TiledImage.viewportToImageCoordinates instead.")}}else if(n===1){var r=this.viewer.world.getItemAt(0);return r.viewportToImageCoordinates(t,i,true)}}return this._viewportToImageDelta(t-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(t,i){if(t instanceof e.Point){return this.imageToViewportCoordinates(t.x,t.y)}if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.imageToViewportCoordinates] is not accurate "+"with multi-image; use TiledImage.imageToViewportCoordinates instead.")}}else if(n===1){var r=this.viewer.world.getItemAt(0);return r.imageToViewportCoordinates(t,i,true)}}var o=this._imageToViewportDelta(t,i);o.x+=this._contentBoundsNoRotate.x;o.y+=this._contentBoundsNoRotate.y;return o},imageToViewportRectangle:function(t,i,n,r){var o=t;if(!(o instanceof e.Rect)){o=new e.Rect(t,i,n,r)}if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.imageToViewportRectangle] is not accurate "+"with multi-image; use TiledImage.imageToViewportRectangle instead.")}}else if(s===1){var a=this.viewer.world.getItemAt(0);return a.imageToViewportRectangle(t,i,n,r,true)}}var l=this.imageToViewportCoordinates(o.x,o.y);var h=this._imageToViewportDelta(o.width,o.height);return new e.Rect(l.x,l.y,h.x,h.y,o.degrees)},viewportToImageRectangle:function(t,i,n,r){var o=t;if(!(o instanceof e.Rect)){o=new e.Rect(t,i,n,r)}if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.viewportToImageRectangle] is not accurate "+"with multi-image; use TiledImage.viewportToImageRectangle instead.")}}else if(s===1){var a=this.viewer.world.getItemAt(0);return a.viewportToImageRectangle(t,i,n,r,true)}}var l=this.viewportToImageCoordinates(o.x,o.y);var h=this._viewportToImageDelta(o.width,o.height);return new e.Rect(l.x,l.y,h.x,h.y,o.degrees)},viewerElementToImageCoordinates:function(e){var t=this.pointFromPixel(e,true);return this.viewportToImageCoordinates(t)},imageToViewerElementCoordinates:function(e){var t=this.imageToViewportCoordinates(e);return this.pixelFromPoint(t,true)},windowToImageCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var i=this.imageToViewerElementCoordinates(t);return i.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(e){return this.pointFromPixel(e,true)},viewportToViewerElementCoordinates:function(e){return this.pixelFromPoint(e,true)},viewerElementToViewportRectangle:function(t){return e.Rect.fromSummits(this.pointFromPixel(t.getTopLeft(),true),this.pointFromPixel(t.getTopRight(),true),this.pointFromPixel(t.getBottomLeft(),true))},viewportToViewerElementRectangle:function(t){return e.Rect.fromSummits(this.pixelFromPoint(t.getTopLeft(),true),this.pixelFromPoint(t.getTopRight(),true),this.pixelFromPoint(t.getBottomLeft(),true))},windowToViewportCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var i=this.viewportToViewerElementCoordinates(t);return i.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.viewportToImageZoom] is not "+"accurate with multi-image.")}}else if(i===1){var n=this.viewer.world.getItemAt(0);return n.viewportToImageZoom(t)}}var r=this._contentSizeNoRotate.x;var o=this._containerInnerSize.x;var s=this._contentBoundsNoRotate.width;var a=o/r*s;return t*a},imageToViewportZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.imageToViewportZoom] is not accurate "+"with multi-image.")}}else if(i===1){var n=this.viewer.world.getItemAt(0);return n.imageToViewportZoom(t)}}var r=this._contentSizeNoRotate.x;var o=this._containerInnerSize.x;var s=this._contentBoundsNoRotate.width;var a=r/o/s;return t*a},toggleFlip:function(){this.setFlip(!this.getFlip());return this},getFlip:function(){return this.flipped},setFlip:function(e){if(this.flipped===e){return this}this.flipped=e;if(this.viewer.navigator){this.viewer.navigator.setFlip(this.getFlip())}this.viewer.forceRedraw();this.viewer.raiseEvent("flip",{flipped:e});return this}}})(t);(function(e){e.TiledImage=function(i){var n=this;e.console.assert(i.tileCache,"[TiledImage] options.tileCache is required");e.console.assert(i.drawer,"[TiledImage] options.drawer is required");e.console.assert(i.viewer,"[TiledImage] options.viewer is required");e.console.assert(i.imageLoader,"[TiledImage] options.imageLoader is required");e.console.assert(i.source,"[TiledImage] options.source is required");e.console.assert(!i.clip||i.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present");e.EventSource.call(this);this._tileCache=i.tileCache;delete i.tileCache;this._drawer=i.drawer;delete i.drawer;this._imageLoader=i.imageLoader;delete i.imageLoader;if(i.clip instanceof e.Rect){this._clip=i.clip.clone()}delete i.clip;var r=i.x||0;delete i.x;var o=i.y||0;delete i.y;this.normHeight=i.source.dimensions.y/i.source.dimensions.x;this.contentAspectX=i.source.dimensions.x/i.source.dimensions.y;var s=1;if(i.width){s=i.width;delete i.width;if(i.height){e.console.error("specifying both width and height to a tiledImage is not supported");delete i.height}}else if(i.height){s=i.height/this.normHeight;delete i.height}var a=i.fitBounds;delete i.fitBounds;var l=i.fitBoundsPlacement||t.Placement.CENTER;delete i.fitBoundsPlacement;var h=i.degrees||0;delete i.degrees;var u=i.ajaxHeaders;delete i.ajaxHeaders;e.extend(true,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:false,_needsDraw:true,_hasOpaqueTile:false,_tilesLoading:0,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,immediateRender:e.DEFAULT_SETTINGS.immediateRender,blendTime:e.DEFAULT_SETTINGS.blendTime,alwaysBlend:e.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:e.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:e.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:e.DEFAULT_SETTINGS.iOSDevice,debugMode:e.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:e.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:e.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:e.DEFAULT_SETTINGS.placeholderFillStyle,opacity:e.DEFAULT_SETTINGS.opacity,preload:e.DEFAULT_SETTINGS.preload,compositeOperation:e.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:e.DEFAULT_SETTINGS.subPixelRoundingForTransparency},i);this._preload=this.preload;delete this.preload;this._fullyLoaded=false;this._xSpring=new e.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime});this._ySpring=new e.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime});this._scaleSpring=new e.Spring({initial:s,springStiffness:this.springStiffness,animationTime:this.animationTime});this._degreesSpring=new e.Spring({initial:h,springStiffness:this.springStiffness,animationTime:this.animationTime});this._updateForScale();if(a){this.fitBounds(a,l,true)}this._drawingHandler=function(t){n.viewer.raiseEvent("tile-drawing",e.extend({tiledImage:n},t))};this._ownAjaxHeaders={};this.setAjaxHeaders(u,false)};e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(e){if(e===this._fullyLoaded){return}this._fullyLoaded=e;this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded})},reset:function(){this._tileCache.clearTilesFor(this);this.lastResetTime=e.now();this._needsDraw=true},update:function(){var e=this._xSpring.update();var t=this._ySpring.update();var i=this._scaleSpring.update();var n=this._degreesSpring.update();if(e||t||i||n){this._updateForScale();this._needsDraw=true;return true}return false},draw:function(){if(this.opacity!==0||this._preload){this._midDraw=true;this._updateViewport();this._midDraw=false}else{this._needsDraw=false}},destroy:function(){this.reset();if(this.source.destroy){this.source.destroy()}},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(this.getRotation(e),this._getRotationPoint(e))},getBoundsNoRotate:function(t){return t?new e.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new e.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){e.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead");return this.getBounds()},getClippedBounds:function(t){var i=this.getBoundsNoRotate(t);if(this._clip){var n=t?this._worldWidthCurrent:this._worldWidthTarget;var r=n/this.source.dimensions.x;var o=this._clip.times(r);i=new e.Rect(i.x+o.x,i.y+o.y,o.width,o.height)}return i.rotate(this.getRotation(t),this._getRotationPoint(t))},getTileBounds:function(e,t,i){var n=this.source.getNumTiles(e);var r=(n.x+t%n.x)%n.x;var o=(n.y+i%n.y)%n.y;var s=this.source.getTileBounds(e,r,o);if(this.getFlip()){s.x=1-s.x-s.width}s.x+=(t-r)/n.x;s.y+=this._worldHeightCurrent/this._worldWidthCurrent*((i-o)/n.y);return s},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var t=this.imageToWindowCoordinates(new e.Point(0,0));var i=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(i.x-t.x,i.y-t.y)},_viewportToImageDelta:function(t,i,n){var r=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t*(this.source.dimensions.x/r),i*(this.source.dimensions.y*this.contentAspectX/r))},viewportToImageCoordinates:function(t,i,n){var r;if(t instanceof e.Point){n=i;r=t}else{r=new e.Point(t,i)}r=r.rotate(-this.getRotation(n),this._getRotationPoint(n));return n?this._viewportToImageDelta(r.x-this._xSpring.current.value,r.y-this._ySpring.current.value):this._viewportToImageDelta(r.x-this._xSpring.target.value,r.y-this._ySpring.target.value)},_imageToViewportDelta:function(t,i,n){var r=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t/this.source.dimensions.x*r,i/this.source.dimensions.y/this.contentAspectX*r)},imageToViewportCoordinates:function(t,i,n){if(t instanceof e.Point){n=i;i=t.y;t=t.x}var r=this._imageToViewportDelta(t,i);if(n){r.x+=this._xSpring.current.value;r.y+=this._ySpring.current.value}else{r.x+=this._xSpring.target.value;r.y+=this._ySpring.target.value}return r.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(t,i,n,r,o){var s=t;if(s instanceof e.Rect){o=i}else{s=new e.Rect(t,i,n,r)}var a=this.imageToViewportCoordinates(s.getTopLeft(),o);var l=this._imageToViewportDelta(s.width,s.height,o);return new e.Rect(a.x,a.y,l.x,l.y,s.degrees+this.getRotation(o))},viewportToImageRectangle:function(t,i,n,r,o){var s=t;if(t instanceof e.Rect){o=i}else{s=new e.Rect(t,i,n,r)}var a=this.viewportToImageCoordinates(s.getTopLeft(),o);var l=this._viewportToImageDelta(s.width,s.height,o);return new e.Rect(a.x,a.y,l.x,l.y,s.degrees-this.getRotation(o))},viewerElementToImageCoordinates:function(e){var t=this.viewport.pointFromPixel(e,true);return this.viewportToImageCoordinates(t)},imageToViewerElementCoordinates:function(e){var t=this.imageToViewportCoordinates(e);return this.viewport.pixelFromPoint(t,true)},windowToImageCoordinates:function(e){var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(e){var i=this.imageToViewerElementCoordinates(e);return i.plus(t.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(t){var i=this._scaleSpring.current.value;t=t.rotate(-this.getRotation(true),this._getRotationPoint(true));return new e.Rect((t.x-this._xSpring.current.value)/i,(t.y-this._ySpring.current.value)/i,t.width/i,t.height/i,t.degrees)},viewportToImageZoom:function(e){var t=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return t*e},imageToViewportZoom:function(e){var t=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return e/t},setPosition:function(e,t){var i=this._xSpring.target.value===e.x&&this._ySpring.target.value===e.y;if(t){if(i&&this._xSpring.current.value===e.x&&this._ySpring.current.value===e.y){return}this._xSpring.resetTo(e.x);this._ySpring.resetTo(e.y);this._needsDraw=true}else{if(i){return}this._xSpring.springTo(e.x);this._ySpring.springTo(e.y);this._needsDraw=true}if(!i){this._raiseBoundsChange()}},setWidth:function(e,t){this._setScale(e,t)},setHeight:function(e,t){this._setScale(e/this.normHeight,t)},setCroppingPolygons:function(t){var i=function(t){return t instanceof e.Point||typeof t.x==="number"&&typeof t.y==="number"};var n=function(e){return e.map((function(e){try{if(i(e)){return{x:e.x,y:e.y}}else{throw new Error}}catch(e){throw new Error("A Provided cropping polygon point is not supported")}}))};try{if(!e.isArray(t)){throw new Error("Provided cropping polygon is not an array")}this._croppingPolygons=t.map((function(e){return n(e)}))}catch(t){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported");e.console.error(t);this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(t,i,n){i=i||e.Placement.CENTER;var r=e.Placement.properties[i];var o=this.contentAspectX;var s=0;var a=0;var l=1;var h=1;if(this._clip){o=this._clip.getAspectRatio();l=this._clip.width/this.source.dimensions.x;h=this._clip.height/this.source.dimensions.y;if(t.getAspectRatio()>o){s=this._clip.x/this._clip.height*t.height;a=this._clip.y/this._clip.height*t.height}else{s=this._clip.x/this._clip.width*t.width;a=this._clip.y/this._clip.width*t.width}}if(t.getAspectRatio()>o){var u=t.height/h;var c=0;if(r.isHorizontallyCentered){c=(t.width-t.height*o)/2}else if(r.isRight){c=t.width-t.height*o}this.setPosition(new e.Point(t.x-s+c,t.y-a),n);this.setHeight(u,n)}else{var d=t.width/l;var p=0;if(r.isVerticallyCentered){p=(t.height-t.width/o)/2}else if(r.isBottom){p=t.height-t.width/o}this.setPosition(new e.Point(t.x-s,t.y-a+p),n);this.setWidth(d,n)}},getClip:function(){if(this._clip){return this._clip.clone()}return null},setClip:function(t){e.console.assert(!t||t instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null");if(t instanceof e.Rect){this._clip=t.clone()}else{this._clip=null}this._needsDraw=true;this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(e){this.flipped=!!e;this._needsDraw=true;this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(e){if(e===this.opacity){return}this.opacity=e;this._needsDraw=true;this.raiseEvent("opacity-change",{opacity:this.opacity})},getPreload:function(){return this._preload},setPreload:function(e){this._preload=!!e;this._needsDraw=true},getRotation:function(e){return e?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(e,t){if(this._degreesSpring.target.value===e&&this._degreesSpring.isAtTargetValue()){return}if(t){this._degreesSpring.resetTo(e)}else{this._degreesSpring.springTo(e)}this._needsDraw=true;this._raiseBoundsChange()},_getRotationPoint:function(e){return this.getBoundsNoRotate(e).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(e){if(e===this.compositeOperation){return}this.compositeOperation=e;this._needsDraw=true;this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation})},setAjaxHeaders:function(t,i){if(t===null){t={}}if(!e.isPlainObject(t)){console.error("[TiledImage.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}this._ownAjaxHeaders=t;this._updateAjaxHeaders(i)},_updateAjaxHeaders:function(t){if(t===undefined){t=true}if(e.isPlainObject(this.viewer.ajaxHeaders)){this.ajaxHeaders=e.extend({},this.viewer.ajaxHeaders,this._ownAjaxHeaders)}else{this.ajaxHeaders=this._ownAjaxHeaders}if(t){var i,n,r,o;for(var s in this.tilesMatrix){i=this.source.getNumTiles(s);for(var a in this.tilesMatrix[s]){n=(i.x+a%i.x)%i.x;for(var l in this.tilesMatrix[s][a]){r=(i.y+l%i.y)%i.y;o=this.tilesMatrix[s][a][l];o.loadWithAjax=this.loadTilesWithAjax;if(o.loadWithAjax){var h=this.source.getTileAjaxHeaders(s,n,r);o.ajaxHeaders=e.extend({},this.ajaxHeaders,h)}else{o.ajaxHeaders=null}}}}for(var u=0;u<this._imageLoader.jobQueue.length;u++){var c=this._imageLoader.jobQueue[u];c.loadWithAjax=c.tile.loadWithAjax;c.ajaxHeaders=c.tile.loadWithAjax?c.tile.ajaxHeaders:null}}},_setScale:function(e,t){var i=this._scaleSpring.target.value===e;if(t){if(i&&this._scaleSpring.current.value===e){return}this._scaleSpring.resetTo(e);this._updateForScale();this._needsDraw=true}else{if(i){return}this._scaleSpring.springTo(e);this._updateForScale();this._needsDraw=true}if(!i){this._raiseBoundsChange()}},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value;this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value;this._worldWidthCurrent=this._scaleSpring.current.value;this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent("bounds-change")},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var e=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2)));var t=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),true).x*this._scaleSpring.current.value;var i=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(t/this.minPixelRatio)/Math.log(2))));i=Math.max(i,this.source.minLevel||0);e=Math.min(e,i);return{lowestLevel:e,highestLevel:i}},_updateViewport:function(){this._needsDraw=false;this._tilesLoading=0;this.loadingCoverage={};while(this.lastDrawn.length>0){var t=this.lastDrawn.pop();t.beingDrawn=false}var i=this.viewport;var n=this._viewportToTiledImageRectangle(i.getBoundsWithMargins(true));if(!this.wrapHorizontal&&!this.wrapVertical){var r=this._viewportToTiledImageRectangle(this.getClippedBounds(true));n=n.intersection(r);if(n===null){return}}var o=this._getLevelsInterval();var s=o.lowestLevel;var a=o.highestLevel;var l=null;var h=false;var u=e.now();for(var c=a;c>=s;c--){var d=false;var p=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(c),true).x*this._scaleSpring.current.value;if(c===s||!h&&p>=this.minPixelRatio){d=true;h=true}else if(!h){continue}var f=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(c),false).x*this._scaleSpring.current.value;var g=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),false).x*this._scaleSpring.current.value;var v=this.immediateRender?1:g;var m=Math.min(1,(p-.5)/.5);var y=v/Math.abs(v-f);l=this._updateLevel(h,d,c,m,y,n,u,l);if(this._providesCoverage(this.coverage,c)){break}}this._drawTiles(this.lastDrawn);if(l&&!l.context2D){this._loadTile(l,u);this._needsDraw=true;this._setFullyLoaded(false)}else{this._setFullyLoaded(this._tilesLoading===0)}},_getCornerTiles:function(t,i,n){var r;var o;if(this.wrapHorizontal){r=e.positiveModulo(i.x,1);o=e.positiveModulo(n.x,1)}else{r=Math.max(0,i.x);o=Math.min(1,n.x)}var s;var a;var l=1/this.source.aspectRatio;if(this.wrapVertical){s=e.positiveModulo(i.y,l);a=e.positiveModulo(n.y,l)}else{s=Math.max(0,i.y);a=Math.min(l,n.y)}var h=this.source.getTileAtPoint(t,new e.Point(r,s));var u=this.source.getTileAtPoint(t,new e.Point(o,a));var c=this.source.getNumTiles(t);if(this.wrapHorizontal){h.x+=c.x*Math.floor(i.x);u.x+=c.x*Math.floor(n.x)}if(this.wrapVertical){h.y+=c.y*Math.floor(i.y/l);u.y+=c.y*Math.floor(n.y/l)}return{topLeft:h,bottomRight:u}},_updateLevel:function(e,t,i,n,r,o,s,a){var l=o.getBoundingBox().getTopLeft();var h=o.getBoundingBox().getBottomRight();if(this.viewer){this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:e,level:i,opacity:n,visibility:r,drawArea:o,topleft:l,bottomright:h,currenttime:s,best:a})}this._resetCoverage(this.coverage,i);this._resetCoverage(this.loadingCoverage,i);var u=this._getCornerTiles(i,l,h);var c=u.topLeft;var d=u.bottomRight;var p=this.source.getNumTiles(i);var f=this.viewport.pixelFromPoint(this.viewport.getCenter());if(this.getFlip()){d.x+=1;if(!this.wrapHorizontal){d.x=Math.min(d.x,p.x-1)}}for(var g=c.x;g<=d.x;g++){for(var v=c.y;v<=d.y;v++){var m;if(this.getFlip()){var y=(p.x+g%p.x)%p.x;m=g+p.x-y-y-1}else{m=g}if(o.intersection(this.getTileBounds(i,m,v))===null){continue}a=this._updateTile(t,e,m,v,i,n,r,f,p,s,a)}}return a},_updateTile:function(e,t,i,n,r,o,s,a,l,h,u){var c=this._getTile(i,n,r,h,l,this._worldWidthCurrent,this._worldHeightCurrent),d=t;if(this.viewer){this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:c})}this._setCoverage(this.coverage,r,i,n,false);var p=c.loaded||c.loading||this._isCovered(this.loadingCoverage,r,i,n);this._setCoverage(this.loadingCoverage,r,i,n,p);if(!c.exists){return u}if(e&&!d){if(this._isCovered(this.coverage,r,i,n)){this._setCoverage(this.coverage,r,i,n,true)}else{d=true}}if(!d){return u}this._positionTile(c,this.source.tileOverlap,this.viewport,a,s);if(!c.loaded){if(c.context2D){this._setTileLoaded(c)}else{var f=this._tileCache.getImageRecord(c.cacheKey);if(f){this._setTileLoaded(c,f.getData())}}}if(c.loaded){var g=this._blendTile(c,i,n,r,o,h);if(g){this._needsDraw=true}}else if(c.loading){this._tilesLoading++}else if(!p){u=this._compareTiles(u,c)}return u},_getTile:function(t,i,n,r,o,s,a){var l,h,u,c,d,p,f,g,v,m,y=this.tilesMatrix,w=this.source;if(!y[n]){y[n]={}}if(!y[n][t]){y[n][t]={}}if(!y[n][t][i]||!y[n][t][i].flipped!==!this.flipped){l=(o.x+t%o.x)%o.x;h=(o.y+i%o.y)%o.y;u=this.getTileBounds(n,t,i);c=w.getTileBounds(n,l,h,true);d=w.tileExists(n,l,h);p=w.getTileUrl(n,l,h);f=w.getTilePostData(n,l,h);if(this.loadTilesWithAjax){g=w.getTileAjaxHeaders(n,l,h);if(e.isPlainObject(this.ajaxHeaders)){g=e.extend({},this.ajaxHeaders,g)}}else{g=null}v=w.getContext2D?w.getContext2D(n,l,h):undefined;m=new e.Tile(n,t,i,u,d,p,v,this.loadTilesWithAjax,g,c,f,w.getTileHashKey(n,l,h,p,g,f));if(this.getFlip()){if(l===0){m.isRightMost=true}}else{if(l===o.x-1){m.isRightMost=true}}if(h===o.y-1){m.isBottomMost=true}m.flipped=this.flipped;y[n][t][i]=m}m=y[n][t][i];m.lastTouchTime=r;return m},_loadTile:function(e,t){var i=this;e.loading=true;this._imageLoader.addJob({src:e.getUrl(),tile:e,source:this.source,postData:e.postData,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(n,r,o){i._onTileLoad(e,t,n,r,o)},abort:function(){e.loading=false}})},_onTileLoad:function(t,i,n,r,o){if(!n){e.console.error("Tile %s failed to load: %s - error: %s",t,t.getUrl(),r);this.viewer.raiseEvent("tile-load-failed",{tile:t,tiledImage:this,time:i,message:r,tileRequest:o});t.loading=false;t.exists=false;return}else{t.exists=true}if(i<this.lastResetTime){e.console.warn("Ignoring tile %s loaded before reset: %s",t,t.getUrl());t.loading=false;return}var s=this,a=function(){var e=s.source;var i=e.getClosestLevel();s._setTileLoaded(t,n,i,o)};if(!this._midDraw){a()}else{window.setTimeout(a,1)}},_setTileLoaded:function(t,i,n,r){var o=0,s=false,a=this;function l(){if(s){e.console.error("Event 'tile-loaded' argument getCompletionCallback must be called synchronously. "+"Its return value should be called asynchronously.")}o++;return h}function h(){o--;if(o===0){t.loading=false;t.loaded=true;t.hasTransparency=a.source.hasTransparency(t.context2D,t.getUrl(),t.ajaxHeaders,t.postData);if(!t.context2D){a._tileCache.cacheTile({data:i,tile:t,cutoff:n,tiledImage:a})}a._needsDraw=true}}var u=l();this.viewer.raiseEvent("tile-loaded",{tile:t,tiledImage:this,tileRequest:r,get image(){e.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead.");return i},data:i,getCompletionCallback:l});s=true;u()},_positionTile:function(t,i,n,r,o){var s=t.bounds.getTopLeft();s.x*=this._scaleSpring.current.value;s.y*=this._scaleSpring.current.value;s.x+=this._xSpring.current.value;s.y+=this._ySpring.current.value;var a=t.bounds.getSize();a.x*=this._scaleSpring.current.value;a.y*=this._scaleSpring.current.value;var l=n.pixelFromPointNoRotate(s,true),h=n.pixelFromPointNoRotate(s,false),u=n.deltaPixelsFromPointsNoRotate(a,true),c=n.deltaPixelsFromPointsNoRotate(a,false),d=h.plus(c.divide(2)),p=r.squaredDistanceTo(d);if(!i){u=u.plus(new e.Point(1,1))}if(t.isRightMost&&this.wrapHorizontal){u.x+=.75}if(t.isBottomMost&&this.wrapVertical){u.y+=.75}t.position=l;t.size=u;t.squaredDistance=p;t.visibility=o},_blendTile:function(e,t,i,n,r,o){var s=1e3*this.blendTime,a,l;if(!e.blendStart){e.blendStart=o}a=o-e.blendStart;l=s?Math.min(1,a/s):1;if(this.alwaysBlend){l*=r}e.opacity=l;this.lastDrawn.push(e);if(l===1){this._setCoverage(this.coverage,n,t,i,true);this._hasOpaqueTile=true}else if(a<s){return true}return false},_compareTiles:function(e,t){if(!e){return t}if(t.visibility>e.visibility){return t}else if(t.visibility===e.visibility){if(t.squaredDistance<e.squaredDistance){return t}}return e},_drawTiles:function(t){if(this.opacity===0||t.length===0&&!this.placeholderFillStyle){return}var i=t[0];var n;if(i){n=this.opacity<1||this.compositeOperation&&this.compositeOperation!=="source-over"||!this._isBottomItem()&&this.source.hasTransparency(i.context2D,i.getUrl(),i.ajaxHeaders,i.postData)}var r;var s;var a=this.viewport.getZoom(true);var l=this.viewportToImageZoom(a);if(t.length>1&&l>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(true)%360===0&&e.supportsCanvas&&this.viewer.useCanvas){n=true;r=i.getScaleForEdgeSmoothing();s=i.getTranslationForEdgeSmoothing(r,this._drawer.getCanvasSize(false),this._drawer.getCanvasSize(true))}var h;if(n){if(!r){h=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(true)).getIntegerBoundingBox();if(this._drawer.viewer.viewport.getFlip()){if(this.viewport.getRotation(true)%360!==0||this.getRotation(true)%360!==0){h.x=this._drawer.viewer.container.clientWidth-(h.x+h.width)}}h=h.times(e.pixelDensityRatio)}this._drawer._clear(true,h)}if(!r){if(this.viewport.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.viewport.getRotation(true),useSketch:n})}if(this.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.getRotation(true),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(true),true),useSketch:n})}if(this.viewport.getRotation(true)%360===0&&this.getRotation(true)%360===0){if(this._drawer.viewer.viewport.getFlip()){this._drawer._flip()}}}var u=false;if(this._clip){this._drawer.saveContext(n);var c=this.imageToViewportRectangle(this._clip,true);c=c.rotate(-this.getRotation(true),this._getRotationPoint(true));var d=this._drawer.viewportToDrawerRectangle(c);if(r){d=d.times(r)}if(s){d=d.translate(s)}this._drawer.setClip(d,n);u=true}if(this._croppingPolygons){var p=this;this._drawer.saveContext(n);try{var f=this._croppingPolygons.map((function(e){return e.map((function(e){var t=p.imageToViewportCoordinates(e.x,e.y,true).rotate(-p.getRotation(true),p._getRotationPoint(true));var i=p._drawer.viewportCoordToDrawerCoord(t);if(r){i=i.times(r)}if(s){i=i.plus(s)}return i}))}));this._drawer.clipWithPolygons(f,n)}catch(t){e.console.error(t)}u=true}if(this.placeholderFillStyle&&this._hasOpaqueTile===false){var g=this._drawer.viewportToDrawerRectangle(this.getBounds(true));if(r){g=g.times(r)}if(s){g=g.translate(s)}var v=null;if(typeof this.placeholderFillStyle==="function"){v=this.placeholderFillStyle(this,this._drawer.context)}else{v=this.placeholderFillStyle}this._drawer.drawRectangle(g,v,n)}var m=o(this.subPixelRoundingForTransparency);var y=false;if(m===e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS){y=true}else if(m===e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){var w=this.viewer&&this.viewer.isAnimating();y=!w}for(var T=t.length-1;T>=0;T--){i=t[T];this._drawer.drawTile(i,this._drawingHandler,n,r,s,y,this.source);i.beingDrawn=true;if(this.viewer){this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:i})}}if(u){this._drawer.restoreContext(n)}if(!r){if(this.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(n)}if(this.viewport.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(n)}}if(n){if(r){if(this.viewport.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.viewport.getRotation(true),useSketch:false})}if(this.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.getRotation(true),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(true),true),useSketch:false})}}this._drawer.blendSketch({opacity:this.opacity,scale:r,translate:s,compositeOperation:this.compositeOperation,bounds:h});if(r){if(this.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(false)}if(this.viewport.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(false)}}}if(!r){if(this.viewport.getRotation(true)%360===0&&this.getRotation(true)%360===0){if(this._drawer.viewer.viewport.getFlip()){this._drawer._flip()}}}this._drawDebugInfo(t)},_drawDebugInfo:function(t){if(this.debugMode){for(var i=t.length-1;i>=0;i--){var n=t[i];try{this._drawer.drawDebugInfo(n,t.length,i,this)}catch(t){e.console.error(t)}}}},_providesCoverage:function(e,t,i,n){var r,o,s,a;if(!e[t]){return false}if(i===undefined||n===undefined){r=e[t];for(s in r){if(Object.prototype.hasOwnProperty.call(r,s)){o=r[s];for(a in o){if(Object.prototype.hasOwnProperty.call(o,a)&&!o[a]){return false}}}}return true}return e[t][i]===undefined||e[t][i][n]===undefined||e[t][i][n]===true},_isCovered:function(e,t,i,n){if(i===undefined||n===undefined){return this._providesCoverage(e,t+1)}else{return this._providesCoverage(e,t+1,2*i,2*n)&&this._providesCoverage(e,t+1,2*i,2*n+1)&&this._providesCoverage(e,t+1,2*i+1,2*n)&&this._providesCoverage(e,t+1,2*i+1,2*n+1)}},_setCoverage:function(t,i,n,r,o){if(!t[i]){e.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",i);return}if(!t[i][n]){t[i][n]={}}t[i][n][r]=o},_resetCoverage:function(e,t){e[t]={}}});var i=e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function n(t){return t!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&t!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&t!==e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function r(e){if(n(e)){return i}return e}function o(t){if(typeof t==="number"){return r(t)}if(!t||!e.Browser){return i}var o=t[e.Browser.vendor];if(n(o)){o=t["*"]}return r(o)}})(t);(function(e){var t=function(t){e.console.assert(t,"[TileCache.cacheTile] options is required");e.console.assert(t.tile,"[TileCache.cacheTile] options.tile is required");e.console.assert(t.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");this.tile=t.tile;this.tiledImage=t.tiledImage};var i=function(t){e.console.assert(t,"[ImageRecord] options is required");e.console.assert(t.data,"[ImageRecord] options.data is required");this._tiles=[];t.create.apply(null,[this,t.data,t.ownerTile]);this._destroyImplementation=t.destroy.bind(null,this);this.getImage=t.getImage.bind(null,this);this.getData=t.getData.bind(null,this);this.getRenderedContext=t.getRenderedContext.bind(null,this)};i.prototype={destroy:function(){this._destroyImplementation();this._tiles=null},addTile:function(t){e.console.assert(t,"[ImageRecord.addTile] tile is required");this._tiles.push(t)},removeTile:function(t){for(var i=0;i<this._tiles.length;i++){if(this._tiles[i]===t){this._tiles.splice(i,1);return}}e.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",t)},getTileCount:function(){return this._tiles.length}};e.TileCache=function(t){t=t||{};this._maxImageCacheCount=t.maxImageCacheCount||e.DEFAULT_SETTINGS.maxImageCacheCount;this._tilesLoaded=[];this._imagesLoaded=[];this._imagesLoadedCount=0};e.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(n){e.console.assert(n,"[TileCache.cacheTile] options is required");e.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required");e.console.assert(n.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required");e.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var r=n.cutoff||0;var o=this._tilesLoaded.length;var s=this._imagesLoaded[n.tile.cacheKey];if(!s){if(!n.data){e.console.error("[TileCache.cacheTile] options.image was renamed to options.data. '.image' attribute "+"has been deprecated and will be removed in the future.");n.data=n.image}e.console.assert(n.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord");s=this._imagesLoaded[n.tile.cacheKey]=new i({data:n.data,ownerTile:n.tile,create:n.tiledImage.source.createTileCache,destroy:n.tiledImage.source.destroyTileCache,getImage:n.tiledImage.source.getTileCacheDataAsImage,getData:n.tiledImage.source.getTileCacheData,getRenderedContext:n.tiledImage.source.getTileCacheDataAsContext2D});this._imagesLoadedCount++}s.addTile(n.tile);n.tile.cacheImageRecord=s;if(this._imagesLoadedCount>this._maxImageCacheCount){var a=null;var l=-1;var h=null;var u,c,d,p,f,g;for(var v=this._tilesLoaded.length-1;v>=0;v--){g=this._tilesLoaded[v];u=g.tile;if(u.level<=r||u.beingDrawn){continue}else if(!a){a=u;l=v;h=g;continue}p=u.lastTouchTime;c=a.lastTouchTime;f=u.level;d=a.level;if(p<c||p===c&&f>d){a=u;l=v;h=g}}if(a&&l>=0){this._unloadTile(h);o=l}}this._tilesLoaded[o]=new t({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(t){e.console.assert(t,"[TileCache.clearTilesFor] tiledImage is required");var i;for(var n=0;n<this._tilesLoaded.length;++n){i=this._tilesLoaded[n];if(i.tiledImage===t){this._unloadTile(i);this._tilesLoaded.splice(n,1);n--}}},getImageRecord:function(t){e.console.assert(t,"[TileCache.getImageRecord] cacheKey is required");return this._imagesLoaded[t]},_unloadTile:function(t){e.console.assert(t,"[TileCache._unloadTile] tileRecord is required");var i=t.tile;var n=t.tiledImage;i.unload();i.cacheImageRecord=null;var r=this._imagesLoaded[i.cacheKey];r.removeTile(i);if(!r.getTileCount()){r.destroy();delete this._imagesLoaded[i.cacheKey];this._imagesLoadedCount--}n.viewer.raiseEvent("tile-unloaded",{tile:i,tiledImage:n})}}})(t);(function(e){e.World=function(t){var i=this;e.console.assert(t.viewer,"[World] options.viewer is required");e.EventSource.call(this);this.viewer=t.viewer;this._items=[];this._needsDraw=false;this._autoRefigureSizes=true;this._needsSizesFigured=false;this._delegatedFigureSizes=function(e){if(i._autoRefigureSizes){i._figureSizes()}else{i._needsSizesFigured=true}};this._figureSizes()};e.extend(e.World.prototype,e.EventSource.prototype,{addItem:function(t,i){e.console.assert(t,"[World.addItem] item is required");e.console.assert(t instanceof e.TiledImage,"[World.addItem] only TiledImages supported at this time");i=i||{};if(i.index!==undefined){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,t)}else{this._items.push(t)}if(this._autoRefigureSizes){this._figureSizes()}else{this._needsSizesFigured=true}this._needsDraw=true;t.addHandler("bounds-change",this._delegatedFigureSizes);t.addHandler("clip-change",this._delegatedFigureSizes);this.raiseEvent("add-item",{item:t})},getItemAt:function(t){e.console.assert(t!==undefined,"[World.getItemAt] index is required");return this._items[t]},getIndexOfItem:function(t){e.console.assert(t,"[World.getIndexOfItem] item is required");return e.indexOf(this._items,t)},getItemCount:function(){return this._items.length},setItemIndex:function(t,i){e.console.assert(t,"[World.setItemIndex] item is required");e.console.assert(i!==undefined,"[World.setItemIndex] index is required");var n=this.getIndexOfItem(t);if(i>=this._items.length){throw new Error("Index bigger than number of layers.")}if(i===n||n===-1){return}this._items.splice(n,1);this._items.splice(i,0,t);this._needsDraw=true;this.raiseEvent("item-index-change",{item:t,previousIndex:n,newIndex:i})},removeItem:function(t){e.console.assert(t,"[World.removeItem] item is required");var i=e.indexOf(this._items,t);if(i===-1){return}t.removeHandler("bounds-change",this._delegatedFigureSizes);t.removeHandler("clip-change",this._delegatedFigureSizes);t.destroy();this._items.splice(i,1);this._figureSizes();this._needsDraw=true;this._raiseRemoveItem(t)},removeAll:function(){this.viewer._cancelPendingImages();var e;var t;for(t=0;t<this._items.length;t++){e=this._items[t];e.removeHandler("bounds-change",this._delegatedFigureSizes);e.removeHandler("clip-change",this._delegatedFigureSizes);e.destroy()}var i=this._items;this._items=[];this._figureSizes();this._needsDraw=true;for(t=0;t<i.length;t++){e=i[t];this._raiseRemoveItem(e)}},resetItems:function(){for(var e=0;e<this._items.length;e++){this._items[e].reset()}},update:function(){var e=false;for(var t=0;t<this._items.length;t++){e=this._items[t].update()||e}return e},draw:function(){for(var e=0;e<this._items.length;e++){this._items[e].draw()}this._needsDraw=false},needsDraw:function(){for(var e=0;e<this._items.length;e++){if(this._items[e].needsDraw()){return true}}return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(e){this._autoRefigureSizes=e;if(e&this._needsSizesFigured){this._figureSizes();this._needsSizesFigured=false}},arrange:function(t){t=t||{};var i=t.immediately||false;var n=t.layout||e.DEFAULT_SETTINGS.collectionLayout;var r=t.rows||e.DEFAULT_SETTINGS.collectionRows;var o=t.columns||e.DEFAULT_SETTINGS.collectionColumns;var s=t.tileSize||e.DEFAULT_SETTINGS.collectionTileSize;var a=t.tileMargin||e.DEFAULT_SETTINGS.collectionTileMargin;var l=s+a;var h;if(!t.rows&&o){h=o}else{h=Math.ceil(this._items.length/r)}var u=0;var c=0;var d,p,f,g,v;this.setAutoRefigureSizes(false);for(var m=0;m<this._items.length;m++){if(m&&m%h===0){if(n==="horizontal"){c+=l;u=0}else{u+=l;c=0}}d=this._items[m];p=d.getBounds();if(p.width>p.height){f=s}else{f=s*(p.width/p.height)}g=f*(p.height/p.width);v=new e.Point(u+(s-f)/2,c+(s-g)/2);d.setPosition(v,i);d.setWidth(f,i);if(n==="horizontal"){u+=l}else{c+=l}}this.setAutoRefigureSizes(true)},_figureSizes:function(){var t=this._homeBounds?this._homeBounds.clone():null;var i=this._contentSize?this._contentSize.clone():null;var n=this._contentFactor||0;if(!this._items.length){this._homeBounds=new e.Rect(0,0,1,1);this._contentSize=new e.Point(1,1);this._contentFactor=1}else{var r=this._items[0];var o=r.getBounds();this._contentFactor=r.getContentSize().x/o.width;var s=r.getClippedBounds().getBoundingBox();var a=s.x;var l=s.y;var h=s.x+s.width;var u=s.y+s.height;for(var c=1;c<this._items.length;c++){r=this._items[c];o=r.getBounds();this._contentFactor=Math.max(this._contentFactor,r.getContentSize().x/o.width);s=r.getClippedBounds().getBoundingBox();a=Math.min(a,s.x);l=Math.min(l,s.y);h=Math.max(h,s.x+s.width);u=Math.max(u,s.y+s.height)}this._homeBounds=new e.Rect(a,l,h-a,u-l);this._contentSize=new e.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}if(this._contentFactor!==n||!this._homeBounds.equals(t)||!this._contentSize.equals(i)){this.raiseEvent("metrics-change",{})}},_raiseRemoveItem:function(e){this.raiseEvent("remove-item",{item:e})}})})(t)}));class o{constructor(e){this.type="DziViewer";this.opts=e}init(){return t(this,void 0,void 0,(function*(){const e=this.app.getState();const t=this.opts.holder;t.append("div").attr("id","openseadragon-viewer").style("width"," 800px").style("height"," 800px");const i=[];for(const t of e.dzimages){i.push(`dzimages/${e.sample_id}?genome=${e.genome}&dslabel=${e.dslabel}&file=${t}`)}r({id:"openseadragon-viewer",tileSources:i,prefixUrl:"https://openseadragon.github.io/openseadragon/images/",showNavigator:true,sequenceMode:i.length>1})}))}}const s=e(o);const a=s;function l(){return t(this,void 0,void 0,(function*(){return{chartType:"DziViewer",subfolder:"dziviewer",extension:"ts"}}))}export{a as componentInit,s as dziViewer,l as getPlotConfig};
|
|
7
|
+
function t(e){return new t.Viewer(e)}(function(e){e.version={versionStr:"4.1.1",major:parseInt("4",10),minor:parseInt("1",10),revision:parseInt("1",10)};var i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Promise]":"promise","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;e.isFunction=function(t){return e.type(t)==="function"};e.isArray=Array.isArray||function(t){return e.type(t)==="array"};e.isWindow=function(e){return e&&typeof e==="object"&&"setInterval"in e};e.type=function(e){return e===null||e===undefined?String(e):i[n.call(e)]||"object"};e.isPlainObject=function(i){if(!i||t.type(i)!=="object"||i.nodeType||e.isWindow(i)){return false}if(i.constructor&&!r.call(i,"constructor")&&!r.call(i.constructor.prototype,"isPrototypeOf")){return false}var n;for(var o in i){n=o}return n===undefined||r.call(i,n)};e.isEmptyObject=function(e){for(var t in e){return false}return true};e.freezeObject=function(t){if(Object.freeze){e.freezeObject=Object.freeze}else{e.freezeObject=function(e){return e}}return e.freezeObject(t)};e.supportsCanvas=function(){var t=document.createElement("canvas");return!!(e.isFunction(t.getContext)&&t.getContext("2d"))}();e.isCanvasTainted=function(e){var t=false;try{e.getContext("2d").getImageData(0,0,1,1)}catch(e){t=true}return t};e.supportsAddEventListener=function(){return!!(document.documentElement.addEventListener&&document.addEventListener)}();e.supportsRemoveEventListener=function(){return!!(document.documentElement.removeEventListener&&document.removeEventListener)}();e.supportsEventListenerOptions=function(){var t=0;if(e.supportsAddEventListener){try{var i={get capture(){t++;return false},get once(){t++;return false},get passive(){t++;return false}};window.addEventListener("test",null,i);window.removeEventListener("test",null,i)}catch(e){t=0}}return t>=3}();e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var t=document.createElement("canvas").getContext("2d");var i=window.devicePixelRatio||1;var n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return Math.max(i,1)/n}else{return 1}};e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(t);(function(e){e.extend=function(){var i,n,r,o,s,a,l=arguments[0]||{},h=arguments.length,u=false,c=1;if(typeof l==="boolean"){u=l;l=arguments[1]||{};c=2}if(typeof l!=="object"&&!t.isFunction(l)){l={}}if(h===c){l=this;--c}for(;c<h;c++){i=arguments[c];if(i!==null||i!==undefined){for(n in i){var d=Object.getOwnPropertyDescriptor(i,n);if(d!==undefined){if(d.get||d.set){Object.defineProperty(l,n,d);continue}o=d.value}else{e.console.warn('Could not copy inherited property "'+n+'".');continue}if(l===o){continue}if(u&&o&&(t.isPlainObject(o)||(s=t.isArray(o)))){r=l[n];if(s){s=false;a=r&&t.isArray(r)?r:[]}else{a=r&&t.isPlainObject(r)?r:{}}l[n]=t.extend(u,a,o)}else if(o!==undefined){l[n]=o}}}}return l};var i=function(){if(typeof navigator!=="object"){return false}var e=navigator.userAgent;if(typeof e!=="string"){return false}return e.indexOf("iPhone")!==-1||e.indexOf("iPad")!==-1||e.indexOf("iPod")!==-1};e.extend(e,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:false,ajaxWithCredentials:false,loadTilesWithAjax:false,ajaxHeaders:{},splitHashDataForPost:false,panHorizontal:true,panVertical:true,constrainDuringPan:false,wrapHorizontal:false,wrapVertical:false,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:false,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:true,scrollToZoom:true,clickToZoom:true,dblClickToZoom:false,dblClickDragToZoom:false,pinchToZoom:false,zoomToRefPoint:true,flickEnabled:false,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},gestureSettingsTouch:{dragToPan:true,scrollToZoom:false,clickToZoom:false,dblClickToZoom:true,dblClickDragToZoom:true,pinchToZoom:true,zoomToRefPoint:true,flickEnabled:true,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},gestureSettingsPen:{dragToPan:true,scrollToZoom:false,clickToZoom:true,dblClickToZoom:false,dblClickDragToZoom:false,pinchToZoom:false,zoomToRefPoint:true,flickEnabled:false,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},gestureSettingsUnknown:{dragToPan:true,scrollToZoom:false,clickToZoom:false,dblClickToZoom:true,dblClickDragToZoom:false,pinchToZoom:true,zoomToRefPoint:true,flickEnabled:true,flickMinSpeed:120,flickMomentum:.25,pinchRotate:false},zoomPerClick:2,zoomPerScroll:1.2,zoomPerDblClickDrag:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:false,autoHideControls:true,immediateRender:false,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:i(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:true,preserveImageSizeOnResize:false,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:true,sequenceControlAnchor:null,preserveViewport:false,preserveOverlays:false,navPrevNextWrap:false,showNavigationControl:true,navigationControlAnchor:null,showZoomControl:true,showHomeControl:true,showFullPageControl:true,showRotationControl:false,showFlipControl:false,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:true,showNavigator:false,navigatorElement:null,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:false,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:true,navigatorAutoFade:true,navigatorRotate:true,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:false,opacity:1,preload:false,compositeOperation:null,imageSmoothingEnabled:true,placeholderFillStyle:null,subPixelRoundingForTransparency:null,showReferenceStrip:false,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:false,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,useCanvas:true,tileRetryMax:0,tileRetryDelay:2500,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:false,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"],silenceMultiImageWarnings:false},SIGNAL:"----seadragon----",delegate:function(e,t){return function(){var i=arguments;if(i===undefined){i=[]}return t.apply(e,i)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},SUBPIXEL_ROUNDING_OCCURRENCES:{NEVER:0,ONLY_AT_REST:1,ALWAYS:2},_viewers:new Map,getViewer:function(t){return e._viewers.get(this.getElement(t))},getElement:function(e){if(typeof e==="string"){e=document.getElementById(e)}return e},getElementPosition:function(t){var i=new e.Point,n,r;t=e.getElement(t);n=e.getElementStyle(t).position==="fixed";r=s(t,n);while(r){i.x+=t.offsetLeft;i.y+=t.offsetTop;if(n){i=i.plus(e.getPageScroll())}t=r;n=e.getElementStyle(t).position==="fixed";r=s(t,n)}return i},getElementOffset:function(t){t=e.getElement(t);var i=t&&t.ownerDocument,n,r,o={top:0,left:0};if(!i){return new e.Point}n=i.documentElement;if(typeof t.getBoundingClientRect!==typeof undefined){o=t.getBoundingClientRect()}r=i===i.window?i:i.nodeType===9?i.defaultView||i.parentWindow:false;return new e.Point(o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0),o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0))},getElementSize:function(t){t=e.getElement(t);return new e.Point(t.clientWidth,t.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(t){t=e.getElement(t);return t.currentStyle}:function(t){t=e.getElement(t);return window.getComputedStyle(t,"")},getCssPropertyWithVendorPrefix:function(t){var i={};e.getCssPropertyWithVendorPrefix=function(t){if(i[t]!==undefined){return i[t]}var n=document.createElement("div").style;var r=null;if(n[t]!==undefined){r=t}else{var o=["Webkit","Moz","MS","O","webkit","moz","ms","o"];var s=e.capitalizeFirstLetter(t);for(var a=0;a<o.length;a++){var l=o[a]+s;if(n[l]!==undefined){r=l;break}}}i[t]=r;return r};return e.getCssPropertyWithVendorPrefix(t)},capitalizeFirstLetter:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},positiveModulo:function(e,t){var i=e%t;if(i<0){i+=t}return i},pointInElement:function(t,i){t=e.getElement(t);var n=e.getElementOffset(t),r=e.getElementSize(t);return i.x>=n.x&&i.x<n.x+r.x&&i.y<n.y+r.y&&i.y>=n.y},getMousePosition:function(t){if(typeof t.pageX==="number"){e.getMousePosition=function(t){var i=new e.Point;i.x=t.pageX;i.y=t.pageY;return i}}else if(typeof t.clientX==="number"){e.getMousePosition=function(t){var i=new e.Point;i.x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;i.y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop;return i}}else{throw new Error("Unknown event mouse position, no known technique.")}return e.getMousePosition(t)},getPageScroll:function(){var t=document.documentElement||{},i=document.body||{};if(typeof window.pageXOffset==="number"){e.getPageScroll=function(){return new e.Point(window.pageXOffset,window.pageYOffset)}}else if(i.scrollLeft||i.scrollTop){e.getPageScroll=function(){return new e.Point(document.body.scrollLeft,document.body.scrollTop)}}else if(t.scrollLeft||t.scrollTop){e.getPageScroll=function(){return new e.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}else{return new e.Point(0,0)}return e.getPageScroll()},setPageScroll:function(t){if(typeof window.scrollTo!=="undefined"){e.setPageScroll=function(e){window.scrollTo(e.x,e.y)}}else{var i=e.getPageScroll();if(i.x===t.x&&i.y===t.y){return}document.body.scrollLeft=t.x;document.body.scrollTop=t.y;var n=e.getPageScroll();if(n.x!==i.x&&n.y!==i.y){e.setPageScroll=function(e){document.body.scrollLeft=e.x;document.body.scrollTop=e.y};return}document.documentElement.scrollLeft=t.x;document.documentElement.scrollTop=t.y;n=e.getPageScroll();if(n.x!==i.x&&n.y!==i.y){e.setPageScroll=function(e){document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y};return}e.setPageScroll=function(e){}}e.setPageScroll(t)},getWindowSize:function(){var t=document.documentElement||{},i=document.body||{};if(typeof window.innerWidth==="number"){e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)}}else if(t.clientWidth||t.clientHeight){e.getWindowSize=function(){return new e.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)}}else if(i.clientWidth||i.clientHeight){e.getWindowSize=function(){return new e.Point(document.body.clientWidth,document.body.clientHeight)}}else{throw new Error("Unknown window size, no known technique.")}return e.getWindowSize()},makeCenteredNode:function(t){t=e.getElement(t);var i=[e.makeNeutralElement("div"),e.makeNeutralElement("div"),e.makeNeutralElement("div")];e.extend(i[0].style,{display:"table",height:"100%",width:"100%"});e.extend(i[1].style,{display:"table-row"});e.extend(i[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"});i[0].appendChild(i[1]);i[1].appendChild(i[2]);i[2].appendChild(t);return i[0]},makeNeutralElement:function(e){var t=document.createElement(e),i=t.style;i.background="transparent none";i.border="none";i.margin="0px";i.padding="0px";i.position="static";return t},now:function(){if(Date.now){e.now=Date.now}else{e.now=function(){return(new Date).getTime()}}return e.now()},makeTransparentImage:function(t){var i=e.makeNeutralElement("img");i.src=t;return i},setElementOpacity:function(t,i,n){var r,o;t=e.getElement(t);if(n&&!e.Browser.alpha){i=Math.round(i)}if(e.Browser.opacity){t.style.opacity=i<1?i:""}else{if(i<1){r=Math.round(100*i);o="alpha(opacity="+r+")";t.style.filter=o}else{t.style.filter=""}}},setElementTouchActionNone:function(t){t=e.getElement(t);if(typeof t.style.touchAction!=="undefined"){t.style.touchAction="none"}else if(typeof t.style.msTouchAction!=="undefined"){t.style.msTouchAction="none"}},setElementPointerEvents:function(t,i){t=e.getElement(t);if(typeof t.style!=="undefined"&&typeof t.style.pointerEvents!=="undefined"){t.style.pointerEvents=i}},setElementPointerEventsNone:function(t){e.setElementPointerEvents(t,"none")},addClass:function(t,i){t=e.getElement(t);if(!t.className){t.className=i}else if((" "+t.className+" ").indexOf(" "+i+" ")===-1){t.className+=" "+i}},indexOf:function(e,t,i){if(Array.prototype.indexOf){this.indexOf=function(e,t,i){return e.indexOf(t,i)}}else{this.indexOf=function(e,t,i){var n,r=i?i:0,o;if(!e){throw new TypeError}o=e.length;if(o===0||r>=o){return-1}if(r<0){r=o-Math.abs(r)}for(n=r;n<o;n++){if(e[n]===t){return n}}return-1}}return this.indexOf(e,t,i)},removeClass:function(t,i){var n,r=[],o;t=e.getElement(t);n=t.className.split(/\s+/);for(o=0;o<n.length;o++){if(n[o]&&n[o]!==i){r.push(n[o])}}t.className=r.join(" ")},normalizeEventListenerOptions:function(t){var i;if(typeof t!=="undefined"){if(typeof t==="boolean"){i=e.supportsEventListenerOptions?{capture:t}:t}else{i=e.supportsEventListenerOptions?t:typeof t.capture!=="undefined"?t.capture:false}}else{i=e.supportsEventListenerOptions?{capture:false}:false}return i},addEvent:function(){if(e.supportsAddEventListener){return function(t,i,n,r){r=e.normalizeEventListenerOptions(r);t=e.getElement(t);t.addEventListener(i,n,r)}}else if(document.documentElement.attachEvent&&document.attachEvent){return function(t,i,n){t=e.getElement(t);t.attachEvent("on"+i,n)}}else{throw new Error("No known event model.")}}(),removeEvent:function(){if(e.supportsRemoveEventListener){return function(t,i,n,r){r=e.normalizeEventListenerOptions(r);t=e.getElement(t);t.removeEventListener(i,n,r)}}else if(document.documentElement.detachEvent&&document.detachEvent){return function(t,i,n){t=e.getElement(t);t.detachEvent("on"+i,n)}}else{throw new Error("No known event model.")}}(),cancelEvent:function(e){e.preventDefault()},eventIsCanceled:function(e){return e.defaultPrevented},stopEvent:function(e){e.stopPropagation()},createCallback:function(e,t){var i=[],n;for(n=2;n<arguments.length;n++){i.push(arguments[n])}return function(){var n=i.concat([]),r;for(r=0;r<arguments.length;r++){n.push(arguments[r])}return t.apply(e,n)}},getUrlParameter:function(e){var t=o[e];return t?t:null},getUrlProtocol:function(e){var t=e.match(/^([a-z]+:)\/\//i);if(t===null){return window.location.protocol}return t[1].toLowerCase()},createAjaxRequest:function(t){var i;try{i=!!new ActiveXObject("Microsoft.XMLHTTP")}catch(e){i=false}if(i){if(window.XMLHttpRequest){e.createAjaxRequest=function(e){if(e){return new ActiveXObject("Microsoft.XMLHTTP")}return new XMLHttpRequest}}else{e.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}}else if(window.XMLHttpRequest){e.createAjaxRequest=function(){return new XMLHttpRequest}}else{throw new Error("Browser doesn't support XMLHttpRequest.")}return e.createAjaxRequest(t)},makeAjaxRequest:function(t,i,n){var r;var o;var s;var a;if(e.isPlainObject(t)){i=t.success;n=t.error;r=t.withCredentials;o=t.headers;s=t.responseType||null;a=t.postData||null;t=t.url}var l=e.getUrlProtocol(t);var h=e.createAjaxRequest(l==="file:");if(!e.isFunction(i)){throw new Error("makeAjaxRequest requires a success callback")}h.onreadystatechange=function(){if(h.readyState===4){h.onreadystatechange=function(){};if(h.status>=200&&h.status<300||h.status===0&&l!=="http:"&&l!=="https:"){i(h)}else{if(e.isFunction(n)){n(h)}else{e.console.error("AJAX request returned %d: %s",h.status,t)}}}};var u=a?"POST":"GET";try{h.open(u,t,true);if(s){h.responseType=s}if(o){for(var c in o){if(Object.prototype.hasOwnProperty.call(o,c)&&o[c]){h.setRequestHeader(c,o[c])}}}if(r){h.withCredentials=true}h.send(a)}catch(t){e.console.error("%s while making AJAX request: %s",t.name,t.message);h.onreadystatechange=function(){};if(e.isFunction(n)){n(h,t)}}return h},jsonp:function(t){var i,n=t.url,r=document.head||document.getElementsByTagName("head")[0]||document.documentElement,o=t.callbackName||"openseadragon"+e.now(),s=window[o],a="$1"+o+"$2",l=t.param||"callback",h=t.callback;n=n.replace(/(=)\?(&|$)|\?\?/i,a);n+=(/\?/.test(n)?"&":"?")+l+"="+o;window[o]=function(t){if(!s){try{delete window[o]}catch(e){}}else{window[o]=s}if(h&&e.isFunction(h)){h(t)}};i=document.createElement("script");if(undefined!==t.async||false!==t.async){i.async="async"}if(t.scriptCharset){i.charset=t.scriptCharset}i.src=n;i.onload=i.onreadystatechange=function(e,t){if(t||!i.readyState||/loaded|complete/.test(i.readyState)){i.onload=i.onreadystatechange=null;if(r&&i.parentNode){r.removeChild(i)}i=undefined}};r.insertBefore(i,r.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(t){if(window.DOMParser){e.parseXml=function(e){var t=null,i;i=new DOMParser;t=i.parseFromString(e,"text/xml");return t}}else if(window.ActiveXObject){e.parseXml=function(e){var t=null;t=new ActiveXObject("Microsoft.XMLDOM");t.async=false;t.loadXML(e);return t}}else{throw new Error("Browser doesn't support XML DOM.")}return e.parseXml(t)},parseJSON:function(t){e.parseJSON=window.JSON.parse;return e.parseJSON(t)},imageFormatSupported:function(e){e=e?e:"";return!!r[e.toLowerCase()]},setImageFormatsSupported:function(t){e.extend(r,t)}});var n=function(e){};e.console=window.console||{log:n,debug:n,info:n,warn:n,error:n,assert:n};e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:true};var r={bmp:false,jpeg:true,jpg:true,png:true,tif:false,wdp:false},o={};(function(){var t=navigator.appVersion,i=navigator.userAgent,n;switch(navigator.appName){case"Microsoft Internet Explorer":if(!!window.attachEvent&&!!window.ActiveXObject){e.Browser.vendor=e.BROWSERS.IE;e.Browser.version=parseFloat(i.substring(i.indexOf("MSIE")+5,i.indexOf(";",i.indexOf("MSIE"))))}break;case"Netscape":if(window.addEventListener){if(i.indexOf("Edge")>=0){e.Browser.vendor=e.BROWSERS.EDGE;e.Browser.version=parseFloat(i.substring(i.indexOf("Edge")+5))}else if(i.indexOf("Edg")>=0){e.Browser.vendor=e.BROWSERS.CHROMEEDGE;e.Browser.version=parseFloat(i.substring(i.indexOf("Edg")+4))}else if(i.indexOf("Firefox")>=0){e.Browser.vendor=e.BROWSERS.FIREFOX;e.Browser.version=parseFloat(i.substring(i.indexOf("Firefox")+8))}else if(i.indexOf("Safari")>=0){e.Browser.vendor=i.indexOf("Chrome")>=0?e.BROWSERS.CHROME:e.BROWSERS.SAFARI;e.Browser.version=parseFloat(i.substring(i.substring(0,i.indexOf("Safari")).lastIndexOf("/")+1,i.indexOf("Safari")))}else{n=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})");if(n.exec(i)!==null){e.Browser.vendor=e.BROWSERS.IE;e.Browser.version=parseFloat(RegExp.$1)}}}break;case"Opera":e.Browser.vendor=e.BROWSERS.OPERA;e.Browser.version=parseFloat(t);break}var r=window.location.search.substring(1),s=r.split("&"),a,l,h;for(h=0;h<s.length;h++){a=s[h];l=a.indexOf("=");if(l>0){var u=a.substring(0,l),c=a.substring(l+1);try{o[u]=decodeURIComponent(c)}catch(t){e.console.error("Ignoring malformed URL parameter: %s=%s",u,c)}}}e.Browser.alpha=!(e.Browser.vendor===e.BROWSERS.CHROME&&e.Browser.version<2);e.Browser.opacity=true;if(e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<11){e.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")}})();(function(t){var i=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame;var n=t.cancelAnimationFrame||t.mozCancelAnimationFrame||t.webkitCancelAnimationFrame||t.msCancelAnimationFrame;if(i&&n){e.requestAnimationFrame=function(){return i.apply(t,arguments)};e.cancelAnimationFrame=function(){return n.apply(t,arguments)}}else{var r=[],o=[],s=0,a;e.requestAnimationFrame=function(t){r.push([++s,t]);if(!a){a=setInterval((function(){if(r.length){var t=e.now();var i=o;o=r;r=i;while(o.length){o.shift()[1](t)}}else{clearInterval(a);a=undefined}}),1e3/50)}return s};e.cancelAnimationFrame=function(e){var t,i;for(t=0,i=r.length;t<i;t+=1){if(r[t][0]===e){r.splice(t,1);return}}for(t=0,i=o.length;t<i;t+=1){if(o[t][0]===e){o.splice(t,1);return}}}}})(window);function s(e,t){if(t&&e!==document.body){return document.body}else{return e.offsetParent}}})(t);(function(t,i){if(e.exports){e.exports=i()}else{t.OpenSeadragon=i()}})(n,(function(){return t}));(function(e){var t={supportsFullScreen:false,isFullScreen:function(){return false},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""};if(document.exitFullscreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.fullscreenElement};t.requestFullScreen=function(e){return e.requestFullscreen()};t.exitFullScreen=function(){document.exitFullscreen()};t.fullScreenEventName="fullscreenchange";t.fullScreenErrorEventName="fullscreenerror"}else if(document.msExitFullscreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.msFullscreenElement};t.requestFullScreen=function(e){return e.msRequestFullscreen()};t.exitFullScreen=function(){document.msExitFullscreen()};t.fullScreenEventName="MSFullscreenChange";t.fullScreenErrorEventName="MSFullscreenError"}else if(document.webkitExitFullscreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.webkitFullscreenElement};t.requestFullScreen=function(e){return e.webkitRequestFullscreen()};t.exitFullScreen=function(){document.webkitExitFullscreen()};t.fullScreenEventName="webkitfullscreenchange";t.fullScreenErrorEventName="webkitfullscreenerror"}else if(document.webkitCancelFullScreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement};t.requestFullScreen=function(e){return e.webkitRequestFullScreen()};t.exitFullScreen=function(){document.webkitCancelFullScreen()};t.fullScreenEventName="webkitfullscreenchange";t.fullScreenErrorEventName="webkitfullscreenerror"}else if(document.mozCancelFullScreen){t.supportsFullScreen=true;t.getFullScreenElement=function(){return document.mozFullScreenElement};t.requestFullScreen=function(e){return e.mozRequestFullScreen()};t.exitFullScreen=function(){document.mozCancelFullScreen()};t.fullScreenEventName="mozfullscreenchange";t.fullScreenErrorEventName="mozfullscreenerror"}t.isFullScreen=function(){return t.getFullScreenElement()!==null};t.cancelFullScreen=function(){e.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead.");t.exitFullScreen()};e.extend(e,t)})(t);(function(e){e.EventSource=function(){this.events={}};e.EventSource.prototype={addOnceHandler:function(e,t,i,n,r){var o=this;n=n||1;var s=0;var a=function(i){s++;if(s===n){o.removeHandler(e,a)}return t(i)};this.addHandler(e,a,i,r)},addHandler:function(t,i,n,r){var o=this.events[t];if(!o){this.events[t]=o=[]}if(i&&e.isFunction(i)){var s=o.length,a={handler:i,userData:n||null,priority:r||0};o[s]=a;while(s>0&&o[s-1].priority<o[s].priority){o[s]=o[s-1];o[s-1]=a;s--}}},removeHandler:function(t,i){var n=this.events[t],r=[],o;if(!n){return}if(e.isArray(n)){for(o=0;o<n.length;o++){if(n[o].handler!==i){r.push(n[o])}}this.events[t]=r}},numberOfHandlers:function(e){var t=this.events[e];if(!t){return 0}return t.length},removeAllHandlers:function(e){if(e){this.events[e]=[]}else{for(var t in this.events){this.events[t]=[]}}},getHandler:function(e){var t=this.events[e];if(!t||!t.length){return null}t=t.length===1?[t[0]]:Array.apply(null,t);return function(e,i){var n,r=t.length;for(n=0;n<r;n++){if(t[n]){i.eventSource=e;i.userData=t[n].userData;t[n].handler(i)}}}},raiseEvent:function(e,t){var i=this.getHandler(e);if(i){return i(this,t||{})}return undefined}}})(t);(function(e){var t={};e.MouseTracker=function(i){var n=arguments;if(!e.isPlainObject(i)){i={element:n[0],clickTimeThreshold:n[1],clickDistThreshold:n[2]}}this.hash=Math.random();this.element=e.getElement(i.element);this.clickTimeThreshold=i.clickTimeThreshold||e.DEFAULT_SETTINGS.clickTimeThreshold;this.clickDistThreshold=i.clickDistThreshold||e.DEFAULT_SETTINGS.clickDistThreshold;this.dblClickTimeThreshold=i.dblClickTimeThreshold||e.DEFAULT_SETTINGS.dblClickTimeThreshold;this.dblClickDistThreshold=i.dblClickDistThreshold||e.DEFAULT_SETTINGS.dblClickDistThreshold;this.userData=i.userData||null;this.stopDelay=i.stopDelay||50;this.preProcessEventHandler=i.preProcessEventHandler||null;this.contextMenuHandler=i.contextMenuHandler||null;this.enterHandler=i.enterHandler||null;this.leaveHandler=i.leaveHandler||null;this.exitHandler=i.exitHandler||null;this.overHandler=i.overHandler||null;this.outHandler=i.outHandler||null;this.pressHandler=i.pressHandler||null;this.nonPrimaryPressHandler=i.nonPrimaryPressHandler||null;this.releaseHandler=i.releaseHandler||null;this.nonPrimaryReleaseHandler=i.nonPrimaryReleaseHandler||null;this.moveHandler=i.moveHandler||null;this.scrollHandler=i.scrollHandler||null;this.clickHandler=i.clickHandler||null;this.dblClickHandler=i.dblClickHandler||null;this.dragHandler=i.dragHandler||null;this.dragEndHandler=i.dragEndHandler||null;this.pinchHandler=i.pinchHandler||null;this.stopHandler=i.stopHandler||null;this.keyDownHandler=i.keyDownHandler||null;this.keyUpHandler=i.keyUpHandler||null;this.keyHandler=i.keyHandler||null;this.focusHandler=i.focusHandler||null;this.blurHandler=i.blurHandler||null;var r=this;t[this.hash]={click:function(e){m(r,e)},dblclick:function(e){y(r,e)},keydown:function(e){w(r,e)},keyup:function(e){T(r,e)},keypress:function(e){x(r,e)},focus:function(e){S(r,e)},blur:function(e){E(r,e)},contextmenu:function(e){P(r,e)},wheel:function(e){_(r,e)},mousewheel:function(e){R(r,e)},DOMMouseScroll:function(e){R(r,e)},MozMousePixelScroll:function(e){R(r,e)},losecapture:function(e){b(r,e)},mouseenter:function(e){F(r,e)},mouseleave:function(e){M(r,e)},mouseover:function(e){N(r,e)},mouseout:function(e){A(r,e)},mousedown:function(e){W(r,e)},mouseup:function(e){U(r,e)},mousemove:function(e){G(r,e)},touchstart:function(e){D(r,e)},touchend:function(e){I(r,e)},touchmove:function(e){k(r,e)},touchcancel:function(e){O(r,e)},gesturestart:function(e){H(r,e)},gesturechange:function(e){z(r,e)},gotpointercapture:function(e){B(r,e)},lostpointercapture:function(e){L(r,e)},pointerenter:function(e){F(r,e)},pointerleave:function(e){M(r,e)},pointerover:function(e){N(r,e)},pointerout:function(e){A(r,e)},pointerdown:function(e){W(r,e)},pointerup:function(e){U(r,e)},pointermove:function(e){G(r,e)},pointercancel:function(e){X(r,e)},pointerupcaptured:function(e){V(r,e)},pointermovecaptured:function(e){q(r,e)},tracking:false,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:false};this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler);this.hasScrollHandler=!!this.scrollHandler;if(e.MouseTracker.havePointerEvents){e.setElementPointerEvents(this.element,"auto")}if(this.exitHandler){e.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead.")}if(!i.startDisabled){this.setTracking(true)}};e.MouseTracker.prototype={destroy:function(){s(this);this.element=null;t[this.hash]=null;delete t[this.hash]},isTracking:function(){return t[this.hash].tracking},setTracking:function(e){if(e){o(this)}else{s(this)}return this},getActivePointersListByType:function(i){var n=t[this.hash],r,o=n.activePointersLists.length,s;for(r=0;r<o;r++){if(n.activePointersLists[r].type===i){return n.activePointersLists[r]}}s=new e.MouseTracker.GesturePointList(i);n.activePointersLists.push(s);return s},getActivePointerCount:function(){var e=t[this.hash],i,n=e.activePointersLists.length,r=0;for(i=0;i<n;i++){r+=e.activePointersLists[i].getLength()}return r},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};var i=function(){try{return window.self!==window.top}catch(e){return true}}();function n(e){try{return e.addEventListener&&e.removeEventListener}catch(e){return false}}e.MouseTracker.gesturePointVelocityTracker=function(){var t=[],i=0,n=0;var r=function(e,t){return e.hash.toString()+t.type+t.id.toString()};var o=function(){var i,r=t.length,o,s,a=e.now(),l,h,u;l=a-n;n=a;for(i=0;i<r;i++){o=t[i];s=o.gPoint;s.direction=Math.atan2(s.currentPos.y-o.lastPos.y,s.currentPos.x-o.lastPos.x);h=o.lastPos.distanceTo(s.currentPos);o.lastPos=s.currentPos;u=1e3*h/(l+1);s.speed=.75*u+.25*s.speed}};var s=function(s,a){var l=r(s,a);t.push({guid:l,gPoint:a,lastPos:a.currentPos});if(t.length===1){n=e.now();i=window.setInterval(o,50)}};var a=function(e,n){var o=r(e,n),s,a=t.length;for(s=0;s<a;s++){if(t[s].guid===o){t.splice(s,1);a--;if(a===0){window.clearInterval(i)}break}}};return{addPoint:s,removePoint:a}}();e.MouseTracker.captureElement=document;e.MouseTracker.wheelEventName=e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version>8||"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==undefined?"mousewheel":"DOMMouseScroll";e.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",e.MouseTracker.wheelEventName];if(e.MouseTracker.wheelEventName==="DOMMouseScroll"){e.MouseTracker.subscribeEvents.push("MozMousePixelScroll")}if(window.PointerEvent){e.MouseTracker.havePointerEvents=true;e.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel");e.MouseTracker.havePointerCapture=function(){var t=document.createElement("div");return e.isFunction(t.setPointerCapture)&&e.isFunction(t.releasePointerCapture)}();if(e.MouseTracker.havePointerCapture){e.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")}}else{e.MouseTracker.havePointerEvents=false;e.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove");e.MouseTracker.mousePointerId="legacy-mouse";e.MouseTracker.havePointerCapture=function(){var t=document.createElement("div");return e.isFunction(t.setCapture)&&e.isFunction(t.releaseCapture)}();if(e.MouseTracker.havePointerCapture){e.MouseTracker.subscribeEvents.push("losecapture")}if("ontouchstart"in window){e.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel")}if("ongesturestart"in window){e.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")}}e.MouseTracker.GesturePointList=function(e){this._gPoints=[];this.type=e;this.buttons=0;this.contacts=0;this.clicks=0;this.captureCount=0};e.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(e){return this._gPoints.push(e)},removeById:function(e){var t,i=this._gPoints.length;for(t=0;t<i;t++){if(this._gPoints[t].id===e){this._gPoints.splice(t,1);break}}return this._gPoints.length},getByIndex:function(e){if(e<this._gPoints.length){return this._gPoints[e]}return null},getById:function(e){var t,i=this._gPoints.length;for(t=0;t<i;t++){if(this._gPoints[t].id===e){return this._gPoints[t]}}return null},getPrimary:function(e){var t,i=this._gPoints.length;for(t=0;t<i;t++){if(this._gPoints[t].isPrimary){return this._gPoints[t]}}return null},addContact:function(){++this.contacts;if(this.contacts>1&&(this.type==="mouse"||this.type==="pen")){e.console.warn("GesturePointList.addContact() Implausible contacts value");this.contacts=1}},removeContact:function(){--this.contacts;if(this.contacts<0){this.contacts=0}}};function r(e){var i=t[e.hash],n,r,o,s,a,l=i.activePointersLists.length;for(n=0;n<l;n++){o=i.activePointersLists[n];if(o.getLength()>0){a=[];s=o.asArray();for(r=0;r<s.length;r++){a.push(s[r])}for(r=0;r<a.length;r++){K(e,o,a[r])}}}for(n=0;n<l;n++){i.activePointersLists.pop()}i.sentDragEvent=false}function o(i){var n=t[i.hash],o,s;if(!n.tracking){for(s=0;s<e.MouseTracker.subscribeEvents.length;s++){o=e.MouseTracker.subscribeEvents[s];e.addEvent(i.element,o,n[o],o===e.MouseTracker.wheelEventName?{passive:false,capture:false}:false)}r(i);n.tracking=true}}function s(i){var n=t[i.hash],o,s;if(n.tracking){for(s=0;s<e.MouseTracker.subscribeEvents.length;s++){o=e.MouseTracker.subscribeEvents[s];e.removeEvent(i.element,o,n[o],false)}r(i);n.tracking=false}}function a(e,i){var n=t[e.hash];if(i==="pointerevent"){return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured}}else if(i==="mouse"){return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured}}else if(i==="touch"){return{upName:"touchend",upHandler:n.touchendcaptured,moveName:"touchmove",moveHandler:n.touchmovecaptured}}else{throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}}function l(t,r){var o;if(e.MouseTracker.havePointerCapture){if(e.MouseTracker.havePointerEvents){try{t.element.setPointerCapture(r.id)}catch(t){e.console.warn("setPointerCapture() called on invalid pointer ID");return}}else{t.element.setCapture(true)}}else{o=a(t,e.MouseTracker.havePointerEvents?"pointerevent":r.type);if(i&&n(window.top)){e.addEvent(window.top,o.upName,o.upHandler,true)}e.addEvent(e.MouseTracker.captureElement,o.upName,o.upHandler,true);e.addEvent(e.MouseTracker.captureElement,o.moveName,o.moveHandler,true)}J(t,r,true)}function h(t,r){var o;var s;var l;if(e.MouseTracker.havePointerCapture){if(e.MouseTracker.havePointerEvents){s=t.getActivePointersListByType(r.type);l=s.getById(r.id);if(!l||!l.captured){return}try{t.element.releasePointerCapture(r.id)}catch(e){}}else{t.element.releaseCapture()}}else{o=a(t,e.MouseTracker.havePointerEvents?"pointerevent":r.type);if(i&&n(window.top)){e.removeEvent(window.top,o.upName,o.upHandler,true)}e.removeEvent(e.MouseTracker.captureElement,o.moveName,o.moveHandler,true);e.removeEvent(e.MouseTracker.captureElement,o.upName,o.upHandler,true)}J(t,r,false)}function u(t){return e.MouseTracker.havePointerEvents?t.pointerId:e.MouseTracker.mousePointerId}function c(t){if(e.MouseTracker.havePointerEvents){return t.pointerType||(e.Browser.vendor===e.BROWSERS.IE?"mouse":"")}else{return"mouse"}}function d(t){return e.MouseTracker.havePointerEvents?t.isPrimary:true}function p(t){return e.getMousePosition(t)}function f(e,t){return g(p(e),t)}function g(t,i){var n=e.getElementOffset(i);return t.minus(n)}function v(t,i){return new e.Point((t.x+i.x)/2,(t.y+i.y)/2)}function m(t,i){var n={originalEvent:i,eventType:"click",pointerType:"mouse",isEmulated:false};$(t,n);if(n.preventDefault&&!n.defaultPrevented){e.cancelEvent(i)}if(n.stopPropagation){e.stopEvent(i)}}function y(t,i){var n={originalEvent:i,eventType:"dblclick",pointerType:"mouse",isEmulated:false};$(t,n);if(n.preventDefault&&!n.defaultPrevented){e.cancelEvent(i)}if(n.stopPropagation){e.stopEvent(i)}}function w(t,i){var n=null;var r={originalEvent:i,eventType:"keydown",pointerType:"",isEmulated:false};$(t,r);if(t.keyDownHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.keyDownHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function T(t,i){var n=null;var r={originalEvent:i,eventType:"keyup",pointerType:"",isEmulated:false};$(t,r);if(t.keyUpHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.keyUpHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function x(t,i){var n=null;var r={originalEvent:i,eventType:"keypress",pointerType:"",isEmulated:false};$(t,r);if(t.keyHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.keyHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function S(e,t){var i={originalEvent:t,eventType:"focus",pointerType:"",isEmulated:false};$(e,i);if(e.focusHandler&&!i.preventGesture){e.focusHandler({eventSource:e,originalEvent:t,userData:e.userData})}}function E(e,t){var i={originalEvent:t,eventType:"blur",pointerType:"",isEmulated:false};$(e,i);if(e.blurHandler&&!i.preventGesture){e.blurHandler({eventSource:e,originalEvent:t,userData:e.userData})}}function P(t,i){var n=null;var r={originalEvent:i,eventType:"contextmenu",pointerType:"mouse",isEmulated:false};$(t,r);if(t.contextMenuHandler&&!r.preventGesture&&!r.defaultPrevented){n={eventSource:t,position:g(p(i),t.element),originalEvent:r.originalEvent,preventDefault:r.preventDefault||r.defaultPrevented,userData:t.userData};t.contextMenuHandler(n)}if(n&&n.preventDefault||r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function _(e,t){C(e,t,t)}function R(t,i){var n={target:i.target||i.srcElement,type:"wheel",shiftKey:i.shiftKey||false,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX?i.pageX:i.clientX,pageY:i.pageY?i.pageY:i.clientY,deltaMode:i.type==="MozMousePixelScroll"?0:1,deltaX:0,deltaZ:0};if(e.MouseTracker.wheelEventName==="mousewheel"){n.deltaY=-i.wheelDelta/e.DEFAULT_SETTINGS.pixelsPerWheelLine}else{n.deltaY=i.detail}C(t,n,i)}function C(t,i,n){var r=0,o;var s=null;r=i.deltaY<0?1:-1;o={originalEvent:i,eventType:"wheel",pointerType:"mouse",isEmulated:i!==n};$(t,o);if(t.scrollHandler&&!o.preventGesture&&!o.defaultPrevented){s={eventSource:t,pointerType:"mouse",position:f(i,t.element),scroll:r,shift:i.shiftKey,isTouchEvent:false,originalEvent:n,preventDefault:o.preventDefault||o.defaultPrevented,userData:t.userData};t.scrollHandler(s)}if(o.stopPropagation){e.stopEvent(n)}if(s&&s.preventDefault||o.preventDefault&&!o.defaultPrevented){e.cancelEvent(n)}}function b(t,i){var n={id:e.MouseTracker.mousePointerId,type:"mouse"};var r={originalEvent:i,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:false};$(t,r);if(i.target===t.element){J(t,n,false)}if(r.stopPropagation){e.stopEvent(i)}}function D(t,i){var n,r,o=i.changedTouches.length,s,a=t.getActivePointersListByType("touch");n=e.now();if(a.getLength()>i.touches.length-o){e.console.warn("Tracked touch contact count doesn't match event.touches.length")}var l={originalEvent:i,eventType:"pointerdown",pointerType:"touch",isEmulated:false};$(t,l);for(r=0;r<o;r++){s={id:i.changedTouches[r].identifier,type:"touch",isPrimary:a.getLength()===0,currentPos:p(i.changedTouches[r]),currentTime:n};ee(t,l,s);re(t,l,s,0);J(t,s,true)}if(l.preventDefault&&!l.defaultPrevented){e.cancelEvent(i)}if(l.stopPropagation){e.stopEvent(i)}}function I(t,i){var n,r,o=i.changedTouches.length,s;n=e.now();var a={originalEvent:i,eventType:"pointerup",pointerType:"touch",isEmulated:false};$(t,a);for(r=0;r<o;r++){s={id:i.changedTouches[r].identifier,type:"touch",currentPos:p(i.changedTouches[r]),currentTime:n};oe(t,a,s,0);J(t,s,false);te(t,a,s)}if(a.preventDefault&&!a.defaultPrevented){e.cancelEvent(i)}if(a.stopPropagation){e.stopEvent(i)}}function k(t,i){var n,r,o=i.changedTouches.length,s;n=e.now();var a={originalEvent:i,eventType:"pointermove",pointerType:"touch",isEmulated:false};$(t,a);for(r=0;r<o;r++){s={id:i.changedTouches[r].identifier,type:"touch",currentPos:p(i.changedTouches[r]),currentTime:n};se(t,a,s)}if(a.preventDefault&&!a.defaultPrevented){e.cancelEvent(i)}if(a.stopPropagation){e.stopEvent(i)}}function O(t,i){var n=i.changedTouches.length,r,o;var s={originalEvent:i,eventType:"pointercancel",pointerType:"touch",isEmulated:false};$(t,s);for(r=0;r<n;r++){o={id:i.changedTouches[r].identifier,type:"touch"};ae(t,s,o)}if(s.stopPropagation){e.stopEvent(i)}}function H(t,i){if(!e.eventIsCanceled(i)){i.preventDefault()}return false}function z(t,i){if(!e.eventIsCanceled(i)){i.preventDefault()}return false}function B(t,i){var n={originalEvent:i,eventType:"gotpointercapture",pointerType:c(i),isEmulated:false};$(t,n);if(i.target===t.element){J(t,{id:i.pointerId,type:c(i)},true)}if(n.stopPropagation){e.stopEvent(i)}}function L(t,i){var n={originalEvent:i,eventType:"lostpointercapture",pointerType:c(i),isEmulated:false};$(t,n);if(i.target===t.element){J(t,{id:i.pointerId,type:c(i)},false)}if(n.stopPropagation){e.stopEvent(i)}}function F(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerenter",pointerType:n.type,isEmulated:false};$(t,r);ee(t,r,n)}function M(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerleave",pointerType:n.type,isEmulated:false};$(t,r);te(t,r,n)}function N(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerover",pointerType:n.type,isEmulated:false};$(t,r);ie(t,r,n);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function A(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerout",pointerType:n.type,isEmulated:false};$(t,r);ne(t,r,n);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function W(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r=e.MouseTracker.havePointerEvents&&n.type==="touch"&&e.Browser.vendor!==e.BROWSERS.IE;var o={originalEvent:i,eventType:"pointerdown",pointerType:n.type,isEmulated:false};$(t,o);re(t,o,n,i.button);if(o.preventDefault&&!o.defaultPrevented){e.cancelEvent(i)}if(o.stopPropagation){e.stopEvent(i)}if(o.shouldCapture){if(r){J(t,n,true)}else{l(t,n)}}}function U(e,t){j(e,t)}function V(t,i){var n=t.getActivePointersListByType(c(i));if(n.getById(i.pointerId)){j(t,i)}e.stopEvent(i)}function j(t,i){var n;n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointerup",pointerType:n.type,isEmulated:false};$(t,r);oe(t,r,n,i.button);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}if(r.shouldReleaseCapture){if(i.target===t.element){h(t,n)}else{J(t,n,false)}}}function G(e,t){Z(e,t)}function q(t,i){var n=t.getActivePointersListByType(c(i));if(n.getById(i.pointerId)){Z(t,i)}e.stopEvent(i)}function Z(t,i){var n={id:u(i),type:c(i),isPrimary:d(i),currentPos:p(i),currentTime:e.now()};var r={originalEvent:i,eventType:"pointermove",pointerType:n.type,isEmulated:false};$(t,r);se(t,r,n);if(r.preventDefault&&!r.defaultPrevented){e.cancelEvent(i)}if(r.stopPropagation){e.stopEvent(i)}}function X(t,i){var n={id:i.pointerId,type:c(i)};var r={originalEvent:i,eventType:"pointercancel",pointerType:n.type,isEmulated:false};$(t,r);ae(t,r,n);if(r.stopPropagation){e.stopEvent(i)}}function Y(e,t){t.speed=0;t.direction=0;t.contactPos=t.currentPos;t.contactTime=t.currentTime;t.lastPos=t.currentPos;t.lastTime=t.currentTime;return e.add(t)}function K(t,i,n){var r;var o=i.getById(n.id);if(o){if(o.captured){e.console.warn("stopTrackingPointer() called on captured pointer");h(t,o)}i.removeContact();r=i.removeById(n.id)}else{r=i.getLength()}return r}function Q(e,t){switch(t.eventType){case"pointermove":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasGestureHandlers;t.stopPropagation=false;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=false;t.stopPropagation=false;break;case"pointerdown":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasGestureHandlers;t.stopPropagation=false;break;case"pointerup":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasGestureHandlers;t.stopPropagation=false;break;case"wheel":t.isStoppable=true;t.isCancelable=true;t.preventDefault=false;t.preventGesture=!e.hasScrollHandler;t.stopPropagation=false;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":t.isStoppable=true;t.isCancelable=false;t.preventDefault=false;t.preventGesture=false;t.stopPropagation=false;break;case"click":t.isStoppable=true;t.isCancelable=true;t.preventDefault=!!e.clickHandler;t.preventGesture=false;t.stopPropagation=false;break;case"dblclick":t.isStoppable=true;t.isCancelable=true;t.preventDefault=!!e.dblClickHandler;t.preventGesture=false;t.stopPropagation=false;break;case"focus":case"blur":case"pointerenter":case"pointerleave":default:t.isStoppable=false;t.isCancelable=false;t.preventDefault=false;t.preventGesture=false;t.stopPropagation=false;break}}function $(t,i){i.eventSource=t;i.eventPhase=i.originalEvent?typeof i.originalEvent.eventPhase!=="undefined"?i.originalEvent.eventPhase:0:0;i.defaultPrevented=e.eventIsCanceled(i.originalEvent);i.shouldCapture=false;i.shouldReleaseCapture=false;i.userData=t.userData;Q(t,i);if(t.preProcessEventHandler){t.preProcessEventHandler(i)}}function J(t,i,n){var r=t.getActivePointersListByType(i.type);var o=r.getById(i.id);if(o){if(n&&!o.captured){o.captured=true;r.captureCount++}else if(!n&&o.captured){o.captured=false;r.captureCount--;if(r.captureCount<0){r.captureCount=0;e.console.warn("updatePointerCaptured() - pointsList.captureCount went negative")}}}else{e.console.warn("updatePointerCaptured() called on untracked pointer")}}function ee(e,t,i){var n=e.getActivePointersListByType(i.type),r;r=n.getById(i.id);if(r){r.insideElement=true;r.lastPos=r.currentPos;r.lastTime=r.currentTime;r.currentPos=i.currentPos;r.currentTime=i.currentTime;i=r}else{i.captured=false;i.insideElementPressed=false;i.insideElement=true;Y(n,i)}if(e.enterHandler){e.enterHandler({eventSource:e,pointerType:i.type,position:g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData})}}function te(e,t,i){var n=e.getActivePointersListByType(i.type),r,o;r=n.getById(i.id);if(r){if(r.captured){r.insideElement=false;r.lastPos=r.currentPos;r.lastTime=r.currentTime;r.currentPos=i.currentPos;r.currentTime=i.currentTime}else{K(e,n,r)}i=r}else{i.captured=false;i.insideElementPressed=false}if(e.leaveHandler||e.exitHandler){o={eventSource:e,pointerType:i.type,position:i.currentPos&&g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData};if(e.leaveHandler){e.leaveHandler(o)}if(e.exitHandler){e.exitHandler(o)}}}function ie(e,t,i){var n,r;n=e.getActivePointersListByType(i.type);r=n.getById(i.id);if(r){i=r}else{i.captured=false;i.insideElementPressed=false}if(e.overHandler){e.overHandler({eventSource:e,pointerType:i.type,position:g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData})}}function ne(e,t,i){var n,r;n=e.getActivePointersListByType(i.type);r=n.getById(i.id);if(r){i=r}else{i.captured=false;i.insideElementPressed=false}if(e.outHandler){e.outHandler({eventSource:e,pointerType:i.type,position:i.currentPos&&g(i.currentPos,e.element),buttons:n.buttons,pointers:e.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:n.buttons!==0,isTouchEvent:i.type==="touch",originalEvent:t.originalEvent,userData:e.userData})}}function re(i,n,r,o){var s=t[i.hash],a=i.getActivePointersListByType(r.type),l;if(typeof n.originalEvent.buttons!=="undefined"){a.buttons=n.originalEvent.buttons}else{if(o===0){a.buttons|=1}else if(o===1){a.buttons|=4}else if(o===2){a.buttons|=2}else if(o===3){a.buttons|=8}else if(o===4){a.buttons|=16}else if(o===5){a.buttons|=32}}if(o!==0){n.shouldCapture=false;n.shouldReleaseCapture=false;if(i.nonPrimaryPressHandler&&!n.preventGesture&&!n.defaultPrevented){n.preventDefault=true;i.nonPrimaryPressHandler({eventSource:i,pointerType:r.type,position:g(r.currentPos,i.element),button:o,buttons:a.buttons,isTouchEvent:r.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}return}l=a.getById(r.id);if(l){l.insideElementPressed=true;l.insideElement=true;l.originalTarget=n.originalEvent.target;l.contactPos=r.currentPos;l.contactTime=r.currentTime;l.lastPos=l.currentPos;l.lastTime=l.currentTime;l.currentPos=r.currentPos;l.currentTime=r.currentTime;r=l}else{r.captured=false;r.insideElementPressed=true;r.insideElement=true;r.originalTarget=n.originalEvent.target;Y(a,r)}a.addContact();if(!n.preventGesture&&!n.defaultPrevented){n.shouldCapture=true;n.shouldReleaseCapture=false;n.preventDefault=true;if(i.dragHandler||i.dragEndHandler||i.pinchHandler){e.MouseTracker.gesturePointVelocityTracker.addPoint(i,r)}if(a.contacts===1){if(i.pressHandler&&!n.preventGesture){i.pressHandler({eventSource:i,pointerType:r.type,position:g(r.contactPos,i.element),buttons:a.buttons,isTouchEvent:r.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}}else if(a.contacts===2){if(i.pinchHandler&&r.type==="touch"){s.pinchGPoints=a.asArray();s.lastPinchDist=s.currentPinchDist=s.pinchGPoints[0].currentPos.distanceTo(s.pinchGPoints[1].currentPos);s.lastPinchCenter=s.currentPinchCenter=v(s.pinchGPoints[0].currentPos,s.pinchGPoints[1].currentPos)}}}else{n.shouldCapture=false;n.shouldReleaseCapture=false}}function oe(i,n,r,o){var s=t[i.hash],a=i.getActivePointersListByType(r.type),l,h,u,c=false,d;if(typeof n.originalEvent.buttons!=="undefined"){a.buttons=n.originalEvent.buttons}else{if(o===0){a.buttons^=~1}else if(o===1){a.buttons^=~4}else if(o===2){a.buttons^=~2}else if(o===3){a.buttons^=~8}else if(o===4){a.buttons^=~16}else if(o===5){a.buttons^=~32}}n.shouldCapture=false;if(o!==0){n.shouldReleaseCapture=false;if(i.nonPrimaryReleaseHandler&&!n.preventGesture&&!n.defaultPrevented){n.preventDefault=true;i.nonPrimaryReleaseHandler({eventSource:i,pointerType:r.type,position:g(r.currentPos,i.element),button:o,buttons:a.buttons,isTouchEvent:r.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}return}u=a.getById(r.id);if(u){a.removeContact();if(u.captured){c=true}u.lastPos=u.currentPos;u.lastTime=u.currentTime;u.currentPos=r.currentPos;u.currentTime=r.currentTime;if(!u.insideElement){K(i,a,u)}l=u.currentPos;h=u.currentTime}else{r.captured=false;r.insideElementPressed=false;r.insideElement=true;Y(a,r);u=r}if(!n.preventGesture&&!n.defaultPrevented){if(c){n.shouldReleaseCapture=true;n.preventDefault=true;if(i.dragHandler||i.dragEndHandler||i.pinchHandler){e.MouseTracker.gesturePointVelocityTracker.removePoint(i,u)}if(a.contacts===0){if(i.releaseHandler&&l){i.releaseHandler({eventSource:i,pointerType:u.type,position:g(l,i.element),buttons:a.buttons,insideElementPressed:u.insideElementPressed,insideElementReleased:u.insideElement,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}if(i.dragEndHandler&&s.sentDragEvent){i.dragEndHandler({eventSource:i,pointerType:u.type,position:g(u.currentPos,i.element),speed:u.speed,direction:u.direction,shift:n.originalEvent.shiftKey,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}s.sentDragEvent=false;if((i.clickHandler||i.dblClickHandler)&&u.insideElement){d=h-u.contactTime<=i.clickTimeThreshold&&u.contactPos.distanceTo(l)<=i.clickDistThreshold;if(i.clickHandler){i.clickHandler({eventSource:i,pointerType:u.type,position:g(u.currentPos,i.element),quick:d,shift:n.originalEvent.shiftKey,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,originalTarget:u.originalTarget,userData:i.userData})}if(i.dblClickHandler&&d){a.clicks++;if(a.clicks===1){s.lastClickPos=l;s.dblClickTimeOut=setTimeout((function(){a.clicks=0}),i.dblClickTimeThreshold)}else if(a.clicks===2){clearTimeout(s.dblClickTimeOut);a.clicks=0;if(s.lastClickPos.distanceTo(l)<=i.dblClickDistThreshold){i.dblClickHandler({eventSource:i,pointerType:u.type,position:g(u.currentPos,i.element),shift:n.originalEvent.shiftKey,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData})}s.lastClickPos=null}}}}else if(a.contacts===2){if(i.pinchHandler&&u.type==="touch"){s.pinchGPoints=a.asArray();s.lastPinchDist=s.currentPinchDist=s.pinchGPoints[0].currentPos.distanceTo(s.pinchGPoints[1].currentPos);s.lastPinchCenter=s.currentPinchCenter=v(s.pinchGPoints[0].currentPos,s.pinchGPoints[1].currentPos)}}}else{n.shouldReleaseCapture=false;if(i.releaseHandler&&l){i.releaseHandler({eventSource:i,pointerType:u.type,position:g(l,i.element),buttons:a.buttons,insideElementPressed:u.insideElementPressed,insideElementReleased:u.insideElement,isTouchEvent:u.type==="touch",originalEvent:n.originalEvent,userData:i.userData});n.preventDefault=true}}}}function se(e,i,n){var r=t[e.hash],o=e.getActivePointersListByType(n.type),s,a,l;if(typeof i.originalEvent.buttons!=="undefined"){o.buttons=i.originalEvent.buttons}s=o.getById(n.id);if(s){s.lastPos=s.currentPos;s.lastTime=s.currentTime;s.currentPos=n.currentPos;s.currentTime=n.currentTime}else{return}i.shouldCapture=false;i.shouldReleaseCapture=false;if(e.stopHandler&&n.type==="mouse"){clearTimeout(e.stopTimeOut);e.stopTimeOut=setTimeout((function(){le(e,i.originalEvent,n.type)}),e.stopDelay)}if(o.contacts===0){if(e.moveHandler){e.moveHandler({eventSource:e,pointerType:n.type,position:g(n.currentPos,e.element),buttons:o.buttons,isTouchEvent:n.type==="touch",originalEvent:i.originalEvent,userData:e.userData})}}else if(o.contacts===1){if(e.moveHandler){s=o.asArray()[0];e.moveHandler({eventSource:e,pointerType:s.type,position:g(s.currentPos,e.element),buttons:o.buttons,isTouchEvent:s.type==="touch",originalEvent:i.originalEvent,userData:e.userData})}if(e.dragHandler&&!i.preventGesture&&!i.defaultPrevented){s=o.asArray()[0];l=s.currentPos.minus(s.lastPos);e.dragHandler({eventSource:e,pointerType:s.type,position:g(s.currentPos,e.element),buttons:o.buttons,delta:l,speed:s.speed,direction:s.direction,shift:i.originalEvent.shiftKey,isTouchEvent:s.type==="touch",originalEvent:i.originalEvent,userData:e.userData});i.preventDefault=true;r.sentDragEvent=true}}else if(o.contacts===2){if(e.moveHandler){a=o.asArray();e.moveHandler({eventSource:e,pointerType:a[0].type,position:g(v(a[0].currentPos,a[1].currentPos),e.element),buttons:o.buttons,isTouchEvent:a[0].type==="touch",originalEvent:i.originalEvent,userData:e.userData})}if(e.pinchHandler&&n.type==="touch"&&!i.preventGesture&&!i.defaultPrevented){l=r.pinchGPoints[0].currentPos.distanceTo(r.pinchGPoints[1].currentPos);if(l!==r.currentPinchDist){r.lastPinchDist=r.currentPinchDist;r.currentPinchDist=l;r.lastPinchCenter=r.currentPinchCenter;r.currentPinchCenter=v(r.pinchGPoints[0].currentPos,r.pinchGPoints[1].currentPos);e.pinchHandler({eventSource:e,pointerType:"touch",gesturePoints:r.pinchGPoints,lastCenter:g(r.lastPinchCenter,e.element),center:g(r.currentPinchCenter,e.element),lastDistance:r.lastPinchDist,distance:r.currentPinchDist,shift:i.originalEvent.shiftKey,originalEvent:i.originalEvent,userData:e.userData});i.preventDefault=true}}}}function ae(e,t,i){var n=e.getActivePointersListByType(i.type),r;r=n.getById(i.id);if(r){K(e,n,r)}}function le(e,t,i){if(e.stopHandler){e.stopHandler({eventSource:e,pointerType:i,position:f(t,e.element),buttons:e.getActivePointersListByType(i).buttons,isTouchEvent:i==="touch",originalEvent:t,userData:e.userData})}}})(t);(function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5};e.Control=function(t,i,n){var r=t.parentNode;if(typeof i==="number"){e.console.error("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");i={anchor:i}}i.attachToViewer=typeof i.attachToViewer==="undefined"?true:i.attachToViewer;this.autoFade=typeof i.autoFade==="undefined"?true:i.autoFade;this.element=t;this.anchor=i.anchor;this.container=n;if(this.anchor===e.ControlAnchor.ABSOLUTE){this.wrapper=e.makeNeutralElement("div");this.wrapper.style.position="absolute";this.wrapper.style.top=typeof i.top==="number"?i.top+"px":i.top;this.wrapper.style.left=typeof i.left==="number"?i.left+"px":i.left;this.wrapper.style.height=typeof i.height==="number"?i.height+"px":i.height;this.wrapper.style.width=typeof i.width==="number"?i.width+"px":i.width;this.wrapper.style.margin="0px";this.wrapper.style.padding="0px";this.element.style.position="relative";this.element.style.top="0px";this.element.style.left="0px";this.element.style.height="100%";this.element.style.width="100%"}else{this.wrapper=e.makeNeutralElement("div");this.wrapper.style.display="inline-block";if(this.anchor===e.ControlAnchor.NONE){this.wrapper.style.width=this.wrapper.style.height="100%"}}this.wrapper.appendChild(this.element);if(i.attachToViewer){if(this.anchor===e.ControlAnchor.TOP_RIGHT||this.anchor===e.ControlAnchor.BOTTOM_RIGHT){this.container.insertBefore(this.wrapper,this.container.firstChild)}else{this.container.appendChild(this.wrapper)}}else{r.appendChild(this.wrapper)}};e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element);if(this.anchor!==e.ControlAnchor.NONE){this.container.removeChild(this.wrapper)}},isVisible:function(){return this.wrapper.style.display!=="none"},setVisible:function(t){this.wrapper.style.display=t?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(t){if(this.element[e.SIGNAL]&&e.Browser.vendor===e.BROWSERS.IE){e.setElementOpacity(this.element,t,true)}else{e.setElementOpacity(this.wrapper,t,true)}}}})(t);(function(e){e.ControlDock=function(t){var i=["topleft","topright","bottomright","bottomleft"],n,r;e.extend(true,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},t);this.container.onsubmit=function(){return false};if(this.element){this.element=e.getElement(this.element);this.element.appendChild(this.container);this.element.style.position="relative";this.container.style.width="100%";this.container.style.height="100%"}for(r=0;r<i.length;r++){n=i[r];this.controls[n]=e.makeNeutralElement("div");this.controls[n].style.position="absolute";if(n.match("left")){this.controls[n].style.left="0px"}if(n.match("right")){this.controls[n].style.right="0px"}if(n.match("top")){this.controls[n].style.top="0px"}if(n.match("bottom")){this.controls[n].style.bottom="0px"}}this.container.appendChild(this.controls.topleft);this.container.appendChild(this.controls.topright);this.container.appendChild(this.controls.bottomright);this.container.appendChild(this.controls.bottomleft)};e.ControlDock.prototype={addControl:function(i,n){i=e.getElement(i);var r=null;if(t(this,i)>=0){return}switch(n.anchor){case e.ControlAnchor.TOP_RIGHT:r=this.controls.topright;i.style.position="relative";i.style.paddingRight="0px";i.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:r=this.controls.bottomright;i.style.position="relative";i.style.paddingRight="0px";i.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:r=this.controls.bottomleft;i.style.position="relative";i.style.paddingLeft="0px";i.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:r=this.controls.topleft;i.style.position="relative";i.style.paddingLeft="0px";i.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:r=this.container;i.style.margin="0px";i.style.padding="0px";break;default:case e.ControlAnchor.NONE:r=this.container;i.style.margin="0px";i.style.padding="0px";break}this.controls.push(new e.Control(i,n,r));i.style.display="inline-block"},removeControl:function(i){i=e.getElement(i);var n=t(this,i);if(n>=0){this.controls[n].destroy();this.controls.splice(n,1)}return this},clearControls:function(){while(this.controls.length>0){this.controls.pop().destroy()}return this},areControlsEnabled:function(){var e;for(e=this.controls.length-1;e>=0;e--){if(this.controls[e].isVisible()){return true}}return false},setControlsEnabled:function(e){var t;for(t=this.controls.length-1;t>=0;t--){this.controls[t].setVisible(e)}return this}};function t(e,t){var i=e.controls,n;for(n=i.length-1;n>=0;n--){if(i[n].element===t){return n}}return-1}})(t);(function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:false,isVerticallyCentered:true,isBottom:false},1:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:true,isVerticallyCentered:false,isBottom:false},2:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:true,isVerticallyCentered:false,isBottom:false},3:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:true,isVerticallyCentered:false,isBottom:false},4:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:false,isVerticallyCentered:true,isBottom:false},5:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:false,isVerticallyCentered:false,isBottom:true},6:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:false,isVerticallyCentered:false,isBottom:true},7:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:false,isVerticallyCentered:false,isBottom:true},8:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:false,isVerticallyCentered:true,isBottom:false}}})})(t);(function(e){var t={};var i=1;e.Viewer=function(r){var o=arguments,s=this,l;if(!e.isPlainObject(r)){r={id:o[0],xmlPath:o.length>1?o[1]:undefined,prefixUrl:o.length>2?o[2]:undefined,controls:o.length>3?o[3]:undefined,overlays:o.length>4?o[4]:undefined}}if(r.config){e.extend(true,r,r.config);delete r.config}e.extend(true,this,{id:r.id,hash:r.hash||i++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttonGroup:null,profiler:null},e.DEFAULT_SETTINGS,r);if(typeof this.hash==="undefined"){throw new Error("A hash must be defined, either by specifying options.id or options.hash.")}if(typeof t[this.hash]!=="undefined"){e.console.warn("Hash "+this.hash+" has already been used.")}t[this.hash]={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:false,forceRedraw:false,needsResize:false,forceResize:false,mouseInside:false,group:null,zooming:false,zoomFactor:null,lastZoomTime:null,fullPage:false,onfullscreenchange:null,lastClickTime:null,draggingToZoom:false};this._sequenceIndex=0;this._firstOpen=true;this._updateRequestId=null;this._loadQueue=[];this.currentOverlays=[];this._updatePixelDensityRatioBind=null;this._lastScrollTime=e.now();e.EventSource.call(this);this.addHandler("open-failed",(function(t){var i=e.getString("Errors.OpenFailed",t.eventSource,t.message);s._showMessage(i)}));e.ControlDock.call(this,r);if(this.xmlPath){this.tileSources=[this.xmlPath]}this.element=this.element||document.getElementById(this.id);this.canvas=e.makeNeutralElement("div");this.canvas.className="openseadragon-canvas";(function(e){e.width="100%";e.height="100%";e.overflow="hidden";e.position="absolute";e.top="0px";e.left="0px"})(this.canvas.style);e.setElementTouchActionNone(this.canvas);if(r.tabIndex!==""){this.canvas.tabIndex=r.tabIndex===undefined?0:r.tabIndex}this.container.className="openseadragon-container";(function(e){e.width="100%";e.height="100%";e.position="relative";e.overflow="hidden";e.left="0px";e.top="0px";e.textAlign="left"})(this.container.style);e.setElementTouchActionNone(this.container);this.container.insertBefore(this.canvas,this.container.firstChild);this.element.appendChild(this.container);this.bodyWidth=document.body.style.width;this.bodyHeight=document.body.style.height;this.bodyOverflow=document.body.style.overflow;this.docOverflow=document.documentElement.style.overflow;this.innerTracker=new e.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:e.delegate(this,f),keyDownHandler:e.delegate(this,g),keyHandler:e.delegate(this,v),clickHandler:e.delegate(this,m),dblClickHandler:e.delegate(this,y),dragHandler:e.delegate(this,w),dragEndHandler:e.delegate(this,T),enterHandler:e.delegate(this,x),leaveHandler:e.delegate(this,S),pressHandler:e.delegate(this,E),releaseHandler:e.delegate(this,P),nonPrimaryPressHandler:e.delegate(this,_),nonPrimaryReleaseHandler:e.delegate(this,R),scrollHandler:e.delegate(this,I),pinchHandler:e.delegate(this,C),focusHandler:e.delegate(this,b),blurHandler:e.delegate(this,D)});this.outerTracker=new e.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:e.delegate(this,k),leaveHandler:e.delegate(this,O)});if(this.toolbar){this.toolbar=new e.ControlDock({element:this.toolbar})}this.bindStandardControls();t[this.hash].prevContainerSize=n(this.container);if(window.ResizeObserver){this._autoResizePolling=false;this._resizeObserver=new ResizeObserver((function(){t[s.hash].needsResize=true}));this._resizeObserver.observe(this.container,{})}else{this._autoResizePolling=true}this.world=new e.World({viewer:this});this.world.addHandler("add-item",(function(e){s.source=s.world.getItemAt(0).source;t[s.hash].forceRedraw=true;if(!s._updateRequestId){s._updateRequestId=a(s,H)}}));this.world.addHandler("remove-item",(function(e){if(s.world.getItemCount()){s.source=s.world.getItemAt(0).source}else{s.source=null}t[s.hash].forceRedraw=true}));this.world.addHandler("metrics-change",(function(e){if(s.viewport){s.viewport._setContentBounds(s.world.getHomeBounds(),s.world.getContentFactor())}}));this.world.addHandler("item-index-change",(function(e){s.source=s.world.getItemAt(0).source}));this.viewport=new e.Viewport({containerSize:t[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins,silenceMultiImageWarnings:this.silenceMultiImageWarnings});this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor());this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:r.timeout,tileRetryMax:this.tileRetryMax,tileRetryDelay:this.tileRetryDelay});this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount});this.drawer=new e.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor});this.overlaysContainer=e.makeNeutralElement("div");this.canvas.appendChild(this.overlaysContainer);if(!this.drawer.canRotate()){if(this.rotateLeft){l=this.buttonGroup.buttons.indexOf(this.rotateLeft);this.buttonGroup.buttons.splice(l,1);this.buttonGroup.element.removeChild(this.rotateLeft.element)}if(this.rotateRight){l=this.buttonGroup.buttons.indexOf(this.rotateRight);this.buttonGroup.buttons.splice(l,1);this.buttonGroup.element.removeChild(this.rotateRight.element)}}this._addUpdatePixelDensityRatioEvent();if(this.showNavigator){this.navigator=new e.Navigator({element:this.navigatorElement,id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy,animationTime:this.animationTime})}if(this.sequenceMode){this.bindSequenceControls()}if(this.tileSources){this.open(this.tileSources)}for(l=0;l<this.customControls.length;l++){this.addControl(this.customControls[l].id,{anchor:this.customControls[l].anchor})}e.requestAnimationFrame((function(){h(s)}));if(this.imageSmoothingEnabled!==undefined&&!this.imageSmoothingEnabled){this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled)}e._viewers.set(this.element,this)};e.extend(e.Viewer.prototype,e.EventSource.prototype,e.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(t){e.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead.");return this.open(t)},openTileSource:function(t){e.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead.");return this.open(t)},get buttons(){e.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup");return this.buttonGroup},open:function(t,i){var n=this;this.close();if(!t){return this}if(this.sequenceMode&&e.isArray(t)){if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}if(typeof i!=="undefined"&&!isNaN(i)){this.initialPage=i}this.tileSources=t;this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage));if(this.tileSources.length){this.open(this.tileSources[this._sequenceIndex]);if(this.showReferenceStrip){this.addReferenceStrip()}}this._updateSequenceButtons(this._sequenceIndex);return this}if(!e.isArray(t)){t=[t]}if(!t.length){return this}this._opening=true;var r=t.length;var s=0;var a=0;var l;var h=function(){if(s+a===r){if(s){if(n._firstOpen||!n.preserveViewport){n.viewport.goHome(true);n.viewport.update()}n._firstOpen=false;var e=t[0];if(e.tileSource){e=e.tileSource}if(n.overlays&&!n.preserveOverlays){for(var i=0;i<n.overlays.length;i++){n.currentOverlays[i]=o(n,n.overlays[i])}}n._drawOverlays();n._opening=false;n.raiseEvent("open",{source:e})}else{n._opening=false;n.raiseEvent("open-failed",l)}}};var u=function(t){if(!e.isPlainObject(t)||!t.tileSource){t={tileSource:t}}if(t.index!==undefined){e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead");delete t.index}if(t.collectionImmediately===undefined){t.collectionImmediately=true}var i=t.success;t.success=function(e){s++;if(t.tileSource.overlays){for(var r=0;r<t.tileSource.overlays.length;r++){n.addOverlay(t.tileSource.overlays[r])}}if(i){i(e)}h()};var r=t.error;t.error=function(e){a++;if(!l){l=e}if(r){r(e)}h()};n.addTiledImage(t)};for(var c=0;c<t.length;c++){u(t[c])}return this},close:function(){if(!t[this.hash]){return this}this._opening=false;if(this.navigator){this.navigator.close()}if(!this.preserveOverlays){this.clearOverlays();this.overlaysContainer.innerHTML=""}t[this.hash].animating=false;this.world.removeAll();this.imageLoader.clear();this.raiseEvent("close");return this},destroy:function(){if(!t[this.hash]){return}this.raiseEvent("before-destroy");this._removeUpdatePixelDensityRatioEvent();this.close();this.clearOverlays();this.overlaysContainer.innerHTML="";if(this._resizeObserver){this._resizeObserver.disconnect()}if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}if(this._updateRequestId!==null){e.cancelAnimationFrame(this._updateRequestId);this._updateRequestId=null}if(this.drawer){this.drawer.destroy()}if(this.navigator){this.navigator.destroy();t[this.navigator.hash]=null;delete t[this.navigator.hash];this.navigator=null}if(this.buttonGroup){this.buttonGroup.destroy()}else if(this.customButtons){while(this.customButtons.length){this.customButtons.pop().destroy()}}if(this.paging){this.paging.destroy()}if(this.element){while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}}this.container.onsubmit=null;this.clearControls();if(this.innerTracker){this.innerTracker.destroy()}if(this.outerTracker){this.outerTracker.destroy()}t[this.hash]=null;delete t[this.hash];this.canvas=null;this.container=null;e._viewers.delete(this.element);this.element=null;this.raiseEvent("destroy");this.removeAllHandlers()},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(e){this.innerTracker.setTracking(e);this.outerTracker.setTracking(e);this.raiseEvent("mouse-enabled",{enabled:e});return this},areControlsEnabled:function(){var e=this.controls.length,t;for(t=0;t<this.controls.length;t++){e=e&&this.controls[t].isVisible()}return e},setControlsEnabled:function(e){if(e){c(this)}else{h(this)}this.raiseEvent("controls-enabled",{enabled:e});return this},setDebugMode:function(e){for(var t=0;t<this.world.getItemCount();t++){this.world.getItemAt(t).debugMode=e}this.debugMode=e;this.forceRedraw()},setAjaxHeaders:function(t,i){if(t===null){t={}}if(!e.isPlainObject(t)){console.error("[Viewer.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}if(i===undefined){i=true}this.ajaxHeaders=t;if(i){for(var n=0;n<this.world.getItemCount();n++){this.world.getItemAt(n)._updateAjaxHeaders(true)}if(this.navigator){this.navigator.setAjaxHeaders(this.ajaxHeaders,true)}if(this.referenceStrip&&this.referenceStrip.miniViewers){for(var r in this.referenceStrip.miniViewers){this.referenceStrip.miniViewers[r].setAjaxHeaders(this.ajaxHeaders,true)}}}},addButton:function(e){this.buttonGroup.addButton(e)},isFullPage:function(){return t[this.hash].fullPage},setFullPage:function(i){var n=document.body,r=n.style,o=document.documentElement.style,s=this,a,l;if(i===this.isFullPage()){return this}var h={fullPage:i,preventDefaultAction:false};this.raiseEvent("pre-full-page",h);if(h.preventDefaultAction){return this}if(i){this.elementSize=e.getElementSize(this.element);this.pageScroll=e.getPageScroll();this.elementMargin=this.element.style.margin;this.element.style.margin="0";this.elementPadding=this.element.style.padding;this.element.style.padding="0";this.bodyMargin=r.margin;this.docMargin=o.margin;r.margin="0";o.margin="0";this.bodyPadding=r.padding;this.docPadding=o.padding;r.padding="0";o.padding="0";this.bodyWidth=r.width;this.docWidth=o.width;r.width="100%";o.width="100%";this.bodyHeight=r.height;this.docHeight=o.height;r.height="100%";o.height="100%";this.bodyDisplay=r.display;r.display="block";this.previousBody=[];t[this.hash].prevElementParent=this.element.parentNode;t[this.hash].prevNextSibling=this.element.nextSibling;t[this.hash].prevElementWidth=this.element.style.width;t[this.hash].prevElementHeight=this.element.style.height;a=n.childNodes.length;for(l=0;l<a;l++){this.previousBody.push(n.childNodes[0]);n.removeChild(n.childNodes[0])}if(this.toolbar&&this.toolbar.element){this.toolbar.parentNode=this.toolbar.element.parentNode;this.toolbar.nextSibling=this.toolbar.element.nextSibling;n.appendChild(this.toolbar.element);e.addClass(this.toolbar.element,"fullpage")}e.addClass(this.element,"fullpage");n.appendChild(this.element);this.element.style.height="100vh";this.element.style.width="100vw";if(this.toolbar&&this.toolbar.element){this.element.style.height=e.getElementSize(this.element).y-e.getElementSize(this.toolbar.element).y+"px"}t[this.hash].fullPage=true;e.delegate(this,k)({})}else{this.element.style.margin=this.elementMargin;this.element.style.padding=this.elementPadding;r.margin=this.bodyMargin;o.margin=this.docMargin;r.padding=this.bodyPadding;o.padding=this.docPadding;r.width=this.bodyWidth;o.width=this.docWidth;r.height=this.bodyHeight;o.height=this.docHeight;r.display=this.bodyDisplay;n.removeChild(this.element);a=this.previousBody.length;for(l=0;l<a;l++){n.appendChild(this.previousBody.shift())}e.removeClass(this.element,"fullpage");t[this.hash].prevElementParent.insertBefore(this.element,t[this.hash].prevNextSibling);if(this.toolbar&&this.toolbar.element){n.removeChild(this.toolbar.element);e.removeClass(this.toolbar.element,"fullpage");this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling);delete this.toolbar.parentNode;delete this.toolbar.nextSibling}this.element.style.width=t[this.hash].prevElementWidth;this.element.style.height=t[this.hash].prevElementHeight;var u=0;var c=function(){e.setPageScroll(s.pageScroll);var t=e.getPageScroll();u++;if(u<10&&(t.x!==s.pageScroll.x||t.y!==s.pageScroll.y)){e.requestAnimationFrame(c)}};e.requestAnimationFrame(c);t[this.hash].fullPage=false;e.delegate(this,O)({})}if(this.navigator&&this.viewport){this.navigator.update(this.viewport)}this.raiseEvent("full-page",{fullPage:i});return this},setFullScreen:function(t){var i=this;if(!e.supportsFullScreen){return this.setFullPage(t)}if(e.isFullScreen()===t){return this}var n={fullScreen:t,preventDefaultAction:false};this.raiseEvent("pre-full-screen",n);if(n.preventDefaultAction){return this}if(t){this.setFullPage(true);if(!this.isFullPage()){return this}this.fullPageStyleWidth=this.element.style.width;this.fullPageStyleHeight=this.element.style.height;this.element.style.width="100%";this.element.style.height="100%";var r=function(){var t=e.isFullScreen();if(!t){e.removeEvent(document,e.fullScreenEventName,r);e.removeEvent(document,e.fullScreenErrorEventName,r);i.setFullPage(false);if(i.isFullPage()){i.element.style.width=i.fullPageStyleWidth;i.element.style.height=i.fullPageStyleHeight}}if(i.navigator&&i.viewport){setTimeout((function(){i.navigator.update(i.viewport)}))}i.raiseEvent("full-screen",{fullScreen:t})};e.addEvent(document,e.fullScreenEventName,r);e.addEvent(document,e.fullScreenErrorEventName,r);e.requestFullScreen(document.body)}else{e.exitFullScreen()}return this},isVisible:function(){return this.container.style.visibility!=="hidden"},isFullScreen:function(){return e.isFullScreen()&&this.isFullPage()},setVisible:function(e){this.container.style.visibility=e?"":"hidden";this.raiseEvent("visible",{visible:e});return this},addTiledImage:function(t){e.console.assert(t,"[Viewer.addTiledImage] options is required");e.console.assert(t.tileSource,"[Viewer.addTiledImage] options.tileSource is required");e.console.assert(!t.replace||t.index>-1&&t.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var i=this;if(t.replace){t.replaceItem=i.world.getItemAt(t.index)}this._hideMessage();if(t.placeholderFillStyle===undefined){t.placeholderFillStyle=this.placeholderFillStyle}if(t.opacity===undefined){t.opacity=this.opacity}if(t.preload===undefined){t.preload=this.preload}if(t.compositeOperation===undefined){t.compositeOperation=this.compositeOperation}if(t.crossOriginPolicy===undefined){t.crossOriginPolicy=t.tileSource.crossOriginPolicy!==undefined?t.tileSource.crossOriginPolicy:this.crossOriginPolicy}if(t.ajaxWithCredentials===undefined){t.ajaxWithCredentials=this.ajaxWithCredentials}if(t.loadTilesWithAjax===undefined){t.loadTilesWithAjax=this.loadTilesWithAjax}if(!e.isPlainObject(t.ajaxHeaders)){t.ajaxHeaders={}}var n={options:t};function o(e){for(var r=0;r<i._loadQueue.length;r++){if(i._loadQueue[r]===n){i._loadQueue.splice(r,1);break}}if(i._loadQueue.length===0){s(n)}i.raiseEvent("add-item-failed",e);if(t.error){t.error(e)}}function s(e){if(i.collectionMode){i.world.arrange({immediately:e.options.collectionImmediately,rows:i.collectionRows,columns:i.collectionColumns,layout:i.collectionLayout,tileSize:i.collectionTileSize,tileMargin:i.collectionTileMargin});i.world.setAutoRefigureSizes(true)}}if(e.isArray(t.tileSource)){setTimeout((function(){o({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:t.tileSource,options:t})}));return}this._loadQueue.push(n);function a(){var t,n,r;while(i._loadQueue.length){t=i._loadQueue[0];if(!t.tileSource){break}i._loadQueue.splice(0,1);if(t.options.replace){var o=i.world.getIndexOfItem(t.options.replaceItem);if(o!==-1){t.options.index=o}i.world.removeItem(t.options.replaceItem)}n=new e.TiledImage({viewer:i,source:t.tileSource,viewport:i.viewport,drawer:i.drawer,tileCache:i.tileCache,imageLoader:i.imageLoader,x:t.options.x,y:t.options.y,width:t.options.width,height:t.options.height,fitBounds:t.options.fitBounds,fitBoundsPlacement:t.options.fitBoundsPlacement,clip:t.options.clip,placeholderFillStyle:t.options.placeholderFillStyle,opacity:t.options.opacity,preload:t.options.preload,degrees:t.options.degrees,flipped:t.options.flipped,compositeOperation:t.options.compositeOperation,springStiffness:i.springStiffness,animationTime:i.animationTime,minZoomImageRatio:i.minZoomImageRatio,wrapHorizontal:i.wrapHorizontal,wrapVertical:i.wrapVertical,immediateRender:i.immediateRender,blendTime:i.blendTime,alwaysBlend:i.alwaysBlend,minPixelRatio:i.minPixelRatio,smoothTileEdgesMinZoom:i.smoothTileEdgesMinZoom,iOSDevice:i.iOSDevice,crossOriginPolicy:t.options.crossOriginPolicy,ajaxWithCredentials:t.options.ajaxWithCredentials,loadTilesWithAjax:t.options.loadTilesWithAjax,ajaxHeaders:t.options.ajaxHeaders,debugMode:i.debugMode,subPixelRoundingForTransparency:i.subPixelRoundingForTransparency});if(i.collectionMode){i.world.setAutoRefigureSizes(false)}if(i.navigator){r=e.extend({},t.options,{replace:false,originalTiledImage:n,tileSource:t.tileSource});i.navigator.addTiledImage(r)}i.world.addItem(n,{index:t.options.index});if(i._loadQueue.length===0){s(t)}if(i.world.getItemCount()===1&&!i.preserveViewport){i.viewport.goHome(true)}if(t.options.success){t.options.success({item:n})}}}r(this,t.tileSource,t,(function(e){n.tileSource=e;a()}),(function(e){e.options=t;o(e);a()}))},addSimpleImage:function(t){e.console.assert(t,"[Viewer.addSimpleImage] options is required");e.console.assert(t.url,"[Viewer.addSimpleImage] options.url is required");var i=e.extend({},t,{tileSource:{type:"image",url:t.url}});delete i.url;this.addTiledImage(i)},addLayer:function(t){var i=this;e.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var n=e.extend({},t,{success:function(e){i.raiseEvent("add-layer",{options:t,drawer:e.item})},error:function(e){i.raiseEvent("add-layer-failed",e)}});this.addTiledImage(n);return this},getLayerAtLevel:function(t){e.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead.");return this.world.getItemAt(t)},getLevelOfLayer:function(t){e.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead.");return this.world.getIndexOfItem(t)},getLayersCount:function(){e.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead.");return this.world.getItemCount()},setLayerLevel:function(t,i){e.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead.");return this.world.setItemIndex(t,i)},removeLayer:function(t){e.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead.");return this.world.removeItem(t)},forceRedraw:function(){t[this.hash].forceRedraw=true;return this},forceResize:function(){t[this.hash].needsResize=true;t[this.hash].forceResize=true},bindSequenceControls:function(){var t=e.delegate(this,d),i=e.delegate(this,p),n=e.delegate(this,this.goToNextPage),r=e.delegate(this,this.goToPreviousPage),o=this.navImages,s=true;if(this.showSequenceControl){if(this.previousButton||this.nextButton){s=false}this.previousButton=new e.Button({element:this.previousButton?e.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.PreviousPage"),srcRest:F(this.prefixUrl,o.previous.REST),srcGroup:F(this.prefixUrl,o.previous.GROUP),srcHover:F(this.prefixUrl,o.previous.HOVER),srcDown:F(this.prefixUrl,o.previous.DOWN),onRelease:r,onFocus:t,onBlur:i});this.nextButton=new e.Button({element:this.nextButton?e.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.NextPage"),srcRest:F(this.prefixUrl,o.next.REST),srcGroup:F(this.prefixUrl,o.next.GROUP),srcHover:F(this.prefixUrl,o.next.HOVER),srcDown:F(this.prefixUrl,o.next.DOWN),onRelease:n,onFocus:t,onBlur:i});if(!this.navPrevNextWrap){this.previousButton.disable()}if(!this.tileSources||!this.tileSources.length){this.nextButton.disable()}if(s){this.paging=new e.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.pagingControl=this.paging.element;if(this.toolbar){this.toolbar.addControl(this.pagingControl,{anchor:e.ControlAnchor.BOTTOM_RIGHT})}else{this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||e.ControlAnchor.TOP_LEFT})}}}return this},bindStandardControls:function(){var t=e.delegate(this,M),i=e.delegate(this,A),n=e.delegate(this,V),r=e.delegate(this,N),o=e.delegate(this,j),s=e.delegate(this,q),a=e.delegate(this,Z),l=e.delegate(this,X),h=e.delegate(this,Y),u=e.delegate(this,K),c=e.delegate(this,d),f=e.delegate(this,p),g=this.navImages,v=[],m=true;if(this.showNavigationControl){if(this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton){m=false}if(this.showZoomControl){v.push(this.zoomInButton=new e.Button({element:this.zoomInButton?e.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomIn"),srcRest:F(this.prefixUrl,g.zoomIn.REST),srcGroup:F(this.prefixUrl,g.zoomIn.GROUP),srcHover:F(this.prefixUrl,g.zoomIn.HOVER),srcDown:F(this.prefixUrl,g.zoomIn.DOWN),onPress:t,onRelease:i,onClick:n,onEnter:t,onExit:i,onFocus:c,onBlur:f}));v.push(this.zoomOutButton=new e.Button({element:this.zoomOutButton?e.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomOut"),srcRest:F(this.prefixUrl,g.zoomOut.REST),srcGroup:F(this.prefixUrl,g.zoomOut.GROUP),srcHover:F(this.prefixUrl,g.zoomOut.HOVER),srcDown:F(this.prefixUrl,g.zoomOut.DOWN),onPress:r,onRelease:i,onClick:o,onEnter:r,onExit:i,onFocus:c,onBlur:f}))}if(this.showHomeControl){v.push(this.homeButton=new e.Button({element:this.homeButton?e.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Home"),srcRest:F(this.prefixUrl,g.home.REST),srcGroup:F(this.prefixUrl,g.home.GROUP),srcHover:F(this.prefixUrl,g.home.HOVER),srcDown:F(this.prefixUrl,g.home.DOWN),onRelease:s,onFocus:c,onBlur:f}))}if(this.showFullPageControl){v.push(this.fullPageButton=new e.Button({element:this.fullPageButton?e.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.FullPage"),srcRest:F(this.prefixUrl,g.fullpage.REST),srcGroup:F(this.prefixUrl,g.fullpage.GROUP),srcHover:F(this.prefixUrl,g.fullpage.HOVER),srcDown:F(this.prefixUrl,g.fullpage.DOWN),onRelease:a,onFocus:c,onBlur:f}))}if(this.showRotationControl){v.push(this.rotateLeftButton=new e.Button({element:this.rotateLeftButton?e.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateLeft"),srcRest:F(this.prefixUrl,g.rotateleft.REST),srcGroup:F(this.prefixUrl,g.rotateleft.GROUP),srcHover:F(this.prefixUrl,g.rotateleft.HOVER),srcDown:F(this.prefixUrl,g.rotateleft.DOWN),onRelease:l,onFocus:c,onBlur:f}));v.push(this.rotateRightButton=new e.Button({element:this.rotateRightButton?e.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateRight"),srcRest:F(this.prefixUrl,g.rotateright.REST),srcGroup:F(this.prefixUrl,g.rotateright.GROUP),srcHover:F(this.prefixUrl,g.rotateright.HOVER),srcDown:F(this.prefixUrl,g.rotateright.DOWN),onRelease:h,onFocus:c,onBlur:f}))}if(this.showFlipControl){v.push(this.flipButton=new e.Button({element:this.flipButton?e.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Flip"),srcRest:F(this.prefixUrl,g.flip.REST),srcGroup:F(this.prefixUrl,g.flip.GROUP),srcHover:F(this.prefixUrl,g.flip.HOVER),srcDown:F(this.prefixUrl,g.flip.DOWN),onRelease:u,onFocus:c,onBlur:f}))}if(m){this.buttonGroup=new e.ButtonGroup({buttons:v,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.navControl=this.buttonGroup.element;this.addHandler("open",e.delegate(this,G));if(this.toolbar){this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT})}else{this.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT})}}else{this.customButtons=v}}return this},currentPage:function(){return this._sequenceIndex},goToPage:function(e){if(this.tileSources&&e>=0&&e<this.tileSources.length){this._sequenceIndex=e;this._updateSequenceButtons(e);this.open(this.tileSources[e]);if(this.referenceStrip){this.referenceStrip.setFocus(e)}this.raiseEvent("page",{page:e})}return this},addOverlay:function(t,i,n,r){var a;if(e.isPlainObject(t)){a=t}else{a={element:t,location:i,placement:n,onDraw:r}}t=e.getElement(a.element);if(s(this.currentOverlays,t)>=0){return this}var l=o(this,a);this.currentOverlays.push(l);l.drawHTML(this.overlaysContainer,this.viewport);this.raiseEvent("add-overlay",{element:t,location:a.location,placement:a.placement});return this},updateOverlay:function(i,n,r){var o;i=e.getElement(i);o=s(this.currentOverlays,i);if(o>=0){this.currentOverlays[o].update(n,r);t[this.hash].forceRedraw=true;this.raiseEvent("update-overlay",{element:i,location:n,placement:r})}return this},removeOverlay:function(i){var n;i=e.getElement(i);n=s(this.currentOverlays,i);if(n>=0){this.currentOverlays[n].destroy();this.currentOverlays.splice(n,1);t[this.hash].forceRedraw=true;this.raiseEvent("remove-overlay",{element:i})}return this},clearOverlays:function(){while(this.currentOverlays.length>0){this.currentOverlays.pop().destroy()}t[this.hash].forceRedraw=true;this.raiseEvent("clear-overlay",{});return this},getOverlayById:function(t){var i;t=e.getElement(t);i=s(this.currentOverlays,t);if(i>=0){return this.currentOverlays[i]}else{return null}},_updateSequenceButtons:function(e){if(this.nextButton){if(!this.tileSources||this.tileSources.length-1===e){if(!this.navPrevNextWrap){this.nextButton.disable()}}else{this.nextButton.enable()}}if(this.previousButton){if(e>0){this.previousButton.enable()}else{if(!this.navPrevNextWrap){this.previousButton.disable()}}}},_showMessage:function(t){this._hideMessage();var i=e.makeNeutralElement("div");i.appendChild(document.createTextNode(t));this.messageDiv=e.makeCenteredNode(i);e.addClass(this.messageDiv,"openseadragon-message");this.container.appendChild(this.messageDiv)},_hideMessage:function(){var e=this.messageDiv;if(e){e.parentNode.removeChild(e);delete this.messageDiv}},gestureSettingsByDeviceType:function(e){switch(e){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var e,t=this.currentOverlays.length;for(e=0;e<t;e++){this.currentOverlays[e].drawHTML(this.overlaysContainer,this.viewport)}},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=false;if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}},addReferenceStrip:function(){this.showReferenceStrip=true;if(this.sequenceMode){if(this.referenceStrip){return}if(this.tileSources.length&&this.tileSources.length>1){this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this});this.referenceStrip.setFocus(this._sequenceIndex)}}else{e.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')}},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this);e.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){e.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var t=e.pixelDensityRatio;var i=e.getCurrentPixelDensityRatio();if(t!==i){e.pixelDensityRatio=i;this.world.resetItems();this.forceRedraw()}},goToPreviousPage:function(){var e=this._sequenceIndex-1;if(this.navPrevNextWrap&&e<0){e+=this.tileSources.length}this.goToPage(e)},goToNextPage:function(){var e=this._sequenceIndex+1;if(this.navPrevNextWrap&&e>=this.tileSources.length){e=0}this.goToPage(e)},isAnimating:function(){return t[this.hash].animating}});function n(t){t=e.getElement(t);return new e.Point(t.clientWidth===0?1:t.clientWidth,t.clientHeight===0?1:t.clientHeight)}function r(t,i,n,r,o){var s=t;if(e.type(i)==="string"){if(i.match(/^\s*<.*>\s*$/)){i=e.parseXml(i)}else if(i.match(/^\s*[{[].*[}\]]\s*$/)){try{var a=e.parseJSON(i);i=a}catch(e){}}}function l(e,t){if(e.ready){r(e)}else{e.addHandler("ready",(function(){r(e)}));e.addHandler("open-failed",(function(e){o({message:e.message,source:t})}))}}setTimeout((function(){if(e.type(i)==="string"){i=new e.TileSource({url:i,crossOriginPolicy:n.crossOriginPolicy!==undefined?n.crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,ajaxHeaders:n.ajaxHeaders?n.ajaxHeaders:t.ajaxHeaders,splitHashDataForPost:t.splitHashDataForPost,useCanvas:t.useCanvas,success:function(e){r(e.tileSource)}});i.addHandler("open-failed",(function(e){o(e)}))}else if(e.isPlainObject(i)||i.nodeType){if(i.crossOriginPolicy===undefined&&(n.crossOriginPolicy!==undefined||t.crossOriginPolicy!==undefined)){i.crossOriginPolicy=n.crossOriginPolicy!==undefined?n.crossOriginPolicy:t.crossOriginPolicy}if(i.ajaxWithCredentials===undefined){i.ajaxWithCredentials=t.ajaxWithCredentials}if(i.useCanvas===undefined){i.useCanvas=t.useCanvas}if(e.isFunction(i.getTileUrl)){var a=new e.TileSource(i);a.getTileUrl=i.getTileUrl;r(a)}else{var h=e.TileSource.determineType(s,i);if(!h){o({message:"Unable to load TileSource",source:i});return}var u=h.prototype.configure.apply(s,[i]);l(new h(u),i)}}else{l(i,i)}}))}function o(t,i){if(i instanceof e.Overlay){return i}var n=null;if(i.element){n=e.getElement(i.element)}else{var r=i.id?i.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);n=e.getElement(i.id);if(!n){n=document.createElement("a");n.href="#/overlay/"+r}n.id=r;e.addClass(n,i.className?i.className:"openseadragon-overlay")}var o=i.location;var s=i.width;var a=i.height;if(!o){var l=i.x;var h=i.y;if(i.px!==undefined){var u=t.viewport.imageToViewportRectangle(new e.Rect(i.px,i.py,s||0,a||0));l=u.x;h=u.y;s=s!==undefined?u.width:undefined;a=a!==undefined?u.height:undefined}o=new e.Point(l,h)}var c=i.placement;if(c&&e.type(c)==="string"){c=e.Placement[i.placement.toUpperCase()]}return new e.Overlay({element:n,location:o,placement:c,onDraw:i.onDraw,checkResize:i.checkResize,width:s,height:a,rotationMode:i.rotationMode})}function s(e,t){var i;for(i=e.length-1;i>=0;i--){if(e[i].element===t){return i}}return-1}function a(t,i){return e.requestAnimationFrame((function(){i(t)}))}function l(t){e.requestAnimationFrame((function(){u(t)}))}function h(t){if(!t.autoHideControls){return}t.controlsShouldFade=true;t.controlsFadeBeginTime=e.now()+t.controlsFadeDelay;window.setTimeout((function(){l(t)}),t.controlsFadeDelay)}function u(t){var i,n,r,o;if(t.controlsShouldFade){i=e.now();n=i-t.controlsFadeBeginTime;r=1-n/t.controlsFadeLength;r=Math.min(1,r);r=Math.max(0,r);for(o=t.controls.length-1;o>=0;o--){if(t.controls[o].autoFade){t.controls[o].setOpacity(r)}}if(r>0){l(t)}}}function c(e){var t;e.controlsShouldFade=false;for(t=e.controls.length-1;t>=0;t--){e.controls[t].setOpacity(1)}}function d(){c(this)}function p(){h(this)}function f(e){var t={tracker:e.eventSource,position:e.position,originalEvent:e.originalEvent,preventDefault:e.preventDefault};this.raiseEvent("canvas-contextmenu",t);e.preventDefault=t.preventDefault}function g(t){var i={originalEvent:t.originalEvent,preventDefaultAction:false,preventVerticalPan:t.preventVerticalPan||!this.panVertical,preventHorizontalPan:t.preventHorizontalPan||!this.panHorizontal};this.raiseEvent("canvas-key",i);if(!i.preventDefaultAction&&!t.ctrl&&!t.alt&&!t.meta){switch(t.keyCode){case 38:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(1.1)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 40:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(.9)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 37:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 39:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 187:this.viewport.zoomBy(1.1);this.viewport.applyConstraints();t.preventDefault=true;break;case 189:this.viewport.zoomBy(.9);this.viewport.applyConstraints();t.preventDefault=true;break;case 48:this.viewport.goHome();this.viewport.applyConstraints();t.preventDefault=true;break;case 87:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(1.1)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 83:if(!i.preventVerticalPan){if(t.shift){this.viewport.zoomBy(.9)}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40)))}this.viewport.applyConstraints()}t.preventDefault=true;break;case 65:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 68:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0)));this.viewport.applyConstraints()}t.preventDefault=true;break;case 82:if(t.shift){if(this.viewport.flipped){this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement)}else{this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement)}}else{if(this.viewport.flipped){this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement)}else{this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement)}}this.viewport.applyConstraints();t.preventDefault=true;break;case 70:this.viewport.toggleFlip();t.preventDefault=true;break;case 74:this.goToPreviousPage();break;case 75:this.goToNextPage();break;default:t.preventDefault=false;break}}else{t.preventDefault=false}}function v(e){var t={originalEvent:e.originalEvent};this.raiseEvent("canvas-key-press",t)}function m(i){var n;var r=document.activeElement===this.canvas;if(!r){this.canvas.focus()}if(this.viewport.flipped){i.position.x=this.viewport.getContainerSize().x-i.position.x}var o={tracker:i.eventSource,position:i.position,quick:i.quick,shift:i.shift,originalEvent:i.originalEvent,originalTarget:i.originalTarget,preventDefaultAction:false};this.raiseEvent("canvas-click",o);if(!o.preventDefaultAction&&this.viewport&&i.quick){n=this.gestureSettingsByDeviceType(i.pointerType);if(n.clickToZoom===true){this.viewport.zoomBy(i.shift?1/this.zoomPerClick:this.zoomPerClick,n.zoomToRefPoint?this.viewport.pointFromPixel(i.position,true):null);this.viewport.applyConstraints()}if(n.dblClickDragToZoom){if(t[this.hash].draggingToZoom===true){t[this.hash].lastClickTime=null;t[this.hash].draggingToZoom=false}else{t[this.hash].lastClickTime=e.now()}}}}function y(e){var t;var i={tracker:e.eventSource,position:e.position,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.raiseEvent("canvas-double-click",i);if(!i.preventDefaultAction&&this.viewport){t=this.gestureSettingsByDeviceType(e.pointerType);if(t.dblClickToZoom){this.viewport.zoomBy(e.shift?1/this.zoomPerClick:this.zoomPerClick,t.zoomToRefPoint?this.viewport.pointFromPixel(e.position,true):null);this.viewport.applyConstraints()}}}function w(e){var i;var n={tracker:e.eventSource,pointerType:e.pointerType,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.raiseEvent("canvas-drag",n);i=this.gestureSettingsByDeviceType(e.pointerType);if(!n.preventDefaultAction&&this.viewport){if(i.dblClickDragToZoom&&t[this.hash].draggingToZoom){var r=Math.pow(this.zoomPerDblClickDrag,e.delta.y/50);this.viewport.zoomBy(r)}else if(i.dragToPan&&!t[this.hash].draggingToZoom){if(!this.panHorizontal){e.delta.x=0}if(!this.panVertical){e.delta.y=0}if(this.viewport.flipped){e.delta.x=-e.delta.x}if(this.constrainDuringPan){var o=this.viewport.deltaPointsFromPixels(e.delta.negate());this.viewport.centerSpringX.target.value+=o.x;this.viewport.centerSpringY.target.value+=o.y;var s=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=o.x;this.viewport.centerSpringY.target.value-=o.y;if(s.xConstrained){e.delta.x=0}if(s.yConstrained){e.delta.y=0}}this.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta.negate()),i.flickEnabled&&!this.constrainDuringPan)}}}function T(i){var n;var r={tracker:i.eventSource,pointerType:i.pointerType,position:i.position,speed:i.speed,direction:i.direction,shift:i.shift,originalEvent:i.originalEvent,preventDefaultAction:false};this.raiseEvent("canvas-drag-end",r);n=this.gestureSettingsByDeviceType(i.pointerType);if(!r.preventDefaultAction&&this.viewport){if(!t[this.hash].draggingToZoom&&n.flickEnabled&&i.speed>=n.flickMinSpeed){var o=0;if(this.panHorizontal){o=n.flickMomentum*i.speed*Math.cos(i.direction)}var s=0;if(this.panVertical){s=n.flickMomentum*i.speed*Math.sin(i.direction)}var a=this.viewport.pixelFromPoint(this.viewport.getCenter(true));var l=this.viewport.pointFromPixel(new e.Point(a.x-o,a.y-s));this.viewport.panTo(l,false)}this.viewport.applyConstraints()}if(n.dblClickDragToZoom&&t[this.hash].draggingToZoom===true){t[this.hash].draggingToZoom=false}}function x(e){this.raiseEvent("canvas-enter",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function S(e){this.raiseEvent("canvas-exit",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function E(i){var n;this.raiseEvent("canvas-press",{tracker:i.eventSource,pointerType:i.pointerType,position:i.position,insideElementPressed:i.insideElementPressed,insideElementReleased:i.insideElementReleased,originalEvent:i.originalEvent});n=this.gestureSettingsByDeviceType(i.pointerType);if(n.dblClickDragToZoom){var r=t[this.hash].lastClickTime;var o=e.now();if(r===null){return}if(o-r<this.dblClickTimeThreshold){t[this.hash].draggingToZoom=true}t[this.hash].lastClickTime=null}}function P(e){this.raiseEvent("canvas-release",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent})}function _(e){this.raiseEvent("canvas-nonprimary-press",{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function R(e){this.raiseEvent("canvas-nonprimary-release",{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function C(e){var t,i,n,r;var o={tracker:e.eventSource,pointerType:e.pointerType,gesturePoints:e.gesturePoints,lastCenter:e.lastCenter,center:e.center,lastDistance:e.lastDistance,distance:e.distance,shift:e.shift,originalEvent:e.originalEvent,preventDefaultPanAction:false,preventDefaultZoomAction:false,preventDefaultRotateAction:false};this.raiseEvent("canvas-pinch",o);if(this.viewport){t=this.gestureSettingsByDeviceType(e.pointerType);if(t.pinchToZoom&&(!o.preventDefaultPanAction||!o.preventDefaultZoomAction)){i=this.viewport.pointFromPixel(e.center,true);if(t.zoomToRefPoint&&!o.preventDefaultPanAction){n=this.viewport.pointFromPixel(e.lastCenter,true);r=n.minus(i);if(!this.panHorizontal){r.x=0}if(!this.panVertical){r.y=0}this.viewport.panBy(r,true)}if(!o.preventDefaultZoomAction){this.viewport.zoomBy(e.distance/e.lastDistance,i,true)}this.viewport.applyConstraints()}if(t.pinchRotate&&!o.preventDefaultRotateAction){var s=Math.atan2(e.gesturePoints[0].currentPos.y-e.gesturePoints[1].currentPos.y,e.gesturePoints[0].currentPos.x-e.gesturePoints[1].currentPos.x);var a=Math.atan2(e.gesturePoints[0].lastPos.y-e.gesturePoints[1].lastPos.y,e.gesturePoints[0].lastPos.x-e.gesturePoints[1].lastPos.x);i=this.viewport.pointFromPixel(e.center,true);this.viewport.rotateTo(this.viewport.getRotation(true)+(s-a)*(180/Math.PI),i,true)}}}function b(e){this.raiseEvent("canvas-focus",{tracker:e.eventSource,originalEvent:e.originalEvent})}function D(e){this.raiseEvent("canvas-blur",{tracker:e.eventSource,originalEvent:e.originalEvent})}function I(t){var i,n,r,o,s;o=e.now();s=o-this._lastScrollTime;if(s>this.minScrollDeltaTime){this._lastScrollTime=o;i={tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:false,preventDefault:true};this.raiseEvent("canvas-scroll",i);if(!i.preventDefaultAction&&this.viewport){if(this.viewport.flipped){t.position.x=this.viewport.getContainerSize().x-t.position.x}n=this.gestureSettingsByDeviceType(t.pointerType);if(n.scrollToZoom){r=Math.pow(this.zoomPerScroll,t.scroll);this.viewport.zoomBy(r,n.zoomToRefPoint?this.viewport.pointFromPixel(t.position,true):null);this.viewport.applyConstraints()}}t.preventDefault=i.preventDefault}else{t.preventDefault=true}}function k(e){t[this.hash].mouseInside=true;c(this);this.raiseEvent("container-enter",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function O(e){if(e.pointers<1){t[this.hash].mouseInside=false;if(!t[this.hash].animating){h(this)}}this.raiseEvent("container-exit",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function H(e){B(e);if(e.isOpen()){e._updateRequestId=a(e,H)}else{e._updateRequestId=false}}function z(i,n){var r=i.viewport;var o=r.getZoom();var s=r.getCenter();r.resize(n,i.preserveImageSizeOnResize);r.panTo(s,true);var a;if(i.preserveImageSizeOnResize){a=t[i.hash].prevContainerSize.x/n.x}else{var l=new e.Point(0,0);var h=new e.Point(t[i.hash].prevContainerSize.x,t[i.hash].prevContainerSize.y).distanceTo(l);var u=new e.Point(n.x,n.y).distanceTo(l);a=u/h*t[i.hash].prevContainerSize.x/n.x}r.zoomTo(o*a,null,true);t[i.hash].prevContainerSize=n;t[i.hash].forceRedraw=true;t[i.hash].needsResize=false;t[i.hash].forceResize=false}function B(e){if(e._opening||!t[e.hash]){return}if(e.autoResize||t[e.hash].forceResize){var i;if(e._autoResizePolling){i=n(e.container);var r=t[e.hash].prevContainerSize;if(!i.equals(r)){t[e.hash].needsResize=true}}if(t[e.hash].needsResize){z(e,i||n(e.container))}}var o=e.viewport.update();var s=e.world.update()||o;if(o){e.raiseEvent("viewport-change")}if(e.referenceStrip){s=e.referenceStrip.update(e.viewport)||s}var a=t[e.hash].animating;if(!a&&s){e.raiseEvent("animation-start");c(e)}var l=a&&!s;if(l){t[e.hash].animating=false}if(s||l||t[e.hash].forceRedraw||e.world.needsDraw()){L(e);e._drawOverlays();if(e.navigator){e.navigator.update(e.viewport)}t[e.hash].forceRedraw=false;if(s){e.raiseEvent("animation")}}if(l){e.raiseEvent("animation-finish");if(!t[e.hash].mouseInside){h(e)}}t[e.hash].animating=s}function L(e){e.imageLoader.clear();e.drawer.clear();e.world.draw();e.raiseEvent("update-viewport",{})}function F(e,t){return e?e+t:t}function M(){t[this.hash].lastZoomTime=e.now();t[this.hash].zoomFactor=this.zoomPerSecond;t[this.hash].zooming=true;W(this)}function N(){t[this.hash].lastZoomTime=e.now();t[this.hash].zoomFactor=1/this.zoomPerSecond;t[this.hash].zooming=true;W(this)}function A(){t[this.hash].zooming=false}function W(t){e.requestAnimationFrame(e.delegate(t,U))}function U(){var i,n,r;if(t[this.hash].zooming&&this.viewport){i=e.now();n=i-t[this.hash].lastZoomTime;r=Math.pow(t[this.hash].zoomFactor,n/1e3);this.viewport.zoomBy(r);this.viewport.applyConstraints();t[this.hash].lastZoomTime=i;W(this)}}function V(){if(this.viewport){t[this.hash].zooming=false;this.viewport.zoomBy(this.zoomPerClick/1);this.viewport.applyConstraints()}}function j(){if(this.viewport){t[this.hash].zooming=false;this.viewport.zoomBy(1/this.zoomPerClick);this.viewport.applyConstraints()}}function G(){if(this.buttonGroup){this.buttonGroup.emulateEnter();this.buttonGroup.emulateLeave()}}function q(){if(this.viewport){this.viewport.goHome()}}function Z(){if(this.isFullPage()&&!e.isFullScreen()){this.setFullPage(false)}else{this.setFullScreen(!this.isFullPage())}if(this.buttonGroup){this.buttonGroup.emulateLeave()}this.fullPageButton.element.focus();if(this.viewport){this.viewport.applyConstraints()}}function X(){if(this.viewport){var e=this.viewport.getRotation();if(this.viewport.flipped){e+=this.rotationIncrement}else{e-=this.rotationIncrement}this.viewport.setRotation(e)}}function Y(){if(this.viewport){var e=this.viewport.getRotation();if(this.viewport.flipped){e-=this.rotationIncrement}else{e+=this.rotationIncrement}this.viewport.setRotation(e)}}function K(){this.viewport.toggleFlip()}})(t);(function(e){e.Navigator=function(s){var a=s.viewer,l=this,h,u;if(s.element||s.id){if(s.element){if(s.id){e.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.")}if(s.element.id){s.id=s.element.id}else{s.id="navigator-"+e.now()}this.element=s.element}else{this.element=document.getElementById(s.id)}s.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:false,autoFade:false}}else{s.id="navigator-"+e.now();this.element=e.makeNeutralElement("div");s.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:true,autoFade:s.autoFade};if(s.position){if("BOTTOM_RIGHT"===s.position){s.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT}else if("BOTTOM_LEFT"===s.position){s.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT}else if("TOP_RIGHT"===s.position){s.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT}else if("TOP_LEFT"===s.position){s.controlOptions.anchor=e.ControlAnchor.TOP_LEFT}else if("ABSOLUTE"===s.position){s.controlOptions.anchor=e.ControlAnchor.ABSOLUTE;s.controlOptions.top=s.top;s.controlOptions.left=s.left;s.controlOptions.height=s.height;s.controlOptions.width=s.width}}}this.element.id=s.id;this.element.className+=" navigator";s=e.extend(true,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},s,{element:this.element,tabIndex:-1,showNavigator:false,mouseNavEnabled:false,showNavigationControl:false,showSequenceControl:false,immediateRender:true,blendTime:0,animationTime:s.animationTime,autoResize:false,minZoomImageRatio:1,background:s.background,opacity:s.opacity,borderColor:s.borderColor,displayRegionColor:s.displayRegionColor});s.minPixelRatio=this.minPixelRatio=a.minPixelRatio;e.setElementTouchActionNone(this.element);this.borderWidth=2;this.fudge=new e.Point(1,1);this.totalBorderWidths=new e.Point(this.borderWidth*2,this.borderWidth*2).minus(this.fudge);if(s.controlOptions.anchor!==e.ControlAnchor.NONE){(function(e,t){e.margin="0px";e.border=t+"px solid "+s.borderColor;e.padding="0px";e.background=s.background;e.opacity=s.opacity;e.overflow="hidden"})(this.element.style,this.borderWidth)}this.displayRegion=e.makeNeutralElement("div");this.displayRegion.id=this.element.id+"-displayregion";this.displayRegion.className="displayregion";(function(e,t){e.position="relative";e.top="0px";e.left="0px";e.fontSize="0px";e.overflow="hidden";e.border=t+"px solid "+s.displayRegionColor;e.margin="0px";e.padding="0px";e.background="transparent";e["float"]="left";e.cssFloat="left";e.styleFloat="left";e.zIndex=999999999;e.cursor="default";e.boxSizing="content-box"})(this.displayRegion.style,this.borderWidth);e.setElementPointerEventsNone(this.displayRegion);e.setElementTouchActionNone(this.displayRegion);this.displayRegionContainer=e.makeNeutralElement("div");this.displayRegionContainer.id=this.element.id+"-displayregioncontainer";this.displayRegionContainer.className="displayregioncontainer";this.displayRegionContainer.style.width="100%";this.displayRegionContainer.style.height="100%";e.setElementPointerEventsNone(this.displayRegionContainer);e.setElementTouchActionNone(this.displayRegionContainer);a.addControl(this.element,s.controlOptions);this._resizeWithViewer=s.controlOptions.anchor!==e.ControlAnchor.ABSOLUTE&&s.controlOptions.anchor!==e.ControlAnchor.NONE;if(s.width&&s.height){this.setWidth(s.width);this.setHeight(s.height)}else if(this._resizeWithViewer){h=e.getElementSize(a.element);this.element.style.height=Math.round(h.y*s.sizeRatio)+"px";this.element.style.width=Math.round(h.x*s.sizeRatio)+"px";this.oldViewerSize=h;u=e.getElementSize(this.element);this.elementArea=u.x*u.y}this.oldContainerSize=new e.Point(0,0);e.Viewer.apply(this,[s]);this.displayRegionContainer.appendChild(this.displayRegion);this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function c(e,t){o(l.displayRegionContainer,e);o(l.displayRegion,-e);l.viewport.setRotation(e,t)}if(s.navigatorRotate){var d=s.viewer.viewport?s.viewer.viewport.getRotation():s.viewer.degrees||0;c(d,true);s.viewer.addHandler("rotate",(function(e){c(e.degrees,e.immediately)}))}this.innerTracker.destroy();this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,i),clickHandler:e.delegate(this,t),releaseHandler:e.delegate(this,n),scrollHandler:e.delegate(this,r),preProcessEventHandler:function(e){if(e.eventType==="wheel"){e.preventDefault=true}}});this.outerTracker.userData="Navigator.outerTracker";e.setElementPointerEventsNone(this.canvas);e.setElementPointerEventsNone(this.container);this.addHandler("reset-size",(function(){if(l.viewport){l.viewport.goHome(true)}}));a.world.addHandler("item-index-change",(function(e){window.setTimeout((function(){var t=l.world.getItemAt(e.previousIndex);l.world.setItemIndex(t,e.newIndex)}),1)}));a.world.addHandler("remove-item",(function(e){var t=e.item;var i=l._getMatchingItem(t);if(i){l.world.removeItem(i)}}));this.update(a.viewport)};e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var t=new e.Point(this.container.clientWidth===0?1:this.container.clientWidth,this.container.clientHeight===0?1:this.container.clientHeight);if(!t.equals(this.oldContainerSize)){this.viewport.resize(t,true);this.viewport.goHome(true);this.oldContainerSize=t;this.drawer.clear();this.world.draw()}}},setWidth:function(e){this.width=e;this.element.style.width=typeof e==="number"?e+"px":e;this._resizeWithViewer=false;this.updateSize()},setHeight:function(e){this.height=e;this.element.style.height=typeof e==="number"?e+"px":e;this._resizeWithViewer=false;this.updateSize()},setFlip:function(e){this.viewport.setFlip(e);this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)");return this},setDisplayTransform:function(e){s(this.displayRegion,e);s(this.canvas,e);s(this.element,e)},update:function(t){var i,n,r,s,a,l;i=e.getElementSize(this.viewer.element);if(this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)){this.oldViewerSize=i;if(this.maintainSizeRatio||!this.elementArea){n=i.x*this.sizeRatio;r=i.y*this.sizeRatio}else{n=Math.sqrt(this.elementArea*(i.x/i.y));r=this.elementArea/n}this.element.style.width=Math.round(n)+"px";this.element.style.height=Math.round(r)+"px";if(!this.elementArea){this.elementArea=n*r}this.updateSize()}if(t&&this.viewport){s=t.getBoundsNoRotate(true);a=this.viewport.pixelFromPointNoRotate(s.getTopLeft(),false);l=this.viewport.pixelFromPointNoRotate(s.getBottomRight(),false).minus(this.totalBorderWidths);if(!this.navigatorRotate){var h=t.getRotation(true);o(this.displayRegion,-h)}var u=this.displayRegion.style;u.display=this.world.getItemCount()?"block":"none";u.top=a.y.toFixed(2)+"px";u.left=a.x.toFixed(2)+"px";var c=l.x-a.x;var d=l.y-a.y;u.width=Math.round(Math.max(c,0))+"px";u.height=Math.round(Math.max(d,0))+"px"}},addTiledImage:function(t){var i=this;var n=t.originalTiledImage;delete t.original;var r=e.extend({},t,{success:function(e){var t=e.item;t._originalForNavigator=n;i._matchBounds(t,n,true);i._matchOpacity(t,n);i._matchCompositeOperation(t,n);function r(){i._matchBounds(t,n)}function o(){i._matchOpacity(t,n)}function s(){i._matchCompositeOperation(t,n)}n.addHandler("bounds-change",r);n.addHandler("clip-change",r);n.addHandler("opacity-change",o);n.addHandler("composite-operation-change",s)}});return e.Viewer.prototype.addTiledImage.apply(this,[r])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(e){var t=this.world.getItemCount();var i;for(var n=0;n<t;n++){i=this.world.getItemAt(n);if(i._originalForNavigator===e){return i}}return null},_matchBounds:function(e,t,i){var n=t.getBoundsNoRotate();e.setPosition(n.getTopLeft(),i);e.setWidth(n.width,i);e.setRotation(t.getRotation(),i);e.setClip(t.getClip());e.setFlip(t.getFlip())},_matchOpacity:function(e,t){e.setOpacity(t.opacity)},_matchCompositeOperation:function(e,t){e.setCompositeOperation(t.compositeOperation)}});function t(e){var t={tracker:e.eventSource,position:e.position,quick:e.quick,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.viewer.raiseEvent("navigator-click",t);if(!t.preventDefaultAction&&e.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){if(this.viewer.viewport.flipped){e.position.x=this.viewport.getContainerSize().x-e.position.x}var i=this.viewport.pointFromPixel(e.position);if(!this.panVertical){i.y=this.viewer.viewport.getCenter(true).y}else if(!this.panHorizontal){i.x=this.viewer.viewport.getCenter(true).x}this.viewer.viewport.panTo(i);this.viewer.viewport.applyConstraints()}}function i(e){var t={tracker:e.eventSource,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:false};this.viewer.raiseEvent("navigator-drag",t);if(!t.preventDefaultAction&&this.viewer.viewport){if(!this.panHorizontal){e.delta.x=0}if(!this.panVertical){e.delta.y=0}if(this.viewer.viewport.flipped){e.delta.x=-e.delta.x}this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta));if(this.viewer.constrainDuringPan){this.viewer.viewport.applyConstraints()}}}function n(e){if(e.insideElementPressed&&this.viewer.viewport){this.viewer.viewport.applyConstraints()}}function r(e){var t={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefault:e.preventDefault};this.viewer.raiseEvent("navigator-scroll",t);e.preventDefault=t.preventDefault}function o(e,t){s(e,"rotate("+t+"deg)")}function s(e,t){e.style.webkitTransform=t;e.style.mozTransform=t;e.style.msTransform=t;e.style.oTransform=t;e.style.transform=t}})(t);(function(e){var t={Errors:{Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from "+"loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",OpenFailed:"Unable to open {0}: {1}"},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in",ZoomOut:"Zoom out",NextPage:"Next page",PreviousPage:"Previous page",RotateLeft:"Rotate left",RotateRight:"Rotate right",Flip:"Flip Horizontally"}};e.extend(e,{getString:function(i){var n=i.split("."),r=null,o=arguments,s=t,a;for(a=0;a<n.length-1;a++){s=s[n[a]]||{}}r=s[n[a]];if(typeof r!=="string"){e.console.error("Untranslated source string:",i);r=""}return r.replace(/\{\d+\}/g,(function(e){var t=parseInt(e.match(/\d+/),10)+1;return t<o.length?o[t]:""}))},setString:function(e,i){var n=e.split("."),r=t,o;for(o=0;o<n.length-1;o++){if(!r[n[o]]){r[n[o]]={}}r=r[n[o]]}r[n[o]]=i}})})(t);(function(e){e.Point=function(e,t){this.x=typeof e==="number"?e:0;this.y=typeof t==="number"?t:0};e.Point.prototype={clone:function(){return new e.Point(this.x,this.y)},plus:function(t){return new e.Point(this.x+t.x,this.y+t.y)},minus:function(t){return new e.Point(this.x-t.x,this.y-t.y)},times:function(t){return new e.Point(this.x*t,this.y*t)},divide:function(t){return new e.Point(this.x/t,this.y/t)},negate:function(){return new e.Point(-this.x,-this.y)},distanceTo:function(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))},squaredDistanceTo:function(e){return Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2)},apply:function(t){return new e.Point(t(this.x),t(this.y))},equals:function(t){return t instanceof e.Point&&this.x===t.x&&this.y===t.y},rotate:function(t,i){i=i||new e.Point(0,0);var n;var r;if(t%90===0){var o=e.positiveModulo(t,360);switch(o){case 0:n=1;r=0;break;case 90:n=0;r=1;break;case 180:n=-1;r=0;break;case 270:n=0;r=-1;break}}else{var s=t*Math.PI/180;n=Math.cos(s);r=Math.sin(s)}var a=n*(this.x-i.x)-r*(this.y-i.y)+i.x;var l=r*(this.x-i.x)+n*(this.y-i.y)+i.y;return new e.Point(a,l)},toString:function(){return"("+Math.round(this.x*100)/100+","+Math.round(this.y*100)/100+")"}}})(t);(function(e){e.TileSource=function(t,i,n,r,o,s){var a=this;var l=arguments,h,u;if(e.isPlainObject(t)){h=t}else{h={width:l[0],height:l[1],tileSize:l[2],tileOverlap:l[3],minLevel:l[4],maxLevel:l[5]}}e.EventSource.call(this);e.extend(true,this,h);if(!this.success){for(u=0;u<arguments.length;u++){if(e.isFunction(arguments[u])){this.success=arguments[u];break}}}if(this.success){this.addHandler("ready",(function(e){a.success(e)}))}if("string"===e.type(arguments[0])){this.url=arguments[0]}if(this.url){this.aspectRatio=1;this.dimensions=new e.Point(10,10);this._tileWidth=0;this._tileHeight=0;this.tileOverlap=0;this.minLevel=0;this.maxLevel=0;this.ready=false;this.getImageInfo(this.url)}else{this.ready=true;this.aspectRatio=h.width&&h.height?h.width/h.height:1;this.dimensions=new e.Point(h.width,h.height);if(this.tileSize){this._tileWidth=this._tileHeight=this.tileSize;delete this.tileSize}else{if(this.tileWidth){this._tileWidth=this.tileWidth;delete this.tileWidth}else{this._tileWidth=0}if(this.tileHeight){this._tileHeight=this.tileHeight;delete this.tileHeight}else{this._tileHeight=0}}this.tileOverlap=h.tileOverlap?h.tileOverlap:0;this.minLevel=h.minLevel?h.minLevel:0;this.maxLevel=undefined!==h.maxLevel&&null!==h.maxLevel?h.maxLevel:h.width&&h.height?Math.ceil(Math.log(Math.max(h.width,h.height))/Math.log(2)):0;if(this.success&&e.isFunction(this.success)){this.success(this)}}};e.TileSource.prototype={getTileSize:function(t){e.console.error("[TileSource.getTileSize] is deprecated. "+"Use TileSource.getTileWidth() and TileSource.getTileHeight() instead");return this._tileWidth},getTileWidth:function(e){if(!this._tileWidth){return this.getTileSize(e)}return this._tileWidth},getTileHeight:function(e){if(!this._tileHeight){return this.getTileSize(e)}return this._tileHeight},setMaxLevel:function(e){this.maxLevel=e;this._memoizeLevelScale()},getLevelScale:function(e){this._memoizeLevelScale();return this.getLevelScale(e)},_memoizeLevelScale:function(){var e={},t;for(t=0;t<=this.maxLevel;t++){e[t]=1/Math.pow(2,this.maxLevel-t)}this.getLevelScale=function(t){return e[t]}},getNumTiles:function(t){var i=this.getLevelScale(t),n=Math.ceil(i*this.dimensions.x/this.getTileWidth(t)),r=Math.ceil(i*this.dimensions.y/this.getTileHeight(t));return new e.Point(n,r)},getPixelRatio:function(t){var i=this.dimensions.times(this.getLevelScale(t)),n=1/i.x*e.pixelDensityRatio,r=1/i.y*e.pixelDensityRatio;return new e.Point(n,r)},getClosestLevel:function(){var e,t;for(e=this.minLevel+1;e<=this.maxLevel;e++){t=this.getNumTiles(e);if(t.x>1||t.y>1){break}}return e-1},getTileAtPoint:function(t,i){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;e.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var r=this.dimensions.x*this.getLevelScale(t);var o=i.x*r;var s=i.y*r;var a=Math.floor(o/this.getTileWidth(t));var l=Math.floor(s/this.getTileHeight(t));if(i.x>=1){a=this.getNumTiles(t).x-1}var h=1e-15;if(i.y>=1/this.aspectRatio-h){l=this.getNumTiles(t).y-1}return new e.Point(a,l)},getTileBounds:function(t,i,n,r){var o=this.dimensions.times(this.getLevelScale(t)),s=this.getTileWidth(t),a=this.getTileHeight(t),l=i===0?0:s*i-this.tileOverlap,h=n===0?0:a*n-this.tileOverlap,u=s+(i===0?1:2)*this.tileOverlap,c=a+(n===0?1:2)*this.tileOverlap,d=1/o.x;u=Math.min(u,o.x-l);c=Math.min(c,o.y-h);if(r){return new e.Rect(0,0,u,c)}return new e.Rect(l*d,h*d,u*d,c*d)},getImageInfo:function(t){var n=this,r,o,s,a,l,h,u;if(t){l=t.split("/");h=l[l.length-1];u=h.lastIndexOf(".");if(u>-1){l[l.length-1]=h.slice(0,u)}}var c=null;if(this.splitHashDataForPost){var d=t.indexOf("#");if(d!==-1){c=t.substring(d+1);t=t.substr(0,d)}}o=function(i){if(typeof i==="string"){i=e.parseXml(i)}var r=e.TileSource.determineType(n,i,t);if(!r){n.raiseEvent("open-failed",{message:"Unable to load TileSource",source:t});return}a=r.prototype.configure.apply(n,[i,t,c]);if(a.ajaxWithCredentials===undefined){a.ajaxWithCredentials=n.ajaxWithCredentials}s=new r(a);n.ready=true;n.raiseEvent("ready",{tileSource:s})};if(t.match(/\.js$/)){r=t.split("/").pop().replace(".js","");e.jsonp({url:t,async:false,callbackName:r,callback:o})}else{e.makeAjaxRequest({url:t,postData:c,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){var t=i(e);o(t)},error:function(i,r){var o;try{o="HTTP "+i.status+" attempting to load TileSource: "+t}catch(e){var s;if(typeof r==="undefined"||!r.toString){s="Unknown error"}else{s=r.toString()}o=s+" attempting to load TileSource: "+t}e.console.error(o);n.raiseEvent("open-failed",{message:o,source:t,postData:c})}})}},supports:function(e,t){return false},configure:function(e,t,i){throw new Error("Method not implemented.")},getTileUrl:function(e,t,i){throw new Error("Method not implemented.")},getTilePostData:function(e,t,i){return null},getTileAjaxHeaders:function(e,t,i){return{}},getTileHashKey:function(e,t,i,n,r,o){function s(e){return r?e+"+"+JSON.stringify(r):e}if(typeof n!=="string"){return s(e+"/"+t+"_"+i)}return s(n)},tileExists:function(e,t,i){var n=this.getNumTiles(e);return e>=this.minLevel&&e<=this.maxLevel&&t>=0&&i>=0&&t<n.x&&i<n.y},hasTransparency:function(e,t,i,n){return!!e||t.match(".png")},downloadTileStart:function(t){var i=t.userData,n=new Image;i.image=n;i.request=null;var r=function(e){if(!n){t.finish(null,i.request,"Image load failed: undefined Image instance.");return}n.onload=n.onerror=n.onabort=null;t.finish(e?null:n,i.request,e)};n.onload=function(){r()};n.onabort=n.onerror=function(){r("Image load aborted.")};if(t.loadWithAjax){i.request=e.makeAjaxRequest({url:t.src,withCredentials:t.ajaxWithCredentials,headers:t.ajaxHeaders,responseType:"arraybuffer",postData:t.postData,success:function(e){var t;try{t=new window.Blob([e.response])}catch(n){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n.name==="TypeError"&&i){var o=new i;o.append(e.response);t=o.getBlob()}}if(t.size===0){r("Empty image response.")}else{n.src=(window.URL||window.webkitURL).createObjectURL(t)}},error:function(e){r("Image load aborted - XHR error")}})}else{if(t.crossOriginPolicy!==false){n.crossOrigin=t.crossOriginPolicy}n.src=t.src}},downloadTileAbort:function(e){if(e.userData.request){e.userData.request.abort()}var t=e.userData.image;if(e.userData.image){t.onload=t.onerror=t.onabort=null}},createTileCache:function(e,t,i){e._data=t},destroyTileCache:function(e){e._data=null;e._renderedContext=null},getTileCacheData:function(e){return e._data},getTileCacheDataAsImage:function(e){return e._data},getTileCacheDataAsContext2D:function(e){if(!e._renderedContext){var t=document.createElement("canvas");t.width=e._data.width;t.height=e._data.height;e._renderedContext=t.getContext("2d");e._renderedContext.drawImage(e._data,0,0);e._data=null}return e._renderedContext}};e.extend(true,e.TileSource.prototype,e.EventSource.prototype);function i(t){var i=t.responseText,n=t.status,r,o;if(!t){throw new Error(e.getString("Errors.Security"))}else if(t.status!==200&&t.status!==0){n=t.status;r=n===404?"Not Found":t.statusText;throw new Error(e.getString("Errors.Status",n,r))}if(i.match(/^\s*<.*/)){try{o=t.responseXML&&t.responseXML.documentElement?t.responseXML:e.parseXml(i)}catch(e){o=t.responseText}}else if(i.match(/\s*[{[].*/)){try{o=e.parseJSON(i)}catch(e){o=i}}else{o=i}return o}e.TileSource.determineType=function(i,n,r){var o;for(o in t){if(o.match(/.+TileSource$/)&&e.isFunction(t[o])&&e.isFunction(t[o].prototype.supports)&&t[o].prototype.supports.call(i,n,r)){return t[o]}}e.console.error("No TileSource was able to open %s %s",r,n);return null}})(t);(function(e){e.DziTileSource=function(t,i,n,r,o,s,a,l,h){var u,c,d,p;if(e.isPlainObject(t)){p=t}else{p={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]}}this._levelRects={};this.tilesUrl=p.tilesUrl;this.fileFormat=p.fileFormat;this.displayRects=p.displayRects;if(this.displayRects){for(u=this.displayRects.length-1;u>=0;u--){c=this.displayRects[u];for(d=c.minLevel;d<=c.maxLevel;d++){if(!this._levelRects[d]){this._levelRects[d]=[]}this._levelRects[d].push(c)}}}e.TileSource.apply(this,[p])};e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){var i;if(e.Image){i=e.Image.xmlns}else if(e.documentElement){if("Image"===e.documentElement.localName||"Image"===e.documentElement.tagName){i=e.documentElement.namespaceURI}}i=(i||"").toLowerCase();return i.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||i.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(n,r,o){var s;if(!e.isPlainObject(n)){s=t(this,n)}else{s=i(this,n)}if(r&&!s.tilesUrl){s.tilesUrl=r.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/");if(r.search(/\.(dzi|xml|js)\?/)!==-1){s.queryParams=r.match(/\?.*/)}else{s.queryParams=""}}return s},getTileUrl:function(e,t,i){return[this.tilesUrl,e,"/",t,"_",i,".",this.fileFormat,this.queryParams].join("")},tileExists:function(e,t,i){var n=this._levelRects[e],r,o,s,a,l,h,u;if(this.minLevel&&e<this.minLevel||this.maxLevel&&e>this.maxLevel){return false}if(!n||!n.length){return true}for(u=n.length-1;u>=0;u--){r=n[u];if(e<r.minLevel||e>r.maxLevel){continue}o=this.getLevelScale(e);s=r.x*o;a=r.y*o;l=s+r.width*o;h=a+r.height*o;s=Math.floor(s/this._tileWidth);a=Math.floor(a/this._tileWidth);l=Math.ceil(l/this._tileWidth);h=Math.ceil(h/this._tileWidth);if(s<=t&&t<l&&a<=i&&i<h){return true}}return false}});function t(t,n){if(!n||!n.documentElement){throw new Error(e.getString("Errors.Xml"))}var r=n.documentElement,o=r.localName||r.tagName,s=n.documentElement.namespaceURI,a=null,l=[],h,u,c,d,p;if(o==="Image"){try{d=r.getElementsByTagName("Size")[0];if(d===undefined){d=r.getElementsByTagNameNS(s,"Size")[0]}a={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:r.getAttribute("Url"),Format:r.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(r.getAttribute("Overlap"),10),TileSize:parseInt(r.getAttribute("TileSize"),10),Size:{Height:parseInt(d.getAttribute("Height"),10),Width:parseInt(d.getAttribute("Width"),10)}}};if(!e.imageFormatSupported(a.Image.Format)){throw new Error(e.getString("Errors.ImageFormat",a.Image.Format.toUpperCase()))}h=r.getElementsByTagName("DisplayRect");if(h===undefined){h=r.getElementsByTagNameNS(s,"DisplayRect")[0]}for(p=0;p<h.length;p++){u=h[p];c=u.getElementsByTagName("Rect")[0];if(c===undefined){c=u.getElementsByTagNameNS(s,"Rect")[0]}l.push({Rect:{X:parseInt(c.getAttribute("X"),10),Y:parseInt(c.getAttribute("Y"),10),Width:parseInt(c.getAttribute("Width"),10),Height:parseInt(c.getAttribute("Height"),10),MinLevel:parseInt(u.getAttribute("MinLevel"),10),MaxLevel:parseInt(u.getAttribute("MaxLevel"),10)}})}if(l.length){a.Image.DisplayRect=l}return i(t,a)}catch(t){throw t instanceof Error?t:new Error(e.getString("Errors.Dzi"))}}else if(o==="Collection"){throw new Error(e.getString("Errors.Dzc"))}else if(o==="Error"){var f=r.getElementsByTagName("Message")[0];var g=f.firstChild.nodeValue;throw new Error(g)}throw new Error(e.getString("Errors.Dzi"))}function i(t,i){var n=i.Image,r=n.Url,o=n.Format,s=n.Size,a=n.DisplayRect||[],l=parseInt(s.Width,10),h=parseInt(s.Height,10),u=parseInt(n.TileSize,10),c=parseInt(n.Overlap,10),d=[],p,f;for(f=0;f<a.length;f++){p=a[f].Rect;d.push(new e.DisplayRect(parseInt(p.X,10),parseInt(p.Y,10),parseInt(p.Width,10),parseInt(p.Height,10),parseInt(p.MinLevel,10),parseInt(p.MaxLevel,10)))}return e.extend(true,{width:l,height:h,tileSize:u,tileOverlap:c,minLevel:null,maxLevel:null,tilesUrl:r,fileFormat:o,displayRects:d},i)}})(t);(function(e){e.IIIFTileSource=function(t){e.extend(true,this,t);this._id=this["@id"]||this["id"]||this["identifier"]||null;if(!(this.height&&this.width&&this._id)){throw new Error("IIIF required parameters (width, height, or id) not provided.")}t.tileSizePerScaleFactor={};this.tileFormat=this.tileFormat||"jpg";this.version=t.version;if(this.tile_width&&this.tile_height){t.tileWidth=this.tile_width;t.tileHeight=this.tile_height}else if(this.tile_width){t.tileSize=this.tile_width}else if(this.tile_height){t.tileSize=this.tile_height}else if(this.tiles){if(this.tiles.length===1){t.tileWidth=this.tiles[0].width;t.tileHeight=this.tiles[0].height||this.tiles[0].width;this.scale_factors=this.tiles[0].scaleFactors}else{this.scale_factors=[];for(var r=0;r<this.tiles.length;r++){for(var o=0;o<this.tiles[r].scaleFactors.length;o++){var s=this.tiles[r].scaleFactors[o];this.scale_factors.push(s);t.tileSizePerScaleFactor[s]={width:this.tiles[r].width,height:this.tiles[r].height||this.tiles[r].width}}}}}else if(i(t)){var a=Math.min(this.height,this.width),l=[256,512,1024],h=[];for(var u=0;u<l.length;u++){if(l[u]<=a){h.push(l[u])}}if(h.length>0){t.tileSize=Math.max.apply(null,h)}else{t.tileSize=a}}else if(this.sizes&&this.sizes.length>0){this.emulateLegacyImagePyramid=true;t.levels=n(this);e.extend(true,t,{width:t.levels[t.levels.length-1].width,height:t.levels[t.levels.length-1].height,tileSize:Math.max(t.height,t.width),tileOverlap:0,minLevel:0,maxLevel:t.levels.length-1});this.levels=t.levels}else{e.console.error("Nothing in the info.json to construct image pyramids from")}if(!t.maxLevel&&!this.emulateLegacyImagePyramid){if(!this.scale_factors){t.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)))}else{var c=Math.max.apply(null,this.scale_factors);t.maxLevel=Math.round(Math.log(c)*Math.LOG2E)}}if(this.sizes){var d=this.sizes.length;if(d===t.maxLevel||d===t.maxLevel+1){this.levelSizes=this.sizes.slice().sort((function(e,t){return e.width-t.width}));if(d===t.maxLevel){this.levelSizes.push({width:this.width,height:this.height})}}}e.TileSource.apply(this,[t])};e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){if(e.protocol&&e.protocol==="http://iiif.io/api/image"){return true}else if(e["@context"]&&(e["@context"]==="http://library.stanford.edu/iiif/image-api/1.1/context.json"||e["@context"]==="http://iiif.io/api/image/1/context.json")){return true}else if(e.profile&&e.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0){return true}else if(e.identifier&&e.width&&e.height){return true}else if(e.documentElement&&"info"===e.documentElement.tagName&&"http://library.stanford.edu/iiif/image-api/ns/"===e.documentElement.namespaceURI){return true}else{return false}},configure:function(i,n,o){if(!e.isPlainObject(i)){var s=r(i);s["@context"]="http://iiif.io/api/image/1.0/context.json";s["@id"]=n.replace("/info.xml","");s.version=1;return s}else{if(!i["@context"]){i["@context"]="http://iiif.io/api/image/1.0/context.json";i["@id"]=n.replace("/info.json","");i.version=1}else{var a=i["@context"];if(Array.isArray(a)){for(var l=0;l<a.length;l++){if(typeof a[l]==="string"&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(a[l])||a[l]==="http://library.stanford.edu/iiif/image-api/1.1/context.json")){a=a[l];break}}}switch(a){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":i.version=1;break;case"http://iiif.io/api/image/2/context.json":i.version=2;break;case"http://iiif.io/api/image/3/context.json":i.version=3;break;default:e.console.error("Data has a @context property which contains no known IIIF context URI.")}}if(i.preferredFormats){for(var h=0;h<i.preferredFormats.length;h++){if(t.imageFormatSupported(i.preferredFormats[h])){i.tileFormat=i.preferredFormats[h];break}}}return i}},getTileWidth:function(t){if(this.emulateLegacyImagePyramid){return e.TileSource.prototype.getTileWidth.call(this,t)}var i=Math.pow(2,this.maxLevel-t);if(this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]){return this.tileSizePerScaleFactor[i].width}return this._tileWidth},getTileHeight:function(t){if(this.emulateLegacyImagePyramid){return e.TileSource.prototype.getTileHeight.call(this,t)}var i=Math.pow(2,this.maxLevel-t);if(this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]){return this.tileSizePerScaleFactor[i].height}return this._tileHeight},getLevelScale:function(t){if(this.emulateLegacyImagePyramid){var i=NaN;if(this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel){i=this.levels[t].width/this.levels[this.maxLevel].width}return i}return e.TileSource.prototype.getLevelScale.call(this,t)},getNumTiles:function(t){if(this.emulateLegacyImagePyramid){var i=this.getLevelScale(t);if(i){return new e.Point(1,1)}else{return new e.Point(0,0)}}if(this.levelSizes){var n=this.levelSizes[t];var r=Math.ceil(n.width/this.getTileWidth(t)),o=Math.ceil(n.height/this.getTileHeight(t));return new e.Point(r,o)}else{return e.TileSource.prototype.getNumTiles.call(this,t)}},getTileAtPoint:function(t,i){if(this.emulateLegacyImagePyramid){return new e.Point(0,0)}if(this.levelSizes){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;e.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var r=this.levelSizes[t].width;var o=i.x*r;var s=i.y*r;var a=Math.floor(o/this.getTileWidth(t));var l=Math.floor(s/this.getTileHeight(t));if(i.x>=1){a=this.getNumTiles(t).x-1}var h=1e-15;if(i.y>=1/this.aspectRatio-h){l=this.getNumTiles(t).y-1}return new e.Point(a,l)}return e.TileSource.prototype.getTileAtPoint.call(this,t,i)},getTileUrl:function(e,t,i){if(this.emulateLegacyImagePyramid){var n=null;if(this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].url}return n}var r="0",o=Math.pow(.5,this.maxLevel-e),s,a,l,h,u,c,d,p,f,g,v,m,y,w,T,x;if(this.levelSizes){s=this.levelSizes[e].width;a=this.levelSizes[e].height}else{s=Math.ceil(this.width*o);a=Math.ceil(this.height*o)}l=this.getTileWidth(e);h=this.getTileHeight(e);u=Math.round(l/o);c=Math.round(h/o);if(this.version===1){T="native."+this.tileFormat}else{T="default."+this.tileFormat}if(s<l&&a<h){if(this.version===2&&s===this.width){m="full"}else if(this.version===3&&s===this.width&&a===this.height){m="max"}else if(this.version===3){m=s+","+a}else{m=s+","}d="full"}else{p=t*u;f=i*c;g=Math.min(u,this.width-p);v=Math.min(c,this.height-f);if(t===0&&i===0&&g===this.width&&v===this.height){d="full"}else{d=[p,f,g,v].join(",")}y=Math.min(l,s-t*l);w=Math.min(h,a-i*h);if(this.version===2&&y===this.width){m="full"}else if(this.version===3&&y===this.width&&w===this.height){m="max"}else if(this.version===3){m=y+","+w}else{m=y+","}}x=[this._id,d,m,r,T].join("/");return x},__testonly__:{canBeTiled:i,constructLevels:n}});function i(e){var t=["http://library.stanford.edu/iiif/image-api/compliance.html#level0","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0","http://iiif.io/api/image/2/level0.json","level0","https://iiif.io/api/image/3/level0.json"];var i=Array.isArray(e.profile)?e.profile[0]:e.profile;var n=t.indexOf(i)!==-1;var r=false;if(e.version===2&&e.profile.length>1&&e.profile[1].supports){r=e.profile[1].supports.indexOf("sizeByW")!==-1}if(e.version===3&&e.extraFeatures){r=e.extraFeatures.indexOf("sizeByWh")!==-1}return!n||r}function n(e){var t=[];for(var i=0;i<e.sizes.length;i++){t.push({url:e._id+"/full/"+e.sizes[i].width+","+(e.version===3?e.sizes[i].height:"")+"/0/default."+e.tileFormat,width:e.sizes[i].width,height:e.sizes[i].height})}return t.sort((function(e,t){return e.width-t.width}))}function r(t){if(!t||!t.documentElement){throw new Error(e.getString("Errors.Xml"))}var i=t.documentElement,n=i.tagName,r=null;if(n==="info"){try{r={};o(i,r);return r}catch(t){throw t instanceof Error?t:new Error(e.getString("Errors.IIIF"))}}throw new Error(e.getString("Errors.IIIF"))}function o(t,i,n){var r,s;if(t.nodeType===3&&n){s=t.nodeValue.trim();if(s.match(/^\d*$/)){s=Number(s)}if(!i[n]){i[n]=s}else{if(!e.isArray(i[n])){i[n]=[i[n]]}i[n].push(s)}}else if(t.nodeType===1){for(r=0;r<t.childNodes.length;r++){o(t.childNodes[r],i,t.nodeName)}}}})(t);(function(e){e.OsmTileSource=function(t,i,n,r,o){var s;if(e.isPlainObject(t)){s=t}else{s={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}}if(!s.width||!s.height){s.width=65572864;s.height=65572864}if(!s.tileSize){s.tileSize=256;s.tileOverlap=0}if(!s.tilesUrl){s.tilesUrl="http://tile.openstreetmap.org/"}s.minLevel=8;e.TileSource.apply(this,[s])};e.extend(e.OsmTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"openstreetmaps"===e.type},configure:function(e,t,i){return e},getTileUrl:function(e,t,i){return this.tilesUrl+(e-8)+"/"+t+"/"+i+".png"}})})(t);(function(e){e.TmsTileSource=function(t,i,n,r,o){var s;if(e.isPlainObject(t)){s=t}else{s={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}}var a=Math.ceil(s.width/256)*256,l=Math.ceil(s.height/256)*256,h;if(a>l){h=a/256}else{h=l/256}s.maxLevel=Math.ceil(Math.log(h)/Math.log(2))-1;s.tileSize=256;s.width=a;s.height=l;e.TileSource.apply(this,[s])};e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"tiledmapservice"===e.type},configure:function(e,t,i){return e},getTileUrl:function(e,t,i){var n=this.getNumTiles(e).y-1;return this.tilesUrl+e+"/"+t+"/"+(n-i)+".png"}})})(t);(function(e){e.ZoomifyTileSource=function(e){if(typeof e.tileSize==="undefined"){e.tileSize=256}if(typeof e.fileFormat==="undefined"){e.fileFormat="jpg";this.fileFormat=e.fileFormat}var i={x:e.width,y:e.height};e.imageSizes=[{x:e.width,y:e.height}];e.gridSize=[this._getGridSize(e.width,e.height,e.tileSize)];while(parseInt(i.x,10)>e.tileSize||parseInt(i.y,10)>e.tileSize){i.x=Math.floor(i.x/2);i.y=Math.floor(i.y/2);e.imageSizes.push({x:i.x,y:i.y});e.gridSize.push(this._getGridSize(i.x,i.y,e.tileSize))}e.imageSizes.reverse();e.gridSize.reverse();e.minLevel=0;e.maxLevel=e.gridSize.length-1;t.TileSource.apply(this,[e])};e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(e,t,i){return{x:Math.ceil(e/i),y:Math.ceil(t/i)}},_calculateAbsoluteTileNumber:function(e,t,i){var n=0;var r={};for(var o=0;o<e;o++){r=this.gridSize[o];n+=r.x*r.y}r=this.gridSize[e];n+=r.x*i+t;return n},supports:function(e,t){return e.type&&"zoomifytileservice"===e.type},configure:function(e,t,i){return e},getTileUrl:function(e,t,i){var n=0;var r=this._calculateAbsoluteTileNumber(e,t,i);n=Math.floor(r/256);return this.tilesUrl+"TileGroup"+n+"/"+e+"-"+t+"-"+i+"."+this.fileFormat}})})(t);(function(e){e.LegacyTileSource=function(i){var n,r,o;if(e.isArray(i)){n={type:"legacy-image-pyramid",levels:i}}n.levels=t(n.levels);if(n.levels.length>0){r=n.levels[n.levels.length-1].width;o=n.levels[n.levels.length-1].height}else{r=0;o=0;e.console.error("No supported image formats found")}e.extend(true,n,{width:r,height:o,tileSize:Math.max(o,r),tileOverlap:0,minLevel:0,maxLevel:n.levels.length>0?n.levels.length-1:0});e.TileSource.apply(this,[n]);this.levels=n.levels};e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"legacy-image-pyramid"===e.type||e.documentElement&&"legacy-image-pyramid"===e.documentElement.getAttribute("type")},configure:function(t,r,o){var s;if(!e.isPlainObject(t)){s=i(this,t)}else{s=n(this,t)}return s},getLevelScale:function(e){var t=NaN;if(this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel){t=this.levels[e].width/this.levels[this.maxLevel].width}return t},getNumTiles:function(t){var i=this.getLevelScale(t);if(i){return new e.Point(1,1)}else{return new e.Point(0,0)}},getTileUrl:function(e,t,i){var n=null;if(this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].url}return n}});function t(t){var i=[],n,r;for(r=0;r<t.length;r++){n=t[r];if(n.height&&n.width&&n.url){i.push({url:n.url,width:Number(n.width),height:Number(n.height)})}else{e.console.error("Unsupported image format: %s",n.url?n.url:"<no URL>")}}return i.sort((function(e,t){return e.height-t.height}))}function i(t,i){if(!i||!i.documentElement){throw new Error(e.getString("Errors.Xml"))}var r=i.documentElement,o=r.tagName,s=null,a=[],l,h;if(o==="image"){try{s={type:r.getAttribute("type"),levels:[]};a=r.getElementsByTagName("level");for(h=0;h<a.length;h++){l=a[h];s.levels.push({url:l.getAttribute("url"),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10)})}return n(t,s)}catch(e){throw e instanceof Error?e:new Error("Unknown error parsing Legacy Image Pyramid XML.")}}else if(o==="collection"){throw new Error("Legacy Image Pyramid Collections not yet supported.")}else if(o==="error"){throw new Error("Error: "+i)}throw new Error("Unknown element "+o)}function n(e,t){return t.levels}})(t);(function(e){e.ImageTileSource=function(t){t=e.extend({buildPyramid:true,crossOriginPolicy:false,ajaxWithCredentials:false,useCanvas:true},t);e.TileSource.apply(this,[t])};e.extend(e.ImageTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&e.type==="image"},configure:function(e,t,i){return e},getImageInfo:function(t){var i=this._image=new Image;var n=this;if(this.crossOriginPolicy){i.crossOrigin=this.crossOriginPolicy}if(this.ajaxWithCredentials){i.useCredentials=this.ajaxWithCredentials}e.addEvent(i,"load",(function(){n.width=i.naturalWidth;n.height=i.naturalHeight;n.aspectRatio=n.width/n.height;n.dimensions=new e.Point(n.width,n.height);n._tileWidth=n.width;n._tileHeight=n.height;n.tileOverlap=0;n.minLevel=0;n.levels=n._buildLevels();n.maxLevel=n.levels.length-1;n.ready=true;n.raiseEvent("ready",{tileSource:n})}));e.addEvent(i,"error",(function(){n.raiseEvent("open-failed",{message:"Error loading image at "+t,source:t})}));i.src=t},getLevelScale:function(e){var t=NaN;if(e>=this.minLevel&&e<=this.maxLevel){t=this.levels[e].width/this.levels[this.maxLevel].width}return t},getNumTiles:function(t){var i=this.getLevelScale(t);if(i){return new e.Point(1,1)}else{return new e.Point(0,0)}},getTileUrl:function(e,t,i){var n=null;if(e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].url}return n},getContext2D:function(e,t,i){var n=null;if(e>=this.minLevel&&e<=this.maxLevel){n=this.levels[e].context2D}return n},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var t=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas){delete this._image;return t}var i=this._image.naturalWidth;var n=this._image.naturalHeight;var r=document.createElement("canvas");var o=r.getContext("2d");r.width=i;r.height=n;o.drawImage(this._image,0,0,i,n);t[0].context2D=o;delete this._image;if(e.isCanvasTainted(r)){return t}while(i>=2&&n>=2){i=Math.floor(i/2);n=Math.floor(n/2);var s=document.createElement("canvas");var a=s.getContext("2d");s.width=i;s.height=n;a.drawImage(r,0,0,i,n);t.splice(0,0,{context2D:a,width:i,height:n});r=s;o=a}return t},_freeupCanvasMemory:function(){for(var e=0;e<this.levels.length;e++){if(this.levels[e].context2D){this.levels[e].context2D.canvas.height=0;this.levels[e].context2D.canvas.width=0}}}})})(t);(function(e){e.TileSourceCollection=function(t,i,n,r){e.console.error("TileSourceCollection is deprecated; use World instead")}})(t);(function(e){e.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3};e.Button=function(t){var i=this;e.EventSource.call(this);e.extend(true,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},t);this.element=t.element||e.makeNeutralElement("div");if(!t.element){this.imgRest=e.makeTransparentImage(this.srcRest);this.imgGroup=e.makeTransparentImage(this.srcGroup);this.imgHover=e.makeTransparentImage(this.srcHover);this.imgDown=e.makeTransparentImage(this.srcDown);this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip;e.setElementPointerEventsNone(this.imgRest);e.setElementPointerEventsNone(this.imgGroup);e.setElementPointerEventsNone(this.imgHover);e.setElementPointerEventsNone(this.imgDown);this.element.style.position="relative";e.setElementTouchActionNone(this.element);this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute";this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px";this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px";this.imgHover.style.visibility=this.imgDown.style.visibility="hidden";if(e.Browser.vendor===e.BROWSERS.FIREFOX&&e.Browser.version<3){this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=""}this.element.appendChild(this.imgRest);this.element.appendChild(this.imgGroup);this.element.appendChild(this.imgHover);this.element.appendChild(this.imgDown)}this.addHandler("press",this.onPress);this.addHandler("release",this.onRelease);this.addHandler("click",this.onClick);this.addHandler("enter",this.onEnter);this.addHandler("exit",this.onExit);this.addHandler("focus",this.onFocus);this.addHandler("blur",this.onBlur);this.currentState=e.ButtonState.GROUP;this.fadeBeginTime=null;this.shouldFade=false;this.element.style.display="inline-block";this.element.style.position="relative";this.element.title=this.tooltip;this.tracker=new e.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){if(t.insideElementPressed){o(i,e.ButtonState.DOWN);i.raiseEvent("enter",{originalEvent:t.originalEvent})}else if(!t.buttonDownAny){o(i,e.ButtonState.HOVER)}},focusHandler:function(e){i.tracker.enterHandler(e);i.raiseEvent("focus",{originalEvent:e.originalEvent})},leaveHandler:function(t){s(i,e.ButtonState.GROUP);if(t.insideElementPressed){i.raiseEvent("exit",{originalEvent:t.originalEvent})}},blurHandler:function(e){i.tracker.leaveHandler(e);i.raiseEvent("blur",{originalEvent:e.originalEvent})},pressHandler:function(t){o(i,e.ButtonState.DOWN);i.raiseEvent("press",{originalEvent:t.originalEvent})},releaseHandler:function(t){if(t.insideElementPressed&&t.insideElementReleased){s(i,e.ButtonState.HOVER);i.raiseEvent("release",{originalEvent:t.originalEvent})}else if(t.insideElementPressed){s(i,e.ButtonState.GROUP)}else{o(i,e.ButtonState.HOVER)}},clickHandler:function(e){if(e.quick){i.raiseEvent("click",{originalEvent:e.originalEvent})}},keyHandler:function(e){if(13===e.keyCode){i.raiseEvent("click",{originalEvent:e.originalEvent});i.raiseEvent("release",{originalEvent:e.originalEvent});e.preventDefault=true}else{e.preventDefault=false}}});s(this,e.ButtonState.REST)};e.extend(e.Button.prototype,e.EventSource.prototype,{notifyGroupEnter:function(){o(this,e.ButtonState.GROUP)},notifyGroupExit:function(){s(this,e.ButtonState.REST)},disable:function(){this.notifyGroupExit();this.element.disabled=true;this.tracker.setTracking(false);e.setElementOpacity(this.element,.2,true)},enable:function(){this.element.disabled=false;this.tracker.setTracking(true);e.setElementOpacity(this.element,1,true);this.notifyGroupEnter()},destroy:function(){if(this.imgRest){this.element.removeChild(this.imgRest);this.imgRest=null}if(this.imgGroup){this.element.removeChild(this.imgGroup);this.imgGroup=null}if(this.imgHover){this.element.removeChild(this.imgHover);this.imgHover=null}if(this.imgDown){this.element.removeChild(this.imgDown);this.imgDown=null}this.removeAllHandlers();this.tracker.destroy();this.element=null}});function t(t){e.requestAnimationFrame((function(){i(t)}))}function i(i){var n,r,o;if(i.shouldFade){n=e.now();r=n-i.fadeBeginTime;o=1-r/i.fadeLength;o=Math.min(1,o);o=Math.max(0,o);if(i.imgGroup){e.setElementOpacity(i.imgGroup,o,true)}if(o>0){t(i)}}}function n(i){i.shouldFade=true;i.fadeBeginTime=e.now()+i.fadeDelay;window.setTimeout((function(){t(i)}),i.fadeDelay)}function r(t){t.shouldFade=false;if(t.imgGroup){e.setElementOpacity(t.imgGroup,1,true)}}function o(t,i){if(t.element.disabled){return}if(i>=e.ButtonState.GROUP&&t.currentState===e.ButtonState.REST){r(t);t.currentState=e.ButtonState.GROUP}if(i>=e.ButtonState.HOVER&&t.currentState===e.ButtonState.GROUP){if(t.imgHover){t.imgHover.style.visibility=""}t.currentState=e.ButtonState.HOVER}if(i>=e.ButtonState.DOWN&&t.currentState===e.ButtonState.HOVER){if(t.imgDown){t.imgDown.style.visibility=""}t.currentState=e.ButtonState.DOWN}}function s(t,i){if(t.element.disabled){return}if(i<=e.ButtonState.HOVER&&t.currentState===e.ButtonState.DOWN){if(t.imgDown){t.imgDown.style.visibility="hidden"}t.currentState=e.ButtonState.HOVER}if(i<=e.ButtonState.GROUP&&t.currentState===e.ButtonState.HOVER){if(t.imgHover){t.imgHover.style.visibility="hidden"}t.currentState=e.ButtonState.GROUP}if(i<=e.ButtonState.REST&&t.currentState===e.ButtonState.GROUP){n(t);t.currentState=e.ButtonState.REST}}})(t);(function(e){e.ButtonGroup=function(t){e.extend(true,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},t);var i=this.buttons.concat([]),n=this,r;this.element=t.element||e.makeNeutralElement("div");if(!t.group){this.element.style.display="inline-block";for(r=0;r<i.length;r++){this.element.appendChild(i[r].element)}}e.setElementTouchActionNone(this.element);this.tracker=new e.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(e){var t;for(t=0;t<n.buttons.length;t++){n.buttons[t].notifyGroupEnter()}},leaveHandler:function(e){var t;if(!e.insideElementPressed){for(t=0;t<n.buttons.length;t++){n.buttons[t].notifyGroupExit()}}}})};e.ButtonGroup.prototype={addButton:function(e){this.buttons.push(e);this.element.appendChild(e.element)},emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){while(this.buttons.length){var e=this.buttons.pop();this.element.removeChild(e.element);e.destroy()}this.tracker.destroy();this.element=null}}})(t);(function(e){e.Rect=function(t,i,n,r,o){this.x=typeof t==="number"?t:0;this.y=typeof i==="number"?i:0;this.width=typeof n==="number"?n:0;this.height=typeof r==="number"?r:0;this.degrees=typeof o==="number"?o:0;this.degrees=e.positiveModulo(this.degrees,360);var s,a;if(this.degrees>=270){s=this.getTopRight();this.x=s.x;this.y=s.y;a=this.height;this.height=this.width;this.width=a;this.degrees-=270}else if(this.degrees>=180){s=this.getBottomRight();this.x=s.x;this.y=s.y;this.degrees-=180}else if(this.degrees>=90){s=this.getBottomLeft();this.x=s.x;this.y=s.y;a=this.height;this.height=this.width;this.width=a;this.degrees-=90}};e.Rect.fromSummits=function(t,i,n){var r=t.distanceTo(i);var o=t.distanceTo(n);var s=i.minus(t);var a=Math.atan(s.y/s.x);if(s.x<0){a+=Math.PI}else if(s.y<0){a+=2*Math.PI}return new e.Rect(t.x,t.y,r,o,a/Math.PI*180)};e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(t){return t instanceof e.Rect&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height&&this.degrees===t.degrees},times:function(t){return new e.Rect(this.x*t,this.y*t,this.width*t,this.height*t,this.degrees)},translate:function(t){return new e.Rect(this.x+t.x,this.y+t.y,this.width,this.height,this.degrees)},union:function(t){var i=this.getBoundingBox();var n=t.getBoundingBox();var r=Math.min(i.x,n.x);var o=Math.min(i.y,n.y);var s=Math.max(i.x+i.width,n.x+n.width);var a=Math.max(i.y+i.height,n.y+n.height);return new e.Rect(r,o,s-r,a-o)},intersection:function(t){var i=1e-10;var n=[];var r=this.getTopLeft();if(t.containsPoint(r,i)){n.push(r)}var o=this.getTopRight();if(t.containsPoint(o,i)){n.push(o)}var s=this.getBottomLeft();if(t.containsPoint(s,i)){n.push(s)}var a=this.getBottomRight();if(t.containsPoint(a,i)){n.push(a)}var l=t.getTopLeft();if(this.containsPoint(l,i)){n.push(l)}var h=t.getTopRight();if(this.containsPoint(h,i)){n.push(h)}var u=t.getBottomLeft();if(this.containsPoint(u,i)){n.push(u)}var c=t.getBottomRight();if(this.containsPoint(c,i)){n.push(c)}var d=this._getSegments();var p=t._getSegments();for(var f=0;f<d.length;f++){var g=d[f];for(var v=0;v<p.length;v++){var m=p[v];var y=w(g[0],g[1],m[0],m[1]);if(y){n.push(y)}}}function w(t,n,r,o){var s=n.minus(t);var a=o.minus(r);var l=-a.x*s.y+s.x*a.y;if(l===0){return null}var h=(s.x*(t.y-r.y)-s.y*(t.x-r.x))/l;var u=(a.x*(t.y-r.y)-a.y*(t.x-r.x))/l;if(-i<=h&&h<=1-i&&-i<=u&&u<=1-i){return new e.Point(t.x+u*s.x,t.y+u*s.y)}return null}if(n.length===0){return null}var T=n[0].x;var x=n[0].x;var S=n[0].y;var E=n[0].y;for(var P=1;P<n.length;P++){var _=n[P];if(_.x<T){T=_.x}if(_.x>x){x=_.x}if(_.y<S){S=_.y}if(_.y>E){E=_.y}}return new e.Rect(T,S,x-T,E-S)},_getSegments:function(){var e=this.getTopLeft();var t=this.getTopRight();var i=this.getBottomLeft();var n=this.getBottomRight();return[[e,t],[t,n],[n,i],[i,e]]},rotate:function(t,i){t=e.positiveModulo(t,360);if(t===0){return this.clone()}i=i||this.getCenter();var n=this.getTopLeft().rotate(t,i);var r=this.getTopRight().rotate(t,i);var o=r.minus(n);o=o.apply((function(e){var t=1e-15;return Math.abs(e)<t?0:e}));var s=Math.atan(o.y/o.x);if(o.x<0){s+=Math.PI}else if(o.y<0){s+=2*Math.PI}return new e.Rect(n.x,n.y,this.width,this.height,s/Math.PI*180)},getBoundingBox:function(){if(this.degrees===0){return this.clone()}var t=this.getTopLeft();var i=this.getTopRight();var n=this.getBottomLeft();var r=this.getBottomRight();var o=Math.min(t.x,i.x,n.x,r.x);var s=Math.max(t.x,i.x,n.x,r.x);var a=Math.min(t.y,i.y,n.y,r.y);var l=Math.max(t.y,i.y,n.y,r.y);return new e.Rect(o,a,s-o,l-a)},getIntegerBoundingBox:function(){var t=this.getBoundingBox();var i=Math.floor(t.x);var n=Math.floor(t.y);var r=Math.ceil(t.width+t.x-i);var o=Math.ceil(t.height+t.y-n);return new e.Rect(i,n,r,o)},containsPoint:function(e,t){t=t||0;var i=this.getTopLeft();var n=this.getTopRight();var r=this.getBottomLeft();var o=n.minus(i);var s=r.minus(i);return(e.x-i.x)*o.x+(e.y-i.y)*o.y>=-t&&(e.x-n.x)*o.x+(e.y-n.y)*o.y<=t&&(e.x-i.x)*s.x+(e.y-i.y)*s.y>=-t&&(e.x-r.x)*s.x+(e.y-r.y)*s.y<=t},toString:function(){return"["+Math.round(this.x*100)/100+", "+Math.round(this.y*100)/100+", "+Math.round(this.width*100)/100+"x"+Math.round(this.height*100)/100+", "+Math.round(this.degrees*100)/100+"deg"+"]"}}})(t);(function(e){var t={};e.ReferenceStrip=function(u){var c=this,d=u.viewer,p=e.getElementSize(d.element),f,g,v;if(!u.id){u.id="referencestrip-"+e.now();this.element=e.makeNeutralElement("div");this.element.id=u.id;this.element.className="referencestrip"}u=e.extend(true,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},u,{element:this.element});e.extend(this,u);t[this.id]={animating:false};this.minPixelRatio=this.viewer.minPixelRatio;this.element.tabIndex=0;g=this.element.style;g.marginTop="0px";g.marginRight="0px";g.marginBottom="0px";g.marginLeft="0px";g.left="0px";g.bottom="0px";g.border="0px";g.background="#000";g.position="relative";e.setElementTouchActionNone(this.element);e.setElementOpacity(this.element,.8);this.viewer=d;this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,i),dragHandler:e.delegate(this,n),scrollHandler:e.delegate(this,r),enterHandler:e.delegate(this,s),leaveHandler:e.delegate(this,a),keyDownHandler:e.delegate(this,l),keyHandler:e.delegate(this,h),preProcessEventHandler:function(e){if(e.eventType==="wheel"){e.preventDefault=true}}});if(u.width&&u.height){this.element.style.width=u.width+"px";this.element.style.height=u.height+"px";d.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})}else{if("horizontal"===u.scroll){this.element.style.width=p.x*u.sizeRatio*d.tileSources.length+12*d.tileSources.length+"px";this.element.style.height=p.y*u.sizeRatio+"px";d.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})}else{this.element.style.height=p.y*u.sizeRatio*d.tileSources.length+12*d.tileSources.length+"px";this.element.style.width=p.x*u.sizeRatio+"px";d.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})}}this.panelWidth=p.x*this.sizeRatio+8;this.panelHeight=p.y*this.sizeRatio+8;this.panels=[];this.miniViewers={};for(v=0;v<d.tileSources.length;v++){f=e.makeNeutralElement("div");f.id=this.element.id+"-"+v;f.style.width=c.panelWidth+"px";f.style.height=c.panelHeight+"px";f.style.display="inline";f.style["float"]="left";f.style.cssFloat="left";f.style.styleFloat="left";f.style.padding="2px";e.setElementTouchActionNone(f);e.setElementPointerEventsNone(f);this.element.appendChild(f);f.activePanel=false;this.panels.push(f)}o(this,this.scroll==="vertical"?p.y:p.x,0);this.setFocus(0)};e.ReferenceStrip.prototype={setFocus:function(t){var i=this.element.querySelector("#"+this.element.id+"-"+t),n=e.getElementSize(this.viewer.canvas),r=Number(this.element.style.width.replace("px","")),a=Number(this.element.style.height.replace("px","")),l=-Number(this.element.style.marginLeft.replace("px","")),h=-Number(this.element.style.marginTop.replace("px","")),u;if(this.currentSelected!==i){if(this.currentSelected){this.currentSelected.style.background="#000"}this.currentSelected=i;this.currentSelected.style.background="#999";if("horizontal"===this.scroll){u=Number(t)*(this.panelWidth+3);if(u>l+n.x-this.panelWidth){u=Math.min(u,r-n.x);this.element.style.marginLeft=-u+"px";o(this,n.x,-u)}else if(u<l){u=Math.max(0,u-n.x/2);this.element.style.marginLeft=-u+"px";o(this,n.x,-u)}}else{u=Number(t)*(this.panelHeight+3);if(u>h+n.y-this.panelHeight){u=Math.min(u,a-n.y);this.element.style.marginTop=-u+"px";o(this,n.y,-u)}else if(u<h){u=Math.max(0,u-n.y/2);this.element.style.marginTop=-u+"px";o(this,n.y,-u)}}this.currentPage=t;s.call(this,{eventSource:this.tracker})}},update:function(){if(t[this.id].animating){return true}return false},destroy:function(){if(this.miniViewers){for(var e in this.miniViewers){this.miniViewers[e].destroy()}}this.tracker.destroy();if(this.element){this.viewer.removeControl(this.element)}}};function i(e){if(e.quick){var t;if("horizontal"===this.scroll){t=Math.floor(e.position.x/(this.panelWidth+4))}else{t=Math.floor(e.position.y/this.panelHeight)}this.viewer.goToPage(t)}this.element.focus()}function n(t){this.dragging=true;if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),r=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=e.getElementSize(this.viewer.canvas);if("horizontal"===this.scroll){if(-t.delta.x>0){if(i>-(r-a.x)){this.element.style.marginLeft=i+t.delta.x*2+"px";o(this,a.x,i+t.delta.x*2)}}else if(-t.delta.x<0){if(i<0){this.element.style.marginLeft=i+t.delta.x*2+"px";o(this,a.x,i+t.delta.x*2)}}}else{if(-t.delta.y>0){if(n>-(s-a.y)){this.element.style.marginTop=n+t.delta.y*2+"px";o(this,a.y,n+t.delta.y*2)}}else if(-t.delta.y<0){if(n<0){this.element.style.marginTop=n+t.delta.y*2+"px";o(this,a.y,n+t.delta.y*2)}}}}}function r(t){if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),r=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=e.getElementSize(this.viewer.canvas);if("horizontal"===this.scroll){if(t.scroll>0){if(i>-(r-a.x)){this.element.style.marginLeft=i-t.scroll*60+"px";o(this,a.x,i-t.scroll*60)}}else if(t.scroll<0){if(i<0){this.element.style.marginLeft=i-t.scroll*60+"px";o(this,a.x,i-t.scroll*60)}}}else{if(t.scroll<0){if(n>a.y-s){this.element.style.marginTop=n+t.scroll*60+"px";o(this,a.y,n+t.scroll*60)}}else if(t.scroll>0){if(n<0){this.element.style.marginTop=n+t.scroll*60+"px";o(this,a.y,n+t.scroll*60)}}}t.preventDefault=true}}function o(t,i,n){var r,o,s,a,l,h;if("horizontal"===t.scroll){r=t.panelWidth}else{r=t.panelHeight}o=Math.ceil(i/r)+5;s=Math.ceil((Math.abs(n)+i)/r)+1;o=s-o;o=o<0?0:o;for(l=o;l<s&&l<t.panels.length;l++){h=t.panels[l];if(!h.activePanel){var u;var c=t.viewer.tileSources[l];if(c.referenceStripThumbnailUrl){u={type:"image",url:c.referenceStripThumbnailUrl}}else{u=c}a=new e.Viewer({id:h.id,tileSources:[u],element:h,navigatorSizeRatio:t.sizeRatio,showNavigator:false,mouseNavEnabled:false,showNavigationControl:false,showSequenceControl:false,immediateRender:true,blendTime:0,animationTime:0,loadTilesWithAjax:t.viewer.loadTilesWithAjax,ajaxHeaders:t.viewer.ajaxHeaders,useCanvas:t.useCanvas});e.setElementPointerEventsNone(a.canvas);e.setElementPointerEventsNone(a.container);a.innerTracker.setTracking(false);a.outerTracker.setTracking(false);t.miniViewers[h.id]=a;h.activePanel=true}}}function s(e){var t=e.eventSource.element;if("horizontal"===this.scroll){t.style.marginBottom="0px"}else{t.style.marginLeft="0px"}}function a(t){var i=t.eventSource.element;if("horizontal"===this.scroll){i.style.marginBottom="-"+e.getElementSize(i).y/2+"px"}else{i.style.marginLeft="-"+e.getElementSize(i).x/2+"px"}}function l(e){if(!e.ctrl&&!e.alt&&!e.meta){switch(e.keyCode){case 38:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;case 40:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 37:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 39:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;default:e.preventDefault=false;break}}else{e.preventDefault=false}}function h(e){if(!e.ctrl&&!e.alt&&!e.meta){switch(e.keyCode){case 61:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;case 45:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 48:case 119:case 87:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;case 115:case 83:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 97:r.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});e.preventDefault=true;break;case 100:r.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});e.preventDefault=true;break;default:e.preventDefault=false;break}}else{e.preventDefault=false}}})(t);(function(e){e.DisplayRect=function(t,i,n,r,o,s){e.Rect.apply(this,[t,i,n,r]);this.minLevel=o;this.maxLevel=s};e.extend(e.DisplayRect.prototype,e.Rect.prototype)})(t);(function(e){e.Spring=function(t){var i=arguments;if(typeof t!=="object"){t={initial:i.length&&typeof i[0]==="number"?i[0]:undefined,springStiffness:i.length>1?i[1].springStiffness:5,animationTime:i.length>1?i[1].animationTime:1.5}}e.console.assert(typeof t.springStiffness==="number"&&t.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number");e.console.assert(typeof t.animationTime==="number"&&t.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0");if(t.exponential){this._exponential=true;delete t.exponential}e.extend(true,this,t);this.current={value:typeof this.initial==="number"?this.initial:this._exponential?0:1,time:e.now()};e.console.assert(!this._exponential||this.current.value!==0,"[OpenSeadragon.Spring] value must be non-zero for exponential springs");this.start={value:this.current.value,time:this.current.time};this.target={value:this.current.value,time:this.current.time};if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}};e.Spring.prototype={resetTo:function(t){e.console.assert(!this._exponential||t!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs");this.start.value=this.target.value=this.current.value=t;this.start.time=this.target.time=this.current.time=e.now();if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}},springTo:function(t){e.console.assert(!this._exponential||t!==0,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs");this.start.value=this.current.value;this.start.time=this.current.time;this.target.value=t;this.target.time=this.start.time+1e3*this.animationTime;if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value)}},shiftBy:function(t){this.start.value+=t;this.target.value+=t;if(this._exponential){e.console.assert(this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs");this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value)}},setExponential:function(t){this._exponential=t;if(this._exponential){e.console.assert(this.current.value!==0&&this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs");this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}},update:function(){this.current.time=e.now();var i,n;if(this._exponential){i=this.start._logValue;n=this.target._logValue}else{i=this.start.value;n=this.target.value}var r=this.current.time>=this.target.time?n:i+(n-i)*t(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time));var o=this.current.value;if(this._exponential){this.current.value=Math.exp(r)}else{this.current.value=r}return o!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function t(e,t){return(1-Math.exp(e*-t))/(1-Math.exp(-e))}})(t);(function(e){e.ImageJob=function(t){e.extend(true,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},t);this.data=null;this.userData={};this.errorMsg=null};e.ImageJob.prototype={start:function(){this.tries++;var e=this;var t=this.abort;this.jobId=window.setTimeout((function(){e.finish(null,null,"Image load exceeded timeout ("+e.timeout+" ms)")}),this.timeout);this.abort=function(){e.source.downloadTileAbort(e);if(typeof t==="function"){t()}};this.source.downloadTileStart(this)},finish:function(e,t,i){this.data=e;this.request=t;this.errorMsg=i;if(this.jobId){window.clearTimeout(this.jobId)}this.callback(this)}};e.ImageLoader=function(t){e.extend(true,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},t)};e.ImageLoader.prototype={addJob:function(i){if(!i.source){e.console.error("ImageLoader.prototype.addJob() requires [options.source]. "+"TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var n=e.TileSource.prototype;i.source={downloadTileStart:n.downloadTileStart,downloadTileAbort:n.downloadTileAbort}}var r=this,o=function(e){t(r,e,i.callback)},s={src:i.src,tile:i.tile||{},source:i.source,loadWithAjax:i.loadWithAjax,ajaxHeaders:i.loadWithAjax?i.ajaxHeaders:null,crossOriginPolicy:i.crossOriginPolicy,ajaxWithCredentials:i.ajaxWithCredentials,postData:i.postData,callback:o,abort:i.abort,timeout:this.timeout},a=new e.ImageJob(s);if(!this.jobLimit||this.jobsInProgress<this.jobLimit){a.start();this.jobsInProgress++}else{this.jobQueue.push(a)}},clear:function(){for(var e=0;e<this.jobQueue.length;e++){var t=this.jobQueue[e];if(typeof t.abort==="function"){t.abort()}}this.jobQueue=[]}};function t(e,t,i){if(t.errorMsg!==""&&(t.data===null||t.data===undefined)&&t.tries<1+e.tileRetryMax){e.failedTiles.push(t)}var n;e.jobsInProgress--;if((!e.jobLimit||e.jobsInProgress<e.jobLimit)&&e.jobQueue.length>0){n=e.jobQueue.shift();n.start();e.jobsInProgress++}if(e.tileRetryMax>0&&e.jobQueue.length===0){if((!e.jobLimit||e.jobsInProgress<e.jobLimit)&&e.failedTiles.length>0){n=e.failedTiles.shift();setTimeout((function(){n.start()}),e.tileRetryDelay);e.jobsInProgress++}}i(t.data,t.errorMsg,t.request)}})(t);(function(e){e.Tile=function(t,i,n,r,o,s,a,l,h,u,c,d){this.level=t;this.x=i;this.y=n;this.bounds=r;this.sourceBounds=u;this.exists=o;this._url=s;this.postData=c;this.context2D=a;this.loadWithAjax=l;this.ajaxHeaders=h;if(d===undefined){e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache"+" in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used.");d=e.TileSource.prototype.getTileHashKey(t,i,n,s,h,c)}this.cacheKey=d;this.loaded=false;this.loading=false;this.element=null;this.imgElement=null;this.style=null;this.position=null;this.size=null;this.flipped=false;this.blendStart=null;this.opacity=null;this.squaredDistance=null;this.visibility=null;this.hasTransparency=false;this.beingDrawn=false;this.lastTouchTime=0;this.isRightMost=false;this.isBottomMost=false};e.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){console.warn("Tile.prototype._hasTransparencyChannel() has been "+"deprecated and will be removed in the future. Use TileSource.prototype.hasTransparency() instead.");return!!this.context2D||this.getUrl().match(".png")},drawHTML:function(t){if(!this.cacheImageRecord){e.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString());return}if(!this.loaded){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}if(!this.element){var i=this.getImage();if(!i){return}this.element=e.makeNeutralElement("div");this.imgElement=i.cloneNode();this.imgElement.style.msInterpolationMode="nearest-neighbor";this.imgElement.style.width="100%";this.imgElement.style.height="100%";this.style=this.element.style;this.style.position="absolute"}if(this.element.parentNode!==t){t.appendChild(this.element)}if(this.imgElement.parentNode!==this.element){this.element.appendChild(this.imgElement)}this.style.top=this.position.y+"px";this.style.left=this.position.x+"px";this.style.height=this.size.y+"px";this.style.width=this.size.x+"px";if(this.flipped){this.style.transform="scaleX(-1)"}e.setElementOpacity(this.element,this.opacity)},get image(){e.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead.");return this.getImage()},get url(){e.console.error("[Tile.url] property has been deprecated. Use [Tile.prototype.getUrl] instead.");return this.getUrl()},getImage:function(){return this.cacheImageRecord.getImage()},getUrl:function(){if(typeof this._url==="function"){return this._url()}return this._url},getCanvasContext:function(){return this.context2D||this.cacheImageRecord.getRenderedContext()},drawCanvas:function(t,i,n,r,o,s){var a=this.position.times(e.pixelDensityRatio),l=this.size.times(e.pixelDensityRatio),h;if(!this.context2D&&!this.cacheImageRecord){e.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString());return}h=this.getCanvasContext();if(!this.loaded||!h){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}t.save();t.globalAlpha=this.opacity;if(typeof n==="number"&&n!==1){a=a.times(n);l=l.times(n)}if(r instanceof e.Point){a=a.plus(r)}if(t.globalAlpha===1&&this.hasTransparency){if(o){a.x=Math.round(a.x);a.y=Math.round(a.y);l.x=Math.round(l.x);l.y=Math.round(l.y)}t.clearRect(a.x,a.y,l.x,l.y)}i({context:t,tile:this,rendered:h});var u,c;if(this.sourceBounds){u=Math.min(this.sourceBounds.width,h.canvas.width);c=Math.min(this.sourceBounds.height,h.canvas.height)}else{u=h.canvas.width;c=h.canvas.height}t.translate(a.x+l.x/2,0);if(this.flipped){t.scale(-1,1)}t.drawImage(h.canvas,0,0,u,c,-l.x/2,a.y,l.x,l.y);t.restore()},getScaleForEdgeSmoothing:function(){var t;if(this.cacheImageRecord){t=this.cacheImageRecord.getRenderedContext()}else if(this.context2D){t=this.context2D}else{e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString());return 1}return t.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(t,i,n){var r=Math.max(1,Math.ceil((n.x-i.x)/2));var o=Math.max(1,Math.ceil((n.y-i.y)/2));return new e.Point(r,o).minus(this.position.times(e.pixelDensityRatio).times(t||1).apply((function(e){return e%1})))},unload:function(){if(this.imgElement&&this.imgElement.parentNode){this.imgElement.parentNode.removeChild(this.imgElement)}if(this.element&&this.element.parentNode){this.element.parentNode.removeChild(this.element)}this.element=null;this.imgElement=null;this.loaded=false;this.loading=false}}})(t);(function(e){e.OverlayPlacement=e.Placement;e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3});e.Overlay=function(t,i,n){var r;if(e.isPlainObject(t)){r=t}else{r={element:t,location:i,placement:n}}this.element=r.element;this.style=r.element.style;this._init(r)};e.Overlay.prototype={_init:function(t){this.location=t.location;this.placement=t.placement===undefined?e.Placement.TOP_LEFT:t.placement;this.onDraw=t.onDraw;this.checkResize=t.checkResize===undefined?true:t.checkResize;this.width=t.width===undefined?null:t.width;this.height=t.height===undefined?null:t.height;this.rotationMode=t.rotationMode||e.OverlayRotationMode.EXACT;if(this.location instanceof e.Rect){this.width=this.location.width;this.height=this.location.height;this.location=this.location.getTopLeft();this.placement=e.Placement.TOP_LEFT}this.scales=this.width!==null&&this.height!==null;this.bounds=new e.Rect(this.location.x,this.location.y,this.width,this.height);this.position=this.location},adjust:function(t,i){var n=e.Placement.properties[this.placement];if(!n){return}if(n.isHorizontallyCentered){t.x-=i.x/2}else if(n.isRight){t.x-=i.x}if(n.isVerticallyCentered){t.y-=i.y/2}else if(n.isBottom){t.y-=i.y}},destroy:function(){var t=this.element;var i=this.style;if(t.parentNode){t.parentNode.removeChild(t);if(t.prevElementParent){i.display="none";document.body.appendChild(t)}}this.onDraw=null;i.top="";i.left="";i.position="";if(this.width!==null){i.width=""}if(this.height!==null){i.height=""}var n=e.getCssPropertyWithVendorPrefix("transformOrigin");var r=e.getCssPropertyWithVendorPrefix("transform");if(n&&r){i[n]="";i[r]=""}},drawHTML:function(t,i){var n=this.element;if(n.parentNode!==t){n.prevElementParent=n.parentNode;n.prevNextSibling=n.nextSibling;t.appendChild(n);this.style.position="absolute";this.size=e.getElementSize(n)}var r=this._getOverlayPositionAndSize(i);var o=r.position;var s=this.size=r.size;var a=r.rotate;if(this.onDraw){this.onDraw(o,s,this.element)}else{var l=this.style;l.left=o.x+"px";l.top=o.y+"px";if(this.width!==null){l.width=s.x+"px"}if(this.height!==null){l.height=s.y+"px"}var h=e.getCssPropertyWithVendorPrefix("transformOrigin");var u=e.getCssPropertyWithVendorPrefix("transform");if(h&&u){if(a){l[h]=this._getTransformOrigin();l[u]="rotate("+a+"deg)"}else{l[h]="";l[u]=""}}l.display="block"}},_getOverlayPositionAndSize:function(t){var i=t.pixelFromPoint(this.location,true);var n=this._getSizeInPixels(t);this.adjust(i,n);var r=0;if(t.getRotation(true)&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION){if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var o=new e.Rect(i.x,i.y,n.x,n.y);var s=this._getBoundingBox(o,t.getRotation(true));i=s.getTopLeft();n=s.getSize()}else{r=t.getRotation(true)}}return{position:i,size:n,rotate:r}},_getSizeInPixels:function(t){var i=this.size.x;var n=this.size.y;if(this.width!==null||this.height!==null){var r=t.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),true);if(this.width!==null){i=r.x}if(this.height!==null){n=r.y}}if(this.checkResize&&(this.width===null||this.height===null)){var o=this.size=e.getElementSize(this.element);if(this.width===null){i=o.x}if(this.height===null){n=o.y}}return new e.Point(i,n)},_getBoundingBox:function(e,t){var i=this._getPlacementPoint(e);return e.rotate(t,i).getBoundingBox()},_getPlacementPoint:function(t){var i=new e.Point(t.x,t.y);var n=e.Placement.properties[this.placement];if(n){if(n.isHorizontallyCentered){i.x+=t.width/2}else if(n.isRight){i.x+=t.width}if(n.isVerticallyCentered){i.y+=t.height/2}else if(n.isBottom){i.y+=t.height}}return i},_getTransformOrigin:function(){var t="";var i=e.Placement.properties[this.placement];if(!i){return t}if(i.isLeft){t="left"}else if(i.isRight){t="right"}if(i.isTop){t+=" top"}else if(i.isBottom){t+=" bottom"}return t},update:function(t,i){var n=e.isPlainObject(t)?t:{location:t,placement:i};this._init({location:n.location||this.location,placement:n.placement!==undefined?n.placement:this.placement,onDraw:n.onDraw||this.onDraw,checkResize:n.checkResize||this.checkResize,width:n.width!==undefined?n.width:this.width,height:n.height!==undefined?n.height:this.height,rotationMode:n.rotationMode||this.rotationMode})},getBounds:function(t){e.console.assert(t,"A viewport must now be passed to Overlay.getBounds.");var i=this.width;var n=this.height;if(i===null||n===null){var r=t.deltaPointsFromPixelsNoRotate(this.size,true);if(i===null){i=r.x}if(n===null){n=r.y}}var o=this.location.clone();this.adjust(o,new e.Point(i,n));return this._adjustBoundsForRotation(t,new e.Rect(o.x,o.y,i,n))},_adjustBoundsForRotation:function(t,i){if(!t||t.getRotation(true)===0||this.rotationMode===e.OverlayRotationMode.EXACT){return i}if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null){return i}var n=this._getOverlayPositionAndSize(t);return t.viewerElementToViewportRectangle(new e.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-t.getRotation(true),this._getPlacementPoint(i))}}})(t);(function(e){e.Drawer=function(t){e.console.assert(t.viewer,"[Drawer] options.viewer is required");var i=arguments;if(!e.isPlainObject(t)){t={source:i[0],viewport:i[1],element:i[2]}}e.console.assert(t.viewport,"[Drawer] options.viewport is required");e.console.assert(t.element,"[Drawer] options.element is required");if(t.source){e.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead")}this.viewer=t.viewer;this.viewport=t.viewport;this.debugGridColor=typeof t.debugGridColor==="string"?[t.debugGridColor]:t.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor;if(t.opacity){e.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead")}this.useCanvas=e.supportsCanvas&&(this.viewer?this.viewer.useCanvas:true);this.container=e.getElement(t.element);this.canvas=e.makeNeutralElement(this.useCanvas?"canvas":"div");this.context=this.useCanvas?this.canvas.getContext("2d"):null;this.sketchCanvas=null;this.sketchContext=null;this.element=this.container;this.container.dir="ltr";if(this.useCanvas){var n=this._calculateCanvasSize();this.canvas.width=n.x;this.canvas.height=n.y}this.canvas.style.width="100%";this.canvas.style.height="100%";this.canvas.style.position="absolute";e.setElementOpacity(this.canvas,this.opacity,true);e.setElementPointerEventsNone(this.canvas);e.setElementTouchActionNone(this.canvas);this.container.style.textAlign="left";this.container.appendChild(this.canvas);this._imageSmoothingEnabled=true};e.Drawer.prototype={addOverlay:function(t,i,n,r){e.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead.");this.viewer.addOverlay(t,i,n,r);return this},updateOverlay:function(t,i,n){e.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead.");this.viewer.updateOverlay(t,i,n);return this},removeOverlay:function(t){e.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead.");this.viewer.removeOverlay(t);return this},clearOverlays:function(){e.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead.");this.viewer.clearOverlays();return this},viewportCoordToDrawerCoord:function(t){var i=this.viewport.pixelFromPointNoRotate(t,true);return new e.Point(i.x*e.pixelDensityRatio,i.y*e.pixelDensityRatio)},clipWithPolygons:function(e,t){if(!this.useCanvas){return}var i=this._getContext(t);i.beginPath();e.forEach((function(e){e.forEach((function(e,t){i[t===0?"moveTo":"lineTo"](e.x,e.y)}))}));i.clip()},setOpacity:function(t){e.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");var i=this.viewer.world;for(var n=0;n<i.getItemCount();n++){i.getItemAt(n).setOpacity(t)}return this},getOpacity:function(){e.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");var t=this.viewer.world;var i=0;for(var n=0;n<t.getItemCount();n++){var r=t.getItemAt(n).getOpacity();if(r>i){i=r}}return i},needsUpdate:function(){e.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead.");return this.viewer.world.needsDraw()},numTilesLoaded:function(){e.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead.");return this.viewer.tileCache.numTilesLoaded()},reset:function(){e.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead.");this.viewer.world.resetItems();return this},update:function(){e.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead.");this.clear();this.viewer.world.draw();return this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1;this.canvas.height=1;this.sketchCanvas=null;this.sketchContext=null},clear:function(){this.canvas.innerHTML="";if(this.useCanvas){var e=this._calculateCanvasSize();if(this.canvas.width!==e.x||this.canvas.height!==e.y){this.canvas.width=e.x;this.canvas.height=e.y;this._updateImageSmoothingEnabled(this.context);if(this.sketchCanvas!==null){var t=this._calculateSketchCanvasSize();this.sketchCanvas.width=t.x;this.sketchCanvas.height=t.y;this._updateImageSmoothingEnabled(this.sketchContext)}}this._clear()}},_clear:function(e,t){if(!this.useCanvas){return}var i=this._getContext(e);if(t){i.clearRect(t.x,t.y,t.width,t.height)}else{var n=i.canvas;i.clearRect(0,0,n.width,n.height)}},viewportToDrawerRectangle:function(t){var i=this.viewport.pixelFromPointNoRotate(t.getTopLeft(),true);var n=this.viewport.deltaPixelsFromPointsNoRotate(t.getSize(),true);return new e.Rect(i.x*e.pixelDensityRatio,i.y*e.pixelDensityRatio,n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio)},drawTile:function(t,i,n,r,o,s,a){e.console.assert(t,"[Drawer.drawTile] tile is required");e.console.assert(i,"[Drawer.drawTile] drawingHandler is required");if(this.useCanvas){var l=this._getContext(n);r=r||1;t.drawCanvas(l,i,r,o,s,a)}else{t.drawHTML(this.canvas)}},_getContext:function(e){var t=this.context;if(e){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var i=this._calculateSketchCanvasSize();this.sketchCanvas.width=i.x;this.sketchCanvas.height=i.y;this.sketchContext=this.sketchCanvas.getContext("2d");if(this.viewport.getRotation()===0){var n=this;this.viewer.addHandler("rotate",(function e(){if(n.viewport.getRotation()===0){return}n.viewer.removeHandler("rotate",e);var t=n._calculateSketchCanvasSize();n.sketchCanvas.width=t.x;n.sketchCanvas.height=t.y}))}this._updateImageSmoothingEnabled(this.sketchContext)}t=this.sketchContext}return t},saveContext:function(e){if(!this.useCanvas){return}this._getContext(e).save()},restoreContext:function(e){if(!this.useCanvas){return}this._getContext(e).restore()},setClip:function(e,t){if(!this.useCanvas){return}var i=this._getContext(t);i.beginPath();i.rect(e.x,e.y,e.width,e.height);i.clip()},drawRectangle:function(e,t,i){if(!this.useCanvas){return}var n=this._getContext(i);n.save();n.fillStyle=t;n.fillRect(e.x,e.y,e.width,e.height);n.restore()},blendSketch:function(t,i,n,r){var o=t;if(!e.isPlainObject(o)){o={opacity:t,scale:i,translate:n,compositeOperation:r}}if(!this.useCanvas||!this.sketchCanvas){return}t=o.opacity;r=o.compositeOperation;var s=o.bounds;this.context.save();this.context.globalAlpha=t;if(r){this.context.globalCompositeOperation=r}if(s){if(s.x<0){s.width+=s.x;s.x=0}if(s.x+s.width>this.canvas.width){s.width=this.canvas.width-s.x}if(s.y<0){s.height+=s.y;s.y=0}if(s.y+s.height>this.canvas.height){s.height=this.canvas.height-s.y}this.context.drawImage(this.sketchCanvas,s.x,s.y,s.width,s.height,s.x,s.y,s.width,s.height)}else{i=o.scale||1;n=o.translate;var a=n instanceof e.Point?n:new e.Point(0,0);var l=0;var h=0;if(n){var u=this.sketchCanvas.width-this.canvas.width;var c=this.sketchCanvas.height-this.canvas.height;l=Math.round(u/2);h=Math.round(c/2)}this.context.drawImage(this.sketchCanvas,a.x-l*i,a.y-h*i,(this.canvas.width+2*l)*i,(this.canvas.height+2*h)*i,-l,-h,this.canvas.width+2*l,this.canvas.height+2*h)}this.context.restore()},drawDebugInfo:function(t,i,n,r){if(!this.useCanvas){return}var o=this.viewer.world.getIndexOfItem(r)%this.debugGridColor.length;var s=this.context;s.save();s.lineWidth=2*e.pixelDensityRatio;s.font="small-caps bold "+13*e.pixelDensityRatio+"px arial";s.strokeStyle=this.debugGridColor[o];s.fillStyle=this.debugGridColor[o];if(this.viewport.getRotation(true)%360!==0){this._offsetForRotation({degrees:this.viewport.getRotation(true)})}if(r.getRotation(true)%360!==0){this._offsetForRotation({degrees:r.getRotation(true),point:r.viewport.pixelFromPointNoRotate(r._getRotationPoint(true),true)})}if(r.viewport.getRotation(true)%360===0&&r.getRotation(true)%360===0){if(r._drawer.viewer.viewport.getFlip()){r._drawer._flip()}}s.strokeRect(t.position.x*e.pixelDensityRatio,t.position.y*e.pixelDensityRatio,t.size.x*e.pixelDensityRatio,t.size.y*e.pixelDensityRatio);var a=(t.position.x+t.size.x/2)*e.pixelDensityRatio;var l=(t.position.y+t.size.y/2)*e.pixelDensityRatio;s.translate(a,l);s.rotate(Math.PI/180*-this.viewport.getRotation(true));s.translate(-a,-l);if(t.x===0&&t.y===0){s.fillText("Zoom: "+this.viewport.getZoom(),t.position.x*e.pixelDensityRatio,(t.position.y-30)*e.pixelDensityRatio);s.fillText("Pan: "+this.viewport.getBounds().toString(),t.position.x*e.pixelDensityRatio,(t.position.y-20)*e.pixelDensityRatio)}s.fillText("Level: "+t.level,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+20)*e.pixelDensityRatio);s.fillText("Column: "+t.x,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+30)*e.pixelDensityRatio);s.fillText("Row: "+t.y,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+40)*e.pixelDensityRatio);s.fillText("Order: "+n+" of "+i,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+50)*e.pixelDensityRatio);s.fillText("Size: "+t.size.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+60)*e.pixelDensityRatio);s.fillText("Position: "+t.position.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+70)*e.pixelDensityRatio);if(this.viewport.getRotation(true)%360!==0){this._restoreRotationChanges()}if(r.getRotation(true)%360!==0){this._restoreRotationChanges()}if(r.viewport.getRotation(true)%360===0&&r.getRotation(true)%360===0){if(r._drawer.viewer.viewport.getFlip()){r._drawer._flip()}}s.restore()},debugRect:function(t){if(this.useCanvas){var i=this.context;i.save();i.lineWidth=2*e.pixelDensityRatio;i.strokeStyle=this.debugGridColor[0];i.fillStyle=this.debugGridColor[0];i.strokeRect(t.x*e.pixelDensityRatio,t.y*e.pixelDensityRatio,t.width*e.pixelDensityRatio,t.height*e.pixelDensityRatio);i.restore()}},setImageSmoothingEnabled:function(e){if(this.useCanvas){this._imageSmoothingEnabled=e;this._updateImageSmoothingEnabled(this.context);this.viewer.forceRedraw()}},_updateImageSmoothingEnabled:function(e){e.msImageSmoothingEnabled=this._imageSmoothingEnabled;e.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(t){var i=this._getContext(t).canvas;return new e.Point(i.width,i.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(t){var i=t.point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter();var n=this._getContext(t.useSketch);n.save();n.translate(i.x,i.y);if(this.viewer.viewport.flipped){n.rotate(Math.PI/180*-t.degrees);n.scale(-1,1)}else{n.rotate(Math.PI/180*t.degrees)}n.translate(-i.x,-i.y)},_flip:function(t){t=t||{};var i=t.point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter();var n=this._getContext(t.useSketch);n.translate(i.x,0);n.scale(-1,1);n.translate(-i.x,0)},_restoreRotationChanges:function(e){var t=this._getContext(e);t.restore()},_calculateCanvasSize:function(){var t=e.pixelDensityRatio;var i=this.viewport.getContainerSize();return{x:Math.round(i.x*t),y:Math.round(i.y*t)}},_calculateSketchCanvasSize:function(){var e=this._calculateCanvasSize();if(this.viewport.getRotation()===0){return e}var t=Math.ceil(Math.sqrt(e.x*e.x+e.y*e.y));return{x:t,y:t}}}})(t);(function(e){e.Viewport=function(t){var i=arguments;if(i.length&&i[0]instanceof e.Point){t={containerSize:i[0],contentSize:i[1],config:i[2]}}if(t.config){e.extend(true,t,t.config);delete t.config}this._margins=e.extend({left:0,top:0,right:0,bottom:0},t.margins||{});delete t.margins;t.initialDegrees=t.degrees;delete t.degrees;e.extend(true,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:e.DEFAULT_SETTINGS.silenceMultiImageWarnings},t);this._updateContainerInnerSize();this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.zoomSpring=new e.Spring({exponential:true,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime});this.degreesSpring=new e.Spring({initial:t.initialDegrees,springStiffness:this.springStiffness,animationTime:this.animationTime});this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;this._oldDegrees=this.degreesSpring.current.value;this._setContentBounds(new e.Rect(0,0,1,1),1);this.goHome(true);this.update()};e.Viewport.prototype={get degrees(){e.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead.");return this.getRotation()},set degrees(t){e.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead.");this.rotateTo(t)},resetContentSize:function(t){e.console.assert(t,"[Viewport.resetContentSize] contentSize is required");e.console.assert(t instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point");e.console.assert(t.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0");e.console.assert(t.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0");this._setContentBounds(new e.Rect(0,0,1,t.y/t.x),t.x);return this},setHomeBounds:function(t,i){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually.");this._setContentBounds(t,i)},_setContentBounds:function(t,i){e.console.assert(t,"[Viewport._setContentBounds] bounds is required");e.console.assert(t instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect");e.console.assert(t.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0");e.console.assert(t.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0");this._contentBoundsNoRotate=t.clone();this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i);this._contentBounds=t.rotate(this.getRotation()).getBoundingBox();this._contentSize=this._contentBounds.getSize().times(i);this._contentAspectRatio=this._contentSize.x/this._contentSize.y;if(this.viewer){this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:i,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})}},getHomeZoom:function(){if(this.defaultZoomLevel){return this.defaultZoomLevel}var e=this._contentAspectRatio/this.getAspectRatio();var t;if(this.homeFillsViewer){t=e>=1?e:1}else{t=e>=1?1:e}return t/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var t=this._contentBounds.getCenter();var i=1/this.getHomeZoom();var n=i/this.getAspectRatio();return new e.Rect(t.x-i/2,t.y-n/2,i,n)},goHome:function(e){if(this.viewer){this.viewer.raiseEvent("home",{immediately:e})}return this.fitBounds(this.getHomeBounds(),e)},getMinZoom:function(){var e=this.getHomeZoom(),t=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*e;return t},getMaxZoom:function(){var e=this.maxZoomLevel;if(!e){e=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x;e/=this._contentBounds.width}return Math.max(e,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(t){e.console.assert(e.type(t)==="object","[Viewport.setMargins] margins must be an object");this._margins=e.extend({left:0,top:0,right:0,bottom:0},t);this._updateContainerInnerSize();if(this.viewer){this.viewer.forceRedraw()}},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(-this.getRotation(e))},getBoundsNoRotate:function(t){var i=this.getCenter(t);var n=1/this.getZoom(t);var r=n/this.getAspectRatio();return new e.Rect(i.x-n/2,i.y-r/2,n,r)},getBoundsWithMargins:function(e){return this.getBoundsNoRotateWithMargins(e).rotate(-this.getRotation(e),this.getCenter(e))},getBoundsNoRotateWithMargins:function(e){var t=this.getBoundsNoRotate(e);var i=this._containerInnerSize.x*this.getZoom(e);t.x-=this._margins.left/i;t.y-=this._margins.top/i;t.width+=(this._margins.left+this._margins.right)/i;t.height+=(this._margins.top+this._margins.bottom)/i;return t},getCenter:function(t){var i=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),n=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),r,o,s,a,l,h,u,c;if(t){return i}else if(!this.zoomPoint){return n}r=this.pixelFromPoint(this.zoomPoint,true);o=this.getZoom();s=1/o;a=s/this.getAspectRatio();l=new e.Rect(i.x-s/2,i.y-a/2,s,a);h=this._pixelFromPoint(this.zoomPoint,l);u=h.minus(r).rotate(-this.getRotation(true));c=u.divide(this._containerInnerSize.x*o);return n.plus(c)},getZoom:function(e){if(e){return this.zoomSpring.current.value}else{return this.zoomSpring.target.value}},_applyZoomConstraints:function(e){return Math.max(Math.min(e,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(e){var t=this.viewportToViewerElementRectangle(e).getBoundingBox();var i=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox();var n=false;var r=false;if(this.wrapHorizontal);else{var o=t.x+t.width;var s=i.x+i.width;var a,l,h;if(t.width>i.width){a=this.visibilityRatio*i.width}else{a=this.visibilityRatio*t.width}l=i.x-o+a;h=s-t.x-a;if(a>i.width){t.x+=(l+h)/2;n=true}else if(h<0){t.x+=h;n=true}else if(l>0){t.x+=l;n=true}}if(this.wrapVertical);else{var u=t.y+t.height;var c=i.y+i.height;var d,p,f;if(t.height>i.height){d=this.visibilityRatio*i.height}else{d=this.visibilityRatio*t.height}p=i.y-u+d;f=c-t.y-d;if(d>i.height){t.y+=(p+f)/2;r=true}else if(f<0){t.y+=f;r=true}else if(p>0){t.y+=p;r=true}}var g=n||r;var v=g?this.viewerElementToViewportRectangle(t):e.clone();v.xConstrained=n;v.yConstrained=r;v.constraintApplied=g;return v},_raiseConstraintsEvent:function(e){if(this.viewer){this.viewer.raiseEvent("constrain",{immediately:e})}},applyConstraints:function(e){var t=this.getZoom();var i=this._applyZoomConstraints(t);if(t!==i){this.zoomTo(i,this.zoomPoint,e)}var n=this.getConstrainedBounds(false);if(n.constraintApplied){this.fitBounds(n,e);this._raiseConstraintsEvent(e)}return this},ensureVisible:function(e){return this.applyConstraints(e)},_fitBounds:function(t,i){i=i||{};var n=i.immediately||false;var r=i.constraints||false;var o=this.getAspectRatio();var s=t.getCenter();var a=new e.Rect(t.x,t.y,t.width,t.height,t.degrees+this.getRotation()).getBoundingBox();if(a.getAspectRatio()>=o){a.height=a.width/o}else{a.width=a.height*o}a.x=s.x-a.width/2;a.y=s.y-a.height/2;var l=1/a.width;if(n){this.panTo(s,true);this.zoomTo(l,null,true);if(r){this.applyConstraints(true)}return this}var h=this.getCenter(true);var u=this.getZoom(true);this.panTo(h,true);this.zoomTo(u,null,true);var c=this.getBounds();var d=this.getZoom();if(d===0||Math.abs(l/d-1)<1e-8){this.zoomTo(l,null,true);this.panTo(s,n);if(r){this.applyConstraints(false)}return this}if(r){this.panTo(s,false);l=this._applyZoomConstraints(l);this.zoomTo(l,null,false);var p=this.getConstrainedBounds();this.panTo(h,true);this.zoomTo(u,null,true);this.fitBounds(p)}else{var f=a.rotate(-this.getRotation());var g=f.getTopLeft().times(l).minus(c.getTopLeft().times(d)).divide(l-d);this.zoomTo(l,g,n)}return this},fitBounds:function(e,t){return this._fitBounds(e,{immediately:t,constraints:false})},fitBoundsWithConstraints:function(e,t){return this._fitBounds(e,{immediately:t,constraints:true})},fitVertically:function(t){var i=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,t)},fitHorizontally:function(t){var i=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,t)},getConstrainedBounds:function(e){var t,i;t=this.getBounds(e);i=this._applyBoundaryConstraints(t);return i},panBy:function(t,i){var n=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(t),i)},panTo:function(e,t){if(t){this.centerSpringX.resetTo(e.x);this.centerSpringY.resetTo(e.y)}else{this.centerSpringX.springTo(e.x);this.centerSpringY.springTo(e.y)}if(this.viewer){this.viewer.raiseEvent("pan",{center:e,immediately:t})}return this},zoomBy:function(e,t,i){return this.zoomTo(this.zoomSpring.target.value*e,t,i)},zoomTo:function(t,i,n){var r=this;this.zoomPoint=i instanceof e.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null;if(n){this._adjustCenterSpringsForZoomPoint((function(){r.zoomSpring.resetTo(t)}))}else{this.zoomSpring.springTo(t)}if(this.viewer){this.viewer.raiseEvent("zoom",{zoom:t,refPoint:i,immediately:n})}return this},setRotation:function(e,t){return this.rotateTo(e,null,t)},getRotation:function(e){return e?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(e,t,i){return this.rotateTo(e,t,i)},rotateTo:function(t,i,n){if(!this.viewer||!this.viewer.drawer.canRotate()){return this}if(this.degreesSpring.target.value===t&&this.degreesSpring.isAtTargetValue()){return this}this.rotationPivot=i instanceof e.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null;if(n){if(this.rotationPivot){var r=t-this._oldDegrees;if(!r){this.rotationPivot=null;return this}this._rotateAboutPivot(t)}else{this.degreesSpring.resetTo(t)}}else{var o=e.positiveModulo(this.degreesSpring.current.value,360);var s=e.positiveModulo(t,360);var a=s-o;if(a>180){s-=360}else if(a<-180){s+=360}var l=o-s;this.degreesSpring.resetTo(t+l);this.degreesSpring.springTo(t)}this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor());this.viewer.forceRedraw();this.viewer.raiseEvent("rotate",{degrees:t,immediately:!!n,pivot:this.rotationPivot||this.getCenter()});return this},rotateBy:function(e,t,i){return this.rotateTo(this.degreesSpring.target.value+e,t,i)},resize:function(e,t){var i=this.getBoundsNoRotate(),n=i,r;this.containerSize.x=e.x;this.containerSize.y=e.y;this._updateContainerInnerSize();if(t){r=e.x/this.containerSize.x;n.width=i.width*r;n.height=n.width/this.getAspectRatio()}if(this.viewer){this.viewer.raiseEvent("resize",{newContainerSize:e,maintain:t})}var o=this.fitBounds(n,true);if(this.viewer){this.viewer.raiseEvent("after-resize",{newContainerSize:e,maintain:t})}return o},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var e=this;this._adjustCenterSpringsForZoomPoint((function(){e.zoomSpring.update()}));if(this.degreesSpring.isAtTargetValue()){this.rotationPivot=null}this.centerSpringX.update();this.centerSpringY.update();if(this.rotationPivot){this._rotateAboutPivot(true)}else{this.degreesSpring.update()}var t=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;this._oldDegrees=this.degreesSpring.current.value;return t},_rotateAboutPivot:function(e){var t=e===true;var i=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(i.x);this.centerSpringY.shiftBy(i.y);if(t){this.degreesSpring.update()}else{this.degreesSpring.resetTo(e)}var n=this.degreesSpring.current.value-this._oldDegrees;var r=i.rotate(n*-1).times(-1);this.centerSpringX.shiftBy(r.x);this.centerSpringY.shiftBy(r.y)},_adjustCenterSpringsForZoomPoint:function(e){if(this.zoomPoint){var t=this.pixelFromPoint(this.zoomPoint,true);e();var i=this.pixelFromPoint(this.zoomPoint,true);var n=i.minus(t);var r=this.deltaPointsFromPixels(n,true);this.centerSpringX.shiftBy(r.x);this.centerSpringY.shiftBy(r.y);if(this.zoomSpring.isAtTargetValue()){this.zoomPoint=null}}else{e()}},deltaPixelsFromPointsNoRotate:function(e,t){return e.times(this._containerInnerSize.x*this.getZoom(t))},deltaPixelsFromPoints:function(e,t){return this.deltaPixelsFromPointsNoRotate(e.rotate(this.getRotation(t)),t)},deltaPointsFromPixelsNoRotate:function(e,t){return e.divide(this._containerInnerSize.x*this.getZoom(t))},deltaPointsFromPixels:function(e,t){return this.deltaPointsFromPixelsNoRotate(e,t).rotate(-this.getRotation(t))},pixelFromPointNoRotate:function(e,t){return this._pixelFromPointNoRotate(e,this.getBoundsNoRotate(t))},pixelFromPoint:function(e,t){return this._pixelFromPoint(e,this.getBoundsNoRotate(t))},_pixelFromPointNoRotate:function(t,i){return t.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(e,t){return this._pixelFromPointNoRotate(e.rotate(this.getRotation(true),this.getCenter(true)),t)},pointFromPixelNoRotate:function(t,i){var n=this.getBoundsNoRotate(i);return t.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(e,t){return this.pointFromPixelNoRotate(e,t).rotate(-this.getRotation(t),this.getCenter(t))},_viewportToImageDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(t,i){if(t instanceof e.Point){return this.viewportToImageCoordinates(t.x,t.y)}if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.viewportToImageCoordinates] is not accurate "+"with multi-image; use TiledImage.viewportToImageCoordinates instead.")}}else if(n===1){var r=this.viewer.world.getItemAt(0);return r.viewportToImageCoordinates(t,i,true)}}return this._viewportToImageDelta(t-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(t,i){if(t instanceof e.Point){return this.imageToViewportCoordinates(t.x,t.y)}if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.imageToViewportCoordinates] is not accurate "+"with multi-image; use TiledImage.imageToViewportCoordinates instead.")}}else if(n===1){var r=this.viewer.world.getItemAt(0);return r.imageToViewportCoordinates(t,i,true)}}var o=this._imageToViewportDelta(t,i);o.x+=this._contentBoundsNoRotate.x;o.y+=this._contentBoundsNoRotate.y;return o},imageToViewportRectangle:function(t,i,n,r){var o=t;if(!(o instanceof e.Rect)){o=new e.Rect(t,i,n,r)}if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.imageToViewportRectangle] is not accurate "+"with multi-image; use TiledImage.imageToViewportRectangle instead.")}}else if(s===1){var a=this.viewer.world.getItemAt(0);return a.imageToViewportRectangle(t,i,n,r,true)}}var l=this.imageToViewportCoordinates(o.x,o.y);var h=this._imageToViewportDelta(o.width,o.height);return new e.Rect(l.x,l.y,h.x,h.y,o.degrees)},viewportToImageRectangle:function(t,i,n,r){var o=t;if(!(o instanceof e.Rect)){o=new e.Rect(t,i,n,r)}if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.viewportToImageRectangle] is not accurate "+"with multi-image; use TiledImage.viewportToImageRectangle instead.")}}else if(s===1){var a=this.viewer.world.getItemAt(0);return a.viewportToImageRectangle(t,i,n,r,true)}}var l=this.viewportToImageCoordinates(o.x,o.y);var h=this._viewportToImageDelta(o.width,o.height);return new e.Rect(l.x,l.y,h.x,h.y,o.degrees)},viewerElementToImageCoordinates:function(e){var t=this.pointFromPixel(e,true);return this.viewportToImageCoordinates(t)},imageToViewerElementCoordinates:function(e){var t=this.imageToViewportCoordinates(e);return this.pixelFromPoint(t,true)},windowToImageCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var i=this.imageToViewerElementCoordinates(t);return i.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(e){return this.pointFromPixel(e,true)},viewportToViewerElementCoordinates:function(e){return this.pixelFromPoint(e,true)},viewerElementToViewportRectangle:function(t){return e.Rect.fromSummits(this.pointFromPixel(t.getTopLeft(),true),this.pointFromPixel(t.getTopRight(),true),this.pointFromPixel(t.getBottomLeft(),true))},viewportToViewerElementRectangle:function(t){return e.Rect.fromSummits(this.pixelFromPoint(t.getTopLeft(),true),this.pixelFromPoint(t.getTopRight(),true),this.pixelFromPoint(t.getBottomLeft(),true))},windowToViewportCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var i=this.viewportToViewerElementCoordinates(t);return i.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.viewportToImageZoom] is not "+"accurate with multi-image.")}}else if(i===1){var n=this.viewer.world.getItemAt(0);return n.viewportToImageZoom(t)}}var r=this._contentSizeNoRotate.x;var o=this._containerInnerSize.x;var s=this._contentBoundsNoRotate.width;var a=o/r*s;return t*a},imageToViewportZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1){if(!this.silenceMultiImageWarnings){e.console.error("[Viewport.imageToViewportZoom] is not accurate "+"with multi-image.")}}else if(i===1){var n=this.viewer.world.getItemAt(0);return n.imageToViewportZoom(t)}}var r=this._contentSizeNoRotate.x;var o=this._containerInnerSize.x;var s=this._contentBoundsNoRotate.width;var a=r/o/s;return t*a},toggleFlip:function(){this.setFlip(!this.getFlip());return this},getFlip:function(){return this.flipped},setFlip:function(e){if(this.flipped===e){return this}this.flipped=e;if(this.viewer.navigator){this.viewer.navigator.setFlip(this.getFlip())}this.viewer.forceRedraw();this.viewer.raiseEvent("flip",{flipped:e});return this}}})(t);(function(e){e.TiledImage=function(i){var n=this;e.console.assert(i.tileCache,"[TiledImage] options.tileCache is required");e.console.assert(i.drawer,"[TiledImage] options.drawer is required");e.console.assert(i.viewer,"[TiledImage] options.viewer is required");e.console.assert(i.imageLoader,"[TiledImage] options.imageLoader is required");e.console.assert(i.source,"[TiledImage] options.source is required");e.console.assert(!i.clip||i.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present");e.EventSource.call(this);this._tileCache=i.tileCache;delete i.tileCache;this._drawer=i.drawer;delete i.drawer;this._imageLoader=i.imageLoader;delete i.imageLoader;if(i.clip instanceof e.Rect){this._clip=i.clip.clone()}delete i.clip;var r=i.x||0;delete i.x;var o=i.y||0;delete i.y;this.normHeight=i.source.dimensions.y/i.source.dimensions.x;this.contentAspectX=i.source.dimensions.x/i.source.dimensions.y;var s=1;if(i.width){s=i.width;delete i.width;if(i.height){e.console.error("specifying both width and height to a tiledImage is not supported");delete i.height}}else if(i.height){s=i.height/this.normHeight;delete i.height}var a=i.fitBounds;delete i.fitBounds;var l=i.fitBoundsPlacement||t.Placement.CENTER;delete i.fitBoundsPlacement;var h=i.degrees||0;delete i.degrees;var u=i.ajaxHeaders;delete i.ajaxHeaders;e.extend(true,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:false,_needsDraw:true,_hasOpaqueTile:false,_tilesLoading:0,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,immediateRender:e.DEFAULT_SETTINGS.immediateRender,blendTime:e.DEFAULT_SETTINGS.blendTime,alwaysBlend:e.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:e.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:e.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:e.DEFAULT_SETTINGS.iOSDevice,debugMode:e.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:e.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:e.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:e.DEFAULT_SETTINGS.placeholderFillStyle,opacity:e.DEFAULT_SETTINGS.opacity,preload:e.DEFAULT_SETTINGS.preload,compositeOperation:e.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:e.DEFAULT_SETTINGS.subPixelRoundingForTransparency},i);this._preload=this.preload;delete this.preload;this._fullyLoaded=false;this._xSpring=new e.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime});this._ySpring=new e.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime});this._scaleSpring=new e.Spring({initial:s,springStiffness:this.springStiffness,animationTime:this.animationTime});this._degreesSpring=new e.Spring({initial:h,springStiffness:this.springStiffness,animationTime:this.animationTime});this._updateForScale();if(a){this.fitBounds(a,l,true)}this._drawingHandler=function(t){n.viewer.raiseEvent("tile-drawing",e.extend({tiledImage:n},t))};this._ownAjaxHeaders={};this.setAjaxHeaders(u,false)};e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(e){if(e===this._fullyLoaded){return}this._fullyLoaded=e;this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded})},reset:function(){this._tileCache.clearTilesFor(this);this.lastResetTime=e.now();this._needsDraw=true},update:function(){var e=this._xSpring.update();var t=this._ySpring.update();var i=this._scaleSpring.update();var n=this._degreesSpring.update();if(e||t||i||n){this._updateForScale();this._needsDraw=true;return true}return false},draw:function(){if(this.opacity!==0||this._preload){this._midDraw=true;this._updateViewport();this._midDraw=false}else{this._needsDraw=false}},destroy:function(){this.reset();if(this.source.destroy){this.source.destroy()}},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(this.getRotation(e),this._getRotationPoint(e))},getBoundsNoRotate:function(t){return t?new e.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new e.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){e.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead");return this.getBounds()},getClippedBounds:function(t){var i=this.getBoundsNoRotate(t);if(this._clip){var n=t?this._worldWidthCurrent:this._worldWidthTarget;var r=n/this.source.dimensions.x;var o=this._clip.times(r);i=new e.Rect(i.x+o.x,i.y+o.y,o.width,o.height)}return i.rotate(this.getRotation(t),this._getRotationPoint(t))},getTileBounds:function(e,t,i){var n=this.source.getNumTiles(e);var r=(n.x+t%n.x)%n.x;var o=(n.y+i%n.y)%n.y;var s=this.source.getTileBounds(e,r,o);if(this.getFlip()){s.x=1-s.x-s.width}s.x+=(t-r)/n.x;s.y+=this._worldHeightCurrent/this._worldWidthCurrent*((i-o)/n.y);return s},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var t=this.imageToWindowCoordinates(new e.Point(0,0));var i=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(i.x-t.x,i.y-t.y)},_viewportToImageDelta:function(t,i,n){var r=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t*(this.source.dimensions.x/r),i*(this.source.dimensions.y*this.contentAspectX/r))},viewportToImageCoordinates:function(t,i,n){var r;if(t instanceof e.Point){n=i;r=t}else{r=new e.Point(t,i)}r=r.rotate(-this.getRotation(n),this._getRotationPoint(n));return n?this._viewportToImageDelta(r.x-this._xSpring.current.value,r.y-this._ySpring.current.value):this._viewportToImageDelta(r.x-this._xSpring.target.value,r.y-this._ySpring.target.value)},_imageToViewportDelta:function(t,i,n){var r=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t/this.source.dimensions.x*r,i/this.source.dimensions.y/this.contentAspectX*r)},imageToViewportCoordinates:function(t,i,n){if(t instanceof e.Point){n=i;i=t.y;t=t.x}var r=this._imageToViewportDelta(t,i);if(n){r.x+=this._xSpring.current.value;r.y+=this._ySpring.current.value}else{r.x+=this._xSpring.target.value;r.y+=this._ySpring.target.value}return r.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(t,i,n,r,o){var s=t;if(s instanceof e.Rect){o=i}else{s=new e.Rect(t,i,n,r)}var a=this.imageToViewportCoordinates(s.getTopLeft(),o);var l=this._imageToViewportDelta(s.width,s.height,o);return new e.Rect(a.x,a.y,l.x,l.y,s.degrees+this.getRotation(o))},viewportToImageRectangle:function(t,i,n,r,o){var s=t;if(t instanceof e.Rect){o=i}else{s=new e.Rect(t,i,n,r)}var a=this.viewportToImageCoordinates(s.getTopLeft(),o);var l=this._viewportToImageDelta(s.width,s.height,o);return new e.Rect(a.x,a.y,l.x,l.y,s.degrees-this.getRotation(o))},viewerElementToImageCoordinates:function(e){var t=this.viewport.pointFromPixel(e,true);return this.viewportToImageCoordinates(t)},imageToViewerElementCoordinates:function(e){var t=this.imageToViewportCoordinates(e);return this.viewport.pixelFromPoint(t,true)},windowToImageCoordinates:function(e){var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(e){var i=this.imageToViewerElementCoordinates(e);return i.plus(t.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(t){var i=this._scaleSpring.current.value;t=t.rotate(-this.getRotation(true),this._getRotationPoint(true));return new e.Rect((t.x-this._xSpring.current.value)/i,(t.y-this._ySpring.current.value)/i,t.width/i,t.height/i,t.degrees)},viewportToImageZoom:function(e){var t=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return t*e},imageToViewportZoom:function(e){var t=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return e/t},setPosition:function(e,t){var i=this._xSpring.target.value===e.x&&this._ySpring.target.value===e.y;if(t){if(i&&this._xSpring.current.value===e.x&&this._ySpring.current.value===e.y){return}this._xSpring.resetTo(e.x);this._ySpring.resetTo(e.y);this._needsDraw=true}else{if(i){return}this._xSpring.springTo(e.x);this._ySpring.springTo(e.y);this._needsDraw=true}if(!i){this._raiseBoundsChange()}},setWidth:function(e,t){this._setScale(e,t)},setHeight:function(e,t){this._setScale(e/this.normHeight,t)},setCroppingPolygons:function(t){var i=function(t){return t instanceof e.Point||typeof t.x==="number"&&typeof t.y==="number"};var n=function(e){return e.map((function(e){try{if(i(e)){return{x:e.x,y:e.y}}else{throw new Error}}catch(e){throw new Error("A Provided cropping polygon point is not supported")}}))};try{if(!e.isArray(t)){throw new Error("Provided cropping polygon is not an array")}this._croppingPolygons=t.map((function(e){return n(e)}))}catch(t){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported");e.console.error(t);this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(t,i,n){i=i||e.Placement.CENTER;var r=e.Placement.properties[i];var o=this.contentAspectX;var s=0;var a=0;var l=1;var h=1;if(this._clip){o=this._clip.getAspectRatio();l=this._clip.width/this.source.dimensions.x;h=this._clip.height/this.source.dimensions.y;if(t.getAspectRatio()>o){s=this._clip.x/this._clip.height*t.height;a=this._clip.y/this._clip.height*t.height}else{s=this._clip.x/this._clip.width*t.width;a=this._clip.y/this._clip.width*t.width}}if(t.getAspectRatio()>o){var u=t.height/h;var c=0;if(r.isHorizontallyCentered){c=(t.width-t.height*o)/2}else if(r.isRight){c=t.width-t.height*o}this.setPosition(new e.Point(t.x-s+c,t.y-a),n);this.setHeight(u,n)}else{var d=t.width/l;var p=0;if(r.isVerticallyCentered){p=(t.height-t.width/o)/2}else if(r.isBottom){p=t.height-t.width/o}this.setPosition(new e.Point(t.x-s,t.y-a+p),n);this.setWidth(d,n)}},getClip:function(){if(this._clip){return this._clip.clone()}return null},setClip:function(t){e.console.assert(!t||t instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null");if(t instanceof e.Rect){this._clip=t.clone()}else{this._clip=null}this._needsDraw=true;this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(e){this.flipped=!!e;this._needsDraw=true;this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(e){if(e===this.opacity){return}this.opacity=e;this._needsDraw=true;this.raiseEvent("opacity-change",{opacity:this.opacity})},getPreload:function(){return this._preload},setPreload:function(e){this._preload=!!e;this._needsDraw=true},getRotation:function(e){return e?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(e,t){if(this._degreesSpring.target.value===e&&this._degreesSpring.isAtTargetValue()){return}if(t){this._degreesSpring.resetTo(e)}else{this._degreesSpring.springTo(e)}this._needsDraw=true;this._raiseBoundsChange()},_getRotationPoint:function(e){return this.getBoundsNoRotate(e).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(e){if(e===this.compositeOperation){return}this.compositeOperation=e;this._needsDraw=true;this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation})},setAjaxHeaders:function(t,i){if(t===null){t={}}if(!e.isPlainObject(t)){console.error("[TiledImage.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}this._ownAjaxHeaders=t;this._updateAjaxHeaders(i)},_updateAjaxHeaders:function(t){if(t===undefined){t=true}if(e.isPlainObject(this.viewer.ajaxHeaders)){this.ajaxHeaders=e.extend({},this.viewer.ajaxHeaders,this._ownAjaxHeaders)}else{this.ajaxHeaders=this._ownAjaxHeaders}if(t){var i,n,r,o;for(var s in this.tilesMatrix){i=this.source.getNumTiles(s);for(var a in this.tilesMatrix[s]){n=(i.x+a%i.x)%i.x;for(var l in this.tilesMatrix[s][a]){r=(i.y+l%i.y)%i.y;o=this.tilesMatrix[s][a][l];o.loadWithAjax=this.loadTilesWithAjax;if(o.loadWithAjax){var h=this.source.getTileAjaxHeaders(s,n,r);o.ajaxHeaders=e.extend({},this.ajaxHeaders,h)}else{o.ajaxHeaders=null}}}}for(var u=0;u<this._imageLoader.jobQueue.length;u++){var c=this._imageLoader.jobQueue[u];c.loadWithAjax=c.tile.loadWithAjax;c.ajaxHeaders=c.tile.loadWithAjax?c.tile.ajaxHeaders:null}}},_setScale:function(e,t){var i=this._scaleSpring.target.value===e;if(t){if(i&&this._scaleSpring.current.value===e){return}this._scaleSpring.resetTo(e);this._updateForScale();this._needsDraw=true}else{if(i){return}this._scaleSpring.springTo(e);this._updateForScale();this._needsDraw=true}if(!i){this._raiseBoundsChange()}},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value;this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value;this._worldWidthCurrent=this._scaleSpring.current.value;this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent("bounds-change")},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var e=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2)));var t=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),true).x*this._scaleSpring.current.value;var i=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(t/this.minPixelRatio)/Math.log(2))));i=Math.max(i,this.source.minLevel||0);e=Math.min(e,i);return{lowestLevel:e,highestLevel:i}},_updateViewport:function(){this._needsDraw=false;this._tilesLoading=0;this.loadingCoverage={};while(this.lastDrawn.length>0){var t=this.lastDrawn.pop();t.beingDrawn=false}var i=this.viewport;var n=this._viewportToTiledImageRectangle(i.getBoundsWithMargins(true));if(!this.wrapHorizontal&&!this.wrapVertical){var r=this._viewportToTiledImageRectangle(this.getClippedBounds(true));n=n.intersection(r);if(n===null){return}}var o=this._getLevelsInterval();var s=o.lowestLevel;var a=o.highestLevel;var l=null;var h=false;var u=e.now();for(var c=a;c>=s;c--){var d=false;var p=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(c),true).x*this._scaleSpring.current.value;if(c===s||!h&&p>=this.minPixelRatio){d=true;h=true}else if(!h){continue}var f=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(c),false).x*this._scaleSpring.current.value;var g=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),false).x*this._scaleSpring.current.value;var v=this.immediateRender?1:g;var m=Math.min(1,(p-.5)/.5);var y=v/Math.abs(v-f);l=this._updateLevel(h,d,c,m,y,n,u,l);if(this._providesCoverage(this.coverage,c)){break}}this._drawTiles(this.lastDrawn);if(l&&!l.context2D){this._loadTile(l,u);this._needsDraw=true;this._setFullyLoaded(false)}else{this._setFullyLoaded(this._tilesLoading===0)}},_getCornerTiles:function(t,i,n){var r;var o;if(this.wrapHorizontal){r=e.positiveModulo(i.x,1);o=e.positiveModulo(n.x,1)}else{r=Math.max(0,i.x);o=Math.min(1,n.x)}var s;var a;var l=1/this.source.aspectRatio;if(this.wrapVertical){s=e.positiveModulo(i.y,l);a=e.positiveModulo(n.y,l)}else{s=Math.max(0,i.y);a=Math.min(l,n.y)}var h=this.source.getTileAtPoint(t,new e.Point(r,s));var u=this.source.getTileAtPoint(t,new e.Point(o,a));var c=this.source.getNumTiles(t);if(this.wrapHorizontal){h.x+=c.x*Math.floor(i.x);u.x+=c.x*Math.floor(n.x)}if(this.wrapVertical){h.y+=c.y*Math.floor(i.y/l);u.y+=c.y*Math.floor(n.y/l)}return{topLeft:h,bottomRight:u}},_updateLevel:function(e,t,i,n,r,o,s,a){var l=o.getBoundingBox().getTopLeft();var h=o.getBoundingBox().getBottomRight();if(this.viewer){this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:e,level:i,opacity:n,visibility:r,drawArea:o,topleft:l,bottomright:h,currenttime:s,best:a})}this._resetCoverage(this.coverage,i);this._resetCoverage(this.loadingCoverage,i);var u=this._getCornerTiles(i,l,h);var c=u.topLeft;var d=u.bottomRight;var p=this.source.getNumTiles(i);var f=this.viewport.pixelFromPoint(this.viewport.getCenter());if(this.getFlip()){d.x+=1;if(!this.wrapHorizontal){d.x=Math.min(d.x,p.x-1)}}for(var g=c.x;g<=d.x;g++){for(var v=c.y;v<=d.y;v++){var m;if(this.getFlip()){var y=(p.x+g%p.x)%p.x;m=g+p.x-y-y-1}else{m=g}if(o.intersection(this.getTileBounds(i,m,v))===null){continue}a=this._updateTile(t,e,m,v,i,n,r,f,p,s,a)}}return a},_updateTile:function(e,t,i,n,r,o,s,a,l,h,u){var c=this._getTile(i,n,r,h,l,this._worldWidthCurrent,this._worldHeightCurrent),d=t;if(this.viewer){this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:c})}this._setCoverage(this.coverage,r,i,n,false);var p=c.loaded||c.loading||this._isCovered(this.loadingCoverage,r,i,n);this._setCoverage(this.loadingCoverage,r,i,n,p);if(!c.exists){return u}if(e&&!d){if(this._isCovered(this.coverage,r,i,n)){this._setCoverage(this.coverage,r,i,n,true)}else{d=true}}if(!d){return u}this._positionTile(c,this.source.tileOverlap,this.viewport,a,s);if(!c.loaded){if(c.context2D){this._setTileLoaded(c)}else{var f=this._tileCache.getImageRecord(c.cacheKey);if(f){this._setTileLoaded(c,f.getData())}}}if(c.loaded){var g=this._blendTile(c,i,n,r,o,h);if(g){this._needsDraw=true}}else if(c.loading){this._tilesLoading++}else if(!p){u=this._compareTiles(u,c)}return u},_getTile:function(t,i,n,r,o,s,a){var l,h,u,c,d,p,f,g,v,m,y=this.tilesMatrix,w=this.source;if(!y[n]){y[n]={}}if(!y[n][t]){y[n][t]={}}if(!y[n][t][i]||!y[n][t][i].flipped!==!this.flipped){l=(o.x+t%o.x)%o.x;h=(o.y+i%o.y)%o.y;u=this.getTileBounds(n,t,i);c=w.getTileBounds(n,l,h,true);d=w.tileExists(n,l,h);p=w.getTileUrl(n,l,h);f=w.getTilePostData(n,l,h);if(this.loadTilesWithAjax){g=w.getTileAjaxHeaders(n,l,h);if(e.isPlainObject(this.ajaxHeaders)){g=e.extend({},this.ajaxHeaders,g)}}else{g=null}v=w.getContext2D?w.getContext2D(n,l,h):undefined;m=new e.Tile(n,t,i,u,d,p,v,this.loadTilesWithAjax,g,c,f,w.getTileHashKey(n,l,h,p,g,f));if(this.getFlip()){if(l===0){m.isRightMost=true}}else{if(l===o.x-1){m.isRightMost=true}}if(h===o.y-1){m.isBottomMost=true}m.flipped=this.flipped;y[n][t][i]=m}m=y[n][t][i];m.lastTouchTime=r;return m},_loadTile:function(e,t){var i=this;e.loading=true;this._imageLoader.addJob({src:e.getUrl(),tile:e,source:this.source,postData:e.postData,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(n,r,o){i._onTileLoad(e,t,n,r,o)},abort:function(){e.loading=false}})},_onTileLoad:function(t,i,n,r,o){if(!n){e.console.error("Tile %s failed to load: %s - error: %s",t,t.getUrl(),r);this.viewer.raiseEvent("tile-load-failed",{tile:t,tiledImage:this,time:i,message:r,tileRequest:o});t.loading=false;t.exists=false;return}else{t.exists=true}if(i<this.lastResetTime){e.console.warn("Ignoring tile %s loaded before reset: %s",t,t.getUrl());t.loading=false;return}var s=this,a=function(){var e=s.source;var i=e.getClosestLevel();s._setTileLoaded(t,n,i,o)};if(!this._midDraw){a()}else{window.setTimeout(a,1)}},_setTileLoaded:function(t,i,n,r){var o=0,s=false,a=this;function l(){if(s){e.console.error("Event 'tile-loaded' argument getCompletionCallback must be called synchronously. "+"Its return value should be called asynchronously.")}o++;return h}function h(){o--;if(o===0){t.loading=false;t.loaded=true;t.hasTransparency=a.source.hasTransparency(t.context2D,t.getUrl(),t.ajaxHeaders,t.postData);if(!t.context2D){a._tileCache.cacheTile({data:i,tile:t,cutoff:n,tiledImage:a})}a._needsDraw=true}}var u=l();this.viewer.raiseEvent("tile-loaded",{tile:t,tiledImage:this,tileRequest:r,get image(){e.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead.");return i},data:i,getCompletionCallback:l});s=true;u()},_positionTile:function(t,i,n,r,o){var s=t.bounds.getTopLeft();s.x*=this._scaleSpring.current.value;s.y*=this._scaleSpring.current.value;s.x+=this._xSpring.current.value;s.y+=this._ySpring.current.value;var a=t.bounds.getSize();a.x*=this._scaleSpring.current.value;a.y*=this._scaleSpring.current.value;var l=n.pixelFromPointNoRotate(s,true),h=n.pixelFromPointNoRotate(s,false),u=n.deltaPixelsFromPointsNoRotate(a,true),c=n.deltaPixelsFromPointsNoRotate(a,false),d=h.plus(c.divide(2)),p=r.squaredDistanceTo(d);if(!i){u=u.plus(new e.Point(1,1))}if(t.isRightMost&&this.wrapHorizontal){u.x+=.75}if(t.isBottomMost&&this.wrapVertical){u.y+=.75}t.position=l;t.size=u;t.squaredDistance=p;t.visibility=o},_blendTile:function(e,t,i,n,r,o){var s=1e3*this.blendTime,a,l;if(!e.blendStart){e.blendStart=o}a=o-e.blendStart;l=s?Math.min(1,a/s):1;if(this.alwaysBlend){l*=r}e.opacity=l;this.lastDrawn.push(e);if(l===1){this._setCoverage(this.coverage,n,t,i,true);this._hasOpaqueTile=true}else if(a<s){return true}return false},_compareTiles:function(e,t){if(!e){return t}if(t.visibility>e.visibility){return t}else if(t.visibility===e.visibility){if(t.squaredDistance<e.squaredDistance){return t}}return e},_drawTiles:function(t){if(this.opacity===0||t.length===0&&!this.placeholderFillStyle){return}var i=t[0];var n;if(i){n=this.opacity<1||this.compositeOperation&&this.compositeOperation!=="source-over"||!this._isBottomItem()&&this.source.hasTransparency(i.context2D,i.getUrl(),i.ajaxHeaders,i.postData)}var r;var s;var a=this.viewport.getZoom(true);var l=this.viewportToImageZoom(a);if(t.length>1&&l>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(true)%360===0&&e.supportsCanvas&&this.viewer.useCanvas){n=true;r=i.getScaleForEdgeSmoothing();s=i.getTranslationForEdgeSmoothing(r,this._drawer.getCanvasSize(false),this._drawer.getCanvasSize(true))}var h;if(n){if(!r){h=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(true)).getIntegerBoundingBox();if(this._drawer.viewer.viewport.getFlip()){if(this.viewport.getRotation(true)%360!==0||this.getRotation(true)%360!==0){h.x=this._drawer.viewer.container.clientWidth-(h.x+h.width)}}h=h.times(e.pixelDensityRatio)}this._drawer._clear(true,h)}if(!r){if(this.viewport.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.viewport.getRotation(true),useSketch:n})}if(this.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.getRotation(true),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(true),true),useSketch:n})}if(this.viewport.getRotation(true)%360===0&&this.getRotation(true)%360===0){if(this._drawer.viewer.viewport.getFlip()){this._drawer._flip()}}}var u=false;if(this._clip){this._drawer.saveContext(n);var c=this.imageToViewportRectangle(this._clip,true);c=c.rotate(-this.getRotation(true),this._getRotationPoint(true));var d=this._drawer.viewportToDrawerRectangle(c);if(r){d=d.times(r)}if(s){d=d.translate(s)}this._drawer.setClip(d,n);u=true}if(this._croppingPolygons){var p=this;this._drawer.saveContext(n);try{var f=this._croppingPolygons.map((function(e){return e.map((function(e){var t=p.imageToViewportCoordinates(e.x,e.y,true).rotate(-p.getRotation(true),p._getRotationPoint(true));var i=p._drawer.viewportCoordToDrawerCoord(t);if(r){i=i.times(r)}if(s){i=i.plus(s)}return i}))}));this._drawer.clipWithPolygons(f,n)}catch(t){e.console.error(t)}u=true}if(this.placeholderFillStyle&&this._hasOpaqueTile===false){var g=this._drawer.viewportToDrawerRectangle(this.getBounds(true));if(r){g=g.times(r)}if(s){g=g.translate(s)}var v=null;if(typeof this.placeholderFillStyle==="function"){v=this.placeholderFillStyle(this,this._drawer.context)}else{v=this.placeholderFillStyle}this._drawer.drawRectangle(g,v,n)}var m=o(this.subPixelRoundingForTransparency);var y=false;if(m===e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS){y=true}else if(m===e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){var w=this.viewer&&this.viewer.isAnimating();y=!w}for(var T=t.length-1;T>=0;T--){i=t[T];this._drawer.drawTile(i,this._drawingHandler,n,r,s,y,this.source);i.beingDrawn=true;if(this.viewer){this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:i})}}if(u){this._drawer.restoreContext(n)}if(!r){if(this.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(n)}if(this.viewport.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(n)}}if(n){if(r){if(this.viewport.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.viewport.getRotation(true),useSketch:false})}if(this.getRotation(true)%360!==0){this._drawer._offsetForRotation({degrees:this.getRotation(true),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(true),true),useSketch:false})}}this._drawer.blendSketch({opacity:this.opacity,scale:r,translate:s,compositeOperation:this.compositeOperation,bounds:h});if(r){if(this.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(false)}if(this.viewport.getRotation(true)%360!==0){this._drawer._restoreRotationChanges(false)}}}if(!r){if(this.viewport.getRotation(true)%360===0&&this.getRotation(true)%360===0){if(this._drawer.viewer.viewport.getFlip()){this._drawer._flip()}}}this._drawDebugInfo(t)},_drawDebugInfo:function(t){if(this.debugMode){for(var i=t.length-1;i>=0;i--){var n=t[i];try{this._drawer.drawDebugInfo(n,t.length,i,this)}catch(t){e.console.error(t)}}}},_providesCoverage:function(e,t,i,n){var r,o,s,a;if(!e[t]){return false}if(i===undefined||n===undefined){r=e[t];for(s in r){if(Object.prototype.hasOwnProperty.call(r,s)){o=r[s];for(a in o){if(Object.prototype.hasOwnProperty.call(o,a)&&!o[a]){return false}}}}return true}return e[t][i]===undefined||e[t][i][n]===undefined||e[t][i][n]===true},_isCovered:function(e,t,i,n){if(i===undefined||n===undefined){return this._providesCoverage(e,t+1)}else{return this._providesCoverage(e,t+1,2*i,2*n)&&this._providesCoverage(e,t+1,2*i,2*n+1)&&this._providesCoverage(e,t+1,2*i+1,2*n)&&this._providesCoverage(e,t+1,2*i+1,2*n+1)}},_setCoverage:function(t,i,n,r,o){if(!t[i]){e.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",i);return}if(!t[i][n]){t[i][n]={}}t[i][n][r]=o},_resetCoverage:function(e,t){e[t]={}}});var i=e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function n(t){return t!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&t!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&t!==e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function r(e){if(n(e)){return i}return e}function o(t){if(typeof t==="number"){return r(t)}if(!t||!e.Browser){return i}var o=t[e.Browser.vendor];if(n(o)){o=t["*"]}return r(o)}})(t);(function(e){var t=function(t){e.console.assert(t,"[TileCache.cacheTile] options is required");e.console.assert(t.tile,"[TileCache.cacheTile] options.tile is required");e.console.assert(t.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");this.tile=t.tile;this.tiledImage=t.tiledImage};var i=function(t){e.console.assert(t,"[ImageRecord] options is required");e.console.assert(t.data,"[ImageRecord] options.data is required");this._tiles=[];t.create.apply(null,[this,t.data,t.ownerTile]);this._destroyImplementation=t.destroy.bind(null,this);this.getImage=t.getImage.bind(null,this);this.getData=t.getData.bind(null,this);this.getRenderedContext=t.getRenderedContext.bind(null,this)};i.prototype={destroy:function(){this._destroyImplementation();this._tiles=null},addTile:function(t){e.console.assert(t,"[ImageRecord.addTile] tile is required");this._tiles.push(t)},removeTile:function(t){for(var i=0;i<this._tiles.length;i++){if(this._tiles[i]===t){this._tiles.splice(i,1);return}}e.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",t)},getTileCount:function(){return this._tiles.length}};e.TileCache=function(t){t=t||{};this._maxImageCacheCount=t.maxImageCacheCount||e.DEFAULT_SETTINGS.maxImageCacheCount;this._tilesLoaded=[];this._imagesLoaded=[];this._imagesLoadedCount=0};e.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(n){e.console.assert(n,"[TileCache.cacheTile] options is required");e.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required");e.console.assert(n.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required");e.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var r=n.cutoff||0;var o=this._tilesLoaded.length;var s=this._imagesLoaded[n.tile.cacheKey];if(!s){if(!n.data){e.console.error("[TileCache.cacheTile] options.image was renamed to options.data. '.image' attribute "+"has been deprecated and will be removed in the future.");n.data=n.image}e.console.assert(n.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord");s=this._imagesLoaded[n.tile.cacheKey]=new i({data:n.data,ownerTile:n.tile,create:n.tiledImage.source.createTileCache,destroy:n.tiledImage.source.destroyTileCache,getImage:n.tiledImage.source.getTileCacheDataAsImage,getData:n.tiledImage.source.getTileCacheData,getRenderedContext:n.tiledImage.source.getTileCacheDataAsContext2D});this._imagesLoadedCount++}s.addTile(n.tile);n.tile.cacheImageRecord=s;if(this._imagesLoadedCount>this._maxImageCacheCount){var a=null;var l=-1;var h=null;var u,c,d,p,f,g;for(var v=this._tilesLoaded.length-1;v>=0;v--){g=this._tilesLoaded[v];u=g.tile;if(u.level<=r||u.beingDrawn){continue}else if(!a){a=u;l=v;h=g;continue}p=u.lastTouchTime;c=a.lastTouchTime;f=u.level;d=a.level;if(p<c||p===c&&f>d){a=u;l=v;h=g}}if(a&&l>=0){this._unloadTile(h);o=l}}this._tilesLoaded[o]=new t({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(t){e.console.assert(t,"[TileCache.clearTilesFor] tiledImage is required");var i;for(var n=0;n<this._tilesLoaded.length;++n){i=this._tilesLoaded[n];if(i.tiledImage===t){this._unloadTile(i);this._tilesLoaded.splice(n,1);n--}}},getImageRecord:function(t){e.console.assert(t,"[TileCache.getImageRecord] cacheKey is required");return this._imagesLoaded[t]},_unloadTile:function(t){e.console.assert(t,"[TileCache._unloadTile] tileRecord is required");var i=t.tile;var n=t.tiledImage;i.unload();i.cacheImageRecord=null;var r=this._imagesLoaded[i.cacheKey];r.removeTile(i);if(!r.getTileCount()){r.destroy();delete this._imagesLoaded[i.cacheKey];this._imagesLoadedCount--}n.viewer.raiseEvent("tile-unloaded",{tile:i,tiledImage:n})}}})(t);(function(e){e.World=function(t){var i=this;e.console.assert(t.viewer,"[World] options.viewer is required");e.EventSource.call(this);this.viewer=t.viewer;this._items=[];this._needsDraw=false;this._autoRefigureSizes=true;this._needsSizesFigured=false;this._delegatedFigureSizes=function(e){if(i._autoRefigureSizes){i._figureSizes()}else{i._needsSizesFigured=true}};this._figureSizes()};e.extend(e.World.prototype,e.EventSource.prototype,{addItem:function(t,i){e.console.assert(t,"[World.addItem] item is required");e.console.assert(t instanceof e.TiledImage,"[World.addItem] only TiledImages supported at this time");i=i||{};if(i.index!==undefined){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,t)}else{this._items.push(t)}if(this._autoRefigureSizes){this._figureSizes()}else{this._needsSizesFigured=true}this._needsDraw=true;t.addHandler("bounds-change",this._delegatedFigureSizes);t.addHandler("clip-change",this._delegatedFigureSizes);this.raiseEvent("add-item",{item:t})},getItemAt:function(t){e.console.assert(t!==undefined,"[World.getItemAt] index is required");return this._items[t]},getIndexOfItem:function(t){e.console.assert(t,"[World.getIndexOfItem] item is required");return e.indexOf(this._items,t)},getItemCount:function(){return this._items.length},setItemIndex:function(t,i){e.console.assert(t,"[World.setItemIndex] item is required");e.console.assert(i!==undefined,"[World.setItemIndex] index is required");var n=this.getIndexOfItem(t);if(i>=this._items.length){throw new Error("Index bigger than number of layers.")}if(i===n||n===-1){return}this._items.splice(n,1);this._items.splice(i,0,t);this._needsDraw=true;this.raiseEvent("item-index-change",{item:t,previousIndex:n,newIndex:i})},removeItem:function(t){e.console.assert(t,"[World.removeItem] item is required");var i=e.indexOf(this._items,t);if(i===-1){return}t.removeHandler("bounds-change",this._delegatedFigureSizes);t.removeHandler("clip-change",this._delegatedFigureSizes);t.destroy();this._items.splice(i,1);this._figureSizes();this._needsDraw=true;this._raiseRemoveItem(t)},removeAll:function(){this.viewer._cancelPendingImages();var e;var t;for(t=0;t<this._items.length;t++){e=this._items[t];e.removeHandler("bounds-change",this._delegatedFigureSizes);e.removeHandler("clip-change",this._delegatedFigureSizes);e.destroy()}var i=this._items;this._items=[];this._figureSizes();this._needsDraw=true;for(t=0;t<i.length;t++){e=i[t];this._raiseRemoveItem(e)}},resetItems:function(){for(var e=0;e<this._items.length;e++){this._items[e].reset()}},update:function(){var e=false;for(var t=0;t<this._items.length;t++){e=this._items[t].update()||e}return e},draw:function(){for(var e=0;e<this._items.length;e++){this._items[e].draw()}this._needsDraw=false},needsDraw:function(){for(var e=0;e<this._items.length;e++){if(this._items[e].needsDraw()){return true}}return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(e){this._autoRefigureSizes=e;if(e&this._needsSizesFigured){this._figureSizes();this._needsSizesFigured=false}},arrange:function(t){t=t||{};var i=t.immediately||false;var n=t.layout||e.DEFAULT_SETTINGS.collectionLayout;var r=t.rows||e.DEFAULT_SETTINGS.collectionRows;var o=t.columns||e.DEFAULT_SETTINGS.collectionColumns;var s=t.tileSize||e.DEFAULT_SETTINGS.collectionTileSize;var a=t.tileMargin||e.DEFAULT_SETTINGS.collectionTileMargin;var l=s+a;var h;if(!t.rows&&o){h=o}else{h=Math.ceil(this._items.length/r)}var u=0;var c=0;var d,p,f,g,v;this.setAutoRefigureSizes(false);for(var m=0;m<this._items.length;m++){if(m&&m%h===0){if(n==="horizontal"){c+=l;u=0}else{u+=l;c=0}}d=this._items[m];p=d.getBounds();if(p.width>p.height){f=s}else{f=s*(p.width/p.height)}g=f*(p.height/p.width);v=new e.Point(u+(s-f)/2,c+(s-g)/2);d.setPosition(v,i);d.setWidth(f,i);if(n==="horizontal"){u+=l}else{c+=l}}this.setAutoRefigureSizes(true)},_figureSizes:function(){var t=this._homeBounds?this._homeBounds.clone():null;var i=this._contentSize?this._contentSize.clone():null;var n=this._contentFactor||0;if(!this._items.length){this._homeBounds=new e.Rect(0,0,1,1);this._contentSize=new e.Point(1,1);this._contentFactor=1}else{var r=this._items[0];var o=r.getBounds();this._contentFactor=r.getContentSize().x/o.width;var s=r.getClippedBounds().getBoundingBox();var a=s.x;var l=s.y;var h=s.x+s.width;var u=s.y+s.height;for(var c=1;c<this._items.length;c++){r=this._items[c];o=r.getBounds();this._contentFactor=Math.max(this._contentFactor,r.getContentSize().x/o.width);s=r.getClippedBounds().getBoundingBox();a=Math.min(a,s.x);l=Math.min(l,s.y);h=Math.max(h,s.x+s.width);u=Math.max(u,s.y+s.height)}this._homeBounds=new e.Rect(a,l,h-a,u-l);this._contentSize=new e.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}if(this._contentFactor!==n||!this._homeBounds.equals(t)||!this._contentSize.equals(i)){this.raiseEvent("metrics-change",{})}},_raiseRemoveItem:function(e){this.raiseEvent("remove-item",{item:e})}})})(t)}));class o{constructor(e){this.type="DziViewer";this.opts=e}init(){return t(this,void 0,void 0,(function*(){const e=this.app.getState();const t=this.opts.holder;t.append("div").attr("id","openseadragon-viewer").style("width"," 800px").style("height"," 800px");const i=[];for(const t of e.dzimages){i.push(`dzimages/${e.sample_id}?genome=${e.genome}&dslabel=${e.dslabel}&file=${t}`)}r({id:"openseadragon-viewer",tileSources:i,prefixUrl:"https://openseadragon.github.io/openseadragon/images/",showNavigator:true,sequenceMode:i.length>1})}))}}const s=e(o);const a=s;function l(){return t(this,void 0,void 0,(function*(){return{chartType:"DziViewer",subfolder:"dziviewer",extension:"ts"}}))}export{a as componentInit,s as dziViewer,l as getPlotConfig};
|