@huangqiansan/guacamole-common-js
Version:
The Guacamole javascript client
1 lines • 74.1 kB
JavaScript
var Guacamole=Guacamole||{};Guacamole.ArrayBufferReader=function(e){var t=this;e.onblob=function(e){for(var s=window.atob(e),o=new ArrayBuffer(s.length),i=new Uint8Array(o),n=0;n<s.length;n++)i[n]=s.charCodeAt(n);t.ondata&&t.ondata(o)},e.onend=function(){t.onend&&t.onend()},this.ondata=null,this.onend=null},Guacamole=Guacamole||{},Guacamole.ArrayBufferWriter=function(e){var t=this;e.onack=function(e){t.onack&&t.onack(e)};function n(t){for(var s="",n=0;n<t.byteLength;n++)s+=String.fromCharCode(t[n]);e.sendBlob(window.btoa(s))}this.blobLength=Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH,this.sendData=function(e){var s,o=new Uint8Array(e);if(o.length<=t.blobLength)n(o);else for(s=0;s<o.length;s+=t.blobLength)n(o.subarray(s,s+t.blobLength))},this.sendEnd=function(){e.sendEnd()},this.onack=null},Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH=6048,Guacamole=Guacamole||{},Guacamole.AudioContextFactory={singleton:null,getAudioContext:function(){var t=window.AudioContext||window.webkitAudioContext;if(t)try{return Guacamole.AudioContextFactory.singleton||(Guacamole.AudioContextFactory.singleton=new t),Guacamole.AudioContextFactory.singleton}catch{}return null}},Guacamole=Guacamole||{},Guacamole.AudioPlayer=function(){this.sync=function(){}},Guacamole.AudioPlayer.isSupportedType=function(t){return Guacamole.RawAudioPlayer.isSupportedType(t)},Guacamole.AudioPlayer.getSupportedTypes=function(){return Guacamole.RawAudioPlayer.getSupportedTypes()},Guacamole.AudioPlayer.getInstance=function(t,n){return Guacamole.RawAudioPlayer.isSupportedType(n)?new Guacamole.RawAudioPlayer(t,n):null},Guacamole.RawAudioPlayer=function(t,n){var s=Guacamole.RawAudioFormat.parse(n),i=Guacamole.AudioContextFactory.getAudioContext(),o=i.currentTime,c=new Guacamole.ArrayBufferReader(t),u=.02,l=.3,a=s.bytesPerSample===1?window.Int8Array:window.Int16Array,d=s.bytesPerSample===1?128:32768,r=[],h=function(t){if(t.length<=1)return t[0];var n,s,o=0;return t.forEach(function(t){o+=t.length}),n=0,s=new a(o),t.forEach(function(t){s.set(t,n),n+=t.length}),s},m=function(t){for(var i,r,c=Number.MAX_VALUE,n=t.length,d=Math.floor(t.length/s.channels),l=Math.floor(s.rate*u),h=Math.max(s.channels*l,s.channels*(d-l)),o=h;o<t.length;o+=s.channels){for(i=0,r=0;r<s.channels;r++)i+=Math.abs(t[o+r]);i<=c&&(n=o+s.channels,c=i)}return n===t.length?[t]:[new a(t.buffer.slice(0,n*s.bytesPerSample)),new a(t.buffer.slice(n*s.bytesPerSample))]},f=function(t){r.push(new a(t))},p=function(){var t=h(r);return t?(r=m(t),t=r.shift(),t):null},g=function(t){var n,a,r,c,h,l=t.length/s.channels,u=i.currentTime;o<u&&(o=u);for(r=i.createBuffer(s.channels,l,s.rate),n=0;n<s.channels;n++)for(h=r.getChannelData(n),c=n,a=0;a<l;a++)h[a]=t[c]/d,c+=s.channels;return r};c.ondata=function(t){f(new a(t));var n,c,r=p();if(!r)return;c=i.currentTime,o<c&&(o=c),n=i.createBufferSource(),n.connect(i.destination),n.start||(n.start=n.noteOn),n.buffer=g(r),n.start(o),o+=r.length/s.channels/s.rate},this.sync=function(){var t=i.currentTime;o=Math.min(o,t+l)}},Guacamole.RawAudioPlayer.prototype=new Guacamole.AudioPlayer,Guacamole.RawAudioPlayer.isSupportedType=function(t){return!!Guacamole.AudioContextFactory.getAudioContext()&&Guacamole.RawAudioFormat.parse(t)!==null},Guacamole.RawAudioPlayer.getSupportedTypes=function(){return Guacamole.AudioContextFactory.getAudioContext()?["audio/L8","audio/L16"]:[]},Guacamole=Guacamole||{},Guacamole.AudioRecorder=function(){this.onclose=null,this.onerror=null},Guacamole.AudioRecorder.isSupportedType=function(t){return Guacamole.RawAudioRecorder.isSupportedType(t)},Guacamole.AudioRecorder.getSupportedTypes=function(){return Guacamole.RawAudioRecorder.getSupportedTypes()},Guacamole.AudioRecorder.getInstance=function(t,n){return Guacamole.RawAudioRecorder.isSupportedType(n)?new Guacamole.RawAudioRecorder(t,n):null},Guacamole.RawAudioRecorder=function(t,n){var o,i,a,c,d,u,m,f,p,g,v,b,j,y,_,w,r=this,O=2048,h=3,s=Guacamole.RawAudioFormat.parse(n),l=Guacamole.AudioContextFactory.getAudioContext();navigator.mediaDevices||(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia||(navigator.mediaDevices.getUserMedia=(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia).bind(navigator)),a=new Guacamole.ArrayBufferWriter(t),y=s.bytesPerSample===1?window.Int8Array:window.Int16Array,g=s.bytesPerSample===1?128:32768,m=0,f=0,i=null,c=null,o=null,d=function(t){if(t===0)return 1;var n=Math.PI*t;return Math.sin(n)/n},v=function(t,n){return-n<t&&t<n?d(t)*d(t/n):0},b=function(t,n){for(var o=(t.length-1)*n,a=Math.floor(o)-h+1,r=Math.floor(o)+h,i=0,s=a;s<=r;s++)i+=(t[s]||0)*v(o-s,h);return i},j=function(t){var n,o,i,a,r,c,l,d=t.length;m+=d,c=Math.round(m*s.rate/t.sampleRate),n=c-f,f+=n;for(a=new y(n*s.channels),o=0;o<s.channels;o++)for(l=t.getChannelData(o),r=o,i=0;i<n;i++)a[r]=b(l,i/(n-1))*g,r+=s.channels;return a},p=function(t){o=l.createScriptProcessor(O,s.channels,s.channels),o.connect(l.destination),o.onaudioprocess=function(t){a.sendData(j(t.inputBuffer).buffer)},c=l.createMediaStreamSource(t),c.connect(o),l.state==="suspended"&&l.resume(),i=t},u=function(){a.sendEnd(),r.onerror&&r.onerror()},_=function(){var t=navigator.mediaDevices.getUserMedia({audio:!0},p,u);t&&t.then&&t.then(p,u)},w=function(){if(c&&c.disconnect(),o&&o.disconnect(),i)for(var n=i.getTracks(),t=0;t<n.length;t++)n[t].stop();o=null,c=null,i=null,a.sendEnd()},a.onack=function(t){t.code===Guacamole.Status.Code.SUCCESS&&!i?_():(w(),a.onack=null,t.code===Guacamole.Status.Code.RESOURCE_CLOSED?r.onclose&&r.onclose():r.onerror&&r.onerror())}},Guacamole.RawAudioRecorder.prototype=new Guacamole.AudioRecorder,Guacamole.RawAudioRecorder.isSupportedType=function(t){return!!Guacamole.AudioContextFactory.getAudioContext()&&Guacamole.RawAudioFormat.parse(t)!==null},Guacamole.RawAudioRecorder.getSupportedTypes=function(){return Guacamole.AudioContextFactory.getAudioContext()?["audio/L8","audio/L16"]:[]},Guacamole=Guacamole||{},Guacamole.BlobReader=function(e,t){var n,s=this,o=0;window.BlobBuilder?n=new BlobBuilder:window.WebKitBlobBuilder?n=new WebKitBlobBuilder:window.MozBlobBuilder?n=new MozBlobBuilder:n=new function(){var e=[];this.append=function(n){e.push(new Blob([n],{type:t}))},this.getBlob=function(){return new Blob(e,{type:t})}},e.onblob=function(t){for(var r=window.atob(t),i=new ArrayBuffer(r.length),c=new Uint8Array(i),a=0;a<r.length;a++)c[a]=r.charCodeAt(a);n.append(i),o+=i.byteLength,s.onprogress&&s.onprogress(i.byteLength),e.sendAck("OK",0)},e.onend=function(){s.onend&&s.onend()},this.getLength=function(){return o},this.getBlob=function(){return n.getBlob()},this.onprogress=null,this.onend=null},Guacamole=Guacamole||{},Guacamole.BlobWriter=function(t){var o,n=this,s=new Guacamole.ArrayBufferWriter(t);s.onack=function(e){n.onack&&n.onack(e)},o=function(t,n,s){var i,a=(t.slice||t.webkitSlice||t.mozSlice).bind(t),o=s-n;return o!==s&&(i=a(n,o),i.size===o)?i:a(n,s)},this.sendBlob=function(t){var i=0,a=new FileReader,r=function(){if(i>=t.size){n.oncomplete&&n.oncomplete(t);return}var r=o(t,i,i+s.blobLength);i+=s.blobLength,a.readAsArrayBuffer(r)};a.onload=function(){s.sendData(a.result),s.onack=function(o){if(n.onack&&n.onack(o),o.isError())return;n.onprogress&&n.onprogress(t,i-s.blobLength),r()}},a.onerror=function(){n.onerror&&n.onerror(t,i,a.error)},r()},this.sendEnd=function(){s.sendEnd()},this.onack=null,this.onerror=null,this.onprogress=null,this.oncomplete=null},Guacamole=Guacamole||{},Guacamole.Client=function(e){var s,h,m,j,_,x,k,t=this,E=0,A=1,f=2,O=3,y=4,b=5,a=E,d=0,T=5e3,g=null,w=0,F={0:"butt",1:"round",2:"square"},M={0:"bevel",1:"miter",2:"round"},n=new Guacamole.Display,i={},v={},z={},C=[],o=[],u=[],p=new Guacamole.IntegerPool,l=[];function c(e){e!=a&&(a=e,t.onstatechange&&t.onstatechange(a))}function r(){return a==O||a==f}this.exportState=function(t){var r,o={currentState:a,currentTimestamp:d,layers:{}},s={};for(r in i)s[r]=i[r];n.flush(function(){for(a in s){var a,c=parseInt(a),n=s[a],r=n.toCanvas(),i={width:n.width,height:n.height};n.width&&n.height&&(i.url=r.toDataURL("image/png")),c>0&&(i.x=n.x,i.y=n.y,i.z=n.z,i.alpha=n.alpha,i.matrix=n.matrix,i.parent=k(n.parent)),o.layers[a]=i}t(o)})},this.importState=function(t,o){a=t.currentState,d=t.currentTimestamp,n.cancel();for(u in i)h=parseInt(u),h>0&&i[u].dispose();i={};for(u in t.layers){h=parseInt(u);var l,u,h,m,r=t.layers[u],c=s(h);n.resize(c,r.width,r.height),r.url&&(n.setChannelMask(c,Guacamole.Layer.SRC),n.draw(c,0,0,r.url)),h>0&&r.parent>=0&&(m=s(r.parent),n.move(c,m,r.x,r.y,r.z),n.shade(c,r.alpha),l=r.matrix,n.distort(c,l[0],l[1],l[2],l[3],l[4],l[5]))}n.flush(o)},this.getDisplay=function(){return n},this.sendSize=function(t,n){if(!r())return;e.sendMessage("size",t,n)},this.sendKeyEvent=function(t,n){if(!r())return;e.sendMessage("key",n,t)},this.sendMouseState=function(s,o){if(!r())return;var i,a=s.x,c=s.y;o&&(a/=n.getScale(),c/=n.getScale()),n.moveCursor(Math.floor(a),Math.floor(c)),i=0,s.left&&(i|=1),s.middle&&(i|=2),s.right&&(i|=4),s.up&&(i|=8),s.down&&(i|=16),e.sendMessage("mouse",Math.floor(a),Math.floor(c),i)},this.sendTouchState=function(s,o){if(!r())return;var i=s.x,a=s.y;o&&(i/=n.getScale(),a/=n.getScale()),e.sendMessage("touch",s.id,Math.floor(i),Math.floor(a),Math.floor(s.radiusX),Math.floor(s.radiusY),s.angle,s.force)},this.createOutputStream=function(){var n=p.next(),s=l[n]=new Guacamole.OutputStream(t,n);return s},this.createAudioStream=function(n){var s=t.createOutputStream();return e.sendMessage("audio",s.index,n),s},this.createFileStream=function(n,s){var o=t.createOutputStream();return e.sendMessage("file",o.index,n,s),o},this.createPipeStream=function(n,s){var o=t.createOutputStream();return e.sendMessage("pipe",o.index,n,s),o},this.createClipboardStream=function(n){var s=t.createOutputStream();return e.sendMessage("clipboard",s.index,n),s},this.createArgumentValueStream=function(s,o){var i=t.createOutputStream();return e.sendMessage("argv",i.index,s,o),i},this.createObjectOutputStream=function(s,o,i){var a=t.createOutputStream();return e.sendMessage("put",s,a.index,o,i),a},this.requestObjectInputStream=function(n,s){if(!r())return;e.sendMessage("get",n,s)},this.sendAck=function(t,n,s){if(!r())return;e.sendMessage("ack",t,n,s)},this.sendBlob=function(t,n){if(!r())return;e.sendMessage("blob",t,n)},this.endStream=function(t){if(!r())return;e.sendMessage("end",t),l[t]&&(p.free(t),delete l[t])},this.onstatechange=null,this.onname=null,this.onerror=null,this.onmsg=null,this.onjoin=null,this.onleave=null,this.onaudio=null,this.onvideo=null,this.onmultitouch=null,this.onargv=null,this.onclipboard=null,this.onfile=null,this.onfilesystem=null,this.onpipe=null,this.onrequired=null,this.onsync=null,s=function(t){var s=i[t];return s||(t===0?s=n.getDefaultLayer():t>0?s=n.createLayer():s=n.createBuffer(),i[t]=s),s},k=function(t){if(!t)return null;for(var n in i)if(t===i[n])return parseInt(n);return null};function S(t){var n=C[t];return n==null&&(n=C[t]=new Guacamole.Parser,n.oninstruction=e.oninstruction),n}j={"miter-limit":function(e,t){n.setMiterLimit(e,parseFloat(t))},"multi-touch":function(n,s){t.onmultitouch&&n instanceof Guacamole.Display.VisibleLayer&&t.onmultitouch(n,parseInt(s))}},x={ack:function(e){var t=parseInt(e[0]),o=e[1],s=parseInt(e[2]),n=l[t];n&&(n.onack&&n.onack(new Guacamole.Status(s,o)),s>=256&&l[t]===n&&(p.free(t),delete l[t]))},arc:function(e){var t=s(parseInt(e[0])),o=parseInt(e[1]),i=parseInt(e[2]),a=parseInt(e[3]),r=parseFloat(e[4]),c=parseFloat(e[5]),l=parseInt(e[6]);n.arc(t,o,i,a,r,c,l!=0)},argv:function(e){var s,n=parseInt(e[0]),i=e[1],a=e[2];t.onargv?(s=o[n]=new Guacamole.InputStream(t,n),t.onargv(s,i,a)):t.sendAck(n,"Receiving argument values unsupported",256)},audio:function(e){var n=parseInt(e[0]),i=e[1],a=o[n]=new Guacamole.InputStream(t,n),s=null;t.onaudio&&(s=t.onaudio(a,i)),s||(s=Guacamole.AudioPlayer.getInstance(a,i)),s?(v[n]=s,t.sendAck(n,"OK",0)):t.sendAck(n,"BAD TYPE",783)},blob:function(e){var n=parseInt(e[0]),s=e[1],t=o[n];t&&t.onblob&&t.onblob(s)},body:function(n){var a,r=parseInt(n[0]),s=u[r],i=parseInt(n[1]),c=n[2],l=n[3];s&&s.onbody?(a=o[i]=new Guacamole.InputStream(t,i),s.onbody(a,c,l)):t.sendAck(i,"Receipt of body unsupported",256)},cfill:function(e){var o=parseInt(e[0]),t=s(parseInt(e[1])),i=parseInt(e[2]),a=parseInt(e[3]),r=parseInt(e[4]),c=parseInt(e[5]);n.setChannelMask(t,o),n.fillColor(t,i,a,r,c)},clip:function(e){var t=s(parseInt(e[0]));n.clip(t)},clipboard:function(e){var s,n=parseInt(e[0]),i=e[1];t.onclipboard?(s=o[n]=new Guacamole.InputStream(t,n),t.onclipboard(s,i)):t.sendAck(n,"Clipboard unsupported",256)},close:function(e){var t=s(parseInt(e[0]));n.close(t)},copy:function(e){var o=s(parseInt(e[0])),i=parseInt(e[1]),a=parseInt(e[2]),r=parseInt(e[3]),c=parseInt(e[4]),l=parseInt(e[5]),t=s(parseInt(e[6])),d=parseInt(e[7]),u=parseInt(e[8]);n.setChannelMask(t,l),n.copy(o,i,a,r,c,t,d,u)},cstroke:function(e){var o=parseInt(e[0]),t=s(parseInt(e[1])),i=F[parseInt(e[2])],a=M[parseInt(e[3])],r=parseInt(e[4]),c=parseInt(e[5]),l=parseInt(e[6]),d=parseInt(e[7]),u=parseInt(e[8]);n.setChannelMask(t,o),n.strokeColor(t,i,a,r,c,l,d,u)},cursor:function(e){var t=parseInt(e[0]),o=parseInt(e[1]),i=s(parseInt(e[2])),a=parseInt(e[3]),r=parseInt(e[4]),c=parseInt(e[5]),l=parseInt(e[6]);n.setCursor(t,o,i,a,r,c,l)},curve:function(e){var t=s(parseInt(e[0])),o=parseInt(e[1]),i=parseInt(e[2]),a=parseInt(e[3]),r=parseInt(e[4]),c=parseInt(e[5]),l=parseInt(e[6]);n.curveTo(t,o,i,a,r,c,l)},disconnect:function(){t.disconnect()},dispose:function(e){var o,t=parseInt(e[0]);t>0?(o=s(t),n.dispose(o),delete i[t]):t<0&&delete i[t]},distort:function(e){var o,t=parseInt(e[0]),i=parseFloat(e[1]),a=parseFloat(e[2]),r=parseFloat(e[3]),c=parseFloat(e[4]),l=parseFloat(e[5]),d=parseFloat(e[6]);t>=0&&(o=s(t),n.distort(o,i,a,r,c,l,d))},error:function(e){var n=e[0],s=parseInt(e[1]);t.onerror&&t.onerror(new Guacamole.Status(s,n)),t.disconnect()},end:function(e){var n=parseInt(e[0]),t=o[n];t&&(t.onend&&t.onend(),delete o[n])},file:function(e){var s,n=parseInt(e[0]),i=e[1],a=e[2];t.onfile?(s=o[n]=new Guacamole.InputStream(t,n),t.onfile(s,i,a)):t.sendAck(n,"File transfer unsupported",256)},filesystem:function(n){var o,s=parseInt(n[0]),i=n[1];t.onfilesystem&&(o=u[s]=new Guacamole.Object(t,s),t.onfilesystem(o,i))},identity:function(e){var t=s(parseInt(e[0]));n.setTransform(t,1,0,0,1,0,0)},img:function(e){var i=parseInt(e[0]),r=parseInt(e[1]),a=s(parseInt(e[2])),c=e[3],l=parseInt(e[4]),d=parseInt(e[5]),u=o[i]=new Guacamole.InputStream(t,i);n.setChannelMask(a,r),n.drawStream(a,l,d,u,c)},jpeg:function(e){var o=parseInt(e[0]),t=s(parseInt(e[1])),i=parseInt(e[2]),a=parseInt(e[3]),r=e[4];n.setChannelMask(t,o),n.draw(t,i,a,"data:image/jpeg;base64,"+r)},lfill:function(e){var o=parseInt(e[0]),t=s(parseInt(e[1])),i=s(parseInt(e[2]));n.setChannelMask(t,o),n.fillLayer(t,i)},line:function(e){var t=s(parseInt(e[0])),o=parseInt(e[1]),i=parseInt(e[2]);n.lineTo(t,o,i)},lstroke:function(e){var o=parseInt(e[0]),t=s(parseInt(e[1])),i=s(parseInt(e[2]));n.setChannelMask(t,o),n.strokeLayer(t,i)},mouse:function(t){var s=parseInt(t[0]),o=parseInt(t[1]);n.showCursor(!0),n.moveCursor(s,o)},move:function(e){var i,a,t=parseInt(e[0]),o=parseInt(e[1]),r=parseInt(e[2]),c=parseInt(e[3]),l=parseInt(e[4]);t>0&&o>=0&&(i=s(t),a=s(o),n.move(i,a,r,c,l))},msg:function(e){var n,s,o=!0,i=parseInt(e[0]);if(t.onmsg&&(o=t.onmsg(i,e.slice(1)),o===void 0&&(o=!0)),o)switch(i){case Guacamole.Client.Message.USER_JOINED:n=e[1],s=e[2],t.onjoin&&t.onjoin(n,s);break;case Guacamole.Client.Message.USER_LEFT:n=e[1],s=e[2],t.onleave&&t.onleave(n,s);break}},name:function(e){t.onname&&t.onname(e[0])},nest:function(e){var t=S(parseInt(e[0]));t.receive(e[1])},pipe:function(e){var s,n=parseInt(e[0]),i=e[1],a=e[2];t.onpipe?(s=o[n]=new Guacamole.InputStream(t,n),t.onpipe(s,i,a)):t.sendAck(n,"Named pipes unsupported",256)},png:function(e){var o=parseInt(e[0]),t=s(parseInt(e[1])),i=parseInt(e[2]),a=parseInt(e[3]),r=e[4];n.setChannelMask(t,o),n.draw(t,i,a,"data:image/png;base64,"+r)},pop:function(e){var t=s(parseInt(e[0]));n.pop(t)},push:function(e){var t=s(parseInt(e[0]));n.push(t)},rect:function(e){var t=s(parseInt(e[0])),o=parseInt(e[1]),i=parseInt(e[2]),a=parseInt(e[3]),r=parseInt(e[4]);n.rect(t,o,i,a,r)},required:function(n){t.onrequired&&t.onrequired(n)},reset:function(e){var t=s(parseInt(e[0]));n.reset(t)},set:function(e){var n=s(parseInt(e[0])),o=e[1],i=e[2],t=j[o];t&&t(n,i)},shade:function(e){var o,t=parseInt(e[0]),i=parseInt(e[1]);t>=0&&(o=s(t),n.shade(o,i))},size:function(e){var t=parseInt(e[0]),o=s(t),i=parseInt(e[1]),a=parseInt(e[2]);n.resize(o,i,a)},start:function(e){var t=s(parseInt(e[0])),o=parseInt(e[1]),i=parseInt(e[2]);n.moveTo(t,o,i)},sync:function(s){var o=parseInt(s[0]);n.flush(function(){for(s in v){var s,n=v[s];n&&n.sync()}o!==d&&(e.sendMessage("sync",o),d=o)}),a===f&&c(O),t.onsync&&t.onsync(o)},transfer:function(e){var o=s(parseInt(e[0])),i=parseInt(e[1]),a=parseInt(e[2]),r=parseInt(e[3]),c=parseInt(e[4]),t=parseInt(e[5]),l=s(parseInt(e[6])),d=parseInt(e[7]),u=parseInt(e[8]);t===3?n.put(o,i,a,r,c,l,d,u):t!==5&&n.transfer(o,i,a,r,c,l,d,u,Guacamole.Client.DefaultTransferFunction[t])},transform:function(e){var t=s(parseInt(e[0])),o=parseFloat(e[1]),i=parseFloat(e[2]),a=parseFloat(e[3]),r=parseFloat(e[4]),c=parseFloat(e[5]),l=parseFloat(e[6]);n.transform(t,o,i,a,r,c,l)},undefine:function(t){var s=parseInt(t[0]),n=u[s];n&&n.onundefine&&n.onundefine()},video:function(e){var n=parseInt(e[0]),a=s(parseInt(e[1])),r=e[2],c=o[n]=new Guacamole.InputStream(t,n),i=null;t.onvideo&&(i=t.onvideo(c,a,r)),i||(i=Guacamole.VideoPlayer.getInstance(c,a,r)),i?(z[n]=i,t.sendAck(n,"OK",0)):t.sendAck(n,"BAD TYPE",783)}},m=function(){e.sendMessage("nop"),w=(new Date).getTime()},h=function(){window.clearTimeout(g);var n=(new Date).getTime(),t=Math.max(w+T-n,0);t>0?g=window.setTimeout(m,t):m()},_=function(){window.clearTimeout(g)},e.oninstruction=function(e,t){var n=x[e];n&&n(t),h()},this.disconnect=function(){a!=b&&a!=y&&(c(y),_(),e.sendMessage("disconnect"),e.disconnect(),c(b))},this.connect=function(t){c(A);try{e.connect(t)}catch(e){throw c(E),e}h(),c(f)}},Guacamole.Client.DefaultTransferFunction={0x0:function(e,t){t.red=t.green=t.blue=0},0xF:function(e,t){t.red=t.green=t.blue=255},0x3:function(e,t){t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha},0x5:function(){},0xC:function(e,t){t.red=255&~e.red,t.green=255&~e.green,t.blue=255&~e.blue,t.alpha=e.alpha},0xA:function(e,t){t.red=255&~t.red,t.green=255&~t.green,t.blue=255&~t.blue},0x1:function(e,t){t.red=e.red&t.red,t.green=e.green&t.green,t.blue=e.blue&t.blue},0xE:function(e,t){t.red=255&~(e.red&t.red),t.green=255&~(e.green&t.green),t.blue=255&~(e.blue&t.blue)},0x7:function(e,t){t.red=e.red|t.red,t.green=e.green|t.green,t.blue=e.blue|t.blue},0x8:function(e,t){t.red=255&~(e.red|t.red),t.green=255&~(e.green|t.green),t.blue=255&~(e.blue|t.blue)},0x6:function(e,t){t.red=e.red^t.red,t.green=e.green^t.green,t.blue=e.blue^t.blue},0x9:function(e,t){t.red=255&~(e.red^t.red),t.green=255&~(e.green^t.green),t.blue=255&~(e.blue^t.blue)},0x4:function(e,t){t.red=255&(~e.red&t.red),t.green=255&(~e.green&t.green),t.blue=255&(~e.blue&t.blue)},0xD:function(e,t){t.red=255&(~e.red|t.red),t.green=255&(~e.green|t.green),t.blue=255&(~e.blue|t.blue)},0x2:function(e,t){t.red=255&(e.red&~t.red),t.green=255&(e.green&~t.green),t.blue=255&(e.blue&~t.blue)},0xB:function(e,t){t.red=255&(e.red|~t.red),t.green=255&(e.green|~t.green),t.blue=255&(e.blue|~t.blue)}},Guacamole.Client.Message={USER_JOINED:1,USER_LEFT:2},Guacamole=Guacamole||{},Guacamole.DataURIReader=function(e,t){var n=this,s="data:"+t+";base64,";e.onblob=function(t){s+=t},e.onend=function(){n.onend&&n.onend()},this.getURI=function(){return s},this.onend=null},Guacamole=Guacamole||{},Guacamole.Display=function(){var s,a,c,l,d,n=this,o=0,i=0,r=1,t=document.createElement("div");t.style.position="relative",t.style.width=o+"px",t.style.height=i+"px",t.style.transformOrigin=t.style.webkitTransformOrigin=t.style.MozTransformOrigin=t.style.OTransformOrigin=t.style.msTransformOrigin="0 0",c=new Guacamole.Display.VisibleLayer(o,i),a=new Guacamole.Display.VisibleLayer(0,0),a.setChannelMask(Guacamole.Layer.SRC),t.appendChild(c.getElement()),t.appendChild(a.getElement()),s=document.createElement("div"),s.style.position="relative",s.style.width=o*r+"px",s.style.height=i*r+"px",s.appendChild(t),this.cursorHotspotX=0,this.cursorHotspotY=0,this.cursorX=0,this.cursorY=0,this.onresize=null,this.oncursor=null,d=[],l=[];function u(){for(var t,e=0;e<l.length;){if(t=l[e],!t.isReady())break;t.flush(),e++}l.splice(0,e)}function h(e,t){this.cancel=function(){e=null,t.forEach(function(t){t.cancel()}),t=[]},this.isReady=function(){for(var e=0;e<t.length;e++)if(t[e].blocked)return!1;return!0},this.flush=function(){for(var n=0;n<t.length;n++)t[n].execute();e&&e()}}function m(e,t){var n=this;this.blocked=t,this.cancel=function(){n.blocked=!1,e=null},this.unblock=function(){n.blocked&&(n.blocked=!1,u())},this.execute=function(){e&&e()}}function e(e,t){var n=new m(e,t);return d.push(n),n}this.getElement=function(){return s},this.getWidth=function(){return o},this.getHeight=function(){return i},this.getDefaultLayer=function(){return c},this.getCursorLayer=function(){return a},this.createLayer=function(){var e=new Guacamole.Display.VisibleLayer(o,i);return e.move(c,0,0,0),e},this.createBuffer=function(){var e=new Guacamole.Layer(0,0);return e.autosize=1,e},this.flush=function(e){l.push(new h(e,d)),d=[],u()},this.cancel=function(){l.forEach(function(t){t.cancel()}),l=[],d.forEach(function(t){t.cancel()}),d=[]},this.setCursor=function(t,s,o,i,r,c,l){e(function(){n.cursorHotspotX=t,n.cursorHotspotY=s,a.resize(c,l),a.copy(o,i,r,c,l,0,0),n.moveCursor(n.cursorX,n.cursorY),n.oncursor&&n.oncursor(a.toCanvas(),t,s)})},this.showCursor=function(e){var n=a.getElement(),s=n.parentNode;e===!1?s&&s.removeChild(n):s!==t&&t.appendChild(n)},this.moveCursor=function(e,t){a.translate(e-n.cursorHotspotX,t-n.cursorHotspotY),n.cursorX=e,n.cursorY=t},this.resize=function(a,l,d){e(function(){a.resize(l,d),a===c&&(o=l,i=d,t.style.width=o+"px",t.style.height=i+"px",s.style.width=o*r+"px",s.style.height=i*r+"px",n.onresize&&n.onresize(l,d))})},this.drawImage=function(t,n,s,o){e(function(){t.drawImage(n,s,o)})},this.drawBlob=function(t,n,s,o){if(window.createImageBitmap)a=e(function(){t.drawImage(n,s,r)},!0),window.createImageBitmap(o).then(function(t){r=t,a.unblock()});else{var i,a,r,c=URL.createObjectURL(o);a=e(function(){i.width&&i.height&&t.drawImage(n,s,i),URL.revokeObjectURL(c)},!0),i=new Image,i.onload=a.unblock,i.onerror=a.unblock,i.src=c}},this.drawStream=function(t,s,o,i,a){if(window.createImageBitmap){var r=new Guacamole.BlobReader(i,a);r.onend=function(){n.drawBlob(t,s,o,r.getBlob())}}else r=new Guacamole.DataURIReader(i,a),r.onend=function(){n.draw(t,s,o,r.getURI())}},this.draw=function(t,n,s,o){var a=e(function(){i.width&&i.height&&t.drawImage(n,s,i)},!0),i=new Image;i.onload=a.unblock,i.onerror=a.unblock,i.src=o},this.play=function(t,n,s,o){var i=document.createElement("video");i.type=n,i.src=o,i.addEventListener("play",function(){function e(){t.drawImage(0,0,i),i.ended||window.setTimeout(e,20)}e()},!1),e(i.play)},this.transfer=function(t,n,s,o,i,a,r,c,l){e(function(){a.transfer(t,n,s,o,i,r,c,l)})},this.put=function(t,n,s,o,i,a,r,c){e(function(){a.put(t,n,s,o,i,r,c)})},this.copy=function(t,n,s,o,i,a,r,c){e(function(){a.copy(t,n,s,o,i,r,c)})},this.moveTo=function(t,n,s){e(function(){t.moveTo(n,s)})},this.lineTo=function(t,n,s){e(function(){t.lineTo(n,s)})},this.arc=function(t,n,s,o,i,a,r){e(function(){t.arc(n,s,o,i,a,r)})},this.curveTo=function(t,n,s,o,i,a,r){e(function(){t.curveTo(n,s,o,i,a,r)})},this.close=function(t){e(function(){t.close()})},this.rect=function(t,n,s,o,i){e(function(){t.rect(n,s,o,i)})},this.clip=function(t){e(function(){t.clip()})},this.strokeColor=function(t,n,s,o,i,a,r,c){e(function(){t.strokeColor(n,s,o,i,a,r,c)})},this.fillColor=function(t,n,s,o,i){e(function(){t.fillColor(n,s,o,i)})},this.strokeLayer=function(t,n,s,o,i){e(function(){t.strokeLayer(n,s,o,i)})},this.fillLayer=function(t,n){e(function(){t.fillLayer(n)})},this.push=function(t){e(function(){t.push()})},this.pop=function(t){e(function(){t.pop()})},this.reset=function(t){e(function(){t.reset()})},this.setTransform=function(t,n,s,o,i,a,r){e(function(){t.setTransform(n,s,o,i,a,r)})},this.transform=function(t,n,s,o,i,a,r){e(function(){t.transform(n,s,o,i,a,r)})},this.setChannelMask=function(t,n){e(function(){t.setChannelMask(n)})},this.setMiterLimit=function(t,n){e(function(){t.setMiterLimit(n)})},this.dispose=function(n){e(function(){n.dispose()})},this.distort=function(n,s,o,i,a,r,c){e(function(){n.distort(s,o,i,a,r,c)})},this.move=function(n,s,o,i,a){e(function(){n.move(s,o,i,a)})},this.shade=function(n,s){e(function(){n.shade(s)})},this.scale=function(e){t.style.transform=t.style.WebkitTransform=t.style.MozTransform=t.style.OTransform=t.style.msTransform="scale("+e+","+e+")",r=e,s.style.width=o*r+"px",s.style.height=i*r+"px"},this.getScale=function(){return r},this.flatten=function(){var e,t=document.createElement("canvas");t.width=c.width,t.height=c.height,e=t.getContext("2d");function s(e){var n,t=[];for(n in e.children)t.push(e.children[n]);return t.sort(function(t,n){var s,i,a,o=t.z-n.z;return o!==0?o:(i=t.getElement(),a=n.getElement(),s=a.compareDocumentPosition(i),s&Node.DOCUMENT_POSITION_PRECEDING?-1:s&Node.DOCUMENT_POSITION_FOLLOWING?1:0)}),t}function n(t,o,i){if(t.width>0&&t.height>0){var a,r,c,l=e.globalAlpha;e.globalAlpha*=t.alpha/255,e.drawImage(t.getCanvas(),o,i);for(c=s(t),a=0;a<c.length;a++)r=c[a],n(r,o+r.x,i+r.y);e.globalAlpha=l}}return n(c,0,0),t}},Guacamole.Display.VisibleLayer=function(e,t){Guacamole.Layer.apply(this,[e,t]);var n,o,i,a,r,s=this;this.__unique_id=Guacamole.Display.VisibleLayer.__next_id++,this.alpha=255,this.x=0,this.y=0,this.z=0,this.matrix=[1,0,0,1,0,0],this.parent=null,this.children={},o=s.getCanvas(),o.style.position="absolute",o.style.left="0px",o.style.top="0px",n=document.createElement("div"),n.appendChild(o),n.style.width=e+"px",n.style.height=t+"px",n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.overflow="hidden",r=this.resize,this.resize=function(e,t){n.style.width=e+"px",n.style.height=t+"px",r(e,t)},this.getElement=function(){return n},i="translate(0px, 0px)",a="matrix(1, 0, 0, 1, 0, 0)",this.translate=function(e,t){s.x=e,s.y=t,i="translate("+e+"px,"+t+"px)",n.style.transform=n.style.WebkitTransform=n.style.MozTransform=n.style.OTransform=n.style.msTransform=i+" "+a},this.move=function(e,t,o,i){if(s.parent!==e){s.parent&&delete s.parent.children[s.__unique_id],s.parent=e,e.children[s.__unique_id]=s;var a=e.getElement();a.appendChild(n)}s.translate(t,o),s.z=i,n.style.zIndex=i},this.shade=function(e){s.alpha=e,n.style.opacity=e/255},this.dispose=function(){s.parent&&(delete s.parent.children[s.__unique_id],s.parent=null),n.parentNode&&n.parentNode.removeChild(n)},this.distort=function(e,t,o,r,c,l){s.matrix=[e,t,o,r,c,l],a="matrix("+e+","+t+","+o+","+r+","+c+","+l+")",n.style.transform=n.style.WebkitTransform=n.style.MozTransform=n.style.OTransform=n.style.msTransform=i+" "+a}},Guacamole.Display.VisibleLayer.__next_id=0,Guacamole=Guacamole||{},Guacamole.Event=function(t){this.type=t,this.timestamp=(new Date).getTime(),this.getAge=function(){return(new Date).getTime()-this.timestamp},this.invokeLegacyHandler=function(){}},Guacamole.Event.DOMEvent=function(t,n){Guacamole.Event.call(this,t),n=n||[],Array.isArray(n)||(n=[n]),this.preventDefault=function(){n.forEach(function(t){t.preventDefault&&t.preventDefault(),t.returnValue=!1})},this.stopPropagation=function(){n.forEach(function(t){t.stopPropagation()})}},Guacamole.Event.DOMEvent.cancelEvent=function(t){t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1},Guacamole.Event.Target=function(){var t={};this.on=function(n,s){var o=t[n];o||(t[n]=o=[]),o.push(s)},this.onEach=function(t,n){t.forEach(function(t){this.on(t,n)},this)},this.dispatch=function(n){n.invokeLegacyHandler(this);var s,o=t[n.type];if(o)for(s=0;s<o.length;s++)o[s](n,this)},this.off=function(n,s){var o,i=t[n];if(!i)return!1;for(o=0;o<i.length;o++)if(i[o]===s)return i.splice(o,1),!0;return!1},this.offEach=function(t,n){var s=!1;return t.forEach(function(t){s|=this.off(t,n)},this),s}},Guacamole=Guacamole||{},Guacamole.InputSink=function(){var n=this,t=document.createElement("textarea");t.style.position="fixed",t.style.outline="none",t.style.border="none",t.style.margin="0",t.style.padding="0",t.style.height="0",t.style.width="0",t.style.left="0",t.style.bottom="0",t.style.resize="none",t.style.background="transparent",t.style.color="transparent",t.addEventListener("keypress",function(){t.value=""},!1),t.addEventListener("compositionend",function(n){n.data&&(t.value="")},!1),t.addEventListener("input",function(n){n.data&&!n.isComposing&&(t.value="")},!1),t.addEventListener("focus",function(){window.setTimeout(function(){t.click(),t.select()},0)},!0),this.focus=function(){window.setTimeout(function(){t.focus()},0)},this.getElement=function(){return t},document.addEventListener("keydown",function(){var s,o=document.activeElement;if(o&&o!==document.body&&(s=o.getBoundingClientRect(),s.left+s.width>0&&s.top+s.height>0))return;n.focus()},!0)},Guacamole=Guacamole||{},Guacamole.InputStream=function(e,t){var n=this;this.index=t,this.onblob=null,this.onend=null,this.sendAck=function(t,s){e.sendAck(n.index,t,s)}},Guacamole=Guacamole||{},Guacamole.IntegerPool=function(){var t=this,e=[];this.next_int=0,this.next=function(){return e.length>0?e.shift():t.next_int++},this.free=function(t){e.push(t)}},Guacamole=Guacamole||{},Guacamole.JSONReader=function(t){var n=this,o=new Guacamole.StringReader(t),s="";this.getLength=function(){return s.length},this.getJSON=function(){return JSON.parse(s)},o.ontext=function(t){s+=t,n.onprogress&&n.onprogress(t.length)},o.onend=function(){n.onend&&n.onend()},this.onprogress=null,this.onend=null},Guacamole=Guacamole||{},Guacamole.Keyboard=function(t){var s,o,i,a,r,c,l,d,u,h,m,f,g,b,j,y,w,x,C,E,k,A,S,M,n=this,z=Guacamole.Keyboard._nextID++,F="_GUAC_KEYBOARD_HANDLED_BY_"+z;this.onkeydown=null,this.onkeyup=null,o={keyupUnreliable:!1,altIsTypableOnly:!1,capsLockKeyupUnreliable:!1},navigator&&navigator.platform&&(navigator.platform.match(/ipad|iphone|ipod/i)?o.keyupUnreliable=!0:navigator.platform.match(/^mac/i)&&(o.altIsTypableOnly=!0,o.capsLockKeyupUnreliable=!0)),i=function(t){var n=this;this.keyCode=t?t.which||t.keyCode:0,this.keyIdentifier=t&&t.keyIdentifier,this.key=t&&t.key,this.location=t?M(t):0,this.modifiers=t?Guacamole.Keyboard.ModifierState.fromKeyboardEvent(t):new Guacamole.Keyboard.ModifierState,this.timestamp=(new Date).getTime(),this.defaultPrevented=!1,this.keysym=null,this.reliable=!1,this.getAge=function(){return(new Date).getTime()-n.timestamp}},c=function(t){i.call(this,t),this.keysym=_(this.key,this.location)||O(this.keyCode,this.location),this.keyupReliable=!o.keyupUnreliable,this.keysym&&!C(this.keysym)&&(this.reliable=!0),!this.keysym&&x(this.keyCode,this.keyIdentifier)&&(this.keysym=_(this.keyIdentifier,this.location,this.modifiers.shift)),this.modifiers.meta&&this.keysym!==65511&&this.keysym!==65512?this.keyupReliable=!1:this.keysym===65509&&o.capsLockKeyupUnreliable&&(this.keyupReliable=!1);var n=!this.modifiers.ctrl&&!o.altIsTypableOnly,s=!this.modifiers.alt;(s&&this.modifiers.ctrl||n&&this.modifiers.alt||this.modifiers.meta||this.modifiers.hyper)&&(this.reliable=!0),l[this.keyCode]=this.keysym},c.prototype=new i,d=function(t){i.call(this,t),this.keysym=v(this.keyCode),this.reliable=!0},d.prototype=new i,h=function(t){i.call(this,t),this.keysym=O(this.keyCode,this.location)||_(this.key,this.location),n.pressed[this.keysym]||(this.keysym=l[this.keyCode]||this.keysym),this.reliable=!0},h.prototype=new i,s=[],S={8:[65288],9:[65289],12:[65291,65291,65291,65461],13:[65293],16:[65505,65505,65506],17:[65507,65507,65508],18:[65513,65513,65027],19:[65299],20:[65509],27:[65307],32:[32],33:[65365,65365,65365,65465],34:[65366,65366,65366,65459],35:[65367,65367,65367,65457],36:[65360,65360,65360,65463],37:[65361,65361,65361,65460],38:[65362,65362,65362,65464],39:[65363,65363,65363,65462],40:[65364,65364,65364,65458],45:[65379,65379,65379,65456],46:[65535,65535,65535,65454],91:[65511],92:[65512],93:[65383],96:[65456],97:[65457],98:[65458],99:[65459],100:[65460],101:[65461],102:[65462],103:[65463],104:[65464],105:[65465],106:[65450],107:[65451],109:[65453],110:[65454],111:[65455],112:[65470],113:[65471],114:[65472],115:[65473],116:[65474],117:[65475],118:[65476],119:[65477],120:[65478],121:[65479],122:[65480],123:[65481],144:[65407],145:[65300],225:[65027]},k={Again:[65382],AllCandidates:[65341],Alphanumeric:[65328],Alt:[65513,65513,65027],Attn:[64782],AltGraph:[65027],ArrowDown:[65364],ArrowLeft:[65361],ArrowRight:[65363],ArrowUp:[65362],Backspace:[65288],CapsLock:[65509],Cancel:[65385],Clear:[65291],Convert:[65313],Copy:[64789],Crsel:[64796],CrSel:[64796],CodeInput:[65335],Compose:[65312],Control:[65507,65507,65508],ContextMenu:[65383],Delete:[65535],Down:[65364],End:[65367],Enter:[65293],EraseEof:[64774],Escape:[65307],Execute:[65378],Exsel:[64797],ExSel:[64797],F1:[65470],F2:[65471],F3:[65472],F4:[65473],F5:[65474],F6:[65475],F7:[65476],F8:[65477],F9:[65478],F10:[65479],F11:[65480],F12:[65481],F13:[65482],F14:[65483],F15:[65484],F16:[65485],F17:[65486],F18:[65487],F19:[65488],F20:[65489],F21:[65490],F22:[65491],F23:[65492],F24:[65493],Find:[65384],GroupFirst:[65036],GroupLast:[65038],GroupNext:[65032],GroupPrevious:[65034],FullWidth:null,HalfWidth:null,HangulMode:[65329],Hankaku:[65321],HanjaMode:[65332],Help:[65386],Hiragana:[65317],HiraganaKatakana:[65319],Home:[65360],Hyper:[65517,65517,65518],Insert:[65379],JapaneseHiragana:[65317],JapaneseKatakana:[65318],JapaneseRomaji:[65316],JunjaMode:[65336],KanaMode:[65325],KanjiMode:[65313],Katakana:[65318],Left:[65361],Meta:[65511,65511,65512],ModeChange:[65406],NumLock:[65407],PageDown:[65366],PageUp:[65365],Pause:[65299],Play:[64790],PreviousCandidate:[65342],PrintScreen:[65377],Redo:[65382],Right:[65363],RomanCharacters:null,Scroll:[65300],Select:[65376],Separator:[65452],Shift:[65505,65505,65506],SingleCandidate:[65340],Super:[65515,65515,65516],Tab:[65289],UIKeyInputDownArrow:[65364],UIKeyInputEscape:[65307],UIKeyInputLeftArrow:[65361],UIKeyInputRightArrow:[65363],UIKeyInputUpArrow:[65362],Up:[65362],Undo:[65381],Win:[65511,65511,65512],Zenkaku:[65320],ZenkakuHankaku:[65322]},w={0xFE03:!0,0xFFE1:!0,0xFFE2:!0,0xFFE3:!0,0xFFE4:!0,0xFFE5:!0,0xFFE7:!0,0xFFE8:!0,0xFFE9:!0,0xFFEA:!0,0xFFEB:!0,0xFFEC:!0},this.modifiers=new Guacamole.Keyboard.ModifierState,this.pressed={},f={},g={},l={},m=null,u=null,j=function(t,n){return t?t[n]||t[0]:null},C=function(t){return t>=0&&t<=255||(t&4294901760)===16777216};function _(e,t,n){if(!e)return null;var s,i,a,o=e.indexOf("U+");if(o>=0)i=e.substring(o+2),s=String.fromCharCode(parseInt(i,16));else if(e.length===1&&t!==3)s=e;else return j(k[e],t);return n===!0?s=s.toUpperCase():n===!1&&(s=s.toLowerCase()),a=s.charCodeAt(0),v(a)}function T(e){return e<=31||e>=127&&e<=159}function v(e){return T(e)?65280|e:e>=0&&e<=255?e:e>=256&&e<=1114111?16777216|e:null}function O(e,t){return j(S[e],t)}x=function(t,n){if(!n)return!1;var o,s=n.indexOf("U+");return s===-1||(o=parseInt(n.substring(s+2),16),t!==o||t>=65&&t<=90||t>=48&&t<=57)},this.press=function(e){if(e===null)return;if(!n.pressed[e]&&(n.pressed[e]=!0,n.onkeydown)){var t=n.onkeydown(e);return g[e]=t,window.clearTimeout(m),window.clearInterval(u),w[e]||(m=window.setTimeout(function(){u=window.setInterval(function(){n.onkeyup(e),n.onkeydown(e)},50)},500)),t}return g[e]||!1},this.release=function(e){n.pressed[e]&&(delete n.pressed[e],delete f[e],window.clearTimeout(m),window.clearInterval(u),e!==null&&n.onkeyup&&n.onkeyup(e))},this.type=function(t){for(var o,i,s=0;s<t.length;s++)i=t.codePointAt?t.codePointAt(s):t.charCodeAt(s),o=v(i),n.press(o),n.release(o)},this.reset=function(){for(var e in n.pressed)n.release(parseInt(e));s=[]},a=function(t,s,o){var i,a,r=o.modifiers[t],c=n.modifiers[t];if(s.indexOf(o.keysym)!==-1)return;if(c&&r===!1)for(i=0;i<s.length;i++)n.release(s[i]);else if(!c&&r){for(i=0;i<s.length;i++)if(n.pressed[s[i]])return;a=s[0],o.keysym&&(f[a]=!0),n.press(a)}},y=function(t){a("alt",[65513,65514,65027],t),a("shift",[65505,65506],t),a("ctrl",[65507,65508],t),a("meta",[65511,65512],t),a("hyper",[65515,65516],t),n.modifiers=t.modifiers},E=function(){for(var t in n.pressed)if(!f[t])return!1;return!0};function p(){var t,e=b();if(!e)return!1;do t=e,e=b();while(e!==null)return E()&&n.reset(),t.defaultPrevented}A=function(t){if(!n.modifiers.ctrl||!n.modifiers.alt)return;if(t>=65&&t<=90)return;if(t>=97&&t<=122)return;(t<=255||(t&4278190080)===16777216)&&(n.release(65507),n.release(65508),n.release(65513),n.release(65514))},b=function(){var i,a,r,u,t=s[0];if(!t)return null;if(t instanceof c){{if(i=null,a=[],t.keysym===65511||t.keysym===65512){if(s.length===1)return null;if(s[1].keysym!==t.keysym){if(!s[1].modifiers.meta)return s.shift()}else if(s[1]instanceof c)return s.shift()}if(t.reliable?(i=t.keysym,a=s.splice(0,1)):s[1]instanceof d?(i=s[1].keysym,a=s.splice(0,2)):s[1]&&(i=t.keysym,a=s.splice(0,1)),a.length>0){if(y(t),i){A(i),u=!n.press(i),l[t.keyCode]=i,t.keyupReliable||n.release(i);for(r=0;r<a.length;r++)a[r].defaultPrevented=u}return t}}}else if(t instanceof h&&!o.keyupUnreliable){if(i=t.keysym,i)n.release(i),delete l[t.keyCode],t.defaultPrevented=!0;else return n.reset(),t;return y(t),s.shift()}else return s.shift();return null},M=function(t){return"location"in t?t.location:"keyLocation"in t?t.keyLocation:0},r=function(t){return!t[F]&&(t[F]=!0,!0)},this.listenTo=function(t){t.addEventListener("keydown",function(e){if(!n.onkeydown)return;if(!r(e))return;var t=new c(e);if(t.keyCode===229)return;s.push(t),p()&&e.preventDefault()},!0),t.addEventListener("keypress",function(e){if(!n.onkeydown&&!n.onkeyup)return;if(!r(e))return;s.push(new d(e)),p()&&e.preventDefault()},!0),t.addEventListener("keyup",function(e){if(!n.onkeyup)return;if(!r(e))return;e.preventDefault(),s.push(new h(e)),p()},!0);var o=function(s){if(!n.onkeydown&&!n.onkeyup)return;if(!r(s))return;s.data&&!s.isComposing&&(t.removeEventListener("compositionend",i,!1),n.type(s.data))},i=function(s){if(!n.onkeydown&&!n.onkeyup)return;if(!r(s))return;s.data&&(t.removeEventListener("input",o,!1),n.type(s.data))};t.addEventListener("input",o,!1),t.addEventListener("compositionend",i,!1)},t&&n.listenTo(t)},Guacamole.Keyboard._nextID=0,Guacamole.Keyboard.ModifierState=function(){this.shift=!1,this.ctrl=!1,this.alt=!1,this.meta=!1,this.hyper=!1},Guacamole.Keyboard.ModifierState.fromKeyboardEvent=function(e){var t=new Guacamole.Keyboard.ModifierState;return t.shift=e.shiftKey,t.ctrl=e.ctrlKey,t.alt=e.altKey,t.meta=e.metaKey,e.getModifierState&&(t.hyper=e.getModifierState("OS")||e.getModifierState("Super")||e.getModifierState("Hyper")||e.getModifierState("Win")),t},Guacamole=Guacamole||{},Guacamole.Layer=function(e,t){var o,a,c,d,u,s=this,l=64,i=document.createElement("canvas"),n=i.getContext("2d");n.save(),a=!0,o=!0,c=0,u={0x1:"destination-in",0x2:"destination-out",0x4:"source-in",0x6:"source-atop",0x8:"source-out",0x9:"destination-atop",0xA:"xor",0xB:"destination-over",0xC:"copy",0xE:"source-over",0xF:"lighter"},d=function(t,o){t=t||0,o=o||0;var r,h,m,d=Math.ceil(t/l)*l,u=Math.ceil(o/l)*l;i.width!==d||i.height!==u?(r=null,!a&&i.width!==0&&i.height!==0&&(r=document.createElement("canvas"),r.width=Math.min(s.width,t),r.height=Math.min(s.height,o),h=r.getContext("2d"),h.drawImage(i,0,0,r.width,r.height,0,0,r.width,r.height)),m=n.globalCompositeOperation,i.width=d,i.height=u,r&&n.drawImage(r,0,0,r.width,r.height,0,0,r.width,r.height),n.globalCompositeOperation=m,c=0,n.save()):s.reset(),s.width=t,s.height=o};function r(e,t,n,o){var i,a,r=n+e,c=o+t;r>s.width?i=r:i=s.width,c>s.height?a=c:a=s.height,s.resize(i,a)}this.autosize=!1,this.width=e,this.height=t,this.getCanvas=function(){return i},this.toCanvas=function(){var n,t=document.createElement("canvas");return t.width=s.width,t.height=s.height,n=t.getContext("2d"),n.drawImage(s.getCanvas(),0,0),t},this.resize=function(e,t){(e!==s.width||t!==s.height)&&d(e,t)},this.drawImage=function(e,t,o){s.autosize&&r(e,t,o.width,o.height),n.drawImage(o,e,t),a=!1},this.transfer=function(e,t,o,i,c,l,d,u){var h,m,p,g,v,f=e.getCanvas();if(t>=f.width||o>=f.height)return;if(t+i>f.width&&(i=f.width-t),o+c>f.height&&(c=f.height-o),i===0||c===0)return;s.autosize&&r(l,d,i,c);for(g=e.getCanvas().getContext("2d").getImageData(t,o,i,c),m=n.getImageData(l,d,i,c),h=0;h<i*c*4;h+=4)v=new Guacamole.Layer.Pixel(g.data[h],g.data[h+1],g.data[h+2],g.data[h+3]),p=new Guacamole.Layer.Pixel(m.data[h],m.data[h+1],m.data[h+2],m.data[h+3]),u(v,p),m.data[h]=p.red,m.data[h+1]=p.green,m.data[h+2]=p.blue,m.data[h+3]=p.alpha;n.putImageData(m,l,d),a=!1},this.put=function(e,t,o,i,c,l,d){var h,u=e.getCanvas();if(t>=u.width||o>=u.height)return;if(t+i>u.width&&(i=u.width-t),o+c>u.height&&(c=u.height-o),i===0||c===0)return;s.autosize&&r(l,d,i,c),h=e.getCanvas().getContext("2d").getImageData(t,o,i,c),n.putImageData(h,l,d),a=!1},this.copy=function(e,t,o,i,c,l,d){var u=e.getCanvas();if(t>=u.width||o>=u.height)return;if(t+i>u.width&&(i=u.width-t),o+c>u.height&&(c=u.height-o),i===0||c===0)return;s.autosize&&r(l,d,i,c),n.drawImage(u,t,o,i,c,l,d,i,c),a=!1},this.moveTo=function(e,t){o&&(n.beginPath(),o=!1),s.autosize&&r(e,t,0,0),n.moveTo(e,t)},this.lineTo=function(e,t){o&&(n.beginPath(),o=!1),s.autosize&&r(e,t,0,0),n.lineTo(e,t)},this.arc=function(e,t,i,a,c,l){o&&(n.beginPath(),o=!1),s.autosize&&r(e,t,0,0),n.arc(e,t,i,a,c,l)},this.curveTo=function(e,t,i,a,c,l){o&&(n.beginPath(),o=!1),s.autosize&&r(c,l,0,0),n.bezierCurveTo(e,t,i,a,c,l)},this.close=function(){n.closePath(),o=!0},this.rect=function(e,t,i,a){o&&(n.beginPath(),o=!1),s.autosize&&r(e,t,i,a),n.rect(e,t,i,a)},this.clip=function(){n.clip(),o=!0},this.strokeColor=function(e,t,s,i,r,c,l){n.lineCap=e,n.lineJoin=t,n.lineWidth=s,n.strokeStyle="rgba("+i+","+r+","+c+","+l/255+")",n.stroke(),a=!1,o=!0},this.fillColor=function(e,t,s,i){n.fillStyle="rgba("+e+","+t+","+s+","+i/255+")",n.fill(),a=!1,o=!0},this.strokeLayer=function(e,t,s,i){n.lineCap=e,n.lineJoin=t,n.lineWidth=s,n.strokeStyle=n.createPattern(i.getCanvas(),"repeat"),n.stroke(),a=!1,o=!0},this.fillLayer=function(e){n.fillStyle=n.createPattern(e.getCanvas(),"repeat"),n.fill(),a=!1,o=!0},this.push=function(){n.save(),c++},this.pop=function(){c>0&&(n.restore(),c--)},this.reset=function(){for(;c>0;)n.restore(),c--;n.restore(),n.save(),n.beginPath(),o=!1},this.setTransform=function(e,t,s,o,i,a){n.setTransform(e,t,s,o,i,a)},this.transform=function(e,t,s,o,i,a){n.transform(e,t,s,o,i,a)},this.setChannelMask=function(e){n.globalCompositeOperation=u[e]},this.setMiterLimit=function(e){n.miterLimit=e},d(e,t),i.style.zIndex=-1},Guacamole.Layer.ROUT=2,Guacamole.Layer.ATOP=6,Guacamole.Layer.XOR=10,Guacamole.Layer.ROVER=11,Guacamole.Layer.OVER=14,Guacamole.Layer.PLUS=15,Guacamole.Layer.RIN=1,Guacamole.Layer.IN=4,Guacamole.Layer.OUT=8,Guacamole.Layer.RATOP=9,Guacamole.Layer.SRC=12,Guacamole.Layer.Pixel=function(e,t,n,s){this.red=e,this.green=t,this.blue=n,this.alpha=s},Guacamole=Guacamole||{},Guacamole.Mouse=function(t){Guacamole.Mouse.Event.Target.call(this);var s,o,i,c,n=this;this.touchMouseThreshold=3,this.scrollThreshold=53,this.PIXELS_PER_LINE=18,this.PIXELS_PER_PAGE=this.PIXELS_PER_LINE*16,i=[Guacamole.Mouse.State.Buttons.LEFT,Guacamole.Mouse.State.Buttons.MIDDLE,Guacamole.Mouse.State.Buttons.RIGHT],o=0,s=0,t.addEventListener("contextmenu",function(e){Guacamole.Event.DOMEvent.cancelEvent(e)},!1),t.addEventListener("mousemove",function(e){if(o){Guacamole.Event.DOMEvent.cancelEvent(e),o--;return}n.move(Guacamole.Position.fromClientPosition(t,e.clientX,e.clientY),e)},!1),t.addEventListener("mousedown",function(e){if(o){Guacamole.Event.DOMEvent.cancelEvent(e);return}var t=i[e.button];t&&n.press(t,e)},!1),t.addEventListener("mouseup",function(e){if(o){Guacamole.Event.DOMEvent.cancelEvent(e);return}var t=i[e.button];t&&n.release(t,e)},!1),t.addEventListener("mouseout",function(e){e||(e=window.event);for(var s=e.relatedTarget||e.toElement;s;){if(s===t)return;s=s.parentNode}n.reset(e),n.out(e)},!1),t.addEventListener("selectstart",function(e){Guacamole.Event.DOMEvent.cancelEvent(e)},!1);function a(){o=n.touchMouseThreshold}t.addEventListener("touchmove",a,!1),t.addEventListener("touchstart",a,!1),t.addEventListener("touchend",a,!1);function r(e){var t=e.deltaY||-e.wheelDeltaY||-e.wheelDelta;if(t?e.deltaMode===1?t=e.deltaY*n.PIXELS_PER_LINE:e.deltaMode===2&&(t=e.deltaY*n.PIXELS_PER_PAGE):t=e.detail*n.PIXELS_PER_LINE,s+=t,s<=-n.scrollThreshold){do n.click(Guacamole.Mouse.State.Buttons.UP),s+=n.scrollThreshold;while(s<=-n.scrollThreshold)s=0}if(s>=n.scrollThreshold){do n.click(Guacamole.Mouse.State.Buttons.DOWN),s-=n.scrollThreshold;while(s>=n.scrollThreshold)s=0}Guacamole.Event.DOMEvent.cancelEvent(e)}t.addEventListener("DOMMouseScroll",r,!1),t.addEventListener("mousewheel",r,!1),t.addEventListener("wheel",r,!1),c=function(){var e=document.createElement("div");if(!("cursor"in e.style))return!1;try{e.style.cursor="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX///+nxBvIAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==) 0 0, auto"}catch{return!1}return/\burl\([^()]*\)\s+0\s+0\b/.test(e.style.cursor||"")}(),this.setCursor=function(e,n,s){if(c){var o=e.toDataURL("image/png");return t.style.cursor="url("+o+") "+n+" "+s+", auto",!0}return!1}},Guacamole.Mouse.State=function(t){var n=function(t,n,s,o,i,a,r){return{x:t,y:n,left:s,middle:o,right:i,up:a,down:r}};arguments.length>1?t=n.apply(this,arguments):t=t||{},Guacamole.Position.call(this,t),this.left=t.left||!1,this.middle=t.middle||!1,this.right=t.right||!1,this.up=t.up||!1,this.down=t.down||!1},Guacamole.Mouse.State.Buttons={LEFT:"left",MIDDLE:"middle",RIGHT:"right",UP:"up",DOWN:"down"},Guacamole.Mouse.Event=function(t,n,s){Guacamole.Event.DOMEvent.call(this,t,s);var o="on"+this.type;this.state=n,this.invokeLegacyHandler=function(t){t[o]&&(this.preventDefault(),this.stopPropagation(),t[o](this.state))}},Guacamole.Mouse.Event.Target=function(){Guacamole.Event.Target.call(this),this.currentState=new Guacamole.Mouse.State,this.press=function(t,n){this.currentState[t]||(this.currentState[t]=!0,this.dispatch(new Guacamole.Mouse.Event("mousedown",this.currentState,n)))},this.release=function(t,n){this.currentState[t]&&(this.currentState[t]=!1,this.dispatch(new Guacamole.Mouse.Event("mouseup",this.currentState,n)))},this.click=function(t,n){this.press(t,n),this.release(t,n)},this.move=function(t,n){(this.currentState.x!==t.x||this.currentState.y!==t.y)&&(this.currentState.x=t.x,this.currentState.y=t.y,this.dispatch(new Guacamole.Mouse.Event("mousemove",this.currentState,n)))},this.out=function(t){this.dispatch(new Guacamole.Mouse.Event("mouseout",this.currentState,t))},this.reset=function(t){for(var n in Guacamole.Mouse.State.Buttons)this.release(Guacamole.Mouse.State.Buttons[n],t)}},Guacamole.Mouse.Touchpad=function(t){Guacamole.Mouse.Event.Target.call(this);var s,o,i,a,r,c,l,d,n=this;this.scrollThreshold=20*(window.devicePixelRatio||1),this.clickTimingThreshold=250,this.clickMoveThreshold=10*(window.devicePixelRatio||1),this.currentState=new Guacamole.Mouse.State,i=0,a=0,r=0,l=0,c=0,d={1:"left",2:"right",3:"middle"},o=!1,s=null,t.addEventListener("touchend",function(e){if(e.preventDefault(),o&&e.touches.length===0){var a=(new Date).getTime(),t=d[i];n.currentState[t]&&(n.release(t,e),s&&(window.clearTimeout(s),s=null)),a-l<=n.clickTimingThreshold&&c<n.clickMoveThreshold&&(n.press(t,e),s=window.setTimeout(function(){n.release(t,e),o=!1},n.clickTimingThreshold)),s||(o=!1)}},!1),t.addEventListener("touchstart",function(e){if(e.preventDefault(),i=Math.min(e.touches.length,3),s&&(window.clearTimeout(s),s=null),!o){o=!0;var t=e.touches[0];a=t.clientX,r=t.clientY,l=(new Date).getTime(),c=0}},!1),t.addEventListener("touchmove",function(e){e.preventDefault();var s,u,h,f,o=e.touches[0],m=o.clientX-a,d=o.clientY-r;c+=Math.abs(m)+Math.abs(d),i===1?(f=c/((new Date).getTime()-l),u=1+f,s=new Guacamole.Position(n.currentState),s.x+=m*u,s.y+=d*u,s.x=Math.min(Math.max(0,s.x),t.offsetWidth-1),s.y=Math.min(Math.max(0,s.y),t.offsetHeight-1),n.move(s,e),a=o.clientX,r=o.clientY):i===2&&Math.abs(d)>=n.scrollThreshold&&(d>0?h="down":h="up",n.click(h,e),a=o.clientX,r=o.clientY)},!1)},Guacamole.Mouse.Touchscreen=function(t){Guacamole.Mouse.Event.Target.call(this);var n=this,o=!1,r=null,c=null,a=null,i=null;this.scrollThreshold=20*(window.devicePixelRatio||1),this.clickTimingThreshold=250,this.clickMoveThreshold=16*(window.devicePixelRatio||1),this.longPressThreshold=500;function l(e){var t=e.touches[0]||e.changedTouches[0],s=t.clientX-r,o=t.clientY-c;return Math.sqrt(s*s+o*o)>=n.clickMoveThreshold}function d(e){var t=e.touches[0];o=!0,r=t.clientX,c=t.clientY}function s(){window.clearTimeout(a),window.clearTimeout(i),o=!1}t.addEventListener("touchend",function(e){if(!o)return;if(e.touches.length!==0||e.changedTouches.length!==1){s();return}if(window.clearTimeout(i),n.release(Guacamole.Mouse.State.Buttons.LEFT,e),!l(e)&&(e.preventDefault(),!n.currentState.left)){var r=e.changedTouches[0];n.move(Guacamole.Position.fromClientPosition(t,r.clientX,r.clientY)),n.press(Guacamole.Mouse.State.Buttons.LEFT,e),a=window.setTimeout(function(){n.release(Guacamole.Mouse.State.Buttons.LEFT,e),s()},n.clickTimingThreshold)}},!1),t.addEventListener("touchstart",function(e){if(e.touches.length!==1){s();return}e.preventDefault(),d(e),window.clearTimeout(a),i=window.setTimeout(function(){var o=e.touches[0];n.move(Guacamole.Position.fromClientPosition(t,o.clientX,o.clientY)),n.click(Guacamole.Mouse.State.Buttons.RIGHT,e),s()},n.longPressThreshold)},!1),t.addEventListener("touchmove",function(e){if(!o)return;if(l(e)&&window.clearTimeout(i),e.touches.length!==1){s();return}if(n.currentState.left){e.preventDefault();var a=e.touches[0];n.move(Guacamole.Position.fromClientPosition(t,a.clientX,a.clientY),e)}},!1)},Guacamole=Guacamole||{},Guacamole=Guacamole||{},Guacamole.Object=function(t,n){var o=this,s={},i=function(t){var o,n=s[t];return n?(o=n.shift(),n.length===0&&delete s[t],o):null},a=function(t,n){var o=s[t];o||(o=[],s[t]=o),o.push(n)};this.index=n,this.onbody=function(t,n,s){var o=i(s);o&&o(t,n)},this.onundefine=null,this.requestInputStream=function(n,s){s&&a(n,s),t.requestObjectInputStream(o.index,n)},this.createOutputStream=function(n,s){return t.createObjectOutputStream(o.index,n,s)}},Guacamole.Object.ROOT_STREAM="/",Guacamole.Object.STREAM_INDEX_MIMETYPE="application/vnd.glyptodon.guacamole.stream-index+json",Guacamole=Guacamole||{},Guacamole.OnScreenKeyboard=function(e){var i,m,f,g,t=this,a={},r={},c=[],n=function(t,n){t.classList?t.classList.add(n):t.className+=" "+n},p=function(t,n){t.classList?t.classList.remove(n):t.className=t.className.replace(/([^ ]+)[ ]*/g,function(t,s){return s===n?"":t})},o=0,b=function(){o=t.touchMouseThreshold},l=function(t,n,s,o){this.width=n,this.height=s,this.scale=function(e){t.style.width=n*e+"px",t.style.height=s*e+"px",o&&(t.style.lineHeight=s*e+"px",t.style.fontSize=e+"px")}},v=function(t){for(var s,n=0;n<t.length;n++)if(s=t[n],!(s in a))return!1;return!0},d=function(n){var s,i,o=t.keys[n];if(!o)return null;for(s=o.length-1;s>=0;s--)if(i=o[s],v(i.requires))return i;return null},u=function(o,c){if(!r[o]){n(c,"guac-keyboard-pressed");var u,h,l=d(o);l.modifier?(h="guac-keyboard-modifier-"+i(l.modifier),u=a[l.modifier],u===void 0?(n(s,h),a[l.modifier]=l.keysym,l.keysym&&t.onkeydown&&t.onkeydown(l.keysym)):(p(s,h),delete a[l.modifier],u&&t.onkeyup&&t.onkeyup(u))):t.onkeydown&&t.onkeydown(l.keysym),r[o]=!0}},h=function(n,s){if(r[n]){p(s,"guac-keyboard-pressed");var o=d(n);!o.modifier&&t.onkeyup&&t.onkeyup(o.keysym),r[n]=!1}},s=document.createElement("div");s.className="guac-keyboard",s.onselectstart=s.onmousemove=s.onmouseup=s.onmousedown=function(t){return o&&o--,t.stopPropagation(),!1},this.touchMouseThreshold=3,this.onkeydown=null,this.onkeyup=null,this.layout=new Guacamole.OnScreenKeyboard.Layout(e),this.getElement=function(){return s},this.resize=function(e){for(var s,o=Math.floor(e*10/t.layout.width)/10,n=0;n<c.length;n++)s=c[n],s.scale(o)},m=function(t,n){if(n instanceof Array){for(var o=[],s=0;s<n.length;s++)o.push(new Guacamole.OnScreenKeyboard.Key(n[s],t));return o}return typeof n=="number"?[new Guacamole.OnScreenKeyboard.Key({name:t,keysym:n})]:typeof n=="string"?[new Guacamole.OnScreenKeyboard.Key({name:t,title:n})]:[new Guacamole.OnScreenKeyboard.Key(n,t)]},f=function(n){var s,o={};for(s in e.keys)o[s]=m(s,n[s]);return o},this.keys=f(e.keys),i=function(t){var n=t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[^A-Za-z0-9]+/g,"-").toLowerCase();return n},g=function e(s,a,r){var r,d,m,p,g,v,b,j,y,_,w,O,x,C,f=document.createElement("div");if(r&&n(f,"guac-keyboard-"+i(r)),a instanceof Array){n(f,"guac-keyboard-group");for(m=0;m<a.length;m++)e(f,a[m])}else if(a instanceof Object){n(f,"guac-keyboard-group"),y=Object.keys(a).sort();for(m=0;m<y.length;m++)r=y[m],e(f,a[r],r)}else if(typeof a=="number")n(f,"guac-keyboard-gap"),c.push(new l(f,a,a));else if(typeof a=="string"){if(g=a,g.length===1&&(g="0x"+g.charCodeAt(0).toString(16)),n(f,"guac-keyboard-key-container"),d=document.createElement("div"),d.className="guac-keyboard-key guac-keyboard-key-"+i(g),b=t.keys[a],b)for(m=0;m<b.length;m++){v=b[m],p=document.createElement("div"),p.className="guac-keyboard-cap",p.textContent=v.title;for(j=0;j<v.requires.length;j++)_=v.requires[j],n(p,"guac-keyboard-requires-"+i(_)),n(d,"guac-keyboard-uses-"+i(_));d.appendChild(p)}f.appendChild(d),c.push(new l(f,t.layout.keyWidths[a]||1,1,!0)),O=function(n){n.preventDefault(),o=t.touchMouseThreshold,u(a,d)},x=function(n){n.preventDefault(),o=t.touchMouseThreshold,h(a,d)},C=function(t){t.preventDefault(),o===0&&u(a,d)},w=function(t){t.preventDefault(),o===0&&h(a,d)},d.addEventListener("touchstart",O,!0),d.addEventListener("touchend",x,!0),d.addEventListener("mousedown",C,!0),d.addEventListener("mouseup",w,!0),d.addEventListener("mouseout",w,!0)}s.appendChild(f)},g(s,e.layout)},Guacamole.OnScreenKeyboard.Layout=function(e){this.language=e.language,this.type=e.type,this.keys=e.keys,this.layout=e.layout,this.width=e.width,this.keyWidths=e.keyWidths||{}},Guacamole.OnScreenKeyboard.Key=function(e,t){this.name=t||e.name,this.title=e.title||this.name,this.keysym=e.keysym||function(t){if(!t||t.length!==1)return null;var n=t.charCodeAt(0);return n>=0&&n<=255?n:n>=256&&n<=1114111?16777216|n:null}(this.title),this.modifier=e.modifier,this.requires=e.requires||[]},Guacamole=Guacamole||{},Guacamole.OutputStream=function(e,t){var n=this;this.index=t,this.onack=null,this.sendBlob=function(t){e.sendBlob(n.index,t)},this.sendEnd=function(){e.endStream(n.index)}},Guacamole=Guacamole||{},Guacamole.Parser=function(){var a=this,t="",i=[],n=-1,s=0,o=0,r=4096,c=65536;this.receive=function(l,d){for(d?t=l:(s>r&&n>=s&&(t=t.substring(s),n-=s,s=0),t.length?t+=l:t=l);n<t.length;){if(n>=s){var u,h,f,p,m=Guacamole.Parser.codePointCount(t,s,n);if(m<o){n+=o-m;continue}if(o&&t.codePointAt(n-1)>=c){n++;continue}if(f=t.substring(s,n),h=t.substring(n,n+1),i.push(f),h===";")p=i.shift(),a.oninstruction!==null&&a.oninstruction(p,i),i=[],n+1===t.length&&(n=-1,t="");else if(h!==",")throw new Error('Element terminator of instruction was not ";" nor ",".');s=n+1}if(u=t.indexOf(".",s),u!==-1){if(o=parseInt(t.substring(n+1,u)),isNaN(o))throw new Error("Non-numeric character in element length.");s=u+1,n=s+o}else{s=t.length;break}}},this.oninstruction=null},Guacamole.Parser.codePointCount=function(t,n,s){t=t.substring(n||0,s);var o=t.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g);return t.length-(o?o.length:0)},Guacamole.Parser.toInstruction=function(t){for(var s=function(t){var n=""+t;return Guacamole.Parser.codePointCount(n)+"."+n},o=s(t[0]),n=1;n<t.length;n++)o+=","+s(t[n]);return o+";"},Guacamole=Guacamole||{},Guacamole.Position=function(t){t=t||{},this.x=t.x||0,this.y=t.y||0,this.fromClientPosition=function(t,n,s){this.x=n-t.offsetLeft,this.y=s-t.offsetTop;for(var i,a,o=t.offsetParent;o&&o!==document.body;)this.x-=o.offsetLeft-o.scrollLeft,this.y-=o.offsetTop-o.scrollTop,o=o.offsetParent;o&&(i=document.body.scrollLeft||document.documentElement.scrollLeft,a=document.body.scrollTop||document.documentElement.scrollTop,this.x-=o.offsetLeft-i,this.y-=o.offsetTop-a)}},Guacamole.Position.fromClientPosition=function(t,n,s){var o=new Guacamole.Position;return o.fromClientPosition(t,n,s),o},Guacamole=Guacamole||{},Guacamole.RawAudioFormat=function(t){this.bytesPerSample=t.bytesPerSample,this.channels=t.channels,this.rate=t.rate},Guacamole.RawAudioFormat.parse=function(t){var n,s,o,i,r,c,d,a=null,l=1;if(t.substring(0,9)==="audio/L8;")t=t.substring(9),i=1;else if(t.substring(0,10)==="audio/L16;")t=t.substring(10),i=2;else return null;for(r=t.split(","),n=0;n<r.length;n++){if(s=r[n],o=s.indexOf("="),o===-1)return null;switch(d=s.substring(0,o),c=s.substring(o+1),d){case"channels":l=parseInt(c);break;case"rate":a=parseInt(c);break;default:return null}}return a===null?null:new Guacamole.RawAudioFormat({bytesPerSample:i,channels:l,rate:a})},Guacamole=Guacamole||{},Guacamole.SessionRecording=function(t){var i,r,u,h,g,v,j,y,C,E,S,n=this,a=null,A=262144,F=16384,M=5e3,s=[],_=0,k=new Guacamole.SessionRecording._PlaybackTunnel,l=new Guacamole.Client(k),o=-1,m=null,b=null,p=null,x=0,c=0,f=!1,d=null,w=function(t,s,o){if(f&&t===i)return;var a,r,c,l=new Guacamole.Parser;l.oninstruction=s,a=0,r=new FileReader,c=function(){if(f&&t===i)return;if(r.readyState===2)try{l.receive(r.result)}catch(e){n.onerror&&n.onerror(e.message);return}if(a>=t.size)o&&o();else{var s=t.slice(a,a+A);a+=s.size,r.readAsText(s)}},r.onload=c,c()},O=function(t){for(var n=t.length,s=n+3;n>=10;)s++,n=Math.floor(n/10);return s};l.connect(),l.getDisplay().showCursor(!1),v=function(t,o){c+=O(t);for(var a,r,i=0;i<o.length;i++)c+=O(o[i]);t==="sync"&&(a=parseInt(o[0]),r=new Guacamole.SessionRecording._Frame(a,x,c),s.push(r),x=c,(s.length===1||c-s[_].start>=F&&a-s[_].timestamp>=M)&&(r.keyframe=!0,_=s.length-1),n.onprogress&&n.onprogress(n.getDuration(),c))},g=function(){n.onload&&n.onload()},t instanceof Blob?(i=t,w(i,v,g)):(a=t,i=new Blob,y=!1,r="",a.oninstruction=function(t,n){r+=t.length+"."+t,n.forEach(function(t){r+=","+t.length+"."+t}),r+=";",r.length>=A&&(i=new Blob([i,r]),r=""),v(t,n)},a.onerror=function(t){y=!0,n.onerror&&n.onerror(t.message)},a.onstatechange=function(t){t===Guacamole.Tunnel.State.CLOSED&&(r.length&&(i=new Blob([i,r]),r=""),y||g())}),u=function(t){return s.length===0?0:t-s[0].timestamp},C=function e(t,n,o){if(t===n)return t;var i=Math.floor((t+n)/2),a=u(s[i].timestamp);return o<a&&i>t?e(t,i-1,o):o>a&&i<n?e(i+1,n,o):i},E=function(t,n){var a=s[t];w(i.slice(a.start,a.end),function(t,n){k.receiveInstruction(t,n)},function(){a.keyframe&&!a.clientState&&l.exportState(function(t){a.clientState=new Blob([JSON.stringify(t)])}),o=t,n&&n()})},j=function(t,i,a){h();for(var c,f=p={aborted:!1},r=t,d=function e(){if(n.onseek&&o>r&&n.onseek(u(s[o].timestamp),o-r,t-r),f.aborted)return;o<t?E(o+1,e):i()},m=function(){var t=a?Math.max(a-(new Date).getTime(),0):0;t?window.setTimeout(d,t):d()};r>=0;r--){if(c=s[r],r===o)break;if(c.clientState){c.clientState.text().then(function(t){l.importState(JSON.parse(t)),o=r,m()});return}}m()},h=function(){p&&(p.aborted=!0,p=null)},S=function e(){if(o+1<s.length){var t=s[o+1],i=t.timestamp-m+b;j(o+1,function(){e()},i)}else n.pause()},this.onload=null,this.onerror=null,this.onabort=null,this.onprogress=null,this.onplay=null,this.onpause=null,this.onseek=null,this.connect=function(t){a&&a.connect(t)},this.disconnect=function(){a&&a.disconnect()},this.abort=function(){f||(f=!0,n.onabort&&n.onabort(),a&&a.disconnect())},this.getDisplay=function(){return l.getDisplay()},this.isPlaying=function(){return!!m},this.getPosition=function(){return o===-1?0:u(s[o].timestamp)},this.getDuration=function(){return s.length===0?0:u(s[s.length-1].timestamp)},this.play=function(){if(!n.isPlaying()&&o+1<s.length){n.onplay&&n.onplay();var t=s[o+1];m=t.timestamp,b=(new Date).getTime(),S()}},this.seek=function(t,o){if(s.length===0)return;n.cancel();var i=n.isPlaying();n.pause(),d=function(){d=null,i&&(n.play(),i=null),o&&o()},j(C(0,s.length-1,t),d)},this.cancel=function(){d&&(h(),d())},this.pause=function(){h(),n.isPlaying()&&(n.onpause&&n.onpause(),m=null,b=null)}},Guacamole.SessionRecording._Frame=function(t,n,s){this.keyframe=!1,this.timestamp=t,this.start=n,this.end=s,this.clientState=null},Guacamole.SessionRecording._PlaybackTunnel=function(){var t=this;this.connect=function(){},this.sendMessage=function(){},this.disconnect=function(){},this.receiveInstruction=function(n,s){t.oninstruction&&t.oninstruction(n,s)}},Guacamole=Guacamole||{},Guacamole.Status=function(e,t){var n=this;this.code=e,this.message=t,this.isError=function(){return n.code<0||n.code>255}},Guacamole.Status.Code={SUCCESS:0,UNSUPPORTED:256,SERVER_ERROR:512,SERVER_BUSY:513,UPSTREAM_TIMEOUT:514,UPSTREAM_ERROR:515,RESOURCE_NOT_FOUND:516,RESOURCE_CONFLICT:517,RESOURCE_CLOSED:518,UPSTREAM_NOT_FOUND:519,UPSTREAM_UNAVAILABLE:520,SESSION_CONFLICT:521,SESSION_TIMEOUT:522,SESSION_CLOSED:523,CLIENT_BAD_REQUEST:768,CLIENT_UNAUTHORIZED:769,CLIENT_FORBIDDEN:771,CLIENT_TIMEOUT:776,CLIENT_OVERRUN:781,CLIENT_BAD_TYPE:783,CLIENT_TOO_MANY:797},Guacamole.Status.Code.fromHTTPCode=function(t){switch(t){case 400:return Guacamole.Status.Code.CLIENT_BAD_REQUEST;case 403:return Guacamole.Status.Code.CLIENT_FORBIDDEN;case 404:return Guacamole.Status.Code.RESOURCE_NOT_FOUND;case 429:return Guacamole.Status.Code.CLIENT_TOO_MANY;case 503:return Guacamole.Status.Code.SERVER_BUSY}return Guacamole.Status.Code.SERVER_ERROR},Guacamole.Status.Code.fromWebSocketCode=function(t){switch(t){case 1e3:return Guacamole.Status.Code.SUCCESS;case 1006:case 1015:return Guacamole.Status.Code.UPSTREAM_NOT_FOUND;case 1001:case 1012:case 1013:case 1014:return Guacamole.Status.Code.UPSTREAM_UNAVAILABLE}return Guacamole.Status.Code.SERVER_ERROR},Guacamole=Guacamole||{},Guacamole.StringReader=function(e){var t=this,s=new Guacamole.UTF8Parser,n=new Guacamole.ArrayBufferReader(e);n.ondata=function(e){var n=s.decode(e);t.ontext&&t.ontext(n)},n.onend=function(){t.onend&&t.onend()},this.ontext=null,this.onend=null},Guacamole=Guacamole||{},Guacamole.StringWriter=function(e){var o=this,s=new Guacamole.ArrayBufferWriter(e),n=new Uint8Array(8192),t=0;s.onack=function(e){o.onack&&o.onack(e)};function a(e){if(t+e>=n.length){var s=new Uint8Array((t+e)*2);s.set(n),n=s}t+=e}function i(e){if(e<=127)o=0,s=1;else if(e<=2047)o=192,s=2;else if(e<=65535)o=224,s=3;else if(e<=2097151)o=240,s=4;else{i(65533);return}a(s);for(var s,o,r=t-1,c=1;c<s;c++)n[r--]=128|e&63,e>>=6;n[r]=o|e}function r(e){for(var o,a,s=0;s<e.length;s++)o=e.charCodeAt(s),i(o);if(t>0)return a=n.subarray(0,t),t=0,a}this.sendText=function(e){e.length&&s.sendData(r(e))},this.sendEnd=function(){s.sendEnd()},this.onack=null},Guacamole=Guacamole||{},Guacamole.Touch=function(t){Guacamole.Event.Target.call(this);var n=this,s=Math.floor(16*window.devicePixelRatio);this.touches={},this.activeTouches=0,t.addEventListener("touchstart",function(o){for(var i,a,c,r=0;r<o.changedTouches.length;r++){if(i=o.changedTouches[r],a=i.identifier,n.touches[a])continue;c=n.touches[a]=new Guacamole.Touch.State({id:a,radiusX:i.radiusX||s,radiusY:i.radiusY||s,angle:i.angle||0,force:i.force||1}),n.activeTouches++,c.fromClientPosition(t,i.clientX,i.clientY),n.dispatch(new Guacamole.Touch.Event("touchmove",o,c))}},!1),t.addEventListener("touchmove",function(o){for(var i,a,c,r=0;r<o.changedTouches.length;r++){if(i=o.changedTouches[r],c=i.identifier,a=n.touches[c],!a)continue;i.force&&(a.force=i.force),a.angle=i.angle||0,a.radiusX=i.radiusX||s,a.radiusY=i.radiusY||s,a.fromClientPosition(t,i.clientX,i.clientY),n.dispatch(new Guacamole.Touch.Event("touchmove",o,a))}},!1),t.addEventListener("touchend",function(s){for(var o,i,r,a=0;a<s.changedTouches.length;a++){if(i=s.changedTouches[a],r=i.identifier,o=n.touches[r],!o)continue;delete n.touches[r],n.activeTouches--,o.force=0,o.fromClientPosition(t,i.clientX,i.clientY),n.dispatch(new Guacamole.Touch.Event("touchend",s,o))}},!1)},Guacamole.Touch.State=function(t){t=t||{},Guacamole.Position.call(this,t),this.id=t.id||0,this.radiusX=t.radiusX||0,this.radiusY=t.radiusY||0,this.angle=t.angle||0,this.force=t.force||1},Guacamole.Touch.Event=function(t,n,s){Guacamole.Event.DOMEvent.call(this,t,[n]),this.state=s},Guacamole=Guacamole||{},Guacamole.Tunnel=function(){this.connect=function(){},this.disconnect=function(){},this.sendMessage=function(){},this.setState=function(e){e!==this.state&&(this.state=e,this.onstatechange&&this.onstatechange(e))},this.setUUID=function(t){this.uuid=t,this.onuuid&&this.onuuid(t)},this.isConnected=function(){return this.state===Guacamole.Tunnel.State.OPEN||this.state===Guacamole.Tunnel.State.UNSTABLE},this.state=Guacamole.Tunnel.State.CLOSED,this.receiveTimeout=15e3,this.unstableThreshold=1500,this.uuid=null,this.onuuid=null,this.onerror=null,this.onstatechange=null,this.oninstruction=null},Guacamole.Tunnel.INTERNAL_DATA_OPCODE="",Guacamole.Tunnel.State={CONNECTING:0,OPEN:1,CLOSED:2,UNSTABLE:3},Guacamole.HTTPTunnel=function(e,t,n){var i,_,s=this,k=e+"?connect",E=e+"?read:",x=e+"?write:",u=1,O=0,l=u,c=!1,r="",h=!!t,m=null,f=null,j=null,C=500,v=n||{},d="Guacamole-Tunnel-Token",a=null;function g(e,t){for(var n in t)e.setRequestHeader(n,t[n])}i=function(){window.clearTimeout(m),window.clearTimeout(f),s.state===Guacamole.Tunnel.State.UNSTABLE&&s.setState(Guacamole.Tunnel.State.OPEN),m=window.setTimeout(function(){o(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT,"Server timeout."))},s.receiveTimeout),f=window.setTimeout(function(){s.setState(Guacamole.Tunnel.State.UNSTABLE)},s.unstableThreshold)};function o(e){if(window.clearTimeout(m),window.clearTimeout(f),window.clearInterval(j),s.state===Guacamole.Tunnel.State.CLOSED)return;e.code!==Guacamole.Status.Code.SUCCESS&&s.onerror&&(s.state===Guacamole.Tunnel.State.CONNECTING||e.code!==Guacamole.Status.Code.RESOURCE_NOT_FOUND)&&s.onerror(e),c=!1,s.setState(Guacamole.Tunnel.State.CLOSED)}this.sendMessage=function(){if(!s.isConnected())return;if(!arguments.length)return;r+=Guacamole.Parser.toInstruction(arguments),c||b()};function b(){if(!s.isConnected())return;if(r.length>0){c=!0;var e=new XMLHttpRequest;e.open("POST",x+s.uuid),e.withCredentials=h,g(e,v),e.setRequestHeader("Content-type","application/octet-stream"),e.setRequestHeader(d,a),e.onreadystatechange=function(){e.readyState===4&&(i(),e.status!==200?p(e):b())},e.send(r),r=""}else c=!1}function p(e){var n,t=parseInt(e.getResponseHeader("Guacamole-Status-Code"));t?(n=e.getResponseHeader("Guacamole-Error-Message"),o(new Guacamole.Status(t,n))):o(e.status?new Guacamole.Status(Guacamole.Status.Code.fromHTTPCode(e.status),e.statusText):new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_NOT_FOUND))}function y(e){var t=null,a=null,c=0,r=new Guacamole.Parser;r.oninstruction=function n(o,i){o===Guacamole.Tunnel.INTERNAL_DATA_OPCODE&&i.length===0?(r=new Guacamole.Parser,r.oninstruction=n,t&&clearInterval(t),e.onreadystatechange=null,e.abort(),a&&y(a)):o!==Guacamole.Tunnel.INTERNAL_DATA_OPCODE&&s.oninstruction&&s.oninstruction(o,i)};function n(){if(!s.isConnected()){t!==null&&clearInterval(t);return}if(e.readyState<2)return;var c,d;try{c=e.status}catch{c=200}if(!a&&c===200&&(a=w()),e.readyState===3||e.readyState===4){if(i(),l===u&&(e.readyState===3&&!t?t=setInterval(n,30):e.readyState===4&&t&&clearInterval(t)),e.status===0){s.disconnect();return}if(e.status!==200){p(e);return}try{d=e.responseText}catch{return}try{r.receive(d,!0)}catch(e){o(new Guacamole.Status(Guacamole.Status.Code.SERVER_ERROR,e.message));return}}}l===u?e.onreadystatechange=function(){e.readyState===3&&(c++,c>=2&&(l=O,e.onreadystatechange=n)),n()}:e.onreadystatechange=n,n()}_=0;function w(){var e=new XMLHttpRequest;return e.open("GET",E+s.uuid+":"+_++),e.setRequestHeader(d,a),e.withCredentials=h,g(e,v),e.send(null),e}this.connect=function(e){i(),s.setState(Guacamole.Tunnel.State.CONNECTING);var t=new XMLHttpRequest;t.onreadystatechange=function(){if(t.readyState!==4)return;if(t.status!==200){p(t);return}if(i(),s.setUUID(t.responseText),a=t.getResponseHeader(d),!a){o(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_NOT_FOUND));return}s.setState(Guacamole.Tunnel.State.OPEN),j=setInterval(function(){s.sendMessage("nop")},C),y(w())},t.open("POST",k,!0),t.withCredentials=h,g(t,v),t.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),t.send(e)},this.disconnect=function(){o(new Guacamole.Status(Guacamole.Status.Code.SUCCESS,"Manually closed."))}},Guacamole.HTTPTunnel.prototype=new Guacamole.Tunnel,Guacamole.WebSocketTunnel=function(e){var o,i,c,h,m,t=this,d=null,s=null,l=null,r=null,a=null,f={"http:":"ws:","https:":"wss:"},p=500,u=0;e.substring(0,3)!=="ws:"&&e.substring(0,4)!=="wss:"&&(i=f[window.location.protocol],e.substring(0,1)==="/"?e=i+"//"+window.location.host+e:(h=window.location.pathname.lastIndexOf("/"),m=window.location.pathname.substring(0,h+1),e=i+"//"+window.location.host+m+e)),c=function(){var n=(new Date).getTime();t.sendMessage(Guacamole.Tunnel.INTERNAL_DATA_OPCODE,"ping",n),u=n},o=function(){window.clearTimeout(l),window.clearTimeout(r),window.clearTimeout(a),t.state===Guacamole.Tunnel.State.UNSTABLE&&t.setState(Guacamole.Tunnel.State.OPEN),l=window.setTimeout(function(){n(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT,"Server timeout."))},t.receiveTimeout),r=window.setTimeout(function(){t.setState(Guacamole.Tunnel.State.UNSTABLE)},t.unstableThreshold);var o=(new Date).getTime(),s=Math.max(u+p-o,0);s>0?a=window.setTimeout(c,s):c()};function n(e){if(window.clearTimeout(l),window.clearTimeout(r),window.clearTimeout(a),t.state===Guacamole.Tunnel.State.CLOSED)return;e.code!==Guacamole.Status.Code.SUCCESS&&t.onerror&&t.onerror(e),t.setState(Guacamole.Tunnel.State.CLOSED),s.close()}this.sendMessage=function(){if(!t.isConnected())return;if(!arguments.length)return;s.send(Guacamole.Parser.toInstruction(arguments))},this.connect=function(i){o(),t.setState(Guacamole.Tunnel.State.CONNECTING),d=new Guacamole.Parser,d.oninstruction=function(n,s){t.uuid===null&&(n===Guacamole.Tunnel.INTERNAL_DATA_OPCODE&&s.length===1&&t.setUUID(s[0]),t.setState(Guacamole.Tunnel.State.OPEN)),n!==Guacamole.Tunnel.INTERNAL_DATA_OPCODE&&t.oninstruction&&t.oninstruction(n,s)},s=new WebSocket(e+"?"+i,"guacamole"),s.onopen=function(){o()},s.onclose=function(e){e.reason?n(new Guacamole.Status(parseInt(e.reason),e.reason)):n(e.code?new Guacamole.Status(Guacamole.Status.Code.fromWebSocketCode(e.code)):new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_NOT_FOUND))},s.onmessage=function(e){o();try{d.receive(e.data)}catch(e){n(new Guacamole.Status(Guacamole.Status.Code.SERVER_ERROR,e.message))}}},this.disconnect=function(){n(new Guacamole.Status(Guacamole.Status.Code.SUCCESS,"Manually closed."))}},Guacamole.WebSocketTunnel.prototype=new Guacamole.Tunnel,Guacamole.ChainedTunnel=function(){for(var i,t=this,n=[],s=null,o=0;o<arguments.length;o++)n.push(arguments[o]);function a(e){t.disconnect=e.disconnect,t.sendMessage=e.sendMessage;var o=function(s){if(s&&s.code===Guacamole.Status.Code.UPSTREAM_TIMEOUT)return n=[],null;var o=n.shift();return o&&(e.onerror=null,e.oninstruction=null,e.onstatechange=null,a(o)),o};function r(){e.onstatechange=t.onstatechange,e.oninstruction=t.oninstruction,e.onerror=t.onerror,e.uuid&&t.setUUID(e.uuid),e.onuuid=function(n){t.setUUID(n)},s=e}e.onstatechange=function(e){switch(e){case Guacamole.Tunnel.State.OPEN:r(),t.onstatechange&&t.onstatechange(e);break;case Guacamole.Tunnel.State.CLOSED:!o()&&t.onstatechange&&t.onstatechange(e);break}},e.oninstruction=function(e,n){r(),t.oninstruction&&t.oninstruction(e,n)},e.onerror=function(e){!o(e)&&t.onerror&&t.onerror(e)},e.connect(i)}this.connect=function(e){i=e;var o=s||n.shift();o?a(o):t.onerror&&t.onerror(Guacamole.Status.Code.SERVER_ERROR,"No tunnels to try.")}},Guacamole.ChainedTunnel.prototype=new Guacamole.Tunnel,Guacamole.StaticHTTPTunnel=function(t,n,s){var o=this,i=null,a=s||{};this.size=null,this.sendMessage=function(){},this.connect=function(){o.disconnect(),o.setState(Guacamole.Tunnel.State.CONNECTING);var r=new Guacamole.Parser,c=new Guacamole.UTF8Parser;r.oninstruction=function(t,n){o.oninstruction&&o.oninstruction(t,n)},i=new AbortController,fetch(t,{headers:a,credentials:n?"include":"same-origin",signal:i.signal}).then(function(t){if(!t.ok){o.onerror&&o.onerror(new Guacamole.Status(Guacamole.Status.Code.fromHTTPCode(t.status),t.statusText)),o.disconnect();return}o.size=t.headers.get("Content-Length"),o.setState(Guacamole.Tunnel.State.OPEN);var n=t.body.getReader(),s=function e(t){if(t.done){o.disconnect();return}r.receive(c.decode(t.value)),n.read().then(e)};n.read().then(s)})},this.disconnect=function(){i&&(i.abort(),i=null),o.setState(Guacamole.Tunnel.State.CLOSED)}},Guacamole.StaticHTTPTunnel.prototype=new Guacamole.Tunnel,Guacamole=Guacamole||{},Guacamole.UTF8Parser=function(){var t=0,n=0;this.decode=function(s){for(var o,i="",r=new Uint8Array(s),a=0;a<r.length;a++)o=r[a],t===0?(o|127)===127?i+=String.fromCharCode(o):(o|31)===223?(n=o&31,t=1):(o|15)===239?(n=o&15,t=2):(o|7)===247?(n=o&7,t=3):i+="�":(o|63)===191?(n=n<<6|o&63,t--,t===0&&(i+=String.fromCharCode(n))):(t=0,i+="�");return i}},Guacamole=Guacamole||{},Guacamole.API_VERSION="1.5.3",Guacamole=Guacamole||{},Guacamole.VideoPlayer=function(){this.sync=function(){}},Guacamole.VideoPlayer.isSupportedType=function(){return!1},Guacamole.VideoPlayer.getSupportedTypes=function(){return[]},Guacamole.VideoPlayer.getInstance=function(){return null},module.exports=Guacamole