Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(e,t){returnnewUint8Array(Array.prototype.slice.call(this,e,t))}});varCreateAgentRemoteDesktop=function(e,t){varh={};"string"==typeof(h.CanvasId=e)&&(h.CanvasId=Q(e)),h.Canvas=h.CanvasId.getContext("2d"),h.scrolldiv=t,h.State=0,h.PendingOperations=[],h.tilesReceived=0,h.TilesDrawn=0,h.KillDraw=0,h.ipad=!1,h.tabletKeyboardVisible=!1,h.LastX=0,h.LastY=0,h.touchenabled=0,h.submenuoffset=0,h.touchtimer=null,h.TouchArray={},h.connectmode=0,h.connectioncount=0,h.rotation=0,h.protocol=2,h.debugmode=0,h.firstUpKeys=[],h.stopInput=!1,h.localKeyMap=!0,h.pressedKeys=[],h.sessionid=0,h.username,h.oldie=!1,h.CompressionLevel=50,h.ScalingLevel=1024,h.FrameRateTimer=100,h.FirstDraw=!1,h.ScreenWidth=960,h.ScreenHeight=700,h.width=960,h.height=960,h.displays=null,h.selectedDisplay=null,h.onScreenSizeChange=null,h.onMessage=null,h.onConnectCountChanged=null,h.onDebugMessage=null,h.onTouchEnabledChanged=null,h.onDisplayinfo=null;varg=!(h.accumulator=null),p="default";h.mouseCursorActive=function(e){g!=e&&(g=e,h.CanvasId.style.cursor=1==e?p:"default")};varv=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none","not-allowed","col-resize","row-resize","copy","zoom-in","zoom-out"];h.Start=function(){h.State=0,h.accumulator=null},h.Stop=function(){h.setRotation(0),h.UnGrabKeyInput(),h.UnGrabMouseInput(),h.touchenabled=0,null!=h.onScreenSizeChange&&h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight,h.CanvasId),h.Canvas.clearRect(0,0,h.CanvasId.width,h.CanvasId.height)},h.xxStateChange=function(e){if(h.State!=e)switch(h.State=e,h.CanvasId.style.cursor="default",e){case0:h.Stop()}},h.send=function(e){1<h.debugmode&&console.log("KSend("+e.length+"): "+rstr2hex(e)),null!=h.parent&&h.parent.send(e)},h.ProcessPictureMsg=function(e,t,n){varo=newImage;o.xcount=h.tilesReceived++;for(vara=h.tilesReceived,r=e.slice(4),s=0,i=[];5e4<r.byteLength-s;)i.push(String.fromCharCode.apply(null,r.slice(s,s+5e4))),s+=5e4;0<s?i.push(String.fromCharCode.apply(null,r.slice(s))):i.push(String.fromCharCode.apply(null,r)),o.src="data:image/jpeg;base64,"+btoa(i.join("")),o.onload=function(){if(null!=h.Canvas&&h.KillDraw<a&&0!=h.State)for(h.PendingOperations.push([a,2,o,t,n]);h.DoPendingOperations(););elseh.PendingOperations.push([a,0])},o.error=function(){console.log("DecodeTileError")}},h.DoPendingOperations=function(){if(0==h.PendingOperations.length)return!1;for(vare=0;e<h.PendingOperations.length;e++){vart=h.PendingOperations[e];if(t[0]==h.TilesDrawn+1)return1==t[1]?h.ProcessCopyRectMsg(t[2]):2==t[1]&&(h.Canvas.drawImage(t[2],h.rotX(t[3],t[4]),h.rotY(t[3],t[4])),deletet[2]),h.PendingOperations.splice(e,1),deletet,h.TilesDrawn++,h.TilesDrawn==h.tilesReceived&&h.KillDraw<h.TilesDrawn&&(h.KillDraw=h.TilesDrawn=h.tilesReceived=0),!0}returnh.oldie&&0<h.PendingOperations.length&&h.TilesDrawn++,!1},h.ProcessCopyRectMsg=function(e){vart=((255&e.charCodeAt(0))<<8)+(255&e.charCodeAt(1)),n=((255&e.charCodeAt(2))<<8)+(255&e.charCodeAt(3)),o=((255&e.charCodeAt(4))<<8)+(255&e.charCodeAt(5)),a=((255&e.charCodeAt(6))<<8)+(255&e.charCodeAt(7)),r=((255&e.charCodeAt(8))<<8)+(255&e.charCodeAt(9)),s=((255&e.charCodeAt(10))<<8)+(255&e.charCodeAt(11));h.Canvas.drawImage(Canvas.canvas,t,n,r,s,o,a,r,s)},h.SendUnPause=function(){h.send(String.fromCharCode(0,8,0,5,0))},h.SendPause=function(){h.send(String.fromCharCode(0,8,0,5,1))},h.SendCompressionLevel=function(e,t,n,o){t&&(h.CompressionLevel=t),n&&(h.ScalingLevel=n),o&&(h.FrameRateTimer=o),h.send(String.fromCharCode(0,5,0,10,e,h.CompressionLevel)+h.shortToStr(h.ScalingLevel)+h.shortToStr(h.FrameRateTimer))},h.SendRefresh=function(){h.send(String.fromCharCode(0,6,0,4))},h.ProcessScreenMsg=function(e,t){for(0<h.debugmode&&console.log("ScreenSize: "+e+" x "+t),h.Canvas.setTransform(1,0,0,1,0,0),h.rotation=0,h.FirstDraw=!0,h.ScreenWidth=h.width=e,h.ScreenHeight=h.height=t,h.KillDraw=h.tilesReceived;0<h.PendingOperations.length;)h.PendingOperatio