diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b21e2d..d6252f92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,89 @@ +## [2.23.2](https://github.com/eeditiones/tei-publisher-components/compare/v2.23.1...v2.23.2) (2024-05-19) + + +### Bug Fixes + +* **pb-facs-link:** emit-on-load should also wait for pb-facsimile/pb-tify to be available ([b16730a](https://github.com/eeditiones/tei-publisher-components/commit/b16730a07c7d930080b35de2de9af75da93b3ab2)) +* **pb-mixin:** fix bug in wait method introduced by 189d5a1ac87014db3452f846cf506616a12959f4 ([afb665d](https://github.com/eeditiones/tei-publisher-components/commit/afb665d9a720c484bbf0549628780920f7a91447)) +* **pb-mixin:** the wait method needs to make sure the HTML DOM has been loaded entirely before selecting elements to wait for ([189d5a1](https://github.com/eeditiones/tei-publisher-components/commit/189d5a1ac87014db3452f846cf506616a12959f4)) +* **pb-tify:** emit ready event element is connected ([b8bae11](https://github.com/eeditiones/tei-publisher-components/commit/b8bae1199030dd8d3b68307507be9ac3246a4e9f)) + +## [2.23.1](https://github.com/eeditiones/tei-publisher-components/compare/v2.23.0...v2.23.1) (2024-05-16) + + +### Bug Fixes + +* **pb-authority-lookup, anton:** avoid error if json.data.location == null ([d06a34a](https://github.com/eeditiones/tei-publisher-components/commit/d06a34acc923b80b3b788bef5fa6fb2aecd18a35)) + +# [2.23.0](https://github.com/eeditiones/tei-publisher-components/compare/v2.22.2...v2.23.0) (2024-05-15) + + +### Features + +* **pb-facsimile:** added option to add download icon to trigger download of current viewport. Added a demo for the feature ([0233c83](https://github.com/eeditiones/tei-publisher-components/commit/0233c8333e9e78ed529a21361e358974c1cecf46)) + +## [2.22.2](https://github.com/eeditiones/tei-publisher-components/compare/v2.22.1...v2.22.2) (2024-05-02) + + +### Bug Fixes + +* **pb-grid:** emit pb-refresh to configured channel only ([63091ab](https://github.com/eeditiones/tei-publisher-components/commit/63091ab6d509770b8b847fe25fe5a1a2ed7d86e8)) + +## [2.22.1](https://github.com/eeditiones/tei-publisher-components/compare/v2.22.0...v2.22.1) (2024-05-02) + + +### Bug Fixes + +* **pb-grid:** remove panel broken ([44bcf81](https://github.com/eeditiones/tei-publisher-components/commit/44bcf8150832042c9706cc8e3e4dee8c19db9689)) + +# [2.22.0](https://github.com/eeditiones/tei-publisher-components/compare/v2.21.0...v2.22.0) (2024-05-02) + + +### Features + +* adds zoom to pb-grid ([c3f557d](https://github.com/eeditiones/tei-publisher-components/commit/c3f557d83ff13e23dad5a9162af5f9f0f7e319ad)) + +# [2.21.0](https://github.com/eeditiones/tei-publisher-components/compare/v2.20.0...v2.21.0) (2024-05-02) + + +### Bug Fixes + +* no scrolling when component is disabled ([dfe1881](https://github.com/eeditiones/tei-publisher-components/commit/dfe188178d556608501a5e600ccb81591565e6c2)) + + +### Features + +* changes vertical alignment of scroll ([38b8dce](https://github.com/eeditiones/tei-publisher-components/commit/38b8dce6f5e6dc63c38aa34905b21dc1ab832c33)) + +# [2.20.0](https://github.com/eeditiones/tei-publisher-components/compare/v2.19.3...v2.20.0) (2024-05-02) + + +### Features + +* **pb-grid:** support dragging a panel to a different position in the grid ([4cf75f8](https://github.com/eeditiones/tei-publisher-components/commit/4cf75f8edb0294a8943846037c44a41e87a76afd)) + +## [2.19.3](https://github.com/eeditiones/tei-publisher-components/compare/v2.19.2...v2.19.3) (2024-04-25) + + +### Bug Fixes + +* **pb-facsimile:** using patched OSD from jinntec/openseadragon and corrected finding the pb-page element. ([2a89c8d](https://github.com/eeditiones/tei-publisher-components/commit/2a89c8d108260608eab76ade31b81f289ce1902b)) + +## [2.19.2](https://github.com/eeditiones/tei-publisher-components/compare/v2.19.1...v2.19.2) (2024-03-23) + + +### Bug Fixes + +* **pb-tify:** make sure container div is created ([e96f4f2](https://github.com/eeditiones/tei-publisher-components/commit/e96f4f2ba27d83096c5cf84ce4943bd00ba62091)) + +## [2.19.1](https://github.com/eeditiones/tei-publisher-components/compare/v2.19.0...v2.19.1) (2024-02-16) + + +### Bug Fixes + +* **pb-leaflet-map:** pb-leaflet-marker-click event details should include reference to pb-geolocation element where possible ([da54cdb](https://github.com/eeditiones/tei-publisher-components/commit/da54cdb99bda19ab2bb9386d5d0e2e3b3196ee19)) +* **pb-table-grid:** react to language changes ([50cc2a0](https://github.com/eeditiones/tei-publisher-components/commit/50cc2a019bde937061499cd151cda9aed455c31a)) + # [2.19.0](https://github.com/eeditiones/tei-publisher-components/compare/v2.18.4...v2.19.0) (2024-01-26) diff --git a/demo/demos.json b/demo/demos.json index 784a44f8..a9226d78 100644 --- a/demo/demos.json +++ b/demo/demos.json @@ -40,7 +40,8 @@ }, "pb-facsimile": { "demo/pb-facsimile.html": "Demo", - "demo/pb-facsimile-2.html": "Align text page with facsimile" + "demo/pb-facsimile-2.html": "Align text page with facsimile", + "demo/pb-facsimile-3.html": "With Download Button" }, "pb-image-strip": { "demo/pb-image-strip-view.html": "Demo with pb-view", diff --git a/demo/pb-facsimile-3.html b/demo/pb-facsimile-3.html new file mode 100644 index 00000000..6ef797b9 --- /dev/null +++ b/demo/pb-facsimile-3.html @@ -0,0 +1,82 @@ + + + + + + + pb-view Demo + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/openseadragon.min.js b/lib/openseadragon.min.js index 4a1d1ee0..77b9fbe4 100644 --- a/lib/openseadragon.min.js +++ b/lib/openseadragon.min.js @@ -1,9 +1,80 @@ -//! openseadragon 4.0.1 -//! Built on 2023-03-17 -//! Git commit: unknown +//! openseadragon 4.1.1 +//! Built on 2024-04-25 +//! Git commit: v4.1.0-254-65bd08d5 //! http://openseadragon.github.io //! License: http://openseadragon.github.io/license/ -function OpenSeadragon(e){return new OpenSeadragon.Viewer(e)}!function(n){n.version={versionStr:"4.0.1",major:parseInt("4",10),minor:parseInt("0",10),revision:parseInt("1",10)};var t={"[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"},i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;n.isFunction=function(e){return"function"===n.type(e)};n.isArray=Array.isArray||function(e){return"array"===n.type(e)};n.isWindow=function(e){return e&&"object"==typeof e&&"setInterval"in e};n.type=function(e){return null==e?String(e):t[i.call(e)]||"object"};n.isPlainObject=function(e){if(!e||"object"!==OpenSeadragon.type(e)||e.nodeType||n.isWindow(e))return!1;if(e.constructor&&!o.call(e,"constructor")&&!o.call(e.constructor.prototype,"isPrototypeOf"))return!1;var t;for(var i in e)t=i;return void 0===t||o.call(e,t)};n.isEmptyObject=function(e){for(var t in e)return!1;return!0};n.freezeObject=function(e){Object.freeze?n.freezeObject=Object.freeze:n.freezeObject=function(e){return e};return n.freezeObject(e)};n.supportsCanvas=(e=document.createElement("canvas"),!(!n.isFunction(e.getContext)||!e.getContext("2d")));var e;n.isCanvasTainted=function(e){var t=!1;try{e.getContext("2d").getImageData(0,0,1,1)}catch(e){t=!0}return t};n.supportsAddEventListener=!(!document.documentElement.addEventListener||!document.addEventListener);n.supportsRemoveEventListener=!(!document.documentElement.removeEventListener||!document.removeEventListener);n.supportsEventListenerOptions=function(){var t=0;if(n.supportsAddEventListener)try{var e={get capture(){t++;return!1},get once(){t++;return!1},get passive(){t++;return!1}};window.addEventListener("test",null,e);window.removeEventListener("test",null,e)}catch(e){t=0}return 3<=t}();n.getCurrentPixelDensityRatio=function(){if(n.supportsCanvas){var e=document.createElement("canvas").getContext("2d");var t=window.devicePixelRatio||1;e=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return Math.max(t,1)/e}return 1};n.pixelDensityRatio=n.getCurrentPixelDensityRatio()}(OpenSeadragon);!function(u){u.extend=function(){var e,t,i,n,o,r=arguments[0]||{},s=arguments.length,a=!1,l=1;if("boolean"==typeof r){a=r;r=arguments[1]||{};l=2}"object"==typeof r||OpenSeadragon.isFunction(r)||(r={});if(s===l){r=this;--l}for(;l=i.x&&t.x=i.y},getMousePosition:function(e){if("number"==typeof e.pageX)u.getMousePosition=function(e){var t=new u.Point;t.x=e.pageX;t.y=e.pageY;return t};else{if("number"!=typeof e.clientX)throw new Error("Unknown event mouse position, no known technique.");u.getMousePosition=function(e){var t=new u.Point;t.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;t.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;return t}}return u.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},t=document.body||{};if("number"==typeof window.pageXOffset)u.getPageScroll=function(){return new u.Point(window.pageXOffset,window.pageYOffset)};else if(t.scrollLeft||t.scrollTop)u.getPageScroll=function(){return new u.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new u.Point(0,0);u.getPageScroll=function(){return new u.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return u.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)u.setPageScroll=function(e){window.scrollTo(e.x,e.y)};else{var t=u.getPageScroll();if(t.x===e.x&&t.y===e.y)return;document.body.scrollLeft=e.x;document.body.scrollTop=e.y;var i=u.getPageScroll();if(i.x!==t.x&&i.y!==t.y){u.setPageScroll=function(e){document.body.scrollLeft=e.x;document.body.scrollTop=e.y};return}document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y;if((i=u.getPageScroll()).x!==t.x&&i.y!==t.y){u.setPageScroll=function(e){document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y};return}u.setPageScroll=function(e){}}u.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},t=document.body||{};if("number"==typeof window.innerWidth)u.getWindowSize=function(){return new u.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)u.getWindowSize=function(){return new u.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!t.clientWidth&&!t.clientHeight)throw new Error("Unknown window size, no known technique.");u.getWindowSize=function(){return new u.Point(document.body.clientWidth,document.body.clientHeight)}}return u.getWindowSize()},makeCenteredNode:function(e){e=u.getElement(e);var t=[u.makeNeutralElement("div"),u.makeNeutralElement("div"),u.makeNeutralElement("div")];u.extend(t[0].style,{display:"table",height:"100%",width:"100%"});u.extend(t[1].style,{display:"table-row"});u.extend(t[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"});t[0].appendChild(t[1]);t[1].appendChild(t[2]);t[2].appendChild(e);return t[0]},makeNeutralElement:function(e){var t=document.createElement(e),e=t.style;e.background="transparent none";e.border="none";e.margin="0px";e.padding="0px";e.position="static";return t},now:function(){Date.now?u.now=Date.now:u.now=function(){return(new Date).getTime()};return u.now()},makeTransparentImage:function(e){var t=u.makeNeutralElement("img");t.src=e;return t},setElementOpacity:function(e,t,i){e=u.getElement(e);i&&!u.Browser.alpha&&(t=Math.round(t));if(u.Browser.opacity)e.style.opacity=t<1?t:"";else if(t<1){t=Math.round(100*t);e.style.filter="alpha(opacity="+t+")"}else e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=u.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},setElementPointerEvents:function(e,t){void 0!==(e=u.getElement(e)).style&&void 0!==e.style.pointerEvents&&(e.style.pointerEvents=t)},setElementPointerEventsNone:function(e){u.setElementPointerEvents(e,"none")},addClass:function(e,t){(e=u.getElement(e)).className?-1===(" "+e.className+" ").indexOf(" "+t+" ")&&(e.className+=" "+t):e.className=t},indexOf:function(e,t,i){Array.prototype.indexOf?this.indexOf=function(e,t,i){return e.indexOf(t,i)}:this.indexOf=function(e,t,i){var n,o,i=i||0;if(!e)throw new TypeError;if(0===(o=e.length)||o<=i)return-1;for(n=i=i<0?o-Math.abs(i):i;nt.touches.length-r&&c.console.warn("Tracked touch contact count doesn't match event.touches.length");var a={originalEvent:t,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};H(e,a);for(n=0;n\s*$/))n=m.parseXml(n);else if(n.match(/^\s*[{[].*[}\]]\s*$/))try{var e=m.parseJSON(n);n=e}catch(e){}function l(e,t){if(e.ready)r(e);else{e.addHandler("ready",function(){r(e)});e.addHandler("open-failed",function(e){s({message:e.message,source:t})})}}setTimeout(function(){if("string"===m.type(n))(n=new m.TileSource({url:n,crossOriginPolicy:(void 0!==o.crossOriginPolicy?o:i).crossOriginPolicy,ajaxWithCredentials:i.ajaxWithCredentials,ajaxHeaders:o.ajaxHeaders||i.ajaxHeaders,splitHashDataForPost:i.splitHashDataForPost,useCanvas:i.useCanvas,success:function(e){r(e.tileSource)}})).addHandler("open-failed",function(e){s(e)});else if(m.isPlainObject(n)||n.nodeType){void 0!==n.crossOriginPolicy||void 0===o.crossOriginPolicy&&void 0===i.crossOriginPolicy||(n.crossOriginPolicy=(void 0!==o.crossOriginPolicy?o:i).crossOriginPolicy);void 0===n.ajaxWithCredentials&&(n.ajaxWithCredentials=i.ajaxWithCredentials);void 0===n.useCanvas&&(n.useCanvas=i.useCanvas);if(m.isFunction(n.getTileUrl)){var e=new m.TileSource(n);e.getTileUrl=n.getTileUrl;r(e)}else{var t=m.TileSource.determineType(a,n);if(t){e=t.prototype.configure.apply(a,[n]);l(new t(e),n)}else s({message:"Unable to load TileSource",source:n})}}else l(n,n)})}(this,i.tileSource,i,function(e){o.tileSource=e;s()},function(e){e.options=i;t(e);s()})}function s(){var e,t;for(;n._loadQueue.length&&(e=n._loadQueue[0]).tileSource;){n._loadQueue.splice(0,1);if(e.options.replace){var i=n.world.getIndexOfItem(e.options.replaceItem);-1!==i&&(e.options.index=i);n.world.removeItem(e.options.replaceItem)}t=new m.TiledImage({viewer:n,source:e.tileSource,viewport:n.viewport,drawer:n.drawer,tileCache:n.tileCache,imageLoader:n.imageLoader,x:e.options.x,y:e.options.y,width:e.options.width,height:e.options.height,fitBounds:e.options.fitBounds,fitBoundsPlacement:e.options.fitBoundsPlacement,clip:e.options.clip,placeholderFillStyle:e.options.placeholderFillStyle,opacity:e.options.opacity,preload:e.options.preload,degrees:e.options.degrees,flipped:e.options.flipped,compositeOperation:e.options.compositeOperation,springStiffness:n.springStiffness,animationTime:n.animationTime,minZoomImageRatio:n.minZoomImageRatio,wrapHorizontal:n.wrapHorizontal,wrapVertical:n.wrapVertical,immediateRender:n.immediateRender,blendTime:n.blendTime,alwaysBlend:n.alwaysBlend,minPixelRatio:n.minPixelRatio,smoothTileEdgesMinZoom:n.smoothTileEdgesMinZoom,iOSDevice:n.iOSDevice,crossOriginPolicy:e.options.crossOriginPolicy,ajaxWithCredentials:e.options.ajaxWithCredentials,loadTilesWithAjax:e.options.loadTilesWithAjax,ajaxHeaders:e.options.ajaxHeaders,debugMode:n.debugMode,subPixelRoundingForTransparency:n.subPixelRoundingForTransparency});n.collectionMode&&n.world.setAutoRefigureSizes(!1);if(n.navigator){i=m.extend({},e.options,{replace:!1,originalTiledImage:t,tileSource:e.tileSource});n.navigator.addTiledImage(i)}n.world.addItem(t,{index:e.options.index});0===n._loadQueue.length&&r(e);1!==n.world.getItemCount()||n.preserveViewport||n.viewport.goHome(!0);e.options.success&&e.options.success({item:t})}}},addSimpleImage:function(e){m.console.assert(e,"[Viewer.addSimpleImage] options is required");m.console.assert(e.url,"[Viewer.addSimpleImage] options.url is required");e=m.extend({},e,{tileSource:{type:"image",url:e.url}});delete e.url;this.addTiledImage(e)},addLayer:function(t){var i=this;m.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var e=m.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(e);return this},getLayerAtLevel:function(e){m.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead.");return this.world.getItemAt(e)},getLevelOfLayer:function(e){m.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead.");return this.world.getIndexOfItem(e)},getLayersCount:function(){m.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead.");return this.world.getItemCount()},setLayerLevel:function(e,t){m.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead.");return this.world.setItemIndex(e,t)},removeLayer:function(e){m.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead.");return this.world.removeItem(e)},forceRedraw:function(){c[this.hash].forceRedraw=!0;return this},forceResize:function(){c[this.hash].needsResize=!0;c[this.hash].forceResize=!0},bindSequenceControls:function(){var e=m.delegate(this,v),t=m.delegate(this,f),i=m.delegate(this,this.goToNextPage),n=m.delegate(this,this.goToPreviousPage),o=this.navImages,r=!0;if(this.showSequenceControl){(this.previousButton||this.nextButton)&&(r=!1);this.previousButton=new m.Button({element:this.previousButton?m.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.PreviousPage"),srcRest:H(this.prefixUrl,o.previous.REST),srcGroup:H(this.prefixUrl,o.previous.GROUP),srcHover:H(this.prefixUrl,o.previous.HOVER),srcDown:H(this.prefixUrl,o.previous.DOWN),onRelease:n,onFocus:e,onBlur:t});this.nextButton=new m.Button({element:this.nextButton?m.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.NextPage"),srcRest:H(this.prefixUrl,o.next.REST),srcGroup:H(this.prefixUrl,o.next.GROUP),srcHover:H(this.prefixUrl,o.next.HOVER),srcDown:H(this.prefixUrl,o.next.DOWN),onRelease:i,onFocus:e,onBlur:t});this.navPrevNextWrap||this.previousButton.disable();this.tileSources&&this.tileSources.length||this.nextButton.disable();if(r){this.paging=new m.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.pagingControl=this.paging.element;this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:m.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||m.ControlAnchor.TOP_LEFT})}}return this},bindStandardControls:function(){var e=m.delegate(this,L),t=m.delegate(this,M),i=m.delegate(this,N),n=m.delegate(this,F),o=m.delegate(this,A),r=m.delegate(this,W),s=m.delegate(this,V),a=m.delegate(this,G),l=m.delegate(this,j),h=m.delegate(this,q),c=m.delegate(this,v),u=m.delegate(this,f),d=this.navImages,p=[],g=!0;if(this.showNavigationControl){(this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(g=!1);if(this.showZoomControl){p.push(this.zoomInButton=new m.Button({element:this.zoomInButton?m.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.ZoomIn"),srcRest:H(this.prefixUrl,d.zoomIn.REST),srcGroup:H(this.prefixUrl,d.zoomIn.GROUP),srcHover:H(this.prefixUrl,d.zoomIn.HOVER),srcDown:H(this.prefixUrl,d.zoomIn.DOWN),onPress:e,onRelease:t,onClick:i,onEnter:e,onExit:t,onFocus:c,onBlur:u}));p.push(this.zoomOutButton=new m.Button({element:this.zoomOutButton?m.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.ZoomOut"),srcRest:H(this.prefixUrl,d.zoomOut.REST),srcGroup:H(this.prefixUrl,d.zoomOut.GROUP),srcHover:H(this.prefixUrl,d.zoomOut.HOVER),srcDown:H(this.prefixUrl,d.zoomOut.DOWN),onPress:n,onRelease:t,onClick:o,onEnter:n,onExit:t,onFocus:c,onBlur:u}))}this.showHomeControl&&p.push(this.homeButton=new m.Button({element:this.homeButton?m.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.Home"),srcRest:H(this.prefixUrl,d.home.REST),srcGroup:H(this.prefixUrl,d.home.GROUP),srcHover:H(this.prefixUrl,d.home.HOVER),srcDown:H(this.prefixUrl,d.home.DOWN),onRelease:r,onFocus:c,onBlur:u}));this.showFullPageControl&&p.push(this.fullPageButton=new m.Button({element:this.fullPageButton?m.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.FullPage"),srcRest:H(this.prefixUrl,d.fullpage.REST),srcGroup:H(this.prefixUrl,d.fullpage.GROUP),srcHover:H(this.prefixUrl,d.fullpage.HOVER),srcDown:H(this.prefixUrl,d.fullpage.DOWN),onRelease:s,onFocus:c,onBlur:u}));if(this.showRotationControl){p.push(this.rotateLeftButton=new m.Button({element:this.rotateLeftButton?m.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.RotateLeft"),srcRest:H(this.prefixUrl,d.rotateleft.REST),srcGroup:H(this.prefixUrl,d.rotateleft.GROUP),srcHover:H(this.prefixUrl,d.rotateleft.HOVER),srcDown:H(this.prefixUrl,d.rotateleft.DOWN),onRelease:a,onFocus:c,onBlur:u}));p.push(this.rotateRightButton=new m.Button({element:this.rotateRightButton?m.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.RotateRight"),srcRest:H(this.prefixUrl,d.rotateright.REST),srcGroup:H(this.prefixUrl,d.rotateright.GROUP),srcHover:H(this.prefixUrl,d.rotateright.HOVER),srcDown:H(this.prefixUrl,d.rotateright.DOWN),onRelease:l,onFocus:c,onBlur:u}))}this.showFlipControl&&p.push(this.flipButton=new m.Button({element:this.flipButton?m.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.Flip"),srcRest:H(this.prefixUrl,d.flip.REST),srcGroup:H(this.prefixUrl,d.flip.GROUP),srcHover:H(this.prefixUrl,d.flip.HOVER),srcDown:H(this.prefixUrl,d.flip.DOWN),onRelease:h,onFocus:c,onBlur:u}));if(g){this.buttonGroup=new m.ButtonGroup({buttons:p,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.navControl=this.buttonGroup.element;this.addHandler("open",m.delegate(this,U));(this.toolbar||this).addControl(this.navControl,{anchor:this.navigationControlAnchor||m.ControlAnchor.TOP_LEFT})}else this.customButtons=p}return this},currentPage:function(){return this._sequenceIndex},goToPage:function(e){if(this.tileSources&&0<=e&&e=this.tileSources.length&&(e=0);this.goToPage(e)},isAnimating:function(){return c[this.hash].animating}});function r(e){e=m.getElement(e);return new m.Point(0===e.clientWidth?1:e.clientWidth,0===e.clientHeight?1:e.clientHeight)}function h(e,t){if(t instanceof m.Overlay)return t;var i=null;if(t.element)i=m.getElement(t.element);else{var n=t.id||"openseadragon-overlay-"+Math.floor(1e7*Math.random());(i=m.getElement(t.id))||((i=document.createElement("a")).href="#/overlay/"+n);i.id=n;m.addClass(i,t.className||"openseadragon-overlay")}var o=t.location;var r=t.width;var s=t.height;if(!o){n=t.x;var a=t.y;if(void 0!==t.px){e=e.viewport.imageToViewportRectangle(new m.Rect(t.px,t.py,r||0,s||0));n=e.x;a=e.y;r=void 0!==r?e.width:void 0;s=void 0!==s?e.height:void 0}o=new m.Point(n,a)}a=t.placement;a&&"string"===m.type(a)&&(a=m.Placement[t.placement.toUpperCase()]);return new m.Overlay({element:i,location:o,placement:a,onDraw:t.onDraw,checkResize:t.checkResize,width:r,height:s,rotationMode:t.rotationMode})}function s(e,t){var i;for(i=e.length-1;0<=i;i--)if(e[i].element===t)return i;return-1}function a(e,t){return m.requestAnimationFrame(function(){t(e)})}function l(e){m.requestAnimationFrame(function(){!function(e){var t,i,n;if(e.controlsShouldFade){t=m.now();t=t-e.controlsFadeBeginTime;i=1-t/e.controlsFadeLength;i=Math.min(1,i);i=Math.max(0,i);for(n=e.controls.length-1;0<=n;n--)e.controls[n].autoFade&&e.controls[n].setOpacity(i);0=t.flickMinSpeed){var n=0;this.panHorizontal&&(n=t.flickMomentum*e.speed*Math.cos(e.direction));i=0;this.panVertical&&(i=t.flickMomentum*e.speed*Math.sin(e.direction));e=this.viewport.pixelFromPoint(this.viewport.getCenter(!0));i=this.viewport.pointFromPixel(new m.Point(e.x-n,e.y-i));this.viewport.panTo(i,!1)}this.viewport.applyConstraints()}t.dblClickDragToZoom&&!0===c[this.hash].draggingToZoom&&(c[this.hash].draggingToZoom=!1)}function S(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 E(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 P(e){this.raiseEvent("canvas-press",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent});if(this.gestureSettingsByDeviceType(e.pointerType).dblClickDragToZoom){var t=c[this.hash].lastClickTime;e=m.now();if(null!==t){e-tthis.minScrollDeltaTime){this._lastScrollTime=n;t={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:!1,preventDefault:!0};this.raiseEvent("canvas-scroll",t);if(!t.preventDefaultAction&&this.viewport){this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x);if((i=this.gestureSettingsByDeviceType(e.pointerType)).scrollToZoom){n=Math.pow(this.zoomPerScroll,e.scroll);this.viewport.zoomBy(n,i.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null);this.viewport.applyConstraints()}}e.preventDefault=t.preventDefault}else e.preventDefault=!0}function k(e){c[this.hash].mouseInside=!0;n(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 B(e){if(e.pointers<1){c[this.hash].mouseInside=!1;c[this.hash].animating||u(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 z(e){!function(e){if(!e._opening&&c[e.hash]){if(e.autoResize||c[e.hash].forceResize){if(e._autoResizePolling){i=r(e.container);var t=c[e.hash].prevContainerSize;i.equals(t)||(c[e.hash].needsResize=!0)}c[e.hash].needsResize&&function(e,t){var i=e.viewport;var n=i.getZoom();var o=i.getCenter();i.resize(t,e.preserveImageSizeOnResize);i.panTo(o,!0);var r;if(e.preserveImageSizeOnResize)r=c[e.hash].prevContainerSize.x/t.x;else{var s=new m.Point(0,0);o=new m.Point(c[e.hash].prevContainerSize.x,c[e.hash].prevContainerSize.y).distanceTo(s);s=new m.Point(t.x,t.y).distanceTo(s);r=s/o*c[e.hash].prevContainerSize.x/t.x}i.zoomTo(n*r,null,!0);c[e.hash].prevContainerSize=t;c[e.hash].forceRedraw=!0;c[e.hash].needsResize=!1;c[e.hash].forceResize=!1}(e,i||r(e.container))}t=e.viewport.update();var i=e.world.update()||t;t&&e.raiseEvent("viewport-change");e.referenceStrip&&(i=e.referenceStrip.update(e.viewport)||i);t=c[e.hash].animating;if(!t&&i){e.raiseEvent("animation-start");n(e)}t=t&&!i;t&&(c[e.hash].animating=!1);if(i||t||c[e.hash].forceRedraw||e.world.needsDraw()){!function(e){e.imageLoader.clear();e.drawer.clear();e.world.draw();e.raiseEvent("update-viewport",{})}(e);e._drawOverlays();e.navigator&&e.navigator.update(e.viewport);c[e.hash].forceRedraw=!1;i&&e.raiseEvent("animation")}if(t){e.raiseEvent("animation-finish");c[e.hash].mouseInside||u(e)}c[e.hash].animating=i}}(e);e.isOpen()?e._updateRequestId=a(e,z):e._updateRequestId=!1}function H(e,t){return e?e+t:t}function L(){c[this.hash].lastZoomTime=m.now();c[this.hash].zoomFactor=this.zoomPerSecond;c[this.hash].zooming=!0;i(this)}function F(){c[this.hash].lastZoomTime=m.now();c[this.hash].zoomFactor=1/this.zoomPerSecond;c[this.hash].zooming=!0;i(this)}function M(){c[this.hash].zooming=!1}function i(e){m.requestAnimationFrame(m.delegate(e,t))}function t(){var e,t;if(c[this.hash].zooming&&this.viewport){t=(e=m.now())-c[this.hash].lastZoomTime;t=Math.pow(c[this.hash].zoomFactor,t/1e3);this.viewport.zoomBy(t);this.viewport.applyConstraints();c[this.hash].lastZoomTime=e;i(this)}}function N(){if(this.viewport){c[this.hash].zooming=!1;this.viewport.zoomBy(+this.zoomPerClick);this.viewport.applyConstraints()}}function A(){if(this.viewport){c[this.hash].zooming=!1;this.viewport.zoomBy(1/this.zoomPerClick);this.viewport.applyConstraints()}}function U(){if(this.buttonGroup){this.buttonGroup.emulateEnter();this.buttonGroup.emulateLeave()}}function W(){this.viewport&&this.viewport.goHome()}function V(){this.isFullPage()&&!m.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage());this.buttonGroup&&this.buttonGroup.emulateLeave();this.fullPageButton.element.focus();this.viewport&&this.viewport.applyConstraints()}function G(){if(this.viewport){var e=this.viewport.getRotation();this.viewport.flipped?e+=this.rotationIncrement:e-=this.rotationIncrement;this.viewport.setRotation(e)}}function j(){if(this.viewport){var e=this.viewport.getRotation();this.viewport.flipped?e-=this.rotationIncrement:e+=this.rotationIncrement;this.viewport.setRotation(e)}}function q(){this.viewport.toggleFlip()}}(OpenSeadragon);!function(r){r.Navigator=function(i){var e,t=i.viewer,n=this;if(i.element||i.id){if(i.element){i.id&&r.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.");i.element.id?i.id=i.element.id:i.id="navigator-"+r.now();this.element=i.element}else this.element=document.getElementById(i.id);i.controlOptions={anchor:r.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}}else{i.id="navigator-"+r.now();this.element=r.makeNeutralElement("div");i.controlOptions={anchor:r.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:i.autoFade};if(i.position)if("BOTTOM_RIGHT"===i.position)i.controlOptions.anchor=r.ControlAnchor.BOTTOM_RIGHT;else if("BOTTOM_LEFT"===i.position)i.controlOptions.anchor=r.ControlAnchor.BOTTOM_LEFT;else if("TOP_RIGHT"===i.position)i.controlOptions.anchor=r.ControlAnchor.TOP_RIGHT;else if("TOP_LEFT"===i.position)i.controlOptions.anchor=r.ControlAnchor.TOP_LEFT;else if("ABSOLUTE"===i.position){i.controlOptions.anchor=r.ControlAnchor.ABSOLUTE;i.controlOptions.top=i.top;i.controlOptions.left=i.left;i.controlOptions.height=i.height;i.controlOptions.width=i.width}}this.element.id=i.id;this.element.className+=" navigator";(i=r.extend(!0,{sizeRatio:r.DEFAULT_SETTINGS.navigatorSizeRatio},i,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:i.animationTime,autoResize:!1,minZoomImageRatio:1,background:i.background,opacity:i.opacity,borderColor:i.borderColor,displayRegionColor:i.displayRegionColor})).minPixelRatio=this.minPixelRatio=t.minPixelRatio;r.setElementTouchActionNone(this.element);this.borderWidth=2;this.fudge=new r.Point(1,1);this.totalBorderWidths=new r.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge);i.controlOptions.anchor!==r.ControlAnchor.NONE&&function(e,t){e.margin="0px";e.border=t+"px solid "+i.borderColor;e.padding="0px";e.background=i.background;e.opacity=i.opacity;e.overflow="hidden"}(this.element.style,this.borderWidth);this.displayRegion=r.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 "+i.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);r.setElementPointerEventsNone(this.displayRegion);r.setElementTouchActionNone(this.displayRegion);this.displayRegionContainer=r.makeNeutralElement("div");this.displayRegionContainer.id=this.element.id+"-displayregioncontainer";this.displayRegionContainer.className="displayregioncontainer";this.displayRegionContainer.style.width="100%";this.displayRegionContainer.style.height="100%";r.setElementPointerEventsNone(this.displayRegionContainer);r.setElementTouchActionNone(this.displayRegionContainer);t.addControl(this.element,i.controlOptions);this._resizeWithViewer=i.controlOptions.anchor!==r.ControlAnchor.ABSOLUTE&&i.controlOptions.anchor!==r.ControlAnchor.NONE;if(i.width&&i.height){this.setWidth(i.width);this.setHeight(i.height)}else if(this._resizeWithViewer){e=r.getElementSize(t.element);this.element.style.height=Math.round(e.y*i.sizeRatio)+"px";this.element.style.width=Math.round(e.x*i.sizeRatio)+"px";this.oldViewerSize=e;e=r.getElementSize(this.element);this.elementArea=e.x*e.y}this.oldContainerSize=new r.Point(0,0);r.Viewer.apply(this,[i]);this.displayRegionContainer.appendChild(this.displayRegion);this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function o(e){c(n.displayRegionContainer,e);c(n.displayRegion,-e);n.viewport.setRotation(e)}if(i.navigatorRotate){o(i.viewer.viewport?i.viewer.viewport.getRotation():i.viewer.degrees||0);i.viewer.addHandler("rotate",function(e){o(e.degrees)})}this.innerTracker.destroy();this.innerTracker=new r.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:r.delegate(this,a),clickHandler:r.delegate(this,s),releaseHandler:r.delegate(this,l),scrollHandler:r.delegate(this,h),preProcessEventHandler:function(e){"wheel"===e.eventType&&(e.preventDefault=!0)}});this.outerTracker.userData="Navigator.outerTracker";r.setElementPointerEventsNone(this.canvas);r.setElementPointerEventsNone(this.container);this.addHandler("reset-size",function(){n.viewport&&n.viewport.goHome(!0)});t.world.addHandler("item-index-change",function(t){window.setTimeout(function(){var e=n.world.getItemAt(t.previousIndex);n.world.setItemIndex(e,t.newIndex)},1)});t.world.addHandler("remove-item",function(e){e=e.item;e=n._getMatchingItem(e);e&&n.world.removeItem(e)});this.update(t.viewport)};r.extend(r.Navigator.prototype,r.EventSource.prototype,r.Viewer.prototype,{updateSize:function(){if(this.viewport){var e=new r.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);if(!e.equals(this.oldContainerSize)){this.viewport.resize(e,!0);this.viewport.goHome(!0);this.oldContainerSize=e;this.drawer.clear();this.world.draw()}}},setWidth:function(e){this.width=e;this.element.style.width="number"==typeof e?e+"px":e;this._resizeWithViewer=!1},setHeight:function(e){this.height=e;this.element.style.height="number"==typeof e?e+"px":e;this._resizeWithViewer=!1},setFlip:function(e){this.viewport.setFlip(e);this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)");return this},setDisplayTransform:function(e){i(this.displayRegion,e);i(this.canvas,e);i(this.element,e)},update:function(e){var t;i=r.getElementSize(this.viewer.element);if(this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)){this.oldViewerSize=i;if(this.maintainSizeRatio||!this.elementArea){t=i.x*this.sizeRatio;n=i.y*this.sizeRatio}else{t=Math.sqrt(this.elementArea*(i.x/i.y));n=this.elementArea/t}this.element.style.width=Math.round(t)+"px";this.element.style.height=Math.round(n)+"px";this.elementArea||(this.elementArea=t*n);this.updateSize()}if(e&&this.viewport){i=e.getBoundsNoRotate(!0);t=this.viewport.pixelFromPointNoRotate(i.getTopLeft(),!1);n=this.viewport.pixelFromPointNoRotate(i.getBottomRight(),!1).minus(this.totalBorderWidths);e=this.displayRegion.style;e.display=this.world.getItemCount()?"block":"none";e.top=Math.round(t.y)+"px";e.left=Math.round(t.x)+"px";var i=Math.abs(t.x-n.x);var n=Math.abs(t.y-n.y);e.width=Math.round(Math.max(i,0))+"px";e.height=Math.round(Math.max(n,0))+"px"}},addTiledImage:function(e){var n=this;var o=e.originalTiledImage;delete e.original;e=r.extend({},e,{success:function(e){var t=e.item;t._originalForNavigator=o;n._matchBounds(t,o,!0);n._matchOpacity(t,o);n._matchCompositeOperation(t,o);function i(){n._matchBounds(t,o)}o.addHandler("bounds-change",i);o.addHandler("clip-change",i);o.addHandler("opacity-change",function(){n._matchOpacity(t,o)});o.addHandler("composite-operation-change",function(){n._matchCompositeOperation(t,o)})}});return r.Viewer.prototype.addTiledImage.apply(this,[e])},destroy:function(){return r.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(e){var t=this.world.getItemCount();var i;for(var n=0;n=1/this.aspectRatio-1e-15&&(n=this.getNumTiles(e).y-1);return new h.Point(i,n)},getTileBounds:function(e,t,i,n){var o=this.dimensions.times(this.getLevelScale(e)),r=this.getTileWidth(e),s=this.getTileHeight(e),a=0===t?0:r*t-this.tileOverlap,e=0===i?0:s*i-this.tileOverlap,t=r+(0===t?1:2)*this.tileOverlap,s=s+(0===i?1:2)*this.tileOverlap,i=1/o.x;t=Math.min(t,o.x-a);s=Math.min(s,o.y-e);return n?new h.Rect(0,0,t,s):new h.Rect(a*i,e*i,t*i,s*i)},getImageInfo:function(n){var t,i,e,o,r,s=this;n&&-1<(r=(o=(e=n.split("/"))[e.length-1]).lastIndexOf("."))&&(e[e.length-1]=o.slice(0,r));var a=null;if(this.splitHashDataForPost){var l=n.indexOf("#");if(-1!==l){a=n.substring(l+1);n=n.substr(0,l)}}t=function(e){"string"==typeof e&&(e=h.parseXml(e));var t=h.TileSource.determineType(s,e,n);if(t){void 0===(i=t.prototype.configure.apply(s,[e,n,a])).ajaxWithCredentials&&(i.ajaxWithCredentials=s.ajaxWithCredentials);i=new t(i);s.ready=!0;s.raiseEvent("ready",{tileSource:i})}else s.raiseEvent("open-failed",{message:"Unable to load TileSource",source:n})};if(n.match(/\.js$/)){l=n.split("/").pop().replace(".js","");h.jsonp({url:n,async:!1,callbackName:l,callback:t})}else h.makeAjaxRequest({url:n,postData:a,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){e=function(t){var e,i,n=t.responseText,o=t.status;{if(!t)throw new Error(h.getString("Errors.Security"));if(200!==t.status&&0!==t.status){o=t.status;e=404===o?"Not Found":t.statusText;throw new Error(h.getString("Errors.Status",o,e))}}if(n.match(/\s*<.*/))try{i=t.responseXML&&t.responseXML.documentElement?t.responseXML:h.parseXml(n)}catch(e){i=t.responseText}else if(n.match(/\s*[{[].*/))try{i=h.parseJSON(n)}catch(e){i=n}else i=n;return i}(e);t(e)},error:function(e,t){var i;try{i="HTTP "+e.status+" attempting to load TileSource: "+n}catch(e){i=(void 0!==t&&t.toString?t.toString():"Unknown error")+" attempting to load TileSource: "+n}h.console.error(i);s.raiseEvent("open-failed",{message:i,source:n,postData:a})}})},supports:function(e,t){return!1},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,o,r){function s(e){return o?e+"+"+JSON.stringify(o):e}return s("string"!=typeof n?e+"/"+t+"_"+i:n)},tileExists:function(e,t,i){var n=this.getNumTiles(e);return e>=this.minLevel&&e<=this.maxLevel&&0<=t&&0<=i&&tthis.maxLevel)return!1;if(!h||!h.length)return!0;for(l=h.length-1;0<=l;l--)if(!(e<(n=h[l]).minLevel||e>n.maxLevel)){a=this.getLevelScale(e);o=n.x*a;r=n.y*a;s=o+n.width*a;a=r+n.height*a;o=Math.floor(o/this._tileWidth);r=Math.floor(r/this._tileWidth);s=Math.ceil(s/this._tileWidth);a=Math.ceil(a/this._tileWidth);if(o<=t&&t=this.minLevel&&e<=this.maxLevel?this.levels[e].width/this.levels[this.maxLevel].width:t}return h.TileSource.prototype.getLevelScale.call(this,e)},getNumTiles:function(e){if(this.emulateLegacyImagePyramid)return this.getLevelScale(e)?new h.Point(1,1):new h.Point(0,0);return h.TileSource.prototype.getNumTiles.call(this,e)},getTileAtPoint:function(e,t){return this.emulateLegacyImagePyramid?new h.Point(0,0):h.TileSource.prototype.getTileAtPoint.call(this,e,t)},getTileUrl:function(e,t,i){if(this.emulateLegacyImagePyramid){var n=null;return n=0=this.minLevel&&e<=this.maxLevel?this.levels[e].url:n}var o,r,s,a,l,h=Math.pow(.5,this.maxLevel-e),c=Math.round(this.width*h),u=Math.round(this.height*h);o=this.getTileWidth(e);r=this.getTileHeight(e);l=Math.round(o/h);n=Math.round(r/h);e=1===this.version?"native."+this.tileFormat:"default."+this.tileFormat;if(ce.tileSize||parseInt(t.y,10)>e.tileSize;){t.x=Math.floor(t.x/2);t.y=Math.floor(t.y/2);e.imageSizes.push({x:t.x,y:t.y});e.gridSize.push(this._getGridSize(t.x,t.y,e.tileSize))}e.imageSizes.reverse();e.gridSize.reverse();e.minLevel=0;e.maxLevel=e.gridSize.length-1;OpenSeadragon.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 o={};for(var r=0;r");return n.sort(function(e,t){return e.height-t.height})}(t.levels);if(0=this.minLevel&&e<=this.maxLevel?this.levels[e].width/this.levels[this.maxLevel].width:t},getNumTiles:function(e){return this.getLevelScale(e)?new a.Point(1,1):new a.Point(0,0)},getTileUrl:function(e,t,i){var n=null;return n=0=this.minLevel&&e<=this.maxLevel?this.levels[e].url:n}})}(OpenSeadragon);!function(a){a.ImageTileSource=function(e){e=a.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},e);a.TileSource.apply(this,[e])};a.extend(a.ImageTileSource.prototype,a.TileSource.prototype,{supports:function(e,t){return e.type&&"image"===e.type},configure:function(e,t,i){return e},getImageInfo:function(e){var t=this._image=new Image;var i=this;this.crossOriginPolicy&&(t.crossOrigin=this.crossOriginPolicy);this.ajaxWithCredentials&&(t.useCredentials=this.ajaxWithCredentials);a.addEvent(t,"load",function(){i.width=t.naturalWidth;i.height=t.naturalHeight;i.aspectRatio=i.width/i.height;i.dimensions=new a.Point(i.width,i.height);i._tileWidth=i.width;i._tileHeight=i.height;i.tileOverlap=0;i.minLevel=0;i.levels=i._buildLevels();i.maxLevel=i.levels.length-1;i.ready=!0;i.raiseEvent("ready",{tileSource:i})});a.addEvent(t,"error",function(){i.raiseEvent("open-failed",{message:"Error loading image at "+e,source:e})});t.src=e},getLevelScale:function(e){var t=NaN;return t=e>=this.minLevel&&e<=this.maxLevel?this.levels[e].width/this.levels[this.maxLevel].width:t},getNumTiles:function(e){return this.getLevelScale(e)?new a.Point(1,1):new a.Point(0,0)},getTileUrl:function(e,t,i){var n=null;return n=e>=this.minLevel&&e<=this.maxLevel?this.levels[e].url:n},getContext2D:function(e,t,i){var n=null;return n=e>=this.minLevel&&e<=this.maxLevel?this.levels[e].context2D:n},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var e=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!a.supportsCanvas||!this.useCanvas){delete this._image;return e}var t=this._image.naturalWidth;var i=this._image.naturalHeight;var n=document.createElement("canvas");var o=n.getContext("2d");n.width=t;n.height=i;o.drawImage(this._image,0,0,t,i);e[0].context2D=o;delete this._image;if(a.isCanvasTainted(n))return e;for(;2<=t&&2<=i;){t=Math.floor(t/2);i=Math.floor(i/2);var r=document.createElement("canvas");var s=r.getContext("2d");r.width=t;r.height=i;s.drawImage(n,0,0,t,i);e.splice(0,0,{context2D:s,width:t,height:i});n=r;o=s}return e},_freeupCanvasMemory:function(){for(var e=0;e=i.ButtonState.GROUP&&e.currentState===i.ButtonState.REST){!function(e){e.shouldFade=!1;e.imgGroup&&i.setElementOpacity(e.imgGroup,1,!0)}(e);e.currentState=i.ButtonState.GROUP}if(t>=i.ButtonState.HOVER&&e.currentState===i.ButtonState.GROUP){e.imgHover&&(e.imgHover.style.visibility="");e.currentState=i.ButtonState.HOVER}if(t>=i.ButtonState.DOWN&&e.currentState===i.ButtonState.HOVER){e.imgDown&&(e.imgDown.style.visibility="");e.currentState=i.ButtonState.DOWN}}}function r(e,t){if(!e.element.disabled){if(t<=i.ButtonState.HOVER&&e.currentState===i.ButtonState.DOWN){e.imgDown&&(e.imgDown.style.visibility="hidden");e.currentState=i.ButtonState.HOVER}if(t<=i.ButtonState.GROUP&&e.currentState===i.ButtonState.HOVER){e.imgHover&&(e.imgHover.style.visibility="hidden");e.currentState=i.ButtonState.GROUP}if(t<=i.ButtonState.REST&&e.currentState===i.ButtonState.GROUP){!function(e){e.shouldFade=!0;e.fadeBeginTime=i.now()+e.fadeDelay;window.setTimeout(function(){n(e)},e.fadeDelay)}(e);e.currentState=i.ButtonState.REST}}}}(OpenSeadragon);!function(o){o.ButtonGroup=function(e){o.extend(!0,this,{buttons:[],clickTimeThreshold:o.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:o.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},e);var t,i=this.buttons.concat([]),n=this;this.element=e.element||o.makeNeutralElement("div");if(!e.group){this.element.style.display="inline-block";for(t=0;tu&&(u=m.x);m.yp&&(p=m.y)}return new v.Rect(c,d,u-c,p-d)},_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(e,t){if(0===(e=v.positiveModulo(e,360)))return this.clone();t=t||this.getCenter();var i=this.getTopLeft().rotate(e,t);e=this.getTopRight().rotate(e,t).minus(i);e=e.apply(function(e){return Math.abs(e)<1e-15?0:e});t=Math.atan(e.y/e.x);e.x<0?t+=Math.PI:e.y<0&&(t+=2*Math.PI);return new v.Rect(i.x,i.y,this.width,this.height,t/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var e=this.getTopLeft();var t=this.getTopRight();var i=this.getBottomLeft();var n=this.getBottomRight();var o=Math.min(e.x,t.x,i.x,n.x);var r=Math.max(e.x,t.x,i.x,n.x);var s=Math.min(e.y,t.y,i.y,n.y);n=Math.max(e.y,t.y,i.y,n.y);return new v.Rect(o,s,r-o,n-s)},getIntegerBoundingBox:function(){var e=this.getBoundingBox();var t=Math.floor(e.x);var i=Math.floor(e.y);var n=Math.ceil(e.width+e.x-t);e=Math.ceil(e.height+e.y-i);return new v.Rect(t,i,n,e)},containsPoint:function(e,t){t=t||0;var i=this.getTopLeft();var n=this.getTopRight();var o=this.getBottomLeft();var r=n.minus(i);var s=o.minus(i);return(e.x-i.x)*r.x+(e.y-i.y)*r.y>=-t&&(e.x-n.x)*r.x+(e.y-n.y)*r.y<=t&&(e.x-i.x)*s.x+(e.y-i.y)*s.y>=-t&&(e.x-o.x)*s.x+(e.y-o.y)*s.y<=t},toString:function(){return"["+Math.round(100*this.x)/100+", "+Math.round(100*this.y)/100+", "+Math.round(100*this.width)/100+"x"+Math.round(100*this.height)/100+", "+Math.round(100*this.degrees)/100+"deg]"}}}(OpenSeadragon);!function(h){var s={};h.ReferenceStrip=function(e){var t,i,n,o=e.viewer,r=h.getElementSize(o.element);if(!e.id){e.id="referencestrip-"+h.now();this.element=h.makeNeutralElement("div");this.element.id=e.id;this.element.className="referencestrip"}e=h.extend(!0,{sizeRatio:h.DEFAULT_SETTINGS.referenceStripSizeRatio,position:h.DEFAULT_SETTINGS.referenceStripPosition,scroll:h.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:h.DEFAULT_SETTINGS.clickTimeThreshold},e,{element:this.element});h.extend(this,e);s[this.id]={animating:!1};this.minPixelRatio=this.viewer.minPixelRatio;this.element.tabIndex=0;(i=this.element.style).marginTop="0px";i.marginRight="0px";i.marginBottom="0px";i.marginLeft="0px";i.left="0px";i.bottom="0px";i.border="0px";i.background="#000";i.position="relative";h.setElementTouchActionNone(this.element);h.setElementOpacity(this.element,.8);this.viewer=o;this.tracker=new h.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:h.delegate(this,a),dragHandler:h.delegate(this,l),scrollHandler:h.delegate(this,c),enterHandler:h.delegate(this,d),leaveHandler:h.delegate(this,p),keyDownHandler:h.delegate(this,g),keyHandler:h.delegate(this,m),preProcessEventHandler:function(e){"wheel"===e.eventType&&(e.preventDefault=!0)}});if(e.width&&e.height){this.element.style.width=e.width+"px";this.element.style.height=e.height+"px";o.addControl(this.element,{anchor:h.ControlAnchor.BOTTOM_LEFT})}else if("horizontal"===e.scroll){this.element.style.width=r.x*e.sizeRatio*o.tileSources.length+12*o.tileSources.length+"px";this.element.style.height=r.y*e.sizeRatio+"px";o.addControl(this.element,{anchor:h.ControlAnchor.BOTTOM_LEFT})}else{this.element.style.height=r.y*e.sizeRatio*o.tileSources.length+12*o.tileSources.length+"px";this.element.style.width=r.x*e.sizeRatio+"px";o.addControl(this.element,{anchor:h.ControlAnchor.TOP_LEFT})}this.panelWidth=r.x*this.sizeRatio+8;this.panelHeight=r.y*this.sizeRatio+8;this.panels=[];this.miniViewers={};for(n=0;ns+n.x-this.panelWidth){t=Math.min(t,o-n.x);this.element.style.marginLeft=-t+"px";u(this,n.x,-t)}else if(ta+n.y-this.panelHeight){t=Math.min(t,r-n.y);this.element.style.marginTop=-t+"px";u(this,n.y,-t)}else if(t-(n-r.x)){this.element.style.marginLeft=t+2*e.delta.x+"px";u(this,r.x,t+2*e.delta.x)}}else if(-e.delta.x<0&&t<0){this.element.style.marginLeft=t+2*e.delta.x+"px";u(this,r.x,t+2*e.delta.x)}}else if(0<-e.delta.y){if(i>-(o-r.y)){this.element.style.marginTop=i+2*e.delta.y+"px";u(this,r.y,i+2*e.delta.y)}}else if(-e.delta.y<0&&i<0){this.element.style.marginTop=i+2*e.delta.y+"px";u(this,r.y,i+2*e.delta.y)}}}function c(e){if(this.element){var t=Number(this.element.style.marginLeft.replace("px","")),i=Number(this.element.style.marginTop.replace("px","")),n=Number(this.element.style.width.replace("px","")),o=Number(this.element.style.height.replace("px","")),r=h.getElementSize(this.viewer.canvas);if("horizontal"===this.scroll){if(0-(n-r.x)){this.element.style.marginLeft=t-60*e.scroll+"px";u(this,r.x,t-60*e.scroll)}}else if(e.scroll<0&&t<0){this.element.style.marginLeft=t-60*e.scroll+"px";u(this,r.x,t-60*e.scroll)}}else if(e.scroll<0){if(i>r.y-o){this.element.style.marginTop=i+60*e.scroll+"px";u(this,r.y,i+60*e.scroll)}}else if(0=this.target.time?t:e+(t-e)*(n=this.springStiffness,i=(this.current.time-this.start.time)/(this.target.time-this.start.time),(1-Math.exp(n*-i))/(1-Math.exp(-n)));var i;var n=this.current.value;this._exponential?this.current.value=Math.exp(i):this.current.value=i;return n!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(OpenSeadragon);!function(n){n.ImageJob=function(e){n.extend(!0,this,{timeout:n.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},e);this.data=null;this.userData={};this.errorMsg=null};n.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);"function"==typeof t&&t()};this.source.downloadTileStart(this)},finish:function(e,t,i){this.data=e;this.request=t;this.errorMsg=i;this.jobId&&window.clearTimeout(this.jobId);this.callback(this)}};n.ImageLoader=function(e){n.extend(!0,this,{jobLimit:n.DEFAULT_SETTINGS.imageLoaderLimit,timeout:n.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},e)};n.ImageLoader.prototype={addJob:function(t){if(!t.source){n.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var e=n.TileSource.prototype;t.source={downloadTileStart:e.downloadTileStart,downloadTileAbort:e.downloadTileAbort}}var i=this,e={src:t.src,tile:t.tile||{},source:t.source,loadWithAjax:t.loadWithAjax,ajaxHeaders:t.loadWithAjax?t.ajaxHeaders:null,crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,postData:t.postData,callback:function(e){!function(e,t,i){""!==t.errorMsg&&(null===t.image||void 0===t.image)&&t.tries<1+e.tileRetryMax&&e.failedTiles.push(t);var n;e.jobsInProgress--;if((!e.jobLimit||e.jobsInProgressthis.canvas.width&&(r.width=this.canvas.width-r.x);if(r.y<0){r.height+=r.y;r.y=0}r.y+r.height>this.canvas.height&&(r.height=this.canvas.height-r.y);this.context.drawImage(this.sketchCanvas,r.x,r.y,r.width,r.height,r.x,r.y,r.width,r.height)}else{t=o.scale||1;e=(i=o.translate)instanceof a.Point?i:new a.Point(0,0);n=0;r=0;if(i){o=this.sketchCanvas.width-this.canvas.width;i=this.sketchCanvas.height-this.canvas.height;n=Math.round(o/2);r=Math.round(i/2)}this.context.drawImage(this.sketchCanvas,e.x-n*t,e.y-r*t,(this.canvas.width+2*n)*t,(this.canvas.height+2*r)*t,-n,-r,this.canvas.width+2*n,this.canvas.height+2*r)}this.context.restore()}},drawDebugInfo:function(e,t,i,n){if(this.useCanvas){var o=this.viewer.world.getIndexOfItem(n)%this.debugGridColor.length;var r=this.context;r.save();r.lineWidth=2*a.pixelDensityRatio;r.font="small-caps bold "+13*a.pixelDensityRatio+"px arial";r.strokeStyle=this.debugGridColor[o];r.fillStyle=this.debugGridColor[o];this.viewport.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:this.viewport.getRotation(!0)});n.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:n.getRotation(!0),point:n.viewport.pixelFromPointNoRotate(n._getRotationPoint(!0),!0)});n.viewport.getRotation(!0)%360==0&&n.getRotation(!0)%360==0&&n._drawer.viewer.viewport.getFlip()&&n._drawer._flip();r.strokeRect(e.position.x*a.pixelDensityRatio,e.position.y*a.pixelDensityRatio,e.size.x*a.pixelDensityRatio,e.size.y*a.pixelDensityRatio);var s=(e.position.x+e.size.x/2)*a.pixelDensityRatio;o=(e.position.y+e.size.y/2)*a.pixelDensityRatio;r.translate(s,o);r.rotate(Math.PI/180*-this.viewport.getRotation(!0));r.translate(-s,-o);if(0===e.x&&0===e.y){r.fillText("Zoom: "+this.viewport.getZoom(),e.position.x*a.pixelDensityRatio,(e.position.y-30)*a.pixelDensityRatio);r.fillText("Pan: "+this.viewport.getBounds().toString(),e.position.x*a.pixelDensityRatio,(e.position.y-20)*a.pixelDensityRatio)}r.fillText("Level: "+e.level,(e.position.x+10)*a.pixelDensityRatio,(e.position.y+20)*a.pixelDensityRatio);r.fillText("Column: "+e.x,(e.position.x+10)*a.pixelDensityRatio,(e.position.y+30)*a.pixelDensityRatio);r.fillText("Row: "+e.y,(e.position.x+10)*a.pixelDensityRatio,(e.position.y+40)*a.pixelDensityRatio);r.fillText("Order: "+i+" of "+t,(e.position.x+10)*a.pixelDensityRatio,(e.position.y+50)*a.pixelDensityRatio);r.fillText("Size: "+e.size.toString(),(e.position.x+10)*a.pixelDensityRatio,(e.position.y+60)*a.pixelDensityRatio);r.fillText("Position: "+e.position.toString(),(e.position.x+10)*a.pixelDensityRatio,(e.position.y+70)*a.pixelDensityRatio);this.viewport.getRotation(!0)%360!=0&&this._restoreRotationChanges();n.getRotation(!0)%360!=0&&this._restoreRotationChanges();n.viewport.getRotation(!0)%360==0&&n.getRotation(!0)%360==0&&n._drawer.viewer.viewport.getFlip()&&n._drawer._flip();r.restore()}},debugRect:function(e){if(this.useCanvas){var t=this.context;t.save();t.lineWidth=2*a.pixelDensityRatio;t.strokeStyle=this.debugGridColor[0];t.fillStyle=this.debugGridColor[0];t.strokeRect(e.x*a.pixelDensityRatio,e.y*a.pixelDensityRatio,e.width*a.pixelDensityRatio,e.height*a.pixelDensityRatio);t.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(e){e=this._getContext(e).canvas;return new a.Point(e.width,e.height)},getCanvasCenter:function(){return new a.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(e){var t=e.point?e.point.times(a.pixelDensityRatio):this.getCanvasCenter();var i=this._getContext(e.useSketch);i.save();i.translate(t.x,t.y);if(this.viewer.viewport.flipped){i.rotate(Math.PI/180*-e.degrees);i.scale(-1,1)}else i.rotate(Math.PI/180*e.degrees);i.translate(-t.x,-t.y)},_flip:function(e){var t=(e=e||{}).point?e.point.times(a.pixelDensityRatio):this.getCanvasCenter();e=this._getContext(e.useSketch);e.translate(t.x,0);e.scale(-1,1);e.translate(-t.x,0)},_restoreRotationChanges:function(e){this._getContext(e).restore()},_calculateCanvasSize:function(){var e=a.pixelDensityRatio;var t=this.viewport.getContainerSize();return{x:Math.round(t.x*e),y:Math.round(t.y*e)}},_calculateSketchCanvasSize:function(){var e=this._calculateCanvasSize();if(0===this.viewport.getRotation())return e;e=Math.ceil(Math.sqrt(e.x*e.x+e.y*e.y));return{x:e,y:e}}}}(OpenSeadragon);!function(h){h.Viewport=function(e){var t=arguments;if((e=t.length&&t[0]instanceof h.Point?{containerSize:t[0],contentSize:t[1],config:t[2]}:e).config){h.extend(!0,e,e.config);delete e.config}this._margins=h.extend({left:0,top:0,right:0,bottom:0},e.margins||{});delete e.margins;e.initialDegrees=e.degrees;delete e.degrees;h.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:h.DEFAULT_SETTINGS.springStiffness,animationTime:h.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:h.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:h.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:h.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:h.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:h.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:h.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:h.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:h.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:h.DEFAULT_SETTINGS.degrees,flipped:h.DEFAULT_SETTINGS.flipped,homeFillsViewer:h.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:h.DEFAULT_SETTINGS.silenceMultiImageWarnings},e);this._updateContainerInnerSize();this.centerSpringX=new h.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.centerSpringY=new h.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.zoomSpring=new h.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime});this.degreesSpring=new h.Spring({initial:e.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 h.Rect(0,0,1,1),1);this.goHome(!0);this.update()};h.Viewport.prototype={get degrees(){h.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead.");return this.getRotation()},set degrees(e){h.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead.");this.rotateTo(e)},resetContentSize:function(e){h.console.assert(e,"[Viewport.resetContentSize] contentSize is required");h.console.assert(e instanceof h.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point");h.console.assert(0i.width?this.visibilityRatio*i.width:this.visibilityRatio*t.width;r=i.x-r+a;s=s-t.x-a;if(a>i.width){t.x+=(r+s)/2;n=!0}else if(s<0){t.x+=s;n=!0}else if(0i.height?this.visibilityRatio*i.height:this.visibilityRatio*t.height;l=i.y-l+r;s=s-t.y-r;if(r>i.height){t.y+=(l+s)/2;o=!0}else if(s<0){t.y+=s;o=!0}else if(0=o?s.height=s.width/o:s.width=s.height*o;s.x=r.x-s.width/2;s.y=r.y-s.height/2;var a=1/s.width;if(i){this.panTo(r,!0);this.zoomTo(a,null,!0);n&&this.applyConstraints(!0);return this}var l=this.getCenter(!0);t=this.getZoom(!0);this.panTo(l,!0);this.zoomTo(t,null,!0);e=this.getBounds();o=this.getZoom();if(0===o||Math.abs(a/o-1)<1e-8){this.zoomTo(a,null,!0);this.panTo(r,i);n&&this.applyConstraints(!1);return this}if(n){this.panTo(r,!1);this.zoomTo(a,null,!1);r=this.getConstrainedBounds();this.panTo(l,!0);this.zoomTo(t,null,!0);this.fitBounds(r)}else{o=s.rotate(-this.getRotation()).getTopLeft().times(a).minus(e.getTopLeft().times(o)).divide(a-o);this.zoomTo(a,o,i)}return this},fitBounds:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!1})},fitBoundsWithConstraints:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!0})},fitVertically:function(e){var t=new h.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(t,e)},fitHorizontally:function(e){var t=new h.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(t,e)},getConstrainedBounds:function(e){e=this.getBounds(e);return this._applyBoundaryConstraints(e)},panBy:function(e,t){var i=new h.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(i.plus(e),t)},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)}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(e,t,i){var n=this;this.zoomPoint=t instanceof h.Point&&!isNaN(t.x)&&!isNaN(t.y)?t:null;i?this._adjustCenterSpringsForZoomPoint(function(){n.zoomSpring.resetTo(e)}):this.zoomSpring.springTo(e);this.viewer&&this.viewer.raiseEvent("zoom",{zoom:e,refPoint:t,immediately:i});return this},setRotation:function(e,t){return this.rotateTo(e,null,t)},getRotation:function(e){return(e?this.degreesSpring.current:this.degreesSpring.target).value},setRotationWithPivot:function(e,t,i){return this.rotateTo(e,t,i)},rotateTo:function(e,t,i){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===e&&this.degreesSpring.isAtTargetValue())return this;this.rotationPivot=t instanceof h.Point&&!isNaN(t.x)&&!isNaN(t.y)?t:null;if(i)if(this.rotationPivot){if(!(e-this._oldDegrees)){this.rotationPivot=null;return this}this._rotateAboutPivot(e)}else this.degreesSpring.resetTo(e);else{var n=h.positiveModulo(this.degreesSpring.current.value,360);var o=h.positiveModulo(e,360);t=o-n;180o){r=this._clip.x/this._clip.height*e.height;s=this._clip.y/this._clip.height*e.height}else{r=this._clip.x/this._clip.width*e.width;s=this._clip.y/this._clip.width*e.width}}if(e.getAspectRatio()>o){var l=e.height/t;t=0;n.isHorizontallyCentered?t=(e.width-e.height*o)/2:n.isRight&&(t=e.width-e.height*o);this.setPosition(new y.Point(e.x-r+t,e.y-s),i);this.setHeight(l,i)}else{l=e.width/a;a=0;n.isVerticallyCentered?a=(e.height-e.width/o)/2:n.isBottom&&(a=e.height-e.width/o);this.setPosition(new y.Point(e.x-r,e.y-s+a),i);this.setWidth(l,i)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(e){y.console.assert(!e||e instanceof y.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null");e instanceof y.Rect?this._clip=e.clone():this._clip=null;this._needsDraw=!0;this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(e){this.flipped=!!e;this._needsDraw=!0;this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(e){if(e!==this.opacity){this.opacity=e;this._needsDraw=!0;this.raiseEvent("opacity-change",{opacity:this.opacity})}},getPreload:function(){return this._preload},setPreload:function(e){this._preload=!!e;this._needsDraw=!0},getRotation:function(e){return(e?this._degreesSpring.current:this._degreesSpring.target).value},setRotation:function(e,t){if(this._degreesSpring.target.value!==e||!this._degreesSpring.isAtTargetValue()){t?this._degreesSpring.resetTo(e):this._degreesSpring.springTo(e);this._needsDraw=!0;this._raiseBoundsChange()}},_getRotationPoint:function(e){return this.getBoundsNoRotate(e).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(e){if(e!==this.compositeOperation){this.compositeOperation=e;this._needsDraw=!0;this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation})}},_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=!0}else{if(i)return;this._scaleSpring.springTo(e);this._updateForScale();this._needsDraw=!0}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),!0).x*this._scaleSpring.current.value;t=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(t/this.minPixelRatio)/Math.log(2))));t=Math.max(t,this.source.minLevel||0);return{lowestLevel:Math.min(e,t),highestLevel:t}},_updateViewport:function(){this._needsDraw=!1;this._tilesLoading=0;this.loadingCoverage={};for(;0=this.minPixelRatio)r=l=!0;else if(!r)continue;var c=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(a),!1).x*this._scaleSpring.current.value;var u=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value;u=this.immediateRender?1:u;h=Math.min(1,(h-.5)/.5);c=u/Math.abs(u-c);o=this._updateLevel(r,l,a,h,c,t,s,o);if(this._providesCoverage(this.coverage,a))break}this._drawTiles(this.lastDrawn);if(o&&!o.context2D){this._loadTile(o,s);this._needsDraw=!0;this._setFullyLoaded(!1)}else this._setFullyLoaded(0===this._tilesLoading)},_getCornerTiles:function(e,t,i){var n;var o;if(this.wrapHorizontal){n=y.positiveModulo(t.x,1);o=y.positiveModulo(i.x,1)}else{n=Math.max(0,t.x);o=Math.min(1,i.x)}var r=1/this.source.aspectRatio;if(this.wrapVertical){s=y.positiveModulo(t.y,r);a=y.positiveModulo(i.y,r)}else{s=Math.max(0,t.y);a=Math.min(r,i.y)}var s=this.source.getTileAtPoint(e,new y.Point(n,s));var a=this.source.getTileAtPoint(e,new y.Point(o,a));e=this.source.getNumTiles(e);if(this.wrapHorizontal){s.x+=e.x*Math.floor(t.x);a.x+=e.x*Math.floor(i.x)}if(this.wrapVertical){s.y+=e.y*Math.floor(t.y/r);a.y+=e.y*Math.floor(i.y/r)}return{topLeft:s,bottomRight:a}},_updateLevel:function(e,t,i,n,o,r,s,a){var l=r.getBoundingBox().getTopLeft();var h=r.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:e,level:i,opacity:n,visibility:o,drawArea:r,topleft:l,bottomright:h,currenttime:s,best:a});this._resetCoverage(this.coverage,i);this._resetCoverage(this.loadingCoverage,i);h=this._getCornerTiles(i,l,h);var c=h.topLeft;var u=h.bottomRight;var d=this.source.getNumTiles(i);var p=this.viewport.pixelFromPoint(this.viewport.getCenter());if(this.getFlip()){u.x+=1;this.wrapHorizontal||(u.x=Math.min(u.x,d.x-1))}for(var g=c.x;g<=u.x;g++)for(var m=c.y;m<=u.y;m++){if(this.getFlip()){var v=(d.x+g%d.x)%d.x;v=g+d.x-v-v-1}else v=g;null!==r.intersection(this.getTileBounds(i,v,m))&&(a=this._updateTile(t,e,v,m,i,n,o,p,d,s,a))}return a},_updateTile:function(e,t,i,n,o,r,s,a,l,h,c){var u=this._getTile(i,n,o,h,l,this._worldWidthCurrent,this._worldHeightCurrent),l=t;this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:u});this._setCoverage(this.coverage,o,i,n,!1);t=u.loaded||u.loading||this._isCovered(this.loadingCoverage,o,i,n);this._setCoverage(this.loadingCoverage,o,i,n,t);if(!u.exists)return c;e&&!l&&(this._isCovered(this.coverage,o,i,n)?this._setCoverage(this.coverage,o,i,n,!0):l=!0);if(!l)return c;this._positionTile(u,this.source.tileOverlap,this.viewport,a,s);if(!u.loaded)if(u.context2D)this._setTileLoaded(u);else{s=this._tileCache.getImageRecord(u.cacheKey);s&&this._setTileLoaded(u,s.getData())}u.loaded?this._blendTile(u,i,n,o,r,h)&&(this._needsDraw=!0):u.loading?this._tilesLoading++:t||(c=this._compareTiles(c,u));return c},_getTile:function(e,t,i,n,o,r,s){var a,l,h,c,u,d,p,g,m,v=this.tilesMatrix,f=this.source;v[i]||(v[i]={});v[i][e]||(v[i][e]={});if(!v[i][e][t]||!v[i][e][t].flipped!=!this.flipped){a=(o.x+e%o.x)%o.x;l=(o.y+t%o.y)%o.y;h=this.getTileBounds(i,e,t);c=f.getTileBounds(i,a,l,!0);u=f.tileExists(i,a,l);d=f.getTileUrl(i,a,l);m=f.getTilePostData(i,a,l);if(this.loadTilesWithAjax){p=f.getTileAjaxHeaders(i,a,l);y.isPlainObject(this.ajaxHeaders)&&(p=y.extend({},this.ajaxHeaders,p))}else p=null;g=f.getContext2D?f.getContext2D(i,a,l):void 0;m=new y.Tile(i,e,t,h,u,d,g,this.loadTilesWithAjax,p,c,m,f.getTileHashKey(i,a,l,d,p,m));this.getFlip()?0==a&&(m.isRightMost=!0):a==o.x-1&&(m.isRightMost=!0);l==o.y-1&&(m.isBottomMost=!0);m.flipped=this.flipped;v[i][e][t]=m}(m=v[i][e][t]).lastTouchTime=n;return m},_loadTile:function(n,o){var r=this;n.loading=!0;this._imageLoader.addJob({src:n.getUrl(),tile:n,source:this.source,postData:n.postData,loadWithAjax:n.loadWithAjax,ajaxHeaders:n.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(e,t,i){r._onTileLoad(n,o,e,t,i)},abort:function(){n.loading=!1}})},_onTileLoad:function(t,e,i,n,o){if(i)if(ee.visibility||t.visibility===e.visibility&&t.squaredDistancethis.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(!0)%360==0&&y.supportsCanvas&&this.viewer.useCanvas){i=!0;n=t.getScaleForEdgeSmoothing();o=t.getTranslationForEdgeSmoothing(n,this._drawer.getCanvasSize(!1),this._drawer.getCanvasSize(!0))}var a;if(i){if(!n){a=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(!0)).getIntegerBoundingBox();this._drawer.viewer.viewport.getFlip()&&(this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0||(a.x=this._drawer.viewer.container.clientWidth-(a.x+a.width)));a=a.times(y.pixelDensityRatio)}this._drawer._clear(!0,a)}if(!n){this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:i});this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:i});this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip()}r=!1;if(this._clip){this._drawer.saveContext(i);s=this.imageToViewportRectangle(this._clip,!0);s=s.rotate(-this.getRotation(!0),this._getRotationPoint(!0));s=this._drawer.viewportToDrawerRectangle(s);n&&(s=s.times(n));o&&(s=s.translate(o));this._drawer.setClip(s,i);r=!0}if(this._croppingPolygons){var l=this;this._drawer.saveContext(i);try{var h=this._croppingPolygons.map(function(e){return e.map(function(e){e=l.imageToViewportCoordinates(e.x,e.y,!0).rotate(-l.getRotation(!0),l._getRotationPoint(!0));e=l._drawer.viewportCoordToDrawerCoord(e);return e=n?e.times(n):e})});this._drawer.clipWithPolygons(h,i)}catch(e){y.console.error(e)}r=!0}if(this.placeholderFillStyle&&!1===this._hasOpaqueTile){h=this._drawer.viewportToDrawerRectangle(this.getBounds(!0));n&&(h=h.times(n));o&&(h=h.translate(o));var c=null;c="function"==typeof this.placeholderFillStyle?this.placeholderFillStyle(this,this._drawer.context):this.placeholderFillStyle;this._drawer.drawRectangle(h,c,i)}c=function(e){if("number"==typeof e)return m(e);if(!e||!y.Browser)return p;var t=e[y.Browser.vendor];g(t)&&(t=e["*"]);return m(t)}(this.subPixelRoundingForTransparency);var u=!1;c===y.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS?u=!0:c===y.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&(u=!(this.viewer&&this.viewer.isAnimating()));for(var d=e.length-1;0<=d;d--){t=e[d];this._drawer.drawTile(t,this._drawingHandler,i,n,o,u,this.source);t.beingDrawn=!0;this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:t})}r&&this._drawer.restoreContext(i);if(!n){this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(i);this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(i)}if(i){if(n){this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:!1});this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:!1})}this._drawer.blendSketch({opacity:this.opacity,scale:n,translate:o,compositeOperation:this.compositeOperation,bounds:a});if(n){this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1);this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1)}}n||this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip();this._drawDebugInfo(e)}},_drawDebugInfo:function(e){if(this.debugMode)for(var t=e.length-1;0<=t;t--){var i=e[t];try{this._drawer.drawDebugInfo(i,e.length,t,this)}catch(e){y.console.error(e)}}},_providesCoverage:function(e,t,i,n){var o,r,s,a;if(!e[t])return!1;if(void 0!==i&&void 0!==n)return void 0===e[t][i]||void 0===e[t][i][n]||!0===e[t][i][n];for(s in o=e[t])if(Object.prototype.hasOwnProperty.call(o,s))for(a in r=o[s])if(Object.prototype.hasOwnProperty.call(r,a)&&!r[a])return!1;return!0},_isCovered:function(e,t,i,n){return void 0===i||void 0===n?this._providesCoverage(e,t+1):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(e,t,i,n,o){if(e[t]){e[t][i]||(e[t][i]={});e[t][i][n]=o}else y.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",t)},_resetCoverage:function(e,t){e[t]={}}});var p=y.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function g(e){return e!==y.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&e!==y.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&e!==y.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function m(e){return g(e)?p:e}}(OpenSeadragon);!function(g){function m(e){g.console.assert(e,"[TileCache.cacheTile] options is required");g.console.assert(e.tile,"[TileCache.cacheTile] options.tile is required");g.console.assert(e.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");this.tile=e.tile;this.tiledImage=e.tiledImage}function v(e){g.console.assert(e,"[ImageRecord] options is required");g.console.assert(e.data,"[ImageRecord] options.data is required");this._tiles=[];e.create.apply(null,[this,e.data,e.ownerTile]);this._destroyImplementation=e.destroy.bind(null,this);this.getImage=e.getImage.bind(null,this);this.getData=e.getData.bind(null,this);this.getRenderedContext=e.getRenderedContext.bind(null,this)}v.prototype={destroy:function(){this._destroyImplementation();this._tiles=null},addTile:function(e){g.console.assert(e,"[ImageRecord.addTile] tile is required");this._tiles.push(e)},removeTile:function(e){for(var t=0;tthis._maxImageCacheCount){var o=null;var r=-1;var s=null;var a,l,h,c,u,d;for(var p=this._tilesLoaded.length-1;0<=p;p--)if(!((a=(d=this._tilesLoaded[p]).tile).level<=t||a.beingDrawn))if(o){c=a.lastTouchTime;l=o.lastTouchTime;u=a.level;h=o.level;if(c=this._items.length)throw new Error("Index bigger than number of layers.");if(t!==i&&-1!==i){this._items.splice(i,1);this._items.splice(t,0,e);this._needsDraw=!0;this.raiseEvent("item-index-change",{item:e,previousIndex:i,newIndex:t})}},removeItem:function(e){g.console.assert(e,"[World.removeItem] item is required");var t=g.indexOf(this._items,e);if(-1!==t){e.removeHandler("bounds-change",this._delegatedFigureSizes);e.removeHandler("clip-change",this._delegatedFigureSizes);e.destroy();this._items.splice(t,1);this._figureSizes();this._needsDraw=!0;this._raiseRemoveItem(e)}},removeAll:function(){this.viewer._cancelPendingImages();var e;var t;for(t=0;td.height?r:r*(d.width/d.height))*(d.height/d.width);d=new g.Point(l+(r-u)/2,h+(r-d)/2);c.setPosition(d,t);c.setWidth(u,t);"horizontal"===i?l+=s:h+=s}this.setAutoRefigureSizes(!0)},_figureSizes:function(){var e=this._homeBounds?this._homeBounds.clone():null;var t=this._contentSize?this._contentSize.clone():null;var i=this._contentFactor||0;if(this._items.length){var n=this._items[0];var o=n.getBounds();this._contentFactor=n.getContentSize().x/o.width;var r=n.getClippedBounds().getBoundingBox();var s=r.x;var a=r.y;var l=r.x+r.width;var h=r.y+r.height;for(var c=1;c=i.x&&t.x=i.y},getMousePosition:function(e){if("number"==typeof e.pageX)u.getMousePosition=function(e){var t=new u.Point;t.x=e.pageX;t.y=e.pageY;return t};else{if("number"!=typeof e.clientX)throw new Error("Unknown event mouse position, no known technique.");u.getMousePosition=function(e){var t=new u.Point;t.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;t.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;return t}}return u.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},t=document.body||{};if("number"==typeof window.pageXOffset)u.getPageScroll=function(){return new u.Point(window.pageXOffset,window.pageYOffset)};else if(t.scrollLeft||t.scrollTop)u.getPageScroll=function(){return new u.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new u.Point(0,0);u.getPageScroll=function(){return new u.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return u.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)u.setPageScroll=function(e){window.scrollTo(e.x,e.y)};else{var t=u.getPageScroll();if(t.x===e.x&&t.y===e.y)return;document.body.scrollLeft=e.x;document.body.scrollTop=e.y;var i=u.getPageScroll();if(i.x!==t.x&&i.y!==t.y){u.setPageScroll=function(e){document.body.scrollLeft=e.x;document.body.scrollTop=e.y};return}document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y;if((i=u.getPageScroll()).x!==t.x&&i.y!==t.y){u.setPageScroll=function(e){document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y};return}u.setPageScroll=function(e){}}u.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},t=document.body||{};if("number"==typeof window.innerWidth)u.getWindowSize=function(){return new u.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)u.getWindowSize=function(){return new u.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!t.clientWidth&&!t.clientHeight)throw new Error("Unknown window size, no known technique.");u.getWindowSize=function(){return new u.Point(document.body.clientWidth,document.body.clientHeight)}}return u.getWindowSize()},makeCenteredNode:function(e){e=u.getElement(e);var t=[u.makeNeutralElement("div"),u.makeNeutralElement("div"),u.makeNeutralElement("div")];u.extend(t[0].style,{display:"table",height:"100%",width:"100%"});u.extend(t[1].style,{display:"table-row"});u.extend(t[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"});t[0].appendChild(t[1]);t[1].appendChild(t[2]);t[2].appendChild(e);return t[0]},makeNeutralElement:function(e){var t=document.createElement(e),e=t.style;e.background="transparent none";e.border="none";e.margin="0px";e.padding="0px";e.position="static";return t},now:function(){Date.now?u.now=Date.now:u.now=function(){return(new Date).getTime()};return u.now()},makeTransparentImage:function(e){var t=u.makeNeutralElement("img");t.src=e;return t},setElementOpacity:function(e,t,i){e=u.getElement(e);i&&!u.Browser.alpha&&(t=Math.round(t));if(u.Browser.opacity)e.style.opacity=t<1?t:"";else if(t<1){t=Math.round(100*t);e.style.filter="alpha(opacity="+t+")"}else e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=u.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},setElementPointerEvents:function(e,t){void 0!==(e=u.getElement(e)).style&&void 0!==e.style.pointerEvents&&(e.style.pointerEvents=t)},setElementPointerEventsNone:function(e){u.setElementPointerEvents(e,"none")},addClass:function(e,t){(e=u.getElement(e)).className?-1===(" "+e.className+" ").indexOf(" "+t+" ")&&(e.className+=" "+t):e.className=t},indexOf:function(e,t,i){Array.prototype.indexOf?this.indexOf=function(e,t,i){return e.indexOf(t,i)}:this.indexOf=function(e,t,i){var n,r,i=i||0;if(!e)throw new TypeError;if(0===(r=e.length)||r<=i)return-1;for(n=i=i<0?r-Math.abs(i):i;nt.touches.length-o&&c.console.warn("Tracked touch contact count doesn't match event.touches.length");var a={originalEvent:t,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};A(e,a);for(n=0;n{e[t]=i[t];delete i[t];return e},{}),i.drawerOptions);m.extend(!0,this,{id:i.id,hash:i.hash||s++,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},m.DEFAULT_SETTINGS,i);if(void 0===this.hash)throw new Error("A hash must be defined, either by specifying options.id or options.hash.");void 0!==c[this.hash]&&m.console.warn("Hash "+this.hash+" has already been used.");c[this.hash]={fsBoundsDelta:new m.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1};this._sequenceIndex=0;this._firstOpen=!0;this._updateRequestId=null;this._loadQueue=[];this.currentOverlays=[];this._updatePixelDensityRatioBind=null;this._lastScrollTime=m.now();m.EventSource.call(this);this.addHandler("open-failed",function(e){e=m.getString("Errors.OpenFailed",e.eventSource,e.message);n._showMessage(e)});m.ControlDock.call(this,i);this.xmlPath&&(this.tileSources=[this.xmlPath]);this.element=this.element||document.getElementById(this.id);this.canvas=m.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);m.setElementTouchActionNone(this.canvas);""!==i.tabIndex&&(this.canvas.tabIndex=void 0===i.tabIndex?0:i.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);m.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 m.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:m.delegate(this,d),keyDownHandler:m.delegate(this,p),keyHandler:m.delegate(this,g),clickHandler:m.delegate(this,y),dblClickHandler:m.delegate(this,w),dragHandler:m.delegate(this,T),dragEndHandler:m.delegate(this,x),enterHandler:m.delegate(this,_),leaveHandler:m.delegate(this,E),pressHandler:m.delegate(this,S),releaseHandler:m.delegate(this,P),nonPrimaryPressHandler:m.delegate(this,R),nonPrimaryReleaseHandler:m.delegate(this,b),scrollHandler:m.delegate(this,O),pinchHandler:m.delegate(this,C),focusHandler:m.delegate(this,D),blurHandler:m.delegate(this,I)});this.outerTracker=new m.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:m.delegate(this,B),leaveHandler:m.delegate(this,F)});this.toolbar&&(this.toolbar=new m.ControlDock({element:this.toolbar}));this.bindStandardControls();c[this.hash].prevContainerSize=a(this.container);if(window.ResizeObserver){this._autoResizePolling=!1;this._resizeObserver=new ResizeObserver(function(){c[n.hash].needsResize=!0});this._resizeObserver.observe(this.container,{})}else this._autoResizePolling=!0;this.world=new m.World({viewer:this});this.world.addHandler("add-item",function(e){n.source=n.world.getItemAt(0).source;c[n.hash].forceRedraw=!0;n._updateRequestId||(n._updateRequestId=l(n,k))});this.world.addHandler("remove-item",function(e){n.world.getItemCount()?n.source=n.world.getItemAt(0).source:n.source=null;c[n.hash].forceRedraw=!0});this.world.addHandler("metrics-change",function(e){n.viewport&&n.viewport._setContentBounds(n.world.getHomeBounds(),n.world.getContentFactor())});this.world.addHandler("item-index-change",function(e){n.source=n.world.getItemAt(0).source});this.viewport=new m.Viewport({containerSize:c[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 m.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:i.timeout,tileRetryMax:this.tileRetryMax,tileRetryDelay:this.tileRetryDelay});this.tileCache=new m.TileCache({maxImageCacheCount:this.maxImageCacheCount});if(Object.prototype.hasOwnProperty.call(this.drawerOptions,"useCanvas")){m.console.error('useCanvas is deprecated, use the "drawer" option to indicate preferred drawer(s)');this.drawerOptions.useCanvas||(this.drawer=m.HTMLDrawer);delete this.drawerOptions.useCanvas}let r=Array.isArray(this.drawer)?this.drawer:[this.drawer];if(0===r.length){r=[m.DEFAULT_SETTINGS.drawer].flat();m.console.warn("No valid drawers were selected. Using the default value.")}this.drawer=null;for(const o of r)if(this.requestDrawer(o,{mainDrawer:!0,redrawImmediately:!1}))break;if(!this.drawer){m.console.error("No drawer could be created!");throw"Error with creating the selected drawer(s)"}this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled);this.overlaysContainer=m.makeNeutralElement("div");this.canvas.appendChild(this.overlaysContainer);if(!this.drawer.canRotate()){if(this.rotateLeft){e=this.buttonGroup.buttons.indexOf(this.rotateLeft);this.buttonGroup.buttons.splice(e,1);this.buttonGroup.element.removeChild(this.rotateLeft.element)}if(this.rotateRight){e=this.buttonGroup.buttons.indexOf(this.rotateRight);this.buttonGroup.buttons.splice(e,1);this.buttonGroup.element.removeChild(this.rotateRight.element)}}this._addUpdatePixelDensityRatioEvent();this.showNavigator&&(this.navigator=new m.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,drawer:this.drawer.getType()}));this.sequenceMode&&this.bindSequenceControls();this.tileSources&&this.open(this.tileSources);for(e=0;e\s*$/))n=m.parseXml(n);else if(n.match(/^\s*[{[].*[}\]]\s*$/))try{var e=m.parseJSON(n);n=e}catch(e){}function l(e,t){if(e.ready)o(e);else{e.addHandler("ready",function(){o(e)});e.addHandler("open-failed",function(e){s({message:e.message,source:t})})}}setTimeout(function(){if("string"===m.type(n))(n=new m.TileSource({url:n,crossOriginPolicy:(void 0!==r.crossOriginPolicy?r:i).crossOriginPolicy,ajaxWithCredentials:i.ajaxWithCredentials,ajaxHeaders:r.ajaxHeaders||i.ajaxHeaders,splitHashDataForPost:i.splitHashDataForPost,success:function(e){o(e.tileSource)}})).addHandler("open-failed",function(e){s(e)});else if(m.isPlainObject(n)||n.nodeType){void 0!==n.crossOriginPolicy||void 0===r.crossOriginPolicy&&void 0===i.crossOriginPolicy||(n.crossOriginPolicy=(void 0!==r.crossOriginPolicy?r:i).crossOriginPolicy);void 0===n.ajaxWithCredentials&&(n.ajaxWithCredentials=i.ajaxWithCredentials);if(m.isFunction(n.getTileUrl)){var e=new m.TileSource(n);e.getTileUrl=n.getTileUrl;o(e)}else{var t=m.TileSource.determineType(a,n);if(t){e=t.prototype.configure.apply(a,[n]);l(new t(e),n)}else s({message:"Unable to load TileSource",source:n})}}else l(n,n)})}(this,i.tileSource,i,function(e){r.tileSource=e;s()},function(e){e.options=i;t(e);s()})}function s(){var e,t;for(;n._loadQueue.length&&(e=n._loadQueue[0]).tileSource;){n._loadQueue.splice(0,1);if(e.options.replace){var i=n.world.getIndexOfItem(e.options.replaceItem);-1!==i&&(e.options.index=i);n.world.removeItem(e.options.replaceItem)}t=new m.TiledImage({viewer:n,source:e.tileSource,viewport:n.viewport,drawer:n.drawer,tileCache:n.tileCache,imageLoader:n.imageLoader,x:e.options.x,y:e.options.y,width:e.options.width,height:e.options.height,fitBounds:e.options.fitBounds,fitBoundsPlacement:e.options.fitBoundsPlacement,clip:e.options.clip,placeholderFillStyle:e.options.placeholderFillStyle,opacity:e.options.opacity,preload:e.options.preload,degrees:e.options.degrees,flipped:e.options.flipped,compositeOperation:e.options.compositeOperation,springStiffness:n.springStiffness,animationTime:n.animationTime,minZoomImageRatio:n.minZoomImageRatio,wrapHorizontal:n.wrapHorizontal,wrapVertical:n.wrapVertical,maxTilesPerFrame:n.maxTilesPerFrame,immediateRender:n.immediateRender,blendTime:n.blendTime,alwaysBlend:n.alwaysBlend,minPixelRatio:n.minPixelRatio,smoothTileEdgesMinZoom:n.smoothTileEdgesMinZoom,iOSDevice:n.iOSDevice,crossOriginPolicy:e.options.crossOriginPolicy,ajaxWithCredentials:e.options.ajaxWithCredentials,loadTilesWithAjax:e.options.loadTilesWithAjax,ajaxHeaders:e.options.ajaxHeaders,debugMode:n.debugMode,subPixelRoundingForTransparency:n.subPixelRoundingForTransparency});n.collectionMode&&n.world.setAutoRefigureSizes(!1);if(n.navigator){i=m.extend({},e.options,{replace:!1,originalTiledImage:t,tileSource:e.tileSource});n.navigator.addTiledImage(i)}n.world.addItem(t,{index:e.options.index});0===n._loadQueue.length&&o(e);1!==n.world.getItemCount()||n.preserveViewport||n.viewport.goHome(!0);e.options.success&&e.options.success({item:t})}}},addSimpleImage:function(e){m.console.assert(e,"[Viewer.addSimpleImage] options is required");m.console.assert(e.url,"[Viewer.addSimpleImage] options.url is required");e=m.extend({},e,{tileSource:{type:"image",url:e.url}});delete e.url;this.addTiledImage(e)},addLayer:function(t){var i=this;m.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var e=m.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(e);return this},getLayerAtLevel:function(e){m.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead.");return this.world.getItemAt(e)},getLevelOfLayer:function(e){m.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead.");return this.world.getIndexOfItem(e)},getLayersCount:function(){m.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead.");return this.world.getItemCount()},setLayerLevel:function(e,t){m.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead.");return this.world.setItemIndex(e,t)},removeLayer:function(e){m.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead.");return this.world.removeItem(e)},forceRedraw:function(){c[this.hash].forceRedraw=!0;return this},forceResize:function(){c[this.hash].needsResize=!0;c[this.hash].forceResize=!0},bindSequenceControls:function(){var e=m.delegate(this,v),t=m.delegate(this,f),i=m.delegate(this,this.goToNextPage),n=m.delegate(this,this.goToPreviousPage),r=this.navImages,o=!0;if(this.showSequenceControl){(this.previousButton||this.nextButton)&&(o=!1);this.previousButton=new m.Button({element:this.previousButton?m.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.PreviousPage"),srcRest:A(this.prefixUrl,r.previous.REST),srcGroup:A(this.prefixUrl,r.previous.GROUP),srcHover:A(this.prefixUrl,r.previous.HOVER),srcDown:A(this.prefixUrl,r.previous.DOWN),onRelease:n,onFocus:e,onBlur:t});this.nextButton=new m.Button({element:this.nextButton?m.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.NextPage"),srcRest:A(this.prefixUrl,r.next.REST),srcGroup:A(this.prefixUrl,r.next.GROUP),srcHover:A(this.prefixUrl,r.next.HOVER),srcDown:A(this.prefixUrl,r.next.DOWN),onRelease:i,onFocus:e,onBlur:t});this.navPrevNextWrap||this.previousButton.disable();this.tileSources&&this.tileSources.length||this.nextButton.disable();if(o){this.paging=new m.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.pagingControl=this.paging.element;this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:m.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||m.ControlAnchor.TOP_LEFT})}}return this},bindStandardControls:function(){var e=m.delegate(this,M),t=m.delegate(this,L),i=m.delegate(this,z),n=m.delegate(this,H),r=m.delegate(this,N),o=m.delegate(this,W),s=m.delegate(this,G),a=m.delegate(this,V),l=m.delegate(this,j),h=m.delegate(this,q),c=m.delegate(this,v),u=m.delegate(this,f),d=this.navImages,p=[],g=!0;if(this.showNavigationControl){(this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(g=!1);if(this.showZoomControl){p.push(this.zoomInButton=new m.Button({element:this.zoomInButton?m.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.ZoomIn"),srcRest:A(this.prefixUrl,d.zoomIn.REST),srcGroup:A(this.prefixUrl,d.zoomIn.GROUP),srcHover:A(this.prefixUrl,d.zoomIn.HOVER),srcDown:A(this.prefixUrl,d.zoomIn.DOWN),onPress:e,onRelease:t,onClick:i,onEnter:e,onExit:t,onFocus:c,onBlur:u}));p.push(this.zoomOutButton=new m.Button({element:this.zoomOutButton?m.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.ZoomOut"),srcRest:A(this.prefixUrl,d.zoomOut.REST),srcGroup:A(this.prefixUrl,d.zoomOut.GROUP),srcHover:A(this.prefixUrl,d.zoomOut.HOVER),srcDown:A(this.prefixUrl,d.zoomOut.DOWN),onPress:n,onRelease:t,onClick:r,onEnter:n,onExit:t,onFocus:c,onBlur:u}))}this.showHomeControl&&p.push(this.homeButton=new m.Button({element:this.homeButton?m.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.Home"),srcRest:A(this.prefixUrl,d.home.REST),srcGroup:A(this.prefixUrl,d.home.GROUP),srcHover:A(this.prefixUrl,d.home.HOVER),srcDown:A(this.prefixUrl,d.home.DOWN),onRelease:o,onFocus:c,onBlur:u}));this.showFullPageControl&&p.push(this.fullPageButton=new m.Button({element:this.fullPageButton?m.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.FullPage"),srcRest:A(this.prefixUrl,d.fullpage.REST),srcGroup:A(this.prefixUrl,d.fullpage.GROUP),srcHover:A(this.prefixUrl,d.fullpage.HOVER),srcDown:A(this.prefixUrl,d.fullpage.DOWN),onRelease:s,onFocus:c,onBlur:u}));if(this.showRotationControl){p.push(this.rotateLeftButton=new m.Button({element:this.rotateLeftButton?m.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.RotateLeft"),srcRest:A(this.prefixUrl,d.rotateleft.REST),srcGroup:A(this.prefixUrl,d.rotateleft.GROUP),srcHover:A(this.prefixUrl,d.rotateleft.HOVER),srcDown:A(this.prefixUrl,d.rotateleft.DOWN),onRelease:a,onFocus:c,onBlur:u}));p.push(this.rotateRightButton=new m.Button({element:this.rotateRightButton?m.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.RotateRight"),srcRest:A(this.prefixUrl,d.rotateright.REST),srcGroup:A(this.prefixUrl,d.rotateright.GROUP),srcHover:A(this.prefixUrl,d.rotateright.HOVER),srcDown:A(this.prefixUrl,d.rotateright.DOWN),onRelease:l,onFocus:c,onBlur:u}))}this.showFlipControl&&p.push(this.flipButton=new m.Button({element:this.flipButton?m.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:m.getString("Tooltips.Flip"),srcRest:A(this.prefixUrl,d.flip.REST),srcGroup:A(this.prefixUrl,d.flip.GROUP),srcHover:A(this.prefixUrl,d.flip.HOVER),srcDown:A(this.prefixUrl,d.flip.DOWN),onRelease:h,onFocus:c,onBlur:u}));if(g){this.buttonGroup=new m.ButtonGroup({buttons:p,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.navControl=this.buttonGroup.element;this.addHandler("open",m.delegate(this,U));(this.toolbar||this).addControl(this.navControl,{anchor:this.navigationControlAnchor||m.ControlAnchor.TOP_LEFT})}else this.customButtons=p}return this},currentPage:function(){return this._sequenceIndex},goToPage:function(e){if(this.tileSources&&0<=e&&e=this.tileSources.length&&(e=0);this.goToPage(e)},isAnimating:function(){return c[this.hash].animating}});function a(e){e=m.getElement(e);return new m.Point(0===e.clientWidth?1:e.clientWidth,0===e.clientHeight?1:e.clientHeight)}function h(e,t){if(t instanceof m.Overlay)return t;var i=null;if(t.element)i=m.getElement(t.element);else{var n=t.id||"openseadragon-overlay-"+Math.floor(1e7*Math.random());(i=m.getElement(t.id))||((i=document.createElement("a")).href="#/overlay/"+n);i.id=n;m.addClass(i,t.className||"openseadragon-overlay")}var r=t.location;var o=t.width;var s=t.height;if(!r){n=t.x;var a=t.y;if(void 0!==t.px){e=e.viewport.imageToViewportRectangle(new m.Rect(t.px,t.py,o||0,s||0));n=e.x;a=e.y;o=void 0!==o?e.width:void 0;s=void 0!==s?e.height:void 0}r=new m.Point(n,a)}a=t.placement;a&&"string"===m.type(a)&&(a=m.Placement[t.placement.toUpperCase()]);return new m.Overlay({element:i,location:r,placement:a,onDraw:t.onDraw,checkResize:t.checkResize,width:o,height:s,rotationMode:t.rotationMode})}function r(e,t){var i;for(i=e.length-1;0<=i;i--)if(e[i].element===t)return i;return-1}function l(e,t){return m.requestAnimationFrame(function(){t(e)})}function o(e){m.requestAnimationFrame(function(){!function(e){var t,i,n;if(e.controlsShouldFade){t=m.now();t=t-e.controlsFadeBeginTime;i=1-t/e.controlsFadeLength;i=Math.min(1,i);i=Math.max(0,i);for(n=e.controls.length-1;0<=n;n--)e.controls[n].autoFade&&e.controls[n].setOpacity(i);0=t.flickMinSpeed){var n=0;this.panHorizontal&&(n=t.flickMomentum*e.speed*Math.cos(e.direction));i=0;this.panVertical&&(i=t.flickMomentum*e.speed*Math.sin(e.direction));e=this.viewport.pixelFromPoint(this.viewport.getCenter(!0));i=this.viewport.pointFromPixel(new m.Point(e.x-n,e.y-i));this.viewport.panTo(i,!1)}this.viewport.applyConstraints()}t.dblClickDragToZoom&&!0===c[this.hash].draggingToZoom&&(c[this.hash].draggingToZoom=!1)}function _(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 E(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 S(e){this.raiseEvent("canvas-press",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent});if(this.gestureSettingsByDeviceType(e.pointerType).dblClickDragToZoom){var t=c[this.hash].lastClickTime;e=m.now();if(null!==t){e-tthis.minScrollDeltaTime){this._lastScrollTime=n;t={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:!1,preventDefault:!0};this.raiseEvent("canvas-scroll",t);if(!t.preventDefaultAction&&this.viewport){this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x);if((i=this.gestureSettingsByDeviceType(e.pointerType)).scrollToZoom){n=Math.pow(this.zoomPerScroll,e.scroll);this.viewport.zoomBy(n,i.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null);this.viewport.applyConstraints()}}e.preventDefault=t.preventDefault}else e.preventDefault=!0}function B(e){c[this.hash].mouseInside=!0;n(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 F(e){if(e.pointers<1){c[this.hash].mouseInside=!1;c[this.hash].animating||u(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 k(e){!function(e){if(!e._opening&&c[e.hash]){if(e.autoResize||c[e.hash].forceResize){if(e._autoResizePolling){i=a(e.container);var t=c[e.hash].prevContainerSize;i.equals(t)||(c[e.hash].needsResize=!0)}c[e.hash].needsResize&&function(e,t){var i=e.viewport;var n=i.getZoom();var r=i.getCenter();i.resize(t,e.preserveImageSizeOnResize);i.panTo(r,!0);var o;if(e.preserveImageSizeOnResize)o=c[e.hash].prevContainerSize.x/t.x;else{var s=new m.Point(0,0);r=new m.Point(c[e.hash].prevContainerSize.x,c[e.hash].prevContainerSize.y).distanceTo(s);s=new m.Point(t.x,t.y).distanceTo(s);o=s/r*c[e.hash].prevContainerSize.x/t.x}i.zoomTo(n*o,null,!0);c[e.hash].prevContainerSize=t;c[e.hash].forceRedraw=!0;c[e.hash].needsResize=!1;c[e.hash].forceResize=!1}(e,i||a(e.container))}t=e.viewport.update();var i=e.world.update(t)||t;t&&e.raiseEvent("viewport-change");e.referenceStrip&&(i=e.referenceStrip.update(e.viewport)||i);t=c[e.hash].animating;if(!t&&i){e.raiseEvent("animation-start");n(e)}t=t&&!i;t&&(c[e.hash].animating=!1);if(i||t||c[e.hash].forceRedraw||e.world.needsDraw()){!function(e){e.imageLoader.clear();e.world.draw();e.raiseEvent("update-viewport",{})}(e);e._drawOverlays();e.navigator&&e.navigator.update(e.viewport);c[e.hash].forceRedraw=!1;i&&e.raiseEvent("animation")}if(t){e.raiseEvent("animation-finish");c[e.hash].mouseInside||u(e)}c[e.hash].animating=i}}(e);e.isOpen()?e._updateRequestId=l(e,k):e._updateRequestId=!1}function A(e,t){return e?e+t:t}function M(){c[this.hash].lastZoomTime=m.now();c[this.hash].zoomFactor=this.zoomPerSecond;c[this.hash].zooming=!0;i(this)}function H(){c[this.hash].lastZoomTime=m.now();c[this.hash].zoomFactor=1/this.zoomPerSecond;c[this.hash].zooming=!0;i(this)}function L(){c[this.hash].zooming=!1}function i(e){m.requestAnimationFrame(m.delegate(e,t))}function t(){var e,t;if(c[this.hash].zooming&&this.viewport){t=(e=m.now())-c[this.hash].lastZoomTime;t=Math.pow(c[this.hash].zoomFactor,t/1e3);this.viewport.zoomBy(t);this.viewport.applyConstraints();c[this.hash].lastZoomTime=e;i(this)}}function z(){if(this.viewport){c[this.hash].zooming=!1;this.viewport.zoomBy(+this.zoomPerClick);this.viewport.applyConstraints()}}function N(){if(this.viewport){c[this.hash].zooming=!1;this.viewport.zoomBy(1/this.zoomPerClick);this.viewport.applyConstraints()}}function U(){if(this.buttonGroup){this.buttonGroup.emulateEnter();this.buttonGroup.emulateLeave()}}function W(){this.viewport&&this.viewport.goHome()}function G(){this.isFullPage()&&!m.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage());this.buttonGroup&&this.buttonGroup.emulateLeave();this.fullPageButton.element.focus();this.viewport&&this.viewport.applyConstraints()}function V(){if(this.viewport){var e=this.viewport.getRotation();this.viewport.flipped?e+=this.rotationIncrement:e-=this.rotationIncrement;this.viewport.setRotation(e)}}function j(){if(this.viewport){var e=this.viewport.getRotation();this.viewport.flipped?e-=this.rotationIncrement:e+=this.rotationIncrement;this.viewport.setRotation(e)}}function q(){this.viewport.toggleFlip()}m.determineDrawer=function(e){for(var t in OpenSeadragon){const i=OpenSeadragon[t],n=i.prototype;if(n&&n instanceof OpenSeadragon.DrawerBase&&m.isFunction(n.getType)&&n.getType.call(i)===e)return i}return null}}(OpenSeadragon);!function(o){o.Navigator=function(i){var e,t=i.viewer,n=this;if(i.element||i.id){if(i.element){i.id&&o.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.");i.element.id?i.id=i.element.id:i.id="navigator-"+o.now();this.element=i.element}else this.element=document.getElementById(i.id);i.controlOptions={anchor:o.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}}else{i.id="navigator-"+o.now();this.element=o.makeNeutralElement("div");i.controlOptions={anchor:o.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:i.autoFade};if(i.position)if("BOTTOM_RIGHT"===i.position)i.controlOptions.anchor=o.ControlAnchor.BOTTOM_RIGHT;else if("BOTTOM_LEFT"===i.position)i.controlOptions.anchor=o.ControlAnchor.BOTTOM_LEFT;else if("TOP_RIGHT"===i.position)i.controlOptions.anchor=o.ControlAnchor.TOP_RIGHT;else if("TOP_LEFT"===i.position)i.controlOptions.anchor=o.ControlAnchor.TOP_LEFT;else if("ABSOLUTE"===i.position){i.controlOptions.anchor=o.ControlAnchor.ABSOLUTE;i.controlOptions.top=i.top;i.controlOptions.left=i.left;i.controlOptions.height=i.height;i.controlOptions.width=i.width}}this.element.id=i.id;this.element.className+=" navigator";(i=o.extend(!0,{sizeRatio:o.DEFAULT_SETTINGS.navigatorSizeRatio},i,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:i.animationTime,autoResize:!1,minZoomImageRatio:1,background:i.background,opacity:i.opacity,borderColor:i.borderColor,displayRegionColor:i.displayRegionColor})).minPixelRatio=this.minPixelRatio=t.minPixelRatio;o.setElementTouchActionNone(this.element);this.borderWidth=2;this.fudge=new o.Point(1,1);this.totalBorderWidths=new o.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge);i.controlOptions.anchor!==o.ControlAnchor.NONE&&function(e,t){e.margin="0px";e.border=t+"px solid "+i.borderColor;e.padding="0px";e.background=i.background;e.opacity=i.opacity;e.overflow="hidden"}(this.element.style,this.borderWidth);this.displayRegion=o.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 "+i.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);o.setElementPointerEventsNone(this.displayRegion);o.setElementTouchActionNone(this.displayRegion);this.displayRegionContainer=o.makeNeutralElement("div");this.displayRegionContainer.id=this.element.id+"-displayregioncontainer";this.displayRegionContainer.className="displayregioncontainer";this.displayRegionContainer.style.width="100%";this.displayRegionContainer.style.height="100%";o.setElementPointerEventsNone(this.displayRegionContainer);o.setElementTouchActionNone(this.displayRegionContainer);t.addControl(this.element,i.controlOptions);this._resizeWithViewer=i.controlOptions.anchor!==o.ControlAnchor.ABSOLUTE&&i.controlOptions.anchor!==o.ControlAnchor.NONE;if(i.width&&i.height){this.setWidth(i.width);this.setHeight(i.height)}else if(this._resizeWithViewer){e=o.getElementSize(t.element);this.element.style.height=Math.round(e.y*i.sizeRatio)+"px";this.element.style.width=Math.round(e.x*i.sizeRatio)+"px";this.oldViewerSize=e;e=o.getElementSize(this.element);this.elementArea=e.x*e.y}this.oldContainerSize=new o.Point(0,0);o.Viewer.apply(this,[i]);this.displayRegionContainer.appendChild(this.displayRegion);this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function r(e,t){c(n.displayRegionContainer,e);c(n.displayRegion,-e);n.viewport.setRotation(e,t)}if(i.navigatorRotate){r(i.viewer.viewport?i.viewer.viewport.getRotation():i.viewer.degrees||0,!0);i.viewer.addHandler("rotate",function(e){r(e.degrees,e.immediately)})}this.innerTracker.destroy();this.innerTracker=new o.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:o.delegate(this,a),clickHandler:o.delegate(this,s),releaseHandler:o.delegate(this,l),scrollHandler:o.delegate(this,h),preProcessEventHandler:function(e){"wheel"===e.eventType&&(e.preventDefault=!0)}});this.outerTracker.userData="Navigator.outerTracker";o.setElementPointerEventsNone(this.canvas);o.setElementPointerEventsNone(this.container);this.addHandler("reset-size",function(){n.viewport&&n.viewport.goHome(!0)});t.world.addHandler("item-index-change",function(t){window.setTimeout(function(){var e=n.world.getItemAt(t.previousIndex);n.world.setItemIndex(e,t.newIndex)},1)});t.world.addHandler("remove-item",function(e){e=e.item;e=n._getMatchingItem(e);e&&n.world.removeItem(e)});this.update(t.viewport)};o.extend(o.Navigator.prototype,o.EventSource.prototype,o.Viewer.prototype,{updateSize:function(){if(this.viewport){var e=new o.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);if(!e.equals(this.oldContainerSize)){this.viewport.resize(e,!0);this.viewport.goHome(!0);this.oldContainerSize=e;this.world.update();this.world.draw();this.update(this.viewer.viewport)}}},setWidth:function(e){this.width=e;this.element.style.width="number"==typeof e?e+"px":e;this._resizeWithViewer=!1;this.updateSize()},setHeight:function(e){this.height=e;this.element.style.height="number"==typeof e?e+"px":e;this._resizeWithViewer=!1;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){i(this.displayRegion,e);i(this.canvas,e);i(this.element,e)},update:function(e){var t,i;e=e||this.viewer.viewport;t=o.getElementSize(this.viewer.element);if(this._resizeWithViewer&&t.x&&t.y&&!t.equals(this.oldViewerSize)){this.oldViewerSize=t;if(this.maintainSizeRatio||!this.elementArea){i=t.x*this.sizeRatio;r=t.y*this.sizeRatio}else{i=Math.sqrt(this.elementArea*(t.x/t.y));r=this.elementArea/i}this.element.style.width=Math.round(i)+"px";this.element.style.height=Math.round(r)+"px";this.elementArea||(this.elementArea=i*r);this.updateSize()}if(e&&this.viewport){i=e.getBoundsNoRotate(!0);r=this.viewport.pixelFromPointNoRotate(i.getTopLeft(),!1);i=this.viewport.pixelFromPointNoRotate(i.getBottomRight(),!1).minus(this.totalBorderWidths);if(!this.navigatorRotate){var n=e.getRotation(!0);c(this.displayRegion,-n)}e=this.displayRegion.style;e.display=this.world.getItemCount()?"block":"none";e.top=r.y.toFixed(2)+"px";e.left=r.x.toFixed(2)+"px";n=i.x-r.x;var r=i.y-r.y;e.width=Math.round(Math.max(n,0))+"px";e.height=Math.round(Math.max(r,0))+"px"}},addTiledImage:function(e){var n=this;var r=e.originalTiledImage;delete e.original;e=o.extend({},e,{success:function(e){var t=e.item;t._originalForNavigator=r;n._matchBounds(t,r,!0);n._matchOpacity(t,r);n._matchCompositeOperation(t,r);function i(){n._matchBounds(t,r)}r.addHandler("bounds-change",i);r.addHandler("clip-change",i);r.addHandler("opacity-change",function(){n._matchOpacity(t,r)});r.addHandler("composite-operation-change",function(){n._matchCompositeOperation(t,r)})}});return o.Viewer.prototype.addTiledImage.apply(this,[e])},destroy:function(){return o.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(e){var t=this.world.getItemCount();var i;for(var n=0;n=1/this.aspectRatio-1e-15&&(n=this.getNumTiles(e).y-1);return new h.Point(i,n)},getTileBounds:function(e,t,i,n){var r=this.dimensions.times(this.getLevelScale(e)),o=this.getTileWidth(e),s=this.getTileHeight(e),a=0===t?0:o*t-this.tileOverlap,e=0===i?0:s*i-this.tileOverlap,t=o+(0===t?1:2)*this.tileOverlap,s=s+(0===i?1:2)*this.tileOverlap,i=1/r.x;t=Math.min(t,r.x-a);s=Math.min(s,r.y-e);return n?new h.Rect(0,0,t,s):new h.Rect(a*i,e*i,t*i,s*i)},getImageInfo:function(n){var t,i,e,r,o,s=this;n&&-1<(o=(r=(e=n.split("/"))[e.length-1]).lastIndexOf("."))&&(e[e.length-1]=r.slice(0,o));var a=null;if(this.splitHashDataForPost){var l=n.indexOf("#");if(-1!==l){a=n.substring(l+1);n=n.substr(0,l)}}t=function(e){"string"==typeof e&&(e=h.parseXml(e));var t=h.TileSource.determineType(s,e,n);if(t){void 0===(i=t.prototype.configure.apply(s,[e,n,a])).ajaxWithCredentials&&(i.ajaxWithCredentials=s.ajaxWithCredentials);i=new t(i);s.ready=!0;s.raiseEvent("ready",{tileSource:i})}else s.raiseEvent("open-failed",{message:"Unable to load TileSource",source:n})};if(n.match(/\.js$/)){l=n.split("/").pop().replace(".js","");h.jsonp({url:n,async:!1,callbackName:l,callback:t})}else h.makeAjaxRequest({url:n,postData:a,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){e=function(t){var e,i,n=t.responseText,r=t.status;{if(!t)throw new Error(h.getString("Errors.Security"));if(200!==t.status&&0!==t.status){r=t.status;e=404===r?"Not Found":t.statusText;throw new Error(h.getString("Errors.Status",r,e))}}if(n.match(/^\s*<.*/))try{i=t.responseXML&&t.responseXML.documentElement?t.responseXML:h.parseXml(n)}catch(e){i=t.responseText}else if(n.match(/\s*[{[].*/))try{i=h.parseJSON(n)}catch(e){i=n}else i=n;return i}(e);t(e)},error:function(e,t){var i;try{i="HTTP "+e.status+" attempting to load TileSource: "+n}catch(e){i=(void 0!==t&&t.toString?t.toString():"Unknown error")+" attempting to load TileSource: "+n}h.console.error(i);s.raiseEvent("open-failed",{message:i,source:n,postData:a})}})},supports:function(e,t){return!1},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}return s("string"!=typeof n?e+"/"+t+"_"+i:n)},tileExists:function(e,t,i){var n=this.getNumTiles(e);return e>=this.minLevel&&e<=this.maxLevel&&0<=t&&0<=i&&tthis.maxLevel)return!1;if(!h||!h.length)return!0;for(l=h.length-1;0<=l;l--)if(!(e<(n=h[l]).minLevel||e>n.maxLevel)){a=this.getLevelScale(e);r=n.x*a;o=n.y*a;s=r+n.width*a;a=o+n.height*a;r=Math.floor(r/this._tileWidth);o=Math.floor(o/this._tileWidth);s=Math.ceil(s/this._tileWidth);a=Math.ceil(a/this._tileWidth);if(r<=t&&te.width-t.width);l===e.maxLevel&&this.levelSizes.push({width:this.width,height:this.height})}}h.TileSource.apply(this,[e])};h.extend(h.IIIFTileSource.prototype,h.TileSource.prototype,{supports:function(e,t){return!(!e.protocol||"http://iiif.io/api/image"!==e.protocol)||(!(!e["@context"]||"http://library.stanford.edu/iiif/image-api/1.1/context.json"!==e["@context"]&&"http://iiif.io/api/image/1/context.json"!==e["@context"])||(!(!e.profile||0!==e.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html"))||(!!(e.identifier&&e.width&&e.height)||!(!e.documentElement||"info"!==e.documentElement.tagName||"http://library.stanford.edu/iiif/image-api/ns/"!==e.documentElement.namespaceURI))))},configure:function(e,t,i){if(h.isPlainObject(e)){if(e["@context"]){var n=e["@context"];if(Array.isArray(n))for(var r=0;r=this.minLevel&&e<=this.maxLevel?this.levels[e].width/this.levels[this.maxLevel].width:t}return h.TileSource.prototype.getLevelScale.call(this,e)},getNumTiles:function(e){if(this.emulateLegacyImagePyramid)return this.getLevelScale(e)?new h.Point(1,1):new h.Point(0,0);if(this.levelSizes){var t=this.levelSizes[e];var i=Math.ceil(t.width/this.getTileWidth(e)),t=Math.ceil(t.height/this.getTileHeight(e));return new h.Point(i,t)}return h.TileSource.prototype.getNumTiles.call(this,e)},getTileAtPoint:function(e,t){if(this.emulateLegacyImagePyramid)return new h.Point(0,0);if(this.levelSizes){var i=0<=t.x&&t.x<=1&&0<=t.y&&t.y<=1/this.aspectRatio;h.console.assert(i,"[TileSource.getTileAtPoint] must be called with a valid point.");var n=this.levelSizes[e].width;i=t.x*n;n=t.y*n;i=Math.floor(i/this.getTileWidth(e));n=Math.floor(n/this.getTileHeight(e));1<=t.x&&(i=this.getNumTiles(e).x-1);t.y>=1/this.aspectRatio-1e-15&&(n=this.getNumTiles(e).y-1);return new h.Point(i,n)}return h.TileSource.prototype.getTileAtPoint.call(this,e,t)},getTileUrl:function(e,t,i){if(this.emulateLegacyImagePyramid){var n=null;return n=0=this.minLevel&&e<=this.maxLevel?this.levels[e].url:n}var r,o,s,a,l,h,c,u,d=Math.pow(.5,this.maxLevel-e);if(this.levelSizes){r=this.levelSizes[e].width;o=this.levelSizes[e].height}else{r=Math.ceil(this.width*d);o=Math.ceil(this.height*d)}c=this.getTileWidth(e);u=this.getTileHeight(e);a=Math.round(c/d);l=Math.round(u/d);n=1===this.version?"native."+this.tileFormat:"default."+this.tileFormat;if(re.tileSize||parseInt(t.y,10)>e.tileSize;){t.x=Math.floor(t.x/2);t.y=Math.floor(t.y/2);e.imageSizes.push({x:t.x,y:t.y});e.gridSize.push(this._getGridSize(t.x,t.y,e.tileSize))}e.imageSizes.reverse();e.gridSize.reverse();e.minLevel=0;e.maxLevel=e.gridSize.length-1;OpenSeadragon.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");return n.sort(function(e,t){return e.height-t.height})}(t.levels);if(0=this.minLevel&&e<=this.maxLevel?this.levels[e].width/this.levels[this.maxLevel].width:t},getNumTiles:function(e){return this.getLevelScale(e)?new a.Point(1,1):new a.Point(0,0)},getTileUrl:function(e,t,i){var n=null;return n=0=this.minLevel&&e<=this.maxLevel?this.levels[e].url:n}})}(OpenSeadragon);!function(a){a.ImageTileSource=function(e){e=a.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1},e);a.TileSource.apply(this,[e])};a.extend(a.ImageTileSource.prototype,a.TileSource.prototype,{supports:function(e,t){return e.type&&"image"===e.type},configure:function(e,t,i){return e},getImageInfo:function(e){var t=this._image=new Image;var i=this;this.crossOriginPolicy&&(t.crossOrigin=this.crossOriginPolicy);this.ajaxWithCredentials&&(t.useCredentials=this.ajaxWithCredentials);a.addEvent(t,"load",function(){i.width=t.naturalWidth;i.height=t.naturalHeight;i.aspectRatio=i.width/i.height;i.dimensions=new a.Point(i.width,i.height);i._tileWidth=i.width;i._tileHeight=i.height;i.tileOverlap=0;i.minLevel=0;i.levels=i._buildLevels();i.maxLevel=i.levels.length-1;i.ready=!0;i.raiseEvent("ready",{tileSource:i})});a.addEvent(t,"error",function(){i.raiseEvent("open-failed",{message:"Error loading image at "+e,source:e})});t.src=e},getLevelScale:function(e){var t=NaN;return t=e>=this.minLevel&&e<=this.maxLevel?this.levels[e].width/this.levels[this.maxLevel].width:t},getNumTiles:function(e){return this.getLevelScale(e)?new a.Point(1,1):new a.Point(0,0)},getTileUrl:function(e,t,i){var n=null;return n=e>=this.minLevel&&e<=this.maxLevel?this.levels[e].url:n},getContext2D:function(e,t,i){var n=null;return n=e>=this.minLevel&&e<=this.maxLevel?this.levels[e].context2D:n},destroy:function(e){this._freeupCanvasMemory(e)},_buildLevels:function(){var e=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!a.supportsCanvas){delete this._image;return e}var t=this._image.naturalWidth;var i=this._image.naturalHeight;var n=document.createElement("canvas");var r=n.getContext("2d");n.width=t;n.height=i;r.drawImage(this._image,0,0,t,i);e[0].context2D=r;delete this._image;if(a.isCanvasTainted(n))return e;for(;2<=t&&2<=i;){t=Math.floor(t/2);i=Math.floor(i/2);var o=document.createElement("canvas");var s=o.getContext("2d");o.width=t;o.height=i;s.drawImage(n,0,0,t,i);e.splice(0,0,{context2D:s,width:t,height:i});n=o;r=s}return e},_freeupCanvasMemory:function(e){for(var t=0;t=i.ButtonState.GROUP&&e.currentState===i.ButtonState.REST){!function(e){e.shouldFade=!1;e.imgGroup&&i.setElementOpacity(e.imgGroup,1,!0)}(e);e.currentState=i.ButtonState.GROUP}if(t>=i.ButtonState.HOVER&&e.currentState===i.ButtonState.GROUP){e.imgHover&&(e.imgHover.style.visibility="");e.currentState=i.ButtonState.HOVER}if(t>=i.ButtonState.DOWN&&e.currentState===i.ButtonState.HOVER){e.imgDown&&(e.imgDown.style.visibility="");e.currentState=i.ButtonState.DOWN}}}function o(e,t){if(!e.element.disabled){if(t<=i.ButtonState.HOVER&&e.currentState===i.ButtonState.DOWN){e.imgDown&&(e.imgDown.style.visibility="hidden");e.currentState=i.ButtonState.HOVER}if(t<=i.ButtonState.GROUP&&e.currentState===i.ButtonState.HOVER){e.imgHover&&(e.imgHover.style.visibility="hidden");e.currentState=i.ButtonState.GROUP}if(t<=i.ButtonState.REST&&e.currentState===i.ButtonState.GROUP){!function(e){e.shouldFade=!0;e.fadeBeginTime=i.now()+e.fadeDelay;window.setTimeout(function(){n(e)},e.fadeDelay)}(e);e.currentState=i.ButtonState.REST}}}}(OpenSeadragon);!function(r){r.ButtonGroup=function(e){r.extend(!0,this,{buttons:[],clickTimeThreshold:r.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:r.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},e);var t,i=this.buttons.concat([]),n=this;this.element=e.element||r.makeNeutralElement("div");if(!e.group){this.element.style.display="inline-block";for(t=0;tu&&(u=m.x);m.yp&&(p=m.y)}return new v.Rect(c,d,u-c,p-d)},_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(e,t){if(0===(e=v.positiveModulo(e,360)))return this.clone();t=t||this.getCenter();var i=this.getTopLeft().rotate(e,t);e=this.getTopRight().rotate(e,t).minus(i);e=e.apply(function(e){return Math.abs(e)<1e-15?0:e});t=Math.atan(e.y/e.x);e.x<0?t+=Math.PI:e.y<0&&(t+=2*Math.PI);return new v.Rect(i.x,i.y,this.width,this.height,t/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var e=this.getTopLeft();var t=this.getTopRight();var i=this.getBottomLeft();var n=this.getBottomRight();var r=Math.min(e.x,t.x,i.x,n.x);var o=Math.max(e.x,t.x,i.x,n.x);var s=Math.min(e.y,t.y,i.y,n.y);n=Math.max(e.y,t.y,i.y,n.y);return new v.Rect(r,s,o-r,n-s)},getIntegerBoundingBox:function(){var e=this.getBoundingBox();var t=Math.floor(e.x);var i=Math.floor(e.y);var n=Math.ceil(e.width+e.x-t);e=Math.ceil(e.height+e.y-i);return new v.Rect(t,i,n,e)},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(100*this.x)/100+", "+Math.round(100*this.y)/100+", "+Math.round(100*this.width)/100+"x"+Math.round(100*this.height)/100+", "+Math.round(100*this.degrees)/100+"deg]"}}}(OpenSeadragon);!function(h){var s={};h.ReferenceStrip=function(e){var t,i,n,r=e.viewer,o=h.getElementSize(r.element);if(!e.id){e.id="referencestrip-"+h.now();this.element=h.makeNeutralElement("div");this.element.id=e.id;this.element.className="referencestrip"}e=h.extend(!0,{sizeRatio:h.DEFAULT_SETTINGS.referenceStripSizeRatio,position:h.DEFAULT_SETTINGS.referenceStripPosition,scroll:h.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:h.DEFAULT_SETTINGS.clickTimeThreshold},e,{element:this.element});h.extend(this,e);s[this.id]={animating:!1};this.minPixelRatio=this.viewer.minPixelRatio;this.element.tabIndex=0;(i=this.element.style).marginTop="0px";i.marginRight="0px";i.marginBottom="0px";i.marginLeft="0px";i.left="0px";i.bottom="0px";i.border="0px";i.background="#000";i.position="relative";h.setElementTouchActionNone(this.element);h.setElementOpacity(this.element,.8);this.viewer=r;this.tracker=new h.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:h.delegate(this,a),dragHandler:h.delegate(this,l),scrollHandler:h.delegate(this,c),enterHandler:h.delegate(this,d),leaveHandler:h.delegate(this,p),keyDownHandler:h.delegate(this,g),keyHandler:h.delegate(this,m),preProcessEventHandler:function(e){"wheel"===e.eventType&&(e.preventDefault=!0)}});if(e.width&&e.height){this.element.style.width=e.width+"px";this.element.style.height=e.height+"px";r.addControl(this.element,{anchor:h.ControlAnchor.BOTTOM_LEFT})}else if("horizontal"===e.scroll){this.element.style.width=o.x*e.sizeRatio*r.tileSources.length+12*r.tileSources.length+"px";this.element.style.height=o.y*e.sizeRatio+"px";r.addControl(this.element,{anchor:h.ControlAnchor.BOTTOM_LEFT})}else{this.element.style.height=o.y*e.sizeRatio*r.tileSources.length+12*r.tileSources.length+"px";this.element.style.width=o.x*e.sizeRatio+"px";r.addControl(this.element,{anchor:h.ControlAnchor.TOP_LEFT})}this.panelWidth=o.x*this.sizeRatio+8;this.panelHeight=o.y*this.sizeRatio+8;this.panels=[];this.miniViewers={};for(n=0;ns+n.x-this.panelWidth){t=Math.min(t,r-n.x);this.element.style.marginLeft=-t+"px";u(this,n.x,-t)}else if(ta+n.y-this.panelHeight){t=Math.min(t,o-n.y);this.element.style.marginTop=-t+"px";u(this,n.y,-t)}else if(t-(n-o.x)){this.element.style.marginLeft=t+2*e.delta.x+"px";u(this,o.x,t+2*e.delta.x)}}else if(-e.delta.x<0&&t<0){this.element.style.marginLeft=t+2*e.delta.x+"px";u(this,o.x,t+2*e.delta.x)}}else if(0<-e.delta.y){if(i>-(r-o.y)){this.element.style.marginTop=i+2*e.delta.y+"px";u(this,o.y,i+2*e.delta.y)}}else if(-e.delta.y<0&&i<0){this.element.style.marginTop=i+2*e.delta.y+"px";u(this,o.y,i+2*e.delta.y)}}}function c(e){if(this.element){var t=Number(this.element.style.marginLeft.replace("px","")),i=Number(this.element.style.marginTop.replace("px","")),n=Number(this.element.style.width.replace("px","")),r=Number(this.element.style.height.replace("px","")),o=h.getElementSize(this.viewer.canvas);if("horizontal"===this.scroll){if(0-(n-o.x)){this.element.style.marginLeft=t-60*e.scroll+"px";u(this,o.x,t-60*e.scroll)}}else if(e.scroll<0&&t<0){this.element.style.marginLeft=t-60*e.scroll+"px";u(this,o.x,t-60*e.scroll)}}else if(e.scroll<0){if(i>o.y-r){this.element.style.marginTop=i+60*e.scroll+"px";u(this,o.y,i+60*e.scroll)}}else if(0=this.target.time)this.current.value=this.target.value;else{i=e+(t-e)*(i=this.springStiffness,n=(this.current.time-this.start.time)/(this.target.time-this.start.time),(1-Math.exp(i*-n))/(1-Math.exp(-i)));this._exponential?this.current.value=Math.exp(i):this.current.value=i}var i,n;return this.current.value!==this.target.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(OpenSeadragon);!function(n){n.ImageJob=function(e){n.extend(!0,this,{timeout:n.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},e);this.data=null;this.userData={};this.errorMsg=null};n.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);"function"==typeof t&&t()};this.source.downloadTileStart(this)},finish:function(e,t,i){this.data=e;this.request=t;this.errorMsg=i;this.jobId&&window.clearTimeout(this.jobId);this.callback(this)}};n.ImageLoader=function(e){n.extend(!0,this,{jobLimit:n.DEFAULT_SETTINGS.imageLoaderLimit,timeout:n.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},e)};n.ImageLoader.prototype={addJob:function(t){if(!t.source){n.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var e=n.TileSource.prototype;t.source={downloadTileStart:e.downloadTileStart,downloadTileAbort:e.downloadTileAbort}}var i=this,e={src:t.src,tile:t.tile||{},source:t.source,loadWithAjax:t.loadWithAjax,ajaxHeaders:t.loadWithAjax?t.ajaxHeaders:null,crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,postData:t.postData,callback:function(e){!function(e,t,i){""!==t.errorMsg&&(null===t.data||void 0===t.data)&&t.tries<1+e.tileRetryMax&&e.failedTiles.push(t);var n;e.jobsInProgress--;if((!e.jobLimit||e.jobsInProgresse.tile);if(0!==e.opacity&&(0!==t.length||e.placeholderFillStyle))for(var i=t.length-1;0<=i;i--){var n=t[i];this._drawTile(n);this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:e,tile:n})}}_drawTile(e){n.console.assert(e,"[Drawer._drawTile] tile is required");let t=this.canvas;if(e.cacheImageRecord)if(e.loaded){if(!e.element){var i=e.getImage();if(!i)return;e.element=n.makeNeutralElement("div");e.imgElement=i.cloneNode();e.imgElement.style.msInterpolationMode="nearest-neighbor";e.imgElement.style.width="100%";e.imgElement.style.height="100%";e.style=e.element.style;e.style.position="absolute"}e.element.parentNode!==t&&t.appendChild(e.element);e.imgElement.parentNode!==e.element&&e.element.appendChild(e.imgElement);e.style.top=e.position.y+"px";e.style.left=e.position.x+"px";e.style.height=e.size.y+"px";e.style.width=e.size.x+"px";e.flipped&&(e.style.transform="scaleX(-1)");n.setElementOpacity(e.element,e.opacity)}else n.console.warn("Attempting to draw tile %s when it's not yet loaded.",e.toString());else n.console.warn("[Drawer._drawTileToHTML] attempting to draw tile %s when it's not cached",e.toString())}}n.HTMLDrawer=t}(OpenSeadragon);!function(p){var e=p;class t extends e.DrawerBase{constructor(e){super(e);this.context=this.canvas.getContext("2d");this.sketchCanvas=null;this.sketchContext=null;this._imageSmoothingEnabled=!0;this._viewportFlipped=!1;this.viewer.allowEventHandler("tile-drawn");this.viewer.allowEventHandler("tile-drawing")}static isSupported(){return p.supportsCanvas}getType(){return"canvas"}_createDrawingElement(){let e=p.makeNeutralElement("canvas");var t=this._calculateCanvasSize();e.width=t.x;e.height=t.y;return e}draw(e){this._prepareNewFrame();if(this.viewer.viewport.getFlip()!==this._viewportFlipped){this._flip();this._viewportFlipped=!this._viewportFlipped}for(const t of e)0!==t.opacity&&this._drawTiles(t)}canRotate(){return!0}destroy(){this.canvas.width=1;this.canvas.height=1;this.sketchCanvas=null;this.sketchContext=null;this.container.removeChild(this.canvas)}minimumOverlapRequired(){return!0}setImageSmoothingEnabled(e){this._imageSmoothingEnabled=!!e;this._updateImageSmoothingEnabled(this.context);this.viewer.forceRedraw()}drawDebuggingRect(e){var t=this.context;t.save();t.lineWidth=2*p.pixelDensityRatio;t.strokeStyle=this.debugGridColor[0];t.fillStyle=this.debugGridColor[0];t.strokeRect(e.x*p.pixelDensityRatio,e.y*p.pixelDensityRatio,e.width*p.pixelDensityRatio,e.height*p.pixelDensityRatio);t.restore()}_raiseTileDrawingEvent(e,t,i,n){this.viewer.raiseEvent("tile-drawing",{tiledImage:e,context:t,tile:i,rendered:n})}_prepareNewFrame(){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(null!==this.sketchCanvas){e=this._calculateSketchCanvasSize();this.sketchCanvas.width=e.x;this.sketchCanvas.height=e.y;this._updateImageSmoothingEnabled(this.sketchContext)}}this._clear()}_clear(e,t){e=this._getContext(e);if(t)e.clearRect(t.x,t.y,t.width,t.height);else{t=e.canvas;e.clearRect(0,0,t.width,t.height)}}_drawTiles(i){var e=i.getTilesToDraw().map(e=>e.tile);if(0!==i.opacity&&(0!==e.length||i.placeholderFillStyle)){var t=e[0];var n;t&&(n=i.opacity<1||i.compositeOperation&&"source-over"!==i.compositeOperation||!i._isBottomItem()&&i.source.hasTransparency(t.context2D,t.getUrl(),t.ajaxHeaders,t.postData));var r;var o;var s=this.viewport.getZoom(!0);var a=i.viewportToImageZoom(s);if(1i.smoothTileEdgesMinZoom&&!i.iOSDevice&&i.getRotation(!0)%360==0){n=!0;r=t.getScaleForEdgeSmoothing();o=t.getTranslationForEdgeSmoothing(r,this._getCanvasSize(!1),this._getCanvasSize(!0))}var l;if(n){r||(l=(l=this.viewport.viewportToViewerElementRectangle(i.getClippedBounds(!0)).getIntegerBoundingBox()).times(p.pixelDensityRatio));this._clear(!0,l)}r||this._setRotations(i,n);s=!1;if(i._clip){this._saveContext(n);a=i.imageToViewportRectangle(i._clip,!0);a=a.rotate(-i.getRotation(!0),i._getRotationPoint(!0));a=this.viewportToDrawerRectangle(a);r&&(a=a.times(r));o&&(a=a.translate(o));this._setClip(a,n);s=!0}if(i._croppingPolygons){var h=this;s||this._saveContext(n);try{var c=i._croppingPolygons.map(function(e){return e.map(function(e){e=i.imageToViewportCoordinates(e.x,e.y,!0).rotate(-i.getRotation(!0),i._getRotationPoint(!0));e=h.viewportCoordToDrawerCoord(e);r&&(e=e.times(r));return e=o?e.plus(o):e})});this._clipWithPolygons(c,n)}catch(e){p.console.error(e)}s=!0}i._hasOpaqueTile=!1;if(i.placeholderFillStyle&&!1===i._hasOpaqueTile){let e=this.viewportToDrawerRectangle(i.getBoundsNoRotate(!0));r&&(e=e.times(r));o&&(e=e.translate(o));let t=null;t="function"==typeof i.placeholderFillStyle?i.placeholderFillStyle(i,this.context):i.placeholderFillStyle;this._drawRectangle(e,t,n)}c=function(e){if("number"==typeof e)return v(e);if(!e||!p.Browser)return g;var t=e[p.Browser.vendor];m(t)&&(t=e["*"]);return v(t)}(i.subPixelRoundingForTransparency);var u=!1;c===p.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS?u=!0:c===p.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&(u=!(this.viewer&&this.viewer.isAnimating()));for(var d=0;dthis.canvas.width&&(o.width=this.canvas.width-o.x);if(o.y<0){o.height+=o.y;o.y=0}o.y+o.height>this.canvas.height&&(o.height=this.canvas.height-o.y);this.context.drawImage(this.sketchCanvas,o.x,o.y,o.width,o.height,o.x,o.y,o.width,o.height)}else{t=r.scale||1;e=(i=r.translate)instanceof p.Point?i:new p.Point(0,0);n=0;o=0;if(i){r=this.sketchCanvas.width-this.canvas.width;i=this.sketchCanvas.height-this.canvas.height;n=Math.round(r/2);o=Math.round(i/2)}this.context.drawImage(this.sketchCanvas,e.x-n*t,e.y-o*t,(this.canvas.width+2*n)*t,(this.canvas.height+2*o)*t,-n,-o,this.canvas.width+2*n,this.canvas.height+2*o)}this.context.restore()}_drawDebugInfoOnTile(e,t,i,n){var r=this.viewer.world.getIndexOfItem(n)%this.debugGridColor.length;var o=this.context;o.save();o.lineWidth=2*p.pixelDensityRatio;o.font="small-caps bold "+13*p.pixelDensityRatio+"px arial";o.strokeStyle=this.debugGridColor[r];o.fillStyle=this.debugGridColor[r];this._setRotations(n);this._viewportFlipped&&this._flip({point:e.position.plus(e.size.divide(2))});o.strokeRect(e.position.x*p.pixelDensityRatio,e.position.y*p.pixelDensityRatio,e.size.x*p.pixelDensityRatio,e.size.y*p.pixelDensityRatio);var s=(e.position.x+e.size.x/2)*p.pixelDensityRatio;var a=(e.position.y+e.size.y/2)*p.pixelDensityRatio;o.translate(s,a);r=this.viewport.getRotation(!0);o.rotate(Math.PI/180*-r);o.translate(-s,-a);if(0===e.x&&0===e.y){o.fillText("Zoom: "+this.viewport.getZoom(),e.position.x*p.pixelDensityRatio,(e.position.y-30)*p.pixelDensityRatio);o.fillText("Pan: "+this.viewport.getBounds().toString(),e.position.x*p.pixelDensityRatio,(e.position.y-20)*p.pixelDensityRatio)}o.fillText("Level: "+e.level,(e.position.x+10)*p.pixelDensityRatio,(e.position.y+20)*p.pixelDensityRatio);o.fillText("Column: "+e.x,(e.position.x+10)*p.pixelDensityRatio,(e.position.y+30)*p.pixelDensityRatio);o.fillText("Row: "+e.y,(e.position.x+10)*p.pixelDensityRatio,(e.position.y+40)*p.pixelDensityRatio);o.fillText("Order: "+i+" of "+t,(e.position.x+10)*p.pixelDensityRatio,(e.position.y+50)*p.pixelDensityRatio);o.fillText("Size: "+e.size.toString(),(e.position.x+10)*p.pixelDensityRatio,(e.position.y+60)*p.pixelDensityRatio);o.fillText("Position: "+e.position.toString(),(e.position.x+10)*p.pixelDensityRatio,(e.position.y+70)*p.pixelDensityRatio);this.viewport.getRotation(!0)%360!=0&&this._restoreRotationChanges();n.getRotation(!0)%360!=0&&this._restoreRotationChanges();o.restore()}_updateImageSmoothingEnabled(e){e.msImageSmoothingEnabled=this._imageSmoothingEnabled;e.imageSmoothingEnabled=this._imageSmoothingEnabled}_getCanvasSize(e){e=this._getContext(e).canvas;return new p.Point(e.width,e.height)}_getCanvasCenter(){return new p.Point(this.canvas.width/2,this.canvas.height/2)}_setRotations(e,t=!1){var i=!1;if(this.viewport.getRotation(!0)%360!=0){this._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:t,saveContext:i});i=!1}e.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:e.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(e._getRotationPoint(!0),!0),useSketch:t,saveContext:i})}_offsetForRotation(e){var t=e.point?e.point.times(p.pixelDensityRatio):this._getCanvasCenter();var i=this._getContext(e.useSketch);i.save();i.translate(t.x,t.y);i.rotate(Math.PI/180*e.degrees);i.translate(-t.x,-t.y)}_flip(e){var t=(e=e||{}).point?e.point.times(p.pixelDensityRatio):this._getCanvasCenter();e=this._getContext(e.useSketch);e.translate(t.x,0);e.scale(-1,1);e.translate(-t.x,0)}_restoreRotationChanges(e){this._getContext(e).restore()}_calculateCanvasSize(){var e=p.pixelDensityRatio;var t=this.viewport.getContainerSize();return{x:Math.round(t.x*e),y:Math.round(t.y*e)}}_calculateSketchCanvasSize(){var e=this._calculateCanvasSize();if(0===this.viewport.getRotation())return e;e=Math.ceil(Math.sqrt(e.x*e.x+e.y*e.y));return{x:e,y:e}}}p.CanvasDrawer=t;var g=p.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function m(e){return e!==p.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&e!==p.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&e!==p.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function v(e){return m(e)?g:e}}(OpenSeadragon);!function(w){const e=w;e.WebGLDrawer=class extends e.DrawerBase{constructor(e){super(e);this._destroyed=!1;this._TextureMap=new Map;this._TileMap=new Map;this._gl=null;this._firstPass=null;this._secondPass=null;this._glFrameBuffer=null;this._renderToTexture=null;this._glFramebufferToCanvasTransform=null;this._outputCanvas=null;this._outputContext=null;this._clippingCanvas=null;this._clippingContext=null;this._renderingCanvas=null;this._backupCanvasDrawer=null;this._boundToTileReady=e=>this._tileReadyHandler(e);this._boundToImageUnloaded=e=>this._imageUnloadedHandler(e);this.viewer.addHandler("tile-ready",this._boundToTileReady);this.viewer.addHandler("image-unloaded",this._boundToImageUnloaded);this.viewer.rejectEventHandler("tile-drawn","The WebGLDrawer does not raise the tile-drawn event");this.viewer.rejectEventHandler("tile-drawing","The WebGLDrawer does not raise the tile-drawing event");this._setupCanvases();this._setupRenderer();this.context=this._outputContext}destroy(){if(!this._destroyed){let t=this._gl;var n=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{this._cleanupImageData(e)});t.deleteBuffer(this._secondPass.bufferOutputPosition);t.deleteFramebuffer(this._glFrameBuffer);this._renderingCanvas.width=this._renderingCanvas.height=1;this._clippingCanvas.width=this._clippingCanvas.height=1;this._outputCanvas.width=this._outputCanvas.height=1;this._renderingCanvas=null;this._clippingCanvas=this._clippingContext=null;this._outputCanvas=this._outputContext=null;let i=t.getExtension("WEBGL_lose_context");i&&i.loseContext();this.viewer.removeHandler("tile-ready",this._boundToTileReady);this.viewer.removeHandler("image-unloaded",this._boundToImageUnloaded);this._gl=null;if(this._backupCanvasDrawer){this._backupCanvasDrawer.destroy();this._backupCanvasDrawer=null}this.container.removeChild(this.canvas);this.viewer.drawer===this&&(this.viewer.drawer=null);this._destroyed=!0}}canRotate(){return!0}static isSupported(){let e=document.createElement("canvas");let t=w.isFunction(e.getContext)&&e.getContext("webgl");let i=t.getExtension("WEBGL_lose_context");i&&i.loseContext();return!!t}getType(){return"webgl"}_createDrawingElement(){let e=w.makeNeutralElement("canvas");var t=this._calculateCanvasSize();e.width=t.x;e.height=t.y;return e}_getBackupCanvasDrawer(){if(!this._backupCanvasDrawer){this._backupCanvasDrawer=this.viewer.requestDrawer("canvas",{mainDrawer:!1});this._backupCanvasDrawer.canvas.style.setProperty("visibility","hidden")}return this._backupCanvasDrawer}draw(e){let v=this._gl;let t=this.viewport.getBoundsNoRotate(!0),i=this.viewport.getCenter(!0),n=this.viewport.getRotation(!0)*Math.PI/180;var r=this.viewport.flipped?-1:1;var o=w.Mat3.makeTranslation(-i.x,-i.y);let s=w.Mat3.makeScaling(2/t.width*r,-2/t.height);r=w.Mat3.makeRotation(-n);let f=s.multiply(r).multiply(o);v.bindFramebuffer(v.FRAMEBUFFER,null);v.clear(v.COLOR_BUFFER_BIT);this._outputContext.clearRect(0,0,this._outputCanvas.width,this._outputCanvas.height);let y=!1;e.forEach((s,e)=>{if(s.isTainted()){if(y){this._outputContext.drawImage(this._renderingCanvas,0,0);v.bindFramebuffer(v.FRAMEBUFFER,null);v.clear(v.COLOR_BUFFER_BIT);y=!1}const n=this._getBackupCanvasDrawer();n.draw([s]);this._outputContext.drawImage(n.canvas,0,0)}else{let o=s.getTilesToDraw();s.placeholderFillStyle&&!1===s._hasOpaqueTile&&this._drawPlaceholder(s);if(0!==o.length&&0!==s.getOpacity()){var t=o[0];var i=s.compositeOperation||this.viewer.compositeOperation||s._clip||s._croppingPolygons||s.debugMode;var a=i||s.opacity<1||t.hasTransparency;if(i){y&&this._outputContext.drawImage(this._renderingCanvas,0,0);v.bindFramebuffer(v.FRAMEBUFFER,null);v.clear(v.COLOR_BUFFER_BIT)}v.useProgram(this._firstPass.shaderProgram);if(a){v.bindFramebuffer(v.FRAMEBUFFER,this._glFrameBuffer);v.clear(v.COLOR_BUFFER_BIT)}else v.bindFramebuffer(v.FRAMEBUFFER,null);let n=f;var l=s.getRotation(!0);if(l%360!=0){t=w.Mat3.makeRotation(-l*Math.PI/180);l=s.getBoundsNoRotate(!0).getCenter();let e=w.Mat3.makeTranslation(l.x,l.y);l=w.Mat3.makeTranslation(-l.x,-l.y);l=e.multiply(t).multiply(l);n=f.multiply(l)}var h=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);if(h<=0)throw new Error(`WegGL error: bad value for gl parameter MAX_TEXTURE_IMAGE_UNITS (${h}). This could happen + if too many contexts have been created and not released, or there is another problem with the graphics card.`);var c=new Float32Array(12*h);var u=new Array(h);let r=new Array(h);var d=new Array(h);for(let i=0;i{v.uniformMatrix3fv(this._firstPass.uTransformMatrices[t],!1,e)});v.uniform1fv(this._firstPass.uOpacities,new Float32Array(d));v.bindBuffer(v.ARRAY_BUFFER,this._firstPass.bufferOutputPosition);v.vertexAttribPointer(this._firstPass.aOutputPosition,2,v.FLOAT,!1,0,0);v.bindBuffer(v.ARRAY_BUFFER,this._firstPass.bufferTexturePosition);v.vertexAttribPointer(this._firstPass.aTexturePosition,2,v.FLOAT,!1,0,0);v.bindBuffer(v.ARRAY_BUFFER,this._firstPass.bufferIndex);v.vertexAttribPointer(this._firstPass.aIndex,1,v.FLOAT,!1,0,0);v.drawArrays(v.TRIANGLES,0,6*g)}}if(a){v.useProgram(this._secondPass.shaderProgram);v.bindFramebuffer(v.FRAMEBUFFER,null);v.activeTexture(v.TEXTURE0);v.bindTexture(v.TEXTURE_2D,this._renderToTexture);this._gl.uniform1f(this._secondPass.uOpacityMultiplier,s.opacity);v.bindBuffer(v.ARRAY_BUFFER,this._secondPass.bufferTexturePosition);v.vertexAttribPointer(this._secondPass.aTexturePosition,2,v.FLOAT,!1,0,0);v.bindBuffer(v.ARRAY_BUFFER,this._secondPass.bufferOutputPosition);v.vertexAttribPointer(this._firstPass.aOutputPosition,2,v.FLOAT,!1,0,0);v.drawArrays(v.TRIANGLES,0,6)}y=!0;if(i){this._applyContext2dPipeline(s,o,e);y=!1;v.bindFramebuffer(v.FRAMEBUFFER,null);v.clear(v.COLOR_BUFFER_BIT)}0===e&&this._raiseTiledImageDrawnEvent(s,o.map(e=>e.tile))}}});y&&this._outputContext.drawImage(this._renderingCanvas,0,0)}setImageSmoothingEnabled(e){}drawDebuggingRect(e){let t=this._outputContext;t.save();t.lineWidth=2*w.pixelDensityRatio;t.strokeStyle=this.debugGridColor[0];t.fillStyle=this.debugGridColor[0];t.strokeRect(e.x*w.pixelDensityRatio,e.y*w.pixelDensityRatio,e.width*w.pixelDensityRatio,e.height*w.pixelDensityRatio);t.restore()}_getTextureDataFromTile(e){return e.getCanvasContext().canvas}_applyContext2dPipeline(e,t,i){this._outputContext.save();this._outputContext.globalCompositeOperation=0===i?null:e.compositeOperation||this.viewer.compositeOperation;if(e._croppingPolygons||e._clip){this._renderToClippingCanvas(e);this._outputContext.drawImage(this._clippingCanvas,0,0)}else this._outputContext.drawImage(this._renderingCanvas,0,0);this._outputContext.restore();if(e.debugMode){i=this.viewer.viewport.getFlip();i&&this._flip();this._drawDebugInfo(t,e,i);i&&this._flip()}}_getTileData(e,t,i,n,r,o,s,a,l){var h=i.texture;var c=i.position;o.set(c,12*r);i=this._calculateOverlapFraction(e,t);o=e.positionedBounds.width*i.x;c=e.positionedBounds.height*i.y;t=e.positionedBounds.x+(0===e.x?0:o);i=e.positionedBounds.y+(0===e.y?0:c);o=e.positionedBounds.x+e.positionedBounds.width-(e.isRightMost?0:o);c=e.positionedBounds.y+e.positionedBounds.height-(e.isBottomMost?0:c);let u=new w.Mat3([o-t,0,0,0,c-i,0,t,i,1]);if(e.flipped){let e=w.Mat3.makeTranslation(.5,0);i=w.Mat3.makeTranslation(-.5,0);i=e.multiply(w.Mat3.makeScaling(-1,1)).multiply(i);u=u.multiply(i)}n=n.multiply(u);l[r]=e.opacity;s[r]=h;a[r]=n.values}_setupRenderer(){let e=this._gl;e||w.console.error("_setupCanvases must be called before _setupRenderer");this._unitQuad=this._makeQuadVertexBuffer(0,1,0,1);this._makeFirstPassShaderProgram();this._makeSecondPassShaderProgram();this._renderToTexture=e.createTexture();e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,this._renderToTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this._renderingCanvas.width,this._renderingCanvas.height,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);this._glFrameBuffer=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,this._glFrameBuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._renderToTexture,0);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}_makeFirstPassShaderProgram(){let t=this._glNumTextures=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);var e=` + attribute vec2 a_output_position; + attribute vec2 a_texture_position; + attribute float a_index; + + ${[...Array(t).keys()].map(e=>`uniform mat3 u_matrix_${e};`).join("\n")} // create a uniform mat3 for each potential tile to draw + + varying vec2 v_texture_position; + varying float v_image_index; + + void main() { + + mat3 transform_matrix; // value will be set by the if/elses in makeConditional() + + ${[...Array(t).keys()].map(e=>`${0n.getUniformLocation(r,"u_matrix_"+e)),uImages:n.getUniformLocation(r,"u_images"),uOpacities:n.getUniformLocation(r,"u_opacities"),bufferOutputPosition:n.createBuffer(),bufferTexturePosition:n.createBuffer(),bufferIndex:n.createBuffer()};n.uniform1iv(this._firstPass.uImages,[...Array(t).keys()]);let o=new Float32Array(12*t);for(let e=0;eArray(6).fill(e)).flat();n.bufferData(n.ARRAY_BUFFER,new Float32Array(i),n.STATIC_DRAW);n.enableVertexAttribArray(this._firstPass.aIndex)}_makeSecondPassShaderProgram(){let e=this._gl;var t=this.constructor.initShaderProgram(e,` + attribute vec2 a_output_position; + attribute vec2 a_texture_position; + + uniform mat3 u_matrix; + + varying vec2 v_texture_position; + + void main() { + gl_Position = vec4(u_matrix * vec3(a_output_position, 1), 1); + + v_texture_position = a_texture_position; + } + `,` + precision mediump float; + + // our texture + uniform sampler2D u_image; + + // the texCoords passed in from the vertex shader. + varying vec2 v_texture_position; + + // the opacity multiplier for the image + uniform float u_opacity_multiplier; + + void main() { + gl_FragColor = texture2D(u_image, v_texture_position); + gl_FragColor *= u_opacity_multiplier; + } + `);e.useProgram(t);this._secondPass={shaderProgram:t,aOutputPosition:e.getAttribLocation(t,"a_output_position"),aTexturePosition:e.getAttribLocation(t,"a_texture_position"),uMatrix:e.getUniformLocation(t,"u_matrix"),uImage:e.getUniformLocation(t,"u_image"),uOpacityMultiplier:e.getUniformLocation(t,"u_opacity_multiplier"),bufferOutputPosition:e.createBuffer(),bufferTexturePosition:e.createBuffer()};e.bindBuffer(e.ARRAY_BUFFER,this._secondPass.bufferOutputPosition);e.bufferData(e.ARRAY_BUFFER,this._unitQuad,e.STATIC_DRAW);e.enableVertexAttribArray(this._secondPass.aOutputPosition);e.bindBuffer(e.ARRAY_BUFFER,this._secondPass.bufferTexturePosition);e.bufferData(e.ARRAY_BUFFER,this._unitQuad,e.DYNAMIC_DRAW);e.enableVertexAttribArray(this._secondPass.aTexturePosition);t=w.Mat3.makeScaling(2,2).multiply(w.Mat3.makeTranslation(-.5,-.5));e.uniformMatrix3fv(this._secondPass.uMatrix,!1,t.values)}_resizeRenderer(){let e=this._gl;var t=this._renderingCanvas.width;var i=this._renderingCanvas.height;e.viewport(0,0,t,i);e.deleteTexture(this._renderToTexture);this._renderToTexture=e.createTexture();e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,this._renderToTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,i,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.bindFramebuffer(e.FRAMEBUFFER,this._glFrameBuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._renderToTexture,0)}_setupCanvases(){let t=this;this._outputCanvas=this.canvas;this._outputContext=this._outputCanvas.getContext("2d");this._renderingCanvas=document.createElement("canvas");this._clippingCanvas=document.createElement("canvas");this._clippingContext=this._clippingCanvas.getContext("2d");this._renderingCanvas.width=this._clippingCanvas.width=this._outputCanvas.width;this._renderingCanvas.height=this._clippingCanvas.height=this._outputCanvas.height;this._gl=this._renderingCanvas.getContext("webgl");this.viewer.addHandler("resize",function(){if(t._outputCanvas!==t.viewer.drawer.canvas){t._outputCanvas.style.width=t.viewer.drawer.canvas.clientWidth+"px";t._outputCanvas.style.height=t.viewer.drawer.canvas.clientHeight+"px"}var e=t._calculateCanvasSize();if(t._outputCanvas.width!==e.x||t._outputCanvas.height!==e.y){t._outputCanvas.width=e.x;t._outputCanvas.height=e.y}t._renderingCanvas.style.width=t._outputCanvas.clientWidth+"px";t._renderingCanvas.style.height=t._outputCanvas.clientHeight+"px";t._renderingCanvas.width=t._clippingCanvas.width=t._outputCanvas.width;t._renderingCanvas.height=t._clippingCanvas.height=t._outputCanvas.height;t._resizeRenderer()})}_makeQuadVertexBuffer(e,t,i,n){return new Float32Array([e,n,t,n,e,i,e,i,t,n,t,i])}_tileReadyHandler(r){let o=r.tile;let s=r.tiledImage;if(!s.isTainted()){var a=o.getCanvasContext();var l=a&&a.canvas;if(l&&!w.isCanvasTainted(l)){if(!this._TextureMap.get(l)){let e=this._gl;var h=e.createTexture();let t;var c=s.source.tileOverlap;let i,n;if(o.sourceBounds){i=Math.min(o.sourceBounds.width,l.width)/l.width;n=Math.min(o.sourceBounds.height,l.height)/l.height}else{i=1;n=1}if(0{e=t.imageToViewportCoordinates(e.x,e.y,!0).rotate(this.viewer.viewport.getRotation(!0),this.viewer.viewport.getCenter(!0));return this.viewportCoordToDrawerCoord(e)});this._clippingContext.beginPath();e.forEach((e,t)=>{this._clippingContext[0===t?"moveTo":"lineTo"](e.x,e.y)});this._clippingContext.clip();this._setClip()}if(t._croppingPolygons){let e=t._croppingPolygons.map(e=>e.map(e=>{e=t.imageToViewportCoordinates(e.x,e.y,!0).rotate(this.viewer.viewport.getRotation(!0),this.viewer.viewport.getCenter(!0));return this.viewportCoordToDrawerCoord(e)}));this._clippingContext.beginPath();e.forEach(e=>{e.forEach((e,t)=>{this._clippingContext[0===t?"moveTo":"lineTo"](e.x,e.y)})});this._clippingContext.clip()}if(this.viewer.viewport.getFlip()){e=new w.Point(this.canvas.width/2,this.canvas.height/2);this._clippingContext.translate(e.x,0);this._clippingContext.scale(-1,1);this._clippingContext.translate(-e.x,0)}this._clippingContext.drawImage(this._renderingCanvas,0,0);this._clippingContext.restore()}_setRotations(e){var t=!1;if(this.viewport.getRotation(!0)%360!=0){this._offsetForRotation({degrees:this.viewport.getRotation(!0),saveContext:t});t=!1}e.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:e.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(e._getRotationPoint(!0),!0),saveContext:t})}_offsetForRotation(e){var t=e.point?e.point.times(w.pixelDensityRatio):this._getCanvasCenter();var i=this._outputContext;i.save();i.translate(t.x,t.y);i.rotate(Math.PI/180*e.degrees);i.translate(-t.x,-t.y)}_flip(e){var t=(e=e||{}).point?e.point.times(w.pixelDensityRatio):this._getCanvasCenter();e=this._outputContext;e.translate(t.x,0);e.scale(-1,1);e.translate(-t.x,0)}_drawDebugInfo(e,t,i){for(var n=e.length-1;0<=n;n--){var r=e[n].tile;try{this._drawDebugInfoOnTile(r,e.length,n,t,i)}catch(e){w.console.error(e)}}}_drawDebugInfoOnTile(e,t,i,n,r){var o=this.viewer.world.getIndexOfItem(n)%this.debugGridColor.length;var s=this.context;s.save();s.lineWidth=2*w.pixelDensityRatio;s.font="small-caps bold "+13*w.pixelDensityRatio+"px arial";s.strokeStyle=this.debugGridColor[o];s.fillStyle=this.debugGridColor[o];this._setRotations(n);r&&this._flip({point:e.position.plus(e.size.divide(2))});s.strokeRect(e.position.x*w.pixelDensityRatio,e.position.y*w.pixelDensityRatio,e.size.x*w.pixelDensityRatio,e.size.y*w.pixelDensityRatio);var a=(e.position.x+e.size.x/2)*w.pixelDensityRatio;o=(e.position.y+e.size.y/2)*w.pixelDensityRatio;s.translate(a,o);r=this.viewport.getRotation(!0);s.rotate(Math.PI/180*-r);s.translate(-a,-o);if(0===e.x&&0===e.y){s.fillText("Zoom: "+this.viewport.getZoom(),e.position.x*w.pixelDensityRatio,(e.position.y-30)*w.pixelDensityRatio);s.fillText("Pan: "+this.viewport.getBounds().toString(),e.position.x*w.pixelDensityRatio,(e.position.y-20)*w.pixelDensityRatio)}s.fillText("Level: "+e.level,(e.position.x+10)*w.pixelDensityRatio,(e.position.y+20)*w.pixelDensityRatio);s.fillText("Column: "+e.x,(e.position.x+10)*w.pixelDensityRatio,(e.position.y+30)*w.pixelDensityRatio);s.fillText("Row: "+e.y,(e.position.x+10)*w.pixelDensityRatio,(e.position.y+40)*w.pixelDensityRatio);s.fillText("Order: "+i+" of "+t,(e.position.x+10)*w.pixelDensityRatio,(e.position.y+50)*w.pixelDensityRatio);s.fillText("Size: "+e.size.toString(),(e.position.x+10)*w.pixelDensityRatio,(e.position.y+60)*w.pixelDensityRatio);s.fillText("Position: "+e.position.toString(),(e.position.x+10)*w.pixelDensityRatio,(e.position.y+70)*w.pixelDensityRatio);this.viewport.getRotation(!0)%360!=0&&this._restoreRotationChanges();n.getRotation(!0)%360!=0&&this._restoreRotationChanges();s.restore()}_drawPlaceholder(e){var t=e.getBounds(!0);var i=this.viewportToDrawerRectangle(e.getBounds(!0));const n=this._outputContext;let r;r="function"==typeof e.placeholderFillStyle?e.placeholderFillStyle(e,n):e.placeholderFillStyle;this._offsetForRotation({degrees:this.viewer.viewport.getRotation(!0)});n.fillStyle=r;n.translate(i.x,i.y);n.rotate(Math.PI/180*t.degrees);n.translate(-i.x,-i.y);n.fillRect(i.x,i.y,i.width,i.height);this._restoreRotationChanges()}_getCanvasCenter(){return new w.Point(this.canvas.width/2,this.canvas.height/2)}_restoreRotationChanges(){this._outputContext.restore()}static initShaderProgram(e,t,i){function n(e,t,i){t=e.createShader(t);e.shaderSource(t,i);e.compileShader(t);if(e.getShaderParameter(t,e.COMPILE_STATUS))return t;w.console.error("An error occurred compiling the shaders: "+e.getShaderInfoLog(t));e.deleteShader(t);return null}var r=n(e,e.VERTEX_SHADER,t);t=n(e,e.FRAGMENT_SHADER,i);i=e.createProgram();e.attachShader(i,r);e.attachShader(i,t);e.linkProgram(i);if(e.getProgramParameter(i,e.LINK_STATUS))return i;w.console.error("Unable to initialize the shader program: "+e.getProgramInfoLog(i));return null}}}(OpenSeadragon);!function(h){h.Viewport=function(e){var t=arguments;if((e=t.length&&t[0]instanceof h.Point?{containerSize:t[0],contentSize:t[1],config:t[2]}:e).config){h.extend(!0,e,e.config);delete e.config}this._margins=h.extend({left:0,top:0,right:0,bottom:0},e.margins||{});delete e.margins;e.initialDegrees=e.degrees;delete e.degrees;h.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:h.DEFAULT_SETTINGS.springStiffness,animationTime:h.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:h.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:h.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:h.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:h.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:h.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:h.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:h.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:h.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:h.DEFAULT_SETTINGS.degrees,flipped:h.DEFAULT_SETTINGS.flipped,homeFillsViewer:h.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:h.DEFAULT_SETTINGS.silenceMultiImageWarnings},e);this._updateContainerInnerSize();this.centerSpringX=new h.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.centerSpringY=new h.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.zoomSpring=new h.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime});this.degreesSpring=new h.Spring({initial:e.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 h.Rect(0,0,1,1),1);this.goHome(!0);this.update()};h.Viewport.prototype={get degrees(){h.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead.");return this.getRotation()},set degrees(e){h.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead.");this.rotateTo(e)},resetContentSize:function(e){h.console.assert(e,"[Viewport.resetContentSize] contentSize is required");h.console.assert(e instanceof h.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point");h.console.assert(0i.width?this.visibilityRatio*i.width:this.visibilityRatio*t.width;o=i.x-o+a;s=s-t.x-a;if(a>i.width){t.x+=(o+s)/2;n=!0}else if(s<0){t.x+=s;n=!0}else if(0i.height?this.visibilityRatio*i.height:this.visibilityRatio*t.height;l=i.y-l+o;s=s-t.y-o;if(o>i.height){t.y+=(l+s)/2;r=!0}else if(s<0){t.y+=s;r=!0}else if(0=r?s.height=s.width/r:s.width=s.height*r;s.x=o.x-s.width/2;s.y=o.y-s.height/2;var a=1/s.width;if(i){this.panTo(o,!0);this.zoomTo(a,null,!0);n&&this.applyConstraints(!0);return this}var l=this.getCenter(!0);t=this.getZoom(!0);this.panTo(l,!0);this.zoomTo(t,null,!0);e=this.getBounds();r=this.getZoom();if(0===r||Math.abs(a/r-1)<1e-8){this.zoomTo(a,null,!0);this.panTo(o,i);n&&this.applyConstraints(!1);return this}if(n){this.panTo(o,!1);a=this._applyZoomConstraints(a);this.zoomTo(a,null,!1);o=this.getConstrainedBounds();this.panTo(l,!0);this.zoomTo(t,null,!0);this.fitBounds(o)}else{r=s.rotate(-this.getRotation()).getTopLeft().times(a).minus(e.getTopLeft().times(r)).divide(a-r);this.zoomTo(a,r,i)}return this},fitBounds:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!1})},fitBoundsWithConstraints:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!0})},fitVertically:function(e){var t=new h.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(t,e)},fitHorizontally:function(e){var t=new h.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(t,e)},getConstrainedBounds:function(e){e=this.getBounds(e);return this._applyBoundaryConstraints(e)},panBy:function(e,t){var i=new h.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(i.plus(e),t)},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)}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(e,t,i){var n=this;this.zoomPoint=t instanceof h.Point&&!isNaN(t.x)&&!isNaN(t.y)?t:null;i?this._adjustCenterSpringsForZoomPoint(function(){n.zoomSpring.resetTo(e)}):this.zoomSpring.springTo(e);this.viewer&&this.viewer.raiseEvent("zoom",{zoom:e,refPoint:t,immediately:i});return this},setRotation:function(e,t){return this.rotateTo(e,null,t)},getRotation:function(e){return(e?this.degreesSpring.current:this.degreesSpring.target).value},setRotationWithPivot:function(e,t,i){return this.rotateTo(e,t,i)},rotateTo:function(e,t,i){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===e&&this.degreesSpring.isAtTargetValue())return this;this.rotationPivot=t instanceof h.Point&&!isNaN(t.x)&&!isNaN(t.y)?t:null;if(i)if(this.rotationPivot){if(!(e-this._oldDegrees)){this.rotationPivot=null;return this}this._rotateAboutPivot(e)}else this.degreesSpring.resetTo(e);else{var n=h.positiveModulo(this.degreesSpring.current.value,360);var r=h.positiveModulo(e,360);t=r-n;180this.getMaxZoom()&&this.applyConstraints(i)}}}}(OpenSeadragon);!function(v){v.TiledImage=function(e){this._initialized=!1;v.console.assert(e.tileCache,"[TiledImage] options.tileCache is required");v.console.assert(e.drawer,"[TiledImage] options.drawer is required");v.console.assert(e.viewer,"[TiledImage] options.viewer is required");v.console.assert(e.imageLoader,"[TiledImage] options.imageLoader is required");v.console.assert(e.source,"[TiledImage] options.source is required");v.console.assert(!e.clip||e.clip instanceof v.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present");v.EventSource.call(this);this._tileCache=e.tileCache;delete e.tileCache;this._drawer=e.drawer;delete e.drawer;this._imageLoader=e.imageLoader;delete e.imageLoader;e.clip instanceof v.Rect&&(this._clip=e.clip.clone());delete e.clip;var t=e.x||0;delete e.x;var i=e.y||0;delete e.y;this.normHeight=e.source.dimensions.y/e.source.dimensions.x;this.contentAspectX=e.source.dimensions.x/e.source.dimensions.y;var n=1;if(e.width){n=e.width;delete e.width;if(e.height){v.console.error("specifying both width and height to a tiledImage is not supported");delete e.height}}else if(e.height){n=e.height/this.normHeight;delete e.height}var r=e.fitBounds;delete e.fitBounds;var o=e.fitBoundsPlacement||OpenSeadragon.Placement.CENTER;delete e.fitBoundsPlacement;var s=e.degrees||0;delete e.degrees;var a=e.ajaxHeaders;delete e.ajaxHeaders;v.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_needsDraw:!0,_needsUpdate:!0,_hasOpaqueTile:!1,_tilesLoading:0,_tilesToDraw:[],_lastDrawn:[],_isBlending:!1,_wasBlending:!1,_isTainted:!1,springStiffness:v.DEFAULT_SETTINGS.springStiffness,animationTime:v.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:v.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:v.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:v.DEFAULT_SETTINGS.wrapVertical,immediateRender:v.DEFAULT_SETTINGS.immediateRender,blendTime:v.DEFAULT_SETTINGS.blendTime,alwaysBlend:v.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:v.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:v.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:v.DEFAULT_SETTINGS.iOSDevice,debugMode:v.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:v.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:v.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:v.DEFAULT_SETTINGS.placeholderFillStyle,opacity:v.DEFAULT_SETTINGS.opacity,preload:v.DEFAULT_SETTINGS.preload,compositeOperation:v.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:v.DEFAULT_SETTINGS.subPixelRoundingForTransparency,maxTilesPerFrame:v.DEFAULT_SETTINGS.maxTilesPerFrame},e);this._preload=this.preload;delete this.preload;this._fullyLoaded=!1;this._xSpring=new v.Spring({initial:t,springStiffness:this.springStiffness,animationTime:this.animationTime});this._ySpring=new v.Spring({initial:i,springStiffness:this.springStiffness,animationTime:this.animationTime});this._scaleSpring=new v.Spring({initial:n,springStiffness:this.springStiffness,animationTime:this.animationTime});this._degreesSpring=new v.Spring({initial:s,springStiffness:this.springStiffness,animationTime:this.animationTime});this._updateForScale();r&&this.fitBounds(r,o,!0);this._ownAjaxHeaders={};this.setAjaxHeaders(a,!1);this._initialized=!0};v.extend(v.TiledImage.prototype,v.EventSource.prototype,{needsDraw:function(){return this._needsDraw},redraw:function(){this._needsDraw=!0},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(e){if(e!==this._fullyLoaded){this._fullyLoaded=e;this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded})}},reset:function(){this._tileCache.clearTilesFor(this);this.lastResetTime=v.now();this._needsDraw=!0},update:function(e){var t=this._xSpring.update();var i=this._ySpring.update();var n=this._scaleSpring.update();var r=this._degreesSpring.update();r=t||i||n||r||this._needsUpdate;if(r||e||!this._fullyLoaded){e=this._updateLevelsForViewport();this._setFullyLoaded(e)}this._needsUpdate=!1;if(r){this._updateForScale();this._raiseBoundsChange();return this._needsDraw=!0}return!1},setDrawn:function(){this._needsDraw=this._isBlending||this._wasBlending;return this._needsDraw},setTainted(e){this._isTainted=e},isTainted(){return this._isTainted},destroy:function(){this.reset();this.source.destroy&&this.source.destroy(this.viewer)},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(this.getRotation(e),this._getRotationPoint(e))},getBoundsNoRotate:function(e){return e?new v.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new v.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){v.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead");return this.getBounds()},getClippedBounds:function(e){var t=this.getBoundsNoRotate(e);if(this._clip){var i=(e?this._worldWidthCurrent:this._worldWidthTarget)/this.source.dimensions.x;i=this._clip.times(i);t=new v.Rect(t.x+i.x,t.y+i.y,i.width,i.height)}return t.rotate(this.getRotation(e),this._getRotationPoint(e))},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;e=this.source.getTileBounds(e,r,o);this.getFlip()&&(e.x=Math.max(0,1-e.x-e.width));e.x+=(t-r)/n.x;e.y+=this._worldHeightCurrent/this._worldWidthCurrent*((i-o)/n.y);return e},getContentSize:function(){return new v.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var e=this.imageToWindowCoordinates(new v.Point(0,0));var t=this.imageToWindowCoordinates(this.getContentSize());return new v.Point(t.x-e.x,t.y-e.y)},_viewportToImageDelta:function(e,t,i){i=(i?this._scaleSpring.current:this._scaleSpring.target).value;return new v.Point(e*(this.source.dimensions.x/i),t*(this.source.dimensions.y*this.contentAspectX/i))},viewportToImageCoordinates:function(e,t,i){var n;if(e instanceof v.Point){i=t;n=e}else n=new v.Point(e,t);n=n.rotate(-this.getRotation(i),this._getRotationPoint(i));return i?this._viewportToImageDelta(n.x-this._xSpring.current.value,n.y-this._ySpring.current.value):this._viewportToImageDelta(n.x-this._xSpring.target.value,n.y-this._ySpring.target.value)},_imageToViewportDelta:function(e,t,i){i=(i?this._scaleSpring.current:this._scaleSpring.target).value;return new v.Point(e/this.source.dimensions.x*i,t/this.source.dimensions.y/this.contentAspectX*i)},imageToViewportCoordinates:function(e,t,i){if(e instanceof v.Point){i=t;t=e.y;e=e.x}t=this._imageToViewportDelta(e,t,i);if(i){t.x+=this._xSpring.current.value;t.y+=this._ySpring.current.value}else{t.x+=this._xSpring.target.value;t.y+=this._ySpring.target.value}return t.rotate(this.getRotation(i),this._getRotationPoint(i))},imageToViewportRectangle:function(e,t,i,n,r){var o=e;o instanceof v.Rect?r=t:o=new v.Rect(e,t,i,n);i=this.imageToViewportCoordinates(o.getTopLeft(),r);n=this._imageToViewportDelta(o.width,o.height,r);return new v.Rect(i.x,i.y,n.x,n.y,o.degrees+this.getRotation(r))},viewportToImageRectangle:function(e,t,i,n,r){var o=e;e instanceof v.Rect?r=t:o=new v.Rect(e,t,i,n);i=this.viewportToImageCoordinates(o.getTopLeft(),r);n=this._viewportToImageDelta(o.width,o.height,r);return new v.Rect(i.x,i.y,n.x,n.y,o.degrees-this.getRotation(r))},viewerElementToImageCoordinates:function(e){e=this.viewport.pointFromPixel(e,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(e){e=this.imageToViewportCoordinates(e);return this.viewport.pixelFromPoint(e,!0)},windowToImageCoordinates:function(e){e=e.minus(OpenSeadragon.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(e)},imageToWindowCoordinates:function(e){return this.imageToViewerElementCoordinates(e).plus(OpenSeadragon.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(e){var t=this._scaleSpring.current.value;e=e.rotate(-this.getRotation(!0),this._getRotationPoint(!0));return new v.Rect((e.x-this._xSpring.current.value)/t,(e.y-this._ySpring.current.value)/t,e.width/t,e.height/t,e.degrees)},viewportToImageZoom:function(e){return this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x*e},imageToViewportZoom:function(e){return e/(this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x)},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=!0;this._needsUpdate=!0}else{if(i)return;this._xSpring.springTo(e.x);this._ySpring.springTo(e.y);this._needsDraw=!0;this._needsUpdate=!0}i||this._raiseBoundsChange()},setWidth:function(e,t){this._setScale(e,t)},setHeight:function(e,t){this._setScale(e/this.normHeight,t)},setCroppingPolygons:function(e){var t=function(e){return e instanceof v.Point||"number"==typeof e.x&&"number"==typeof e.y};try{if(!v.isArray(e))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=e.map(function(e){return e.map(function(e){try{if(t(e))return{x:e.x,y:e.y};throw new Error}catch(e){throw new Error("A Provided cropping polygon point is not supported")}})});this._needsDraw=!0}catch(e){v.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported");v.console.error(e);this.resetCroppingPolygons()}},resetCroppingPolygons:function(){this._croppingPolygons=null;this._needsDraw=!0},fitBounds:function(e,t,i){t=t||v.Placement.CENTER;var n=v.Placement.properties[t];var r=this.contentAspectX;var o=0;var s=0;var a=1;t=1;if(this._clip){r=this._clip.getAspectRatio();a=this._clip.width/this.source.dimensions.x;t=this._clip.height/this.source.dimensions.y;if(e.getAspectRatio()>r){o=this._clip.x/this._clip.height*e.height;s=this._clip.y/this._clip.height*e.height}else{o=this._clip.x/this._clip.width*e.width;s=this._clip.y/this._clip.width*e.width}}if(e.getAspectRatio()>r){var l=e.height/t;t=0;n.isHorizontallyCentered?t=(e.width-e.height*r)/2:n.isRight&&(t=e.width-e.height*r);this.setPosition(new v.Point(e.x-o+t,e.y-s),i);this.setHeight(l,i)}else{l=e.width/a;a=0;n.isVerticallyCentered?a=(e.height-e.width/r)/2:n.isBottom&&(a=e.height-e.width/r);this.setPosition(new v.Point(e.x-o,e.y-s+a),i);this.setWidth(l,i)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(e){v.console.assert(!e||e instanceof v.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null");e instanceof v.Rect?this._clip=e.clone():this._clip=null;this._needsDraw=!0;this.raiseEvent("clip-change")},getFlip:function(){return this.flipped},setFlip:function(e){this.flipped=e},get flipped(){return this._flipped},set flipped(e){var t=this._flipped!==!!e;this._flipped=!!e;if(t){this.update(!0);this._needsDraw=!0;this._raiseBoundsChange()}},get wrapHorizontal(){return this._wrapHorizontal},set wrapHorizontal(e){var t=this._wrapHorizontal!==!!e;this._wrapHorizontal=!!e;if(this._initialized&&t){this.update(!0);this._needsDraw=!0}},get wrapVertical(){return this._wrapVertical},set wrapVertical(e){var t=this._wrapVertical!==!!e;this._wrapVertical=!!e;if(this._initialized&&t){this.update(!0);this._needsDraw=!0}},get debugMode(){return this._debugMode},set debugMode(e){this._debugMode=!!e;this._needsDraw=!0},getOpacity:function(){return this.opacity},setOpacity:function(e){this.opacity=e},get opacity(){return this._opacity},set opacity(e){if(e!==this.opacity){this._opacity=e;this._needsDraw=!0;this.raiseEvent("opacity-change",{opacity:this.opacity})}},getPreload:function(){return this._preload},setPreload:function(e){this._preload=!!e;this._needsDraw=!0},getRotation:function(e){return(e?this._degreesSpring.current:this._degreesSpring.target).value},setRotation:function(e,t){if(this._degreesSpring.target.value!==e||!this._degreesSpring.isAtTargetValue()){t?this._degreesSpring.resetTo(e):this._degreesSpring.springTo(e);this._needsDraw=!0;this._needsUpdate=!0;this._raiseBoundsChange()}},getDrawArea:function(){if(0===this._opacity&&!this._preload)return!1;var e=this._viewportToTiledImageRectangle(this.viewport.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var t=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));e=e.intersection(t)}return e},getTilesToDraw:function(){let e=this._tilesToDraw.flat();this._updateTilesInViewport(e);e=this._tilesToDraw.flat();e.forEach(e=>{e.tile.beingDrawn=!0});this._lastDrawn=e;return e},_getRotationPoint:function(e){return this.getBoundsNoRotate(e).getCenter()},get compositeOperation(){return this._compositeOperation},set compositeOperation(e){if(e!==this._compositeOperation){this._compositeOperation=e;this._needsDraw=!0;this.raiseEvent("composite-operation-change",{compositeOperation:this._compositeOperation})}},getCompositeOperation:function(){return this._compositeOperation},setCompositeOperation:function(e){this.compositeOperation=e},setAjaxHeaders:function(e,t){if(v.isPlainObject(e=null===e?{}:e)){this._ownAjaxHeaders=e;this._updateAjaxHeaders(t)}else console.error("[TiledImage.setAjaxHeaders] Ignoring invalid headers, must be a plain object")},_updateAjaxHeaders:function(e){void 0===e&&(e=!0);v.isPlainObject(this.viewer.ajaxHeaders)?this.ajaxHeaders=v.extend({},this.viewer.ajaxHeaders,this._ownAjaxHeaders):this.ajaxHeaders=this._ownAjaxHeaders;if(e){var t,i;for(var n in this.tilesMatrix){t=this.source.getNumTiles(n);for(var r in this.tilesMatrix[n]){i=(t.x+r%t.x)%t.x;for(var o in this.tilesMatrix[n][r]){s=(t.y+o%t.y)%t.y;(o=this.tilesMatrix[n][r][o]).loadWithAjax=this.loadTilesWithAjax;if(o.loadWithAjax){var s=this.source.getTileAjaxHeaders(n,i,s);o.ajaxHeaders=v.extend({},this.ajaxHeaders,s)}else o.ajaxHeaders=null}}}for(var a=0;a{e.tile.beingDrawn=!1});this._tilesToDraw=[];this._tilesLoading=0;this.loadingCoverage={};if(!o){this._needsDraw=!1;return this._fullyLoaded}var a=new Array(i-n+1);for(let e=0,t=i;t>=n;t--,e++)a[e]=t;for(let e=i+1;e<=this.source.maxLevel;e++){var l=this.tilesMatrix[e]&&this.tilesMatrix[e][0]&&this.tilesMatrix[e][0][0];if(l&&l.isBottomMost&&l.isRightMost&&l.loaded){a.push(e);a.hasHigherResolutionFallback=!0;break}}for(let e=0;e=this.minPixelRatio)r=c=!0;else if(!r)continue;var d=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(h),!1).x*this._scaleSpring.current.value;var p=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value;p=this.immediateRender?1:p;u=Math.min(1,(u-.5)/.5);d=p/Math.abs(p-d);d=this._updateLevel(r,c,h,u,d,o,s,t);t=d.bestTiles;d=d.updatedTiles.filter(e=>e.loaded);u=function(t,i,n){return function(e){return{tile:e,level:t,levelOpacity:i,currentTime:n}}}(h,u,s);this._tilesToDraw[h]=d.map(u);if(this._providesCoverage(this.coverage,h))break}if(t&&0i&&e.pop();return e},_sortTiles:function(e){e.sort(function(e,t){return null===e?1:null===t?-1:e.visibility===t.visibility?e.squaredDistance-t.squaredDistance:e.visibility-t.visibility})},_providesCoverage:function(e,t,i,n){var r,o,s,a;if(!e[t])return!1;if(void 0!==i&&void 0!==n)return void 0===e[t][i]||void 0===e[t][i][n]||!0===e[t][i][n];for(s in r=e[t])if(Object.prototype.hasOwnProperty.call(r,s))for(a in o=r[s])if(Object.prototype.hasOwnProperty.call(o,a)&&!o[a])return!1;return!0},_isCovered:function(e,t,i,n){return void 0===i||void 0===n?this._providesCoverage(e,t+1):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(e,t,i,n,r){if(e[t]){e[t][i]||(e[t][i]={});e[t][i][n]=r}else v.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",t)},_resetCoverage:function(e,t){e[t]={}}})}(OpenSeadragon);!function(g){function m(e){g.console.assert(e,"[TileCache.cacheTile] options is required");g.console.assert(e.tile,"[TileCache.cacheTile] options.tile is required");g.console.assert(e.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");this.tile=e.tile;this.tiledImage=e.tiledImage}function v(e){g.console.assert(e,"[ImageRecord] options is required");g.console.assert(e.data,"[ImageRecord] options.data is required");this._tiles=[];e.create.apply(null,[this,e.data,e.ownerTile]);this._destroyImplementation=e.destroy.bind(null,this);this.getImage=e.getImage.bind(null,this);this.getData=e.getData.bind(null,this);this.getRenderedContext=e.getRenderedContext.bind(null,this)}v.prototype={destroy:function(){this._destroyImplementation();this._tiles=null},addTile:function(e){g.console.assert(e,"[ImageRecord.addTile] tile is required");this._tiles.push(e)},removeTile:function(e){for(var t=0;tthis._maxImageCacheCount){var r=null;var o=-1;var s=null;var a,l,h,c,u,d;for(var p=this._tilesLoaded.length-1;0<=p;p--)if(!((a=(d=this._tilesLoaded[p]).tile).level<=t||a.beingDrawn))if(r){c=a.lastTouchTime;l=r.lastTouchTime;u=a.level;h=r.level;if(c=this._items.length)throw new Error("Index bigger than number of layers.");if(t!==i&&-1!==i){this._items.splice(i,1);this._items.splice(t,0,e);this._needsDraw=!0;this.raiseEvent("item-index-change",{item:e,previousIndex:i,newIndex:t})}},removeItem:function(e){g.console.assert(e,"[World.removeItem] item is required");var t=g.indexOf(this._items,e);if(-1!==t){e.removeHandler("bounds-change",this._delegatedFigureSizes);e.removeHandler("clip-change",this._delegatedFigureSizes);e.destroy();this._items.splice(t,1);this._figureSizes();this._needsDraw=!0;this._raiseRemoveItem(e)}},removeAll:function(){this.viewer._cancelPendingImages();var e;var t;for(t=0;t{this._needsDraw=e.setDrawn()||this._needsDraw})},needsDraw:function(){for(var e=0;ed.height?o:o*(d.width/d.height))*(d.height/d.width);d=new g.Point(l+(o-u)/2,h+(o-d)/2);c.setPosition(d,t);c.setWidth(u,t);"horizontal"===i?l+=s:h+=s}this.setAutoRefigureSizes(!0)},_figureSizes:function(){var e=this._homeBounds?this._homeBounds.clone():null;var t=this._contentSize?this._contentSize.clone():null;var i=this._contentFactor||0;if(this._items.length){var n=this._items[0];var r=n.getBounds();this._contentFactor=n.getContentSize().x/r.width;var o=n.getClippedBounds().getBoundingBox();var s=o.x;var a=o.y;var l=o.x+o.width;var h=o.y+o.height;for(var c=1;c` also be gone so display is empty after existing full-screen. + +Fork is up-to-date with upstream OSD 4.1.1 + + + + diff --git a/package-lock.json b/package-lock.json index 9500d2d8..a39ef66a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@teipublisher/pb-components", - "version": "2.19.0", + "version": "2.23.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@teipublisher/pb-components", - "version": "2.19.0", + "version": "2.23.2", "license": "GPL-3.0-or-later", "dependencies": { "@babel/runtime": "7.11.2", diff --git a/package.json b/package.json index 27662ace..1b3446cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@teipublisher/pb-components", - "version": "2.19.0", + "version": "2.23.2", "description": "Collection of webcomponents underlying TEI Publisher", "repository": "https://github.com/eeditiones/tei-publisher-components.git", "main": "index.html", diff --git a/src/authority/anton.js b/src/authority/anton.js index 63021777..b0278999 100644 --- a/src/authority/anton.js +++ b/src/authority/anton.js @@ -98,7 +98,9 @@ export class Anton extends Registry { switch (this._register) { case 'place': output.country = json.data.country; - output.location = json.data.location.coordinates; + if (json.data.location && json.data.location.coordinates) { + output.location = json.data.location.coordinates; + } output.links = json.data.links.map((link) => link.url); break; case 'person': diff --git a/src/pb-facs-link.js b/src/pb-facs-link.js index 10f7d36f..d4f6a561 100644 --- a/src/pb-facs-link.js +++ b/src/pb-facs-link.js @@ -79,7 +79,7 @@ export class PbFacsLink extends pbMixin(LitElement) { const link = this.shadowRoot.querySelector('a'); link.addEventListener(this.trigger, this._linkListener.bind(this)); if (this.emitOnLoad) { - this._trigger(); + this.wait(() => { this._trigger(); }); } } diff --git a/src/pb-facsimile.js b/src/pb-facsimile.js index 600f343e..f33e78ca 100644 --- a/src/pb-facsimile.js +++ b/src/pb-facsimile.js @@ -7,7 +7,7 @@ import { resolveURL } from './utils.js'; * View zoomable images using a IIIF server. * * @fires pb-start-update - When received, resets the facsimile viewer - * @fires pb-load-facsimile - When received, adds an image to the current image sequence. Emitted by + * @fires pb-load-facsimile - When received, adds an image to the current image sequence. Emitted by * `pb-facs-link`. The event detail should contain an object with the properties `url`, `order` and `element`, * where `url` is the relative or absolute URL to the image, `order` is an integer specifying the position at which * the image should be inserted in the list, and `element` points to the `pb-facs-link` element triggering the event. @@ -41,7 +41,7 @@ export class PbFacsimile extends pbMixin(LitElement) { type: Boolean, attribute: 'show-navigator' }, - + /** If true then the 'previous" and 'next' button is displayed switch between images. */ showSequenceMode: { type: Boolean, @@ -58,6 +58,13 @@ export class PbFacsimile extends pbMixin(LitElement) { type: Boolean, attribute: 'show-full-page-control' }, + /** + * if true shows a 'download' button + */ + showDownloadButton:{ + type: Boolean, + attribute: 'show-download-control' + }, /** * Default zoom between: set to 0 to adjust to viewer size. */ @@ -138,6 +145,14 @@ export class PbFacsimile extends pbMixin(LitElement) { loaded: { type: Boolean, reflect: true + }, + /** + * CORS (Cross-Origin Resource Sharing) policy - wraps the OSD Viewer option - + * only sensible values are 'anonymous' (default) or 'use-credentials'. + */ + crossOriginPolicy:{ + type: String, + attribute: 'cors' } }; } @@ -146,6 +161,7 @@ export class PbFacsimile extends pbMixin(LitElement) { super(); this._facsimiles = []; this.baseUri = ''; + this.crossOriginPolicy = 'anonymous'; this.type = 'iiif'; this.visibilityRatio = 1; this.defaultZoomLevel = 0; @@ -155,6 +171,7 @@ export class PbFacsimile extends pbMixin(LitElement) { this.showNavigationControl = false; this.showFullPageControl = false; this.showRotationControl = false; + this.showDownloadButton = false; this.constrainDuringPan = false; this.referenceStrip = false; this.referenceStripSizeRatio = 0.2; @@ -173,38 +190,47 @@ export class PbFacsimile extends pbMixin(LitElement) { this.subscribeTo('pb-start-update', this._clearAll.bind(this)); this.subscribeTo('pb-load-facsimile', (e) => { const { element, order } = e.detail - const itemOrder = this._facsimiles.map(item => item.getOrder ? item.getOrder() : Number.POSITIVE_INFINITY ) + const itemOrder = this._facsimiles.map(item => item.getOrder ? item.getOrder() : Number.POSITIVE_INFINITY ) const insertAt = itemOrder.reduce((result, next, index) => { if (order < next) return result; if (order === next) return index; return index + 1; }, 0) - + this._facsimiles.splice(insertAt, 0, element) this.loaded = this._facsimiles.length > 0; - + this._facsimileObserver() }); this.subscribeTo('pb-show-annotation', this._showAnnotationListener.bind(this)); } firstUpdated() { - window.ESGlobalBridge.requestAvailability(); - const path = resolveURL('../lib/openseadragon.min.js'); - window.ESGlobalBridge.instance.load("openseadragon", path); - window.addEventListener( - "es-bridge-openseadragon-loaded", - this._initOpenSeadragon.bind(this), - { once: true } - ); + try{ + window.ESGlobalBridge.requestAvailability(); + const path = resolveURL('../lib/openseadragon.min.js'); + window.ESGlobalBridge.instance.load("openseadragon", path); + window.addEventListener( + "es-bridge-openseadragon-loaded", + this._initOpenSeadragon.bind(this), + { once: true } + ); + } catch (error){ + console.error(error.message); + } } render() { return html` +
+ ${this.showDownloadButton ? + html``:'' + } + `; } @@ -227,6 +253,26 @@ export class PbFacsimile extends pbMixin(LitElement) { max-height: var(--pb-facsimile-height, auto); width: 100%; } + #downloadBtn{ + position: absolute; + z-index: 100; + bottom:0.25rem; + width:1.35rem; + height:1.35rem; + transform:rotate(-90deg); + cursor: pointer; + border: thin solid #D7DDE8; + display: flex; + align-items: center; + justify-content: center; + border-radius:0.75rem; + background-image:linear-gradient(to left, #fafafa 0%, #D7DDE8 51%, #bbbbbb 100%); + font-size:1.2rem; + box-shadow: -2px 1px 5px 0px rgba(0,0,0,0.75); + } + #downloadBtn:hover{ + background-image:radial-gradient( white, #efefef); + } `; } @@ -236,7 +282,7 @@ export class PbFacsimile extends pbMixin(LitElement) { const options = { element: this.shadowRoot.getElementById('viewer'), prefixUrl, - preserveViewport: true, + preserveViewport: true, showZoomControl: true, sequenceMode: this.showSequenceMode, showHomeControl: this.showHomeControl, @@ -248,8 +294,10 @@ export class PbFacsimile extends pbMixin(LitElement) { visibilityRatio: 1, minZoomLevel: 1, defaultZoomLevel: this.defaultZoomLevel, - constrainDuringPan: true + constrainDuringPan: true, + crossOriginPolicy: this.crossOriginPolicy }; + if (this.referenceStrip) { options.showReferenceStrip = true; options.referenceStripSizeRatio = this.referenceStripSizeRatio; @@ -266,15 +314,25 @@ export class PbFacsimile extends pbMixin(LitElement) { this.emitTo('pb-facsimile-status', { status: 'fail' }); }); + const download = this.shadowRoot.querySelector('#downloadBtn'); + if(this.showDownloadButton){ + download.addEventListener('click', (ev) => { + ev.preventDefault(); + const currentImage = this.viewer.drawer.canvas.toDataURL("image/png"); + const downloadLink = document.createElement('a'); + downloadLink.href = currentImage; + downloadLink.download = 'download'; + downloadLink.click(); + }); + } + /* handling of full-screen view requires to hide/unhide the content of body to allow full screen viewer to full-page functionality. Standard OSD completely deletes all body children disconnecting all event-handlers that have been there. This solution just uses style.display to hide/show. Former display value of pb-page will be preserved. - - Current limitation: this solution assumes that a pb-page element exists and is an immediate child of body. */ - this.ownerPage = this.closest('pb-page'); + this.ownerPage = document.querySelector('pb-page'); if(this.ownerPage){ this.pbPageDisplay = window.getComputedStyle(this.ownerPage).getPropertyValue('display'); this.viewer.addHandler('full-screen', (ev) => { diff --git a/src/pb-grid.js b/src/pb-grid.js index c7ec3b0e..8ff35735 100644 --- a/src/pb-grid.js +++ b/src/pb-grid.js @@ -10,6 +10,7 @@ import './pb-panel.js'; * @slot - default unnamed slot for the panel * @fires pb-refresh - Fired after a new column has been added to allow connected components to refresh. * @fires pb-panel - When received, updates the list of panels to show + * @fires pb-zoom - When received, zoom in or out by changing font size of the content * @cssprop --pb-grid-column-widths - Columns width specified according to the grid-template-columns property of the CSS Grid Layout * @cssprop --pb-grid-column-gap - Width of the gap between columns */ @@ -75,6 +76,10 @@ export class PbGrid extends pbMixin(LitElement) { registry.commit(this, this._getState()) }); + this.subscribeTo('pb-zoom', ev => { + this.zoom(ev.detail.direction); + }); + const panelsParam = registry.get('panels'); if (panelsParam) { this.panels = panelsParam.split('.').map(param => parseInt(param)); @@ -92,10 +97,27 @@ export class PbGrid extends pbMixin(LitElement) { } firstUpdated() { + this.panels.forEach(panelNum => this._insertPanel(panelNum)); registry.commit(this, this._getState()) this._animate(); this._update(); + + this.addEventListener('pb-drop', (ev) => { + const draggedPanelIdx = parseInt(ev.detail.panel); + const targetPanelIdx = this._getPanelIndex(ev.detail.target); + + console.log(' Insert panel %d at %d in %s', draggedPanelIdx, targetPanelIdx, this.panels); + this.querySelectorAll('._grid_panel').forEach((panel) => { + panel.classList.remove('dragover'); + }); + + this.panels.splice(targetPanelIdx, 0, this.panels.splice(draggedPanelIdx, 1)[0]); + this.innerHTML=''; // hard reset of child DOM + this.panels.forEach(panelNum => this._insertPanel(panelNum)); + registry.commit(this, this._getState()); + this._update(); + }); } /** @@ -150,17 +172,31 @@ export class PbGrid extends pbMixin(LitElement) { this._insertPanel(value); registry.commit(this, this._getState()) this._update(); - this.emitTo('pb-refresh', null); + this.emitTo('pb-refresh'); } + /** + * Remove a panel from the grid + * + * @param {HTMLElement|number} panel the pb-panel element or the panel number + */ removePanel(panel) { - const idx = this._getPanelIndex(panel); + let idx; + let container; + if (typeof panel === 'number') { + idx = this.panels.indexOf(panel); + container = this.querySelector(`[active="${panel}"]`); + } else { + container = panel; + idx = this._getPanelIndex(panel); + } console.log(' Removing panel %d', idx); this.panels.splice(this.direction === 'rtl' ? this.panels.length - idx - 1 : idx, 1); - panel.parentNode.removeChild(panel); + container.parentNode.removeChild(container); this._columns -= 1; - registry.commit(this, this._getState() ) + registry.commit(this, this._getState()); + this._assignPanelIds(); this._update(); } @@ -173,6 +209,7 @@ export class PbGrid extends pbMixin(LitElement) { this.insertBefore(clone, this.firstElementChild); } clone.classList.add('_grid_panel'); + this._assignPanelIds(); } _update() { @@ -194,6 +231,12 @@ export class PbGrid extends pbMixin(LitElement) { return panels.indexOf(panel); } + _assignPanelIds() { + this.querySelectorAll('._grid_panel').forEach((panel, idx) => { + panel.position = idx; + }); + } + _getState() { return { panels: this.panels.join('.') }; } @@ -213,6 +256,17 @@ export class PbGrid extends pbMixin(LitElement) { `; } + zoom(direction) { + const fontSize = window.getComputedStyle(this).getPropertyValue('font-size'); + const size = parseInt(fontSize.replace(/^(\d+)px/, "$1")); + + if (direction === 'in') { + this.style.fontSize = (size + 1) + 'px'; + } else { + this.style.fontSize = (size - 1) + 'px'; + } + } + } if (!customElements.get('pb-grid')) { customElements.define('pb-grid', PbGrid); diff --git a/src/pb-highlight.js b/src/pb-highlight.js index b039bb5a..4d8426cf 100644 --- a/src/pb-highlight.js +++ b/src/pb-highlight.js @@ -134,8 +134,8 @@ export class PbHighlight extends pbMixin(LitElement) { _highlightOn(ev) { if (ev.detail.source != this && ev.detail.id === this.key) { this._className = 'highlight-on'; - if (ev.detail.scroll) { - this.scrollIntoView({ behaviour: 'smooth' }); + if (ev.detail.scroll && this.disabled == false) { + this.scrollIntoView({ block: "center", behaviour: 'smooth' }); } if (this.duration > 0) { setTimeout(function () { diff --git a/src/pb-leaflet-map.js b/src/pb-leaflet-map.js index 701831b4..5de35559 100644 --- a/src/pb-leaflet-map.js +++ b/src/pb-leaflet-map.js @@ -162,7 +162,7 @@ export class PbLeafletMap extends pbMixin(LitElement) { marker.bindTooltip(loc.label); } marker.addEventListener('click', () => { - this.emitTo('pb-leaflet-marker-click', loc); + this.emitTo('pb-leaflet-marker-click', { element: loc }); }); marker.bindTooltip(loc.label); this.setMarkerIcon(marker); @@ -192,7 +192,7 @@ export class PbLeafletMap extends pbMixin(LitElement) { marker.bindPopup(loc.popup); } marker.addEventListener('click', () => { - this.emitTo('pb-leaflet-marker-click', loc); + this.emitTo('pb-leaflet-marker-click', { element: loc }); }); this.setMarkerIcon(marker); }); @@ -215,7 +215,7 @@ export class PbLeafletMap extends pbMixin(LitElement) { if (!this._hasMarker(this.latitude, this.longitude)) { const marker = L.marker([this.latitude, this.longitude]); marker.addEventListener('click', () => { - this.emitTo('pb-leaflet-marker-click', ev.detail.element); + this.emitTo('pb-leaflet-marker-click', ev.detail); }); if (ev.detail.label) { marker.bindTooltip(ev.detail.label); @@ -530,7 +530,7 @@ export class PbLeafletMap extends pbMixin(LitElement) { layer.setIcon(this._icons.active); } } else if (this._icons && this._icons.default && layer.getIcon() !== this._icons.default) { - layer.setIcon(this._icons.default); + layer.setIcon(this._icons.default); } }); } diff --git a/src/pb-mixin.js b/src/pb-mixin.js index 92635552..46d0b016 100644 --- a/src/pb-mixin.js +++ b/src/pb-mixin.js @@ -213,39 +213,49 @@ export const pbMixin = (superclass) => class PbMixin extends superclass { * @param {Function} callback function to be called when all components are ready */ wait(callback) { - if (!this.waitFor) { - callback(); - return; - } - const targetNodes = Array.from(document.querySelectorAll(this.waitFor)); - const targets = targetNodes.filter(target => this.emitsOnSameChannel(target)); - const targetCount = targets.length; - if (targetCount === 0) { - // selector did not return any targets - callback(); - return; - } - let count = targetCount; - targets.forEach((target) => { - if (target._isReady) { - count -= 1; - if (count === 0) { - callback(); - } + const _checkAndWait = () => { + const targetNodes = Array.from(document.querySelectorAll(this.waitFor)); + const targets = targetNodes.filter(target => this.emitsOnSameChannel(target)); + const targetCount = targets.length; + if (targetCount === 0) { + // selector did not return any targets + callback(); return; } - const handler = target.addEventListener('pb-ready', (ev) => { - if (ev.detail.source === this) { - // same source: ignore + let count = targetCount; + targets.forEach((target) => { + if (target._isReady) { + count -= 1; + if (count === 0) { + callback(); + } return; } - count -= 1; - if (count === 0) { - target.removeEventListener('pb-ready', handler); - callback(); - } + const handler = target.addEventListener('pb-ready', (ev) => { + if (ev.detail.source === this) { + // same source: ignore + return; + } + count -= 1; + if (count === 0) { + target.removeEventListener('pb-ready', handler); + callback(); + } + }); }); - }); + } + + if (!this.waitFor) { + callback(); + return; + } + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', () => { + _checkAndWait(); + }); + } else { + _checkAndWait(); + } } /** diff --git a/src/pb-panel.js b/src/pb-panel.js index 52fd67ad..3f8af7bf 100644 --- a/src/pb-panel.js +++ b/src/pb-panel.js @@ -43,6 +43,13 @@ export class PbPanel extends pbMixin(LitElement) { panels: { type: Array, reflect: true + }, + /** + * if set, the panel can be dragged to another position in the grid. A button will + * be added to the toolbar to allow dragging. + */ + draggable: { + type: Boolean } }; } @@ -52,6 +59,8 @@ export class PbPanel extends pbMixin(LitElement) { this.active = 0; this.label = 'View'; this.panels = null; + this.position = -1; + this.draggable = false; } connectedCallback() { @@ -65,15 +74,59 @@ export class PbPanel extends pbMixin(LitElement) { this._show(); } + firstUpdated() { + const dragHandle = this.shadowRoot.getElementById('drag-handle'); + let initiator = null; + + if (this.draggable) { + dragHandle.addEventListener('dragstart', (ev) => { + ev.dataTransfer.setDragImage(this, 10, 10); + ev.dataTransfer.setData("text", this.position); + initiator = this; + }); + } + + this.addEventListener('dragover', (ev) => { + ev.preventDefault(); + }); + document.addEventListener('dragenter', (ev) => { + ev.stopPropagation(); + ev.preventDefault(); + if (initiator === this) { + return; + } + if (this.contains(ev.target)) { + this.classList.add('dragover'); + } else { + this.classList.remove('dragover'); + } + }); + this.addEventListener('drop', (ev) => { + ev.stopPropagation(); + ev.preventDefault(); + + initiator = null; + this.dispatchEvent(new CustomEvent('pb-drop', { + detail: { + panel: ev.dataTransfer.getData("text"), + target: this + }, + bubbles: true, + composed: true + })); + }); + } + render() { return html` - + + selected="${this.active}" @selected-item-changed="${this._update}"> ${this.panels.map((item) => html`${item}`)} - + + ${this.draggable ? html`` : ''} @@ -99,6 +152,20 @@ export class PbPanel extends pbMixin(LitElement) { app-toolbar { font-size: 75%; } + + :host(.dragover) { + background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color)); + animation: highlight 1s; + } + + @keyframes highlight { + from { + background-color: transparent; + } + to { + background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color)); + } + } `; } diff --git a/src/pb-table-grid.js b/src/pb-table-grid.js index 5e2a9709..b337626d 100644 --- a/src/pb-table-grid.js +++ b/src/pb-table-grid.js @@ -98,13 +98,24 @@ export class PbTableGrid extends pbMixin(LitElement) { this.subscribeTo('pb-search-resubmit', (ev) => { this._params = Object.assign({}, ev.detail.params); + for (const [k,v] of Object.entries(this._params)) { + if (v === null) { delete this._params[k] } + } this._submit(); }); registry.subscribe(this, (state) => { this._params = state; this._submit(); - }) + }); + + this.subscribeTo('pb-i18n-update', ev => { + const needsRefresh = this.language && this.language !== ev.detail.language; + this.language = ev.detail.language; + if (needsRefresh) { + this._submit(); + } + }, []); if (!this.height) { const property = getComputedStyle(this).getPropertyValue('--pb-table-grid-height'); @@ -130,7 +141,10 @@ export class PbTableGrid extends pbMixin(LitElement) { const pbColumns = this.querySelectorAll('pb-table-column'); const columns = []; pbColumns.forEach((column) => columns.push(column.data())); - waitOnce('pb-page-ready', () => { + waitOnce('pb-page-ready', (data) => { + if (data && data.language) { + this.language = data.language; + } this._params = registry.state; const url = this.toAbsoluteURL(this.source); const config = { @@ -165,7 +179,9 @@ export class PbTableGrid extends pbMixin(LitElement) { } this._params.limit = limit; this._params.start = page * limit + 1; - + if (this.language) { + this._params.language = this.language; + } registry.commit(this, this._params); return `${prev}${prev.indexOf('?') > -1 ? '&' : '?'}${new URLSearchParams(this._params).toString()}`; diff --git a/src/pb-tify.js b/src/pb-tify.js index 04ca349a..64aad012 100644 --- a/src/pb-tify.js +++ b/src/pb-tify.js @@ -59,6 +59,11 @@ export class PbTify extends pbMixin(LitElement) { _injectStylesheet(this.cssPath); + this._container = document.createElement('div'); + this._container.style.height = '100%'; + this._container.style.width = '100%'; + this.appendChild(this._container); + this.subscribeTo('pb-show-annotation', (ev) => { if (ev.detail) { this._initialPages = ev.detail.order ? Number(ev.detail.order) : Number.POSITIVE_INFINITY; @@ -75,17 +80,14 @@ export class PbTify extends pbMixin(LitElement) { } } }); + + this.signalReady(); } firstUpdated() { super.firstUpdated(); waitOnce('pb-page-ready', () => { - this._container = document.createElement('div'); - this._container.style.height = '100%'; - this._container.style.width = '100%'; - this.appendChild(this._container); - this._initViewer(); }); } @@ -103,7 +105,6 @@ export class PbTify extends pbMixin(LitElement) { manifestUrl: this.toAbsoluteURL(this.manifest, this.getEndpoint()) }); this._tify.ready.then(() => { - this.signalReady(); // open initial page if set earlier via pb-load-facsimile event if (this._initialPages) { this._tify.setPage(this._initialPages); diff --git a/test/pb-view.test.js b/test/pb-view.test.js index 6feac25c..6fdec635 100644 --- a/test/pb-view.test.js +++ b/test/pb-view.test.js @@ -51,7 +51,7 @@ describe('initialize and refresh view', () => { }))); await oneEvent(document, 'pb-end-update'); - const geolocation = view.shadowRoot.querySelector('pb-geolocation[key=CanFloque]'); + const geolocation = view.shadowRoot.querySelector('pb-geolocation[key=CanFloque] *'); expect(geolocation.innerHTML).to.equal('Can Floque'); });