Type.registerNamespace("Sys.Extended.UI.Seadragon");Type.registerNamespace("Seadragon");Seadragon.Utils=function(){function o(n,t){return t&&n!=document.body?document.body:n.offsetParent}var t={UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5};Seadragon.Browser=t;var n=this,u=["Msxml2.XMLHTTP","Msxml3.XMLHTTP","Microsoft.XMLHTTP"],s={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},i=t.UNKNOWN,r=0,f=!1,e={};(function(){var h=navigator.appName,w=navigator.appVersion,n=navigator.userAgent,c,y,p,a,u,o,s;if(h!="Microsoft Internet Explorer"||!window.attachEvent||!window.ActiveXObject)if(h!="Netscape"||!window.addEventListener)h!="Opera"||!window.opera||!window.attachEvent||(i=t.OPERA,r=parseFloat(w));else{var v=n.indexOf("Firefox"),l=n.indexOf("Safari"),b=n.indexOf("Chrome");v>=0?(i=t.FIREFOX,r=parseFloat(n.substring(v+8))):l>=0&&(y=n.substring(0,l).lastIndexOf("/"),i=b>=0?t.CHROME:t.SAFARI,r=parseFloat(n.substring(y+1,l)))}else c=n.indexOf("MSIE"),i=t.IE,r=parseFloat(n.substring(c+5,n.indexOf(";",c)));for(p=window.location.search.substring(1),a=p.split("&"),u=0;u0&&(e[o.substring(0,s)]=decodeURIComponent(o.substring(s+1)));f=i==t.IE||i==t.CHROME&&r<2})();this.getBrowser=function(){return i};this.getBrowserVersion=function(){return r};this.getElement=function(n){return typeof n=="string"&&(n=document.getElementById(n)),n};this.getElementPosition=function(t){for(var t=n.getElement(t),i=new Seadragon.Point,r=n.getElementStyle(t).position=="fixed",u=o(t,r);u;)i.x+=t.offsetLeft,i.y+=t.offsetTop,r&&(i=i.plus(n.getPageScroll())),t=u,r=n.getElementStyle(t).position=="fixed",u=o(t,r);return i};this.getElementSize=function(t){var t=n.getElement(t);return new Seadragon.Point(t.clientWidth,t.clientHeight)};this.getElementStyle=function(t){var t=n.getElement(t);if(t.currentStyle)return t.currentStyle;if(window.getComputedStyle)return window.getComputedStyle(t,"");Seadragon.Debug.fail("Unknown element style, no known technique.")};this.getEvent=function(n){return n?n:window.event};this.getMousePosition=function(t){var t=n.getEvent(t),i=new Seadragon.Point;return typeof t.pageX=="number"?(i.x=t.pageX,i.y=t.pageY):typeof t.clientX=="number"?(i.x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i.y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop):Seadragon.Debug.fail("Unknown event mouse position, no known technique."),i};this.getPageScroll=function(){var n=new Seadragon.Point,t=document.documentElement||{},i=document.body||{};return typeof pageXOffset=="number"?(n.x=window.pageXOffset,n.y=window.pageYOffset):i.scrollLeft||i.scrollTop?(n.x=i.scrollLeft,n.y=i.scrollTop):(t.scrollLeft||t.scrollTop)&&(n.x=t.scrollLeft,n.y=t.scrollTop),n};this.getWindowSize=function(){var n=new Seadragon.Point,t=document.documentElement||{},i=document.body||{};return typeof innerWidth=="number"?(n.x=window.innerWidth,n.y=window.innerHeight):t.clientWidth||t.clientHeight?(n.x=t.clientWidth,n.y=t.clientHeight):i.clientWidth||i.clientHeight?(n.x=i.clientWidth,n.y=i.clientHeight):Seadragon.Debug.fail("Unknown window size, no known technique."),n};this.imageFormatSupported=function(n){var n=n?n:"";return!!s[n.toLowerCase()]};this.makeCenteredNode=function(t){var t=Seadragon.Utils.getElement(t),r=n.makeNeutralElement("div"),i=[],u,f;for(i.push('
'),i.push('
'),i.push('
<\/div><\/div><\/div>'),r.innerHTML=i.join(""),r=r.firstChild,u=r,f=r.getElementsByTagName("div");f.length>0;)u=f[0],f=u.getElementsByTagName("div");return u.appendChild(t),r};this.makeNeutralElement=function(n){var i=document.createElement(n),t=i.style;return t.background="transparent none",t.border="none",t.margin="0px",t.padding="0px",t.position="static",i};this.makeTransparentImage=function(u){var e=n.makeNeutralElement("img"),f=null;return i==t.IE&&r<7?(f=n.makeNeutralElement("span"),f.style.display="inline-block",e.onload=function(){f.style.width=f.style.width||e.width+"px";f.style.height=f.style.height||e.height+"px";e.onload=null;e=null},e.src=u,f.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+u+"', sizingMethod='scale')"):(f=e,f.src=u),f};this.setElementOpacity=function(t,i,r){var t=n.getElement(t),o,u,e;if(r&&f&&(i=Math.round(i)),t.style.opacity=i<1?i:"",i==1){o=t.style.filter||"";t.style.filter=o.replace(/alpha\(.*?\)/g,"");return}u=Math.round(100*i);e=" alpha(opacity="+u+") ";try{t.filters&&t.filters.alpha?t.filters.alpha.opacity=u:t.style.filter+=e}catch(s){t.style.filter+=e}};this.addEvent=function(t,i,r,u){var t=n.getElement(t);t.addEventListener?t.addEventListener(i,r,u):t.attachEvent?(t.attachEvent("on"+i,r),u&&t.setCapture&&t.setCapture()):Seadragon.Debug.fail("Unable to attach event handler, no known technique.")};this.removeEvent=function(t,i,r,u){var t=n.getElement(t);t.removeEventListener?t.removeEventListener(i,r,u):t.detachEvent?(t.detachEvent("on"+i,r),u&&t.releaseCapture&&t.releaseCapture()):Seadragon.Debug.fail("Unable to detach event handler, no known technique.")};this.cancelEvent=function(t){var t=n.getEvent(t);t.preventDefault&&t.preventDefault();t.cancel=!0;t.returnValue=!1};this.stopEvent=function(t){var t=n.getEvent(t);t.stopPropagation&&t.stopPropagation();t.cancelBubble=!0};this.createCallback=function(n,t){for(var r=[],i=2;i0&&this._scheduleFade()}},_beginFading:function(){this._shouldFade=!0;this._fadeBeginTime=(new Date).getTime()+this._fadeDelay;window.setTimeout(Function.createDelegate(this,this._scheduleFade),this._fadeDelay)},_stopFading:function(){this._shouldFade=!1;Seadragon.Utils.setElementOpacity(this._imgGroup,1,!0)},_inTo:function(n){n>=Sys.Extended.UI.Seadragon.ButtonState.GROUP&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.REST&&(this._stopFading(),this._currentState=Sys.Extended.UI.Seadragon.ButtonState.GROUP);n>=Sys.Extended.UI.Seadragon.ButtonState.HOVER&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.GROUP&&(this._imgHover.style.visibility="",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.HOVER);n>=Sys.Extended.UI.Seadragon.ButtonState.DOWN&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.HOVER&&(this._imgDown.style.visibility="",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.DOWN)},_outTo:function(n){n<=Sys.Extended.UI.Seadragon.ButtonState.HOVER&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.DOWN&&(this._imgDown.style.visibility="hidden",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.HOVER);n<=Sys.Extended.UI.Seadragon.ButtonState.GROUP&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.HOVER&&(this._imgHover.style.visibility="hidden",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.GROUP);this._newState<=Sys.Extended.UI.Seadragon.ButtonState.REST&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.GROUP&&(this._beginFading(),this._currentState=Sys.Extended.UI.Seadragon.ButtonState.REST)},_enterHandler:function(n,t,i,r){i?(this._inTo(Sys.Extended.UI.Seadragon.ButtonState.DOWN),this._raiseEvent("onEnter",this)):r||this._inTo(Sys.Extended.UI.Seadragon.ButtonState.HOVER)},_exitHandler:function(n,t,i){this._outTo(Sys.Extended.UI.Seadragon.ButtonState.GROUP);i&&this._raiseEvent("onExit",this)},_pressHandler:function(){this._inTo(Sys.Extended.UI.Seadragon.ButtonState.DOWN);this._raiseEvent("onPress",this)},_releaseHandler:function(n,t,i,r){i&&r?(this._outTo(Sys.Extended.UI.Seadragon.ButtonState.HOVER),this._raiseEvent("onRelease",this)):i?this._outTo(Sys.Extended.UI.Seadragon.ButtonState.GROUP):this._inTo(Sys.Extended.UI.Seadragon.ButtonState.HOVER)},_clickHandler:function(n,t,i){i&&this._raiseEvent("onClick",this)},_raiseEvent:function(n,t){var i=this.get_events().getHandler(n);i&&(t||(t=Sys.EventArgs.Empty),i(this,t))},get_element:function(){return this._button},get_tooltip:function(){return this._tooltip},set_tooltip:function(n){this._tooltip=n},get_config:function(){return this.config},set_config:function(n){this.config=n},get_srcRest:function(){return this._srcRest},set_srcRest:function(n){this._srcRest=n},get_srcGroup:function(){return this._srcGroup},set_srcGroup:function(n){this._srcGroup=n},get_srcHover:function(){return this._srcHover},set_srcHover:function(n){this._srcHover=n},get_srcDown:function(){return this._srcDown},set_srcDown:function(n){this._srcDown=n},add_onPress:function(n){this.get_events().addHandler("onPress",n)},remove_onPress:function(n){this.get_events().removeHandler("onPress",n)},add_onClick:function(n){this.get_events().addHandler("onClick",n)},remove_onClick:function(n){this.get_events().removeHandler("onClick",n)},add_onEnter:function(n){this.get_events().addHandler("onEnter",n)},remove_onEnter:function(n){this.get_events().removeHandler("onEnter",n)},add_onRelease:function(n){this.get_events().addHandler("onRelease",n)},remove_onRelease:function(n){this.get_events().removeHandler("onRelease",n)},add_onExit:function(n){this.get_events().addHandler("onExit",n)},remove_onExit:function(n){this.get_events().removeHandler("onExit",n)},notifyGroupEnter:function(){this._inTo(Sys.Extended.UI.Seadragon.ButtonState.GROUP)},notifyGroupExit:function(){this._outTo(Sys.Extended.UI.Seadragon.ButtonState.REST)}};Sys.Extended.UI.Seadragon.Button.registerClass("Sys.Extended.UI.Seadragon.Button",Sys.Component);Sys.Extended.UI.Seadragon.ButtonGroup=function(){Sys.Extended.UI.Seadragon.ButtonGroup.initializeBase(this);this._buttons=null;this._group=null;this.config=null};Sys.Extended.UI.Seadragon.ButtonGroup.prototype={initialize:function(){var i,n,t;for(Sys.Extended.UI.Seadragon.ButtonGroup.callBaseMethod(this,"initialize"),this._group=Seadragon.Utils.makeNeutralElement("span"),i=this._buttons.concat([]),n=new Seadragon.MouseTracker(this._group,this.config.clickTimeThreshold,this.config.clickDistThreshold),this._group.style.display="inline-block",t=0;t=0;t--)this._controls[t].setOpacity(n);n>0&&this._scheduleControlsFade()}},_onCanvasClick:function(n,t,i,r){if(this.viewport&&i){var u=this.config.zoomPerClick,f=r?1/u:u;this.viewport.zoomBy(f,this.viewport.pointFromPixel(t,!0));this.viewport.applyConstraints()}},_onCanvasDrag:function(n,t,i){this.viewport&&this.viewport.panBy(this.viewport.deltaPointsFromPixels(i.negate()))},_onCanvasRelease:function(n,t,i){i&&this.viewport&&this.viewport.applyConstraints()},_onContainerExit:function(n,t,i){i||(this._mouseInside=!1,this._animating||this._beginControlsAutoHide())},_onContainerRelease:function(n,t,i,r){r||(this._mouseInside=!1,this._animating||this._beginControlsAutoHide())},_getControlIndex:function(n){for(var t=this._controls.length-1;t>=0;t--)if(this._controls[t].elmt==n)return t;return-1},_abortControlsAutoHide:function(){this._controlsShouldFade=!1;for(var n=this._controls.length-1;n>=0;n--)this._controls[n].setOpacity(1)},_onContainerEnter:function(){this._mouseInside=!0;this._abortControlsAutoHide()},_updateOnce:function(){var t,n;this.source&&(this.profiler.beginUpdate(),t=Seadragon.Utils.getElementSize(this._container),t.equals(this._prevContainerSize)||(this.viewport.resize(t,!0),this._prevContainerSize=t,this._raiseEvent("resize",this)),n=this.viewport.update(),!this._animating&&n&&(this._raiseEvent("animationstart",self),this._abortControlsAutoHide()),n?(this.drawer.update(),this._raiseEvent("animation",self)):this._forceRedraw||this.drawer.needsUpdate()?(this.drawer.update(),this._forceRedraw=!1):this.drawer.idle(),this._animating&&!n&&(this._raiseEvent("animationfinish",this),this._mouseInside||this._beginControlsAutoHide()),this._animating=n,this.profiler.endUpdate())},_onClose:function(){this.source=null;this.viewport=null;this.drawer=null;this.profiler=null;this._canvas.innerHTML=""},_beforeOpen:function(){return this.source&&this._onClose(),this._lastOpenStartTime=(new Date).getTime(),window.setTimeout(Function.createDelegate(this,function(){this._lastOpenStartTime>this._lastOpenEndTime&&this._setMessage(Seadragon.Strings.getString("Messages.Loading"))}),2e3),this._lastOpenStartTime},_setMessage:function(n){var i=document.createTextNode(n),t;this._canvas.innerHTML="";this._canvas.appendChild(Seadragon.Utils.makeCenteredNode(i));t=i.parentNode.style;t.color="white";t.fontFamily="verdana";t.fontSize="13px";t.fontSizeAdjust="none";t.fontStyle="normal";t.fontStretch="normal";t.fontVariant="normal";t.fontWeight="normal";t.lineHeight="1em";t.textAlign="center";t.textDecoration="none"},_onOpen:function(n,t,i){var u,r;if(this._lastOpenEndTime=(new Date).getTime(),n=0)){i=null;switch(t){case Sys.Extended.UI.Seadragon.ControlAnchor.TOP_RIGHT:i=this._controlsTR;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.BOTTOM_RIGHT:i=this._controlsBR;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.BOTTOM_LEFT:i=this._controlsBL;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.TOP_LEFT:i=this._controlsTL;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.NONE:default:i=this._container;n.style.position="absolute"}this._controls.push(new Sys.Extended.UI.Seadragon.Control(n,t,i))}},isOpen:function(){return!!this.source},openDzi:function(n,t){var i=this._beforeOpen();Sys.Extended.UI.Seadragon.DziTileSourceHelper.createFromXml(n,t,Seadragon.Utils.createCallback(null,Function.createDelegate(this,this._onOpen),i))},openTileSource:function(n){var t=this._beforeOpen();window.setTimeout(Function.createDelegate(this,function(){this._onOpen(t,n)}),1)},close:function(){this.source&&this._onClose()},removeControl:function(n){var n=Seadragon.Utils.getElement(n),t=this._getControlIndex(n);t>=0&&(this._controls[t].destroy(),this._controls.splice(t,1))},clearControls:function(){while(this._controls.length>0)this._controls.pop().destroy()},isDashboardEnabled:function(){for(var n=this._controls.length-1;n>=0;n--)if(this._controls[n].isVisible())return!0;return!1},isFullPage:function(){return this._container.parentNode==document.body},isMouseNavEnabled:function(){return this._innerTracker.isTracking()},isVisible:function(){return this._container.style.visibility!="hidden"},setDashboardEnabled:function(n){for(var t=this._controls.length-1;t>=0;t--)this._controls[t].setVisible(n)},setFullPage:function(n){var f,e;if(n!=this.isFullPage()){var o=document.body,t=o.style,u=document.documentElement.style,i=this._container.style,r=this._canvas.style;n?(bodyOverflow=t.overflow,docOverflow=u.overflow,t.overflow="hidden",u.overflow="hidden",bodyWidth=t.width,bodyHeight=t.height,t.width="100%",t.height="100%",r.backgroundColor="black",r.color="white",i.position="fixed",i.zIndex=Sys.Extended.UI.zIndex.SeadragonContainer,o.appendChild(this._container),this._prevContainerSize=Seadragon.Utils.getWindowSize(),this._onContainerEnter()):(t.overflow=bodyOverflow,u.overflow=docOverflow,t.width=bodyWidth,t.height=bodyHeight,r.backgroundColor="",r.color="",i.position="relative",i.zIndex="",this.get_element().appendChild(this._container),this._prevContainerSize=Seadragon.Utils.getElementSize(this.get_element()),this._onContainerExit());this.viewport&&(f=this.viewport.getBounds(),this.viewport.resize(this._prevContainerSize),e=this.viewport.getBounds(),n?this._fsBoundsDelta=new Sys.Extended.UI.Seadragon.Point(e.width/f.width,e.height/f.height):(this.viewport.update(),this.viewport.zoomBy(Math.max(this._fsBoundsDelta.x,this._fsBoundsDelta.y),null,!0)),this._forceRedraw=!0,this._raiseEvent("resize",this),this._updateOnce())}},setMouseNavEnabled:function(n){this._innerTracker.setTracking(n)},setVisible:function(n){this._container.style.visibility=n?"":"hidden"}};Sys.Extended.UI.Seadragon.Viewer.registerClass("Sys.Extended.UI.Seadragon.Viewer",Sys.UI.Control),function(){function o(n){return Seadragon.Utils.getMousePosition(n)}function i(n,t){var i=Seadragon.Utils.getMousePosition(n),r=Seadragon.Utils.getElementPosition(t);return i.minus(r)}function r(n,t){for(var i=document.body;t&&n!=t&&i!=t;)try{t=t.parentNode}catch(r){return!1}return n==t}function s(){u=!0}function h(){u=!1}if(!Seadragon.MouseTracker){var n=Seadragon.Utils.getBrowser()==Seadragon.Browser.IE,u=!1,f=!1,e={},t=[];(function(){n?(Seadragon.Utils.addEvent(document,"mousedown",s,!1),Seadragon.Utils.addEvent(document,"mouseup",h,!1)):(Seadragon.Utils.addEvent(window,"mousedown",s,!0),Seadragon.Utils.addEvent(window,"mouseup",h,!0))})();Seadragon.MouseTracker=function(s,h,c){function lt(){y||(Seadragon.Utils.addEvent(s,"mouseover",nt,!1),Seadragon.Utils.addEvent(s,"mouseout",tt,!1),Seadragon.Utils.addEvent(s,"mousedown",et,!1),Seadragon.Utils.addEvent(s,"mouseup",v,!1),Seadragon.Utils.addEvent(s,"click",ht,!1),y=!0,e[d]=b)}function at(){y&&(Seadragon.Utils.removeEvent(s,"mouseover",nt,!1),Seadragon.Utils.removeEvent(s,"mouseout",tt,!1),Seadragon.Utils.removeEvent(s,"mousedown",et,!1),Seadragon.Utils.removeEvent(s,"mouseup",v,!1),Seadragon.Utils.removeEvent(s,"click",ht,!1),g(),y=!1,delete e[d])}function vt(){a||(n?(Seadragon.Utils.removeEvent(s,"mouseup",v,!1),Seadragon.Utils.addEvent(s,"mouseup",ot,!0),Seadragon.Utils.addEvent(s,"mousemove",ct,!0)):(Seadragon.Utils.addEvent(window,"mouseup",st,!0),Seadragon.Utils.addEvent(window,"mousemove",it,!0)),a=!0)}function g(){a&&(n?(Seadragon.Utils.removeEvent(s,"mousemove",ct,!0),Seadragon.Utils.removeEvent(s,"mouseup",ot,!0),Seadragon.Utils.addEvent(s,"mouseup",v,!1)):(Seadragon.Utils.removeEvent(window,"mousemove",it,!0),Seadragon.Utils.removeEvent(window,"mouseup",st,!0)),a=!1)}function ft(n,t){var i=e;for(var r in i)i.hasOwnProperty(r)&&d!=r&&i[r][n](t)}function yt(){return w}function nt(t){var t=Seadragon.Utils.getEvent(t),e,o;if((n&&a&&!r(t.srcElement,s)&&ft("onMouseOver",t),e=t.target?t.target:t.srcElement,o=t.relatedTarget?t.relatedTarget:t.fromElement,r(s,e)&&!r(s,o))&&(w=!0,typeof l.enterHandler=="function"))try{l.enterHandler(l,i(t,s),p,u)}catch(f){Seadragon.Debug.error(f.name+" while executing enter handler: "+f.message,f)}}function tt(t){var t=Seadragon.Utils.getEvent(t),e,o;if((n&&a&&!r(t.srcElement,s)&&ft("onMouseOut",t),e=t.target?t.target:t.srcElement,o=t.relatedTarget?t.relatedTarget:t.toElement,r(s,e)&&!r(s,o))&&(w=!1,typeof l.exitHandler=="function"))try{l.exitHandler(l,i(t,s),p,u)}catch(f){Seadragon.Debug.error(f.name+" while executing exit handler: "+f.message,f)}}function et(r){var r=Seadragon.Utils.getEvent(r);if(r.button!=2){if(p=!0,k=o(r),ut=k,rt=(new Date).getTime(),typeof l.pressHandler=="function")try{l.pressHandler(l,i(r,s))}catch(u){Seadragon.Debug.error(u.name+" while executing press handler: "+u.message,u)}(l.pressHandler||l.dragHandler)&&Seadragon.Utils.cancelEvent(r);n&&f?n&&t.push(b):(vt(),f=!0,t=[b])}}function v(n){var n=Seadragon.Utils.getEvent(n),r=p,u=w;if(n.button!=2){if(p=!1,typeof l.releaseHandler=="function")try{l.releaseHandler(l,i(n,s),r,u)}catch(t){Seadragon.Debug.error(t.name+" while executing release handler: "+t.message,t)}r&&u&&pt(n)}}function ot(n){var n=Seadragon.Utils.getEvent(n),i,r;if(n.button!=2){for(i=0;i=4||browser==Seadragon.Browser.CHROME&&browserVer>=2,useCanvas=typeof document.createElement("canvas").getContext=="function"&&subpixelRenders;Sys.Extended.UI.Seadragon.Tile=function(n,t,i,r,u,f){this.level=n;this.x=t;this.y=i;this.bounds=r;this.exists=u;this.loaded=!1;this.loading=!1;this.elmt=null;this.image=null;this.url=f;this.style=null;this.position=null;this.size=null;this.blendStart=null;this.opacity=null;this.distance=null;this.visibility=null;this.beingDrawn=!1;this.lastTouchTime=0};Sys.Extended.UI.Seadragon.Tile.prototype={dispose:function(){},toString:function(){return this.level+"/"+this.x+"_"+this.y},drawHTML:function(n){if(!this.loaded){Seadragon.Debug.error("Attempting to draw tile "+this.toString()+" when it's not yet loaded.");return}this.elmt||(this.elmt=Seadragon.Utils.makeNeutralElement("img"),this.elmt.src=this.url,this.style=this.elmt.style,this.style.position="absolute",this.style.msInterpolationMode="nearest-neighbor");var i=this.elmt,t=this.style,r=this.position.apply(Math.floor),u=this.size.apply(Math.ceil);i.parentNode!=n&&n.appendChild(i);t.left=r.x+"px";t.top=r.y+"px";t.width=u.x+"px";t.height=u.y+"px";Seadragon.Utils.setElementOpacity(i,this.opacity)},drawCanvas:function(n){if(!this.loaded){Seadragon.Debug.error("Attempting to draw tile "+this.toString()+" when it's not yet loaded.");return}var t=this.position,i=this.size;n.globalAlpha=this.opacity;n.drawImage(this.image,t.x,t.y,i.x,i.y)},unload:function(){this.elmt&&this.elmt.parentNode&&this.elmt.parentNode.removeChild(this.elmt);this.elmt=null;this.image=null;this.loaded=!1;this.loading=!1}};Sys.Extended.UI.Seadragon.Tile.registerClass("Sys.Extended.UI.Seadragon.Tile",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Overlay=function(n,t,i){this.elmt=n;this.scales=t instanceof Sys.Extended.UI.Seadragon.Rect;this.bounds=new Sys.Extended.UI.Seadragon.Rect(t.x,t.y,t.width,t.height);this.placement=t instanceof Sys.Extended.UI.Seadragon.Point?i:Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_LEFT;this.position=new Sys.Extended.UI.Seadragon.Point(t.x,t.y);this.size=new Sys.Extended.UI.Seadragon.Point(t.width,t.height);this.style=n.style};Sys.Extended.UI.Seadragon.Overlay.prototype={adjust:function(n,t){switch(this.placement){case Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_LEFT:break;case Sys.Extended.UI.Seadragon.OverlayPlacement.TOP:n.x-=t.x/2;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_RIGHT:n.x-=t.x;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.RIGHT:n.x-=t.x;n.y-=t.y/2;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.BOTTOM_RIGHT:n.x-=t.x;n.y-=t.y;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.BOTTOM:n.x-=t.x/2;n.y-=t.y;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.BOTTOM_LEFT:n.y-=t.y;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.LEFT:n.y-=t.y/2;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.CENTER:default:n.x-=t.x/2;n.y-=t.y/2}},destroy:function(){var t=this.elmt,n=this.style;t.parentNode&&t.parentNode.removeChild(t);n.top="";n.left="";n.position="";this.scales&&(n.width="",n.height="")},drawHTML:function(n){var u=this.elmt,r=this.style,f=this.scales,t,i;u.parentNode!=n&&n.appendChild(u);f||(this.size=Seadragon.Utils.getElementSize(u));t=this.position;i=this.size;this.adjust(t,i);t=t.apply(Math.floor);i=i.apply(Math.ceil);r.left=t.x+"px";r.top=t.y+"px";r.position="absolute";f&&(r.width=i.x+"px",r.height=i.y+"px")},update:function(n,t){this.scales=n instanceof Sys.Extended.UI.Seadragon.Rect;this.bounds=new Sys.Extended.UI.Seadragon.Rect(n.x,n.y,n.width,n.height);this.placement=n instanceof Sys.Extended.UI.Seadragon.Point?t:Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_LEFT}};Sys.Extended.UI.Seadragon.Overlay.registerClass("Sys.Extended.UI.Seadragon.Overlay",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Drawer=function(n,t,i){this._container=Seadragon.Utils.getElement(i);this._canvas=Seadragon.Utils.makeNeutralElement(useCanvas?"canvas":"div");this._context=useCanvas?this._canvas.getContext("2d"):null;this._viewport=t;this._source=n;this.config=this._viewport.config;this._imageLoader=new Sys.Extended.UI.Seadragon.ImageLoader(this.config.imageLoaderLimit);this._profiler=new Sys.Extended.UI.Seadragon.Profiler;this._minLevel=n.minLevel;this._maxLevel=n.maxLevel;this._tileSize=n.tileSize;this._tileOverlap=n.tileOverlap;this._normHeight=n.dimensions.y/n.dimensions.x;this._cacheNumTiles={};this._cachePixelRatios={};this._tilesMatrix={};this._tilesLoaded=[];this._coverage={};this._overlays=[];this._lastDrawn=[];this._lastResetTime=0;this._midUpdate=!1;this._updateAgain=!0;this.elmt=this._container;this._init()};Sys.Extended.UI.Seadragon.Drawer.prototype={dispose:function(){},_init:function(){this._canvas.style.width="100%";this._canvas.style.height="100%";this._canvas.style.position="absolute";this._container.style.textAlign="left";this._container.appendChild(this._canvas)},_compareTiles:function(n,t){return n?t.visibility>n.visibility?t:t.visibility==n.visibility&&t.distance=QUOTA){var a=Math.ceil(Math.log(this._tileSize)/Math.log(2)),r=null,e=-1;for(f=this._tilesLoaded.length-1;f>=0;f--){if(u=this._tilesLoaded[f],u.level<=this._cutoff||u.beingDrawn)continue;else if(!r){r=u;e=f;continue}var s=u.lastTouchTime,h=r.lastTouchTime,c=u.level,l=r.level;(sl)&&(r=u,e=f)}r&&e>=0&&(r.unload(),o=e)}this._tilesLoaded[o]=n;this._updateAgain=!0},_clearTiles:function(){this._tilesMatrix={};this._tilesLoaded=[]},_providesCoverage:function(n,t,i){var r,f,u,e;if(!this._coverage[n])return!1;if(t===undefined||i===undefined){r=this._coverage[n];for(f in r)if(r.hasOwnProperty(f)){u=r[f];for(e in u)if(u.hasOwnProperty(e)&&!u[e])return!1}return!0}return this._coverage[n][t]===undefined||this._coverage[n][t][i]===undefined||this._coverage[n][t][i]===!0},_isCovered:function(n,t,i){return t===undefined||i===undefined?this._providesCoverage(n+1):this._providesCoverage(n+1,2*t,2*i)&&this._providesCoverage(n+1,2*t,2*i+1)&&this._providesCoverage(n+1,2*t+1,2*i)&&this._providesCoverage(n+1,2*t+1,2*i+1)},_setCoverage:function(n,t,i,r){if(!this._coverage[n]){Seadragon.Debug.error("Setting coverage for a tile before its level's coverage has been reset: "+n);return}this._coverage[n][t]||(this._coverage[n][t]={});this._coverage[n][t][i]=r},_resetCoverage:function(n){this._coverage[n]={}},_compareTiles:function(n,t){return n?t.visibility>n.visibility?t:t.visibility==n.visibility&&t.distance=0;t--)if(this._overlays[t].elmt==n)return t;return-1},_updateActual:function(){var t,nt,tt,r,u,b,rt,k,n,ii,f,c,ut;this._updateAgain=!1;for(var l=this._canvas,ft=this._context,ri=this._container,et=useCanvas,h=this._lastDrawn;h.length>0;)n=h.pop(),n.beingDrawn=!1;var ot=this._viewport.getContainerSize(),st=ot.x,ht=ot.y;l.innerHTML="";et&&(l.width=st,l.height=ht,ft.clearRect(0,0,st,ht));var ct=this._viewport.getBounds(!0),e=ct.getTopLeft(),o=ct.getBottomRight();if((this.config.wrapHorizontal||!(o.x<0||e.x>1))&&(this.config.wrapVertical||!(o.y<0||e.y>this._normHeight))){var ui=Math.abs,ki=Math.ceil,lt=Math.floor,a=Math.log,d=Math.max,i=Math.min,fi=this.config.alwaysBlend,at=1e3*this.config.blendTime,ei=this.config.immediateRender,g=this.config.minZoomDimension,di=this.config.minImageRatio,vt=this.config.wrapHorizontal,yt=this.config.wrapVertical;vt||(e.x=d(e.x,0),o.x=i(o.x,1));yt||(e.y=d(e.y,0),o.y=i(o.y,this._normHeight));var v=null,y=!1,p=(new Date).getTime(),oi=this._viewport.pixelFromPoint(this._viewport.getCenter()),si=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(0),!1).x,pt=ei?1:si;g=g||64;var w=d(this._minLevel,lt(a(g)/a(2))),hi=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(0),!0).x,wt=i(this._maxLevel,lt(a(hi/MIN_PIXEL_RATIO)/a(2)));for(w=i(w,wt),t=wt;t>=w;t--){if(nt=!1,tt=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(t),!0).x,!y&&tt>=MIN_PIXEL_RATIO||t==w)nt=!0,y=!0;else if(!y)continue;this._resetCoverage(t);var ci=i(1,(tt-.5)/.5),li=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(t),!1).x,ai=pt/ui(pt-li),bt=this._source.getTileAtPoint(t,e),s=this._source.getTileAtPoint(t,o),kt=this._getNumTiles(t),dt=kt.x,gt=kt.y;for(vt||(s.x=i(s.x,dt-1)),yt||(s.y=i(s.y,gt-1)),r=bt.x;r<=s.x;r++)for(u=bt.y;u<=s.y;u++)if((n=this._getTile(t,r,u,p,dt,gt),b=nt,this._setCoverage(t,r,u,!1),n.exists)&&(y&&!b&&(this._isCovered(t,r,u)?this._setCoverage(t,r,u,!0):b=!0),b)){var ni=n.bounds.getTopLeft(),ti=n.bounds.getSize(),vi=this._viewport.pixelFromPoint(ni,!0),it=this._viewport.deltaPixelsFromPoints(ti,!0);this._tileOverlap||(it=it.plus(new Sys.Extended.UI.Seadragon.Point(1,1)));var yi=this._viewport.pixelFromPoint(ni,!1),pi=this._viewport.deltaPixelsFromPoints(ti,!1),wi=yi.plus(pi.divide(2)),bi=oi.distanceTo(wi);n.position=vi;n.size=it;n.distance=bi;n.visibility=ai;n.loaded?(n.blendStart||(n.blendStart=p),rt=p-n.blendStart,k=i(1,rt/at),fi&&(k*=ci),n.opacity=k,h.push(n),k==1?this._setCoverage(t,r,u,!0):rt=0;f--)n=h[f],et?n.drawCanvas(ft):n.drawHTML(l),n.beingDrawn=!0;for(ii=this._overlays.length,f=0;f=0||(this._overlays.push(new Sys.Extended.UI.Seadragon.Overlay(n,t,i)),this._updateAgain=!0)},updateOverlay:function(n,t,i){var n=Seadragon.Utils.getElement(n),r=this._getOverlayIndex(n);r>=0&&(this._overlays[r].update(t,i),this._updateAgain=!0)},removeOverlay:function(n){var n=Seadragon.Utils.getElement(n),t=this._getOverlayIndex(n);t>=0&&(this._overlays[t].destroy(),this._overlays.splice(t,1),this._updateAgain=!0)},clearOverlays:function(){while(this._overlays.length>0)this._overlays.pop().destroy(),this._updateAgain=!0},needsUpdate:function(){return this._updateAgain},numTilesLoaded:function(){return this._tilesLoaded.length},reset:function(){this._clearTiles();this._lastResetTime=(new Date).getTime();this._updateAgain=!0},update:function(){this._profiler.beginUpdate();this._midUpdate=!0;this._updateActual();this._midUpdate=!1;this._profiler.endUpdate()},idle:function(){}};Sys.Extended.UI.Seadragon.Drawer.registerClass("Sys.Extended.UI.Seadragon.Drawer",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.TileSource=function(n,t,i,r,u,f){this.aspectRatio=n/t;this.dimensions=new Sys.Extended.UI.Seadragon.Point(n,t);this.minLevel=u?u:0;this.maxLevel=f?f:Math.ceil(Math.log(Math.max(n,t))/Math.log(2));this.tileSize=i?i:0;this.tileOverlap=r?r:0};Sys.Extended.UI.Seadragon.TileSource.prototype={getLevelScale:function(n){return 1/(1<=this.minLevel&&n<=this.maxLevel&&t>=0&&i>=0&&t=0;t--)for(i=this.displayRects[t],n=i.minLevel;n<=i.maxLevel;n++)this._levelRects[n]||(this._levelRects[n]=[]),this._levelRects[n].push(i)},getTileUrl:function(n,t,i){return[this.tilesUrl,n,"/",t,"_",i,".",this.fileFormat].join("")},tileExists:function(n,t,i){var u=this._levelRects[n],f,r;if(!u||!u.length)return!0;for(f=u.length-1;f>=0;f--)if(r=u[f],!(nr.maxLevel)){var e=this.getLevelScale(n),o=r.x*e,s=r.y*e,h=o+r.width*e,c=s+r.height*e;if(o=Math.floor(o/this.tileSize),s=Math.floor(s/this.tileSize),h=Math.ceil(h/this.tileSize),c=Math.ceil(c/this.tileSize),o<=t&&t-1&&(u[u.length-1]=s.slice(0,h)),c=u.join("/")+"_files/",o)?(t?(e=Function.createDelegate(this,this.processResponse),window.setTimeout(function(){var n=f(e,Seadragon.Utils.parseXml(t));i(n,r)},1)):(e=Function.createDelegate(this,this.processResponse),Seadragon.Utils.makeAjaxRequest(n,function(n){var t=f(e,n);i(t,r)})),null):t?f(Function.createDelegate(this,this.processXml),Seadragon.Utils.parseXml(t)):f(Function.createDelegate(this,this.processResponse),Seadragon.Utils.makeAjaxRequest(n))},processResponse:function(n,t){var r,u,i;if(n){if(n.status!==200&&n.status!==0){r=n.status;u=r==404?"Not Found":n.statusText;throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Status",r,u));}}else throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Security"));return i=null,n.responseXML&&n.responseXML.documentElement?i=n.responseXML:n.responseText&&(i=Seadragon.Utils.parseXml(n.responseText)),this.processXml(i,t)},processXml:function(n,t){var i,r,f;if(!n||!n.documentElement)throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Xml"));if(i=n.documentElement,r=i.tagName,r=="Image")try{return this.processDzi(i,t)}catch(u){f=Seadragon.Strings.getString("Errors.Dzi");throw u instanceof Sys.Extended.UI.Seadragon.DziError?u:new Sys.Extended.UI.Seadragon.DziError(f);}else if(r=="Collection")throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Dzc"));else if(r=="Error")return this.processError(i);throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Dzi"));},processDzi:function(n,t){var u=n.getAttribute("Format"),r,f,i;if(!Seadragon.Utils.imageFormatSupported(u))throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.ImageFormat",u.toUpperCase()));var e=n.getElementsByTagName("Size")[0],o=n.getElementsByTagName("DisplayRect"),h=parseInt(e.getAttribute("Width"),10),c=parseInt(e.getAttribute("Height"),10),l=parseInt(n.getAttribute("TileSize")),a=parseInt(n.getAttribute("Overlap")),s=[];for(r=0;r=this.imageLoaderLimit)return!1;var i=Seadragon.Utils.createCallback(null,Function.createDelegate(this,this._onComplete),t),r=new Sys.Extended.UI.Seadragon.Job(n,i);return this._downloading++,r.start(),!0}};Sys.Extended.UI.Seadragon.ImageLoader.registerClass("Sys.Extended.UI.Seadragon.ImageLoader",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Profiler=function(){this._midUpdate=!1;this._numUpdates=0;this._lastBeginTime=null;this._lastEndTime=null;this._minUpdateTime=Infinity;this._avgUpdateTime=0;this._maxUpdateTime=0;this._minIdleTime=Infinity;this._avgIdleTime=0;this._maxIdleTime=0};Sys.Extended.UI.Seadragon.Profiler.prototype={getAvgUpdateTime:function(){return this._avgUpdateTime},getMinUpdateTime:function(){return this._minUpdateTime},getMaxUpdateTime:function(){return this._maxUpdateTime},getAvgIdleTime:function(){return this._avgIdleTime},getMinIdleTime:function(){return this._minIdleTime},getMaxIdleTime:function(){return this._maxIdleTime},isMidUpdate:function(){return this._midUpdate},getNumUpdates:function(){return this._numUpdates},beginUpdate:function(){if(this._midUpdate&&this.endUpdate(),this._midUpdate=!0,this._lastBeginTime=(new Date).getTime(),!(this._numUpdates<1)){var n=this._lastBeginTime-this._lastEndTime;this._avgIdleTime=(this._avgIdleTime*(this._numUpdates-1)+n)/this._numUpdates;nthis._maxIdleTime&&(this._maxIdleTime=n)}},endUpdate:function(){if(this._midUpdate){this._lastEndTime=(new Date).getTime();this._midUpdate=!1;var n=this._lastEndTime-this._lastBeginTime;this._numUpdates++;this._avgUpdateTime=(this._avgUpdateTime*(this._numUpdates-1)+n)/this._numUpdates;nthis._maxUpdateTime&&(this._maxUpdateTime=n)}},clearProfile:function(){this._midUpdate=!1;this._numUpdates=0;this._lastBeginTime=null;this._lastEndTime=null;this._minUpdateTime=Infinity;this._avgUpdateTime=0;this._maxUpdateTime=0;this._minIdleTime=Infinity;this._avgIdleTime=0;this._maxIdleTime=0}};Sys.Extended.UI.Seadragon.Profiler.registerClass("Sys.Extended.UI.Seadragon.Profiler",null,Sys.IDisposable);Seadragon.Spring=Sys.Extended.UI.Seadragon.Spring=function(n,t){this._currentValue=typeof n=="number"?n:0;this._startValue=this._currentValue;this._targetValue=this._currentValue;this.config=t;this._currentTime=(new Date).getTime();this._startTime=this._currentTime;this._targetTime=this._currentTime};Sys.Extended.UI.Seadragon.Spring.prototype={_transform:function(n){var t=this.config.springStiffness;return(1-Math.exp(-n*t))/(1-Math.exp(-t))},getCurrent:function(){return this._currentValue},getTarget:function(){return this._targetValue},resetTo:function(n){this._targetValue=n;this._targetTime=this._currentTime;this._startValue=this._targetValue;this._startTime=this._targetTime},springTo:function(n){this._startValue=this._currentValue;this._startTime=this._currentTime;this._targetValue=n;this._targetTime=this._startTime+1e3*this.config.animationTime},shiftBy:function(n){this._startValue+=n;this._targetValue+=n},update:function(){this._currentTime=(new Date).getTime();this._currentValue=this._currentTime>=this._targetTime?this._targetValue:this._startValue+(this._targetValue-this._startValue)*this._transform((this._currentTime-this._startTime)/(this._targetTime-this._startTime))}};Sys.Extended.UI.Seadragon.Spring.registerClass("Sys.Extended.UI.Seadragon.Spring",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Viewport=function(n,t,i){this.zoomPoint=null;this.config=i;this._containerSize=n;this._contentSize=t;this._contentAspect=t.x/t.y;this._contentHeight=t.y/t.x;this._centerSpringX=new Seadragon.Spring(0,this.config);this._centerSpringY=new Seadragon.Spring(0,this.config);this._zoomSpring=new Seadragon.Spring(1,this.config);this._homeBounds=new Sys.Extended.UI.Seadragon.Rect(0,0,1,this._contentHeight);this.goHome(!0);this.update()};Sys.Extended.UI.Seadragon.Viewport.prototype={_getHomeZoom:function(){var n=this._contentAspect/this.getAspectRatio();return n>=1?1:n},_getMinZoom:function(){var n=this._getHomeZoom(),t;return t=this.config.minZoomDimension?this._contentSize.x<=this._contentSize.y?this.config.minZoomDimension/this._containerSize.x:this.config.minZoomDimension/(this._containerSize.x*this._contentHeight):this.config.minZoomImageRatio*n,Math.min(t,n)},_getMaxZoom:function(){var n=this._contentSize.x*this.config.maxZoomPixelRatio/this._containerSize.x;return Math.max(n,this._getHomeZoom())},getAspectRatio:function(){return this._containerSize.x/this._containerSize.y},getContainerSize:function(){return new Sys.Extended.UI.Seadragon.Point(this._containerSize.x,this._containerSize.y)},getBounds:function(n){var i=this.getCenter(n),t=1/this.getZoom(n),r=t/this.getAspectRatio();return new Sys.Extended.UI.Seadragon.Rect(i.x-t/2,i.y-r/2,t,r)},getCenter:function(n){var t=new Sys.Extended.UI.Seadragon.Point(this._centerSpringX.getCurrent(),this._centerSpringY.getCurrent()),r=new Sys.Extended.UI.Seadragon.Point(this._centerSpringX.getTarget(),this._centerSpringY.getTarget());if(n)return t;if(!this.zoomPoint)return r;var o=this.pixelFromPoint(this.zoomPoint,!0),u=this.getZoom(),i=1/u,f=i/this.getAspectRatio(),e=new Sys.Extended.UI.Seadragon.Rect(t.x-i/2,t.y-f/2,i,f),s=this.zoomPoint.minus(e.getTopLeft()).times(this._containerSize.x/e.width),h=s.minus(o),c=h.divide(this._containerSize.x*u);return r.plus(c)},getZoom:function(n){return n?this._zoomSpring.getCurrent():this._zoomSpring.getTarget()},applyConstraints:function(n){var e=this.getZoom(),o=Math.max(Math.min(e,this._getMaxZoom()),this._getMinZoom()),i;e!=o&&this.zoomTo(o,this.zoomPoint,n);var t=this.getBounds(),s=this.config.visibilityRatio,r=s*t.width,u=s*t.height,h=t.x+t.width,c=1-t.x,l=t.y+t.height,a=this._contentHeight-t.y,f=0;this.config.wrapHorizontal||(h=u?(i.height=n.width/u,i.y=f.y-i.height/2):(i.width=n.height*u,i.x=f.x-i.width/2);this.panTo(this.getCenter(!0),!0);this.zoomTo(this.getZoom(!0),null,!0);var r=this.getBounds(),s=this.getZoom(),e=1/i.width;if(e==s||i.width==r.width){this.panTo(f,t);return}o=r.getTopLeft().times(this._containerSize.x/r.width).minus(i.getTopLeft().times(this._containerSize.x/i.width)).divide(this._containerSize.x/r.width-this._containerSize.x/i.width);this.zoomTo(e,o,t)},goHome:function(n){var t=this.getCenter();this.config.wrapHorizontal&&(t.x=(1+t.x%1)%1,this._centerSpringX.resetTo(t.x),this._centerSpringX.update());this.config.wrapVertical&&(t.y=(this._contentHeight+t.y%this._contentHeight)%this._contentHeight,this._centerSpringY.resetTo(t.y),this._centerSpringY.update());this.fitBounds(this._homeBounds,n)},panBy:function(n,t){var i=new Sys.Extended.UI.Seadragon.Point(this._centerSpringX.getTarget(),this._centerSpringY.getTarget());this.panTo(i.plus(n),t)},panTo:function(n,t){t?(this._centerSpringX.resetTo(n.x),this._centerSpringY.resetTo(n.y)):(this._centerSpringX.springTo(n.x),this._centerSpringY.springTo(n.y))},zoomBy:function(n,t,i){this.zoomTo(this._zoomSpring.getTarget()*n,t,i)},zoomTo:function(n,t,i){i?this._zoomSpring.resetTo(n):this._zoomSpring.springTo(n);this.zoomPoint=t instanceof Sys.Extended.UI.Seadragon.Point?t:null},resize:function(n,t){var r=this.getBounds(),i=r,u=n.x/this._containerSize.x;this._containerSize=new Sys.Extended.UI.Seadragon.Point(n.x,n.y);t&&(i.width=r.width*u,i.height=i.width/this.getAspectRatio());this.fitBounds(i,!0)},update:function(){var r=this._centerSpringX.getCurrent(),u=this._centerSpringY.getCurrent(),n=this._zoomSpring.getCurrent(),t;if(this.zoomPoint&&(t=this.pixelFromPoint(this.zoomPoint,!0)),this._zoomSpring.update(),this.zoomPoint&&this._zoomSpring.getCurrent()!=n){var f=this.pixelFromPoint(this.zoomPoint,!0),e=f.minus(t),i=this.deltaPointsFromPixels(e,!0);this._centerSpringX.shiftBy(i.x);this._centerSpringY.shiftBy(i.y)}else this.zoomPoint=null;return this._centerSpringX.update(),this._centerSpringY.update(),this._centerSpringX.getCurrent()!=r||this._centerSpringY.getCurrent()!=u||this._zoomSpring.getCurrent()!=n},deltaPixelsFromPoints:function(n,t){return n.times(this._containerSize.x*this.getZoom(t))},deltaPointsFromPixels:function(n,t){return n.divide(this._containerSize.x*this.getZoom(t))},pixelFromPoint:function(n,t){var i=this.getBounds(t);return n.minus(i.getTopLeft()).times(this._containerSize.x/i.width)},pointFromPixel:function(n,t){var i=this.getBounds(t);return n.divide(this._containerSize.x/i.width).plus(i.getTopLeft())}};Sys.Extended.UI.Seadragon.Viewport.registerClass("Sys.Extended.UI.Seadragon.Viewport",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.DisplayRect=function(n,t,i,r,u,f){Sys.Extended.UI.Seadragon.DisplayRect.initializeBase(this,[n,t,i,r]);this.minLevel=u;this.maxLevel=f};Sys.Extended.UI.Seadragon.DisplayRect.registerClass("Sys.Extended.UI.Seadragon.DisplayRect",Sys.Extended.UI.Seadragon.Rect);